Changeset 86
- Timestamp:
- 08/17/08 09:19:50 (4 months ago)
- Files:
-
- trunk/lily/lily/chrome/content/images/activity-extra-large.png (added)
- trunk/lily/lily/chrome/content/images/activity-large.png (added)
- trunk/lily/lily/chrome/content/images/activity-medium.png (added)
- trunk/lily/lily/chrome/content/images/activity-small.png (added)
- trunk/lily/lily/chrome/content/images/ajax-loader-black.gif (deleted)
- trunk/lily/lily/chrome/content/lily.js (modified) (3 diffs)
- trunk/lily/lily/chrome/content/patch.js (modified) (5 diffs)
- trunk/lily/lily/chrome/content/patch.xul (modified) (1 diff)
- trunk/lily/lily/chrome/content/utils.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lily/lily/chrome/content/lily.js
r76 r86 289 289 //win,str,width,color 290 290 if(!this.initialized) 291 LilyUtils.displayMessageDialog(content,"<img src='chrome://lily/content/images/a jax-loader-black.gif'/>",200);291 LilyUtils.displayMessageDialog(content,"<img src='chrome://lily/content/images/activity-medium.png'/>",200); 292 292 }, 293 293 … … 873 873 */ 874 874 savePatchAsAddOn: function(pID) { 875 875 876 876 var patchID=pID||this.currPatch; 877 878 877 var exportParams = {id:patchID,type:"addon",platform:LilyUtils.navigatorPlatform()}; 879 878 880 879 //show a dialog to get the export details 881 880 Lily.getCurrentPatch().patchView.xulWin.openDialog("chrome://lily/content/exportDialog.xul", "lilyExportDialog", "chrome,titlebar,toolbar,centerscreen,modal",exportParams); 882 881 882 Lily.getCurrentPatch().patchView.showWindowStatusActivity(true); 883 Lily.getCurrentPatch().patchView.setWindowStatusText("Saving as addon...") 884 883 885 if(exportParams.saved) { 884 LilyPatchExporter.savePatchAsAddOn(exportParams); 886 LilyUtils.runInBackGround(function(){ 887 LilyPatchExporter.savePatchAsAddOn(exportParams); 888 },function(){ 889 Lily.getCurrentPatch().patchView.showWindowStatusActivity(false); 890 Lily.getCurrentPatch().patchView.clearWindowStatusText(); 891 }) 885 892 } 886 893 … … 900 907 Lily.getCurrentPatch().patchView.xulWin.openDialog("chrome://lily/content/exportDialog.xul", "lilyExportDialog", "chrome,titlebar,toolbar,centerscreen,modal",exportParams); 901 908 909 Lily.getCurrentPatch().patchView.showWindowStatusActivity(true); 910 Lily.getCurrentPatch().patchView.setWindowStatusText("Saving as app...") 911 902 912 if(exportParams.saved) { 903 LilyPatchExporter.savePatchAsApp(exportParams); 913 LilyUtils.runInBackGround(function(){ 914 LilyPatchExporter.savePatchAsApp(exportParams); 915 },function(){ 916 Lily.getCurrentPatch().patchView.showWindowStatusActivity(false); 917 Lily.getCurrentPatch().patchView.clearWindowStatusText(); 918 }) 904 919 } 920 905 921 }, 906 922 trunk/lily/lily/chrome/content/patch.js
r80 r86 2029 2029 this.chromeWin=null; //browsers chrome window 2030 2030 this.statusBar=null; //status bar 2031 this.statusBarIcon=null; //icon status bar 2031 this.statusBarIcon=null; //icon status bar 2032 this.statusBarActivity=null; //activity status bar 2032 2033 this.document=null; 2033 2034 this.body=null; … … 2166 2167 this.body.style.fontSize=LilyUtils.sizeFontForPlatform(size); 2167 2168 } 2169 2170 this.showWindowStatusActivity=function(state) { 2171 if(state) 2172 this.statusBarActivity.style.visibility="visible"; 2173 else 2174 this.statusBarActivity.style.visibility="hidden"; 2175 } 2168 2176 2169 2177 this.setWindowStatusIcon=function(state) { … … 2235 2243 2236 2244 thisPtr.statusBar={setAttribute:function(){}};// 2237 thisPtr.statusBarIcon={setAttribute:function(){}}; //window.status ;//2245 thisPtr.statusBarIcon={setAttribute:function(){}}; //window.status// 2238 2246 2239 2247 //pass the window refs to the controller … … 2276 2284 thisPtr.head=thisPtr.oWin.document.getElementById("headElement"); 2277 2285 2278 thisPtr.statusBar=thisPtr.xulWin.document.getElementById("lilyStatusPanel")||{setAttribute:function(){}};; 2279 thisPtr.statusBarIcon=thisPtr.xulWin.document.getElementById("lilyIconPanel")||{setAttribute:function(){}};; 2286 thisPtr.statusBar=thisPtr.xulWin.document.getElementById("lilyStatusPanel")||{setAttribute:function(){}}; 2287 thisPtr.statusBarIcon=thisPtr.xulWin.document.getElementById("lilyIconPanel")||{setAttribute:function(){}}; 2288 thisPtr.statusBarActivity=thisPtr.xulWin.document.getElementById("lilyStatusActivity")||{setAttribute:function(){}}; 2280 2289 2281 2290 //pass the window refs to the controller … … 2357 2366 thisPtr.statusBar=thisPtr.xulWin.document.getElementById("lilyStatusPanel"); 2358 2367 thisPtr.statusBarIcon=thisPtr.xulWin.document.getElementById("lilyIconPanel"); 2368 thisPtr.statusBarActivity=thisPtr.xulWin.document.getElementById("lilyStatusActivity"); 2359 2369 2360 2370 //pass the window refs to the controller trunk/lily/lily/chrome/content/patch.xul
r57 r86 189 189 <statusbarpanel tooltiptext="Patch is unlocked for editing. Click to lock." onclick="opener.Lily.toggleEdit()" class="statusbarpanel-iconic" src="chrome://lily/content/images/lock_open.png" id="lilyIconPanel" width="20"/> 190 190 <statusbarpanel style="height:24px;font-size:18px;font-family:verdana,DejaVu Sans,sans-serif;" id="lilyStatusPanel" flex="1"/> 191 <image style="visibility:hidden" id="lilyStatusActivity" src="chrome://lily/content/images/activity-medium.png"/> 191 192 </statusbar> 192 193 </vbox> trunk/lily/lily/chrome/content/utils.js
r79 r86 2076 2076 }, 2077 2077 2078 /* 2079 Method: runInBackGround 2080 run a method in the background. 2081 2082 Arguments: 2083 f - function to run in the background 2084 cb - function to call with the result 2085 */ 2086 runInBackGround: function(f,cb) { 2087 2088 var workingThread = function(threadID,func) { 2089 this.threadID = threadID; 2090 this.func = func; 2091 this.result; 2092 }; 2093 2094 workingThread.prototype = { 2095 run: function() { 2096 try { 2097 // This is where the working thread does its processing work. 2098 this.result = this.func(); 2099 // When it's done, call back to the main thread to let it know 2100 // we're finished. 2101 main.dispatch(new mainThread(this.threadID, this.result), 2102 background.DISPATCH_NORMAL); 2103 } catch(err) { 2104 Components.utils.reportError(err); 2105 } 2106 }, 2107 2108 QueryInterface: function(iid) { 2109 if (iid.equals(Components.interfaces.nsIRunnable) || 2110 iid.equals(Components.interfaces.nsISupports)) { 2111 return this; 2112 } 2113 throw Components.results.NS_ERROR_NO_INTERFACE; 2114 } 2115 }; 2116 2117 2118 var mainThread = function(threadID,result) { 2119 this.threadID = threadID; 2120 this.result = result; 2121 }; 2122 2123 mainThread.prototype = { 2124 run: function() { 2125 try { 2126 // This is where we react to the completion of the working thread. 2127 cb(this.threadID,this.result); 2128 } catch(err) { 2129 Components.utils.reportError(err); 2130 } 2131 }, 2132 2133 QueryInterface: function(iid) { 2134 if (iid.equals(Components.interfaces.nsIRunnable) || 2135 iid.equals(Components.interfaces.nsISupports)) { 2136 return this; 2137 } 2138 throw Components.results.NS_ERROR_NO_INTERFACE; 2139 } 2140 }; 2141 2142 var background = Components.classes["@mozilla.org/thread-manager;1"].getService().newThread(0); 2143 var main = Components.classes["@mozilla.org/thread-manager;1"].getService().mainThread; 2144 background.dispatch(new workingThread(1,f), background.DISPATCH_NORMAL); 2145 2146 }, 2147 2078 2148 //drag code from https://addons.mozilla.org/en-US/seamonkey/addon/2190/ by Emanuele Ruffaldi- http://www.teslacore.it 2079 2149 dragDropHandler: function(cb) {
