Not part of default build -- WINCE ONLY

Better tabbrowser support from Macrio.
Adding Browser Status Filter via some nasty makefile magic.
Adding rules to make packaging happen via make installer.
Adding a jsconsole dump feature.  this should really be a js comp
This commit is contained in:
dougt%meer.net 2005-07-29 01:16:17 +00:00
Родитель 04ea7af548
Коммит 477d274b54
11 изменённых файлов: 188 добавлений и 162 удалений

Просмотреть файл

@ -84,9 +84,9 @@ nsBrowserStatusHandler.prototype =
if(aStateFlags & nsIWebProgressListener.STATE_TRANSFERRING) {
this.transferCount+=5;
// Has to be fixed and stay within the urlBarIdentity functions.
if(gSelectedTab==this.refTab) {
document.styleSheets[1].cssRules[0].style.backgroundPosition=this.transferCount+"px 100%";
}
//if(gSelectedTab==this.refTab) {
document.styleSheets[1].cssRules[0].style.backgroundPosition=this.transferCount+"px 100%";
// }
}
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)
@ -96,9 +96,9 @@ nsBrowserStatusHandler.prototype =
{
this.transferCount=0;
// Has to be fixed and stay within the urlBarIdentity functions.
if(gSelectedTab==this.refTab) {
document.styleSheets[1].cssRules[0].style.backgroundImage="url(chrome://minimo/skin/transfer.gif)";
}
// if(gSelectedTab==this.refTab) {
document.styleSheets[1].cssRules[0].style.backgroundImage="url(chrome://minimo/skin/transfer.gif)";
// }
this.stopreloadButton.image = "chrome://minimo/skin/stop.gif";
this.stopreloadButton.onClick = "BrowserStop()";
this.statusbar.hidden = false;
@ -108,9 +108,9 @@ nsBrowserStatusHandler.prototype =
if (aStateFlags & nsIWebProgressListener.STATE_STOP)
{
// Has to be fixed and stay within the urlBarIdentity functions.
if(gSelectedTab==this.refTab) {
document.styleSheets[1].cssRules[0].style.backgroundPosition="1000px 100%";
}
// if(gSelectedTab==this.refTab) {
document.styleSheets[1].cssRules[0].style.backgroundPosition="0px 100%";
// }
this.stopreloadButton.image = "chrome://minimo/skin/reload.gif";
this.stopreloadButton.onClick = "BrowserReload()";
@ -119,9 +119,6 @@ nsBrowserStatusHandler.prototype =
this.statusbarText.label = "";
return;
}
return;
}
@ -136,13 +133,15 @@ nsBrowserStatusHandler.prototype =
{
return;
}
return;
}
},
onProgressChange : function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
{
this.transferCount++;
document.styleSheets[1].cssRules[0].style.backgroundPosition=this.transferCount+"px 100%";
//alert("aWebProgress="+aWebProgress+"aRequest.name: "+aRequest.name+"aCurSelfProgress:"+aCurSelfProgress);
},
@ -151,8 +150,7 @@ nsBrowserStatusHandler.prototype =
{
// Update the URL BAR only if the gSelectedTab matches this tab.
if(gSelectedTab==this.refTab) {
// if(gSelectedTab==this.refTab) {
domWindow = aWebProgress.DOMWindow;
// Update urlbar only if there was a load on the root docshell
if (domWindow == domWindow.top) {
@ -163,7 +161,7 @@ nsBrowserStatusHandler.prototype =
//this.lastLocation=aLocation.spec; // the onclick tab handler should get this URL to refresh the urlbar.
this.refTab.setAttribute("lastLocation",aLocation.spec);
}
//}
},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
@ -180,14 +178,16 @@ nsBrowserStatusHandler.prototype =
* Initial Minimo Startup
*
**/
/* moved this as global */
function MiniNavStartup()
{
gURLBar = document.getElementById("urlbar");
var currentTab=getBrowser().selectedTab;
browserInit(currentTab);
currentTab.setAttribute("selectedTabIndex",gtabCounter++);
currentTab.setAttribute("recentURL","http://www.google.com");
gSelectedTab=currentTab;
loadURI("http://www.google.com");
@ -199,36 +199,33 @@ function MiniNavStartup()
**/
function browserInit(refTab)
{
try {
var BrowserStatusHandler = new nsBrowserStatusHandler();
BrowserStatusHandler.init();
BrowserStatusHandler.refTab=refTab;
BrowserStatusHandler.refTab=refTab; // WARNING (was refTab);
gBrowserStatusHandlerArray.push(BrowserStatusHandler);
try {
var refBrowser=getBrowser().getBrowserForTab(refTab);
var webProgress = refBrowser.webProgress;
webProgress.addProgressListener(BrowserStatusHandler, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
getBrowser().addProgressListener(BrowserStatusHandler, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
gBrowserStatusHandlerArray.push(BrowserStatusHandler);
var refBrowser=getBrowser().getBrowserForTab(refTab);
var webNavigation=refBrowser.webNavigation;
webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory);
} catch (e) {
alert("Error trying to startup browser. Please report this as a bug:\n" + e);
}
var webNavigation=refBrowser.webNavigation;
webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory);
} catch (e) {
alert("Error trying to startup browser. Please report this as a bug:\n" + e);
}
try {
refBrowser.markupDocumentViewer.textZoom = .75;
} catch (e) {}
gURLBar = document.getElementById("urlbar");
try {
refBrowser.markupDocumentViewer.textZoom = .75;
} catch (e) {}
gURLBar = document.getElementById("urlbar");
}
function MiniNavShutdown()
{
if (gBrowserStatusHandler)
gBrowserStatusHandler.destroy();
if (gBrowserStatusHandler) gBrowserStatusHandler.destroy();
}
function getBrowser()
@ -243,7 +240,6 @@ function getWebNavigation()
function loadURI(uri)
{
getBrowser().selectedTab.setAttribute("selectedTabURL",uri);
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
}
@ -277,10 +273,25 @@ function BrowserReload()
}
function BrowserAddTab() {
var thisTab=getBrowser().addTab("about:blank");
var thisTab=getBrowser().addTab("http://taboca.com");
browserInit(thisTab);
}
function BrowserOpenTab()
{
try {
getBrowser().selectedTab = getBrowser().addTab('about:blank');
browserInit(getBrowser().selectedTab);
} catch (e) {
alert(e);
}
// if (gURLBar) setTimeout(function() { gURLBar.focus(); }, 0);
}
/**
* Work-in-progress, this handler is 100% generic and gets all the clicks for the entire tabbed
* content area. Need to fix with the approach where we handler only clicks for the actual tab.
@ -290,11 +301,11 @@ function tabbrowserAreaClick(e) {
// When the click happens,
// updates the location bar with the lastLocation for the given selectedTab.
// Note that currently the lastLocation is stored in the DOM for the selectedTab.
// Note that currently the lastLocation is stored in the DOM for the selectedTab.
gSelectedTab=getBrowser().selectedTab;
gURLBar.value=gSelectedTab.getAttribute("lastLocation");
document.styleSheets[1].cssRules[0].style.backgroundPosition="1000px 100%";
document.styleSheets[1].cssRules[0].style.backgroundPosition="1000px 100%";
}

Просмотреть файл

@ -63,18 +63,19 @@
<toolbox>
<toolbar id="nav-bar" >
<!--
<menubar id="sample-menubar" class="chromeclass-menubar">
<menu id="file-menu" label="?" style="margin:0px;">
<menupopup id="file-popup">
<menuitem label="new Tab" oncommand="addTab()" />
</menupopup>
</menu>
</menubar>
-->
<!-- try also the following style with the toolbarbutton... type="menu-button" -->
<menubar class="chromeclass-menubar">
<menu id="menu-button" >
<menupopup id="menu_FilePopup">
<menuitem id="menu_close"/>
<menuitem id="menu_closeWindow" command="cmd_closeWindow"
key="key_closeWindow" label="about"/>
<menuitem label="new Tab" oncommand="BrowserOpenTab()" />
</menupopup>
</menu>
</menubar>
<toolbarbutton id="tabnew" label="+" oncommand="BrowserAddTab()" />
<toolbarbutton id="back-button" image="chrome://minimo/skin/back.gif" onclick="BrowserBack()"/>
<toolbarbutton id="forward-button" image="chrome://minimo/skin/forward.gif" onclick="BrowserForward()"/>
<toolbarbutton id="reload-stop-button" image="chrome://minimo/skin/reload.gif" onclick="BrowserReload()"/>
@ -85,7 +86,7 @@
<hbox flex="1" >
<hbox id="appcontent" flex="100%">
<hbox id="browser" context="context" flex="1">
<tabbrowser context="context" type="content-primary" id="content" src="about:blank" flex="1" onclick="tabbrowserAreaClick(event)" onnewtab="BrowserAddTab()"/>
<tabbrowser context="context" type="content-primary" id="content" src="about:blank" flex="1" onclick="tabbrowserAreaClick(event)" onnewtab="BrowserOpenTab()"/>
</hbox>
</hbox>
</hbox>

Просмотреть файл

@ -1,13 +0,0 @@
minimo.jar:
content/minimo/contents.rdf (content/contents.rdf)
content/minimo/minimo.js (content/minimo.js)
content/minimo/minimo.xul (content/minimo.xul)
locale/en-US/minimo/contents.rdf (locale/en-US/contents.rdf)
locale/en-US/minimo/minimo.dtd (locale/en-US/minimo.dtd)
skin/classic/minimo/contents.rdf (skin/contents.rdf)
skin/classic/minimo/minimo.css (skin/minimo.css)
skin/classic/minimo/back.gif (skin/back.gif)
skin/classic/minimo/forward.gif (skin/forward.gif)
skin/classic/minimo/reload.gif (skin/reload.gif)
skin/classic/minimo/stop.gif (skin/stop.gif)
skin/classic/minimo/transfer.gif (skin/transfer.gif)

Просмотреть файл

@ -54,31 +54,36 @@ toolbar *, #appcontent * {
margin: 0px ! important;
}
* {
font-size: small ! important;
font-family: sans-serif ! important;
}
#menu-button {
background: url("chrome://minimo/skin/m.jpg") no-repeat 50% 50%;
width:20px;
height:12px;
}
#back-button
{
list-style-image : url("chrome://minimo/content/back.gif");
list-style-image : url("chrome://minimo/skin/back.gif");
margin-left:2px;
}
#forward-button
{
list-style-image : url("chrome://minimo/content/forward.gif");
list-style-image : url("chrome://minimo/skin/forward.gif");
}
#stop-button
{
list-style-image : url("chrome://minimo/content/stop.gif");
list-style-image : url("chrome://minimo/skin/stop.gif");
}
#reload-button
{
list-style-image : url("chrome://minimo/content/reload.gif");
list-style-image : url("chrome://minimo/skin/reload.gif");
}
toolbarbutton {

Просмотреть файл

@ -1,84 +1,11 @@
* {
/* on a small screen, we need to use a readable font */
font-size: small ! important;
}
/* for all elements but the root element and the body, let's */
/* cancel all annoying document's settings */
* {
/* first cancel all size settings */
width: auto ! important;
height: auto ! important;
/* and make the width adjust to screen layout for the device */
max-width: 100% ! important;
/* max-heights should not apply to small screens */
max-height: none ! important;
/* remove all positioning */
position: static ! important;
/* remove all positioning offsets */
top: auto ! important;
left: auto ! important;
/* and cancel floats */
float: none ! important;
/* margins and paddings have to be changed */
padding: 0px ! important;
margin: 0px ! important;
/* avoid overflow on pre and table cells */
white-space: normal ! important;
}
table,tbody,thead,tfoot,tr,td,th,col,colgroup {
/* we need to "flatten" all tables */
display: block ! important;
}
img[width="1"], img[height="1"],img[width="468"], img[height="600"] {
/* let's get rid of 1 pixel wide/high images */
/* and of std formats of ads ; current ads formats are */
/* too big for small screens */
display: none ! important;
}
li {
/* better placement of the bullet on a small screen */
list-style-position: inside ! important;
}
:-moz-any-link {
/* we need to make anchors more visible */
text-decoration: underline !important;
}
ul,ol {
display: block ! important;
}
li {
display: list-item ! important;
}
a {
background-image: none ! important;
}
img[src*="spacer"] {
display: none ! important;
}
/* google maps hack */
@-moz-document domain(maps.google.com)
{
div#rhs { display: none ! important;}
div#map { height: 80%;
width: 100%;
overflow: hidden;
position: inherit;
div#map { height: 320px ! important;
width: 240px ! important;
overflow: hidden ! important;
position: inherit ! important;
}
}

