mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 09:34:56 +08:00
GP-2914 fixed issue with snapshot listing colors. Also, cleaned up color usage in FieldFactories
This commit is contained in:
+3
-1
@@ -20,6 +20,7 @@ import java.math.BigInteger;
|
|||||||
import docking.widgets.fieldpanel.field.AttributedString;
|
import docking.widgets.fieldpanel.field.AttributedString;
|
||||||
import docking.widgets.fieldpanel.field.TextFieldElement;
|
import docking.widgets.fieldpanel.field.TextFieldElement;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.field.*;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
@@ -42,6 +43,7 @@ import ghidra.taint.model.TaintVec;
|
|||||||
*/
|
*/
|
||||||
public class TaintFieldFactory extends FieldFactory {
|
public class TaintFieldFactory extends FieldFactory {
|
||||||
public static final String PROPERTY_NAME = TaintTracePcodeExecutorStatePiece.NAME;
|
public static final String PROPERTY_NAME = TaintTracePcodeExecutorStatePiece.NAME;
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.taint");
|
||||||
public static final String FIELD_NAME = "Taint";
|
public static final String FIELD_NAME = "Taint";
|
||||||
|
|
||||||
public TaintFieldFactory() {
|
public TaintFieldFactory() {
|
||||||
@@ -90,7 +92,7 @@ public class TaintFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy,
|
return ListingTextField.createSingleLineTextField(this, proxy,
|
||||||
new TextFieldElement(new AttributedString(vec.toDisplay(), color, getMetrics()), 0, 0),
|
new TextFieldElement(new AttributedString(vec.toDisplay(), COLOR, getMetrics()), 0, 0),
|
||||||
startX + varWidth, width, hlProvider);
|
startX + varWidth, width, hlProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-8
@@ -21,8 +21,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.field.*;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
@@ -35,6 +35,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
import ghidra.util.classfinder.ClassSearcher;
|
import ghidra.util.classfinder.ClassSearcher;
|
||||||
|
|
||||||
public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.disassembly.external");
|
||||||
|
|
||||||
private static List<ExternalDisassembler> availableDisassemblers;
|
private static List<ExternalDisassembler> availableDisassemblers;
|
||||||
|
|
||||||
@@ -65,12 +66,6 @@ public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
|||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// have no options
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||||
return (category == FieldFormatModel.INSTRUCTION_OR_DATA);
|
return (category == FieldFormatModel.INSTRUCTION_OR_DATA);
|
||||||
@@ -131,7 +126,7 @@ public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
|||||||
if (disassembly == null) {
|
if (disassembly == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AttributedString text = new AttributedString(disassembly, Palette.BLACK, getMetrics());
|
AttributedString text = new AttributedString(disassembly, COLOR, getMetrics());
|
||||||
FieldElement fieldElement = new TextFieldElement(text, 0, 0);
|
FieldElement fieldElement = new TextFieldElement(text, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
||||||
startX + varWidth, width, hlProvider);
|
startX + varWidth, width, hlProvider);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.field.*;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
@@ -34,6 +35,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
|
|
||||||
public class EntropyFieldFactory extends FieldFactory {
|
public class EntropyFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Entropy";
|
public static final String FIELD_NAME = "Entropy";
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.bytes.entropy");
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,19 +82,19 @@ public class EntropyFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
entropy = calcEntropy(bytes, 0, bytes.length);
|
entropy = calcEntropy(bytes, 0, bytes.length);
|
||||||
float[] hsbvals = Color.RGBtoHSB(255, 0, 0, null);
|
float[] hsbvals = Color.RGBtoHSB(255, 0, 0, null);
|
||||||
color =
|
Color color =
|
||||||
Color.getHSBColor(hsbvals[0], hsbvals[1], (float) (hsbvals[1] * (entropy / 8.0)));
|
Color.getHSBColor(hsbvals[0], hsbvals[1], (float) (hsbvals[1] * (entropy / 8.0)));
|
||||||
|
String str = "" + (int) ((entropy / 8.0) * 100);
|
||||||
|
AttributedString text = new AttributedString(str, color, getMetrics());
|
||||||
|
|
||||||
|
FieldElement fieldElement = new TextFieldElement(text, 0, 0);
|
||||||
|
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
||||||
|
startX + varWidth, width, hlProvider);
|
||||||
}
|
}
|
||||||
catch (MemoryAccessException e) {
|
catch (MemoryAccessException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = "" + (int) ((entropy / 8.0) * 100);
|
|
||||||
AttributedString text = new AttributedString(str, color, getMetrics());
|
|
||||||
|
|
||||||
FieldElement fieldElement = new TextFieldElement(text, 0, 0);
|
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
|
||||||
startX + varWidth, width, hlProvider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double calcEntropy(byte[] b, int start, int len) {
|
private double calcEntropy(byte[] b, int start, int len) {
|
||||||
@@ -153,8 +155,8 @@ public class EntropyFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel myModel, HighlightProvider myHlProvider,
|
public FieldFactory newInstance(FieldFormatModel myModel, HighlightProvider myHlProvider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions displayOptions1, ToolOptions fieldOptions) {
|
||||||
return new EntropyFieldFactory(myModel, myHlProvider, displayOptions, fieldOptions);
|
return new EntropyFieldFactory(myModel, myHlProvider, displayOptions1, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,10 @@ color.cursor.focused.listing = color.cursor.focused
|
|||||||
color.cursor.unfocused.listing = color.cursor.unfocused
|
color.cursor.unfocused.listing = color.cursor.unfocused
|
||||||
|
|
||||||
color.fg.listing.address = color.fg
|
color.fg.listing.address = color.fg
|
||||||
color.fg.listing.ref.bad = red
|
|
||||||
color.fg.listing.bytes = blue
|
color.fg.listing.bytes = blue
|
||||||
color.fg.listing.constant = green
|
color.fg.listing.constant = green
|
||||||
color.fg.listing.label.unreferenced = black
|
color.fg.listing.label.unreferenced = black
|
||||||
color.fg.listing.entrypoint = magenta
|
color.fg.listing.ext.entrypoint = magenta
|
||||||
color.fg.listing.comment.auto = lightGray
|
color.fg.listing.comment.auto = lightGray
|
||||||
color.fg.listing.comment.eol = blue
|
color.fg.listing.comment.eol = blue
|
||||||
color.fg.listing.comment.repeatable = darkOrange
|
color.fg.listing.comment.repeatable = darkOrange
|
||||||
@@ -34,7 +33,9 @@ color.fg.listing.comment.ref.repeatable = cornflowerBlue
|
|||||||
color.fg.listing.comment.plate = gray
|
color.fg.listing.comment.plate = gray
|
||||||
color.fg.listing.comment.post = blue
|
color.fg.listing.comment.post = blue
|
||||||
color.fg.listing.comment.pre = indigo
|
color.fg.listing.comment.pre = indigo
|
||||||
color.fg.listing.ref.ext.resolved = teal
|
color.fg.listing.ref.bad = red
|
||||||
|
color.fg.listing.ext.ref.unresolved = color.fg.listing.ref.bad
|
||||||
|
color.fg.listing.ext.ref.resolved = teal
|
||||||
color.fg.listing.fieldname = color.fg
|
color.fg.listing.fieldname = color.fg
|
||||||
color.fg.listing.function.callfixup = fuchsia
|
color.fg.listing.function.callfixup = fuchsia
|
||||||
color.fg.listing.function.name = blue
|
color.fg.listing.function.name = blue
|
||||||
@@ -44,20 +45,33 @@ color.fg.listing.function.param.auto = gray
|
|||||||
color.fg.listing.function.return.type = black
|
color.fg.listing.function.return.type = black
|
||||||
color.fg.listing.function.param.custom = indigo
|
color.fg.listing.function.param.custom = indigo
|
||||||
color.fg.listing.function.param.dynamic = #006666
|
color.fg.listing.function.param.dynamic = #006666
|
||||||
|
color.fg.listing.function.variable = purple
|
||||||
|
color.fg.listing.function.variable.assigned = purple
|
||||||
|
color.fg.listing.function.name.thunk = color.fg.listing.function.name
|
||||||
|
|
||||||
color.fg.listing.label.local = green
|
color.fg.listing.label.local = green
|
||||||
color.fg.listing.label.non.primary = olive
|
color.fg.listing.label.non.primary = olive
|
||||||
color.fg.listing.label.primary = darkBlue
|
color.fg.listing.label.primary = darkBlue
|
||||||
color.fg.listing.mnemonic.override = deepPink
|
color.fg.listing.mnemonic.override = deepPink
|
||||||
color.fg.listing.mnemonic = navy
|
color.fg.listing.mnemonic = navy
|
||||||
color.fg.listing.mnemonic.unimplemented = navy
|
color.fg.listing.mnemonic.unimplemented = navy
|
||||||
|
color.fg.listing.array.values = color.fg
|
||||||
|
color.fg.listing.bytes.alignment = gray
|
||||||
|
color.fg.listing.bytes.entropy = color.fg
|
||||||
|
color.fg.listing.disassembly.external = color.fg
|
||||||
|
color.fg.listing.file.offset = color.fg
|
||||||
|
color.fg.listing.function.purge = blue
|
||||||
|
color.fg.listing.function.source = color.fg
|
||||||
|
color.fg.listing.mask.bits = navy
|
||||||
|
color.fg.listing.mask.value = green
|
||||||
|
color.fg.listing.mask.label = color.fg
|
||||||
|
color.fg.listing.block.start = indigo
|
||||||
|
color.fg.listing.instruction.parallel = blue
|
||||||
|
|
||||||
// TODO
|
|
||||||
color.fg.listing.flow.arrow.inactive = lightGray
|
color.fg.listing.flow.arrow.inactive = lightGray
|
||||||
color.fg.listing.flow.arrow.active = color.fg
|
color.fg.listing.flow.arrow.active = color.fg
|
||||||
color.fg.listing.flow.arrow.selected = limeGreen
|
color.fg.listing.flow.arrow.selected = limeGreen
|
||||||
color.fg.listing.separator = color.fg
|
color.fg.listing.separator = color.fg
|
||||||
color.fg.listing.variable = purple
|
|
||||||
color.fg.listing.version.tracking = purple
|
|
||||||
color.fg.listing.xref = darkGreen
|
color.fg.listing.xref = darkGreen
|
||||||
color.fg.listing.xref.offcut = gray
|
color.fg.listing.xref.offcut = gray
|
||||||
color.fg.listing.xref.read = blue
|
color.fg.listing.xref.read = blue
|
||||||
@@ -66,10 +80,13 @@ color.fg.listing.xref.other = color.fg
|
|||||||
color.fg.listing.register = olive
|
color.fg.listing.register = olive
|
||||||
color.fg.listing.underline = cornflowerBlue
|
color.fg.listing.underline = cornflowerBlue
|
||||||
color.fg.listing.pcode.label = blue
|
color.fg.listing.pcode.label = blue
|
||||||
color.fg.listing.pcode.space = blue
|
color.fg.listing.pcode.address.space = blue
|
||||||
color.fg.listing.pcode.varnode = blue
|
color.fg.listing.pcode.varnode = blue
|
||||||
color.fg.listing.pcode.userop = blue
|
color.fg.listing.pcode.userop = blue
|
||||||
|
|
||||||
|
color.fg.listing.stack.depth = blue
|
||||||
|
color.fg.listing.taint = color.fg
|
||||||
|
|
||||||
color.bg.listing.comparison.bytes = chartreuse
|
color.bg.listing.comparison.bytes = chartreuse
|
||||||
color.bg.listing.comparison.mnemonic = chartreuse
|
color.bg.listing.comparison.mnemonic = chartreuse
|
||||||
color.bg.listing.comparison.operand = chartreuse
|
color.bg.listing.comparison.operand = chartreuse
|
||||||
@@ -97,10 +114,8 @@ color.fg.listing.header.active.field = black
|
|||||||
|
|
||||||
|
|
||||||
color.fg.listing.address = color.fg
|
color.fg.listing.address = color.fg
|
||||||
color.fg.listing.ref.bad = color.palette.red
|
|
||||||
color.fg.listing.bytes = color.palette.blue
|
color.fg.listing.bytes = color.palette.blue
|
||||||
color.fg.listing.constant = color.palette.green
|
color.fg.listing.constant = color.palette.green
|
||||||
color.fg.listing.label.unreferenced = color.fg
|
|
||||||
color.fg.listing.entrypoint = color.palette.magenta
|
color.fg.listing.entrypoint = color.palette.magenta
|
||||||
color.fg.listing.comment.auto = color.fg
|
color.fg.listing.comment.auto = color.fg
|
||||||
color.fg.listing.comment.eol = color.palette.blue
|
color.fg.listing.comment.eol = color.palette.blue
|
||||||
@@ -109,7 +124,7 @@ color.fg.listing.comment.ref.repeatable = color.palette.darkcyan
|
|||||||
color.fg.listing.comment.plate = gray
|
color.fg.listing.comment.plate = gray
|
||||||
color.fg.listing.comment.post = color.palette.blue
|
color.fg.listing.comment.post = color.palette.blue
|
||||||
color.fg.listing.comment.pre = color.palette.indigo
|
color.fg.listing.comment.pre = color.palette.indigo
|
||||||
color.fg.listing.ref.ext.resolved = color.palette.teal
|
color.fg.listing.ref.resolved = color.palette.teal
|
||||||
color.fg.listing.fieldname = color.fg
|
color.fg.listing.fieldname = color.fg
|
||||||
color.fg.listing.function.callfixup = color.palette.magenta
|
color.fg.listing.function.callfixup = color.palette.magenta
|
||||||
color.fg.listing.function.name = color.palette.blue
|
color.fg.listing.function.name = color.palette.blue
|
||||||
@@ -119,9 +134,12 @@ color.fg.listing.function.param.auto = gray
|
|||||||
color.fg.listing.function.return.type = color.fg
|
color.fg.listing.function.return.type = color.fg
|
||||||
color.fg.listing.function.param.custom = color.palette.indigo
|
color.fg.listing.function.param.custom = color.palette.indigo
|
||||||
color.fg.listing.function.param.dynamic = color.palette.teal
|
color.fg.listing.function.param.dynamic = color.palette.teal
|
||||||
|
color.fg.listing.function.variable = color.palette.purple
|
||||||
|
color.fg.listing.function.variable.assigned = color.palette.purple
|
||||||
color.fg.listing.label.local = color.palette.green
|
color.fg.listing.label.local = color.palette.green
|
||||||
color.fg.listing.label.non.primary = color.palette.olive
|
color.fg.listing.label.non.primary = color.palette.olive
|
||||||
color.fg.listing.label.primary = color.palette.cyan
|
color.fg.listing.label.primary = color.palette.cyan
|
||||||
|
color.fg.listing.label.unreferenced = color.fg
|
||||||
color.fg.listing.mnemonic.override = color.palette.pink
|
color.fg.listing.mnemonic.override = color.palette.pink
|
||||||
color.fg.listing.mnemonic = color.palette.cyan
|
color.fg.listing.mnemonic = color.palette.cyan
|
||||||
color.fg.listing.mnemonic.unimplemented = color.palette.cyan
|
color.fg.listing.mnemonic.unimplemented = color.palette.cyan
|
||||||
@@ -131,7 +149,6 @@ color.fg.listing.flow.arrow.inactive = lightGray
|
|||||||
color.fg.listing.flow.arrow.active = color.fg
|
color.fg.listing.flow.arrow.active = color.fg
|
||||||
color.fg.listing.flow.arrow.selected = limeGreen
|
color.fg.listing.flow.arrow.selected = limeGreen
|
||||||
color.fg.listing.separator = color.fg
|
color.fg.listing.separator = color.fg
|
||||||
color.fg.listing.variable = color.palette.purple
|
|
||||||
color.fg.listing.version.tracking = color.palette.purple
|
color.fg.listing.version.tracking = color.palette.purple
|
||||||
color.fg.listing.xref = color.palette.darkgreen
|
color.fg.listing.xref = color.palette.darkgreen
|
||||||
color.fg.listing.xref.offcut = gray
|
color.fg.listing.xref.offcut = gray
|
||||||
@@ -141,6 +158,6 @@ color.fg.listing.xref.other = color.fg
|
|||||||
color.fg.listing.register = color.palette.olive
|
color.fg.listing.register = color.palette.olive
|
||||||
color.fg.listing.underline = cornflowerBlue
|
color.fg.listing.underline = cornflowerBlue
|
||||||
color.fg.listing.pcode.label = color.palette.blue
|
color.fg.listing.pcode.label = color.palette.blue
|
||||||
color.fg.listing.pcode.space = color.palette.blue
|
color.fg.listing.pcode.address.space = color.palette.blue
|
||||||
color.fg.listing.pcode.varnode = color.palette.blue
|
color.fg.listing.pcode.varnode = color.palette.blue
|
||||||
color.fg.listing.pcode.userop = color.palette.blue
|
color.fg.listing.pcode.userop = color.palette.blue
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ color.flowtype.fall.through = red
|
|||||||
color.flowtype.jump.conditional = #007C00 // dark green
|
color.flowtype.jump.conditional = #007C00 // dark green
|
||||||
color.flowtype.jump.unconditional = blue
|
color.flowtype.jump.unconditional = blue
|
||||||
|
|
||||||
color.function.thunk = color.palette.blue
|
|
||||||
color.fg.function.name = color.palette.blue
|
|
||||||
color.fg.function.params = color.palette.magenta
|
|
||||||
|
|
||||||
color.bg.table.selection.bundle = [color]textHighlight
|
color.bg.table.selection.bundle = [color]textHighlight
|
||||||
color.fg.table.selection.bundle = [color]textHighlightText
|
color.fg.table.selection.bundle = [color]textHighlightText
|
||||||
color.fg.table.bundle.disabled = darkGray
|
color.fg.table.bundle.disabled = darkGray
|
||||||
@@ -75,6 +71,8 @@ color.bg.plugin.datamgr.edge.composite = magenta
|
|||||||
color.bg.plugin.datamgr.edge.reference = blue
|
color.bg.plugin.datamgr.edge.reference = blue
|
||||||
color.bg.plugin.datamgr.icon.highlight = rgb(204, 204, 255)
|
color.bg.plugin.datamgr.icon.highlight = rgb(204, 204, 255)
|
||||||
|
|
||||||
|
color.fg.plugin.disassembledview.address = color.fg
|
||||||
|
|
||||||
color.bg.plugin.editors.compositeeditor.text = color.fg
|
color.bg.plugin.editors.compositeeditor.text = color.fg
|
||||||
color.bg.plugin.editors.compositeeditor.line = system.color.border
|
color.bg.plugin.editors.compositeeditor.line = system.color.border
|
||||||
color.bg.plugin.editors.compositeeditor.line.interior = #D4D4D4
|
color.bg.plugin.editors.compositeeditor.line.interior = #D4D4D4
|
||||||
@@ -87,11 +85,10 @@ color.bg.plugin.editors.compositeeditor.non.bit = #A0A0FF
|
|||||||
|
|
||||||
color.fg.plugin.equate.enum = lightskyblue
|
color.fg.plugin.equate.enum = lightskyblue
|
||||||
|
|
||||||
color.fg.plugin.function.editor.dialog.thunk = color.function.thunk
|
|
||||||
color.fg.plugin.function.editor.dialog.textfield.default = color.fg
|
color.fg.plugin.function.editor.dialog.textfield.default = color.fg
|
||||||
color.fg.plugin.function.editor.dialog.textfield.error = color.fg.error
|
color.fg.plugin.function.editor.dialog.textfield.error = color.fg.error
|
||||||
color.fg.plugin.function.editor.dialog.textfield.function.name = color.palette.blue
|
color.fg.plugin.function.editor.dialog.textfield.function.name = color.palette.blue
|
||||||
color.fg.plugin.function.editor.dialog.textfield.parameter = color.fg.function.params
|
color.fg.plugin.function.editor.dialog.textfield.parameter = color.fg.listing.function.param
|
||||||
|
|
||||||
color.bg.plugin.instructionsearch.table.masked.instruction = rgb(237, 243, 254) // faint blue
|
color.bg.plugin.instructionsearch.table.masked.instruction = rgb(237, 243, 254) // faint blue
|
||||||
color.bg.plugin.instructionsearch.table.masked.non.instruction = rgb(255, 242, 214) // tan
|
color.bg.plugin.instructionsearch.table.masked.non.instruction = rgb(255, 242, 214) // tan
|
||||||
|
|||||||
+8
-27
@@ -40,12 +40,10 @@ import ghidra.app.plugin.core.codebrowser.hover.ListingHoverService;
|
|||||||
import ghidra.app.services.*;
|
import ghidra.app.services.*;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.ProgramDropProvider;
|
import ghidra.app.util.ProgramDropProvider;
|
||||||
import ghidra.app.util.viewer.field.ListingField;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.field.ListingTextField;
|
|
||||||
import ghidra.app.util.viewer.format.*;
|
import ghidra.app.util.viewer.format.*;
|
||||||
import ghidra.app.util.viewer.listingpanel.*;
|
import ghidra.app.util.viewer.listingpanel.*;
|
||||||
import ghidra.app.util.viewer.options.ListingDisplayOptionsEditor;
|
import ghidra.app.util.viewer.options.ListingDisplayOptionsEditor;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.util.AddressIndexMap;
|
import ghidra.app.util.viewer.util.AddressIndexMap;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.options.*;
|
import ghidra.framework.options.*;
|
||||||
@@ -112,7 +110,7 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||||||
connectedProvider = createProvider(formatMgr, true);
|
connectedProvider = createProvider(formatMgr, true);
|
||||||
tool.showComponentProvider(connectedProvider, true);
|
tool.showComponentProvider(connectedProvider, true);
|
||||||
initOptions(fieldOptions);
|
initOptions(fieldOptions);
|
||||||
initDisplayOptions(displayOptions);
|
connectedProvider.getListingPanel().setTextBackgroundColor(ListingColors.BACKGROUND);
|
||||||
initMiscellaneousOptions();
|
initMiscellaneousOptions();
|
||||||
displayOptions.addOptionsChangeListener(this);
|
displayOptions.addOptionsChangeListener(this);
|
||||||
fieldOptions.addOptionsChangeListener(this);
|
fieldOptions.addOptionsChangeListener(this);
|
||||||
@@ -385,13 +383,7 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||||||
Object newValue) {
|
Object newValue) {
|
||||||
|
|
||||||
ListingPanel listingPanel = connectedProvider.getListingPanel();
|
ListingPanel listingPanel = connectedProvider.getListingPanel();
|
||||||
if (options.getName().equals(GhidraOptions.CATEGORY_BROWSER_DISPLAY)) {
|
if (options.getName().equals(GhidraOptions.CATEGORY_BROWSER_FIELDS)) {
|
||||||
if (optionName.equals(OptionsGui.BACKGROUND.getColorOptionName())) {
|
|
||||||
Color c = (Color) newValue;
|
|
||||||
listingPanel.setTextBackgroundColor(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (options.getName().equals(GhidraOptions.CATEGORY_BROWSER_FIELDS)) {
|
|
||||||
|
|
||||||
FieldPanel fieldPanel = listingPanel.getFieldPanel();
|
FieldPanel fieldPanel = listingPanel.getFieldPanel();
|
||||||
if (optionName.equals(GhidraOptions.OPTION_SELECTION_COLOR)) {
|
if (optionName.equals(GhidraOptions.OPTION_SELECTION_COLOR)) {
|
||||||
@@ -563,12 +555,9 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||||||
"The highlight color in the browser.");
|
"The highlight color in the browser.");
|
||||||
|
|
||||||
fieldOptions.registerThemeColorBinding(CURSOR_COLOR_OPTIONS_NAME,
|
fieldOptions.registerThemeColorBinding(CURSOR_COLOR_OPTIONS_NAME,
|
||||||
FOCUSED_CURSOR_COLOR.getId(),
|
FOCUSED_CURSOR_COLOR.getId(), helpLocation, "The color of the cursor in the browser.");
|
||||||
helpLocation,
|
|
||||||
"The color of the cursor in the browser.");
|
|
||||||
fieldOptions.registerThemeColorBinding(UNFOCUSED_CURSOR_COLOR_OPTIONS_NAME,
|
fieldOptions.registerThemeColorBinding(UNFOCUSED_CURSOR_COLOR_OPTIONS_NAME,
|
||||||
UNFOCUSED_CURSOR_COLOR.getId(),
|
UNFOCUSED_CURSOR_COLOR.getId(), helpLocation,
|
||||||
helpLocation,
|
|
||||||
"The color of the cursor in the browser when the browser does not have focus.");
|
"The color of the cursor in the browser when the browser does not have focus.");
|
||||||
fieldOptions.registerOption(BLINK_CURSOR_OPTIONS_NAME, true, helpLocation,
|
fieldOptions.registerOption(BLINK_CURSOR_OPTIONS_NAME, true, helpLocation,
|
||||||
"When selected, the cursor will blink when the containing window is focused.");
|
"When selected, the cursor will blink when the containing window is focused.");
|
||||||
@@ -580,8 +569,7 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||||||
|
|
||||||
helpLocation = new HelpLocation(getName(), "Keyboard_Controls_Shift");
|
helpLocation = new HelpLocation(getName(), "Keyboard_Controls_Shift");
|
||||||
fieldOptions.registerOption(MOUSE_WHEEL_HORIZONTAL_SCROLLING_OPTIONS_NAME, true,
|
fieldOptions.registerOption(MOUSE_WHEEL_HORIZONTAL_SCROLLING_OPTIONS_NAME, true,
|
||||||
helpLocation,
|
helpLocation, "Enables horizontal scrolling by holding the Shift key while " +
|
||||||
"Enables horizontal scrolling by holding the Shift key while " +
|
|
||||||
"using the mouse scroll wheel");
|
"using the mouse scroll wheel");
|
||||||
|
|
||||||
Color color = fieldOptions.getColor(GhidraOptions.OPTION_SELECTION_COLOR,
|
Color color = fieldOptions.getColor(GhidraOptions.OPTION_SELECTION_COLOR,
|
||||||
@@ -594,9 +582,8 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||||||
selectionMarkers.setMarkerColor(color);
|
selectionMarkers.setMarkerColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
color =
|
color = fieldOptions.getColor(GhidraOptions.OPTION_HIGHLIGHT_COLOR,
|
||||||
fieldOptions.getColor(GhidraOptions.OPTION_HIGHLIGHT_COLOR,
|
GhidraOptions.DEFAULT_HIGHLIGHT_COLOR);
|
||||||
GhidraOptions.DEFAULT_HIGHLIGHT_COLOR);
|
|
||||||
MarkerSet highlightMarkers = getHighlightMarkers(currentProgram);
|
MarkerSet highlightMarkers = getHighlightMarkers(currentProgram);
|
||||||
fieldPanel.setHighlightColor(color);
|
fieldPanel.setHighlightColor(color);
|
||||||
if (highlightMarkers != null) {
|
if (highlightMarkers != null) {
|
||||||
@@ -622,12 +609,6 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||||||
isHighlightCursorLine = fieldOptions.getBoolean(GhidraOptions.HIGHLIGHT_CURSOR_LINE, true);
|
isHighlightCursorLine = fieldOptions.getBoolean(GhidraOptions.HIGHLIGHT_CURSOR_LINE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDisplayOptions(Options displayOptions) {
|
|
||||||
Color color = displayOptions.getColor(OptionsGui.BACKGROUND.getColorOptionName(),
|
|
||||||
OptionsGui.BACKGROUND.getDefaultColor());
|
|
||||||
connectedProvider.getListingPanel().setTextBackgroundColor(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initMiscellaneousOptions() {
|
private void initMiscellaneousOptions() {
|
||||||
// make sure the following options are registered
|
// make sure the following options are registered
|
||||||
HelpLocation helpLocation =
|
HelpLocation helpLocation =
|
||||||
|
|||||||
+13
-83
@@ -15,7 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.disassembler;
|
package ghidra.app.plugin.core.disassembler;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -24,15 +25,14 @@ import javax.swing.event.ChangeListener;
|
|||||||
|
|
||||||
import docking.WindowPosition;
|
import docking.WindowPosition;
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
|
import generic.theme.GColor;
|
||||||
import generic.theme.Gui;
|
import generic.theme.Gui;
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
import ghidra.app.plugin.ProgramPlugin;
|
import ghidra.app.plugin.ProgramPlugin;
|
||||||
import ghidra.app.util.PseudoDisassembler;
|
import ghidra.app.util.PseudoDisassembler;
|
||||||
import ghidra.app.util.viewer.field.BrowserCodeUnitFormat;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.field.FieldFactory;
|
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||||
import ghidra.framework.model.DomainObjectListener;
|
import ghidra.framework.model.DomainObjectListener;
|
||||||
import ghidra.framework.options.OptionsChangeListener;
|
import ghidra.framework.options.OptionsChangeListener;
|
||||||
@@ -78,6 +78,9 @@ import ghidra.util.exception.UsrException;
|
|||||||
)
|
)
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjectListener {
|
public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjectListener {
|
||||||
|
private static final Color ADDRESS_COLOR =
|
||||||
|
new GColor("color.fg.plugin.disassembledview.address");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of addresses that should be disassembled, including the
|
* The number of addresses that should be disassembled, including the
|
||||||
* address of the current {@link ProgramLocation}.
|
* address of the current {@link ProgramLocation}.
|
||||||
@@ -324,24 +327,6 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
* The component provided for the DisassembledViewPlugin.
|
* The component provided for the DisassembledViewPlugin.
|
||||||
*/
|
*/
|
||||||
private class DisassembledViewComponentProvider extends ComponentProviderAdapter {
|
private class DisassembledViewComponentProvider extends ComponentProviderAdapter {
|
||||||
/**
|
|
||||||
* Constant for the selection color setting.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constant for the address foreground color setting.
|
|
||||||
*/
|
|
||||||
private static final String ADDRESS_COLOR_OPTION = "Address Color";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constant for the browser font setting.
|
|
||||||
*/
|
|
||||||
private static final String ADDRESS_FONT_OPTION = "BASE FONT";
|
|
||||||
/**
|
|
||||||
* Constant for the browser's background setting.
|
|
||||||
*/
|
|
||||||
private static final String BACKGROUND_COLOR_OPTION = "Background Color";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant part of the tooltip text for the list cells. This
|
* The constant part of the tooltip text for the list cells. This
|
||||||
* string is prepended to the currently selected address in the
|
* string is prepended to the currently selected address in the
|
||||||
@@ -363,27 +348,6 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
*/
|
*/
|
||||||
private JList<DisassembledAddressInfo> contentList;
|
private JList<DisassembledAddressInfo> contentList;
|
||||||
|
|
||||||
/**
|
|
||||||
* The color of the address in the list that represents the current
|
|
||||||
* selection in the code browser.
|
|
||||||
*/
|
|
||||||
private Color selectedAddressColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color of the preview text.
|
|
||||||
*/
|
|
||||||
private Color addressForegroundColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color for the list background.
|
|
||||||
*/
|
|
||||||
private Color backgroundColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The font for the list items.
|
|
||||||
*/
|
|
||||||
private Font font;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The preview style of the addresses being displayed.
|
* The preview style of the addresses being displayed.
|
||||||
*/
|
*/
|
||||||
@@ -438,7 +402,7 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
super.getListCellRendererComponent(list, value, index, isSelected,
|
super.getListCellRendererComponent(list, value, index, isSelected,
|
||||||
cellHasFocus);
|
cellHasFocus);
|
||||||
|
|
||||||
setFont(font);
|
setFont(Gui.getFont(FieldFactory.BASE_LISTING_FONT_ID));
|
||||||
|
|
||||||
setToolTipText(TOOLTIP_TEXT_PREPEND +
|
setToolTipText(TOOLTIP_TEXT_PREPEND +
|
||||||
HTMLUtilities.escapeHTML(currentLocation.getAddress().toString()));
|
HTMLUtilities.escapeHTML(currentLocation.getAddress().toString()));
|
||||||
@@ -446,8 +410,8 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
// make sure the first value is highlighted to indicate
|
// make sure the first value is highlighted to indicate
|
||||||
// that it is the selected program location
|
// that it is the selected program location
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
Color foreground = addressForegroundColor;
|
Color foreground = ADDRESS_COLOR;
|
||||||
Color background = selectedAddressColor;
|
Color background = GhidraOptions.DEFAULT_SELECTION_COLOR;
|
||||||
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
foreground = Gui.brighter(foreground);
|
foreground = Gui.brighter(foreground);
|
||||||
@@ -471,10 +435,6 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
ToolOptions opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
|
ToolOptions opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
|
||||||
opt.addOptionsChangeListener(optionsChangeListener);
|
opt.addOptionsChangeListener(optionsChangeListener);
|
||||||
|
|
||||||
// current address background color
|
|
||||||
selectedAddressColor = opt.getColor(GhidraOptions.OPTION_SELECTION_COLOR,
|
|
||||||
GhidraOptions.DEFAULT_SELECTION_COLOR);
|
|
||||||
|
|
||||||
// the address preview style
|
// the address preview style
|
||||||
addressPreviewFormat = new BrowserCodeUnitFormat(tool);
|
addressPreviewFormat = new BrowserCodeUnitFormat(tool);
|
||||||
addressPreviewFormat.addChangeListener(addressFormatChangeListener);
|
addressPreviewFormat.addChangeListener(addressFormatChangeListener);
|
||||||
@@ -482,20 +442,9 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_DISPLAY);
|
opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_DISPLAY);
|
||||||
opt.addOptionsChangeListener(optionsChangeListener);
|
opt.addOptionsChangeListener(optionsChangeListener);
|
||||||
|
|
||||||
// the preview text color
|
contentList.setForeground(ADDRESS_COLOR);
|
||||||
addressForegroundColor = opt.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
contentList.setBackground(ListingColors.BACKGROUND);
|
||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
Gui.registerFont(contentList, "font.listing.base");
|
||||||
|
|
||||||
// background color
|
|
||||||
backgroundColor = opt.getColor(OptionsGui.BACKGROUND.getColorOptionName(),
|
|
||||||
OptionsGui.BACKGROUND.getDefaultColor());
|
|
||||||
|
|
||||||
// font
|
|
||||||
font = Gui.getFont(FieldFactory.BASE_LISTING_FONT_ID);
|
|
||||||
|
|
||||||
contentList.setForeground(addressForegroundColor);
|
|
||||||
contentList.setBackground(backgroundColor);
|
|
||||||
contentList.setFont(font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -565,25 +514,6 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
|||||||
@Override
|
@Override
|
||||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
if (options.getName().equals(GhidraOptions.CATEGORY_BROWSER_FIELDS)) {
|
|
||||||
if (optionName.equals(GhidraOptions.OPTION_SELECTION_COLOR)) {
|
|
||||||
selectedAddressColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (options.getName().equals(GhidraOptions.CATEGORY_BROWSER_DISPLAY)) {
|
|
||||||
if (optionName.equals(ADDRESS_COLOR_OPTION)) {
|
|
||||||
addressForegroundColor = (Color) newValue;
|
|
||||||
contentList.setForeground(addressForegroundColor);
|
|
||||||
}
|
|
||||||
else if (optionName.equals(BACKGROUND_COLOR_OPTION)) {
|
|
||||||
backgroundColor = (Color) newValue;
|
|
||||||
contentList.setBackground(backgroundColor);
|
|
||||||
}
|
|
||||||
else if (optionName.equals(ADDRESS_FONT_OPTION)) {
|
|
||||||
font = Gui.getFont(FieldFactory.BASE_LISTING_FONT_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the display
|
// update the display
|
||||||
contentList.repaint();
|
contentList.repaint();
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-20
@@ -28,6 +28,8 @@ import ghidra.app.CorePluginPackage;
|
|||||||
import ghidra.app.events.*;
|
import ghidra.app.events.*;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
import ghidra.app.services.CodeViewerService;
|
import ghidra.app.services.CodeViewerService;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FlowArrowColors;
|
||||||
import ghidra.app.util.viewer.listingpanel.*;
|
import ghidra.app.util.viewer.listingpanel.*;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.util.AddressIndexMap;
|
import ghidra.app.util.viewer.util.AddressIndexMap;
|
||||||
@@ -434,8 +436,7 @@ public class FlowArrowPlugin extends Plugin implements MarginProvider, OptionsCh
|
|||||||
List<FlowArrow> results = new ArrayList<>();
|
List<FlowArrow> results = new ArrayList<>();
|
||||||
ArrowCache arrowCache = new ArrowCache();
|
ArrowCache arrowCache = new ArrowCache();
|
||||||
CodeUnitIterator it = program.getListing()
|
CodeUnitIterator it = program.getListing()
|
||||||
.getCodeUnitIterator(
|
.getCodeUnitIterator(CodeUnit.INSTRUCTION_PROPERTY, screenAddresses, true);
|
||||||
CodeUnit.INSTRUCTION_PROPERTY, screenAddresses, true);
|
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
CodeUnit cu = it.next();
|
CodeUnit cu = it.next();
|
||||||
@@ -545,9 +546,8 @@ public class FlowArrowPlugin extends Plugin implements MarginProvider, OptionsCh
|
|||||||
Address bottomAddr = layoutToPixel.getLayoutAddress(n - 1);
|
Address bottomAddr = layoutToPixel.getLayoutAddress(n - 1);
|
||||||
if (bottomAddr != null) {
|
if (bottomAddr != null) {
|
||||||
AddressSpace testSpace = bottomAddr.getAddressSpace();
|
AddressSpace testSpace = bottomAddr.getAddressSpace();
|
||||||
validState = (program.getAddressFactory()
|
validState =
|
||||||
.getAddressSpace(
|
(program.getAddressFactory().getAddressSpace(testSpace.getSpaceID()) == testSpace);
|
||||||
testSpace.getSpaceID()) == testSpace);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,21 +652,10 @@ public class FlowArrowPlugin extends Plugin implements MarginProvider, OptionsCh
|
|||||||
OptionsGui.FLOW_ARROW_SELECTED.getThemeColorId(), null,
|
OptionsGui.FLOW_ARROW_SELECTED.getThemeColorId(), null,
|
||||||
"The color for an arrow that has been selected by the user");
|
"The color for an arrow that has been selected by the user");
|
||||||
|
|
||||||
Color c = opt.getColor(OptionsGui.BACKGROUND.getColorOptionName(),
|
flowArrowPanel.setBackground(ListingColors.BACKGROUND);
|
||||||
OptionsGui.BACKGROUND.getDefaultColor());
|
flowArrowPanel.setForeground(FlowArrowColors.INACTIVE);
|
||||||
flowArrowPanel.setBackground(c);
|
flowArrowPanel.setHighlightColor(FlowArrowColors.ACTIVE);
|
||||||
|
flowArrowPanel.setSelectedColor(FlowArrowColors.SELECTED);
|
||||||
c = opt.getColor(OptionsGui.FLOW_ARROW_NON_ACTIVE.getColorOptionName(),
|
|
||||||
OptionsGui.FLOW_ARROW_NON_ACTIVE.getDefaultColor());
|
|
||||||
flowArrowPanel.setForeground(c);
|
|
||||||
|
|
||||||
c = opt.getColor(OptionsGui.FLOW_ARROW_ACTIVE.getColorOptionName(),
|
|
||||||
OptionsGui.FLOW_ARROW_ACTIVE.getDefaultColor());
|
|
||||||
flowArrowPanel.setHighlightColor(c);
|
|
||||||
|
|
||||||
c = opt.getColor(OptionsGui.FLOW_ARROW_SELECTED.getColorOptionName(),
|
|
||||||
OptionsGui.FLOW_ARROW_SELECTED.getDefaultColor());
|
|
||||||
flowArrowPanel.setSelectedColor(c);
|
|
||||||
|
|
||||||
opt.addOptionsChangeListener(this);
|
opt.addOptionsChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-7
@@ -19,13 +19,12 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.cmd.function.CallDepthChangeInfo;
|
import ghidra.app.cmd.function.CallDepthChangeInfo;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.field.*;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -36,6 +35,7 @@ import ghidra.program.util.StackDepthFieldLocation;
|
|||||||
|
|
||||||
public class StackDepthFieldFactory extends FieldFactory {
|
public class StackDepthFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Stack Depth";
|
public static final String FIELD_NAME = "Stack Depth";
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.stack.depth");
|
||||||
private Address lastEntry = null;
|
private Address lastEntry = null;
|
||||||
private CallDepthChangeInfo depth = null;
|
private CallDepthChangeInfo depth = null;
|
||||||
private long lastModNumber = -1;
|
private long lastModNumber = -1;
|
||||||
@@ -47,9 +47,6 @@ public class StackDepthFieldFactory extends FieldFactory {
|
|||||||
private StackDepthFieldFactory(FieldFormatModel model, HighlightProvider hsProvider,
|
private StackDepthFieldFactory(FieldFormatModel model, HighlightProvider hsProvider,
|
||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
||||||
color = displayOptions.getColor(OptionsGui.BYTES.getColorOptionName(),
|
|
||||||
OptionsGui.BYTES.getDefaultColor());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -88,7 +85,7 @@ public class StackDepthFieldFactory extends FieldFactory {
|
|||||||
// This can be used to display the value of any register symbolically flowing over the program.
|
// This can be used to display the value of any register symbolically flowing over the program.
|
||||||
// depthString = depth.getRegValueRepresentation(cu.getMinAddress(), cu.getProgram().getRegister("ESP"));
|
// depthString = depth.getRegValueRepresentation(cu.getMinAddress(), cu.getProgram().getRegister("ESP"));
|
||||||
|
|
||||||
AttributedString as = new AttributedString(depthString, Palette.BLUE, getMetrics());
|
AttributedString as = new AttributedString(depthString, COLOR, getMetrics());
|
||||||
|
|
||||||
Integer overrideDepth =
|
Integer overrideDepth =
|
||||||
CallDepthChangeInfo.getStackDepthChange(cu.getProgram(), cu.getMinAddress());
|
CallDepthChangeInfo.getStackDepthChange(cu.getProgram(), cu.getMinAddress());
|
||||||
@@ -166,5 +163,4 @@ public class StackDepthFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
return (category == FieldFormatModel.INSTRUCTION_OR_DATA);
|
return (category == FieldFormatModel.INSTRUCTION_OR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-19
@@ -35,7 +35,6 @@ import docking.widgets.checkbox.GCheckBox;
|
|||||||
import docking.widgets.combobox.GComboBox;
|
import docking.widgets.combobox.GComboBox;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.theme.GColor;
|
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.*;
|
import generic.theme.GThemeDefaults.Colors.*;
|
||||||
@@ -43,6 +42,7 @@ import generic.util.WindowUtilities;
|
|||||||
import ghidra.app.services.DataTypeManagerService;
|
import ghidra.app.services.DataTypeManagerService;
|
||||||
import ghidra.app.util.ToolTipUtils;
|
import ghidra.app.util.ToolTipUtils;
|
||||||
import ghidra.app.util.cparser.C.CParserUtils;
|
import ghidra.app.util.cparser.C.CParserUtils;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
import ghidra.program.model.listing.Function;
|
import ghidra.program.model.listing.Function;
|
||||||
@@ -54,8 +54,6 @@ import ghidra.util.layout.VerticalLayout;
|
|||||||
import resources.Icons;
|
import resources.Icons;
|
||||||
|
|
||||||
public class FunctionEditorDialog extends DialogComponentProvider implements ModelChangeListener {
|
public class FunctionEditorDialog extends DialogComponentProvider implements ModelChangeListener {
|
||||||
private static final Color FG_COLOR_THUNK =
|
|
||||||
new GColor("color.fg.plugin.function.editor.dialog.thunk");
|
|
||||||
|
|
||||||
private FunctionEditorModel model;
|
private FunctionEditorModel model;
|
||||||
private DocumentListener nameFieldDocumentListener;
|
private DocumentListener nameFieldDocumentListener;
|
||||||
@@ -215,7 +213,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Java.BORDER),
|
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Java.BORDER),
|
||||||
BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||||
thunkedText.setBorder(border);
|
thunkedText.setBorder(border);
|
||||||
thunkedText.setForeground(FG_COLOR_THUNK);
|
thunkedText.setForeground(FunctionColors.THUNK);
|
||||||
thunkedPanel.add(thunkedText);
|
thunkedPanel.add(thunkedText);
|
||||||
return thunkedPanel;
|
return thunkedPanel;
|
||||||
}
|
}
|
||||||
@@ -304,8 +302,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
|
|
||||||
signatureTextField.setTabListener(tabListener);
|
signatureTextField.setTabListener(tabListener);
|
||||||
|
|
||||||
signatureTextField.setChangeListener(
|
signatureTextField
|
||||||
e -> model.setSignatureFieldText(signatureTextField.getText()));
|
.setChangeListener(e -> model.setSignatureFieldText(signatureTextField.getText()));
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,9 +332,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
message += "<BR><BR>";
|
message += "<BR><BR>";
|
||||||
}
|
}
|
||||||
|
|
||||||
message = HTMLUtilities.wrapAsHTML(
|
message = HTMLUtilities.wrapAsHTML(message +
|
||||||
message + "<CENTER><B>Do you want to continue editing or " +
|
"<CENTER><B>Do you want to continue editing or " + "abort your changes?</B></CENTER>");
|
||||||
"abort your changes?</B></CENTER>");
|
|
||||||
int result = OptionDialog.showOptionNoCancelDialog(rootPanel, "Invalid Function Signature",
|
int result = OptionDialog.showOptionNoCancelDialog(rootPanel, "Invalid Function Signature",
|
||||||
message, "Continue Editing", "Abort Changes", OptionDialog.ERROR_MESSAGE);
|
message, "Continue Editing", "Abort Changes", OptionDialog.ERROR_MESSAGE);
|
||||||
return result == OptionDialog.OPTION_TWO; // Option 2 is to abort
|
return result == OptionDialog.OPTION_TWO; // Option 2 is to abort
|
||||||
@@ -372,8 +369,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
noReturnCheckBox = new GCheckBox("No Return");
|
noReturnCheckBox = new GCheckBox("No Return");
|
||||||
noReturnCheckBox.addItemListener(e -> model.setNoReturn(noReturnCheckBox.isSelected()));
|
noReturnCheckBox.addItemListener(e -> model.setNoReturn(noReturnCheckBox.isSelected()));
|
||||||
storageCheckBox = new GCheckBox("Use Custom Storage");
|
storageCheckBox = new GCheckBox("Use Custom Storage");
|
||||||
storageCheckBox.addItemListener(
|
storageCheckBox
|
||||||
e -> model.setUseCustomizeStorage(storageCheckBox.isSelected()));
|
.addItemListener(e -> model.setUseCustomizeStorage(storageCheckBox.isSelected()));
|
||||||
panel.add(noReturnCheckBox);
|
panel.add(noReturnCheckBox);
|
||||||
panel.add(storageCheckBox);
|
panel.add(storageCheckBox);
|
||||||
panel.setBorder(BorderFactory.createTitledBorder("Function Attributes:"));
|
panel.setBorder(BorderFactory.createTitledBorder("Function Attributes:"));
|
||||||
@@ -386,8 +383,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
String[] names = new String[callingConventionNames.size()];
|
String[] names = new String[callingConventionNames.size()];
|
||||||
callingConventionComboBox = new GComboBox<>(callingConventionNames.toArray(names));
|
callingConventionComboBox = new GComboBox<>(callingConventionNames.toArray(names));
|
||||||
callingConventionComboBox.setSelectedItem(model.getCallingConventionName());
|
callingConventionComboBox.setSelectedItem(model.getCallingConventionName());
|
||||||
callingConventionComboBox.addItemListener(e -> model.setCallingConventionName(
|
callingConventionComboBox.addItemListener(e -> model
|
||||||
(String) callingConventionComboBox.getSelectedItem()));
|
.setCallingConventionName((String) callingConventionComboBox.getSelectedItem()));
|
||||||
return callingConventionComboBox;
|
return callingConventionComboBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,8 +397,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
|
|
||||||
callFixupComboBox.addItem(FunctionEditorModel.NONE_CHOICE);
|
callFixupComboBox.addItem(FunctionEditorModel.NONE_CHOICE);
|
||||||
if (callFixupNames.length != 0) {
|
if (callFixupNames.length != 0) {
|
||||||
callFixupComboBox.setToolTipText(
|
callFixupComboBox
|
||||||
"Select call-fixup as defined by compiler specification");
|
.setToolTipText("Select call-fixup as defined by compiler specification");
|
||||||
for (String element : callFixupNames) {
|
for (String element : callFixupNames) {
|
||||||
callFixupComboBox.addItem(element);
|
callFixupComboBox.addItem(element);
|
||||||
}
|
}
|
||||||
@@ -760,15 +757,13 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
setToolTipText("Invalid Parameter Storage");
|
setToolTipText("Invalid Parameter Storage");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setForeground(
|
setForeground(isSelected ? table.getSelectionForeground() : Colors.FOREGROUND);
|
||||||
isSelected ? table.getSelectionForeground() : Colors.FOREGROUND);
|
|
||||||
setToolTipText("");
|
setToolTipText("");
|
||||||
}
|
}
|
||||||
setText(storage.toString());
|
setText(storage.toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setForeground(
|
setForeground(isSelected ? table.getSelectionForeground() : Colors.FOREGROUND);
|
||||||
isSelected ? table.getSelectionForeground() : Colors.FOREGROUND);
|
|
||||||
setText("");
|
setText("");
|
||||||
setToolTipText(null);
|
setToolTipText(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-39
@@ -59,20 +59,16 @@ public class PcodeFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
super(name, model, highlightProvider, displayOptions, fieldOptions);
|
super(name, model, highlightProvider, displayOptions, fieldOptions);
|
||||||
setWidth(300);
|
setWidth(300);
|
||||||
color = displayOptions.getColor(OptionsGui.BYTES.getColorOptionName(),
|
|
||||||
OptionsGui.BYTES.getDefaultColor());
|
|
||||||
style = displayOptions.getInt(OptionsGui.BYTES.getStyleOptionName(), -1);
|
style = displayOptions.getInt(OptionsGui.BYTES.getStyleOptionName(), -1);
|
||||||
formatter = new AttributedStringPcodeFormatter();
|
formatter = new AttributedStringPcodeFormatter();
|
||||||
|
|
||||||
setColors(displayOptions);
|
|
||||||
setOptions(fieldOptions);
|
setOptions(fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel myModel, HighlightProvider highlightProvider,
|
public FieldFactory newInstance(FieldFormatModel myModel, HighlightProvider highlightProvider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions options, ToolOptions fieldOptions) {
|
||||||
return new PcodeFieldFactory(FIELD_NAME, myModel, highlightProvider, displayOptions,
|
return new PcodeFieldFactory(FIELD_NAME, myModel, highlightProvider, options, fieldOptions);
|
||||||
fieldOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,7 +146,6 @@ public class PcodeFieldFactory extends FieldFactory {
|
|||||||
Object newValue) {
|
Object newValue) {
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
||||||
formatter.setFontMetrics(getMetrics());
|
formatter.setFontMetrics(getMetrics());
|
||||||
setColors(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -166,37 +161,6 @@ public class PcodeFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the fonts are first initialized or when one of the options changes. It looks up
|
|
||||||
* all the color settings and resets the its values.
|
|
||||||
*/
|
|
||||||
private void setColors(Options options) {
|
|
||||||
formatter.setAddressColor(options.getColor(OptionsGui.ADDRESS.getColorOptionName(),
|
|
||||||
OptionsGui.ADDRESS.getDefaultColor()));
|
|
||||||
formatter.setRegisterColor(options.getColor(OptionsGui.REGISTERS.getColorOptionName(),
|
|
||||||
OptionsGui.REGISTERS.getDefaultColor()));
|
|
||||||
formatter.setScalarColor(options.getColor(OptionsGui.CONSTANT.getColorOptionName(),
|
|
||||||
OptionsGui.CONSTANT.getDefaultColor()));
|
|
||||||
formatter.setLocalColor(options.getColor(OptionsGui.LABELS_LOCAL.getColorOptionName(),
|
|
||||||
OptionsGui.LABELS_LOCAL.getDefaultColor()));
|
|
||||||
formatter.setMnemonicColor(options.getColor(OptionsGui.MNEMONIC.getColorOptionName(),
|
|
||||||
OptionsGui.MNEMONIC.getDefaultColor()));
|
|
||||||
formatter.setUnimplColor(options.getColor(OptionsGui.UNIMPL.getColorOptionName(),
|
|
||||||
OptionsGui.UNIMPL.getDefaultColor()));
|
|
||||||
formatter.setSeparatorColor(options.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
|
||||||
OptionsGui.SEPARATOR.getDefaultColor()));
|
|
||||||
formatter.setLineLabelColor(
|
|
||||||
options.getColor(OptionsGui.PCODE_LINE_LABEL.getColorOptionName(),
|
|
||||||
OptionsGui.PCODE_LINE_LABEL.getDefaultColor()));
|
|
||||||
formatter.setSpaceColor(options.getColor(OptionsGui.PCODE_ADDR_SPACE.getColorOptionName(),
|
|
||||||
OptionsGui.PCODE_ADDR_SPACE.getDefaultColor()));
|
|
||||||
formatter.setRawColor(options.getColor(OptionsGui.PCODE_RAW_VARNODE.getColorOptionName(),
|
|
||||||
OptionsGui.PCODE_RAW_VARNODE.getDefaultColor()));
|
|
||||||
formatter.setUseropColor(options.getColor(OptionsGui.PCODE_USEROP.getColorOptionName(),
|
|
||||||
OptionsGui.PCODE_USEROP.getDefaultColor()));
|
|
||||||
formatter.setFontMetrics(getMetrics());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setOptions(Options fieldOptions) {
|
private void setOptions(Options fieldOptions) {
|
||||||
fieldOptions.registerOption(MAX_DISPLAY_LINES_MSG, MAX_DISPLAY_LINES, null,
|
fieldOptions.registerOption(MAX_DISPLAY_LINES_MSG, MAX_DISPLAY_LINES, null,
|
||||||
"Max number line of pcode to display");
|
"Max number line of pcode to display");
|
||||||
@@ -206,5 +170,4 @@ public class PcodeFieldFactory extends FieldFactory {
|
|||||||
boolean displayRaw = fieldOptions.getBoolean(DISPLAY_RAW_PCODE, false);
|
boolean displayRaw = fieldOptions.getBoolean(DISPLAY_RAW_PCODE, false);
|
||||||
formatter.setOptions(maxDisplayLines, displayRaw);
|
formatter.setOptions(maxDisplayLines, displayRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -434,13 +434,7 @@ public class SymbolInspector implements OptionsChangeListener {
|
|||||||
if (se == null) {
|
if (se == null) {
|
||||||
return Colors.BACKGROUND;
|
return Colors.BACKGROUND;
|
||||||
}
|
}
|
||||||
String optionName = se.getColorOptionName();
|
return se.getDefaultColor();
|
||||||
Color color = (Color) cache.get(optionName);
|
|
||||||
if (color == null) {
|
|
||||||
color = optionsObject.getColor(se.getColorOptionName(), se.getDefaultColor());
|
|
||||||
cache.put(optionName, color);
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getStyle(ScreenElement se) {
|
private int getStyle(ScreenElement se) {
|
||||||
@@ -450,7 +444,7 @@ public class SymbolInspector implements OptionsChangeListener {
|
|||||||
String optionName = se.getStyleOptionName();
|
String optionName = se.getStyleOptionName();
|
||||||
Integer style = (Integer) cache.get(optionName);
|
Integer style = (Integer) cache.get(optionName);
|
||||||
if (style == null) {
|
if (style == null) {
|
||||||
style = Integer.valueOf(optionsObject.getInt(se.getStyleOptionName(), -1));
|
style = optionsObject.getInt(optionName, -1);
|
||||||
cache.put(optionName, style);
|
cache.put(optionName, style);
|
||||||
}
|
}
|
||||||
return style.intValue();
|
return style.intValue();
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import generic.theme.GColor;
|
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.util.html.*;
|
import ghidra.app.util.html.*;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.program.model.data.Enum;
|
import ghidra.program.model.data.Enum;
|
||||||
@@ -44,13 +43,6 @@ import ghidra.util.StringUtilities;
|
|||||||
*/
|
*/
|
||||||
public class ToolTipUtils {
|
public class ToolTipUtils {
|
||||||
|
|
||||||
private static final Color FG_FUNCTION_NAME = new GColor("color.fg.function.name");
|
|
||||||
private static final Color PARAM_NAME_COLOR = new GColor("color.fg.function.params");
|
|
||||||
private static final Color PARAM_CUSTOM_STORAGE_COLOR =
|
|
||||||
OptionsGui.PARAMETER_CUSTOM.getDefaultColor();
|
|
||||||
private static final Color PARAM_DYNAMIC_STORAGE_COLOR =
|
|
||||||
OptionsGui.PARAMETER_DYNAMIC.getDefaultColor();
|
|
||||||
|
|
||||||
private static final String ELLIPSES = "...";
|
private static final String ELLIPSES = "...";
|
||||||
public static final int LINE_LENGTH = 80;
|
public static final int LINE_LENGTH = 80;
|
||||||
private static final int PARAM_LENGTH_WRAP_THRESHOLD = LINE_LENGTH;
|
private static final int PARAM_LENGTH_WRAP_THRESHOLD = LINE_LENGTH;
|
||||||
@@ -269,11 +261,11 @@ public class ToolTipUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Color paramColor =
|
Color paramColor =
|
||||||
usesCustomStorage ? PARAM_CUSTOM_STORAGE_COLOR : PARAM_DYNAMIC_STORAGE_COLOR;
|
usesCustomStorage ? FunctionColors.PARAM_CUSTOM : FunctionColors.PARAM_DYNAMIC;
|
||||||
buf.append(
|
buf.append(
|
||||||
colorString(paramColor, friendlyEncodeHTML(param.getVariableStorage().toString())));
|
colorString(paramColor, friendlyEncodeHTML(param.getVariableStorage().toString())));
|
||||||
buf.append("</td><td width=\"1%\">");
|
buf.append("</td><td width=\"1%\">");
|
||||||
buf.append(colorString(PARAM_NAME_COLOR, friendlyEncodeHTML(name)));
|
buf.append(colorString(FunctionColors.PARAM, friendlyEncodeHTML(name)));
|
||||||
|
|
||||||
// consume remaining space and compact other columns
|
// consume remaining space and compact other columns
|
||||||
buf.append("</td><td width=\"100%\"> </td></tr>");
|
buf.append("</td><td width=\"100%\"> </td></tr>");
|
||||||
@@ -304,7 +296,7 @@ public class ToolTipUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String functionName = StringUtilities.trimMiddle(function.getName(), LINE_LENGTH);
|
String functionName = StringUtilities.trimMiddle(function.getName(), LINE_LENGTH);
|
||||||
buffy.append(colorString(FG_FUNCTION_NAME, friendlyEncodeHTML(functionName)));
|
buffy.append(colorString(FunctionColors.NAME, friendlyEncodeHTML(functionName)));
|
||||||
buffy.append(HTML_SPACE).append("(");
|
buffy.append(HTML_SPACE).append("(");
|
||||||
|
|
||||||
buildParameterPreview(function, buffy);
|
buildParameterPreview(function, buffy);
|
||||||
@@ -405,7 +397,7 @@ public class ToolTipUtils {
|
|||||||
pb.append(colorString(Colors.FOREGROUND, friendlyEncodeHTML(type)));
|
pb.append(colorString(Colors.FOREGROUND, friendlyEncodeHTML(type)));
|
||||||
pb.append(HTML_SPACE);
|
pb.append(HTML_SPACE);
|
||||||
|
|
||||||
pb.append(colorString(PARAM_NAME_COLOR, friendlyEncodeHTML(name)));
|
pb.append(colorString(FunctionColors.NAME, friendlyEncodeHTML(name)));
|
||||||
params.add(pb.toString());
|
params.add(pb.toString());
|
||||||
return rawTextLength;
|
return rawTextLength;
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-138
@@ -23,7 +23,8 @@ import java.util.List;
|
|||||||
import docking.widgets.fieldpanel.field.AttributedString;
|
import docking.widgets.fieldpanel.field.AttributedString;
|
||||||
import docking.widgets.fieldpanel.field.CompositeAttributedString;
|
import docking.widgets.fieldpanel.field.CompositeAttributedString;
|
||||||
import ghidra.app.plugin.processors.sleigh.template.OpTpl;
|
import ghidra.app.plugin.processors.sleigh.template.OpTpl;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.field.ListingColors;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.*;
|
||||||
import ghidra.program.model.address.AddressSpace;
|
import ghidra.program.model.address.AddressSpace;
|
||||||
import ghidra.program.model.lang.Language;
|
import ghidra.program.model.lang.Language;
|
||||||
import ghidra.program.model.lang.Register;
|
import ghidra.program.model.lang.Register;
|
||||||
@@ -37,18 +38,6 @@ public class AttributedStringPcodeFormatter extends
|
|||||||
|
|
||||||
private FontMetrics metrics;
|
private FontMetrics metrics;
|
||||||
|
|
||||||
private Color addressColor = OptionsGui.ADDRESS.getDefaultColor();
|
|
||||||
private Color registerColor = OptionsGui.REGISTERS.getDefaultColor();
|
|
||||||
private Color scalarColor = OptionsGui.CONSTANT.getDefaultColor();
|
|
||||||
private Color localColor = OptionsGui.LABELS_LOCAL.getDefaultColor();
|
|
||||||
private Color mnemonicColor = OptionsGui.MNEMONIC.getDefaultColor();
|
|
||||||
private Color unimplColor = OptionsGui.UNIMPL.getDefaultColor();
|
|
||||||
private Color separatorColor = OptionsGui.SEPARATOR.getDefaultColor();
|
|
||||||
private Color lineLabelColor = OptionsGui.PCODE_LINE_LABEL.getDefaultColor();
|
|
||||||
private Color spaceColor = OptionsGui.PCODE_ADDR_SPACE.getDefaultColor();
|
|
||||||
private Color rawColor = OptionsGui.PCODE_RAW_VARNODE.getDefaultColor();
|
|
||||||
private Color useropColor = OptionsGui.PCODE_USEROP.getDefaultColor();
|
|
||||||
|
|
||||||
private AttributedString aSpace;
|
private AttributedString aSpace;
|
||||||
private AttributedString aEquals;
|
private AttributedString aEquals;
|
||||||
private AttributedString aComma;
|
private AttributedString aComma;
|
||||||
@@ -67,110 +56,10 @@ public class AttributedStringPcodeFormatter extends
|
|||||||
initPunctuation();
|
initPunctuation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for addresses
|
|
||||||
*
|
|
||||||
* @param addressColor
|
|
||||||
*/
|
|
||||||
public void setAddressColor(Color addressColor) {
|
|
||||||
this.addressColor = addressColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for register names
|
|
||||||
*
|
|
||||||
* @param registerColor
|
|
||||||
*/
|
|
||||||
public void setRegisterColor(Color registerColor) {
|
|
||||||
this.registerColor = registerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for scalars and non-address constants
|
|
||||||
*
|
|
||||||
* @param scalarColor
|
|
||||||
*/
|
|
||||||
public void setScalarColor(Color scalarColor) {
|
|
||||||
this.scalarColor = scalarColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for labels referring to addresses
|
|
||||||
*
|
|
||||||
* @param localColor
|
|
||||||
*/
|
|
||||||
public void setLocalColor(Color localColor) {
|
|
||||||
this.localColor = localColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for op mnemonics
|
|
||||||
*
|
|
||||||
* @param mnemonicColor
|
|
||||||
*/
|
|
||||||
public void setMnemonicColor(Color mnemonicColor) {
|
|
||||||
this.mnemonicColor = mnemonicColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for the {@code unimpl} op mnemonic
|
|
||||||
*
|
|
||||||
* @param unimplColor
|
|
||||||
*/
|
|
||||||
public void setUnimplColor(Color unimplColor) {
|
|
||||||
this.unimplColor = unimplColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for punctuation
|
|
||||||
*
|
|
||||||
* @param separatorColor
|
|
||||||
*/
|
|
||||||
public void setSeparatorColor(Color separatorColor) {
|
|
||||||
this.separatorColor = separatorColor;
|
|
||||||
initPunctuation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for labels referring to p-code ops
|
|
||||||
*
|
|
||||||
* @param lineLabelColor
|
|
||||||
*/
|
|
||||||
public void setLineLabelColor(Color lineLabelColor) {
|
|
||||||
this.lineLabelColor = lineLabelColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for address space names
|
|
||||||
*
|
|
||||||
* @param spaceColor
|
|
||||||
*/
|
|
||||||
public void setSpaceColor(Color spaceColor) {
|
|
||||||
this.spaceColor = spaceColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for raw varnodes
|
|
||||||
*
|
|
||||||
* @param rawColor
|
|
||||||
*/
|
|
||||||
public void setRawColor(Color rawColor) {
|
|
||||||
this.rawColor = rawColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the color for userop ({@code CALLOTHER}) names
|
|
||||||
*
|
|
||||||
* @param useropColor
|
|
||||||
*/
|
|
||||||
public void setUseropColor(Color useropColor) {
|
|
||||||
this.useropColor = useropColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set font metrics for AttributedString objects
|
* Set font metrics for AttributedString objects
|
||||||
*
|
*
|
||||||
* @param metrics
|
* @param metrics the font metrics
|
||||||
*/
|
*/
|
||||||
public void setFontMetrics(FontMetrics metrics) {
|
public void setFontMetrics(FontMetrics metrics) {
|
||||||
this.metrics = metrics;
|
this.metrics = metrics;
|
||||||
@@ -180,8 +69,8 @@ public class AttributedStringPcodeFormatter extends
|
|||||||
/**
|
/**
|
||||||
* Set general formatting options
|
* Set general formatting options
|
||||||
*
|
*
|
||||||
* @param maxDisplayLines
|
* @param maxDisplayLines the maximum number of lines to display
|
||||||
* @param displayRawPcode
|
* @param displayRawPcode show raw pcode
|
||||||
*/
|
*/
|
||||||
public void setOptions(int maxDisplayLines, boolean displayRawPcode) {
|
public void setOptions(int maxDisplayLines, boolean displayRawPcode) {
|
||||||
this.maxDisplayLines = maxDisplayLines;
|
this.maxDisplayLines = maxDisplayLines;
|
||||||
@@ -189,16 +78,16 @@ public class AttributedStringPcodeFormatter extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initPunctuation() {
|
private void initPunctuation() {
|
||||||
aSpace = new AttributedString(" ", separatorColor, metrics);
|
aSpace = new AttributedString(" ", ListingColors.SEPARATOR, metrics);
|
||||||
aEquals = new AttributedString(" = ", separatorColor, metrics);
|
aEquals = new AttributedString(" = ", ListingColors.SEPARATOR, metrics);
|
||||||
aComma = new AttributedString(",", separatorColor, metrics);
|
aComma = new AttributedString(",", ListingColors.SEPARATOR, metrics);
|
||||||
aLeftParen = new AttributedString("(", separatorColor, metrics);
|
aLeftParen = new AttributedString("(", ListingColors.SEPARATOR, metrics);
|
||||||
aRightParen = new AttributedString(")", separatorColor, metrics);
|
aRightParen = new AttributedString(")", ListingColors.SEPARATOR, metrics);
|
||||||
aLeftBracket = new AttributedString("[", separatorColor, metrics);
|
aLeftBracket = new AttributedString("[", ListingColors.SEPARATOR, metrics);
|
||||||
aRightBracket = new AttributedString("]", separatorColor, metrics);
|
aRightBracket = new AttributedString("]", ListingColors.SEPARATOR, metrics);
|
||||||
aStar = new AttributedString("*", separatorColor, metrics);
|
aStar = new AttributedString("*", ListingColors.SEPARATOR, metrics);
|
||||||
aColon = new AttributedString(":", separatorColor, metrics);
|
aColon = new AttributedString(":", ListingColors.SEPARATOR, metrics);
|
||||||
aQuote = new AttributedString("\"", separatorColor, metrics);
|
aQuote = new AttributedString("\"", ListingColors.SEPARATOR, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -244,24 +133,27 @@ public class AttributedStringPcodeFormatter extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendLineLabelRef(long label) {
|
public void appendLineLabelRef(long label) {
|
||||||
lineList.add(new AttributedString(stringifyLineLabel(label), lineLabelColor, metrics));
|
lineList.add(
|
||||||
|
new AttributedString(stringifyLineLabel(label), PcodeColors.LABEL, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendMnemonic(int opcode) {
|
public void appendMnemonic(int opcode) {
|
||||||
Color color = opcode == PcodeOp.UNIMPLEMENTED ? unimplColor : mnemonicColor;
|
Color color = opcode == PcodeOp.UNIMPLEMENTED ? MnemonicColors.UNIMPLEMENTED
|
||||||
|
: MnemonicColors.NORMAL;
|
||||||
lineList.add(new AttributedString(stringifyOpMnemonic(opcode), color, metrics));
|
lineList.add(new AttributedString(stringifyOpMnemonic(opcode), color, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendUserop(int id) {
|
public void appendUserop(int id) {
|
||||||
lineList.add(new AttributedString(stringifyUserop(language, id), useropColor, metrics));
|
lineList.add(
|
||||||
|
new AttributedString(stringifyUserop(language, id), PcodeColors.USEROP, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendRawVarnode(AddressSpace space, long offset, long size) {
|
public void appendRawVarnode(AddressSpace space, long offset, long size) {
|
||||||
lineList.add(new AttributedString(stringifyRawVarnode(space, offset, size), rawColor,
|
lineList.add(new AttributedString(stringifyRawVarnode(space, offset, size),
|
||||||
metrics));
|
PcodeColors.VARNODE, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
private AttributedString getAttributedChar(char c) {
|
private AttributedString getAttributedChar(char c) {
|
||||||
@@ -298,33 +190,36 @@ public class AttributedStringPcodeFormatter extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendAddressWordOffcut(long wordOffset, long offcut) {
|
public void appendAddressWordOffcut(long wordOffset, long offcut) {
|
||||||
lineList.add(new AttributedString(stringifyWordOffcut(wordOffset, offcut), addressColor,
|
lineList.add(new AttributedString(stringifyWordOffcut(wordOffset, offcut),
|
||||||
metrics));
|
ListingColors.ADDRESS, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendLabel(String label) {
|
public void appendLabel(String label) {
|
||||||
lineList.add(new AttributedString(label, localColor, metrics));
|
lineList.add(new AttributedString(label, LabelColors.LOCAL, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendRegister(Register register) {
|
public void appendRegister(Register register) {
|
||||||
lineList.add(new AttributedString(stringifyRegister(register), registerColor, metrics));
|
lineList.add(
|
||||||
|
new AttributedString(stringifyRegister(register), ListingColors.REGISTER, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendScalar(long value) {
|
public void appendScalar(long value) {
|
||||||
lineList.add(new AttributedString(stringifyScalarValue(value), scalarColor, metrics));
|
lineList.add(
|
||||||
|
new AttributedString(stringifyScalarValue(value), ListingColors.CONSTANT, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendSpace(AddressSpace space) {
|
public void appendSpace(AddressSpace space) {
|
||||||
lineList.add(new AttributedString(stringifySpace(space), spaceColor, metrics));
|
lineList.add(
|
||||||
|
new AttributedString(stringifySpace(space), PcodeColors.ADDRESS_SPACE, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendUnique(long offset) {
|
public void appendUnique(long offset) {
|
||||||
lineList.add(new AttributedString(stringifyUnique(offset), localColor, metrics));
|
lineList.add(new AttributedString(stringifyUnique(offset), LabelColors.LOCAL, metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+6
-24
@@ -18,6 +18,7 @@ package ghidra.app.util.viewer.field;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.options.ScreenElement;
|
import ghidra.app.util.viewer.options.ScreenElement;
|
||||||
@@ -29,27 +30,17 @@ public abstract class AbstractVariableFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
private static class ParameterFieldOptions {
|
private static class ParameterFieldOptions {
|
||||||
private final ScreenElement element;
|
private final ScreenElement element;
|
||||||
Color color;
|
|
||||||
FontMetrics defaultMetrics;
|
FontMetrics defaultMetrics;
|
||||||
FontMetrics[] fontMetrics = new FontMetrics[4];
|
FontMetrics[] fontMetrics = new FontMetrics[4];
|
||||||
int style = -1;
|
int style = -1;
|
||||||
|
|
||||||
ParameterFieldOptions(ScreenElement element) {
|
ParameterFieldOptions(ScreenElement element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
color = element.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
String getColorOptionName() {
|
|
||||||
return element.getColorOptionName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getStyleOptionName() {
|
String getStyleOptionName() {
|
||||||
return element.getStyleOptionName();
|
return element.getStyleOptionName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color getDefaultColor() {
|
|
||||||
return element.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int CUSTOM_PARAM_INDEX = 0;
|
private static final int CUSTOM_PARAM_INDEX = 0;
|
||||||
@@ -76,8 +67,6 @@ public abstract class AbstractVariableFieldFactory extends FieldFactory {
|
|||||||
protected AbstractVariableFieldFactory(String name, FieldFormatModel model,
|
protected AbstractVariableFieldFactory(String name, FieldFormatModel model,
|
||||||
HighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) {
|
HighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) {
|
||||||
super(name, model, highlightProvider, displayOptions, fieldOptions);
|
super(name, model, highlightProvider, displayOptions, fieldOptions);
|
||||||
|
|
||||||
initDisplayOptions(displayOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initDisplayOptions(Options displayOptions) {
|
protected void initDisplayOptions(Options displayOptions) {
|
||||||
@@ -86,7 +75,7 @@ public abstract class AbstractVariableFieldFactory extends FieldFactory {
|
|||||||
colorOptionName = "Variable Color";
|
colorOptionName = "Variable Color";
|
||||||
styleOptionName = "Variable Style";
|
styleOptionName = "Variable Style";
|
||||||
|
|
||||||
super.initDisplayOptions();
|
super.initDisplayOptions(displayOptions);
|
||||||
|
|
||||||
parameterFieldOptions = new ParameterFieldOptions[2];
|
parameterFieldOptions = new ParameterFieldOptions[2];
|
||||||
parameterFieldOptions[CUSTOM_PARAM_INDEX] =
|
parameterFieldOptions[CUSTOM_PARAM_INDEX] =
|
||||||
@@ -95,9 +84,6 @@ public abstract class AbstractVariableFieldFactory extends FieldFactory {
|
|||||||
new ParameterFieldOptions(OptionsGui.PARAMETER_DYNAMIC);
|
new ParameterFieldOptions(OptionsGui.PARAMETER_DYNAMIC);
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
parameterFieldOptions[i].color =
|
|
||||||
displayOptions.getColor(parameterFieldOptions[i].getColorOptionName(),
|
|
||||||
parameterFieldOptions[i].getDefaultColor());
|
|
||||||
parameterFieldOptions[i].style =
|
parameterFieldOptions[i].style =
|
||||||
displayOptions.getInt(parameterFieldOptions[i].getStyleOptionName(), -1);
|
displayOptions.getInt(parameterFieldOptions[i].getStyleOptionName(), -1);
|
||||||
setMetrics(baseFont, parameterFieldOptions[i]);
|
setMetrics(baseFont, parameterFieldOptions[i]);
|
||||||
@@ -115,10 +101,7 @@ public abstract class AbstractVariableFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (optionName.equals(parameterFieldOptions[i].getColorOptionName())) {
|
if (optionName.equals(styleOptionName)) {
|
||||||
parameterFieldOptions[i].color = (Color) newValue;
|
|
||||||
}
|
|
||||||
else if (optionName.equals(styleOptionName)) {
|
|
||||||
parameterFieldOptions[i].style = options.getInt(optionName, -1);
|
parameterFieldOptions[i].style = options.getInt(optionName, -1);
|
||||||
setMetrics(baseFont, parameterFieldOptions[i]);
|
setMetrics(baseFont, parameterFieldOptions[i]);
|
||||||
}
|
}
|
||||||
@@ -139,11 +122,10 @@ public abstract class AbstractVariableFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
protected Color getColor(Variable var) {
|
protected Color getColor(Variable var) {
|
||||||
if (var instanceof Parameter) {
|
if (var instanceof Parameter) {
|
||||||
int index = var.getFunction().hasCustomVariableStorage() ? CUSTOM_PARAM_INDEX
|
return var.getFunction().hasCustomVariableStorage() ? FunctionColors.PARAM_CUSTOM
|
||||||
: DYNAMIC_PARAM_INDEX;
|
: FunctionColors.PARAM_DYNAMIC;
|
||||||
return parameterFieldOptions[index].color;
|
|
||||||
}
|
}
|
||||||
return color;
|
return FunctionColors.PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FontMetrics getMetrics(Variable var) {
|
protected FontMetrics getMetrics(Variable var) {
|
||||||
|
|||||||
+3
-10
@@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.beans.PropertyEditor;
|
import java.beans.PropertyEditor;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -40,7 +38,6 @@ import ghidra.util.exception.AssertException;
|
|||||||
*/
|
*/
|
||||||
public class AddressFieldFactory extends FieldFactory {
|
public class AddressFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Address";
|
public static final String FIELD_NAME = "Address";
|
||||||
public static final Color DEFAULT_COLOR = Colors.FOREGROUND;
|
|
||||||
private final static String GROUP_TITLE = "Address Field";
|
private final static String GROUP_TITLE = "Address Field";
|
||||||
public final static String DISPLAY_BLOCK_NAME =
|
public final static String DISPLAY_BLOCK_NAME =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Display Block Name";
|
GROUP_TITLE + Options.DELIMITER + "Display Block Name";
|
||||||
@@ -96,11 +93,6 @@ public class AddressFieldFactory extends FieldFactory {
|
|||||||
fieldOptions.getOptions(GROUP_TITLE).setOptionsHelpLocation(helpLoc);
|
fieldOptions.getOptions(GROUP_TITLE).setOptionsHelpLocation(helpLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return DEFAULT_COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionsName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionsName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
@@ -123,8 +115,8 @@ public class AddressFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
CodeUnit cu = (CodeUnit) obj;
|
CodeUnit cu = (CodeUnit) obj;
|
||||||
String text = getAddressString(cu);
|
String text = getAddressString(cu);
|
||||||
FieldElement as =
|
FieldElement as = new TextFieldElement(
|
||||||
new TextFieldElement(new AttributedString(text, color, getMetrics()), 0, 0);
|
new AttributedString(text, ListingColors.ADDRESS, getMetrics()), 0, 0);
|
||||||
ListingTextField ltf;
|
ListingTextField ltf;
|
||||||
if (rightJustify) {
|
if (rightJustify) {
|
||||||
ltf = ListingTextField.createSingleLineTextFieldWithReverseClipping(this, proxy, as,
|
ltf = ListingTextField.createSingleLineTextFieldWithReverseClipping(this, proxy, as,
|
||||||
@@ -211,4 +203,5 @@ public class AddressFieldFactory extends FieldFactory {
|
|||||||
return new AddressFieldFactory(newModel, highlightStringProvider, toolOptions,
|
return new AddressFieldFactory(newModel, highlightStringProvider, toolOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-11
@@ -18,23 +18,16 @@ package ghidra.app.util.viewer.field;
|
|||||||
import java.beans.PropertyEditor;
|
import java.beans.PropertyEditor;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.AttributedString;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.field.FieldElement;
|
|
||||||
import docking.widgets.fieldpanel.field.TextFieldElement;
|
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.format.FormatManager;
|
import ghidra.app.util.viewer.format.FormatManager;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.CustomOption;
|
import ghidra.framework.options.*;
|
||||||
import ghidra.framework.options.OptionType;
|
|
||||||
import ghidra.framework.options.Options;
|
|
||||||
import ghidra.framework.options.ToolOptions;
|
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
import ghidra.program.model.listing.CodeUnit;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.listing.Data;
|
|
||||||
import ghidra.program.model.listing.Program;
|
|
||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
@@ -110,7 +103,8 @@ public class ArrayValuesFieldFactory extends FieldFactory {
|
|||||||
Data child = parent.getComponent(index++);
|
Data child = parent.getComponent(index++);
|
||||||
boolean isLastItem = isLastLine && (i == itemCount - 1);
|
boolean isLastItem = isLastLine && (i == itemCount - 1);
|
||||||
String value = getDisplayValue(child, !isLastItem);
|
String value = getDisplayValue(child, !isLastItem);
|
||||||
AttributedString as = new AttributedString(value, color, getMetrics());
|
AttributedString as =
|
||||||
|
new AttributedString(value, ListingColors.ARRAY_VALUES, getMetrics());
|
||||||
aStrings[i] = new TextFieldElement(as, i, 0);
|
aStrings[i] = new TextFieldElement(as, i, 0);
|
||||||
}
|
}
|
||||||
return ListingTextField.createPackedTextField(this, proxy, aStrings, startX + varWidth,
|
return ListingTextField.createPackedTextField(this, proxy, aStrings, startX + varWidth,
|
||||||
|
|||||||
+3
-15
@@ -15,14 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -36,7 +35,6 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
*/
|
*/
|
||||||
public class AssignedVariableFieldFactory extends FieldFactory {
|
public class AssignedVariableFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Var Assign";
|
public static final String FIELD_NAME = "Var Assign";
|
||||||
public static final Color DEFAULT_COLOR = Palette.PURPLE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
@@ -57,12 +55,6 @@ public class AssignedVariableFieldFactory extends FieldFactory {
|
|||||||
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FactoryField for the given object at index index.
|
* Returns the FactoryField for the given object at index index.
|
||||||
* @param varWidth the amount of variable width spacing for any fields
|
* @param varWidth the amount of variable width spacing for any fields
|
||||||
@@ -95,7 +87,8 @@ public class AssignedVariableFieldFactory extends FieldFactory {
|
|||||||
buf.append(var.getVariableStorage().toString());
|
buf.append(var.getVariableStorage().toString());
|
||||||
buf.append(" = ");
|
buf.append(" = ");
|
||||||
buf.append(var.getName());
|
buf.append(var.getName());
|
||||||
AttributedString as = new AttributedString(buf.toString(), color, getMetrics());
|
AttributedString as = new AttributedString(buf.toString(),
|
||||||
|
FunctionColors.VARIABLE_ASSIGNED, getMetrics());
|
||||||
elemenetList.add(new TextFieldElement(as, 0, 0));
|
elemenetList.add(new TextFieldElement(as, 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,9 +139,4 @@ public class AssignedVariableFieldFactory extends FieldFactory {
|
|||||||
return new AssignedVariableFieldFactory(formatModel, hsProvider, displayOptions,
|
return new AssignedVariableFieldFactory(formatModel, hsProvider, displayOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return DEFAULT_COLOR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-10
@@ -27,7 +27,6 @@ import java.math.BigInteger;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -47,8 +46,6 @@ import ghidra.util.HelpLocation;
|
|||||||
public class BytesFieldFactory extends FieldFactory {
|
public class BytesFieldFactory extends FieldFactory {
|
||||||
private static final int CHARS_IN_BYTE = 2;
|
private static final int CHARS_IN_BYTE = 2;
|
||||||
public static final String FIELD_NAME = "Bytes";
|
public static final String FIELD_NAME = "Bytes";
|
||||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
|
||||||
public static final Color ALIGNMENT_BYTES_COLOR = Palette.GRAY;
|
|
||||||
public final static String GROUP_TITLE = "Bytes Field";
|
public final static String GROUP_TITLE = "Bytes Field";
|
||||||
public final static String MAX_DISPLAY_LINES_MSG =
|
public final static String MAX_DISPLAY_LINES_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
||||||
@@ -211,10 +208,11 @@ public class BytesFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
FieldElement[] aStrings = new FieldElement[fieldElementLength + extraLen];
|
FieldElement[] aStrings = new FieldElement[fieldElementLength + extraLen];
|
||||||
|
|
||||||
buildAttributedByteValues(aStrings, 0, bytes, length, 0, color, extraLen != 0);
|
buildAttributedByteValues(aStrings, 0, bytes, length, 0, ListingColors.BYTES,
|
||||||
|
extraLen != 0);
|
||||||
if (extraLen != 0) {
|
if (extraLen != 0) {
|
||||||
buildAttributedByteValues(aStrings, fieldElementLength, alignmentBytes,
|
buildAttributedByteValues(aStrings, fieldElementLength, alignmentBytes,
|
||||||
alignmentBytes.length, residual, ALIGNMENT_BYTES_COLOR, false);
|
alignmentBytes.length, residual, ListingColors.BYTES_ALIGNMENT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListingTextField.createPackedTextField(this, proxy, aStrings, startX + varWidth,
|
return ListingTextField.createPackedTextField(this, proxy, aStrings, startX + varWidth,
|
||||||
@@ -434,11 +432,6 @@ public class BytesFieldFactory extends FieldFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return DEFAULT_COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||||
if (!CodeUnit.class.isAssignableFrom(proxyObjectClass)) {
|
if (!CodeUnit.class.isAssignableFrom(proxyObjectClass)) {
|
||||||
|
|||||||
+3
-3
@@ -52,8 +52,8 @@ public class DummyFieldFactory extends FieldFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int x = startX + varWidth;
|
int x = startX + varWidth;
|
||||||
FieldElement text =
|
FieldElement text = new TextFieldElement(
|
||||||
new TextFieldElement(new AttributedString("", color, getMetrics()), 0, 0);
|
new AttributedString("", ListingColors.BACKGROUND, getMetrics()), 0, 0);
|
||||||
|
|
||||||
return ListingTextField.createSingleLineTextField(this, obj, text, x, width, hlProvider);
|
return ListingTextField.createSingleLineTextField(this, obj, text, x, width, hlProvider);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public class DummyFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hlProvdier,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hlProvdier,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions options, ToolOptions fieldOptions) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-41
@@ -26,6 +26,7 @@ import docking.widgets.fieldpanel.field.*;
|
|||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.*;
|
import ghidra.app.util.*;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.CommentColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -43,25 +44,25 @@ import ghidra.util.bean.field.AnnotatedTextFieldElement;
|
|||||||
*/
|
*/
|
||||||
public class EolCommentFieldFactory extends FieldFactory {
|
public class EolCommentFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "EOL Comment";
|
public static final String FIELD_NAME = "EOL Comment";
|
||||||
private final static String GROUP_TITLE = "EOL Comments Field";
|
private static final String GROUP_TITLE = "EOL Comments Field";
|
||||||
private static final String SEMICOLON_PREFIX = "; ";
|
private static final String SEMICOLON_PREFIX = "; ";
|
||||||
public final static String ENABLE_WORD_WRAP_MSG =
|
public static final String ENABLE_WORD_WRAP_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Enable Word Wrapping";
|
GROUP_TITLE + Options.DELIMITER + "Enable Word Wrapping";
|
||||||
public final static String MAX_DISPLAY_LINES_MSG =
|
public static final String MAX_DISPLAY_LINES_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
||||||
public final static String ENABLE_SHOW_SEMICOLON_MSG =
|
public static final String ENABLE_SHOW_SEMICOLON_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Show Semicolon at Start of Each Line";
|
GROUP_TITLE + Options.DELIMITER + "Show Semicolon at Start of Each Line";
|
||||||
public final static String ENABLE_ALWAYS_SHOW_REPEATABLE_MSG =
|
public static final String ENABLE_ALWAYS_SHOW_REPEATABLE_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Always Show the Repeatable Comment";
|
GROUP_TITLE + Options.DELIMITER + "Always Show the Repeatable Comment";
|
||||||
public final static String ENABLE_ALWAYS_SHOW_REF_REPEATABLE_MSG =
|
public static final String ENABLE_ALWAYS_SHOW_REF_REPEATABLE_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Always Show the Referenced Repeatable Comments";
|
GROUP_TITLE + Options.DELIMITER + "Always Show the Referenced Repeatable Comments";
|
||||||
public final static String ENABLE_ALWAYS_SHOW_AUTOMATIC_MSG =
|
public static final String ENABLE_ALWAYS_SHOW_AUTOMATIC_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Always Show the Automatic Comment";
|
GROUP_TITLE + Options.DELIMITER + "Always Show the Automatic Comment";
|
||||||
public static final String USE_ABBREVIATED_AUTOMITIC_COMMENT_MSG =
|
public static final String USE_ABBREVIATED_AUTOMITIC_COMMENT_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Use Abbreviated Automatic Comments";
|
GROUP_TITLE + Options.DELIMITER + "Use Abbreviated Automatic Comments";
|
||||||
public static final String SHOW_FUNCTION_AUTOMITIC_COMMENT_MSG =
|
public static final String SHOW_FUNCTION_AUTOMITIC_COMMENT_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Show Function Reference Automatic Comments";
|
GROUP_TITLE + Options.DELIMITER + "Show Function Reference Automatic Comments";
|
||||||
public final static String ENABLE_PREPEND_REF_ADDRESS_MSG =
|
public static final String ENABLE_PREPEND_REF_ADDRESS_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Prepend the Address to Each Referenced Comment";
|
GROUP_TITLE + Options.DELIMITER + "Prepend the Address to Each Referenced Comment";
|
||||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
||||||
|
|
||||||
@@ -74,9 +75,6 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
private boolean useAbbreviatedAutomatic;
|
private boolean useAbbreviatedAutomatic;
|
||||||
private boolean showAutomaticFunctions;
|
private boolean showAutomaticFunctions;
|
||||||
private boolean prependRefAddress;
|
private boolean prependRefAddress;
|
||||||
private Color repeatableCommentColor;
|
|
||||||
private Color automaticCommentColor;
|
|
||||||
private Color refRepeatableCommentColor;
|
|
||||||
private int repeatableCommentStyle;
|
private int repeatableCommentStyle;
|
||||||
private int automaticCommentStyle;
|
private int automaticCommentStyle;
|
||||||
private int refRepeatableCommentStyle;
|
private int refRepeatableCommentStyle;
|
||||||
@@ -138,19 +136,10 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
maxDisplayLines = fieldOptions.getInt(MAX_DISPLAY_LINES_MSG, 6);
|
maxDisplayLines = fieldOptions.getInt(MAX_DISPLAY_LINES_MSG, 6);
|
||||||
isWordWrap = fieldOptions.getBoolean(ENABLE_WORD_WRAP_MSG, false);
|
isWordWrap = fieldOptions.getBoolean(ENABLE_WORD_WRAP_MSG, false);
|
||||||
repeatableCommentColor =
|
|
||||||
displayOptions.getColor(OptionsGui.COMMENT_REPEATABLE.getColorOptionName(),
|
|
||||||
OptionsGui.COMMENT_REPEATABLE.getDefaultColor());
|
|
||||||
repeatableCommentStyle =
|
repeatableCommentStyle =
|
||||||
displayOptions.getInt(OptionsGui.COMMENT_REPEATABLE.getStyleOptionName(), -1);
|
displayOptions.getInt(OptionsGui.COMMENT_REPEATABLE.getStyleOptionName(), -1);
|
||||||
automaticCommentColor =
|
|
||||||
displayOptions.getColor(OptionsGui.COMMENT_AUTO.getColorOptionName(),
|
|
||||||
OptionsGui.COMMENT_AUTO.getDefaultColor());
|
|
||||||
automaticCommentStyle =
|
automaticCommentStyle =
|
||||||
displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1);
|
displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1);
|
||||||
refRepeatableCommentColor =
|
|
||||||
displayOptions.getColor(OptionsGui.COMMENT_REF_REPEAT.getColorOptionName(),
|
|
||||||
OptionsGui.COMMENT_REF_REPEAT.getDefaultColor());
|
|
||||||
refRepeatableCommentStyle =
|
refRepeatableCommentStyle =
|
||||||
displayOptions.getInt(OptionsGui.COMMENT_REF_REPEAT.getStyleOptionName(), -1);
|
displayOptions.getInt(OptionsGui.COMMENT_REF_REPEAT.getStyleOptionName(), -1);
|
||||||
showSemicolon = fieldOptions.getBoolean(ENABLE_SHOW_SEMICOLON_MSG, false);
|
showSemicolon = fieldOptions.getBoolean(ENABLE_SHOW_SEMICOLON_MSG, false);
|
||||||
@@ -160,8 +149,7 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
alwaysShowAutomatic = fieldOptions.getBoolean(ENABLE_ALWAYS_SHOW_AUTOMATIC_MSG, false);
|
alwaysShowAutomatic = fieldOptions.getBoolean(ENABLE_ALWAYS_SHOW_AUTOMATIC_MSG, false);
|
||||||
useAbbreviatedAutomatic =
|
useAbbreviatedAutomatic =
|
||||||
fieldOptions.getBoolean(USE_ABBREVIATED_AUTOMITIC_COMMENT_MSG, true);
|
fieldOptions.getBoolean(USE_ABBREVIATED_AUTOMITIC_COMMENT_MSG, true);
|
||||||
showAutomaticFunctions =
|
showAutomaticFunctions = fieldOptions.getBoolean(SHOW_FUNCTION_AUTOMITIC_COMMENT_MSG, true);
|
||||||
fieldOptions.getBoolean(SHOW_FUNCTION_AUTOMITIC_COMMENT_MSG, true);
|
|
||||||
|
|
||||||
prependRefAddress = fieldOptions.getBoolean(ENABLE_PREPEND_REF_ADDRESS_MSG, false);
|
prependRefAddress = fieldOptions.getBoolean(ENABLE_PREPEND_REF_ADDRESS_MSG, false);
|
||||||
|
|
||||||
@@ -225,9 +213,6 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
*/
|
*/
|
||||||
private void adjustRepeatableDisplayOptions(Options options, String optionName, Object oldValue,
|
private void adjustRepeatableDisplayOptions(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
if (optionName.equals(OptionsGui.COMMENT_REPEATABLE.getColorOptionName())) {
|
|
||||||
repeatableCommentColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
String repeatableStyleName = OptionsGui.COMMENT_REPEATABLE.getStyleOptionName();
|
String repeatableStyleName = OptionsGui.COMMENT_REPEATABLE.getStyleOptionName();
|
||||||
if (optionName.equals(repeatableStyleName)) {
|
if (optionName.equals(repeatableStyleName)) {
|
||||||
repeatableCommentStyle = options.getInt(repeatableStyleName, -1);
|
repeatableCommentStyle = options.getInt(repeatableStyleName, -1);
|
||||||
@@ -244,9 +229,6 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
*/
|
*/
|
||||||
private void adjustRefRepeatDisplayOptions(Options options, String optionName, Object oldValue,
|
private void adjustRefRepeatDisplayOptions(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
if (optionName.equals(OptionsGui.COMMENT_REF_REPEAT.getColorOptionName())) {
|
|
||||||
refRepeatableCommentColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
String refRepeatStyleName = OptionsGui.COMMENT_REF_REPEAT.getStyleOptionName();
|
String refRepeatStyleName = OptionsGui.COMMENT_REF_REPEAT.getStyleOptionName();
|
||||||
if (optionName.equals(refRepeatStyleName)) {
|
if (optionName.equals(refRepeatStyleName)) {
|
||||||
refRepeatableCommentStyle = options.getInt(refRepeatStyleName, -1);
|
refRepeatableCommentStyle = options.getInt(refRepeatStyleName, -1);
|
||||||
@@ -262,9 +244,6 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
*/
|
*/
|
||||||
private void adjustAutomaticCommentDisplayOptions(Options options, String optionName,
|
private void adjustAutomaticCommentDisplayOptions(Options options, String optionName,
|
||||||
Object oldValue, Object newValue) {
|
Object oldValue, Object newValue) {
|
||||||
if (optionName.equals(OptionsGui.COMMENT_AUTO.getColorOptionName())) {
|
|
||||||
automaticCommentColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
String automaticCommentStyleName = OptionsGui.COMMENT_AUTO.getStyleOptionName();
|
String automaticCommentStyleName = OptionsGui.COMMENT_AUTO.getStyleOptionName();
|
||||||
if (optionName.equals(automaticCommentStyleName)) {
|
if (optionName.equals(automaticCommentStyleName)) {
|
||||||
automaticCommentStyle = options.getInt(automaticCommentStyleName, -1);
|
automaticCommentStyle = options.getInt(automaticCommentStyleName, -1);
|
||||||
@@ -315,8 +294,8 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
List<FieldElement> elementList = new ArrayList<>();
|
List<FieldElement> elementList = new ArrayList<>();
|
||||||
|
|
||||||
// This Code Unit's End of Line Comment
|
// This Code Unit's End of Line Comment
|
||||||
AttributedString myEolPrefixString =
|
AttributedString myEolPrefixString = new AttributedString(SEMICOLON_PREFIX,
|
||||||
new AttributedString(SEMICOLON_PREFIX, color, getMetrics(style), false, null);
|
CommentColors.EOL, getMetrics(style), false, null);
|
||||||
String[] eolComments = displayableEol.getEOLComments();
|
String[] eolComments = displayableEol.getEOLComments();
|
||||||
List<FieldElement> eolFieldElements = convertToFieldElements(program, eolComments,
|
List<FieldElement> eolFieldElements = convertToFieldElements(program, eolComments,
|
||||||
myEolPrefixString, showSemicolon, isWordWrap, getNextRow(elementList));
|
myEolPrefixString, showSemicolon, isWordWrap, getNextRow(elementList));
|
||||||
@@ -325,7 +304,7 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
// This Code Unit's Repeatable Comment
|
// This Code Unit's Repeatable Comment
|
||||||
if (alwaysShowRepeatable || elementList.isEmpty()) {
|
if (alwaysShowRepeatable || elementList.isEmpty()) {
|
||||||
AttributedString myRepeatablePrefixString = new AttributedString(SEMICOLON_PREFIX,
|
AttributedString myRepeatablePrefixString = new AttributedString(SEMICOLON_PREFIX,
|
||||||
repeatableCommentColor, getMetrics(repeatableCommentStyle), false, null);
|
CommentColors.REPEATABLE, getMetrics(repeatableCommentStyle), false, null);
|
||||||
String[] repeatableComments = displayableEol.getRepeatableComments();
|
String[] repeatableComments = displayableEol.getRepeatableComments();
|
||||||
List<FieldElement> repeatableFieldElements =
|
List<FieldElement> repeatableFieldElements =
|
||||||
convertToFieldElements(program, repeatableComments, myRepeatablePrefixString,
|
convertToFieldElements(program, repeatableComments, myRepeatablePrefixString,
|
||||||
@@ -336,7 +315,7 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
// Referenced Repeatable Comments
|
// Referenced Repeatable Comments
|
||||||
if (alwaysShowRefRepeatables || elementList.isEmpty()) {
|
if (alwaysShowRefRepeatables || elementList.isEmpty()) {
|
||||||
AttributedString refRepeatPrefixString = new AttributedString(SEMICOLON_PREFIX,
|
AttributedString refRepeatPrefixString = new AttributedString(SEMICOLON_PREFIX,
|
||||||
refRepeatableCommentColor, getMetrics(refRepeatableCommentStyle), false, null);
|
CommentColors.REF_REPEATABLE, getMetrics(refRepeatableCommentStyle), false, null);
|
||||||
int refRepeatCount = displayableEol.getReferencedRepeatableCommentsCount();
|
int refRepeatCount = displayableEol.getReferencedRepeatableCommentsCount();
|
||||||
for (int subTypeIndex = 0; subTypeIndex < refRepeatCount; subTypeIndex++) {
|
for (int subTypeIndex = 0; subTypeIndex < refRepeatCount; subTypeIndex++) {
|
||||||
RefRepeatComment refRepeatComment =
|
RefRepeatComment refRepeatComment =
|
||||||
@@ -352,7 +331,7 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
// Automatic Comment
|
// Automatic Comment
|
||||||
if (alwaysShowAutomatic || elementList.isEmpty()) {
|
if (alwaysShowAutomatic || elementList.isEmpty()) {
|
||||||
AttributedString autoCommentPrefixString = new AttributedString(SEMICOLON_PREFIX,
|
AttributedString autoCommentPrefixString = new AttributedString(SEMICOLON_PREFIX,
|
||||||
automaticCommentColor, getMetrics(automaticCommentStyle), false, null);
|
CommentColors.AUTO, getMetrics(automaticCommentStyle), false, null);
|
||||||
String[] autoComment = displayableEol.getAutomaticComment();
|
String[] autoComment = displayableEol.getAutomaticComment();
|
||||||
List<FieldElement> autoCommentFieldElements =
|
List<FieldElement> autoCommentFieldElements =
|
||||||
convertToFieldElements(program, autoComment, autoCommentPrefixString, showSemicolon,
|
convertToFieldElements(program, autoComment, autoCommentPrefixString, showSemicolon,
|
||||||
@@ -575,11 +554,6 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||||||
newFieldOptions);
|
newFieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.COMMENT_EOL.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the array of comments to a single string and use the given
|
* Convert the array of comments to a single string and use the given
|
||||||
* separatorChar as the delimiter.
|
* separatorChar as the delimiter.
|
||||||
|
|||||||
@@ -19,12 +19,9 @@ import java.awt.*;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import generic.theme.Gui;
|
import generic.theme.Gui;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -48,8 +45,6 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
protected String name;
|
protected String name;
|
||||||
protected int startX;
|
protected int startX;
|
||||||
protected int width;
|
protected int width;
|
||||||
protected Color color;
|
|
||||||
protected Color underlineColor = Palette.BLUE;
|
|
||||||
private FontMetrics defaultMetrics;
|
private FontMetrics defaultMetrics;
|
||||||
private FontMetrics[] fontMetrics = new FontMetrics[4];
|
private FontMetrics[] fontMetrics = new FontMetrics[4];
|
||||||
protected Font baseFont;
|
protected Font baseFont;
|
||||||
@@ -59,7 +54,6 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
|
|
||||||
protected String colorOptionName;
|
protected String colorOptionName;
|
||||||
protected String styleOptionName;
|
protected String styleOptionName;
|
||||||
protected Options displayOptions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base constructor
|
* Base constructor
|
||||||
@@ -79,26 +73,23 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
|
|
||||||
width = 100;
|
width = 100;
|
||||||
|
|
||||||
this.displayOptions = displayOptions;
|
initDisplayOptions(displayOptions);
|
||||||
initDisplayOptions();
|
initFieldOptions(fieldOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initFieldOptions(Options fieldOptions) {
|
||||||
fieldOptions.getOptions(name)
|
fieldOptions.getOptions(name)
|
||||||
.setOptionsHelpLocation(new HelpLocation("CodeBrowserPlugin", name));
|
.setOptionsHelpLocation(new HelpLocation("CodeBrowserPlugin", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initDisplayOptions() {
|
protected void initDisplayOptions(Options displayOptions) {
|
||||||
baseFont = Gui.getFont(BASE_LISTING_FONT_ID);
|
baseFont = Gui.getFont(BASE_LISTING_FONT_ID);
|
||||||
// For most fields (defined in optionsGui) these will be set. But "ad hoc" fields won't,
|
// For most fields (defined in optionsGui) these will be set. But "ad hoc" fields won't,
|
||||||
// so register something. A second registration won't change the original
|
// so register something. A second registration won't change the original
|
||||||
|
|
||||||
displayOptions.registerThemeColorBinding(colorOptionName, Colors.FOREGROUND.getId(), null,
|
|
||||||
"Sets the " + colorOptionName);
|
|
||||||
displayOptions.registerOption(styleOptionName, -1, null, "Sets the " + style);
|
displayOptions.registerOption(styleOptionName, -1, null, "Sets the " + style);
|
||||||
|
|
||||||
color = displayOptions.getColor(colorOptionName, getDefaultColor());
|
|
||||||
style = displayOptions.getInt(styleOptionName, -1);
|
style = displayOptions.getInt(styleOptionName, -1);
|
||||||
underlineColor = displayOptions.getColor(OptionsGui.UNDERLINE.getColorOptionName(),
|
|
||||||
OptionsGui.UNDERLINE.getDefaultColor());
|
|
||||||
setMetrics(baseFont);
|
setMetrics(baseFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,24 +101,6 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notification that the Options have changed.
|
|
||||||
* @param options the Options object that changed. Will be either the display
|
|
||||||
* options or the field options.
|
|
||||||
* @param optionName the name of the property that changed.
|
|
||||||
* @param oldValue the old value of the property.
|
|
||||||
* @param newValue the new value of the property.
|
|
||||||
*/
|
|
||||||
public void optionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
if (options == displayOptions) {
|
|
||||||
displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fieldOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification the services changed. Subclasses should override this method
|
* Notification the services changed. Subclasses should override this method
|
||||||
* if they care about service changes.
|
* if they care about service changes.
|
||||||
@@ -161,16 +134,10 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
baseFont = SystemUtilities.adjustForFontSizeOverride((Font) newValue);
|
baseFont = SystemUtilities.adjustForFontSizeOverride((Font) newValue);
|
||||||
setMetrics(baseFont);
|
setMetrics(baseFont);
|
||||||
}
|
}
|
||||||
else if (optionName.equals(colorOptionName)) {
|
|
||||||
color = (Color) newValue;
|
|
||||||
}
|
|
||||||
else if (optionName.equals(styleOptionName)) {
|
else if (optionName.equals(styleOptionName)) {
|
||||||
style = options.getInt(optionName, -1);
|
style = options.getInt(optionName, -1);
|
||||||
setMetrics(baseFont);
|
setMetrics(baseFont);
|
||||||
}
|
}
|
||||||
else if (optionName.equals(OptionsGui.UNDERLINE.getColorOptionName())) {
|
|
||||||
underlineColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
model.update();
|
model.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,14 +161,6 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the default field color.
|
|
||||||
* @return the color.
|
|
||||||
*/
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return Colors.FOREGROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the starting x position for the fields generated by this factory.
|
* Returns the starting x position for the fields generated by this factory.
|
||||||
* @return the start x.
|
* @return the start x.
|
||||||
|
|||||||
+2
-8
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
@@ -24,7 +23,6 @@ import ghidra.GhidraOptions;
|
|||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.format.FormatManager;
|
import ghidra.app.util.viewer.format.FormatManager;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -115,7 +113,8 @@ public class FieldNameFieldFactory extends FieldFactory {
|
|||||||
if ((fieldName == null) || (fieldName.length() == 0)) {
|
if ((fieldName == null) || (fieldName.length() == 0)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AttributedString as = new AttributedString(fieldName, color, getMetrics());
|
AttributedString as =
|
||||||
|
new AttributedString(fieldName, ListingColors.FIELD_NAME, getMetrics());
|
||||||
FieldElement text = new TextFieldElement(as, 0, 0);
|
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||||
|
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||||
@@ -160,9 +159,4 @@ public class FieldNameFieldFactory extends FieldFactory {
|
|||||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new FieldNameFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
return new FieldNameFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.FIELD_NAME.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -20,6 +20,7 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -41,6 +42,7 @@ import ghidra.util.exception.AssertException;
|
|||||||
public class FileOffsetFieldFactory extends FieldFactory {
|
public class FileOffsetFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "File Offset";
|
public static final String FIELD_NAME = "File Offset";
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.file.offset");
|
||||||
public static final String GROUP_TITLE = "File Offset Field";
|
public static final String GROUP_TITLE = "File Offset Field";
|
||||||
public final static String FILE_OFFSET_DISPLAY_OPTIONS_NAME =
|
public final static String FILE_OFFSET_DISPLAY_OPTIONS_NAME =
|
||||||
GROUP_TITLE + Options.DELIMITER + "File Offset Display Options";
|
GROUP_TITLE + Options.DELIMITER + "File Offset Display Options";
|
||||||
@@ -141,7 +143,7 @@ public class FileOffsetFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FieldElement fieldElement =
|
FieldElement fieldElement =
|
||||||
new TextFieldElement(new AttributedString(text, color, getMetrics()), 0, 0);
|
new TextFieldElement(new AttributedString(text, COLOR, getMetrics()), 0, 0);
|
||||||
ListingTextField listingTextField = ListingTextField.createSingleLineTextField(this, proxy,
|
ListingTextField listingTextField = ListingTextField.createSingleLineTextField(this, proxy,
|
||||||
fieldElement, startX + varWidth, width, hlProvider);
|
fieldElement, startX + varWidth, width, hlProvider);
|
||||||
listingTextField.setPrimary(true);
|
listingTextField.setPrimary(true);
|
||||||
@@ -191,5 +193,4 @@ public class FileOffsetFieldFactory extends FieldFactory {
|
|||||||
return (category == FieldFormatModel.INSTRUCTION_OR_DATA ||
|
return (category == FieldFormatModel.INSTRUCTION_OR_DATA ||
|
||||||
category == FieldFormatModel.OPEN_DATA || category == FieldFormatModel.ARRAY);
|
category == FieldFormatModel.OPEN_DATA || category == FieldFormatModel.ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-30
@@ -15,15 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -38,8 +37,6 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class FunctionCallFixupFieldFactory extends FieldFactory {
|
public class FunctionCallFixupFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Function Call-Fixup";
|
public static final String FIELD_NAME = "Function Call-Fixup";
|
||||||
private Color fixupColor;
|
|
||||||
private Color literalColor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -59,20 +56,6 @@ public class FunctionCallFixupFieldFactory extends FieldFactory {
|
|||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
|
|
||||||
literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
|
||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
|
||||||
fixupColor = displayOptions.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_CALL_FIXUP.getDefaultColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
literalColor = options.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_CALL_FIXUP.getDefaultColor());
|
|
||||||
fixupColor = options.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_CALL_FIXUP.getDefaultColor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,10 +74,10 @@ public class FunctionCallFixupFieldFactory extends FieldFactory {
|
|||||||
AttributedString as;
|
AttributedString as;
|
||||||
int elementIndex = 0;
|
int elementIndex = 0;
|
||||||
|
|
||||||
as = new AttributedString("Call-Fixup: ", literalColor, getMetrics());
|
as = new AttributedString("Call-Fixup: ", ListingColors.SEPARATOR, getMetrics());
|
||||||
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
||||||
|
|
||||||
as = new AttributedString(callFixupStr, fixupColor, getMetrics());
|
as = new AttributedString(callFixupStr, FunctionColors.CALL_FIXUP, getMetrics());
|
||||||
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
||||||
|
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy,
|
return ListingTextField.createSingleLineTextField(this, proxy,
|
||||||
@@ -141,14 +124,4 @@ public class FunctionCallFixupFieldFactory extends FieldFactory {
|
|||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.FUN_CALL_FIXUP.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// don't care
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -19,10 +19,9 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GColor;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -32,6 +31,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
|
|
||||||
public class FunctionPurgeFieldFactory extends FieldFactory {
|
public class FunctionPurgeFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Function Purge";
|
public static final String FIELD_NAME = "Function Purge";
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.function.purge");
|
||||||
|
|
||||||
public FunctionPurgeFieldFactory() {
|
public FunctionPurgeFieldFactory() {
|
||||||
super(FIELD_NAME);
|
super(FIELD_NAME);
|
||||||
@@ -40,8 +40,6 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||||||
private FunctionPurgeFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
private FunctionPurgeFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
color = displayOptions.getColor(OptionsGui.BYTES.getColorOptionName(),
|
|
||||||
OptionsGui.BYTES.getDefaultColor());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +77,7 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||||||
stringDepth = Integer.toHexString(depth);
|
stringDepth = Integer.toHexString(depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AttributedString as = new AttributedString(stringDepth, Palette.BLUE, getMetrics());
|
AttributedString as = new AttributedString(stringDepth, COLOR, getMetrics());
|
||||||
FieldElement text = new TextFieldElement(as, 0, 0);
|
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
@@ -123,5 +121,4 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
return (category == FieldFormatModel.FUNCTION);
|
return (category == FieldFormatModel.FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-11
@@ -15,15 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.AttributedString;
|
import docking.widgets.fieldpanel.field.AttributedString;
|
||||||
import docking.widgets.fieldpanel.field.FieldElement;
|
import docking.widgets.fieldpanel.field.FieldElement;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.CommentColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -38,6 +38,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
*/
|
*/
|
||||||
public class FunctionRepeatableCommentFieldFactory extends FieldFactory {
|
public class FunctionRepeatableCommentFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Function Repeatable Comment";
|
public static final String FIELD_NAME = "Function Repeatable Comment";
|
||||||
|
public static final GColor COLOR = new GColor("color.fg.listing.comment.repeatable");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -70,7 +71,8 @@ public class FunctionRepeatableCommentFieldFactory extends FieldFactory {
|
|||||||
Program program = f.getProgram();
|
Program program = f.getProgram();
|
||||||
String[] commentArr = f.getRepeatableCommentAsArray();
|
String[] commentArr = f.getRepeatableCommentAsArray();
|
||||||
FieldElement[] fields = new FieldElement[commentArr.length];
|
FieldElement[] fields = new FieldElement[commentArr.length];
|
||||||
AttributedString prototype = new AttributedString("prototype", color, getMetrics());
|
AttributedString prototype =
|
||||||
|
new AttributedString("prototype", CommentColors.REPEATABLE, getMetrics());
|
||||||
for (int i = 0; i < commentArr.length; i++) {
|
for (int i = 0; i < commentArr.length; i++) {
|
||||||
fields[i] = CommentUtils.parseTextForAnnotations(commentArr[i], program, prototype, i);
|
fields[i] = CommentUtils.parseTextForAnnotations(commentArr[i], program, prototype, i);
|
||||||
}
|
}
|
||||||
@@ -125,12 +127,4 @@ public class FunctionRepeatableCommentFieldFactory extends FieldFactory {
|
|||||||
return new FunctionRepeatableCommentFieldFactory(formatModel, provider, options,
|
return new FunctionRepeatableCommentFieldFactory(formatModel, provider, options,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.COMMENT_EOL.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-79
@@ -23,12 +23,10 @@ import java.util.List;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -48,17 +46,7 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
GROUP_TITLE + Options.DELIMITER + GhidraOptions.DISPLAY_NAMESPACE;
|
GROUP_TITLE + Options.DELIMITER + GhidraOptions.DISPLAY_NAMESPACE;
|
||||||
|
|
||||||
private boolean displayFunctionScope;
|
private boolean displayFunctionScope;
|
||||||
private Color funNameColor;
|
|
||||||
private Color unresolvedThunkRefColor;
|
|
||||||
private Color resolvedThunkRefColor;
|
|
||||||
private Color funRetColor;
|
|
||||||
private Color literalColor;
|
|
||||||
private Color funParamsColor;
|
|
||||||
private Color autoParamColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default Constructor
|
|
||||||
*/
|
|
||||||
public FunctionSignatureFieldFactory() {
|
public FunctionSignatureFieldFactory() {
|
||||||
super(FIELD_NAME);
|
super(FIELD_NAME);
|
||||||
}
|
}
|
||||||
@@ -78,45 +66,6 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
"Prepends namespaces to labels that are not in the global namespace.");
|
"Prepends namespaces to labels that are not in the global namespace.");
|
||||||
|
|
||||||
displayFunctionScope = fieldOptions.getBoolean(DISPLAY_NAMESPACE, false);
|
displayFunctionScope = fieldOptions.getBoolean(DISPLAY_NAMESPACE, false);
|
||||||
|
|
||||||
funRetColor = displayOptions.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_RET_TYPE.getDefaultColor());
|
|
||||||
funNameColor = displayOptions.getColor(OptionsGui.FUN_NAME.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_NAME.getDefaultColor());
|
|
||||||
unresolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
|
||||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
|
||||||
resolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
|
||||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
|
||||||
funParamsColor = displayOptions.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_PARAMS.getDefaultColor());
|
|
||||||
autoParamColor = displayOptions.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_PARAMS.getDefaultColor());
|
|
||||||
literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
|
||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
funRetColor =
|
|
||||||
options.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), Colors.FOREGROUND);
|
|
||||||
funNameColor =
|
|
||||||
options.getColor(OptionsGui.FUN_NAME.getColorOptionName(), Colors.FOREGROUND);
|
|
||||||
unresolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
|
||||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
|
||||||
resolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
|
||||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
|
||||||
funParamsColor =
|
|
||||||
options.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), Colors.FOREGROUND);
|
|
||||||
autoParamColor =
|
|
||||||
options.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), Palette.GRAY);
|
|
||||||
literalColor =
|
|
||||||
options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Colors.FOREGROUND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -135,7 +84,8 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
// inline
|
// inline
|
||||||
if (function.isInline()) {
|
if (function.isInline()) {
|
||||||
as = new AttributedString(Function.INLINE + " ", funRetColor, getMetrics());
|
as = new AttributedString(Function.INLINE + " ", FunctionColors.RETURN_TYPE,
|
||||||
|
getMetrics());
|
||||||
textElements.add(new FunctionInlineFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionInlineFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
@@ -143,7 +93,8 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
// thunk
|
// thunk
|
||||||
if (function.isThunk()) {
|
if (function.isThunk()) {
|
||||||
as = new AttributedString(Function.THUNK + " ", funRetColor, getMetrics());
|
as = new AttributedString(Function.THUNK + " ", FunctionColors.RETURN_TYPE,
|
||||||
|
getMetrics());
|
||||||
textElements.add(new FunctionThunkFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionThunkFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
@@ -151,7 +102,8 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
// noreturn
|
// noreturn
|
||||||
if (function.hasNoReturn()) {
|
if (function.hasNoReturn()) {
|
||||||
as = new AttributedString(Function.NORETURN + " ", funRetColor, getMetrics());
|
as = new AttributedString(Function.NORETURN + " ", FunctionColors.RETURN_TYPE,
|
||||||
|
getMetrics());
|
||||||
textElements.add(new FunctionNoReturnFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionNoReturnFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
@@ -159,7 +111,7 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
// return type
|
// return type
|
||||||
as = new AttributedString(function.getReturn().getFormalDataType().getDisplayName() + " ",
|
as = new AttributedString(function.getReturn().getFormalDataType().getDisplayName() + " ",
|
||||||
funRetColor, getMetrics());
|
FunctionColors.RETURN_TYPE, getMetrics());
|
||||||
textElements.add(new FunctionReturnTypeFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionReturnTypeFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
@@ -171,9 +123,10 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
if (callingConvention != null &&
|
if (callingConvention != null &&
|
||||||
!callingConvention.equals(Function.UNKNOWN_CALLING_CONVENTION_STRING)) {
|
!callingConvention.equals(Function.UNKNOWN_CALLING_CONVENTION_STRING)) {
|
||||||
as = new AttributedString(callingConvention + " ", funRetColor, getMetrics());
|
as = new AttributedString(callingConvention + " ", FunctionColors.RETURN_TYPE,
|
||||||
textElements.add(
|
getMetrics());
|
||||||
new FunctionCallingConventionFieldElement(as, elementIndex, 0, startCol));
|
textElements
|
||||||
|
.add(new FunctionCallingConventionFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
}
|
}
|
||||||
@@ -186,14 +139,15 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
elementIndex++;
|
elementIndex++;
|
||||||
|
|
||||||
// opening parenthesis
|
// opening parenthesis
|
||||||
as = new AttributedString("(", literalColor, getMetrics());
|
as = new AttributedString("(", ListingColors.SEPARATOR, getMetrics());
|
||||||
textElements.add(new FunctionStartParametersFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionStartParametersFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
int paramOffset = 0;
|
int paramOffset = 0;
|
||||||
AttributedString commaSeparator = new AttributedString(", ", literalColor, getMetrics());
|
AttributedString commaSeparator =
|
||||||
|
new AttributedString(", ", ListingColors.SEPARATOR, getMetrics());
|
||||||
int lastParam = params.length - 1;
|
int lastParam = params.length - 1;
|
||||||
for (int i = 0; i < params.length; i++) {
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
|
||||||
@@ -202,7 +156,8 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Color pcolor = params[i].isAutoParameter() ? autoParamColor : funParamsColor;
|
Color pcolor =
|
||||||
|
params[i].isAutoParameter() ? FunctionColors.PARAM_AUTO : FunctionColors.PARAM;
|
||||||
|
|
||||||
String text = params[i].getFormalDataType().getDisplayName() + " ";
|
String text = params[i].getFormalDataType().getDisplayName() + " ";
|
||||||
as = new AttributedString(text, pcolor, getMetrics());
|
as = new AttributedString(text, pcolor, getMetrics());
|
||||||
@@ -238,23 +193,23 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
paramOffset += commaSeparator.length();
|
paramOffset += commaSeparator.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
}
|
}
|
||||||
as = new AttributedString(FunctionSignature.VAR_ARGS_DISPLAY_STRING, funParamsColor,
|
as = new AttributedString(FunctionSignature.VAR_ARGS_DISPLAY_STRING,
|
||||||
getMetrics());
|
FunctionColors.PARAM, getMetrics());
|
||||||
textElements.add(new FunctionSignatureFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionSignatureFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
}
|
}
|
||||||
else if (lastParam < 0 && function.getSignatureSource() != SourceType.DEFAULT) {
|
else if (lastParam < 0 && function.getSignatureSource() != SourceType.DEFAULT) {
|
||||||
// void parameter list
|
// void parameter list
|
||||||
as = new AttributedString(FunctionSignature.VOID_PARAM_DISPLAY_STRING, funParamsColor,
|
as = new AttributedString(FunctionSignature.VOID_PARAM_DISPLAY_STRING,
|
||||||
getMetrics());
|
FunctionColors.PARAM, getMetrics());
|
||||||
textElements.add(new FunctionSignatureFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionSignatureFieldElement(as, elementIndex, 0, startCol));
|
||||||
startCol += as.length();
|
startCol += as.length();
|
||||||
elementIndex++;
|
elementIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// closing parenthesis
|
// closing parenthesis
|
||||||
as = new AttributedString(")", literalColor, getMetrics());
|
as = new AttributedString(")", ListingColors.SEPARATOR, getMetrics());
|
||||||
textElements.add(new FunctionEndParametersFieldElement(as, elementIndex, 0, startCol));
|
textElements.add(new FunctionEndParametersFieldElement(as, elementIndex, 0, startCol));
|
||||||
|
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy,
|
return ListingTextField.createSingleLineTextField(this, proxy,
|
||||||
@@ -266,23 +221,23 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
if (function.isThunk()) {
|
if (function.isThunk()) {
|
||||||
Function thunkedFunction = function.getThunkedFunction(true);
|
Function thunkedFunction = function.getThunkedFunction(true);
|
||||||
if (thunkedFunction == null) {
|
if (thunkedFunction == null) {
|
||||||
return unresolvedThunkRefColor;
|
return ListingColors.EXT_REF_UNRESOLVED;
|
||||||
}
|
}
|
||||||
else if (thunkedFunction.isExternal()) {
|
else if (thunkedFunction.isExternal()) {
|
||||||
ExternalLocation externalLocation = thunkedFunction.getExternalLocation();
|
ExternalLocation externalLocation = thunkedFunction.getExternalLocation();
|
||||||
String libName = externalLocation.getLibraryName();
|
String libName = externalLocation.getLibraryName();
|
||||||
if (Library.UNKNOWN.equals(libName)) {
|
if (Library.UNKNOWN.equals(libName)) {
|
||||||
return unresolvedThunkRefColor;
|
return ListingColors.EXT_REF_UNRESOLVED;
|
||||||
}
|
}
|
||||||
ExternalManager externalManager = function.getProgram().getExternalManager();
|
ExternalManager externalManager = function.getProgram().getExternalManager();
|
||||||
String path = externalManager.getExternalLibraryPath(libName);
|
String path = externalManager.getExternalLibraryPath(libName);
|
||||||
if (path == null || path.length() == 0) {
|
if (path == null || path.length() == 0) {
|
||||||
return unresolvedThunkRefColor;
|
return ListingColors.EXT_REF_UNRESOLVED;
|
||||||
}
|
}
|
||||||
return resolvedThunkRefColor;
|
return ListingColors.EXT_REF_RESOLVED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return funNameColor;
|
return FunctionColors.NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -420,13 +375,7 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new FunctionSignatureFieldFactory(formatModel, provider, toolOptions,
|
return new FunctionSignatureFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
fieldOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.FUN_NAME.getDefaultColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+3
-28
@@ -15,16 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.AttributedString;
|
import docking.widgets.fieldpanel.field.AttributedString;
|
||||||
import docking.widgets.fieldpanel.field.TextFieldElement;
|
import docking.widgets.fieldpanel.field.TextFieldElement;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -40,8 +38,6 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Signature Source";
|
public static final String FIELD_NAME = "Signature Source";
|
||||||
// private Color funRetColor;
|
|
||||||
private Color literalColor;
|
|
||||||
|
|
||||||
//private int displayWidth;
|
//private int displayWidth;
|
||||||
|
|
||||||
@@ -62,17 +58,6 @@ public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
|||||||
public FunctionSignatureSourceFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
public FunctionSignatureSourceFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
|
|
||||||
literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
|
||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
literalColor =
|
|
||||||
options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Colors.FOREGROUND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,7 +70,8 @@ public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
|||||||
Function function = functionProxy.getObject();
|
Function function = functionProxy.getObject();
|
||||||
SourceType source = function.getSignatureSource();
|
SourceType source = function.getSignatureSource();
|
||||||
String sourceStr = "<" + source.toString() + ">";
|
String sourceStr = "<" + source.toString() + ">";
|
||||||
AttributedString as = new AttributedString(sourceStr, literalColor, getMetrics());
|
AttributedString as =
|
||||||
|
new AttributedString(sourceStr, FunctionColors.SOURCE, getMetrics());
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy,
|
return ListingTextField.createSingleLineTextField(this, proxy,
|
||||||
new TextFieldElement(as, 0, 0), startX + varWidth, width, hlProvider);
|
new TextFieldElement(as, 0, 0), startX + varWidth, width, hlProvider);
|
||||||
}
|
}
|
||||||
@@ -131,15 +117,4 @@ public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
|||||||
return new FunctionSignatureSourceFieldFactory(formatModel, provider, toolOptions,
|
return new FunctionSignatureSourceFieldFactory(formatModel, provider, toolOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.SEPARATOR.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// don't care
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-24
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -24,10 +23,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -45,9 +43,6 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class FunctionTagFieldFactory extends FieldFactory {
|
public class FunctionTagFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Function Tags";
|
public static final String FIELD_NAME = "Function Tags";
|
||||||
public static final Color DEFAULT_COLOR = Palette.MAROON;
|
|
||||||
|
|
||||||
private Color literalColor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -67,10 +62,6 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
private FunctionTagFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
private FunctionTagFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
color = displayOptions.getColor(OptionsGui.FUN_TAG.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_TAG.getDefaultColor());
|
|
||||||
literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
|
||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,18 +130,6 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
return new FunctionTagFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
return new FunctionTagFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
if (optionName.equals(OptionsGui.FUN_TAG.getColorOptionName())) {
|
|
||||||
color = (Color) newValue;
|
|
||||||
}
|
|
||||||
else if (optionName.equals(OptionsGui.SEPARATOR.getColorOptionName())) {
|
|
||||||
literalColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a tags list field to be show at the beginning of each function that shows the tags
|
* Creates a tags list field to be show at the beginning of each function that shows the tags
|
||||||
* assigned to that function.
|
* assigned to that function.
|
||||||
@@ -169,11 +148,11 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
AttributedString as;
|
AttributedString as;
|
||||||
int elementIndex = 0;
|
int elementIndex = 0;
|
||||||
|
|
||||||
as = new AttributedString("Tags: ", literalColor, getMetrics());
|
as = new AttributedString("Tags: ", ListingColors.SEPARATOR, getMetrics());
|
||||||
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
||||||
|
|
||||||
String tagNamesStr = StringUtils.join(tagNames, ", ");
|
String tagNamesStr = StringUtils.join(tagNames, ", ");
|
||||||
as = new AttributedString(tagNamesStr, color, getMetrics());
|
as = new AttributedString(tagNamesStr, FunctionColors.TAG, getMetrics());
|
||||||
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
||||||
|
|
||||||
return textElements;
|
return textElements;
|
||||||
|
|||||||
+9
-22
@@ -20,9 +20,8 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.MaskColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -38,9 +37,6 @@ import ghidra.util.StringUtilities;
|
|||||||
public class InstructionMaskValueFieldFactory extends FieldFactory {
|
public class InstructionMaskValueFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Instr Mask/Value";
|
public static final String FIELD_NAME = "Instr Mask/Value";
|
||||||
public static final Color MASK_COLOR = Palette.getColor("navy");
|
|
||||||
public static final Color VALUE_COLOR = Palette.GREEN;
|
|
||||||
public static final Color LABEL_COLOR = Colors.FOREGROUND;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
@@ -61,12 +57,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FactoryField for the given object at index index.
|
* Returns the FactoryField for the given object at index index.
|
||||||
* @param varWidth the amount of variable width spacing for any fields
|
* @param varWidth the amount of variable width spacing for any fields
|
||||||
@@ -100,14 +90,15 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
try {
|
try {
|
||||||
FieldElement[] fieldElements = new FieldElement[2 * (operandCount + 1)];
|
FieldElement[] fieldElements = new FieldElement[2 * (operandCount + 1)];
|
||||||
fieldElements[0] =
|
fieldElements[0] =
|
||||||
getLine("M[m]: ", instructionMask.getBytes(), MASK_COLOR, proxy, varWidth);
|
getLine("M[m]: ", instructionMask.getBytes(), MaskColors.BITS, proxy, varWidth);
|
||||||
fieldElements[1] =
|
fieldElements[1] =
|
||||||
getLine("V[m]: ", instructionMask.applyMask(instr), VALUE_COLOR, proxy, varWidth);
|
getLine("V[m]: ", instructionMask.applyMask(instr), MaskColors.VALUE, proxy,
|
||||||
|
varWidth);
|
||||||
for (int i = 0; i < operandCount; i++) {
|
for (int i = 0; i < operandCount; i++) {
|
||||||
fieldElements[2 * (i + 1)] = getLine("M[" + i + "]: ", operandMasks[i].getBytes(),
|
fieldElements[2 * (i + 1)] = getLine("M[" + i + "]: ", operandMasks[i].getBytes(),
|
||||||
MASK_COLOR, proxy, varWidth);
|
MaskColors.BITS, proxy, varWidth);
|
||||||
fieldElements[2 * (i + 1) + 1] = getLine("V[" + i + "]: ",
|
fieldElements[2 * (i + 1) + 1] = getLine("V[" + i + "]: ",
|
||||||
operandMasks[i].applyMask(instr), VALUE_COLOR, proxy, varWidth);
|
operandMasks[i].applyMask(instr), MaskColors.VALUE, proxy, varWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListingTextField.createMultilineTextField(this, proxy, fieldElements,
|
return ListingTextField.createMultilineTextField(this, proxy, fieldElements,
|
||||||
@@ -123,10 +114,11 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
FieldElement[] fieldElements = new FieldElement[2];
|
FieldElement[] fieldElements = new FieldElement[2];
|
||||||
AttributedString as =
|
AttributedString as =
|
||||||
new AttributedString(label, LABEL_COLOR, getMetrics(), false, underlineColor);
|
new AttributedString(label, MaskColors.LABEL, getMetrics(), false,
|
||||||
|
ListingColors.UNDERLINE);
|
||||||
fieldElements[0] = new TextFieldElement(as, 0, 0);
|
fieldElements[0] = new TextFieldElement(as, 0, 0);
|
||||||
as = new AttributedString(getFormattedBytes(value), valueColor, getMetrics(), false,
|
as = new AttributedString(getFormattedBytes(value), valueColor, getMetrics(), false,
|
||||||
underlineColor);
|
ListingColors.UNDERLINE);
|
||||||
fieldElements[1] = new TextFieldElement(as, 0, 0);
|
fieldElements[1] = new TextFieldElement(as, 0, 0);
|
||||||
return new CompositeFieldElement(fieldElements);
|
return new CompositeFieldElement(fieldElements);
|
||||||
}
|
}
|
||||||
@@ -178,9 +170,4 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
return new InstructionMaskValueFieldFactory(formatModel, hsProvider, toolOptions,
|
return new InstructionMaskValueFieldFactory(formatModel, hsProvider, toolOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return Colors.FOREGROUND;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -454,5 +454,4 @@ public class LabelFieldFactory extends FieldFactory {
|
|||||||
ToolOptions pDisplayOptions, ToolOptions fieldOptions) {
|
ToolOptions pDisplayOptions, ToolOptions fieldOptions) {
|
||||||
return new LabelFieldFactory(formatModel, provider, pDisplayOptions, fieldOptions);
|
return new LabelFieldFactory(formatModel, provider, pDisplayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
/* ###
|
||||||
|
* 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 ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
|
import generic.theme.GColor;
|
||||||
|
|
||||||
|
public class ListingColors {
|
||||||
|
// @formatter:off
|
||||||
|
|
||||||
|
public static final GColor BACKGROUND = new GColor("color.bg.listing");
|
||||||
|
|
||||||
|
public static final GColor ADDRESS = new GColor("color.fg.listing.address");
|
||||||
|
public static final GColor BYTES = new GColor("color.fg.listing.bytes");
|
||||||
|
public static final GColor EXT_ENTRY_POINT = new GColor("color.fg.listing.ext.entrypoint");
|
||||||
|
public static final GColor FIELD_NAME = new GColor("color.fg.listing.fieldname");
|
||||||
|
public static final GColor SEPARATOR = new GColor("color.fg.listing.separator");
|
||||||
|
public static final GColor UNDERLINE = new GColor("color.fg.listing.underline");
|
||||||
|
public static final GColor ARRAY_VALUES = new GColor("color.fg.listing.array.values");
|
||||||
|
public static final GColor BYTES_ALIGNMENT = new GColor("color.fg.listing.bytes.alignment");
|
||||||
|
public static final GColor BLOCK_START = new GColor("color.fg.listing.block.start");
|
||||||
|
|
||||||
|
public static final GColor CONSTANT = new GColor("color.fg.listing.constant");
|
||||||
|
public static final GColor REF_BAD = new GColor("color.fg.listing.ref.bad");
|
||||||
|
public static final GColor EXT_REF_UNRESOLVED = new GColor("color.fg.listing.ext.ref.unresolved");
|
||||||
|
public static final GColor EXT_REF_RESOLVED = new GColor("color.fg.listing.ext.ref.resolved");
|
||||||
|
public static final GColor REGISTER = new GColor("color.fg.listing.register");
|
||||||
|
public static final GColor PARALLEL_INSTRUCTION = new GColor("color.fg.listing.instruction.parallel");
|
||||||
|
|
||||||
|
|
||||||
|
public static class XrefColors {
|
||||||
|
public static final GColor DEFAULT = new GColor("color.fg.listing.xref");
|
||||||
|
public static final GColor OFFCUT = new GColor("color.fg.listing.xref.offcut");
|
||||||
|
public static final GColor READ = new GColor("color.fg.listing.xref.read");
|
||||||
|
public static final GColor WRITE = new GColor("color.fg.listing.xref.write");
|
||||||
|
public static final GColor OTHER = new GColor("color.fg.listing.xref.other");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PcodeColors {
|
||||||
|
public static final GColor LABEL = new GColor("color.fg.listing.pcode.label");
|
||||||
|
public static final GColor ADDRESS_SPACE = new GColor("color.fg.listing.pcode.address.space");
|
||||||
|
public static final GColor VARNODE = new GColor("color.fg.listing.pcode.varnode");
|
||||||
|
public static final GColor USEROP = new GColor("color.fg.listing.pcode.userop");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MnemonicColors {
|
||||||
|
public static final GColor NORMAL = new GColor("color.fg.listing.mnemonic");
|
||||||
|
public static final GColor OVERRIDE = new GColor("color.fg.listing.mnemonic.override");
|
||||||
|
public static final GColor UNIMPLEMENTED = new GColor("color.fg.listing.mnemonic.unimplemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CommentColors {
|
||||||
|
public static final GColor AUTO = new GColor("color.fg.listing.comment.auto");
|
||||||
|
public static final GColor EOL = new GColor("color.fg.listing.comment.eol");
|
||||||
|
public static final GColor PLATE= new GColor("color.fg.listing.comment.plate");
|
||||||
|
public static final GColor POST= new GColor("color.fg.listing.comment.post");
|
||||||
|
public static final GColor PRE= new GColor("color.fg.listing.comment.pre");
|
||||||
|
public static final GColor REPEATABLE = new GColor("color.fg.listing.comment.repeatable");
|
||||||
|
public static final GColor REF_REPEATABLE = new GColor("color.fg.listing.comment.ref.repeatable");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class LabelColors {
|
||||||
|
public static final GColor LOCAL = new GColor("color.fg.listing.label.local");
|
||||||
|
public static final GColor NON_PRIMARY = new GColor("color.fg.listing.label.non.primary");
|
||||||
|
public static final GColor PRIMARY = new GColor("color.fg.listing.label.primary");
|
||||||
|
public static final GColor UNREFERENCED = new GColor("color.fg.listing.label.unreferenced");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FunctionColors {
|
||||||
|
public static final GColor CALL_FIXUP = new GColor("color.fg.listing.function.callfixup");
|
||||||
|
public static final GColor NAME = new GColor("color.fg.listing.function.name");
|
||||||
|
public static final GColor PARAM = new GColor("color.fg.listing.function.param");
|
||||||
|
public static final GColor PARAM_AUTO = new GColor("color.fg.listing.function.param.auto");
|
||||||
|
public static final GColor PARAM_CUSTOM = new GColor("color.fg.listing.function.param.custom");
|
||||||
|
public static final GColor PARAM_DYNAMIC = new GColor("color.fg.listing.function.param.dynamic");
|
||||||
|
public static final GColor RETURN_TYPE = new GColor("color.fg.listing.function.return.type");
|
||||||
|
public static final GColor SOURCE = new GColor("color.fg.listing.function.source");
|
||||||
|
public static final GColor TAG = new GColor("color.fg.listing.function.tag");
|
||||||
|
public static final GColor VARIABLE = new GColor("color.fg.listing.function.variable");
|
||||||
|
public static final GColor VARIABLE_ASSIGNED = new GColor("color.fg.listing.function.variable.assigned");
|
||||||
|
public static final GColor THUNK = new GColor("color.fg.listing.function.name.thunk");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FlowArrowColors {
|
||||||
|
public static final GColor ACTIVE = new GColor("color.fg.listing.flow.arrow.active");
|
||||||
|
public static final GColor INACTIVE = new GColor("color.fg.listing.flow.arrow.inactive");
|
||||||
|
public static final GColor SELECTED = new GColor("color.fg.listing.flow.arrow.selected");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MaskColors {
|
||||||
|
public static final GColor BITS = new GColor("color.fg.listing.mask.bits");
|
||||||
|
public static final GColor LABEL = new GColor("color.fg.listing.mask.label");
|
||||||
|
public static final GColor VALUE = new GColor("color.fg.listing.mask.value");
|
||||||
|
|
||||||
|
}
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
}
|
||||||
+1
-39
@@ -23,7 +23,6 @@ import java.util.List;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -42,14 +41,12 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class MemoryBlockStartFieldFactory extends FieldFactory {
|
public class MemoryBlockStartFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
private static final String FIELD_NAME = "Memory Block Start";
|
private static final String FIELD_NAME = "Memory Block Start";
|
||||||
private static final Color BLOCK_COLOR = Palette.getColor("indigo");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public MemoryBlockStartFieldFactory() {
|
public MemoryBlockStartFieldFactory() {
|
||||||
super(FIELD_NAME);
|
super(FIELD_NAME);
|
||||||
color = BLOCK_COLOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +59,6 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
private MemoryBlockStartFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
private MemoryBlockStartFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
color = BLOCK_COLOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,15 +183,6 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a comment to be show at the beginning of each block that shows the following:
|
|
||||||
* - block name
|
|
||||||
* - block type
|
|
||||||
* - block start/end address (size)
|
|
||||||
* - block comment
|
|
||||||
*
|
|
||||||
* @param cu
|
|
||||||
*/
|
|
||||||
protected List<AttributedString> createBlockStartText(CodeUnit cu) {
|
protected List<AttributedString> createBlockStartText(CodeUnit cu) {
|
||||||
|
|
||||||
List<AttributedString> lines = new ArrayList<>();
|
List<AttributedString> lines = new ArrayList<>();
|
||||||
@@ -227,7 +214,7 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
String line1 = block.getName() + " " + type;
|
String line1 = block.getName() + " " + type;
|
||||||
String line2 = block.getComment();
|
String line2 = block.getComment();
|
||||||
String line3 = block.getStart().toString(true) + "-" + block.getEnd().toString(true);
|
String line3 = block.getStart().toString(true) + "-" + block.getEnd().toString(true);
|
||||||
|
Color color = ListingColors.BLOCK_START;
|
||||||
AttributedString borderAS = new AttributedString("//", color, getMetrics());
|
AttributedString borderAS = new AttributedString("//", color, getMetrics());
|
||||||
lines.add(borderAS);
|
lines.add(borderAS);
|
||||||
lines.add(new AttributedString("// " + line1, color, getMetrics()));
|
lines.add(new AttributedString("// " + line1, color, getMetrics()));
|
||||||
@@ -240,12 +227,6 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates {@link FieldElement} instances for each given {@link AttributedString}.
|
|
||||||
*
|
|
||||||
* @param attributedStrings
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private FieldElement[] createFieldElements(List<AttributedString> attributedStrings) {
|
private FieldElement[] createFieldElements(List<AttributedString> attributedStrings) {
|
||||||
List<FieldElement> elements = new ArrayList<>();
|
List<FieldElement> elements = new ArrayList<>();
|
||||||
int lineNum = 0;
|
int lineNum = 0;
|
||||||
@@ -261,23 +242,4 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
return elementsArray;
|
return elementsArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the length of the longest string in the given list.
|
|
||||||
*
|
|
||||||
* @param lines
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private int getLongestLineSize(String... lines) {
|
|
||||||
|
|
||||||
int longest = 0;
|
|
||||||
for (String line : lines) {
|
|
||||||
if (line.length() > longest) {
|
|
||||||
longest = line.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return longest;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-23
@@ -23,11 +23,10 @@ import javax.swing.event.ChangeListener;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.MnemonicColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -45,14 +44,11 @@ import ghidra.util.HelpLocation;
|
|||||||
*/
|
*/
|
||||||
public class MnemonicFieldFactory extends FieldFactory {
|
public class MnemonicFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Mnemonic";
|
public static final String FIELD_NAME = "Mnemonic";
|
||||||
public static final Color OVERRIDE_COLOR = Palette.PURPLE;
|
|
||||||
|
|
||||||
private final static Color BAD_PROTOTYPE_COLOR = Messages.ERROR;
|
private final static Color BAD_PROTOTYPE_COLOR = Messages.ERROR;
|
||||||
private final static String SHOW_UNDERLINE_FOR_REFERENCES =
|
private final static String SHOW_UNDERLINE_FOR_REFERENCES =
|
||||||
GhidraOptions.MNEMONIC_GROUP_TITLE + Options.DELIMITER + "Underline Fields With References";
|
GhidraOptions.MNEMONIC_GROUP_TITLE + Options.DELIMITER + "Underline Fields With References";
|
||||||
|
|
||||||
private static final String OVERRIDE_COLOR_OPTION = "Mnemonic, Override Color";
|
|
||||||
private Color overrideColor;
|
|
||||||
private boolean underliningEnabled = true;
|
private boolean underliningEnabled = true;
|
||||||
|
|
||||||
protected BrowserCodeUnitFormat codeUnitFormat;
|
protected BrowserCodeUnitFormat codeUnitFormat;
|
||||||
@@ -76,8 +72,6 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||||||
Options displayOptions, ToolOptions fieldOptions) {
|
Options displayOptions, ToolOptions fieldOptions) {
|
||||||
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
||||||
|
|
||||||
overrideColor = displayOptions.getColor(OVERRIDE_COLOR_OPTION, OVERRIDE_COLOR);
|
|
||||||
|
|
||||||
HelpLocation hl = new HelpLocation("CodeBrowserPlugin", "Mnemonic_Field");
|
HelpLocation hl = new HelpLocation("CodeBrowserPlugin", "Mnemonic_Field");
|
||||||
fieldOptions.getOptions("Mnemonic Fields").setOptionsHelpLocation(hl);
|
fieldOptions.getOptions("Mnemonic Fields").setOptionsHelpLocation(hl);
|
||||||
|
|
||||||
@@ -90,15 +84,6 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||||||
codeUnitFormat.addChangeListener(codeUnitFormatListener);
|
codeUnitFormat.addChangeListener(codeUnitFormatListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
if (optionName.equals(OVERRIDE_COLOR_OPTION)) {
|
|
||||||
overrideColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
@@ -129,14 +114,14 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
boolean underline = underliningEnabled && (cu.getMnemonicReferences().length > 0);
|
boolean underline = underliningEnabled && (cu.getMnemonicReferences().length > 0);
|
||||||
String mnemonic = codeUnitFormat.getMnemonicRepresentation(cu);
|
String mnemonic = codeUnitFormat.getMnemonicRepresentation(cu);
|
||||||
Color c = color;
|
Color c = MnemonicColors.NORMAL;
|
||||||
if (invalidInstrProto) {
|
if (invalidInstrProto) {
|
||||||
c = BAD_PROTOTYPE_COLOR;
|
c = BAD_PROTOTYPE_COLOR;
|
||||||
}
|
}
|
||||||
else if (cu instanceof Instruction) {
|
else if (cu instanceof Instruction) {
|
||||||
Instruction instr = (Instruction) cu;
|
Instruction instr = (Instruction) cu;
|
||||||
if (instr.getFlowOverride() != FlowOverride.NONE || instr.isFallThroughOverridden()) {
|
if (instr.getFlowOverride() != FlowOverride.NONE || instr.isFallThroughOverridden()) {
|
||||||
c = overrideColor;
|
c = MnemonicColors.OVERRIDE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -146,7 +131,7 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AttributedString as =
|
AttributedString as =
|
||||||
new AttributedString(mnemonic, c, getMetrics(), underline, underlineColor);
|
new AttributedString(mnemonic, c, getMetrics(), underline, ListingColors.UNDERLINE);
|
||||||
FieldElement text = new TextFieldElement(as, 0, 0);
|
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
@@ -222,8 +207,4 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||||||
return new MnemonicFieldFactory(formatModel, hsProvider, displayOptions, fieldOptions);
|
return new MnemonicFieldFactory(formatModel, hsProvider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.MNEMONIC.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-9
@@ -42,7 +42,7 @@ public class OpenCloseFieldFactory extends FieldFactory {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param model the model that the field belongs to.
|
* @param model the model that the field belongs to.
|
||||||
* @param hsProvider the HightLightStringProvider.
|
* @param hlProvider the HightLightStringProvider.
|
||||||
* @param displayOptions the Options for display properties.
|
* @param displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific properties.
|
* @param fieldOptions the Options for field specific properties.
|
||||||
*/
|
*/
|
||||||
@@ -86,13 +86,6 @@ public class OpenCloseFieldFactory extends FieldFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#servicesChanged()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void servicesChanged() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes if the given data is the last component at its level.
|
* Computes if the given data is the last component at its level.
|
||||||
*/
|
*/
|
||||||
@@ -165,5 +158,4 @@ public class OpenCloseFieldFactory extends FieldFactory {
|
|||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||||
return new OpenCloseFieldFactory(fieldModel, provider, displayOptions, fieldOptions);
|
return new OpenCloseFieldFactory(fieldModel, provider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-19
@@ -27,6 +27,7 @@ import docking.widgets.fieldpanel.support.FieldLocation;
|
|||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.util.*;
|
import ghidra.app.util.*;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.FunctionColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -366,7 +367,7 @@ abstract class OperandFieldHelper extends FieldFactory {
|
|||||||
: getAttributesForData(data, value);
|
: getAttributesForData(data, value);
|
||||||
AttributedString as =
|
AttributedString as =
|
||||||
new AttributedString(dataValueRepresentation.toString(), attributes.colorAttribute,
|
new AttributedString(dataValueRepresentation.toString(), attributes.colorAttribute,
|
||||||
getMetrics(attributes.styleAttribute), underline, underlineColor);
|
getMetrics(attributes.styleAttribute), underline, ListingColors.UNDERLINE);
|
||||||
FieldElement field = new OperandFieldElement(as, 0, 0, 0);
|
FieldElement field = new OperandFieldElement(as, 0, 0, 0);
|
||||||
|
|
||||||
if (shouldWordWrap(data, dataValueRepresentation)) {
|
if (shouldWordWrap(data, dataValueRepresentation)) {
|
||||||
@@ -450,7 +451,7 @@ abstract class OperandFieldHelper extends FieldFactory {
|
|||||||
AttributedString as =
|
AttributedString as =
|
||||||
new AttributedString(opRepList != null ? opRepList.toString() : "<UNSUPPORTED>",
|
new AttributedString(opRepList != null ? opRepList.toString() : "<UNSUPPORTED>",
|
||||||
badRefAttributes.colorAttribute, getMetrics(badRefAttributes.styleAttribute),
|
badRefAttributes.colorAttribute, getMetrics(badRefAttributes.styleAttribute),
|
||||||
false, underlineColor);
|
false, ListingColors.UNDERLINE);
|
||||||
elements.add(new OperandFieldElement(as, opIndex, subOpIndex, characterOffset));
|
elements.add(new OperandFieldElement(as, opIndex, subOpIndex, characterOffset));
|
||||||
characterOffset += as.length();
|
characterOffset += as.length();
|
||||||
}
|
}
|
||||||
@@ -491,7 +492,7 @@ abstract class OperandFieldHelper extends FieldFactory {
|
|||||||
|
|
||||||
ColorStyleAttributes attributes = getOpAttributes(opElem, inst, opIndex);
|
ColorStyleAttributes attributes = getOpAttributes(opElem, inst, opIndex);
|
||||||
AttributedString as = new AttributedString(opElem.toString(), attributes.colorAttribute,
|
AttributedString as = new AttributedString(opElem.toString(), attributes.colorAttribute,
|
||||||
getMetrics(attributes.styleAttribute), underline, underlineColor);
|
getMetrics(attributes.styleAttribute), underline, ListingColors.UNDERLINE);
|
||||||
elements.add(new OperandFieldElement(as, opIndex, subOpIndex, characterOffset));
|
elements.add(new OperandFieldElement(as, opIndex, subOpIndex, characterOffset));
|
||||||
return characterOffset + as.length();
|
return characterOffset + as.length();
|
||||||
}
|
}
|
||||||
@@ -670,34 +671,27 @@ abstract class OperandFieldHelper extends FieldFactory {
|
|||||||
* changes. It looks up all the color settings and resets the its values.
|
* changes. It looks up all the color settings and resets the its values.
|
||||||
*/
|
*/
|
||||||
private void setOptions(Options options) {
|
private void setOptions(Options options) {
|
||||||
separatorAttributes.colorAttribute = options.getColor(
|
|
||||||
OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor());
|
separatorAttributes.colorAttribute = ListingColors.SEPARATOR;
|
||||||
|
scalarAttributes.colorAttribute = ListingColors.CONSTANT;
|
||||||
|
variableRefAttributes.colorAttribute = FunctionColors.VARIABLE;
|
||||||
|
addressAttributes.colorAttribute = ListingColors.ADDRESS;
|
||||||
|
externalRefAttributes.colorAttribute = ListingColors.EXT_REF_RESOLVED;
|
||||||
|
badRefAttributes.colorAttribute = ListingColors.REF_BAD;
|
||||||
|
registerAttributes.colorAttribute = ListingColors.REGISTER;
|
||||||
|
|
||||||
separatorAttributes.styleAttribute =
|
separatorAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.SEPARATOR.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.SEPARATOR.getStyleOptionName(), -1);
|
||||||
scalarAttributes.colorAttribute = options.getColor(OptionsGui.CONSTANT.getColorOptionName(),
|
|
||||||
OptionsGui.CONSTANT.getDefaultColor());
|
|
||||||
scalarAttributes.styleAttribute =
|
scalarAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.CONSTANT.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.CONSTANT.getStyleOptionName(), -1);
|
||||||
variableRefAttributes.colorAttribute = options.getColor(
|
|
||||||
OptionsGui.VARIABLE.getColorOptionName(), OptionsGui.VARIABLE.getDefaultColor());
|
|
||||||
variableRefAttributes.styleAttribute =
|
variableRefAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.VARIABLE.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.VARIABLE.getStyleOptionName(), -1);
|
||||||
addressAttributes.colorAttribute = options.getColor(OptionsGui.ADDRESS.getColorOptionName(),
|
|
||||||
OptionsGui.ADDRESS.getDefaultColor());
|
|
||||||
addressAttributes.styleAttribute =
|
addressAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.ADDRESS.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.ADDRESS.getStyleOptionName(), -1);
|
||||||
externalRefAttributes.colorAttribute =
|
|
||||||
options.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
|
||||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
|
||||||
externalRefAttributes.styleAttribute =
|
externalRefAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.EXT_REF_RESOLVED.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.EXT_REF_RESOLVED.getStyleOptionName(), -1);
|
||||||
badRefAttributes.colorAttribute =
|
|
||||||
options.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
|
||||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
|
||||||
badRefAttributes.styleAttribute =
|
badRefAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.BAD_REF_ADDR.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.BAD_REF_ADDR.getStyleOptionName(), -1);
|
||||||
registerAttributes.colorAttribute = options.getColor(
|
|
||||||
OptionsGui.REGISTERS.getColorOptionName(), OptionsGui.REGISTERS.getDefaultColor());
|
|
||||||
registerAttributes.styleAttribute =
|
registerAttributes.styleAttribute =
|
||||||
options.getInt(OptionsGui.REGISTERS.getStyleOptionName(), -1);
|
options.getInt(OptionsGui.REGISTERS.getStyleOptionName(), -1);
|
||||||
|
|
||||||
|
|||||||
+2
-17
@@ -15,13 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -40,7 +37,6 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class ParallelInstructionFieldFactory extends FieldFactory {
|
public class ParallelInstructionFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Parallel ||";
|
public static final String FIELD_NAME = "Parallel ||";
|
||||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
@@ -61,12 +57,6 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// don't care
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FactoryField for the given object at index index.
|
* Returns the FactoryField for the given object at index index.
|
||||||
* @param proxy the object whose properties should be displayed.
|
* @param proxy the object whose properties should be displayed.
|
||||||
@@ -92,8 +82,8 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributedString as =
|
AttributedString as = new AttributedString(fieldText, ListingColors.PARALLEL_INSTRUCTION,
|
||||||
new AttributedString(fieldText, color, getMetrics(), false, underlineColor);
|
getMetrics(), false, ListingColors.UNDERLINE);
|
||||||
FieldElement text = new TextFieldElement(as, 0, 0);
|
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
@@ -132,9 +122,4 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
return new ParallelInstructionFieldFactory(formatModel, hsProvider, toolOptinos,
|
return new ParallelInstructionFieldFactory(formatModel, hsProvider, toolOptinos,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return Colors.FOREGROUND;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-19
@@ -27,9 +27,9 @@ import docking.widgets.fieldpanel.support.*;
|
|||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HelpTopics;
|
import ghidra.app.util.HelpTopics;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.CommentColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.listingpanel.ListingModel;
|
import ghidra.app.util.viewer.listingpanel.ListingModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.DataProxy;
|
import ghidra.app.util.viewer.proxy.DataProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -227,7 +227,8 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributedString prototype = new AttributedString(EMPTY_STRING, color, getMetrics());
|
AttributedString prototype =
|
||||||
|
new AttributedString(EMPTY_STRING, CommentColors.PLATE, getMetrics());
|
||||||
|
|
||||||
AttributedString asteriscs = getStarsString();
|
AttributedString asteriscs = getStarsString();
|
||||||
int row = elements.size();
|
int row = elements.size();
|
||||||
@@ -288,19 +289,19 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
addPadding(buffy, prePadding);
|
addPadding(buffy, prePadding);
|
||||||
|
|
||||||
FieldElement prefix = new TextFieldElement(
|
FieldElement prefix = new TextFieldElement(
|
||||||
new AttributedString(buffy.toString(), color, getMetrics()), row, 0);
|
new AttributedString(buffy.toString(), CommentColors.PLATE, getMetrics()), row, 0);
|
||||||
|
|
||||||
FieldElement ellipsis =
|
FieldElement ellipsis = new TextFieldElement(
|
||||||
new TextFieldElement(new AttributedString(ellipsisText, color, getMetrics()), row,
|
new AttributedString(ellipsisText, CommentColors.PLATE, getMetrics()), row,
|
||||||
prefix.length() + element.length());
|
prefix.length() + element.length());
|
||||||
|
|
||||||
buffy.setLength(0);
|
buffy.setLength(0);
|
||||||
addPadding(buffy, postPadding);
|
addPadding(buffy, postPadding);
|
||||||
buffy.append(' ').append('*');
|
buffy.append(' ').append('*');
|
||||||
|
|
||||||
FieldElement suffix =
|
FieldElement suffix = new TextFieldElement(
|
||||||
new TextFieldElement(new AttributedString(buffy.toString(), color, getMetrics()), row,
|
new AttributedString(buffy.toString(), CommentColors.PLATE, getMetrics()), row,
|
||||||
prefix.length() + element.length() + ellipsis.length());
|
prefix.length() + element.length() + ellipsis.length());
|
||||||
|
|
||||||
return new FieldElementResult(
|
return new FieldElementResult(
|
||||||
new CompositeFieldElement(new FieldElement[] { prefix, element, ellipsis, suffix }),
|
new CompositeFieldElement(new FieldElement[] { prefix, element, ellipsis, suffix }),
|
||||||
@@ -314,7 +315,8 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addBlankLines(List<FieldElement> elements, int numberBlankLines, CodeUnit cu) {
|
private void addBlankLines(List<FieldElement> elements, int numberBlankLines, CodeUnit cu) {
|
||||||
AttributedString prototype = new AttributedString(EMPTY_STRING, color, getMetrics());
|
AttributedString prototype =
|
||||||
|
new AttributedString(EMPTY_STRING, CommentColors.PLATE, getMetrics());
|
||||||
for (int row = 0; row < numberBlankLines; row++) {
|
for (int row = 0; row < numberBlankLines; row++) {
|
||||||
elements.add(0, new TextFieldElement(prototype, row, 0));
|
elements.add(0, new TextFieldElement(prototype, row, 0));
|
||||||
}
|
}
|
||||||
@@ -350,7 +352,8 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
elements.add(new TextFieldElement(asteriscs, row++, 0));
|
elements.add(new TextFieldElement(asteriscs, row++, 0));
|
||||||
|
|
||||||
int commentRow = row++;
|
int commentRow = row++;
|
||||||
AttributedString as = new AttributedString(defaultComment, color, getMetrics());
|
AttributedString as =
|
||||||
|
new AttributedString(defaultComment, CommentColors.PLATE, getMetrics());
|
||||||
TextFieldElement commentElement = new TextFieldElement(as, commentRow, 0);
|
TextFieldElement commentElement = new TextFieldElement(as, commentRow, 0);
|
||||||
FieldElementResult result = addSideBorder(commentElement, commentRow, true);
|
FieldElementResult result = addSideBorder(commentElement, commentRow, true);
|
||||||
elements.add(result.getFieldElement());
|
elements.add(result.getFieldElement());
|
||||||
@@ -424,7 +427,7 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
private AttributedString getStarsString() {
|
private AttributedString getStarsString() {
|
||||||
String asteriscs = getStars();
|
String asteriscs = getStars();
|
||||||
return new AttributedString(asteriscs, color, getMetrics());
|
return new AttributedString(asteriscs, CommentColors.PLATE, getMetrics());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -547,8 +550,8 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
int dataRow = commentRow + numberBlankLines + headerCount;
|
int dataRow = commentRow + numberBlankLines + headerCount;
|
||||||
|
|
||||||
ListingTextField listingTextField = (ListingTextField) listingField;
|
ListingTextField listingTextField = (ListingTextField) listingField;
|
||||||
RowColLocation location = listingTextField.dataToScreenLocation(dataRow,
|
RowColLocation location =
|
||||||
commentLocation.getCharOffset());
|
listingTextField.dataToScreenLocation(dataRow, commentLocation.getCharOffset());
|
||||||
return new FieldLocation(index, fieldNum, location.row(), location.col());
|
return new FieldLocation(index, fieldNum, location.row(), location.col());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,11 +572,6 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
return new PlateFieldFactory(formatModel, hsProvider, toolOptions, fieldOptions);
|
return new PlateFieldFactory(formatModel, hsProvider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.COMMENT_PLATE.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
|
|||||||
+11
-20
@@ -25,6 +25,7 @@ import docking.widgets.fieldpanel.field.*;
|
|||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.FieldUtils;
|
import docking.widgets.fieldpanel.support.FieldUtils;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.CommentColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -72,7 +73,6 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
private int nLinesAfterBlocks;
|
private int nLinesAfterBlocks;
|
||||||
private boolean isWordWrap;
|
private boolean isWordWrap;
|
||||||
private boolean alwaysShowAutomatic;
|
private boolean alwaysShowAutomatic;
|
||||||
private Color automaticCommentColor;
|
|
||||||
private int automaticCommentStyle;
|
private int automaticCommentStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,9 +104,6 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
flagJMPsRETs = fieldOptions.getBoolean(FLAG_TERMINATOR_OPTION, false);
|
flagJMPsRETs = fieldOptions.getBoolean(FLAG_TERMINATOR_OPTION, false);
|
||||||
nLinesAfterBlocks = fieldOptions.getInt(LINES_AFTER_BLOCKS_OPTION, 0);
|
nLinesAfterBlocks = fieldOptions.getInt(LINES_AFTER_BLOCKS_OPTION, 0);
|
||||||
|
|
||||||
automaticCommentColor =
|
|
||||||
displayOptions.getColor(OptionsGui.COMMENT_AUTO.getColorOptionName(),
|
|
||||||
OptionsGui.COMMENT_AUTO.getDefaultColor());
|
|
||||||
automaticCommentStyle =
|
automaticCommentStyle =
|
||||||
displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1);
|
displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1);
|
||||||
|
|
||||||
@@ -331,11 +328,6 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
return new PostCommentFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
return new PostCommentFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.COMMENT_POST.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
@@ -379,9 +371,6 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
*/
|
*/
|
||||||
private void adjustAutomaticCommentDisplayOptions(Options options, String optionName,
|
private void adjustAutomaticCommentDisplayOptions(Options options, String optionName,
|
||||||
Object oldValue, Object newValue) {
|
Object oldValue, Object newValue) {
|
||||||
if (optionName.equals(OptionsGui.COMMENT_AUTO.getColorOptionName())) {
|
|
||||||
automaticCommentColor = (Color) newValue;
|
|
||||||
}
|
|
||||||
String automaticCommentStyleName = OptionsGui.COMMENT_AUTO.getStyleOptionName();
|
String automaticCommentStyleName = OptionsGui.COMMENT_AUTO.getStyleOptionName();
|
||||||
if (optionName.equals(automaticCommentStyleName)) {
|
if (optionName.equals(automaticCommentStyleName)) {
|
||||||
automaticCommentStyle = options.getInt(automaticCommentStyleName, -1);
|
automaticCommentStyle = options.getInt(automaticCommentStyleName, -1);
|
||||||
@@ -393,6 +382,7 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
Listing listing = instr.getProgram().getListing();
|
Listing listing = instr.getProgram().getListing();
|
||||||
Address addr = instr.getMinAddress();
|
Address addr = instr.getMinAddress();
|
||||||
FlowType flowType = instr.getFlowType();
|
FlowType flowType = instr.getFlowType();
|
||||||
|
Color color = CommentColors.POST;
|
||||||
|
|
||||||
// Options that affect Post Comments:
|
// Options that affect Post Comments:
|
||||||
// Flag Function Exits (only if post comment does not exist)
|
// Flag Function Exits (only if post comment does not exist)
|
||||||
@@ -456,7 +446,7 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
if (fields.length > 0) {
|
if (fields.length > 0) {
|
||||||
for (int i = 0; i < nLinesAutoComment; i++) {
|
for (int i = 0; i < nLinesAutoComment; i++) {
|
||||||
AttributedString as = new AttributedString(autoComment[i],
|
AttributedString as = new AttributedString(autoComment[i],
|
||||||
automaticCommentColor, getMetrics(automaticCommentStyle), false, null);
|
CommentColors.AUTO, getMetrics(automaticCommentStyle), false, null);
|
||||||
fields[i] = new TextFieldElement(as, i, 0);
|
fields[i] = new TextFieldElement(as, i, 0);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < comments.length; i++) {
|
for (int i = 0; i < comments.length; i++) {
|
||||||
@@ -497,10 +487,11 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
CodeUnit cu = (CodeUnit) proxy.getObject();
|
CodeUnit cu = (CodeUnit) proxy.getObject();
|
||||||
Program program = cu.getProgram();
|
Program program = cu.getProgram();
|
||||||
AttributedString prototypeString = new AttributedString("prototype", color, getMetrics());
|
AttributedString prototypeString =
|
||||||
|
new AttributedString("prototype", CommentColors.POST, getMetrics());
|
||||||
List<FieldElement> fields = new ArrayList<>();
|
List<FieldElement> fields = new ArrayList<>();
|
||||||
for (int i = 0; i < nLinesAutoComment; i++) {
|
for (int i = 0; i < nLinesAutoComment; i++) {
|
||||||
AttributedString as = new AttributedString(autoComment[i], automaticCommentColor,
|
AttributedString as = new AttributedString(autoComment[i], CommentColors.AUTO,
|
||||||
getMetrics(automaticCommentStyle), false, null);
|
getMetrics(automaticCommentStyle), false, null);
|
||||||
fields.add(new TextFieldElement(as, i, 0));
|
fields.add(new TextFieldElement(as, i, 0));
|
||||||
}
|
}
|
||||||
@@ -513,7 +504,7 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
if (useLinesAfterBlock) {
|
if (useLinesAfterBlock) {
|
||||||
for (int i = 0; i < nLinesAfterBlocks; i++) {
|
for (int i = 0; i < nLinesAfterBlocks; i++) {
|
||||||
AttributedString as = new AttributedString("", color, getMetrics());
|
AttributedString as = new AttributedString("", CommentColors.POST, getMetrics());
|
||||||
fields.add(new TextFieldElement(as, fields.size(), 0));
|
fields.add(new TextFieldElement(as, fields.size(), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -618,12 +609,12 @@ public class PostCommentFieldFactory extends FieldFactory {
|
|||||||
hasAppropriatePcodeOp = true;
|
hasAppropriatePcodeOp = true;
|
||||||
if (op.getOpcode() == PcodeOp.CALLOTHER) {
|
if (op.getOpcode() == PcodeOp.CALLOTHER) {
|
||||||
if (callOtherName == null) {
|
if (callOtherName == null) {
|
||||||
callOtherName = inst.getProgram().getLanguage().getUserDefinedOpName(
|
callOtherName = inst.getProgram()
|
||||||
(int) op.getInput(0).getOffset());
|
.getLanguage()
|
||||||
|
.getUserDefinedOpName((int) op.getInput(0).getOffset());
|
||||||
if (op.getOutput() != null) {
|
if (op.getOutput() != null) {
|
||||||
outputWarningString =
|
outputWarningString =
|
||||||
"WARNING: Output of " + callOtherName +
|
"WARNING: Output of " + callOtherName + " destroyed by override!";
|
||||||
" destroyed by override!";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+8
-15
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -26,6 +25,7 @@ import docking.widgets.fieldpanel.field.*;
|
|||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.FieldUtils;
|
import docking.widgets.fieldpanel.support.FieldUtils;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
|
import ghidra.app.util.viewer.field.ListingColors.CommentColors;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -66,7 +66,6 @@ public class PreCommentFieldFactory extends FieldFactory {
|
|||||||
private boolean flagSubroutineEntry;
|
private boolean flagSubroutineEntry;
|
||||||
private boolean isWordWrap;
|
private boolean isWordWrap;
|
||||||
private boolean alwaysShowAutomatic;
|
private boolean alwaysShowAutomatic;
|
||||||
private Color automaticCommentColor;
|
|
||||||
private int automaticCommentStyle;
|
private int automaticCommentStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,9 +94,6 @@ public class PreCommentFieldFactory extends FieldFactory {
|
|||||||
flagFunctionEntry = fieldOptions.getBoolean(FLAG_FUNCTION_ENTRY_OPTION, false);
|
flagFunctionEntry = fieldOptions.getBoolean(FLAG_FUNCTION_ENTRY_OPTION, false);
|
||||||
flagSubroutineEntry = fieldOptions.getBoolean(FLAG_SUBROUTINE_ENTRY_OPTION, false);
|
flagSubroutineEntry = fieldOptions.getBoolean(FLAG_SUBROUTINE_ENTRY_OPTION, false);
|
||||||
|
|
||||||
automaticCommentColor =
|
|
||||||
displayOptions.getColor(OptionsGui.COMMENT_AUTO.getColorOptionName(),
|
|
||||||
OptionsGui.COMMENT_AUTO.getDefaultColor());
|
|
||||||
automaticCommentStyle =
|
automaticCommentStyle =
|
||||||
displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1);
|
displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1);
|
||||||
|
|
||||||
@@ -188,11 +184,6 @@ public class PreCommentFieldFactory extends FieldFactory {
|
|||||||
return new PreCommentFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
return new PreCommentFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.COMMENT_PRE.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
@@ -333,7 +324,8 @@ public class PreCommentFieldFactory extends FieldFactory {
|
|||||||
return buildZeroLengthComponentAutoComment(lastDtc, data, levelsToIgnore, label);
|
return buildZeroLengthComponentAutoComment(lastDtc, data, levelsToIgnore, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] buildZeroLengthComponentAutoComment(DataTypeComponent lastZeroLengthComponent, Data data, int levelsToIgnore, String label) {
|
private String[] buildZeroLengthComponentAutoComment(DataTypeComponent lastZeroLengthComponent,
|
||||||
|
Data data, int levelsToIgnore, String label) {
|
||||||
|
|
||||||
String fieldName = lastZeroLengthComponent.getFieldName();
|
String fieldName = lastZeroLengthComponent.getFieldName();
|
||||||
if (StringUtils.isEmpty(fieldName)) {
|
if (StringUtils.isEmpty(fieldName)) {
|
||||||
@@ -356,8 +348,8 @@ public class PreCommentFieldFactory extends FieldFactory {
|
|||||||
flexName.insert(0, label + ".");
|
flexName.insert(0, label + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new String[] { "Zero-length Component: " + lastZeroLengthComponent.getDataType().getName() + " " +
|
return new String[] { "Zero-length Component: " +
|
||||||
flexName.toString() };
|
lastZeroLengthComponent.getDataType().getName() + " " + flexName.toString() };
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListingTextField getTextField(String[] comments, String[] autoComment,
|
private ListingTextField getTextField(String[] comments, String[] autoComment,
|
||||||
@@ -378,10 +370,11 @@ public class PreCommentFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
CodeUnit cu = (CodeUnit) proxy.getObject();
|
CodeUnit cu = (CodeUnit) proxy.getObject();
|
||||||
Program program = cu.getProgram();
|
Program program = cu.getProgram();
|
||||||
AttributedString prototypeString = new AttributedString("prototype", color, getMetrics());
|
AttributedString prototypeString =
|
||||||
|
new AttributedString("prototype", CommentColors.PRE, getMetrics());
|
||||||
List<FieldElement> fields = new ArrayList<>();
|
List<FieldElement> fields = new ArrayList<>();
|
||||||
for (int i = 0; i < nLinesAutoComment; i++) {
|
for (int i = 0; i < nLinesAutoComment; i++) {
|
||||||
AttributedString as = new AttributedString(autoComment[i], automaticCommentColor,
|
AttributedString as = new AttributedString(autoComment[i], CommentColors.AUTO,
|
||||||
getMetrics(automaticCommentStyle), false, null);
|
getMetrics(automaticCommentStyle), false, null);
|
||||||
fields.add(new TextFieldElement(as, i, 0));
|
fields.add(new TextFieldElement(as, i, 0));
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-23
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -23,7 +22,6 @@ import docking.widgets.fieldpanel.field.*;
|
|||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -47,7 +45,6 @@ public class RegisterFieldFactory extends FieldFactory {
|
|||||||
RegisterFieldFactory.REGISTER_GROUP_NAME + Options.DELIMITER +
|
RegisterFieldFactory.REGISTER_GROUP_NAME + Options.DELIMITER +
|
||||||
"Display Default Register Values";
|
"Display Default Register Values";
|
||||||
private RegComparator regComp;
|
private RegComparator regComp;
|
||||||
private Color regColor;
|
|
||||||
private boolean showHiddenRegisters;
|
private boolean showHiddenRegisters;
|
||||||
private boolean showDefaultValues;
|
private boolean showDefaultValues;
|
||||||
|
|
||||||
@@ -59,15 +56,16 @@ public class RegisterFieldFactory extends FieldFactory {
|
|||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, highlightProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, highlightProvider, displayOptions, fieldOptions);
|
||||||
regComp = new RegComparator();
|
regComp = new RegComparator();
|
||||||
initDisplayOptions();
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initFieldOptions(Options fieldOptions) {
|
||||||
|
super.initFieldOptions(fieldOptions);
|
||||||
fieldOptions.registerOption(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false, null,
|
fieldOptions.registerOption(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false, null,
|
||||||
"Shows/hides context registers");
|
"Shows/hides context registers");
|
||||||
fieldOptions.registerOption(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false, null,
|
fieldOptions.registerOption(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false, null,
|
||||||
"Shows/hides default register values");
|
"Shows/hides default register values");
|
||||||
regColor =
|
|
||||||
displayOptions.getColor(OptionsGui.REGISTERS.getColorOptionName(), getDefaultColor());
|
|
||||||
|
|
||||||
showHiddenRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false);
|
showHiddenRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false);
|
||||||
showDefaultValues =
|
showDefaultValues =
|
||||||
fieldOptions.getBoolean(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false);
|
fieldOptions.getBoolean(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false);
|
||||||
@@ -152,11 +150,6 @@ public class RegisterFieldFactory extends FieldFactory {
|
|||||||
return (category == FieldFormatModel.FUNCTION);
|
return (category == FieldFormatModel.FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.REGISTERS.getDefaultColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
@@ -173,16 +166,6 @@ public class RegisterFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
if (optionName.equals(OptionsGui.REGISTERS.getColorOptionName())) {
|
|
||||||
regColor = (Color) newValue;
|
|
||||||
model.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Register> getSetRegisters(Function function) {
|
private List<Register> getSetRegisters(Function function) {
|
||||||
Program program = function.getProgram();
|
Program program = function.getProgram();
|
||||||
ProgramContext programContext = program.getProgramContext();
|
ProgramContext programContext = program.getProgramContext();
|
||||||
@@ -219,7 +202,8 @@ public class RegisterFieldFactory extends FieldFactory {
|
|||||||
private FieldElement[] getFieldElements(String[] registerStrings) {
|
private FieldElement[] getFieldElements(String[] registerStrings) {
|
||||||
FieldElement[] fieldElements = new FieldElement[registerStrings.length];
|
FieldElement[] fieldElements = new FieldElement[registerStrings.length];
|
||||||
for (int i = 0; i < registerStrings.length; i++) {
|
for (int i = 0; i < registerStrings.length; i++) {
|
||||||
AttributedString str = new AttributedString(registerStrings[i], regColor, getMetrics());
|
AttributedString str =
|
||||||
|
new AttributedString(registerStrings[i], ListingColors.REGISTER, getMetrics());
|
||||||
fieldElements[i] = new TextFieldElement(str, i, 0);
|
fieldElements[i] = new TextFieldElement(str, i, 0);
|
||||||
}
|
}
|
||||||
return fieldElements;
|
return fieldElements;
|
||||||
|
|||||||
+6
-28
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -25,7 +24,6 @@ import docking.widgets.fieldpanel.support.FieldLocation;
|
|||||||
import ghidra.app.cmd.function.CallDepthChangeInfo;
|
import ghidra.app.cmd.function.CallDepthChangeInfo;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -36,15 +34,11 @@ import ghidra.program.model.listing.*;
|
|||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.program.util.RegisterTransitionFieldLocation;
|
import ghidra.program.util.RegisterTransitionFieldLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates Mnemonic Fields.
|
|
||||||
*/
|
|
||||||
public class RegisterTransitionFieldFactory extends FieldFactory {
|
public class RegisterTransitionFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
private static final String FIELD_NAME = "Register Transition";
|
private static final String FIELD_NAME = "Register Transition";
|
||||||
private static final String DISPLAY_HIDDEN_REGISTERS_OPTION_NAME =
|
private static final String DISPLAY_HIDDEN_REGISTERS_OPTION_NAME =
|
||||||
RegisterFieldFactory.DISPLAY_HIDDEN_REGISTERS_OPTION_NAME;
|
RegisterFieldFactory.DISPLAY_HIDDEN_REGISTERS_OPTION_NAME;
|
||||||
private Color regColor;
|
|
||||||
private boolean showContextRegisters;
|
private boolean showContextRegisters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,9 +62,6 @@ public class RegisterTransitionFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initOptions(Options displayOptions, Options fieldOptions) {
|
private void initOptions(Options displayOptions, Options fieldOptions) {
|
||||||
regColor =
|
|
||||||
displayOptions.getColor(OptionsGui.REGISTERS.getColorOptionName(), getDefaultColor());
|
|
||||||
|
|
||||||
showContextRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false);
|
showContextRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,17 +76,6 @@ public class RegisterTransitionFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
|
|
||||||
if (optionName.equals(OptionsGui.REGISTERS.getColorOptionName())) {
|
|
||||||
regColor = (Color) newValue;
|
|
||||||
model.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FactoryField for the given object at index index.
|
* Returns the FactoryField for the given object at index index.
|
||||||
* @param varWidth the amount of variable width spacing for any fields
|
* @param varWidth the amount of variable width spacing for any fields
|
||||||
@@ -141,12 +121,15 @@ public class RegisterTransitionFieldFactory extends FieldFactory {
|
|||||||
FieldElement[] fieldElements = new FieldElement[numElements];
|
FieldElement[] fieldElements = new FieldElement[numElements];
|
||||||
for (int i = 0; i < numRegisters; i++) {
|
for (int i = 0; i < numRegisters; i++) {
|
||||||
Register register = transitionRegisters.get(i);
|
Register register = transitionRegisters.get(i);
|
||||||
AttributedString str = new AttributedString("assume " + register.getName() + " = " +
|
AttributedString str = new AttributedString(
|
||||||
getValueString(register, context, curAddress), regColor, getMetrics());
|
"assume " + register.getName() + " = " +
|
||||||
|
getValueString(register, context, curAddress),
|
||||||
|
ListingColors.REGISTER, getMetrics());
|
||||||
fieldElements[i] = new TextFieldElement(str, i, 0);
|
fieldElements[i] = new TextFieldElement(str, i, 0);
|
||||||
}
|
}
|
||||||
if (stackDepthStr != null) {
|
if (stackDepthStr != null) {
|
||||||
AttributedString str = new AttributedString(stackDepthStr, regColor, getMetrics());
|
AttributedString str =
|
||||||
|
new AttributedString(stackDepthStr, ListingColors.REGISTER, getMetrics());
|
||||||
fieldElements[numRegisters] = new TextFieldElement(str, numRegisters, 0);
|
fieldElements[numRegisters] = new TextFieldElement(str, numRegisters, 0);
|
||||||
}
|
}
|
||||||
return ListingTextField.createMultilineTextField(this, proxy, fieldElements,
|
return ListingTextField.createMultilineTextField(this, proxy, fieldElements,
|
||||||
@@ -264,9 +247,4 @@ public class RegisterTransitionFieldFactory extends FieldFactory {
|
|||||||
return new RegisterTransitionFieldFactory(fieldFormatModel, hsProvider, displayOptions,
|
return new RegisterTransitionFieldFactory(fieldFormatModel, hsProvider, displayOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.MNEMONIC.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -48,7 +48,7 @@ public class SeparatorFieldFactory extends FieldFactory {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param model the model that the field belongs to.
|
* @param model the model that the field belongs to.
|
||||||
* @param hsProvider the HightLightStringProvider.
|
* @param hlProvider the HightLightStringProvider.
|
||||||
* @param displayOptions the Options for display properties.
|
* @param displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific properties.
|
* @param fieldOptions the Options for field specific properties.
|
||||||
*/
|
*/
|
||||||
@@ -71,7 +71,8 @@ public class SeparatorFieldFactory extends FieldFactory {
|
|||||||
sb.append(sepChar);
|
sb.append(sepChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributedString as = new AttributedString(sb.toString(), color, getMetrics());
|
AttributedString as =
|
||||||
|
new AttributedString(sb.toString(), ListingColors.SEPARATOR, getMetrics());
|
||||||
FieldElement text = new TextFieldElement(as, 0, 0);
|
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
@@ -118,5 +119,4 @@ public class SeparatorFieldFactory extends FieldFactory {
|
|||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||||
return new SeparatorFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
return new SeparatorFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -47,7 +47,7 @@ public class SpaceFieldFactory extends FieldFactory {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param model the model that the field belongs to.
|
* @param model the model that the field belongs to.
|
||||||
* @param hsProvider the HightLightStringProvider.
|
* @param hlProvider the HightLightStringProvider.
|
||||||
* @param displayOptions the Options for display properties.
|
* @param displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific properties.
|
* @param fieldOptions the Options for field specific properties.
|
||||||
*/
|
*/
|
||||||
@@ -84,8 +84,8 @@ public class SpaceFieldFactory extends FieldFactory {
|
|||||||
fes[i] = new TextFieldElement(as, 0, 0);
|
fes[i] = new TextFieldElement(as, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListingTextField.createMultilineTextField(this, proxy, fes,
|
return ListingTextField.createMultilineTextField(this, proxy, fes, startX + varWidth,
|
||||||
startX + varWidth, width, n + 1, hlProvider);
|
width, n + 1, hlProvider);
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -153,5 +153,4 @@ public class SpaceFieldFactory extends FieldFactory {
|
|||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||||
return new SpaceFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
return new SpaceFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -30,12 +30,9 @@ import ghidra.program.model.listing.Data;
|
|||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.program.util.SpacerFieldLocation;
|
import ghidra.program.util.SpacerFieldLocation;
|
||||||
import ghidra.util.StringUtilities;
|
import ghidra.util.StringUtilities;
|
||||||
import ghidra.util.classfinder.ClassSearcher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates Spacer Fields.
|
* Generates Spacer Fields.
|
||||||
* <P>
|
|
||||||
* This field is not meant to be loaded by the {@link ClassSearcher}, hence the X in the name.
|
|
||||||
*/
|
*/
|
||||||
public class SpacerFieldFactory extends FieldFactory {
|
public class SpacerFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Spacer";
|
public static final String FIELD_NAME = "Spacer";
|
||||||
@@ -114,7 +111,7 @@ public class SpacerFieldFactory extends FieldFactory {
|
|||||||
@Override
|
@Override
|
||||||
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||||
if (enabled && (text != null)) {
|
if (enabled && (text != null)) {
|
||||||
AttributedString as = new AttributedString(text, color, getMetrics());
|
AttributedString as = new AttributedString(text, ListingColors.SEPARATOR, getMetrics());
|
||||||
FieldElement field = new TextFieldElement(as, 0, 0);
|
FieldElement field = new TextFieldElement(as, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, field, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, field, startX + varWidth,
|
||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
@@ -186,5 +183,4 @@ public class SpacerFieldFactory extends FieldFactory {
|
|||||||
ToolOptions options, ToolOptions fieldOptions) {
|
ToolOptions options, ToolOptions fieldOptions) {
|
||||||
return new SpacerFieldFactory(formatModel, provider, options, fieldOptions);
|
return new SpacerFieldFactory(formatModel, provider, options, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-38
@@ -23,7 +23,6 @@ import docking.widgets.fieldpanel.field.*;
|
|||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
import ghidra.app.util.viewer.proxy.FunctionProxy;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -41,9 +40,6 @@ import ghidra.program.util.ThunkedFunctionFieldLocation;
|
|||||||
public class ThunkedFunctionFieldFactory extends FieldFactory {
|
public class ThunkedFunctionFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Thunked-Function";
|
public static final String FIELD_NAME = "Thunked-Function";
|
||||||
private Color literalColor;
|
|
||||||
private Color unresolvedThunkRefColor;
|
|
||||||
private Color resolvedThunkRefColor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -62,46 +58,23 @@ public class ThunkedFunctionFieldFactory extends FieldFactory {
|
|||||||
public ThunkedFunctionFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
public ThunkedFunctionFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||||
ToolOptions displayOptions, Options fieldOptions) {
|
ToolOptions displayOptions, Options fieldOptions) {
|
||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
|
|
||||||
literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(),
|
|
||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
|
||||||
unresolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
|
||||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
|
||||||
resolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
|
||||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
|
||||||
literalColor = options.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(),
|
|
||||||
OptionsGui.FUN_CALL_FIXUP.getDefaultColor());
|
|
||||||
unresolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
|
||||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
|
||||||
resolvedThunkRefColor =
|
|
||||||
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
|
||||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color getThunkedFunctionNameColor(Function thunkedFunction) {
|
private Color getThunkedFunctionNameColor(Function thunkedFunction) {
|
||||||
if (!thunkedFunction.isExternal()) {
|
if (!thunkedFunction.isExternal()) {
|
||||||
return literalColor;
|
return ListingColors.SEPARATOR;
|
||||||
}
|
}
|
||||||
ExternalLocation externalLocation = thunkedFunction.getExternalLocation();
|
ExternalLocation externalLocation = thunkedFunction.getExternalLocation();
|
||||||
String libName = externalLocation.getLibraryName();
|
String libName = externalLocation.getLibraryName();
|
||||||
if (Library.UNKNOWN.equals(libName)) {
|
if (Library.UNKNOWN.equals(libName)) {
|
||||||
return unresolvedThunkRefColor;
|
return ListingColors.EXT_REF_UNRESOLVED;
|
||||||
}
|
}
|
||||||
ExternalManager externalManager = thunkedFunction.getProgram().getExternalManager();
|
ExternalManager externalManager = thunkedFunction.getProgram().getExternalManager();
|
||||||
String path = externalManager.getExternalLibraryPath(libName);
|
String path = externalManager.getExternalLibraryPath(libName);
|
||||||
if (path == null || path.length() == 0) {
|
if (path == null || path.length() == 0) {
|
||||||
return unresolvedThunkRefColor;
|
return ListingColors.EXT_REF_UNRESOLVED;
|
||||||
}
|
}
|
||||||
return resolvedThunkRefColor;
|
return ListingColors.EXT_REF_RESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,7 +93,7 @@ public class ThunkedFunctionFieldFactory extends FieldFactory {
|
|||||||
AttributedString as;
|
AttributedString as;
|
||||||
int elementIndex = 0;
|
int elementIndex = 0;
|
||||||
|
|
||||||
as = new AttributedString("Thunked-Function: ", literalColor, getMetrics());
|
as = new AttributedString("Thunked-Function: ", ListingColors.SEPARATOR, getMetrics());
|
||||||
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
textElements.add(new TextFieldElement(as, elementIndex++, 0));
|
||||||
|
|
||||||
as = new AttributedString(thunkedFunction.getName(true),
|
as = new AttributedString(thunkedFunction.getName(true),
|
||||||
@@ -171,10 +144,4 @@ public class ThunkedFunctionFieldFactory extends FieldFactory {
|
|||||||
return new ThunkedFunctionFieldFactory(formatModel, provider, pDisplayOptions,
|
return new ThunkedFunctionFieldFactory(formatModel, provider, pDisplayOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// don't care
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-11
@@ -15,14 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.app.util.viewer.proxy.VariableProxy;
|
import ghidra.app.util.viewer.proxy.VariableProxy;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -48,7 +46,7 @@ public class VariableCommentFieldFactory extends AbstractVariableFieldFactory {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param model the model that the field belongs to.
|
* @param model the model that the field belongs to.
|
||||||
* @param hsProvider the HightLightStringProvider.
|
* @param hlProvider the HightLightStringProvider.
|
||||||
* @param displayOptions the Options for display properties.
|
* @param displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific properties.
|
* @param fieldOptions the Options for field specific properties.
|
||||||
*/
|
*/
|
||||||
@@ -181,12 +179,4 @@ public class VariableCommentFieldFactory extends AbstractVariableFieldFactory {
|
|||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||||
return new VariableCommentFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
return new VariableCommentFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.VARIABLE.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-7
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
@@ -27,7 +26,6 @@ import generic.theme.GIcon;
|
|||||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.app.util.viewer.proxy.VariableProxy;
|
import ghidra.app.util.viewer.proxy.VariableProxy;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -151,9 +149,4 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new VariableLocFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
return new VariableLocFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.VARIABLE.getDefaultColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-11
@@ -15,14 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
import ghidra.app.util.viewer.proxy.VariableProxy;
|
import ghidra.app.util.viewer.proxy.VariableProxy;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
@@ -129,13 +127,4 @@ public class VariableNameFieldFactory extends AbstractVariableFieldFactory {
|
|||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||||
return new VariableNameFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
return new VariableNameFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Color getDefaultColor() {
|
|
||||||
return OptionsGui.VARIABLE.getDefaultColor();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user