bug 30022; added SetTextZoom and some UI stuff for that

git-svn-id: svn://10.0.0.236/trunk@64959 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
erik%netscape.com
2000-04-02 21:58:08 +00:00
parent eeb070b4d8
commit bbcfe20c54
5 changed files with 60 additions and 4 deletions

View File

@@ -53,6 +53,7 @@ interface nsIBrowserInstance : nsISupports {
void init();
void setContentWindow( in nsIDOMWindow aWindow );
void setWebShellWindow( in nsIDOMWindow aWindow );
void setTextZoom( in float aTextZoom );
void SetDocumentCharset(in wstring charset);
// File.

View File

@@ -46,6 +46,7 @@ catch (ex) {
var overLink = null;
var explicitURL = false;
var statusTextFld = null;
var textZoom = 1.0;
function UpdateHistory(event)
@@ -801,6 +802,17 @@ function BrowserEditBookmarks()
}
}
function BrowserChangeTextZoom(aChange)
{
if (appCore != null) {
textZoom += (aChange * 0.1);
if (textZoom < 0.1) {
textZoom = 0.1;
}
appCore.setTextZoom(textZoom);
}
}
function BrowserSetDefaultCharacterSet(aCharset)
{
if (appCore != null) {

View File

@@ -51,6 +51,14 @@ Contributor(s): ______________________________________. -->
<key id="key_selectAll"/>
<key id="key_preferences"/>
<!-- View Menu -->
<key id="key_enlargeTextSize" xulkey="true"
key="&enlargeTextSizeCmd.commandkey;"
observes="Browser:EnlargeTextSize"/>
<key id="key_reduceTextSize" xulkey="true"
key="&reduceTextSizeCmd.commandkey;"
observes="Browser:ReduceTextSize"/>
<key id="goForwardKb" xulkey="true" key="&goForwardCmd.commandkey;" observes="Browser:GoForward" />
<key id="goBackwardKb" xulkey="true" key="&goBackCmd.commandkey;" observes="Browser:GoBackwards" />
<key id="goHomeKb" xulkey="true" key="&goHomeCmd.commandkey;" observes="Browser:GoHome" />
@@ -83,6 +91,12 @@ Contributor(s): ______________________________________. -->
<broadcaster id="cmd_selectAll"/>
<broadcaster id="cmd_preferences"/>
<!-- View Menu -->
<broadcaster id="Browser:EnlargeTextSize"
oncommand="BrowserChangeTextZoom(1);"/>
<broadcaster id="Browser:ReduceTextSize"
oncommand="BrowserChangeTextZoom(-1);"/>
<broadcaster id="cmd_viewnavbar" oncommand="goToggleToolbar( 'nav-bar','cmd_viewnavbar');" checked="true"/>
<broadcaster id="cmd_viewpersonaltoolbar" oncommand="goToggleToolbar('PersonalToolbar','cmd_viewpersonaltoolbar');" checked="true"/>
<broadcaster id="cmd_viewtaskbar" oncommand="goToggleToolbar('taskbar','cmd_viewtaskbar');" checked="true"/>
@@ -181,10 +195,12 @@ Contributor(s): ______________________________________. -->
</menu>
<menuseparator />
<menuitem value="&enlargeTextSizeCmd.label;" disabled="true"
oncommand="BrowserReload();"/>
<menuitem value="&reduceTextSizeCmd.label;" disabled="true"
oncommand="BrowserReload();"/>
<menuitem value="&enlargeTextSizeCmd.label;"
key="key_enlargeTextSize"
observes="Browser:EnlargeTextSize"/>
<menuitem value="&reduceTextSizeCmd.label;"
key="key_reduceTextSize"
observes="Browser:ReduceTextSize"/>
<menuseparator />
<menu value="&useStyleSheetMenu.label;" disabled="true" oncommand="BrowserReload();">
<menupopup>

View File

@@ -47,7 +47,9 @@
<!ENTITY personalbarCmd.label "Personal Toolbar">
<!ENTITY taskbarCmd.label "Taskbar">
<!ENTITY enlargeTextSizeCmd.label "Enlarge Text Size">
<!ENTITY enlargeTextSizeCmd.commandkey "+">
<!ENTITY reduceTextSizeCmd.label "Reduce Text Size">
<!ENTITY reduceTextSizeCmd.commandkey "-">
<!ENTITY useStyleSheetMenu.label "Use Stylesheet">
<!ENTITY useStyleSheetDefaultCmd.label "Default">
<!ENTITY useStyleSheetEasyReadingCmd.label "Easy Reading">

View File

@@ -242,6 +242,31 @@ nsBrowserAppCore::Init()
return rv;
}
NS_IMETHODIMP
nsBrowserAppCore::SetTextZoom(float aTextZoom)
{
nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(mContentWindow) );
if (!globalObj) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocShell> docShell;
globalObj->GetDocShell(getter_AddRefs(docShell));
if (docShell)
{
nsCOMPtr<nsIContentViewer> childCV;
NS_ENSURE_SUCCESS(docShell->GetContentViewer(getter_AddRefs(childCV)), NS_ERROR_FAILURE);
if (childCV)
{
nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
if (markupCV) {
NS_ENSURE_SUCCESS(markupCV->SetTextZoom(aTextZoom), NS_ERROR_FAILURE);
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsBrowserAppCore::SetDocumentCharset(const PRUnichar *aCharset)
{