Просмотреть файл

@ -68,8 +68,13 @@ CPPSRCS = \
winEmbed.cpp \
WindowCreator.cpp \
SplashScreen.cpp \
nsConsoleWriter.cpp \
$(NULL)
# this should move into the toolkit!
CPPSRCS += nsBrowserStatusFilter.cpp
RCINCLUDE = SplashScreen.rc
EXTRA_DSO_LIBS = embed_base_s profdirserviceprovider_s
@ -82,7 +87,7 @@ LIBS = \
$(MOZ_JS_LIBS) \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
LOCAL_INCLUDES = -I$(srcdir) -I$(topsrcdir)/xpfe/browser/src/
include $(topsrcdir)/config/config.mk
@ -113,4 +118,10 @@ include $(topsrcdir)/config/static-rules.mk
endif # BUILD_STATIC_LIBS
export::
$(NSINSTALL) $(topsrcdir)/xpfe/browser/src/nsBrowserStatusFilter.cpp .
GARBAGE += nsBrowserStatusFilter.cpp
installer::
bash $(srcdir)/package.sh $(MOZ_BUILD_ROOT) $(srcdir)

Просмотреть файл

@ -100,4 +100,9 @@ void CreateSplashScreen();
void KillSplashScreen();
void GetScreenSize(unsigned long* x, unsigned long* y);
void WriteConsoleLog();
#include "nsBrowserStatusFilter.h"
#endif // MINIMO_PRIVATE_H

