Changeset 54 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/panels/ScriptBuilderTimelinePanel.java
- Timestamp:
- 08/09/2017 04:12:39 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/panels/ScriptBuilderTimelinePanel.java
r53 r54 11 11 import javax.swing.JPanel; 12 12 import javax.swing.event.MouseInputAdapter; 13 import scriptbuilder.gui.IncidentEditorFrame; 13 14 import scriptbuilder.gui.ScriptBuilderFrame; 14 15 import scriptbuilder.gui.ScriptBuilderGuiConstants; … … 100 101 { 101 102 Editor ed = new Editor(); 102 ScriptBuilderFrame f = (ScriptBuilderFrame) getTopLevelAncestor(); 103 ScriptBuilderFrame f = null; 104 IncidentEditorFrame g = null; 105 if (getTopLevelAncestor() instanceof ScriptBuilderFrame) 106 { 107 f = (ScriptBuilderFrame) getTopLevelAncestor(); 108 } 109 else if (getTopLevelAncestor() instanceof IncidentEditorFrame) 110 { 111 g = (IncidentEditorFrame) getTopLevelAncestor(); 112 } 103 113 104 114 x = cursorTime = e.getX(); … … 142 152 if (e.getButton() == MouseEvent.BUTTON1) 143 153 { 144 if (f.currentEventType != null) 145 { 146 I_ScriptEvent s = ScriptEvent.factoryByType(f.currentEventType); 147 ed.addProperty(eventTypeToPropertyMap.get(f.currentEventType), s); 148 if (incident.slices.get(newSlice) == null) 154 if (getTopLevelAncestor() instanceof ScriptBuilderFrame) 155 { 156 if (f.currentEventType != null) 149 157 { 150 incident.addNewEvent(s, newSlice); 158 I_ScriptEvent s = ScriptEvent.factoryByType(f.currentEventType); 159 ed.addProperty(eventTypeToPropertyMap.get(f.currentEventType), s); 160 if (incident.slices.get(newSlice) == null) 161 { 162 incident.addNewEvent(s, newSlice); 163 } 164 else 165 { 166 incident.slices.get(newSlice).addEvent(s); 167 } 168 f.update(f.getScript(), f.getScript()); 151 169 } 152 else 170 } 171 if (getTopLevelAncestor() instanceof IncidentEditorFrame) 172 { 173 if (g.currentEventType != null) 153 174 { 154 incident.slices.get(newSlice).addEvent(s); 175 I_ScriptEvent s = ScriptEvent.factoryByType(g.currentEventType); 176 ed.addProperty(eventTypeToPropertyMap.get(g.currentEventType), s); 177 if (incident.slices.get(newSlice) == null) 178 { 179 incident.addNewEvent(s, newSlice); 180 } 181 else 182 { 183 incident.slices.get(newSlice).addEvent(s); 184 } 185 g.update(null, g.getIncident()); 155 186 } 156 f.update(f.getScript(), f.getScript());157 187 } 158 188 } … … 294 324 295 325 Graphics2D g2d = (Graphics2D) g; 296 IncidentTimelineDrawer.DrawScriptBuilderTimeline(g2d, incident); 326 if (getTopLevelAncestor() instanceof ScriptBuilderFrame) 327 { 328 IncidentTimelineDrawer.DrawScriptBuilderTimeline(g2d, incident); 329 } 330 if (getTopLevelAncestor() instanceof IncidentEditorFrame) 331 { 332 IncidentTimelineDrawer.DrawIncidentTimeline(g2d, incident, false); 333 } 297 334 298 335 if (focused) 299 336 { 300 337 CursorDrawer.DrawCursor(g2d, cursorTime, false); 301 if (((ScriptBuilderFrame) this.getTopLevelAncestor()).currentEventType != null) 302 { 303 EventIconDrawer.DrawEventIcon(g2d, 304 ((ScriptBuilderFrame) this.getTopLevelAncestor()).currentEventType, 305 x + 5, y + 10); 338 if (this.getTopLevelAncestor() instanceof ScriptBuilderFrame) 339 { 340 if (((ScriptBuilderFrame) this.getTopLevelAncestor()).currentEventType != null) 341 { 342 EventIconDrawer.DrawEventIcon(g2d, 343 ((ScriptBuilderFrame) this.getTopLevelAncestor()).currentEventType, 344 x + 5, y + 10); 345 } 346 } 347 if (this.getTopLevelAncestor() instanceof IncidentEditorFrame) 348 { 349 if (((IncidentEditorFrame) this.getTopLevelAncestor()).currentEventType != null) 350 { 351 EventIconDrawer.DrawEventIcon(g2d, 352 ((IncidentEditorFrame) this.getTopLevelAncestor()).currentEventType, 353 x + 5, y + 10); 354 } 306 355 } 307 356 }
Note: See TracChangeset
for help on using the changeset viewer.
