Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsViewerApp.cpp File Reference
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsXPBaseWindow.h"
#include "nsViewerApp.h"
#include "nsBrowserWindow.h"
#include "nsWidgetsCID.h"
#include "nsWindowCreator.h"
#include "nsIAppShell.h"
#include "nsIPref.h"
#include "nsIWindowWatcher.h"
#include "nsIFormProcessor.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
#include "nsIFactory.h"
#include "nsIEventQueueService.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsWebCrawler.h"
#include "prprf.h"
#include "plstr.h"
#include "prenv.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsGUIEvent.h"
#include "nsStaticComponents.h"
#include "nsICheckButton.h"
#include "nsILabel.h"
#include "nsIButton.h"
#include "nsITextWidget.h"
#include "nsILookAndFeel.h"
#include "nsColor.h"
#include "nsWidgetSupport.h"
#include "nsFont.h"
#include "nsUnitConversion.h"
#include "nsIDeviceContext.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsISupportsObsolete.h"
#include "nsNetCID.h"
#include "nsICookieService.h"
#include "resources.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIURL.h"

Go to the source code of this file.

Defines

#define DIALOG_FONT   "Helvetica"
#define DIALOG_FONT_SIZE   10
#define DEFAULT_WIDTH   620
#define DEFAULT_HEIGHT   400
#define _MAX_PATH   512
#define DEBUG_EMPTY   "(none)"

Functions

nsresult NS_NewXPBaseWindowFactory (nsIFactory **aFactory)
static NS_DEFINE_IID (kAppShellCID, NS_APPSHELL_CID)
static NS_DEFINE_IID (kXPBaseWindowCID, NS_XPBASE_WINDOW_CID)
static NS_DEFINE_IID (kCookieServiceCID, NS_COOKIESERVICE_CID)
static NS_DEFINE_IID (kIAppShellIID, NS_IAPPSHELL_IID)
static NS_DEFINE_IID (kISupportsIID, NS_ISUPPORTS_IID)
static NS_DEFINE_CID (kFormProcessorCID, NS_FORMPROCESSOR_CID)
static void PrintHelpInfo (char **argv)
static void AddTestDocsFromFile (nsWebCrawler *aCrawler, const nsString &aFileName)
static NS_DEFINE_IID (kLookAndFeelCID, NS_LOOKANDFEEL_CID)
static NS_DEFINE_IID (kButtonCID, NS_BUTTON_CID)
static NS_DEFINE_IID (kTextFieldCID, NS_TEXTFIELD_CID)
static NS_DEFINE_IID (kWindowCID, NS_WINDOW_CID)
static NS_DEFINE_IID (kCheckButtonCID, NS_CHECKBUTTON_CID)
static NS_DEFINE_IID (kLabelCID, NS_LABEL_CID)
static NS_DEFINE_IID (kIButtonIID, NS_IBUTTON_IID)
static NS_DEFINE_IID (kITextWidgetIID, NS_ITEXTWIDGET_IID)
static NS_DEFINE_IID (kIWidgetIID, NS_IWIDGET_IID)
static NS_DEFINE_IID (kICheckButtonIID, NS_ICHECKBUTTON_IID)
static NS_DEFINE_IID (kILabelIID, NS_ILABEL_IID)
static voidGetWidgetNativeData (nsISupports *aObject)
static nsEventStatus PR_CALLBACK HandleRobotEvent (nsGUIEvent *aEvent)
 

HandleRobotEvent


static PRBool CreateRobotDialog (nsIWidget *aParent)
static nsEventStatus PR_CALLBACK HandleSiteEvent (nsGUIEvent *aEvent)
 

HandleSiteEvent


static PRBool CreateSiteDialog (nsIWidget *aParent)

Variables

nsStaticModuleInfo const *const kPStaticModules = nsnull
PRUint32 const kStaticModuleCount = 0
static PRInt32 gDebugRobotLoads = 5000
static char gVerifyDir [_MAX_PATH]
static PRBool gVisualDebug = PR_TRUE
static nsIWidgetmRobotDialog = nsnull
static nsIButtonmCancelBtn
static nsIButtonmStartBtn
static nsITextWidgetmVerDirTxt
static nsITextWidgetmStopAfterTxt
static nsICheckButtonmUpdateChkBtn
static nsIWidgetmSiteDialog = nsnull
static nsIButtonmSiteCancelBtn
static nsIButtonmSitePrevBtn
static nsIButtonmSiteNextBtn
static nsILabelmSiteLabel
static nsIButtonmSiteJumpBtn
static nsITextWidgetmSiteIndexTxt
static nsBrowserWindowgWinData
static int gTop100Pointer = 0
static int gTop100LastPointer = 0
static const char *const gTop100List []

