mirror of
https://github.com/OMGeeky/ATCS.git
synced 2026-01-02 01:20:15 +01:00
v0.4.4 !
- Projects can now use either loadresources.xml or loadresources_debug.xml, or none (as before). This must be selected at project creation and cannot be changed. - NPC and Items comparators now include both the source and altered version of elements present in both. - Spritesheets view should now be better laid out, as insets were not taken into account, thus cropping a few pixels right and down.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.gpl.rpg.atcontentstudio.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
@@ -8,18 +9,26 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListCellRenderer;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project.ResourceSet;
|
||||
import com.gpl.rpg.atcontentstudio.model.Workspace;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMapSet;
|
||||
@@ -30,7 +39,8 @@ public class ProjectCreationWizard extends JDialog {
|
||||
private static final long serialVersionUID = -2854969975146867119L;
|
||||
|
||||
final JTextField projectNameField;
|
||||
final JComboBox atSourceSelectionCombo;
|
||||
final JComboBox<String> atSourceSelectionCombo;
|
||||
final JComboBox<Project.ResourceSet> resourceSetToUse;
|
||||
|
||||
final JButton browse;
|
||||
final JButton okButton;
|
||||
@@ -42,7 +52,62 @@ public class ProjectCreationWizard extends JDialog {
|
||||
super(ATContentStudio.frame);
|
||||
setTitle("Create project");
|
||||
projectNameField = new JTextField();
|
||||
atSourceSelectionCombo = new JComboBox();
|
||||
atSourceSelectionCombo = new JComboBox<String>();
|
||||
resourceSetToUse = new JComboBox<Project.ResourceSet>(new ComboBoxModel<Project.ResourceSet>() {
|
||||
|
||||
Project.ResourceSet selected = Project.ResourceSet.allFiles;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return Project.ResourceSet.values().length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceSet getElementAt(int index) {
|
||||
return Project.ResourceSet.values()[index];
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new LinkedList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object anItem) {
|
||||
selected = (ResourceSet) anItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelectedItem() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
});
|
||||
resourceSetToUse.setRenderer(new ListCellRenderer<Project.ResourceSet>() {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(
|
||||
JList<? extends ResourceSet> list, ResourceSet value,
|
||||
int index, boolean isSelected, boolean cellHasFocus) {
|
||||
switch (value) {
|
||||
case allFiles:
|
||||
return new JLabel("All available files");
|
||||
case debugData:
|
||||
return new JLabel("Debug data");
|
||||
case gameData:
|
||||
return new JLabel("Real game data");
|
||||
default:
|
||||
return new JLabel();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
browse = new JButton("Browse...");
|
||||
okButton = new JButton("Ok");
|
||||
cancelButton = new JButton("Cancel");
|
||||
@@ -103,7 +168,7 @@ public class ProjectCreationWizard extends JDialog {
|
||||
if (!Workspace.activeWorkspace.knownMapSourcesFolders.contains(atSourceFolder)) {
|
||||
Workspace.activeWorkspace.knownMapSourcesFolders.add(atSourceFolder);
|
||||
}
|
||||
Workspace.createProject(projectNameField.getText(), atSourceFolder);
|
||||
Workspace.createProject(projectNameField.getText(), atSourceFolder, (Project.ResourceSet)resourceSetToUse.getSelectedItem());
|
||||
ProjectCreationWizard.this.dispose();
|
||||
}
|
||||
});
|
||||
@@ -154,6 +219,17 @@ public class ProjectCreationWizard extends JDialog {
|
||||
c.weightx = 20;
|
||||
panel.add(browse, c);
|
||||
|
||||
c.gridy++;
|
||||
c.gridx = 1;
|
||||
c.gridwidth = 1;
|
||||
c.weightx = 20;
|
||||
panel.add(new JLabel("Resource set: "), c);
|
||||
|
||||
c.gridx++;
|
||||
c.weightx = 80;
|
||||
c.gridwidth = 2;
|
||||
panel.add(resourceSetToUse, c);
|
||||
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new GridBagLayout());
|
||||
GridBagConstraints c2 = new GridBagConstraints();
|
||||
|
||||
@@ -151,10 +151,10 @@ public class SpritesheetEditor extends Editor {
|
||||
TableColumn col;
|
||||
while (columns.hasMoreElements()) {
|
||||
col = columns.nextElement();
|
||||
col.setMinWidth(sheet.spriteWidth + 1);
|
||||
col.setMaxWidth(sheet.spriteWidth + 1);
|
||||
col.setMinWidth(sheet.spriteWidth + 4);
|
||||
col.setMaxWidth(sheet.spriteWidth + 4);
|
||||
}
|
||||
spritesTable.setRowHeight(sheet.spriteHeight + 1);
|
||||
spritesTable.setRowHeight(sheet.spriteHeight + 4);
|
||||
pane.add(new JScrollPane(spritesTable), BorderLayout.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ItemsTableView extends ElementTableView {
|
||||
private static final long serialVersionUID = 1474255176349837609L;
|
||||
|
||||
public ItemsTableView(Project proj) {
|
||||
super(new ItemsTableModel(proj), "Compare "+proj.getItemCount()+" items.", new ImageIcon(DefaultIcons.getItemIcon()));
|
||||
super(new ItemsTableModel(proj), "Compare "+proj.getItemCountIncludingAltered()+" items.", new ImageIcon(DefaultIcons.getItemIcon()));
|
||||
}
|
||||
|
||||
private static class ItemsTableModel implements TableModel {
|
||||
@@ -32,7 +32,7 @@ public class ItemsTableView extends ElementTableView {
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
// return proj.getItemCount() + 1;
|
||||
return proj.getItemCount();
|
||||
return proj.getItemCountIncludingAltered();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +130,7 @@ public class ItemsTableView extends ElementTableView {
|
||||
// return getColumnName(columnIndex);
|
||||
// }
|
||||
// Item item = proj.getItem(rowIndex - 1);
|
||||
Item item = proj.getItem(rowIndex);
|
||||
Item item = proj.getItemIncludingAltered(rowIndex);
|
||||
boolean canUse = item.category != null && item.category.action_type == ItemCategory.ActionType.use;
|
||||
boolean canEquip = item.category != null && item.category.action_type == ItemCategory.ActionType.equip;
|
||||
switch (columnIndex) {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class NPCsTableView extends ElementTableView {
|
||||
private static final long serialVersionUID = -4196852140899079621L;
|
||||
|
||||
public NPCsTableView(Project proj) {
|
||||
super(new NPCsTableModel(proj), "Compare "+proj.getNPCCount()+" NPCs.", new ImageIcon(DefaultIcons.getNPCIcon()));
|
||||
super(new NPCsTableModel(proj), "Compare "+proj.getNPCCountIncludingAltered()+" NPCs.", new ImageIcon(DefaultIcons.getNPCIcon()));
|
||||
}
|
||||
|
||||
private static class NPCsTableModel implements TableModel {
|
||||
@@ -30,7 +30,7 @@ public class NPCsTableView extends ElementTableView {
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return proj.getNPCCount();
|
||||
return proj.getNPCCountIncludingAltered();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +109,7 @@ public class NPCsTableView extends ElementTableView {
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
NPC npc = proj.getNPC(rowIndex);
|
||||
NPC npc = proj.getNPCIncludingAltered(rowIndex);
|
||||
switch (columnIndex) {
|
||||
case 0: return new ImageIcon(npc.getIcon()); // Icon
|
||||
case 1: return npc.id; //ID
|
||||
|
||||
Reference in New Issue
Block a user