Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsPhMain.cpp File Reference
#include "nsViewerApp.h"
#include "nsBrowserWindow.h"
#include "nsWidgetsCID.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIMenuBar.h"
#include "nsIMenu.h"
#include "nsIMenuItem.h"
#include "nsIThread.h"
#include <stdlib.h>
#include <signal.h>
#include "plevent.h"
#include "resources.h"
#include <photon/Pg.h>
#include <Pt.h>

Go to the source code of this file.


#define PRINTF   printf


char * strsignal (int)
void CreateViewerMenus (PtWidget_t *, void *)
void abnormal_exit_handler (int signum)
int main (int argc, char **argv)
 The Xalan testcases app.


static nsNativeViewerAppgTheApp

Define Documentation

Definition at line 59 of file nsPhMain.cpp.

Function Documentation

Definition at line 136 of file nsPhMain.cpp.

  /* Free any shared memory that has been allocated */

#if 1
  if (    (signum == SIGSEGV)
       || (signum == SIGILL)
          || (signum == SIGABRT)
    printf("prog = viewer\npid = %d\nsignal = %s\n", getpid(), strsignal(signum));

#if 0
    printf("stack logged to someplace\n");
    printf("need to fix xpcom/base/nsTraceRefCnt.cpp in WalkTheStack.\n");

    printf("Sleeping for 5 minutes.\n");
    printf("Type 'gdb viewer %d' to attach your debugger to this thread.\n", getpid());
    printf("Done sleeping...\n");


Here is the call graph for this function:

Here is the caller graph for this function:

void CreateViewerMenus ( PtWidget_t *  ,

Definition at line 146 of file nsPhMenu.cpp.

  PtArg_t     arg[10];
  PtWidget_t  *menu, *submenu, *submenu2;

//printf("Entering CreateViewerMenus menubar=<%p>\n", menubar);

  menu = CreateTopLevelMenu(menubar, "File");
  CreateMenuItem(menu, "New Window",VIEWER_WINDOW_OPEN);
  CreateMenuItem(menu, "Open",VIEWER_FILE_OPEN);
  CreateMenuItem(menu, "View Source",VIEW_SOURCE);

  submenu=CreateSubMenu(menu, "Samples");

struct MenuList_s {
 char     *Label;
 PRUint32 Command;

struct MenuList_s DemoList[18] = 
  {"#0 Basic Styles", VIEWER_DEMO0},
  {"#1 CSS Styles", VIEWER_DEMO1},
  {"#2 Images", VIEWER_DEMO2},
  {"#3 Basic Tables", VIEWER_DEMO3},
  {"#4 Sample Tables", VIEWER_DEMO4},
  {"#5 More Styles", VIEWER_DEMO5},
  {"#6 Deeply Nested Tables", VIEWER_DEMO6},
  {"#7 Scaled Anim Image", VIEWER_DEMO7},
  {"#8 Form", VIEWER_DEMO8},
  {"#9 Frames", VIEWER_DEMO9},
  {"#10 Anim Images", VIEWER_DEMO10},
  {"#11 Fixed Positioning", VIEWER_DEMO11},
  {"#12 More Fixed Pos", VIEWER_DEMO12},
  {"#13 DHTML", VIEWER_DEMO13},
  {"#14 XML Sorting", VIEWER_DEMO14},
  {"#15 XML IRS", VIEWER_DEMO15},
  {"#16 Gfx Widgets", VIEWER_DEMO16},
  {"#17 <Empty>", VIEWER_DEMO17}

  for(int i=0; i<=17; i++)
    CreateMenuItem(submenu, DemoList[i].Label,DemoList[i].Command);

  CreateMenuItem(menu, "Test Sites", VIEWER_TOP100);
  submenu=CreateSubMenu(menu, "XPToolkit Tests");
  CreateMenuItem(submenu, "Toolbar Test 1", VIEWER_XPTOOLKITTOOLBAR1);
  CreateMenuItem(submenu, "Tree Test 2", VIEWER_XPTOOLKITTREE1);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Print Preview", VIEWER_ONE_COLUMN);
  CreateMenuItem(menu, "Print", VIEWER_PRINT);
  CreateMenuItem(menu, "Print Setup", VIEWER_PRINT_SETUP);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Exit", VIEWER_EXIT);

  menu = CreateTopLevelMenu(menubar, "Edit");
  CreateMenuItem(menu, "Cut", VIEWER_EDIT_CUT);
  CreateMenuItem(menu, "Copy", VIEWER_EDIT_COPY);
  CreateMenuItem(menu, "Paste", VIEWER_EDIT_PASTE);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Select All", VIEWER_EDIT_SELECTALL);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Find in Page", VIEWER_EDIT_FINDINPAGE);
//#ifdef DEBUG 
  menu = CreateTopLevelMenu(menubar, "Debug");
  CreateMenuItem(menu, "Visual Debugging", VIEWER_VISUAL_DEBUGGING);
  CreateMenuItem(menu, NULL, 0);
  submenu=CreateSubMenu(menu, "Event Debugging");
  CreateMenuItem(submenu, "Toggle Paint Flashing", VIEWER_TOGGLE_PAINT_FLASHING);
  CreateMenuItem(submenu, "Toggle Paint Dumpinging", VIEWER_TOGGLE_PAINT_DUMPING);
  CreateMenuItem(submenu, "Toggle Invalidate Dumping", VIEWER_TOGGLE_INVALIDATE_DUMPING);
  CreateMenuItem(submenu, "Toggle Event Dumping", VIEWER_TOGGLE_EVENT_DUMPING);
  CreateMenuItem(submenu, NULL, 0);
  CreateMenuItem(submenu, "Toggle Motion Event Dumping", VIEWER_TOGGLE_MOTION_EVENT_DUMPING);
  CreateMenuItem(submenu, "Toggle Crossing Event Dumpinging", VIEWER_TOGGLE_CROSSING_EVENT_DUMPING);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Reflow Test", VIEWER_REFLOW_TEST);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Dump Content", VIEWER_DUMP_CONTENT);
  CreateMenuItem(menu, "Dump Frames", VIEWER_DUMP_FRAMES);
  CreateMenuItem(menu, "Dump Views", VIEWER_DUMP_VIEWS);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Dump Style Sheets", VIEWER_DUMP_STYLE_SHEETS);
  CreateMenuItem(menu, "Dump Style Contexts", VIEWER_DUMP_STYLE_CONTEXTS);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Debug Save", VIEWER_DEBUGSAVE);
  CreateMenuItem(menu, "Debug Output Text", VIEWER_DISPLAYTEXT);
  CreateMenuItem(menu, "Debug Output HTML", VIEWER_DISPLAYHTML);
  CreateMenuItem(menu, "Debug Toggle Selection", VIEWER_TOGGLE_SELECTION);
  CreateMenuItem(menu, NULL, 0);
  CreateMenuItem(menu, "Debug Robot", VIEWER_DEBUGROBOT);
  CreateMenuItem(menu, NULL, 0);
  submenu=CreateSubMenu(menu, "Style");
  submenu2=CreateSubMenu(submenu, "Select Style Sheet");
  CreateMenuItem(submenu2, "List Available Sheets", VIEWER_SELECT_STYLE_LIST);
  CreateMenuItem(submenu2, NULL, 0);
  CreateMenuItem(submenu2, "Select Default", VIEWER_SELECT_STYLE_DEFAULT);
  CreateMenuItem(submenu2, NULL, 0);
  CreateMenuItem(submenu2, "Select Alternative 1", VIEWER_SELECT_STYLE_ONE);
  CreateMenuItem(submenu2, "Select Alternative 2", VIEWER_SELECT_STYLE_TWO);
  CreateMenuItem(submenu2, "Select Alternative 3", VIEWER_SELECT_STYLE_THREE);
  CreateMenuItem(submenu2, "Select Alternative 4", VIEWER_SELECT_STYLE_FOUR);
  submenu2=CreateSubMenu(submenu, "Compatibility Mode");
  CreateMenuItem(submenu2, "Use DTD", VIEWER_USE_DTD_MODE);
  CreateMenuItem(submenu2, "Nav Quirks", VIEWER_NAV_QUIRKS_MODE);
  CreateMenuItem(submenu2, "Standard", VIEWER_STANDARD_MODE);
  submenu2=CreateSubMenu(submenu, "Widget Render Mode");
  CreateMenuItem(submenu2, "Native", VIEWER_NATIVE_WIDGET_MODE); 
  CreateMenuItem(submenu2, "Gfx", VIEWER_GFX_WIDGET_MODE); 

  menu = CreateTopLevelMenu(menubar, "Tools");
  CreateMenuItem(menu, "JavaScript Console", JS_CONSOLE);
  CreateMenuItem(menu, "Editor Mode", EDITOR_MODE);

Here is the call graph for this function:

int main ( int  argc,
char **  argv 

The Xalan testcases app.

Definition at line 166 of file nsPhMain.cpp.


  /* I need this to free shared memory in case of a crash */
  signal(SIGTERM, abnormal_exit_handler);
  signal(SIGQUIT, abnormal_exit_handler);
  signal(SIGINT,  abnormal_exit_handler);
  signal(SIGHUP,  abnormal_exit_handler);
  signal(SIGSEGV, abnormal_exit_handler);
  signal(SIGILL,  abnormal_exit_handler);
  signal(SIGABRT, abnormal_exit_handler);

  // Initialize XPCOM
  nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
  if (NS_SUCCEEDED(rv)) {
    // The toolkit service in mozilla will look in the environment
    // to determine which toolkit to use.  Yes, it is a dumb hack to
    // force it here, but we have no choice because of toolkit specific
    // code linked into the viewer.
    gTheApp = new nsNativeViewerApp();
    gTheApp->Initialize(argc, argv);
    delete gTheApp;

    // Shutdown XPCOM
    rv = NS_ShutdownXPCOM(nsnull);
    NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
  return 0;

Here is the call graph for this function:

char* strsignal ( int  )

Here is the caller graph for this function:

Variable Documentation

Definition at line 61 of file nsPhMain.cpp.