Define Documentation

#define _MAX_PATH   512

Definition at line 695 of file nsViewerApp.cpp.

#define DEBUG_EMPTY   "(none)"

Definition at line 699 of file nsViewerApp.cpp.

Definition at line 131 of file nsViewerApp.cpp.

#define DEFAULT_WIDTH   620

Definition at line 130 of file nsViewerApp.cpp.

#define DIALOG_FONT   "Helvetica"

Definition at line 105 of file nsViewerApp.cpp.

Definition at line 106 of file nsViewerApp.cpp.


Function Documentation

static void AddTestDocsFromFile ( nsWebCrawler aCrawler,
const nsString aFileName 
) [static]

Definition at line 336 of file nsViewerApp.cpp.

{
  NS_LossyConvertUCS2toASCII cfn(aFileName);
#if defined(XP_WIN) || defined(XP_OS2)
  FILE* fp = fopen(cfn.get(), "rb");
#else
  FILE* fp = fopen(cfn.get(), "r");
#endif

  if (nsnull==fp)
  {
    fprintf(stderr, "Input file not found: %s\n", cfn.get());
    exit (-1);
  }
  nsAutoString line;
  for (;;) {
    char linebuf[2000];
    char* cp = fgets(linebuf, sizeof(linebuf), fp);
    if (nsnull == cp) {
      break;
    }
    if (linebuf[0] == '#') {
      continue;
    }

    // strip crlf's from the line
    int len = strlen(linebuf);
    if (0 != len) {
      if (('\n' == linebuf[len-1]) || ('\r' == linebuf[len-1])) {
        linebuf[--len] = 0;
      }
    }
    if (0 != len) {
      if (('\n' == linebuf[len-1]) || ('\r' == linebuf[len-1])) {
        linebuf[--len] = 0;
      }
    }

    // Add non-empty lines to the test list
    if (0 != len) {
      line.AssignWithConversion(linebuf);
      aCrawler->AddURL(line);
    }
  }

  fclose(fp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool CreateRobotDialog ( nsIWidget aParent) [static]

Definition at line 847 of file nsViewerApp.cpp.

{
  PRBool result = PR_TRUE;

  if (mRobotDialog != nsnull) {
    NS_ShowWidget(mRobotDialog,PR_TRUE);
    NS_SetFocusToWidget(mStartBtn);
    return PR_TRUE;
  }

   nsILabel * label;

  nsIDeviceContext* dc = aParent->GetDeviceContext();
  float t2d;
  t2d = dc->TwipsToDevUnits();
  nsFont font(DIALOG_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
              NS_FONT_WEIGHT_NORMAL, 0,
              nscoord(t2d * NSIntPointsToTwips(DIALOG_FONT_SIZE)));
  NS_RELEASE(dc);

  nscoord dialogWidth = 375;
  // create a Dialog
  //
  nsRect rect;
  rect.SetRect(0, 0, dialogWidth, 162);  

  CallCreateInstance(kWindowCID, &mRobotDialog);
  if (nsnull == mRobotDialog)
       return PR_FALSE;

  nsIWidget* dialogWidget = nsnull;
  if (NS_OK == mRobotDialog->QueryInterface(kIWidgetIID,(void**)&dialogWidget))
  {
    dialogWidget->Create(aParent, rect, HandleRobotEvent, NULL);
    NS_RELEASE(dialogWidget);
  }
  
  //mRobotDialog->SetLabel("Debug Robot Options");

  nscoord txtHeight   = 24;
  nscolor textBGColor = NS_RGB(255,255,255);
  nscolor textFGColor = NS_RGB(255,255,255);

  {
    nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);
    if (lookAndFeel) {
      lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);
      lookAndFeel->GetColor(nsILookAndFeel::eColor_TextBackground, textBGColor);
      lookAndFeel->GetColor(nsILookAndFeel::eColor_TextForeground, textFGColor);
    }
  }
  
  nscoord w  = 65;
  nscoord x  = 5;
  nscoord y  = 10;

  // Create Update CheckButton
  rect.SetRect(x, y, 150, 24);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewCheckButton(&mUpdateChkBtn);
#else
  CallCreateInstance(kCheckButtonCID, &mUpdateChkBtn);
#endif
  NS_CreateCheckButton(mRobotDialog, mUpdateChkBtn,rect,HandleRobotEvent,&font);
  mUpdateChkBtn->SetLabel(NS_ConvertASCIItoUCS2("Update Display (Visual)"));
  mUpdateChkBtn->SetState(PR_TRUE);
  y += 24 + 2;

  // Create Label
  w = 115;
  rect.SetRect(x, y+3, w, 24);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewLabel(&label);
#else
  CallCreateInstance(kLabelCID, &label);
#endif
  NS_CreateLabel(mRobotDialog,label,rect,HandleRobotEvent,&font);
  label->SetAlignment(eAlign_Right);
  label->SetLabel(NS_ConvertASCIItoUCS2("Verfication Directory:"));
  x += w + 1;

  // Create TextField
  nsIWidget* widget = nsnull;
  rect.SetRect(x, y, 225, txtHeight);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewTextWidget(&mVerDirTxt);
#else
  CallCreateInstance(kTextFieldCID, &mVerDirTxt);
#endif
  NS_CreateTextWidget(mRobotDialog,mVerDirTxt,rect,HandleRobotEvent,&font);
  if (mVerDirTxt && NS_OK == mVerDirTxt->QueryInterface(kIWidgetIID,(void**)&widget))
  {
    widget->SetBackgroundColor(textBGColor);
    widget->SetForegroundColor(textFGColor);
  }
  nsString str; str.AssignWithConversion(DEBUG_EMPTY);
  PRUint32 size;
  mVerDirTxt->SetText(str,size);

  y += txtHeight + 2;
  
  x = 5;
  w = 55;
  rect.SetRect(x, y+4, w, 24);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewLabel(&label);
#else
  CallCreateInstance(kLabelCID, &label);
#endif
  NS_CreateLabel(mRobotDialog,label,rect,HandleRobotEvent,&font);
  label->SetAlignment(eAlign_Right);
  label->SetLabel(NS_ConvertASCIItoUCS2("Stop after:"));
  x += w + 2;

  // Create TextField
  rect.SetRect(x, y, 75, txtHeight);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewTextWidget(&mStopAfterTxt);
#else
  CallCreateInstance(kTextFieldCID, &mStopAfterTxt);
#endif
  NS_CreateTextWidget(mRobotDialog,mStopAfterTxt,rect,HandleRobotEvent,&font);
  if (mStopAfterTxt && NS_OK == mStopAfterTxt->QueryInterface(kIWidgetIID,(void**)&widget))
  {
    widget->SetBackgroundColor(textBGColor);
    widget->SetForegroundColor(textFGColor);
    mStopAfterTxt->SetText(NS_ConvertASCIItoUCS2("5000"),size);
  }
  x += 75 + 2;

  w = 75;
  rect.SetRect(x, y+4, w, 24);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewLabel(&label);
#else
  CallCreateInstance(kLabelCID, &label);
#endif
  NS_CreateLabel(mRobotDialog,label,rect,HandleRobotEvent,&font);
  label->SetAlignment(eAlign_Left);
  label->SetLabel(NS_ConvertASCIItoUCS2("(page loads)"));
  y += txtHeight + 2;
  

  y += 10;
  w = 75;
  nscoord xx = (dialogWidth - (2*w)) / 3;
  // Create Find Start Button
  rect.SetRect(xx, y, w, 24);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewButton(&mStartBtn);
#else
  CallCreateInstance(kButtonCID, &mStartBtn);
#endif
  NS_CreateButton(mRobotDialog,mStartBtn,rect,HandleRobotEvent,&font);
  mStartBtn->SetLabel(NS_ConvertASCIItoUCS2("Start"));
  
  xx += w + xx;
  // Create Cancel Button
  rect.SetRect(xx, y, w, 24);  
#ifdef USE_LOCAL_WIDGETS
  NS_NewButton(&mCancelBtn);
#else
  CallCreateInstance(kButtonCID, &mCancelBtn);
#endif
  NS_CreateButton(mRobotDialog,mCancelBtn,rect,HandleRobotEvent,&font);
  mCancelBtn->SetLabel(NS_ConvertASCIItoUCS2("Cancel"));
  
  NS_ShowWidget(mRobotDialog,PR_TRUE);
  NS_SetFocusToWidget(mStartBtn);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool CreateSiteDialog ( nsIWidget aParent) [static]

Definition at line 1287 of file nsViewerApp.cpp.

{
  // Dynamically find the index of the last pointer
  gTop100LastPointer = 0;
  const char * p;
  do {
    p = gTop100List[gTop100LastPointer++];
  } while (p);
  gTop100LastPointer--;

  PRBool result = PR_TRUE;

  if (mSiteDialog == nsnull) {

    nsILabel * label;

    nsIDeviceContext* dc = aParent->GetDeviceContext();
    float t2d;
    t2d = dc->TwipsToDevUnits();
    nsFont font(DIALOG_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
                NS_FONT_WEIGHT_NORMAL, 0,
                nscoord(t2d * NSIntPointsToTwips(DIALOG_FONT_SIZE)));
    NS_RELEASE(dc);

    nscoord dialogWidth = 375;
    // create a Dialog
    //
    nsRect rect;
    rect.SetRect(0, 0, dialogWidth, 125+24+10);  

    nsIWidget* widget = nsnull;
    CallCreateInstance(kWindowCID, &mSiteDialog);
    if (nsnull == mSiteDialog)
      return PR_FALSE;
    
    if (NS_OK == mSiteDialog->QueryInterface(kIWidgetIID,(void**)&widget))
    {
      widget->Create((nsIWidget *) nsnull, rect, HandleSiteEvent, NULL);
      //mSiteDialog->SetLabel("Top 100 Site Walker");
    }
    //mSiteDialog->SetClientData(this);
    nsAutoString titleStr(NS_LITERAL_STRING("Top "));
    titleStr.AppendInt(gTop100LastPointer);
    titleStr.AppendLiteral(" Sites");
    mSiteDialog->SetTitle(titleStr);

    nscoord w  = 65;
    nscoord x  = 5;
    nscoord y  = 10;

    // Create Label
    w = 50;
    rect.SetRect(x, y+3, w, 24);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewLabel(&label);
#else
    CallCreateInstance(kLabelCID, &label);
#endif
    NS_CreateLabel(mSiteDialog,label,rect,HandleSiteEvent,&font);
    label->SetAlignment(eAlign_Right);
    label->SetLabel(NS_ConvertASCIItoUCS2("Site:"));
    x += w + 1;

    w = 250;
    rect.SetRect(x, y+3, w, 24);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewLabel(&mSiteLabel);
#else
   CallCreateInstance(kLabelCID, &mSiteLabel);
#endif
    NS_CreateLabel(mSiteDialog,mSiteLabel,rect,HandleSiteEvent,&font);
    mSiteLabel->SetAlignment(eAlign_Left);
    mSiteLabel->SetLabel(EmptyString());

    y += 34;
    w = 75;
    nscoord spacing = (dialogWidth - (3*w)) / 4;
    x = spacing;
    // Create Previous Button
    rect.SetRect(x, y, w, 24);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewButton(&mSitePrevBtn);
#else
    CallCreateInstance(kButtonCID, &mSitePrevBtn);
#endif
    NS_CreateButton(mSiteDialog,mSitePrevBtn,rect,HandleSiteEvent,&font);
    mSitePrevBtn->SetLabel(NS_ConvertASCIItoUCS2("<< Previous"));
    x += spacing + w;

    // Create Next Button
    rect.SetRect(x, y, w, 24);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewButton(&mSiteNextBtn);
#else
    CallCreateInstance(kButtonCID, &mSiteNextBtn);
#endif
    NS_CreateButton(mSiteDialog,mSiteNextBtn,rect,HandleSiteEvent,&font);
    mSiteNextBtn->SetLabel(NS_ConvertASCIItoUCS2("Next >>"));
    x += spacing + w;
  
    // Create Cancel Button
    rect.SetRect(x, y, w, 24);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewButton(&mSiteCancelBtn);
#else
    CallCreateInstance(kButtonCID, &mSiteCancelBtn);
#endif
    NS_CreateButton(mSiteDialog,mSiteCancelBtn,rect,HandleSiteEvent,&font);
    mSiteCancelBtn->SetLabel(NS_ConvertASCIItoUCS2("Cancel"));

    w  = 65;
    x  = spacing;
    y  += 24 + 10;

    nscoord txtHeight   = 24;
    nscolor textBGColor = NS_RGB(255,255,255);
    nscolor textFGColor = NS_RGB(255,255,255);

    {
      nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);
      if (lookAndFeel) {
        lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);
        lookAndFeel->GetColor(nsILookAndFeel::eColor_TextBackground, textBGColor);
        lookAndFeel->GetColor(nsILookAndFeel::eColor_TextForeground, textFGColor);
      }
    }

    // Create TextField
    rect.SetRect(x, y, w, txtHeight);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewTextWidget(&mSiteIndexTxt);
#else
    CallCreateInstance(kTextFieldCID, &mSiteIndexTxt);
#endif
    NS_CreateTextWidget(mSiteDialog,mSiteIndexTxt,rect,HandleSiteEvent,&font);
    if (mVerDirTxt && NS_OK == mSiteIndexTxt->QueryInterface(kIWidgetIID,(void**)&widget)) {
      widget->SetBackgroundColor(textBGColor);
      widget->SetForegroundColor(textFGColor);
    }

    nsString str;
    str.AppendInt(0);
    PRUint32 size;
    mSiteIndexTxt->SetText(str,size);

    x += spacing + w;
    w = 100;
    // Create Jump Button
    rect.SetRect(x, y, w, 24);  
#ifdef USE_LOCAL_WIDGETS
    NS_NewButton(&mSiteJumpBtn);
#else
    CallCreateInstance(kButtonCID, &mSiteJumpBtn);
#endif
    NS_CreateButton(mSiteDialog,mSiteJumpBtn,rect,HandleSiteEvent,&font);
    mSiteJumpBtn->SetLabel(NS_ConvertASCIItoUCS2("Jump to Index"));
  }


  NS_ShowWidget(mSiteDialog,PR_TRUE);
  NS_SetFocusToWidget(mSiteNextBtn);

  // Init
  NS_EnableWidget(mSitePrevBtn,PR_FALSE);
 
  if (gWinData) {
    nsString urlStr; urlStr.AssignWithConversion(gTop100List[gTop100Pointer]);
    gWinData->GoTo(urlStr.get());
    mSiteLabel->SetLabel(urlStr);
  }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void* GetWidgetNativeData ( nsISupports *  aObject) [static]

