Author: hqm
Date: 2008-03-05 03:46:53 -0800 (Wed, 05 Mar 2008)
New Revision: 8170

Modified:
   
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
   
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
Log:
Change 20080304-hqm-Z by [EMAIL PROTECTED] on 2008-03-04 21:31:57 EST
    in /Users/hqm/openlaszlo/devildog
    for http://svn.openlaszlo.org/openlaszlo/branches/devildog

Summary: generate multiframe resource table for swf9

New Features:

Bugs Fixed:

Technical Reviewer: max
QA Reviewer: philr
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
    
For swf9, generate a list of resources for a multi-frame asset, similar to
DHTML, but with the assets actually compiled in.


Tests:

compile test/swf9/multiframe.lzx, look at intermediate swf9 .as 
LzApplication.as file




Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
===================================================================
--- 
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
     2008-03-05 04:00:15 UTC (rev 8169)
+++ 
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
     2008-03-05 11:46:53 UTC (rev 8170)
@@ -608,6 +608,11 @@
     // [TODO hqm 01/06] this should be keyed off of the 'lzr' runtime
     // arg, it should return true for lzr=dhtml
     public boolean isDHTML() {
+
+        if (this.getRuntime().equals("swf9")) {
+            return false;
+        }
+        
         return Compiler.SCRIPT_RUNTIMES.contains(this.getRuntime());
     }
 

Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
===================================================================
--- 
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
 2008-03-05 04:00:15 UTC (rev 8169)
+++ 
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
 2008-03-05 11:46:53 UTC (rev 8170)
@@ -284,7 +284,6 @@
         int width = 0;
         int height = 0;
         int fNum = 0;
-        String sep = "";
         File dirfile = mEnv.getApplicationFile().getParentFile();
         String appdir = dirfile != null ? dirfile.getPath() : ".";
         mLogger.debug("appdir is: " + appdir + ", LPS.HOME() is: "+ 
LPS.HOME());
@@ -296,36 +295,29 @@
         if (sources.isEmpty()) {
             return;
         }
+        ArrayList frameClassList = new ArrayList();
+
         String pType;
         String relPath;
         String arPath;
         String srPath;
+        sbuf.append("#passthrough {\n");
+
         for (Iterator e = sources.iterator() ; e.hasNext() ;) {
             File fFile = new File((String)e.next());
-            arPath = FileUtils.relativePath(fFile, appdir);
-            srPath = FileUtils.relativePath(fFile, sHome);
-            // TODO: Some of this should be rolled out of the loop.
-            if (arPath.length() <= srPath.length()) {
-                pType="ar";
-                relPath = arPath;
-            } else {
-                pType ="sr";
-                relPath = srPath;
+            String rpath;
+            try {
+                rpath = fFile.getCanonicalPath();
+                // Fix Winblows pathname backslash lossage
+                rpath = rpath.replaceAll("\\\\", "/");
+            } catch (IOException err) {
+                throw new ImportResourceError(fFile.toString(), err, mEnv);
             }
-            // make it relative
-            if (relPath.charAt(0) == '/') {
-                 relPath = relPath.substring(1);
-           }
 
-            if (first == true) {
-                sbuf.append("LzResourceLibrary." + sResourceName + "={ptype: 
\"" + pType + "\", frames:[");
-                first = false;
-            }
-
-            mLogger.debug("relFile is: "+relPath);
-
-            sbuf.append(sep+"'"+relPath+"'");
-            sep = ",";
+            sbuf.append("[Embed(source=\""+rpath+"\")]\n");
+            String assetClassname = "__embed_lzasset_" + 
sResourceName+"_"+fNum;
+            sbuf.append("var "+assetClassname+":Class;\n");
+            frameClassList.add(assetClassname);
             // Definition to add to the library (without stop)
             Resource res = getMultiFrameResource(fFile.toString(), 
sResourceName, fNum);
             int rw = res.getWidth();
@@ -338,8 +330,22 @@
             }
             fNum++;
         }
+        sbuf.append("}#\n");
+
+        sbuf.append("LzResourceLibrary." + sResourceName + "={frames: ");
+        
+        // enumerate the asset classes for each frame
+        sbuf.append("[");
+        String sep = "";
+        for (Iterator e = frameClassList.iterator() ; e.hasNext() ;) {
+            String assetclass = (String)e.next();
+            sbuf.append(sep+assetclass);
+            sep = ",";
+        }
+        sbuf.append("]");
+
         mMultiFrameResourceSet.add(new Resource(sResourceName, width, height));
-        sbuf.append("],width:" + width);
+        sbuf.append(",width:" + width);
         sbuf.append(",height:" + height);
         sbuf.append("};");
         addScript(sbuf.toString());


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to