Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
Argent77 committed Apr 25, 2020
2 parents 600dea3 + 4b93ab6 commit 1b2fd57
Show file tree
Hide file tree
Showing 75 changed files with 1,240 additions and 754 deletions.
11 changes: 11 additions & 0 deletions src/org/infinity/NearInfinity.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@
import org.infinity.gui.QuickSearch;
import org.infinity.gui.ResourceTree;
import org.infinity.gui.StatusBar;
import org.infinity.gui.StructViewer;
import org.infinity.gui.ViewFrame;
import org.infinity.gui.WindowBlocker;
import org.infinity.icon.Icons;
import org.infinity.resource.AbstractStruct;
import org.infinity.resource.Closeable;
import org.infinity.resource.EffectFactory;
import org.infinity.resource.Profile;
Expand Down Expand Up @@ -550,6 +552,15 @@ public void actionPerformed(ActionEvent event)
} finally {
WindowBlocker.blockWindow(this, false);
}
} else if (event.getActionCommand().equals("RefreshView")) {
// repaint UI controls of current view
if (getViewable() instanceof AbstractStruct) {
StructViewer sv = ((AbstractStruct)getViewable()).getViewer();
if (sv != null)
SwingUtilities.updateComponentTreeUI(sv);
}
// repaint UI controls of child windows
ChildFrame.updateWindowGUIs();
} else if (event.getActionCommand().equals("ChangeLook")) {
try {
LookAndFeelInfo info = BrowserMenuBar.getInstance().getLookAndFeel();
Expand Down
14 changes: 6 additions & 8 deletions src/org/infinity/datatype/ResourceRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public JComponent edit(final ActionListener container)
//FIXME: ResRefChecker check only that point is exist, so this must be
// the same check or this check must be inside isLegalEntry(...)
// There only 2 places where isLegalEntry is called: this and ResRefChecker
if (isLegalEntry(entry) && entry.getResourceName().lastIndexOf('.') <= 8) {
if (isLegalEntry(entry) && entry.getResourceRef().length() <= 8) {
values.add(new ResourceRefEntry(entry));
}
}
Expand Down Expand Up @@ -226,19 +226,17 @@ public boolean updateValue(AbstractStruct struct)
if (entry == null) {
setValue(selected.name);
} else {
int i = -1;
boolean found = false;
for (final String type : types) {
//TODO: It seems that instead of toString getExtension must be used
i = entry.getResourceName().indexOf('.' + type.toUpperCase(Locale.ENGLISH));
if (i != -1) {
found = entry.getExtension().equalsIgnoreCase(type);
if (found) {
this.type = type;
setValue(entry.getResourceName().substring(0, i));
setValue(entry.getResourceRef());
break;
}
}
if (i == -1) {
if (!found)
return false;
}
}

// notifying listeners
Expand Down
2 changes: 1 addition & 1 deletion src/org/infinity/gui/BIFFEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ private void setProgress(int level, boolean ok)
if (ok)
boxes[level - 1].setSelected(true);
else
boxes[level - 1].setForeground(Color.red);
boxes[level - 1].setForeground(Color.RED);
bok.setEnabled(level == boxes.length || !ok);
}

Expand Down
35 changes: 19 additions & 16 deletions src/org/infinity/gui/BrowserMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

public final class BrowserMenuBar extends JMenuBar implements KeyEventDispatcher
{
public static final String VERSION = "v2.1-20200419";
public static final String VERSION = "v2.1-20200425";
public static final LookAndFeelInfo DEFAULT_LOOKFEEL =
new LookAndFeelInfo("Metal", "javax.swing.plaf.metal.MetalLookAndFeel");

Expand Down Expand Up @@ -343,7 +343,7 @@ public boolean showDlgTechInfo()

public boolean getColoredOffsetsEnabled()
{
return optionsMenu.optionShowColoredOffsets.isSelected();
return optionsMenu.optionShowColoredStructures.isSelected();
}

public boolean getHexColorMapEnabled()
Expand Down Expand Up @@ -1756,7 +1756,7 @@ private static final class OptionsMenu extends JMenu implements ActionListener,
private static final String OPTION_CACHEOVERRIDE = "CacheOverride";
private static final String OPTION_MORECOMPILERWARNINGS = "MoreCompilerWarnings";
private static final String OPTION_SHOWSTRREFS = "ShowStrrefs";
private static final String OPTION_SHOWCOLOREDOFFSETS = "ShowColoredOffsets";
private static final String OPTION_SHOWCOLOREDSTRUCTURES = "ShowColoredStructures";
private static final String OPTION_SHOWHEXCOLORED = "ShowHexColored";
private static final String OPTION_KEEPVIEWONCOPY = "UpdateTreeOnCopy";
private static final String OPTION_SHOWTREESEARCHNAMES = "ShowTreeSearchNames";
Expand Down Expand Up @@ -1832,7 +1832,7 @@ private static final class OptionsMenu extends JMenu implements ActionListener,

private JCheckBoxMenuItem optionBackupOnSave, optionShowOffset, optionIgnoreOverride,
optionIgnoreReadErrors, optionCacheOverride, optionShowStrrefs,
optionShowColoredOffsets, optionShowHexColored, optionShowUnknownResources,
optionShowColoredStructures, optionShowHexColored, optionShowUnknownResources,
optionKeepViewOnCopy, optionTreeSearchNames,
optionHighlightOverridden;
// optionMonitorFileChanges;
Expand Down Expand Up @@ -1861,27 +1861,28 @@ private OptionsMenu()
new JCheckBoxMenuItem("Ignore Overrides", getPrefs().getBoolean(OPTION_IGNOREOVERRIDE, false));
add(optionIgnoreOverride);
optionIgnoreReadErrors =
new JCheckBoxMenuItem("Ignore Read Errors", getPrefs().getBoolean(OPTION_IGNOREREADERRORS, false));
new JCheckBoxMenuItem("Ignore read errors", getPrefs().getBoolean(OPTION_IGNOREREADERRORS, false));
add(optionIgnoreReadErrors);
optionShowUnknownResources =
new JCheckBoxMenuItem("Show Unknown Resource Types", getPrefs().getBoolean(OPTION_SHOWUNKNOWNRESOURCES, true));
new JCheckBoxMenuItem("Show unknown resource types", getPrefs().getBoolean(OPTION_SHOWUNKNOWNRESOURCES, true));
optionShowUnknownResources.setActionCommand("Refresh");
optionShowUnknownResources.addActionListener(NearInfinity.getInstance());
optionShowUnknownResources.setToolTipText("Uncheck this option to hide unknown or unsupported resource types and invalid filenames.");
add(optionShowUnknownResources);
optionShowOffset =
new JCheckBoxMenuItem("Show Hex Offsets", getPrefs().getBoolean(OPTION_SHOWOFFSETS, false));
new JCheckBoxMenuItem("Show hex offsets", getPrefs().getBoolean(OPTION_SHOWOFFSETS, false));
add(optionShowOffset);
optionTreeSearchNames = new JCheckBoxMenuItem("Show Search Names in Resource Tree", getPrefs().getBoolean(OPTION_SHOWTREESEARCHNAMES, true));
optionTreeSearchNames =
new JCheckBoxMenuItem("Show search names in resource tree", getPrefs().getBoolean(OPTION_SHOWTREESEARCHNAMES, true));
optionTreeSearchNames.setActionCommand("RefreshTree");
optionTreeSearchNames.addActionListener(NearInfinity.getInstance());
add(optionTreeSearchNames);
optionHighlightOverridden = new JCheckBoxMenuItem("Show Overridden Files in Bold in Resource Tree", getPrefs().getBoolean(OPTION_HIGHLIGHT_OVERRIDDEN, true));
optionHighlightOverridden =
new JCheckBoxMenuItem("Show overridden files in bold in resource tree", getPrefs().getBoolean(OPTION_HIGHLIGHT_OVERRIDDEN, true));
optionHighlightOverridden.setActionCommand("RefreshTree");
optionHighlightOverridden.addActionListener(NearInfinity.getInstance());
optionHighlightOverridden.setToolTipText("If checked, files, that contains in game index (.key file) and located "
+ "in the Override folder, will be shown in bold in the Resource Tree. "
+ "This setting has no effect if override files are shown only in the Override folder");
optionHighlightOverridden.setToolTipText("<html>If checked, files that are listed in the chitin.key and are located in the Override folder, will be shown<br>" +
"in <b>bold</b> in the Resource Tree. This setting has no effect if override files are shown only in the Override folder.</html>");
add(optionHighlightOverridden);
// optionMonitorFileChanges =
// new JCheckBoxMenuItem("Autoupdate resource tree", getPrefs().getBoolean(OPTION_MONITORFILECHANGES, true));
Expand All @@ -1900,9 +1901,11 @@ private OptionsMenu()
optionShowStrrefs =
new JCheckBoxMenuItem("Show Strrefs in View tabs", getPrefs().getBoolean(OPTION_SHOWSTRREFS, false));
add(optionShowStrrefs);
optionShowColoredOffsets =
new JCheckBoxMenuItem("Show colored offset fields in Edit tabs", getPrefs().getBoolean(OPTION_SHOWCOLOREDOFFSETS, true));
add(optionShowColoredOffsets);
optionShowColoredStructures =
new JCheckBoxMenuItem("Show colored structures in Edit tabs", getPrefs().getBoolean(OPTION_SHOWCOLOREDSTRUCTURES, true));
optionShowColoredStructures.setActionCommand("RefreshView");
optionShowColoredStructures.addActionListener(NearInfinity.getInstance());
add(optionShowColoredStructures);
optionShowHexColored =
new JCheckBoxMenuItem("Show colored blocks in Raw tabs", getPrefs().getBoolean(OPTION_SHOWHEXCOLORED, true));
add(optionShowHexColored);
Expand Down Expand Up @@ -2523,7 +2526,7 @@ private void storePreferences()
getPrefs().putBoolean(OPTION_MORECOMPILERWARNINGS, optionMoreCompileWarnings.isSelected());
getPrefs().putBoolean(OPTION_SHOWSTRREFS, optionShowStrrefs.isSelected());
dialogViewerMenu.storePreferences(getPrefs());
getPrefs().putBoolean(OPTION_SHOWCOLOREDOFFSETS, optionShowColoredOffsets.isSelected());
getPrefs().putBoolean(OPTION_SHOWCOLOREDSTRUCTURES, optionShowColoredStructures.isSelected());
getPrefs().putBoolean(OPTION_SHOWHEXCOLORED, optionShowHexColored.isSelected());
getPrefs().putBoolean(OPTION_KEEPVIEWONCOPY, optionKeepViewOnCopy.isSelected());
getPrefs().putBoolean(OPTION_SHOWTREESEARCHNAMES, optionTreeSearchNames.isSelected());
Expand Down
Loading

0 comments on commit 1b2fd57

Please sign in to comment.