Definition at line 736 of file nsViewerApp.cpp.

{
       void*                result = nsnull;
       nsIWidget*    widget;
       if (NS_OK == aObject->QueryInterface(kIWidgetIID,(void**)&widget))
       {
              result = widget->GetNativeData(NS_NATIVE_WIDGET);
              NS_RELEASE(widget);
       }
       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsEventStatus PR_CALLBACK HandleRobotEvent ( nsGUIEvent aEvent) [static]


HandleRobotEvent

Definition at line 785 of file nsViewerApp.cpp.

{
  nsEventStatus result = nsEventStatus_eIgnore;
  if (aEvent == nsnull ||  aEvent->widget == nsnull) {
    return result;
  }

  switch(aEvent->message) {
    case NS_MOUSE_LEFT_BUTTON_UP: {
      if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mCancelBtn)) {
        NS_ShowWidget(mRobotDialog,PR_FALSE);
      } else if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mStartBtn)) {

        nsString str;
        PRUint32 size;

        mStopAfterTxt->GetText(str, 255, size);
        char * cStr = ToNewCString(str);
        sscanf(cStr, "%d", &gDebugRobotLoads);
        if (gDebugRobotLoads <= 0) {
          gDebugRobotLoads = 5000;
        }
        delete[] cStr;

        mVerDirTxt->GetText(str, 255, size);
        str.ToCString(gVerifyDir, (PRInt32)_MAX_PATH);
        if (!strcmp(gVerifyDir,DEBUG_EMPTY)) {
          gVerifyDir[0] = '\0';
        }
        PRBool state = PR_FALSE;
        mUpdateChkBtn->GetState(state);
        gVisualDebug = state ? PR_TRUE: PR_FALSE;

      } 

      } break;
    
    case NS_PAINT: 
