This commit is contained in:
rods%netscape.com 1999-04-20 17:44:55 +00:00
Родитель 9ad95fe43d
Коммит ea8d80c59e
21 изменённых файлов: 0 добавлений и 9122 удалений

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

@ -1,29 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public src
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk

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

@ -1,22 +0,0 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..
DIRS=public src
include <$(DEPTH)\layout\config\rules.mak>

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

@ -1,947 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
//is case this is defined from the outside... MMP
#ifdef WIN32_LEAN_AND_MEAN
#undef WIN32_LEAN_AND_MEAN
#endif
#include "JSConsole.h"
#include "jsconsres.h"
#include "nsIScriptContext.h"
#include <stdio.h>
#include "jsapi.h"
#ifdef MOZ_DEBUG
HINSTANCE JSConsole::sAppInstance = 0;
HACCEL JSConsole::sAccelTable = 0;
CHAR JSConsole::sDefaultCaption[] = "JavaScript Console";
BOOL JSConsole::mRegistered = FALSE;
// display an error string along with the error returned from
// the GetLastError functions
#define MESSAGE_LENGTH 256
void DisplayError(LPSTR lpMessage)
{
CHAR lpMsgBuf[MESSAGE_LENGTH * 2];
CHAR lpLastError[MESSAGE_LENGTH];
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
0,
(LPTSTR)&lpLastError,
MESSAGE_LENGTH,
NULL);
strcpy(lpMsgBuf, lpMessage);
strcat(lpMsgBuf, "\nThe WWS (Worthless Windows System) reports:\n");
strcat(lpMsgBuf, lpLastError);
// Display the string.
::MessageBox(NULL, lpMsgBuf, "JSConsole Error", MB_OK | MB_ICONSTOP);
}
#if defined(_DEBUG)
#define VERIFY(value, errorCondition, message) \
if((value) == (errorCondition)) DisplayError(message);
#else // !_DEBUG
#define VERIFY(value, errorCondition, message) (value)
#endif // _DEBUG
//
// Register the window class
//
BOOL JSConsole::RegisterWidget()
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = JSConsole::WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = JSConsole::sAppInstance;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
wc.lpszMenuName = MAKEINTRESOURCE(JSCONSOLE_MENU);
wc.lpszClassName = "JavaScript Console";
return (BOOL)::RegisterClass(&wc);
}
//
// Create the main application window
//
JSConsole* JSConsole::CreateConsole()
{
if (!JSConsole::mRegistered){
JSConsole::mRegistered = RegisterWidget();
}
HWND hWnd = ::CreateWindowEx(WS_EX_ACCEPTFILES |
WS_EX_CLIENTEDGE |
WS_EX_CONTROLPARENT,
"JavaScript Console",
JSConsole::sDefaultCaption,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
450,
500,
NULL,
NULL,
JSConsole::sAppInstance,
NULL);
if (hWnd) {
::ShowWindow(hWnd, SW_SHOW);
::UpdateWindow(hWnd);
JSConsole *console = (JSConsole*)::GetWindowLong(hWnd, GWL_USERDATA);
return console;
}
return NULL;
}
//
// Window Procedure
//
LRESULT CALLBACK JSConsole::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
JSConsole *console = (JSConsole*)::GetWindowLong(hWnd, GWL_USERDATA);
// just ignore the message unless is WM_NCCREATE
if (!console) {
if (uMsg == WM_NCCREATE) {
HWND hWndEdit = ::CreateWindow("EDIT",
NULL,
WS_CHILDWINDOW | WS_VISIBLE | ES_MULTILINE |
ES_AUTOHSCROLL | ES_AUTOVSCROLL |
WS_HSCROLL | WS_VSCROLL,
0, 0, 0, 0,
hWnd,
NULL,
JSConsole::sAppInstance,
NULL);
if (!hWndEdit) {
::DisplayError("Cannot Create Edit Window");
return FALSE;
}
::SendMessage(hWndEdit, EM_SETLIMITTEXT, (WPARAM)0, (LPARAM)0);
console = new JSConsole(hWnd, hWndEdit);
::SetWindowLong(hWnd, GWL_USERDATA, (DWORD)console);
::SetFocus(hWndEdit);
}
#if defined(STRICT)
return ::CallWindowProc((WNDPROC)::DefWindowProc, hWnd, uMsg,
wParam, lParam);
#else
return ::CallWindowProc((FARPROC)::DefWindowProc, hWnd, uMsg,
wParam, lParam);
#endif /* STRICT */
}
switch(uMsg) {
// make sure the edit window covers the whole client area
case WM_SIZE:
return console->OnSize(wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam));
// exit the application
case WM_DESTROY:
console->OnDestroy();
#if defined(STRICT)
return ::CallWindowProc((WNDPROC)::DefWindowProc, hWnd, uMsg,
wParam, lParam);
#else
return ::CallWindowProc((FARPROC)::DefWindowProc, hWnd, uMsg,
wParam, lParam);
#endif /* STRICT */
// enable/disable menu items
case WM_INITMENUPOPUP:
return console->OnInitMenu((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam));
case WM_COMMAND:
// menu or accelerator
if (HIWORD(wParam) == 0 || HIWORD(wParam) == 1) {
switch(LOWORD(wParam)) {
case ID_FILENEW:
console->OnFileNew();
break;
case ID_FILEOPEN:
if (console->OpenFileDialog(OPEN_DIALOG)) {
console->LoadFile();
}
break;
case ID_FILESAVE:
if (console->CanSave()) {
console->SaveFile();
break;
}
// fall through so it can "Save As..."
case ID_FILESAVEAS:
if (console->OpenFileDialog(SAVE_DIALOG)) {
console->SaveFile();
}
break;
case ID_FILEEXIT:
::DestroyWindow(hWnd);
break;
case ID_EDITUNDO:
console->OnEditUndo();
break;
case ID_EDITCUT:
console->OnEditCut();
break;
case ID_EDITCOPY:
console->OnEditCopy();
break;
case ID_EDITPASTE:
console->OnEditPaste();
break;
case ID_EDITDELETE:
console->OnEditDelete();
break;
case ID_EDITSELECTALL:
console->OnEditSelectAll();
break;
case ID_COMMANDSEVALALL:
console->OnCommandEvaluateAll();
break;
case ID_COMMANDSEVALSEL:
console->OnCommandEvaluateSelection();
break;
case ID_COMMANDSINSPECTOR:
console->OnCommandInspector();
break;
}
}
break;
case WM_DROPFILES:
{
HDROP hDropInfo = (HDROP)wParam;
if (::DragQueryFile(hDropInfo, (UINT)-1L, NULL, 0) != 1) {
::MessageBox(hWnd, "Just One File Please...", "JSConsole Error", MB_OK | MB_ICONINFORMATION);
}
else {
CHAR fileName[MAX_PATH];
::DragQueryFile(hDropInfo, 0, fileName, MAX_PATH);
console->SetFileName(fileName);
console->LoadFile();
}
break;
}
case WM_SETFOCUS:
return console->OnSetFocus((HWND)wParam);
default:
#if defined(STRICT)
return ::CallWindowProc((WNDPROC)::DefWindowProc, hWnd, uMsg,
wParam, lParam);
#else
return ::CallWindowProc((FARPROC)::DefWindowProc, hWnd, uMsg,
wParam, lParam);
#endif /* STRICT */
}
return 0;
}
//
// Constructor
// The main window and the edit control must have been created already
//
JSConsole::JSConsole(HWND aMainWindow, HWND aEditControl) :
mMainWindow(aMainWindow),
mEditWindow(aEditControl),
mContext(NULL)
{
mFileInfo.Init();
}
//
// Destructor
//
JSConsole::~JSConsole()
{
}
//
// Load a file into the edit field
//
BOOL JSConsole::LoadFile()
{
BOOL result = FALSE;
if (mMainWindow) {
// open the file
HANDLE file = ::CreateFile(mFileInfo.mCurrentFileName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
if (file != INVALID_HANDLE_VALUE) {
// check the file size. Max is 64k
DWORD sizeHiWord;
DWORD sizeLoWord = ::GetFileSize(file, &sizeHiWord);
if (sizeLoWord < 0x10000 && sizeHiWord == 0) {
// alloc a buffer big enough to contain the file (account for '\0'
CHAR *buffer = new CHAR[sizeLoWord + 1];
if (buffer) {
// read the file in memory
if (::ReadFile(file,
buffer,
sizeLoWord,
&sizeHiWord,
NULL)) {
NS_ASSERTION(sizeLoWord == sizeHiWord, "ReadFile inconsistency");
buffer[sizeLoWord] = '\0'; // terminate the buffer
// write the file to the edit field
::SendMessage(mEditWindow, WM_SETTEXT, (WPARAM)0, (LPARAM)buffer);
// update the caption
CHAR caption[80];
::wsprintf(caption,
"%s - %s",
mFileInfo.mCurrentFileName + mFileInfo.mFileOffset,
sDefaultCaption);
::SendMessage(mMainWindow, WM_SETTEXT, (WPARAM)0, (LPARAM)caption);
result = TRUE;
}
else {
::DisplayError("Error Reading the File");
}
// free the allocated buffer
delete[] buffer;
}
else {
::MessageBox(mMainWindow,
"Cannot Allocate Enough Memory to Copy the File in Memory",
"JSConsole Error",
MB_OK | MB_ICONSTOP);
}
}
else {
::MessageBox(mMainWindow,
"File too big. Max is 64k",
"JSConsole Error",
MB_OK | MB_ICONSTOP);
}
// close the file handle
::CloseHandle(file);
}
#ifdef _DEBUG
else {
CHAR message[MAX_PATH + 20];
wsprintf(message, "Cannot Open File: %s", mFileInfo.mCurrentFileName);
::DisplayError(message);
}
#endif
}
return result;
}
//
// Save the current text into a file
//
BOOL JSConsole::SaveFile()
{
BOOL result = FALSE;
if (mMainWindow && mFileInfo.mCurrentFileName[0] != '\0') {
// create the new file
HANDLE file = ::CreateFile(mFileInfo.mCurrentFileName,
GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
if (file != INVALID_HANDLE_VALUE) {
DWORD size;
// get the text size
size = ::SendMessage(mEditWindow, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0);
// alloc a buffer big enough to contain the file
CHAR *buffer = new CHAR[++size];
if (buffer) {
DWORD byteRead;
// read the text area content
::SendMessage(mEditWindow, WM_GETTEXT, (WPARAM)size, (LPARAM)buffer);
// write the buffer to disk
if (::WriteFile(file,
buffer,
size,
&byteRead,
NULL)) {
NS_ASSERTION(byteRead == size, "WriteFile inconsistency");
// update the caption
CHAR caption[80];
::wsprintf(caption,
"%s - %s",
mFileInfo.mCurrentFileName + mFileInfo.mFileOffset,
sDefaultCaption);
::SendMessage(mMainWindow, WM_SETTEXT, (WPARAM)0, (LPARAM)caption);
result = TRUE;
}
else {
::DisplayError("Error Writing the File");
}
// free the allocated buffer
delete[] buffer;
}
else {
::MessageBox(mMainWindow,
"Cannot Allocate Enough Memory to Copy the Edit Text in Memory",
"JSConsole Error",
MB_OK | MB_ICONSTOP);
}
// close the file handle
::CloseHandle(file);
}
#ifdef _DEBUG
else {
CHAR message[MAX_PATH + 20];
wsprintf(message, "Cannot Open File: %s", mFileInfo.mCurrentFileName);
::DisplayError(message);
}
#endif
}
return result;
}
//
// Open a FileOpen or FileSave dialog
//
BOOL JSConsole::OpenFileDialog(UINT aWhichDialog)
{
BOOL result = FALSE;
OPENFILENAME ofn;
if (mMainWindow) {
// *.js is the standard File Name on the Save/Open Dialog
if (mFileInfo.mCurrentFileName[0] == '\0')
::strcpy(mFileInfo.mCurrentFileName, "*.js");
// fill the OPENFILENAME sruct
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = mMainWindow;
ofn.hInstance = JSConsole::sAppInstance;
ofn.lpstrFilter = "JavaScript Files (*.js)\0*.js\0Text Files (*.txt)\0*.txt\0All Files\0*.*\0\0";
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1; // the first one in lpstrFilter
ofn.lpstrFile = mFileInfo.mCurrentFileName; // contains the file path name on return
ofn.nMaxFile = sizeof(mFileInfo.mCurrentFileName);
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL; // use default
ofn.lpstrTitle = NULL; // use default
ofn.Flags = OFN_CREATEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = "js"; // default extension is .js
ofn.lCustData = NULL;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
// call the open file dialog or the save file dialog according to aIsOpenDialog
if (aWhichDialog == OPEN_DIALOG) {
result = ::GetOpenFileName(&ofn);
}
else if (aWhichDialog == SAVE_DIALOG) {
result = ::GetSaveFileName(&ofn);
}
if (!result) {
mFileInfo.mCurrentFileName[0] = '\0';
::CommDlgExtendedError();
}
else {
mFileInfo.mFileOffset = ofn.nFileOffset;
mFileInfo.mFileExtension = ofn.nFileExtension;
}
}
return result;
}
//
// set the mFileInfo structure with the proper value given a generic path
//
void JSConsole::SetFileName(LPSTR aFileName)
{
strcpy(mFileInfo.mCurrentFileName, aFileName);
for (int i = strlen(aFileName); i >= 0; i--) {
if (mFileInfo.mCurrentFileName[i] == '.') {
mFileInfo.mFileExtension = i;
}
if (mFileInfo.mCurrentFileName[i] == '\\') {
mFileInfo.mFileOffset = i + 1;
break;
}
}
}
//
// Move the edit window to cover the all client area
//
LRESULT JSConsole::OnSize(DWORD aResizeFlags, UINT aWidth, UINT aHeight)
{
::MoveWindow(mEditWindow, 0, 0, aWidth, aHeight, TRUE);
RECT textArea;
textArea.left = 3;
textArea.top = 1;
textArea.right = aWidth - 20;
textArea.bottom = aHeight - 17;
::SendMessage(mEditWindow, EM_SETRECTNP, (WPARAM)0, (LPARAM)&textArea);
return 0L;
}
//
// Initialize properly menu items
//
LRESULT JSConsole::OnInitMenu(HMENU aMenu, UINT aPos, BOOL aIsSystem)
{
if (!aIsSystem) {
if (aPos == EDITMENUPOS) {
InitEditMenu(aMenu);
}
else if (aPos == COMMANDSMENUPOS) {
InitCommandMenu(aMenu);
}
}
return 0L;
}
//
// Pass the focus to the edit window
//
LRESULT JSConsole::OnSetFocus(HWND aWnd)
{
::SetFocus(mEditWindow);
return 0L;
}
//
// Destroy message
//
void JSConsole::OnDestroy()
{
if (mDestroyNotification)
(*mDestroyNotification)();
}
//
// File/New. Reset caption, text area and file info
//
void JSConsole::OnFileNew()
{
SendMessage(mEditWindow, WM_SETTEXT, (WPARAM)0, (LPARAM)0);
SendMessage(mMainWindow, WM_SETTEXT, (WPARAM)0, (LPARAM)JSConsole::sDefaultCaption);
mFileInfo.Init();
}
//
// Edit/Undo. Undo the last operation on the edit field
//
void JSConsole::OnEditUndo()
{
SendMessage(mEditWindow, WM_UNDO, (WPARAM)0, (LPARAM)0);
}
//
// Edit/Cut. Cut the current selection
//
void JSConsole::OnEditCut()
{
SendMessage(mEditWindow, WM_CUT, (WPARAM)0, (LPARAM)0);
}
//
// Edit/Copy. Copy the current selection
//
void JSConsole::OnEditCopy()
{
SendMessage(mEditWindow, WM_COPY, (WPARAM)0, (LPARAM)0);
}
//
// Edit/Paste. Paste from the clipboard
//
void JSConsole::OnEditPaste()
{
SendMessage(mEditWindow, WM_PASTE, (WPARAM)0, (LPARAM)0);
}
//
// Edit/Delete. Delete the current selection
//
void JSConsole::OnEditDelete()
{
SendMessage(mEditWindow, WM_CLEAR, (WPARAM)0, (LPARAM)0);
}
//
// Edit/Select All. Select the whole text in the text area
//
void JSConsole::OnEditSelectAll()
{
SendMessage(mEditWindow, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
}
//
// Command/Evaluate All. Take the text area content and evaluate in the js context
//
void JSConsole::OnCommandEvaluateAll()
{
EvaluateText(0, (UINT)-1);
}
//
// Command/Evaluate Selection. Take the current text area selection and evaluate in the js context
//
void JSConsole::OnCommandEvaluateSelection()
{
//
// get the selection and evaluate it
//
DWORD startSel, endSel;
// get selection range
::SendMessage(mEditWindow, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel);
EvaluateText(startSel, endSel);
}
//
// Command/Inspector. Run the js inspector on the global object
//
void JSConsole::OnCommandInspector()
{
::MessageBox(mMainWindow, "Inspector not yet available", "JSConsole Error", MB_OK | MB_ICONINFORMATION);
}
//
// Help
//
void JSConsole::OnHelp()
{
}
//
// private method. Deal with the "Edit" menu
//
void JSConsole::InitEditMenu(HMENU aMenu)
{
CHAR someText[2] = {'\0', '\0'}; // some buffer
// set flags to "disable"
UINT undoFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
UINT cutFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
UINT copyFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
UINT pasteFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
UINT deleteFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
UINT selectAllFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
// check if the edit area has any text
SendMessage(mEditWindow, WM_GETTEXT, (WPARAM)2, (LPARAM)someText);
if (someText[0] != '\0') {
// enable the "Select All"
selectAllFlags = MF_BYPOSITION | MF_ENABLED;
// enable "Copy/Cut/Paste" if there is any selection
UINT startPos, endPos;
SendMessage(mEditWindow, EM_GETSEL, (WPARAM)&startPos, (LPARAM)&endPos);
if (startPos != endPos) {
cutFlags = MF_BYPOSITION | MF_ENABLED;
copyFlags = MF_BYPOSITION | MF_ENABLED;
deleteFlags = MF_BYPOSITION | MF_ENABLED;
}
}
// undo is available if the edit control says so
if (SendMessage(mEditWindow, EM_CANUNDO, (WPARAM)0, (LPARAM)0)) {
undoFlags = MF_BYPOSITION | MF_ENABLED;
}
// check whether or not the clipboard contains text data
if (IsClipboardFormatAvailable(CF_TEXT)) {
pasteFlags = MF_BYPOSITION | MF_ENABLED;
}
// do enable/disable
VERIFY(EnableMenuItem(aMenu,
ID_EDITUNDO - ID_EDITMENU - 1,
undoFlags),
-1L,
"Disable/Enable \"Undo\" Failed");
VERIFY(EnableMenuItem(aMenu,
ID_EDITCUT - ID_EDITMENU - 1,
cutFlags),
-1L,
"Disable/Enable \"Cut\" Failed");
VERIFY(EnableMenuItem(aMenu,
ID_EDITCOPY - ID_EDITMENU - 1,
copyFlags),
-1L,
"Disable/Enable \"Copy\" Failed");
VERIFY(EnableMenuItem(aMenu,
ID_EDITPASTE - ID_EDITMENU - 1,
pasteFlags),
-1L,
"Disable/Enable \"Paste\" Failed");
VERIFY(EnableMenuItem(aMenu,
ID_EDITDELETE - ID_EDITMENU - 1,
deleteFlags),
-1L,
"Disable/Enable \"Delete\" Failed");
VERIFY(EnableMenuItem(aMenu,
ID_EDITSELECTALL - ID_EDITMENU - 1,
selectAllFlags),
-1L,
"Disable/Enable \"Select All\" Failed");
}
//
// private method. Deal with the "Command" menu
//
void JSConsole::InitCommandMenu(HMENU aMenu)
{
CHAR someText[2] = {'\0', '\0'}; // some buffer
// set flags to "disable"
UINT evaluateAllFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
UINT evaluateSelectionFlags = MF_BYPOSITION | MF_DISABLED | MF_GRAYED;
// check if the edit area has any text
SendMessage(mEditWindow, WM_GETTEXT, (WPARAM)2, (LPARAM)someText);
if (someText[0] != 0) {
// if there is some text enable "Evaluate All"
evaluateAllFlags = MF_BYPOSITION | MF_ENABLED;
// enable "Evaluate Selection" if there is any selection
UINT startPos, endPos;
SendMessage(mEditWindow, EM_GETSEL, (WPARAM)&startPos, (LPARAM)&endPos);
if (startPos != endPos) {
evaluateSelectionFlags = MF_BYPOSITION | MF_ENABLED;
}
}
// disable/enable commands
VERIFY(EnableMenuItem(aMenu,
ID_COMMANDSEVALALL - ID_COMMANDSMENU - 1,
evaluateAllFlags),
-1L,
"Disable/Enable \"Evaluate All\" Failed");
VERIFY(EnableMenuItem(aMenu,
ID_COMMANDSEVALSEL - ID_COMMANDSMENU - 1,
evaluateSelectionFlags),
-1L,
"Disable/Enable \"Evaluate Selection\" Failed");
}
//
// normailize a buffer of char coming from a text area.
// Basically get rid of the 0x0D char
//
LPSTR NormalizeBuffer(LPSTR aBuffer)
{
// trim all the 0x0D at the beginning (should be 1 at most, but hey...)
while (*aBuffer == 0x0D) {
aBuffer++;
}
LPSTR readPointer = aBuffer;
LPSTR writePointer = aBuffer;
do {
// compact the buffer if needed
*writePointer = *readPointer;
// skip the 0x0D
if (*readPointer != 0x0D) {
writePointer++;
}
} while (*readPointer++ != '\0');
return aBuffer;
}
LPSTR PrepareForTextArea(LPSTR aBuffer, PRInt32 aSize)
{
PRInt32 count = 0;
LPSTR newBuffer = aBuffer;
LPSTR readPointer = aBuffer;
// count the '\n'
while (*readPointer != '\0' && (*readPointer++ != '\n' || ++count));
if (0 != count) {
readPointer = aBuffer;
newBuffer = new CHAR[aSize + count + 1];
LPSTR writePointer = newBuffer;
while (*readPointer != '\0') {
if (*readPointer == '\n') {
*writePointer++ = 0x0D;
}
*writePointer++ = *readPointer++;
}
*writePointer = '\0';
}
return newBuffer;
}
//
// Evaluate the text enclosed between startSel and endSel
//
void JSConsole::EvaluateText(UINT aStartSel, UINT aEndSel)
{
if (mContext) {
// get the text size
UINT size = ::SendMessage(mEditWindow, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0);
// alloc a buffer big enough to contain the file
CHAR *buffer = new CHAR[++size];
if (buffer) {
// get the whole text
::SendMessage(mEditWindow, WM_GETTEXT, (WPARAM)size, (LPARAM)buffer);
// get the portion of the text to be evaluated
if (aEndSel != (UINT)-1) {
size = aEndSel - aStartSel;
strncpy(buffer, buffer + aStartSel, size);
buffer[size] = '\0';
}
else {
aEndSel = size;
}
// change the 0x0D0x0A couple in 0x0A ('\n')
// no new buffer allocation, the pointer may be in the middle
// of the old buffer though, so keep buffer to call delete
LPSTR cleanBuffer = ::NormalizeBuffer(buffer);
// evaluate the string
jsval returnValue;
if (mContext->EvaluateString(nsString(cleanBuffer),
nsnull,
0,
returnValue,
&isUndefined)) {
// output the result on the console and on the edit area
CHAR result[128];
LPSTR res = result;
int bDelete = 0;
JSContext *cx = (JSContext *)mContext->GetNativeContext();
char *str = returnValue.ToNewCString();
::printf("The return value is %s\n", str);
// make a string with 0xA changed to 0xD0xA
res = PrepareForTextArea(str, returnValue.Length());
if (res != str) {
bDelete = 1; // if the buffer was new'ed
}
// set the position at the end of the selection
::SendMessage(mEditWindow, EM_SETSEL, (WPARAM)aEndSel, (LPARAM)aEndSel);
// write the result
::SendMessage(mEditWindow, EM_REPLACESEL, (WPARAM)TRUE, (LPARAM)res);
// highlight the result
::SendMessage(mEditWindow, EM_SETSEL, (WPARAM)aEndSel - 1, (LPARAM)(aEndSel + strlen(res)));
// deal with the "big string" case
if (bDelete > 0) {
delete[] res;
}
delete[] str;
// clean up a bit
JS_GC((JSContext *)mContext->GetNativeContext());
}
else {
::MessageBox(mMainWindow,
"Error evaluating the Script",
"JSConsole Error",
MB_OK | MB_ICONERROR);
}
delete[] buffer;
}
else {
::MessageBox(mMainWindow,
"Not Enough Memory to Allocate a Buffer to Evaluate the Script",
"JSConsole Error",
MB_OK | MB_ICONSTOP);
}
}
else {
::MessageBox(mMainWindow,
"Java Script Context not initialized",
"JSConsole Error",
MB_OK | MB_ICONSTOP);
}
}
#endif // MOZ_DEBUG

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

@ -1,106 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef jsconsole_h__
#define jsconsole_h__
#include <windows.h>
class nsIScriptContext;
#define OPEN_DIALOG 0
#define SAVE_DIALOG 1
typedef void (*DESTROY_NOTIFICATION) ();
class JSConsole {
private:
HWND mMainWindow;
HWND mEditWindow;
DESTROY_NOTIFICATION mDestroyNotification;
// keep info from the OPENFILENAME struct
struct FileInfo {
CHAR mCurrentFileName[MAX_PATH];
WORD mFileOffset;
WORD mFileExtension;
void Init() {mCurrentFileName[0] = '\0'; mFileOffset = 0; mFileExtension = 0;}
} mFileInfo;
// one context per window
nsIScriptContext *mContext;
public:
static HINSTANCE sAppInstance;
static HACCEL sAccelTable;
static CHAR sDefaultCaption[];
static BOOL RegisterWidget();
static JSConsole* CreateConsole();
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
static BOOL mRegistered;
public:
JSConsole(HWND aMainWindow, HWND aEditControl);
~JSConsole();
BOOL LoadFile();
BOOL SaveFile();
BOOL OpenFileDialog(UINT aOpenOrSave);
inline BOOL CanSave() { return mFileInfo.mCurrentFileName[0] != '\0'; }
void SetFileName(LPSTR aFileName);
HWND GetMainWindow() { return mMainWindow; }
void SetNotification(DESTROY_NOTIFICATION aNotification) { mDestroyNotification = aNotification; }
void SetContext(nsIScriptContext *aContext) { mContext = aContext; }
void EvaluateText(UINT aStartSel, UINT aEndSel);
// windows messages
LRESULT OnSize(DWORD aResizeFlags, UINT aWidth, UINT aHeight);
LRESULT OnInitMenu(HMENU aMenu, UINT aPos, BOOL aIsSystem);
LRESULT OnSetFocus(HWND aWnd);
void OnDestroy();
// menu items
void OnFileNew();
void OnEditUndo();
void OnEditCut();
void OnEditCopy();
void OnEditPaste();
void OnEditDelete();
void OnEditSelectAll();
void OnCommandEvaluateAll();
void OnCommandEvaluateSelection();
void OnCommandInspector();
void OnHelp();
private:
void InitEditMenu(HMENU aMenu);
void InitCommandMenu(HMENU aMenu);
};
#endif // jsconsole_h__

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

@ -1,232 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PROGRAM = xpviewer
TOOLKIT_GFX_LIB = -lgfx$(MOZ_TOOLKIT)
TOOLKIT_WIDGET_LIB = -lwidget$(MOZ_TOOLKIT)
TOOLKIT_BASE_LIB = -lgmbase$(MOZ_TOOLKIT)
# Hardcoding dlopen()'s? This needs to get fixed.
#
TOOLKIT_CFLAGS := \
-DWIDGET_DLL=\"libwidget$(MOZ_TOOLKIT).$(DLL_SUFFIX)\" \
-DGFXWIN_DLL=\"libgfx$(MOZ_TOOLKIT).$(DLL_SUFFIX)\" \
$(TK_CFLAGS)
CPPSRCS = \
nsFindDialog.cpp \
nsSetupRegistry.cpp \
nsUnixStubs.cpp \
nsBrowserWindow.cpp \
nsBrowserMain.cpp \
nsViewerApp.cpp \
nsXPBaseWindow.cpp \
$(NULL)
ifdef MOZ_OJI
JSJ_LIB = -ljsj
endif
LIBS := \
-L$(DIST)/bin \
-lraptorbase \
-lpref \
-lraptorbase \
$(TOOLKIT_WIDGET_LIB) \
-lraptorgfx \
$(TOOLKIT_GFX_LIB) \
-lraptorhtml \
$(DIST)/lib/libraptorhtmlforms_s.a \
$(TOOLKIT_BASE_LIB) \
-lraptorhtmlpars \
-lraptorview \
-lreg \
-labouturl \
-lfileurl \
-lftpurl \
-lgophurl \
-lhttpurl \
-lsockstuburl \
-limg \
$(JPEG_LIBS) \
$(PNG_LIBS) \
-l$(MOZ_LIB_JS_PREFIX)js \
-ljsdom \
-ljsurl \
$(DIST)/lib/libjsdomcore_s.a \
$(JSJ_LIB) \
-lmimetype \
-lnetcache \
-lnetcnvts \
-lnetlib \
-lnetutil \
-lnetwork \
-lpwcac \
-lraptorwebwidget \
-lreg \
-lremoturl \
-lsecfree \
-lstubnj \
-lstubsj \
-ltestdynamic \
-l$(MOZ_LIB_UTIL_PREFIX)util \
-lxp \
-lxpcom \
-l$(MOZ_LIB_UTIL_PREFIX)util \
-lxp \
-lxpcom \
$(ZLIB_LIBS) \
-lraptorplugin \
-l$(MOZ_LIB_DBM_PREFIX)dbm \
$(NULL)
include $(topsrcdir)/config/config.mk
CFLAGS += $(TOOLKIT_CFLAGS)
include $(topsrcdir)/config/rules.mk
install::
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test0.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test1.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test2.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test3.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test4.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test5.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test6.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test7.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test8.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test8siz.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test8sca.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test8tab.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test9.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test9a.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/test9b.html $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/raptor.jpg $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/Anieyes.gif $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/gear1.gif $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/rock_gra.gif $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/../../../webshell/tests/viewer/samples/bg.jpg $(DIST)/bin/res/samples
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation00.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation01.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation02.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation03.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation04.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation05.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation06.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation07.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation08.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation09.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation10.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation11.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation12.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation13.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation14.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation15.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation16.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation17.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation18.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation19.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation20.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation21.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation22.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation23.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation24.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation25.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation26.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation27.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation28.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation29.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation30.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation31.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation32.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation33.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation34.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation35.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation36.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation37.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/throbber/LargeAnimation38.gif $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/toolbar/DialogAddrIcon.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogAddrIcon_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogCompIcon.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogCompIcon_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogMailIcon.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogMailIcon_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogNavIcon.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/DialogNavIcon_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Back.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Back_dis.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Back_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Bookmarks.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Bookmarks_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Edit.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Forward.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Forward_dis.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Forward_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Home.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Home_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_HTab.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_HTab_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_LoadImages.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_LoadImages.mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Location.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Location_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MiniAddr.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MiniComp.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MiniMail.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MiniNav.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MiniTab.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MixSecurity.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_MixSecurity.mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Netscape.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Netscape_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_PersonalIcon.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Places.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Places_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Print.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Print_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Reload.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Reload_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Search.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Search_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Secure.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Secure_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Stop.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Stop.mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Stop_dis.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Stop_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Tab.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_TabSmall.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_TabSmall_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Tab_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Unsecure.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_Unsecure.mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_WhatsRelated.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/TB_WhatsRelated_mo.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/StatusBar-insecure.gif $(DIST)/bin/res/toolbar
$(INSTALL) $(srcdir)/resources/toolbar/StatusBar-secure.gif $(DIST)/bin/res/toolbar

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

@ -1,67 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef jsconsres_h___
#define jsconsres_h___
// Main menu id
#define JSCONSOLE_MENU 20100
#define FILEMENUPOS 0
#define ID_FILEMENU 20200
// File menu items ids
#define ID_FILENEW 20201
#define ID_FILEOPEN 20202
#define ID_FILESAVE 20203
#define ID_FILESAVEAS 20204
// separator
#define ID_FILEEXIT 20206
#define EDITMENUPOS 1
#define ID_EDITMENU 20300
// Edit menu items ids
#define ID_EDITUNDO 20301
// separator
#define ID_EDITCUT 20303
#define ID_EDITCOPY 20304
#define ID_EDITPASTE 20305
#define ID_EDITDELETE 20306
// separator
#define ID_EDITSELECTALL 20308
#define COMMANDSMENUPOS 2
#define ID_COMMANDSMENU 20400
// Commands menu items ids
#define ID_COMMANDSEVALALL 20401
#define ID_COMMANDSEVALSEL 20402
// separator
#define ID_COMMANDSINSPECTOR 20404
#define HELPMENUPOS 3
#define ID_HELPMENU 20500
// Help menu items
#define ID_NOHELP 20501
//
// Accelerators table ids
//
#define ACCELERATOR_TABLE 1000
#endif // jsconsres_h___

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

@ -1,228 +0,0 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
IGNORE_MANIFEST=1
MAKE_OBJ_TYPE = EXE
PROGRAM = .\$(OBJDIR)\xpviewer.exe
RESFILE = xpviewer.res
MISCDEP= \
$(DIST)\lib\raptorweb.lib \
$(DIST)\lib\xpcom32.lib \
$(LIBNSPR) \
$(DIST)\lib\plc3.lib
OBJS = \
.\$(OBJDIR)\nsFindDialog.obj \
.\$(OBJDIR)\nsXPBaseWindow.obj \
.\$(OBJDIR)\nsBrowserWindow.obj \
.\$(OBJDIR)\nsSetupRegistry.obj \
.\$(OBJDIR)\nsViewerApp.obj \
.\$(OBJDIR)\nsBrowserMain.obj \
.\$(OBJDIR)\JSConsole.obj \
$(NULL)
LINCS= \
-I$(PUBLIC)\raptor \
-I$(PUBLIC)\xpcom \
-I$(PUBLIC)\dom \
-I$(PUBLIC)\js \
-I$(PUBLIC)\netlib \
-I$(PUBLIC)\java \
-I$(PUBLIC)\plugin \
-I$(PUBLIC)\editor \
-I$(PUBLIC)\pref \
!ifdef MOZ_FULLCIRCLE
-I$(PUBLIC)\fullsoft \
!endif
$(NULL)
MYLIBS= \
$(DIST)\lib\raptorbase.lib \
$(DIST)\lib\raptorgfxwin.lib \
$(DIST)\lib\raptorhtml.lib \
$(DIST)\lib\raptorweb.lib \
$(DIST)\lib\raptorwidget.lib \
$(DIST)\lib\raptorhtmlpars.lib \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\js32$(VERSION_NUMBER).lib \
$(LIBNSPR) \
$(DIST)\lib\plc3.lib \
$(DIST)\lib\netlib.lib \
$(DIST)\lib\jsdom.lib \
comdlg32.lib \
!ifdef MOZ_FULLCIRCLE
$(DIST)\lib\fulls32.lib \
!endif
$(NULL)
LLIBS= $(MYLIBS) \
shell32.lib \
-SUBSYSTEM:CONSOLE
include <$(DEPTH)\config\rules.mak>
!ifdef MOZ_NO_DEBUG_RTL
OS_CFLAGS = $(OS_CFLAGS) -DMOZ_NO_DEBUG_RTL
!endif
install:: $(PROGRAM)
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin
$(MAKE_INSTALL) resources\chrome\find.html $(DIST)\bin\res\samples
$(MAKE_INSTALL) resources\throbber\LargeAnimation00.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation01.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation02.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation03.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation04.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation05.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation06.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation07.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation08.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation09.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation10.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation11.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation12.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation13.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation14.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation15.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation16.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation17.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation18.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation19.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation20.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation21.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation22.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation23.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation24.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation25.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation26.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation27.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation28.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation29.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation30.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation31.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation32.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation33.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation34.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation35.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation36.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation37.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\throbber\LargeAnimation38.gif $(DIST)\bin\res\throbber
$(MAKE_INSTALL) resources\toolbar\DialogAddrIcon.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogAddrIcon_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogCompIcon.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogCompIcon_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogMailIcon.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogMailIcon_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogNavIcon.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\DialogNavIcon_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Back.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Back_dis.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Back_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Bookmarks.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Bookmarks_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Edit.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Forward.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Forward_dis.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Forward_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Home.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Home_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_HTab.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_HTab_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_LoadImages.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_LoadImages.mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Location.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Location_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MiniAddr.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MiniComp.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MiniMail.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MiniNav.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MiniTab.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MixSecurity.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_MixSecurity.mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Netscape.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Netscape_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_PersonalIcon.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Places.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Places_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Print.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Print_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Reload.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Reload_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Search.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Search_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Secure.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Secure_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Stop.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Stop.mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Stop_dis.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Stop_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Tab.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_TabSmall.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_TabSmall_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Tab_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Unsecure.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_Unsecure.mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_WhatsRelated.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\TB_WhatsRelated_mo.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\StatusBar-insecure.gif $(DIST)\bin\res\toolbar
$(MAKE_INSTALL) resources\toolbar\StatusBar-secure.gif $(DIST)\bin\res\toolbar
clobber::
rm -f $(DIST)\bin\xpviewer.exe
rm -f $(DIST)\bin\res\samples\find.html
rm -f $(DIST)\bin\res\samples\test0.html
rm -f $(DIST)\bin\res\samples\test1.html
rm -f $(DIST)\bin\res\samples\test2.html
rm -f $(DIST)\bin\res\samples\test3.html
rm -f $(DIST)\bin\res\samples\test4.html
rm -f $(DIST)\bin\res\samples\test5.html
rm -f $(DIST)\bin\res\samples\test6.html
rm -f $(DIST)\bin\res\samples\test7.html
rm -f $(DIST)\bin\res\samples\test8.html
rm -f $(DIST)\bin\res\samples\test8siz.html
rm -f $(DIST)\bin\res\samples\test8sca.html
rm -f $(DIST)\bin\res\samples\test8tab.html
rm -f $(DIST)\bin\res\samples\test_ed.html
rm -f $(DIST)\bin\res\samples\test9.html
rm -f $(DIST)\bin\res\samples\test9a.html
rm -f $(DIST)\bin\res\samples\test9b.html
rm -f $(DIST)\bin\res\samples\raptor.jpg
rm -f $(DIST)\bin\res\samples\Anieyes.gif
rm -f $(DIST)\bin\res\samples\gear1.gif
rm -f $(DIST)\bin\res\samples\rock_gra.gif
rm -f $(DIST)\bin\res\samples\bg.jpg
rm -f $(DIST)\bin\res\throbber\anims00.gif
rm -f $(DIST)\bin\res\throbber\anims01.gif
rm -f $(DIST)\bin\res\throbber\anims02.gif
rm -f $(DIST)\bin\res\throbber\anims03.gif
rm -f $(DIST)\bin\res\throbber\anims04.gif
rm -f $(DIST)\bin\res\throbber\anims05.gif
rm -f $(DIST)\bin\res\throbber\anims06.gif
rm -f $(DIST)\bin\res\throbber\anims07.gif
rm -f $(DIST)\bin\res\throbber\anims08.gif
rm -f $(DIST)\bin\res\throbber\anims09.gif
rm -f $(DIST)\bin\res\throbber\anims10.gif
rm -f $(DIST)\bin\res\throbber\anims11.gif
rm -f $(DIST)\bin\res\throbber\anims12.gif
rm -f $(DIST)\bin\res\throbber\anims13.gif

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

@ -1,130 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifdef XP_PC
#include <windows.h>
#include "JSConsole.h"
#endif
#include "nsViewerApp.h"
#include "nsBrowserWindow.h"
#include "nsITimer.h"
#include "plevent.h"
#ifdef XP_PC
JSConsole *gConsole;
HINSTANCE gInstance, gPrevInstance;
#endif
static nsITimer* gNetTimer;
/*nsNativeViewerApp::nsNativeViewerApp()
{
}
nsNativeViewerApp::~nsNativeViewerApp()
{
}
int
nsNativeViewerApp::Run()
{
OpenWindow();
// Process messages
MSG msg;
while (::GetMessage(&msg, NULL, 0, 0)) {
if (!JSConsole::sAccelTable ||
!gConsole ||
!gConsole->GetMainWindow() ||
!TranslateAccelerator(gConsole->GetMainWindow(),
JSConsole::sAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
*/
//----------------------------------------------------------------------
/*nsNativeBrowserWindow::nsNativeBrowserWindow()
{
}
nsNativeBrowserWindow::~nsNativeBrowserWindow()
{
}
nsresult
nsBrowserWindow::CreateMenuBar(PRInt32 aWidth)
{
HMENU menu = ::LoadMenu(gInstance, "Viewer");
HWND hwnd = (HWND)mWindow->GetNativeData(NS_NATIVE_WIDGET);
::SetMenu(hwnd, menu);
return NS_OK;
}
nsEventStatus
nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
{
// Dispatch windows-only menu code goes here
// Dispatch xp menu items
return nsBrowserWindow::DispatchMenuItem(aID);
}*/
//----------------------------------------------------------------------
int main(int argc, char **argv)
{
#ifdef XP_PC
PL_InitializeEventsLib("");
#endif
nsViewerApp* app = new nsViewerApp();
NS_ADDREF(app);
/* we should, um, check for failure */
if (app->Initialize(argc, argv) != NS_OK)
return 0;
// Initialize() now does this: app->OpenWindow();
app->Run();
NS_RELEASE(app);
return 0;
}
#ifdef XP_PC
int PASCAL
WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
int nCmdShow)
{
gInstance = instance;
gPrevInstance = prevInstance;
PL_InitializeEventsLib("");
nsViewerApp* app = new nsViewerApp();
app->Initialize(0, nsnull);
app->OpenWindow();
int result = app->Run();
delete app;
return result;
}
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,340 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsBrowserWindow_h___
#define nsBrowserWindow_h___
#include "nsIBrowserWindow.h"
#include "nsIXPBaseWindow.h"
#include "nsIStreamListener.h"
#include "nsINetSupport.h"
#include "nsIWebShell.h"
#include "nsIScriptContextOwner.h"
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsCRT.h"
#include "nsIToolbarManagerListener.h"
#include "nsIImageButtonListener.h"
#include "nsIEditor.h"
class nsILabel;
class nsICheckButton;
class nsIRadioButton;
class nsIDialog;
class nsITextWidget;
class nsIButton;
class nsIThrobber;
class nsViewerApp;
class nsIPresShell;
class nsIPref;
class nsIImageButton;
class nsIMenuButton;
class nsIToolbar;
class nsIToolbarManager;
#define SAMPLES_BASE_URL "resource:/res/samples"
/**
* Abstract base class for our test app's browser windows
*/
class nsBrowserWindow : public nsIBrowserWindow,
public nsIStreamObserver,
public nsINetSupport,
public nsIWebShellContainer,
public nsIToolbarManagerListener,
public nsIImageButtonListener
{
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsBrowserWindow();
virtual ~nsBrowserWindow();
// nsISupports
NS_DECL_ISUPPORTS
// nsIBrowserWindow
NS_IMETHOD Init(nsIAppShell* aAppShell,
nsIPref* aPrefs,
const nsRect& aBounds,
PRUint32 aChromeMask,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
NS_IMETHOD SizeTo(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD GetWindowBounds(nsRect& aBounds);
NS_IMETHOD GetBounds(nsRect& aBounds);
NS_IMETHOD Show();
NS_IMETHOD Hide();
NS_IMETHOD Close();
NS_IMETHOD SetChrome(PRUint32 aNewChromeMask);
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult);
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
NS_IMETHOD SetStatus(const PRUnichar* aStatus);
NS_IMETHOD SetStatus(const nsString &aStatus);
NS_IMETHOD GetStatus(PRUnichar** aResult);
NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
NS_IMETHOD HandleEvent(nsGUIEvent * anEvent);
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURL* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus);
NS_IMETHOD NewWebShell(PRUint32 aChromeMask,
PRBool aVisible,
nsIWebShell *&aNewWebShell);
NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult);
NS_IMETHOD FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken);
// nsINetSupport
NS_IMETHOD_(void) Alert(const nsString &aText);
NS_IMETHOD_(PRBool) Confirm(const nsString &aText);
NS_IMETHOD_(PRBool) Prompt(const nsString &aText,
const nsString &aDefault,
nsString &aResult);
NS_IMETHOD_(PRBool) PromptUserAndPassword(const nsString &aText,
nsString &aUser,
nsString &aPassword);
NS_IMETHOD_(PRBool) PromptPassword(const nsString &aText,
nsString &aPassword);
// nsBrowserWindow
virtual nsresult CreateMenuBar(PRInt32 aWidth);
virtual nsresult CreateToolBar(PRInt32 aWidth);
virtual nsresult CreateStatusBar(PRInt32 aWidth);
// XXX: This method is temporary until javascript event handlers come
// through the content model.
void ExecuteJavaScriptString(nsIWebShell* aWebShell, nsString& aJavaScript);
void Layout(PRInt32 aWidth, PRInt32 aHeight);
void Back();
void Forward();
void GoTo(const PRUnichar* aURL);
void StartThrobber();
void StopThrobber();
void LoadThrobberImages();
void DestroyThrobberImages();
virtual nsEventStatus DispatchMenuItem(PRInt32 aID);
void DoFileOpen();
void DoViewSource();
void DoCopy();
void DoJSConsole();
void DoEditorMode(nsIWebShell* aWebShell);
nsIPresShell* GetPresShell();
void DoFind();
void DoSelectAll();
void DoAppsDialog();
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
NS_IMETHOD ForceRefresh();
// nsIToolbarManager Listener Interface
NS_IMETHOD NotifyToolbarManagerChangedSize(nsIToolbarManager* aToolbarMgr);
// nsIImageButtonListener
NS_IMETHOD NotifyImageButtonEvent(nsIImageButton * aImgBtn, nsGUIEvent* anEvent);
#ifdef NS_DEBUG
void DumpContent(FILE *out = stdout);
void DumpFrames(FILE *out = stdout, nsString *aFilter = nsnull);
void DumpViews(FILE *out = stdout);
void DumpWebShells(FILE *out = stdout);
void DumpStyleSheets(FILE *out = stdout);
void DumpStyleContexts(FILE *out = stdout);
void ToggleFrameBorders();
void ShowContentSize();
void ShowFrameSize();
void ShowStyleSize();
void DoDebugSave();
void DoToggleSelection();
void DoDebugRobot();
nsEventStatus DispatchDebugMenu(PRInt32 aID);
#endif
void DoSiteWalker();
nsEventStatus ProcessDialogEvent(nsGUIEvent *aEvent);
void SetApp(nsViewerApp* aApp) {
mApp = aApp;
}
static void CloseAllWindows();
nsViewerApp* mApp;
nsIXPBaseWindow* mXPDialog;
PRUint32 mChromeMask;
nsString mTitle;
nsIWidget* mWindow;
nsIWebShell* mWebShell;
nsIWidget ** mAppsDialogBtns;
PRInt32 mNumAppsDialogBtns;
nsIWidget ** mMiniAppsBtns;
PRInt32 mNumMiniAppsBtns;
nsIWidget ** mToolbarBtns;
PRInt32 mNumToolbarBtns;
nsIWidget ** mPersonalToolbarBtns;
PRInt32 mNumPersonalToolbarBtns;
// "Toolbar"
nsIToolbarManager * mToolbarMgr;
nsIToolbar * mBtnToolbar;
nsIToolbar * mURLToolbar;
//nsIImageButton* mBack;
//nsIImageButton* mForward;
//nsIImageButton* mReload;
//nsIImageButton* mHome;
//nsIImageButton* mPrint;
//nsIImageButton* mStop;
nsIThrobber* mThrobber;
nsIMenuButton* mBookmarks;
nsIMenuButton* mWhatsRelated;
nsITextWidget* mLocation;
nsIImageButton* mLocationIcon;
// nsIWidget for Buttons
//nsIWidget* mBackWidget;
//nsIWidget* mForwardWidget;
//nsIWidget* mReloadWidget;
//nsIWidget* mHomeWidget;
//nsIWidget* mPrintWidget;
//nsIWidget* mStopWidget;
nsIWidget* mBookmarksWidget;
nsIWidget* mWhatsRelatedWidget;
nsIWidget* mLocationWidget;
nsIWidget* mLocationIconWidget;
// "Status bar"
nsITextWidget * mStatus;
nsIToolbar * mStatusBar;
nsIImageButton * mStatusSecurityLabel;
nsIImageButton * mStatusProcess;
nsIImageButton * mStatusText;
// Mini App Bar (in StatusBar)
nsIToolbar * mStatusAppBar;
nsIImageButton * mMiniTab;
nsIImageButton * mMiniNav;
nsIImageButton * mMiniMail;
nsIImageButton * mMiniAddr;
nsIImageButton * mMiniComp;
nsIWidget * mStatusAppBarWidget;
nsIWidget * mMiniTabWidget;
// Apps Dialog
nsIDialog * mAppsDialog;
// Find Dialog
nsIDialog * mDialog;
nsIButton * mCancelBtn;
nsIButton * mFindBtn;
nsITextWidget * mTextField;
nsICheckButton * mMatchCheckBtn;
nsIRadioButton * mUpRadioBtn;
nsIRadioButton * mDwnRadioBtn;
nsILabel * mLabel;
//for creating more instances
nsIAppShell* mAppShell; //not addref'ed!
nsIPref* mPrefs; //not addref'ed!
PRBool mAllowPlugins;
// Global window collection
static nsVoidArray gBrowsers;
static void AddBrowser(nsBrowserWindow* aBrowser);
static void RemoveBrowser(nsBrowserWindow* aBrowser);
static nsBrowserWindow* FindBrowserFor(nsIWidget* aWidget, PRIntn aWhich);
static nsBrowserWindow* FindBrowserFor(nsIWidget* aWidget);
protected:
nsresult AddToolbarItem(nsIToolbar *aToolbar,
PRInt32 aGap,
PRBool aEnable,
nsIWidget *aButtonWidget);
void UpdateToolbarBtns();
void AddEditor(nsIEditor *); //this function is temporary and WILL be depricated
nsIEditor * mEditor; //this will hold the editor for future commands. we must think about this mjudge
};
// nsViewSourceWindow
//
// Objects of this class are nsBrowserWindows with no chrome and which render the *source*
// for web pages rather than the web pages themselves.
//
// We also override SetTitle to block the nsIWebShell from resetting our nice "Source for..."
// title.
//
// Note that there is no nsViewSourceWindow interface, nor does this class have a CID or
// provide a factory. Deal with it (but seriously, I explain why somewhere).
class nsViewSourceWindow : public nsBrowserWindow {
public:
nsViewSourceWindow( nsIAppShell *anAppShell,
nsIPref *aPrefs,
nsViewerApp *anApp,
const PRUnichar *aURL );
NS_IMETHOD SetTitle( const PRUnichar *aTitle );
};;
// XXX This is bad; because we can't hang a closure off of the event
// callback we have no way to store our This pointer; therefore we
// have to hunt to find the browswer that events belong too!!!
// aWhich for FindBrowserFor
#define FIND_WINDOW 0
#define FIND_BACK 1
#define FIND_FORWARD 2
#define FIND_LOCATION 3
//----------------------------------------------------------------------
/*class nsNativeBrowserWindow : public nsBrowserWindow {
public:
nsNativeBrowserWindow();
~nsNativeBrowserWindow();
virtual nsresult CreateMenuBar(PRInt32 aWidth);
virtual nsEventStatus DispatchMenuItem(PRInt32 aID);
};*/
#endif /* nsBrowserWindow_h___ */

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

