mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-31 08:33:57 +01:00
v0.5.4 released! Keyword is data-protection. Many small bugfixes, but
main changes are: - Modified marker (* character before name) goes up the project tree by marking all parents of a modified object as modified. - Impact management when changing an object's ID. Allows for some refactoring to occur, while marking the impacted elements as modified, or aven creating "altered" versions if imapcted element was only in game source.
This commit is contained in:
@@ -1615,7 +1615,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
||||
gdeIcon.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (map.state == GameDataElement.State.modified || map.state == GameDataElement.State.created) {
|
||||
if (map.needsSaving()) {
|
||||
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this, "You have unsaved changes in ATCS.\nYou'd better save your changes in ATCS before opening this map with the external editor.\nDo you want to save before opening the file?", "Save before opening?", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
if (confirm == JOptionPane.CANCEL_OPTION) return;
|
||||
if (confirm == JOptionPane.YES_OPTION) {
|
||||
@@ -1633,7 +1633,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (map.state == GameDataElement.State.modified) {
|
||||
if (map.needsSaving()) {
|
||||
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this, "You modified this map in ATCS. All ATCS-made changes will be lost if you confirm.\n On the other hand, if you save using ATCS, all external changes will be lost.\n Do you want to reload?", "Confirm reload?", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (confirm == JOptionPane.CANCEL_OPTION) return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class WorldMapEditor extends Editor {
|
||||
|
||||
public String mapBeingAddedID = null;
|
||||
public String selectedLabel = null;
|
||||
|
||||
WorldMapView mapView = null;
|
||||
|
||||
public WorldMapEditor(WorldmapSegment worldmap) {
|
||||
target = worldmap;
|
||||
this.name = worldmap.id;
|
||||
@@ -114,7 +115,7 @@ public class WorldMapEditor extends Editor {
|
||||
addLabelField(pane, "Worldmap File: ", ((Worldmap)worldmap.getParent()).worldmapFile.getAbsolutePath());
|
||||
pane.add(createButtonPane(worldmap), JideBoxLayout.FIX);
|
||||
|
||||
final WorldMapView mapView = new WorldMapView(worldmap);
|
||||
mapView = new WorldMapView(worldmap);
|
||||
JScrollPane mapScroller = new JScrollPane(mapView);
|
||||
final JViewport vPort = mapScroller.getViewport();
|
||||
|
||||
@@ -296,6 +297,7 @@ public class WorldMapEditor extends Editor {
|
||||
for (String s : mapView.selected) {
|
||||
map.labelledMaps.get(selectedLabel).add(s);
|
||||
}
|
||||
notifyModelModified();
|
||||
mapView.revalidate();
|
||||
mapView.repaint();
|
||||
}
|
||||
@@ -319,6 +321,7 @@ public class WorldMapEditor extends Editor {
|
||||
worldmap.labels.put(created.id, created);
|
||||
worldmap.labels.remove(selectedLabel);
|
||||
selectedLabel = created.id;
|
||||
notifyModelModified();
|
||||
mapView.revalidate();
|
||||
mapView.repaint();
|
||||
}
|
||||
@@ -334,6 +337,7 @@ public class WorldMapEditor extends Editor {
|
||||
worldmap.labelledMaps.remove(selectedLabel);
|
||||
worldmap.labels.remove(selectedLabel);
|
||||
selectedLabel = null;
|
||||
notifyModelModified();
|
||||
mapView.revalidate();
|
||||
mapView.repaint();
|
||||
}
|
||||
@@ -348,6 +352,7 @@ public class WorldMapEditor extends Editor {
|
||||
public void labelCreated(NamedArea created) {
|
||||
worldmap.labelledMaps.put(created.id, new ArrayList<String>());
|
||||
worldmap.labelledMaps.get(created.id).addAll(mapView.selected);
|
||||
notifyModelModified();
|
||||
mapView.revalidate();
|
||||
mapView.repaint();
|
||||
}
|
||||
@@ -436,11 +441,12 @@ public class WorldMapEditor extends Editor {
|
||||
mapView.selected.remove(selectedMap);
|
||||
mapSelectionChanged();
|
||||
mapView.updateFromModel();
|
||||
notifyModelModified();
|
||||
update = true;
|
||||
} else if (editMode == EditMode.addMap && mapBeingAddedID != null) {
|
||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
mapView.recomputeSize();
|
||||
mapView.pushToModel();
|
||||
pushToModel();
|
||||
}
|
||||
mapView.updateFromModel();
|
||||
update = true;
|
||||
@@ -463,7 +469,7 @@ public class WorldMapEditor extends Editor {
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragStart = null;
|
||||
if (editMode == EditMode.moveMaps) {
|
||||
mapView.pushToModel();
|
||||
pushToModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,4 +719,16 @@ public class WorldMapEditor extends Editor {
|
||||
message.repaint();
|
||||
}
|
||||
|
||||
public void pushToModel() {
|
||||
mapView.pushToModel();
|
||||
notifyModelModified();
|
||||
}
|
||||
|
||||
public void notifyModelModified() {
|
||||
target.state = GameDataElement.State.modified;
|
||||
this.name = ((WorldmapSegment)target).getDesc();
|
||||
target.childrenChanged(new ArrayList<ProjectTreeNode>());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user