#ifndef XP_UNIX
        // paint the background
        if (aEvent->widget == mRobotDialog ) {
          nsIRenderingContext *drawCtx = ((nsPaintEvent*)aEvent)->renderingContext;
          drawCtx->SetColor(aEvent->widget->GetBackgroundColor());
          drawCtx->FillRect(*(((nsPaintEvent*)aEvent)->rect));

          return nsEventStatus_eIgnore;
      }
#endif
      return nsEventStatus_eIgnore;
      break;

    default:
      result = nsEventStatus_eIgnore;
  } //switch

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsEventStatus PR_CALLBACK HandleSiteEvent ( nsGUIEvent aEvent) [static]


HandleSiteEvent

Definition at line 1200 of file nsViewerApp.cpp.

{
  nsEventStatus result = nsEventStatus_eIgnore;
  if (aEvent == nsnull || aEvent->widget == nsnull) {
    return result;
  }

  switch(aEvent->message) {

    case NS_MOUSE_LEFT_BUTTON_UP: {
      if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mSiteCancelBtn)) {
        NS_ShowWidget(mSiteDialog,PR_FALSE);

      } else if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mSiteIndexTxt)) {
        // no op

      } else {

        PRInt32 oldIndex = gTop100Pointer;

        if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mSitePrevBtn)) {
          gTop100Pointer--;
        } else if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mSiteNextBtn)) {
          gTop100Pointer++;
        } else {
          nsString str;
          PRUint32 size;
          PRInt32  inx;

          mSiteIndexTxt->GetText(str, 255, size);
          char * cStr = ToNewCString(str);
          sscanf(cStr, "%d", &inx);
          if (inx >= 0 && inx < gTop100LastPointer) {
            gTop100Pointer = inx;
          }
          delete[] cStr;
        }

        PRBool loadPage = PR_FALSE;
        if (gTop100Pointer < 0) {
          gTop100Pointer = 0;
        } else if (gTop100Pointer >= gTop100LastPointer) {
          gTop100Pointer = gTop100LastPointer-1;
        } else {
          loadPage = PR_TRUE;
        }

        NS_EnableWidget(mSitePrevBtn, gTop100Pointer > 0);
        NS_EnableWidget(mSiteNextBtn, gTop100Pointer < (gTop100LastPointer-1));

        if (gWinData && loadPage && oldIndex != gTop100Pointer) {
          nsString urlStr; urlStr.AssignWithConversion(gTop100List[gTop100Pointer]);
          mSiteLabel->SetLabel(urlStr);
          gWinData->GoTo(urlStr.get());
        }

        nsAutoString str;
        str.AppendInt(gTop100Pointer);
        PRUint32 size;
        mSiteIndexTxt->SetText(str, size);
      }
      } break;
      
      case NS_PAINT: 
