#788 Add DefineCompactedFont Tag to gfx file: fixed

Faster raw editing
This commit is contained in:
honfika@gmail.com
2015-02-02 18:25:29 +01:00
parent e7f1182c6a
commit 73d5a047c5
2 changed files with 24 additions and 17 deletions

View File

@@ -86,6 +86,8 @@ public class GenericTagTreePanel extends GenericTagPanel {
private Tag editedTag;
private static final Map<Class, List<Field>> fieldCache = new HashMap<>();
private class MyTree extends JTree {
public MyTree() {
@@ -821,22 +823,26 @@ public class GenericTagTreePanel extends GenericTagPanel {
}
private static List<Field> getAvailableFields(Class<?> cls) {
List<Field> ret = new ArrayList<>();
Field fields[] = cls.getFields();
for (Field f : fields) {
if (Modifier.isStatic(f.getModifiers())) {
continue;
List<Field> ret = fieldCache.get(cls);
if (ret == null) {
ret = new ArrayList<>();
Field fields[] = cls.getFields();
for (Field f : fields) {
if (Modifier.isStatic(f.getModifiers())) {
continue;
}
f.setAccessible(true);
Internal inter = f.getAnnotation(Internal.class);
if (inter != null) {
continue;
}
HideInRawEdit hide = f.getAnnotation(HideInRawEdit.class);
if (hide != null) {
continue;
}
ret.add(f);
}
f.setAccessible(true);
Internal inter = f.getAnnotation(Internal.class);
if (inter != null) {
continue;
}
HideInRawEdit hide = f.getAnnotation(HideInRawEdit.class);
if (hide != null) {
continue;
}
ret.add(f);
fieldCache.put(cls, ret);
}
return ret;
}

View File

@@ -372,9 +372,10 @@ public class TagTree extends JTree {
ret = Arrays.asList(DefineButtonTag.ID, DefineButton2Tag.ID);
break;
case TagTreeModel.FOLDER_FONTS:
ret = Arrays.asList(DefineFontTag.ID, DefineFont2Tag.ID, DefineFont3Tag.ID, DefineFont4Tag.ID);
if (gfx) {
ret.add(DefineCompactedFont.ID);
ret = Arrays.asList(DefineFontTag.ID, DefineFont2Tag.ID, DefineFont3Tag.ID, DefineFont4Tag.ID, DefineCompactedFont.ID);
} else {
ret = Arrays.asList(DefineFontTag.ID, DefineFont2Tag.ID, DefineFont3Tag.ID, DefineFont4Tag.ID);
}
break;
case TagTreeModel.FOLDER_BINARY_DATA: