source:
josm/trunk/patches/10trim_svgsalamander.patch@
15283
Last change on this file since 15283 was 8083, checked in by , 10 years ago | |
---|---|
File size: 10.1 KB |
-
kitfox/svg/SVGElement.java
Only in kitfox/svg: animation Only in kitfox/svg/app/ant: SVGToImageAntTask.java Only in kitfox/svg/app/beans: ProportionalLayoutPanel.form Only in kitfox/svg/app/beans: ProportionalLayoutPanel.java Only in kitfox/svg/app/beans: SVGPanel.form Only in kitfox/svg/app/beans: SVGPanel.java Only in kitfox/svg/app/data: HandlerFactory.java Only in kitfox/svg/app: MainFrame.form Only in kitfox/svg/app: MainFrame.java Only in kitfox/svg/app: PlayerDialog.form Only in kitfox/svg/app: PlayerDialog.java Only in kitfox/svg/app: PlayerThread.java Only in kitfox/svg/app: PlayerThreadListener.java Only in kitfox/svg/app: SVGPlayer.form Only in kitfox/svg/app: SVGPlayer.java Only in kitfox/svg/app: SVGViewer.form Only in kitfox/svg/app: SVGViewer.java Only in kitfox/svg/app: VersionDialog.form Only in kitfox/svg/app: VersionDialog.java Only in kitfox/svg: SVGDisplayPanel.form Only in kitfox/svg: SVGDisplayPanel.java diff -ur kitfox/svg/SVGElement.java src/com/kitfox/svg/SVGElement.java
old new 35 35 */ 36 36 package com.kitfox.svg; 37 37 38 import com.kitfox.svg.animation.AnimationElement;39 import com.kitfox.svg.animation.TrackBase;40 import com.kitfox.svg.animation.TrackManager;41 38 import com.kitfox.svg.pathcmd.Arc; 42 39 import com.kitfox.svg.pathcmd.BuildHistory; 43 40 import com.kitfox.svg.pathcmd.Cubic; … … 122 119 * The diagram this element belongs to 123 120 */ 124 121 protected SVGDiagram diagram; 125 /**126 * Link to the universe we reside in127 */128 protected final TrackManager trackManager = new TrackManager();129 122 boolean dirty = true; 130 123 131 124 /** … … 305 298 } 306 299 } 307 300 308 public void removeAttribute(String name, int attribType)309 {310 switch (attribType)311 {312 case AnimationElement.AT_CSS:313 inlineStyles.remove(name);314 return;315 case AnimationElement.AT_XML:316 presAttribs.remove(name);317 return;318 }319 }320 321 public void addAttribute(String name, int attribType, String value) throws SVGElementException322 {323 if (hasAttribute(name, attribType))324 {325 throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists");326 }327 328 //Alter layout for id attribute329 if ("id".equals(name))330 {331 if (diagram != null)332 {333 diagram.removeElement(id);334 diagram.setElement(value, this);335 }336 this.id = value;337 }338 339 switch (attribType)340 {341 case AnimationElement.AT_CSS:342 inlineStyles.put(name, new StyleAttribute(name, value));343 return;344 case AnimationElement.AT_XML:345 presAttribs.put(name, new StyleAttribute(name, value));346 return;347 }348 349 throw new SVGElementException(this, "Invalid attribute type " + attribType);350 }351 352 public boolean hasAttribute(String name, int attribType) throws SVGElementException353 {354 switch (attribType)355 {356 case AnimationElement.AT_CSS:357 return inlineStyles.containsKey(name);358 case AnimationElement.AT_XML:359 return presAttribs.containsKey(name);360 case AnimationElement.AT_AUTO:361 return inlineStyles.containsKey(name) || presAttribs.containsKey(name);362 }363 364 throw new SVGElementException(this, "Invalid attribute type " + attribType);365 }366 367 301 /** 368 302 * @return a set of Strings that corespond to CSS attributes on this element 369 303 */ … … 389 323 children.add(child); 390 324 child.parent = this; 391 325 child.setDiagram(diagram); 392 393 //Add info to track if we've scanned animation element394 if (child instanceof AnimationElement)395 {396 trackManager.addTrackElement((AnimationElement) child);397 }398 326 } 399 327 400 328 protected void setDiagram(SVGDiagram diagram) … … 529 457 return getStyle(attrib, true); 530 458 } 531 459 532 public void setAttribute(String name, int attribType, String value) throws SVGElementException533 {534 StyleAttribute styAttr;535 536 537 switch (attribType)538 {539 case AnimationElement.AT_CSS:540 {541 styAttr = (StyleAttribute) inlineStyles.get(name);542 break;543 }544 case AnimationElement.AT_XML:545 {546 styAttr = (StyleAttribute) presAttribs.get(name);547 break;548 }549 case AnimationElement.AT_AUTO:550 {551 styAttr = (StyleAttribute) inlineStyles.get(name);552 553 if (styAttr == null)554 {555 styAttr = (StyleAttribute) presAttribs.get(name);556 }557 break;558 }559 default:560 throw new SVGElementException(this, "Invalid attribute type " + attribType);561 }562 563 if (styAttr == null)564 {565 throw new SVGElementException(this, "Could not find attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + "). Make sure to create attribute before setting it.");566 }567 568 //Alter layout for relevant attributes569 if ("id".equals(styAttr.getName()))570 {571 if (diagram != null)572 {573 diagram.removeElement(this.id);574 diagram.setElement(value, this);575 }576 this.id = value;577 }578 579 styAttr.setStringValue(value);580 }581 582 public boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException583 {584 return getStyle(attrib, recursive, true);585 }586 587 460 /** 588 461 * Copies the current style into the passed style attribute. Checks for 589 462 * inline styles first, then internal and extranal style sheets, and finally … … 595 468 * style attribute, checks attributes of parents back to root until one 596 469 * found. 597 470 */ 598 public boolean getStyle(StyleAttribute attrib, boolean recursive, boolean evalAnimation) 599 throws SVGException 471 public boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException 600 472 { 601 473 String styName = attrib.getName(); 602 474 … … 605 477 606 478 attrib.setStringValue(styAttr == null ? "" : styAttr.getStringValue()); 607 479 608 //Evalutate coresponding track, if one exists609 if (evalAnimation)610 {611 TrackBase track = trackManager.getTrack(styName, AnimationElement.AT_CSS);612 if (track != null)613 {614 track.getValue(attrib, diagram.getUniverse().getCurTime());615 return true;616 }617 }618 619 480 //Return if we've found a non animated style 620 481 if (styAttr != null) 621 482 { … … 628 489 629 490 attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue()); 630 491 631 //Evalutate coresponding track, if one exists632 if (evalAnimation)633 {634 TrackBase track = trackManager.getTrack(styName, AnimationElement.AT_XML);635 if (track != null)636 {637 track.getValue(attrib, diagram.getUniverse().getCurTime());638 return true;639 }640 }641 642 492 //Return if we've found a presentation attribute instead 643 493 if (presAttr != null) 644 494 { … … 700 550 //Copy presentation value directly 701 551 attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue()); 702 552 703 //Evalutate coresponding track, if one exists704 TrackBase track = trackManager.getTrack(presName, AnimationElement.AT_XML);705 if (track != null)706 {707 track.getValue(attrib, diagram.getUniverse().getCurTime());708 return true;709 }710 711 553 //Return if we found presentation attribute 712 554 if (presAttr != null) 713 555 { -
kitfox/svg/SVGLoaderHelper.java
diff -ur kitfox/svg/SVGLoaderHelper.java src/com/kitfox/svg/SVGLoaderHelper.java
old new 37 37 package com.kitfox.svg; 38 38 39 39 import java.net.*; 40 import java.io.*;41 42 import com.kitfox.svg.animation.parser.*;43 40 44 41 /** 45 42 * @author Mark McKay … … 58 55 public final SVGDiagram diagram; 59 56 60 57 public final URI xmlBase; 61 62 /**63 * Animate nodes use this to parse their time strings64 */65 public final AnimTimeParser animTimeParser = new AnimTimeParser(new StringReader(""));66 58 67 59 /** Creates a new instance of SVGLoaderHelper */ 68 60 public SVGLoaderHelper(URI xmlBase, SVGUniverse universe, SVGDiagram diagram) -
kitfox/svg/SVGLoader.java
diff -ur kitfox/svg/SVGLoader.java src/com/kitfox/svg/SVGLoader.java
old new 42 42 import org.xml.sax.*; 43 43 import org.xml.sax.helpers.DefaultHandler; 44 44 45 import com.kitfox.svg.animation.*;46 45 import java.util.logging.Level; 47 46 import java.util.logging.Logger; 48 47 … … 88 87 89 88 //Compile a list of important builder classes 90 89 nodeClasses.put("a", A.class); 91 nodeClasses.put("animate", Animate.class);92 nodeClasses.put("animatecolor", AnimateColor.class);93 nodeClasses.put("animatemotion", AnimateMotion.class);94 nodeClasses.put("animatetransform", AnimateTransform.class);95 90 nodeClasses.put("circle", Circle.class); 96 91 nodeClasses.put("clippath", ClipPath.class); 97 92 nodeClasses.put("defs", Defs.class); … … 115 110 nodeClasses.put("polyline", Polyline.class); 116 111 nodeClasses.put("radialgradient", RadialGradient.class); 117 112 nodeClasses.put("rect", Rect.class); 118 nodeClasses.put("set", SetSmil.class);119 113 nodeClasses.put("shape", ShapeElement.class); 120 114 nodeClasses.put("stop", Stop.class); 121 115 nodeClasses.put("style", Style.class);
Note:
See TracBrowser
for help on using the repository browser.