Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
MRJConsole.cpp File Reference
#include <Appearance.h>
#include <Gestalt.h>
#include <string.h>
#include "MRJConsole.h"
#include "MRJPlugin.h"
#include "MRJSession.h"
#include "TopLevelFrame.h"
#include "nsIPluginManager2.h"

Go to the source code of this file.

Functions

static OSStatus requestFrame (JMAWTContextRef contextRef, JMFrameRef frameRef, JMFrameKind kind, const Rect *initialBounds, Boolean resizeable, JMFrameCallbacks *cb)
static OSStatus releaseFrame (JMAWTContextRef contextRef, JMFrameRef frameRef)
static SInt16 getUniqueMenuID (JMAWTContextRef contextRef, Boolean isSubmenu)
static Boolean appearanceManagerExists ()
static OSStatus JMTextToStr255 (JMTextRef textRef, Str255 str)
int min (int x, int y)
static void push (StringPtr dest, StringPtr str)
static void exceptionOccurred (JMAWTContextRef context, JMTextRef exceptionName, JMTextRef exceptionMsg, JMTextRef stackTrace)

Variables

nsIPluginManager2thePluginManager2
MRJConsoletheConsole = NULL

Function Documentation

static Boolean appearanceManagerExists ( ) [static]

Definition at line 300 of file MRJConsole.cpp.

{
       long response = 0;
       return (Gestalt(gestaltAppearanceAttr, &response) == noErr && (response & (1 << gestaltAppearanceExists)));
}

Here is the caller graph for this function:

static void exceptionOccurred ( JMAWTContextRef  context,
JMTextRef  exceptionName,
JMTextRef  exceptionMsg,
JMTextRef  stackTrace 
) [static]

Definition at line 325 of file MRJConsole.cpp.

{
       // why not display this using the Appearance Manager's wizzy new alert?
       if (appearanceManagerExists()) {
              OSStatus status;
              Str255 preason = { '\0' }, pmessage = { '\0'}, ptrace = { '\0' };
              if (exceptionName != NULL) {
                     status = ::JMTextToStr255(exceptionName, preason);
                     if (exceptionMsg != NULL) {
                            status = ::JMTextToStr255(exceptionMsg, pmessage);
                            push(preason, "\p (");
                            push(preason, pmessage);
                            push(preason, "\p)");
                     }
              }
              
              if (stackTrace != NULL)
                     status = ::JMTextToStr255(stackTrace, ptrace);
              
              SInt16 itemHit = 0;
              OSErr result = ::StandardAlert(kAlertPlainAlert, preason, ptrace, NULL, &itemHit);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static SInt16 getUniqueMenuID ( JMAWTContextRef  contextRef,
Boolean  isSubmenu 
) [static]

Definition at line 288 of file MRJConsole.cpp.

{
       MRJConsole* thisConsole = NULL;
       OSStatus status = ::JMGetAWTContextData(contextRef, (JMClientData*)&thisConsole);
       if (thePluginManager2 != NULL) {
              PRInt16 menuID;
              if (thePluginManager2->AllocateMenuID(thisConsole, isSubmenu, &menuID) == NS_OK)
                     return menuID;
       }
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static OSStatus JMTextToStr255 ( JMTextRef  textRef,
Str255  str 
) [static]

Definition at line 306 of file MRJConsole.cpp.

{
       UInt32 length = 0;
       OSStatus status = JMGetTextBytes(textRef, kTextEncodingMacRoman, &str[1], sizeof(Str255) - 1, &length);
       if (status == noErr)
              str[0] = (unsigned char)(status == noErr ? length : 0);
       return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int min ( int  x,
int  y 
) [inline]

Definition at line 315 of file MRJConsole.cpp.

{ return (x <= y ? x : y); }
static void push ( StringPtr  dest,
StringPtr  str 
) [static]

Definition at line 317 of file MRJConsole.cpp.

{
       int length = dest[0];
       int newLength = min(255, length + str[0]);
       if (newLength > length)
              ::BlockMoveData(&str[1], &dest[1] + length, newLength - length);
}

Here is the caller graph for this function:

static OSStatus releaseFrame ( JMAWTContextRef  contextRef,
JMFrameRef  frameRef 
) [static]

Definition at line 274 of file MRJConsole.cpp.

{
       MRJConsole* thisConsole = NULL;
       OSStatus status = ::JMGetAWTContextData(contextRef, (JMClientData*)&thisConsole);
       MRJFrame* thisFrame = NULL;
       status = ::JMGetFrameData(frameRef, (JMClientData*)&thisFrame);
       if (thisFrame != NULL) {
              status = ::JMSetFrameData(frameRef, NULL);
              thisConsole->setFrame(NULL);
              delete thisFrame;
       }
       return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static OSStatus requestFrame ( JMAWTContextRef  contextRef,
JMFrameRef  frameRef,
JMFrameKind  kind,
const Rect *  initialBounds,
Boolean  resizeable,
JMFrameCallbacks *  cb 
) [static]

Definition at line 256 of file MRJConsole.cpp.

{
       extern JMFrameCallbacks theFrameCallbacks;
       // set up the viewer frame's callbacks.
       BlockMoveData(&theFrameCallbacks, cb, sizeof(theFrameCallbacks));

       MRJConsole* thisConsole = NULL;
       OSStatus status = ::JMGetAWTContextData(contextRef, (JMClientData*)&thisConsole);
       if (status == noErr && thePluginManager2 != NULL) {
              // Can only do this safely if we are using the new API.
              TopLevelFrame* frame = new TopLevelFrame(thisConsole, frameRef, kind, initialBounds, resizeable);
              status = ::JMSetFrameData(frameRef, frame);
              thisConsole->setFrame(frame);
       }
       return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 59 of file MRJConsole.cpp.

Definition at line 74 of file MRJPlugin.cpp.