@ -1,165 +0,0 @@
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsFindDialog.h"
#include "nsIDOMEvent.h"
#include "nsIXPBaseWindow.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLDocument.h"
static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID);
//-------------------------------------------------------------------------
//
// nsFindDialog constructor
//
//-------------------------------------------------------------------------
//-----------------------------------------------------------------
nsFindDialog::nsFindDialog(nsBrowserWindow * aBrowserWindow) :
mBrowserWindow(aBrowserWindow),
mFindBtn(nsnull),
mCancelBtn(nsnull),
mSearchDown(PR_TRUE)
{
}
//-----------------------------------------------------------------
nsFindDialog::~nsFindDialog()
{
}
//---------------------------------------------------------------
void nsFindDialog::Initialize(nsIXPBaseWindow * aWindow)
{
nsIDOMHTMLDocument *doc = nsnull;
aWindow->GetDocument(doc);
if (nsnull != doc) {
doc->GetElementById("find", &mFindBtn);
doc->GetElementById("cancel", &mCancelBtn);
doc->GetElementById("searchup", &mUpRB);
doc->GetElementById("searchdown", &mDwnRB);
doc->GetElementById("matchcase", &mMatchCaseCB);
// XXX: Register event listening on each dom element. We should change this so
// all DOM events are automatically passed through.
aWindow->AddEventListener(mFindBtn);
aWindow->AddEventListener(mCancelBtn);
aWindow->AddEventListener(mUpRB);
aWindow->AddEventListener(mDwnRB);
SetChecked(mMatchCaseCB, PR_FALSE);
NS_RELEASE(doc);
}
}
//-----------------------------------------------------------------
void nsFindDialog::MouseClick(nsIDOMEvent* aMouseEvent, nsIXPBaseWindow * aWindow)
{
// Event Dispatch. This method should not contain
// anything but calls to methods. This idea is that this dispatch
// mechanism may be replaced by JavaScript EventHandlers which call the idl'ed
// interfaces to perform the same operation that is currently being handled by
// this C++ code.
nsIDOMNode * node;
aMouseEvent->GetTarget(&node);
if (node == mFindBtn) {
DoFind(aWindow);
} else if (node == mCancelBtn) {
DoClose(aWindow);
}
NS_RELEASE(node);
}
//-----------------------------------------------------------------
void nsFindDialog::Destroy(nsIXPBaseWindow * aWindow)
{
// Unregister event listeners that were registered in the
// Initialize here.
// XXX: Should change code in XPBaseWindow to automatically unregister
// all event listening, That way this code will not be necessary.
aWindow->RemoveEventListener(mFindBtn);
aWindow->RemoveEventListener(mCancelBtn);
}
//---------------------------------------------------------------
void
nsFindDialog::DoFind(nsIXPBaseWindow * aWindow)
{
// Now we have the content tree, lets find the
// widgets holding the info.
nsIDOMElement * textNode = nsnull;
nsIDOMHTMLDocument *doc = nsnull;
aWindow->GetDocument(doc);
if (nsnull != doc) {
if (NS_OK == doc->GetElementById("query", &textNode)) {
nsIDOMHTMLInputElement * element;
if (NS_OK == textNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
nsString str;
PRBool foundIt = PR_FALSE;
element->GetValue(str);
PRBool searchDown = IsChecked(mDwnRB);
PRBool matchcase = IsChecked(mMatchCaseCB);
mBrowserWindow->FindNext(str, matchcase, searchDown, foundIt);
if (foundIt) {
mBrowserWindow->ForceRefresh();
}
NS_RELEASE(element);
}
NS_RELEASE(textNode);
}
NS_RELEASE(doc);
}
}
void
nsFindDialog::DoClose(nsIXPBaseWindow * aWindow)
{
aWindow->SetVisible(PR_FALSE);
}
//---------------------------------------------------------------
PRBool
nsFindDialog::IsChecked(nsIDOMElement * aNode)
{
nsIDOMHTMLInputElement * element;
if (NS_OK == aNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
PRBool checked;
element->GetChecked(&checked);
NS_RELEASE(element);
return checked;
}
return PR_FALSE;
}
//---------------------------------------------------------------
void
nsFindDialog::SetChecked(nsIDOMElement * aNode, PRBool aValue)
{
nsIDOMHTMLInputElement * element;
if (NS_OK == aNode->QueryInterface(kIDOMHTMLInputElementIID, (void**) &element)) {
element->SetChecked(aValue);
NS_RELEASE(element);
}
}

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

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsFindDialog_h___
#define nsFindDialog_h___
#include "nsBrowserWindow.h"
#include "nsWindowListener.h"
#include "nsIDOMElement.h"
/**
* Implement Navigator Find Dialog
*/
class nsFindDialog : public nsWindowListener
{
public:
nsFindDialog(nsBrowserWindow * aBrowserWindow);
virtual ~nsFindDialog();
// nsWindowListener Methods
void MouseClick(nsIDOMEvent* aMouseEvent, nsIXPBaseWindow * aWindow);
void Initialize(nsIXPBaseWindow * aWindow);
void Destroy(nsIXPBaseWindow * aWindow);
// new methods
virtual void DoFind(nsIXPBaseWindow * aWindow);
virtual void DoClose(nsIXPBaseWindow * aWindow);
protected:
PRBool IsChecked(nsIDOMElement * aNode);
void SetChecked(nsIDOMElement * aNode, PRBool aValue);
nsBrowserWindow * mBrowserWindow;
nsIDOMElement * mFindBtn;
nsIDOMElement * mCancelBtn;
nsIDOMElement * mUpRB;
nsIDOMElement * mDwnRB;
nsIDOMElement * mMatchCaseCB;
PRBool mSearchDown;
};
#endif /* nsFindDialog_h___ */

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

