mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch
'origin/GT-3606_dragonmacher_PR-1541_rickyz_any-font-size' Fixes #1541 Fixes #160
This commit is contained in:
commit
e4084b40ee
2 changed files with 10 additions and 13 deletions
|
@ -22,6 +22,7 @@ import java.beans.PropertyChangeListener;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
|
@ -130,9 +131,6 @@ public class OptionsGui extends JPanel {
|
||||||
MNEMONIC_OVERRIDE, PARAMETER_CUSTOM, PARAMETER_DYNAMIC, REGISTERS, SEPARATOR, UNDERLINE,
|
MNEMONIC_OVERRIDE, PARAMETER_CUSTOM, PARAMETER_DYNAMIC, REGISTERS, SEPARATOR, UNDERLINE,
|
||||||
VARIABLE, VERSION_TRAK, XREF, XREF_OFFCUT, XREF_READ, XREF_WRITE, XREF_OTHER };
|
VARIABLE, VERSION_TRAK, XREF, XREF_OFFCUT, XREF_READ, XREF_WRITE, XREF_OTHER };
|
||||||
|
|
||||||
private String[] fontSizes = { "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
|
|
||||||
"17", "18", "20", "22", "24", "30" };
|
|
||||||
|
|
||||||
private Map<Integer, FontMetrics> metricsMap = new HashMap<>();
|
private Map<Integer, FontMetrics> metricsMap = new HashMap<>();
|
||||||
|
|
||||||
private JList<ScreenElement> namesList;
|
private JList<ScreenElement> namesList;
|
||||||
|
@ -142,7 +140,7 @@ public class OptionsGui extends JPanel {
|
||||||
private JCheckBox boldCheckbox;
|
private JCheckBox boldCheckbox;
|
||||||
private JCheckBox italicsCheckbox;
|
private JCheckBox italicsCheckbox;
|
||||||
private JCheckBox customCheckbox;
|
private JCheckBox customCheckbox;
|
||||||
private JComboBox<String> fontSizeField;
|
private JComboBox<Integer> fontSizeField;
|
||||||
private JComboBox<String> fontNameField;
|
private JComboBox<String> fontNameField;
|
||||||
private JPanel colorPanel;
|
private JPanel colorPanel;
|
||||||
private int selectedIndex;
|
private int selectedIndex;
|
||||||
|
@ -174,7 +172,7 @@ public class OptionsGui extends JPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
setSelectedFontName(baseFont.getName());
|
setSelectedFontName(baseFont.getName());
|
||||||
fontSizeField.setSelectedItem(Integer.toString(baseFont.getSize()));
|
fontSizeField.setSelectedItem(baseFont.getSize());
|
||||||
|
|
||||||
namesList.setSelectedIndex(0);
|
namesList.setSelectedIndex(0);
|
||||||
namesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
namesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
@ -346,7 +344,7 @@ public class OptionsGui extends JPanel {
|
||||||
fontNameField.setRenderer(new FontRenderer());
|
fontNameField.setRenderer(new FontRenderer());
|
||||||
panel1.add(fontNameField);
|
panel1.add(fontNameField);
|
||||||
|
|
||||||
fontSizeField = new GComboBox<>(fontSizes);
|
fontSizeField = new GComboBox<>(IntStream.rangeClosed(6, 32).boxed().toArray(Integer[]::new));
|
||||||
fontSizeField.setBackground(Color.white);
|
fontSizeField.setBackground(Color.white);
|
||||||
panel1.add(fontSizeField);
|
panel1.add(fontSizeField);
|
||||||
panel.add(panel1, BorderLayout.NORTH);
|
panel.add(panel1, BorderLayout.NORTH);
|
||||||
|
@ -774,7 +772,7 @@ public class OptionsGui extends JPanel {
|
||||||
String name = (String) fontNameField.getSelectedItem();
|
String name = (String) fontNameField.getSelectedItem();
|
||||||
int size = baseFont.getSize();
|
int size = baseFont.getSize();
|
||||||
try {
|
try {
|
||||||
size = Integer.parseInt((String) fontSizeField.getSelectedItem());
|
size = (Integer) fontSizeField.getSelectedItem();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.beans.PropertyEditorSupport;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ public class FontPropertyEditor extends PropertyEditorSupport {
|
||||||
JLabel fontLabel, sizeLabel, styleLabel;
|
JLabel fontLabel, sizeLabel, styleLabel;
|
||||||
JLabel fontStringLabel;
|
JLabel fontStringLabel;
|
||||||
JComboBox<FontWrapper> fonts;
|
JComboBox<FontWrapper> fonts;
|
||||||
JComboBox<String> sizes;
|
JComboBox<Integer> sizes;
|
||||||
JComboBox<String> styles;
|
JComboBox<String> styles;
|
||||||
int styleChoice;
|
int styleChoice;
|
||||||
int sizeChoice;
|
int sizeChoice;
|
||||||
|
@ -170,12 +171,11 @@ public class FontPropertyEditor extends PropertyEditorSupport {
|
||||||
fontPanel.add(fonts);
|
fontPanel.add(fonts);
|
||||||
fonts.setSelectedItem(fontWrapper);
|
fonts.setSelectedItem(fontWrapper);
|
||||||
|
|
||||||
sizes = new GComboBox<>(
|
sizes = new GComboBox<>(IntStream.rangeClosed(1, 72).boxed().toArray(Integer[]::new));
|
||||||
new String[] { "8", "10", "12", "14", "16", "18", "24", "28", "32" });
|
|
||||||
sizes.setMaximumRowCount(9);
|
sizes.setMaximumRowCount(9);
|
||||||
sizePanel.add(sizes);
|
sizePanel.add(sizes);
|
||||||
sizeChoice = font.getSize();
|
sizeChoice = font.getSize();
|
||||||
sizes.setSelectedItem("" + sizeChoice);
|
sizes.setSelectedItem(sizeChoice);
|
||||||
sizes.setMaximumRowCount(9);
|
sizes.setMaximumRowCount(9);
|
||||||
|
|
||||||
styles = new GComboBox<>(new String[] { "PLAIN", "BOLD", "ITALIC", "BOLD & ITALIC" });
|
styles = new GComboBox<>(new String[] { "PLAIN", "BOLD", "ITALIC", "BOLD & ITALIC" });
|
||||||
|
@ -203,8 +203,7 @@ public class FontPropertyEditor extends PropertyEditorSupport {
|
||||||
styleChoice = styles.getSelectedIndex();
|
styleChoice = styles.getSelectedIndex();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String sizeStr = (String) sizes.getSelectedItem();
|
sizeChoice = (Integer) sizes.getSelectedItem();
|
||||||
sizeChoice = Integer.parseInt(sizeStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
font = new Font(fontNameChoice, styleChoice, sizeChoice);
|
font = new Font(fontNameChoice, styleChoice, sizeChoice);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue