trackeditor: add undo to split segments (WIP)
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8553 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 281dd95722ab53b337742fc86c043a58855555c8 Former-commit-id: 1557de579e531d53d3dced747735f4b4dadf9410
This commit is contained in:
parent
172d7a0331
commit
339fbb9c57
4 changed files with 17 additions and 5 deletions
|
@ -110,7 +110,8 @@ IF(Java_Development_FOUND AND Java_FOUND)
|
||||||
utils/undo/UndoAddSegment.java
|
utils/undo/UndoAddSegment.java
|
||||||
utils/undo/UndoDeleteSegment.java
|
utils/undo/UndoDeleteSegment.java
|
||||||
utils/undo/UndoInterface.java
|
utils/undo/UndoInterface.java
|
||||||
utils/undo/UndoSegmentChange.java)
|
utils/undo/UndoSegmentChange.java
|
||||||
|
utils/undo/UndoSplitSegment.java)
|
||||||
|
|
||||||
#file(GLOB_RECURSE _JAVA_SRC ./*.java)
|
#file(GLOB_RECURSE _JAVA_SRC ./*.java)
|
||||||
#foreach(_jfile ${_JAVA_SRC})
|
#foreach(_jfile ${_JAVA_SRC})
|
||||||
|
|
|
@ -40,6 +40,7 @@ import utils.undo.Undo;
|
||||||
import utils.undo.UndoAddSegment;
|
import utils.undo.UndoAddSegment;
|
||||||
import utils.undo.UndoDeleteSegment;
|
import utils.undo.UndoDeleteSegment;
|
||||||
import utils.undo.UndoSegmentChange;
|
import utils.undo.UndoSegmentChange;
|
||||||
|
import utils.undo.UndoSplitSegment;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -444,7 +445,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
||||||
Editor.getProperties().setCurveNameCount(count2);
|
Editor.getProperties().setCurveNameCount(count2);
|
||||||
newShape2.setName("curve " + count2);
|
newShape2.setName("curve " + count2);
|
||||||
data.insertElementAt(newShape2, pos + 1);
|
data.insertElementAt(newShape2, pos + 1);
|
||||||
//Undo.add(new UndoSplitSegment(editorFrame, oldShape, cloneShape, newShape2));
|
Undo.add(new UndoSplitSegment(editorFrame, oldShape, cloneShape, newShape2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "rgt":
|
case "rgt":
|
||||||
|
@ -500,7 +501,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
||||||
Editor.getProperties().setCurveNameCount(count2);
|
Editor.getProperties().setCurveNameCount(count2);
|
||||||
newShape2.setName("curve " + count2);
|
newShape2.setName("curve " + count2);
|
||||||
data.insertElementAt(newShape2, pos + 1);
|
data.insertElementAt(newShape2, pos + 1);
|
||||||
//Undo.add(new UndoSplitSegment(editorFrame, oldShape, cloneShape, newShape2));
|
Undo.add(new UndoSplitSegment(editorFrame, oldShape, cloneShape, newShape2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "str":
|
case "str":
|
||||||
|
@ -534,7 +535,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
||||||
Editor.getProperties().setStraightNameCount(count3);
|
Editor.getProperties().setStraightNameCount(count3);
|
||||||
newShape3.setName("straight " + count3);
|
newShape3.setName("straight " + count3);
|
||||||
data.insertElementAt(newShape3, pos + 1);
|
data.insertElementAt(newShape3, pos + 1);
|
||||||
//Undo.add(new UndoSplitSegment(editorFrame, oldShape, cloneShape, newShape3));
|
Undo.add(new UndoSplitSegment(editorFrame, oldShape, cloneShape, newShape3));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -559,7 +560,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
||||||
if (mustFireEvent)
|
if (mustFireEvent)
|
||||||
fireSelectionChanged(selectionChangedEvent);
|
fireSelectionChanged(selectionChangedEvent);
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(this, "Not implemented yet!", "Moving Finishh Line", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(this, "Not implemented yet!", "Moving Finish Line", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
|
||||||
handledShape = null;
|
handledShape = null;
|
||||||
editorFrame.documentIsModified = true;
|
editorFrame.documentIsModified = true;
|
||||||
|
|
|
@ -6,6 +6,16 @@ import utils.circuit.Segment;
|
||||||
|
|
||||||
public class SegmentVector extends Vector<Segment>
|
public class SegmentVector extends Vector<Segment>
|
||||||
{
|
{
|
||||||
|
public synchronized Segment set(int index, Segment segment)
|
||||||
|
{
|
||||||
|
Segment current = get(index);
|
||||||
|
|
||||||
|
segment.nextShape = current.nextShape;
|
||||||
|
segment.previousShape = current.previousShape;
|
||||||
|
|
||||||
|
return super.set(index, segment);
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized boolean add(Segment segment)
|
public synchronized boolean add(Segment segment)
|
||||||
{
|
{
|
||||||
Segment last = null;
|
Segment last = null;
|
||||||
|
|
BIN
src/tools/trackeditor/utils/undo/UndoSplitSegment.class
Normal file
BIN
src/tools/trackeditor/utils/undo/UndoSplitSegment.class
Normal file
Binary file not shown.
Loading…
Reference in a new issue