From 61467f144400ee9d9f9be138f419ea3f73cdd8f3 Mon Sep 17 00:00:00 2001 From: "stephend%netscape.com" Date: Wed, 4 Apr 2001 03:18:34 +0000 Subject: [PATCH] Part of the fix for bug 52154, 'Make gui for view source coloring pref' r=akkana@netscape.com sr=hewitt@netscape.com --- htmlparser/src/nsViewSourceHTML.cpp | 10 +++++----- modules/libpref/src/init/all.js | 3 +++ parser/htmlparser/src/nsViewSourceHTML.cpp | 10 +++++----- .../prefwindow/resources/locale/en-US/pref-colors.dtd | 3 +++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htmlparser/src/nsViewSourceHTML.cpp b/htmlparser/src/nsViewSourceHTML.cpp index df232dfc8c4..6c742831a2c 100644 --- a/htmlparser/src/nsViewSourceHTML.cpp +++ b/htmlparser/src/nsViewSourceHTML.cpp @@ -19,7 +19,7 @@ * * Contributor(s): * jce2@po.cwru.edu : Added pref to turn on/off - * syntax hilighting in view source + * syntax highlighting in view source * window. * * @@ -875,10 +875,10 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri CSharedVSContext& theContext=CSharedVSContext::GetSharedContext(); #ifdef VIEW_SOURCE_COLORING // This determines the value of the boolean syntax_highlight preference. - PRBool syntaxHilight = PR_FALSE; + PRBool syntaxHighlight = PR_FALSE; NS_WITH_SERVICE(nsIPref, thePrefsService, kPrefCID, &result); if (NS_SUCCEEDED(result) && thePrefsService) - thePrefsService->GetBoolPref("browser.view_source.syntax_highlight", &syntaxHilight); + thePrefsService->GetBoolPref("view_source.syntax_highlight", &syntaxHighlight); #endif // VIEW_SOURCE_COLORING #ifdef VIEW_SOURCE_HTML @@ -898,7 +898,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri #endif // VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_COLORING - if (syntaxHilight) + if (syntaxHighlight) { theContext.mStartNode.Init(&theTagToken,mLineNumber); #ifdef VIEW_SOURCE_HTML @@ -939,7 +939,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri #ifdef VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_COLORING - if (syntaxHilight) + if (syntaxHighlight) { theContext.mStartNode.ReleaseAll(); CEndToken theEndToken(eHTMLTag_span); diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 7197e23cd32..da5eb7de591 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -106,6 +106,9 @@ pref("browser.PICS.service.http___home_netscape_com_default_rating.s", 0); pref("browser.target_new_blocked", false); +// view source +pref("view_source.syntax_highlight", true); + // gfx widgets pref("nglayout.widget.mode", 2); pref("nglayout.widget.gfxscrollbars", true); diff --git a/parser/htmlparser/src/nsViewSourceHTML.cpp b/parser/htmlparser/src/nsViewSourceHTML.cpp index df232dfc8c4..6c742831a2c 100644 --- a/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -19,7 +19,7 @@ * * Contributor(s): * jce2@po.cwru.edu : Added pref to turn on/off - * syntax hilighting in view source + * syntax highlighting in view source * window. * * @@ -875,10 +875,10 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri CSharedVSContext& theContext=CSharedVSContext::GetSharedContext(); #ifdef VIEW_SOURCE_COLORING // This determines the value of the boolean syntax_highlight preference. - PRBool syntaxHilight = PR_FALSE; + PRBool syntaxHighlight = PR_FALSE; NS_WITH_SERVICE(nsIPref, thePrefsService, kPrefCID, &result); if (NS_SUCCEEDED(result) && thePrefsService) - thePrefsService->GetBoolPref("browser.view_source.syntax_highlight", &syntaxHilight); + thePrefsService->GetBoolPref("view_source.syntax_highlight", &syntaxHighlight); #endif // VIEW_SOURCE_COLORING #ifdef VIEW_SOURCE_HTML @@ -898,7 +898,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri #endif // VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_COLORING - if (syntaxHilight) + if (syntaxHighlight) { theContext.mStartNode.Init(&theTagToken,mLineNumber); #ifdef VIEW_SOURCE_HTML @@ -939,7 +939,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri #ifdef VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_COLORING - if (syntaxHilight) + if (syntaxHighlight) { theContext.mStartNode.ReleaseAll(); CEndToken theEndToken(eHTMLTag_span); diff --git a/xpfe/components/prefwindow/resources/locale/en-US/pref-colors.dtd b/xpfe/components/prefwindow/resources/locale/en-US/pref-colors.dtd index 106cf1385ee..402acba75bc 100644 --- a/xpfe/components/prefwindow/resources/locale/en-US/pref-colors.dtd +++ b/xpfe/components/prefwindow/resources/locale/en-US/pref-colors.dtd @@ -26,3 +26,6 @@ + + +