@ -1,210 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#define NS_IMPL_IDS
#include "nsIPref.h"
#include "nsIComponentManager.h"
#include "nsWidgetsCID.h"
#include "nsGfxCIID.h"
#include "nsViewsCID.h"
#include "nsPluginsCID.h"
#include "nsIBrowserWindow.h"
#include "nsIWebShell.h"
#include "nsIDocumentLoader.h"
#include "nsIThrobber.h"
#include "nsParserCIID.h"
#include "nsDOMCID.h"
#include "nsLayoutCID.h"
#include "nsINetService.h"
#include "nsEditorCID.h"
#ifdef XP_PC
#define WIDGET_DLL "raptorwidget.dll"
#define GFXWIN_DLL "raptorgfxwin.dll"
#define VIEW_DLL "raptorview.dll"
#define WEB_DLL "raptorweb.dll"
#define PLUGIN_DLL "raptorplugin.dll"
#define PREF_DLL "xppref32.dll"
#define PARSER_DLL "raptorhtmlpars.dll"
#define DOM_DLL "jsdom.dll"
#define LAYOUT_DLL "raptorhtml.dll"
#define NETLIB_DLL "netlib.dll"
#define EDITOR_DLL "ender.dll"
#else
#ifdef XP_MAC
#define WIDGET_DLL "WIDGET_DLL"
#define GFXWIN_DLL "GFXWIN_DLL"
#define VIEW_DLL "VIEW_DLL"
#define WEB_DLL "WEB_DLL"
#define PLUGIN_DLL "PLUGIN_DLL"
#define PREF_DLL "PREF_DLL"
#define PARSER_DLL "PARSER_DLL"
#define DOM_DLL "DOM_DLL"
#define LAYOUT_DLL "LAYOUT_DLL"
#define NETLIB_DLL "NETLIB_DLL"
//#define EDITOR_DLL "EDITOR_DLL" // temporary
#else
// XP_UNIX
#ifndef WIDGET_DLL
#define WIDGET_DLL "libwidgetmotif.so"
#endif
#ifndef GFXWIN_DLL
#define GFXWIN_DLL "libgfxmotif.so"
#endif
#define VIEW_DLL "libraptorview.so"
#define WEB_DLL "libraptorwebwidget.so"
#define PLUGIN_DLL "raptorplugin.so"
#define PREF_DLL "libpref.so"
#define PARSER_DLL "libraptorhtmlpars.so"
#define DOM_DLL "libjsdom.so"
#define LAYOUT_DLL "libraptorhtml.so"
#define NETLIB_DLL "libnetlib.so"
#define EDITOR_DLL "libeditor.so"
#endif // XP_MAC
#endif // XP_PC
// Class ID's
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
static NS_DEFINE_IID(kCWindowCID, NS_WINDOW_CID);
static NS_DEFINE_IID(kCDialogCID, NS_DIALOG_CID);
static NS_DEFINE_IID(kCLabelCID, NS_LABEL_CID);
static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_IID(kCToolkitCID, NS_TOOLKIT_CID);
static NS_DEFINE_IID(kCWindowIID, NS_WINDOW_CID);
static NS_DEFINE_IID(kCScrollbarIID, NS_VERTSCROLLBAR_CID);
static NS_DEFINE_IID(kCHScrollbarIID, NS_HORZSCROLLBAR_CID);
static NS_DEFINE_IID(kCButtonCID, NS_BUTTON_CID);
static NS_DEFINE_IID(kCComboBoxCID, NS_COMBOBOX_CID);
static NS_DEFINE_IID(kCListBoxCID, NS_LISTBOX_CID);
static NS_DEFINE_IID(kCRadioButtonCID, NS_RADIOBUTTON_CID);
static NS_DEFINE_IID(kCTextAreaCID, NS_TEXTAREA_CID);
static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID);
static NS_DEFINE_IID(kCCheckButtonIID, NS_CHECKBUTTON_CID);
static NS_DEFINE_IID(kCChildIID, NS_CHILD_CID);
static NS_DEFINE_IID(kCRenderingContextIID, NS_RENDERING_CONTEXT_CID);
static NS_DEFINE_IID(kCDeviceContextIID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID);
static NS_DEFINE_IID(kCRegionIID, NS_REGION_CID);
static NS_DEFINE_IID(kCBlenderIID, NS_BLENDER_CID);
static NS_DEFINE_IID(kCDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID);
static NS_DEFINE_IID(kCDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTORY_CID);
static NS_DEFINE_IID(kCViewManagerCID, NS_VIEW_MANAGER_CID);
static NS_DEFINE_IID(kCViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kCScrollingViewCID, NS_SCROLLING_VIEW_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kCDocumentLoaderCID, NS_DOCUMENTLOADER_CID);
static NS_DEFINE_IID(kThrobberCID, NS_THROBBER_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kCDOMScriptObjectFactory, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static NS_DEFINE_IID(kCDOMNativeObjectRegistry, NS_DOM_NATIVE_OBJECT_REGISTRY_CID);
static NS_DEFINE_IID(kCHTMLDocument, NS_HTMLDOCUMENT_CID);
static NS_DEFINE_IID(kCXMLDocument, NS_XMLDOCUMENT_CID);
static NS_DEFINE_IID(kCImageDocument, NS_IMAGEDOCUMENT_CID);
static NS_DEFINE_IID(kCRangeListCID, NS_RANGELIST_CID);
static NS_DEFINE_IID(kCRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kCHTMLImageElement, NS_HTMLIMAGEELEMENT_CID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
static NS_DEFINE_IID(kCImageButtonCID, NS_IMAGEBUTTON_CID);
static NS_DEFINE_IID(kCToolbarCID, NS_TOOLBAR_CID);
static NS_DEFINE_IID(kCToolbarManagerCID, NS_TOOLBARMANAGER_CID);
static NS_DEFINE_IID(kCToolbarItemHolderCID, NS_TOOLBARITEMHOLDER_CID);
static NS_DEFINE_IID(kCPopUpMenuCID, NS_POPUPMENU_CID);
static NS_DEFINE_IID(kCMenuButtonCID, NS_MENUBUTTON_CID);
static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID);
static NS_DEFINE_IID(kCMenuCID, NS_MENU_CID);
static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID);
static NS_DEFINE_IID(kCEditorCID, NS_EDITOR_CID);
static NS_DEFINE_IID(kCXULCommandCID, NS_XULCOMMAND_CID);
extern "C" void
NS_SetupRegistry()
{
nsComponentManager::RegisterComponent(kLookAndFeelCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCWindowIID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCScrollbarIID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCHScrollbarIID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDialogCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCLabelCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCComboBoxCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCFileWidgetCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCListBoxCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCRadioButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCTextAreaCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCTextFieldCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCCheckButtonIID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCChildIID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCAppShellCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCToolkitCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCRenderingContextIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDeviceContextIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCFontMetricsIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCImageIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCRegionIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCBlenderIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDeviceContextSpecCID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDeviceContextSpecFactoryCID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCViewManagerCID, NULL, NULL, VIEW_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCViewCID, NULL, NULL, VIEW_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCScrollingViewCID, NULL, NULL, VIEW_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kWebShellCID, NULL, NULL, WEB_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDocumentLoaderCID, NULL, NULL, WEB_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kThrobberCID, NULL, NULL, WEB_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kPrefCID, NULL, NULL, PREF_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCPluginHostCID, NULL, NULL, PLUGIN_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCParserCID, NULL, NULL, PARSER_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDOMScriptObjectFactory, NULL, NULL, DOM_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCDOMNativeObjectRegistry, NULL, NULL, DOM_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCHTMLDocument, NULL, NULL, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCXMLDocument, NULL, NULL, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCImageDocument, NULL, NULL, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCRangeListCID, NULL, NULL, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCRangeCID, NULL, NULL, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCHTMLImageElement, NULL, NULL, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kNetServiceCID, NULL, NULL, NETLIB_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCImageButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCToolbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCToolbarManagerCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCToolbarItemHolderCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCPopUpMenuCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCMenuButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCMenuBarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCMenuCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCMenuItemCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kCXULCommandCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE);
#ifndef XP_MAC // temporary
nsComponentManager::RegisterComponent(kCEditorCID, NULL, NULL, EDITOR_DLL, PR_FALSE, PR_FALSE);
#endif // XP_MAC
}

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