Просмотреть файл

Просмотреть файл

@ -1,17 +1,24 @@
#!/bin/bash
if [ -z "$MOZ_OBJDIR" ]
if [ $# -ne 2 ]
then
echo MOZ_OBJDIR is not set!!
exit 1
else
echo MOZ_OBJDIR is $MOZ_OBJDIR
echo "Usage: `basename $0` OBJDIR SRCDIR"
exit $E_BADARGS
fi
pushd $MOZ_OBJDIR/dist
rm -rf wince
OBJDIR=$1
SRCDIR=$2
echo Copying over files from MOZ_OBJDIR
echo ---------------------------------------------------
echo OBJDIR = $OBJDIR
echo SRCDIR = $SRCDIR
echo ---------------------------------------------------
pushd $OBJDIR/dist
rm -rf wince
rm -f wince.zip
echo Copying over files from OBJDIR
mkdir wince
cp -a bin/js3250.dll wince
@ -101,19 +108,22 @@ echo Copying over customized files
popd
cp -a all.js $MOZ_OBJDIR/dist/wince/greprefs
pushd $SRCDIR
cp -a all.js $OBJDIR/dist/wince/greprefs
echo Applying SSR
cat ../smallScreen.css >> $MOZ_OBJDIR/dist/wince/res/ua.css
cat ../smallScreen.css >> $OBJDIR/dist/wince/res/ua.css
echo Copying ARM shunt lib. Adjust if you are not building ARM
cp -a ../../../build/wince/shunt/build/ARMV4Rel/shunt.dll $MOZ_OBJDIR/dist/wince
cp -a ../../../build/wince/shunt/build/ARMV4Rel/shunt.dll $OBJDIR/dist/wince
echo Zipping
rm -f $MOZ_OBJDIR/dist/wince.zip
zip -r $MOZ_OBJDIR/dist/wince.zip $MOZ_OBJDIR/dist/wince
zip -r $OBJDIR/dist/wince.zip $OBJDIR/dist/wince
popd
echo Done.

Просмотреть файл

Просмотреть файл

@ -45,9 +45,53 @@ const static char* start_url = "chrome://minimo/content/minimo.xul";
//const static char* start_url = "http://www.meer.net/~dougt/test.html";
//const static char* start_url = "resource://gre/res/start.html";
PRBool gDumpJSConsole = PR_FALSE;
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
class nsBrowserStatusFilterFactory : public nsIFactory
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
nsBrowserStatusFilterFactory();
~nsBrowserStatusFilterFactory() { }
};
nsBrowserStatusFilterFactory::nsBrowserStatusFilterFactory()
{
}
NS_IMPL_ISUPPORTS1(nsBrowserStatusFilterFactory, nsIFactory)
NS_IMETHODIMP
nsBrowserStatusFilterFactory::CreateInstance(nsISupports* aOuter,
const nsIID& aIID,
void* *aResult)
{
NS_ENSURE_NO_AGGREGATION(aOuter);
nsBrowserStatusFilter* filter = new nsBrowserStatusFilter();
if (!filter)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = filter->QueryInterface(aIID, aResult);
if (NS_FAILED(rv))
delete filter;
return rv;
}
NS_IMETHODIMP
nsBrowserStatusFilterFactory::LockFactory(PRBool)
{
return NS_OK;
}
class ApplicationObserver: public nsIObserver
{
public:
@ -164,8 +208,29 @@ void DoPreferences()
return;
prefBranch->SetBoolPref("snav.keyCode.modifier", 0);
prefBranch->GetBoolPref("config.wince.dumpJSConsole", &gDumpJSConsole);
}
void OverrideComponents()
{
static NS_DEFINE_CID(kBrowserStatusFilter, NS_BROWSERSTATUSFILTER_CID);
nsCOMPtr<nsIComponentRegistrar> registrar;
NS_GetComponentRegistrar(getter_AddRefs(registrar));
nsBrowserStatusFilterFactory* factory = new nsBrowserStatusFilterFactory();
if (!factory)
return;
if (registrar)
registrar->RegisterFactory(kBrowserStatusFilter,
NS_BROWSERSTATUSFILTER_CLASSNAME,
NS_BROWSERSTATUSFILTER_CONTRACTID,
factory);
}
typedef struct FindAppStruct
{
@ -229,6 +294,7 @@ int main(int argc, char *argv[])
return 1;
DoPreferences();
OverrideComponents();
NS_TIMELINE_ENTER("appStartup");
nsCOMPtr<nsIAppShell> appShell = do_CreateInstance(kAppShellCID);
@ -258,6 +324,9 @@ int main(int argc, char *argv[])
delete appObserver;
delete creatorCallback;
if (gDumpJSConsole)
WriteConsoleLog();
// Close down Embedding APIs
NS_TermEmbedding();