#ifndef XP_UNIX
        // paint the background
        if (aEvent->widget->GetNativeData(NS_NATIVE_WIDGET) == GetWidgetNativeData(mSiteDialog) ) {
            nsIRenderingContext *drawCtx = ((nsPaintEvent*)aEvent)->renderingContext;
            drawCtx->SetColor(aEvent->widget->GetBackgroundColor());
            drawCtx->FillRect(*(((nsPaintEvent*)aEvent)->rect));

            return nsEventStatus_eIgnore;
        }
#endif
      break;

      default:
        result = nsEventStatus_eIgnore;
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kFormProcessorCID  ,
NS_FORMPROCESSOR_CID   
) [static]
static NS_DEFINE_IID ( kAppShellCID  ,
NS_APPSHELL_CID   
) [static]
static NS_DEFINE_IID ( kXPBaseWindowCID  ,
NS_XPBASE_WINDOW_CID   
) [static]
static NS_DEFINE_IID ( kCookieServiceCID  ,
NS_COOKIESERVICE_CID   
) [static]
static NS_DEFINE_IID ( kIAppShellIID  ,
NS_IAPPSHELL_IID   
) [static]
static NS_DEFINE_IID ( kISupportsIID  ,
NS_ISUPPORTS_IID   
) [static]
static NS_DEFINE_IID ( kLookAndFeelCID  ,
NS_LOOKANDFEEL_CID   
) [static]
static NS_DEFINE_IID ( kButtonCID  ,
NS_BUTTON_CID   
) [static]
static NS_DEFINE_IID ( kTextFieldCID  ,
NS_TEXTFIELD_CID   
) [static]
static NS_DEFINE_IID ( kWindowCID  ,
NS_WINDOW_CID   
) [static]
static NS_DEFINE_IID ( kCheckButtonCID  ,
NS_CHECKBUTTON_CID   
) [static]
static NS_DEFINE_IID ( kLabelCID  ,
NS_LABEL_CID   
) [static]
static NS_DEFINE_IID ( kIButtonIID  ,
NS_IBUTTON_IID   
) [static]
static NS_DEFINE_IID ( kITextWidgetIID  ,
NS_ITEXTWIDGET_IID   
) [static]
static NS_DEFINE_IID ( kIWidgetIID  ,
NS_IWIDGET_IID   
) [static]
static NS_DEFINE_IID ( kICheckButtonIID  ,
NS_ICHECKBUTTON_IID   
) [static]
static NS_DEFINE_IID ( kILabelIID  ,
NS_ILABEL_IID   
) [static]

