added menu items to turn on/off GFX scrollbars

added menu items to save and "Goto" to two urls, this helps a lot with testing.
b=27712
This commit is contained in:
rods%netscape.com 2000-03-14 14:19:56 +00:00
Родитель 9cdfa6fef7
Коммит 4ff3f6d742
4 изменённых файлов: 109 добавлений и 0 удалений

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

@ -876,6 +876,45 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
DoImageInspector();
break;
case VIEWER_GFX_SCROLLBARS_ON: {
SetBoolPref("nglayout.widget.gfxscrollbars", PR_TRUE);
nsAutoString text;
PRUint32 size;
mLocation->GetText(text, 1000, size);
GoTo(text.GetUnicode());
}
break;
case VIEWER_GFX_SCROLLBARS_OFF: {
SetBoolPref("nglayout.widget.gfxscrollbars", PR_FALSE);
nsAutoString text;
PRUint32 size;
mLocation->GetText(text, 1000, size);
GoTo(text.GetUnicode());
}
break;
case VIEWER_GOTO_TEST_URL1:
case VIEWER_GOTO_TEST_URL2: {
nsAutoString urlStr;
char * pref = aID == VIEWER_GOTO_TEST_URL1?"nglayout.widget.testurl1":"nglayout.widget.testurl2";
GetStringPref(pref, urlStr);
PRUint32 size;
mLocation->SetText(urlStr, size);
GoTo(urlStr.GetUnicode());
}
break;
case VIEWER_SAVE_TEST_URL1:
case VIEWER_SAVE_TEST_URL2: {
nsAutoString text;
PRUint32 size;
mLocation->GetText(text, 1000, size);
char * pref = aID == VIEWER_SAVE_TEST_URL1?"nglayout.widget.testurl1":"nglayout.widget.testurl2";
SetStringPref(pref, text);
}
break;
#ifdef PURIFY
case VIEWER_PURIFY_SHOW_NEW_LEAKS:
case VIEWER_PURIFY_SHOW_ALL_LEAKS:
@ -3186,6 +3225,52 @@ nsBrowserWindow::ToggleBoolPrefAndRefresh(const char * aPrefName)
}
}
void
nsBrowserWindow::SetBoolPref(const char * aPrefName, PRBool aValue)
{
NS_ASSERTION(nsnull != aPrefName,"null pref name");
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
if (prefs && nsnull != aPrefName)
{
prefs->SetBoolPref(aPrefName, aValue);
prefs->SavePrefFile();
}
}
void
nsBrowserWindow::SetStringPref(const char * aPrefName, const nsString& aValue)
{
NS_ASSERTION(nsnull != aPrefName, "null pref name");
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
if (nsnull != prefs && nsnull != aPrefName)
{
char * prefStr = aValue.ToNewCString();
prefs->SetCharPref(aPrefName, prefStr);
prefs->SavePrefFile();
delete [] prefStr;
}
}
void
nsBrowserWindow::GetStringPref(const char * aPrefName, nsString& aValue)
{
NS_ASSERTION(nsnull != aPrefName, "null pref name");
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_PROGID));
if (nsnull != prefs && nsnull != aPrefName)
{
char* prefCharVal;
nsresult result = prefs->CopyCharPref(aPrefName, &prefCharVal);
if (NS_SUCCEEDED(result)) {
aValue = prefCharVal;
PL_strfree(prefCharVal);
}
}
}
//----------------------------------------------------------------------
static void

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

@ -181,6 +181,11 @@ public:
void ToggleFrameBorders();
void ToggleVisualEventDebugging();
void ToggleBoolPrefAndRefresh(const char * aPrefName);
void SetBoolPref(const char * aPrefName, PRBool aValue);
void SetStringPref(const char * aPrefName, const nsString& aValue);
void GetStringPref(const char * aPrefName, nsString& aValue);
void ShowContentSize(FILE* out = stdout);
void ShowFrameSize(FILE* out = stdout);
void ShowStyleSize();

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

@ -74,6 +74,12 @@
#define VIEWER_GFX_WIDGET_MODE 40070
#define VIEWER_DISPLAYTEXT 40071
#define VIEWER_DISPLAYHTML 40072
#define VIEWER_GFX_SCROLLBARS_ON 40073
#define VIEWER_GFX_SCROLLBARS_OFF 40074
#define VIEWER_GOTO_TEST_URL1 40075
#define VIEWER_GOTO_TEST_URL2 40076
#define VIEWER_SAVE_TEST_URL1 40077
#define VIEWER_SAVE_TEST_URL2 40078
#define VIEWER_TOGGLE_PAINT_FLASHING 40200
#define VIEWER_TOGGLE_PAINT_DUMPING 40210

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

@ -134,6 +134,19 @@ VIEWER MENU DISCARDABLE
MENUITEM "Nav Quirks", VIEWER_NAV_QUIRKS_MODE
MENUITEM "Standard", VIEWER_STANDARD_MODE
}
POPUP "&GfxScrollbar Mode Pref"
{
MENUITEM "Gfx Off", VIEWER_GFX_SCROLLBARS_OFF
MENUITEM "Gfx On", VIEWER_GFX_SCROLLBARS_ON
}
}
POPUP "&URLs"
{
MENUITEM "Goto URL #1", VIEWER_GOTO_TEST_URL1
MENUITEM "Goto URL #2", VIEWER_GOTO_TEST_URL2
MENUITEM SEPARATOR
MENUITEM "Save URL #1", VIEWER_SAVE_TEST_URL1
MENUITEM "Save URL #2", VIEWER_SAVE_TEST_URL2
}
POPUP "&Tools"
{