@ -1,60 +0,0 @@
#include "xp_mcom.h"
#include "net.h"
#include "xp_linebuf.h"
#include "mkbuf.h"
#ifndef MOZ_USER_DIR
#define MOZ_USER_DIR ".mozilla"
#endif
extern "C" XP_Bool ValidateDocData(MWContext *window_id)
{
printf("ValidateDocData not implemented, stubbed in webshell/tests/viewer/nsStubs.cpp\n");
return PR_TRUE;
}
/* dist/public/xp/xp_linebuf.h */
extern "C" int XP_ReBuffer (const char *net_buffer, int32 net_buffer_size,
uint32 desired_buffer_size,
char **bufferP, uint32 *buffer_sizeP,
uint32 *buffer_fpP,
int32 (*per_buffer_fn) (char *buffer,
uint32 buffer_size,
void *closure),
void *closure)
{
printf("XP_ReBuffer not implemented, stubbed in webshell/tests/viewer/nsStubs.cpp\n");
return(0);
}
/* mozilla/include/xp_trace.h */
extern "C" void XP_Trace( const char *, ... )
{
printf("XP_Trace not implemented, stubbed in webshell/tests/viewer/nsStubs.cpp\n");
}
extern "C" char *fe_GetConfigDir(void) {
char *home = getenv("HOME");
if (home) {
int len = strlen(home);
len += strlen("/") + strlen(MOZ_USER_DIR) + 1;
char* config_dir = (char *)XP_CALLOC(len, sizeof(char));
// we really should use XP_STRN*_SAFE but this is MODULAR_NETLIB
XP_STRCPY(config_dir, home);
XP_STRCAT(config_dir, "/");
XP_STRCAT(config_dir, MOZ_USER_DIR);
return config_dir;
}
return strdup("/tmp");
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsViewerApp_h___
#define nsViewerApp_h___
#include "nsIAppShell.h"
#include "nsString.h"
#include "nsCRT.h"
#include "nsVoidArray.h"
class nsIPref;
//class nsWebCrawler;
class nsBrowserWindow;
class nsIBrowserWindow;
class nsViewerApp : public nsDispatchListener
{
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsViewerApp();
virtual ~nsViewerApp();
// nsISupports
NS_DECL_ISUPPORTS
// nsDispatchListener
virtual void AfterDispatch();
// nsViewerApp
NS_IMETHOD SetupRegistry();
NS_IMETHOD Initialize(int argc, char** argv);
NS_IMETHOD ProcessArguments(int argc, char** argv);
NS_IMETHOD OpenWindow();
NS_IMETHOD OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow);
NS_IMETHOD ViewSourceFor(const PRUnichar* pURL);
NS_IMETHOD CreateRobot(nsBrowserWindow* aWindow);
NS_IMETHOD CreateSiteWalker(nsBrowserWindow* aWindow);
NS_IMETHOD CreateJSConsole(nsBrowserWindow* aWindow);
NS_IMETHOD Exit();
NS_IMETHOD DoPrefs(nsBrowserWindow* aWindow);
NS_IMETHOD Run();
protected:
void Destroy();
nsIAppShell* mAppShell;
nsIPref* mPrefs;
nsString mStartURL;
PRBool mDoPurify;
PRBool mLoadTestFromFile;
//PRBool mCrawl;
nsString mInputFileName;
PRInt32 mNumSamples;
PRInt32 mDelay;
PRInt32 mRepeatCount;
//nsWebCrawler* mCrawler;
PRBool mAllowPlugins;
PRBool mIsInitialized;
};
#endif /* nsViewerApp_h___ */

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