Definition at line 598 of file nsXPBaseWindow.cpp.

{
  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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void PrintHelpInfo ( char **  argv) [static]

Definition at line 306 of file nsViewerApp.cpp.

{
  fprintf(stderr, "Usage: %s [options] [starting url]\n", argv[0]);
  fprintf(stderr, "-M -- measure (and show) page load time\n");
  fprintf(stderr, "-p[#]   -- autload tests 0-#\n");
  fprintf(stderr, "-q -- jiggles window width after page has autoloaded\n");
  fprintf(stderr, "-f filename -- read a list of URLs to autoload from <filename>\n");
  fprintf(stderr, "-d # -- set the delay between autoloads to # (in milliseconds)\n");
  fprintf(stderr, "-np -- no plugins\n");
  fprintf(stderr, "-v -- verbose (debug noise)\n");
  fprintf(stderr, "-r # -- how many times a page is loaded when autoloading\n");
  fprintf(stderr, "-o dirname -- create an output file for the frame dump of each page\n  and put it in <dirname>. <dirname> must include the trailing\n  <slash> character appropriate for your OS\n");
  fprintf(stderr, "-rd dirname -- specify a regression directory whose contents are from\n  a previous -o run to compare against with this run\n");
  fprintf(stderr, "-regnostyle -- exclude style data from the regression test output: valid only with -o and -rd\n");
  fprintf(stderr, "-h # -- the initial height of the viewer window\n");
  fprintf(stderr, "-w # -- the initial width of the viewer window\n");
  fprintf(stderr, "-C -- enable crawler\n");
  fprintf(stderr, "-R filename -- record pages crawled to in <filename>\n");
  fprintf(stderr, "-S domain -- add a domain/host that is safe to crawl (e.g. www.netscape.com)\n");
  fprintf(stderr, "-A domain -- add a domain/host that should be avoided (e.g. microsoft.com)\n");
  fprintf(stderr, "-N pages -- set the max # of pages to crawl\n");
  fprintf(stderr, "-x -- startup and just shutdown to test for leaks under Purify\n");
  fprintf(stderr, "-Prt -- number of the printer test 1=regression, no printout \n");
  fprintf(stderr, "-B -- Setting for regression output 1=brief, 2=verbose \n");
#if defined(NS_DEBUG) && defined(XP_WIN)
  fprintf(stderr, "-md # -- set the crt debug flags to #\n");
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

PRInt32 gDebugRobotLoads = 5000 [static]

Definition at line 700 of file nsViewerApp.cpp.

int gTop100LastPointer = 0 [static]

Definition at line 1060 of file nsViewerApp.cpp.

const char* const gTop100List[] [static]

Definition at line 1061 of file nsViewerApp.cpp.

int gTop100Pointer = 0 [static]

Definition at line 1059 of file nsViewerApp.cpp.

char gVerifyDir[_MAX_PATH] [static]

Definition at line 701 of file nsViewerApp.cpp.

Definition at line 702 of file nsViewerApp.cpp.

Definition at line 1058 of file nsViewerApp.cpp.

Definition at line 203 of file nsViewerApp.cpp.

Definition at line 204 of file nsViewerApp.cpp.

nsIButton* mCancelBtn [static]

Definition at line 706 of file nsViewerApp.cpp.

Definition at line 705 of file nsViewerApp.cpp.

Definition at line 714 of file nsViewerApp.cpp.

Definition at line 713 of file nsViewerApp.cpp.

Definition at line 719 of file nsViewerApp.cpp.

Definition at line 718 of file nsViewerApp.cpp.

nsILabel* mSiteLabel [static]

Definition at line 717 of file nsViewerApp.cpp.

Definition at line 716 of file nsViewerApp.cpp.

Definition at line 715 of file nsViewerApp.cpp.

nsIButton* mStartBtn [static]

Definition at line 707 of file nsViewerApp.cpp.

Definition at line 709 of file nsViewerApp.cpp.

Definition at line 710 of file nsViewerApp.cpp.

Definition at line 708 of file nsViewerApp.cpp.