Attachment 'twikidraw-full.diff'

Download

   1 diff -urP --ignore-space-change orig/src/CH/ifa/draw/contrib/PolygonFigure.java moin/src/CH/ifa/draw/contrib/PolygonFigure.java
   2 --- orig/src/CH/ifa/draw/contrib/PolygonFigure.java	2004-02-07 21:22:50.000000000 +0100
   3 +++ moin/src/CH/ifa/draw/contrib/PolygonFigure.java	2004-02-07 21:22:58.000000000 +0100
   4 @@ -322,8 +322,8 @@
   5  		coords += ",";
   6  	    coords += fPoly.xpoints[i] + "," + fPoly.ypoints[i];
   7  	}
   8 -	return "<AREA SHAPE=\"POLY\" COORDS=\"" + coords +
   9 -            "\" HREF=\"" + sense + "\">\n";
  10 +	return "<area shape=\"poly\" coords=\"" +
  11 +	    coords + "\" />\n";
  12      }
  13      
  14      public void write(StorableOutput dw) {
  15 diff -urP --ignore-space-change orig/src/CH/ifa/draw/figures/EllipseFigure.java moin/src/CH/ifa/draw/figures/EllipseFigure.java
  16 --- orig/src/CH/ifa/draw/figures/EllipseFigure.java	2004-02-07 21:22:50.000000000 +0100
  17 +++ moin/src/CH/ifa/draw/figures/EllipseFigure.java	2004-02-07 21:22:58.000000000 +0100
  18 @@ -106,9 +106,9 @@
  19  		coords += x + "," + y;
  20  		ang += Math.PI / 3;
  21  	    }
  22 -	    return "<AREA SHAPE=\"POLY\" COORDS=\"" + coords +
  23 -		"\" HREF=\"" +
  24 -		sense + "\">\n";
  25 +	    return "<area shape=\"poly\" coords=\"" + coords +
  26 +		"\" href=\"" +
  27 +		sense + "\" />\n";
  28  	}
  29  	return "";
  30      }
  31 diff -urP --ignore-space-change orig/src/CH/ifa/draw/figures/PolyLineFigure.java moin/src/CH/ifa/draw/figures/PolyLineFigure.java
  32 --- orig/src/CH/ifa/draw/figures/PolyLineFigure.java	2004-02-07 21:22:50.000000000 +0100
  33 +++ moin/src/CH/ifa/draw/figures/PolyLineFigure.java	2004-02-07 21:22:58.000000000 +0100
  34 @@ -339,9 +339,9 @@
  35  	    backwards = (p2.x - x) + "," + (p2.y - y) + "," +
  36  		(p1.x - x) + "," + (p1.y - y) + backwards;
  37          }
  38 -	return "<AREA SHAPE=\"POLY\" COORDS=\"" +
  39 -	    forwards + "," + backwards + "\" HREF=\"" +
  40 -	    sensitive + "\">\n";
  41 +	return "<area shape=\"poly\" coords=\"" +
  42 +	    forwards + "," + backwards + "\" href=\"" +
  43 +	    sensitive + "\" />\n";
  44      }
  45  
  46      public void read(StorableInput dr) throws IOException {
  47 diff -urP --ignore-space-change orig/src/CH/ifa/draw/figures/RectangleFigure.java moin/src/CH/ifa/draw/figures/RectangleFigure.java
  48 --- orig/src/CH/ifa/draw/figures/RectangleFigure.java	2004-02-07 21:22:50.000000000 +0100
  49 +++ moin/src/CH/ifa/draw/figures/RectangleFigure.java	2004-02-07 21:22:58.000000000 +0100
  50 @@ -85,11 +85,11 @@
  51  		sense = URLDecoder.decode(sense);
  52  	    } catch (Exception e) {}
  53  	    Rectangle box = displayBox();
  54 -	    return "<AREA SHAPE=\"RECT\" COORDS=\"" +
  55 +	    return "<area shape=\"rect\" coords=\"" +
  56  		box.x + "," + box.y + "," +
  57  		(box.x + box.width) + "," +
  58  		(box.y + box.height) +
  59 -		"\" HREF=\"" + sense + "\">\n";
  60 +		"\" href=\"" + sense + "\" />\n";
  61  	}
  62  	return "";
  63      }
  64 diff -urP --ignore-space-change orig/src/CH/ifa/draw/figures/RoundRectangleFigure.java moin/src/CH/ifa/draw/figures/RoundRectangleFigure.java
  65 --- orig/src/CH/ifa/draw/figures/RoundRectangleFigure.java	2004-02-07 21:22:50.000000000 +0100
  66 +++ moin/src/CH/ifa/draw/figures/RoundRectangleFigure.java	2004-02-07 21:22:58.000000000 +0100
  67 @@ -119,12 +119,12 @@
  68  		sense = URLDecoder.decode(sense);
  69  	    } catch (Exception e) {}
  70  	    Rectangle box = displayBox();
  71 -	    return "<AREA SHAPE=\"RECT\" COORDS=\"" +
  72 +	    return "<area shape=\"rect\" coords=\"" +
  73  		       box.x + "," + box.y + "," +
  74  		       (box.x + box.width) + "," +
  75  		       (box.y + box.height) +
  76 -		       "\" HREF=\"" +
  77 -		       sense + "\">\n";
  78 +		       "\" href=\"" +
  79 +		       sense + "\" />\n";
  80  	}
  81  	return "";
  82      }
  83 diff -urP --ignore-space-change orig/src/CH/ifa/draw/standard/CompositeFigure.java moin/src/CH/ifa/draw/standard/CompositeFigure.java
  84 --- orig/src/CH/ifa/draw/standard/CompositeFigure.java	2004-02-07 21:22:50.000000000 +0100
  85 +++ moin/src/CH/ifa/draw/standard/CompositeFigure.java	2004-02-07 21:22:58.000000000 +0100
  86 @@ -395,7 +395,7 @@
  87  	String areas = "";
  88          Enumeration k = fFigures.elements();
  89          while (k.hasMoreElements())
  90 -            areas += ((Storable) k.nextElement()).getMap();
  91 +            areas = ((Storable) k.nextElement()).getMap() + areas;
  92  	return areas;
  93      }
  94  
  95 diff -urP --ignore-space-change orig/src/CH/ifa/draw/twiki/TWikiFrame.java moin/src/CH/ifa/draw/twiki/TWikiFrame.java
  96 --- orig/src/CH/ifa/draw/twiki/TWikiFrame.java	2004-02-07 21:22:50.000000000 +0100
  97 +++ moin/src/CH/ifa/draw/twiki/TWikiFrame.java	2004-02-07 21:22:58.000000000 +0100
  98 @@ -26,6 +26,8 @@
  99  import java.net.*;
 100  import java.lang.reflect.*;
 101  
 102 +import com.keypoint.PngEncoderIndexed;
 103 +
 104  public class TWikiFrame extends DrawFrame {
 105  
 106      /**
 107 @@ -34,8 +36,10 @@
 108      static private String UNTITLED_PARAMETER   = "untitled";
 109      static private String DRAWPATH_PARAMETER   = "drawpath";
 110      static private String GIFPATH_PARAMETER    = "gifpath";
 111 +    static private String PNGPATH_PARAMETER    = "pngpath";
 112      static private String SVGPATH_PARAMETER    = "svgpath";
 113      static private String SAVEPATH_PARAMETER   = "savepath";
 114 +    static private String BASENAME_PARAMETER   = "basename";
 115      static private String HELPPATH_PARAMETER   = "helppath";
 116      static private String BORDERSIZE_PARAMETER = "bordersize";
 117  
 118 @@ -333,8 +337,8 @@
 119  
 120      public boolean doSaveDrawing() {
 121  	TWikiDraw app = (TWikiDraw)getApplication();
 122 -	boolean savedDraw, savedSvg, savedGif, savedMap;
 123 -	savedDraw = savedSvg = savedGif = savedMap = false;
 124 +		boolean savedDraw, savedSvg, savedGif, savedPng, savedMap;
 125 +		savedDraw = savedSvg = savedGif = savedPng = savedMap = false;
 126  
 127  	// set wait cursor
 128  	setCursor(new Cursor(Cursor.WAIT_CURSOR));
 129 @@ -359,12 +363,16 @@
 130  	    if (savePath == null)
 131  		savePath = "";
 132  
 133 +			// gets base filename
 134 +			String baseName = app.getParameter(BASENAME_PARAMETER);
 135 +			if (baseName == null)
 136 +				baseName = "SET_BASENAME_PARAM";
 137 +			
 138              // submit POST command to the server three times:
 139  	    // *.draw, *.map and *.gif
 140              // first upload *.draw file
 141 -            showStatus("Saving " + drawingPath);
 142 -	    savedDraw = app.post(
 143 -		savePath, "", "text/plain", drawingPath,
 144 +			showStatus("Saving " + baseName + ".draw");
 145 +			savedDraw = app.post(savePath, baseName + ".draw", "text/plain", drawingPath,
 146  		out.toString(), "TWikiDraw draw file");
 147  
 148  	    // calculate the minimum size of the gif image
 149 @@ -394,32 +402,31 @@
 150  	    String map = drawing().getMap();
 151  	    if (map.length() > 0) {
 152  		String mapPath = drawingPath.substring(0, drawingPath.length() - 5);
 153 -		showStatus("Saving " + mapPath);
 154 +				showStatus("Saving " + baseName + ".map");
 155  		// enclose the map and add editable border. Note that the
 156  		// edit border is add LAST so the earlier AREAs take
 157  		// precedence.
 158 -		map = "<MAP NAME=\"%MAPNAME%\">\n" + map +
 159 -		    "<AREA SHAPE=\"RECT\" COORDS=\"" +
 160 -		    "0,0," + (d.width+iBorder) + "," + (iBorder/2) +
 161 -		    "\" HREF=\"%TWIKIDRAW%\">\n" +
 162 -		    "<AREA SHAPE=\"RECT\" COORDS=\"" +
 163 -		    "0,0," + iBorder/2 + "," + (d.height+iBorder) +
 164 -		    "\" HREF=\"%TWIKIDRAW%\">\n" +
 165 -		    "<AREA SHAPE=\"RECT\" COORDS=\"" +
 166 -		    (d.width+iBorder/2) + ",0," + (d.width+iBorder) + "," + (d.height+iBorder) +
 167 -		    "\" HREF=\"%TWIKIDRAW%\">\n" +
 168 -		    "<AREA SHAPE=\"RECT\" COORDS=\"" +
 169 -		    "0," + (d.height+iBorder/2) + "," +
 170 -		    (d.width+iBorder) + "," + (d.height+iBorder) +
 171 -		    "\" HREF=\"%TWIKIDRAW%\">\n" +
 172 -		    "</MAP>";
 173 -		savedMap = app.post(
 174 -		    savePath, "", "text/plain", mapPath + ".map",
 175 +				map = "<map name=\"%MAPNAME%\">\n" + map +
 176 +					"<area shape=\"rect\" coords=\"" +
 177 +					"0,0," + (d.width + iBorder) + "," + (iBorder/2) +
 178 +					"\" href=\"%TWIKIDRAW%\" />\n" +
 179 +					"<area shape=\"rect\" coords=\"" +
 180 +					"0,0," + (iBorder/2) + "," + (d.height + iBorder) +
 181 +					"\" href=\"%TWIKIDRAW%\" />\n" +
 182 +					"<area shape=\"rect\" coords=\"" +
 183 +					(d.width + iBorder/2) + ",0," + (d.width + iBorder) + "," + (d.height + iBorder) +
 184 +					"\" href=\"%TWIKIDRAW%\" />\n" +
 185 +					"<area shape=\"rect\" coords=\"" +
 186 +					"0," + (d.height + iBorder/2) + "," +
 187 +					(d.width + iBorder) + "," + (d.height + iBorder) +
 188 +					"\" href=\"%TWIKIDRAW%\" />\n" +
 189 +					"</map>";
 190 +				savedMap = app.post(savePath, baseName + ".map", "text/plain", mapPath + ".map",
 191  		    map, "TWikiDraw map file");
 192  	    } else {
 193  		// erase any previous map file
 194  		String mapPath = drawingPath.substring(0, drawingPath.length() - 5);
 195 -		savedMap = app.post( savePath, "", "text/plain", mapPath + ".map", "", "" );
 196 +				savedMap = app.post( savePath, baseName + ".map", "text/plain", mapPath + ".map", "", "");
 197  	    }
 198  	    
 199              // get pathname of the SVG file
 200 @@ -437,12 +444,13 @@
 201  
 202              // gets pathname of the GIF image
 203              String gifPath = getApplication().getParameter(GIFPATH_PARAMETER);
 204 -	    if (gifPath == null || gifPath.length() == 0)
 205 -		gifPath = "untitled.gif";
 206 +			if (gifPath == null || gifPath.length() == 0) gifPath = null;
 207  
 208 -            // then create *.gif image and upload file
 209 -	    showStatus("Saving " + gifPath);
 210 +			// gets pathname of the PNG image
 211 +			String pngPath = getApplication().getParameter(PNGPATH_PARAMETER);
 212 +			if (pngPath == null || pngPath.length() == 0) pngPath = null;
 213  
 214 +			if (gifPath != null || pngPath != null) {
 215  	    // clear the selection so it doesn't appear
 216  	    view().clearSelection();
 217  
 218 @@ -451,11 +459,29 @@
 219  	    Graphics oGrf = oImgBuffer.getGraphics();
 220  	    this.view().enableGuides(false);
 221  	    this.view().drawAll(oGrf);
 222 -	    // test gif image:
 223 -	    //TestFrame tf = new TestFrame( "tt2: " + oImgBuffer.toString() ); 
 224 -	    //tf.setSize(new Dimension(d.width+30, d.height+30));
 225 -	    //tf.setImage(oImgBuffer);
 226 -	    //tf.show();
 227 +				
 228 +				if (pngPath != null) {
 229 +					// then create *.png image and upload file
 230 +					showStatus("Saving " + baseName + ".png");
 231 +					
 232 +					PngEncoderIndexed oEncode = new PngEncoderIndexed(oImgBuffer);
 233 +					byte[] aByte = oEncode.pngEncode();
 234 +					int size = aByte.length;
 235 +					char[] aChar = new char[size];
 236 +					for(int i = 0; i < size; i++) {
 237 +						aChar[i] = (char)aByte[i];
 238 +					}
 239 +					
 240 +					// upload *.png file
 241 +					savedPng = app.post(savePath, baseName + ".png", "image/png",
 242 +										pngPath, String.valueOf( aChar, 0, size),
 243 +										"TWikiDraw PNG file");
 244 +				}
 245 +				
 246 +				if (gifPath != null) {
 247 +					// then create *.gif image and upload file
 248 +					showStatus("Saving " + baseName + ".gif");
 249 +					
 250  	    ByteArrayOutputStream oOut = new ByteArrayOutputStream();
 251  	    GifEncoder oEncode = new GifEncoder(oImgBuffer, oOut);
 252  	    oEncode.encode();
 253 @@ -467,10 +493,11 @@
 254  	    }
 255  	    
 256  	    // upload *.gif file
 257 -	    savedGif = app.post(
 258 -		savePath, "", "image/gif",
 259 +					savedGif = app.post(savePath, baseName + ".gif", "image/gif",
 260  		gifPath, String.valueOf( aChar, 0, size),
 261  		"TWikiDraw GIF file");
 262 +				}
 263 +			}
 264          } catch (MalformedURLException e) {
 265              this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 266              showStatus("Bad Wiki servlet URL: "+e.getMessage());
 267 @@ -482,7 +509,8 @@
 268  	this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 269  	showStatus("Saved .draw " + (savedDraw ? "OK" : "Failed") +
 270  		   " .map " + (savedMap ? "OK" : "Failed") +
 271 -		   " .gif " + (savedGif ? "OK" : "Failed"));
 272 +				   " .gif " + (savedGif ? "OK" : "Failed") +
 273 +				   " .png " + (savedPng ? "OK" : "Failed"));
 274  	return savedDraw;
 275      }
 276  

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-01-19 16:58:45, 10.0 KB) [[attachment:TO.tdraw]]
  • [get | view] (2005-11-28 21:54:52, 173.7 KB) [[attachment:TWikiDrawPlugin-1.103-OliverGraf-source.zip]]
  • [get | view] (2005-11-28 21:58:04, 174.0 KB) [[attachment:TWikiDrawPlugin-1.103-utf8-source.zip]]
  • [get | view] (2005-12-27 01:48:17, 170.3 KB) [[attachment:TWikiDrawPlugin-OliverGraf-SourceTree.zip]]
  • [get | view] (2009-09-19 19:46:07, 10.0 KB) [[attachment:anotherTest.tdraw]]
  • [get | view] (2004-02-07 18:31:10, 0.8 KB) [[attachment:mapname.diff]]
  • [get | view] (2012-10-22 07:10:47, 30.0 KB) [[attachment:meintest.tdraw]]
  • [get | view] (2010-09-20 14:11:48, 10.0 KB) [[attachment:mytest.tdraw]]
  • [get | view] (2010-12-28 18:33:16, 10.0 KB) [[attachment:new.tdraw]]
  • [get | view] (2005-09-12 16:36:38, 181.8 KB) [[attachment:newline_fix_twikidraw-sources.zip]]
  • [get | view] (2005-09-12 16:36:24, 205.5 KB) [[attachment:newline_fix_twikidraw.jar]]
  • [get | view] (2005-11-28 21:55:38, 185.3 KB) [[attachment:twikidraw-1.103-OliverGraf.jar]]
  • [get | view] (2005-11-28 21:56:32, 10.3 KB) [[attachment:twikidraw-1.103-full.diff]]
  • [get | view] (2005-11-28 21:58:29, 19.5 KB) [[attachment:twikidraw-1.103-utf8.diff]]
  • [get | view] (2005-11-28 21:57:38, 185.6 KB) [[attachment:twikidraw-1.103-utf8.jar]]
  • [get | view] (2004-02-07 20:44:17, 11.0 KB) [[attachment:twikidraw-full.diff]]
  • [get | view] (2004-02-07 20:44:26, 10.0 KB) [[attachment:twikidraw-png.zip]]
  • [get | view] (2004-02-07 20:44:47, 174.8 KB) [[attachment:twikidraw-sources.zip]]
  • [get | view] (2004-02-07 20:45:08, 184.3 KB) [[attachment:twikidraw.jar]]
  • [get | view] (2009-02-26 06:31:19, 1.1 KB) [[attachment:twikidrawbuild.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.