@ -1,887 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsIPref.h"
#include "prmem.h"
#ifdef XP_MAC
#include "nsXPBaseWindow.h"
#define NS_IMPL_IDS
#else
#define NS_IMPL_IDS
#include "nsXPBaseWindow.h"
#endif
#include "nsINetSupport.h"
#include "nsIAppShell.h"
#include "nsIWidget.h"
#include "nsIDOMDocument.h"
#include "nsIURL.h"
#include "nsIComponentManager.h"
#include "nsIFactory.h"
#include "nsCRT.h"
#include "nsWidgetsCID.h"
#include "nsViewerApp.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIDocumentViewer.h"
#include "nsIContentViewer.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsHTMLContentSinkStream.h"
#include "nsIDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsWindowListener.h"
#if defined(WIN32)
#include <strstrea.h>
#else
#include <strstream.h>
#endif
// XXX For font setting below
#include "nsFont.h"
//#include "nsUnitConversion.h"
//#include "nsIDeviceContext.h"
static NS_DEFINE_IID(kXPBaseWindowCID, NS_XPBASE_WINDOW_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID);
static NS_DEFINE_IID(kDialogCID, NS_DIALOG_CID);
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kIDOMHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID);
//----------------------------------------------------------------------
nsXPBaseWindow::nsXPBaseWindow() :
mContentRoot(nsnull),
mPrefs(nsnull),
mAppShell(nsnull),
mDocIsLoaded(PR_FALSE)
{
}
//----------------------------------------------------------------------
nsXPBaseWindow::~nsXPBaseWindow()
{
NS_IF_RELEASE(mContentRoot);
NS_IF_RELEASE(mPrefs);
NS_IF_RELEASE(mAppShell);
}
//----------------------------------------------------------------------
NS_IMPL_ADDREF(nsXPBaseWindow)
NS_IMPL_RELEASE(nsXPBaseWindow)
//----------------------------------------------------------------------
nsresult nsXPBaseWindow::QueryInterface(const nsIID& aIID,
void** aInstancePtrResult)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
*aInstancePtrResult = NULL;
if (aIID.Equals(kIXPBaseWindowIID)) {
*aInstancePtrResult = (void*) ((nsIXPBaseWindow*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIStreamObserverIID)) {
*aInstancePtrResult = (void*) ((nsIStreamObserver*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIWebShellContainerIID)) {
*aInstancePtrResult = (void*) ((nsIWebShellContainer*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kINetSupportIID)) {
*aInstancePtrResult = (void*) ((nsINetSupport*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIDOMMouseListenerIID)) {
NS_ADDREF_THIS(); // Increase reference count for caller
*aInstancePtrResult = (void *)((nsIDOMMouseListener*)this);
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
NS_ADDREF_THIS();
*aInstancePtrResult = (void*) ((nsISupports*)((nsIXPBaseWindow*)this));
return NS_OK;
}
return NS_NOINTERFACE;
}
//----------------------------------------------------------------------
static nsEventStatus PR_CALLBACK
HandleXPDialogEvent(nsGUIEvent *aEvent)
{
nsEventStatus result = nsEventStatus_eIgnore;
nsXPBaseWindow* baseWin;
aEvent->widget->GetClientData(((void*&)baseWin));
if (nsnull != baseWin) {
nsSizeEvent* sizeEvent;
switch(aEvent->message) {
case NS_SIZE:
sizeEvent = (nsSizeEvent*)aEvent;
baseWin->Layout(sizeEvent->windowSize->width,
sizeEvent->windowSize->height);
result = nsEventStatus_eConsumeNoDefault;
break;
case NS_DESTROY: {
//nsViewerApp* app = baseWin->mApp;
result = nsEventStatus_eConsumeDoDefault;
baseWin->Close();
NS_RELEASE(baseWin);
}
return result;
default:
break;
}
//NS_RELEASE(baseWin);
}
return result;
}
//----------------------------------------------------------------------
nsresult nsXPBaseWindow::Init(nsXPBaseWindowType aType,
nsIAppShell* aAppShell,
nsIPref* aPrefs,
const nsString& aDialogURL,
const nsString& aTitle,
const nsRect& aBounds,
PRUint32 aChromeMask,
PRBool aAllowPlugins)
{
mAllowPlugins = aAllowPlugins;
mWindowType = aType;
mAppShell = aAppShell;
NS_IF_ADDREF(mAppShell);
mPrefs = aPrefs;
NS_IF_ADDREF(mPrefs);
// Create top level window
nsresult rv;
if (aType == eXPBaseWindowType_window) {
rv = nsComponentManager::CreateInstance(kWindowCID, nsnull, kIWidgetIID,
(void**)&mWindow);
} else {
rv= nsComponentManager::CreateInstance(kDialogCID, nsnull, kIWidgetIID,
(void**)&mWindow);
}
if (NS_OK != rv) {
return rv;
}
mWindow->SetClientData(this);
nsWidgetInitData initData;
initData.mBorderStyle = eBorderStyle_window;
nsRect r(0, 0, aBounds.width, aBounds.height);
mWindow->Create((nsIWidget*)NULL, r, HandleXPDialogEvent,
nsnull, aAppShell, nsnull, &initData);
mWindow->GetBounds(r);
// Create web shell
rv = nsComponentManager::CreateInstance(kWebShellCID, nsnull,
kIWebShellIID,
(void**)&mWebShell);
if (NS_OK != rv) {
return rv;
}
r.x = r.y = 0;
rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET),
r.x, r.y, r.width, r.height,
nsScrollPreference_kNeverScroll, //nsScrollPreference_kAuto,
aAllowPlugins, PR_FALSE);
mWebShell->SetContainer((nsIWebShellContainer*) this);
mWebShell->SetObserver((nsIStreamObserver*)this);
mWebShell->SetPrefs(aPrefs);
mWebShell->Show();
// Now lay it all out
Layout(r.width, r.height);
// Load URL to Load GUI
mDialogURL = aDialogURL;
LoadURL(mDialogURL);
SetTitle(aTitle);
return NS_OK;
}
//----------------------------------------------------------------------
void nsXPBaseWindow::ForceRefresh()
{
nsIPresShell* shell;
GetPresShell(shell);
if (nsnull != shell) {
nsIViewManager* vm = shell->GetViewManager();
if (nsnull != vm) {
nsIView* root;
vm->GetRootView(root);
if (nsnull != root) {
vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE |
NS_VMREFRESH_AUTO_DOUBLE_BUFFER);
}
NS_RELEASE(vm);
}
NS_RELEASE(shell);
}
}
//----------------------------------------------------------------------
void nsXPBaseWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
{
nsRect rr(0, 0, aWidth, aHeight);
mWebShell->SetBounds(rr.x, rr.y, rr.width, rr.height);
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::SetLocation(PRInt32 aX, PRInt32 aY)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
mWindow->Move(aX, aY);
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::SetDimensions(PRInt32 aWidth, PRInt32 aHeight)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
// XXX We want to do this in one shot
mWindow->Resize(aWidth, aHeight, PR_FALSE);
Layout(aWidth, aHeight);
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::GetBounds(nsRect& aBounds)
{
mWindow->GetBounds(aBounds);
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP
nsXPBaseWindow::GetWindowBounds(nsRect& aBounds)
{
//XXX This needs to be non-client bounds when it exists.
mWindow->GetBounds(aBounds);
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::SetVisible(PRBool aIsVisible)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
mWindow->Show(aIsVisible);
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::Close()
{
if (nsnull != mWindowListener) {
mWindowListener->Destroy(this);
}
if (nsnull != mWebShell) {
mWebShell->Destroy();
NS_RELEASE(mWebShell);
}
if (nsnull != mWindow) {
nsIWidget* w = mWindow;
NS_RELEASE(w);
}
return NS_OK;
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::GetWebShell(nsIWebShell*& aResult)
{
aResult = mWebShell;
NS_IF_ADDREF(mWebShell);
return NS_OK;
}
//---------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::SetTitle(const PRUnichar* aTitle)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
mTitle = aTitle;
nsAutoString newTitle(aTitle);
mWindow->SetTitle(newTitle.GetUnicode());
return NS_OK;
}
//---------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::GetTitle(PRUnichar** aResult)
{
*aResult = mTitle;
return NS_OK;
}
//---------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::LoadURL(const nsString& aURL)
{
mWebShell->LoadURL(aURL);
return NS_OK;
}
//---------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason)
{
return NS_OK;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
return NS_OK;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax)
{
return NS_OK;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus)
{
// Find the Root Conent Node for this Window
nsIPresShell* shell;
GetPresShell(shell);
if (nsnull != shell) {
nsIDocument* doc = shell->GetDocument();
if (nsnull != doc) {
mContentRoot = doc->GetRootContent();
mDocIsLoaded = PR_TRUE;
if (nsnull != mWindowListener) {
mWindowListener->Initialize(this);
}
NS_RELEASE(doc);
}
NS_RELEASE(shell);
}
return NS_OK;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult)
{
aResult = nsnull;
nsString aNameStr(aName);
nsIWebShell *ws;
if (NS_OK == GetWebShell(ws)) {
PRUnichar *name;
if (NS_OK == ws->GetName(&name)) {
if (aNameStr.Equals(name)) {
aResult = ws;
NS_ADDREF(aResult);
return NS_OK;
}
}
}
if (NS_OK == ws->FindChildWithName(aName, aResult)) {
if (nsnull != aResult) {
return NS_OK;
}
}
return NS_OK;
}
NS_IMETHODIMP nsXPBaseWindow::FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken)
{
return NS_OK;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::AddEventListener(nsIDOMNode * aNode)
{
nsIDOMEventReceiver * receiver;
if (NS_OK == aNode->QueryInterface(kIDOMEventReceiverIID, (void**) &receiver)) {
receiver->AddEventListenerByIID((nsIDOMMouseListener*)this, kIDOMMouseListenerIID);
NS_RELEASE(receiver);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::RemoveEventListener(nsIDOMNode * aNode)
{
nsIDOMEventReceiver * receiver;
if (NS_OK == aNode->QueryInterface(kIDOMEventReceiverIID, (void**) &receiver)) {
receiver->RemoveEventListener(this, kIDOMMouseListenerIID);
NS_RELEASE(receiver);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::AddWindowListener(nsWindowListener * aWindowListener)
{
mWindowListener = aWindowListener;
if (mDocIsLoaded && nsnull != mWindowListener) {
mWindowListener->Initialize(this);
}
return NS_OK;
}
//-----------------------------------------------------
// Get the HTML Document
NS_IMETHODIMP nsXPBaseWindow::GetDocument(nsIDOMHTMLDocument *& aDocument)
{
nsIDOMHTMLDocument *htmlDoc = nsnull;
nsIPresShell *shell = nsnull;
GetPresShell(shell);
if (nsnull != shell) {
nsIDocument* doc = shell->GetDocument();
if (nsnull != doc) {
nsresult result = doc->QueryInterface(kIDOMHTMLDocumentIID,(void **)&htmlDoc);
NS_RELEASE(doc);
}
NS_RELEASE(shell);
}
aDocument = htmlDoc;
return NS_OK;
}
//-----------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::NewWebShell(PRUint32 aChromeMask,
PRBool aVisible,
nsIWebShell*& aNewWebShell)
{
nsresult rv = NS_OK;
// Create new window. By default, the refcnt will be 1 because of
// the registration of the browser window in gBrowsers.
nsXPBaseWindow* dialogWindow;
NS_NEWXPCOM(dialogWindow, nsXPBaseWindow);
if (nsnull != dialogWindow) {
nsRect bounds;
GetBounds(bounds);
rv = dialogWindow->Init(mWindowType, mAppShell, mPrefs, mDialogURL, mTitle, bounds, aChromeMask, mAllowPlugins);
if (NS_OK == rv) {
if (aVisible) {
dialogWindow->SetVisible(PR_TRUE);
}
nsIWebShell *shell;
rv = dialogWindow->GetWebShell(shell);
aNewWebShell = shell;
} else {
dialogWindow->Close();
}
} else {
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
}
//----------------------------------------
// Stream observer implementation
NS_IMETHODIMP
nsXPBaseWindow::OnProgress(nsIURL* aURL,
PRUint32 aProgress,
PRUint32 aProgressMax)
{
return NS_OK;
}
//----------------------------------------
NS_IMETHODIMP nsXPBaseWindow::OnStatus(nsIURL* aURL, const PRUnichar* aMsg)
{
return NS_OK;
}
//----------------------------------------
NS_IMETHODIMP nsXPBaseWindow::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
return NS_OK;
}
//----------------------------------------
NS_IMETHODIMP nsXPBaseWindow::OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg)
{
return NS_OK;
}
//----------------------------------------
NS_IMETHODIMP_(void) nsXPBaseWindow::Alert(const nsString &aText)
{
char *str;
str = aText.ToNewCString();
printf("%cBrowser Window Alert: %s\n", '\007', str);
PR_Free(str);
}
//----------------------------------------
NS_IMETHODIMP_(PRBool) nsXPBaseWindow::Confirm(const nsString &aText)
{
char *str;
str = aText.ToNewCString();
printf("%cBrowser Window Confirm: %s (y/n)? \n", '\007', str);
PR_Free(str);
char c;
for (;;) {
c = getchar();
if (tolower(c) == 'y') {
return PR_TRUE;
}
if (tolower(c) == 'n') {
return PR_FALSE;
}
}
}
//----------------------------------------
NS_IMETHODIMP_(PRBool) nsXPBaseWindow::Prompt(const nsString &aText,
const nsString &aDefault,
nsString &aResult)
{
char *str;
char buf[256];
str = aText.ToNewCString();
printf("Browser Window: %s\n", str);
PR_Free(str);
printf("%cPrompt: ", '\007');
scanf("%s", buf);
aResult = buf;
return (aResult.Length() > 0);
}
//----------------------------------------
NS_IMETHODIMP_(PRBool) nsXPBaseWindow::PromptUserAndPassword(const nsString &aText,
nsString &aUser,
nsString &aPassword)
{
char *str;
char buf[256];
str = aText.ToNewCString();
printf("Browser Window: %s\n", str);
PR_Free(str);
printf("%cUser: ", '\007');
scanf("%s", buf);
aUser = buf;
printf("%cPassword: ", '\007');
scanf("%s", buf);
aPassword = buf;
return (aUser.Length() > 0);
}
//----------------------------------------
NS_IMETHODIMP_(PRBool) nsXPBaseWindow::PromptPassword(const nsString &aText,
nsString &aPassword)
{
char *str;
char buf[256];
str = aText.ToNewCString();
printf("Browser Window: %s\n", str);
PR_Free(str);
printf("%cPassword: ", '\007');
scanf("%s", buf);
aPassword = buf;
return PR_TRUE;
}
//----------------------------------------------------------------------
NS_IMETHODIMP nsXPBaseWindow::GetPresShell(nsIPresShell*& aPresShell)
{
aPresShell = nsnull;
nsIPresShell* shell = nsnull;
if (nsnull != mWebShell) {
nsIContentViewer* cv = nsnull;
mWebShell->GetContentViewer(cv);
if (nsnull != cv) {
nsIDocumentViewer* docv = nsnull;
cv->QueryInterface(kIDocumentViewerIID, (void**) &docv);
if (nsnull != docv) {
nsIPresContext* cx;
docv->GetPresContext(cx);
if (nsnull != cx) {
shell = cx->GetShell(); // does an add ref
aPresShell = shell;
NS_RELEASE(cx);
}
NS_RELEASE(docv);
}
NS_RELEASE(cv);
}
}
return NS_OK;
}
//-----------------------------------------------------------------
//-- nsIDOMMouseListener
//-----------------------------------------------------------------
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::HandleEvent(nsIDOMEvent* aEvent)
{
return NS_OK;
}
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::MouseUp(nsIDOMEvent* aMouseEvent)
{
return NS_OK;
}
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::MouseDown(nsIDOMEvent* aMouseEvent)
{
return NS_OK;
}
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::MouseClick(nsIDOMEvent* aMouseEvent)
{
if (nsnull != mWindowListener) {
mWindowListener->MouseClick(aMouseEvent, this);
}
return NS_OK;
}
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::MouseDblClick(nsIDOMEvent* aMouseEvent)
{
return NS_OK;
}
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::MouseOver(nsIDOMEvent* aMouseEvent)
{
return NS_OK;
}
//-----------------------------------------------------------------
nsresult nsXPBaseWindow::MouseOut(nsIDOMEvent* aMouseEvent)
{
return NS_OK;
}
//----------------------------------------------------------------------
// Factory code for creating nsXPBaseWindow's
//----------------------------------------------------------------------
class nsXPBaseWindowFactory : public nsIFactory
{
public:
nsXPBaseWindowFactory();
~nsXPBaseWindowFactory();
// nsISupports methods
NS_IMETHOD QueryInterface(const nsIID &aIID, void **aResult);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
private:
nsrefcnt mRefCnt;
};
//----------------------------------------------------------------------
nsXPBaseWindowFactory::nsXPBaseWindowFactory()
{
mRefCnt = 0;
}
//----------------------------------------------------------------------
nsXPBaseWindowFactory::~nsXPBaseWindowFactory()
{
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
}
//----------------------------------------------------------------------
nsresult
nsXPBaseWindowFactory::QueryInterface(const nsIID &aIID, void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aResult = NULL;
if (aIID.Equals(kISupportsIID)) {
*aResult = (void *)(nsISupports*)this;
} else if (aIID.Equals(kIFactoryIID)) {
*aResult = (void *)(nsIFactory*)this;
}
if (*aResult == NULL) {
return NS_NOINTERFACE;
}
NS_ADDREF_THIS(); // Increase reference count for caller
return NS_OK;
}
//----------------------------------------------------------------------
nsrefcnt
nsXPBaseWindowFactory::AddRef()
{
return ++mRefCnt;
}
//----------------------------------------------------------------------
nsrefcnt
nsXPBaseWindowFactory::Release()
{
if (--mRefCnt == 0) {
delete this;
return 0; // Don't access mRefCnt after deleting!
}
return mRefCnt;
}
//----------------------------------------------------------------------
nsresult
nsXPBaseWindowFactory::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
nsresult rv;
nsXPBaseWindow *inst;
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
if (nsnull != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
goto done;
}
NS_NEWXPCOM(inst, nsXPBaseWindow);
if (inst == NULL) {
rv = NS_ERROR_OUT_OF_MEMORY;
goto done;
}
NS_ADDREF(inst);
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
done:
return rv;
}
//----------------------------------------------------------------------
nsresult
nsXPBaseWindowFactory::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
//----------------------------------------------------------------------
nsresult
NS_NewXPBaseWindowFactory(nsIFactory** aFactory)
{
nsresult rv = NS_OK;
nsXPBaseWindowFactory* inst;
NS_NEWXPCOM(inst, nsXPBaseWindowFactory);
if (nsnull == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
else {
NS_ADDREF(inst);
}
*aFactory = inst;
return rv;
}

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

@ -1,181 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsXPBaseWindow_h___
#define nsXPBaseWindow_h___
#include "nsIXPBaseWindow.h"
#include "nsIStreamListener.h"
#include "nsINetSupport.h"
#include "nsIWebShell.h"
#include "nsIScriptContextOwner.h"
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsCRT.h"
#include "nsIContent.h"
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIDocumentLoaderObserver.h"
#include "nsIDOMMouseListener.h"
class nsViewerApp;
class nsIPresShell;
class nsIPref;
/**
*
*/
class nsXPBaseWindow : public nsIXPBaseWindow,
public nsIStreamObserver,
public nsINetSupport,
public nsIWebShellContainer,
public nsIDOMMouseListener
{
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsXPBaseWindow();
virtual ~nsXPBaseWindow();
// nsISupports
NS_DECL_ISUPPORTS
// nsIBrowserWindow
NS_IMETHOD Init(nsXPBaseWindowType aType,
nsIAppShell* aAppShell,
nsIPref* aPrefs,
const nsString& aDialogURL,
const nsString& aTitle,
const nsRect& aBounds,
PRUint32 aChromeMask,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY);
NS_IMETHOD SetDimensions(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD GetWindowBounds(nsRect& aBounds);
NS_IMETHOD GetBounds(nsRect& aBounds);
NS_IMETHOD SetVisible(PRBool aIsVisible);
NS_IMETHOD Close();
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
NS_IMETHOD GetPresShell(nsIPresShell*& aPresShell);
//NS_IMETHOD HandleEvent(nsGUIEvent * anEvent);
NS_IMETHOD LoadURL(const nsString &aURL);
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURL* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus);
NS_IMETHOD NewWebShell(PRUint32 aChromeMask,
PRBool aVisible,
nsIWebShell *&aNewWebShell);
NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult);
NS_IMETHOD FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken);
// nsINetSupport
NS_IMETHOD_(void) Alert(const nsString &aText);
NS_IMETHOD_(PRBool) Confirm(const nsString &aText);
NS_IMETHOD_(PRBool) Prompt(const nsString &aText,
const nsString &aDefault,
nsString &aResult);
NS_IMETHOD_(PRBool) PromptUserAndPassword(const nsString &aText,
nsString &aUser,
nsString &aPassword);
NS_IMETHOD_(PRBool) PromptPassword(const nsString &aText,
nsString &aPassword);
void Layout(PRInt32 aWidth, PRInt32 aHeight);
void ForceRefresh();
//nsEventStatus ProcessDialogEvent(nsGUIEvent *aEvent);
void SetApp(nsViewerApp* aApp) {
mApp = aApp;
}
// DOM Element & Node Interfaces
NS_IMETHOD GetDocument(nsIDOMHTMLDocument *& aDocument);
NS_IMETHOD AddEventListener(nsIDOMNode * aNode);
NS_IMETHOD RemoveEventListener(nsIDOMNode * aNode);
NS_IMETHOD AddWindowListener(nsWindowListener * aWindowListener);
// nsIDOMEventListener
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
// nsIDOMMouseListener (is derived from nsIDOMEventListener)
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent);
protected:
void GetContentRoot(); //Gets the Root Content node after Doc is loaded
nsIContent * mContentRoot; // Points at the Root Content Node
protected:
nsViewerApp* mApp;
nsString mTitle;
nsString mDialogURL;
nsIWidget* mWindow;
nsIWebShell* mWebShell;
nsWindowListener * mWindowListener; // XXX Someday this will be a list
PRBool mDocIsLoaded;
//for creating more instances
nsIAppShell* mAppShell; //not addref'ed!
nsIPref* mPrefs; //not addref'ed!
PRBool mAllowPlugins;
nsXPBaseWindowType mWindowType;
};
// XXX This is bad; because we can't hang a closure off of the event
// callback we have no way to store our This pointer; therefore we
// have to hunt to find the browswer that events belong too!!!
// aWhich for FindBrowserFor
#define FIND_WINDOW 0
#define FIND_BACK 1
#define FIND_FORWARD 2
#define FIND_LOCATION 3
#endif /* nsXPBaseWindow_h___ */

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

@ -1,94 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef resources_h___
#define resources_h___
#define VIEWER_OPEN 40000
#define VIEWER_EXIT 40002
#define PREVIEW_CLOSE 40003
#define VIEWER_WINDOW_OPEN 40009
#define VIEWER_FILE_OPEN 40010
// Note: must be in ascending sequential order
#define VIEWER_DEMO0 40011
#define VIEWER_DEMO1 40012
#define VIEWER_DEMO2 40013
#define VIEWER_DEMO3 40014
#define VIEWER_DEMO4 40015
#define VIEWER_DEMO5 40016
#define VIEWER_DEMO6 40017
#define VIEWER_DEMO7 40018
#define VIEWER_DEMO8 40019
#define VIEWER_DEMO9 40020
#define VIEWER_VISUAL_DEBUGGING 40021
#define VIEWER_REFLOW_TEST 40022
#define VIEWER_DUMP_CONTENT 40023
#define VIEWER_DUMP_FRAMES 40024
#define VIEWER_DUMP_VIEWS 40025
#define VIEWER_DUMP_STYLE_SHEETS 40026
#define VIEWER_DUMP_STYLE_CONTEXTS 40027
#define VIEWER_DEBUGROBOT 40028
#define VIEWER_SHOW_CONTENT_SIZE 40029
#define VIEWER_SHOW_FRAME_SIZE 40030
#define VIEWER_SHOW_STYLE_SIZE 40031
#define VIEWER_DEBUGSAVE 40032
#define VIEWER_SHOW_CONTENT_QUALITY 40033
#define VIEWER_TOGGLE_SELECTION 40034
// Note: must be in ascending sequential order
#define VIEWER_ONE_COLUMN 40040
#define VIEWER_TWO_COLUMN 40041
#define VIEWER_THREE_COLUMN 40042
#define JS_CONSOLE 40100
#define EDITOR_MODE 40120
#define VIEWER_EDIT_CUT 40201
#define VIEWER_EDIT_COPY 40202
#define VIEWER_EDIT_PASTE 40203
#define VIEWER_EDIT_SELECTALL 40204
#define VIEWER_EDIT_FINDINPAGE 40205
#define VIEWER_RL_BASE 41000
#define VIEWER_TOP100 40300
/* Debug Robot dialog setup */
#define IDD_DEBUGROBOT 101
#define IDC_UPDATE_DISPLAY 40301
#define IDC_VERIFICATION_DIRECTORY 40302
#define IDC_PAGE_LOADS 40303
#define IDC_STATIC -1
#define IDD_SITEWALKER 200
#define ID_SITE_PREVIOUS 40400
#define ID_SITE_NEXT 40401
#define IDC_SITE_NAME 40402
#define ID_EXIT 40404
#define VIEWER_FILE_VIEW_SOURCE 40500
#define VIEWER_COMM_NAV 40600
#endif /* resources_h___ */

Двоичные данные
xpfe/xpviewer/src/retro_n.ico

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 766 B

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

@ -1,186 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "resources.h"
#include "jsconsres.h"
#include <winres.h>
1 ICON "retro_n.ico"
#if 0
VIEWER MENU DISCARDABLE
{
POPUP "&File"
{
MENUITEM "&New Window", VIEWER_WINDOW_OPEN
MENUITEM "&Open...", VIEWER_FILE_OPEN
POPUP "&Samples"
{
MENUITEM "demo #0", VIEWER_DEMO0
MENUITEM "demo #1", VIEWER_DEMO1
MENUITEM "demo #2", VIEWER_DEMO2
MENUITEM "demo #3", VIEWER_DEMO3
MENUITEM "demo #4", VIEWER_DEMO4
MENUITEM "demo #5", VIEWER_DEMO5
MENUITEM "demo #6", VIEWER_DEMO6
MENUITEM "demo #7", VIEWER_DEMO7
MENUITEM "demo #8", VIEWER_DEMO8
MENUITEM "demo #9", VIEWER_DEMO9
}
MENUITEM "&Test Sites", VIEWER_TOP100
POPUP "Print &Preview"
{
MENUITEM "One Column", VIEWER_ONE_COLUMN
MENUITEM "Two Column", VIEWER_TWO_COLUMN
MENUITEM "Three Column", VIEWER_THREE_COLUMN
}
MENUITEM "&Exit", VIEWER_EXIT
}
POPUP "&Edit"
BEGIN
MENUITEM "Cu&t", VIEWER_EDIT_CUT, GRAYED
MENUITEM "&Copy", VIEWER_EDIT_COPY
MENUITEM "&Paste", VIEWER_EDIT_PASTE, GRAYED
MENUITEM SEPARATOR
MENUITEM "Select &All", VIEWER_EDIT_SELECTALL, HELP
MENUITEM SEPARATOR
MENUITEM "&Find in Page", VIEWER_EDIT_FINDINPAGE
END
POPUP "&Debug"
{
MENUITEM "&Visual Debugging", VIEWER_VISUAL_DEBUGGING
MENUITEM "&Reflow Test", VIEWER_REFLOW_TEST
MENUITEM SEPARATOR
MENUITEM "Dump &Content", VIEWER_DUMP_CONTENT
MENUITEM "Dump &Frames", VIEWER_DUMP_FRAMES
MENUITEM "Dump &Views", VIEWER_DUMP_VIEWS
MENUITEM SEPARATOR
MENUITEM "Dump &Style Sheets", VIEWER_DUMP_STYLE_SHEETS
MENUITEM "Dump &Style Contexts", VIEWER_DUMP_STYLE_CONTEXTS
MENUITEM SEPARATOR
MENUITEM "Show Content Size", VIEWER_SHOW_CONTENT_SIZE
MENUITEM "Show Frame Size", VIEWER_SHOW_FRAME_SIZE
MENUITEM "Show Style Size", VIEWER_SHOW_STYLE_SIZE
MENUITEM SEPARATOR
MENUITEM "Debug Save", VIEWER_DEBUGSAVE
MENUITEM "Debug Toggle Selection", VIEWER_TOGGLE_SELECTION
MENUITEM SEPARATOR
MENUITEM "Debu&g Robot", VIEWER_DEBUGROBOT
MENUITEM SEPARATOR
MENUITEM "Show Content Quality", VIEWER_SHOW_CONTENT_QUALITY
}
POPUP "&Tools"
{
MENUITEM "&JavaScript Console", JS_CONSOLE
MENUITEM "&Editor Mode", EDITOR_MODE
}
POPUP "&Related Links"
{
MENUITEM SEPARATOR
}
}
PRINTPREVIEW MENU DISCARDABLE
{
POPUP "&File"
{
MENUITEM "&Close", PREVIEW_CLOSE
}
POPUP "&Debug"
{
MENUITEM "&Visual Debugging", VIEWER_VISUAL_DEBUGGING
MENUITEM SEPARATOR
MENUITEM "Dump &Content", VIEWER_DUMP_CONTENT
MENUITEM "Dump &Frames", VIEWER_DUMP_FRAMES
MENUITEM "Dump &Views", VIEWER_DUMP_VIEWS
MENUITEM SEPARATOR
MENUITEM "Dump &Style Sheets", VIEWER_DUMP_STYLE_SHEETS
MENUITEM "Dump &Style Contexts", VIEWER_DUMP_STYLE_CONTEXTS
}
}
JSCONSOLE_MENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New", ID_FILENEW
MENUITEM "&Open...", ID_FILEOPEN
MENUITEM "&Save", ID_FILESAVE
MENUITEM "Save &As...", ID_FILESAVEAS
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILEEXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Undo", ID_EDITUNDO
MENUITEM SEPARATOR
MENUITEM "Cu&t", ID_EDITCUT
MENUITEM "&Copy", ID_EDITCOPY
MENUITEM "&Paste", ID_EDITPASTE
MENUITEM "De&lete", ID_EDITDELETE
MENUITEM SEPARATOR
MENUITEM "Select &All", ID_EDITSELECTALL
END
POPUP "&Commands"
BEGIN
MENUITEM "&Evaluate All\tF5", ID_COMMANDSEVALALL
MENUITEM "Evaluate &Selection\tF10", ID_COMMANDSEVALSEL
MENUITEM SEPARATOR
MENUITEM "&Inspector", ID_COMMANDSINSPECTOR
END
POPUP "&Help"
BEGIN
MENUITEM "No Help Available", ID_NOHELP
END
END
ACCELERATOR_TABLE ACCELERATORS
BEGIN
VK_F5, ID_COMMANDSEVALALL, VIRTKEY
VK_F10, ID_COMMANDSEVALSEL, VIRTKEY
END
IDD_DEBUGROBOT DIALOG DISCARDABLE 0, 0, 246, 84
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debug Robot Options"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "&Start",IDOK,67,57,50,14
PUSHBUTTON "&Cancel",IDCANCEL,127,57,50,14
CONTROL "&Update Display (Visual)",IDC_UPDATE_DISPLAY,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
EDITTEXT IDC_VERIFICATION_DIRECTORY,77,19,159,14,ES_AUTOHSCROLL
EDITTEXT IDC_PAGE_LOADS,41,36,40,14,ES_AUTOHSCROLL
LTEXT "&Verification Directory",IDC_STATIC,7,21,70,8
LTEXT "&Stop after",IDC_STATIC,7,38,32,8
LTEXT "page loads",IDC_STATIC,84,38,36,8
END
IDD_SITEWALKER DIALOG DISCARDABLE 0, 0, 283, 90
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Top 100 Site Walker"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "<< &Previous",ID_SITE_PREVIOUS,55,53,50,14
DEFPUSHBUTTON ">> &Next",ID_SITE_NEXT,116,53,50,14
LTEXT "Site:",IDC_STATIC,20,25,24,8
LTEXT "",IDC_SITE_NAME,50,25,209,8
PUSHBUTTON "&Exit",ID_EXIT,177,53,50,14
END
#endif