diff --git a/mozilla/cmd/macfe/Composer/CColorPopup.cp b/mozilla/cmd/macfe/Composer/CColorPopup.cp deleted file mode 100644 index c47864ffd2f..00000000000 --- a/mozilla/cmd/macfe/Composer/CColorPopup.cp +++ /dev/null @@ -1,802 +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. - */ - -// =========================================================================== -// CColorPopup.cp -// =========================================================================== - -#include "CColorPopup.h" -#include "UGraphicGizmos.h" -#include "UGraphicsUtilities.h" -#include "CTargetedUpdateMenuRegistry.h" -#include "CEditView.h" // constant for menu string resource -#include "edt.h" // EDT calls -#include "prefapi.h" -#include "StSetBroadcasting.h" -#include "CBrowserContext.h" // MWContext - - -// prototypes -pascal void -colorPopupMDEFProc( short message, MenuHandle theMenu, - Rect *menuRect, Point hitPt, short *whichItem ); - -// functionality - -static -void -colorPopupGetBox( Rect *menuRect, Rect *itemBox, short numItems, short theItem ) -{ - Rect box; - - SetRect( itemBox, 0, 0, 0, 0 ); - if ( theItem <= numItems ) - { - if ( theItem == CColorPopup::CURRENT_COLOR_ITEM ) - { - box.bottom = menuRect->bottom - CColorPopup::COLOR_FRAME_BORDER; - box.top = box.bottom - CColorPopup::COLOR_BOX_HEIGHT; - box.left = menuRect->left + CColorPopup::COLOR_FRAME_BORDER; - box.right = box.left + CColorPopup::COLOR_BOX_HEIGHT; - } - else if ( theItem == CColorPopup::DEFAULT_COLOR_ITEM ) - { - box.bottom = menuRect->bottom - CColorPopup::COLOR_FRAME_BORDER - - CColorPopup::COLOR_BOX_HEIGHT; - box.top = box.bottom - CColorPopup::COLOR_BOX_HEIGHT; - box.left = menuRect->left + CColorPopup::COLOR_FRAME_BORDER; - box.right = box.left + CColorPopup::COLOR_BOX_HEIGHT; - } - else if ( theItem == CColorPopup::LAST_COLOR_PICKED_ITEM ) - { - box.top = menuRect->top + CColorPopup::COLOR_FRAME_BORDER; - box.bottom = box.top + CColorPopup::COLOR_BOX_HEIGHT; - box.left = menuRect->left + CColorPopup::COLOR_FRAME_BORDER; - box.right = box.left + CColorPopup::COLOR_BOX_HEIGHT; - } - else - { - box.top = menuRect->top /* + CColorPopup::COLOR_FRAME_BORDER */ + CColorPopup::COLOR_HEX_DISPLAY_SIZE; - box.left = menuRect->left + CColorPopup::COLOR_FRAME_BORDER; - box.bottom = box.top + CColorPopup::COLOR_BOX_HEIGHT; - box.right = box.left + CColorPopup::COLOR_BOX_WIDTH; - - while ( --theItem > 1 ) // 1 is # menuItems preceding color chip matrix - { - OffsetRect( &box, CColorPopup::COLOR_BOX_WIDTH, 0 ); - if ( box.left >= menuRect->right - CColorPopup::COLOR_FRAME_BORDER ) - { - box.left = menuRect->left + CColorPopup::COLOR_FRAME_BORDER; - box.right = box.left + CColorPopup::COLOR_BOX_WIDTH; - OffsetRect( &box, 0, CColorPopup::COLOR_BOX_HEIGHT ); - } - } - } - *itemBox = box; - } -} - - -static -Boolean -colorPopupParseColor( Str255 menuStr, RGBColor *theColor ) -{ - Boolean foundColorFlag = false; - unsigned short part; - short loop; - - theColor->red = theColor->green = theColor->blue = 0; - for ( loop = 1; loop <= (unsigned)menuStr[ 0 ] - 6; ++loop ) - { - if ( menuStr[0] > 1 - && ( menuStr[ loop ] == CColorPopup::COLOR_CHIP_CHAR - || menuStr[ loop ] == CColorPopup::LAST_COLOR_PICKED_CHAR - || menuStr[ loop ] == CColorPopup::DEFAULT_COLOR_CHAR - || menuStr[ loop ] == CColorPopup::CURRENT_COLOR_CHAR ) ) - { - // Converting from ASCII to Hex - // This is BAD code... - - part = menuStr[ loop + 1 ] - '0'; - if ( part > 9 ) - part = menuStr[ loop + 1 ] - 'A' + 10; - theColor->red = part << 4; - part = menuStr[ loop + 2 ] - '0'; - if ( part > 9 ) - part = menuStr[ loop + 2 ] - 'A' + 10; - theColor->red |= part; - theColor->red = theColor->red << 8; - - part = menuStr[ loop + 3 ] - '0'; - if ( part > 9 ) - part = menuStr[ loop + 3 ] - 'A' + 10; - theColor->green = part << 4; - part = menuStr[ loop + 4 ] - '0'; - if ( part > 9 ) - part = menuStr[ loop + 4 ] - 'A' + 10; - theColor->green |= part; - theColor->green = theColor->green << 8; - - part = menuStr[ loop + 5 ] - '0'; - if ( part > 9 ) - part = menuStr[ loop + 5 ] - 'A' + 10; - theColor->blue = part << 4; - part = menuStr[ loop + 6 ] - '0'; - if ( part > 9 ) - part = menuStr[ loop + 6 ] - 'A' + 10; - theColor->blue |= part; - theColor->blue = theColor->blue << 8; - - foundColorFlag = true; - break; - } - } - - return foundColorFlag; -} - - -static -void -colorPopupDrawBox( MenuHandle theMenu, Rect *menuRect, short numItems ) -{ - Boolean wildcardFlag; - CIconHandle cicnHandle; - RGBColor theColor; - const RGBColor black = {0,0,0}, white = {0xFFFF,0xFFFF,0xFFFF}; - Rect box; - Str255 menuStr; - short theItem; - - for ( theItem = 1; theItem <= numItems; ++theItem ) - { - menuStr[ 0 ] = 0; - GetMenuItemText( theMenu, theItem, menuStr ); - wildcardFlag = ((menuStr[0] == 0x01 && menuStr[1] == CColorPopup::COLOR_PICKER_CHAR)) ? true : false; - - colorPopupGetBox( menuRect, &box, numItems, theItem ); - - // text (if any) - int stringNum; - switch ( menuStr[1] ) - { - default: stringNum = 0; break; - case CColorPopup::LAST_COLOR_PICKED_CHAR: stringNum = 20; break; - case CColorPopup::DEFAULT_COLOR_CHAR: stringNum = 21; break; - case CColorPopup::CURRENT_COLOR_CHAR: stringNum = 22; break; - } - - if ( stringNum ) - { - Point baseLinePoint; - baseLinePoint.v = box.top + CColorPopup::COLOR_BOX_HEIGHT - 4; - baseLinePoint.h = box.right + CColorPopup::COLOR_FRAME_BORDER; - - Str255 menuItemStr; - menuItemStr[ 0 ] = 0; - ::GetIndString( menuItemStr, CEditView::STRPOUND_EDITOR_MENUS, stringNum ); - ::RGBBackColor( &white ); - ::RGBForeColor( &black ); - ::MoveTo( baseLinePoint.h, baseLinePoint.v ); - ::DrawString( menuItemStr ); - } - - // draw color chip - if ( (true == wildcardFlag ) || (colorPopupParseColor( menuStr, &theColor ) == true)) - { - ::InsetRect( &box, 1, 1 ); - ::RGBForeColor( &black ); - ::MoveTo( box.left, box.bottom - 1 ); - ::LineTo( box.left, box.top ); - ::LineTo( box.right - 1, box.top ); -#ifdef THREE_D_EFFECT_ON_COLOR_POPUP - ::RGBForeColor( &white ); -#endif - ::LineTo( box.right - 1, box.bottom - 1 ); - ::LineTo( box.left, box.bottom - 1 ); - - if ( true == wildcardFlag ) - { - RGBForeColor( &black ); - if ( (cicnHandle = GetCIcon(11685)) != NULL ) - { - // don't scale, plot into same size rect - Rect r = (**cicnHandle).iconPMap.bounds; - box.bottom = box.top + r.bottom - r.top; - box.right = box.left + r.right - r.left; - - ::PlotCIcon( &box, cicnHandle ); - ::DisposeCIcon( cicnHandle ); - } - } - else - { - InsetRect( &box, 1, 1 ); - RGBForeColor( &theColor ); - PaintRect( &box ); - - ::RGBForeColor( &black ); - box.left += ( box.right-box.left ) / 2; - box.right = box.left; - box.top += ( box.bottom - box.top ) / 2; - box.bottom = box.top; - InsetRect( &box, -4, -4 ); - } - } - } -} - - -static -void -colorPopupChooseColor( Rect *menuRect, Point hitPt, - short *whichItem, short numItems, RGBColor *backColor ) -{ - RGBColor aColor; - Rect box, oldBox; - short newItem = 0, loop; - - colorPopupGetBox( menuRect, &oldBox, numItems, *whichItem ); - - if ( PtInRect( hitPt, menuRect ) ) - { - for ( loop = 1; loop <= numItems; loop++ ) - { - colorPopupGetBox( menuRect, &box, numItems, loop ); - if ( PtInRect( hitPt, &box ) ) - { - newItem = loop; - break; - } - } - - if ( *whichItem != newItem ) - { - // deselect old menu item, select new menu item - - if ( *whichItem > 0 ) - { - RGBForeColor( backColor ); - FrameRect( &oldBox ); - } - if ( newItem > 0 ) - { - aColor.red = aColor.blue = aColor.green = 0; - RGBForeColor( &aColor ); - FrameRect( &box ); - } - -#if COLOR_DISPLAY_TEXT - box = *menuRect; - box.top = box.bottom - COLOR_HEX_DISPLAY_SIZE; - EraseRect( &box ); - if ( newItem > 0 ) - { - menuStr[ 0 ] = 0; - GetMenuItemText( theMenu, newItem, menuStr ); - if ( colorPopupParseColor( menuStr, &aColor ) == true ) - { - if ( menuStr[ 0 ] ) - { - // XXX should save/restore current font info, and set a particular (system?) font - - MoveTo( box.left + ((box.right-box.left) / 2) - ( ::StringWidth(menuStr) / 2), - box.bottom - 4); - DrawString( menuStr ); - } - } - } -#endif - *whichItem = newItem; - } - } - else if ( *whichItem > 0 ) - { - // deselect old menu item - - RGBForeColor( backColor ); - FrameRect( &oldBox ); -#if COLOR_DISPLAY_TEXT - box = *menuRect; - box.top = box.bottom - COLOR_HEX_DISPLAY_SIZE; - EraseRect( &box ); -#endif - *whichItem = 0; // clear old item - } -} - - -pascal void -colorPopupMDEFProc(short message, MenuHandle theMenu, - Rect *menuRect, Point hitPt, short *whichItem) -{ - if ( theMenu == NULL ) - return; - - PenState pnState; - RGBColor foreColor, backColor; -#if 0 - Boolean growRowsFlag = false; -#endif - short numItems, numCols, numRows; - - numItems = ::CountMItems( theMenu ); - ::GetPenState( &pnState ); - ::GetForeColor( &foreColor ); - ::PenNormal(); - - switch( message ) - { - case mDrawMsg: - colorPopupDrawBox( theMenu, menuRect, numItems ); - break; - - case mChooseMsg: - ::GetBackColor( &backColor ); - colorPopupChooseColor( menuRect, hitPt, whichItem, numItems, &backColor ); - ::RGBBackColor( &backColor ); - break; - - case mSizeMsg: - - // determine # of rows/cols needed - -#if 0 - if ( numItems > 0 ) - { - numRows = numCols = 1; - while( numItems > (numRows * numCols) ) - { - if ( growRowsFlag ) - ++numRows; - else - ++numCols; - - growRowsFlag = (!growRowsFlag); - } - } -#endif -#if 1 - // hard code these for now - numRows = 10; - numCols = 10; -#endif -#if TARGET_CARBON - // why are the width and height backwards? If they are switched, the menu is wrong shape - ::SetMenuHeight( theMenu, (numRows * CColorPopup::COLOR_BOX_HEIGHT) + (2 * CColorPopup::COLOR_FRAME_BORDER) ); - ::SetMenuWidth( theMenu, (numCols * CColorPopup::COLOR_BOX_WIDTH) + CColorPopup::COLOR_FRAME_BORDER ); -#else - // why are the width and height backwards? If they are switched, the menu is wrong shape - (**theMenu).menuHeight = (numRows * CColorPopup::COLOR_BOX_HEIGHT) + (2 * CColorPopup::COLOR_FRAME_BORDER); - (**theMenu).menuWidth = (numCols * CColorPopup::COLOR_BOX_WIDTH) + CColorPopup::COLOR_FRAME_BORDER; -#endif // TARGET_CARBON - - #if COLOR_DISPLAY_TEXT - (**theMenu).menuWidth += CColorPopup::COLOR_HEX_DISPLAY_SIZE; - #endif - break; - - case mPopUpMsg: -#if TARGET_CARBON - ::SetRect( menuRect, hitPt.v, hitPt.h, - hitPt.v + ::GetMenuWidth(theMenu), hitPt.h + ::GetMenuHeight(theMenu) ); -#else - ::SetRect( menuRect, hitPt.v, hitPt.h, - hitPt.v + (**theMenu).menuWidth, hitPt.h + (**theMenu).menuHeight ); -#endif // TARGET_CARBON - - break; -/* - case mDrawItemMsg: - break; - - case mCalcItemMsg: - break; -*/ - } - - ::RGBForeColor( &foreColor ); - SetPenState( &pnState ); -} - - -// This class overrides CPatternButtonPopup to provide a popup menu which -// changes the descriptor based on the menu selection -// assumes left-justified text in DrawButtonTitle() - - -// --------------------------------------------------------------------------- -// ¥ CColorPopup -// --------------------------------------------------------------------------- -// Stream-based ctor - -CColorPopup::CColorPopup(LStream* inStream) - : CPatternButtonPopupText(inStream) -{ -} - - -void CColorPopup::FinishCreateSelf() -{ - LView *superview = NULL, *view = GetSuperView(); - while ( view ) - { - view = view->GetSuperView(); - if ( view ) - superview = view; - } - - mEditView = (CEditView *)superview->FindPaneByID( CEditView::pane_ID ); - mDoSetLastPickedPreference = false; - SetTicksBeforeDisplayingPopup( 1 ); //display popup instantaneously - - // need to Finish FinishCreateSelf to get menus set for retrieval - super::FinishCreateSelf(); - - // set the control by adjusting the menu and then getting the current color - // unfortunately, when this is called, the editView doesn't have an mwcontext - // so we can't query to find out what the current color is to set it properly -} - - -void -CColorPopup::InitializeCurrentColor() -{ - MenuHandle menuh; - menuh = GetMenu()->GetMacMenuH(); - - MWContext *mwcontext; - if ( mEditView ) - mwcontext = mEditView->GetNSContext() - ? mEditView->GetNSContext()->operator MWContext*() - : NULL; - else - mwcontext = NULL; - - char colorstr[9]; - LO_Color color; - Boolean isColorFound = false; - - // first try to get the color out of the character data - EDT_CharacterData* chardata; - chardata = EDT_GetCharacterData( mwcontext ); - if ( chardata && chardata->pColor ) - { - isColorFound = true; - color = *chardata->pColor; - XP_SPRINTF( &colorstr[2], "%02X%02X%02X", color.red, color.green, color.blue); - } - if ( chardata ) - EDT_FreeCharacterData( chardata ); - - // if we still haven't found it, let's try the page data - if ( !isColorFound ) - { - EDT_PageData *pagedata = EDT_GetPageData( mwcontext ); - if ( pagedata && pagedata->pColorText ) - { - isColorFound = true; - color = *pagedata->pColorText; - XP_SPRINTF( &colorstr[2], "%02X%02X%02X", color.red, color.green, color.blue); - } - if ( pagedata ) - EDT_FreePageData( pagedata ); - } - - // if we still haven't found the color, get the browser preference - if ( !isColorFound ) - { - // editor.text_color - int iSize = 9; - int result = PREF_GetCharPref( "browser.foreground_color", &colorstr[1], &iSize ); - if ( result != PREF_NOERROR ) - colorstr[1] = 0; // zero string if error is encountered - } - - colorstr[1] = CURRENT_COLOR_CHAR; // put in leading character - colorstr[0] = strlen( &colorstr[1] ); - ::SetMenuItemText( menuh, CURRENT_COLOR_ITEM, (unsigned char *)&colorstr ); - - // set descriptor of control - if ( GetValue() == CURRENT_COLOR_ITEM ) - { - SetDescriptor( (const unsigned char *)colorstr ); - Refresh(); // inval the control's visible pane area - } -} - - -// --------------------------------------------------------------------------- -// ¥ AdjustMenuContents -// --------------------------------------------------------------------------- -// Set last color picked (first item). - -void -CColorPopup::AdjustMenuContents() -{ - MenuHandle menuh; - menuh = GetMenu()->GetMacMenuH(); - - // initialize last color picked - char colorstr[9]; - int iSize = 9; - int result; - - // note hack to avoid converting c-string to p-string - result = PREF_GetCharPref( "editor.last_color_used", &colorstr[1], &iSize ); - if ( result == PREF_NOERROR ) - { - colorstr[1] = LAST_COLOR_PICKED_CHAR; // replace '#' with '<' - colorstr[0] = strlen( &colorstr[1] ); - ::SetMenuItemText( menuh, LAST_COLOR_PICKED_ITEM, (unsigned char *)&colorstr ); - } - - // initialize the default color - result = PREF_GetCharPref( "browser.foreground_color", &colorstr[1], &iSize ); - if ( result == PREF_NOERROR ) - { - colorstr[1] = DEFAULT_COLOR_CHAR; // replace '#' with '<' - colorstr[0] = strlen( &colorstr[1] ); - ::SetMenuItemText( menuh, DEFAULT_COLOR_ITEM, (unsigned char *)&colorstr ); - } - - // initialize the current color - InitializeCurrentColor(); -} - - -void CColorPopup::HandlePopupMenuSelect( Point inPopupLoc, Int16 inCurrentItem, - Int16& outMenuID, Int16& outMenuItem ) -{ - super::HandlePopupMenuSelect( inPopupLoc, inCurrentItem, outMenuID, outMenuItem ); - - // check if we need to set the preference here... - mDoSetLastPickedPreference = ( outMenuID && outMenuItem != DEFAULT_COLOR_ITEM ); -} - - -void CColorPopup::SetValue(Int32 inValue) -{ - if ( inValue == 0 ) - inValue = CURRENT_COLOR_ITEM; - - Boolean shouldBroadcast; - // Handle color picker item special - if ( inValue == COLOR_PICKER_ITEM ) - { - mValue = inValue; // Store new value to broadcast it - BroadcastValueMessage(); // Inform Listeners of value change - - inValue = CURRENT_COLOR_ITEM; // Reset value to current color - shouldBroadcast = false; // Already broadcast above; don't do again - } - else - shouldBroadcast = IsBroadcasting(); - - // broadcast only if it's not a color picker item (handled above) - StSetBroadcasting setBroadcasting( this, shouldBroadcast ); - super::SetValue( inValue ); -} - - -// --------------------------------------------------------------------------- -// ¥ HandleNewValue -// --------------------------------------------------------------------------- -// Hook for handling value changes. Called by SetValue. -// Note that the setting of the new value is done by CPatternButtonPopup::SetValue. -// Therefore, GetValue() will still return the old value here, so the old value is -// still available in this method. - -Boolean -CColorPopup::HandleNewValue(Int32 inNewValue) -{ - Str255 str; - MenuHandle menuh; - menuh = GetMenu()->GetMacMenuH(); - ::GetMenuItemText ( menuh, inNewValue, str ); - - if ( str[1] != COLOR_PICKER_CHAR ) - SetDescriptor( str ); - - if ( mDoSetLastPickedPreference - && str[1] != LAST_COLOR_PICKED_CHAR && str[1] != COLOR_PICKER_CHAR ) - { - mDoSetLastPickedPreference = false; - - // skip over any text which might preceed color - int index; - for ( index = 1; index <= str[0] - && str[index] != LAST_COLOR_PICKED_CHAR - && str[index] != COLOR_CHIP_CHAR - && str[index] != COLOR_PICKER_CHAR - && str[index] != DEFAULT_COLOR_CHAR - && str[index] != CURRENT_COLOR_CHAR; ++index ) - ; - - if ( index + 7 < str[0] ) - str[index + 7] = 0; // null terminate after symbol + 6chars of color - - str[ index ] = COLOR_CHIP_CHAR; // prefs assume #-format color - p2cstr( str ); - int result; - result = PREF_SetCharPref( "editor.last_color_used", (char *)&str[index-1] ); - // skip past initial symbol; index-1 since now c-string - } - - return false; -} - - -const Int16 cPopupArrowHeight = 5; // height of the arrow -const Int16 cPopupArrowWidth = 9; // widest width of the arrow - - -void -CColorPopup::DrawButtonContent(void) -{ - CPatternButtonPopupText::DrawButtonContent(); - DrawPopupArrow(); -} - - -void -CColorPopup::DrawButtonTitle(void) -{ -} - - -void -CColorPopup::DrawButtonGraphic(void) -{ - ResIDT theSaveID = GetGraphicID(); - ResIDT theNewID = theSaveID; - RGBColor foreColor, theColor; - const RGBColor black={0,0,0}; - - Int32 theValue = GetValue(); - if (theValue > 0) - { - if ( theValue == COLOR_PICKER_ITEM ) - theValue = CURRENT_COLOR_ITEM; - - if (GetMenuItemRGBColor((short)theValue, &theColor) == true) - { - CButton::CalcGraphicFrame(); - InsetRect(&mCachedGraphicFrame, (mCachedGraphicFrame.right-mCachedGraphicFrame.left-12)/2, - (mCachedGraphicFrame.bottom-mCachedGraphicFrame.top-12)/2); - - ::GetForeColor(&foreColor); - - ::RGBForeColor(&black); - ::FrameRect(&mCachedGraphicFrame); - ::RGBForeColor(&foreColor); - - ::InsetRect(&mCachedGraphicFrame,1,1); - ::RGBForeColor(&theColor); - ::PaintRect(&mCachedGraphicFrame); - } - else - theValue = CURRENT_COLOR_ITEM; // not sure this is the right thing; - // it'd be nice if GetMenuItemRGBColor always returned true - } -} - - -void -CColorPopup::DrawPopupArrow(void) -{ - Rect theFrame; - - CalcLocalFrameRect(theFrame); - - Int16 width = theFrame.right - theFrame.left; - Int16 height = theFrame.bottom - theFrame.top; - theFrame.top += ((height - cPopupArrowHeight) / 2); - theFrame.left = theFrame.right - cPopupArrowWidth - 7; - theFrame.right = theFrame.left + cPopupArrowWidth - 1; - theFrame.bottom = theFrame.top + cPopupArrowHeight - 1; - - // check if we have moved past the right edge of the button - // if so, adjust it back to the right edge of the button - if ( theFrame.right > mCachedButtonFrame.right - 4 ) - { - theFrame.right = mCachedButtonFrame.right - 4; - theFrame.left = theFrame.right - cPopupArrowWidth - 1; - } - - UGraphicGizmos::DrawPopupArrow( - theFrame, - IsEnabled(), - IsActive(), - IsTrackInside()); -} - - -#pragma mark - - -// always call ProcessCommandStatus for popup menus which can change values -void -CColorPopup::HandleEnablingPolicy() -{ - LCommander* theTarget = LCommander::GetTarget(); - MessageT buttonCommand = GetValueMessage(); - Boolean enabled = false; - Boolean usesMark = false; - Str255 outName; - Char16 outMark; - - if (!CTargetedUpdateMenuRegistry::UseRegistryToUpdateMenus() || - CTargetedUpdateMenuRegistry::CommandInRegistry(buttonCommand)) - { - if (!IsActive() || !IsVisible()) - return; - - if (!theTarget) - return; - - CPatternButtonPopup::HandleEnablingPolicy(); - - if (buttonCommand) - theTarget->ProcessCommandStatus(buttonCommand, enabled, usesMark, outMark, outName); - } - CPatternButtonPopup::Enable(); -} - - - -Boolean -CColorPopup::GetMenuItemRGBColor(short menuItem, RGBColor *theColor) -{ - Str255 str; - MenuHandle menuh; - Boolean colorFoundFlag; - - menuh = GetMenu()->GetMacMenuH(); - ::GetMenuItemText( menuh, menuItem, str ); - colorFoundFlag = colorPopupParseColor( str, theColor ); - return colorFoundFlag; -} - - - -short -CColorPopup::GetMenuItemFromRGBColor(RGBColor *theColor) -{ - MenuHandle menuh; - RGBColor tempColor; - Str255 str; - short loop,numItems,retVal=CURRENT_COLOR_ITEM; // return current color if not found - - if ((menuh = GetMenu()->GetMacMenuH()) != NULL) - { - numItems = ::CountMItems(menuh); - for (loop=1; loop<= numItems; loop++) - { - ::GetMenuItemText( menuh, loop, str); - if (colorPopupParseColor(str, &tempColor) == true) - { - if ((tempColor.red == theColor->red) && (tempColor.blue == theColor->blue) && (tempColor.green == theColor->green)) - { - retVal = loop; - break; - } - } - } - } - return retVal; -} diff --git a/mozilla/cmd/macfe/Composer/CColorPopup.h b/mozilla/cmd/macfe/Composer/CColorPopup.h deleted file mode 100644 index a18311dd42c..00000000000 --- a/mozilla/cmd/macfe/Composer/CColorPopup.h +++ /dev/null @@ -1,74 +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. - */ - -#include "CPatternButtonPopupText.h" - -class CEditView; - - -class CColorPopup : public CPatternButtonPopupText -{ - public: - enum { class_ID = 'Cpop' }; - enum { COLOR_DISPLAY_TEXT = 0, // need to fix "*" bug before turning on (among other things) - COLOR_FRAME_BORDER = 2, - COLOR_BOX_WIDTH = 14, - COLOR_BOX_HEIGHT = 14, - COLOR_HEX_DISPLAY_SIZE = 16 - }; - enum { - LAST_COLOR_PICKED_CHAR = '<', - LAST_COLOR_PICKED_ITEM = 1, - COLOR_CHIP_CHAR = '#', - COLOR_PICKER_CHAR = '*', - COLOR_PICKER_ITEM = 62, - DEFAULT_COLOR_CHAR = '@', - DEFAULT_COLOR_ITEM = 72, - CURRENT_COLOR_CHAR = '.', - CURRENT_COLOR_ITEM = 73 - }; - - typedef CPatternButtonPopupText super; - - - static void* CreateCColorPopupStream( LStream *inStream ) {return( new CColorPopup (inStream ));}; - CColorPopup( LStream *inStream ); // ¥ Constructor - virtual void FinishCreateSelf(); - - // ¥ drawing - void DrawButtonContent(void); - void DrawButtonTitle(void); - void DrawPopupArrow(void); - void DrawButtonGraphic(void); - - // ¥ hooks - virtual void SetValue( Int32 inValue ); - virtual void AdjustMenuContents(); - virtual void HandlePopupMenuSelect( Point inPopupLoc, Int16 inCurrentItem, - Int16& outMenuID, Int16& outMenuItem ); - virtual Boolean HandleNewValue(Int32 inNewValue); - virtual Boolean GetMenuItemRGBColor(short menuItem, RGBColor *theColor); - virtual short GetMenuItemFromRGBColor(RGBColor *theColor); - - void InitializeCurrentColor(); - -protected: - virtual void HandleEnablingPolicy(); - CEditView *mEditView; - Boolean mDoSetLastPickedPreference; -}; diff --git a/mozilla/cmd/macfe/Composer/CComposerDragTask.cp b/mozilla/cmd/macfe/Composer/CComposerDragTask.cp deleted file mode 100644 index def90f66acb..00000000000 --- a/mozilla/cmd/macfe/Composer/CComposerDragTask.cp +++ /dev/null @@ -1,71 +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. - */ - -// =========================================================================== -// CComposerDragTask.cp -// =========================================================================== - - -#include "CComposerDragTask.h" - - -// --------------------------------------------------------------------------- -// ¥ CComposerDragTask -// --------------------------------------------------------------------------- - -CComposerDragTask::CComposerDragTask( - const EventRecord& inEventRecord, - const Rect& inGlobalFrame, - CHTMLView& inHTMLView) - : mGlobalFrame(inGlobalFrame), - mHTMLView(inHTMLView), - super(inEventRecord) -{ -} - - -// --------------------------------------------------------------------------- -// ¥ ~CComposerDragTask -// --------------------------------------------------------------------------- - -CComposerDragTask::~CComposerDragTask() -{ -} - - -// --------------------------------------------------------------------------- -// ¥ AddFlavors -// --------------------------------------------------------------------------- - -void -CComposerDragTask::AddFlavors( DragReference /* inDragRef */ ) -{ - OSErr theErr; - - theErr = ::AddDragItemFlavor( mDragRef, (ItemReference)this, emComposerNativeDrag, - nil, 0, flavorNotSaved | flavorSenderTranslated ); - ThrowIfOSErr_(theErr); -} - - -void -CComposerDragTask::MakeDragRegion( DragReference /* inDragRef */, RgnHandle /* inDragRegion */ ) -{ - AddRectDragItem((ItemReference)&mHTMLView, mGlobalFrame); -} - diff --git a/mozilla/cmd/macfe/Composer/CComposerDragTask.h b/mozilla/cmd/macfe/Composer/CComposerDragTask.h deleted file mode 100644 index 4e0742f546c..00000000000 --- a/mozilla/cmd/macfe/Composer/CComposerDragTask.h +++ /dev/null @@ -1,56 +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. - */ - -// =========================================================================== -// CComposerDragTask.h -// =========================================================================== - -#ifndef CComposerDragTask_H -#define CComposerDragTask_H -#pragma once - -// Includes - -#include - -class CHTMLView; - -#define emComposerNativeDrag 'CNDr' // others defined in "resgui.h" - -// Class declaration - -class CComposerDragTask : public LDragTask -{ -public: - typedef LDragTask super; - - CComposerDragTask( const EventRecord& inEventRecord, - const Rect& inGlobalFrame, CHTMLView& inHTMLView ); - virtual ~CComposerDragTask(); - -protected: - virtual void AddFlavors( DragReference inDragRef ); - virtual void MakeDragRegion( DragReference inDragRef, RgnHandle inDragRegion ); - - - Rect mGlobalFrame; - CHTMLView& mHTMLView; -}; - - -#endif diff --git a/mozilla/cmd/macfe/Composer/CEditDictionary.cp b/mozilla/cmd/macfe/Composer/CEditDictionary.cp deleted file mode 100644 index 06dea14d791..00000000000 --- a/mozilla/cmd/macfe/Composer/CEditDictionary.cp +++ /dev/null @@ -1,320 +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. - */ - -#include "CEditDictionary.h" -#include "CLargeEditField.h" // msg_EditField2 -#include "LGAPushButton.h" -#include "resgui.h" // msg_Help -#include "macutil.h" // ShowHelp -#include "CSpellChecker.h" // ISpellChecker - -// need to include "ntypes.h" before "xp_help.h" because -// "xp_help.h" doesn't include definition of MWContext though it should -#include "ntypes.h" -#include "xp_help.h" // HELP_SPELL_CHECK - -// If user has changed the word field, figure out the length and enable/disable appropriately -void CEditDictionary::ListenToMessage ( MessageT inMessage, - void* ioParam ) { - - Assert_(mWordNameField); - Assert_(mAddButton); - - // This happens when user types - if (inMessage == msg_EditField2) { - if ((**(mWordNameField->GetMacTEH())).teLength) { - mAddButton->Enable(); - } else { - mAddButton->Disable(); - } - - // User clicked in words table - } else if (inMessage == WordsTableID) { - - Boolean atleastoneselected = false; - // Must have at least one cell selected for remove to be valid - STableCell selchecker(0,0); - if (mWordsView->GetNextSelectedCell(selchecker)) { - atleastoneselected = true; - mRemoveButton->Enable(); - } else { - mRemoveButton->Disable(); - } - // Replace is enabled if there is a valid word in New Word Edit Field - // And exactly one word is selected - if ((**(mWordNameField->GetMacTEH())).teLength && atleastoneselected && - !mWordsView->GetNextSelectedCell(selchecker) ) { - mReplaceButton->Enable(); - } else { - mReplaceButton->Disable(); - } - - // User left words table - } else if (inMessage == msg_LeaveDictionaryTable) { - mRemoveButton->Disable(); - mReplaceButton->Disable(); - - // If user clicks on Remove Button - } else if (inMessage == RemoveButtonID) { - RemoveSelectedWords(); - - // If user clicks on Replace Button - } else if (inMessage == ReplaceButtonID) { - ReplaceSelectedWord(); - - // If user clicks on OK Button - } else if (inMessage == msg_OK) { - MakeDictionaryChangesPermanent(); - AttemptClose(); - - // If user clicks on Cancel Button - } else if (inMessage == msg_Cancel) { - AttemptClose(); - - // User clicks on Help Button - } else if (inMessage == msg_Help) { - ShowHelp(HELP_SPELL_CHECK); - - // This is the case when something important happens (selection, deselection, etc.) - // to the New Word edit field. Check status of word - } else if (inMessage == WordID) { - if ((**(mWordNameField->GetMacTEH())).teLength) { - mAddButton->Enable(); - } else { - mAddButton->Disable(); - } - - // Add word to dictionary - } else if (inMessage == AddButtonID) { - AddNewWord(); - } else { - LGADialogBox::ListenToMessage(inMessage, ioParam); - } - -} - -//------------------------------------------------------------------------------------- -// CEditDictionary::MakeDictionaryChangesPermanent -// Take words in view and set in dictionary -//------------------------------------------------------------------------------------- -void CEditDictionary::MakeDictionaryChangesPermanent() { - - STableCell currCellLoc(1,1); - Str255 currCellData; - Uint32 maxsize = 255; - - mISpellChecker->ResetPersonalDictionary(); - for (currCellLoc.row = 1; currCellLoc.row <= mNumWords; currCellLoc.row++) { - maxsize = 255; - mWordsView->GetCellData(currCellLoc, currCellData, maxsize); - mISpellChecker->AddWordToPersonalDictionary(p2cstr(currCellData)); - } -} - - -//------------------------------------------------------------------------------------- -// CEditDictionary::RemoveSelectedWord -// Remove words that are currently selected -//------------------------------------------------------------------------------------- -void CEditDictionary::RemoveSelectedWords() { - - STableCell currCellLoc(0,0); - int rowstodelete = 0; - - while (mWordsView->GetNextSelectedCell(currCellLoc)) { - rowstodelete++; - } - currCellLoc = mWordsView->GetFirstSelectedCell(); - mWordsView->RemoveRows(rowstodelete, currCellLoc.row, true); - mNumWords-=rowstodelete; -} - -//------------------------------------------------------------------------------------- -// CEditDictionary::ReplaceSelectedWord -// Remove currently selected word with word in New Word box -//------------------------------------------------------------------------------------- -void CEditDictionary::ReplaceSelectedWord() { - - STableCell currCellLoc; - Str255 theWord; - - mWordNameField->GetDescriptor(theWord); - currCellLoc = mWordsView->GetFirstSelectedCell(); - if (mWordsView->IsValidCell(currCellLoc)) { - mWordsView->SetCellData(currCellLoc, theWord, theWord[0] + 1); - mWordsView->RefreshCell(currCellLoc); - } -} - - -//------------------------------------------------------------------------------------- -// CEditDictionary::AddNewWord -// Add the word in "New Word" edit field to personal dictionary -//------------------------------------------------------------------------------------- -void CEditDictionary::AddNewWord() { - - Str255 theWord; - Str255 currWord; - Assert_(mWordNameField); - Assert_(mISpellChecker); - - STableCell cell(1,1); - Uint32 maxbytes; - - mWordNameField->GetDescriptor(theWord); - - /* - Check to make sure word is not already in the list. If it is, then highlight that word - and return so we don't insert. - */ - for (cell.row = 1; cell.row <= mNumWords; cell.row++) { - maxbytes = 255; - mWordsView->GetCellData(cell, currWord, maxbytes); - if (currWord[0] == theWord[0] && - !strncmp(reinterpret_cast(&(currWord[1])), reinterpret_cast(&(theWord[1])), theWord[0]) ) { // If word already exists exit - mWordsView->UnselectAllCells(); - mWordsView->SelectCell(cell); - return; - } - } - - mWordsView->InsertRows(1, mNumWords, theWord, theWord[0] + 1, Refresh_Yes); - mNumWords++; - cell.row = mNumWords; - mWordsView->UnselectAllCells(); - mWordsView->SelectCell(cell); -} - - -//------------------------------------------------------------------------------------- -// CEditDictionary::FinishCreateSelf -// Setup object references -//------------------------------------------------------------------------------------- -void CEditDictionary::FinishCreateSelf () { - - mAddButton = dynamic_cast(FindPaneByID(AddButtonID)); - mReplaceButton = dynamic_cast(FindPaneByID(ReplaceButtonID)); - mRemoveButton = dynamic_cast(FindPaneByID(RemoveButtonID)); - mHelpButton = dynamic_cast(FindPaneByID(HelpButtonID)); - mWordNameField = dynamic_cast(FindPaneByID(WordID)); - mWordsView = dynamic_cast(FindPaneByID( WordsTableID )); - - ThrowIfNil_(mAddButton); - ThrowIfNil_(mReplaceButton); - ThrowIfNil_(mRemoveButton); - ThrowIfNil_(mHelpButton); - ThrowIfNil_(mWordNameField); - ThrowIfNil_(mWordsView); - - LGADialogBox::FinishCreateSelf(); - - PenState penState; - ::GetPenState( &penState ); - mWordsView->AddAttachment( new LColorEraseAttachment( &penState, NULL, NULL, true ) ); - mAddButton->Disable(); // Add button should be originally disabled - mReplaceButton->Disable(); - mRemoveButton->Disable(); - - mAddButton->AddListener( this ); - mReplaceButton->AddListener( this ); - mRemoveButton->AddListener( this ); - mWordNameField->AddListener( this ); - mWordsView->AddListener( this ); - mHelpButton->AddListener( this ); -} - -// Constructor - -CEditDictionary::CEditDictionary(LStream *inStream) : mNumWords(0), - mWordNameField(NULL), mISpellChecker(NULL), mAddButton(NULL), mWordsView(NULL), - mHelpButton(NULL), LGADialogBox (inStream) { - -} - -//------------------------------------------------------------------------------------- -// CEditDictionary::SetISPellChecker -// Sets personal dictionary and inserts into GUI -//------------------------------------------------------------------------------------- - -void CEditDictionary::SetISpellChecker(ISpellChecker *i) { - - STableCell cell(0, 1); - Uint32 unusedNumber; - char word_buffer[max_word_length]; - int curr_word_length; - - mISpellChecker = i; - cell.row = 0; - - if ((mISpellChecker->GetFirstPersonalDictionaryWord(word_buffer, max_word_length) >= 0) && mWordsView) { - mWordsView->FocusDraw(); - do { - mNumWords++; - cell.row++; - curr_word_length = strlen(word_buffer); - CStr255 pascalstring( word_buffer ); - mWordsView->InsertRows(1, cell.row-1, NULL ,0, Refresh_Yes); - mWordsView->SetCellData(cell, pascalstring, curr_word_length + 1); - // Insert the words into dialog box here! - } while (mISpellChecker->GetNextPersonalDictionaryWord(word_buffer, max_word_length) >= 0); - } - - mWordsView->GetTableSize(mNumWords, unusedNumber); -} - -//------------------------------------------------------------------------------------- -// CEditDictionary::GetISPellChecker -// Get the Personal Dictionary -//------------------------------------------------------------------------------------- -ISpellChecker *CEditDictionary::GetISpellChecker() { - - return mISpellChecker; -} - -//------------------------------------------------------------------------------------- -// CEditDictionaryTable::BeTarget() -// Broadcast messages when we become target so we can setup buttons -//------------------------------------------------------------------------------------- -void CEditDictionaryTable::BeTarget() { - - CTextTable::BeTarget(); - BroadcastMessage(CEditDictionary::WordsTableID, NULL); -} - -//------------------------------------------------------------------------------------- -// CEditDictionaryTable::DontBeTarget() -// Broadcast messages when we lose target so we can setup buttons -//------------------------------------------------------------------------------------- -void CEditDictionaryTable::DontBeTarget() { - - CTextTable::DontBeTarget(); - BroadcastMessage(CEditDictionary::msg_LeaveDictionaryTable, NULL); -} - -//------------------------------------------------------------------------------------- -// HiliteSelection -// Setup back/front colors. Otherwise we sometimes get the de-highlighting -// wrong when switching selection -//------------------------------------------------------------------------------------- -void CEditDictionaryTable::HiliteSelection( Boolean inActively, Boolean inHilite ) -{ - if (inActively) { - StColorPenState::Normalize(); - } - LTableView::HiliteSelection( inActively, inHilite ); -} diff --git a/mozilla/cmd/macfe/Composer/CEditDictionary.h b/mozilla/cmd/macfe/Composer/CEditDictionary.h deleted file mode 100644 index 34ac5b3105b..00000000000 --- a/mozilla/cmd/macfe/Composer/CEditDictionary.h +++ /dev/null @@ -1,76 +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. - */ - -#pragma once - -#include "CTextTable.h" -#include - - -class LGAPushButton; -class CLargeEditFieldBroadcast; -class ISpellChecker; - - -class CEditDictionary : public LGADialogBox { - - public: - - virtual void ListenToMessage ( MessageT inMessage, - void* ioParam ); - - virtual void FinishCreateSelf(); - CEditDictionary(LStream *inStream); - - void SetISpellChecker(ISpellChecker *i); - ISpellChecker *GetISpellChecker(); - - enum { class_ID = 'CEdD', res_ID = 5298 }; - enum { AddButtonID = 201 , WordID = 200, WordsTableID = 202, ReplaceButtonID = 203, - RemoveButtonID = 204, HelpButtonID = 205, msg_LeaveDictionaryTable = 208 }; - enum { max_word_length = 50 }; // Max length of a word - - protected: - - void MakeDictionaryChangesPermanent(); - virtual void AddNewWord(); - virtual void RemoveSelectedWords(); - virtual void ReplaceSelectedWord(); - CLargeEditFieldBroadcast *mWordNameField; // The field where user edits word - LGAPushButton *mAddButton; // Add new word button - LGAPushButton *mReplaceButton; - LGAPushButton *mRemoveButton; - LGAPushButton *mHelpButton; - CTextTable *mWordsView; // The Personal Dictionary view - - int mNumWords; - - ISpellChecker *mISpellChecker; -}; - -class CEditDictionaryTable : public CTextTable { - - public: - - enum {class_ID = 'CEDT' }; - virtual void BeTarget(); - virtual void DontBeTarget(); - CEditDictionaryTable(LStream *inStream) : CTextTable(inStream) { } - - void HiliteSelection( Boolean inActively, Boolean inHilite ); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/Composer/CEditView.cp b/mozilla/cmd/macfe/Composer/CEditView.cp deleted file mode 100644 index 8e1cc81add6..00000000000 --- a/mozilla/cmd/macfe/Composer/CEditView.cp +++ /dev/null @@ -1,5150 +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. - */ - -#include - -#include "CEditView.h" -#include "CHTMLView.h" // ::SafeSetCursor - -#include "resgui.h" -#include "mprint.h" -#include "meditor.h" // HandleModalDialog -#include "meditdlg.h" // CEditDialog -#include "CHTMLClickrecord.h" -#include "CBrowserContext.h" // load url -#include "CPaneEnabler.h" // CPaneEnabler::UpdatePanes() -#include "CPatternButtonPopup.h" -#include "CSpellChecker.h" // cmd_CheckSpelling -#include "CComposerDragTask.h" -#include "CColorPopup.h" -#include "CFontMenuAttachment.h" // CFontMenuPopup - -#include "TSMProxy.h" -#include "LTSMSupport.h" - -#include "macgui.h" // UGraphics::MakeRGBColor -#include "ufilemgr.h" // CFileMgr::GetURLFromFileSpec -#include "uerrmgr.h" // ErrorManager::PlainAlert -#include "edt.h" -#include "net.h" // FO_CACHE_AND_PRESENT -#include "proto.h" // XP_IsContextBusy() -#include "CURLDispatcher.h" // CURLDispatcher::DispatchURL -#include "pa_tags.h" // tags such as P_HEADER_5 -#include "ulaunch.h" // StartDocInApp -#include "shist.h" // SHIST_GetCurrent -#include "prefapi.h" // PREF_GetBoolPref, PREF_GetIntPref -#include "CPrefsDialog.h" // CPrefsDialog::EditPrefs and related -#include "CRecentEditMenuAttachment.h" // cmd for FindCommandStatus - -#include "FSpCompat.h" -#include "MoreFilesExtras.h" - -#include "uintl.h" - -// get string constants -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS - -#include - -//#define PROFILE 1 -#ifdef PROFILE -#include -extern void ProfileStart(); -extern void ProfileStop(); -extern void ProfileSuspend(); -extern void ProfileResume(); -extern Boolean ProfileInProgress(); -#endif - -#include - - -#define FLUSH_JAPANESE_TEXT if ( mProxy ) mProxy->FlushInput(); - -#pragma mark -- local -- -// ** LOCAL functions -static Boolean -sect_rect_long(SPoint32 frameLocation, SDimension16 frameSize, SPoint32 *updateUL, SPoint32 *updateLR) -{ - if (updateUL->h >= frameLocation.h + frameSize.width || // are we overlapping at all? - updateLR->h <= frameLocation.h || - updateUL->v >= frameLocation.v + frameSize.height || - updateLR->v <= frameLocation.v) - { - *updateLR = *updateUL; // no, - return false; // return. - } - - if ( updateUL->h < frameLocation.h ) - updateUL->h = frameLocation.h; - if ( updateLR->h > frameLocation.h + frameSize.width ) - updateLR->h = frameLocation.h + frameSize.width; - if ( updateUL->v < frameLocation.v ) - updateUL->v = frameLocation.v; - if ( updateLR->v > frameLocation.v + frameSize.height ) - updateLR->v = frameLocation.v + frameSize.height; - - return (updateLR->h != updateUL->h && updateLR->v != updateUL->v ); // is this test redundant; do we always return true?? -} - - -// utility function for menu string/command swapping -// if "outName" is NULL it will actually set the menu text -// otherwise the menu item's text will be returned in "outName" -static -void SetMenuCommandAndString( CommandT oldCommand, CommandT newCommand, - ResIDT newStringResourceID, ResIDT newStringIndex, - Str255 outName ) -{ - ResIDT theMenuID; - MenuHandle theMenuH; - Int16 theItem; - LMenuBar *theMenuBar = LMenuBar::GetCurrentMenuBar(); - - if ( theMenuBar == NULL ) - return; // something must be pretty screwed up! - - // Locate oldCommand - theMenuBar->FindMenuItem( oldCommand, theMenuID, theMenuH, theItem ); - if ( theItem != 0 ) - { // Replace with newCommand - LMenu *theMenu = theMenuBar->FetchMenu( theMenuID ); - if ( newCommand ) - theMenu->SetCommand( theItem, newCommand ); - - if ( newStringResourceID ) - { - Str255 newMenuString; - ::GetIndString( newMenuString, newStringResourceID, newStringIndex ); - if ( newMenuString[ 0 ] ) - { - if ( outName ) - { - outName[ 0 ] = 0; - XP_STRCPY( (char *)outName, (char *)newMenuString ); - } - else - SetMenuItemText( theMenuH, theItem, newMenuString ); - } - } - } -} - -#pragma mark -- CComposerAwareURLDragMixin - -// -// CComposerAwareURLDragMixin constructor -// -// As the name implies, this version of the URLDragMixin class knows about composer. -// Add the composer native drag flavor to the front of the acceptable flavors -// list, because we want to use that first if it is present over all other drag flavors -// -CComposerAwareURLDragMixin :: CComposerAwareURLDragMixin ( ) -{ - AcceptedFlavors().insert ( AcceptedFlavors().begin(), 1, (FlavorType)emComposerNativeDrag ); - -} // constructor - - -// -// ReceiveDragItem -// -// Overridden to handle the composer native drag flavor before all the others -// -void -CComposerAwareURLDragMixin :: ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) -{ - try - { - FlavorType useFlavor; - FindBestFlavor ( inDragRef, inItemRef, useFlavor ); - Size theDataSize = 0; - - switch ( useFlavor ) - { - - case emComposerNativeDrag: - { - SInt16 mods, mouseDownModifiers, mouseUpModifiers; - OSErr err = ::GetDragModifiers( inDragRef, &mods, &mouseDownModifiers, &mouseUpModifiers ); - if (err != noErr) - mouseDownModifiers = 0; - bool doCopy = ( (mods & optionKey) == optionKey ) || ( (mouseDownModifiers & optionKey) == optionKey ); - - err = ::GetFlavorDataSize( inDragRef, inItemRef, emComposerNativeDrag, &theDataSize ); - ThrowIfOSErr_( err ); - - vector datap ( theDataSize + 1 ); - if ( noErr == ::GetFlavorData( inDragRef, inItemRef, emComposerNativeDrag, &(*datap.begin()), &theDataSize, 0 ) - && ( theDataSize > 0 ) ) { - datap[ theDataSize ] = 0; - // get where the mouse is for the drag and convert it to local coords. - Point mouseLoc; - ::GetDragMouse( inDragRef, &mouseLoc, NULL ); - ::GlobalToLocal( &mouseLoc ); - - HandleDropOfComposerFlavor ( &(*datap.begin()), doCopy, mouseLoc ); - } - } - break; - - default: - CHTAwareURLDragMixin::ReceiveDragItem(inDragRef, inDragAttrs, inItemRef, inItemBounds); - break; - - } // switch on best flavor - } - catch ( ... ) - { -#ifdef DEBUG - DebugStr ( "\pCan't find the flavor we want; g" ); -#endif - } - -} // ReceiveDragItem - - -#pragma mark -- CEditView -- -CEditView::CEditView(LStream * inStream) : CHTMLView(inStream), - mEditorDoneLoading( false ), - mUseCharFormattingCache( false ), - mDragData( nil ), - mHoldUpdates( nil ) -{ - // Editable views always have scrollbars, though they might be disabled. - SetScrollMode( LO_SCROLL_YES, true ); - - mLastBlink = 0; - mHideCaret = false; - mCaretDrawn = false; - mCaretActive = false; - mCaretX = 0; - mCaretYLow = 0; - mCaretYHigh = 0; - mDisplayParagraphMarks = false; - - mProxy = NULL; - Int32 theResult; - ::Gestalt( gestaltTSMgrAttr, &theResult ); - - // Failure just means that this edit view won't support TSM - OSErr theErr = ::Gestalt( gestaltTSMgrVersion, &theResult ); - if ( theErr == noErr && theResult >= 1 ) - { - try - { - if ( LTSMSupport::HasTextServices() ) - mProxy = new HTMLInlineTSMProxy( *this ); - } - catch (...) - { - } - } - - mOldLastElementOver = -1; - mOldPoint.h = -1; - mOldPoint.v = -1; -} - -CEditView::~CEditView() -{ - SetContext( NULL ); - delete mProxy; -} - -void CEditView::FinishCreateSelf(void) -{ - LView *view = GetSuperView(); - while (view->GetSuperView()) - view = view->GetSuperView(); - - mParagraphToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Paragraph_Hierarchical_Menu ); - mSizeToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Font_Size_Hierarchical_Menu ); - mAlignToolbarPopup = (CPatternButtonPopup *)view->FindPaneByID( cmd_Align_Hierarchical_Menu ); - mFontToolbarPopup = (CFontMenuPopup *)view->FindPaneByID( 'Font' ); - mColorPopup = (CColorPopup *)view->FindPaneByID( 'Colr' ); - - CHTMLView::FinishCreateSelf(); - SwitchTarget( this ); // brings the composer window into focus -} - -void CEditView::LayoutNewDocument( URL_Struct* inURL, Int32* inWidth, Int32* inHeight, - Int32* inMarginWidth, Int32* inMarginHeight ) -{ - /* - The inherited |LayoutNewDocument| arbitrarily sets the scroll mode to LO_SCROLL_AUTO, - which is wrong for editable views --- they always show their scrollbars. - */ - - /*inherited*/ CHTMLView::LayoutNewDocument( inURL, inWidth, inHeight, inMarginWidth, inMarginHeight ); - SetScrollMode( LO_SCROLL_YES, true ); -} - -void CEditView::SetContext( CBrowserContext* inNewContext ) -{ - // if we are setting this to a NULL context *and* we had a previous context... - // assume we are shutting down window and destroy edit buffer - if ( GetContext() && inNewContext == NULL ) - EDT_DestroyEditBuffer( *GetContext() ); - - // remove and add ourselves (the editor) as a user of the context - if ( GetContext() ) - GetContext()->RemoveUser( this ); - if ( inNewContext ) - inNewContext->AddUser( this ); - - inherited::SetContext( inNewContext ); - - if ( mProxy ) - mProxy->SetContext( *(inNewContext) ); - -} - -Boolean CEditView::CanUseCharFormatting() -{ - if ( ! mUseCharFormattingCache ) - { - ED_ElementType elementType = EDT_GetCurrentElementType( *GetContext() ); - mIsCharFormatting = elementType == ED_ELEMENT_TEXT || elementType == ED_ELEMENT_SELECTION - || elementType == ED_ELEMENT_CELL || elementType == ED_ELEMENT_ROW - || elementType == ED_ELEMENT_COL; - } - - return mIsCharFormatting; -} - -Bool CEditView::PtInSelectedRegion( SPoint32 cpPoint ) -{ - Bool bPtInRegion = false; - Int32 right, left, top, bottom; - - if ( EDT_IS_EDITOR( ((MWContext *)*GetContext()) ) && EDT_IsSelected( *GetContext() ) ) - { - int32 start_selection, end_selection; - LO_Element * start_element = NULL; - LO_Element * end_element = NULL; - CL_Layer *layer = NULL; - // Start the search from the current selection location - LO_GetSelectionEndpoints( *GetContext(), - &start_element, - &end_element, - &start_selection, - &end_selection, - &layer); - - if ( start_element == NULL ) - return false; - - // Do.. Until would be nice! - for ( LO_Any_struct * element = (LO_Any_struct *)start_element; ; - element = (LO_Any_struct *)(element->next) ) - { - // Linefeed rect is from end of text to right ledge, so lets ignore it - if ( element->type != LO_LINEFEED ) - { - if ( element->type == LO_TEXT && - (element == (LO_Any_struct*)start_element || - element == (LO_Any_struct*)end_element) ) - { - // With 1st and last text elements, we need to - // account for character offsets from start or end of selection - - LO_TextStruct *text = (LO_TextStruct*)element; - left = element->x + element->x_offset; - top = element->y + element->y_offset; - right = left + element->width; - bottom = top + element->height; - bPtInRegion = cpPoint.h > left && - cpPoint.h < right && - cpPoint.v > top && - cpPoint.v < bottom; - } - else - { - // Get the rect surrounding selected element, - left = element->x + element->x_offset; - top = element->y + element->y_offset; - right = left + element->width; - bottom = top + element->height; - bPtInRegion = cpPoint.h > left && - cpPoint.h < right && - cpPoint.v > top && - cpPoint.v < bottom; - } - } - // We're done if we are in a rect or finished with last element - - if ( bPtInRegion || element == (LO_Any_struct*)end_element || element->next == NULL ) - { - break; - } - } - } - return bPtInRegion; -} - -// used before editSource, reload, browse -Bool CEditView::VerifySaveUpToDate() -{ - if ( !EDT_DirtyFlag( *GetContext() ) && !EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) )) - return true; - - History_entry* newEntry = SHIST_GetCurrent( &((MWContext *)*GetContext())->hist ); - CStr255 fileName; - if ( newEntry && newEntry->address ) - fileName = newEntry->address; - - MessageT itemHit = HandleModalDialog( EDITDLG_SAVE_BEFORE_BROWSE, fileName, NULL ); - if (itemHit != ok) - return false; - - return SaveDocument(); -} - - -// Call this to check if we need to force saving file -// Conditions are New, unsaved document and when editing a remote file -// Returns true for all cases except CANCEL by the user in any dialog - -Bool CEditView::SaveDocumentAs() -{ - History_entry * hist_ent = SHIST_GetCurrent( &((MWContext *)*GetContext())->hist ); - if ( hist_ent && hist_ent->address ) - { - if ( XP_STRNCMP( hist_ent->address, "file", 4 ) != 0 && CPrefs::GetBoolean( CPrefs::ShowCopyright ) ) - { // preferences - // Show a "Hint" dialog to warn user about copyright - // of downloaded documents or images - - if ( HandleModalDialog( EDITDLG_COPYRIGHT_WARNING , NULL, NULL ) == 2 ) - { - // set preference - CPrefs::SetBoolean( false, CPrefs::ShowCopyright ); - } - } - - if ( hist_ent->title && XP_STRCMP( hist_ent->title, hist_ent->address ) == 0 ) - { - // If there is no title, it will be set to URL address - /// in CFE_FinishedLayout. It makes no sense to - // use this title when changing the filename, so destroy it - XP_FREE( hist_ent->title ); - hist_ent->title = NULL; - if ( ((MWContext *)*GetContext())->title ) - { - XP_FREE( ((MWContext *)*GetContext())->title ); - ((MWContext *)*GetContext())->title = NULL; - } - } - - // Try to suggest a name if not a new doc or local directory - CStr31 pSuggested; - fe_FileNameFromContext( *GetContext(), hist_ent->address, pSuggested ); - - char viewableName[32]; - strcpy( viewableName, pSuggested ); - NET_UnEscape(viewableName); // Hex Decode - pSuggested = viewableName; - - StandardFileReply sfReply; - ::UDesktop::Deactivate(); - ::StandardPutFile( NULL, pSuggested, &sfReply ); - ::UDesktop::Activate(); - - if ( !sfReply.sfGood ) - return false; - - char *pLocalName = CFileMgr::GetURLFromFileSpec( sfReply.sfFile ); - if ( pLocalName ) - { - int16 saveCsid = (GetContext())->GetWinCSID(); - char newName[32]; - strncpy( newName, (char *)&sfReply.sfFile.name[1], sfReply.sfFile.name[0] ); - newName[ sfReply.sfFile.name[0] ] = 0; /* null-terminate */ - - EDT_PageData *pagedata; - pagedata = EDT_GetPageData( *GetContext() ); - if ( pagedata ) - { - /* this code assumes that EDT_SetPageData is not going to free the title */ - if ( ( pagedata->pTitle == NULL ) - || ( pagedata->pTitle && pagedata->pTitle[0] == 0 ) ) - { - XP_FREEIF( pagedata->pTitle ); - pagedata->pTitle = newName; - - if ( pagedata->pTitle ) - { - EDT_SetPageData( *GetContext(), pagedata ); - CEditDialog::Start( EDITDLG_PAGE_TITLE, *GetContext() ); - /* set to NULL since we didn't malloc this data & don't want it freed in EDT_FreePageData */ - pagedata->pTitle = NULL; - } - } - - EDT_FreePageData( pagedata ); - } - - if (hist_ent->title == NULL) - { - StrAllocCopy( ((MWContext *)*GetContext())->title, newName ); - SHIST_SetTitleOfCurrentDoc( *GetContext() ); - } - - Bool bKeepImagesWithDoc = CPrefs::GetBoolean( CPrefs::PublishKeepImages ); // preferences - Bool bAutoAdjustLinks = CPrefs::GetBoolean( CPrefs::PublishMaintainLinks ); - - // ignore result - EDT_SaveFile( *GetContext(), hist_ent->address, // Source - pLocalName, // Destination - true, // Do SaveAs - bKeepImagesWithDoc, bAutoAdjustLinks ); - - (GetContext())->SetWinCSID(saveCsid); - - XP_Bool doAutoSave; - int32 iSave; - PREF_GetBoolPref( "editor.auto_save", &doAutoSave ); - if ( doAutoSave ) - PREF_GetIntPref( "editor.auto_save_delay", &iSave ); - else - iSave = 0; - EDT_SetAutoSavePeriod( *GetContext(), iSave ); - - XP_FREE( pLocalName ); - return true; - } - - // Clear the flag! - } - return true; -} - - -Bool CEditView::SaveDocument() -{ - History_entry * hist_ent = SHIST_GetCurrent(&(((MWContext *)*GetContext())->hist)); - if ( hist_ent && hist_ent->address ) - { - char *szLocalFile = NULL; - - if ( !EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) ) - && XP_ConvertUrlToLocalFile( hist_ent->address, &szLocalFile ) ) - { - Bool bKeepImagesWithDoc = CPrefs::GetBoolean( CPrefs::PublishKeepImages ); - Bool bAutoAdjustLinks = CPrefs::GetBoolean( CPrefs::PublishMaintainLinks ); - - ED_FileError result = EDT_SaveFile( *GetContext(), hist_ent->address, // Source - hist_ent->address, // Destination - false, // Not doing SaveAs - bKeepImagesWithDoc, bAutoAdjustLinks ); - - if ( result == ED_ERROR_NONE ) - { - XP_Bool doAutoSave; - int32 iSave; - PREF_GetBoolPref( "editor.auto_save", &doAutoSave ); - if ( doAutoSave ) - PREF_GetIntPref( "editor.auto_save_delay", &iSave ); - else - iSave = 0; - EDT_SetAutoSavePeriod( *GetContext(), iSave ); - } - - if ( szLocalFile ) - XP_FREE( szLocalFile ); - - return true; - } - else - { - // Any URL that is NOT a file must do SaveAs to rename to a local file - // (With current model, this only happens with new document, - // editing remote URLs immediately forces SaveAs locally) - Boolean returnValue; - returnValue = SaveDocumentAs(); - - if ( returnValue ) // successfully saved - EDT_SetDirtyFlag( *GetContext(), false ); - - return returnValue; - } - } - - return true; -} - -URL_Struct *CEditView::GetURLForPrinting( Boolean& outSuppressURLCaption, MWContext *printingContext ) -{ - // for the editor, we don't want to require saving the file if it's dirty or if - // it has never been saved SO we save it to a temp file and we'll print thatÉ - MWContext *ourContext = *GetContext(); - if ( EDT_IS_EDITOR( ourContext ) - && ( EDT_DirtyFlag( ourContext ) || EDT_IS_NEW_DOCUMENT( ourContext ) ) ) - { - EDT_SaveToTempFile( *GetContext(), EditorPrintingCallback, printingContext ); - return NULL; - } - else - return CHTMLView::GetURLForPrinting( outSuppressURLCaption, printingContext ); -} - -void CEditView::DrawCaret( Boolean doErase ) -{ - if ( mHideCaret ) - return; - - FocusDraw(); - - // only draw caret if we are erasing it or if this view is the target of the window - if ( IsTarget() || doErase ) - { - StColorPenState theState; - ::PenNormal(); - ::PenMode(srcXor); - ::MoveTo(mCaretX, mCaretYLow); - ::LineTo(mCaretX, mCaretYHigh - 1); // only want to turn on pixels down to mCaretYHigh, not beyond - - mLastBlink = TickCount(); - mCaretDrawn = !mCaretDrawn; - } -} - - -void CEditView::EraseCaret() -{ - if ( mCaretDrawn ) - DrawCaret( true ); // erase it if it's on the screen so we don't leave behind carets -} - - -void CEditView::PlaceCaret( int32 caretXi, int32 caretYLowi, int32 caretYHighi ) -{ - if ( mCaretActive ) - RemoveCaret(); // did we forget to remove the last caret?! assert here? - - mCaretActive = false; - -/* This function takes the real position of a layout element, - and returns the local position and whether it is visible. - If it's not visible, the local position is not valid. -*/ - Point portOrigin = {0, 0}; - SPoint32 frameLocation; - SDimension16 frameSize; - SPoint32 imageLocation; - - PortToLocalPoint( portOrigin ); - GetFrameLocation( frameLocation ); - GetFrameSize( frameSize ); - GetImageLocation( imageLocation ); - - // convert local rectangle to image rectangle - long realFrameLeft = frameLocation.h - imageLocation.h; // frameLocation.h - portOrigin.h - imageLocation.h; - long realFrameRight = realFrameLeft + frameSize.width; - long realFrameTop = frameLocation.v - imageLocation.v; // frameLocation.v - portOrigin.v - imageLocation.v; - long realFrameBottom = realFrameTop + frameSize.height; - - // is it visible at all? If not, return - if (realFrameRight <= caretXi || realFrameLeft >= caretXi - || realFrameBottom <= caretYLowi || realFrameTop >= caretYHighi) - return; - - mCaretActive = true; - - mCaretX = caretXi + portOrigin.h + imageLocation.h; - mCaretYLow = caretYLowi + portOrigin.v + imageLocation.v; - mCaretYHigh = mCaretYLow + caretYHighi - caretYLowi; - - DrawCaret( false ); - StartIdling(); -} - - -void CEditView::RemoveCaret() -{ - mCaretActive = false; - EraseCaret(); - StopIdling(); -} - - -void CEditView::DisplayGenericCaret( MWContext *context, LO_Element * pLoAny, - ED_CaretObjectPosition caretPos ) -{ - if ( !(FocusDraw()) ) - return; - - int32 xVal, yVal, yValHigh; - - GetCaretPosition( context, pLoAny, caretPos, &xVal, &yVal, &yValHigh ); - - if ( context->is_editor ) - PlaceCaret( xVal, yVal, yValHigh ); -} - - -// forces a super-reload (not from cache) -void CEditView::DoReload( void ) -{ - Try_ - { - History_entry * history = SHIST_GetCurrent( &((MWContext *)*GetContext())->hist ); - ThrowIfNil_(history); - - SPoint32 location; - LO_Element* element; - - // We need to set the location before creating the new URL struct - GetScrollPosition( location ); - #ifdef LAYERS - element = LO_XYToNearestElement( *GetContext(), location.h, location.v, NULL ); - #else - element = LO_XYToNearestElement( *GetContext(), location.h, location.v ); - #endif // LAYERS - if ( element ) - SHIST_SetPositionOfCurrentDoc( &((MWContext *)*GetContext())->hist, element->lo_any.ele_id ); - - URL_Struct * url = SHIST_CreateURLStructFromHistoryEntry( *GetContext(), history ); - ThrowIfNil_(url); - - url->force_reload = NET_SUPER_RELOAD; - mContext->ImmediateLoadURL( url, FO_CACHE_AND_PRESENT ); - } - Catch_(inErr) - {}EndCatch_ -} - -void CEditView::NoteEditorRepagination( void ) -{ - SetFontInfo(); - - LO_InvalidateFontData( (MWContext *)(*GetContext()) ); - EDT_RefreshLayout( (MWContext *)(*GetContext()) ); - AdjustScrollBars(); -} - - -void CEditView::ActivateSelf() -{ - if ( mCaretActive ) - StartIdling(); // don't forget to restart our caret - - if ( EDT_IsFileModified( *GetContext() )) - { - History_entry* newEntry = SHIST_GetCurrent( &((MWContext *)*GetContext())->hist ); - CStr255 fileName; - if ( newEntry && newEntry->address ) - fileName = newEntry->address; - - if ( HandleModalDialog( EDITDLG_FILE_MODIFIED, fileName, NULL ) == ok ) - DoReload(); - } -} - -void CEditView::GetDefaultBackgroundColor( LO_Color* outColor ) const -{ - // if we're not done loading the editor yet, - // the default color should be the same as the browser - if ( !mEditorDoneLoading ) - { - uint8 red, green, blue; - int result = PREF_GetColorPref( "editor.background_color", &red, &green, &blue ); - if ( PREF_NOERROR == result ) - { - outColor->red = red; - outColor->green = green; - outColor->blue = blue; - } - else - CHTMLView::GetDefaultBackgroundColor( outColor ); - } -} - - -void CEditView:: DeactivateSelf() -{ - FocusDraw(); - -/* if (midocID) - { - OSErr err = ::FixTSMDocument(midocID); - ThrowIfOSErr_(err); - } -*/ - if ( mCaretActive ) - { - StopIdling(); // don't forget to stop caret - EraseCaret(); // oh yeah, and get rid of it if it is on the screen so we don't leave a caret - } -} - -// XXX CALLBACK - -void CEditView::SetDocPosition( int inLocation, Int32 inX, Int32 inY, Boolean inScrollEvenIfVisible ) -{ - // Make sure any pending updates are handled at correct origin - UpdatePort(); - CHTMLView::SetDocPosition( inLocation, inX, inY, inScrollEvenIfVisible ); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ EstablishPort -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// This is the same as CHTMLView's EstablishPort, but without the call to -// SetGDevice. We draw into a stack-based offscreen GWorld, and changing -// the current device under it did bad things (like caused the window to -// redraw all black). -Boolean -CEditView::EstablishPort() -{ - Boolean portSet = false; - GWorldPtr gworld = NULL; - - // if the current drawable, is an offscreen one, be sure to set it - if ( mCurrentDrawable != NULL ) - { - gworld = mCurrentDrawable->GetDrawableOffscreen(); - } - - if ( gworld != NULL ) - { - portSet = true; - if ( UQDGlobals::GetCurrentPort() != (GrafPtr) mGWorld ) - { - SetGWorld ( gworld, NULL ); - mOffscreenDrawable->mClipChanged = true; - } - } - else - { - // make sure to restore the main device - // SetGDevice ( GetMainDevice() ); - portSet = LView::EstablishPort(); - } - - return portSet; -} - -/* -If we are hilighted as the pane being dragged "into", we want to first hide the hilite -before drawing then draw it back. This is because we have an offscreen view which -messes up the drag hilite-ing. -*/ -void CEditView::DrawSelf() -{ - EraseCaret(); // remove caret if it is showing so we don't leave it behind - - if ( mIsHilited ) - ::HideDragHilite(mDragRef); - - CHTMLView::DrawSelf(); - - if ( mIsHilited ) - HiliteDropArea(mDragRef); -} - - -/* -Keep track of the drag reference number so we can re-hilite the drag area manually in DrawSelf. -Also, do our superclass's LDropArea::EnterDropArea behavior -*/ -void CEditView::EnterDropArea( DragReference inDragRef, Boolean inDragHasLeftSender ) -{ - if ( inDragHasLeftSender ) - mDragRef = inDragRef; - - LDropArea::EnterDropArea( inDragRef, inDragHasLeftSender ); -} - -// This method gets called when window changes size. -// Make sure we DO NOT call mContext->Repaginate() like CHTMLView does -void CEditView::AdaptToSuperFrameSize( Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, Boolean inRefresh ) -{ - LView::AdaptToSuperFrameSize( inSurrWidthDelta, inSurrHeightDelta, inRefresh ); - if (mContext) - EDT_RefreshLayout( *GetContext() ); -} - - -#if 0 -void CEditView::SetDocDimension( int /* ledge */, Int32 inWidth, Int32 inHeight ) // this overrides the SetDocDimension which does cacheing. -{ - SDimension32 theImageSize; - GetImageSize(theImageSize); - - Int32 theWidthDelta = inWidth - theImageSize.width; - Int32 theHeightDelta = inHeight - theImageSize.height; - - if ((abs(theWidthDelta) > 200) || (abs(theHeightDelta) > 200)) - { - mCachedImageSizeDelta.width = 0; - mCachedImageSizeDelta.height = 0; - SetDocDimensionSelf(theWidthDelta, theHeightDelta); - } - else - { - mCachedImageSizeDelta.width = theWidthDelta; - mCachedImageSizeDelta.height = theHeightDelta; - } -} -#endif - - -void CEditView::GetDocAndWindowPosition( SPoint32 &frameLocation, SPoint32 &imageLocation, SDimension16 &frameSize ) -{ - // Make sure we're all talking about the same thing. - FocusDraw(); - - // Get the frame and image rectangles... - GetFrameLocation( frameLocation ); - GetImageLocation( imageLocation ); - GetFrameSize( frameSize ); -} - - -void CEditView::CreateFindWindow() -{ - LWindow::CreateWindow( 5290, LCommander::GetTopCommander() ); -} - - -void CEditView::DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG) -{ - if ( mHoldUpdates ) - return; - - inherited::DisplaySubtext(inLocation, inText, inStartPos, inEndPos, inNeedBG); -} - -void CEditView::EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor) -{ - if (mHoldUpdates) - return; - - inherited::EraseBackground(inLocation, inX, inY, inWidth, inHeight, inColor); -} - - -void CEditView::DocumentChanged( int32 iStartY, int32 iHeight ) // clu - need to look at this -{ - SPoint32 frameLocation, imageLocation, updateUL, updateLR; - SDimension16 frameSize; - SDimension32 imageSize; - - // document may have grown but not enough to trigger SetDocDimension so force resize - FlushPendingDocResize(); - - if ( mHoldUpdates ) - { - mHoldUpdates->DocumentChanged( iStartY, iHeight ); - return; - } - - // Make sure we're all talking about the same thing. - FocusDraw(); - // Get the frame rectangle in port coordinates - GetFrameLocation( frameLocation ); // wimpy 16 bit coordinates - GetFrameSize( frameSize ); - - // Get the image rectangle in port coordinates - GetImageLocation( imageLocation ); // massive 32 bit coordinates - GetImageSize( imageSize ); - - // convert the frame rectangle to image coordinates // massive 32 bit coordinates - frameLocation.h = frameLocation.h - imageLocation.h; - frameLocation.v = frameLocation.v - imageLocation.v; - - // Get the region to update in image coordinates. - updateUL.h = 0; // sorry to say, the horizontal will be ignored later and set to the whole frame width - updateUL.v = iStartY; - - // we want to update all the way to right side of the frame (no matter how narrow or wide the image might be..) - updateLR.h = frameLocation.h + frameSize.width; // sorry to say, the horizontal will be ignored later and set to the whole frame width - - // if iHeight is -1, then we want to invalidate to the end of the image or the frame (whichever is lower) - // however, we are going to clip to the frame later anyway, so just invalidate to the end of the frame. - if (iHeight == -1) - updateLR.v = frameLocation.v + frameSize.height; - else - updateLR.v = iStartY + iHeight; - - // Intersect the updated rectangle with the frame rectangle and make sure they overlap (in image coordinates) - if ( sect_rect_long( frameLocation, frameSize, &updateUL, &updateLR ) ) - { - Rect updateRect; - Point ul, lr; - - // get the frame rectangle in port coordinates again. - CalcPortFrameRect( updateRect ); - - // Convert from image to local to port coordinates... we don't have to worry about the conversion because we've already been clipped to the frame - ImageToLocalPoint( updateUL, ul ); - ImageToLocalPoint( updateLR, lr ); - LocalToPortPoint( ul ); - LocalToPortPoint( lr ); - - updateRect.top = ul.v; - updateRect.bottom = lr.v; - - EraseCaret(); // erase it if it's on the screen so we don't show the caret. This should be covered by DrawSelf... -// There is a problem with the last line because Idling is still on and we may just redraw the caret before the InvalRect updates the screen. -// The next two lines are a hack. They cause the updated region to be redrawn immediately, -// this is necessary because EDT_Paste and other functions may cause an update event and then a scroll -// before allowing the updated region to be redrawn (in its old location). -// In other words, when the invalid text is scrolled out from under the update region, it is never updated. - InvalPortRect( &updateRect ); - UpdatePort(); - } -} - - -void CEditView::SpendTime( const EventRecord& inMacEvent ) -{ - if ( mCaretActive ) - if ( TickCount() > mLastBlink + ::LMGetCaretTime() ) - DrawCaret( false ); - - CHTMLView::SpendTime( inMacEvent ); -} - -void CEditView::BeTarget() -{ - FocusDraw(); - - inherited::BeTarget(); - - if ( mProxy ) - mProxy->Activate(); - -} - -void CEditView::DontBeTarget() -{ - FocusDraw(); - - try - { - - if ( mProxy ) - mProxy->Deactivate(); - - } - catch (...) - { - } - - inherited::DontBeTarget(); -} - - -/* -IsPastable shows whether or not a character can be pasted in. Note that right now Tab cannot be -pasted in, even though it is handled in EDT_PasteText(). This is because EDT_PasteText()'s -tab implementation is broken, inserting only one space. - -Note: Methods HandleKeyPress and IsPastable are dependant on each other because IsPastable -returns false for all keystrokes that HandleKeyPress handles other than the default -EDT_KeyDown. Specifically, in HandleKeyPress there is a switch statement based on -"theChar & charCodeMask". If additional case statements are added to this switch which -make it inappropriate to call EDT_KeyDown we may have to add an additional case statement -in IsPastable which returns false. - -*/ -Boolean CEditView::IsPastable(Char16 theChar) -{ - switch ( theChar & charCodeMask ) - { - case char_LeftArrow: - case char_RightArrow: - case char_UpArrow: - case char_DownArrow: - case char_Backspace: - case char_FwdDelete: - case char_Return: - case char_Enter: - case char_Tab: - case char_Home: - case char_End: - case char_PageUp: - case char_PageDown: - return false; - default: - return true; - } -} - - -/* -This function looks ahead into the Event Manager queue. It finds all of the keyDown and keyUp events. -The keyUp events it ignores. The keyDown events, if they are "normal" keystrokes, puts into the -string keys_in_q. This is then used by HandleKeyPress so that since it's already handling a key press, -why not handle the rest also. - -Unfortunately, this is a bit of a hack. Note especially that ::EventAvail() is used to check to make sure -that the event fits criteria and then ::GetNextEvent() gets the event. If inbetween calling these two -calls the Event Queue's structure is changed, this could cause inappropriate behavior. -*/ -int CEditView::FindQueuedKeys(char *keys_in_q) -{ - int curr_q_num; - EventRecord currEvent, eventToRemove; - - curr_q_num = 0; - - /* Keep getting events while: - 1) We have room in our buffer - 2) There are events in Event Manager Queue - 3) Either we get a keyUp, or we get a key down that can be pasted - */ - - - Boolean foundAndClearedEvent; - while ( (curr_q_num < (MAX_Q_SIZE-2)) && ::EventAvail( everyEvent, &currEvent ) ) - { - if ( currEvent.what == autoKey || ( (currEvent.what == keyDown) // its a backspace-keydown - && !((cmdKey | optionKey | controlKey) & currEvent.modifiers) // with no modKeys except maybe shift - && ( IsPastable( static_cast(currEvent.message & 0xFFFF) )) ) ) - { - keys_in_q[curr_q_num + 1] = static_cast(currEvent.message & 0xFF); - ++curr_q_num; - } - else if ( currEvent.what != keyUp ) // its _not_ a keyup; bail - break; // keyups don't stop us, everything else does - - foundAndClearedEvent = ::GetNextEvent( keyDownMask | keyUpMask | autoKeyMask, &eventToRemove ); - XP_ASSERT( foundAndClearedEvent ); - if ( !foundAndClearedEvent ) // something bad must have happened; bail! - break; - } - - return curr_q_num; -} - -/* -Note: Methods HandleKeyPress and IsPastable are dependant on each other because IsPastable -returns false for all keystrokes that HandleKeyPress handles other than the default -EDT_KeyDown. Specifically, in HandleKeyPress there is a switch statement based on -"theChar & charCodeMask". If additional case statements are added to this switch which -make it inappropriate to call EDT_KeyDown we may have to add an additional case statement -in IsPastable which returns false. -*/ -Boolean CEditView::HandleKeyPress( const EventRecord& inKeyEvent ) -{ - int lNumQKeys; - char keys_to_type[MAX_Q_SIZE]; - - if ( !IsDoneLoading() ) - return true; - - ::ObscureCursor(); - - Char16 theChar = inKeyEvent.message & charCodeMask; - short modifiers = inKeyEvent.modifiers & (cmdKey | shiftKey | optionKey | controlKey); - URL_Struct *request = nil; - - Boolean handled = false; - Boolean isNormalKeyPress = false; // whether or not to update buttons - Boolean shiftKeyPressed = ((modifiers & shiftKey) == shiftKey); - - if ( (modifiers & cmdKey) == 0) { // we don't do command keys. But we do everything else... - switch ( theChar ) - { - - // ¥ Navigation Keys ¥ - - case char_LeftArrow: - if (modifiers & optionKey) - EDT_PreviousWord( *GetContext(), shiftKeyPressed ); - else - EDT_PreviousChar( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_RightArrow: - if (modifiers & optionKey) - EDT_NextWord( *GetContext(), shiftKeyPressed ); - else - EDT_NextChar( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_UpArrow: - if (modifiers & optionKey) - EDT_PageUp( *GetContext(), shiftKeyPressed ); - else - EDT_Up( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_DownArrow: - if (modifiers & optionKey) - EDT_PageDown( *GetContext(), shiftKeyPressed ); - else - EDT_Down( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - - case 0xCA: // space !! - if (modifiers & optionKey) - { - EDT_InsertNonbreakingSpace( *GetContext() ); - } - else - { - EDT_KeyDown( *GetContext(), theChar, 0, 0 ); - } - handled = true; - break; - - - // ¥ Deletion Keys ¥ - - case char_Backspace: - // if no existing selection, look for consecutive backspaces - if ( !EDT_IsSelected( *GetContext() ) ) - { - EventRecord currEvent, eventToRemove; - int count = 1; // include current keypress in count - Boolean foundAndClearedEvent; - - while ( ::EventAvail( everyEvent, &currEvent ) ) - { - if ( currEvent.what == autoKey || ( currEvent.what == keyDown // its a backspace-keydown - && !((cmdKey | optionKey | controlKey) & currEvent.modifiers) // with no modKeys except maybe shift - && ( (static_cast(currEvent.message & charCodeMask)) == char_Backspace ) ) ) - ++count; - else if ( currEvent.what != keyUp )// it's _not_ a keyup; bail - break; // keyups don't stop us, everything else does - - foundAndClearedEvent = ::GetNextEvent( keyDownMask | keyUpMask | autoKeyMask, &eventToRemove ); - XP_ASSERT( foundAndClearedEvent ); - if ( !foundAndClearedEvent ) // something bad must have happened; bail! - break; - } - - if ( count > 1 ) // more than just current event? - { - while ( count > 0 ) - { - EDT_PreviousChar( *GetContext(), true ); - --count; - } - } - } - - EDT_DeletePreviousChar( *GetContext() ); - handled = true; - break; - - case char_FwdDelete: - EDT_DeleteChar( *GetContext() ); - handled = true; - break; - - - // ¥ Action Keys ¥ - - case char_Return: - if ( (modifiers & optionKey) || (modifiers & shiftKey) ) - { - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_TEXT ) - EDT_InsertBreak( *GetContext(), ED_BREAK_NORMAL ); - } - else - { - EDT_ReturnKey( *GetContext() ); - } - handled = true; - break; - - case char_Enter: - if (modifiers & optionKey) - { - EDT_ReturnKey( *GetContext() ); - } - else - { - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_TEXT ) - EDT_InsertBreak( *GetContext(), ED_BREAK_NORMAL ); - } - handled = true; - break; - - - case char_Tab: - EDT_TabKey( *GetContext(), !shiftKeyPressed, modifiers & optionKey ); -#if 0 - if (modifiers & optionKey) - EDT_Outdent( *GetContext() ); - else - EDT_Indent( *GetContext() ); -#endif - handled = true; - break; - - case char_Home: - EDT_BeginOfDocument( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_End: - EDT_EndOfDocument( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_PageUp: - EDT_PageUp( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_PageDown: - EDT_PageDown( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - default: - // normal if nothing was selected (no character deletions) and file already marked dirty - isNormalKeyPress = !EDT_IsSelected( *GetContext() ) && EDT_DirtyFlag( *GetContext() ); - - lNumQKeys = FindQueuedKeys(keys_to_type); - if (lNumQKeys > 0) - { - keys_to_type[0] = theChar; - keys_to_type[lNumQKeys + 1] = '\0'; - if ( (GetWinCSID() == CS_UTF8) || (GetWinCSID() == CS_UTF7) ) - { - INTL_Encoding_ID scriptCSID = ScriptToEncoding( ::GetScriptManagerVariable( smKeyScript ) ); - unsigned char* unicodestring = INTL_ConvertLineWithoutAutoDetect( scriptCSID, CS_UTF8, (unsigned char *)keys_to_type, lNumQKeys); - if ( unicodestring ) - { - EDT_InsertText( *GetContext(), (char *)unicodestring ); - XP_FREE( unicodestring ); - } - } - else - EDT_InsertText( *GetContext(), keys_to_type ); - } - else - { - if ( (GetWinCSID() == CS_UTF8) || (GetWinCSID() == CS_UTF7) ) - { - unsigned char characterCode[2]; - characterCode[0] = (char) theChar; - characterCode[1] = '\0'; - INTL_Encoding_ID scriptCSID = ScriptToEncoding( ::GetScriptManagerVariable( smKeyScript ) ); - unsigned char* t_unicodestring = INTL_ConvertLineWithoutAutoDetect( scriptCSID, CS_UTF8, characterCode, 1); - if ( t_unicodestring ) - { - EDT_InsertText( *GetContext(), (char *)t_unicodestring ); - XP_FREE( t_unicodestring ); - } - } - else - EDT_KeyDown( *GetContext(), theChar, 0, 0 ); - } - handled = true; - break; - } - } - else // command key - { - switch ( theChar ) - { - // ¥ Navigation Keys ¥ - case char_LeftArrow: - EDT_BeginOfLine( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_RightArrow: - EDT_EndOfLine( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_UpArrow: - EDT_BeginOfDocument( *GetContext(), shiftKeyPressed ); - handled = true; - break; - - case char_DownArrow: - EDT_EndOfDocument( *GetContext(), shiftKeyPressed ); - handled = true; - break; - } - } - - // update toolbar on navigation moves and when there is a selection - if ( handled && !isNormalKeyPress ) - { - // force menu items to update (checkMarks and text (Undo/Redo) could change) - LCommander::SetUpdateCommandStatus( true ); -// CPaneEnabler::UpdatePanes(); - } - - if ( !handled ) - handled = CHTMLView::HandleKeyPress(inKeyEvent); - - return handled; -} - -static -long GetAlignmentMenuItemNum( MWContext *mwcontext, Boolean& outEnabled ) -{ - if ( mwcontext == NULL ) - { - outEnabled = false; - return 0; - } - - ED_ElementType elementtype; - elementtype = EDT_GetCurrentElementType( mwcontext ); - - outEnabled = ( elementtype != ED_ELEMENT_UNKNOWN_TAG ); - if ( outEnabled ) - { - ED_Alignment alignment; - long itemNum; - - if ( elementtype == ED_ELEMENT_HRULE ) - { - EDT_HorizRuleData *h_data; - h_data = EDT_GetHorizRuleData( mwcontext ); - if ( h_data ) - { - alignment = h_data->align; - EDT_FreeHorizRuleData( h_data ); - } - else - alignment = ED_ALIGN_DEFAULT; - } - else /* For Images, Text, or selection, this will do all: */ - alignment = EDT_GetParagraphAlign( mwcontext ); - - switch( alignment ) - { - case ED_ALIGN_DEFAULT: - case ED_ALIGN_LEFT: itemNum = 1; break; - case ED_ALIGN_ABSCENTER: - case ED_ALIGN_CENTER: itemNum = 2; break; - case ED_ALIGN_RIGHT: itemNum = 3; break; - default: - itemNum = 0; - } - - Assert_(itemNum <= 3 || itemNum >= 0); - - outEnabled = ( itemNum != 0 ); - return itemNum; - } - - return 0; -} - -static -long GetFormatParagraphPopupItem( MWContext *mwcontext, Boolean& outEnabled, Char16& outMark ) -{ - if ( mwcontext == NULL ) - { - outEnabled = false; - return 0; - } - - long itemNum; - TagType paragraph_type = EDT_GetParagraphFormatting( mwcontext ); - switch( paragraph_type ) - { - case P_NSDT: - case P_UNKNOWN: - case P_PARAGRAPH: itemNum = 1; break; - case P_HEADER_1: itemNum = 2; break; - case P_HEADER_2: itemNum = 3; break; - case P_HEADER_3: itemNum = 4; break; - case P_HEADER_4: itemNum = 5; break; - case P_HEADER_5: itemNum = 6; break; - case P_HEADER_6: itemNum = 7; break; - case P_ADDRESS: itemNum = 8; break; - case P_PREFORMAT: itemNum = 9; break; - case P_LIST_ITEM: itemNum = 10; break; - case P_DESC_TITLE: itemNum = 11; break; - case P_DESC_TEXT: itemNum = 12; break; - default: - itemNum = 0; - } - - outMark = checkMark; - XP_ASSERT( itemNum <= 12 && itemNum >= 0 ); - - outEnabled = ( itemNum != 0 ); - - return itemNum; -} - -void CEditView::FindCommandStatus( CommandT inCommand, Boolean& outEnabled, - Boolean& outUsesMark, Char16& outMark, Str255 outName ) -{ - outUsesMark = false; - outEnabled = false; - EDT_CharacterData* better; // used by a bunch of cases. - short index; - Boolean hasBroadcasting; - - if ( ::StillDown() && IsDoneLoading() ) - { - if ( FindCommandStatusForContextMenu( inCommand, outEnabled,outUsesMark, outMark, outName ) ) - return; - } - - // if we haven't finished initializing yet very few commands should be enabled - switch ( inCommand ) - { - case cmd_AddToBookmarks: - if ( !IsDoneLoading() ) - return; - - // don't add history entries == "file:///Untitled" (unsaved editor windows) - if ( !mContext ) - break; - History_entry *histentry = mContext->GetCurrentHistoryEntry(); - if ( histentry && histentry->address ) - { - if ( 0 != XP_STRCMP( histentry->address, XP_GetString(XP_EDIT_NEW_DOC_NAME) ) ) - outEnabled = true; - } - break; - - case cmd_CheckSpelling: - case cmd_Print: - case cmd_ViewSource: - case cmd_Publish: - case cmd_Refresh: - case cmd_Format_Document: - case cmd_Format_PageTitle: - case cmd_Format_FontHierMenu: - outEnabled = IsDoneLoading(); - break; - - case 'Font': - outUsesMark = outEnabled = IsDoneLoading() && CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better /*&& better->pFontFace*/ - && mFontToolbarPopup && mFontToolbarPopup->IsEnabled() ) - { - outMark = checkMark; - - // turn off broadcasting so we don't apply it here! - hasBroadcasting = mFontToolbarPopup->IsBroadcasting(); - if ( hasBroadcasting ) - mFontToolbarPopup->StopBroadcasting(); - - // get font menu item - int menuItemNum; - Str255 fontItemString; - LMenu *ppmenu = mFontToolbarPopup->GetMenu(); - MenuHandle menuh = ppmenu ? ppmenu->GetMacMenuH() : NULL; - for ( menuItemNum = 0; menuItemNum < ::CountMenuItems( menuh ); menuItemNum++ ) - { - fontItemString[ 0 ] = 0; - ::GetMenuItemText ( menuh, menuItemNum, fontItemString ); - p2cstr( fontItemString ); - if ( XP_STRLEN((char *)fontItemString) > 0 - && ( XP_STRSTR( better->pFontFace, (char *)fontItemString ) != NULL // we found a matching font - || ( ( better->values & TF_FIXED ) != 0 && XP_STRSTR( XP_GetString(XP_NSFONT_FIXED), (char *)fontItemString ) ) // or we want "Fixed Width" - || ( !( better->values & TF_FIXED ) && !( better->values & TF_FONT_FACE ) - && XP_STRSTR( XP_GetString(XP_NSFONT_DEFAULT), (char*)fontItemString ) ) ) ) // or we want "Variable Width" - break; - } - - mFontToolbarPopup->SetValue( menuItemNum ); - - // resume broadcasting - if ( hasBroadcasting ) - mFontToolbarPopup->StartBroadcasting(); - } - if ( better ) - EDT_FreeCharacterData( better ); - } - break; - - case cmd_Font_Size_Hierarchical_Menu: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better && mSizeToolbarPopup && mSizeToolbarPopup->IsEnabled() ) - { - outMark = checkMark; - XP_ASSERT( better->iSize <= 8 || better->iSize >= 1 ); - - // turn off broadcasting so we don't apply it here! - hasBroadcasting = mSizeToolbarPopup->IsBroadcasting(); - if ( hasBroadcasting ) - mSizeToolbarPopup->StopBroadcasting(); - - mSizeToolbarPopup->SetValue( better->iSize ); // iSize is the menu itemNum not the size - - // resume broadcasting - if ( hasBroadcasting ) - mSizeToolbarPopup->StartBroadcasting(); - } - if ( better ) - EDT_FreeCharacterData( better ); - } - break; - - case cmd_Align_Hierarchical_Menu: - if ( !IsDoneLoading() ) - return; - - long alignItemNum; - alignItemNum = GetAlignmentMenuItemNum( *GetContext(), outEnabled ); - if ( outEnabled && mAlignToolbarPopup && mAlignToolbarPopup->IsEnabled() ) - { - // turn off broadcasting so we don't apply it here! - hasBroadcasting = mAlignToolbarPopup->IsBroadcasting(); - if ( hasBroadcasting ) - mAlignToolbarPopup->StopBroadcasting(); - - mAlignToolbarPopup->SetValue( alignItemNum ); - - // resume broadcasting - if ( hasBroadcasting ) - mAlignToolbarPopup->StartBroadcasting(); - } - break; - - case cmd_Paragraph_Hierarchical_Menu: - if ( !IsDoneLoading() ) - return; - - long formatItemNum; - formatItemNum = GetFormatParagraphPopupItem( *GetContext(), outEnabled, outMark ); - if ( outEnabled && mParagraphToolbarPopup && mParagraphToolbarPopup->IsEnabled() ) - { - hasBroadcasting = mParagraphToolbarPopup->IsBroadcasting(); - if ( hasBroadcasting ) - mParagraphToolbarPopup->StopBroadcasting(); - - mParagraphToolbarPopup->SetValue( formatItemNum ); - - // resume broadcasting - if ( hasBroadcasting ) - mParagraphToolbarPopup->StartBroadcasting(); - } - break; - - case cmd_Reload: - outEnabled = IsDoneLoading() && !EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) ); - break; - - case cmd_EditSource: - { - if ( !IsDoneLoading() ) - return; - - // only enable "Edit Source" if it's a local file (so we can make an FSSpec; possibly also backend reasons) - History_entry *histentry = mContext->GetCurrentHistoryEntry(); - outEnabled = histentry && histentry->address && ( 0 == XP_STRNCMP( histentry->address, "file", 4 ) ); - } - break; - - case cmd_Remove_Links: - if ( !IsDoneLoading() ) - return; - - outEnabled = EDT_SelectionContainsLink( *GetContext() ); - break; - -#if 0 - case cmd_DisplayTables: - outUsesMark = outEnabled = true; - outMark = EDT_GetDisplayTables( *GetContext() ) ? checkMark : 0; - break; -#endif - - case cmd_Format_Target: - if ( !IsDoneLoading() ) - return; - - outEnabled = ED_ELEMENT_TARGET == EDT_GetCurrentElementType( *GetContext() ); - break; - - case cmd_Format_Unknown_Tag: - if ( !IsDoneLoading() ) - return; - - outEnabled = ED_ELEMENT_UNKNOWN_TAG == EDT_GetCurrentElementType( *GetContext() ); - break; - - case cmd_Format_DefaultFontColor: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_FONT_COLOR) && !(better->values & TF_FONT_COLOR) ) - outMark = checkMark; - if ( !(better->mask & TF_FONT_COLOR) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - -//Table support - case cmd_Delete_Table: - case cmd_Select_Table: - case cmd_Select_All_Cells: - if ( !IsDoneLoading() ) - return; - - outEnabled = EDT_IsInsertPointInTable( *GetContext() ); - break; - - case cmd_Format_Table: - if ( !IsDoneLoading() ) - return; - - outEnabled = ( EDT_IsInsertPointInTableCell( *GetContext() ) - || EDT_IsInsertPointInTableRow( *GetContext() ) - || EDT_IsInsertPointInTable( *GetContext() ) ); - break; - - case cmd_Insert_Row_Above: - case cmd_Insert_Row_Below: - case cmd_Insert_Cell: - case cmd_Select_Row: - case cmd_Format_Row: - case cmd_Delete_Row: - if ( !IsDoneLoading() ) - return; - - outEnabled = EDT_IsInsertPointInTableRow( *GetContext() ); - break; - - case cmd_Insert_Col_Before: - case cmd_Insert_Col_After: - case cmd_Select_Col: - case cmd_Delete_Col: - case cmd_Delete_Cell: - case cmd_Format_Cell: - case cmd_Select_Cell: - if ( !IsDoneLoading() ) - return; - - outEnabled = EDT_IsInsertPointInTableCell( *GetContext() ); - break; - - case cmd_Split_Cell: - if ( !IsDoneLoading() ) - return; - - outEnabled = EDT_CanSplitTableCell( *GetContext() ); - break; - - case cmd_Join_With_Next_Cell: - if (!IsDoneLoading() ) - return; - - outEnabled = ( EDT_GetMergeTableCellsType (*GetContext() ) != ED_MERGE_NONE ); - break; - - case cmd_Convert_Table_To_Text: - if (!IsDoneLoading() ) - return; - - outEnabled = EDT_IsInsertPointInTableCell( *GetContext() ); - break; - - case cmd_Convert_Text_To_Table: - if (!IsDoneLoading() ) - return; - - outEnabled = EDT_CanConvertTextToTable( *GetContext() ); - break; - -#if 0 - case cmd_DisplayTableBoundaries: - outEnabled = true; - Boolean areTableBordersVisible; - areTableBordersVisible = EDT_GetDisplayTables( *GetContext() ); - index = (areTableBordersVisible) ? EDITOR_MENU_HIDE_TABLE_BORDERS : EDITOR_MENU_SHOW_TABLE_BORDERS; - ::GetIndString( outName, STRPOUND_EDITOR_MENUS, index ); - break; -#endif - - case cmd_DisplayParagraphMarks: - outEnabled = true; - index = mDisplayParagraphMarks ? EDITOR_MENU_HIDE_PARA_SYMBOLS - : EDITOR_MENU_SHOW_PARA_SYMBOLS; - ::GetIndString( outName, STRPOUND_EDITOR_MENUS, index ); - break; - - case cmd_Cut: - case cmd_Clear: - if ( !IsDoneLoading() ) - return; - - outEnabled = LO_HaveSelection( *GetContext() ) - && EDT_CanCut( *GetContext(), true ) == EDT_COP_OK; - break; - - case cmd_Copy: - outEnabled = IsDoneLoading() && LO_HaveSelection( *GetContext() ) - && EDT_CanCopy( *GetContext(), true ) == EDT_COP_OK; - break; - - case cmd_Paste: - if ( !IsDoneLoading() ) - return; - - Int32 offset; - outEnabled = EDT_CanPaste( *GetContext(), true ) == EDT_COP_OK - && (::GetScrap( NULL, 'TEXT', &offset ) > 0) - || (::GetScrap( NULL, 'EHTM', &offset ) > 0) - || (::GetScrap( NULL, 'PICT', &offset ) > 0); - break; - - case cmd_SelectAll: - outEnabled = IsDoneLoading(); - break; - - case cmd_BrowseDocument: - if ( !IsDoneLoading() ) - return; - - if ( !XP_IsContextBusy( *GetContext() ) && - !Memory_MemoryIsLow()) - outEnabled = true; - break; - - case cmd_Save: // only enable if file is dirty or new - if ( !IsDoneLoading() ) - return; - - outEnabled = ( EDT_DirtyFlag( *GetContext() ) - || EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) ) ); - break; - - case CRecentEditMenuAttachment::cmd_ID_toSearchFor: - outEnabled = true; - break; - - case cmd_SaveAs: - case cmd_InsertEdit_Target: - case cmd_InsertEditLink: - case cmd_InsertEditImage: - case cmd_InsertEditLine: - case cmd_Insert_Table: - case cmd_Insert_Target: - case cmd_Insert_Unknown_Tag: - case cmd_Insert_Link: - case cmd_Insert_Image: - case cmd_Insert_Line: - case cmd_Insert_Object: - case cmd_FormatColorsAndImage: - outEnabled = IsDoneLoading(); - break; - - -#if 0 - case cmd_Insert_NonbreakingSpace: -#endif - case cmd_Insert_BreakBelowImage: // is this always available? - case cmd_Insert_LineBreak: - outEnabled = IsDoneLoading() && - ED_ELEMENT_TEXT == EDT_GetCurrentElementType( *GetContext() ); - break; - -// Edit Menu - case cmd_Undo: - case cmd_Redo: - { - if ( !IsDoneLoading() ) - return; - - Boolean isUndoEnabled; - outEnabled = isUndoEnabled = EDT_GetUndoCommandID( *GetContext(), 0 ) != CEDITCOMMAND_ID_NULL; - if ( !isUndoEnabled ) - { // check if redo should be enabled - outEnabled = EDT_GetRedoCommandID( *GetContext(), 0 ) != CEDITCOMMAND_ID_NULL; - if ( outEnabled && inCommand != cmd_Redo ) // reset only if not already set - SetMenuCommandAndString( inCommand, cmd_Redo, STRPOUND_EDITOR_MENUS, EDITOR_MENU_REDO, outName ); - } - else if ( inCommand != cmd_Undo ) - SetMenuCommandAndString( inCommand, cmd_Undo, STRPOUND_EDITOR_MENUS, EDITOR_MENU_UNDO, outName ); - } - break; - - case cmd_Format_Paragraph_Normal: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = P_NSDT == EDT_GetParagraphFormatting( *GetContext() ) - ? checkMark : 0; - break; - - case cmd_Format_Paragraph_Head1: - case cmd_Format_Paragraph_Head2: - case cmd_Format_Paragraph_Head3: - case cmd_Format_Paragraph_Head4: - case cmd_Format_Paragraph_Head5: - case cmd_Format_Paragraph_Head6: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = EDT_GetParagraphFormatting( *GetContext() ) - == (inCommand - cmd_Format_Paragraph_Head1 + P_HEADER_1) ? checkMark : 0; - break; - - case cmd_Format_Paragraph_Address: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = P_ADDRESS == EDT_GetParagraphFormatting( *GetContext() ) - ? checkMark : 0; - break; - - case cmd_Format_Paragraph_Formatted: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = P_PREFORMAT == EDT_GetParagraphFormatting( *GetContext() ) - ? checkMark : 0; - break; - - case cmd_Format_Paragraph_List_Item: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = P_LIST_ITEM == EDT_GetParagraphFormatting( *GetContext() ) - ? checkMark : 0; - break; - - case cmd_Format_Paragraph_Desc_Title: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = P_DESC_TITLE == EDT_GetParagraphFormatting( *GetContext() ) - ? checkMark : 0; - break; - - case cmd_Format_Paragraph_Desc_Text: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - outMark = P_DESC_TEXT == EDT_GetParagraphFormatting( *GetContext() ) - ? checkMark : 0; - break; - - case cmd_Bold: // cmd_Format_Character_Bold - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_BOLD) && (better->values & TF_BOLD) ) - outMark = checkMark; - if ( !(better->mask & TF_BOLD) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Italic: // cmd_Format_Character_Italic - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_ITALIC) && (better->values & TF_ITALIC) ) - outMark = checkMark; - if ( !(better->mask & TF_ITALIC) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Underline: // cmd_Format_Character_Underline - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_UNDERLINE) && (better->values & TF_UNDERLINE) ) - outMark = checkMark; - if ( !(better->mask & TF_UNDERLINE) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Nonbreaking: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_NOBREAK) && (better->values & TF_NOBREAK) ) - outMark = checkMark; - if ( !(better->mask & TF_NOBREAK) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Superscript: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_SUPER) && (better->values & TF_SUPER) ) - outMark = checkMark; - if ( !(better->mask & TF_SUPER) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Subscript: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_SUB) && (better->values & TF_SUB) ) - outMark = checkMark; - if ( !(better->mask & TF_SUB) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Strikeout: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_STRIKEOUT) && (better->values & TF_STRIKEOUT) ) - outMark = checkMark; - if ( !(better->mask & TF_STRIKEOUT) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Blink: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ( (better->mask & TF_BLINK) && (better->values & TF_BLINK) ) - outMark = checkMark; - if ( !(better->mask & TF_BLINK) ) - outMark = dashMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Font_Size_N2: - case cmd_Format_Font_Size_N1: - case cmd_Format_Font_Size_0: - case cmd_Format_Font_Size_P1: - case cmd_Format_Font_Size_P2: - case cmd_Format_Font_Size_P3: - case cmd_Format_Font_Size_P4: - if ( !IsDoneLoading() ) - return; - - outUsesMark = outEnabled = CanUseCharFormatting(); - if ( outUsesMark ) - { - outMark = 0; - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - if ((better->mask & TF_FONT_SIZE) && better->iSize == (inCommand - cmd_Format_Font_Size_N2 + 1)) - outMark = checkMark; - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_JustifyLeft: // cmd_AlignParagraphLeft - case cmd_JustifyCenter: // cmd_AlignParagraphCenter - case cmd_JustifyRight: // cmd_AlignParagraphRight - if ( !IsDoneLoading() ) - return; - - outEnabled = CanUseCharFormatting(); - if ( outEnabled ) - { - int alignItemNum = GetAlignmentMenuItemNum( *GetContext(), - outEnabled ); - outUsesMark = true; - if ( ((alignItemNum == 1) && (inCommand == cmd_JustifyLeft)) - || ((alignItemNum == 2) && (inCommand == cmd_JustifyCenter)) - || ((alignItemNum == 3) && (inCommand == cmd_JustifyRight)) ) - outMark = checkMark; - else - outMark = 0; - } - break; - - case cmd_Format_FontColor: - case cmd_Format_Character_ClearAll: - case cmd_Format_Paragraph_Indent: - case cmd_Format_Paragraph_UnIndent: - if ( !IsDoneLoading() ) - return; - - outEnabled = CanUseCharFormatting(); - break; - - case cmd_Format_Text: // Attributes - { - if ( !IsDoneLoading() ) - return; - - outEnabled = true; - if ( CanUseCharFormatting() ) - { - if ( EDT_CanSetHREF( *GetContext() ) && EDT_GetHREF( *GetContext() )) - index = EDITOR_MENU_LINK_ATTRIBUTES; - else - { - index = EDITOR_MENU_CHARACTER_ATTRIBS; - if ( ED_ELEMENT_SELECTION == EDT_GetCurrentElementType( *GetContext() ) ) - { - // if no elements are text characteristics then--> outEnabled = false; - outEnabled = EDT_CanSetCharacterAttribute( *GetContext() ); - } - } - } - else - { - switch ( EDT_GetCurrentElementType( *GetContext() ) ) - { - case ED_ELEMENT_IMAGE: index = EDITOR_MENU_IMAGE_ATTRIBUTES; break; - case ED_ELEMENT_HRULE: index = EDITOR_MENU_LINE_ATTRIBUTES; break; - case ED_ELEMENT_TARGET: index = EDITOR_MENU_TARGET_ATTRIBUTES; break; - case ED_ELEMENT_UNKNOWN_TAG: index = EDITOR_MENU_UNKNOWN_ATTRIBUTES; break; - default: - index = EDITOR_MENU_CHARACTER_ATTRIBS; - outEnabled = false; - break; - } - } - - if ( index ) - ::GetIndString( outName, STRPOUND_EDITOR_MENUS, index ); - } - break; - - case msg_MakeNoList: - case msg_MakeNumList: - case msg_MakeUnumList: - if ( !IsDoneLoading() ) - return; - - outEnabled = true; - outUsesMark = true; - outMark = 0; - - if ( P_LIST_ITEM == EDT_GetParagraphFormatting( *GetContext() ) ) - { - EDT_ListData *list = EDT_GetListData( *GetContext() ); - if ( list ) - { - if ( inCommand == msg_MakeNoList ) - ; // already 0 - else if ( inCommand == msg_MakeUnumList ) - outMark = ( list->iTagType == P_UNUM_LIST ) ? checkMark : 0; - else if ( inCommand == msg_MakeNumList ) - outMark = ( list->iTagType == P_NUM_LIST ) ? checkMark : 0; - - EDT_FreeListData( list ); - } - } - else if (inCommand == msg_MakeNoList ) - outMark = checkMark; - break; - - case cmd_FontSmaller: // cmd_DecreaseFontSize - case cmd_FontLarger: // cmd_IncreaseFontSize - outEnabled = IsDoneLoading(); - break; - - case cmd_DocumentInfo: - outEnabled = IsDoneLoading() && !EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) ); - break; - - default: - if (inCommand >= COLOR_POPUP_MENU_BASE - && inCommand <= COLOR_POPUP_MENU_BASE_LAST) - { - // if we haven't finished initializing yet nothing should be enabled - - outEnabled = IsDoneLoading(); - if ( !outEnabled ) - return; - - if ( mColorPopup && mColorPopup->IsEnabled() ) - { - hasBroadcasting = mColorPopup->IsBroadcasting(); - if ( hasBroadcasting ) - mColorPopup->StopBroadcasting(); - - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better && better->pColor ) - { - RGBColor rgbColor; - short mItem; - - rgbColor.red = (better->pColor->red << 8); - rgbColor.green = (better->pColor->green << 8); - rgbColor.blue = (better->pColor->blue << 8); - mItem = mColorPopup->GetMenuItemFromRGBColor( &rgbColor ); - - // if it's a last resort (current item), set menu string - if ( mItem == CColorPopup::CURRENT_COLOR_ITEM ) - { - // set control to the color that just got picked - Str255 colorstr; - XP_SPRINTF( (char *)&colorstr[2], "%02X%02X%02X", better->pColor->red, better->pColor->green, better->pColor->blue); - colorstr[1] = CColorPopup::CURRENT_COLOR_CHAR; // put in leading character - colorstr[0] = strlen( (char *)&colorstr[1] ); - mColorPopup->SetDescriptor( colorstr ); - ::SetMenuItemText( mColorPopup->GetMenu()->GetMacMenuH(), - CColorPopup::CURRENT_COLOR_ITEM, - (unsigned char *)&colorstr ); - } - mColorPopup->SetValue( mItem ); - } - if ( better ) - EDT_FreeCharacterData( better ); - } - - // resume broadcasting - if ( hasBroadcasting ) - mColorPopup->StartBroadcasting(); - } - } - else - CHTMLView::FindCommandStatus( inCommand, outEnabled, outUsesMark, outMark, outName ); - } - - // force menu items to update (checkMarks and text (Undo/Redo) could change) - LCommander::SetUpdateCommandStatus( true ); -} - - -Boolean CEditView::FindCommandStatusForContextMenu( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ -#pragma unused( outUsesMark, outMark ) - - // We come here only if a CContextMenuAttachment is installed. - // Return true if we want to bypass standard status processing. - if ( !mCurrentClickRecord ) - return false; - - CHTMLClickRecord& cr = *mCurrentClickRecord; // for brevity. - Boolean isAnchor = false; - Boolean isImage = false; - Boolean isTable = false; - if ( cr.mElement ) - { - isAnchor = cr.IsAnchor(); - isImage = !isAnchor && cr.mElement->type == LO_IMAGE - && NET_URL_Type(mContext->GetCurrentURL()) != FTP_TYPE_URL; - isTable = cr.mElement->type == LO_TABLE; - } - switch ( inCommand ) - { - case cmd_Format_Text: - { - short index = 0; - outEnabled = true; - - if ( mCurrentClickRecord && mCurrentClickRecord->GetLayoutElement() - && mCurrentClickRecord->GetLayoutElement()->type == LO_TEXT ) - { - if ( EDT_CanSetHREF( *GetContext() ) && EDT_GetHREF( *GetContext() ) ) - index = EDITOR_MENU_LINK_ATTRIBUTES; - else - { - index = EDITOR_MENU_CHARACTER_ATTRIBS; - if ( ED_ELEMENT_SELECTION == EDT_GetCurrentElementType( *GetContext() ) ) - { - // if no elements are text characteristics then--> outEnabled = false; - outEnabled = EDT_CanSetCharacterAttribute( *GetContext() ); - } - } - } - else - { - if ( isAnchor ) - index = EDITOR_MENU_TARGET_ATTRIBUTES; - else - { - switch ( cr.mElement->type ) - { - case LO_IMAGE: index = EDITOR_MENU_IMAGE_ATTRIBUTES; break; - case LO_HRULE: index = EDITOR_MENU_LINE_ATTRIBUTES; break; - case LO_UNKNOWN: index = EDITOR_MENU_UNKNOWN_ATTRIBUTES; break; - default: - index = EDITOR_MENU_CHARACTER_ATTRIBS; - outEnabled = false; - break; - } - } - - } - - if ( index ) - ::GetIndString( outName, STRPOUND_EDITOR_MENUS, index ); - return true; - break; - } - - case cmd_Format_Table: - case cmd_Insert_Row_Above: - case cmd_Insert_Row_Below: - case cmd_Delete_Row: - case cmd_Insert_Col_Before: - case cmd_Insert_Col_After: - case cmd_Delete_Col: - case cmd_Insert_Cell: - case cmd_Delete_Cell: - case cmd_Delete_Table: - outEnabled = isTable; - return true; - break; - - case cmd_Insert_Image: - case cmd_Insert_Link: - outEnabled = ( mCurrentClickRecord && mCurrentClickRecord->GetLayoutElement() - && mCurrentClickRecord->GetLayoutElement()->type == LO_TEXT ); - return true; - break; - - case cmd_Insert_Table: - outEnabled = true; // always enabled (?!?); even if image or hrule selected (!!!) - return true; - break; - - case cmd_NEW_WINDOW_WITH_FRAME: - outEnabled = ((MWContext *)*GetContext())->is_grid_cell - && (GetContext()->GetCurrentHistoryEntry() != NULL); - return true; - - case cmd_OPEN_LINK: - outEnabled = isAnchor; - return true; - - case cmd_AddToBookmarks: - if ( isAnchor ) - outEnabled = true; - return true; // for now, only have a "add bookmark for this link" command. - - case cmd_SAVE_LINK_AS: - outEnabled = isAnchor; - return true; // we don't know unless it's an anchor - - case cmd_COPY_LINK_LOC: - outEnabled = isAnchor && mCurrentClickRecord->mClickURL.length() > 0; - return true; - - case cmd_VIEW_IMAGE: - case cmd_SAVE_IMAGE_AS: - case cmd_COPY_IMAGE: - case cmd_COPY_IMAGE_LOC: - case cmd_LOAD_IMAGE: - outEnabled = isImage; - return true; - } - - return false; // we don't know about it -} // CEditView::FindCommandStatusForContextMenu - - -void CEditView::TakeOffDuty() -{ - RemoveCaret(); - CHTMLView::TakeOffDuty(); -} - - -void CEditView::PutOnDuty(LCommander *inNewTarget) -{ - mCaretActive = true; - StartIdling(); - CHTMLView::PutOnDuty( inNewTarget ); -} - - -Boolean CEditView::IsMouseInSelection( SPoint32 pt, ED_HitType eHitType, Rect& selectRect ) -{ -//#pragma unused(curLayer) - - // if we're in a table's drag region, we're in a selection; bail now - if (eHitType == ED_HIT_DRAG_TABLE) - return true; - - // otherwise assume we aren't in a selection unless determined below - Boolean returnValue = false; - - // zero out rectangle - selectRect.top = selectRect.bottom = selectRect.left = selectRect.right = 0; - - int32 start_selection, end_selection; - LO_Element *start_element = NULL, *end_element = NULL; - CL_Layer *layer = NULL; - - LO_GetSelectionEndpoints( *GetContext(), &start_element, &end_element, - &start_selection, &end_selection, &layer ); - - if ( start_element == NULL ) - return false; - - int32 caretX = 0, caretYLow = 0, caretYHigh = 0; - returnValue = GetCaretPosition( *GetContext(), start_element, start_selection, - &caretX, &caretYLow, &caretYHigh ); - selectRect.left = caretX; - selectRect.top = caretYLow; - - if ( returnValue ) - GetCaretPosition( *GetContext(), end_element, end_selection, - &caretX, &caretYLow, &caretYHigh ); - - selectRect.right = caretX; - selectRect.bottom = caretYHigh; - - // check if we are actually in the selection - if ( returnValue ) - returnValue = ( pt.h >= selectRect.left && pt.h <= selectRect.right - && pt.v >= selectRect.top && pt.v <= selectRect.bottom ); - - return returnValue; -} - - -void CEditView::ClickSelf( const SMouseDownEvent &where ) -{ - if ( !IsTarget() ) - SwitchTarget( this ); - - FLUSH_JAPANESE_TEXT - - // the user may have clicked in a new location erase caret in case it happens to be drawn in the window now - EraseCaret(); - - // There is a problem with the last line because Idling is still on and - // we may just redraw the caret before the InvalRect updates the screen. So instead of - // calling FocusDraw, we use the same "hack" as the one used in CEditView::DocumentChanged. - // The following four lines cause the updated region to be redrawn immediately. - - Rect updateRect; - CalcPortFrameRect( updateRect ); - InvalPortRect( &updateRect ); - UpdatePort(); - - SPoint32 firstP; - LocalToImagePoint( where.whereLocal, firstP ); - - if ( 2 == GetClickCount() ) - { - EDT_DoubleClick( *GetContext(), firstP.h, firstP.v ); - - ED_ElementType edtElemType = EDT_GetCurrentElementType( *GetContext() ); - - if ( ED_ELEMENT_IMAGE == edtElemType ) - ObeyCommand( cmd_InsertEditImage, NULL); - - else if ( ED_ELEMENT_HRULE == edtElemType ) - ObeyCommand( cmd_InsertEditLine, NULL); - - else if ( ED_ELEMENT_TARGET == edtElemType ) - ObeyCommand( cmd_InsertEdit_Target, NULL); - - else if ( ED_ELEMENT_UNKNOWN_TAG == edtElemType ) - CEditDialog::Start( EDITDLG_UNKNOWN_TAG, *GetContext() ); - - else if ( ED_ELEMENT_TABLE == edtElemType || ED_ELEMENT_CELL == edtElemType - || ED_ELEMENT_ROW == edtElemType || ED_ELEMENT_COL == edtElemType ) - ObeyCommand( cmd_Format_Table, NULL ); - - else { -#ifdef LAYERS - LO_Element* element = LO_XYToElement( *GetContext(), firstP.h, firstP.v, 0 ); -#else - LO_Element* element = LO_XYToElement( *GetContext(), firstP.h, firstP.v ); -#endif - - Rect selectRect; - SMouseDownEvent modifiedEvent( where ); - if ( IsMouseInSelection( firstP, ED_HIT_NONE, selectRect ) ) - { - // adjust/offset event point by same amount as image point - modifiedEvent.whereLocal.h += ( selectRect.left + 1 - firstP.h ); -// modifiedEvent.whereLocal.v += ( selectRect.top + 1 - firstP.v ); - - firstP.h = selectRect.left + 1; - firstP.v = selectRect.top + 1; - } - - CHTMLClickRecord cr1( modifiedEvent.whereLocal, firstP, mContext, element ); - cr1.Recalc(); - - SInt16 mouseAction = cr1.WaitForMouseAction( where.whereLocal, where.macEvent.when, 2 * GetDblTime() ); - - if ( mouseAction == eMouseDragging ) - { - ::SafeSetCursor( iBeamCursor ); - mDoContinueSelection = true; - ClickTrackSelection( modifiedEvent, cr1 ); - mDoContinueSelection = false; - } - } - - } - else - { - LO_Element* element; -#ifdef LAYERS - element = LO_XYToElement( *GetContext(), firstP.h, firstP.v, 0 ); -#else - element = LO_XYToElement( *GetContext(), firstP.h, firstP.v ); -#endif - CHTMLClickRecord cr2( where.whereLocal, firstP, mContext, element ); - cr2.Recalc(); - - if ( element != NULL && element->type != LO_IMAGE && element->type != LO_HRULE ) - ::SafeSetCursor( iBeamCursor ); - else - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - - Rect selectRect; - Boolean isMouseInSelection = IsMouseInSelection( firstP, ED_HIT_NONE, selectRect ); - - // check if we should be drag/drop'ing or selecting - // if the shift key is down, we're not drag/drop'ing - if ( isMouseInSelection && !((where.macEvent.modifiers & shiftKey) != 0) ) - { - Boolean canDragDrop = true /* && PrefSetToDrag&Drop */; - if ( canDragDrop ) - { - ClickTrackSelection( where, cr2 ); - // update status bar??? - return; - } - } - - mDoContinueSelection = !isMouseInSelection; - ClickTrackSelection( where, cr2 ); - mDoContinueSelection = false; - } -} - - -// if we are over an edge, track the edge movement -// otherwise, track the text -// clean this up with TrackSelection in mclick.cp -Boolean CEditView::ClickTrackSelection( const SMouseDownEvent& where, - CHTMLClickRecord& inClickRecord ) -{ - long ticks = TickCount(); - Rect frame, oldSizingRect; - Boolean didTrackSelection = false, didDisplayAttachment = false; - Boolean isSizing = false; - - StopRepeating(); - - // Text selection -#ifdef SOMEDAY_MAC_EDITOR_HANDLE_LAYERS - XP_Rect theBoundingBox; - theBoundingBox.left = theBoundingBox.top = theBoundingBox.right = theBoundingBox.bottom = 0; - CL_GetLayerBboxAbsolute(inClickRecord.mLayer, &theBoundingBox); -#endif - - - // Convert from image to layer coordinates - SPoint32 theImagePointStart, theImagePointEnd, newP, scrollPos; - LocalToImagePoint( where.whereLocal, theImagePointStart ); - newP = theImagePointStart; -#ifdef SOMEDAY_MAC_EDITOR_HANDLE_LAYERS - theImagePointStart.h -= theBoundingBox.left; - theImagePointStart.v -= theBoundingBox.top; -#endif - - theImagePointEnd.h = theImagePointEnd.v = -1; - -// find out what we are doing before we start -// ARE WE IN TABLE (sizing or selecting)??? - Boolean bLock = ((where.macEvent.modifiers & cmdKey) ? true : false); - - LO_Element *pCurrentElement = NULL; - ED_HitType iTableHit; - Boolean hasSelectedTable = false; - iTableHit = EDT_GetTableHitRegion( *GetContext(), newP.h, newP.v, &pCurrentElement, bLock ); - if ( pCurrentElement ) // we're in some part of a table - { - if ( iTableHit == ED_HIT_SIZE_TABLE_WIDTH || iTableHit == ED_HIT_SIZE_TABLE_HEIGHT - || iTableHit == ED_HIT_SIZE_COL || iTableHit == ED_HIT_SIZE_ROW - || iTableHit == ED_HIT_ADD_ROWS || iTableHit == ED_HIT_ADD_COLS ) - { - isSizing = true; - } - else if ( iTableHit == ED_HIT_DRAG_TABLE ) - { - } - else if ( iTableHit != ED_HIT_NONE ) - { - hasSelectedTable = - EDT_SelectTableElement( *GetContext(), newP.h, newP.v, - pCurrentElement, iTableHit, bLock, - (where.macEvent.modifiers & shiftKey) == shiftKey ); - if ( hasSelectedTable ) - { - mDoContinueSelection = false; - UpdatePort(); -// break; // this bails out of loop on single-click; can't bring up context menu - } - } - } - -// ARE WE DRAGGING??? - Rect selectRect; - Boolean doDragSelection = IsMouseInSelection( theImagePointStart, iTableHit, selectRect ) - && !((where.macEvent.modifiers & shiftKey) != 0); - - if ( ( pCurrentElement == NULL ) // we're not in a table or not in table hotspot - || ( pCurrentElement && iTableHit == ED_HIT_NONE ) ) // get element from click record - { -// ARE WE IN A NON-TABLE SIZEABLE ELEMENT??? - pCurrentElement = inClickRecord.GetLayoutElement(); - isSizing = pCurrentElement && EDT_CanSizeObject( *GetContext(), pCurrentElement, newP.h, newP.v ); - - if ( !doDragSelection ) - { - // Setup - if ( (where.macEvent.modifiers & shiftKey) != 0 && !inClickRecord.IsClickOnAnchor() ) - EDT_ExtendSelection( *GetContext(), theImagePointStart.h, theImagePointStart.v ); // this line modified! - else if ( mDoContinueSelection ) - EDT_StartSelection( *GetContext(), theImagePointStart.h, theImagePointStart.v ); // this line modified! - } - } - - Point qdWhere; - ::GetMouse( &qdWhere ); - LocalToPortPoint( qdWhere ); // convert qdWhere to port coordinates for cursor update - AdjustCursorSelf( qdWhere, where.macEvent ); - -// INITIALIZATION FOR RESIZING INLINE - XP_Rect sizeRect; - if ( isSizing ) - { - if ( EDT_StartSizing( *GetContext(), pCurrentElement, - newP.h, newP.v, bLock, &sizeRect ) ) - { - UpdatePort(); - FocusDraw(); - GetScrollPosition( scrollPos ); - oldSizingRect.top = sizeRect.top + scrollPos.v; - oldSizingRect.bottom = sizeRect.bottom + scrollPos.v; - oldSizingRect.left = sizeRect.left + scrollPos.h; - oldSizingRect.right = sizeRect.right + scrollPos.h; - DisplaySelectionFeedback( LO_ELE_SELECTED, oldSizingRect ); - } - } - -// BEGIN ACTUAL TRACKING OF MOVEMENT - // track mouse till we are done - do { - FocusDraw(); // so that we get coordinates right - ::GetMouse( &qdWhere ); - - if ( AutoScrollImage( qdWhere ) ) // auto-scrolling - { - CalcLocalFrameRect( frame ); - if ( qdWhere.v < frame.top ) - qdWhere.v = frame.top; - else if ( qdWhere.v > frame.bottom ) - qdWhere.v = frame.bottom; - } - - LocalToImagePoint( qdWhere, newP ); - LocalToPortPoint( qdWhere ); // convert qdWhere to port coordinates for cursor update - -#ifdef SOMEDAY_MAC_EDITOR_HANDLE_LAYERS - // Convert from image to layer coordinates - newP.h -= theBoundingBox.left; - newP.v -= theBoundingBox.top; -#endif - - if ( ( newP.v != theImagePointEnd.v ) || ( newP.h != theImagePointEnd.h ) ) - { - if ( doDragSelection ) - { - // the following code can't be moved out of the StillDown() loop - // because we need to check if mouse moves so we can bring up - // context menus at the right time - - // if the mouse is not in the selection, then we will be in "move" mode - if ( !IsMouseInSelection( newP, ED_HIT_NONE, frame ) ) - { - ::SafeSetCursor( 131 ); // drag text cursor (drag copy is #6608) - - // get data (store!) since selection will change as we move around! - char *ppText = NULL; - int32 pTextLen; - EDT_ClipboardResult result; - - mDragData = NULL; - mDragDataLength = 0; - result = EDT_CopySelection( *GetContext(), &ppText, &pTextLen, - &mDragData, &mDragDataLength ); - XP_FREEIF( ppText ); - if ( result != EDT_COP_OK || mDragData == NULL ) - mDragDataLength = 0; - - // now start the dragging! - ::LocalToGlobal( &topLeft(selectRect) ); - ::LocalToGlobal( &botRight(selectRect) ); - CComposerDragTask theDragTask( where.macEvent, selectRect, *this ); - - OSErr theErr = ::SetDragSendProc(theDragTask.GetDragReference(), mSendDataUPP, (LDragAndDrop*)this); - ThrowIfOSErr_(theErr); - - theDragTask.DoDrag(); - - XP_FREEIF( mDragData ); - - InitCursor(); // reset cursor back to arrow - - return true; - } - } - else if ( isSizing ) - { - if ( EDT_GetSizingRect( *GetContext(), newP.h, newP.v, bLock, &sizeRect ) ) - { - // Remove last sizing feedback - FocusDraw(); - DisplaySelectionFeedback( LO_ELE_SELECTED, oldSizingRect ); - - GetScrollPosition( scrollPos ); - // Save the new rect. - oldSizingRect.top = sizeRect.top + scrollPos.v; - oldSizingRect.bottom = sizeRect.bottom + scrollPos.v; - oldSizingRect.left = sizeRect.left + scrollPos.h; - oldSizingRect.right = sizeRect.right + scrollPos.h; - - // then draw new feedback - DisplaySelectionFeedback(LO_ELE_SELECTED, oldSizingRect); - } - } - else - { - didTrackSelection = true; - if ( mDoContinueSelection ) - EDT_ExtendSelection( *GetContext(), newP.h, newP.v ); // this line is modified! - } - - // reset clock for context popup menu if mouse hasn't moved much - if ( abs(newP.h - theImagePointEnd.h) >= eMouseHysteresis || - abs(newP.v - theImagePointEnd.v) >= eMouseHysteresis ) - ticks = TickCount(); - } - - // if mouse hasn't moved, check if it's time to bring up context menu - if ( !isSizing - && ( doDragSelection - || ( newP.v == theImagePointEnd.v ) && ( newP.h == theImagePointEnd.h ) ) - && TickCount() > ticks + 2 * GetDblTime() ) - { - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - SInt16 mouseAction = inClickRecord.WaitForMouseAction( where, this, 2 * GetDblTime() ); - if ( mouseAction == eMouseHandledByAttachment ) - { - didDisplayAttachment = true; - break; - } - else - { - ::GetMouse( &qdWhere ); // local coords; mouse may have moved in WaitForMouseAction? - LocalToPortPoint( qdWhere ); - AdjustCursorSelf( qdWhere, where.macEvent ); - } - } - - theImagePointEnd = newP; - - // ¥Êidling - SystemTask(); - EventRecord dummy; - ::WaitNextEvent(0, &dummy, 5, NULL); - } while ( ::StillDown() ); - - if ( isSizing ) - { - // remove last sizing feedback - FocusDraw(); - DisplaySelectionFeedback( LO_ELE_SELECTED, oldSizingRect ); - - if ( abs(theImagePointStart.h - theImagePointEnd.h) >= eMouseHysteresis - || abs(theImagePointStart.v - theImagePointEnd.v) >= eMouseHysteresis ) - EDT_EndSizing( *GetContext() ); - else - { - EDT_CancelSizing( *GetContext() ); - - // move insertion caret - EDT_StartSelection( *GetContext(), theImagePointEnd.h, theImagePointEnd.v ); - EDT_EndSelection( *GetContext(), theImagePointEnd.h, theImagePointEnd.v ); - } - } - - if ( doDragSelection ) - return false; - - ::GetMouse( &qdWhere ); - LocalToImagePoint( qdWhere, newP ); - - if ( !mDoContinueSelection && !didDisplayAttachment && !isSizing && !hasSelectedTable ) - { - // mouse was in a selection but no context menu displayed - EDT_StartSelection( *GetContext(), theImagePointStart.h, theImagePointStart.v ); - EDT_ExtendSelection( *GetContext(), newP.h, newP.v ); // this line is modified! - EDT_EndSelection( *GetContext(), newP.h, newP.v ); - } - else if ( mDoContinueSelection ) - EDT_EndSelection( *GetContext(), newP.h, newP.v ); // this line modified! - - return didTrackSelection; -} - - -Boolean -CEditView::ItemIsAcceptable( DragReference inDragRef, ItemReference inItemRef ) -{ - HFSFlavor fileData; - Size dataSize = sizeof(fileData); - FlavorFlags flags; - - if ( ::GetFlavorData( inDragRef, inItemRef, flavorTypeHFS, &fileData, &dataSize, 0 ) == noErr ) - return true; // we'll take ANY file, at least as a link - - if (::GetFlavorFlags( inDragRef, inItemRef, emBookmarkDrag, &flags ) == noErr ) - return true; - - if ( ::GetFlavorFlags( inDragRef, inItemRef, 'TEXT', &flags ) == noErr ) - return true; - - if ( ::GetFlavorFlags( inDragRef, inItemRef, emComposerNativeDrag, &flags ) == noErr ) - return true; - /* - flavorTypePromiseHFS - emBookmarkFile - emXPBookmarkInternal - 'TEXT' - 'ADDR' - 'ADRS' - emBookmarkFileDrag - emBookmarkDrag - 'PICT' - MAIL_MESSAGE_FLAVOR - TEXT_FLAVOR - NEWS_ARTICLE_FLAVOR - */ - - return false; -} - -void CEditView::DoDragSendData(FlavorType inFlavor, ItemReference inItemRef, DragReference inDragRef) -{ - if ( inFlavor == emComposerNativeDrag ) - { - OSErr theErr = ::SetDragItemFlavorData( inDragRef, inItemRef, - inFlavor, mDragData, mDragDataLength, 0 ); - } - else - CHTMLView::DoDragSendData( inFlavor, inItemRef, inDragRef ); -} - - -void -CEditView::InsideDropArea(DragReference inDragRef) -{ - Point mouseLoc; - SPoint32 imagePt; - - FocusDraw(); - - ::GetDragMouse( inDragRef, &mouseLoc, NULL ); - ::GlobalToLocal( &mouseLoc ); - - Rect localFrame; - Int32 scrollLeft = 0; - Int32 scrollTop = 0; - - CalcLocalFrameRect( localFrame ); - if ( mouseLoc.h < (localFrame.left+10) ) - scrollLeft = -mScrollUnit.h; - else if ( mouseLoc.h > (localFrame.right-10) ) - scrollLeft = mScrollUnit.h; - - if ( mouseLoc.v < (localFrame.top+10) ) - scrollTop = -mScrollUnit.v; - else if ( mouseLoc.v > (localFrame.bottom-10) ) - scrollTop = mScrollUnit.v; - - if ( scrollLeft != 0 || scrollTop != 0 ) - { - if ( ScrollPinnedImageBy( scrollLeft, scrollTop, true ) ) - Draw(NULL); - } - - LocalToImagePoint( mouseLoc, imagePt ); - - /* set the insert point here so that when the drag is over we can insert in the correct place. */ - EDT_PositionDropCaret( *GetContext(), imagePt.h, imagePt.v ); -} - - -// -// ReceiveDragItem -// -// Called once for each item reference dropped on the composer window. After doing some view -// specific work, farm off the bulk of data extraction to our mixin class which will in turn -// call the HandleDropOf* classes below to do the work. -// -void -CEditView::ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttr, - ItemReference inItemRef, Rect& inItemBounds ) -{ - mIsHilited = false; - UnhiliteDropArea( inDragRef ); - - FocusDraw(); - - // store this away for later, it may be necessary - Point mouseLoc; - ::GetDragMouse( inDragRef, &mouseLoc, NULL ); - ::GlobalToLocal( &mouseLoc ); - LocalToImagePoint( mouseLoc, mDropLocationImageCoords ); - - CComposerAwareURLDragMixin::ReceiveDragItem ( inDragRef, inDragAttr, inItemRef, inItemBounds ); - -} // ReceiveDragItem - - -// -// HandleDropOfComposerFlavor -// -// Put the data in the right place, given the current mouse location (in local coords) and if this is a copy -// or a move. Will delete the current selection if it is a move. -// -void -CEditView :: HandleDropOfComposerFlavor ( const char* inData, bool inDoCopy, const Point & inMouseLocLocal ) -{ - SPoint32 mouseInImageCoords; - LocalToImagePoint( inMouseLocLocal, mouseInImageCoords ); - EDT_BeginBatchChanges( *GetContext() ); - if ( inDoCopy || mDragData == NULL ) - EDT_PositionCaret( *GetContext(), mouseInImageCoords.h, mouseInImageCoords.v ); - else - EDT_DeleteSelectionAndPositionCaret( *GetContext(), mouseInImageCoords.h, mouseInImageCoords.v ); - EDT_PasteHTML( *GetContext(), const_cast(inData), ED_PASTE_NORMAL ); - EDT_EndBatchChanges( *GetContext() ); - -} // HandleDropOfComposerFlavor - - -// -// HandleDropOfPageProxy -// -// This one's real easy since all the data extraction code is already done for us. -// -void -CEditView :: HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) -{ - char* url = const_cast(inURL); - char* title = const_cast(inTitle); - - if ( inURL ) { - if ( inTitle ) - EDT_PasteHREF( *GetContext(), &url, &title, 1 ); - else - EDT_PasteHREF( *GetContext(), &url, &url, 1 ); - } - -} // HandleDropOfPageProxy - - -// -// HandleDropOfLocalFile -// -// Accepts gif/jpeg drops and puts them inline and inserts the url for other kinds -// of files. Clippings files are already handled by responding to the 'TEXT' flavor, so we -// never get here (which is why that code was removed). -// -void -CEditView :: HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & inFileData ) -{ - Boolean isImageDropped = false; - char* URLStr = const_cast(inFileURL); - char* titleStr = const_cast(fileName); - - switch ( inFileData.fileType ) - { - case 'GIFf': - case 'JPEG': - isImageDropped = true; - titleStr = NULL; - break; - - default: - if ( inFileURL ) - { - char *link = URLStr; - Bool bAutoAdjustLinks = CPrefs::GetBoolean( CPrefs::PublishMaintainLinks ); - if ( bAutoAdjustLinks ) - { - char *abs = NULL; // lets try making it relative - if ( NET_MakeRelativeURL( LO_GetBaseURL( *GetContext() ), link, &abs ) - != NET_URL_FAIL && abs ) - { - link = abs; - abs = NULL; - } - else if ( abs ) - XP_FREE(abs); - } - - URLStr = link; - titleStr = link; - } - break; - } - - // if the user dragged an image, insert the image inline, otherwise paste in the URL (with - // title if one is present). - if ( URLStr ) { - if ( isImageDropped ) { - EDT_ImageData* imageData = EDT_NewImageData(); - if ( imageData ) - { - imageData->pSrc = XP_STRDUP(URLStr); - EDT_InsertImage( *GetContext(), imageData, CPrefs::GetBoolean( CPrefs::PublishKeepImages ) ); - EDT_FreeImageData( imageData ); - } - } - else { - if ( titleStr ) - EDT_PasteHREF( *GetContext(), &URLStr, &titleStr, 1 ); - else - EDT_PasteHREF( *GetContext(), &URLStr, &URLStr, 1 ); - } - } - -} // HandleDropOfLocalFile - - -// -// HandleDropOfText -// -// Very simple, since all of the data extraction is done for us already -// -void -CEditView :: HandleDropOfText ( const char* inTextData ) -{ - EDT_PositionCaret( *GetContext(), mDropLocationImageCoords.h, mDropLocationImageCoords.v ); - EDT_PasteText( *GetContext(), const_cast(inTextData) ); - -} // HandleDropOfText - - - -void -CEditView :: HandleDropOfHTResource ( HT_Resource /*node*/ ) -{ - DebugStr("\pNot yet implemented"); - -} // HandleDropOfHTResource - - -void CEditView::InsertDefaultLine() -{ - EDT_HorizRuleData *pData = EDT_NewHorizRuleData(); - if ( pData ) - { - EDT_InsertHorizRule( *GetContext(), pData ); - EDT_FreeHorizRuleData( pData ); - } -} - - -// should be XP code (make a list --> indent) -void CEditView::ToFromList(intn listType, ED_ListType elementType) -{ - Bool alreadySet = false; - EDT_ListData* list = NULL; - - EDT_BeginBatchChanges( *GetContext() ); - - if (P_LIST_ITEM == EDT_GetParagraphFormatting( *GetContext() ) ) - { - list = EDT_GetListData( *GetContext() ); - alreadySet = (list && ((list->iTagType == listType) || (listType == 0) ) ); - } - else if ( 0 == listType ) // doesn't want to become a list and isn't a list (disable?) - alreadySet = true; - - if ( alreadySet ) - { // ListA -> Paragraph - EDT_Outdent( *GetContext() ); - EDT_MorphContainer( *GetContext(), P_NSDT ); - } - else - { // Paragraph -> ListA, ListB -> ListA - if ( !list ) - { // make it a list - EDT_Indent( *GetContext() ); - EDT_MorphContainer( *GetContext(), P_LIST_ITEM ); - list = EDT_GetListData( *GetContext() ); - if ( list == NULL ) - { - EDT_EndBatchChanges ( *GetContext() ); - return; // assert? - } - } - - list->iTagType = listType; - list->eType = elementType; - EDT_SetListData( *GetContext(), list ); - } - - if ( list ) - EDT_FreeListData( list ); - - EDT_EndBatchChanges( *GetContext() ); -} - - -void CEditView::DisplayLineFeed( int inLocation, LO_LinefeedStruct* lineFeed, Bool needBg ) -{ - CHTMLView::DisplayLineFeed( inLocation, lineFeed, needBg ); - - if ( ! mDisplayParagraphMarks ) - return; - - // The editor only draws linefeeds which are breaks. - if ( ! lineFeed->break_type ) - return; - - // Also, don't draw mark after end-of-doc mark. - if ( lineFeed->prev && lineFeed->prev->lo_any.edit_offset < 0) - return; - - // Allow selection feedback and display of end-of-paragraph marks in the editor. - // We do nothing if this isn't an end-of-paragraph or hard break. - // If we're displaying the marks, then we display them as little squares. - // Otherwise we just do the selection feedback. - // The selection feedback is a rectangle the height of the linefeed 1/2 of the rectangle's height. - // located at the left edge of the linefeed's range. - - // We need to expand the linefeed's width here so that ResolveElement thinks it's at least as wide - // as we're going to draw it. - - Bool bExpanded = false; - - // save these to restore later. - int32 originalWidth = lineFeed->width; - int32 originalHeight = lineFeed->height; - - const int32 kMinimumWidth = 0; // Oh, I love constants in my code!! - const int32 kMaxHeight = 30; - const int32 kMinimumHeight = 0; - - int32 expandedWidth = originalWidth; - int32 expandedHeight = originalHeight; - - if ( expandedWidth < kMinimumWidth ) - { - expandedWidth = kMinimumWidth; - bExpanded = true; - } - - if ( expandedHeight < kMinimumHeight ) - { - expandedHeight = kMinimumHeight; - bExpanded = true; - } - - lineFeed->width = expandedWidth; - lineFeed->height = expandedHeight; - - if ( expandedHeight > kMaxHeight ) - expandedHeight = kMaxHeight; - - int32 desiredWidth = expandedHeight / 2 + 3; - - if ( expandedWidth > desiredWidth ) - expandedWidth = desiredWidth; - - Rect frame; - - if (!CalcElementPosition( (LO_Element*)lineFeed, frame )) - return; // can't see it. - - // Limit the size of the drawn paragraph marker. - - frame.right = frame.left + expandedWidth; - frame.bottom = frame.top + expandedHeight; - - - if ( frame.right - frame.left > 5 ) - { - frame.left += 2 + 3; - frame.right -= 2; - } - - if ( frame.bottom - frame.top > 5 ) - { - frame.top += 2; - frame.bottom -= 2; - } - - // draw line breaks at 1/3 height of paragraph marks - if ( lineFeed->break_type == LO_LINEFEED_BREAK_HARD ) - frame.top += (frame.bottom - frame.top) * 2 / 3; - - RGBColor tmp; - tmp = UGraphics::MakeRGBColor( lineFeed->text_attr->fg.red, - lineFeed->text_attr->fg.green, - lineFeed->text_attr->fg.blue ); - - // If the linefeed is selected and the linefeed color is the same as selection color, invert it. - // This doesn't do anything if there is no selection. So it is still possible for the linefeed - // fg color to be the same as the linefeed bg color or the page background color. - if ( lineFeed->ele_attrmask & LO_ELE_SELECTED ) - { - RGBColor color; - LMGetHiliteRGB( &color ); - - if ( UGraphics::EqualColor( tmp, color ) ) - { - tmp.red = ~color.red; - tmp.blue = ~color.blue; - tmp.green = ~color.green; - } - } - - ::RGBBackColor( &tmp ); - ::EraseRect( &frame ); - - // restore original size - lineFeed->width = originalWidth; - lineFeed->height = originalHeight; -} - - -void CEditView::DisplayTable( int inLocation, LO_TableStruct *inTableStruct ) -{ - Boolean hasZeroBorderWidth; - int32 savedBorderStyle; - LO_Color savedBorderColor; - Rect theFrame; - - if ( !FocusDraw() ) - return; - - if ( !CalcElementPosition( (LO_Element*)inTableStruct, theFrame ) ) - return; - - int iSelectionBorderThickness; - if ( !(inTableStruct->ele_attrmask & LO_ELE_SELECTED) ) - iSelectionBorderThickness = 0; - else - { - // set the border thickness to be the minimum of all border widths - iSelectionBorderThickness = inTableStruct->border_left_width; - if ( inTableStruct->border_right_width < iSelectionBorderThickness ) - iSelectionBorderThickness = inTableStruct->border_right_width; - if ( inTableStruct->border_top_width < iSelectionBorderThickness ) - iSelectionBorderThickness = inTableStruct->border_top_width; - if ( inTableStruct->border_bottom_width < iSelectionBorderThickness ) - iSelectionBorderThickness = inTableStruct->border_bottom_width; - - // allow for a larger selection if the border is large - if ( iSelectionBorderThickness > 2 * ED_SELECTION_BORDER ) - iSelectionBorderThickness = 2 * ED_SELECTION_BORDER; - - // else if the area is too small, use the spacing between cells - else if ( iSelectionBorderThickness < ED_SELECTION_BORDER ) - { - iSelectionBorderThickness += inTableStruct->inter_cell_space; - - // but don't use it all; stick to the minimal amount - if ( iSelectionBorderThickness > ED_SELECTION_BORDER ) - iSelectionBorderThickness = ED_SELECTION_BORDER; - } - } - - hasZeroBorderWidth = (( inTableStruct->border_width == 0 ) && - ( inTableStruct->border_top_width == 0 ) && - ( inTableStruct->border_right_width == 0 ) && - ( inTableStruct->border_bottom_width == 0 ) && - ( inTableStruct->border_left_width == 0 )); - if ( hasZeroBorderWidth ) - { - if ( 0 == inTableStruct->inter_cell_space ) - { - ::InsetRect( &theFrame, -1, -1 ); - iSelectionBorderThickness = 1; - } - - inTableStruct->border_width = 1; - inTableStruct->border_top_width = 1; - inTableStruct->border_right_width = 1; - inTableStruct->border_bottom_width = 1; - inTableStruct->border_left_width = 1; - - savedBorderStyle = inTableStruct->border_style; - inTableStruct->border_style = BORDER_DOTTED; - savedBorderColor = inTableStruct->border_color; - inTableStruct->border_color.red += 0x80; - inTableStruct->border_color.green += 0x80; - inTableStruct->border_color.blue += 0x80; - } - - CHTMLView::DisplayTable( inLocation, inTableStruct ); - - // restore previous values; necessary? - if ( hasZeroBorderWidth ) - { - inTableStruct->border_width = 0; - inTableStruct->border_top_width = 0; - inTableStruct->border_right_width = 0; - inTableStruct->border_bottom_width = 0; - inTableStruct->border_left_width = 0; - inTableStruct->border_style = savedBorderStyle; - inTableStruct->border_color = savedBorderColor; - } - - if ( (inTableStruct->ele_attrmask & LO_ELE_SELECTED) - && iSelectionBorderThickness < ED_SELECTION_BORDER ) - { - if ( iSelectionBorderThickness ) - ::InsetRect( &theFrame, iSelectionBorderThickness, iSelectionBorderThickness ); - - DisplaySelectionFeedback( LO_ELE_SELECTED, theFrame ); - } -} - - -void CEditView::DisplayCell( int inLocation, LO_CellStruct *inCellStruct ) -{ -#pragma unused( inLocation ) - - if ( !FocusDraw() ) - return; - - Rect theFrame; - if ( CalcElementPosition( (LO_Element*)inCellStruct, theFrame ) ) - { - int iBorder = 0; - - if ( (inCellStruct->ele_attrmask & LO_ELE_SELECTED) - || inCellStruct->ele_attrmask & LO_ELE_SELECTED_SPECIAL ) - { - int32 iMaxWidth = 2 * ED_SELECTION_BORDER; - - iBorder = inCellStruct->border_width; - - if ( inCellStruct->inter_cell_space > 0 && iBorder < iMaxWidth ) - { - int iExtraSpace; - iExtraSpace = ::min( iMaxWidth - iBorder, inCellStruct->inter_cell_space / 2 ); - iBorder += iExtraSpace; - InsetRect( &theFrame, -iExtraSpace, -iExtraSpace ); - } - } - - if ( inCellStruct->border_width == 0 || LO_IsEmptyCell( inCellStruct ) ) - { - StColorPenState state; - PenPat( &qd.gray ); - PenMode( srcXor ); - - if ( (inCellStruct->ele_attrmask & LO_ELE_SELECTED) - || (inCellStruct->ele_attrmask & LO_ELE_SELECTED_SPECIAL ) ) - ::PenSize( ED_SELECTION_BORDER, ED_SELECTION_BORDER ); - - FrameRect( &theFrame ); - } - else if ( (inCellStruct->ele_attrmask & LO_ELE_SELECTED) - || inCellStruct->ele_attrmask & LO_ELE_SELECTED_SPECIAL ) - { - if ( iBorder < ED_SELECTION_BORDER ) - InsetRect( &theFrame, 1, 1 ); - - // don't have a color from table data so use highlight color from system - RGBColor borderColor; - ::LMGetHiliteRGB( &borderColor ); - if ( inCellStruct->ele_attrmask & LO_ELE_SELECTED_SPECIAL ) - DisplayGrooveRidgeBorder( theFrame, borderColor, true, iBorder, iBorder, iBorder, iBorder ); - else if ( /* LO_ELE_SELECTED && */ iBorder < ED_SELECTION_BORDER ) - // draw selection inside cell border if not enough room - DisplaySelectionFeedback( LO_ELE_SELECTED, theFrame ); - else /* just LO_ELE_SELECTED */ - DisplaySolidBorder( theFrame, borderColor, iBorder, iBorder, iBorder, iBorder ); - } - else /* non-empty, non-zero border, non-selected, non-"special" --> Everything else */ - { - // ¥Êthis is really slow LAM - for ( int i = 1; i <= inCellStruct->border_width; i++ ) - { - UGraphics::FrameRectShaded( theFrame, true ); - ::InsetRect( &theFrame, 1, 1 ); - } - } - } -} - - -void CEditView::UpdateEnableStates() -{ - CPaneEnabler::UpdatePanes(); -} - - -void CEditView::DisplayFeedback( int inLocation, LO_Element *inElement ) -{ -#pragma unused(inLocation) - - if (!FocusDraw() || (inElement == NULL)) - return; - - // we only know how to deal with images and tables and cells right now - if ( inElement->lo_any.type != LO_IMAGE ) - return; - - LO_ImageStruct *image = (LO_ImageStruct *)inElement; - - // if it's not selected we are done - if (( image->ele_attrmask & LO_ELE_SELECTED ) == 0 ) - return; - - int selectionBorder = 3; - int32 layerOriginX, layerOriginY; - SPoint32 topLeftImage; - Point topLeft; - Rect borderRect; - - if ( mCurrentDrawable != NULL ) - mCurrentDrawable->GetLayerOrigin(&layerOriginX, &layerOriginY); - else - { - layerOriginX = mLayerOrigin.h; - layerOriginY = mLayerOrigin.v; - } - - topLeftImage.h = image->x + image->x_offset + layerOriginX; - topLeftImage.v = image->y + image->y_offset + layerOriginY; - ImageToLocalPoint(topLeftImage, topLeft); - - borderRect.left = topLeft.h; - borderRect.top = topLeft.v; - borderRect.right = borderRect.left + image->width - + (2 * image->border_width); - borderRect.bottom = borderRect.top + image->height - + (2 * image->border_width); - - ::PenSize( selectionBorder, selectionBorder ); - ::PenMode( patXor ); - ::PenPat( &qd.dkGray ); - - ::FrameRect(&borderRect); - - // reset pen size, mode, and pattern - ::PenNormal(); -} - - -// this is not an FE_* call -void CEditView::DisplaySelectionFeedback( uint16 ele_attrmask, const Rect &inRect ) -{ - Boolean isSelected = ele_attrmask & LO_ELE_SELECTED; - if ( !isSelected ) - return; - - Rect portizedRect; - SPoint32 updateUpperLeft, updateLowerRight; - - // Get the rect to update in image coordinates. - updateUpperLeft.h = inRect.left; // sorry to say, the horizontal will be ignored - updateUpperLeft.v = inRect.top; // later and set to the whole frame width - updateLowerRight.h = inRect.right; - updateLowerRight.v = inRect.bottom; - - // Convert from image to local coordinates... - ImageToLocalPoint( updateUpperLeft, topLeft(portizedRect) ); - ImageToLocalPoint( updateLowerRight, botRight(portizedRect) ); - - int32 rWidth = portizedRect.right - portizedRect.left; - int32 rHeight = portizedRect.bottom - portizedRect.top; - if ( rWidth <= (ED_SELECTION_BORDER*2) || rHeight <= (ED_SELECTION_BORDER*2) ) - { - // Too narrow to draw frame. Draw solid. - ::InvertRect( &portizedRect ); - } - else - { - ::PenSize( ED_SELECTION_BORDER, ED_SELECTION_BORDER ); - ::PenMode( srcXor ); - ::FrameRect( &portizedRect ); - ::PenNormal(); - } -} - - -/* This should invalidate the entire table or cell rect to cause redrawing of backgrounds - * and all table or cell contents. Use to unselect table/cell selection feedback -*/ -void CEditView::InvalidateEntireTableOrCell( LO_Element* inElement ) -{ - if ( !FocusDraw() ) - return; - - int32 iWidth, iHeight; - if ( inElement->type == LO_TABLE ) - { - iWidth = inElement->lo_table.width; - iHeight = inElement->lo_table.height; - } - else if ( inElement->type == LO_CELL ) - { - iWidth = inElement->lo_cell.width; - iHeight = inElement->lo_cell.height; - } - else - return; // Only Table and Cell types allowed - - Rect r; - r.left = inElement->lo_any.x; - r.top = inElement->lo_any.y; - r.right = r.left + iWidth; - r.bottom = r.top + iHeight; - - if ( inElement->type == LO_TABLE - && inElement->lo_table.border_left_width == 0 - && inElement->lo_table.border_right_width == 0 - && inElement->lo_table.border_top_width == 0 - && inElement->lo_table.border_bottom_width == 0 ) - { - // We are displaying a "zero-width" table, - // increase rect by 1 pixel because that's - // where we drew the table's dotted-line border - ::InsetRect( &r, -1, -1 ); - } - - // Include the inter-cell spacing area also used for highlighting a cell - int32 iExtraSpace; - if ( inElement->type == LO_CELL - && inElement->lo_cell.border_width < eSelectionBorder - && 0 < (iExtraSpace = inElement->lo_cell.inter_cell_space / 2) ) - { - ::InsetRect( &r, -iExtraSpace, -iExtraSpace ); - } - - ::InvalRect( &r ); -} - - -void CEditView::DisplayAddRowOrColBorder( XP_Rect* inRect, XP_Bool inDoErase ) -{ - if ( !FocusDraw() ) - return; - - if ( inDoErase ) - { - SPoint32 updateUL, updateLR; - Point ul, lr; - - // Get the rect to update in image coordinates. - updateUL.h = inRect->left; // sorry to say, the horizontal will be ignored later and set to the whole frame width - updateUL.v = inRect->top; - updateLR.h = inRect->right; - updateLR.v = inRect->bottom; - - // Convert from image to local to port coordinates... we don't have to worry about the conversion because we've already been clipped to the frame - ImageToLocalPoint( updateUL, ul ); - ImageToLocalPoint( updateLR, lr ); - LocalToPortPoint( ul ); - LocalToPortPoint( lr ); - - Rect r; - r.top = ul.v; - r.left = ul.h; - r.bottom = lr.v; - r.right = lr.h; - - // if there is no line thickness - if ( inRect->left == inRect->right ) - r.right++; - else // we're working on rows (horizontal line) - { - // increment bottom to ensure it's a valid rect - XP_ASSERT( inRect->top == inRect->bottom ); - r.bottom++; - } - - ::InvalRect( &r ); - - // force redraw in cases where dragging - UpdatePort(); - } - else - { - StColorPenState state; - PenPat( &qd.gray ); - PenMode( srcXor ); - - ::MoveTo( inRect->left, inRect->top ); - ::LineTo( inRect->right, inRect->bottom ); - } -} - - -void CEditView::DisplayHR( int inLocation, LO_HorizRuleStruct* hrule ) -{ - if ( hrule->edit_offset != -1 || mDisplayParagraphMarks ) - CHTMLView::DisplayHR( inLocation, hrule ); -} - - -void CEditView::HandleCut() -{ - char *ppText = NULL, *ppHtml = NULL; - int32 pTextLen = 0, pHtmlLen = 0; - - if ( EDT_COP_OK != EDT_CutSelection( *GetContext(), &ppText, &pTextLen, &ppHtml, &pHtmlLen ) ) - { - ErrorManager::PlainAlert( CUT_ACROSS_CELLS ); - } - - try { - LClipboard::GetClipboard()->SetData( 'TEXT', ppText, pTextLen, true ); - LClipboard::GetClipboard()->SetData( 'EHTM', ppHtml, pHtmlLen, false ); - } - catch(...) - {} - - XP_FREEIF( ppText ); - XP_FREEIF( ppHtml ); -} - - -void CEditView::HandleCopy() -{ - char *ppText = NULL, *ppHtml = NULL; - int32 pTextLen = 0, pHtmlLen = 0; - - if ( EDT_COP_OK != EDT_CopySelection( *GetContext(), &ppText, &pTextLen, &ppHtml, &pHtmlLen ) ) - { - ErrorManager::PlainAlert( CUT_ACROSS_CELLS ); - } - - try { - LClipboard::GetClipboard()->SetData( 'TEXT', ppText, pTextLen, true ); - LClipboard::GetClipboard()->SetData( 'EHTM', ppHtml, pHtmlLen, false ); - } - catch(...) - {} - - XP_FREEIF( ppText ); - XP_FREEIF( ppHtml ); -} - - -void CEditView::HandlePaste() -{ - int32 dataLength; - -/* internal format */ - dataLength = LClipboard::GetClipboard()->GetData( 'EHTM', NULL ); - if ( dataLength > 0 ) - { - Handle htmlHandle = ::NewHandle( dataLength + 1 ); - if ( htmlHandle ) - { - LClipboard::GetClipboard()->GetData( 'EHTM', htmlHandle ); - ::HLock( htmlHandle ); - (*htmlHandle)[ dataLength ] = '\0'; - int result = EDT_PasteHTML( *GetContext(), *htmlHandle, ED_PASTE_NORMAL ); - ::DisposeHandle( htmlHandle ); - return; - } - } - -/* text */ - dataLength = LClipboard::GetClipboard()->GetData( 'TEXT', NULL ); - if ( dataLength > 0 ) - { - Handle textHandle = ::NewHandle( dataLength + 1 ); - if ( textHandle ) - { - LClipboard::GetClipboard()->GetData( 'TEXT', textHandle ); - ::HLock( textHandle ); - (*textHandle)[ dataLength ] = '\0'; - int result = EDT_PasteText( *GetContext(), *textHandle ); - ::DisposeHandle( textHandle ); - return; - } - } - -/* The rest is all PICT (ugh!) */ - dataLength = LClipboard::GetClipboard()->GetData( 'PICT', NULL ); - if ( dataLength <= 0 ) - return; - - // check for quicktime and jpeg compressor - Int32 response; - if ( ::Gestalt( gestaltQuickTime, &response ) != noErr - || ::Gestalt( gestaltCompressionMgr, &response ) != noErr ) - return; - - // get location where to save new jpeg file - StandardFileReply sfReply; - Str255 saveprompt; - - // Because resource changes are expensive (right now) for localization - // this string was added to a "strange" place - ::GetIndString( sfReply.sfFile.name, STRPOUND_EDITOR_MENUS, 18 ); - ::GetIndString( saveprompt, STRPOUND_EDITOR_MENUS, 19 ); - - ::UDesktop::Deactivate(); - ::StandardPutFile( saveprompt[0] ? saveprompt : NULL, sfReply.sfFile.name, &sfReply ); - ::UDesktop::Activate(); - - if ( !sfReply.sfGood ) - return; - - Handle pictDataHandle = ::NewHandle( dataLength ); - if ( pictDataHandle == NULL ) - return; - ::HUnlock( pictDataHandle ); - - LClipboard::GetClipboard()->GetData( 'PICT', pictDataHandle ); - - OSErr err; - if ( !sfReply.sfReplacing ) - { - // create file - err = FSpCreateCompat( &sfReply.sfFile, emSignature, 'JPEG', smSystemScript ); - if ( err ) - { - ::DisposeHandle( pictDataHandle ); - return; - } - } - - // open file - short refNum; - err = ::FSpOpenDFCompat( &sfReply.sfFile, fsRdWrPerm, &refNum ); - if ( err ) - { - if ( !sfReply.sfReplacing ) - FSpDeleteCompat( &sfReply.sfFile ); - ::DisposeHandle( pictDataHandle ); - return; - } - - // write out header - int zero = 0; - long actualSizeWritten = sizeof( zero ); - for ( int count = 1; actualSizeWritten && (count <= (512 / actualSizeWritten)) && err == noErr; count++ ) - err = ::FSWrite( refNum, &actualSizeWritten, &zero ); - - // write out data - ::HLock( pictDataHandle ); - actualSizeWritten = dataLength; - err = FSWriteVerify( refNum, &actualSizeWritten, *pictDataHandle ); - DisposeHandle( pictDataHandle ); - if ( err ) - { - ::FSClose( refNum ); - FSpDeleteCompat( &sfReply.sfFile ); - return; - } - - // overwrite file in place - err = ::CompressPictureFile( refNum, refNum, codecNormalQuality, 'jpeg' ); - if ( err != noErr ) - { - ::FSClose( refNum ); - FSpDeleteCompat( &sfReply.sfFile ); - return; - } - - // re-write file as jpeg (not PICT) - long totalSize, bytesToWrite; - char buffer[512]; - char jfifMarker1[3] = { 0xFF, 0xD8, 0xFF }; - char jfifMarker2[4] = { 'J', 'F', 'I', 'F' }; - - ::SetFPos( refNum, fsFromLEOF, 0 ); - ::GetFPos( refNum, &totalSize ); - ::SetFPos( refNum, fsFromStart, 512 ); - - // skip over remainder of non-JFIF header - // KNOWN BUG: if JFIF header is split over two FSReads we'll miss it in the loop below - Boolean headerFound = false; - while ( err == noErr && !headerFound ) - { - bytesToWrite = 512; - err = ::FSRead( refNum, &bytesToWrite, buffer ); - if ( err == noErr ) - { - int index = 0; - for ( index = 0; index < bytesToWrite - sizeof( jfifMarker1 ); index++ ) - { - if ( 0 == memcmp( &buffer[ index ], jfifMarker1, sizeof(jfifMarker1) ) ) - { - if ( index + 4 + 2 > bytesToWrite // assume it's there without checking - || 0 == memcmp( &buffer[ index + 6 ], jfifMarker2, sizeof(jfifMarker2) ) ) - { - // move fpos back to the start of jfifMarker - err = ::SetFPos( refNum, fsFromMark, -( bytesToWrite - index) ); - headerFound = true; - break; - } - } - } - } - } - - if ( err ) // jfif header not found?? - { - ::FSClose( refNum ); - FSpDeleteCompat( &sfReply.sfFile ); - return; - } - - long fileOffset; - ::GetFPos( refNum, &fileOffset ); - - // write remainder (current fpos) as jfif to start of file - Boolean doneReadingFile = false; - actualSizeWritten = fileOffset; - while ( actualSizeWritten < totalSize && err == noErr ) - { - bytesToWrite = sizeof( buffer ); - err = ::FSRead( refNum, &bytesToWrite, buffer ); - - // ignore eofErr if we have more bytesToWrite - if ( err == eofErr && bytesToWrite ) - err = noErr; - - // move file pointer back to 512 bytes less than where we began read - if ( err == noErr ) - { - ::SetFPos( refNum, fsFromStart, actualSizeWritten - fileOffset ); - - err = ::FSWrite( refNum, &bytesToWrite, buffer ); - - actualSizeWritten += bytesToWrite; - ::SetFPos( refNum, fsFromStart, actualSizeWritten ); - } - } - - ::SetEOF( refNum, actualSizeWritten - fileOffset ); - - ::FSClose( refNum ); - - // create image link - EDT_ImageData *image = EDT_NewImageData(); - if ( image == NULL ) - return; - - image->pSrc = CFileMgr::GetURLFromFileSpec( sfReply.sfFile ); - if ( image->pSrc ) - EDT_InsertImage( *GetContext(), image, true ); - EDT_FreeImageData( image ); -} - - -void CEditView::AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ) -{ - // if this page is tied-up, display a watch - if (!IsDoneLoading() ) - { - ::SafeSetCursor( watchCursor ); - return; - } - - // bail if we did not move, saves time and flickering - if ( ( inPortPt.h == mOldPoint.h ) && ( inPortPt.v == mOldPoint.v ) ) - return; - - // store for the next time we get called - mOldPoint.h = inPortPt.h; - mOldPoint.v = inPortPt.v; - - // find the element the cursor is above - PortToLocalPoint( inPortPt ); - - SPoint32 firstP; - LocalToImagePoint( inPortPt, firstP ); - FocusDraw(); // Debugging only - -#ifdef LAYERS - LO_Element* element = LO_XYToElement( *GetContext(), firstP.h, firstP.v, 0 ); -#else - LO_Element* element = LO_XYToElement( *GetContext(), firstP.h, firstP.v ); -#endif - - // The cursor is over an image or hrule - if ( element && (element->type == LO_IMAGE || element->type == LO_HRULE) ) - { - if ( mOldLastElementOver != -1 ) - { - mOldLastElementOver = element->lo_any.ele_id; - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - // mContext->Progress( CStr255::sEmptyString ); - return; - } - } - - ED_HitType iTableHit; - iTableHit = EDT_GetTableHitRegion( *GetContext(), firstP.h, firstP.v, &element, - (inMacEvent.modifiers & cmdKey) == cmdKey ); - if ( element ) - { - int specialElementID = element->lo_any.ele_id + (iTableHit * 0x01000000); - if ( mOldLastElementOver != specialElementID ) - { - mOldLastElementOver = specialElementID; - // mContext->Progress( CStr255::sEmptyString ); - - switch ( iTableHit ) - { - case ED_HIT_SEL_ALL_CELLS: - case ED_HIT_SEL_TABLE: ::SafeSetCursor( 12001 ); break; - case ED_HIT_SEL_COL: ::SafeSetCursor( 12003 ); break; - case ED_HIT_SEL_ROW: ::SafeSetCursor( 12002 ); break; - case ED_HIT_SEL_CELL: ::SafeSetCursor( 12000 ); break; - case ED_HIT_SIZE_TABLE_WIDTH: ::SafeSetCursor( 12005 ); break; - case ED_HIT_SIZE_TABLE_HEIGHT: ::SafeSetCursor( 12004 ); break; - case ED_HIT_SIZE_COL: ::SafeSetCursor( 130 ); break; - case ED_HIT_SIZE_ROW: ::SafeSetCursor( 129 ); break; - case ED_HIT_ADD_ROWS: ::SafeSetCursor( 12006 ); break; - case ED_HIT_ADD_COLS: ::SafeSetCursor( 12007 ); break; - default: ::SafeSetCursor( iBeamCursor ); - } - } - } - else - { - // The cursor is over blank space - if ( mOldLastElementOver != -1 ) - { - mOldLastElementOver = -1; - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - // ::SafeSetCursor( iBeamCursor ); // not sure if I should do this if element is NULL - // mContext->Progress( CStr255::sEmptyString ); - } - else - ::SafeSetCursor( iBeamCursor ); - } - -} - -void CEditView::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case cmd_Bold: - case cmd_Italic: - case cmd_Underline: - case cmd_FontSmaller: - case cmd_FontLarger: - case cmd_Print: - case cmd_Format_FontColor: - case cmd_InsertEditImage: - case cmd_InsertEditLink: - case cmd_Insert_Table: - case cmd_InsertEdit_Target: - case cmd_Insert_Target: - case cmd_Insert_Line: - case msg_MakeNoList: - case msg_MakeNumList: - case msg_MakeUnumList: - case cmd_Format_Paragraph_Indent: - case cmd_Format_Paragraph_UnIndent: - case cmd_JustifyLeft: - - case cmd_Cut: - case cmd_Copy: - case cmd_Paste: - ObeyCommand( inMessage, ioParam ); - break; - - case cmd_FormatViewerFont: - case cmd_FormatFixedFont: - break; - - case msg_NSCPEditorRepaginate: - // turn off repagination to avoid infinite loop when setting prefs - Boolean isRepaginating = GetRepaginate(); - if ( isRepaginating ) - SetRepaginate( false ); - - NoteEditorRepagination(); - - // turn off repagination to avoid infinite loop when setting prefs - if ( isRepaginating ) - SetRepaginate( true ); - break; - - default: - if (inMessage >= COLOR_POPUP_MENU_BASE && inMessage <= COLOR_POPUP_MENU_BASE_LAST) - ObeyCommand( inMessage, ioParam ); - break; - - } -} - - -Boolean CEditView::ObeyCommand( CommandT inCommand, void *ioParam ) -{ - EDT_CharacterData* better; // used by a bunch of cases. - - if (inCommand >= COLOR_POPUP_MENU_BASE && inCommand <= COLOR_POPUP_MENU_BASE_LAST) - { - FLUSH_JAPANESE_TEXT - if ( mColorPopup && mColorPopup->IsEnabled() ) - { - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - RGBColor outColor; - LO_Color pColor = {0, 0, 0}; - short mItem; - - if ( !EDT_GetFontColor( *GetContext(), &pColor ) ) - { // still a perfectly respectable way to get the font color - // get default color - EDT_PageData *pagedata = EDT_GetPageData( *GetContext() ); - if ( pagedata ) - { - pColor = *pagedata->pColorText; - EDT_FreePageData( pagedata ); - } - } - - mItem = inCommand - COLOR_POPUP_MENU_BASE + 1; - if ( mColorPopup->GetMenuItemRGBColor( mItem, &outColor ) == true ) - { - pColor.red = (outColor.red >> 8); - pColor.green = (outColor.green >> 8); - pColor.blue = (outColor.blue >> 8); - - better->mask = TF_FONT_COLOR; - better->values = (mItem == CColorPopup::DEFAULT_COLOR_ITEM) ? 0 : TF_FONT_COLOR; - // remove font color? or set font color? - better->pColor = &pColor; - EDT_BeginBatchChanges( *GetContext() ); - EDT_SetCharacterData( *GetContext(), better ); - EDT_SetFontColor( *GetContext(), &pColor ); - EDT_EndBatchChanges( *GetContext() ); - better->pColor = NULL; - } - - EDT_FreeCharacterData( better ); - } - } - } - - } - else if (inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) // FindCommandStatus for encoding is handled in the parent class - CHTMLView - { - FLUSH_JAPANESE_TEXT - int16 csid = CPrefs::CmdNumToDocCsid( inCommand ); - if ( !EDT_SetEncoding ( *GetContext(), csid ) ) return true; - // if EDT_SetEncoding returns false, we are done - don't go to the switch statement - } - - switch ( inCommand ) - { - case cmd_Publish: - CEditDialog::Start( EDITDLG_PUBLISH, *GetContext(), 1 ); - break; - - case cmd_Refresh: - EDT_RefreshLayout( *GetContext() ); - break; - -#ifdef MOZ_MAIL_COMPOSE - case cmd_MailDocument: - FLUSH_JAPANESE_TEXT - EDT_MailDocument( *GetContext() ); - break; -#endif - - case cmd_ViewSource: - FLUSH_JAPANESE_TEXT - EDT_DisplaySource( *GetContext() ); - break; - - case cmd_EditSource: - FLUSH_JAPANESE_TEXT - if (VerifySaveUpToDate()) - { - // Now that we have saved the document, lets get an FSSpec for it. - History_entry *hist_ent = SHIST_GetCurrent( &(((MWContext *)*GetContext())->hist) ); - if ( hist_ent == NULL || hist_ent->address == NULL ) - break; - - FSSpec theDocument; - if ( noErr != CFileMgr::FSSpecFromLocalUnixPath( - hist_ent->address + XP_STRLEN("file://"), &theDocument, false ) ) - break; - - // Get the FSSpec for the editor - FSSpec theApplication; - XP_Bool hasEditor = false; - PREF_GetBoolPref( "editor.use_html_editor", &hasEditor ); - if ( hasEditor ) - theApplication = CPrefs::GetFolderSpec(CPrefs::HTMLEditor); - - // Oops, the user has not picked an app in the preferences yet. - if ( !hasEditor || (theApplication.vRefNum == -1 && theApplication.parID == -1) ) - { - ErrorManager::PlainAlert( NO_SRC_EDITOR_PREF_SET ); - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandEditor, - PrefPaneID::eEditor_Main ); - break; - } - else - StartDocInApp( theDocument, theApplication ); - } - break; - - case cmd_Reload: - FLUSH_JAPANESE_TEXT - if ( !EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) ) ) - if ( VerifySaveUpToDate() ) - DoReload(); - break; - - case cmd_Remove_Links: - FLUSH_JAPANESE_TEXT - EDT_SetHREF( *GetContext(), NULL ); - break; - -#if 0 - case cmd_DisplayTables: - EDT_SetDisplayTables( *GetContext(), - !EDT_GetDisplayTables( *GetContext() ) ); - break; -#endif - - case cmd_Format_Target: - CEditDialog::Start( EDITDLG_TARGET, *GetContext(), 0, false ); - break; - - case cmd_Format_Unknown_Tag: - CEditDialog::Start( EDITDLG_UNKNOWN_TAG, *GetContext() ); - break; - - case cmd_Format_DefaultFontColor: - FLUSH_JAPANESE_TEXT - EDT_SetFontColor( *GetContext(), NULL ); - break; - - case cmd_DisplayParagraphMarks: - // update the whole view - mDisplayParagraphMarks = !mDisplayParagraphMarks; - if ( IsDoneLoading() ) - EDT_RefreshLayout( *GetContext() ); - break; - -// File/Edit Toolbar - case cmd_Save: - FLUSH_JAPANESE_TEXT - SaveDocument(); - break; - - case cmd_SaveAs: - SaveDocumentAs(); - break; - - case cmd_BrowseDocument: - FLUSH_JAPANESE_TEXT - if ( VerifySaveUpToDate() ) - { - History_entry* current = SHIST_GetCurrent( &(((MWContext *)*GetContext())->hist) ); - if ( !current ) - break; - - URL_Struct * nurl = NULL; - if ( current && current->address ) - nurl = NET_CreateURLStruct( current->address, NET_DONT_RELOAD ); - - if ( !nurl ) - break; - - try - { - CURLDispatcher::DispatchURL( nurl, NULL ); - } - catch(...) { } - } - break; - - case cmd_Cut: - FLUSH_JAPANESE_TEXT - HandleCut(); - break; - - case cmd_Copy: - FLUSH_JAPANESE_TEXT - HandleCopy(); - break; - - case cmd_Paste: - FLUSH_JAPANESE_TEXT - HandlePaste(); - break; - - case cmd_Clear: - FLUSH_JAPANESE_TEXT - if ( EDT_CanCut( *GetContext(), true ) == EDT_COP_OK ) - EDT_DeletePreviousChar( *GetContext() ); - break; - - case cmd_SelectAll: - FLUSH_JAPANESE_TEXT - EDT_SelectAll( *GetContext() ); - break; - - case cmd_Print: - case cmd_PrintOne: - FLUSH_JAPANESE_TEXT - DoPrintCommand( inCommand ); - break; - -// Character Toolbar - case cmd_FontSmaller: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - EDT_SetFontSize( *GetContext(), - EDT_GetFontSize( *GetContext()) - 1 ); - break; - - case cmd_FontLarger: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - EDT_SetFontSize( *GetContext(), - EDT_GetFontSize( *GetContext()) + 1 ); - break; - - case cmd_Bold: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_BOLD; - better->values ^= TF_BOLD; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Italic: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_ITALIC; - better->values ^= TF_ITALIC; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Underline: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_UNDERLINE; - better->values ^= TF_UNDERLINE; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Strikeout: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_STRIKEOUT; - better->values ^= TF_STRIKEOUT; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_FontColor: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - Point where; - where.h = where.v = 0; - RGBColor inColor; - RGBColor outColor; - LO_Color pColor = {0, 0, 0}; - - if ( !EDT_GetFontColor( *GetContext(), &pColor ) ) - { // still a perfectly respectable way to get the font color.... - // get default color - EDT_PageData *pagedata = EDT_GetPageData( *GetContext() ); - pColor = *pagedata->pColorText; - EDT_FreePageData( pagedata ); - } - - inColor.red = (pColor.red << 8); - inColor.green = (pColor.green << 8); - inColor.blue = (pColor.blue << 8); - - if ( ::GetColor( where, (unsigned char *)*GetString(PICK_COLOR_RESID), - &inColor, &outColor ) ) - { - pColor.red = (outColor.red >> 8); - pColor.green = (outColor.green >> 8); - pColor.blue = (outColor.blue >> 8); - - better->mask = TF_FONT_COLOR; - better->values = TF_FONT_COLOR; - better->pColor = &pColor; - EDT_BeginBatchChanges( *GetContext() ); - EDT_SetCharacterData( *GetContext(), better ); - EDT_SetFontColor( *GetContext(), &pColor ); - EDT_EndBatchChanges( *GetContext() ); - better->pColor = NULL; - - // set control to the color that just got picked - Str255 colorstr; - XP_SPRINTF( (char *)&colorstr[2], "%02X%02X%02X", pColor.red, pColor.green, pColor.blue); - colorstr[1] = CColorPopup::CURRENT_COLOR_CHAR; // put in leading character - colorstr[0] = strlen( (char *)&colorstr[1] ); - mColorPopup->SetDescriptor( colorstr ); - ::SetMenuItemText( mColorPopup->GetMenu()->GetMacMenuH(), - CColorPopup::CURRENT_COLOR_ITEM, - (unsigned char *)&colorstr ); - } - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_ClearAll: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - if ( !EDT_IsSelected( *GetContext() ) - || !EDT_SelectionContainsLink( *GetContext() ) // Detect if any links are included and warn user - || HandleModalDialog( EDITDLG_CONFIRM_OBLITERATE_LINK, NULL, NULL) == ok ) - EDT_FormatCharacter( *GetContext(), TF_NONE ); - break; - - case cmd_InsertEdit_Target: - CEditDialog::Start( EDITDLG_TARGET, *GetContext(), 0, - EDT_GetCurrentElementType( *GetContext() ) != ED_ELEMENT_TARGET ); - break; - - case cmd_Format_Text: - if ( CanUseCharFormatting() ) - { - if ( EDT_CanSetHREF( *GetContext() ) && EDT_GetHREF( *GetContext() ) ) - CEditDialog::Start( EDITDLG_TEXT_AND_LINK, *GetContext(), 2 ); - else - CEditDialog::Start( EDITDLG_TEXT_STYLE, *GetContext(), 1 ); - } - else - { - ED_ElementType edtElemType = EDT_GetCurrentElementType( *GetContext() ); - if ( ED_ELEMENT_IMAGE == edtElemType ) - CEditDialog::Start( EDITDLG_IMAGE, *GetContext(), 1 ); - else if ( ED_ELEMENT_HRULE == edtElemType ) - CEditDialog::Start( EDITDLG_LINE_FORMAT, *GetContext() ); - else if ( ED_ELEMENT_UNKNOWN_TAG == edtElemType ) - CEditDialog::Start( EDITDLG_UNKNOWN_TAG, *GetContext() ); - else if ( ED_ELEMENT_TARGET == edtElemType ) - CEditDialog::Start( EDITDLG_TARGET, *GetContext() ); - } - break; - -// Paragraph Toolbar - case msg_MakeNoList: - ToFromList( 0, ED_LIST_TYPE_DEFAULT ); - break; - - case msg_MakeNumList: - ToFromList( P_NUM_LIST, ED_LIST_TYPE_DIGIT ); - break; - - case msg_MakeUnumList: - ToFromList( P_UNUM_LIST, ED_LIST_TYPE_DEFAULT ); - break; - - case cmd_CheckSpelling: - FLUSH_JAPANESE_TEXT - do_spellcheck( *GetContext(), this, NULL ); - break; - - case cmd_Format_Paragraph_Indent: - EDT_Indent( *GetContext() ); - break; - - case cmd_Format_Paragraph_UnIndent: - EDT_Outdent( *GetContext() ); - break; - - case cmd_JustifyLeft: - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_HRULE ) - { - EDT_HorizRuleData *fData = EDT_GetHorizRuleData( *GetContext() ); - if ( fData ) - { - fData->align = ED_ALIGN_LEFT; - EDT_SetHorizRuleData( *GetContext(), fData ); - EDT_FreeHorizRuleData( fData ); - } - } - else - EDT_SetParagraphAlign( *GetContext(), ED_ALIGN_LEFT ); - break; - - case cmd_JustifyCenter: - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_HRULE ) - { - EDT_HorizRuleData *fData = EDT_GetHorizRuleData( *GetContext() ); - if ( fData ) - { - fData->align = ED_ALIGN_DEFAULT; - EDT_SetHorizRuleData( *GetContext(), fData ); - EDT_FreeHorizRuleData( fData ); - } - - } - else - EDT_SetParagraphAlign( *GetContext(), ED_ALIGN_CENTER ); - break; - - case cmd_JustifyRight: - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_HRULE ) - { - EDT_HorizRuleData *fData = EDT_GetHorizRuleData( *GetContext() ); - if ( fData ) - { - fData->align = ED_ALIGN_RIGHT; - EDT_SetHorizRuleData( *GetContext(), fData ); - EDT_FreeHorizRuleData( fData ); - } - } - else - EDT_SetParagraphAlign( *GetContext(), ED_ALIGN_RIGHT ); - break; - -// Edit Menu - case cmd_Undo: - FLUSH_JAPANESE_TEXT - EDT_Undo( *GetContext() ); - SetMenuCommandAndString( inCommand, cmd_Redo, STRPOUND_EDITOR_MENUS, EDITOR_MENU_REDO, NULL ); - break; - - case cmd_Redo: - FLUSH_JAPANESE_TEXT - EDT_Redo( *GetContext() ); - SetMenuCommandAndString( inCommand, cmd_Undo, STRPOUND_EDITOR_MENUS, EDITOR_MENU_UNDO, NULL ); - break; - -// Insert Menu - case cmd_Insert_Target: - CEditDialog::Start( EDITDLG_TARGET, *GetContext(), 0, true ); - break; - - case cmd_Insert_Unknown_Tag: - CEditDialog::Start( EDITDLG_UNKNOWN_TAG, *GetContext(), 0, true ); - break; - - case cmd_Insert_Link: - CEditDialog::Start( EDITDLG_TEXT_AND_LINK, *GetContext(), 2, true ); - break; - - case cmd_InsertEditLink: - if ( EDT_CanSetHREF( *GetContext() ) ) - { - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_IMAGE ) - CEditDialog::Start( EDITDLG_IMAGE, *GetContext(), 2 ); - else - { - if ( EDT_IsSelected( *GetContext() ) ) - CEditDialog::Start( EDITDLG_TEXT_AND_LINK, *GetContext(), 2 ); - else - CEditDialog::Start( EDITDLG_TEXT_AND_LINK, *GetContext(), 2, true ); - } - } else - CEditDialog::Start( EDITDLG_TEXT_AND_LINK, *GetContext(), 2, true ); - break; - - case cmd_Insert_Image: - CEditDialog::Start( EDITDLG_IMAGE, *GetContext(), 1, true ); - break; - - case cmd_InsertEditImage: - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_IMAGE ) - CEditDialog::Start( EDITDLG_IMAGE, *GetContext(), 1, false ); - else - CEditDialog::Start( EDITDLG_IMAGE, *GetContext(), 1, true ); - break; - - case cmd_Insert_Line: - FLUSH_JAPANESE_TEXT - InsertDefaultLine(); - break; - - case cmd_InsertEditLine: - FLUSH_JAPANESE_TEXT - if ( EDT_GetCurrentElementType( *GetContext() ) == ED_ELEMENT_HRULE ) - CEditDialog::Start( EDITDLG_LINE_FORMAT, *GetContext() ); - else - InsertDefaultLine(); - break; - - case cmd_Insert_LineBreak: - FLUSH_JAPANESE_TEXT - EDT_InsertBreak( *GetContext(), ED_BREAK_NORMAL ); - break; - - case cmd_Insert_BreakBelowImage: - FLUSH_JAPANESE_TEXT - EDT_InsertBreak( *GetContext(), ED_BREAK_RIGHT ); - break; - -#if 0 - case cmd_Insert_NonbreakingSpace: - FLUSH_JAPANESE_TEXT - EDT_InsertNonbreakingSpace( *GetContext() ); - break; -#endif - -// Format Menu - case cmd_Format_Document: - CEditDialog::Start( EDITDLG_DOC_INFO, *GetContext(), 2 ); - break; - - case cmd_Format_PageTitle: - CEditDialog::Start( EDITDLG_DOC_INFO, *GetContext(), 1 ); - break; - -// Format Character Menu - case cmd_Format_Character_Nonbreaking: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_NOBREAK; - better->values ^= TF_NOBREAK; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Superscript: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_SUPER | TF_SUB; - better->values ^= TF_SUPER; - if (better->values & TF_SUB) - better->values ^= TF_SUB; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Subscript: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_SUB | TF_SUPER; - better->values ^= TF_SUB; - if ( better->values & TF_SUPER ) - better->values ^= TF_SUPER; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - - case cmd_Format_Character_Blink: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - { - better = EDT_GetCharacterData( *GetContext() ); - if ( better ) - { - better->mask = TF_BLINK; - better->values ^= TF_BLINK; - EDT_SetCharacterData( *GetContext(), better ); - EDT_FreeCharacterData( better ); - } - } - break; - -// Format Paragraph Menu - case cmd_Format_Paragraph_Normal: - EDT_MorphContainer( *GetContext(), P_NSDT ); - break; - - case cmd_Format_Paragraph_Head1: - case cmd_Format_Paragraph_Head2: - case cmd_Format_Paragraph_Head3: - case cmd_Format_Paragraph_Head4: - case cmd_Format_Paragraph_Head5: - case cmd_Format_Paragraph_Head6: - EDT_MorphContainer( *GetContext(), inCommand - cmd_Format_Paragraph_Head1 + P_HEADER_1 ); - break; - - case cmd_Format_Paragraph_Address: - EDT_MorphContainer( *GetContext(), P_ADDRESS ); - break; - - case cmd_Format_Paragraph_Formatted: - EDT_MorphContainer( *GetContext(), P_PREFORMAT ); - break; - - case cmd_Format_Paragraph_List_Item: - EDT_MorphContainer( *GetContext(), P_LIST_ITEM ); - break; - - case cmd_Format_Paragraph_Desc_Title: - EDT_MorphContainer( *GetContext(), P_DESC_TITLE ); - break; - - case cmd_Format_Paragraph_Desc_Text: - EDT_MorphContainer( *GetContext(), P_DESC_TEXT ); - break; - -// Format Font Size Menu - case cmd_Format_Font_Size_N2: - case cmd_Format_Font_Size_N1: - case cmd_Format_Font_Size_0: - case cmd_Format_Font_Size_P1: - case cmd_Format_Font_Size_P2: - case cmd_Format_Font_Size_P3: - case cmd_Format_Font_Size_P4: - FLUSH_JAPANESE_TEXT - if ( CanUseCharFormatting() ) - EDT_SetFontSize( *GetContext(), inCommand - cmd_Format_Font_Size_N2 + 1 ); - break; - -// Format Table Menu - case cmd_Insert_Table: - CEditDialog::Start( EDITDLG_TABLE, *GetContext(), 0, true ); - break; - - case cmd_Delete_Table: - FLUSH_JAPANESE_TEXT - EDT_DeleteTable( *GetContext() ); - break; - - case cmd_Select_Table: - FLUSH_JAPANESE_TEXT - EDT_SelectTable( *GetContext() ); - break; - - case cmd_Select_Row: - FLUSH_JAPANESE_TEXT - EDT_ChangeTableSelection( *GetContext(), ED_HIT_SEL_ROW, ED_MOVE_NONE, NULL); - break; - - case cmd_Select_Col: - FLUSH_JAPANESE_TEXT - EDT_ChangeTableSelection( *GetContext(), ED_HIT_SEL_COL, ED_MOVE_NONE, NULL ); - break; - - case cmd_Select_Cell: - FLUSH_JAPANESE_TEXT - EDT_ChangeTableSelection( *GetContext(), ED_HIT_SEL_CELL, ED_MOVE_NONE, NULL ); - break; - - case cmd_Select_All_Cells: - FLUSH_JAPANESE_TEXT - EDT_ChangeTableSelection( *GetContext(), ED_HIT_SEL_ALL_CELLS, ED_MOVE_NONE, NULL ); - break; - - case cmd_Format_Table: - Boolean acrossCells = ( EDT_COP_SELECTION_CROSSES_TABLE_DATA_CELL == - EDT_CanCut( *GetContext(), true )); - - if ( !acrossCells && EDT_IsInsertPointInTableCell( *GetContext() )) - CEditDialog::Start( EDITDLG_TABLE_INFO, *GetContext(), 3 ); - - else if ( EDT_IsInsertPointInTableRow( *GetContext() )) - CEditDialog::Start( EDITDLG_TABLE_INFO, *GetContext(), 2 ); - - else if ( EDT_IsInsertPointInTable( *GetContext() )) - CEditDialog::Start( EDITDLG_TABLE_INFO, *GetContext(), 1 ); - break; - - case cmd_Insert_Row_Above: - FLUSH_JAPANESE_TEXT - { - EDT_TableRowData *pData = EDT_NewTableRowData(); - if ( pData ) - { - pData->align = ED_ALIGN_DEFAULT; - pData->valign = ED_ALIGN_DEFAULT; - EDT_InsertTableRows( *GetContext(), pData, false, 1 ); - EDT_FreeTableRowData( pData ); - } - } - break; - - case cmd_Insert_Row_Below: - FLUSH_JAPANESE_TEXT - { - EDT_TableRowData *pData = EDT_NewTableRowData(); - if ( pData ) - { - pData->align = ED_ALIGN_DEFAULT; - pData->valign = ED_ALIGN_DEFAULT; - EDT_InsertTableRows( *GetContext(), pData, true, 1 ); - EDT_FreeTableRowData( pData ); - } - } - break; - - case cmd_Delete_Row: - FLUSH_JAPANESE_TEXT - EDT_DeleteTableRows( *GetContext(), 1 ); - break; - - case cmd_Format_Row: - CEditDialog::Start( EDITDLG_TABLE_INFO, *GetContext(), 2 ); - break; - - case cmd_Insert_Col_Before: - FLUSH_JAPANESE_TEXT - { - EDT_TableCellData* pData = EDT_GetTableCellData( *GetContext() ); - if ( pData ) - { - EDT_InsertTableColumns( *GetContext(), pData, false, 1 ); - EDT_FreeTableCellData( pData ); - } - } - break; - - case cmd_Insert_Col_After: - FLUSH_JAPANESE_TEXT - { - EDT_TableCellData* pData = EDT_GetTableCellData( *GetContext() ); - if ( pData ) - { - EDT_InsertTableColumns( *GetContext(), pData, true, 1 ); - EDT_FreeTableCellData( pData ); - } - } - break; - - case cmd_Delete_Col: - FLUSH_JAPANESE_TEXT - EDT_DeleteTableColumns( *GetContext(), 1 ); - break; - - case cmd_Insert_Cell: - FLUSH_JAPANESE_TEXT - { - EDT_TableCellData* pData = EDT_GetTableCellData( *GetContext() ); - if ( pData ) - { - EDT_InsertTableCells( *GetContext(), pData, true, 1 ); - EDT_FreeTableCellData( pData ); - } - } - break; - - case cmd_Delete_Cell: - FLUSH_JAPANESE_TEXT - EDT_DeleteTableCells( *GetContext(), 1 ); - break; - - case cmd_Format_Cell: - CEditDialog::Start( EDITDLG_TABLE_INFO, *GetContext(), 3 ); - break; - - case cmd_Join_With_Next_Cell: - FLUSH_JAPANESE_TEXT - EDT_MergeTableCells( *GetContext() ); - break; - - case cmd_Split_Cell: - FLUSH_JAPANESE_TEXT - EDT_SplitTableCell( *GetContext() ); - break; - - case cmd_Convert_Table_To_Text: - FLUSH_JAPANESE_TEXT - EDT_ConvertTableToText( *GetContext() ); - break; - - case cmd_Convert_Text_To_Table: - FLUSH_JAPANESE_TEXT - EDT_ConvertTextToTable( *GetContext(), 1 /*passing in 1 for now, we haven't decided on how we want to do this*/ ); - break; - -#if 0 - case cmd_DisplayTableBoundaries: - Boolean doDisplayTableBorders; - // toggle the current state and reset editor view - doDisplayTableBorders = !EDT_GetDisplayTables( *GetContext() ); - EDT_SetDisplayTables( *GetContext(), doDisplayTableBorders ); - break; -#endif - - case msg_TabSelect: - FLUSH_JAPANESE_TEXT - mCaretActive = true; - return true; // yes, we'll take a tab so we can be the active field! - break; - - case cmd_FormatColorsAndImage: - CEditDialog::Start( EDITDLG_BKGD_AND_COLORS, *GetContext() ); - break; - - case cmd_DocumentInfo: - if ( IsDoneLoading() && !EDT_IS_NEW_DOCUMENT( ((MWContext *)*GetContext()) ) ) - return CHTMLView::ObeyCommand( inCommand, ioParam ); - break; - - default: - return CHTMLView::ObeyCommand (inCommand, ioParam); - } - - return true; -} - - -Boolean CEditView::SetDefaultCSID(Int16 prefCSID, Boolean forceRepaginate /* = false */) -{ - int oldCSID = mContext->GetDefaultCSID(); - - if ( prefCSID != oldCSID ) - { - FLUSH_JAPANESE_TEXT - - mContext->SetDefaultCSID( prefCSID ); - mContext->SetWinCSID(INTL_DocToWinCharSetID( prefCSID )); - - if ( !EDT_SetEncoding( *GetContext(), prefCSID )) - { - // revert back! - mContext->SetDefaultCSID( oldCSID ); - mContext->SetWinCSID( INTL_DocToWinCharSetID( oldCSID ) ); - return false; - } - - EDT_RefreshLayout( *GetContext() ); - } - return true; -} - - -void FE_DocumentChanged( MWContext * context, int32 iStartY, int32 iHeight ) -{ - ((CEditView *)ExtractHyperView(context))->DocumentChanged( iStartY, iHeight ); -} - - -Boolean GetCaretPosition(MWContext *context, LO_Element * element, int32 caretPos, - int32* caretX, int32* caretYLow, int32* caretYHigh ) -{ - if (!context || !element ) - return false; - - int32 xVal = element->lo_any.x + element->lo_any.x_offset; - int32 yVal = element->lo_any.y + element->lo_any.y_offset; - int32 yValHigh = yVal + element->lo_any.height; - - switch ( element->type ) - { - case LO_TEXT: - { - LO_TextStruct *text_data = & element->lo_text; - CCharSet charSet = ExtractHyperView(context)->GetCharSet(); - - XP_FAIL_ASSERT( text_data->text_attr ); - - GrafPtr theSavePort = NULL; - if ( ExtractHyperView(context)->GetCachedPort() != qd.thePort ) - { - theSavePort = qd.thePort; - ::SetPort( ExtractHyperView(context)->GetCachedPort() ); - } - - HyperStyle style( context, &charSet, text_data->text_attr, true ); - - style.Apply(); - - // **** Don't know why this was here... - //style.GetFontInfo(); - - // ¥Êmeasure the text - char *textPtr; - PA_LOCK( textPtr, char*, text_data->text ); - - xVal += style.TextWidth( textPtr, 0, caretPos ) - 1; - - PA_UNLOCK( text_data->text ); - - if ( theSavePort != NULL ) - ::SetPort( theSavePort ); - } - break; - - case LO_IMAGE: - { - LO_ImageStruct *pLoImage = &element->lo_image; - if ( caretPos == 0 ) - xVal -= 1; - else - xVal += pLoImage->width + 2 * pLoImage->border_width; - } - break; - - default: - { - LO_Any *any = &element->lo_any; - if ( caretPos == 0 ) - xVal -= 1; - else - xVal += any->width; - } - break; - } - - *caretX = xVal; - *caretYLow = yVal; - *caretYHigh = yValHigh; - - return true; -} - - -static void DisplayCaretAnyElement( MWContext *context, LO_Element *element, int caretPos ) -{ - CEditView *myView = (CEditView *)ExtractHyperView(context); - if ( (myView == NULL) || !(myView->FocusDraw()) ) - return; - - int32 xVal, yVal, yValHigh; - - Boolean gotPosition; - gotPosition = GetCaretPosition( context, element, caretPos, &xVal, &yVal, &yValHigh ); - if ( gotPosition && context->is_editor ) - myView->PlaceCaret( xVal, yVal, yValHigh ); -} - - -void FE_DisplayGenericCaret( MWContext * context, LO_Any * pLoAny, ED_CaretObjectPosition caretPos ) -{ - DisplayCaretAnyElement( context, (LO_Element *)pLoAny, caretPos ); -} - -void FE_DisplayTextCaret( MWContext * context, int /*loc*/, LO_TextStruct * text_data, int char_offset ) -{ - DisplayCaretAnyElement( context, (LO_Element *)text_data, char_offset ); -} - -void FE_DisplayImageCaret(MWContext * context, LO_ImageStruct * pImageData, ED_CaretObjectPosition caretPos ) -{ - DisplayCaretAnyElement( context, (LO_Element *)pImageData, caretPos ); -} - - -Bool FE_GetCaretPosition(MWContext *context, LO_Position* where, int32* caretX, int32* caretYLow, int32* caretYHigh) -{ - return GetCaretPosition( context, where->element, where->position, caretX, caretYLow, caretYHigh ); -} - - -void FE_DestroyCaret( MWContext *pContext ) -{ - if ( pContext->is_editor ) - ((CEditView *)ExtractHyperView(pContext))->RemoveCaret(); -} - -void FE_GetDocAndWindowPosition( MWContext * context, int32 *pX, int32 *pY, int32 *pWidth, int32 *pHeight ) -{ - SPoint32 frameLocation; - SPoint32 imageLocation; - SDimension16 frameSize; - - ((CEditView *)ExtractHyperView(context))->GetDocAndWindowPosition( frameLocation, imageLocation, frameSize ); - - *pX = frameLocation.h - imageLocation.h; - *pY = frameLocation.v - imageLocation.v; - *pWidth = frameSize.width; - *pHeight = frameSize.height; -} diff --git a/mozilla/cmd/macfe/Composer/CEditView.h b/mozilla/cmd/macfe/Composer/CEditView.h deleted file mode 100644 index 257687afa4c..00000000000 --- a/mozilla/cmd/macfe/Composer/CEditView.h +++ /dev/null @@ -1,298 +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. - */ - -#pragma once - -#include -#include "CHTMLView.h" -#include "CURLDragHelper.h" - -// dangling prototype -Boolean GetCaretPosition(MWContext *context, LO_Element * element, int32 caretPos, - int32* caretX, int32* caretYLow, int32* caretYHigh ); - - -class LGAPopup; -class CPatternButtonPopup; -class CColorPopup; -class CComposeSession; -class CFontMenuPopup; - -class HTMLInlineTSMProxy; -class HoldUpdatesProxy; - - -class CComposerAwareURLDragMixin : public CHTAwareURLDragMixin -{ - CComposerAwareURLDragMixin ( ); - virtual ~CComposerAwareURLDragMixin ( ) { } ; - -protected: - - // overridden to handle composer flavor drops - virtual void ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) ; - - // must override to do the right thing - virtual void HandleDropOfComposerFlavor ( const char* inData, bool inDoCopy, const Point & inMouseLocal ) = 0 ; - -}; // class CComposerAwareURLDragMixin - - - -class CEditView: public CHTMLView, public CComposerAwareURLDragMixin -{ -#if !defined(__MWERKS__) || (__MWERKS__ >= 0x2000) - typedef CHTMLView inherited; -#endif - -public: - enum { pane_ID = 'html', class_ID = 'Edtp', dashMark = '-' }; - enum { - STRPOUND_EDITOR_MENUS = 5101, - EDITOR_MENU_SHOW_PARA_SYMBOLS = 1, - EDITOR_MENU_HIDE_PARA_SYMBOLS = 2, - EDITOR_MENU_UNDO = 3, - EDITOR_MENU_REDO = 4, - EDITOR_MENU_SHOW_COMP_TOOLBAR = 5, - EDITOR_MENU_HIDE_COMP_TOOLBAR = 6, - EDITOR_MENU_SHOW_FORMAT_TOOLBAR = 7, - EDITOR_MENU_HIDE_FORMAT_TOOLBAR = 8, - EDITOR_MENU_SHOW_TABLE_BORDERS = 9, - EDITOR_MENU_HIDE_TABLE_BORDERS = 10, - EDITOR_MENU_CHARACTER_ATTRIBS = 11, - EDITOR_MENU_IMAGE_ATTRIBUTES = 12, - EDITOR_MENU_LINK_ATTRIBUTES = 13, - EDITOR_MENU_LINE_ATTRIBUTES = 14, - EDITOR_MENU_TABLE_ATTRIBUTES = 15, - EDITOR_MENU_UNKNOWN_ATTRIBUTES = 16, - EDITOR_MENU_TARGET_ATTRIBUTES = 17 - }; - enum { - eMouseHysteresis = 6, - eSelectionBorder = 3 - }; - - // ¥¥ Constructors - CEditView(LStream * inStream); - ~CEditView(); - virtual void FinishCreateSelf(void); - - // ¥¥ Command handling - virtual Boolean ObeyCommand( CommandT inCommand, void *ioParam ); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void FindCommandStatus( CommandT inCommand, - Boolean& outEnabled, Boolean& outUsesMark, - Char16& outMark,Str255 outName ); - Boolean FindCommandStatusForContextMenu( CommandT inCommand, - Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName ); - - Boolean IsPastable(Char16 theChar); - int FindQueuedKeys( char *keys_in_q ); - virtual Boolean HandleKeyPress( const EventRecord& inKeyEvent ); - - virtual void AdaptToSuperFrameSize( Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, Boolean inRefresh ); - - virtual void BeTarget(); - virtual void DontBeTarget(); - - void HandleCut(); - void HandleCopy(); - void HandlePaste(); - - TSMDocumentID midocID; - - virtual void CreateFindWindow(); - virtual void SetContext( CBrowserContext* inNewContext ); - virtual URL_Struct *GetURLForPrinting( Boolean& outSuppressURLCaption, MWContext *printingContext ); - - void TakeOffDuty(); - virtual void PutOnDuty(LCommander*); - - Bool PtInSelectedRegion(SPoint32 cpPoint ); - virtual Boolean EstablishPort(); - virtual void DrawSelf( void ); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - - Bool SaveDocument(); - Bool SaveDocumentAs(); - Bool VerifySaveUpToDate(); - - - // ¥¥ cursor calls and caret functionality - virtual void AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ); - - virtual void SpendTime( const EventRecord& inMacEvent ); - void DrawCaret( Boolean doErase ); - void EraseCaret(); - void HideCaret( Boolean mhide ) { EraseCaret(); mHideCaret = mhide; } - void PlaceCaret(int32 caretX, int32 caretYLow, int32 caretYHigh); - void RemoveCaret(); - void DisplayGenericCaret( MWContext *context, LO_Element * pLoAny, - ED_CaretObjectPosition caretPos ); - - virtual void ClickSelf (const SMouseDownEvent& where ); - virtual Boolean ClickTrackSelection( const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord ); - - virtual Boolean SetDefaultCSID( Int16 inPreferredCSID, Boolean forceRepaginate = false ); - CBrowserContext *GetNSContext() { return mContext; }; - - void SetHoldUpdates(HoldUpdatesProxy* inHoldUpdates) {mHoldUpdates = inHoldUpdates;}; - - Boolean mEditorDoneLoading; - Boolean IsDoneLoading() const { return mEditorDoneLoading; } - - // ¥¥ FE_* calls - void DocumentChanged( int32 iStartY, int32 iHeight ); - void GetDocAndWindowPosition( SPoint32 &frameLocation, SPoint32 &imageLocation, SDimension16 &frameSize ); - - // ¥¥ formatting query calls - void UseCharFormattingCache() { CanUseCharFormatting(); mUseCharFormattingCache = true; } - void DontUseCharFormattingCache() { mUseCharFormattingCache = false; } - - class StUseCharFormattingCache - { - public: - StUseCharFormattingCache( CEditView& p ) : view(p) { view.UseCharFormattingCache(); } - ~StUseCharFormattingCache() { view.DontUseCharFormattingCache(); } - - private: - CEditView &view; - }; - - LGAPopup * mParagraphToolbarPopup; - LGAPopup * mSizeToolbarPopup; - CFontMenuPopup * mFontToolbarPopup; - CPatternButtonPopup * mAlignToolbarPopup; - CColorPopup * mColorPopup; - -protected: - virtual Boolean IsGrowCachingEnabled() const { return !mEditorDoneLoading; } - - virtual void LayoutNewDocument( URL_Struct *inURL, Int32 *inWidth, - Int32 *inHeight, Int32 *inMarginWidth, Int32 *inMarginHeight ); - - // ¥¥ FE_* calls - virtual void SetDocPosition( int inLocation, Int32 inX, Int32 inY, - Boolean inScrollEvenIfVisible = false); - virtual void DisplayLineFeed( int inLocation, LO_LinefeedStruct *inLinefeedStruct, XP_Bool inNeedBG ); - virtual void DisplayHR( int inLocation, LO_HorizRuleStruct *inRuleStruct ); - virtual void DisplaySubtext( int inLocation, LO_TextStruct *inText, - Int32 inStartPos, Int32 inEndPos, XP_Bool inNeedBG ); - virtual void EraseBackground( int inLocation, Int32 inX, Int32 inY, - Uint32 inWidth, Uint32 inHeight, LO_Color *inColor ); - virtual void GetDefaultBackgroundColor(LO_Color* outColor) const; - virtual void DisplayTable( int inLocation, LO_TableStruct *inTableStruct ); - virtual void DisplayCell( int inLocation, LO_CellStruct *inCellStruct ); - virtual void InvalidateEntireTableOrCell( LO_Element* inElement ); - virtual void DisplayAddRowOrColBorder( XP_Rect* inRect, XP_Bool inDoErase ); - virtual void UpdateEnableStates(); - virtual void DisplayFeedback( int inLocation, LO_Element *inElement ); - virtual void DisplaySelectionFeedback( uint16 ele_attrmask, const Rect &inRect ); - - // ¥¥ Drag and Drop - virtual Boolean ItemIsAcceptable (DragReference dragRef, ItemReference itemRef); - virtual void ReceiveDragItem( DragReference inDragRef, DragAttributes inDragAttr, - ItemReference inItemRef, Rect& inItemBounds ); - virtual void DoDragSendData( FlavorType inFlavor, ItemReference inItemRef, - DragReference inDragRef ); - virtual void InsideDropArea( DragReference inDragRef ); - virtual void EnterDropArea( DragReference inDragRef, Boolean inDragHasLeftSender ); - virtual void HandleDropOfComposerFlavor ( const char* inData, bool inDoCopy, - const Point & inMouseLocal ) ; - virtual void HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) ; - virtual void HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & inFileData ) ; - virtual void HandleDropOfText ( const char* inTextData ) ; - virtual void HandleDropOfHTResource ( HT_Resource node ) ; - DragReference mDragRef; - SPoint32 mDropLocationImageCoords; - - enum { - ED_SELECTION_BORDER = 3 - }; - - enum { MAX_Q_SIZE = 12 }; // Used for checking out key strokes waiting in FindQueuedKeys - - void InsertDefaultLine(); - void DoReload( void ); - void ToFromList( intn listType, ED_ListType elementType ); - void NoteEditorRepagination( void ); - Boolean CanUseCharFormatting(); - - Boolean IsMouseInSelection( SPoint32 pt, ED_HitType eHitType, Rect& selectRect ); - Boolean mDoContinueSelection; - - HTMLInlineTSMProxy* mProxy; - HoldUpdatesProxy* mHoldUpdates; - - // more caret blinking and related stuff - Boolean mCaretDrawn, mCaretActive; - Boolean mHideCaret; - Boolean mDisplayParagraphMarks; - - Point mOldPoint; // Last place cursor was adjusted. No initializing - long mOldLastElementOver; // id of the last element the cursor was over - - unsigned long mLastBlink; - int32 mCaretX; - int32 mCaretYLow; - int32 mCaretYHigh; - - Boolean mUseCharFormattingCache; - Boolean mIsCharFormatting; - - // these are only to be used during drag of data in composer - char *mDragData; // warning this really isn't a "char" but void* data!!! - int32 mDragDataLength; -}; // class CEditView - - -//====================================== -class CMailEditView : public CEditView -//====================================== -{ -public: - enum { pane_ID = 'html', class_ID = 'MEdp' }; - - // ¥¥ Constructors - - CMailEditView(LStream * inStream); - virtual void InstallBackgroundColor(); - virtual void GetDefaultBackgroundColor(LO_Color* outColor) const; - virtual void InitMailCompose(); - void SetComposeSession( CComposeSession *c ) { mComposeSession = c; }; - void SetInitialText( const char *textp ); - void InsertMessageCompositionText( const char* text, - XP_Bool leaveCursorBeginning, XP_Bool isHTML ); - void DisplayDefaultTextBody(); - -private: - Int32 mStartQuoteOffset; - Int32 mEndQuoteOffset; - Boolean mHasAutoQuoted; - Boolean mHasInsertSignature; - Boolean mCursorSet; - char *mInitialText; // Draft text - CComposeSession *mComposeSession; -}; // class CMailEditView - diff --git a/mozilla/cmd/macfe/Composer/CEditorWindow.cp b/mozilla/cmd/macfe/Composer/CEditorWindow.cp deleted file mode 100644 index 9b0224d316c..00000000000 --- a/mozilla/cmd/macfe/Composer/CEditorWindow.cp +++ /dev/null @@ -1,624 +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. - */ - -#include "CEditorWindow.h" -#include "CBrowserContext.h" -#include "resgui.h" -#include "CFormattingToolBar.h" -#include "CFontMenuAttachment.h" -#include "CToolbarPopup.h" -#include "CPatternButtonPopupText.h" -#include "COpenRecentlyEditedPopup.h" -#include "CColorPopup.h" -#include "CColorCaption.h" - -#include "CEditDictionary.h" - -#include "CTextTable.h" -#include "CTableKeySingleSelector.h" - - // macfe -#include "mversion.h" // ID_STRINGS -#include "URobustCreateWindow.h" -#include "uprefd.h" -#include "uerrmgr.h" -#include "uapp.h" -#include "mforms.h" // CTabbedDialog -#include "meditdlg.h" // CTabbedDialog -#include "meditor.h" // HandleModalDialog -#include "CEditView.h" - - // Netscape -#include "net.h" // NET_cinfo_find_type -#include "proto.h" // XP_IsContextBusy -#include "edt.h" -#include "shist.h" -#include "prefapi.h" // PREF_GetBoolPref - -#ifdef PROFILE -#pragma profile on -#endif - -// pane id constants - for ShowOneDragBar -const PaneIDT Paragraph_Bar_PaneID = 'DBar'; -const PaneIDT Character_Bar_PaneID = 'NBar'; - -const char* Pref_ShowParagraphBar = "editor.show_paragraph_toolbar"; -const char* Pref_ShowCharacterBar = "editor.show_character_toolbar"; - -enum { eParagraphBar, - eCharacterBar }; - -CEditorWindow::CEditorWindow( LStream* inStream ) - :CBrowserWindow(inStream) -{ - SetWindowType( WindowType_Editor ); -} - - -static // PRIVATE -CMediatedWindow* GetFrontWindowByType( OSType windowType ) -{ - CMediatedWindow* theWindow = NULL; - CWindowIterator iter(windowType); - iter.Next(theWindow); - return theWindow; -} - -// given an mwcontext (non-busy, with a history), select the matching editor window -// or open an editor window based on that mwcontext -// if all else fails (and memory is not low), create an empty editor window -void CEditorWindow::MakeEditWindowFromBrowser( MWContext* mwcontext ) -{ - if ( Memory_MemoryIsLow() ) - return; - - History_entry* entry = NULL; - if ( mwcontext && !XP_IsContextBusy( mwcontext ) ) - entry = SHIST_GetCurrent(&mwcontext->hist); - - if ( entry && entry->address) - { - // If there is already an editor window open for this url - // just switch to it and keep this browser window open. - CMediatedWindow * win; - CWindowIterator iter(WindowType_Editor); - while (iter.Next(win)) - { - CNSContext* curContext = ((CBrowserWindow *)win)->GetWindowContext(); - MWContext* context; - - context = curContext ? curContext->operator MWContext*() : NULL; - if (context && EDT_IS_EDITOR(context)) - { - History_entry* newEntry = SHIST_GetCurrent(&context->hist); - if (newEntry && newEntry->address && !strcmp(newEntry->address, entry->address)) - { - win->Show(); - win->Select(); - return; - } - } - } - - if (CEditorWindow::MakeEditWindow(mwcontext, NULL) == NULL) // new window based on history of this window - return; // don't close this one on error. - } - else - { - CEditorWindow::MakeEditWindow(NULL, NULL); // make a completely new window - } -} - - -// EDT_PreOpenCallbackFn -static void createEditorWindowCallback( XP_Bool userCanceled, char* pURL, void* hook ) -{ - if ( !userCanceled ) - { - EditorCreationStruct *edtCreatePtr = (EditorCreationStruct *)hook; - - if ( hook ) - { - if ( edtCreatePtr->existingURLstruct && edtCreatePtr->existingURLstruct->address ) - { - XP_FREE( edtCreatePtr->existingURLstruct->address ); - edtCreatePtr->existingURLstruct->address = XP_STRDUP( pURL ); - } - } - - // substitute new URL - CEditorWindow::CreateEditorWindowStage2( edtCreatePtr ); - } -} - - -CEditorWindow* CEditorWindow::MakeEditWindow( MWContext* old_context, URL_Struct* url ) -{ - Boolean urlCameInNULL = (url == NULL); - - // if we don't have an URL, try to get it from the old_context's window history - if (url == NULL && old_context != NULL) - { - CBrowserContext *browserContext = (CBrowserContext *)old_context->fe.newContext; - History_entry* entry = browserContext->GetCurrentHistoryEntry(); // Take the last instead of the first history entry. - if ( entry ) - { - url = SHIST_CreateURLStructFromHistoryEntry( old_context, entry ); - if ( url ) - { - url->force_reload = NET_NORMAL_RELOAD; - - XP_MEMSET( &url->savedData, 0, sizeof( SHIST_SavedData ) ); - } - } - // if we don't have a history entry, we're kind of screwed-->just load a blank page - } - - // we want to open a new blank edit window - // or we are still having troubles... fall back to our old tried and true blank page - if (url == NULL) - url = NET_CreateURLStruct ("about:editfilenew", NET_NORMAL_RELOAD ); - // FIX THIS!!! the above line should use "XP_GetString(XP_EDIT_NEW_DOC_NAME)" - - // time of reckoning. We really, really need an URL and address at this point... - // I don't know what an url without an address is anyway... - if (url == NULL || url->address == NULL) - return NULL; - - // now make sure that the url is a valid type to edit. - NET_cinfo *cinfo = NET_cinfo_find_type (url->address); - - if (cinfo == NULL || cinfo->type == NULL || - (strcasecomp (cinfo->type, TEXT_HTML) - && strcasecomp (cinfo->type, UNKNOWN_CONTENT_TYPE) - && strcasecomp (cinfo->type, TEXT_PLAIN))) - { - ErrorManager::PlainAlert( NOT_HTML ); - return NULL; - } - - EditorCreationStruct *edtCreatePtr = (EditorCreationStruct *)XP_ALLOC( sizeof( EditorCreationStruct ) ); - if ( edtCreatePtr ) - { - edtCreatePtr->context = old_context; - edtCreatePtr->existingURLstruct = url; - edtCreatePtr->isEmptyPage = old_context == NULL && urlCameInNULL; - } - - if ( urlCameInNULL && old_context == NULL ) - { - return CreateEditorWindowStage2( edtCreatePtr ); - } - else - { - EDT_PreOpen( old_context, url->address, createEditorWindowCallback, edtCreatePtr ); - return NULL; - } -} - - -CEditorWindow *CEditorWindow::CreateEditorWindowStage2( EditorCreationStruct *edtCreatePtr ) -{ - // now we can create an editor window since we don't already have one for this url. - - /* instead of just calling LWindow::CreateWindow(), we do it ourselves by hand here - * so that we can set the window bounds before we call FinishCreate(). - */ - - if ( edtCreatePtr == NULL ) - return NULL; - - CEditorWindow* newWindow = NULL; - SetDefaultCommander(CFrontApp::GetApplication()); - try { - OSErr error; - URobustCreateWindow::ReadObjects( 'PPob', CEditorWindow::res_ID, &newWindow, &error ); - Assert_(newWindow); - FailOSErr_(error); - if (newWindow == NULL) - { - XP_FREE( edtCreatePtr ); - return NULL; - } - - newWindow->FinishCreate(); - if (newWindow->HasAttribute(windAttr_ShowNew)) - newWindow->Show(); - - UReanimator::LinkListenerToControls( newWindow, newWindow, CEditorWindow::res_ID ); - } - catch(...) - { - if ( newWindow ) - delete newWindow; - - XP_FREE( edtCreatePtr ); - - return NULL; - } - - Boolean hasURLstruct = edtCreatePtr->existingURLstruct && edtCreatePtr->existingURLstruct->address; - CBrowserContext *nscontext = new CBrowserContext(); - newWindow->SetWindowContext( nscontext ); - - CURLDispatcher::DispatchURL( edtCreatePtr->existingURLstruct, nscontext, false, false, CEditorWindow::res_ID ); - - if ( edtCreatePtr->context ) - { - nscontext->InitHistoryFromContext( (CBrowserContext *)edtCreatePtr->context->fe.newContext ); - } - else - { - // the url will eventually be freed when the load is complete. - } - - // set window title here (esp. for "open") - if ( !edtCreatePtr->isEmptyPage - && edtCreatePtr->existingURLstruct && edtCreatePtr->existingURLstruct->address ) - { - char *pSlash = strrchr( edtCreatePtr->existingURLstruct->address, '/' ); - if ( pSlash ) - pSlash += 1; // move past '/' - newWindow->NoteDocTitleChanged( pSlash ); - } - - XP_FREE( edtCreatePtr ); - - return newWindow; -} - - -void CEditorWindow::SetWindowContext(CBrowserContext* inContext) -{ - if ( inContext ) - { - MWContext *context; - context = inContext->operator MWContext*(); - if ( context ) - { - context->is_editor = true; - NET_CheckForTimeBomb( context ); - } - } - - CBrowserWindow::SetWindowContext( inContext ); -} - - -void CEditorWindow::NoteDocTitleChanged( const char* inNewTitle ) -{ - // there is one bogus set-title from layout that we want to skip... - // We are hard coding "editfilenew" here because it is already hardcoded - // a million other places... - if ( inNewTitle && XP_STRCMP( inNewTitle, "editfilenew" ) == 0 ) - return; - - CNSContext *theContext = GetWindowContext(); - - char *baseName = LO_GetBaseURL( theContext->operator MWContext*() ); // don't free this... - // strip out username and password so user doesn't see them in window title - char *location = NULL; - if ( baseName ) - NET_ParseUploadURL( baseName, &location, NULL, NULL ); - CStr255 csBaseURL(location); - // if this page has a local "file:" url, then just show the file name (skip the url and directory crap.) - - if ( location && NET_IsLocalFileURL(location) ) - { - char *localName = NULL; - XP_ConvertUrlToLocalFile( location, &localName ); - - if (localName) - { -#if 0 - char *pSlash = strrchr(localName, '/'); - if (pSlash) - { // is there is a slash, move everything AFTER the last slash to the front - pSlash++; - XP_STRCPY(localName, pSlash); - } -#endif - - csBaseURL = localName; - XP_FREE(localName); - } - } - - CStr255 netscapeTitle; - CStr255 subTitle; - - ::GetIndString( netscapeTitle, ID_STRINGS, APPNAME_STRING_INDEX ); - ::GetIndString( subTitle, WINDOW_TITLES_RESID, 3 ); - - netscapeTitle += " "; - netscapeTitle += subTitle; - netscapeTitle += " - ["; - - // set up page title manually; rather than rely on XP string passed in - EDT_PageData * pageData = EDT_GetPageData( theContext->operator MWContext*() ); - if ( pageData && pageData->pTitle && pageData->pTitle[0] ) - { - netscapeTitle += pageData->pTitle; - if (csBaseURL.Length()) - netscapeTitle += " : "; - } - - if ( pageData ) - EDT_FreePageData( pageData ); - - // add file path to end - netscapeTitle += csBaseURL; - netscapeTitle += "]"; - - SetDescriptor( netscapeTitle ); - - if ( location ) - XP_FREE( location ); -} - - -void CEditorWindow::RegisterViewTypes() -{ - // Registers all its view types - RegisterClass_( CEditorWindow); - RegisterClass_( CEditView); - RegisterClass_( MultipleSelectionSingleColumn); // newer, better class? - RegisterClass_( CTarget); - RegisterClass_( CLineProp); - RegisterClass_( CFormattingToolBar); - RegisterClass_( CHTMLAreaToolBar); - - RegisterClass_( CToolbarPopup); // newer, better class? - RegisterClass_( CIconToolbarPopup); // newer, better class? - RegisterClass_( CColorPopup); - RegisterClass_( CFontMenuPopup ); - - RegisterClass_( CChameleonCaption); // newer, better class? - RegisterClass_( CChameleonView); // newer, better class? - CTabbedDialog::RegisterViewTypes(); - - RegisterClass_( CTextTable); // newer, better class? - RegisterClass_( CTableKeySingleSelector); // newer, better class? - - RegisterClass_( CPatternButtonPopupText); // newer, better class? - RegisterClass_( LOffscreenView); - RegisterClass_( COpenRecentlyEditedPopup ); - - RegisterClass_( CEditDictionary); - RegisterClass_( CEditDictionaryTable); -} - - -void CEditorWindow::FinishCreateSelf() -{ - CBrowserWindow::FinishCreateSelf(); - - // Show/hide toolbars based on preference settings - XP_Bool value; - PREF_GetBoolPref(Pref_ShowParagraphBar, &value); - mToolbarShown[eParagraphBar] = value; - ShowOneDragBar(Paragraph_Bar_PaneID, value); - PREF_GetBoolPref(Pref_ShowCharacterBar, &value); - mToolbarShown[eCharacterBar] = value; - ShowOneDragBar(Character_Bar_PaneID, value); -} - - -void CEditorWindow::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch (inMessage) - { - case msg_NSCDocTitleChanged: - NoteDocTitleChanged((const char*)ioParam); - break; - - default: - { - if ( inMessage == 'Para' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_Format_Paragraph_Normal; break; - case 2: inMessage = cmd_Format_Paragraph_Head1; break; - case 3: inMessage = cmd_Format_Paragraph_Head2; break; - case 4: inMessage = cmd_Format_Paragraph_Head3; break; - case 5: inMessage = cmd_Format_Paragraph_Head4; break; - case 6: inMessage = cmd_Format_Paragraph_Head5; break; - case 7: inMessage = cmd_Format_Paragraph_Head6; break; - case 8: inMessage = cmd_Format_Paragraph_Address; break; - case 9: inMessage = cmd_Format_Paragraph_Formatted; break; - case 10: inMessage = cmd_Format_Paragraph_List_Item; break; - case 11: inMessage = cmd_Format_Paragraph_Desc_Title; break; - case 12: inMessage = cmd_Format_Paragraph_Desc_Text; break; - } - } - else if ( inMessage == 'Size' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_Format_Font_Size_N2; break; - case 2: inMessage = cmd_Format_Font_Size_N1; break; - case 3: inMessage = cmd_Format_Font_Size_0; break; - case 4: inMessage = cmd_Format_Font_Size_P1; break; - case 5: inMessage = cmd_Format_Font_Size_P2; break; - case 6: inMessage = cmd_Format_Font_Size_P3; break; - case 7: inMessage = cmd_Format_Font_Size_P4; break; - } - } - else if ( inMessage == 'Algn' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_JustifyLeft; break; - case 2: inMessage = cmd_JustifyCenter; break; - case 3: inMessage = cmd_JustifyRight; break; - } - } - - // GetHTMLView() guaranteed not to fail - GetHTMLView()->ObeyCommand( inMessage, ioParam ); - break; - } - } -} - - -// EDT_PreCloseCallbackFn -static void closeEditorWindowCallback( void* hook ) -{ - CEditorWindow *editorWindow = (CEditorWindow *)hook; - if ( editorWindow ) - editorWindow->SetPluginDoneClosing(); -} - - -Boolean CEditorWindow::ObeyCommand( CommandT inCommand, void *ioParam ) -{ - switch ( inCommand ) - { - case cmd_NewWindowEditor: - CEditorWindow::MakeEditWindow( NULL, NULL ); - break; - - case cmd_ViewSource: - // Delegate this to the view. - if ( ((CEditView *)GetHTMLView())->IsDoneLoading() ) - GetHTMLView()->ObeyCommand(inCommand, ioParam); - break; - - case cmd_Toggle_Paragraph_Toolbar: - ToggleDragBar(Paragraph_Bar_PaneID, eParagraphBar, Pref_ShowParagraphBar); - break; - - case cmd_Toggle_Character_Toolbar: - ToggleDragBar(Character_Bar_PaneID, eCharacterBar, Pref_ShowCharacterBar); - break; - - case cmd_Close: - case cmd_Quit: // we'll just intercept these and then send them on to the default case - MWContext *mwcontext = GetWindowContext()->operator MWContext*(); - History_entry* newEntry = SHIST_GetCurrent(&mwcontext->hist); - CStr255 fileName; - if ( newEntry && newEntry->address ) - fileName = newEntry->address; - - if ( ((CEditView *)GetHTMLView())->IsDoneLoading() && EDT_DirtyFlag( *GetWindowContext() ) ) - { - Select(); // This helps during a quit or "close all" - - MessageT itemHit = HandleModalDialog( EDITDLG_SAVE_BEFORE_QUIT, fileName, NULL ); - if (itemHit == cancel) - return true; - - if (itemHit == ok) - { // save - if ( !((CEditView *)GetHTMLView())->SaveDocument() ) - return true; - } - EDT_SetDirtyFlag( mwcontext, false ); // we have to do this or else when we quit, we will be asked twice to save - } - - // need to let this work asynchronously; make our own internal loop - if ( ((CEditView *)GetHTMLView())->IsDoneLoading() && newEntry && newEntry->address ) - { - mPluginDoneClosing = false; - EDT_PreClose( mwcontext, newEntry->address, closeEditorWindowCallback, this ); - - do - { - CFrontApp::GetApplication()->ProcessNextEvent(); - } while ( !mPluginDoneClosing ); - } - - // fall through - - default: - { - return CBrowserWindow::ObeyCommand (inCommand, ioParam); - } - } - return TRUE; -} - - -void CEditorWindow::FindCommandStatus( CommandT inCommand, - Boolean& outEnabled, Boolean& outUsesMark, Char16& outMark, - Str255 outName ) -{ - short index; - outUsesMark = FALSE; - outEnabled = false; - - switch ( inCommand ) - { - case cmd_ViewSource: - // Delegate this to the view. - if ( ((CEditView *)GetHTMLView())->IsDoneLoading() ) - GetHTMLView()->FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - - case cmd_Toggle_Character_Toolbar: - outEnabled = ((CEditView *)GetHTMLView())->IsDoneLoading(); - index = mToolbarShown[eCharacterBar] ? CEditView::EDITOR_MENU_HIDE_COMP_TOOLBAR - : CEditView::EDITOR_MENU_SHOW_COMP_TOOLBAR; - ::GetIndString( outName, CEditView::STRPOUND_EDITOR_MENUS, index ); - break; - - case cmd_Toggle_Paragraph_Toolbar: - outEnabled = ((CEditView *)GetHTMLView())->IsDoneLoading(); - index = mToolbarShown[eParagraphBar] ? CEditView::EDITOR_MENU_HIDE_FORMAT_TOOLBAR - : CEditView::EDITOR_MENU_SHOW_FORMAT_TOOLBAR; - ::GetIndString( outName, CEditView::STRPOUND_EDITOR_MENUS, index ); - break; - - default: - CBrowserWindow::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName ); - } -} - - -// Called when we are trying to quit the application -Boolean CEditorWindow::AttemptQuitSelf( long inSaveOption ) -{ - MWContext *mwcontext = GetWindowContext()->operator MWContext*(); - if ( EDT_DirtyFlag( mwcontext ) ) - { - History_entry* newEntry = SHIST_GetCurrent(&mwcontext->hist); - CStr255 fileName; - if ( newEntry && newEntry->address ) - fileName = newEntry->address; - - if ( kAEAsk == inSaveOption ) - { - MessageT itemHit = HandleModalDialog( EDITDLG_SAVE_BEFORE_QUIT, fileName, NULL ); - if ( cancel == itemHit ) - return false; - } - - // save - if ( !((CEditView *)GetHTMLView())->SaveDocument() ) - return false; - } - - return true; -} - -#ifdef PROFILE -#pragma profile off -#endif diff --git a/mozilla/cmd/macfe/Composer/CEditorWindow.h b/mozilla/cmd/macfe/Composer/CEditorWindow.h deleted file mode 100644 index fed2ae5f898..00000000000 --- a/mozilla/cmd/macfe/Composer/CEditorWindow.h +++ /dev/null @@ -1,67 +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. - */ - -#pragma once - -#include "CBrowserWindow.h" - - -struct EditorCreationStruct { - MWContext *context; // may be NULL - URL_Struct *existingURLstruct; - Boolean isEmptyPage; -}; - - - -/****************************************************************************** - * CEditorWindow is really just a CBrowserWindow with some changes for an editor window. - ******************************************************************************/ -class CEditorWindow: public CBrowserWindow -{ -public: - enum {class_ID = 'edtw', res_ID = 10000}; - - // ¥¥ Constructors - - static void RegisterViewTypes(); // Registers all its view types - static CEditorWindow *MakeEditWindow( MWContext* old_context, URL_Struct* url ); - static CEditorWindow *CreateEditorWindowStage2( EditorCreationStruct *edtCreatePtr); - static void MakeEditWindowFromBrowser( MWContext* mwcontext ); - - CEditorWindow(LStream * inStream); - virtual void FinishCreateSelf(); - virtual void SetWindowContext(CBrowserContext* inContext); - - // ¥¥ Command handling - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual Boolean ObeyCommand( CommandT inCommand, void *ioParam ); - virtual void FindCommandStatus( CommandT inCommand, - Boolean& outEnabled, Boolean& outUsesMark, - Char16& outMark,Str255 outName ); - virtual void NoteDocTitleChanged( const char* title ); - virtual Boolean AttemptQuitSelf( long inSaveOption ); - static CEditorWindow* FindAndShow(Boolean inMakeNew = false); - virtual void SetPluginDoneClosing() { mPluginDoneClosing = true; } - -protected: - - virtual ResIDT GetStatusResID(void) const { return CEditorWindow::res_ID; } - - Boolean mPluginDoneClosing; -}; diff --git a/mozilla/cmd/macfe/Composer/CFontMenuAttachment.cp b/mozilla/cmd/macfe/Composer/CFontMenuAttachment.cp deleted file mode 100644 index 8b07ab375ff..00000000000 --- a/mozilla/cmd/macfe/Composer/CFontMenuAttachment.cp +++ /dev/null @@ -1,312 +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. - */ - -#include "CFontMenuAttachment.h" -#include "CEditView.h" -#include "CBrowserContext.h" // operator MWContext*() -#include "resgui.h" // cmd_FormatViewerFont, cmd_FormatFixedFont, FONT_MENU_BASE -#include "macutil.h" // CMediatedWindow -#include "edt.h" -#include "mforms.h" - - - -LMenu *CFontMenuAttachment::sMenu = NULL; - -//=========================================================== -// CFontMenuAttachment -//=========================================================== -CFontMenuAttachment::CFontMenuAttachment() -{ - UpdateMenu(); -} - -MWContext *CFontMenuAttachment::GetTopWindowContext() -{ - - // Ok, ok. I know this is skanky, - // but there is no common way to get the context from a window: it depends on the window type. - // So, we look around for a CEditView somewhere in the top window. - // A CEditView we understand (and get an MWContext from). - - CMediatedWindow* topWin = NULL; // find the top window to use the plugin in - CWindowIterator iter(WindowType_Any); - iter.Next(topWin); - - if (topWin == NULL) return NULL; - - if (topWin->GetWindowType() == WindowType_Editor || topWin->GetWindowType() == WindowType_Compose) - { - CEditView *editView = (CEditView *)(topWin->FindPaneByID(CEditView::pane_ID)); - - if (editView == NULL || editView->GetNSContext() == NULL) - return NULL; - - return editView->GetNSContext()->operator MWContext*(); - } - else if (topWin->GetWindowType() == WindowType_Browser) - { - // we're in a browser window, so check for an htmlarea that has the focus - LCommander *com = LCommander::GetTarget(); - CFormHTMLArea *ender = dynamic_cast(com); - - if (!ender) return NULL; - - return ender->GetNSContext()->operator MWContext*(); - } - return NULL; -} - - -// Processes: -// -void CFontMenuAttachment::ExecuteSelf( MessageT inMessage, void* ioParam ) -{ - mExecuteHost = FALSE; - switch ( inMessage ) - { - case msg_CommandStatus: - { - SCommandStatus* status = (SCommandStatus*)ioParam; - - EDT_CharacterData* better; - - if ( status->command == cmd_FormatViewerFont || status->command == cmd_FormatFixedFont - || ( status->command >= FONT_MENU_BASE && status->command <= FONT_MENU_BASE_LAST ) ) - { - *(status->enabled) = true; - *(status->usesMark) = false; - - better = NULL; - MWContext *cntxt = GetTopWindowContext(); - if ( cntxt ) - better = EDT_GetCharacterData( cntxt ); - if ( better == NULL ) - { - *(status->enabled) = false; - return; - } - } - - switch ( status->command ) - { - case cmd_FormatViewerFont: - *(status->usesMark) = ( ! ( better->values & TF_FIXED ) && !( better->values & TF_FONT_FACE ) ); - *(status->mark) = *(status->usesMark) ? checkMark : 0; - *(status->usesMark) = true; - - EDT_FreeCharacterData(better); - mExecuteHost = false; - return; - break; - - case cmd_FormatFixedFont: - *(status->usesMark) = ( better->values & TF_FIXED ) != 0; - *(status->mark) = *(status->usesMark) ? checkMark : 0; - *(status->usesMark) = true; - - EDT_FreeCharacterData(better); - mExecuteHost = false; - return; - break; - - default: - if ( status->command >= FONT_MENU_BASE && status->command <= FONT_MENU_BASE_LAST ) - { - // get font menu item - Str255 fontItemString; - fontItemString[0] = 0; - MenuHandle menuh = GetMenu()->GetMacMenuH(); - ::GetMenuItemText ( menuh, status->command - FONT_MENU_BASE + PERM_FONT_ITEMS + 1, fontItemString ); - p2cstr( fontItemString ); - -// in mixed situation the mask bit will be cleared - *(status->usesMark) = ( better->values & TF_FONT_FACE && better->pFontFace && XP_STRLEN((char *)fontItemString) > 0 - && XP_STRSTR( better->pFontFace, (char *)fontItemString ) != NULL ); - *(status->mark) = *(status->usesMark) ? checkMark : 0; - *(status->usesMark) = true; - - EDT_FreeCharacterData(better); - mExecuteHost = false; - return; - } - } - } - break; - - case cmd_FormatViewerFont: - MWContext *cntxt2 = GetTopWindowContext(); - if ( cntxt2 ) - EDT_SetFontFace( cntxt2, NULL, 0, NULL ); - break; - - case cmd_FormatFixedFont: - MWContext *cntxt3 = GetTopWindowContext(); - if ( cntxt3 ) - EDT_SetFontFace( cntxt3, NULL, 1, NULL ); - break; - - default: - { - if ( inMessage >= FONT_MENU_BASE && inMessage <= FONT_MENU_BASE_LAST ) - { - MWContext *cntxt2 = GetTopWindowContext(); - if ( cntxt2 ) - { - // get font menu item - Str255 newFontItemString; - newFontItemString[0] = 0; - MenuHandle menuh = GetMenu()->GetMacMenuH(); - ::GetMenuItemText ( menuh, inMessage - FONT_MENU_BASE + PERM_FONT_ITEMS + 1, newFontItemString ); - p2cstr( newFontItemString ); - - EDT_SetFontFace( cntxt2, NULL, -1, (char *)newFontItemString ); - - mExecuteHost = false; - return; - } - } - } - break; - } - - mExecuteHost = TRUE; // Let application handle it -} - -LMenu *CFontMenuAttachment::GetMenu() -{ - if (!sMenu) - sMenu = new LMenu(cFontMenuID); - - return sMenu; -} - -// build the font menu from the system -void CFontMenuAttachment::UpdateMenu() -{ - if (!GetMenu() || !LMenuBar::GetCurrentMenuBar()) - return; - - int i; - - // ¥ delete all the menu items after the separator line - MenuHandle menu = sMenu->GetMacMenuH(); - if ( menu ) - { - for ( i = ::CountMItems( menu ); i > PERM_FONT_ITEMS; i-- ) - sMenu->RemoveItem( i ); - } - - Try_ - { - ThrowIfNil_( menu ); - - // Add fonts to menu - ::InsertResMenu( menu, 'FONT', PERM_FONT_ITEMS ); - - int commandNum = FONT_MENU_BASE; - int newHowMany = ::CountMItems( menu ); - for (i = PERM_FONT_ITEMS + 1; i <= newHowMany; i++ ) - sMenu->SetCommand( i, commandNum++ ); - } - Catch_( inErr ) - { - } - EndCatch_ -} - - -void CFontMenuAttachment::RemoveMenus() -{ - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - if (currentMenuBar) - currentMenuBar->RemoveMenu(sMenu); - } -} - - -void CFontMenuAttachment::InstallMenus() -{ - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - if (currentMenuBar) - { - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - currentMenuBar->InstallMenu(sMenu, hierMenu); - - ResIDT resID; - MenuHandle menuh; - Int16 whichItem; - currentMenuBar->FindMenuItem( cmd_ID_toSearchFor, resID, menuh, whichItem ); - if ( menuh ) - { - // make it hierarchical - ::SetItemCmd( menuh, whichItem, hMenuCmd ); - ::SetItemMark( menuh, whichItem, menu_ID ); - } - } - } -} - -#pragma mark - - -CFontMenuPopup::CFontMenuPopup( LStream *inStream ) : CPatternButtonPopupText( inStream ) -{ -} - -CFontMenuPopup::~CFontMenuPopup() -{ -} - -void CFontMenuPopup::FinishCreateSelf( void ) -{ - CPatternButtonPopupText::FinishCreateSelf(); - - int i; - - // ¥ delete all the menu items after the separator line - LMenu *ppmenu = GetMenu(); - MenuHandle menuh = ppmenu ? ppmenu->GetMacMenuH() : NULL; - if ( menuh ) - { - for ( i = ::CountMItems( menuh ); i > CFontMenuAttachment::PERM_FONT_ITEMS; i-- ) - ppmenu->RemoveItem( i ); - } - - Try_ - { - ThrowIfNil_( menuh ); - - // Add fonts to menu - ::InsertResMenu( menuh, 'FONT', CFontMenuAttachment::PERM_FONT_ITEMS ); - - int commandNum = FONT_MENU_BASE; - int newHowMany = ::CountMItems( menuh ); - for (i = CFontMenuAttachment::PERM_FONT_ITEMS + 1; i <= newHowMany; i++ ) - ppmenu->SetCommand( i, commandNum++ ); - - SetMaxValue( newHowMany ); - } - Catch_( inErr ) - { - } - EndCatch_ -} diff --git a/mozilla/cmd/macfe/Composer/CFontMenuAttachment.h b/mozilla/cmd/macfe/Composer/CFontMenuAttachment.h deleted file mode 100644 index 70e7453f5e8..00000000000 --- a/mozilla/cmd/macfe/Composer/CFontMenuAttachment.h +++ /dev/null @@ -1,73 +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. - */ - -#pragma once - -#ifndef CFONTMENUATTACHMENT_H_ -#define CFONTMENUATTACHMENT_H_ - -#include -#include "CPatternButtonPopupText.h" -#include "ntypes.h" // MWContext - - -class LMenu; - -/*********************************************************************************** - * CFontMenuAttachment - * Processes Font menu commands -- should be attached to application - * Currently, this menu is only used in the Editor and mail compose window - ***********************************************************************************/ -class CFontMenuAttachment: public LAttachment -{ -public: - enum { menu_ID = 13, PERM_FONT_ITEMS = 3, cmd_ID_toSearchFor = 'FONT' }; - - // ¥¥ constructors - CFontMenuAttachment(); - // ¥¥Êevents - virtual void ExecuteSelf( MessageT inMessage, void* ioParam ); - - static LMenu* GetMenu(); - static void UpdateMenu(); - - static void RemoveMenus(); - static void InstallMenus(); - -protected: - static MWContext* GetTopWindowContext(); - - static LMenu* sMenu; -}; - - - -class CFontMenuPopup : public CPatternButtonPopupText -{ - public: - enum { class_ID = 'Fpop' }; - - static void* CreateCFontMenuPopupStream( LStream *inStream ) {return( new CFontMenuPopup (inStream ));}; - CFontMenuPopup( LStream *inStream ); // ¥ Constructor - ~CFontMenuPopup(); // ¥ Destructor - - // ¥ drawing - void FinishCreateSelf(void); -}; - -#endif diff --git a/mozilla/cmd/macfe/Composer/CFormattingToolBar.cp b/mozilla/cmd/macfe/Composer/CFormattingToolBar.cp deleted file mode 100644 index 2763f9dd8ff..00000000000 --- a/mozilla/cmd/macfe/Composer/CFormattingToolBar.cp +++ /dev/null @@ -1,151 +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. - */ - -#include "CFormattingToolBar.h" -#include "CEditView.h" -#include "resgui.h" -#include "edt.h" -#include "URobustCreateWindow.h" - -CFormattingToolBar::CFormattingToolBar(LStream * inStream) - : CAMSavvyBevelView(inStream) -{ -} - -CFormattingToolBar::~CFormattingToolBar() -{ - mEditView = NULL; -} - -void CFormattingToolBar::FinishCreateSelf() -{ - if ( GetSuperView() ) - { - // get SuperView (we start with "this" so we're guaranteed non-0) - LView *superView = (LView *)this; - while (superView->GetSuperView() != NULL) - superView = superView->GetSuperView(); - - mEditView = dynamic_cast(superView->FindPaneByID( CEditView::pane_ID )); - } - else - mEditView = dynamic_cast(FindPaneByID( CEditView::pane_ID )); - - // if we have a mailcompose window show insert object popup menu - // check for presence of insert menu within CFormattingToolBar - LPane *pane = FindPaneByID('InsO'); - if ( pane ) - { - CMailEditView *mailview = dynamic_cast( mEditView ); - if ( mailview ) - pane->Show(); - else - pane->Hide(); - } - - UReanimator::LinkListenerToControls(this, this, 11616); -} - -void CFormattingToolBar::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - PaneIDT paneID = CEditView::pane_ID; - - if ( mEditView == NULL ) - return; - - if ( inMessage == 'Para' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_Format_Paragraph_Normal; break; - case 2: inMessage = cmd_Format_Paragraph_Head1; break; - case 3: inMessage = cmd_Format_Paragraph_Head2; break; - case 4: inMessage = cmd_Format_Paragraph_Head3; break; - case 5: inMessage = cmd_Format_Paragraph_Head4; break; - case 6: inMessage = cmd_Format_Paragraph_Head5; break; - case 7: inMessage = cmd_Format_Paragraph_Head6; break; - case 8: inMessage = cmd_Format_Paragraph_Address; break; - case 9: inMessage = cmd_Format_Paragraph_Formatted; break; - case 10: inMessage = cmd_Format_Paragraph_List_Item; break; - case 11: inMessage = cmd_Format_Paragraph_Desc_Title; break; - case 12: inMessage = cmd_Format_Paragraph_Desc_Text; break; - } - } - else if ( inMessage == 'Size' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_Format_Font_Size_N2; break; - case 2: inMessage = cmd_Format_Font_Size_N1; break; - case 3: inMessage = cmd_Format_Font_Size_0; break; - case 4: inMessage = cmd_Format_Font_Size_P1; break; - case 5: inMessage = cmd_Format_Font_Size_P2; break; - case 6: inMessage = cmd_Format_Font_Size_P3; break; - case 7: inMessage = cmd_Format_Font_Size_P4; break; - } - } - else if ( inMessage == 'Algn' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_JustifyLeft; break; - case 2: inMessage = cmd_JustifyCenter; break; - case 3: inMessage = cmd_JustifyRight; break; - } - } - else if ( inMessage == 'InsO' ) - { - switch (*(long*)ioParam) - { - case 1: inMessage = cmd_Insert_Link; break; - case 2: inMessage = cmd_Insert_Target; break; - case 3: inMessage = cmd_Insert_Image; break; - case 4: inMessage = cmd_Insert_Line; break; - case 5: inMessage = cmd_Insert_Table; break; - } - } - - mEditView->ObeyCommand( inMessage, ioParam ); -} - -#ifdef ENDER - -// CHTMLAreaToolBar is just a CFormattingToolBar for -// form widgets. - -CHTMLAreaToolBar::CHTMLAreaToolBar(LStream * inStream) - : CFormattingToolBar(inStream) -{ - mEditView = NULL; -} - -CHTMLAreaToolBar::~CHTMLAreaToolBar() -{ -} - -void CHTMLAreaToolBar::FinishCreateSelf() -{ - UReanimator::LinkListenerToControls(this, this, 11617); -} - -void CHTMLAreaToolBar::SetEditView(CEditView* inEditView) -{ - mEditView = inEditView; -} - -#endif // ENDER \ No newline at end of file diff --git a/mozilla/cmd/macfe/Composer/CFormattingToolBar.h b/mozilla/cmd/macfe/Composer/CFormattingToolBar.h deleted file mode 100644 index 8c7f818906b..00000000000 --- a/mozilla/cmd/macfe/Composer/CFormattingToolBar.h +++ /dev/null @@ -1,55 +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. - */ - -#pragma once - -#include "CAMSavvyBevelView.h" -#include - -class CEditView; - - -// used in Editor window and Mail Compose windows - -class CFormattingToolBar : public CAMSavvyBevelView, public LListener -{ -public: - enum {class_ID = 'FoTB'}; - CFormattingToolBar(LStream * inStream); - ~CFormattingToolBar(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void FinishCreateSelf(); - -protected: - CEditView* mEditView; -}; - -#ifdef ENDER -class CHTMLAreaToolBar : public CFormattingToolBar -{ -public: - enum { pane_ID = 'ftfv', class_ID = 'FoTV' }; - CHTMLAreaToolBar(LStream * inStream); - ~CHTMLAreaToolBar(); - - virtual void FinishCreateSelf(); - void SetEditView(CEditView* inEditView); - -}; -#endif // ENDER \ No newline at end of file diff --git a/mozilla/cmd/macfe/Composer/COpenRecentlyEditedPopup.cp b/mozilla/cmd/macfe/Composer/COpenRecentlyEditedPopup.cp deleted file mode 100644 index fe60a9e85f9..00000000000 --- a/mozilla/cmd/macfe/Composer/COpenRecentlyEditedPopup.cp +++ /dev/null @@ -1,184 +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. - */ - -// =========================================================================== -// COpenRecentlyEditedPopup.cp -// =========================================================================== - -#include "COpenRecentlyEditedPopup.h" - -#include "CWindowMediator.h" -#include "CBrowserContext.h" -#include "CEditorWindow.h" -#include "UMenuUtils.h" -#include "PascalString.h" - -#include "net.h" // NET_CreateURLStruct -#include "structs.h" // TagType which is needed in edt.h -#include "edt.h" - - -// --------------------------------------------------------------------------- -// ¥ CreateNavigationButtonPopupStream [static] -// --------------------------------------------------------------------------- - -COpenRecentlyEditedPopup* -COpenRecentlyEditedPopup::CreateOpenRecentlyEditedPopupStream( LStream* inStream ) -{ - return new COpenRecentlyEditedPopup(inStream); -} - -// --------------------------------------------------------------------------- -// ¥ COpenRecentlyEditedPopup -// --------------------------------------------------------------------------- - -COpenRecentlyEditedPopup::COpenRecentlyEditedPopup( LStream* inStream ) - : mBrowserContext(nil), - super(inStream) -{ -} - -// --------------------------------------------------------------------------- -// ¥ ~COpenRecentlyEditedPopup -// --------------------------------------------------------------------------- - -COpenRecentlyEditedPopup::~COpenRecentlyEditedPopup() -{ -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ AdjustMenuContents -// --------------------------------------------------------------------------- - -void -COpenRecentlyEditedPopup::AdjustMenuContents() -{ - if (!GetMenu() || !GetMenu()->GetMacMenuH()) - return; - - if (!AssertPreconditions()) - return; - - // Purge the menu - UMenuUtils::PurgeMenuItems(GetMenu()->GetMacMenuH(), PERM_OPEN_ITEMS); - - // Fill the menu - int i; - char *urlp = NULL, *titlep = NULL; - for ( i = 0; i < MAX_EDIT_HISTORY_LOCATIONS - && EDT_GetEditHistory( ((MWContext *)(*mBrowserContext)), i, &urlp, &titlep ); i++ ) - { - // strange logic: if we have no URL (then how do we go there???) then use title if it exists - if ( urlp == NULL ) - urlp = titlep; - - if ( urlp ) - { - NET_UnEscape( urlp ); - InsertItemIntoMenu( urlp, PERM_OPEN_ITEMS + i ); - } - else - break; - } - - // delete menu break line if we don't have any history items - if ( i == 0 ) - { - ::DeleteMenuItem( GetMenu()->GetMacMenuH(), PERM_OPEN_ITEMS ); - } - - // Set the min/max values of the control since we populated the menu - SetPopupMinMaxValues(); -} - -// --------------------------------------------------------------------------- -// ¥ InsertItemIntoMenu -// --------------------------------------------------------------------------- - -void -COpenRecentlyEditedPopup::InsertItemIntoMenu( char *urlp, Int16 inAfterItem ) -{ - Assert_(GetMenu() && GetMenu()->GetMacMenuH()); - Assert_(mBrowserContext); - CStr255 thePString( urlp ); - - // Insert a "blank" item first... - ::InsertMenuItem( GetMenu()->GetMacMenuH(), "\p ", inAfterItem + 1 ); - - // Then change it. We do this so that no interpretation of metacharacters will occur. - ::SetMenuItemText( GetMenu()->GetMacMenuH(), inAfterItem + 1, thePString ); -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ HandleNewValue -// --------------------------------------------------------------------------- - -Boolean -COpenRecentlyEditedPopup::HandleNewValue( Int32 inNewValue ) -{ - if ( inNewValue >= 1 && inNewValue < PERM_OPEN_ITEMS ) - { - // someone else will handle this - return false; - } - - if ( AssertPreconditions() && inNewValue ) - { - MWContext *cntxt = ((MWContext *)(*mBrowserContext)); - if ( cntxt ) - { - char *aURLtoOpen = NULL; - // EDT_GetEditHistory is 0-based so deduct 1 from 2nd parameter - if ( EDT_GetEditHistory( cntxt, inNewValue - PERM_OPEN_ITEMS - 1, &aURLtoOpen, NULL) ) - { - URL_Struct* theURL = NET_CreateURLStruct( aURLtoOpen, NET_NORMAL_RELOAD ); - if ( theURL ) - CEditorWindow::MakeEditWindow( NULL, theURL ); - } - } - } - - return true; -} - -// --------------------------------------------------------------------------- -// ¥ AssertPreconditions -// --------------------------------------------------------------------------- -// Assert preconditions and fill in interesting member data - -Boolean -COpenRecentlyEditedPopup::AssertPreconditions() -{ - CMediatedWindow* topWindow = CWindowMediator::GetWindowMediator()->FetchTopWindow( WindowType_Any, regularLayerType ); - - if (!topWindow || topWindow->GetWindowType() != WindowType_Editor) - return false; - - CEditorWindow* composerWindow = dynamic_cast(topWindow); - if ( !composerWindow ) - return false; - - if ( !(mBrowserContext = (CBrowserContext*)composerWindow->GetWindowContext()) ) - return false; - - return true; -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/Composer/COpenRecentlyEditedPopup.h b/mozilla/cmd/macfe/Composer/COpenRecentlyEditedPopup.h deleted file mode 100644 index 78af2fb208e..00000000000 --- a/mozilla/cmd/macfe/Composer/COpenRecentlyEditedPopup.h +++ /dev/null @@ -1,63 +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. - */ - -// =========================================================================== -// COpenRecentlyEditedPopup.h -// =========================================================================== - -#ifndef COpenRecentlyEditedPopup_H -#define COpenRecentlyEditedPopup_H -#pragma once - -// Includes - -#include "CPatternButtonPopup.h" - -// Forward declarations - -class CBrowserContext; - -// Class declaration - -class COpenRecentlyEditedPopup : public CPatternButtonPopup -{ -public: - enum { class_ID = 'PbRc', PERM_OPEN_ITEMS = 3 }; - - typedef CPatternButtonPopup super; - - static COpenRecentlyEditedPopup* CreateOpenRecentlyEditedPopupStream(LStream* inStream); - - COpenRecentlyEditedPopup(LStream* inStream); - virtual ~COpenRecentlyEditedPopup(); - -protected: - virtual void AdjustMenuContents(); - - virtual void InsertItemIntoMenu( char *urlp, - Int16 inAfterItem ); - - virtual Boolean HandleNewValue(Int32 inNewValue); - - Boolean AssertPreconditions(); - - CBrowserContext* mBrowserContext; -}; - - -#endif diff --git a/mozilla/cmd/macfe/Composer/CRecentEditMenuAttachment.cp b/mozilla/cmd/macfe/Composer/CRecentEditMenuAttachment.cp deleted file mode 100644 index 891c6753018..00000000000 --- a/mozilla/cmd/macfe/Composer/CRecentEditMenuAttachment.cp +++ /dev/null @@ -1,210 +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. - */ - -//=========================================================== -// CRecentEditMenuAttachment.cp -//=========================================================== - -#include "CRecentEditMenuAttachment.h" -#include "CEditView.h" -#include "CBrowserContext.h" // operator MWContext*() -#include "resgui.h" -#include "macutil.h" // CMediatedWindow -#include "UMenuUtils.h" -#include "edt.h" -#include "CEditorWindow.h" - - - -LMenu *CRecentEditMenuAttachment::sMenu = NULL; - -CRecentEditMenuAttachment::CRecentEditMenuAttachment() -{ - UpdateMenu(); -} - -MWContext *CRecentEditMenuAttachment::GetTopWindowContext() -{ - // Ok, ok. I know this is skanky, - // but there is no common way to get the context from a window: it depends on the window type. - // So, we look around for a CEditView somewhere in the top window. - // A CEditView we understand (and get an MWContext from). - - CMediatedWindow* topWin = NULL; // find the top window to use the plugin in - CWindowIterator iter(WindowType_Any); - iter.Next(topWin); - - if (topWin == NULL - || ! (topWin->GetWindowType() == WindowType_Editor || topWin->GetWindowType() == WindowType_Compose) ) - return NULL; - - CEditView *editView = (CEditView *)(topWin->FindPaneByID(CEditView::pane_ID)); - - if (editView == NULL || editView->GetNSContext() == NULL) - return NULL; - - return editView->GetNSContext()->operator MWContext*(); -} - - -// Processes -void CRecentEditMenuAttachment::ExecuteSelf( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case msg_CommandStatus: - { - SCommandStatus* status = (SCommandStatus*)ioParam; - - if ( status->command >= RECENT_EDIT_MENU_BASE && status->command <= RECENT_EDIT_MENU_BASE_LAST ) - { - *(status->enabled) = true; - mExecuteHost = false; - return; - } - } - break; - - default: - { - if ( inMessage >= RECENT_EDIT_MENU_BASE && inMessage <= RECENT_EDIT_MENU_BASE_LAST ) - { - MWContext *cntxt2 = GetTopWindowContext(); - if ( cntxt2 ) - { - char *aURLtoOpen = NULL; - if ( EDT_GetEditHistory( cntxt2, inMessage - RECENT_EDIT_MENU_BASE - 1, &aURLtoOpen, NULL) ) - { - URL_Struct* theURL = NET_CreateURLStruct( aURLtoOpen, NET_NORMAL_RELOAD ); - if ( theURL ) - CEditorWindow::MakeEditWindow( NULL, theURL ); - - mExecuteHost = false; - return; - } - } - } - } - break; - } - - mExecuteHost = true; // Let application handle it -} - - -LMenu *CRecentEditMenuAttachment::GetMenu() -{ - if (!sMenu) - sMenu = new LMenu( menu_ID ); - - return sMenu; -} - - -// build the font menu from the system -void CRecentEditMenuAttachment::UpdateMenu() -{ - if (!GetMenu() || !LMenuBar::GetCurrentMenuBar()) - return; - - int i; - - // ¥ delete all the menu items after the separator line - MenuHandle menu = sMenu->GetMacMenuH(); - if ( menu ) - { - for ( i = ::CountMItems( menu ); i > 0; i-- ) - sMenu->RemoveItem( i ); - } - - Try_ - { - ThrowIfNil_( menu ); - - // Add recently edited URLs to menu - - int i; - char *urlp = NULL, *titlep = NULL; - - for ( i = 0; i < MAX_EDIT_HISTORY_LOCATIONS - && EDT_GetEditHistory( GetTopWindowContext(), i, &urlp, &titlep ); i++ ) - { - NET_UnEscape( urlp ); - - // convert string to pascal-string for menu - CStr255 menuStr(urlp); - if ( menuStr.IsEmpty() ) - menuStr = titlep; - - if ( !menuStr.IsEmpty() ) - { - // Insert a "blank" item first... - ::InsertMenuItem( GetMenu()->GetMacMenuH(), "\p ", i ); - - // Then change it. We do this so that no interpretation of metacharacters will occur. - ::SetMenuItemText( GetMenu()->GetMacMenuH(), i + 1, menuStr ); - - // SetCommand for menu item - sMenu->SetCommand( i, RECENT_EDIT_MENU_BASE + i ); - sMenu->SetUsed( true ); - } - else - break; - } - } - Catch_( inErr ) - { - } - EndCatch_ -} - - -void CRecentEditMenuAttachment::RemoveMenus() -{ - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - if (currentMenuBar) - currentMenuBar->RemoveMenu(sMenu); - } -} - - -void CRecentEditMenuAttachment::InstallMenus() -{ - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - if (currentMenuBar) - { - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - currentMenuBar->InstallMenu(sMenu, hierMenu); - - ResIDT resID; - MenuHandle menuh; - Int16 whichItem; - currentMenuBar->FindMenuItem( cmd_ID_toSearchFor, resID, menuh, whichItem ); - if ( menuh ) - { - // make it hierarchical - ::SetItemCmd( menuh, whichItem, hMenuCmd ); - ::SetItemMark( menuh, whichItem, menu_ID ); - } - } - } -} diff --git a/mozilla/cmd/macfe/Composer/CRecentEditMenuAttachment.h b/mozilla/cmd/macfe/Composer/CRecentEditMenuAttachment.h deleted file mode 100644 index 959c4cb8008..00000000000 --- a/mozilla/cmd/macfe/Composer/CRecentEditMenuAttachment.h +++ /dev/null @@ -1,55 +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. - */ - -#pragma once - -#ifndef CRECENTEDITMENUATTACHMENT_H_ -#define CRECENTEDITMENUATTACHMENT_H_ - -#include -#include -#include "ntypes.h" - -/*********************************************************************************** - * CRecentEditMenuAttachment - * Processes Recent-Edited files menu commands -- should be attached to application - * Currently, this menu is only used in the Editor window - ***********************************************************************************/ -class CRecentEditMenuAttachment: public LAttachment -{ -public: - enum { menu_ID = 24, cmd_ID_toSearchFor = 'Rece' }; - - // ¥¥ constructors - CRecentEditMenuAttachment(); - // ¥¥Êevents - virtual void ExecuteSelf( MessageT inMessage, void* ioParam ); - - static LMenu* GetMenu(); - static void UpdateMenu(); - - static void RemoveMenus(); - static void InstallMenus(); - -protected: - static MWContext* GetTopWindowContext(); - - static LMenu* sMenu; -}; - -#endif diff --git a/mozilla/cmd/macfe/Composer/CSpellChecker.cp b/mozilla/cmd/macfe/Composer/CSpellChecker.cp deleted file mode 100644 index ca332c4c3b0..00000000000 --- a/mozilla/cmd/macfe/Composer/CSpellChecker.cp +++ /dev/null @@ -1,1055 +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. - */ - -#include "CSpellChecker.h" - -#include "CTextTable.h" -#include "StBlockingDialogHandler.h" -#include "URobustCreateWindow.h" -#include "CSimpleTextView.h" -#include "LGAEditField.h" -#include "LGAPushButton.h" -#include "LGAPopup.h" -#include "CEditDictionary.h" -#include "UMenuUtils.h" - -// need to include "structs.h" before "edt.h" because "edt.h" is missing -// some of the includes it needs -#include "structs.h" -#include "edt.h" -#include "proto.h" // LO_GetSelectionText -#include "prefapi.h" // PREF_SetIntPref -#include "uerrmgr.h" // ErrorManager -#include "resgui.h" // error stringNums -#include "macgui.h" // StPrepareForDialog -#include "ufilemgr.h" // CFileMgr - -// shared library stuff from NSPR -#include "prlink.h" - - -#define MAX_MAC_FILENAME 31 - -/* The difference between calling the spell checker lib from a DLL or from - a static linked lib depends on whether we're generating CFM code - (and on whether the static lib was included in the application project) */ -#if GENERATINGCFM -#define USE_DYNAMIC_SC_LIB -#else -#undef USE_DYNAMIC_SC_LIB -#endif - -// local prototypes -static void exit_spellchecker( PRLibrary *lib, ISpellChecker *pSpellChecker, CMacSpellChecker *macSpellChecker ); - - -// function typedefs -typedef ISpellChecker*(*sc_create_func)(); -typedef void (*sc_destroy_func)(ISpellChecker *); - - - -CMacSpellChecker::CMacSpellChecker( MWContext *context, CEditView *editView, CSimpleTextView *textView ) -{ - mMWContext = context; - mEditView = editView; - mTextView = textView; - mISpellChecker = NULL; -} - - -void CMacSpellChecker::ReplaceHilitedText( char *newText, Boolean doAll ) -{ - if ( mEditView ) - { - char *oldWord = (char *)LO_GetSelectionText( GetMWContext() ); - if ( oldWord == NULL ) - return; - - EDT_ReplaceMisspelledWord( GetMWContext(), oldWord, newText, doAll ); - XP_FREE( oldWord ); - } - else if ( mTextView ) - { - GetISpellChecker()->ReplaceMisspelledWord( newText, doAll ); - - /* assume the misspelled word is selected so that InsertPtr will replace it */ - mTextView->InsertPtr( newText, XP_STRLEN(newText), NULL, NULL, false, true ); - } -} - - -void CMacSpellChecker::IgnoreHilitedText( Boolean doAll ) -{ - if ( mEditView ) - { - char *oldWord = (char *)LO_GetSelectionText( GetMWContext() ); - if ( oldWord == NULL ) - return; - - EDT_IgnoreMisspelledWord( GetMWContext(), oldWord, doAll ); - XP_FREE( oldWord ); - } - else if ( mTextView && doAll ) - { - SInt32 selStart = 0; - SInt32 selEnd = 0; - SInt32 selLen = 0; - - mTextView->GetSelection( &selStart, &selEnd ); - - selLen = selEnd - selStart; - - if ( selLen > 0 ) - { - Handle theText = mTextView->GetTextHandle(); - XP_ASSERT( theText != NULL ); - - char *textP = (char *)XP_ALLOC( selLen + 1 ); - XP_ASSERT( textP ); - if ( textP ) - { - ::BlockMoveData( ((char *)*theText) + selStart, textP, selLen ); - textP[ selLen ] = 0; - - GetISpellChecker()->IgnoreWord( textP ); - XP_FREE( textP ); - } - } - } - // assume we don't need to do anything for ignoring just this occurrence in plain text -} - - -typedef struct dictionaryInfo -{ - int langCode; - int dialectCode; - int menuItemNumber; -} dictionaryInfo; - -static void AddDictionaryMenuItem( MenuHandle languagePopup, dictionaryInfo *dictInfoP ) -{ - // get string for lang code and dialectcode - int stringIndex = 4; - switch ( dictInfoP->langCode ) - { - case L_ENGLISH: - switch ( dictInfoP->dialectCode ) - { - case D_US_ENGLISH: stringIndex = 5; break; - case D_UK_ENGLISH: stringIndex = 6; break; - case D_AUS_ENGLISH: stringIndex = 7; break; - default: stringIndex = 8; break; - } - break; - - case L_CATALAN: stringIndex = 9; break; - case L_HUNGARIAN: stringIndex = 10; break; - - case L_GERMAN: - switch ( dictInfoP->dialectCode ) - { - default: stringIndex = 11; break; - case D_SCHARFES: stringIndex = 12; break; - case D_DOPPEL: stringIndex = 13; break; - } - break; - - case L_SWEDISH: stringIndex = 14; break; - case L_SPANISH: stringIndex = 15; break; - case L_ITALIAN: stringIndex = 16; break; - case L_DANISH: stringIndex = 17; break; - case L_DUTCH: stringIndex = 18; break; - - case L_PORTUGUESE: - switch ( dictInfoP->dialectCode ) - { - default: - case D_EUROPEAN: stringIndex = 20; break; - case D_BRAZILIAN: stringIndex = 21; break; - } - break; - - case L_NORWEGIAN: - switch ( dictInfoP->dialectCode ) - { - default: - case D_BOKMAL: stringIndex = 22; break; - case D_NYNORSK: stringIndex = 23; break; - } - break; - - case L_FINNISH: stringIndex = 24; break; - case L_GREEK: stringIndex = 25; break; - case L_AFRIKAANS: stringIndex = 26; break; - case L_POLISH: stringIndex = 27; break; - case L_CZECH: stringIndex = 28; break; - case L_FRENCH: stringIndex = 29; break; - case L_RUSSIAN: stringIndex = 30; break; - } - - Str255 str; - ::GetIndString( str, SpellCheckerResource, stringIndex ); - if ( str[ 0 ] == 0 ) - dictInfoP->menuItemNumber = 0; - else - { - UMenuUtils::AppendMenuItem( languagePopup, str, true ); - dictInfoP->menuItemNumber = ::CountMItems( languagePopup ); - } -} - - -static int FindDefaultMenuItem( int langcode, int dialectcode, dictionaryInfo *dictInfoP, int maxIndex ) -{ - int i; - for (i = 0; i < maxIndex; i++ ) - { - if ( langcode == dictInfoP[ i ].langCode && dialectcode == dictInfoP[ i ].dialectCode ) - return dictInfoP[ i ].menuItemNumber; - } - - return 1; -} - -static int FindDictionaryInfoIndexForMenu( LGAPopup *languagePopup, dictionaryInfo *dictInfoP, int maxIndex ) -{ - int menuSelection = languagePopup->GetValue(); - if ( menuSelection == 0 ) - return 0; - - int i; - for (i = 0; i < maxIndex; i++ ) - { - if ( menuSelection == dictInfoP[ i ].menuItemNumber ) - return i; - } - - return 0; -} - -void CMacSpellChecker::ShowDialog( char *textP ) -{ - Boolean continueChecking = StartProcessing( false ); - if ( continueChecking ) - continueChecking = GetNextMisspelledWord( true ); - - Str255 s; - LGAPushButton *btn; - StPrepareForDialog prepare; - StBlockingDialogHandler handler( res_ID, NULL ); - LDialogBox* dialog = (LDialogBox *)handler.GetDialog(); - - CTextTable *listview = (CTextTable *)dialog->FindPaneByID( pane_SuggestionList ); - if ( listview == NULL ) - return; - - PenState penState; - ::GetPenState( &penState ); - listview->AddAttachment( new LColorEraseAttachment( &penState, NULL, NULL, true ) ); - - listview->FocusDraw(); - listview->AddListener( &handler ); - dialog->FocusDraw(); - - LGAEditField *editField = (LGAEditField *)dialog->FindPaneByID( pane_NewWord ); - if ( editField == NULL ) - return; - - LGAPushButton *changeBtn = (LGAPushButton *)dialog->FindPaneByID( msg_Change ); - if ( changeBtn == NULL ) - return; - - LGAPopup *languagePopup = (LGAPopup *)dialog->FindPaneByID( msg_NewLanguage ); - if ( languagePopup == NULL ) - return; - languagePopup->LoadPopupMenuH(); - - int curDictionary, CurrLangCode, CurrDialectCode, menuLangCode, menuDialectCode; - int numDictionaries = GetISpellChecker()->GetNumOfDictionaries(); - - dictionaryInfo *dictInfoP = (dictionaryInfo *)XP_ALLOC( numDictionaries * sizeof( dictionaryInfo ) ); - if ( dictInfoP == NULL ) - return; - - for ( curDictionary = 0; curDictionary < numDictionaries; curDictionary++ ) - { - if ( GetISpellChecker()->GetDictionaryLanguage( curDictionary, CurrLangCode, CurrDialectCode ) ) - break; - - dictInfoP[ curDictionary ].langCode = CurrLangCode; - dictInfoP[ curDictionary ].dialectCode = CurrDialectCode; - dictInfoP[ curDictionary ].menuItemNumber = curDictionary + 1; - AddDictionaryMenuItem( languagePopup->GetMacMenuH(), &dictInfoP[ curDictionary ] ); - } - - GetISpellChecker()->GetCurrentLanguage( CurrLangCode, CurrDialectCode ); - - // the following line resets the menu so its width gets adjusted and max value set - languagePopup->SetMacMenuH( languagePopup->GetMacMenuH() ); - languagePopup->SetValue( FindDefaultMenuItem( CurrLangCode, CurrDialectCode, dictInfoP, numDictionaries ) ); - - if ( continueChecking ) - SetNextMisspelledWord( textP, editField, listview, dialog ); - - Boolean isEditFieldOriginal, doNextWord = false, doStartOver = false; - MessageT message; - do { - LCommander *target = dialog->GetTarget(); - - // if we're done checking we won't update buttons anymore - if ( continueChecking ) - { - editField->GetDescriptor( s ); - isEditFieldOriginal = ( XP_STRNCMP( (char *)s, - (char *)mOrigMisspelledWord, mOrigMisspelledWord[0] + 1 ) == 0 ); - p2cstr( s ); - char *indexp = XP_STRCHR( (char *)s, ' ' ); - Boolean containsNoSpaces = indexp == NULL || indexp[0] == 0; - // set state of buttons (enable/disable); disable when editField is target and matches origword - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Change_All ); - if ( target == editField && isEditFieldOriginal ) - { - // string hasn't changed so disable "replace" and "replace all" - changeBtn->Disable(); - if ( btn ) - btn->Disable(); - } - else - { - changeBtn->Enable(); - if ( btn ) - btn->Enable(); - } - - // we shouldn't be able to "learn" something that is already in the dictionary (in sugg. list) - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Add_Button ); - if ( btn ) - { - // can't learn if there's a space in the string! -#ifdef LEARN_BUTTON_WORKS_AS_SPECD - if ( target == editField && containsNoSpaces ) -#else - if ( containsNoSpaces ) -#endif - btn->Enable(); - else - btn->Disable(); - } - - // we shouldn't be able to "check" unless the editfield is the target - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Check ); - if ( btn ) - { - // can't check if multiple words (contains a space) - if ( target == editField && containsNoSpaces ) - btn->Enable(); - else - btn->Disable(); - } - - if ( changeBtn->GetValueMessage() != msg_Change ) - { - changeBtn->SetValueMessage( msg_Change ); - ::GetIndString( s, SpellCheckerResource, ChangeStringIndex ); - changeBtn->SetDescriptor( s ); - } - - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Ignore ); - if ( btn ) - btn->Enable(); - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Ignore_All ); - if ( btn ) - btn->Enable(); - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Stop ); - if ( btn ) - btn->Enable(); - - editField->Enable(); -// listview->Enable(); - } - else // done checking - { - doStartOver = false; - dialog->FocusDraw(); - - if ( changeBtn->GetValueMessage() != msg_Stop ) - { - changeBtn->SetValueMessage( msg_Stop ); - ::GetIndString( s, SpellCheckerResource, DoneStringIndex ); - changeBtn->SetDescriptor( s ); - } - changeBtn->Enable(); - - // disable all of the other buttons - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Change_All ); - if ( btn ) - btn->Disable(); - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Ignore ); - if ( btn ) - btn->Disable(); - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Ignore_All ); - if ( btn ) - btn->Disable(); - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Add_Button ); - if ( btn ) - btn->Disable(); - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Check ); - if ( btn ) - btn->Disable(); - - btn = (LGAPushButton *)dialog->FindPaneByID( msg_Stop ); - if ( btn ) - btn->Disable(); - - editField->Disable(); // don't allow anymore typing - listview->Disable(); - } - - if ( doNextWord ) - { - doNextWord = false; - dialog->FocusDraw(); - - ClearReplacementWord( editField, listview ); - if ( continueChecking ) - continueChecking = GetNextMisspelledWord( doStartOver ); - if ( continueChecking ) - SetNextMisspelledWord( NULL, editField, listview, dialog ); - } - - message = handler.DoDialog(); - switch ( message ) - { - case msg_Add_Button: - editField->GetDescriptor( s ); - p2cstr( s ); - int statusError = GetISpellChecker()->AddWordToPersonalDictionary( (char *)s ); - if ( statusError ) - SysBeep(0); - else - ReplaceHilitedText( (char *)s, true ); - doNextWord = true; - break; - - case msg_Ignore: - case msg_Ignore_All: - IgnoreHilitedText( message == msg_Ignore_All ); - doNextWord = true; - break; - - case msg_Change: - case msg_Change_All: - if ( target && target == editField ) - editField->GetDescriptor( s ); - else if ( target && target == listview ) - { - STableCell c(0, 1); - c = listview->GetFirstSelectedCell(); - Uint32 len = sizeof( s ); - listview->GetCellData( c, s, len ); - } - else - s[ 0 ] = 0; - - if ( s[ 0 ] != 0 ) - { - p2cstr( s ); - ReplaceHilitedText( (char *)s, message == msg_Change_All ); - } - - doNextWord = true; - break; - - case msg_SelectionChanged: - break; - - case msg_Check: - GetAlternativesForWord( editField, listview, dialog ); - break; - - case msg_NewLanguage: - // get current menu choice; convert to langcode/dialectcode - int index = FindDictionaryInfoIndexForMenu( languagePopup, dictInfoP, numDictionaries ); - menuLangCode = dictInfoP[ index ].langCode; - menuDialectCode = dictInfoP[ index ].dialectCode; - if ( CurrLangCode != menuLangCode || menuDialectCode != CurrDialectCode ) // actually changed - { - CurrLangCode = menuLangCode; - CurrDialectCode = menuDialectCode; - PREF_SetIntPref( "SpellChecker.DefaultLanguage", menuLangCode ); - PREF_SetIntPref( "SpellChecker.DefaultDialect", menuDialectCode ); - - if ( GetISpellChecker()->SetCurrentLanguage( menuLangCode, menuDialectCode ) == 0 ) - { - doNextWord = true; // set flag to get next misspelled word and enable/disable - doStartOver = true; - continueChecking = StartProcessing( true ); // continue if any misspelled words - } - } - break; - - case msg_EditDictionary: - CEditDictionary *dictEditor = dynamic_cast - (URobustCreateWindow::CreateWindow( CEditDictionary::res_ID, LCommander::GetTopCommander() )); - if ( dictEditor ) - dictEditor->SetISpellChecker( GetISpellChecker() ); - break; - } - } while ( message != msg_Stop ); - - if ( mEditView ) - // clear the TF_SPELL mask for any words that might still have it - EDT_IgnoreMisspelledWord( mMWContext, NULL, true ); -} - - -char *CMacSpellChecker::GetTextBuffer() -{ - char *retVal; - - if ( mEditView ) - retVal = EDT_GetPositionalText( mMWContext ); - else if ( mTextView ) - { - SInt32 theSize = mTextView->GetTextLength(); - if ( theSize == 0 ) - return NULL; - - retVal = (char *)XP_ALLOC( theSize + 1 ); - XP_ASSERT( retVal ); - if ( retVal ) - { - Handle textH = mTextView->GetTextHandle(); - ::BlockMoveData( *textH, retVal, theSize ); - retVal[ theSize ] = 0; - } - } - - return retVal; -} - - -void CMacSpellChecker::GetSelection(int32 &selStart, int32 &selEnd) -{ - if (mEditView) - { - char *pSelection = (char *)LO_GetSelectionText( GetMWContext() ); - if ( pSelection != NULL ) - { - XP_FREE( pSelection ); - EDT_GetSelectionOffsets( GetMWContext(), &selStart, &selEnd ); - } - } - else - { - long localStart, localEnd; - - mTextView->GetSelection( &localStart, &localEnd ); - // bug fix - // only return the selection if it is not empty. - if (localStart != localEnd) - { - selStart = localStart; - selEnd = localEnd; - } - } -} - - -Boolean CMacSpellChecker::StartProcessing( Boolean startOver ) -{ - char *stringToCheck; - char *misspelledWord = NULL; - - stringToCheck = GetTextBuffer(); - Boolean retVal = stringToCheck != NULL; - - if ( stringToCheck ) - { - if ( mEditView ) - EDT_SetRefresh( mMWContext, false ); - - if ( startOver ) - GetISpellChecker()->SetNewBuf( stringToCheck, true ); - else - { - // setting buffer the first time - // let the spellchecker know the current selection - int32 selStart = 0, selEnd = 0; - GetSelection( selStart, selEnd ); - GetISpellChecker()->SetBuf( stringToCheck, selStart, selEnd ); - } - - XP_HUGE_FREE( stringToCheck ); - - if ( mEditView ) - { - // clear the TF_SPELL mask for any words that might still have it - EDT_IgnoreMisspelledWord( mMWContext, NULL, true ); - - // mark misspelled words - EDT_CharacterData *pData = EDT_NewCharacterData(); - if ( pData ) - { - pData->mask = TF_SPELL; - pData->values = TF_SPELL; - - unsigned long StartPos = 0, len = 0; - while ( GetISpellChecker()->GetNextMisspelledWord( StartPos, len ) == 0 ) - EDT_SetCharacterDataAtOffset( GetMWContext(), pData, StartPos, len ); - - EDT_FreeCharacterData( pData ); - } - - // set cursor position at the beginning so that - // EDT_SelectNextMisspelledWord will start at beginning - EDT_BeginOfDocument( mMWContext, false ); - EDT_SetRefresh( mMWContext, true ); - } - } - - return retVal; -} - - -Boolean CMacSpellChecker::GetNextMisspelledWord( Boolean startOver ) -{ - if ( isHTMLeditor() ) - { - if ( startOver ) - return EDT_SelectFirstMisspelledWord( GetMWContext() ); - else - return EDT_SelectNextMisspelledWord( GetMWContext() ); - } - else - { - unsigned long StartPos = 0, Len = 0; - if ( GetISpellChecker()->GetNextMisspelledWord( StartPos, Len ) == 0 ) - { - mTextView->FocusDraw(); - mTextView->SetSelection( StartPos, StartPos + Len ); - - return true; - } - else // no more misspelled words - return false; - } - - return false; -} - - -void CMacSpellChecker::SetNextMisspelledWord( char *textP, LEditField *typoField, - CTextTable *table, LCommander *commander ) -{ - Boolean doFree = false; - - if ( textP == NULL ) - { - if ( isHTMLeditor() ) - { - textP = (char *)LO_GetSelectionText( GetMWContext() ); - doFree = ( textP != NULL ); - } - else - { - SInt32 selStart = 0; - SInt32 selEnd = 0; - SInt32 selLen = 0; - - mTextView->FocusDraw(); - mTextView->GetSelection( &selStart, &selEnd ); - selLen = selEnd - selStart; - - if ( selLen > 0 ) - { - textP = (char *)XP_ALLOC( selLen + 1 ); - XP_ASSERT( textP != NULL ); - - doFree = ( textP != NULL ); - - if ( textP ) - { - Handle textH = mTextView->GetTextHandle(); - ::BlockMoveData( (*textH) + selStart, textP, selLen ); - textP[ selLen ] = 0; - } - } - } - } - - // convert c-string to pascal-string - CStr255 str( textP ); - if ( typoField ) - { - typoField->FocusDraw(); - typoField->SetDescriptor( str ); - typoField->SelectAll(); - // re-set misspelledword member - typoField->GetDescriptor( mOrigMisspelledWord ); - } - - if ( table ) - { - table->FocusDraw(); - - STableCell cell(0, 1); - int numRows = GetISpellChecker()->GetNumAlternatives( textP ); - if ( numRows > 0 ) - { - table->Enable(); - table->InsertRows( numRows, 0, nil, 0, Refresh_Yes ); - - int i, len; - for ( i = 1; i <= numRows; i++ ) - { - char liststr[256]; - if ( GetISpellChecker()->GetAlternative( i - 1, liststr, 255 ) == 0 ) - { - len = XP_STRLEN( (char *)liststr ); - if ( len > 0 ) - { - cell.row = i; - CStr255 pascalstring( liststr ); - table->SetCellData( cell, pascalstring, len + 1 ); - } - } - } - - cell.row = 1; - table->SelectCell( cell ); - if ( commander ) - commander->SwitchTarget( table ); - } - else - { - table->InsertRows( 1, 0, nil, 0, Refresh_Yes ); - - Str255 noneFoundString; - noneFoundString[0] = 0; - ::GetIndString( noneFoundString, SpellCheckerResource, 31 ); - cell.row = 1; - table->SetCellData( cell, noneFoundString, noneFoundString[0] + 1 ); - - table->Disable(); - - if ( commander && typoField ) - commander->SwitchTarget( typoField ); - } - } - - if ( doFree ) - XP_FREE( textP ); -} - - -void CMacSpellChecker::ClearReplacementWord( LEditField *newWord, CTextTable *table ) -{ - if ( newWord ) - newWord->SetDescriptor( CStr255::sEmptyString ); - - if ( table ) - { - TableIndexT rows = 0, cols = 0; - table->GetTableSize( rows, cols ); - if ( rows ) - { - table->FocusDraw(); - table->RemoveRows( rows, 0, Refresh_Yes ); - } - } -} - - -// this function is used only for "Check" button -void CMacSpellChecker::GetAlternativesForWord( LEditField *newWord, CTextTable *table, LCommander *commander ) -{ - Str255 s; - if ( newWord ) - newWord->GetDescriptor( s ); - p2cstr( s ); - - if ( table ) - { - table->FocusDraw(); - - // clear previous choices (if any) - TableIndexT rows = 0, cols = 0; - table->GetTableSize( rows, cols ); - if ( rows ) - table->RemoveRows( rows, 0, Refresh_Yes ); - - // add new list of choices (if any) - STableCell cell(0, 1); - if ( GetISpellChecker()->CheckWord( (char *)s ) ) - { - // word spelled correctly; no need to get alternatives - table->InsertRows( 1, 0, nil, 0, Refresh_Yes ); - - Str255 spelledRightString; - spelledRightString[0] = 0; - ::GetIndString( spelledRightString, SpellCheckerResource, 32 ); - cell.row = 1; - table->SetCellData( cell, spelledRightString, spelledRightString[0] + 1 ); - table->Disable(); - - if ( commander && newWord ) - commander->SwitchTarget( newWord ); - - return; - } - - int numrows = GetISpellChecker()->GetNumAlternatives( (char *)s ); - if ( numrows > 0 ) - { - table->Enable(); - table->InsertRows( numrows, 0, nil, 0, Refresh_Yes ); - - char liststr[256]; - int i, len; - for ( i = 1; i <= numrows; i++ ) - { - if ( GetISpellChecker()->GetAlternative( i - 1, liststr, sizeof(s) ) == 0 ) - { - len = XP_STRLEN( liststr ); - if ( len > 0 ) - { - cell.row = i; - CStr255 pascalstring( liststr ); - table->SetCellData( cell, pascalstring, len + 1 ); - } - } - } - - cell.row = 1; - table->SelectCell( cell ); - if ( commander ) - commander->SwitchTarget( table ); - } - else - { - table->InsertRows( 1, 0, nil, 0, Refresh_Yes ); - - Str255 noneFoundString; - noneFoundString[0] = 0; - ::GetIndString( noneFoundString, SpellCheckerResource, 31 ); - cell.row = 1; - table->SetCellData( cell, noneFoundString, noneFoundString[0] + 1 ); - table->Disable(); - - if ( commander && newWord ) - commander->SwitchTarget( newWord ); - } - } -} - - -#pragma mark - - -// returns success (true) or failure (false) -static Boolean LocateDictionaries( FSSpec *mainDictionary, FSSpec *personalDictionary ) -{ - FSSpec appFolder, userPrefsFolder, goodFS; - Str255 str; - OSErr err; - - // assume main dictionary and netscape dictionary are next to each other - // get that netscape dictionary FSSpec - appFolder = CPrefs::GetFilePrototype( CPrefs::RequiredGutsFolder ); // CPrefs::NetscapeFolder - // get netscape dictionary name - ::GetIndString( str, SpellCheckerResource, NSDictionaryNameIndex ); - if ( str[ 0 ] == 0 ) - return false; - if ( str[ 0 ] > MAX_MAC_FILENAME ) - str[ 0 ] = MAX_MAC_FILENAME; - - strncpy( (char *)&appFolder.name, (char *)str, str[0] + 1 ); - err = FSMakeFSSpec( appFolder.vRefNum, appFolder.parID, appFolder.name, &goodFS ); - if ( err == noErr ) - memcpy(mainDictionary, &goodFS, sizeof(FSSpec)); - else - return false; - - // check for custom dictionary (may or may not be present) - // assume in User Profile folder - Boolean isValidPath = false; - char *prefMacPath = NULL; - PREF_CopyCharPref("SpellChecker.PersonalDictionary", &prefMacPath); - if ( prefMacPath && *prefMacPath ) - { - err = CFileMgr::FSSpecFromPathname( prefMacPath, &goodFS ); - if ( err == noErr ) - isValidPath = true; - } - - XP_FREEIF( prefMacPath ); - - if ( ! isValidPath ) - { - userPrefsFolder = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - // get user dictionary name - ::GetIndString( str, SpellCheckerResource, UserDictionaryNameIndex ); - if ( str[ 0 ] == 0 ) - return false; - if ( str[ 0 ] > MAX_MAC_FILENAME ) - str[ 0 ] = MAX_MAC_FILENAME; - - strncpy( (char *)&userPrefsFolder.name, (char *)str, str[0] + 1 ); - err = FSMakeFSSpec( userPrefsFolder.vRefNum, userPrefsFolder.parID, userPrefsFolder.name, &goodFS ); - } - - memcpy(personalDictionary, &goodFS, sizeof(FSSpec)); - if ( err == fnfErr ) - return true; - if ( err != noErr ) - return false; - - return true; -} - -#ifndef USE_DYNAMIC_SC_LIB -/* The direct interface to PR_FindSymbol("SC_Create") and PR_FindSymbol("SC_Destroy"): - These prototypes can't be found in any header file; they're defined in an unreleased source file. - It's not _too_ unsafe to define them separately here, because the interface understood - for these functions is the one which uses PR_FindSymbol, which naturally allows - no prototypes anyway. -*/ -extern "C" ISpellChecker * SCAPI SC_Create(); -extern "C" void SCAPI SC_Destroy(ISpellChecker *pSpellChecker); -#endif - -void do_spellcheck( MWContext *mwcontext, CEditView *editView, CSimpleTextView *textView ) -{ - if ( editView == NULL && textView == NULL ) - return; - - // editor requires a context - if ( mwcontext == NULL && editView != NULL) - return; - - // locate dictionaries - FSSpec mainDictionary, personalDictionary; - try { - if ( ! LocateDictionaries( &mainDictionary, &personalDictionary ) ) - { - // display message: unable to locate dictionary! - ErrorManager::PlainAlert( NO_DICTIONARY_FOUND ); - return; - } - } - catch(...) - { - // display message: unable to locate dictionary! - ErrorManager::PlainAlert( NO_DICTIONARY_FOUND ); - return; - } - -#ifdef USE_DYNAMIC_SC_LIB - const char *libPath = PR_GetLibraryPath(); - PR_SetLibraryPath( "/usr/local/netscape/" ); - - // load library - char *libname = "NSSpellChecker"; // internal string within SHLB - PRLibrary *spellCheckerLib = PR_LoadLibrary( libname ); - - // set path back to original path (don't have ourselves in list) - PR_SetLibraryPath( libPath ); - - if ( spellCheckerLib == NULL ) - { - // failed! - ErrorManager::PlainAlert( NO_SPELL_SHLB_FOUND ); - return; - } -#else - PRLibrary *spellCheckerLib = NULL; -#endif - - ISpellChecker *pSpellChecker = NULL; - CMacSpellChecker *macSpellChecker = NULL; - - try { -#ifdef USE_DYNAMIC_SC_LIB - sc_create_func sc_createProc; - sc_createProc = (sc_create_func)PR_FindSymbol( spellCheckerLib, "SC_Create" ); - if ( sc_createProc == NULL ) - { - ErrorManager::PlainAlert( NO_SPELL_SHLB_FOUND ); - exit_spellchecker( spellCheckerLib, pSpellChecker, macSpellChecker ); - return; - } - - pSpellChecker = sc_createProc(); -#else - pSpellChecker = SC_Create(); -#endif - if ( pSpellChecker ) - { - int err; - - macSpellChecker = new CMacSpellChecker( mwcontext, editView, textView ); - - int32 Language = 0; - int32 Dialect = 0; - PREF_GetIntPref( "SpellChecker.DefaultLanguage", &Language ); - PREF_GetIntPref( "SpellChecker.DefaultDialect", &Dialect ); - - err = pSpellChecker->Initialize( Language, Dialect, - (char *)&mainDictionary, - (char *)&personalDictionary ); - if ( err == noErr ) - { - macSpellChecker->SetISpellChecker( pSpellChecker ); - macSpellChecker->ShowDialog( NULL ); - } - } - } - catch(...) - { - exit_spellchecker( spellCheckerLib, pSpellChecker, macSpellChecker ); - throw; - } - - exit_spellchecker( spellCheckerLib, pSpellChecker, macSpellChecker ); -} - - -static void exit_spellchecker( PRLibrary *lib, ISpellChecker *pSpellChecker, CMacSpellChecker *macSpellChecker ) -{ - if ( pSpellChecker ) - { -#ifdef USE_DYNAMIC_SC_LIB - sc_destroy_func sc_destroyProc; - sc_destroyProc = (sc_destroy_func)PR_FindSymbol( lib, "SC_Destroy" ); - if ( sc_destroyProc != NULL ) - sc_destroyProc( pSpellChecker ); -#else - SC_Destroy( pSpellChecker ); -#endif - } - - if ( macSpellChecker ) - delete macSpellChecker; - macSpellChecker = NULL; - - // unload library - if ( lib ) - int err = PR_UnloadLibrary( lib ); -} diff --git a/mozilla/cmd/macfe/Composer/CSpellChecker.h b/mozilla/cmd/macfe/Composer/CSpellChecker.h deleted file mode 100644 index b357aa85fda..00000000000 --- a/mozilla/cmd/macfe/Composer/CSpellChecker.h +++ /dev/null @@ -1,83 +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. - */ - -#pragma once - -#include "spellchk.h" -#include "ntypes.h" // MWContext - -class CEditView; -class LEditField; -class CTextTable; -class CSimpleTextView; - -// public definitions -void do_spellcheck( MWContext *mwcontext, CEditView *editView, CSimpleTextView *textView ); -#define cmd_CheckSpelling 'ChSp' - - -// internal -const int SpellCheckerResource = 5109; -const int ChangeStringIndex = 1; -const int DoneStringIndex = 2; -const int NSDictionaryNameIndex = 3; -const int UserDictionaryNameIndex = 4; - - -// UI management class -class CMacSpellChecker -{ -public: - enum { class_ID = 'Spel', res_ID = 5299 }; - enum { pane_NewWord = 'NewW', pane_SuggestionList = 'AltW', - msg_Change = 'Chng', msg_Change_All = 'CAll', - msg_Ignore = 'Ignr', msg_Ignore_All = 'IAll', - msg_Add_Button = 'AddB', msg_Check = 'Chck', - msg_Stop = 'Stop', msg_NewLanguage = 'Lang', - msg_SelectionChanged = 'SelC', msg_EditDictionary = 'EdDc' }; - - CMacSpellChecker( MWContext *context, - CEditView *editView, CSimpleTextView *textView ); - - char *GetTextBuffer(); - void GetSelection( int32 &selStart, int32 &selEnd ); - void ReplaceHilitedText( char *newText, Boolean doAll ); - void IgnoreHilitedText( Boolean doAll ); - void SetNextMisspelledWord( char *textP, LEditField *typoField, CTextTable *t, LCommander *c ); - Boolean GetNextMisspelledWord( Boolean doFirstWord ); - void ClearReplacementWord( LEditField *newWord, CTextTable *table ); - void GetAlternativesForWord( LEditField *newWord, CTextTable *table, LCommander *c ); - - Boolean StartProcessing( Boolean startOver ); - void ShowDialog( char *textP ); - - MWContext *GetMWContext() { return mMWContext; }; - ISpellChecker *GetISpellChecker() { return mISpellChecker; }; - void SetISpellChecker( ISpellChecker *i ) { mISpellChecker = i; }; - - Boolean isHTMLeditor() { return mEditView != NULL; }; - -private: - ISpellChecker *mISpellChecker; - MWContext *mMWContext; // only if mEditView; ignored if mTextView - Str255 mOrigMisspelledWord; - - // we should have one and only one of these-->evidence that this class is mis-designed - CEditView *mEditView; - CSimpleTextView *mTextView; -}; diff --git a/mozilla/cmd/macfe/Composer/CToolsAttachment.cp b/mozilla/cmd/macfe/Composer/CToolsAttachment.cp deleted file mode 100644 index 7e7513fa045..00000000000 --- a/mozilla/cmd/macfe/Composer/CToolsAttachment.cp +++ /dev/null @@ -1,338 +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. - */ - -#include "CToolsAttachment.h" - -#include "CEditView.h" -#include "CBrowserContext.h" // operator MWContext*() -#include "resgui.h" // TOOLS_MENU_BASE_LAST -#include "macutil.h" // CMediatedWindow -#include "UMenuUtils.h" -#include "edt.h" -//#include "CSpellChecker.h" -#include - - -#define PERM_TOOLS_ITEMS 2 -#define PERM_TOOLS_END_ITEMS 1 - -const CommandT cmd_ToolsHierItem = TOOLS_MENU_BASE_LAST; - -LMenu *CToolsAttachment::sMenu = NULL; -Boolean CToolsAttachment::sInvalidMenu = true; -LArray CToolsAttachment::sMenusList; - -//=========================================================== -// CToolsAttachment -//=========================================================== -CToolsAttachment::CToolsAttachment() -{ -} - - -MWContext *CToolsAttachment::GetTopWindowContext() -{ - // Ok, ok. I know this is skanky, - // but there is no common way to get the context from a window: it depends on the window type. - // So, we look around for a CEditView somewhere in the top window. - // A CEditView we understand (and get an MWContext from). - - CMediatedWindow* topWin = NULL; // find the top window to use the plugin in - CWindowIterator iter(WindowType_Any); -// do { - iter.Next(topWin); -// } while (topWin && topWin->GetWindowType() != WindowType_Editor && topWin->GetWindowType() != WindowType_Compose); - - if (topWin == NULL) - return NULL; - - if ( topWin->GetWindowType() != WindowType_Editor && topWin->GetWindowType() != WindowType_Compose ) - return NULL; - - CEditView *editView = (CEditView *)(topWin->FindPaneByID(CEditView::pane_ID)); - - if (editView == NULL || editView->GetNSContext() == NULL) - return NULL; - - return editView->GetNSContext()->operator MWContext*(); -} - - -// Processes: -void CToolsAttachment::ExecuteSelf( MessageT inMessage, void* ioParam ) -{ - mExecuteHost = FALSE; - switch ( inMessage ) - { -// case cmd_CheckSpelling: // spell checker -// return; - - case cmd_EditorPluginStop: - MWContext *cntxt = GetTopWindowContext(); - if (cntxt) - EDT_StopPlugin(cntxt); - return; - - case msg_CommandStatus: - { - SCommandStatus* status = (SCommandStatus*)ioParam; - - switch ( status->command ) - { - case cmd_EditorPluginStop: - MWContext *cntxt = GetTopWindowContext(); - *(status->enabled) = cntxt && EDT_IsPluginActive(cntxt); - *(status->usesMark) = FALSE; - return; - - default: - if ( status->command >= TOOLS_MENU_BASE && status->command <= TOOLS_MENU_BASE_LAST ) - { - *(status->enabled) = TRUE; - *(status->usesMark) = FALSE; - return; - } - break; - } - } - break; - - default: - { - if ( inMessage >= TOOLS_MENU_BASE && inMessage <= TOOLS_MENU_BASE_LAST ) - { - int32 index = inMessage - TOOLS_MENU_BASE; - - for (int32 CategoryIndex = 0; CategoryIndex < EDT_NumberOfPluginCategories(); CategoryIndex++) - for (int32 PluginIndex = 0; PluginIndex < EDT_NumberOfPlugins(CategoryIndex); PluginIndex++) - if (index-- == 0) - { // count down until we find which one... - MWContext *cntxt = GetTopWindowContext(); - if (cntxt) - EDT_PerformPlugin(cntxt, CategoryIndex, PluginIndex, 0, 0); // what is the result for? - - return; - } - } - } - break; - } - mExecuteHost = TRUE; // Let application handle it -} - - -LMenu *CToolsAttachment::GetMenu() -{ - if (!sMenu) - sMenu = new LMenu(cToolsMenuID); - - return sMenu; -} - -void CToolsAttachment::UpdateMenu() -{ - if (!sInvalidMenu || !GetMenu() || !LMenuBar::GetCurrentMenuBar()) - return; - - int i; - - // ¥ delete all the dynamically created menus - // ¥Êdelete all the hierarchical menus we have added from the menubar - for ( i = 1; i <= sMenusList.GetCount(); i++ ) - { - LMenu* m; - sMenusList.FetchItemAt( i, &m ); - if ( m ) - LMenuBar::GetCurrentMenuBar()->RemoveMenu( m ); - delete m; - } - - // ¥ delete all the menu items after the line in Tools menu - MenuHandle menu = sMenu->GetMacMenuH(); - if ( menu ) - { - int howMany = ::CountMItems( menu ); - for ( i = howMany - PERM_TOOLS_END_ITEMS; i > PERM_TOOLS_ITEMS; i-- ) - sMenu->RemoveItem( i ); - } - sMenusList.RemoveItemsAt( sMenusList.GetCount(), 1 ); - - int whichItem = PERM_TOOLS_ITEMS; - int commandNum = TOOLS_MENU_BASE; - int nextMenuID = cEditorPluginsFirstHierMenuID; - - Try_ - { - ThrowIfNil_( sMenu ); - MenuHandle mHand = sMenu->GetMacMenuH(); - - ThrowIfNil_( mHand ); - - for (int32 CategoryIndex = 0; CategoryIndex < EDT_NumberOfPluginCategories(); CategoryIndex++) { - - CStr255 headerName( EDT_GetPluginCategoryName( CategoryIndex ) ); - CreateMenuString( headerName ); // make sure it isn't too long - - whichItem = UMenuUtils::InsertMenuItem(mHand, headerName, whichItem); // returns actual insert loc - sMenu->SetCommand(whichItem, cmd_ToolsHierItem); - - // ¥ Are there actually any menu items to put on this Hierarchical menu? - if (EDT_NumberOfPlugins(CategoryIndex)) { - - // ¥ do we have any hierarchical menus left? - if (nextMenuID <= cEditorPluginsLastHierMenuID) { - - LMenu* subMenu = (LMenuBar::GetCurrentMenuBar())->FetchMenu( nextMenuID ); - if ( !subMenu ) - { - StringHandle menuStringH = GetString( NEW_RESID ); - Assert_(menuStringH); - if (menuStringH) - { - StHandleLocker locker((Handle)menuStringH); - subMenu = new LMenu( nextMenuID, - (unsigned char *)*menuStringH ); - LMenuBar::GetCurrentMenuBar()->InstallMenu( subMenu, hierMenu ); - } - } - else - SysBeep( 1 ); - - nextMenuID++; - - if ( subMenu ) - { - sMenusList.InsertItemsAt( 1, sMenusList.GetCount(), &subMenu ); - // ¥Êmake item hierarchical - ::SetItemCmd( mHand, whichItem, hMenuCmd ); - ::SetItemMark( mHand, whichItem, subMenu->GetMenuID() ); - FillMenu( - CategoryIndex, - subMenu, - commandNum, - 0 ); - } - - } else { - - // ¥ There are no hierarchical menus left, - // so we will just add these onto the bottom of the main tools menu. - // We have already put the (disabled) category name in the main tools menu - - FillMenu( - CategoryIndex, - sMenu, - commandNum, - whichItem ); - - whichItem += EDT_NumberOfPlugins(CategoryIndex); - } - - } - - } - - // this is a hack. The menu item "Stop Active Plug-in" gets pushed around and loses its command. So, reset it. - sMenu->SetCommand(++whichItem, cmd_EditorPluginStop); - - } - Catch_( inErr ) - { - } - EndCatch_ - - - sInvalidMenu = true; -} - -void CToolsAttachment::FillMenu( - int32 CategoryIndex, - LMenu* newMenu, - int& commandNum, // next menu to create - int whichItem ) // id of the first item to insert -{ - Try_ - { - ThrowIfNil_( newMenu ); - MenuHandle mHand = newMenu->GetMacMenuH(); - - ThrowIfNil_( mHand ); - - for (int32 PluginIndex = 0; PluginIndex < EDT_NumberOfPlugins(CategoryIndex); PluginIndex++) { - - // ¥ should really convert this to sMenu chars - CStr255 pluginName( EDT_GetPluginName( CategoryIndex, PluginIndex) ); - CreateMenuString( pluginName ); - - whichItem = UMenuUtils::InsertMenuItem(mHand, pluginName, whichItem); // returns actual insert loc - newMenu->SetCommand(whichItem, commandNum++); - - } - } - Catch_( inErr ) - { - } - EndCatch_ -} - -void CToolsAttachment::RemoveMenus() -{ - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - - if (currentMenuBar) - { - currentMenuBar->RemoveMenu(sMenu); - - for (ArrayIndexT index = 1; index <= sMenusList.GetCount(); ++index) - { - LMenu *menu; - sMenusList.FetchItemAt(index, &menu); - - if (menu) - currentMenuBar->RemoveMenu(menu); - } - } - } -} - -void CToolsAttachment::InstallMenus() -{ - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - - if (currentMenuBar) - { - for (ArrayIndexT index = sMenusList.GetCount(); index > 0; --index) - { - LMenu *menu; - sMenusList.FetchItemAt(index, &menu); - - if (menu) - { - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - currentMenuBar->InstallMenu(menu, hierMenu); - } - } - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - currentMenuBar->InstallMenu(sMenu, InstallMenu_AtEnd); - } - } -} diff --git a/mozilla/cmd/macfe/Composer/CToolsAttachment.h b/mozilla/cmd/macfe/Composer/CToolsAttachment.h deleted file mode 100644 index 4cc2f16f039..00000000000 --- a/mozilla/cmd/macfe/Composer/CToolsAttachment.h +++ /dev/null @@ -1,64 +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. - */ - -#pragma once - -#ifndef CTOOLSATTACHMENT_H_ -#define CTOOLSATTACHMENT_H_ - -#include -#include "ntypes.h" - -class LMenu; -class LArray; - -/*********************************************************************************** - * CToolsAttachment - * Processes Tools menu commands -- should be attached to application - * Currently, this menu is only used in the Editor window - ***********************************************************************************/ -class CToolsAttachment: public LAttachment -{ -public: - // ¥¥ constructors - CToolsAttachment(); - // ¥¥Êevents - virtual void ExecuteSelf( MessageT inMessage, void* ioParam ); - - static LMenu* GetMenu(); - static void InvalidateMenu() { sInvalidMenu = true; } - static void UpdateMenu(); - - static void RemoveMenus(); - static void InstallMenus(); - -protected: - static void FillMenu( - int32 CategoryIndex, - LMenu* newMenu, - int& commandNum, - int whichItem ); - - static MWContext* GetTopWindowContext(); - - static LMenu* sMenu; - static Boolean sInvalidMenu; - static LArray sMenusList; -}; - -#endif diff --git a/mozilla/cmd/macfe/Composer/build/Composer.mcp b/mozilla/cmd/macfe/Composer/build/Composer.mcp deleted file mode 100644 index e0d12c4dc0b..00000000000 Binary files a/mozilla/cmd/macfe/Composer/build/Composer.mcp and /dev/null differ diff --git a/mozilla/cmd/macfe/Composer/build/Composer_DebugPrefix.h b/mozilla/cmd/macfe/Composer/build/Composer_DebugPrefix.h deleted file mode 100644 index 6dc5d424c42..00000000000 --- a/mozilla/cmd/macfe/Composer/build/Composer_DebugPrefix.h +++ /dev/null @@ -1,49 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Composer_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix_debug.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Composer_HeadersPPC++" - #else - #include "Composer_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Composer_Headers68K++" - #else - #include "Composer_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/Composer/build/Composer_Headers.pch b/mozilla/cmd/macfe/Composer/build/Composer_Headers.pch deleted file mode 100644 index 412b1a39f9c..00000000000 --- a/mozilla/cmd/macfe/Composer/build/Composer_Headers.pch +++ /dev/null @@ -1,46 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Composer_Headers.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -#ifdef powerc - #pragma precompile_target "Composer_HeadersPPC" -#else - #pragma precompile_target "Composer_Headers68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/Composer/build/Composer_Headers.pch++ b/mozilla/cmd/macfe/Composer/build/Composer_Headers.pch++ deleted file mode 100644 index b25e3479053..00000000000 --- a/mozilla/cmd/macfe/Composer/build/Composer_Headers.pch++ +++ /dev/null @@ -1,52 +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. - */ -// - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Composer_Headers.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -#ifdef powerc - #pragma precompile_target "Composer_HeadersPPC++" -#else - #pragma precompile_target "Composer_Headers68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/Composer/build/Composer_Prefix.h b/mozilla/cmd/macfe/Composer/build/Composer_Prefix.h deleted file mode 100644 index bd58561ce27..00000000000 --- a/mozilla/cmd/macfe/Composer/build/Composer_Prefix.h +++ /dev/null @@ -1,49 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Composer_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Composer_HeadersPPC++" - #else - #include "Composer_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Composer_Headers68K++" - #else - #include "Composer_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/Composer/meditdlg.cp b/mozilla/cmd/macfe/Composer/meditdlg.cp deleted file mode 100644 index c7ad318829a..00000000000 --- a/mozilla/cmd/macfe/Composer/meditdlg.cp +++ /dev/null @@ -1,5712 +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. - */ - -#include "meditdlg.h" -#include "meditor.h" // HandleModalDialog -#include "shist.h" -#include "CEditView.h" -#include "edt.h" -#include "pa_tags.h" -#include "secnav.h" -#include "rosetta.h" - -// macfe -#include "ulaunch.h" // StartDocInApp -#include "CColorCaption.h" // for CChameleonCaption -#include "macgui.h" // StPrepareForDialog, UGraphics -#include "resgui.h" // msg_Help, msg_Apply, CLOSE_STR_RESID, EDITOR_PERCENT_PARENT_CELL -#include "uerrmgr.h" -#include "uapp.h" // CFrontApp::DoGetURL -#include "macutil.h" -#include "ufilemgr.h" -#include "CPrefsDialog.h" -#include "prefapi.h" -#include "prefwutil.h" // SetColor -#include "CNSContext.h" // ExtractHyperView -#include "CLargeEditField.h" -#include "CPrefsMediator.h" -#include "URobustCreateWindow.h" -#include "UGraphicGizmos.h" - -// powerplant -#include "CTabControl.h" -#include "LToggleButton.h" -#include "StBlockingDialogHandler.h" -#include "UMenuUtils.h" -#include "LGAEditField.h" -#include "LGAPopup.h" -#include "LGACaption.h" -#include "CTabSwitcher.h" -#include -#include -#include -#include -#include - -#include "xp_help.h" - - -extern char *XP_NEW_DOC_NAME; - -static Boolean IsEditFieldWithinLimits(LGAEditField* editField, int minVal, int maxVal ); - - -static void SetTextTraitsIDByCsid(LEditField* pane, int16 win_csid) -{ - ThrowIfNil_(pane); - static int16 res_csid = -1; - if(-1 == res_csid) // un-initialized - res_csid = INTL_CharSetNameToID(INTL_ResourceCharSet()); - if(win_csid != res_csid) - pane->SetTextTraitsID(CPrefs::GetTextFieldTextResIDs(win_csid)); -} - - -//static void SetOkButtonState( Boolean enable ) -//{ -// StBlockingDialogHandler handler(5150, LCommander::GetTopCommander()); -// LWindow *dlog = (LWindow *)handler.GetDialog(); - -// LControl *okButton = (LControl *)dlog->FindPaneByID( 'OKOK' ); -// if ( okButton == NULL ) -// return; - -// if (enable) -// okButton->Enable(); -// else -// okButton->Disable(); -//} - - -// input: c-string; output: c-string -// returns true if the user clicked ok -static Boolean GetExtraHTML( char *pExtra, char **newExtraHTML , int16 win_csid) -{ - StBlockingDialogHandler handler(5114, LCommander::GetTopCommander()); - LWindow *dlog = (LWindow *)handler.GetDialog(); - - LControl *okButton = (LControl *)dlog->FindPaneByID( 'OKOK' ); - if ( okButton == NULL ) - return false; - - CLargeEditField *editField = (CLargeEditField *)dlog->FindPaneByID( 'Xhtm' ); - if ( editField == NULL ) - return false; - SetTextTraitsIDByCsid( editField, win_csid ); - - dlog->SetLatentSub( editField ); - if ( pExtra ) - { - editField->SetLongDescriptor( pExtra ); - editField->SelectAll(); - } - - MessageT theMessage; - do - { - char *pCurrent = editField->GetLongDescriptor(); - if ( pCurrent == NULL || ( pExtra && XP_STRCMP( pExtra, pCurrent ) == 0 ) ) - okButton->Disable(); - else - okButton->Enable(); - - if ( pCurrent ) - XP_FREE( pCurrent ); - - theMessage = handler.DoDialog(); - - if ( theMessage == msg_Help ) - ShowHelp ( HELP_EXTRA_HTML ); - - } while ( theMessage != msg_OK && theMessage != msg_Cancel ); - - if ( theMessage == msg_OK ) - *newExtraHTML = editField->GetLongDescriptor(); - - return theMessage == msg_OK; -} - - -void CChameleonView::SetColor(RGBColor textColor) -{ - fTextColor.red = textColor.red; - fTextColor.green = textColor.green; - fTextColor.blue = textColor.blue; -} - -void CChameleonView::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - ApplyForeAndBackColors(); - ::RGBBackColor(&fTextColor); - - EraseRect(&frame); -} - - - -void CEditorPrefContain::DrawSelf() -{ - Rect theFrame; - if (CalcLocalFrameRect(theFrame)) - { - StColorPenState theSaver; - theSaver.Normalize(); - - SBevelColorDesc theDesc; - UGraphicGizmos::LoadBevelTraits(5000, theDesc); - - ::PmForeColor(theDesc.fillColor); - ::PaintRect(&theFrame); - - StClipRgnState theClipSaver(theFrame); - StColorState::Normalize(); - - theFrame.top -= 5; - ::FrameRect(&theFrame); - - SBooleanRect theBevelSides = { true, true, true, true }; - UGraphicGizmos::BevelTintPartialRect(theFrame, 3, 0x4000, 0x4000, theBevelSides); - } -} - - -#pragma mark - -/**********************************************************/ -// This is probably stupid. This just allows all the dialogs I'm creating -// to remember who created them. Also the creator can specify which tab the -// Tab control should start on, if there is a tab control. Also, if this -// is an image, link, or HRule dialog, the creator can specify whether the -// final action should be to insert or modify a selected element. - -Boolean CEditDialog::Start(ResIDT inWindowID, MWContext * context, short initTabValue, Boolean insert) -{ - - - CEditDialog* newWindow = NULL; - LEditField* theEditField = NULL; - - StBlockingDialogHandler handler(inWindowID, LCommander::GetTopCommander()); // inSuperCommander - newWindow = (CEditDialog*)handler.GetDialog(); - ThrowIfNULL_(newWindow); - - UReanimator::LinkListenerToControls( newWindow, newWindow, inWindowID ); // the handler is listening; but we want a crack at the messages also... - - newWindow->SetContext(context); - newWindow->SetInitTabValue(initTabValue); - newWindow->SetInWindowID(inWindowID); - newWindow->SetInsertFlag(insert); - newWindow->InitializeDialogControls(); - newWindow->Show(); - - EDT_BeginBatchChanges(context); - - while (TRUE) { // Loop FOREVER. We exit from the loop by returning from particular cases. - - MessageT theMessage = handler.DoDialog(); - LCommander* theTarget = GetTarget(); - - switch (theMessage) { - - case msg_Help: - newWindow->Help(); - break; - - case msg_Apply: - if (theTarget == NULL || theTarget->SwitchTarget(newWindow)) - if (newWindow->CommitChanges(TRUE)) { - - LStdControl* cancel = (LStdControl*)newWindow->FindPaneByID( 'CANC' ); - if (cancel) { - StringHandle CloseHandle = GetString(CLOSE_STR_RESID); - CStr255 Close = **( (CStr255**)CloseHandle ); // Lock it? I don't think so. - cancel->SetDescriptor(Close); - } - } - break; - - case msg_OK: - if (theTarget == NULL || theTarget->SwitchTarget(newWindow)) - if (newWindow->CommitChanges(TRUE)) { - EDT_EndBatchChanges(context); - return TRUE; // Bye Bye!! - } - break; - - case msg_Cancel: { - EDT_EndBatchChanges(context); - return FALSE; // Bye Bye!! - } - break; - - default: - // this should never happen; hopefully, non-debug code makes this case go away - XP_ASSERT( 0 ); - break; - } - - } -} - - -Boolean CEditDialog::AllowSubRemoval( LCommander * /* inSub */ ) -{ - // don't allow removal - return false; -} - - -void CEditDialog::ChooseImageFile(CLargeEditField* editField) -{ - if ( editField == NULL ) - return; - - StPrepareForDialog preparer; - StandardFileReply reply; - Point loc = { -1, -1 }; - OSType types[ 4 ]; - - types[ 0 ] = 'GIFf'; - types[ 1 ] = 'TEXT'; - types[ 2 ] = 'JPEG'; - types[ 3 ] = 'JFIF'; - - ::StandardGetFile( NULL, 4, types, &reply ); - - if ( !reply.sfGood ) - return; - - char *fileLink = CFileMgr::GetURLFromFileSpec( reply.sfFile ); - if ( fileLink == NULL ) - return; - - editField->SetDescriptor( CtoPstr(/*NET_UnEscape*/(fileLink)) ); - - XP_FREE(fileLink); -} - - -/**********************************************************/ -#pragma mark - -#pragma mark CTarget - - -CTarget::CTarget( LStream* inStream ) : CEditDialog( inStream ) -{ - fOriginalTarget = NULL; - fTargetName = NULL; - - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - -CTarget::~CTarget() -{ - UDesktop::Activate(); - - if ( fOriginalTarget ) - XP_FREE( fOriginalTarget ); - fOriginalTarget = NULL; - fTargetName = NULL; -} - - -void CTarget::InitializeDialogControls() -{ - // Create Controls - ThrowIfNil_(fTargetName = (CLargeEditField*)FindPaneByID( 'tgnm' )); - - if ( EDT_GetCurrentElementType(fContext) == ED_ELEMENT_TARGET ) - StrAllocCopy( fOriginalTarget, EDT_GetTargetData(fContext) ); - else - { - StrAllocCopy( fOriginalTarget, (char *)LO_GetSelectionText(fContext) ); - CleanUpTargetString( fOriginalTarget ); - } - - if ( fOriginalTarget ) - fTargetName->SetDescriptor( CStr255(fOriginalTarget) ); - - this->SetLatentSub( fTargetName ); - fTargetName->SelectAll(); -} - -void CTarget::CleanUpTargetString(char *target) -{ - if ( target == NULL ) - return; - - // move temp past spaces and leading # and strcpy from new location over target - // remove leading spaces - char *temp = target; - while ( *temp == ' ' ) - temp++; - - // remove a leading pound, if any - if ( *temp == '#' ) - temp++; - - // strcpy now that we have temp correctly positioned - XP_STRCPY( target, temp ); - - // truncate at the first return character - char *ret = XP_STRCHR( target, '\r' ); - if ( ret ) - *ret = '\0'; -} - - -Boolean CTarget::AlreadyExistsInDocument(char *anchor) -{ - char *targs = EDT_GetAllDocumentTargets( fContext ); - if ( targs == NULL ) - return FALSE; - - char *parse = targs; - if ( parse ) - { - while ( *parse ) - { - if ( XP_STRCMP( anchor, parse ) == 0 ) - { - XP_FREE( targs ); - return TRUE; - } - parse += XP_STRLEN( parse ) + 1; - } - } - - XP_FREE(targs); - return FALSE; -} - - -Boolean CTarget::CommitChanges( Boolean /* isAllPanes */ ) -{ - char *anchor = fTargetName->GetLongDescriptor(); - if ( anchor == NULL ) - return true; - - CleanUpTargetString( anchor ); - - if ( AlreadyExistsInDocument(anchor) && (fInsert || XP_STRCMP(anchor, fOriginalTarget)) ) - { - ErrorManager::PlainAlert( DUPLICATE_TARGET ); - XP_FREE( anchor ); - return false; - } - - if ( !mUndoInited ) - { - EDT_BeginBatchChanges( fContext ); - mUndoInited = true; - } - - if ( fInsert ) - EDT_InsertTarget( fContext, anchor ); - else - EDT_SetTargetData( fContext, anchor ); - - XP_FREE( anchor ); - return true; -} - - -/**********************************************************/ -#pragma mark CUnknownTag - - -CUnknownTag::CUnknownTag( LStream* inStream ) : CEditDialog( inStream ) -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - - -CUnknownTag::~CUnknownTag() -{ - UDesktop::Activate(); -} - - -void CUnknownTag::FinishCreateSelf() -{ - fTargetName = NULL; - - CEditDialog::FinishCreateSelf(); -} - - -void CUnknownTag::InitializeDialogControls() -{ - fTargetName = (CLargeEditField *)FindPaneByID( 'tgnm' ); - SetTextTraitsIDByCsid(fTargetName, GetWinCSID()); - - if ( !fInsert ) - { - char *tag = EDT_GetUnknownTagData( fContext ); - if ( tag ) - { - fTargetName->SetLongDescriptor( tag ); - XP_FREE( tag ); - } - } - - this->SetLatentSub( fTargetName ); - fTargetName->SelectAll(); -} - - -Boolean CUnknownTag::CommitChanges( Boolean /* isAllPanes */ ) -{ - // HACK!!! CUnknownTag is used (unfortunately) by both "Insert HTML Tag" and "Extra HTMLÉ" - // This is bad and should be corrected as soon as possible (after 4.0 ships) - - // in the case of extra HTML we can end up here but fTargetName will be NULL - // let's just bail out and handle this in the extraHTML dlog code (by returning false) - if ( fTargetName == NULL ) - return false; - - char *anchor = fTargetName->GetLongDescriptor(); - if ( anchor == NULL ) - return true; - - if ( EDT_ValidateTag(anchor, FALSE) != ED_TAG_OK ) - { - ErrorManager::PlainAlert( BAD_TAG ); - XP_FREE( anchor ); - return false; - } - - if ( mUndoInited ) - { - EDT_BeginBatchChanges( fContext ); - mUndoInited = true; - } - - if ( fInsert ) - EDT_InsertUnknownTag( fContext, anchor ); - else - EDT_SetUnknownTagData( fContext, anchor ); - - XP_FREE( anchor ); - return true; -} - - -void CUnknownTag::Help() -{ - ShowHelp( HELP_HTML_TAG ); -} - - -void CUnknownTag::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case 'vrfy': - char *anchor = fTargetName->GetLongDescriptor(); - if (anchor) - { - if (EDT_ValidateTag( anchor, false ) != ED_TAG_OK) - ErrorManager::PlainAlert( BAD_TAG ); - - XP_FREE( anchor ); - } - break; - - default: - LDialogBox::ListenToMessage( inMessage, ioParam ); - break; - } -} - - -/**********************************************************/ -#pragma mark CPageTitle - - -CPageTitle::CPageTitle( LStream* inStream ) : CEditDialog( inStream ) -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - -void CPageTitle::FinishCreateSelf() -{ - fPageName = (CLargeEditField *)FindPaneByID( 'pgtl' ); - XP_ASSERT( fPageName ); - CEditDialog::FinishCreateSelf(); -} - - -CPageTitle::~CPageTitle() -{ - UDesktop::Activate(); -} - - -void CPageTitle::InitializeDialogControls() -{ - // fPageName cannot be null because we've already asserted it in FinishCreateSelf() - SetTextTraitsIDByCsid(fPageName, GetWinCSID()); - EDT_PageData *pagedata = EDT_GetPageData( fContext ); - - if ( pagedata ) - { - fPageName->SetDescriptor( CtoPstr( pagedata->pTitle ) ); - EDT_FreePageData( pagedata ); - } - - this->SetLatentSub( fPageName ); - fPageName->SelectAll(); -} - - -Boolean CPageTitle::CommitChanges( Boolean /* isAllPanes */ ) -{ - EDT_PageData *pagedata = EDT_GetPageData( fContext ); - if ( pagedata ) - { - pagedata->pTitle = fPageName->GetLongDescriptor(); - if ( pagedata->pTitle && pagedata->pTitle[0] == 0 ) - { - XP_FREE( pagedata->pTitle ); - pagedata->pTitle = NULL; - } - if ( pagedata->pTitle == NULL ) - pagedata->pTitle = strdup( " " ); - - EDT_SetPageData( fContext, pagedata ); - - EDT_FreePageData( pagedata ); - return true; - } - return false; -} - - - -/**********************************************************/ -#pragma mark - -// Does PowerPlant now have a better class? Can we replace this homebrew class? -// This is a single column LListBox which allows multiple things to be selected. - -MultipleSelectionSingleColumn::MultipleSelectionSingleColumn( LStream* inStream ) : LListBox( inStream ) -{ - FocusDraw(); -#if TARGET_CARBON - ListBounds dataBounds; - ::GetListDataBounds(mMacListH, &dataBounds); -#else - ListBounds dataBounds = (**mMacListH).dataBounds; -#endif // TARGET_CARBON - if ( dataBounds.right == 0 ) - ::LAddColumn(1 , 0, mMacListH); -#if TARGET_CARBON - ::SetListSelectionFlags(mMacListH, ::GetListSelectionFlags(mMacListH) & ~lOnlyOne ); // make sure this bit is cleared. -#else - (**mMacListH).selFlags &= ~lOnlyOne; -#endif // TARGET_CARBON -} - - -int16 MultipleSelectionSingleColumn::NumItems() -{ -#if TARGET_CARBON - ListBounds dataBounds; - ::GetListDataBounds(mMacListH, &dataBounds); -#else - ListBounds dataBounds = (**mMacListH).dataBounds; -#endif // TARGET_CARBON - return (dataBounds.bottom); -} - - -void MultipleSelectionSingleColumn::DeselectAll() -{ - Cell theCell; - int16 count = NumItems(); - theCell.h = 0; - - FocusDraw(); - - for (theCell.v = 0; theCell.v < count; theCell.v++) - LSetSelect(false, theCell, mMacListH); -} - - -void MultipleSelectionSingleColumn::SelectAll() -{ - Cell theCell; - int16 count = NumItems(); - theCell.h = 0; - - FocusDraw(); - - for (theCell.v = 0; theCell.v < count; theCell.v++) - LSetSelect(true, theCell, mMacListH); -} - - -void MultipleSelectionSingleColumn::AddItem( char* data, Boolean isSelected ) -{ - if(SwitchTarget(this)) - { - int16 rowNum = 0; - FocusDraw(); - Cell theCell; - theCell.h = 0; - -#if TARGET_CARBON - ListBounds dataBounds; - ::GetListDataBounds(mMacListH, &dataBounds); -#else - ListBounds dataBounds = (**mMacListH).dataBounds; -#endif // TARGET_CARBON - - rowNum = ::LAddRow(1 , dataBounds.bottom, mMacListH); - theCell.v = rowNum; - ::LSetCell(data, strlen(data) + 1 ,theCell, mMacListH); - ::LSetSelect( isSelected, theCell, mMacListH ); - } -} - - -StringPtr MultipleSelectionSingleColumn::GetItem(Str255 outDescriptor, int32 rowNum) const -{ - outDescriptor[0] = 0; - Cell theCell = {0, 0}; - theCell.h = 0; - theCell.v = rowNum; - Int16 dataLen = 255; - ::LGetCell(outDescriptor + 1, &dataLen, theCell, mMacListH); - outDescriptor[0] = dataLen; - return outDescriptor; -} - - -Boolean MultipleSelectionSingleColumn::IsSelected(int32 rowNum) // rowNum is zero based -{ - FocusDraw(); - Cell theCell; - theCell.h = 0; - theCell.v = rowNum; - return ::LGetSelect(false, &theCell, mMacListH); // false means to only look at this one item... -} - - -void MultipleSelectionSingleColumn::RemoveAllItems() -{ - FocusDraw(); -#if TARGET_CARBON - ListBounds dataBounds; - ::GetListDataBounds(mMacListH, &dataBounds); -#else - ListBounds dataBounds = (**mMacListH).dataBounds; -#endif // TARGET_CARBON - if ( dataBounds.bottom ) - ::LDelRow(dataBounds.bottom, 0, mMacListH); -} - - -/**********************************************************/ -#pragma mark CPublishHistory - -char* CPublishHistory::GetPublishHistoryCharPtr(short whichone) -{ - switch (whichone) { - case 0: return CPrefs::GetCharPtr(CPrefs::PublishHistory0); - case 1: return CPrefs::GetCharPtr(CPrefs::PublishHistory1); - case 2: return CPrefs::GetCharPtr(CPrefs::PublishHistory2); - case 3: return CPrefs::GetCharPtr(CPrefs::PublishHistory3); - case 4: return CPrefs::GetCharPtr(CPrefs::PublishHistory4); - case 5: return CPrefs::GetCharPtr(CPrefs::PublishHistory5); - case 6: return CPrefs::GetCharPtr(CPrefs::PublishHistory6); - case 7: return CPrefs::GetCharPtr(CPrefs::PublishHistory7); - case 8: return CPrefs::GetCharPtr(CPrefs::PublishHistory8); - case 9: return CPrefs::GetCharPtr(CPrefs::PublishHistory9); - } - return CPrefs::GetCharPtr(CPrefs::PublishHistory0); -} - - -void CPublishHistory::SetPublishHistoryCharPtr(char* entry, short whichone) -{ - switch (whichone) { - case 0: CPrefs::SetString( entry, CPrefs::PublishHistory0); break; - case 1: CPrefs::SetString( entry, CPrefs::PublishHistory1); break; - case 2: CPrefs::SetString( entry, CPrefs::PublishHistory2); break; - case 3: CPrefs::SetString( entry, CPrefs::PublishHistory3); break; - case 4: CPrefs::SetString( entry, CPrefs::PublishHistory4); break; - case 5: CPrefs::SetString( entry, CPrefs::PublishHistory5); break; - case 6: CPrefs::SetString( entry, CPrefs::PublishHistory6); break; - case 7: CPrefs::SetString( entry, CPrefs::PublishHistory7); break; - case 8: CPrefs::SetString( entry, CPrefs::PublishHistory8); break; - case 9: CPrefs::SetString( entry, CPrefs::PublishHistory9); break; - } -} - - -Boolean CPublishHistory::IsTherePublishHistory() -{ - char *lowest = GetPublishHistoryCharPtr(0); - - if (lowest == NULL) return FALSE; - if (*lowest == '\0') return FALSE; - return TRUE; -} - - -void CPublishHistory::AddPublishHistoryEntry(char *entry) -{ - if (entry == NULL) return; - - short highestcopy = 9; - short i; - - for (i = 0; i < 9 ; i++) { - char * hist = GetPublishHistoryCharPtr(i); - if (hist && strcmp(hist, entry) == NULL) highestcopy = i; - } - - while (highestcopy > 0) { - SetPublishHistoryCharPtr(GetPublishHistoryCharPtr(highestcopy - 1), highestcopy); - highestcopy--; - } - - SetPublishHistoryCharPtr(entry, 0); -} - - -#pragma mark CPublish - -CPublish::CPublish( LStream* inStream ) : CEditDialog( inStream ) -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - - -CPublish::~CPublish() -{ - UDesktop::Activate(); -} - - -void CPublish::FinishCreateSelf() -{ - // Create Controls - - fLocalLocation = NULL; - - fImageFiles = NULL; - fFolderFiles = NULL; - fDefaultLocation = NULL; - - fFileList = NULL; - - fPublishLocation = NULL; - fUserID = NULL; - fPassword = NULL; - - fSavePassword = NULL; - mHistoryList = NULL; - - CEditDialog::FinishCreateSelf(); -} - - -void CPublish::InitializeDialogControls() -{ - fLocalLocation = (LCaption*)this->FindPaneByID( 'Pub0' ); - - fImageFiles = (LControl*)this->FindPaneByID( 'Pub1' ); - fFolderFiles = (LControl*)this->FindPaneByID( 'Pub2' ); - - History_entry * pEntry = SHIST_GetCurrent(&fContext->hist); - if (pEntry && pEntry->address && NET_IsLocalFileURL(pEntry->address)) - fFolderFiles->Enable(); - else - fFolderFiles->Disable(); - - fFileList = (MultipleSelectionSingleColumn*)this->FindPaneByID( 'Pub3' ); - - fPublishLocation = (LGAEditField*)this->FindPaneByID( 'Pub4' ); - fUserID = (LGAEditField*)this->FindPaneByID( 'user' ); - fPassword = (LGAEditField*)this->FindPaneByID( 'Pass' ); - - fDefaultLocation = (LControl*)this->FindPaneByID( 'Dflt' ); - - fSavePassword = (LControl*)this->FindPaneByID( 'Pub5' ); - mHistoryList = (LGAPopup *)this->FindPaneByID( 'Pub6' ); - - MenuHandle menu = mHistoryList->GetMacMenuH(); - - if (menu && CPublishHistory::IsTherePublishHistory()) { - - ::SetMenuItemText(menu, 1, "\p "); - mHistoryList->SetMaxValue(10); // maximum of 10 entries. - - int i; - - for (i = 0; i < 10; i++) { - char *entry = CPublishHistory::GetPublishHistoryCharPtr(i); - if (entry == NULL || *entry == '\0') break; - - char *location = NULL; - char *user = NULL; - char *pass = NULL; - - if (NET_ParseUploadURL(entry, &location, &user, &pass)) { - - UMenuUtils::InsertMenuItem(menu, CtoPstr(location), i + 2); - - XP_FREE(location); - XP_FREE(user); - XP_FREE(pass); - } - } - } - - char *location = EDT_GetDefaultPublishURL( fContext, NULL, NULL, NULL ); - if ( location ) - { - fPublishLocation->SetDescriptor( CtoPstr(location) ); - XP_FREE( location ); - } - this->SetLatentSub( fPublishLocation ); - - char *localDir = DocName(); - if (localDir) { - - char *pSlash = strrchr(localDir, '/'); - if (pSlash) { // if there is a slash, only keep everything AFTER the last slash - pSlash++; // go past the slash - XP_STRCPY(localDir, pSlash); - } - - fLocalLocation->SetDescriptor( CtoPstr(localDir) ); - - XP_FREE( localDir ); - } - - CLargeEditField *titleField = (CLargeEditField *)FindPaneByID( 'Titl' ); - if ( titleField ) - { - int16 res_csid = INTL_CharSetNameToID(INTL_ResourceCharSet()); - int16 win_csid = GetWinCSID(); - if(win_csid != res_csid) - titleField->SetTextTraitsID(CPrefs::GetTextFieldTextResIDs(win_csid)); - - EDT_PageData *pageData = EDT_GetPageData( fContext ); - if ( pageData ) - { - titleField->SetDescriptor( CtoPstr(pageData->pTitle) ); - EDT_FreePageData( pageData ); - } - } - - CStr255 locationCStr = CPrefs::GetString(CPrefs::PublishLocation); - if (locationCStr.Length()) - fDefaultLocation->Enable(); - else - fDefaultLocation->Disable(); - - TurnOn(fImageFiles); - -} - -char *CPublish::DocName() -{ - History_entry * pEntry = SHIST_GetCurrent(&fContext->hist); - - if (pEntry == NULL || pEntry->address == NULL) return NULL; - - if (!NET_IsLocalFileURL(pEntry->address)) return NULL; - - char *filename = NULL; - XP_ConvertUrlToLocalFile( pEntry->address, &filename ); - - return filename; -} - -Boolean CPublish::CommitChanges( Boolean /* isAllPanes */ ) -{ - char *BrowseLoc = NULL; - - CStr255 outText; - - fPublishLocation->GetDescriptor( outText ); - - int type = NET_URL_Type(outText); - if (type != FTP_TYPE_URL && type != HTTP_TYPE_URL && type != SECURE_HTTP_TYPE_URL) { - ErrorManager::PlainAlert( INVALID_PUBLISH_LOC ); - return FALSE; - } - - // Tell user the URL they are publishing to looks like it might be wrong. - // e.g. ends in a slash or does not have a file extension. - // Give the user the option of attempting to publish to the - // specified URL even if it looks suspicious. - if ( !EDT_CheckPublishURL( fContext, (char*)outText ) ) { - // XP will put up alert - return FALSE; - } - - - /* set the page title */ - EDT_PageData *pageData = EDT_GetPageData( fContext ); - if ( pageData ) - { - CLargeEditField *titleField = (CLargeEditField *)FindPaneByID( 'Titl' ); - if ( titleField ) - pageData->pTitle = titleField->GetLongDescriptor(); - - if ( pageData->pTitle && pageData->pTitle[0] == 0 ) - { - XP_FREE( pageData->pTitle ); - pageData->pTitle = NULL; - } - if ( pageData->pTitle == NULL ) - pageData->pTitle = strdup( " " ); - - EDT_SetPageData( fContext, pageData ); - - EDT_FreePageData( pageData ); - } - - /* get the userID and password to create the internal URL */ - CStr255 user; - CStr255 pass; - fUserID->GetDescriptor( user ); - fPassword->GetDescriptor( pass ); - - if (!NET_MakeUploadURL(&BrowseLoc, outText, user, pass) || BrowseLoc == NULL) - return TRUE; // must be an out of memory problem, but we return TRUE so the user can try to recover - - /* look for related files to also publish */ - int count = 0; - int i; - for (i = fFileList->NumItems() - 1; i >= 0; i--) - if (fFileList->IsSelected(i)) - count++; - - char **allFiles = (char **) XP_CALLOC((count + 2), sizeof(char *)); - if (allFiles == NULL) { - XP_FREE(BrowseLoc); - return TRUE; // must be an out of memory problem, but we return TRUE so the user can try to recover - } - - allFiles[count + 1] = NULL; - allFiles[0] = XP_STRDUP(outText); // we are actually copying the doc name as well as the localDir here - - int allFilesIndex = 1; - for (i = 0; i < count; i++) - { - if (fFileList->IsSelected(i)) - { - CStr255 lookFor; - fFileList->GetItem(lookFor, i); - if (allFilesIndex < count + 1) // sanity check - allFiles[ allFilesIndex ] = XP_STRDUP( lookFor ); - else - XP_ASSERT(0); - - allFilesIndex++; - } - } - - /* get preferences and current URL */ - XP_Bool bKeepImages; - PREF_GetBoolPref("editor.publish_keep_images",&bKeepImages); - XP_Bool bKeepLinks; - PREF_GetBoolPref("editor.publish_keep_links",&bKeepLinks); - - char *pSrcURL; - History_entry * pEntry = SHIST_GetCurrent(&fContext->hist); - if (pEntry && pEntry->address && *pEntry->address) { - pSrcURL = pEntry->address; - } - else { - // no source name. - pSrcURL = XP_NEW_DOC_NAME; - } - - /* actually publish--finally! */ - EDT_PublishFile( fContext, ED_FINISHED_REVERT_BUFFER, pSrcURL, - allFiles, BrowseLoc, bKeepImages, bKeepLinks, false ); // this will eventually free allFiles, when we are done publishing.... - XP_FREE(BrowseLoc); - BrowseLoc = NULL; - - // add this new location to our history...known bugs in this area - if (fSavePassword->GetValue()) - { - char *result; - result = HG99875(pass); - if ( result && (strcmp( result, pass ) == 0) ) - { - // munging didn't do anything so we'll write out "" - pass = ""; - } - else - pass = result; - } - else - pass = ""; - - if (NET_MakeUploadURL(&BrowseLoc, outText, user, pass) && BrowseLoc) { - CPublishHistory::AddPublishHistoryEntry(BrowseLoc); - XP_FREE(BrowseLoc); - } - - // Ask the user if he/she wants to browse to the page. Only browse when the answer is "yes." - switch ( HandleModalDialog ( EDITDLG_BROWSE_PUBLISHED, NULL, NULL ) ) - { - case msg_OK: - CStr255 urlString = CPrefs::GetString( CPrefs::PublishBrowseLocation ); - if ( urlString != CStr255::sEmptyString ) - CFrontApp::DoGetURL( (unsigned char*)urlString ); - break; - - case msg_Cancel: - break; - } - - return TRUE; -} - - -void CPublish::Help() -{ - ShowHelp( HELP_PUBLISH_FILES ); -} - - -void CPublish::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case 'None': // deselect everything in file list - fFileList->DeselectAll(); - break; - - case 'SAll': // select everything in file list - fFileList->SelectAll(); - break; - - case 'Pub1': // add all document images to list - if (fImageFiles->GetValue()) { - fFileList->RemoveAllItems(); - - XP_Bool bKeepImages; - PREF_GetBoolPref("editor.publish_keep_images",&bKeepImages); - XP_Bool *bSelectionArray = NULL; - char *images = EDT_GetAllDocumentFilesSelected( fContext, - &bSelectionArray, bKeepImages ); - if (images) { - char *next = images; - - int index = 0; - while (*next) { - fFileList->AddItem(next, bSelectionArray[ index++ ]); - next += strlen(next) + 1; - } - - XP_FREE(images); - } - if ( bSelectionArray ) - XP_FREE( bSelectionArray ); - } - break; - - case 'Pub2': // add all images in folder to list - /* this should not be enabled if remote document or new document (file:///Untitled) */ - if (fFolderFiles->GetValue()) - { - fFileList->RemoveAllItems(); - - History_entry * pEntry = SHIST_GetCurrent(&fContext->hist); - if (pEntry && pEntry->address && NET_IsLocalFileURL(pEntry->address)) - { - char *URLDir = XP_STRDUP( pEntry->address ); - if ( URLDir ) - { - char *pSlash = strrchr(URLDir, '/'); - if (pSlash) // is there is a slash, chop off everything after the last slash - *++pSlash = '\0'; - - char **images = NET_AssembleAllFilesInDirectory( fContext, URLDir ); - if (images) - { - char **next = images; // go through the list and add them all - while (*next) - { - if (strcmp(*next, pEntry->address)) // don't add current file - { -// char *path = strstr(*next, URLDir); -// if (path) -// fFileList->AddItem( path + strlen(URLDir), false ); -// else -// fFileList->AddItem( *next, false ); - -// char *absURL = NET_MakeAbsoluteURL( pEntry->address, *next ); - fFileList->AddItem( *next, false ); - } - - next++; - } - - next = images; // now free them all... what a waste - while (*next) XP_FREE(*next++); - XP_FREE(images); - - } - - XP_FREE( URLDir ); - } - } - } - break; - - case 'Pub6': // extract one of the history entries and put in publish location - CStr255 text = CPublishHistory::GetPublishHistoryCharPtr(mHistoryList->GetValue() - 2); - - // reset it now, because we don't know when the user might modify the textedit - // field making the selected menu item no longer valid. - mHistoryList->SetValue(1); - - if ((char *) text && *(char *)text) { - - char *location = NULL; - char *user = NULL; - char *pass = NULL; - - if (NET_ParseUploadURL(text, &location, &user, &pass)) { - if (pass && *pass) { - char *newpass = HG99876(pass); - XP_FREE(pass); - pass = newpass; - } - - fPublishLocation->SetDescriptor( CtoPstr(location) ); - fUserID->SetDescriptor( CtoPstr(user) ); - fPassword->SetDescriptor( CtoPstr(pass) ); - - if (pass && *pass) - fSavePassword->SetValue(1); - else - fSavePassword->SetValue(0); - - XP_FREE(location); - XP_FREE(user); - XP_FREE(pass); - } - } - - break; - - case 'Dflt': // put in default publish location - char *BrowseLoc = CPrefs::GetString(CPrefs::PublishLocation); - if (BrowseLoc && *BrowseLoc) { - - char *location = NULL; - char *user = NULL; - char *pass = NULL; - - if (NET_ParseUploadURL(BrowseLoc, &location, &user, &pass)) { - if (pass && *pass) { - char *newpass = HG99876(pass); - XP_FREE(pass); - pass = newpass; - } - - fPublishLocation->SetDescriptor( CtoPstr(location) ); - fUserID->SetDescriptor( CtoPstr(user) ); - fPassword->SetDescriptor( CtoPstr(pass) ); - - XP_FREE(location); - XP_FREE(user); - XP_FREE(pass); - } - } - break; - - case msg_ControlClicked: - if ( ioParam ) - { - LControl *c = (LControl *)ioParam; - if ( c ) - ListenToMessage( c->GetValueMessage(), NULL ); - } - break; - - default: - LDialogBox::ListenToMessage( inMessage, ioParam ); - break; - } -} - - -/**********************************************************/ -#pragma mark CLineProp - -CLineProp::CLineProp( LStream* inStream ): CEditDialog( inStream ) -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - - -CLineProp::~CLineProp() -{ - UDesktop::Activate(); -} - - -#define kPixelsItem 1 -#define kPercentOfWindowItem 2 - -void CLineProp::FinishCreateSelf() -{ - fLeftAlign = NULL; - fCenterAlign = NULL; - fRightAlign = NULL; - - fHeightEditText = NULL; - fWidthEditText = NULL; - fPixelPercent = NULL; - fShading = NULL; - - CEditDialog::FinishCreateSelf(); -} - -void CLineProp::InitializeDialogControls() -{ - // Find Controls - fHeightEditText = (LGAEditField*)this->FindPaneByID( 'ELPh' ); - fWidthEditText = (LGAEditField*)this->FindPaneByID( 'ELPw' ); - - fLeftAlign = (LControl*)this->FindPaneByID( 'Left' ); - fCenterAlign = (LControl*)this->FindPaneByID( 'Cntr' ); - fRightAlign = (LControl*)this->FindPaneByID( 'Rght' ); - - fPixelPercent = (LControl*)this->FindPaneByID( 'eppp' ); - - fShading = (LControl*)this->FindPaneByID( 'ELPs' ); - this->SetLatentSub( fHeightEditText ); - fHeightEditText->SelectAll(); - - // Set control values - - EDT_HorizRuleData* fData; - if (EDT_GetCurrentElementType(fContext) == ED_ELEMENT_HRULE) - fData = EDT_GetHorizRuleData(fContext); - else - fData = EDT_NewHorizRuleData(); - - ThrowIfNil_(fData); - - fHeightEditText->SetValue(fData->size); - fWidthEditText->SetValue(fData->iWidth); - - if (fData->align == ED_ALIGN_LEFT) - TurnOn( fLeftAlign ); - else if ( fData->align == ED_ALIGN_RIGHT) - TurnOn( fRightAlign ); - else - TurnOn( fCenterAlign ); - - fPixelPercent->SetValue( (fData->bWidthPercent) ? kPercentOfWindowItem : kPixelsItem ); - - fShading->SetValue(fData->bNoShade == FALSE); - - pExtra = fData->pExtra; // we'll reuse this pointer - fData->pExtra = NULL; // don't want to free it! - - EDT_FreeHorizRuleData(fData); -} - - -Boolean CLineProp::CommitChanges( Boolean /* allPanes */ ) -{ - if ( !IsEditFieldWithinLimits(fHeightEditText, 1, 100)) - { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return false; - } - - if ( fPixelPercent->GetValue() != kPercentOfWindowItem - && !IsEditFieldWithinLimits(fWidthEditText, 1, 10000)) - { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return false; - } - - if (fPixelPercent->GetValue() == kPercentOfWindowItem - && !IsEditFieldWithinLimits(fWidthEditText, 1, 100)) - { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return false; - } - - if ( !mUndoInited ) - { - EDT_BeginBatchChanges( fContext ); - mUndoInited = true; - } - - EDT_HorizRuleData* fData; - if (EDT_GetCurrentElementType(fContext) == ED_ELEMENT_HRULE) - fData = EDT_GetHorizRuleData(fContext); - else - fData = EDT_NewHorizRuleData(); - - ThrowIfNil_(fData); - - if (fLeftAlign->GetValue()) - fData->align = ED_ALIGN_LEFT; - else if (fCenterAlign->GetValue()) - fData->align = ED_ALIGN_DEFAULT; - else if (fRightAlign->GetValue()) - fData->align = ED_ALIGN_RIGHT; - - fData->size = fHeightEditText->GetValue(); - fData->iWidth = fWidthEditText->GetValue(); - - fData->bWidthPercent = (fPixelPercent->GetValue() == kPercentOfWindowItem); - - fData->bNoShade = !fShading->GetValue(); - - if ( fData->pExtra ) - XP_FREE( fData->pExtra ); - fData->pExtra = ( pExtra ) ? XP_STRDUP( pExtra ) : NULL; - - if (EDT_GetCurrentElementType(fContext) == ED_ELEMENT_HRULE) - EDT_SetHorizRuleData( fContext, fData ); - else - EDT_InsertHorizRule( fContext, fData ); - - EDT_FreeHorizRuleData(fData); - - return true; -} - - -void CLineProp::Help() -{ - ShowHelp( HELP_PROPS_HRULE ); -} - - -/**********************************************************/ -#pragma mark - -#pragma mark CEditTabSwitcher - -CEditTabSwitcher::CEditTabSwitcher(LStream* inStream) : CTabSwitcher(inStream) -{ - fLinkName = NULL; -} - - -CEditTabSwitcher::~CEditTabSwitcher() -{ - XP_FREEIF(fLinkName); -} - - -void CEditTabSwitcher::SetData(MWContext* context, Boolean insert) -{ - fContext = context; - fInsert = insert; -} - - -void CEditTabSwitcher::Help() -{ - CEditContain* page = (CEditContain*)mCurrentPage; - if ( page ) - page->Help(); -} - - -void CEditTabSwitcher::DoPostLoad(LView* inLoadedPage, Boolean inFromCache) -{ - CEditContain * freshPane = (CEditContain*) inLoadedPage; - XP_ASSERT(freshPane); - freshPane->SetContext(fContext); - freshPane->SetInsertFlag(fInsert); - freshPane->SetLinkToLinkName(&fLinkName); - freshPane->SetExtraHTMLString( NULL ); - if (!inFromCache) // don't blast the contents of the text edit fields if there is something already there. - freshPane->ControlsFromPref(); -} - - -/**********************************************************/ -#pragma mark - -#pragma mark CTabbedDialog - -CTabbedDialog::CTabbedDialog( LStream* inStream ): CEditDialog( inStream ) -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - - -CTabbedDialog::~CTabbedDialog() -{ - UDesktop::Activate(); -} - - -void CTabbedDialog::FinishCreateSelf() -{ - mTabControl = NULL; - mTabSwitcher = NULL; - - LDialogBox::FinishCreateSelf(); -} - - -void CTabbedDialog::InitializeDialogControls() -{ - LControl *ApplyButton = (LControl*)FindPaneByID('APPY'); - if (fInsert && ApplyButton) - ApplyButton->Disable(); - SetDefaultButton('OKOK'); - - mTabControl = (CTabControl*)FindPaneByID(CTabControl::class_ID); - ThrowIfNULL_(mTabControl); - - mTabSwitcher = (CEditTabSwitcher*)FindPaneByID(CTabSwitcher::class_ID); - ThrowIfNULL_(mTabSwitcher); - - mTabSwitcher->SetData(fContext, fInsert); - - mTabControl->DoLoadTabs(fInWindowID); - mTabControl->SetValue(fInitTabValue); -} - - -void CTabbedDialog::RegisterViewTypes() -{ -#ifdef COOL_IMAGE_RADIO_BUTTONS - RegisterClass_( CImageAlignButton); -#endif - RegisterClass_( CLargeEditField); - RegisterClass_( CLargeEditFieldBroadcast); - - RegisterClass_( CTabControl); - RegisterClass_( CTabbedDialog); - RegisterClass_( CEDCharacterContain); - RegisterClass_( CEDParagraphContain); - RegisterClass_( CEDLinkContain); - RegisterClass_( CEDImageContain); - RegisterClass_( CEDDocPropGeneralContain); - RegisterClass_( CEDDocPropAppearanceContain); - RegisterClass_( CEDDocPropAdvancedContain); - RegisterClass_( LToggleButton); - RegisterClass_( CUnknownTag); - RegisterClass_( CPageTitle); - RegisterClass_( CPublish); - RegisterClass_( CTableInsertDialog); - RegisterClass_( CEditTabSwitcher); - RegisterClass_( CEDTableContain); - RegisterClass_( CEDTableCellContain); - - RegisterClass_( CEDDocAppearanceNoTab); - RegisterClass_( CFormatMsgColorAndImageDlog); - -} - - -Boolean CTabbedDialog::CommitChanges(Boolean allPanes) -{ - if ( !allPanes ) - { - MessageT thePageMessage = mTabControl->GetMessageForValue(mTabControl->GetValue()); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - if (thePage && !thePage->AllFieldsOK()) - return FALSE; - - if (thePage != NULL) - { - if ( !mUndoInited ) - { - EDT_BeginBatchChanges( fContext ); - mUndoInited = true; - } - - thePage->PrefsFromControls(); - } - return true; - } - - Int32 start = 1; - Int32 end = mTabControl->GetMaxValue(); - - // First, lets make sure that all the panes are happy. - for (int i = start; i <= end; i ++ ) { - - MessageT thePageMessage = mTabControl->GetMessageForValue(i); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - - if (thePage && !thePage->AllFieldsOK()) - { - mTabControl->SetValue(i); // go to the offending pane. - return FALSE; - } - } - - // If the CImagesLocal pane is up, commit that one first (in case we are doing an insert) - if ( !mUndoInited ) - { - EDT_BeginBatchChanges( fContext ); - mUndoInited = true; - } - - for (int i = start; i <= end; i ++ ) - { - MessageT thePageMessage = mTabControl->GetMessageForValue(i); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - - if (thePage && (thePage->GetUserCon() == CEDImageContain::class_ID )) - thePage->PrefsFromControls(); - } - - // If the CEDLinkContain pane is up, commit that one next (in case we are doing an insert) - for (int i = start; i <= end; i ++ ) - { - MessageT thePageMessage = mTabControl->GetMessageForValue(i); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - - if (thePage && (thePage->GetUserCon() == CEDLinkContain::class_ID )) - thePage->PrefsFromControls(); - } - - // If the CEDDocPropAppearanceContain pane is up, commit that one first (in case we are doing a doc properties) - for (int i = start; i <= end; i ++ ) - { - MessageT thePageMessage = mTabControl->GetMessageForValue(i); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - - if (thePage && (thePage->GetUserCon() == CEDDocPropAppearanceContain::class_ID )) - thePage->PrefsFromControls(); - } - - // If the CEDDocPropGeneralContain pane is up, commit that one next (in case we are doing a doc properties) - for (int i = start; i <= end; i ++ ) - { - MessageT thePageMessage = mTabControl->GetMessageForValue(i); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - - if (thePage && (thePage->GetUserCon() == CEDDocPropGeneralContain::class_ID )) - thePage->PrefsFromControls(); - } - - // commit the rest - for (int i = start; i <= end; i ++ ) - { - MessageT thePageMessage = mTabControl->GetMessageForValue(i); - CEditContain* thePage = (CEditContain*)mTabSwitcher->FindPageByID(thePageMessage); - if (thePage && (thePage->GetUserCon() != CEDImageContain::class_ID ) && (thePage->GetUserCon() != CEDLinkContain::class_ID ) && - (thePage->GetUserCon() != CEDDocPropAppearanceContain::class_ID ) && (thePage->GetUserCon() != CEDDocPropGeneralContain::class_ID )) - thePage->PrefsFromControls(); - } - - -// I admit this is not a very clean design... May cause button flicker when you hit "Insert" -// -// When you are inserting an image or a link and you hit "Apply", the "Insert" button should change to "OK" -// For simplicity, we do it anytime the user hits "Apply", "Insert" or "OK" since the other 2 times the dlog will soon disappear anyway. - - LControl *OKButton = (LControl*)FindPaneByID('OKOK'); - if (OKButton) - OKButton->Show(); - - return TRUE; -} - - -void CTabbedDialog::Help() -{ - mTabSwitcher->Help(); -} - - -/**********************************************************/ -#pragma mark - -#pragma mark Table Dialogs - -static void GetTableDataFromControls( EDT_TableData *fData, LControl *borderCheckBox, LGAEditField *borderWidth, - LGAEditField *cellSpacing, LGAEditField *cellPadding, - LControl *customWidth, LControl *isWPercent, LGAEditField *widthSize, - LControl *customHeight, LControl *isHPercent, LGAEditField *heightSize, - LControl *hasColor, CColorButton *customColor, LO_Color *backgroundColor, - LControl *fastLayout, LGAPopup *alignmentMenu, - LControl *useImage, CLargeEditField *imageName, LControl *leaveImage, char *pExtra ) -{ - fData->bBorderWidthDefined = borderCheckBox->GetValue(); - if ( fData->bBorderWidthDefined ) - fData->iBorderWidth = borderWidth->GetValue(); - else - fData->iBorderWidth = 0; - - fData->iCellSpacing = cellSpacing->GetValue(); - fData->iCellPadding = cellPadding->GetValue(); - - if ( customWidth->GetValue() ) - { - fData->bWidthDefined = TRUE; - fData->bWidthPercent = isWPercent->GetValue() == kPercentOfWindowItem; - fData->iWidth = widthSize->GetValue(); - } - else - fData->bWidthDefined = FALSE; - - if (customHeight->GetValue()) - { - fData->bHeightDefined = TRUE; - fData->bHeightPercent = isHPercent->GetValue() == kPercentOfWindowItem; - fData->iHeight = heightSize->GetValue(); - } - else - fData->bHeightDefined = FALSE; - - if (fData->pColorBackground) - XP_FREE(fData->pColorBackground); // we'll replace it with our own if we use it at all. - fData->pColorBackground = NULL; - if (hasColor->GetValue()) - { - *backgroundColor = UGraphics::MakeLOColor(customColor->GetColor()); - fData->pColorBackground = backgroundColor; // I hope that EDT_SetTableData() doesn't hang onto this pointer for long... - } - - switch ( alignmentMenu->GetValue() ) - { - default: - case 1: fData->align = ED_ALIGN_LEFT; break; - case 2: fData->align = ED_ALIGN_ABSCENTER; break; - case 3: fData->align = ED_ALIGN_RIGHT; break; - } - - fData->bUseCols = fastLayout->GetValue(); - - if ( fData->pBackgroundImage ) - { - XP_FREE( fData->pBackgroundImage ); - fData->pBackgroundImage = NULL; - } - if ( useImage->GetValue() ) - fData->pBackgroundImage = imageName->GetLongDescriptor(); - fData->bBackgroundNoSave = leaveImage->GetValue(); - - if ( fData->pExtra ) - XP_FREE( fData->pExtra ); - fData->pExtra = pExtra; // temporarily assign; we don't want to free it though! -} - - -CTableInsertDialog::CTableInsertDialog( LStream* inStream ) : CEditDialog( inStream ) -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - - -CTableInsertDialog::~CTableInsertDialog() -{ - UDesktop::Activate(); -} - - -void CTableInsertDialog::FinishCreateSelf() -{ - // Create Controls - CEditDialog::FinishCreateSelf(); - - UReanimator::LinkListenerToControls( this, this, 5115 ); // the table guts are in RIDL 5115 - - // Find Controls - fNumRowsEditText = (LGAEditField*)FindPaneByID( 'rows' ); - fNumColsEditText = (LGAEditField*)FindPaneByID( 'cols' ); - - fBorderCheckBox = (LControl*)FindPaneByID( 'BrdW' ); - fBorderCheckBox->SetValueMessage( 'BrdW' ); - - fBorderWidthEditText = (LGAEditField*)FindPaneByID( 'brdw' ); - fCellSpacingEditText = (LGAEditField*)FindPaneByID( 'clsp' ); - fCellPaddingEditText = (LGAEditField*)FindPaneByID( 'clpd' ); - - fCustomWidth = (LControl*)FindPaneByID( 'twth' ); - fWidthEditText = (LGAEditField*)FindPaneByID( 'wdth' ); - fWidthPopup = (LControl*)FindPaneByID( 'WdPU' ); - - fCustomHeight = (LControl*)FindPaneByID( 'thgt' ); - fHeightEditText = (LGAEditField*)FindPaneByID( 'hght' ); - fHeightPopup = (LControl*)FindPaneByID( 'HtPU' ); - - fCustomColor = (LControl*)FindPaneByID( 'tclr' ); - fColorCustomColor = (CColorButton*)FindPaneByID( 'Colo' ); - - fCaptionAboveBelow = (LControl*)FindPaneByID( 'cPop' ); - - mTableAlignment = (LGAPopup *)FindPaneByID( 'HzPU' ); - - mFastLayout = (LControl *)FindPaneByID( 'FLay' ); - mUseImage = (LControl*)FindPaneByID( 'UseI' ); - mImageFileName = (CLargeEditField *)FindPaneByID( 'TImg' ); - mImageFileName->AddListener(this); - mLeaveImage = (LControl *)FindPaneByID( 'LvIm' ); - - // Set control values - EDT_TableData *fData = EDT_NewTableData(); - if (fData != NULL) - { - fNumRowsEditText->SetValue( fData->iRows ); - fNumColsEditText->SetValue( fData->iColumns ); - - fBorderCheckBox->SetValue( fData->bBorderWidthDefined ); - fBorderWidthEditText->SetValue( fData->iBorderWidth ); - fCellSpacingEditText->SetValue( fData->iCellSpacing ); - fCellPaddingEditText->SetValue( fData->iCellPadding ); - - fCustomWidth->SetValue( fData->bWidthDefined ); - fWidthEditText->SetValue( fData->iWidth ); - fWidthPopup->SetValue( fData->bWidthPercent ? kPercentOfWindowItem : kPixelsItem ); - - fCustomHeight->SetValue( fData->bHeightDefined ); - fHeightEditText->SetValue( fData->iHeight ); - fHeightPopup->SetValue( fData->bHeightPercent ? kPercentOfWindowItem : kPixelsItem ); - - mUseImage->SetValue( fData->pBackgroundImage != NULL ); - if ( fData->pBackgroundImage ) - mImageFileName->SetLongDescriptor( fData->pBackgroundImage ); - mLeaveImage->SetValue( fData->bBackgroundNoSave ); - - int value; - switch ( fData->align ) - { - default: - case ED_ALIGN_LEFT: value = 1; break; - case ED_ALIGN_ABSCENTER: value = 2; break; - case ED_ALIGN_RIGHT: value = 3; break; - } - mTableAlignment->SetValue( value ); - - mFastLayout->SetValue( fData->bUseCols ); - pExtra = fData->pExtra; // don't bother to make our own copy - fData->pExtra = NULL; // set to NULL so backend doesn't delete - - EDT_FreeTableData( fData ); - } - - RGBColor macColor; - fCustomColor->SetValue(FALSE); // no custom color - macColor.red = 0xFFFF; // but start with white if they pick one. - macColor.green = 0xFFFF; - macColor.blue = 0xFFFF; - fColorCustomColor->SetColor(macColor); - - fCaptionAboveBelow->SetValue( 1 ); - - SetLatentSub( fNumRowsEditText ); - fNumRowsEditText->SelectAll(); - - AdjustEnable(); -} - - -void CTableInsertDialog::InitializeDialogControls() -{ - short resID; - StringHandle titleH; - - if (EDT_IsInsertPointInTable(fContext)) - resID = EDITOR_PERCENT_PARENT_CELL; - else - resID = EDITOR_PERCENT_WINDOW; - - titleH = GetString( resID ); - if (titleH) - { - SInt8 hstate = HGetState( (Handle)titleH ); - HLock( (Handle)titleH ); - - MenuHandle menuh = ((LGAPopup *)fWidthPopup)->GetMacMenuH(); - if (menuh) - { - SetMenuItemText( menuh, kPercentOfWindowItem, *titleH ); - ((LGAPopup *)fWidthPopup)->SetMacMenuH( menuh ); // resets menu width - } - - menuh = ((LGAPopup *)fHeightPopup)->GetMacMenuH(); - if (menuh) - { - SetMenuItemText( menuh, kPercentOfWindowItem, *titleH ); - ((LGAPopup *)fHeightPopup)->SetMacMenuH( menuh ); // resets menu width - } - - HSetState( (Handle)titleH, hstate ); - } -} - - -void CTableInsertDialog::AdjustEnable() -{ - LView *bordercaption = (LView *)FindPaneByID(1); - if ( fBorderCheckBox->GetValue() ) - { - bordercaption->Enable(); - fBorderWidthEditText->Enable(); - } - else - { - bordercaption->Disable(); - fBorderWidthEditText->Disable(); - } - - if (fCustomWidth->GetValue()) { - fWidthEditText->Enable(); - fWidthPopup->Enable(); - } else { - fWidthEditText->Disable(); - fWidthPopup->Disable(); - } - - if (fCustomHeight->GetValue()) { - fHeightEditText->Enable(); - fHeightPopup->Enable(); - } else { - fHeightEditText->Disable(); - fHeightPopup->Disable(); - } - - if ( mUseImage->GetValue() ) - mLeaveImage->Enable(); - else - mLeaveImage->Disable(); -} - - -Boolean CTableInsertDialog::CommitChanges(Boolean /* allPanes */ ) -{ - if (!IsEditFieldWithinLimits(fNumRowsEditText, 1, 100)) { - SwitchTarget( fNumRowsEditText ); - fNumRowsEditText->SelectAll(); - return FALSE; - } - - if (!IsEditFieldWithinLimits(fNumColsEditText, 1, 100)) { - SwitchTarget( fNumColsEditText ); - fNumColsEditText->SelectAll(); - return FALSE; - } - - if ( fBorderCheckBox->GetValue() ) - { - if (!IsEditFieldWithinLimits(fBorderWidthEditText, 0, 10000)) { - SwitchTarget( fBorderWidthEditText ); - fBorderWidthEditText->SelectAll(); - return FALSE; - } - } - - if (!IsEditFieldWithinLimits(fCellSpacingEditText, 0, 10000)) { - SwitchTarget( fCellSpacingEditText ); - fCellSpacingEditText->SelectAll(); - return FALSE; - } - - if (!IsEditFieldWithinLimits(fCellPaddingEditText, 0, 10000)) { - SwitchTarget( fCellPaddingEditText ); - fCellPaddingEditText->SelectAll(); - return FALSE; - } - - if (fCustomWidth->GetValue()) { - if (fWidthPopup->GetValue() == kPixelsItem && !IsEditFieldWithinLimits(fWidthEditText, 1, 10000)) { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return FALSE; - } - - if (fWidthPopup->GetValue() == kPercentOfWindowItem && !IsEditFieldWithinLimits(fWidthEditText, 1, 100)) { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return FALSE; - } - } - - if (fCustomHeight->GetValue()) { - if (fHeightPopup->GetValue() == kPixelsItem && !IsEditFieldWithinLimits(fHeightEditText, 1, 10000)) { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return FALSE; - } - - if (fHeightPopup->GetValue() == kPercentOfWindowItem && !IsEditFieldWithinLimits(fHeightEditText, 1, 100)) { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return FALSE; - } - } - - LO_Color backgroundColor; - EDT_TableData *fData = EDT_NewTableData(); - if (fData == NULL) - return FALSE; - - EDT_BeginBatchChanges( fContext ); - - fData->iRows = fNumRowsEditText->GetValue(); - fData->iColumns = fNumColsEditText->GetValue(); - - GetTableDataFromControls( fData, fBorderCheckBox, fBorderWidthEditText, - fCellSpacingEditText, fCellPaddingEditText, - fCustomWidth, fWidthPopup, fWidthEditText, - fCustomHeight, fHeightPopup, fHeightEditText, - fCustomColor, fColorCustomColor, &backgroundColor, - mFastLayout, mTableAlignment, - mUseImage, mImageFileName, mLeaveImage, pExtra ); - - EDT_InsertTable( fContext, fData ); - - fData->pExtra = NULL; // don't free this! we still use it! - fData->pColorBackground = NULL; // no need to free this, it is our local variable! - EDT_FreeTableData(fData); - - - if (fCaptionAboveBelow->GetValue() != 1) - { - EDT_TableCaptionData* fCaptionData; - fCaptionData = EDT_NewTableCaptionData(); - if (fCaptionData) - { - if ( fCaptionAboveBelow->GetValue() == 2 ) - fCaptionData->align = ED_ALIGN_ABSTOP; - else if ( fCaptionAboveBelow->GetValue() == 3 ) - fCaptionData->align = ED_ALIGN_ABSBOTTOM; // got this constant from CEditTableElement::SetCaption(); - - EDT_InsertTableCaption( fContext, fCaptionData ); - EDT_FreeTableCaptionData( fCaptionData ); - } - } - - EDT_EndBatchChanges( fContext ); - - return TRUE; -} - - -void CTableInsertDialog::Help() -{ - ShowHelp( HELP_NEW_TABLE_PROPS ); -} - - -void CTableInsertDialog::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case 'BrdW': - case 'twth': - case 'thgt': - case 'tclr': - case 'cptn': - AdjustEnable(); - break; - - case msg_LinkColorChange: - fCustomColor->SetValue(TRUE); - break; - - case 'UseI': - if (mUseImage->GetValue() == 1) - { // we are trying to set the image - CStr255 url; - mImageFileName->GetDescriptor(url); - if (url == CStr255::sEmptyString) - { // but it doesn't exist - ChooseImageFile( mImageFileName ); // so try to get it - mImageFileName->GetDescriptor( url ); - if (url == CStr255::sEmptyString) // but, if we were unsuccessful - mUseImage->SetValue( 0 ); // revert back. - } - } - AdjustEnable(); - break; - - case 'wst1': - { - ChooseImageFile( mImageFileName ); // try to get it - CStr255 url2; - mImageFileName->GetDescriptor( url2 ); - if (url2 == CStr255::sEmptyString) // if we were unsuccessful - mUseImage->SetValue( 0 ); // don't try to use image - else - mUseImage->SetValue( 1 ); - } - AdjustEnable(); - break; - - case msg_EditField2: - { - CStr255 url3; - mImageFileName->GetDescriptor( url3 ); - mUseImage->SetValue( url3[ 0 ] ? Button_On : Button_Off ); - } - break; - - case 'Xtra': - char * newExtraHTML = NULL; - Boolean canceled = !GetExtraHTML( pExtra, &newExtraHTML ,GetWinCSID() ); - if (!canceled) - { - if ( pExtra ) - XP_FREE( pExtra ); - pExtra = newExtraHTML; - } - break; - - default: - LDialogBox::ListenToMessage( inMessage, ioParam ); - break; - } -} - - -void CEDTableContain::FinishCreateSelf() -{ - // Find Controls - fNumRowsEditText = (LGAEditField*)this->FindPaneByID( 'rows' ); - fNumColsEditText = (LGAEditField*)this->FindPaneByID( 'cols' ); - - fBorderCheckBox = (LControl*)FindPaneByID( 'BrdW' ); - fBorderCheckBox->SetValueMessage( 'BrdW' ); - - fBorderWidthEditText = (LGAEditField*)this->FindPaneByID( 'brdw' ); - fCellSpacingEditText = (LGAEditField*)this->FindPaneByID( 'clsp' ); - fCellPaddingEditText = (LGAEditField*)this->FindPaneByID( 'clpd' ); - - fCustomWidth = (LControl*)this->FindPaneByID( 'twth' ); - fWidthEditText = (LGAEditField*)this->FindPaneByID( 'wdth' ); - fWidthPopup = (LControl*)this->FindPaneByID( 'WdPU' ); - - fCustomHeight = (LControl*)this->FindPaneByID( 'thgt' ); - fHeightEditText = (LGAEditField*)this->FindPaneByID( 'hght' ); - fHeightPopup = (LControl*)this->FindPaneByID( 'HtPU' ); - - fCustomColor = (LControl*)this->FindPaneByID( 'tclr' ); - fColorCustomColor = (CColorButton*)FindPaneByID( 'Colo' ); - - fCaptionAboveBelow = (LControl*)this->FindPaneByID( 'cPop' ); - - mTableAlignment = (LGAPopup *)FindPaneByID( 'HzPU' ); - - mFastLayout = (LControl *)FindPaneByID( 'FLay' ); - mUseImage = (LControl*)FindPaneByID( 'UseI' ); - mImageFileName = (CLargeEditField *)FindPaneByID( 'TImg' ); - mImageFileName->AddListener(this); - mLeaveImage = (LControl *)FindPaneByID( 'LvIm' ); - pExtra = NULL; - - UReanimator::LinkListenerToControls( this, this, 5115 ); - SetLatentSub( fBorderWidthEditText ); - fBorderWidthEditText->SelectAll(); -} - - -void CEDTableContain::Help() -{ - ShowHelp( HELP_TABLE_PROPS_TABLE ); -} - - -void CEDTableContain::AdjustEnable() -{ - LView *bordercaption = (LView *)FindPaneByID(1); - if ( fBorderCheckBox->GetValue() ) - { - bordercaption->Enable(); - fBorderWidthEditText->Enable(); - } - else - { - bordercaption->Disable(); - fBorderWidthEditText->Disable(); - } - - if (fCustomWidth->GetValue()) { - fWidthEditText->Enable(); - fWidthPopup->Enable(); - } else { - fWidthEditText->Disable(); - fWidthPopup->Disable(); - } - - if (fCustomHeight->GetValue()) { - fHeightEditText->Enable(); - fHeightPopup->Enable(); - } else { - fHeightEditText->Disable(); - fHeightPopup->Disable(); - } - - if ( mUseImage->GetValue() ) - mLeaveImage->Enable(); - else - mLeaveImage->Disable(); -} - - -void CEDTableContain::PrefsFromControls() -{ - EDT_TableData *fData = EDT_GetTableData(fContext); - if (fData == NULL) - return; - - LO_Color backgroundColor; - - fData->iRows = fNumRowsEditText->GetValue(); - fData->iColumns = fNumColsEditText->GetValue(); - - GetTableDataFromControls( fData, fBorderCheckBox, fBorderWidthEditText, - fCellSpacingEditText, fCellPaddingEditText, - fCustomWidth, fWidthPopup, fWidthEditText, - fCustomHeight, fHeightPopup, fHeightEditText, - fCustomColor, fColorCustomColor, &backgroundColor, - mFastLayout, mTableAlignment, - mUseImage, mImageFileName, mLeaveImage, pExtra ); - - EDT_SetTableData( fContext, fData ); - - fData->pExtra = NULL; // don't free this! we still use it! - fData->pColorBackground = NULL; // no need to free this, it is our local variable! - EDT_FreeTableData(fData); - -// deal with caption - EDT_TableCaptionData* fCaptionData = EDT_GetTableCaptionData(fContext); // find out if we have a caption.... - if (fCaptionAboveBelow->GetValue() == 1) /* no caption */ - { - if (fCaptionData) - { - EDT_DeleteTableCaption(fContext); // there is one, but we don't want it. - EDT_FreeTableCaptionData(fCaptionData); - } - } - else - { - if (fCaptionData) - { // we want one, and there is one!!! - if ( fCaptionAboveBelow->GetValue() == 1 ) - fCaptionData->align = ED_ALIGN_ABSTOP; - else - fCaptionData->align = ED_ALIGN_ABSBOTTOM; - - EDT_SetTableCaptionData( fContext, fCaptionData ); - } - else - { - fCaptionData = EDT_NewTableCaptionData(); // we want one and there isn't one!! - if (fCaptionData) - { - if ( fCaptionAboveBelow->GetValue() == 1 ) - fCaptionData->align = ED_ALIGN_ABSTOP; - else - fCaptionData->align = ED_ALIGN_ABSBOTTOM; - - EDT_InsertTableCaption( fContext, fCaptionData ); - } - } - - if (fCaptionData) - EDT_FreeTableCaptionData(fCaptionData); // we have to check this, because EDT_NewTableCaptionData() may have returned NULL - } -} - - -// Initialize from preferences -void CEDTableContain::ControlsFromPref() -{ - short resID; - StringHandle titleH; - - if (EDT_IsInsertPointInNestedTable(fContext)) - resID = EDITOR_PERCENT_PARENT_CELL; - else - resID = EDITOR_PERCENT_WINDOW; - - titleH = GetString( resID ); - if (titleH) - { - SInt8 hstate = HGetState( (Handle)titleH ); - HLock( (Handle)titleH ); - HSetState( (Handle)titleH, hstate ); - - MenuHandle menuh = ((LGAPopup *)fWidthPopup)->GetMacMenuH(); - if (menuh) - { - SetMenuItemText( menuh, kPercentOfWindowItem, *titleH ); - ((LGAPopup *)fWidthPopup)->SetMacMenuH( menuh ); // resets menu width - } - - menuh = ((LGAPopup *)fHeightPopup)->GetMacMenuH(); - if (menuh) - { - SetMenuItemText( menuh, kPercentOfWindowItem, *titleH ); - ((LGAPopup *)fHeightPopup)->SetMacMenuH( menuh ); // resets menu width - } - } - - EDT_TableData* fData = EDT_GetTableData(fContext); - if (fData == NULL) - return; - - fNumColsEditText->SetValue( fData->iColumns ); - fNumColsEditText->Enable(); - - fNumRowsEditText->SetValue( fData->iRows ); - fNumRowsEditText->Enable(); - - switch (fData->align) - { - default: - case ED_ALIGN_LEFT: mTableAlignment->SetValue( 1 ); break; - case ED_ALIGN_ABSCENTER: mTableAlignment->SetValue( 2 ); break; - case ED_ALIGN_RIGHT: mTableAlignment->SetValue( 3 ); break; - } - - mFastLayout->SetValue( fData->bUseCols ); - - fBorderCheckBox->SetValue( fData->bBorderWidthDefined ); - fBorderWidthEditText->SetValue( fData->iBorderWidth ); - fCellSpacingEditText->SetValue( fData->iCellSpacing ); - fCellPaddingEditText->SetValue( fData->iCellPadding ); - - fCustomWidth->SetValue( fData->bWidthDefined ); - fWidthEditText->SetValue( fData->iWidth ); - fWidthPopup->SetValue( fData->bWidthPercent ? kPercentOfWindowItem : kPixelsItem ); - - fCustomHeight->SetValue( fData->bHeightDefined ); - fHeightEditText->SetValue( fData->iHeight ); - fHeightPopup->SetValue( fData->bHeightPercent ? kPercentOfWindowItem : kPixelsItem ); - - RGBColor macColor; - fCustomColor->SetValue( fData->pColorBackground != NULL ); - if (fData->pColorBackground) - macColor = UGraphics::MakeRGBColor(*fData->pColorBackground); - else - macColor = UGraphics::MakeRGBColor(255, 255, 255); - fColorCustomColor->SetColor( macColor ); - - if ( fData->pBackgroundImage ) - { - mImageFileName->SetLongDescriptor( fData->pBackgroundImage ); - // turn on after we set the descriptor so we don't handle as click when msg is broadcast - TurnOn( mUseImage ); - } - mLeaveImage->SetValue( fData->bBackgroundNoSave ); - - pExtra = fData->pExtra; - fData->pExtra = NULL; // we'll take over this copy; don't let backend dispose of it - EDT_FreeTableData(fData); - -// check the caption.... - EDT_TableCaptionData* fCaptionData = EDT_GetTableCaptionData( fContext ); - if (fCaptionData) - { - if (fCaptionData->align != ED_ALIGN_ABSBOTTOM) - fCaptionAboveBelow->SetValue( 2 ); - else - fCaptionAboveBelow->SetValue( 3 ); - EDT_FreeTableCaptionData(fCaptionData); - } - else - { - fCaptionAboveBelow->SetValue( 1 ); - } - - AdjustEnable(); -} - - -Boolean CEDTableContain::AllFieldsOK() -{ - EDT_TableData* fData = EDT_GetTableData(fContext); - if (fData == NULL) - return FALSE; - - int upperBoundRows = fData->iRows > 100 ? fData->iRows : 100; // just in case iRows is over 100 - if (!IsEditFieldWithinLimits(fNumRowsEditText, fData->iRows, upperBoundRows)) { - SwitchTarget( fNumRowsEditText ); - fNumRowsEditText->SelectAll(); - return FALSE; - } - - int upperBoundCols = fData->iColumns > 100 ? fData->iColumns : 100; - if (!IsEditFieldWithinLimits(fNumColsEditText, fData->iColumns, upperBoundCols)) { - SwitchTarget( fNumColsEditText ); - fNumColsEditText->SelectAll(); - return FALSE; - } - - if ( fBorderCheckBox->GetValue() ) - { - if (!IsEditFieldWithinLimits(fBorderWidthEditText, 0, 10000)) { - SwitchTarget( fBorderWidthEditText ); - fBorderWidthEditText->SelectAll(); - return FALSE; - } - } - - if (!IsEditFieldWithinLimits(fCellSpacingEditText, 0, 10000)) { - SwitchTarget( fCellSpacingEditText ); - fCellSpacingEditText->SelectAll(); - return FALSE; - } - - if (!IsEditFieldWithinLimits(fCellPaddingEditText, 0, 10000)) { - SwitchTarget( fCellPaddingEditText ); - fCellPaddingEditText->SelectAll(); - return FALSE; - } - - if (fCustomWidth->GetValue()) { - if (fWidthPopup->GetValue() == kPixelsItem && !IsEditFieldWithinLimits(fWidthEditText, 1, 10000)) { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return FALSE; - } - - if (fWidthPopup->GetValue() == kPercentOfWindowItem && !IsEditFieldWithinLimits(fWidthEditText, 1, 100)) { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return FALSE; - } - } - - if (fCustomHeight->GetValue()) { - if (fHeightPopup->GetValue() == kPixelsItem && !IsEditFieldWithinLimits(fHeightEditText, 1, 10000)) { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return FALSE; - } - - if (fHeightPopup->GetValue() == kPercentOfWindowItem && !IsEditFieldWithinLimits(fHeightEditText, 1, 100)) { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return FALSE; - } - } - - return TRUE; -} - - -void CEDTableContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - //Intercept messages we should act on.... - switch (inMessage) - { - case 'BrdW': - case 'twth': - case 'thgt': - case 'tclr': - case 'cptn': - AdjustEnable(); - break; - - case msg_LinkColorChange: - fCustomColor->SetValue(TRUE); - break; - - case 'UseI': - if (mUseImage->GetValue() == 1) - { // we are trying to set the image - CStr255 url; - mImageFileName->GetDescriptor(url); - if (url == CStr255::sEmptyString) - { // but it doesn't exist - CEditDialog::ChooseImageFile( mImageFileName ); // so try to get it - mImageFileName->GetDescriptor( url ); - if (url == CStr255::sEmptyString) // but, if we were unsuccessful - mUseImage->SetValue( 0 ); // revert back. - } - } - AdjustEnable(); - break; - - case 'wst1': - { - CEditDialog::ChooseImageFile( mImageFileName ); // try to get it - CStr255 url2; - mImageFileName->GetDescriptor( url2 ); - if (url2 == CStr255::sEmptyString) // if we were unsuccessful - mUseImage->SetValue( 0 ); // don't try to use image - else - mUseImage->SetValue( 1 ); - } - AdjustEnable(); - break; - - case msg_EditField2: - { - CStr255 url3; - mImageFileName->GetDescriptor( url3 ); - mUseImage->SetValue( url3[ 0 ] ? Button_On : Button_Off ); - } - break; - - case 'Xtra': - char * newExtraHTML = NULL; - Boolean canceled = !GetExtraHTML( pExtra, &newExtraHTML ,GetWinCSID() ); - if (!canceled) - { - if ( pExtra ) - XP_FREE( pExtra ); - pExtra = newExtraHTML; - } - break; - } - // Pass all messages on... -} - - -void CEDTableCellContain::FinishCreateSelf() -{ - fRowSpanEditText = (LGAEditField*)this->FindPaneByID( 'rows' ); - fColSpanEditText = (LGAEditField*)this->FindPaneByID( 'cols' ); - - spanCaption = (LGACaption*)FindPaneByID( 'span' ); - rowCaption = (LGACaption*)FindPaneByID( 'rCap' ); - colCaption = (LGACaption*)FindPaneByID( 'cCap' ); - - fHorizontalAlignment = (LGAPopup *)this->FindPaneByID( 'HzPU' ); - fVerticalAlignment = (LGAPopup *)this->FindPaneByID( 'VtPU' ); - - fHeaderStyle = (LControl*)this->FindPaneByID( 'head' ); - fWrapText = (LControl*)this->FindPaneByID( 'wrap' ); - - fCustomWidth = (LControl*)this->FindPaneByID( 'cwth' ); - fWidthEditText = (LGAEditField*)this->FindPaneByID( 'wdth' ); - fWidthPopup = (LControl*)this->FindPaneByID( 'WdPU' ); // popup menu - - fCustomHeight = (LControl*)this->FindPaneByID( 'chgt' ); - fHeightEditText = (LGAEditField*)this->FindPaneByID( 'hght' ); - fHeightPopup = (LControl*)this->FindPaneByID( 'HtPU' ); // popup menu - - fCustomColor = (LControl*)this->FindPaneByID( 'cclr' ); - fColorCustomColor = (CColorButton*)FindPaneByID( 'Colo' ); - - mNextButton = (LControl*)this->FindPaneByID( 'NEXT' ); - mPreviousButton = (LControl*)this->FindPaneByID( 'PREV' ); - - mUseImage = (LControl*)FindPaneByID( 'UseI' ); - mImageFileName = (CLargeEditField *)FindPaneByID( 'TImg' ); - mImageFileName->AddListener(this); - mLeaveImage = (LControl *)FindPaneByID( 'LvIm' ); - pExtra = NULL; - - UReanimator::LinkListenerToControls( this, this, mPaneID ); -} - - -void CEDTableCellContain::Help() -{ - ShowHelp( HELP_TABLE_PROPS_CELL ); -} - - -void CEDTableCellContain::AdjustEnable() -{ - ETriState rowEnableState = fRowSpanEditText->GetEnabledState(); - ETriState colEnableState = fColSpanEditText->GetEnabledState(); - - // We do not use IsEnabled() because it returns false when we display the dialog box for - // the first time. The two edit fields' mVisibles are Tri_Latent in the beginning. Since - // the superview is not yet visible, the edit fields are not visible either. The code - // here will activate the captions as long as fRowSpanEditText and fColSpanEditText are not - // triState_Off. - - if ( rowEnableState != triState_Off || colEnableState != triState_Off ) - spanCaption->Activate(); - else - spanCaption->Deactivate(); - - if ( rowEnableState != triState_Off ) - rowCaption->Activate(); - else - rowCaption->Deactivate(); - - if ( colEnableState != triState_Off ) - colCaption->Activate(); - else - colCaption->Deactivate(); - - if (fCustomWidth->GetValue()) - { - fWidthEditText->Enable(); - fWidthPopup->Enable(); - } - else - { - fWidthEditText->Disable(); - fWidthPopup->Disable(); - } - - if (fCustomHeight->GetValue()) - { - fHeightEditText->Enable(); - fHeightPopup->Enable(); - } - else - { - fHeightEditText->Disable(); - fHeightPopup->Disable(); - } - - if ( mUseImage->GetValue() ) - mLeaveImage->Enable(); - else - mLeaveImage->Disable(); -} - - -void CEDTableCellContain::PrefsFromControls() -{ - EDT_TableCellData* cellData = EDT_GetTableCellData( fContext ); - if (cellData == NULL) - return; - - if ( fRowSpanEditText->IsEnabled() ) /* assume CF_ROWSPAN bit already set properly */ - cellData->iRowSpan = fRowSpanEditText->GetValue(); - if ( fColSpanEditText->IsEnabled() ) /* assume CF_COLSPAN bit already set properly */ - cellData->iColSpan = fColSpanEditText->GetValue(); - - int curValue; - - curValue = fHorizontalAlignment->GetValue(); - if ( !(cellData->mask & CF_ALIGN ) && curValue != 4 ) - cellData->mask |= CF_ALIGN; - switch ( curValue ) - { - default: - case 1: cellData->align = ED_ALIGN_LEFT; break; - case 2: cellData->align = ED_ALIGN_ABSCENTER; break; - case 3: cellData->align = ED_ALIGN_RIGHT; break; - case 4: break; // mixed state; don't reset - } - - curValue = fVerticalAlignment->GetValue(); - if ( !(cellData->mask & CF_VALIGN ) && curValue != 5 ) - cellData->mask |= CF_VALIGN; - switch ( curValue ) - { - default: - case 1: cellData->valign = ED_ALIGN_ABSTOP; break; - case 2: cellData->valign = ED_ALIGN_ABSCENTER; break; - case 3: cellData->valign = ED_ALIGN_BASELINE; break; - case 4: cellData->valign = ED_ALIGN_ABSBOTTOM; break; - case 5: break; // mixed state; don't reset - } - - curValue = fHeaderStyle->GetValue(); - if ( curValue != 2 ) - { - if ( !(cellData->mask & CF_HEADER ) ) - cellData->mask |= CF_HEADER; - cellData->bHeader = curValue; - } - - curValue = fWrapText->GetValue(); - if ( curValue != 2 ) - { - if ( !(cellData->mask & CF_NOWRAP ) ) - cellData->mask |= CF_NOWRAP; - cellData->bNoWrap = curValue; - } - - curValue = fCustomWidth->GetValue(); - if ( !(cellData->mask & CF_WIDTH ) && curValue != 2 ) - cellData->mask |= CF_WIDTH; - if ( curValue == 1 ) - { - cellData->bWidthDefined = TRUE; - cellData->bWidthPercent = fWidthPopup->GetValue() == kPercentOfWindowItem; - cellData->iWidth = fWidthEditText->GetValue(); - } - else if ( curValue == 0 ) - cellData->bWidthDefined = FALSE; - - curValue = fCustomHeight->GetValue(); - if ( !(cellData->mask & CF_HEIGHT ) && curValue != 2 ) - cellData->mask |= CF_HEIGHT; - if ( curValue == 1 ) - { - cellData->bHeightDefined = TRUE; - cellData->bHeightPercent = fHeightPopup->GetValue() == kPercentOfWindowItem; - cellData->iHeight = fHeightEditText->GetValue(); - } - else if ( curValue == 0 ) - cellData->bHeightDefined = FALSE; - - XP_FREEIF( cellData->pColorBackground ); // we'll replace it with our own if we use it at all. - cellData->pColorBackground = NULL; - - LO_Color pColor; - curValue = fCustomColor->GetValue(); - if ( curValue != 2 && !(cellData->mask & CF_BACK_COLOR ) ) - cellData->mask |= CF_BACK_COLOR; - if ( curValue == 1 ) - { - pColor = UGraphics::MakeLOColor(fColorCustomColor->GetColor()); - cellData->pColorBackground = &pColor; - } - else if ( curValue == 0 ) - cellData->pColorBackground = NULL; - - XP_FREEIF( cellData->pBackgroundImage ); - cellData->pBackgroundImage = NULL; - - curValue = mUseImage->GetValue(); - if ( !(cellData->mask & CF_BACK_IMAGE ) && curValue != 2 ) - cellData->mask |= CF_BACK_IMAGE; - if ( curValue == 1 ) - cellData->pBackgroundImage = mImageFileName->GetLongDescriptor(); - - curValue = mLeaveImage->GetValue(); - if ( curValue != 2 ) - { - if ( !(cellData->mask & CF_BACK_NOSAVE ) ) - cellData->mask |= CF_BACK_NOSAVE; - cellData->bBackgroundNoSave = curValue; - } - - LView* extrahtmlbutton = (LView *)FindPaneByID( 'Xtra' ); - XP_ASSERT( extrahtmlbutton != NULL ); - if ( !(cellData->mask & CF_EXTRA_HTML ) ) - XP_ASSERT( 1 ); - if ( extrahtmlbutton && extrahtmlbutton->IsEnabled() ) - { - XP_FREEIF( cellData->pExtra ); - cellData->pExtra = pExtra; - } - else - cellData->pExtra = NULL; /* this is probably not the right thing to do but... */ - - EDT_SetTableCellData( fContext, cellData ); - - cellData->pColorBackground = NULL; // don't try to free our local variable. - cellData->pExtra = NULL; // this is our copy; don't let backend delete! - - EDT_FreeTableCellData( cellData ); -} - - -// Initialize from preferences -void CEDTableCellContain::ControlsFromPref() -{ - EDT_TableCellData* cellData = EDT_GetTableCellData( fContext ); - if (cellData == NULL) - return; - -// set popup menus depending if nested in another table or just in window - short resID; - StringHandle titleH; - - if (EDT_IsInsertPointInNestedTable(fContext)) - resID = EDITOR_PERCENT_PARENT_CELL; - else - resID = EDITOR_PERCENT_WINDOW; - - titleH = GetString( resID ); - if (titleH) - { - SInt8 hstate = HGetState( (Handle)titleH ); - HLock( (Handle)titleH ); - HSetState( (Handle)titleH, hstate ); - - MenuHandle menuh = ((LGAPopup *)fWidthPopup)->GetMacMenuH(); - if (menuh) - { - SetMenuItemText( menuh, kPercentOfWindowItem, *titleH ); - ((LGAPopup *)fWidthPopup)->SetMacMenuH( menuh ); // resets menu width - } - - menuh = ((LGAPopup *)fHeightPopup)->GetMacMenuH(); - if (menuh) - { - SetMenuItemText( menuh, kPercentOfWindowItem, *titleH ); - ((LGAPopup *)fHeightPopup)->SetMacMenuH( menuh ); // resets menu width - } - } - -/* col span */ - if ( (cellData->mask & CF_COLSPAN) ) - { - fColSpanEditText->SetValue( cellData->iColSpan ); - fColSpanEditText->Enable(); - } - else - fColSpanEditText->Disable(); - -/* row span */ - if ( (cellData->mask & CF_ROWSPAN) ) - { - fRowSpanEditText->SetValue( cellData->iRowSpan ); - fRowSpanEditText->Enable(); - } - else - fRowSpanEditText->Disable(); - -/* horizontal alignment */ - if ( (cellData->mask & CF_ALIGN) ) - { - switch ( cellData->align ) - { - case ED_ALIGN_DEFAULT: - case ED_ALIGN_LEFT: fHorizontalAlignment->SetValue( 1 ); break; - case ED_ALIGN_ABSCENTER: fHorizontalAlignment->SetValue( 2 ); break; - case ED_ALIGN_RIGHT: fHorizontalAlignment->SetValue( 3 ); break; - } - } - else - fHorizontalAlignment->SetValue( 4 ); - -/* vertical alignment */ - if ( (cellData->mask & CF_VALIGN) ) - { - switch ( cellData->valign ) - { - case ED_ALIGN_ABSTOP: fVerticalAlignment->SetValue( 1 ); break; - case ED_ALIGN_ABSCENTER: fVerticalAlignment->SetValue( 2 ); break; - case ED_ALIGN_BASELINE: fVerticalAlignment->SetValue( 3 ); break; - case ED_ALIGN_ABSBOTTOM: fVerticalAlignment->SetValue( 4 ); break; - } - } - else - fVerticalAlignment->SetValue( 5 ); - -/* text */ - fHeaderStyle->SetValue( (cellData->mask & CF_HEADER) ? cellData->bHeader : 2 ); - fWrapText->SetValue( (cellData->mask & CF_NOWRAP) ? cellData->bNoWrap : 2 ); - - fCustomWidth->SetValue( (cellData->mask & CF_WIDTH) ? cellData->bWidthDefined : 2 ); - if ( cellData->bWidthDefined ) - { - fWidthEditText->SetValue( cellData->iWidth ); - fWidthPopup->SetValue( (cellData->bWidthPercent) ? kPercentOfWindowItem : kPixelsItem ); - } - else - { - fWidthEditText->SetValue(20); // where do we get the default value? - fWidthPopup->SetValue( kPercentOfWindowItem ); - } - - fCustomHeight->SetValue( (cellData->mask & CF_HEIGHT) ? cellData->bHeightDefined : 2 ); - if ( cellData->bHeightDefined ) - { - fHeightEditText->SetValue(cellData->iHeight); - fHeightPopup->SetValue( (cellData->bHeightPercent) ? kPercentOfWindowItem : kPixelsItem ); - } - else - { - fHeightEditText->SetValue(20); // where do we get the default value? - fHeightPopup->SetValue( kPercentOfWindowItem ); - } - - fCustomColor->SetValue( (cellData->mask & CF_BACK_COLOR) ? cellData->pColorBackground != NULL : 2 ); - RGBColor rgb; - if ( cellData->pColorBackground ) - rgb = UGraphics::MakeRGBColor( *cellData->pColorBackground ); - else - rgb = UGraphics::MakeRGBColor( 0xFF, 0xFF, 0xFF ); // something pretty... (or, better yet, get the default color - yeah, right!) - fColorCustomColor->SetColor( rgb ); - fColorCustomColor->Refresh(); // CColorButton::SetColor does not refresh automatically, so we call refresh - - mImageFileName->SetLongDescriptor( cellData->pBackgroundImage ? cellData->pBackgroundImage : "" ); - mUseImage->SetValue( (cellData->mask & CF_BACK_IMAGE) ? cellData->pBackgroundImage != NULL : 2 ); - mLeaveImage->SetValue( (cellData->mask & CF_BACK_NOSAVE) ? cellData->bBackgroundNoSave : 2 ); - - LView* extrahtmlbutton = (LView *)FindPaneByID( 'Xtra' ); - XP_ASSERT( extrahtmlbutton != NULL ); - if ( (cellData->mask & CF_EXTRA_HTML) ) - { - extrahtmlbutton->Enable(); - pExtra = cellData->pExtra; - cellData->pExtra = NULL; // don't let backend free! - } - else - { - /* don't agree; disable for now */ - extrahtmlbutton->Disable(); - pExtra = NULL; - } - - EDT_FreeTableCellData(cellData); - AdjustEnable(); -} - - -Boolean CEDTableCellContain::AllFieldsOK() -{ - if ( fRowSpanEditText->IsEnabled() - && !IsEditFieldWithinLimits( fRowSpanEditText, 1, 100 ) ) - { - SwitchTarget( fRowSpanEditText ); - fRowSpanEditText->SelectAll(); - return FALSE; - } - - if ( fColSpanEditText->IsEnabled() - && !IsEditFieldWithinLimits(fColSpanEditText, 1, 100 ) ) - { - SwitchTarget( fColSpanEditText ); - fColSpanEditText->SelectAll(); - return FALSE; - } - - if ( fCustomWidth->GetValue() == 1 ) - { - int popupValue = fWidthPopup->GetValue(); - if (popupValue == kPercentOfWindowItem && !IsEditFieldWithinLimits(fWidthEditText, 1, 100)) { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return FALSE; - } - - if (popupValue == kPixelsItem && !IsEditFieldWithinLimits(fWidthEditText, 1, 10000)) { - SwitchTarget( fWidthEditText ); - fWidthEditText->SelectAll(); - return FALSE; - } - } - - if ( fCustomHeight->GetValue() == 1 ) - { - int popupValue = fHeightPopup->GetValue(); - if (popupValue == kPercentOfWindowItem && !IsEditFieldWithinLimits(fHeightEditText, 1, 100)) { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return FALSE; - } - - if (popupValue == kPixelsItem && !IsEditFieldWithinLimits(fHeightEditText, 1, 10000)) { - SwitchTarget( fHeightEditText ); - fHeightEditText->SelectAll(); - return FALSE; - } - } - - return TRUE; -} - - -void CEDTableCellContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - switch ( inMessage ) - { - case 'TsPU': /* popup menu item was changed */ - case 'PREV': - case 'NEXT': - /* approprate selection */ - ED_HitType moveType = ED_HIT_SEL_CELL; - LGAPopup * tableSelectionPopup = (LGAPopup*)FindPaneByID( 'TsPU' ); - if ( tableSelectionPopup ) - { - switch ( tableSelectionPopup->GetValue() ) - { - case 1: /* cell */ - moveType = ED_HIT_SEL_CELL; - break; - - case 2: /* row */ - moveType = ED_HIT_SEL_ROW; - break; - - case 3: /* column */ - moveType = ED_HIT_SEL_COL; - break; - } - } - ED_MoveSelType moveDirection; - if (inMessage == 'PREV') - moveDirection = ED_MOVE_PREV; - else if (inMessage == 'NEXT') - moveDirection = ED_MOVE_NEXT; - else if (inMessage == 'TsPU') - moveDirection = ED_MOVE_NONE; - - if ( AllFieldsOK() ) - { - EDT_BeginBatchChanges( fContext ); - PrefsFromControls(); - EDT_EndBatchChanges( fContext); - - EDT_ChangeTableSelection( fContext, moveType, moveDirection, NULL ); - ControlsFromPref(); // fill in new data - } - break; // if fields are not ok, don't change anything - - case 'cwth': - case 'chgt': - case 'cclr': - AdjustEnable(); - break; - - case msg_LinkColorChange: - fCustomColor->SetValue( TRUE ); - break; - - case 'UseI': - if (mUseImage->GetValue() == 1) - { // we are trying to set the image - CStr255 url; - mImageFileName->GetDescriptor(url); - if (url == CStr255::sEmptyString) - { // but it doesn't exist - CEditDialog::ChooseImageFile( mImageFileName ); // so try to get it - mImageFileName->GetDescriptor( url ); - if (url == CStr255::sEmptyString) // but, if we were unsuccessful - mUseImage->SetValue( 0 ); // revert back. - } - } - AdjustEnable(); - break; - - case 'wst1': - { - CEditDialog::ChooseImageFile( mImageFileName ); // try to get it - CStr255 url2; - mImageFileName->GetDescriptor( url2 ); - if (url2 == CStr255::sEmptyString) // if we were unsuccessful - mUseImage->SetValue( 0 ); // don't try to use image - else - mUseImage->SetValue( 1 ); - } - AdjustEnable(); - break; - - case msg_EditField2: - { - CStr255 url3; - mImageFileName->GetDescriptor( url3 ); - mUseImage->SetValue( url3[ 0 ] ? Button_On : Button_Off ); - } - break; - - case 'Xtra': - char * newExtraHTML = NULL; - Boolean canceled = !GetExtraHTML( pExtra, &newExtraHTML ,GetWinCSID() ); - if (!canceled) - { - if ( pExtra ) - XP_FREE( pExtra ); - pExtra = newExtraHTML; - } - break; - } -} - - -/**********************************************************/ -#pragma mark - -#pragma mark Standard Editor Dialogs - -void CEDCharacterContain::FinishCreateSelf() -{ - fTextSizePopup = (LControl*)FindPaneByID( 'txsz' ); - mFontMenu = (LControl*)FindPaneByID( 'Font' ); - mFontChanged = false; - - fColorDefaultRadio = (LControl*)FindPaneByID( 'DocD' ); - fColorCustomRadio = (LControl*)FindPaneByID( 'CstC' ); - fColorCustomColor = (CColorButton*)FindPaneByID( 'ChCr' ); - - fTextBoldCheck = (LControl*)FindPaneByID( 'Bold' ); - fTextItalicCheck = (LControl*)FindPaneByID( 'Ital' ); - fTextSuperscriptCheck = (LControl*)FindPaneByID( 'Supe' ); - fTextSubscriptCheck = (LControl*)FindPaneByID( 'Subs' ); - fTextNoBreaksCheck = (LControl*)FindPaneByID( 'NoBR' ); - fTextUnderlineCheck = (LControl*)FindPaneByID( 'Unln' ); - fTextStrikethroughCheck = (LControl*)FindPaneByID( 'Stri' ); - fTextBlinkingCheck = (LControl*)FindPaneByID( 'Blin' ); - - fClearTextStylesButton = (LControl*)FindPaneByID( 'CTSB' ); - fClearAllStylesButton = (LControl*)FindPaneByID( 'CASB' ); - - LView::FinishCreateSelf(); - UReanimator::LinkListenerToControls( this, this, mPaneID ); - - fTextSizePopup->Show(); -} - -void CEDCharacterContain::PrefsFromControls() -{ - LO_Color pColor; // we pass EDT_SetCharacterData() a pointer to this, so it has to be around for awhile. - - if (EDT_GetCurrentElementType(fContext) != ED_ELEMENT_TEXT - && EDT_GetCurrentElementType(fContext) != ED_ELEMENT_SELECTION) - return; - - EDT_CharacterData* better = EDT_NewCharacterData(); - if (better == NULL) - return; - - better->mask = TF_NONE; - better->values = TF_NONE; - - if (fColorChanged) { - better->mask |= TF_FONT_COLOR; - if (fColorDefaultRadio->GetValue()) { - better->pColor = NULL; - } else { - better->values |= TF_FONT_COLOR; - pColor = UGraphics::MakeLOColor(fColorCustomColor->GetColor()); - better->pColor = &pColor; // I hope that EDT_SetCharacterData() doesn't hang onto this pointer for long... - } - } - - if (fSizeChanged) { - better->mask |= TF_FONT_SIZE; - better->values |= TF_FONT_SIZE; // I'm not supposed to set this if we are using the default font size. But how do I know? An extra menu item?? - better->iSize = fTextSizePopup->GetValue(); - } - - if ( mFontChanged ) - { - better->mask |= TF_FONT_FACE; - if ( better->pFontFace ) - { - XP_FREE( better->pFontFace ); - better->pFontFace = NULL; - } - - int menuitem = mFontMenu->GetValue(); - if ( menuitem == 1 || menuitem == 2 ) // default menu items - { - better->values &= ~TF_FONT_FACE; // I'm supposed to clear TF_FONT_FACE if we are using the default font. - if ( menuitem == 2 ) // if fixed width, do it differently - better->values |= TF_FIXED; - else - better->values &= ~TF_FIXED; // not fixed if we have a font! - } - else - { - better->values |= TF_FONT_FACE; - better->values &= ~TF_FIXED; // not fixed if we have a font! - - Str255 s; - s[ 0 ] = 0; - ((LGAPopup *)mFontMenu)->GetCurrentItemTitle( s ); - p2cstr( s ); - better->pFontFace = XP_STRDUP( (char *)s ); - } - } - - if (fTextBoldCheck->GetValue() == 1) better->values |= TF_BOLD; // what values to set to - if (fTextItalicCheck->GetValue() == 1) better->values |= TF_ITALIC; - if (fTextSuperscriptCheck->GetValue() == 1) better->values |= TF_SUPER; - if (fTextSubscriptCheck->GetValue() == 1) better->values |= TF_SUB; - if (fTextNoBreaksCheck->GetValue() == 1) better->values |= TF_NOBREAK; - if (fTextUnderlineCheck->GetValue() == 1) better->values |= TF_UNDERLINE; - if (fTextStrikethroughCheck->GetValue() == 1) better->values |= TF_STRIKEOUT; - if (fTextBlinkingCheck->GetValue() == 1) better->values |= TF_BLINK; - - if (fTextBoldCheck->GetValue() != 2) better->mask |= TF_BOLD; // if the checkbox is still mixed, don't set anything - if (fTextItalicCheck->GetValue() != 2) better->mask |= TF_ITALIC; - if (fTextSuperscriptCheck->GetValue() != 2) better->mask |= TF_SUPER; - if (fTextSubscriptCheck->GetValue() != 2) better->mask |= TF_SUB; - if (fTextNoBreaksCheck->GetValue() != 2) better->mask |= TF_NOBREAK; - if (fTextUnderlineCheck->GetValue() != 2) better->mask |= TF_UNDERLINE; - if (fTextStrikethroughCheck->GetValue() != 2) better->mask |= TF_STRIKEOUT; - if (fTextBlinkingCheck->GetValue() != 2) better->mask |= TF_BLINK; - - EDT_SetFontFace( fContext, better, -1, better->pFontFace ); -// EDT_SetCharacterData(fContext, better); - better->pColor = NULL; // this is ours. Don't free it. - EDT_FreeCharacterData(better); -} - - -static void SetFontMenuItemByString( LGAPopup *menu, char *font ) -{ - if ( font == NULL ) - { - menu->SetValue( 1 ); - return; - } - - Str255 str; - int i, maxitem; - maxitem = menu->GetMaxValue(); - MenuHandle popupMenu = menu->GetMacMenuH (); - for ( i = 1; i <= maxitem; i++ ) - { - ::GetMenuItemText ( popupMenu, i, str ); - p2cstr(str); - if ( XP_STRSTR( font, (char *)str ) != NULL ) - { - menu->SetValue( i ); - ::SetItemMark( popupMenu, i, '-' ); - break; - } - } -} - - -// Initialize from preferences -void CEDCharacterContain::ControlsFromPref() -{ - if (EDT_GetCurrentElementType(fContext) != ED_ELEMENT_TEXT - && EDT_GetCurrentElementType(fContext) != ED_ELEMENT_SELECTION) return; - - EDT_CharacterData* better = EDT_GetCharacterData( fContext ); - if (better == NULL) return; - - fTextBoldCheck->SetValue(better->values & TF_BOLD ? 1 : 0); - fTextItalicCheck->SetValue(better->values & TF_ITALIC ? 1 : 0); - fTextSuperscriptCheck->SetValue(better->values & TF_SUPER ? 1 : 0); - fTextSubscriptCheck->SetValue(better->values & TF_SUB ? 1 : 0); - fTextNoBreaksCheck->SetValue(better->values & TF_NOBREAK ? 1 : 0); - fTextUnderlineCheck->SetValue(better->values & TF_UNDERLINE ? 1 : 0); - fTextStrikethroughCheck->SetValue(better->values & TF_STRIKEOUT ? 1 : 0); - fTextBlinkingCheck->SetValue(better->values & TF_BLINK ? 1 : 0); - - if (!(better->mask & TF_BOLD)) fTextBoldCheck->SetValue(2); - if (!(better->mask & TF_ITALIC)) fTextItalicCheck->SetValue(2); - if (!(better->mask & TF_SUPER)) fTextSuperscriptCheck->SetValue(2); - if (!(better->mask & TF_SUB)) fTextSubscriptCheck->SetValue(2); - if (!(better->mask & TF_NOBREAK)) fTextNoBreaksCheck->SetValue(2); - if (!(better->mask & TF_UNDERLINE)) fTextUnderlineCheck->SetValue(2); - if (!(better->mask & TF_STRIKEOUT)) fTextStrikethroughCheck->SetValue(2); - if (!(better->mask & TF_BLINK)) fTextBlinkingCheck->SetValue(2); - - if (better->mask & TF_FONT_SIZE) - fTextSizePopup->SetValue(better->iSize); - else - fTextSizePopup->SetValue(EDT_GetFontSize( fContext )); - fSizeChanged = FALSE; - - if ( better->values & TF_FONT_FACE ) - SetFontMenuItemByString( (LGAPopup *)mFontMenu, better->pFontFace ); - else if ( better->values & TF_FIXED ) - mFontMenu->SetValue( 2 ); - else - mFontMenu->SetValue( 1 ); - - mFontChanged = false; - - LO_Color pColor = {0, 0, 0}; - - if (better->mask & TF_FONT_COLOR) { // consistant - if (better->pColor) { - pColor = *better->pColor; - TurnOn( fColorCustomRadio ); - } else { - TurnOn( fColorDefaultRadio ); - EDT_PageData *pagedata = EDT_GetPageData( fContext ); - if (pagedata && pagedata->pColorText) - pColor = *pagedata->pColorText; - EDT_FreePageData( pagedata ); - } - } else { // inconsistant - if (EDT_GetFontColor(fContext, &pColor)) - TurnOn( fColorCustomRadio ); - else { - TurnOn( fColorDefaultRadio ); - // get default color - EDT_PageData *pagedata = EDT_GetPageData( fContext ); - pColor = *pagedata->pColorText; - EDT_FreePageData( pagedata ); - } - } - - fColorCustomColor->SetColor(UGraphics::MakeRGBColor(pColor)); - fColorChanged = FALSE; - - EDT_FreeCharacterData(better); -} - - -void CEDCharacterContain::Help() -{ - ShowHelp( HELP_PROPS_CHARACTER ); -} - - -void CEDCharacterContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - //Intercept messages we should act on.... - switch (inMessage) - { - case msg_Font_Face_Changed: - mFontChanged = true; - break; - - case 'Supe': - if (fTextSuperscriptCheck->GetValue()) - fTextSubscriptCheck->SetValue(0); - break; - - case 'Subs': - if (fTextSubscriptCheck->GetValue()) - fTextSuperscriptCheck->SetValue(0); - break; - - case msg_Clear_Text_Styles: - fTextBoldCheck->SetValue(0); - fTextItalicCheck->SetValue(0); - fTextSuperscriptCheck->SetValue(0); - fTextSubscriptCheck->SetValue(0); - fTextNoBreaksCheck->SetValue(0); - fTextUnderlineCheck->SetValue(0); - fTextStrikethroughCheck->SetValue(0); - fTextBlinkingCheck->SetValue(0); - break; - - case msg_Clear_All_Styles: - fTextBoldCheck->SetValue(0); - fTextItalicCheck->SetValue(0); - fTextSuperscriptCheck->SetValue(0); - fTextSubscriptCheck->SetValue(0); - fTextNoBreaksCheck->SetValue(0); - fTextUnderlineCheck->SetValue(0); - fTextStrikethroughCheck->SetValue(0); - fTextBlinkingCheck->SetValue(0); - - if ( fTextSizePopup->GetValue() != 3 ) - { - fSizeChanged = true; - fTextSizePopup->SetValue(3); - } - - TurnOn( fColorDefaultRadio ); - fColorChanged = TRUE; - - if ( mFontMenu->GetValue() != 1 ) - mFontChanged = true; - mFontMenu->SetValue( 1 ); - break; - - case msg_LinkColorChange: - fColorChanged = TRUE; - TurnOn( fColorCustomRadio ); - break; - - case msg_Default_Color_Radio: - fColorChanged = TRUE; - break; - - case msg_Custom_Color_Radio: - fColorChanged = TRUE; - break; - - case msg_Font_Size_Changed: - fSizeChanged = TRUE; - break; - } - - // Pass all messages on... -} - -/**********************************************************/ -// There is no other good place for these. These correspond to menu item numbers which are -// in a resource (not a rez file) - -#define ED_NO_CONTAINER 1 -#define ED_LIST_ITEM 2 -#define ED_BLOCKQUOTE 3 - -void CEDParagraphContain::FinishCreateSelf() -{ - fParagraphStylePopup = (LControl*)FindPaneByID( 'pspu' ); - fContainerStylePopup = (LControl*)FindPaneByID( 'cspu' ); - - fListStylePopup = (LControl*)FindPaneByID( 'lspu' ); - fNumberPopup = (LControl*)FindPaneByID( 'nobp' ); - fBulletPopup = (LControl*)FindPaneByID( 'bulp' ); - fStartNumberCaption = (LControl*)FindPaneByID( 'junk' ); - fStartNumberEditText = (LGAEditField*)FindPaneByID( 'snet' ); - - fLeftAlignRadio = (LControl*)FindPaneByID( 'Left' ); - fCenterAlignRadio = (LControl*)FindPaneByID( 'Cent' ); - fRightAlignRadio = (LControl*)FindPaneByID( 'Righ' ); - - LView::FinishCreateSelf(); - UReanimator::LinkListenerToControls( this, this, mPaneID ); - - fParagraphStylePopup->Show(); - fContainerStylePopup->Show(); - fListStylePopup->Show(); - fLeftAlignRadio->Show(); - fCenterAlignRadio->Show(); - fRightAlignRadio->Show(); -} - - -void CEDParagraphContain::PrefsFromControls() -{ -// This only differs from the Windows FE code in two ways: -// 1) EDT_MorphContainer is called BEFORE the EDT_Outdent "while" loop instead of AFTER -// 2) if fContainerStylePopup->GetValue() == ED_NO_CONTAINER we NEVER call EDT_SetListData(); the windows code DOES if list != NULL. - - if (fLeftAlignRadio->GetValue()) - EDT_SetParagraphAlign(fContext, ED_ALIGN_LEFT); - else if (fRightAlignRadio->GetValue()) - EDT_SetParagraphAlign(fContext, ED_ALIGN_RIGHT); - else - EDT_SetParagraphAlign(fContext, ED_ALIGN_CENTER); - - switch (fParagraphStylePopup->GetValue()) { - case 1: EDT_MorphContainer( fContext, P_PARAGRAPH); break; - case 2: EDT_MorphContainer( fContext, P_HEADER_1); break; - case 3: EDT_MorphContainer( fContext, P_HEADER_2); break; - case 4: EDT_MorphContainer( fContext, P_HEADER_3); break; - case 5: EDT_MorphContainer( fContext, P_HEADER_4); break; - case 6: EDT_MorphContainer( fContext, P_HEADER_5); break; - case 7: EDT_MorphContainer( fContext, P_HEADER_6); break; - case 8: EDT_MorphContainer( fContext, P_ADDRESS); break; - case 9: EDT_MorphContainer( fContext, P_PREFORMAT); break; - case 10: EDT_MorphContainer( fContext, P_LIST_ITEM); break; - case 11: EDT_MorphContainer( fContext, P_DESC_TITLE); break; - case 12: EDT_MorphContainer( fContext, P_DESC_TEXT); break; - } - - if (fContainerStylePopup->GetValue() == ED_NO_CONTAINER) - { - EDT_ListData * pListData = EDT_GetListData(fContext); // remove - while (pListData) { - EDT_FreeListData(pListData); - EDT_Outdent(fContext); - pListData = EDT_GetListData(fContext); - } - } - else - { - EDT_ListData *list = EDT_GetListData( fContext ); - if (list == NULL) - { // do we need to create a container? - EDT_Indent( fContext ); - list = EDT_GetListData( fContext ); - if (list == NULL) - return; // assert? - } - - list->eType = ED_LIST_TYPE_DEFAULT; // defaults - list->iStart = 1; - - if (fContainerStylePopup->GetValue() == ED_BLOCKQUOTE) - - list->iTagType = P_BLOCKQUOTE; - - else - { - switch (fListStylePopup->GetValue()) { - case 1: list->iTagType = P_UNUM_LIST; break; - case 2: list->iTagType = P_NUM_LIST; break; -// case 3: list->iTagType = P_DIRECTORY; break; -// case 4: list->iTagType = P_MENU; break; - case 5: list->iTagType = P_DESC_LIST; break; - } - - if (list->iTagType == P_UNUM_LIST) { - - switch (fBulletPopup->GetValue()) { - case 1: list->eType = ED_LIST_TYPE_DEFAULT; break; - case 2: list->eType = ED_LIST_TYPE_DISC; break; - case 3: list->eType = ED_LIST_TYPE_CIRCLE; break; - case 4: list->eType = ED_LIST_TYPE_SQUARE; break; - } - - } else if (list->iTagType == P_NUM_LIST) { - - switch (fNumberPopup->GetValue()) { - case 1: list->eType = ED_LIST_TYPE_DEFAULT; break; - case 2: list->eType = ED_LIST_TYPE_DIGIT; break; - case 3: list->eType = ED_LIST_TYPE_BIG_ROMAN; break; - case 4: list->eType = ED_LIST_TYPE_SMALL_ROMAN; break; - case 5: list->eType = ED_LIST_TYPE_BIG_LETTERS; break; - case 6: list->eType = ED_LIST_TYPE_SMALL_LETTERS; break; - } - - list->iStart = fStartNumberEditText->GetValue(); - } - } - - EDT_SetListData(fContext, list); - EDT_FreeListData(list); - } -} - - -// Initialize from preferences -void CEDParagraphContain::ControlsFromPref() -{ - switch (EDT_GetParagraphAlign(fContext)) { - case ED_ALIGN_LEFT: TurnOn(fLeftAlignRadio); break; - case ED_ALIGN_RIGHT: TurnOn(fRightAlignRadio); break; - default: TurnOn(fCenterAlignRadio); break; - } - - fParagraphStylePopup->SetValue(1); - switch (EDT_GetParagraphFormatting(fContext)) { - case P_HEADER_1: fParagraphStylePopup->SetValue(2); break; - case P_HEADER_2: fParagraphStylePopup->SetValue(3); break; - case P_HEADER_3: fParagraphStylePopup->SetValue(4); break; - case P_HEADER_4: fParagraphStylePopup->SetValue(5); break; - case P_HEADER_5: fParagraphStylePopup->SetValue(6); break; - case P_HEADER_6: fParagraphStylePopup->SetValue(7); break; - case P_ADDRESS: fParagraphStylePopup->SetValue(8); break; - case P_PREFORMAT: fParagraphStylePopup->SetValue(9); break; - case P_LIST_ITEM: fParagraphStylePopup->SetValue(10); break; - case P_DESC_TITLE: fParagraphStylePopup->SetValue(11); break; - case P_DESC_TEXT: fParagraphStylePopup->SetValue(12); break; - } - - EDT_ListData *list = EDT_GetListData( fContext ); - - fContainerStylePopup->SetValue(ED_NO_CONTAINER); - if (list) { - if (list->iTagType == P_BLOCKQUOTE) - fContainerStylePopup->SetValue(ED_BLOCKQUOTE); - else - fContainerStylePopup->SetValue(ED_LIST_ITEM); // list item - } - - fListStylePopup->SetValue(1); // set up default values - fBulletPopup->SetValue(1); - fNumberPopup->SetValue(1); - fStartNumberEditText->SetValue(1); - - if (fContainerStylePopup->GetValue() == ED_LIST_ITEM) { // list item - - switch (list->iTagType) { - case P_UNUM_LIST: fListStylePopup->SetValue(1); break; - case P_NUM_LIST: fListStylePopup->SetValue(2); break; -// case P_DIRECTORY: fListStylePopup->SetValue(3); break; -// case P_MENU: fListStylePopup->SetValue(4); break; - case P_DESC_LIST: fListStylePopup->SetValue(5); break; - default: fListStylePopup->SetValue(1); break; // assert? - } - - if (list->iTagType == P_UNUM_LIST) { - - switch (list->eType) { - case ED_LIST_TYPE_DEFAULT: fBulletPopup->SetValue(1); break; - case ED_LIST_TYPE_DISC: fBulletPopup->SetValue(2); break; - case ED_LIST_TYPE_CIRCLE: fBulletPopup->SetValue(3); break; - case ED_LIST_TYPE_SQUARE: fBulletPopup->SetValue(4); break; - default: fBulletPopup->SetValue(1); break; // assert? - } - } - - if (list->iTagType == P_NUM_LIST) { - - switch (list->eType) { - case ED_LIST_TYPE_DEFAULT: fNumberPopup->SetValue(1); break; - case ED_LIST_TYPE_DIGIT: fNumberPopup->SetValue(2); break; - case ED_LIST_TYPE_BIG_ROMAN: fNumberPopup->SetValue(3); break; - case ED_LIST_TYPE_SMALL_ROMAN: fNumberPopup->SetValue(4); break; - case ED_LIST_TYPE_BIG_LETTERS: fNumberPopup->SetValue(5); break; - case ED_LIST_TYPE_SMALL_LETTERS: fNumberPopup->SetValue(6); break; - default: fNumberPopup->SetValue(1); break; // assert? - } - - fStartNumberEditText->SetValue(list->iStart); - } - } - - if (list) EDT_FreeListData(list); - - AdjustPopupsVisibility(); -} - - -void CEDParagraphContain::AdjustPopupsVisibility() -{ - if (fContainerStylePopup->GetValue() != ED_LIST_ITEM) { // list item - - fListStylePopup->Disable(); - fStartNumberCaption->Hide(); - fStartNumberEditText->Hide(); - - switch (fListStylePopup->GetValue()) { - case 1: // Unumbered List - fNumberPopup->Hide(); - fBulletPopup->Disable(); - fBulletPopup->Show(); - break; - - case 2: // Numbered List - fNumberPopup->Disable(); - fNumberPopup->Show(); - fBulletPopup->Hide(); - break; - - default: - fNumberPopup->Hide(); - fBulletPopup->Hide(); - break; - } - - } else { - - fListStylePopup->Enable(); - - switch (fListStylePopup->GetValue()) { - case 1: // Unnumbered List - fNumberPopup->Hide(); - fBulletPopup->Enable(); - fBulletPopup->Show(); - fStartNumberCaption->Hide(); - fStartNumberEditText->Hide(); - break; - - case 2: // Numbered List - fNumberPopup->Enable(); - fNumberPopup->Show(); - fBulletPopup->Hide(); - fStartNumberCaption->Show(); - fStartNumberEditText->Show(); - break; - - default: - fNumberPopup->Hide(); - fBulletPopup->Hide(); - fStartNumberCaption->Hide(); - fStartNumberEditText->Hide(); - break; - - } - } -} - - -void CEDParagraphContain::Help() -{ - ShowHelp( HELP_PROPS_PARAGRAPH ); -} - - -Boolean CEDParagraphContain::AllFieldsOK() -{ - if ( fStartNumberEditText->IsVisible() && fStartNumberEditText->IsEnabled() - && !IsEditFieldWithinLimits( fStartNumberEditText, 1, 2000000000 ) ) - { - SwitchTarget( fStartNumberEditText ); - fStartNumberEditText->SelectAll(); - return FALSE; - } - - return true; -} - - -void CEDParagraphContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - //Intercept messages we should act on.... - - switch (inMessage) { - case msg_Paragraph_Style_Popup: - if (fParagraphStylePopup->GetValue() == 10) // "List item" menu item - fContainerStylePopup->SetValue(ED_LIST_ITEM); // "List" menu item (doesn't seem to be necessary) - else if (fContainerStylePopup->GetValue() == ED_LIST_ITEM) - fContainerStylePopup->SetValue(ED_NO_CONTAINER); // (IS necessary) - AdjustPopupsVisibility(); - break; - - case msg_Paragraph_Addtnl_Style_Popup: - if (fContainerStylePopup->GetValue() == ED_LIST_ITEM) // "List" menu item - fParagraphStylePopup->SetValue(10); // "List item" menu item -// else if (fParagraphStylePopup->GetValue() == 10) -// fParagraphStylePopup->SetValue(1); // windows FE doesn't do this. Do we know what we're doing? - AdjustPopupsVisibility(); - break; - - case msg_List_Style_Popup: - AdjustPopupsVisibility(); - break; - } - - // Pass all messages on... -} - - -/**********************************************************/ -void CEDLinkContain::FinishCreateSelf() -{ - fLinkedTextEdit = (CLargeEditField *)FindPaneByID( 'LTte' ); - - fChooseFileLinkButton = (LControl*)FindPaneByID( 'CFLb' ); - fRemoveLinkButton = (LControl*)FindPaneByID( 'RLbt' ); - fLinkPageTextEdit = (CLargeEditField *)FindPaneByID( 'LPte' ); - - fCurrentDocumentRadio = (LControl*)FindPaneByID( 'CDro' ); - fSelectedFileRadio = (LControl*)FindPaneByID( 'SFro' ); - fTargetList = (OneRowLListBox*)FindPaneByID( 'TAli' ); - - LView::FinishCreateSelf(); - UReanimator::LinkListenerToControls( this, this, mPaneID ); - - fTargs = NULL; -} - - -void CEDLinkContain::PrefsFromControls() -{ - if (fInsert && LO_GetSelectionText(fContext) == NULL) - { - char *link = fLinkPageTextEdit->GetLongDescriptor(); - - if (link && XP_STRLEN(link)) - { - char *anchor = fLinkedTextEdit->GetLongDescriptor(); - if ( anchor && XP_STRLEN(anchor) ) - { - if ( EDT_PasteHREF( fContext, &link, &anchor, 1 ) != EDT_COP_OK ) - ErrorManager::PlainAlert( CUT_ACROSS_CELLS ); - } - else if ( EDT_PasteHREF( fContext, &link, &link, 1 ) != EDT_COP_OK ) - { - // use the link as the anchor if there is no anchor - ErrorManager::PlainAlert( CUT_ACROSS_CELLS ); - } - - XP_FREEIF( anchor); - } - - XP_FREEIF( link ); - } - else // if ( EDT_CanSetHREF( fContext ) ) // should always be true - { - EDT_HREFData *linkdata = EDT_GetHREFData( fContext ); - if ( linkdata ) - { - if ( linkdata->pURL ) - { - XP_FREE( linkdata->pURL ); - linkdata->pURL = NULL; - } - linkdata->pURL = fLinkPageTextEdit->GetLongDescriptor(); - - if ( linkdata->pExtra ) - { - XP_FREE( linkdata->pExtra ); - linkdata->pExtra = NULL; - } - - if ( pExtra ) - linkdata->pExtra = XP_STRDUP( pExtra ); - - EDT_SetHREFData( fContext, linkdata ); - EDT_FreeHREFData( linkdata ); - } - } -} - - -void CEDLinkContain::Show() -{ - if ( *fLinkName ) - fLinkedTextEdit->SetDescriptor( CStr255(*fLinkName) ); - - CEditContain::Show(); -} - - -void CEDLinkContain::Hide() -{ - if ( fLinkName ) - { - XP_FREEIF( *fLinkName ); - *fLinkName = fLinkedTextEdit->GetLongDescriptor(); - } - CEditContain::Hide(); -} - -#define msg_ClickOnTarget 23000 -#define msg_DblClickOnTarget 23001 -#define msg_ClickOnTarget2 23002 /* really should put these in resgui.h or similar */ -#define msg_DblClickOnTarget2 23003 - -// Initialize from preferences -void CEDLinkContain::ControlsFromPref() -{ - SetTextTraitsIDByCsid(fLinkedTextEdit, GetWinCSID()); - if ( *fLinkName ) - { // image pane has already been here - fLinkedTextEdit->SetDescriptor( CStr255(*fLinkName) ); - fLinkedTextEdit->Disable(); - SwitchTarget( fLinkPageTextEdit ); - fLinkPageTextEdit->SelectAll(); - } - else - { - char *selection = (char*)LO_GetSelectionText( fContext ); - if ( selection ) - fLinkedTextEdit->SetDescriptor( CtoPstr(selection) ); - - if ( fInsert && selection == NULL ) - { - fLinkedTextEdit->Enable(); - SwitchTarget( fLinkedTextEdit ); - fLinkedTextEdit->SelectAll(); - } - else - { - fLinkedTextEdit->Disable(); - SwitchTarget( fLinkPageTextEdit ); - fLinkPageTextEdit->SelectAll(); - } - - XP_FREEIF( selection ); - } - - EDT_HREFData *linkdata = EDT_GetHREFData( fContext ); - if ( linkdata ) - { - if ( linkdata->pURL ) - fLinkPageTextEdit->SetDescriptor( CtoPstr(linkdata->pURL) ); - pExtra = linkdata->pExtra; // let's not realloc - linkdata->pExtra = NULL; // don't dispose of this! - - EDT_FreeHREFData( linkdata ); - } - - TurnOn( fCurrentDocumentRadio ); - CurrentFileTargs(); - - fTargetList->FocusDraw(); - fTargetList->SetDoubleClickMessage( msg_DblClickOnTarget ); - fTargetList->SetSingleClickMessage( msg_ClickOnTarget ); - fTargetList->AddListener( this ); - fTargetList->SetValue(-1); -} - - -CEDLinkContain::~CEDLinkContain() -{ - if ( fTargs ) - XP_FREE( fTargs ); - if ( pExtra ) - XP_FREE( pExtra ); - pExtra = NULL; -} - - -void CEDLinkContain::Help() -{ - ShowHelp( HELP_PROPS_LINK ); -} - - -void CEDLinkContain::SelectedFileUpdate() -{ - // clear list - while ( fTargetList->GetRows() ) - fTargetList->RemoveRow(0); - - if ( fTargs ) - XP_FREE(fTargs); - fTargs = NULL; - - // get file to retrieve targets from - char *link = fLinkPageTextEdit->GetLongDescriptor(); - if ( link == NULL ) - return; - - // I assume a pound would only confuse things; remove it if present - char *pound = XP_STRCHR(link, '#'); - if ( pound ) - *pound = '\0'; - - // need to pass an xpURL format "link" below ***FIX***THIS*** - fTargs = EDT_GetAllDocumentTargetsInFile( fContext, link ); - XP_FREE( link ); - char *parse = fTargs; - - int16 rowNum = fTargetList->GetRows(); // add to the bottom? - - while ( parse && *parse ) - { - fTargetList->AddRow( rowNum++, parse, XP_STRLEN(parse) ); - parse += XP_STRLEN(parse) + 1; - } -} - - -void CEDLinkContain::CurrentFileTargs() -{ - while (fTargetList->GetRows()) - fTargetList->RemoveRow(0); - - if ( fTargs ) - XP_FREE( fTargs ); - - fTargs = EDT_GetAllDocumentTargets(fContext); - char *parse = fTargs; - - int16 rowNum = fTargetList->GetRows(); // add to the bottom? - - while (parse && *parse) - { - fTargetList->AddRow( rowNum++, parse, XP_STRLEN(parse)); - parse += XP_STRLEN(parse) + 1; - } -} - - -void CEDLinkContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - //Intercept messages we should act on.... - - switch (inMessage) - { - case 'CDro': // targets from current document radio button - if ( fCurrentDocumentRadio->GetValue() ) - CurrentFileTargs(); - break; - - case 'SFro': // targets from selected file radio button - if ( fSelectedFileRadio->GetValue() ) - SelectedFileUpdate(); - break; - - case msg_Link_Clear_Link: - fLinkPageTextEdit->SetDescriptor("\p"); - break; - - case msg_Link_Browse_File: - { - StPrepareForDialog preparer; - StandardFileReply reply; - Point loc = { -1, -1 }; - OSType types[ 4 ]; - - types[ 0 ] = 'GIFf'; - types[ 1 ] = 'TEXT'; - types[ 2 ] = 'JPEG'; - - ::StandardGetFile( NULL, 3, types, &reply ); - - if ( reply.sfGood ) - { - char *fileLink = CFileMgr::GetURLFromFileSpec( reply.sfFile ); - if ( fileLink ) - { - if (CPrefs::GetBoolean( CPrefs::PublishMaintainLinks )) - { - char *abs = NULL; // let's try making it relative - if (NET_MakeRelativeURL( LO_GetBaseURL( fContext ), fileLink, &abs) != NET_URL_FAIL && abs) - { - XP_FREE( fileLink ); - fileLink = abs; - abs = NULL; - } - - XP_FREEIF( abs ); - } - - fLinkPageTextEdit->SetLongDescriptor( fileLink ); - XP_FREE( fileLink ); - - if ( fSelectedFileRadio->GetValue() ) - SelectedFileUpdate(); - } - } - } - break; - - case msg_DblClickOnTarget: - case msg_ClickOnTarget: - int16 index = fTargetList->GetValue(); - - // first take care of the case where the user tries to "deselect" the item in the list.. - if (index == -1) - { - char *file = fLinkPageTextEdit->GetLongDescriptor(); // we are going to save the url if it exists - if ( file ) - { - char *pound = XP_STRCHR( file, '#' ); - if ( pound ) - { - *pound = '\0'; - fLinkPageTextEdit->SetLongDescriptor( file ); - } - - XP_FREE( file ); - } - break; - } - - char *parse = fTargs; - while ( parse && *parse && index-- ) - parse += XP_STRLEN(parse) + 1; - - if ( parse && *parse ) - { // why is it that I have no other way to do this? - CStr255 temp = ""; - - if (fSelectedFileRadio->GetValue()) - { - char *file2 = fLinkPageTextEdit->GetLongDescriptor(); // we are going to save the url if it exists - if ( file2 ) - { - char *pound = XP_STRCHR(file2, '#'); - if ( pound ) - *pound = '\0'; - - temp = file2; - XP_FREE( file2 ); - } - } - - temp += '#'; - temp += parse; - fLinkPageTextEdit->SetDescriptor(temp); - - } - - if ( inMessage == msg_DblClickOnTarget ) - ListenToMessage( msg_OK, NULL ); - break; - - case 'Xtra': - char * newExtraHTML = NULL; - Boolean canceled = !GetExtraHTML( pExtra, &newExtraHTML, GetWinCSID() ); - if (!canceled) - { - XP_FREEIF( pExtra ); - pExtra = newExtraHTML; - } - break; - } - - // Pass all messages on... -} - - -#ifdef COOL_IMAGE_RADIO_BUTTONS -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ SetValue -// --------------------------------------------------------------------------- -// Turn a ToggleButton on or off - -void -CImageAlignButton::SetValue( Int32 inValue ) -{ - if (inValue != mValue) - { - LControl::SetValue(inValue); - Refresh(); - } - - // If turning RadioButton on, broadcast message so that the RadioGroup - // (if present) will turn off the other RadioButtons in the group. - if (inValue == Button_On) - BroadcastMessage( msg_ControlClicked, (void*) this ); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ HotSpotAction -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CImageAlignButton::HotSpotAction(short /* inHotSpot */, Boolean inCurrInside, Boolean inPrevInside) -{ - if ( GetValue() == 0 ) - { - if ( inCurrInside != inPrevInside ) - { - SetTrackInside( inCurrInside ); - Draw( NULL ); - SetTrackInside( false ); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ HotSpotResult -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CImageAlignButton::HotSpotResult(Int16 inHotSpot) -{ - SetValue(1); - - // Although value doesn't change, send message to inform Listeners - // that button was clicked -// BroadcastValueMessage(); -} -#endif - - -/**********************************************************/ -CEDImageContain::CEDImageContain( LStream* inStream ) : CEditContain( inStream ) -{ - fSrcStr = NULL; - fLowSrcStr = NULL; - fLooseImageMap = FALSE; - mBorderUnspecified = false; -} - -CEDImageContain::~CEDImageContain() -{ - XP_FREEIF( fSrcStr ); - XP_FREEIF( fLowSrcStr ); - XP_FREEIF( pExtra ); - pExtra = NULL; -} - -void CEDImageContain::FinishCreateSelf() -{ - fImageFileName = (CLargeEditField *)FindPaneByID( 'WST1' ); - fImageFileName->AddListener(this); - - fImageAltTextEdit = (CLargeEditField *)FindPaneByID( 'WST5' ); - fImageAltTextEdit->AddListener(this); - - fHeightTextEdit = (LGAEditField*)FindPaneByID( 'WSTd' ); - fHeightTextEdit->AddListener( this ); - fWidthTextEdit = (LGAEditField*)FindPaneByID( 'WSTf' ); - fWidthTextEdit->AddListener( this ); - fImageLockedCheckBox = (LControl *)FindPaneByID( 'Lock' ); // constrain - - fLeftRightBorderTextEdit = (LGAEditField*)FindPaneByID( 'WSTh' ); - fTopBottomBorderTextEdit = (LGAEditField*)FindPaneByID( 'WSTi' ); - fSolidBorderTextEdit = (LGAEditField*)FindPaneByID( 'WSTj' ); - fSolidBorderTextEdit->AddListener( this ); - - fCopyImageCheck = (LControl*)FindPaneByID( 'WSTl' ); - fBackgroundImageCheck = (LControl*)FindPaneByID( 'Bkgd' ); - fRemoveImageMapButton = (LControl*)FindPaneByID( 'WSTm' ); - fEditImageButton = (LControl*)FindPaneByID( 'WSTn' ); - - mImageAlignmentPopup = (LControl*)FindPaneByID( 'ImgA' ); - - LView::FinishCreateSelf(); - UReanimator::LinkListenerToControls( this, this, mPaneID ); -} - - -void CEDImageContain::AdjustEnable() -{ - Boolean allEmpty = false; // assume at least one has text unless proven otherwise - Str255 str; - LGACaption* textCaption = (LGACaption*)FindPaneByID( 'text' ); - fImageFileName->GetDescriptor( str ); - if ( str[0] == 0 ) - { - fCopyImageCheck->Disable(); - fEditImageButton->Disable(); - fBackgroundImageCheck->Disable(); - -// SetOkButtonState (false); - textCaption->Deactivate(); - fImageAltTextEdit->Disable(); - - allEmpty = true; - } - else - { - fCopyImageCheck->Enable(); - fEditImageButton->Enable(); - fBackgroundImageCheck->Enable(); - -// SetOkButtonState (true); - textCaption->Activate(); - fImageAltTextEdit->Enable(); - } - - LView* dimensions = (LView *)FindPaneByID( 'C003' ); - LView* spacearound = (LView *)FindPaneByID( 'C004' ); - LGACaption* aligncaption = (LGACaption *)FindPaneByID( 'Cptn' ); // alignment caption - LView* extrahtmlbutton = (LView *)FindPaneByID( 'Xtra' ); - if ( allEmpty || fBackgroundImageCheck->GetValue() ) - { - dimensions->Deactivate(); // LGACaptions - use Deactivate(), not Disable() - spacearound->Deactivate(); - extrahtmlbutton->Disable(); - - mImageAlignmentPopup->Disable(); - if ( aligncaption ) - aligncaption->Deactivate(); - } - else - { - dimensions->Activate(); - spacearound->Activate(); - extrahtmlbutton->Enable(); - - mImageAlignmentPopup->Enable(); - if ( aligncaption ) - aligncaption->Activate(); - - // can't constrain if it's original size or if either/both are "% of window" - Boolean doEnable = false; - LControl *control = (LControl *)FindPaneByID( 'Orig' ); - if ( control && ( control->GetValue() == 0 ) ) - { - LGAPopup *widthPopup = (LGAPopup *)FindPaneByID( 'WdPU' ); - LGAPopup *heightPopup = (LGAPopup *)FindPaneByID( 'HtPU' ); - doEnable = ( widthPopup->GetValue() != kPercentOfWindowItem ) - && ( heightPopup->GetValue() != kPercentOfWindowItem ); - } - - if ( doEnable ) - fImageLockedCheckBox->Enable(); - else - fImageLockedCheckBox->Disable(); - } -} - - -EDT_ImageData *CEDImageContain::ImageDataFromControls() -{ - EDT_ImageData *image; - - if (fInsert) - image = EDT_NewImageData(); - else - { - if ( EDT_GetCurrentElementType(fContext) != ED_ELEMENT_IMAGE ) - return NULL; - image = EDT_GetImageData( fContext ); - } - - if (image == NULL) - return NULL; - - // what about ED_ALIGN_BOTTOM & ED_ALIGN_ABSTOP - image->align = ED_ALIGN_DEFAULT; - switch (mImageAlignmentPopup->GetValue()) - { - case 1: image->align = ED_ALIGN_TOP; break; - case 2: image->align = ED_ALIGN_ABSCENTER; break; - case 3: image->align = ED_ALIGN_CENTER; break; - case 4: image->align = ED_ALIGN_BASELINE; break; - case 5: image->align = ED_ALIGN_ABSBOTTOM; break; - case 6: image->align = ED_ALIGN_LEFT; break; - case 7: image->align = ED_ALIGN_RIGHT; break; - } - - image->bNoSave = fCopyImageCheck->GetValue(); - - XP_FREEIF( image->pSrc ); - image->pSrc = fImageFileName->GetLongDescriptor(); - - XP_FREEIF( image->pAlt ); - image->pAlt = fImageAltTextEdit->GetLongDescriptor(); - - XP_FREEIF( image->pExtra ); - image->pExtra = ( pExtra ) ? XP_STRDUP( pExtra ) : NULL; - - // we need a valid URL for this image (for instance, something that starts with 'file://' - -/* char *absURL; - - if (image->pSrc && (absURL = NET_MakeAbsoluteURL( LO_GetBaseURL( fContext ), image->pSrc ))) { - XP_FREE(image->pSrc); - image->pSrc = absURL; - } - - if (image->pLowSrc && (absURL = NET_MakeAbsoluteURL( LO_GetBaseURL( fContext ), image->pLowSrc ))) { - XP_FREE(image->pLowSrc); - image->pLowSrc = absURL; - } - - FSSpec file; - char *path; - - file = fImageFileName->GetFSSpec(); - if (file.vRefNum != 0 || file.parID != 0 || file.name[0] != 0) { - char *path = CFileMgr::GetURLFromFileSpec(file); - if (path) { - if (fSrcStr == NULL || strcmp(path, fSrcStr)) { - if (image->pSrc) XP_FREE(image->pSrc); - image->pSrc = path; - } else XP_FREE(path); - } - } - - file = fImageAltFileName->GetFSSpec(); - if (file.vRefNum != 0 || file.parID != 0 || file.name[0] != 0) { - char *path = CFileMgr::GetURLFromFileSpec(file); - if (path) { - if (fLowSrcStr == NULL || strcmp(path, fLowSrcStr)) { - if (image->pLowSrc) XP_FREE(image->pLowSrc); - image->pLowSrc = path; - } else XP_FREE(path); - } - } -*/ - LControl *useCustomSize = (LControl*)FindPaneByID( 'Cust' ); - if ( useCustomSize->GetValue() ) - { - LGAPopup *popup = (LGAPopup *)FindPaneByID( 'HtPU' ); - image->bHeightPercent = (popup ? popup->GetValue() == kPercentOfWindowItem : false); - image->iHeight = fHeightTextEdit->GetValue(); - - popup = (LGAPopup *)FindPaneByID( 'WdPU' ); - image->bWidthPercent = (popup ? popup->GetValue() == kPercentOfWindowItem : false); - image->iWidth = fWidthTextEdit->GetValue(); - } - else - { - image->iWidth = 0; - image->iHeight = 0; - image->bWidthPercent = false; - image->bHeightPercent = false; - } - - image->iHSpace = fLeftRightBorderTextEdit->GetValue(); - image->iVSpace = fTopBottomBorderTextEdit->GetValue(); - if ( mBorderUnspecified ) - image->iBorder = -1; - else - image->iBorder = fSolidBorderTextEdit->GetValue(); - - // Mac "remove image map" button now removes ISMAP instead of USEMAP - // Stupid behavior, but that's what Win and UNIX do. - if ( fLooseImageMap && image->bIsMap ) - { - image->bIsMap = false; - } - - return image; -} - -void CEDImageContain::PrefsFromControls() -{ - // if background image--do it and return - if ( fBackgroundImageCheck->GetValue() ) - { - EDT_PageData *pageData = EDT_GetPageData( fContext ); - if (pageData == NULL) - return; - - if (pageData->pBackgroundImage) - { - XP_FREE( pageData->pBackgroundImage ); - pageData->pBackgroundImage = NULL; - } - - char *url = fImageFileName->GetLongDescriptor(); - if ( url && XP_STRLEN( url ) ) - pageData->pBackgroundImage = url; - else if ( url ) - XP_FREE( url ); - - EDT_SetPageData(fContext, pageData); - EDT_FreePageData(pageData); - - return; - } - - EDT_ImageData *image = ImageDataFromControls(); - if (image) - { - if (fInsert) - EDT_InsertImage( fContext, image, fCopyImageCheck->GetValue() ); - else - EDT_SetImageData( fContext, image, fCopyImageCheck->GetValue() ); - - EDT_FreeImageData(image); - } -} - - -// Initialize from preferences -void CEDImageContain::ControlsFromPref() -{ - SetTextTraitsIDByCsid(fImageAltTextEdit, GetWinCSID()); - fCopyImageCheck->Enable(); - fCopyImageCheck->SetValue( false ); - - fOriginalWidth = 0; - fOriginalHeight = 0; - - fEditImageButton->Disable(); - - Boolean amInsertingNewImage = ( EDT_GetCurrentElementType(fContext) != ED_ELEMENT_IMAGE ); - - EDT_ImageData *image = ( amInsertingNewImage ) ? NULL : EDT_GetImageData( fContext ); - - // set alignment - int value = 4; // default == ED_ALIGN_BASELINE - if ( image ) - { - switch (image->align) - { // what about ED_ALIGN_BOTTOM & ED_ALIGN_ABSTOP - case ED_ALIGN_TOP: value = 1; break; - case ED_ALIGN_ABSCENTER: value = 2; break; - case ED_ALIGN_CENTER: value = 3; break; - case ED_ALIGN_BASELINE: value = 4; break; - case ED_ALIGN_ABSBOTTOM: value = 5; break; - case ED_ALIGN_LEFT: value = 6; break; - case ED_ALIGN_RIGHT: value = 7; break; - default: break; - } - } - mImageAlignmentPopup->SetValue( value ); - - if ( image ) - { - fCopyImageCheck->SetValue( image->bNoSave ); - - if (image->pSrc) - fImageFileName->SetLongDescriptor( image->pSrc ); - - if ( image->pAlt ) - fImageAltTextEdit->SetLongDescriptor( image->pAlt ); - - LControl *customSize = (LControl *)FindPaneByID( 'Cust' ); - - if ( image->iOriginalWidth == 0 ) - { - // we know for sure we have custom if either h or w is % - customSize->SetValue( image->bHeightPercent || image->bWidthPercent ); - fOriginalWidth = image->iWidth; - fOriginalHeight = image->iHeight; - } - else - { - if ( image->iWidth == 0 && image->iHeight == 0 ) - { - image->iHeight = image->iOriginalHeight; - image->iWidth = image->iOriginalWidth; - } - - customSize->SetValue( image->iOriginalWidth != image->iWidth - || image->iOriginalHeight != image->iHeight); - fOriginalWidth = image->iOriginalWidth; /* Width and Height we got on initial loading */ - fOriginalHeight = image->iOriginalHeight; - } - - fHeightTextEdit->SetValue(image->iHeight); - fWidthTextEdit->SetValue(image->iWidth); - - fLeftRightBorderTextEdit->SetValue(image->iHSpace); - fTopBottomBorderTextEdit->SetValue(image->iVSpace); - - // This is weird. If the cross platform code gives us a -1, then we are "default" - // "default" is zero if there is no link or two if there is. - // why doesn't the XP set this up for us? I don't know... - if (image->iBorder == -1) - { - mBorderUnspecified = true; - image->iBorder = EDT_GetDefaultBorderWidth( fContext ); - } - else - mBorderUnspecified = false; - fSolidBorderTextEdit->SetValue( image->iBorder ); - - pExtra = image->pExtra; // let's not realloc - image->pExtra = NULL; // don't dispose of this! - } - - // assume "Original Size" radio button is default - LGAPopup *popup = (LGAPopup *)FindPaneByID( 'HtPU' ); - if ( popup ) - popup->SetValue( image && image->bHeightPercent ? kPercentOfWindowItem : kPixelsItem ); - popup = (LGAPopup *)FindPaneByID( 'WdPU' ); - if ( popup ) - popup->SetValue( image && image->bWidthPercent ? kPercentOfWindowItem : kPixelsItem ); - - // edit image logic - if (image == NULL || (image->pSrc == NULL || XP_STRLEN(image->pSrc) < 1)) - fEditImageButton->Disable(); - else - fEditImageButton->Enable(); - - // image map button - if ( image == NULL ) - fRemoveImageMapButton->Disable(); - else - { - // we already have image in document; don't copy to background - fBackgroundImageCheck->Hide(); - - if ( image->bIsMap ) - fRemoveImageMapButton->Enable(); - else - fRemoveImageMapButton->Disable(); - } - - if ( image ) - EDT_FreeImageData(image); - - // select the editField for the main image file name - SwitchTarget( fImageFileName ); - fImageFileName->SelectAll(); - - AdjustEnable(); -} - -void CEDImageContain::Show() -{ - if (*fLinkName) - fImageFileName->SetLongDescriptor( *fLinkName ); - CEditContain::Show(); -} - -void CEDImageContain::Hide() -{ - if ( *fLinkName ) - XP_FREE( *fLinkName ); - *fLinkName = fImageFileName->GetLongDescriptor(); - -/* FSSpec file; - file = fImageFileName->GetFSSpec(); - if (file.vRefNum != 0 || file.parID != 0 || file.name[0] != 0) { - - *fLinkName = CFileMgr::GetURLFromFileSpec(file); - if (*fLinkName) { - char *temp = FE_URLToLocalName(NET_UnEscape(*fLinkName)); - if (temp) { - XP_FREE(*fLinkName); - *fLinkName = temp; - } - } - } else { - *fLinkName = (char *)XP_ALLOC(sizeof(char)*2); // just fill with some filler so the link pane won't mess with us! - if (*fLinkName) XP_STRCPY(*fLinkName, "-"); - } -*/ - CEditContain::Hide(); -} - -void CEDImageContain::Help() -{ - ShowHelp( HELP_PROPS_IMAGE ); -} - -Boolean CEDImageContain::AllFieldsOK() -{ - Str255 str; - fImageFileName->GetDescriptor( str ); - if ( str[0] == 0 ) - { - SwitchTarget( fImageFileName ); - return false; - } - - // if it's a background image we're done! - if ( fBackgroundImageCheck->GetValue() ) - return true; - - LControl *customSize = (LControl *)FindPaneByID( 'Cust' ); - if ( customSize->GetValue() ) - { - LGAPopup *popup = (LGAPopup *)FindPaneByID( 'HtPU' ); - if ( popup && popup->GetValue() == kPercentOfWindowItem ) - { - if ( !IsEditFieldWithinLimits( fHeightTextEdit, 1, 100 ) ) - { - SwitchTarget( fHeightTextEdit ); - fHeightTextEdit->SelectAll(); - return FALSE; - } - } - else - { - if ( !IsEditFieldWithinLimits( fHeightTextEdit, 1, 10000 ) ) - { - SwitchTarget( fHeightTextEdit ); - fHeightTextEdit->SelectAll(); - return FALSE; - } - } - - popup = (LGAPopup *)FindPaneByID( 'WdPU' ); - if ( popup && popup->GetValue() == kPercentOfWindowItem ) - { - if ( !IsEditFieldWithinLimits( fWidthTextEdit, 1, 100 ) ) - { - SwitchTarget( fWidthTextEdit ); - fWidthTextEdit->SelectAll(); - return FALSE; - } - } - else - { - if ( !IsEditFieldWithinLimits( fWidthTextEdit, 1, 10000 ) ) - { - SwitchTarget( fWidthTextEdit ); - fWidthTextEdit->SelectAll(); - return FALSE; - } - } - } - - if ( !IsEditFieldWithinLimits( fLeftRightBorderTextEdit, 0, 10000 ) ) - { - SwitchTarget( fLeftRightBorderTextEdit ); - fLeftRightBorderTextEdit->SelectAll(); - return FALSE; - } - - if ( !IsEditFieldWithinLimits( fTopBottomBorderTextEdit, 0, 10000 ) ) - { - SwitchTarget( fTopBottomBorderTextEdit ); - fTopBottomBorderTextEdit->SelectAll(); - return FALSE; - } - - if ( !IsEditFieldWithinLimits( fSolidBorderTextEdit, 0, 10000 ) ) - { - SwitchTarget( fSolidBorderTextEdit ); - fSolidBorderTextEdit->SelectAll(); - return FALSE; - } - - return TRUE; -} - - -void CEDImageContain::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch (inMessage) - { - case 'HtPU': - case 'WdPU': - // set radio button to custom size (not original anymore) - LControl *customSize = (LControl *)FindPaneByID( 'Cust' ); - if ( customSize && customSize->GetValue() == 0 ) - customSize->SetValue( true ); - // continue below - - case 'Calc': - AdjustEnable(); - break; - - case 'WSTk': // Original Size Button - LControl *origSizeButton = (LControl *)FindPaneByID( 'Orig' ); - if ( origSizeButton->GetValue() ) - { - fHeightTextEdit->SetValue(fOriginalHeight); // these are not set by the XP yet, apparently. - fWidthTextEdit->SetValue(fOriginalWidth); - } - AdjustEnable(); - break; - - case 'WSTm': // Remove Image Map Button - fLooseImageMap = TRUE; - fRemoveImageMapButton->Disable(); - break; - - case msg_EditField2: - if ( ioParam == NULL ) - return; - - if ( ioParam == fHeightTextEdit || ioParam == fWidthTextEdit ) - { - LControl *customSize = (LControl *)FindPaneByID( 'Cust' ); - if ( customSize && customSize->GetValue() == 0 ) - customSize->SetValue( true ); - - // don't divide by 0! - if ( fOriginalWidth == 0 || fOriginalHeight == 0 ) - return; - - if ( fImageLockedCheckBox->IsEnabled() && fImageLockedCheckBox->GetValue() ) - { - int h, w; - - if ( ioParam == fHeightTextEdit ) - { - h = fHeightTextEdit->GetValue(); - w = h * fOriginalWidth / fOriginalHeight; - fWidthTextEdit->SetValue( w ); - } - else - { - w = fWidthTextEdit->GetValue(); - h = w * fOriginalHeight / fOriginalWidth; - fHeightTextEdit->SetValue( h ); - } - } - } - else - AdjustEnable(); // typing in a different edit field; adjust controls appropriately - break; - - case 'wst1': // "Choose File..." image - CEditDialog::ChooseImageFile(fImageFileName); - AdjustEnable(); - break; - - case 'WSTn': // Edit Image Button - char *imageURL = fImageFileName->GetLongDescriptor(); - if ( imageURL && XP_STRLEN(imageURL) < 1 ) - { - XP_FREE( imageURL ); - imageURL = NULL; - } - - if ( imageURL == NULL ) - break; - - char *absURL = NET_MakeAbsoluteURL( LO_GetBaseURL( fContext ), imageURL ); - XP_FREE(imageURL); - - Boolean isImageLocal = false; - if (absURL && XP_STRSTR(absURL, "file://") == absURL) - { - FSSpec theImage; - - if (CFileMgr::FSSpecFromLocalUnixPath(absURL + XP_STRLEN("file://"), &theImage, FALSE) == noErr) - { // Skip file:// - isImageLocal = true; - - // Get the FSSpec for the editor - FSSpec theApplication; - XP_Bool hasEditor = false; - PREF_GetBoolPref( "editor.use_image_editor", &hasEditor ); - if ( hasEditor ) - theApplication = CPrefs::GetFolderSpec(CPrefs::ImageEditor); - - // Oops, the user has not picked an app in the preferences yet. - if ( !hasEditor || (theApplication.vRefNum == -1 && theApplication.parID == -1 ) ) - { - ErrorManager::PlainAlert( NO_IMG_EDITOR_PREF_SET ); - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandEditor, - PrefPaneID::eEditor_Main, CPrefsDialog::eIgnore); - } - else if ( StartDocInApp(theImage, theApplication) == noErr ) - ; - } - } - - if ( !isImageLocal ) - ErrorManager::PlainAlert( EDITOR_ERROR_EDIT_REMOTE_IMAGE ); - - XP_FREEIF(absURL); - break; - - case 'WSTj': - mBorderUnspecified = false; - break; - - case 'Xtra': - char * newExtraHTML = NULL; - Boolean canceled = !GetExtraHTML( pExtra, &newExtraHTML ,GetWinCSID() ); - if (!canceled) - { - if ( pExtra ) - XP_FREE( pExtra ); - pExtra = newExtraHTML; - } - break; - } -} - -/**********************************************************/ -#pragma mark - -#pragma mark Document Properties - -void CEDDocPropGeneralContain::FinishCreateSelf() -{ - fLocation = (CLargeEditField *)FindPaneByID( 'Loca' ); - fTitle = (CLargeEditField *)FindPaneByID( 'Titl' ); - fAuthor = (CLargeEditField *)FindPaneByID( 'Auth' ); - fDescription = (CLargeEditField *)FindPaneByID( 'Desc' ); - fKeywords = (CLargeEditField *)FindPaneByID( 'Keyw' ); - fClassification = (CLargeEditField *)FindPaneByID( 'Clas' ); - - UReanimator::LinkListenerToControls( this, this, mPaneID ); -} - - -void CEDDocPropGeneralContain::AddMeta(char *Name, CLargeEditField* value) -{ - EDT_MetaData *metaData = EDT_NewMetaData(); // it seems like we could - if (metaData == NULL) - return; - - metaData->bHttpEquiv = FALSE; - metaData->pName = Name; - metaData->pContent = value->GetLongDescriptor(); - - /* if we try to SetMetaData with an empty string for pContent, then "(null)" is used instead; which is ugly. */ - - if ( metaData->pContent == NULL || XP_STRLEN(metaData->pContent) == 0 ) - EDT_DeleteMetaData( fContext, metaData ); // hopefully it won't be a problem if this doesn't exist already. - else - EDT_SetMetaData( fContext, metaData ); - - metaData->pName = NULL; // don't free this, please - - EDT_FreeMetaData( metaData ); -} - - -void CEDDocPropGeneralContain::PrefsFromControls() -{ - EDT_PageData *pageData = EDT_GetPageData(fContext); - if ( pageData ) - { - if ( pageData->pTitle ) - XP_FREE( pageData->pTitle ); - pageData->pTitle = fTitle->GetLongDescriptor(); - - EDT_SetPageData(fContext, pageData); - EDT_FreePageData(pageData); - } - - AddMeta("Author", fAuthor); - AddMeta("Description", fDescription); - AddMeta("KeyWords", fKeywords); - AddMeta("Classification", fClassification); -} - - -// Initialize from preferences -void CEDDocPropGeneralContain::ControlsFromPref() -{ - int16 win_csid = GetWinCSID(); - SetTextTraitsIDByCsid(fTitle, win_csid); - SetTextTraitsIDByCsid(fAuthor, win_csid); - SetTextTraitsIDByCsid(fDescription, win_csid); - SetTextTraitsIDByCsid(fKeywords, win_csid); - SetTextTraitsIDByCsid(fClassification, win_csid); - History_entry * hist_ent = SHIST_GetCurrent( &fContext->hist ); - if ( hist_ent && hist_ent->address ) - fLocation->SetLongDescriptor( hist_ent->address ); - - EDT_PageData *pageData = EDT_GetPageData( fContext ); - if ( pageData ) - { - if ( pageData->pTitle ) - fTitle->SetLongDescriptor( pageData->pTitle ); - EDT_FreePageData( pageData ); - } - - - // Get data from meta tags: - - int count = EDT_MetaDataCount(fContext); - for ( int i = 0; i < count; i++ ) - { - EDT_MetaData* pData = EDT_GetMetaData(fContext, i); - - if ( !pData->bHttpEquiv ) - { - if (strcasecomp(pData->pName, "Author") == 0) - fAuthor->SetLongDescriptor( pData->pContent ); - else if (strcasecomp(pData->pName, "Description") == 0) - fDescription->SetLongDescriptor( pData->pContent ); - else if (strcasecomp(pData->pName, "KeyWords") == 0) - fKeywords->SetLongDescriptor( pData->pContent ); - else if (strcasecomp(pData->pName, "Classification") == 0) - fClassification->SetLongDescriptor( pData->pContent ); - } - - EDT_FreeMetaData( pData ); - } -} - - -void CEDDocPropGeneralContain::Help() -{ - ShowHelp( HELP_DOC_PROPS_GENERAL ); -} - - -static void AddNewColorData( XP_List *pSchemeData, int r1, int g1, int b1, int r2, int g2, int b2, int r3, int g3, int b3, int r4, int g4, int b4, int r5, int g5, int b5 ); -static void AddNewColorData( XP_List *pSchemeData, int r1, int g1, int b1, int r2, int g2, int b2, int r3, int g3, int b3, int r4, int g4, int b4, int r5, int g5, int b5 ) -{ - EDT_ColorSchemeData * pColorData = XP_NEW( EDT_ColorSchemeData ); - if ( !pColorData ) - return; - - memset(pColorData, 0, sizeof(EDT_ColorSchemeData)); - XP_ListAddObjectToEnd( pSchemeData, pColorData ); - - pColorData->ColorText.red = r1; - pColorData->ColorText.green = g1; - pColorData->ColorText.blue = b1; - - pColorData->ColorLink.red = r3; - pColorData->ColorLink.green = g3; - pColorData->ColorLink.blue = b3; - - pColorData->ColorActiveLink.red = r5; - pColorData->ColorActiveLink.green = g5; - pColorData->ColorActiveLink.blue = b5; - - pColorData->ColorFollowedLink.red = r4; - pColorData->ColorFollowedLink.green = g4; - pColorData->ColorFollowedLink.blue = b4; - - pColorData->ColorBackground.red = r2; - pColorData->ColorBackground.green = g2; - pColorData->ColorBackground.blue = b2; -} - - -void AppearanceContain::FinishCreateSelf() -{ - fCustomColor = (LControl*)FindPaneByID( 'Cust' ); - fBrowserColor = (LControl*)FindPaneByID( 'Brow' ); - - fColorScheme = (LControl*)FindPaneByID( 'Sche' ); - - fExampleView = (CChameleonView*)FindPaneByID( 'Exam' ); - fNormalText = (CColorButton*)FindPaneByID( 'Norm' ); - fLinkedText = (CColorButton*)FindPaneByID( 'Link' ); - fActiveLinkedText = (CColorButton*)FindPaneByID( 'Acti' ); - fFollowedLinkedText = (CColorButton*)FindPaneByID( 'Foll' ); - - fExampleNormalText = (CChameleonCaption*)FindPaneByID( 'norm' ); - fExampleLinkedTex = (CChameleonCaption*)FindPaneByID( 'link' ); - fExampleActiveLinkedText = (CChameleonCaption*)FindPaneByID( 'actv' ); - fExampleFollowedLinkedText = (CChameleonCaption*)FindPaneByID( 'fllw' ); - - fSolidColor = (CColorButton*)FindPaneByID( 'Choo' ); - - fImageFile = (LControl*)FindPaneByID( 'Imag' ); - fImageFileName = (CLargeEditField *)FindPaneByID( 'bthr' ); - - UReanimator::LinkListenerToControls( this, this, mPaneID ); - - LO_Color colorBackground = UGraphics::MakeLOColor( CPrefs::GetColor( CPrefs::WindowBkgnd ) ); - LO_Color colorText = UGraphics::MakeLOColor( CPrefs::GetColor( CPrefs::Black ) ); - LO_Color colorLink = UGraphics::MakeLOColor( CPrefs::GetColor( CPrefs::Blue ) ); - LO_Color colorActiveLink = UGraphics::MakeLOColor( CPrefs::GetColor( CPrefs::Blue ) ); // this must be the same as colorLink ?! - LO_Color colorFollowedLink = UGraphics::MakeLOColor( CPrefs::GetColor( CPrefs::Magenta ) ); - - fSchemeData = XP_ListNew(); - AddNewColorData( fSchemeData, - colorText.red, colorText.green, colorText.blue, - colorBackground.red, colorBackground.green, colorBackground.blue, - colorLink.red, colorLink.green, colorLink.blue, - colorFollowedLink.red, colorFollowedLink.green, colorFollowedLink.blue, - colorActiveLink.red, colorActiveLink.green, colorActiveLink.blue); - AddNewColorData( fSchemeData, 0,0,0, 255,240,240, 255,0,0, 128,0,128, 0,0,255 ); - AddNewColorData( fSchemeData, 0,0,0, 255,255,192, 0,0,255, 128,0,128, 255,0,255 ); - AddNewColorData( fSchemeData, 64,0,64, 255,255,128, 0,0,255, 0,128,0, 255,0,128 ); - AddNewColorData( fSchemeData, 0,0,0, 192,192,255, 0,0,255, 128,0,128, 255,0,128 ); - AddNewColorData( fSchemeData, 0,0,0, 128,128,192, 255,255,255, 128,0,128, 255,255,0 ); - AddNewColorData( fSchemeData, 0,0,128, 255,192,64, 0,0,255, 0,128,0, 0,255,255 ); - AddNewColorData( fSchemeData, 255,255,255, 0,0,0, 255,255,0, 192,192,192, 192,255,192 ); - AddNewColorData( fSchemeData, 255,255,255, 0,64,0, 255,255,0, 128,255,128, 0,255,64 ); - AddNewColorData( fSchemeData, 255,255,255, 0,0,128, 255,255,0, 128,128,255, 255,0,255 ); - AddNewColorData( fSchemeData, 255,255,255, 128,0,128, 0,255,255, 128,255,255, 0,255,0 ); - - fColorScheme->SetValue(2); // Netscape default - ListenToMessage('Sche', NULL); -} - - -void AppearanceContain::UpdateTheWholeDamnDialogBox() -{ - RGBColor color; - RGBColor backColor; - - backColor = fSolidColor->GetColor(); // what about the default?? - fExampleView->SetColor( backColor ); - - color = fNormalText->GetColor(); - fExampleNormalText->SetColor( color, backColor ); - - color = fLinkedText->GetColor(); - fExampleLinkedTex->SetColor( color, backColor ); - - color = fActiveLinkedText->GetColor(); - fExampleActiveLinkedText->SetColor( color, backColor ); - - color = fFollowedLinkedText->GetColor(); - fExampleFollowedLinkedText->SetColor( color, backColor ); - - fExampleView->Refresh(); - fNormalText->Refresh(); - fLinkedText->Refresh(); - fActiveLinkedText->Refresh(); - fFollowedLinkedText->Refresh(); - fSolidColor->Refresh(); - - if (fBrowserColor->GetValue()) - { - fColorScheme->Disable(); - fExampleView->Disable(); - fNormalText->Disable(); - fLinkedText->Disable(); - fActiveLinkedText->Disable(); - fFollowedLinkedText->Disable(); - fSolidColor->Disable(); - } - else - { - fColorScheme->Enable(); - fExampleView->Enable(); - fNormalText->Enable(); - fLinkedText->Enable(); - fActiveLinkedText->Enable(); - fFollowedLinkedText->Enable(); - fSolidColor->Enable(); - } -} - - -void AppearanceContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - switch (inMessage) - { - case 'Norm': - case 'Link': - case 'Acti': - case 'Foll': - case 'Choo': - fColorScheme->SetValue(1); // custom - ListenToMessage('Sche', NULL); - case 'Cust': - case 'Brow': - UpdateTheWholeDamnDialogBox(); - break; - - - case 'Imag': - if (fImageFile->GetValue() == 1) - { // we are trying to set the image - CStr255 url; - fImageFileName->GetDescriptor(url); - if (url == CStr255::sEmptyString) - { // but it doesn't exist - CEditDialog::ChooseImageFile( fImageFileName ); // so try to get it - fImageFileName->GetDescriptor(url); - if (url == CStr255::sEmptyString) // but, if we were unsuccessful - fImageFile->SetValue(0); // revert back. - } - } - break; - - case 'wst1': - CEditDialog::ChooseImageFile( fImageFileName ); // try to get it - CStr255 url; - fImageFileName->GetDescriptor(url); - if (url == CStr255::sEmptyString) // if we were unsuccessful - fImageFile->SetValue(0); // don't try to use - else - fImageFile->SetValue(1); // ok - break; - - case 'Sche': - int scheme = fColorScheme->GetValue(); - scheme--; - - if (scheme) - { - EDT_ColorSchemeData * pColorData = (EDT_ColorSchemeData *)XP_ListGetObjectNum(fSchemeData, scheme); - if (pColorData) - { - fSolidColor-> SetColor(UGraphics::MakeRGBColor(pColorData->ColorBackground)); - fNormalText-> SetColor(UGraphics::MakeRGBColor(pColorData->ColorText)); - fLinkedText-> SetColor(UGraphics::MakeRGBColor(pColorData->ColorLink)); - fActiveLinkedText-> SetColor(UGraphics::MakeRGBColor(pColorData->ColorActiveLink)); - fFollowedLinkedText-> SetColor(UGraphics::MakeRGBColor(pColorData->ColorFollowedLink)); - } - - fImageFile->SetValue(0); // no background - UpdateTheWholeDamnDialogBox(); - } - break; - - } -} - - -CEDDocPropAppearanceContain::~CEDDocPropAppearanceContain() -{ - if ( fSchemeData ) - { - EDT_ColorSchemeData *pColorData; - XP_List * list_ptr = fSchemeData; - pColorData = (EDT_ColorSchemeData *)XP_ListNextObject(list_ptr); - while ( pColorData ) - { - XP_FREE(pColorData); - pColorData = (EDT_ColorSchemeData *)XP_ListNextObject(list_ptr); - } - XP_ListDestroy(fSchemeData); -// XP_FREE(fSchemeData); already done by XP_ListDestroy()!! - } -} - -void CEDDocPropAppearanceContain::PrefsFromControls() -{ - LControl *prefCheckBox = (LControl *)FindPaneByID( 'Dflt' ); - if ( prefCheckBox && prefCheckBox->GetValue() && prefCheckBox->IsVisible() ) - { - PREF_SetBoolPref( "editor.use_custom_colors", fCustomColor->GetValue() ); - if ( fCustomColor->GetValue() ) - { - LO_Color colorBackground = UGraphics::MakeLOColor(fSolidColor->GetColor()); - LO_Color colorText = UGraphics::MakeLOColor(fNormalText->GetColor()); - LO_Color colorLink = UGraphics::MakeLOColor(fLinkedText->GetColor()); - LO_Color colorActiveLink = UGraphics::MakeLOColor(fActiveLinkedText->GetColor()); - LO_Color colorFollowedLink = UGraphics::MakeLOColor(fFollowedLinkedText->GetColor()); - - PREF_SetColorPref( "editor.background_color", - colorBackground.red, - colorBackground.green, - colorBackground.blue ); - PREF_SetColorPref( "editor.text_color", - colorText.red, - colorText.green, - colorText.blue ); - PREF_SetColorPref( "editor.link_color", - colorLink.red, - colorLink.green, - colorLink.blue ); - PREF_SetColorPref( "editor.active_link_color", - colorActiveLink.red, - colorActiveLink.green, - colorActiveLink.blue ); - PREF_SetColorPref( "editor.followed_link_color", - colorFollowedLink.red, - colorFollowedLink.green, - colorFollowedLink.blue ); - } - - PREF_SetBoolPref( "editor.use_background_image", fImageFile->GetValue()); - if (fImageFile->GetValue()) - { - char *url = fImageFileName->GetLongDescriptor(); - if ( url && XP_STRLEN( url ) ) - PREF_SetCharPref("editor.background_image", url); - XP_FREEIF( url ); - } - } - - EDT_PageData *pageData = EDT_GetPageData( fContext ); - if (pageData == NULL) - return; - - if (pageData->pColorBackground) XP_FREE(pageData->pColorBackground); // don't care about the old values... - if (pageData->pColorText) XP_FREE(pageData->pColorText); - if (pageData->pColorLink) XP_FREE(pageData->pColorLink); - if (pageData->pColorActiveLink) XP_FREE(pageData->pColorActiveLink); - if (pageData->pColorFollowedLink) XP_FREE(pageData->pColorFollowedLink); - if (pageData->pBackgroundImage) - { - XP_FREE( pageData->pBackgroundImage ); - pageData->pBackgroundImage = NULL; - } - - if ( fImageFile->GetValue() ) - { - char *url = fImageFileName->GetLongDescriptor(); - if ( url && XP_STRLEN( url ) ) - pageData->pBackgroundImage = url; - else if ( url ) - XP_FREE( url ); - } - - if (fBrowserColor->GetValue()) - { - pageData->pColorBackground = NULL; - pageData->pColorText = NULL; - pageData->pColorLink = NULL; - pageData->pColorActiveLink = NULL; - pageData->pColorFollowedLink = NULL; - } - else - { - LO_Color colorBackground = UGraphics::MakeLOColor(fSolidColor->GetColor()); - LO_Color colorText = UGraphics::MakeLOColor(fNormalText->GetColor()); - LO_Color colorLink = UGraphics::MakeLOColor(fLinkedText->GetColor()); - LO_Color colorActiveLink = UGraphics::MakeLOColor(fActiveLinkedText->GetColor()); - LO_Color colorFollowedLink = UGraphics::MakeLOColor(fFollowedLinkedText->GetColor()); - - pageData->pColorBackground = &colorBackground; - pageData->pColorText = &colorText; - pageData->pColorLink = &colorLink; - pageData->pColorActiveLink = &colorActiveLink; - pageData->pColorFollowedLink = &colorFollowedLink; - } - - EDT_SetPageData( fContext, pageData ); - - pageData->pColorBackground = NULL; // of course, we don't want to FREE these... - pageData->pColorText = NULL; - pageData->pColorLink = NULL; - pageData->pColorActiveLink = NULL; - pageData->pColorFollowedLink = NULL; - - EDT_FreePageData( pageData ); -} - - -static -inline -bool operator==( const LO_Color& lhs, const LO_Color& rhs ) -{ - return lhs.red == rhs.red - && lhs.green == rhs.green - && lhs.blue == rhs.blue; -} - - -void CEDDocPropAppearanceContain::ControlsFromPref() -{ - EDT_PageData *pageData = EDT_GetPageData( fContext ); - if (pageData == NULL) - return; - - if (pageData->pColorBackground - || pageData->pColorLink - || pageData->pColorText - || pageData->pColorFollowedLink - || pageData->pColorActiveLink) - { - TurnOn(fCustomColor); - fColorScheme->SetValue(1); // switch to custom by default - - int scheme; - for ( scheme = 0; scheme < fColorScheme->GetMaxValue(); scheme++ ) - { - EDT_ColorSchemeData * pColorData = (EDT_ColorSchemeData *)XP_ListGetObjectNum( fSchemeData, scheme ); - if ( pColorData && (pColorData->ColorBackground == *(pageData->pColorBackground)) - && (pColorData->ColorText == *(pageData->pColorText)) - && (pColorData->ColorLink == *(pageData->pColorLink)) - && (pColorData->ColorActiveLink == *(pageData->pColorActiveLink)) - && (pColorData->ColorFollowedLink == *(pageData->pColorFollowedLink)) ) - { - fColorScheme->SetValue( scheme + 1 ); - break; - } - } - - } - else - { - TurnOn(fBrowserColor); - } - - fImageFile->SetValue(0); - if (pageData->pBackgroundImage && XP_STRLEN(pageData->pBackgroundImage) > 0) - { - fImageFileName->SetLongDescriptor( pageData->pBackgroundImage ); - fImageFile->SetValue(1); - } - - if (pageData->pColorBackground) - fSolidColor->SetColor(UGraphics::MakeRGBColor(*pageData->pColorBackground)); - if (pageData->pColorText) - fNormalText->SetColor(UGraphics::MakeRGBColor(*pageData->pColorText)); - if (pageData->pColorLink) - fLinkedText->SetColor(UGraphics::MakeRGBColor(*pageData->pColorLink)); - if (pageData->pColorActiveLink) - fActiveLinkedText->SetColor(UGraphics::MakeRGBColor(*pageData->pColorActiveLink)); - if (pageData->pColorFollowedLink) - fFollowedLinkedText->SetColor(UGraphics::MakeRGBColor(*pageData->pColorFollowedLink)); - - EDT_FreePageData( pageData ); - UpdateTheWholeDamnDialogBox(); -} - - -void CEDDocPropAppearanceContain::Help() -{ - ShowHelp( HELP_DOC_PROPS_APPEARANCE ); -} - - -/* TO DO: -Well, this is somewhat of a mess because: -1) we store the name and value together separated only by a '='. Easily screwed up if one or the other contains a '=' -2) We don't remove spaces or any other white space. -3) we don't handle quotes at all. Shouldn't we do something about escaping '"' chanacters? -4) The UI needs work. -5) could use stack space for the majority of small META tags and only resort to malloc in exceptional cases -6) when the page is reloaded, we re-blast in the meta values starting from cell number 1 without first clearing the table -7) no UI for user who tries to insert an "Author" meta tag, etc. -8) not too sure what we are supposed to do about case. layout uses case insensitive tags. EDT_GetMetaData() uses case sensitive tags. -*/ - -CEDDocPropAdvancedContain::~CEDDocPropAdvancedContain() -{ - XP_FREEIF( fbuffer ); -} - -void CEDDocPropAdvancedContain::FinishCreateSelf() -{ - fbufferlen = 1000; - fbuffer = (char *)malloc( fbufferlen ); // we'll keep this fbuffer for temp use for various things as long as dlog is around. - if ( fbuffer == NULL ) - fbufferlen = 0; - - fSystemVariables = (OneRowLListBox*)FindPaneByID( 'Syst' ); - fUserVariables = (OneRowLListBox*)FindPaneByID( 'User' ); - - fName = (CLargeEditField *)FindPaneByID( 'Name' ); - fValue = (CLargeEditField *)FindPaneByID( 'Valu' ); - - UReanimator::LinkListenerToControls( this, this, mPaneID ); -} - -void CEDDocPropAdvancedContain::PrefsFromControls() -{ - if (fbuffer == NULL) - return; // the fbuffer is now as big or bigger (it grows) than all MetaData and all cell entries in the table. Don't worry about the size anymore. - - EDT_MetaData* pData; - int16 i, count; - - // First, clear METAs all out because we are going to rebuild the lists from scratch. - count = EDT_MetaDataCount(fContext); - for (i = count - 1; i >= 0; i-- ) - { - pData = EDT_GetMetaData(fContext, i); - - if (strcasecomp(pData->pName, "Author") && // Skip the fields used in General Info page - strcasecomp(pData->pName, "Description") && - strcasecomp(pData->pName, "Generator") && - strcasecomp(pData->pName, "Last-Modified") && - strcasecomp(pData->pName, "Created") && - strcasecomp(pData->pName, "Classification") && - strcasecomp(pData->pName, "Keywords")) - EDT_DeleteMetaData( fContext, pData ); // remove all the other ones. - - EDT_FreeMetaData( pData ); - } - - pData = EDT_NewMetaData(); - - - // Do the system METAs first, bHttpEquiv = FALSE; - pData->bHttpEquiv = FALSE; - count = fSystemVariables->GetRows(); - for (i = 0; i < count; i++) - { - int16 len = fbufferlen; - fSystemVariables->GetCell(i, fbuffer, &len); - fbuffer[len] = '\0'; - - pData->pName = fbuffer; - - char *equal = strchr(fbuffer, '='); // look for the '='. Of course this screws up if the stupid user put an '=' in the TEditField - - if (equal) - { - *equal++ = '\0'; - pData->pContent = equal; - EDT_SetMetaData( fContext, pData ); - } - else - { - pData->pContent = NULL; // I should check if this is valid.... - EDT_DeleteMetaData( fContext, pData ); // you might wonder why I'm calling EDT_DeleteMetaData() if all Tags are supposed to be gone.... Well, what if a user wanted to delete the "Author" tag here by defining it to be NULL?! - } - } - - // Do the user METAs next, bHttpEquiv = TRUE; - pData->bHttpEquiv = TRUE; - count = fUserVariables->GetRows(); - for (i = 0; i < count; i++) - { - int16 len = fbufferlen; - fUserVariables->GetCell(i, fbuffer, &len); - fbuffer[len] = '\0'; - - pData->pName = fbuffer; - - char *equal = strchr(fbuffer, '='); - - if (equal) - { - *equal++ = '\0'; - pData->pContent = equal; - } - else - pData->pContent = NULL; // I should check if this is valid.... - - EDT_SetMetaData( fContext, pData ); - } - - pData->pName = NULL; // we don't want EDT_FreeMetaData() to free our fbuffer for us. - pData->pContent = NULL; // we don't want EDT_FreeMetaData() to free our fbuffer for us. - - EDT_FreeMetaData(pData); -} - - -void CEDDocPropAdvancedContain::ControlsFromPref() -{ - int16 sysRowNum = fSystemVariables->GetRows(); // add to the bottom? shouldn't we clear the tables first and skip this? - int16 usrRowNum = fUserVariables->GetRows(); // add to the bottom? shouldn't we clear the tables first and skip this? - - sysRowNum = 1; // forget what is in the table now. We'll start from the beginning. - usrRowNum = 1; - - int newlength; - int count = EDT_MetaDataCount(fContext); - for ( int i = 0; i < count; i++ ) - { - EDT_MetaData* pData = EDT_GetMetaData(fContext, i); - - newlength = XP_STRLEN(pData->pName) + 1 + XP_STRLEN(pData->pContent) + 1; - if ( fbuffer && newlength > fbufferlen ) - { // grow fbuffer if necessary - fbuffer = (char *) XP_REALLOC(&fbuffer, fbufferlen); - if ( fbuffer ) - fbufferlen = newlength; - else - fbufferlen = 0; - } - - if ( fbuffer ) - { - sprintf(fbuffer, "%s=%s", pData->pName, pData->pContent); - - if ( pData->bHttpEquiv ) - { // which table do we put it in? - fSystemVariables->AddRow( sysRowNum++, fbuffer, XP_STRLEN(fbuffer) ); - } - else if (strcasecomp(pData->pName, "Author") && // Skip the fields used in General Info page - strcasecomp(pData->pName, "Description") && - strcasecomp(pData->pName, "Generator") && - strcasecomp(pData->pName, "Last-Modified") && - strcasecomp(pData->pName, "Created") && - strcasecomp(pData->pName, "Classification") && - strcasecomp(pData->pName, "Keywords")) - { - // TODO: PUT META STRINGS IN RESOURCES? - fUserVariables->AddRow( usrRowNum++, fbuffer, XP_STRLEN(fbuffer) ); - } - } - - EDT_FreeMetaData( pData ); - } - - fSystemVariables->FocusDraw(); - fSystemVariables->SetDoubleClickMessage( msg_DblClickOnTarget ); - fSystemVariables->SetSingleClickMessage(msg_ClickOnTarget); - fSystemVariables->AddListener( this ); - fSystemVariables->SetValue(-1); - - fUserVariables->FocusDraw(); - fUserVariables->SetDoubleClickMessage( msg_DblClickOnTarget2 ); - fUserVariables->SetSingleClickMessage( msg_ClickOnTarget2 ); - fUserVariables->AddListener( this ); - fUserVariables->SetValue(-1); -} - -void CEDDocPropAdvancedContain::PutStringsInBuffer() -{ - if (fbuffer == NULL) - return; - - char *name = fName->GetLongDescriptor(); - if ( name == NULL ) - return; - - char *value = fValue->GetLongDescriptor(); - if ( value == NULL ) - { - XP_FREE( name ); - return; - } - - if ( XP_STRLEN(name) + 1 + XP_STRLEN(value) + 1 > fbufferlen ) - { // grow the fbuffer if necessary - fbuffer = (char *) XP_REALLOC(&fbuffer, fbufferlen); - if ( fbuffer ) - fbufferlen = XP_STRLEN( name ) + 1 + XP_STRLEN( value ) + 1; - else - fbufferlen = 0; - } - - if ( fbuffer ) - sprintf(fbuffer, "%s=%s", name, value); - - XP_FREE( name ); - XP_FREE( value ); -} - -Boolean CEDDocPropAdvancedContain::BufferUnique() -{ - if (fbuffer == NULL) return false; - - if (!fSystemVariables->IsTarget() && !fUserVariables->IsTarget()) - return false; // we compare against the target: at least one must be target - - OneRowLListBox* lBox; - if (fSystemVariables->IsTarget()) - lBox = fSystemVariables; - else - lBox = fUserVariables; - - int16 count = lBox->GetRows(); - char *tempbuff = (char *)malloc(fbufferlen); // we need to copy the strings out of the table one at a time to compare with them. don't copy more than bufflen since they wouldn't be equal then anyway. - if (tempbuff == NULL) - return false; - - int16 i; - for (i = 0; i < count; i++) { - int16 len = fbufferlen; - lBox->GetCell(i, tempbuff, &len); - tempbuff[len] = '\0'; - if (XP_STRCMP(tempbuff, fbuffer) == NULL) - { // we should probably do a case insensitive compare on the Name and a case sensitive compare on the Value. What a pain. - XP_FREE(tempbuff); - return false; - } - } - - XP_FREE(tempbuff); - return true; // no matches; must be unique -} - - -void CEDDocPropAdvancedContain::Help() -{ - ShowHelp( HELP_DOC_PROPS_ADVANCED ); -} - - -void CEDDocPropAdvancedContain::ListenToMessage( MessageT inMessage, void* /* ioParam */ ) -{ - switch (inMessage) { - case msg_Doc_Advanced_Prop_New_Tag: - PutStringsInBuffer(); - if (BufferUnique()) { - if (fSystemVariables->IsTarget()) - fSystemVariables->AddRow(fSystemVariables->GetRows(),fbuffer,strlen(fbuffer)); - - if (fUserVariables->IsTarget()) - fUserVariables->AddRow(fUserVariables->GetRows(),fbuffer,strlen(fbuffer)); - } - break; - - case msg_Doc_Advanced_Prop_Set_Tag: - PutStringsInBuffer(); - if (BufferUnique()) { - - if (fSystemVariables->IsTarget() && fSystemVariables->GetValue() != -1) - fSystemVariables->SetCell(fSystemVariables->GetValue(),fbuffer,strlen(fbuffer)); - - if (fUserVariables->IsTarget() && fUserVariables->GetValue() != -1) - fUserVariables->SetCell(fUserVariables->GetValue(),fbuffer,strlen(fbuffer)); - - } - break; - - case msg_Doc_Advanced_Prop_Delete_Tag: - if (fSystemVariables->IsTarget() && fSystemVariables->GetValue() != -1) - fSystemVariables->RemoveRow(fSystemVariables->GetValue()); - - if (fUserVariables->IsTarget() && fUserVariables->GetValue() != -1) - fUserVariables->RemoveRow(fUserVariables->GetValue()); - break; - - case msg_ClickOnTarget: - case msg_DblClickOnTarget: - if (fbuffer && fSystemVariables->GetValue() != -1) - { - int16 len = fbufferlen; - fSystemVariables->GetCell(fSystemVariables->GetValue(), fbuffer, &len); - fbuffer[len] = '\0'; - - char *equal = strchr(fbuffer, '='); - if ( equal ) - { - *equal++ = '\0'; - fValue->SetLongDescriptor( equal ); - } - else - fValue->SetLongDescriptor( "" ); - - fName->SetLongDescriptor( fbuffer ); - } - break; - - case msg_ClickOnTarget2: - case msg_DblClickOnTarget2: - if (fbuffer && fUserVariables->GetValue() != -1) - { - int16 len = fbufferlen; - fUserVariables->GetCell(fUserVariables->GetValue(), fbuffer, &len); - fbuffer[len] = '\0'; - - char *equal = strchr(fbuffer, '='); - if (equal) - { - *equal++ = '\0'; - fValue->SetLongDescriptor( equal ); - } - else - fValue->SetLongDescriptor( "" ); - - fName->SetLongDescriptor( fbuffer ); - } - break; - } -} - - -void CEDDocAppearanceNoTab::DrawSelf() -{ -// we don't want to draw any frame/bevel border in this case because it is going to -// go into a dialog all by itself (not in a tabbed dialog) -// the following is copied from CPrefContain::DrawSelf() and #if'd out -#if 0 - Rect theFrame; - if (CalcLocalFrameRect(theFrame)) - { - StColorPenState theSaver; - theSaver.Normalize(); - - SBevelColorDesc theDesc; - UGraphicGizmos::LoadBevelTraits(5000, theDesc); - - ::PmForeColor(theDesc.fillColor); - ::PaintRect(&theFrame); - - StClipRgnState theClipSaver(theFrame); - StColorState::Normalize(); - - theFrame.top -= 5; - ::FrameRect(&theFrame); - - SBooleanRect theBevelSides = { true, false, true, true }; - UGraphicGizmos::BevelPartialRect(theFrame, 1, eStdGrayBlack, eStdGrayBlack, theBevelSides); - ::InsetRect(&theFrame, 1, 1); - UGraphicGizmos::BevelPartialRect(theFrame, 2, theDesc.topBevelColor, theDesc.bottomBevelColor, theBevelSides); - } -#endif -} - - -void CFormatMsgColorAndImageDlog::InitializeDialogControls() -{ - LControl *prefCheckBox = (LControl *)FindPaneByID( 'Dflt' ); - if ( prefCheckBox ) - prefCheckBox->Hide(); - - CEDDocPropAppearanceContain *contain = (CEDDocPropAppearanceContain *)FindPaneByID( 5210 ); - if ( contain ) - { - contain->SetContext( GetContext() ); - contain->ControlsFromPref(); - } -} - - -Boolean CFormatMsgColorAndImageDlog::CommitChanges( Boolean /* allPanes */ ) -{ - CEDDocPropAppearanceContain *contain = (CEDDocPropAppearanceContain *)FindPaneByID( 5210 ); - if ( contain ) - { - EDT_BeginBatchChanges( fContext ); - contain->PrefsFromControls(); - EDT_EndBatchChanges( fContext ); - } - - return true; -} - - -void CFormatMsgColorAndImageDlog::Help() -{ - ShowHelp( HELP_DOC_PROPS_APPEARANCE ); -} - - -/**********************************************************/ -#pragma mark - -#pragma mark Modal Dialogs - -// This is a total hack because I'm in a hurry and this has to be a modal dialog. Please rewrite soon! - -void SetItemValue(DialogRef theDialog, short itemNo, short value); -void SetItemValue(DialogRef theDialog, short itemNo, short value) -{ - Rect so; - ControlHandle theControl; - short type; - GetDialogItem(theDialog, itemNo, &type, (Handle *)&theControl, &so); - if (type != kCheckBoxDialogItem) return; - SetControlValue(theControl, value); -} - - -static void InformOfLimit(int min, int max) -{ - Str31 minstr, maxstr; - - NumToString( min, minstr ); - NumToString( max, maxstr ); - HandleModalDialog( EDITDLG_LIMITS, minstr, maxstr); -} - - -static Boolean IsEditFieldWithinLimits(LGAEditField* editField, int minVal, int maxVal ) -{ - short value = editField->GetValue(); - if ( value < minVal || value > maxVal ) - { - InformOfLimit( minVal, maxVal ); - return FALSE; - } - - return TRUE; -} - - -#define ED_SAVE_OVERWRITE_THIS_BUTTON 1 -#define ED_SAVE_OVERWRITE_ALL_BUTTON 2 -#define ED_SAVE_DONT_OVERWRITE_THIS_BUTTON 3 -#define ED_SAVE_DONT_OVERWRITE_ALL_BUTTON 4 -#define ED_SAVE_CANCEL_BUTTON 5 - -ED_SaveOption FE_SaveFileExistsDialog( MWContext * /* pContext */, char* pFileName ) -{ - Str255 pFileNameCopy; - - if ( pFileName ) - { // should use the string classes and manipulation routines and clean up this mess!!! - char *shorter = WH_FileName(pFileName, xpURL); - if (!shorter) - return ED_SAVE_CANCEL; - BlockMoveData(shorter, pFileNameCopy, strlen(shorter) + 1); - XP_FREE(shorter); - c2pstr((char*)pFileNameCopy); - } - - switch (HandleModalDialog( EDITDLG_SAVE_FILE_EXISTS, pFileNameCopy, NULL )) - { - case ED_SAVE_OVERWRITE_THIS_BUTTON: return ED_SAVE_OVERWRITE_THIS; break; - case ED_SAVE_OVERWRITE_ALL_BUTTON: return ED_SAVE_OVERWRITE_ALL; break; - case ED_SAVE_DONT_OVERWRITE_THIS_BUTTON: return ED_SAVE_DONT_OVERWRITE_THIS; break; - case ED_SAVE_DONT_OVERWRITE_ALL_BUTTON: return ED_SAVE_DONT_OVERWRITE_ALL; break; - case ED_SAVE_CANCEL_BUTTON: return ED_SAVE_CANCEL; break; - } - - return ED_SAVE_CANCEL; // shouldn't get here... -} diff --git a/mozilla/cmd/macfe/Composer/meditdlg.h b/mozilla/cmd/macfe/Composer/meditdlg.h deleted file mode 100644 index e69747eb9aa..00000000000 --- a/mozilla/cmd/macfe/Composer/meditdlg.h +++ /dev/null @@ -1,848 +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. - */ - -#pragma once - -#include "CTabSwitcher.h" -#include "ntypes.h" // MWContext -#include "lo_ele.h" // LO_Color -#include "intl_csi.h" // INTL_GetCSIWinCSID - -#ifdef COOL_IMAGE_RADIO_BUTTONS -# include "CBevelButton.h" -#endif - -class OneRowLListBox; -class CColorButton; -class CTabControl; -class CLargeEditField; -class LGAEditField; -class LGAPopup; -class LGACaption; - -class CChameleonView: public LView -{ -public: - enum { class_ID = 'cviw' }; - CChameleonView(LStream * inStream) : LView(inStream) {}; - virtual void SetColor(RGBColor textColor); - virtual void DrawSelf(); - -protected: - - RGBColor fTextColor; - -}; - -class CChameleonCaption; - -// This class simply creates a dialog and extracts the context from the SuperCommand so -// that we can set the values of the controls in the dialog based on the context which created it. - -class CEditDialog: public LDialogBox -{ -public: - CEditDialog( LStream* inStream ): LDialogBox( inStream ), mUndoInited(false) { pExtra = NULL; } - ~CEditDialog() { XP_FREEIF(pExtra); } - static Boolean Start(ResIDT inWindowID, MWContext * context = NULL, short initTabValue = 0, Boolean insert = FALSE); - - Boolean AllowSubRemoval( LCommander *inSub ); - - virtual void InitializeDialogControls() = NULL; - - void SetContext(MWContext* context) {fContext = context;} - MWContext* GetContext() { return fContext;} - - void SetInitTabValue(short initValue) {fInitTabValue = initValue;} - short GetInitTabValue() { return fInitTabValue;} - - void SetInWindowID(ResIDT inWindowID) {fInWindowID = inWindowID;} - ResIDT GetInWindowID() { return fInWindowID;} - - void SetInsertFlag(Boolean insert) {fInsert = insert;} - Boolean GetInsertFlag() { return fInsert;} - - int16 GetWinCSID() { return INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(fContext)); } - - static void ChooseImageFile(CLargeEditField* editField); - -protected: - - virtual Boolean CommitChanges(Boolean allPanes) = NULL; - virtual void Help() = NULL; - - MWContext* fContext; - short fInitTabValue; - Boolean fInsert; - ResIDT fInWindowID; - - char* pExtra; - Boolean mUndoInited; -}; - - -class CEditTabSwitcher: public CTabSwitcher -{ -public: - enum { class_ID = 'EtSw' }; - - CEditTabSwitcher(LStream* inStream); - virtual ~CEditTabSwitcher(); - - virtual void DoPostLoad(LView* inLoadedPage, Boolean inFromCache); - void SetData(MWContext* context, Boolean insert); - void Help(); - -protected: - MWContext* fContext; - Boolean fInsert; - char* fLinkName; // need to share between link and image pages - -}; - - -class CTableInsertDialog: public CEditDialog -{ -public: - enum { class_ID = 'ETBT' }; - - CTableInsertDialog( LStream* inStream ); - virtual ~CTableInsertDialog(); - - virtual Boolean CommitChanges(Boolean allPanes); - void AdjustEnable(); - virtual void FinishCreateSelf(); - virtual void InitializeDialogControls(); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - -protected: - virtual void Help(); - - LGAEditField* fNumRowsEditText; - LGAEditField* fNumColsEditText; - - LControl* fBorderCheckBox; - LGAEditField* fBorderWidthEditText; - LGAEditField* fCellSpacingEditText; - LGAEditField* fCellPaddingEditText; - - LControl* fCustomWidth; - LGAEditField* fWidthEditText; - LControl* fWidthPopup; - - LControl* fCustomHeight; - LGAEditField* fHeightEditText; - LControl* fHeightPopup; - - LControl* fCustomColor; - CColorButton* fColorCustomColor; - - LControl* fCaptionAboveBelow; - - LGAPopup* mTableAlignment; - - LControl* mFastLayout; - LControl* mUseImage; - CLargeEditField* mImageFileName; - LControl* mLeaveImage; -}; - - -class CFormatMsgColorAndImageDlog: public CEditDialog -{ -public: - enum { class_ID = 'Ec+i' }; - - CFormatMsgColorAndImageDlog( LStream* inStream ) : CEditDialog( inStream ) {;} - virtual ~CFormatMsgColorAndImageDlog() {;} - - virtual Boolean CommitChanges(Boolean allPanes); - virtual void InitializeDialogControls(); - -protected: - virtual void Help(); -}; - - -class CTarget: public CEditDialog -{ -public: - enum { class_ID = 'ETRG' }; - - CTarget( LStream* inStream ); - virtual ~CTarget(); - - void CleanUpTargetString(char *target); - Boolean AlreadyExistsInDocument(char *anchor); - virtual Boolean CommitChanges(Boolean allPanes); - virtual void InitializeDialogControls(); - -protected: - virtual void Help() {;} // Sorry, no help. - - char* fOriginalTarget; - CLargeEditField* fTargetName; -}; - -class CLineProp: public CEditDialog -{ -public: - enum { class_ID = 'EDL0' }; - - CLineProp( LStream* inStream ); - virtual ~CLineProp( ); - - virtual Boolean CommitChanges(Boolean allPanes); - virtual void FinishCreateSelf(); - virtual void InitializeDialogControls(); -// virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - -protected: - virtual void Help(); - - LControl* fLeftAlign; - LControl* fCenterAlign; - LControl* fRightAlign; - - LGAEditField* fHeightEditText; - LGAEditField* fWidthEditText; - LControl* fPixelPercent; - LControl* fShading; -}; - - -class CUnknownTag: public CEditDialog -{ -public: - enum { class_ID = 'EDUT' }; - - CUnknownTag( LStream* inStream ); - virtual ~CUnknownTag(); - - virtual Boolean CommitChanges(Boolean allPanes); - virtual void InitializeDialogControls(); - virtual void FinishCreateSelf(); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - -protected: - virtual void Help(); - - CLargeEditField* fTargetName; -}; - - -class CPageTitle: public CEditDialog -{ -public: - enum { class_ID = 'PGTL' }; - - CPageTitle( LStream* inStream ); - virtual ~CPageTitle(); - - virtual Boolean CommitChanges(Boolean allPanes); - virtual void InitializeDialogControls(); - virtual void FinishCreateSelf(); -protected: - virtual void Help() {;} // Sorry, no help. - - CLargeEditField* fPageName; -}; - - -class MultipleSelectionSingleColumn: public LListBox -{ -public: - enum { class_ID = 'MSSC' }; - - MultipleSelectionSingleColumn( LStream* inStream ); - - virtual int16 NumItems(); - virtual void DeselectAll(); - virtual void SelectAll(); - virtual void AddItem( char* data, Boolean isSelected ); - virtual StringPtr GetItem(Str255 outDescriptor, int32 rowNum) const; // rowNum is zero based - virtual void RemoveAllItems(); - virtual Boolean IsSelected(int32 rowNum); // rowNum is zero based - -}; - - -class CPublishHistory -{ -public: - // Do we have any history at all? - static Boolean IsTherePublishHistory(); - - // Get a particular entry - static char* GetPublishHistoryCharPtr(short whichone); - - // Set a particular entry - static void SetPublishHistoryCharPtr(char* entry, short whichone); - - // Put an entry at the top of the list (and remove any duplicate) - static void AddPublishHistoryEntry(char *entry); -}; - -class CPublish: public CEditDialog -{ -public: - enum { class_ID = 'EPLS' }; - - CPublish( LStream* inStream ); - virtual ~CPublish(); - - virtual Boolean CommitChanges(Boolean allPanes); - virtual void FinishCreateSelf(); - virtual void InitializeDialogControls(); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - -protected: - virtual void Help(); - char * DocName(); - - LCaption* fLocalLocation; - - LControl* fImageFiles; - LControl* fFolderFiles; - LControl* fDefaultLocation; - - MultipleSelectionSingleColumn* fFileList; - - LGAEditField* fPublishLocation; - LGAEditField* fUserID; - LGAEditField* fPassword; - - LControl* fSavePassword; - LGAPopup* mHistoryList; -}; - - -// This is a dialog box which contains a Tab control. -// This code was written using Cmd-C & Cmd-V from the CPrefWindow class. -// We don't need everything in CPrefWindow though, and I'm too lazy to make -// a nice base class for both at the moment. - -class CTabbedDialog : public CEditDialog -{ -public: - enum {class_ID = 'EDTB'}; - - CTabbedDialog( LStream* inStream ); - virtual ~CTabbedDialog(); - - static void RegisterViewTypes(); - void FinishCreateSelf(); - virtual void InitializeDialogControls(); - - virtual void SavePlace( LStream* ) { } - virtual void RestorePlace( LStream* ) { } - -// virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - -protected: - virtual void Help(); - virtual Boolean CommitChanges(Boolean allPanes); - - CTabControl* mTabControl; - CEditTabSwitcher* mTabSwitcher; - -}; - - -/***************************************************************************** - * class CEditorPrefContain. (used to be CPrefContain) - * Container for a related group of controls (1 pane of preference window) - * and know how to: - * - get proper variables from data, and assign the values to controls - * - get values from controls back into data. - *****************************************************************************/ -class CEditorPrefContain : public LView, public LListener, public LTabGroup -{ -public: - CEditorPrefContain( LStream* inStream ) : LView( inStream ) {}; - virtual ~CEditorPrefContain() { }; - - // ¥ link to little controls, and reset their values - virtual void FinishCreateSelf() { LView::FinishCreateSelf(); UReanimator::LinkListenerToControls(this, this, GetPaneID()); ControlsFromPref();} - - // ¥Êlistens to 'default' message - void ListenToMessage( MessageT, void* ) {}; - - // ¥ initialize from preferences - virtual void ControlsFromPref() = 0; - virtual void PrefsFromControls() = 0; - - virtual void DrawSelf(); -}; - - -class CEditContain: public CEditorPrefContain, public LBroadcaster -{ -public: - CEditContain(LStream* inStream): CEditorPrefContain( inStream ) - { fContext = NULL; fLinkName = NULL; pExtra = NULL; } // initialize everything to NULL - ~CEditContain(){ XP_FREEIF(pExtra); } - - void SetContext(MWContext* context) {fContext = context;} - MWContext* GetContext() { return fContext;} - - void SetInsertFlag(Boolean insert) {fInsert = insert;} - Boolean GetInsertFlag() { return fInsert;} - - void SetLinkToLinkName(char** LinkNameLink) {fLinkName = LinkNameLink;} - void SetExtraHTMLString(char *s) { pExtra = s; }; - virtual void Help() = NULL; - - int16 GetWinCSID() { return INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(fContext)); } - - virtual Boolean AllFieldsOK() = NULL; - -protected: - MWContext* fContext; - Boolean fInsert; - char** fLinkName; - char* pExtra; -}; - - -class CEDCharacterContain: public CEditContain -{ -public: - enum {class_ID = '1edl'}; - - CEDCharacterContain( LStream* inStream ) : CEditContain( inStream ){}; - - virtual void FinishCreateSelf(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void Help(); - - virtual Boolean AllFieldsOK() { return TRUE;} - -protected: - Boolean fColorChanged; - Boolean fSizeChanged; - - LControl* fTextSizePopup; - LControl* mFontMenu; - Boolean mFontChanged; - - LControl* fColorDefaultRadio; - LControl* fColorCustomRadio; - CColorButton* fColorCustomColor; - - LControl* fTextBoldCheck; - LControl* fTextItalicCheck; - LControl* fTextSuperscriptCheck; - LControl* fTextSubscriptCheck; - LControl* fTextNoBreaksCheck; - LControl* fTextUnderlineCheck; - LControl* fTextStrikethroughCheck; - LControl* fTextBlinkingCheck; - - LControl* fClearTextStylesButton; - LControl* fClearAllStylesButton; -}; - - -class CEDParagraphContain: public CEditContain -{ -public: - enum {class_ID = '2edl'}; - - CEDParagraphContain( LStream* inStream ) : CEditContain( inStream ){}; - - virtual void FinishCreateSelf(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - - virtual void Help(); - - virtual Boolean AllFieldsOK(); - -protected: - void AdjustPopupsVisibility(); - - LControl* fParagraphStylePopup; - LControl* fContainerStylePopup; - - LControl* fListStylePopup; - LControl* fNumberPopup; - LControl* fBulletPopup; - LControl* fStartNumberCaption; - LGAEditField* fStartNumberEditText; - - LControl* fLeftAlignRadio; - LControl* fCenterAlignRadio; - LControl* fRightAlignRadio; - -}; - - -#ifdef COOL_IMAGE_RADIO_BUTTONS -class CImageAlignButton: public CBevelButton -{ -public: - enum { class_ID = 'BvRB' }; - - CImageAlignButton( LStream* inStream ) : CBevelButton( inStream ){}; - virtual void SetValue( - Int32 inValue); - -private: - virtual void HotSpotAction( - Int16 inHotSpot, - Boolean inCurrInside, - Boolean inPrevInside); - - virtual void HotSpotResult(Int16 inHotSpot); -}; -#endif - - -class CEDLinkContain: public CEditContain -{ -public: - enum {class_ID = '3edl'}; - - CEDLinkContain( LStream* inStream ) : CEditContain( inStream ){}; - virtual ~CEDLinkContain(); - - virtual void FinishCreateSelf(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - virtual void Show(); - virtual void Hide(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void Help(); - - virtual Boolean AllFieldsOK() { return TRUE;} - -protected: - void SelectedFileUpdate(); - void CurrentFileTargs(); - - CLargeEditField* fLinkedTextEdit; - - LControl* fChooseFileLinkButton; - LControl* fRemoveLinkButton; - CLargeEditField* fLinkPageTextEdit; - - LControl* fCurrentDocumentRadio; - LControl* fSelectedFileRadio; - OneRowLListBox* fTargetList; - char* fTargs; -}; - - -class CEDImageContain: public CEditContain -{ -public: - enum {class_ID = '4edl'}; - - CEDImageContain( LStream* inStream ); - virtual ~CEDImageContain(); - - virtual void FinishCreateSelf(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - EDT_ImageData * ImageDataFromControls(); - virtual void Show(); - virtual void Hide(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void Help(); - virtual Boolean AllFieldsOK(); - -protected: - void AdjustEnable(); - - char * fSrcStr; - char * fLowSrcStr; - - CLargeEditField* fImageFileName; // was CEditBroadcaster - CLargeEditField* fImageAltTextEdit; - - LGAEditField* fHeightTextEdit; - LGAEditField* fWidthTextEdit; - LControl* fImageLockedCheckBox; - - int32 fOriginalWidth; /* Width and Height we got on initial loading */ - int32 fOriginalHeight; - - LGAEditField* fLeftRightBorderTextEdit; - LGAEditField* fTopBottomBorderTextEdit; - LGAEditField* fSolidBorderTextEdit; - - LControl* fCopyImageCheck; - LControl* fBackgroundImageCheck; - LControl* fRemoveImageMapButton; - LControl* fEditImageButton; - - Boolean fLooseImageMap; - Boolean mBorderUnspecified; - - LControl* mImageAlignmentPopup; -}; - - -class CEDDocPropGeneralContain: public CEditContain -{ -public: - enum {class_ID = '5edl'}; - - CEDDocPropGeneralContain( LStream* inStream ) : CEditContain( inStream ){}; - - virtual void FinishCreateSelf(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - void AddMeta(char *Name, CLargeEditField* value); - -// virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void Help(); - virtual Boolean AllFieldsOK() { return TRUE;} - -protected: - CLargeEditField* fLocation; - CLargeEditField* fTitle; - CLargeEditField* fAuthor; - CLargeEditField* fDescription; - CLargeEditField* fKeywords; - CLargeEditField* fClassification; -}; - - -// This should be moved to XP code in the future - -typedef struct _EDT_ColorSchemeData { - char * pSchemeName; - LO_Color ColorText; - LO_Color ColorLink; - LO_Color ColorActiveLink; - LO_Color ColorFollowedLink; - LO_Color ColorBackground; - char * pBackgroundImage; -} EDT_ColorSchemeData; - - -class AppearanceContain: public CEditContain -{ - AppearanceContain( LStream* inStream ) : CEditContain( inStream ){}; - virtual void FinishCreateSelf(); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - void ChooseImageFile(); - -protected: - void UpdateTheWholeDamnDialogBox(); - - LControl* fCustomColor; - LControl* fBrowserColor; - - LControl* fColorScheme; - - CChameleonView* fExampleView; - CColorButton* fNormalText; - CColorButton* fLinkedText; - CColorButton* fActiveLinkedText; - CColorButton* fFollowedLinkedText; - - CChameleonCaption* fExampleNormalText; - CChameleonCaption* fExampleLinkedTex; - CChameleonCaption* fExampleActiveLinkedText; - CChameleonCaption* fExampleFollowedLinkedText; - - CColorButton* fSolidColor; - LControl* fImageFile; - CLargeEditField* fImageFileName; - - XP_List* fSchemeData; -}; - - -class CEDDocPropAppearanceContain: public AppearanceContain -{ -public: - enum {class_ID = '6edl'}; - - CEDDocPropAppearanceContain( LStream* inStream ) : AppearanceContain( inStream ){}; - virtual ~CEDDocPropAppearanceContain(); - - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - - virtual Boolean AllFieldsOK() { return TRUE;} - virtual void Help(); -}; - - -class CEDDocAppearanceNoTab: public CEDDocPropAppearanceContain -{ -public: - enum {class_ID = '6edL'}; - - CEDDocAppearanceNoTab( LStream* inStream ) : CEDDocPropAppearanceContain( inStream ){}; - virtual ~CEDDocAppearanceNoTab() {;} - - virtual void DrawSelf(); -}; - - -class CEDDocPropAdvancedContain: public CEditContain -{ -public: - enum {class_ID = '7edl'}; - - CEDDocPropAdvancedContain( LStream* inStream ) : CEditContain( inStream ){}; - virtual ~CEDDocPropAdvancedContain(); - - virtual void FinishCreateSelf(); - void PutStringsInBuffer(); - Boolean BufferUnique(); - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void Help(); - virtual Boolean AllFieldsOK() { return TRUE;} - -protected: - int16 fbufferlen; - char* fbuffer; - - OneRowLListBox* fSystemVariables; - OneRowLListBox* fUserVariables; - - CLargeEditField* fName; - CLargeEditField* fValue; -}; - -class CEDTableContain: public CEditContain -{ -public: - enum {class_ID = '8edl'}; - - CEDTableContain( LStream* inStream ) : CEditContain( inStream ) { pExtra = NULL; } - ~CEDTableContain() { XP_FREEIF(pExtra); } - - virtual void FinishCreateSelf(); - virtual void Help(); - void AdjustEnable(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual Boolean AllFieldsOK(); - -protected: - LGAEditField* fNumRowsEditText; - LGAEditField* fNumColsEditText; - - LControl* fBorderCheckBox; - LGAEditField* fBorderWidthEditText; - LGAEditField* fCellSpacingEditText; - LGAEditField* fCellPaddingEditText; - - LControl* fCustomWidth; - LGAEditField* fWidthEditText; - LControl* fWidthPopup; - - LControl* fCustomHeight; - LGAEditField* fHeightEditText; - LControl* fHeightPopup; - - LControl* fCustomColor; - CColorButton* fColorCustomColor; - - LControl* fIncludeCaption; - LControl* fCaptionAboveBelow; - - LGAPopup* mTableAlignment; - - LControl* mFastLayout; - LControl* mUseImage; - CLargeEditField* mImageFileName; - LControl* mLeaveImage; - - char* pExtra; -}; - - -class CEDTableCellContain: public CEditContain -{ -public: - enum {class_ID = 'aedl'}; - - CEDTableCellContain( LStream* inStream ) : CEditContain( inStream ) { pExtra = NULL; } - ~CEDTableCellContain() { XP_FREEIF(pExtra); } - - virtual void FinishCreateSelf(); - virtual void Help(); - void AdjustEnable(); - - virtual void PrefsFromControls(); - virtual void ControlsFromPref(); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual Boolean AllFieldsOK(); - -protected: - LGAEditField* fRowSpanEditText; - LGAEditField* fColSpanEditText; - LGACaption* spanCaption; - LGACaption* rowCaption; - LGACaption* colCaption; - - LGAPopup* fHorizontalAlignment; - LGAPopup* fVerticalAlignment; - - LControl* fHeaderStyle; - LControl* fWrapText; - - LControl* fCustomWidth; - LGAEditField* fWidthEditText; - LControl* fWidthPopup; - - LControl* fCustomHeight; - LGAEditField* fHeightEditText; - LControl* fHeightPopup; - - LControl* fCustomColor; - CColorButton* fColorCustomColor; - - LControl* mNextButton; - LControl* mPreviousButton; - - LControl* mUseImage; - CLargeEditField* mImageFileName; - LControl* mLeaveImage; - - char* pExtra; -}; - diff --git a/mozilla/cmd/macfe/Composer/meditor.cp b/mozilla/cmd/macfe/Composer/meditor.cp deleted file mode 100644 index 746a4ae424c..00000000000 --- a/mozilla/cmd/macfe/Composer/meditor.cp +++ /dev/null @@ -1,391 +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. - */ - -#include "meditor.h" // HandleModalDialog -#include "StBlockingDialogHandler.h" -#include "CEditView.h" -#include "mforms.h" // CFormHTMLArea -#include "macgui.h" // UGraphics::MakeLOColor -#include "CPaneEnabler.h" -#include "resgui.h" // EDITDLG_AUTOSAVE -#include "edt.h" -#include "fe_proto.h" -#include "prefapi.h" // PREF_GetBoolPref, PREF_GetIntPref -#include "shist.h" // SHIST_GetCurrent -#include "uapp.h" // CFrontApp -#include "CColorPopup.h" - -extern "C" { -#include "xpgetstr.h" -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS -} - -#include "CNSContext.h" // ExtractHyperView - - -// takes pascal-strings -MessageT HandleModalDialog( int id, const unsigned char *prompt1, const unsigned char* prompt2) -{ - StPrepareForDialog prepare; - - StBlockingDialogHandler handler( id, NULL ); - LDialogBox* dialog = (LDialogBox *)handler.GetDialog(); - if ( prompt1 ) - { - LCaption *caption = (LCaption *)dialog->FindPaneByID( '^1 ' ); - if ( caption ) - caption->SetDescriptor( prompt1 ); - } - if ( prompt2 ) - { - LCaption *caption = (LCaption *)dialog->FindPaneByID( '^2 ' ); - if ( caption ) - caption->SetDescriptor( prompt2 ); - } - - MessageT message; - do { - message = handler.DoDialog(); - } - while ( message == 0 ); - - return message; -} - -/* Set default colors, background from user Preferences via the Page Data structure -*/ -void FE_SetNewDocumentProperties(MWContext * pContext) -{ - if ( pContext && pContext->is_editor && pContext->bIsComposeWindow ) - return; - - EDT_PageData *pageData = EDT_NewPageData(); - - if (pageData == NULL) return; - - if (CPrefs::GetBoolean(CPrefs::EditorUseCustomColors )) { - - LO_Color EditorText = UGraphics::MakeLOColor(CPrefs::GetColor(CPrefs::EditorText)); - LO_Color EditorLink = UGraphics::MakeLOColor(CPrefs::GetColor(CPrefs::EditorLink)); - LO_Color EditorActiveLink = UGraphics::MakeLOColor(CPrefs::GetColor(CPrefs::EditorActiveLink)); - LO_Color EditorFollowedLink = UGraphics::MakeLOColor(CPrefs::GetColor(CPrefs::EditorFollowedLink)); - LO_Color EditorBackground = UGraphics::MakeLOColor(CPrefs::GetColor(CPrefs::EditorBackground)); - - pageData->pColorText = &EditorText; - pageData->pColorLink= &EditorLink; - pageData->pColorActiveLink = &EditorActiveLink; - pageData->pColorFollowedLink = &EditorFollowedLink; - pageData->pColorBackground = &EditorBackground; - - } else { - - pageData->pColorText = NULL; // I assume this is how we get the browser defaults... - pageData->pColorLink= NULL; - pageData->pColorActiveLink = NULL; - pageData->pColorFollowedLink = NULL; - pageData->pColorBackground = NULL; - - } - - Bool hasBackgroundImage; - if ( ( PREF_GetBoolPref( "editor.use_background_image", &hasBackgroundImage ) == PREF_NOERROR ) - && hasBackgroundImage ) - { - pageData->pBackgroundImage = CPrefs::GetCharPtr(CPrefs::EditorBackgroundImage); - if (pageData->pBackgroundImage && XP_STRLEN(pageData->pBackgroundImage) == 0) // if there is really nothing there, skip it. - pageData->pBackgroundImage = NULL; - } - else - pageData->pBackgroundImage = NULL; - - if ( pContext && pContext->title ) - pageData->pTitle = XP_STRDUP(pContext->title); - - - EDT_SetPageData(pContext, pageData); - - pageData->pColorText = NULL; // don't free out lacal data!!! - pageData->pColorLink= NULL; - pageData->pColorActiveLink = NULL; - pageData->pColorFollowedLink = NULL; - pageData->pColorBackground = NULL; - pageData->pBackgroundImage = NULL; - - EDT_FreePageData(pageData); - - // Set Author name: - -// CStr255 EditorAuthor(CPrefs::GetString(CPrefs::EditorAuthor)); - -// FE_UsersFullName(); - - - EDT_MetaData *metaData = EDT_NewMetaData(); - if (metaData == NULL) return; - metaData->bHttpEquiv = FALSE; - metaData->pName = XP_STRDUP("Author"); - metaData->pContent = XP_STRDUP(CPrefs::GetString(CPrefs::EditorAuthor)); - EDT_SetMetaData(pContext, metaData); - EDT_FreeMetaData(metaData); -} - - -/* - * Brings up a modal image load dialog and returns. Calls - * EDT_ImageLoadCancel() if the cancel button is pressed -*/ -void FE_ImageLoadDialog( MWContext * /* pContext */ ) -{ -} - -/* - * called by the editor engine after the image has been loaded -*/ -void FE_ImageLoadDialogDestroy( MWContext * /* pContext */ ) -{ -} - -void FE_EditorDocumentLoaded( MWContext *pContext ) -{ - if (pContext == NULL || !EDT_IS_EDITOR(pContext)) - return; - - CEditView *editView = (CEditView *)ExtractHyperView(pContext); - CFormHTMLArea *editForm = dynamic_cast(editView); - int32 iSave; - - if ( editForm != NULL) // are we an embedded composer form? - { - iSave = 0; // no auto-save - } - else if ( pContext->bIsComposeWindow ) - { - iSave = 0; // auto-save - - CMailEditView *mailEditView = dynamic_cast(editView); - if ( mailEditView ) - mailEditView->InitMailCompose(); - } - else - { - XP_Bool doAutoSave; - PREF_GetBoolPref( "editor.auto_save", &doAutoSave ); - if ( doAutoSave ) - PREF_GetIntPref( "editor.auto_save_delay", &iSave ); - else - iSave = 0; - } - - EDT_SetAutoSavePeriod(pContext, iSave ); - - // remember when the file was (last) modified - // initializes date/time stamp for external editor warning - EDT_IsFileModified(pContext); - - // We had disabled everything, now we have to enable it again. This happens automatically on activate, but we might not get an activate - // if we don't have a dialog poping up (like if the user just creates a new document, there is no dialog...) - - // set this after calling InitMailCompose - if ( editView ) - { - editView->mEditorDoneLoading = true; - - // set color popup control to show correct default color (now that we have an mwcontext) - if (editView->mColorPopup) editView->mColorPopup->InitializeCurrentColor(); - } - - InitCursor(); - (CFrontApp::GetApplication())->UpdateMenus(); -} - - -Bool FE_CheckAndAutoSaveDocument(MWContext *pContext) -{ - if (pContext == NULL || !EDT_IS_EDITOR(pContext) || ExtractHyperView(pContext) == NULL ) - return FALSE; - - if ( pContext->bIsComposeWindow ) - return FALSE; - - CEditView *editView = (CEditView *)ExtractHyperView(pContext); - if ( FrontWindow() != editView->GetMacPort() ) - return true; - - if (!EDT_DirtyFlag(pContext) && !EDT_IS_NEW_DOCUMENT(pContext)) - return TRUE; - - History_entry* newEntry = SHIST_GetCurrent(&pContext->hist); - CStr255 fileName; - if ( newEntry && newEntry->address ) - fileName = newEntry->address; - - MessageT itemHit = HandleModalDialog(EDITDLG_AUTOSAVE, fileName, NULL ); - if (itemHit != ok) - return FALSE; - - return ((CEditView *)ExtractHyperView(pContext))->SaveDocument(); -} - - -void FE_FinishedSave( MWContext * /* pMWContext */, int /* status */, char * /* pDestURL */, int /* iFileNumber */ ) -{ -} - -ED_CharsetEncode FE_EncodingDialog( MWContext* pContext, char *pCharset ) -{ - StPrepareForDialog prepare; - - StBlockingDialogHandler handler( EDITDLG_ENCODING, NULL ); - LDialogBox* dialog = (LDialogBox *)handler.GetDialog(); - LGARadioButton *change_charset = (LGARadioButton *)dialog->FindPaneByID( 'ccst' ); //radio button for Change Charset - LGARadioButton *change_metatag = (LGARadioButton *)dialog->FindPaneByID( 'cmta' ); //radio button for Change Meta-tag - LCaption *charset_capt = (LCaption *)dialog->FindPaneByID( 'cap1' ); - LCaption *metatag_capt = (LCaption *)dialog->FindPaneByID( 'cap2' ); - - int iBufLen = 255; - char buf[256]; - char *pCharsetMsg = NULL; - char *pMetatagMsg = NULL; - PR_snprintf(buf, iBufLen, "Convert the Current Page to \"%s\"", pCharset); - pCharsetMsg = PR_sprintf_append(pCharsetMsg, buf); - PR_snprintf(buf, iBufLen, "Change the Character Set Label to \"%s\"", pCharset); - pMetatagMsg = PR_sprintf_append(pMetatagMsg, buf); - - change_charset->SetDescriptor ( (CStr255) pCharsetMsg ); - change_metatag->SetDescriptor ( (CStr255) pMetatagMsg ); - charset_capt->SetDescriptor ( (CStr255) XP_GetString(XP_EDT_CHARSET_CONVERT_PAGE) ); - metatag_capt->SetDescriptor ( (CStr255) XP_GetString(XP_EDT_CHARSET_SET_METATAG) ); - - MessageT message; - do { - dialog->Show(); - message = handler.DoDialog(); - } while ( message == 0 || message == msg_ControlClicked ); - // doesn't matter if the user merely switches between radio buttons (msg_ControlClicked) - // stop only when the message is msg_OK or msg_Cancel - - switch (message) - { - case msg_OK: - if ( change_charset->GetValue() ) return ED_ENCODE_CHANGE_CHARSET; - else if ( change_metatag->GetValue() ) return ED_ENCODE_CHANGE_METATAG; - default: // only msg_Cancel should get here, since there is always one radio button selected at any given time - return ED_ENCODE_CANCEL; - } -} - -// in xp_file.h -// Create a backup filename for renaming current file before saving data -// Input should be be URL file type "file:///..." -// Caller must free the string with XP_FREE - -/* - * I don't know what the logic here should be, so I mostly copied this from the Windows code in: - * src/ns/cmd/winfe/fegui.cpp#XP_BackupFileName() - * (I didn't copy all the Windows code which deals with 8.3 filenames.) - */ - -char * XP_BackupFileName( const char * szURL ) -{ - // Must have "file:" URL type and at least 1 character after "///" - if ( szURL == NULL || !NET_IsLocalFileURL((char*)szURL) || XP_STRLEN(szURL) <= 8 ) - return NULL; - - // Add extra space for '\0' and '.BAK', but subtract space for "file:///" - - char *szFileName = (char *)XP_ALLOC((XP_STRLEN(szURL)+1+4-7)*sizeof(char)); - if ( szFileName == NULL ) - return NULL; - - // Get filename but ignore "file:///" - -// { -// char* filename = WH_FileName(szURL+7, xpURL); -// if (!filename) return NULL; -// XP_STRCPY(szFileName,filename); -// XP_FREE(filename); -// } - XP_STRCPY(szFileName, szURL+7); - - // Add extension to the filename - XP_STRCAT( szFileName, ".BAK" ); - - return szFileName; -} - - - -// If pszLocalName is not NULL, we return the full pathname -// in local platform syntax, even if file is not found. -// Caller must free this string. -// Returns TRUE if file already exists -// - -/* - * I don't know what the logic here should be, so I mostly copied this from the Windows code in: - * src/ns/cmd/winfe/fegui.cpp#XP_ConvertUrlToLocalFile() - * (I didn't copy all the Windows code which deals with 8.3 filenames.) - */ - -// The results of this call are passed directly to functions like XP_Stat and XP_FileOpen. -// brade--use xpURL format -Bool XP_ConvertUrlToLocalFile(const char * szURL, char **pszLocalName) // return TRUE if the file exists!! or return FALSE; -{ - // Default assumes no file found - no local filename - - Boolean bFileFound = FALSE; - if ( pszLocalName ) - *pszLocalName = NULL; - - // if "file:///Untitled" fail to convert - if ( szURL && XP_STRCMP( szURL, XP_GetString(XP_EDIT_NEW_DOC_NAME) ) == 0 ) - return bFileFound; - - // Must have "file:" URL type and at least 1 character after "///" - if ( szURL == NULL || !NET_IsLocalFileURL((char*)szURL) || XP_STRLEN(szURL) <= 8 ) - return FALSE; - - - // Extract file path from URL: e.g. "/c|/foo/file.html" - - char *szFileName = NET_ParseURL( szURL, GET_PATH_PART); - if (szFileName == NULL) - return FALSE; - - // NET_UnEscape(szFileName); This will be done in WH_FileName, so don't unescape twice. - - // Test if file exists - XP_StatStruct statinfo; - if ( -1 != XP_Stat(szFileName, &statinfo, xpURL) // if the file exists - && statinfo.st_mode & S_IFREG ) // and its a normal file - bFileFound = TRUE; // We found it! - - if ( pszLocalName ) - { - // Pass string to caller - *pszLocalName = WH_FileName(szFileName, xpURL); - if (szFileName) - XP_FREE( szFileName ); - } - else - XP_FREE(szFileName); - - return bFileFound; -} diff --git a/mozilla/cmd/macfe/Composer/meditor.h b/mozilla/cmd/macfe/Composer/meditor.h deleted file mode 100644 index b77de6d48a5..00000000000 --- a/mozilla/cmd/macfe/Composer/meditor.h +++ /dev/null @@ -1,19 +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. - */ - -MessageT HandleModalDialog( int id , const unsigned char *prompt0, const unsigned char* prompt1); diff --git a/mozilla/cmd/macfe/MANIFEST b/mozilla/cmd/macfe/MANIFEST deleted file mode 100644 index e20b9d87d2b..00000000000 --- a/mozilla/cmd/macfe/MANIFEST +++ /dev/null @@ -1,3 +0,0 @@ -# -# This is a list of local files which get copied to the mozilla:dist directory -# diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/AddressBook.cnst b/mozilla/cmd/macfe/MailNews/AddressBook/AddressBook.cnst deleted file mode 100644 index aaa044295d8..00000000000 Binary files a/mozilla/cmd/macfe/MailNews/AddressBook/AddressBook.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CABContainerDialogs.cp b/mozilla/cmd/macfe/MailNews/AddressBook/CABContainerDialogs.cp deleted file mode 100644 index 30fcf2669b7..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CABContainerDialogs.cp +++ /dev/null @@ -1,247 +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. - */ - -#include "rosetta.h" -#include "CABContainerDialogs.h" -#include "ABcom.h" -#ifdef MOZ_NEWADDR -#include "xp_mcom.h" -#include "msgnet.h" -#include "prefapi.h" -#include "dirprefs.h" - -#include "CValidEditField.h" - -#include "RandomFrontEndCrap.h" - -#include "pascalString.h" - - -#include "CTSMEditField.h" -#include "LGAPushButton.h" -#include "LGACheckbox.h" -#include "LGADialogBox.h" -#include "UmodalDialogs.h" -#include "PP_Messages.h" -#include "macgui.h" - -CLDAPPropertyDialogManager::CLDAPPropertyDialogManager( DIR_Server* server, MSG_Pane* inPane ) -{ - StDialogHandler dialogHandler( eLDAPServerPropertiesDialogResID, NULL ); - LGADialogBox* dialog = dynamic_cast( dialogHandler.GetDialog() ) ; - Assert_( dialog ); - Setup( dialog, server ); - - if( dialog ) - { - dialog->Show(); - MessageT theMessage = msg_Nothing; - while ( (theMessage != msg_Cancel) && (theMessage != msg_OK) ) - { - theMessage = dialogHandler.DoDialog(); - switch( theMessage ) - { - case cmd_HelpButton: // help button - // ShowHelp(mHelpTopic); - break; - - // toggle the port numbers in the port field - case eGarbledBox: - Int32 value = eLDAPStandardPort; - if (mGarbledBox->GetValue()) - value = eLDAPGarbledPort; - mPortNumber->SetValue(eLDAPGarbledPort); - break; - - case eUpdateButton: - UpdateDirServerToUI (); - // The Net_ReplicationDirectory call requires that this flag be set - DIR_ForceFlag( mServer, DIR_REPLICATION_ENABLED, true ); - NET_ReplicateDirectory( NULL, mServer ); - break; - case msg_OK: - - if( !UpdateDirServerToUI() ) - theMessage = msg_Nothing; - break; - default: - break; - } - } - - if ( theMessage == msg_OK ) - { - // I think I am supposed to go context digging for the pane? - AB_UpdateDIRServerForContainerPane( inPane, mServer ); - } - } -} - -Boolean CLDAPPropertyDialogManager::UpdateDirServerToUI() -{ - // first check to make sure that the two validated edit fields are ok. If not, - // then break out of here and don't accept the OK, forcing the user to - // fix them. - Boolean rtnValue = true; - if ( !MaxHitsValidationFunc(mPortNumber) || !PortNumberValidationFunc(mMaxHits) ) - rtnValue = false; - - XP_FREEIF(mServer->searchBase); - XP_FREEIF(mServer->serverName); - XP_FREEIF(mServer->description); - - CStr255 pBuffer; - mDescription->GetDescriptor(pBuffer); - mServer->description = XP_STRDUP(CStr255( pBuffer ) ); - mLdapServer->GetDescriptor(pBuffer); - mServer->serverName = XP_STRDUP(CStr255( pBuffer )); - mSearchRoot->GetDescriptor(pBuffer); - mServer->searchBase = XP_STRDUP(CStr255( pBuffer )); - - DIR_ForceFlag( mServer, DIR_REPLICATION_ENABLED, mDownloadCheckBox->GetValue( ) ); - mServer->port = mPortNumber->GetValue(); - mServer->maxHits = mMaxHits->GetValue(); - - HG51388 - mServer->savePassword = mSavePasswordBox->GetValue()? true: false; - DIR_SetServerFileName(mServer, mServer->serverName); - return rtnValue; -} - - -void CLDAPPropertyDialogManager::Setup( LGADialogBox* inDialog , DIR_Server *inServer ) -{ - mServer = inServer; - - mDescription = (CTSMEditField *) inDialog->FindPaneByID(eDescriptionEditField); - XP_ASSERT(mDescription); - mLdapServer = (LEditField *) inDialog->FindPaneByID(eLDAPServerEditField); - XP_ASSERT(mLdapServer); - mSearchRoot = (LEditField *) inDialog->FindPaneByID(eSearchRootEditField); - XP_ASSERT(mSearchRoot); - mPortNumber = (CValidEditField *) inDialog->FindPaneByID(ePortNumberEditField); - XP_ASSERT(mPortNumber); - mMaxHits = (CValidEditField *) inDialog->FindPaneByID(eMaxHitsEditField); - XP_ASSERT(mMaxHits); - mGarbledBox = (LGACheckbox *) inDialog->FindPaneByID(eGarbledBox); - XP_ASSERT(mGarbledBox); - mSavePasswordBox = dynamic_cast(inDialog->FindPaneByID ( eSaveLDAPServerPasswordBox) ); - Assert_( mSavePasswordBox ); - mDownloadCheckBox = dynamic_cast( inDialog->FindPaneByID ( eDownloadCheckBox ) ); - Assert_( mDownloadCheckBox ); - - UReanimator::LinkListenerToControls( inDialog, inDialog, eLDAPServerPropertiesDialogResID ); - - mPortNumber->SetValidationFunction(PortNumberValidationFunc); - mMaxHits->SetValidationFunction(MaxHitsValidationFunc); - - mDescription->SetDescriptor(CStr255( mServer->description) ); - mLdapServer->SetDescriptor(CStr255 (mServer->serverName )); - mSearchRoot->SetDescriptor(CStr255( mServer->searchBase )); - mDownloadCheckBox->SetValue( DIR_TestFlag( mServer, DIR_REPLICATION_ENABLED ) ); - mPortNumber->SetValue(mServer->port); - mMaxHits->SetValue(mServer->maxHits); - - HG51389 - mSavePasswordBox->SetValue(mServer->savePassword ? 1: 0); - - // If the directories are locked, disable everything but cancel so the user can't make any changes. This - // allows them to view the information but not edit it. - XP_Bool serversLocked = PREF_PrefIsLocked("ldap_1.number_of_directories"); - if ( serversLocked ) - { - inDialog->Disable(); - LGAPushButton *canelButton = (LGAPushButton *)(inDialog->FindPaneByID('CnBt') ); - XP_ASSERT(canelButton); - canelButton->Enable(); - } -} - - -Boolean CLDAPPropertyDialogManager::PortNumberValidationFunc(CValidEditField *portNumber) -// Makes sure the port number field of the dialog is between 0 and 32767, but sets -// a reasonable default if the field is left blank. -{ - Boolean result; - Str255 currentValue; - portNumber->GetDescriptor(currentValue); - if (!currentValue[0]) - { - portNumber->SetValue(eLDAPStandardPort); - HG51387 - portNumber->SelectAll(); - result = false; - } - else - { - result = ConstrainEditField(portNumber, 0, 32767); - } - if (!result) - { - StPrepareForDialog prepare; - ::StopAlert(1068, NULL); - } - return result; -} - - -Boolean CLDAPPropertyDialogManager::MaxHitsValidationFunc(CValidEditField *maxHits) -// Makes sure the max hits field of the dialog is between 1 and 65535. -{ - Boolean result; - result = ConstrainEditField(maxHits, 1, 65535); - if (!result) - { - // If it was constrained to 1 then make it 100 instead. - if (1 == maxHits->GetValue() ) - { - maxHits->SetValue(100); - maxHits->SelectAll(); - } - StPrepareForDialog prepare; - ::StopAlert(1069, NULL); - } - return result; -} - -#pragma mark --CPABPropertyDialogManager-- -CPABPropertyDialogManager::CPABPropertyDialogManager( DIR_Server *inServer, MSG_Pane* inPane ) -{ - StDialogHandler dialogHandler( ePABPropertyWindowID, NULL ); - LGADialogBox* dialog = dynamic_cast( dialogHandler.GetDialog() ) ; - Assert_( dialog ); - - LGAEditField* nameField = dynamic_cast( dialog->FindPaneByID( eNamePaneID ) ); - nameField->SetDescriptor( CStr255 ( inServer->description ) ); - - MessageT theMessage = msg_Nothing; - while ( (theMessage != msg_Cancel) && (theMessage != msg_OK) ) - { - theMessage = dialogHandler.DoDialog(); - } - - if ( theMessage == msg_OK ) - { - XP_FREEIF( inServer->description ); - CStr255 pBuffer; - nameField->GetDescriptor(pBuffer); - inServer->description = XP_STRDUP(CStr255( pBuffer ) ); - AB_UpdateDIRServerForContainerPane( inPane, inServer ); - } -} -#endif diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CABContainerDialogs.h b/mozilla/cmd/macfe/MailNews/AddressBook/CABContainerDialogs.h deleted file mode 100644 index 00340eeae8d..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CABContainerDialogs.h +++ /dev/null @@ -1,95 +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. - */ - - -typedef struct MSG_Pane MSG_Pane; -typedef struct DIR_Server DIR_Server; -class CValidEditField; -class LEditField; -class LGACheckbox; -class LGADialogBox; -class CTSMEditField; - - -//------------------------------------------------------------------------------ -// ¥ CLDAPPropertyDialogManager -//------------------------------------------------------------------------------ - -class CLDAPPropertyDialogManager -{ -public: - CLDAPPropertyDialogManager( DIR_Server* ioServer, MSG_Pane* inPane ); -private: - Boolean UpdateDirServerToUI(); - void Setup( LGADialogBox* inDialog , DIR_Server *inServer ); - - -public: - // PUBLIC CONSTANTS - enum { - class_ID = 'LDSP', - eLDAPServerPropertiesDialogResID = 12002, - cmd_HelpButton = 3 - }; - - // Port ID's - enum { - eLDAPStandardPort = 389, - eLDAPGarbledPort = 636 - }; - - // Pane ID's for dialog - enum { - eDescriptionEditField = 10, - eLDAPServerEditField, - eSearchRootEditField, - ePortNumberEditField, - eMaxHitsEditField, - eGarbledBox = 20, - eSaveLDAPServerPasswordBox = 21, - eUpdateButton = 22, - eDownloadCheckBox = 23 - }; - - static Boolean MaxHitsValidationFunc(CValidEditField *maxHits) ; - static Boolean PortNumberValidationFunc(CValidEditField *portNumber) ; -private: - const char* mHelpTopic; // help string for NetHelp - DIR_Server* mServer; // the LDAP server - - CTSMEditField* mDescription; // Items in dialog - LEditField* mLdapServer; - LEditField* mSearchRoot; - CValidEditField* mPortNumber; - CValidEditField* mMaxHits; - LGACheckbox* mGarbledBox; - LGACheckbox* mSavePasswordBox; - LGACheckbox* mDownloadCheckBox; -}; - -//------------------------------------------------------------------------------ -// ¥ CPABPropertyDialogManager -//------------------------------------------------------------------------------ - -class CPABPropertyDialogManager -{ - enum { eNamePaneID = 'NmEd' }; - enum { ePABPropertyWindowID = 8995 }; -public: - CPABPropertyDialogManager( DIR_Server *inServer, MSG_Pane* inPane ); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookViews.cp b/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookViews.cp deleted file mode 100644 index 439ddfeae7e..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookViews.cp +++ /dev/null @@ -1,1481 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// CAddressBookViews.cp -#include "CAddressBookViews.h" -#include "CAddressBookWindows.h" -#ifdef MOZ_NEWADDR - - -#include "SearchHelpers.h" -#include "MailNewsgroupWindow_Defines.h" -#include "Netscape_Constants.h" -#include "resgui.h" -#include "CMailNewsWindow.h" -#include "CMailNewsContext.h" -#include "UGraphicGizmos.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "UStdDialogs.h" -#include "macutil.h" -#include "UStClasses.h" -#include -#include -#include "divview.h" -#include "CTargetFramer.h" -#include "msgcom.h" -// get string constants -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS - -#include "UProcessUtils.h" -#include "CAppleEventHandler.h" -#include "secnav.h" -#include "CTableKeyAttachment.h" -#include "intl_csi.h" -#include "xp_help.h" -#include "CLDAPQueryDialog.h" -#include "StSetBroadcasting.h" -#include "UAddressBookUtilities.h" -#include "NetscapeDragFlavors.h" -#include "CKeyStealingAttachment.h" -#include "UMailSelection.h" -#pragma mark - - -#define AssertFail_(test) ThrowIfNot_(test) -struct SAddressDelayedDragInfo -{ - CMailSelection mDragSelection; - AB_ContainerInfo* mDragContainer; - AB_DragEffect mDragRequest; -}; - -//------------------------------------------------------------------------------ -// ¥ CAddressBookPane -//------------------------------------------------------------------------------ -// Is the base class for tables which use the addressbook API's -// - -//------------------------------------------------------------------------------ -// ¥ CAddressBookPane -//------------------------------------------------------------------------------ -// -CAddressBookPane::CAddressBookPane(LStream *inStream) : Inherited(inStream), mContainer ( NULL ), mDelayedDragInfo ( false ) -{ - SetRefreshAllWhenResized(false); - mColumnSortCommand [ 0 ]= AB_SortByColumnID0; mColumnAttribID[ 0 ] = AB_attribEntryType; - mColumnSortCommand [ 1 ]= AB_SortByColumnID1; mColumnAttribID[ 1 ] = AB_attribDisplayName; - mColumnSortCommand [ 2 ]= AB_SortByColumnID2; mColumnAttribID[ 2 ] = AB_attribEmailAddress; - mColumnSortCommand [ 3 ]= AB_SortByColumnID3; mColumnAttribID[ 3 ] = AB_attribCompanyName; - mColumnSortCommand [ 4 ]= AB_SortByColumnID4; mColumnAttribID[ 4 ] = AB_attribNickName; - mColumnSortCommand [ 5 ]= AB_SortByColumnID5; mColumnAttribID[ 5 ] = AB_attribLocality; -} - -//------------------------------------------------------------------------------ -// ¥ GetFullAddress -//------------------------------------------------------------------------------ -// Gets an email address for a given row by combining fullname and email address -// MSG_MakeFullAddress should be replaced by the address book equivalent when -// available -// -char* CAddressBookTableView::GetFullAddress( TableIndexT inRow ) -{ - StABEntryAttribute fullName( GetMessagePane(), inRow, AB_attribFullName ); - StABEntryAttribute email( GetMessagePane(), inRow, AB_attribEmailAddress); - return MSG_MakeFullAddress( fullName.GetChar(), email.GetChar() ); -} - - -//------------------------------------------------------------------------------ -// ¥ CurrentBookIsPersonalBook -//------------------------------------------------------------------------------ -// Checks to see if the currenlty loaded container is a PAB -// -Boolean CAddressBookPane::CurrentBookIsPersonalBook() -{ - - Boolean returnResult = false; - if ( mContainer ) - { - AB_ContainerAttribValue * value; - AB_GetContainerAttribute( mContainer, attribContainerType ,& value); - if( value->u.containerType == AB_PABContainer ) - returnResult = true; - AB_FreeContainerAttribValue( value ); - } - return returnResult; -} - - -//------------------------------------------------------------------------------ -// ¥ DrawCellContents -//------------------------------------------------------------------------------ -// Over ride CStandardFlexTable. If the cell is AB_attribEntryType an icon is -// drawn. Otherwise a string is drawn -// -void CAddressBookPane::DrawCellContents(const STableCell &inCell, const Rect &inLocalRect) -{ - ResIDT icon = 0; - CStr255 displayString; - GetCellDisplayData ( inCell, icon, displayString ); - if ( icon ) - { - ResIDT iconID = GetIconID(inCell.row); - IconTransformType transformType = kTransformNone; - - if (iconID) - DrawIconFamily(iconID, 16, 16, transformType, inLocalRect); - } - else - { - - DrawTextString( displayString , &mTextFontInfo, 0, inLocalRect); - } - if (inCell.row == mDropRow) - ::InvertRect(&inLocalRect); -} - -void CAddressBookPane::GetCellDisplayData(const STableCell &inCell, ResIDT& ioIcon, CStr255 &ioDisplayString ) -{ - - AB_AttribID attrib = GetAttribForColumn( inCell.col ); - if ( attrib == AB_attribEntryType ) - { - ioIcon = GetIconID( inCell.row ); - } - else - { - - StABEntryAttribute value ( GetMessagePane(), inCell.row , attrib ); - ioDisplayString = value.GetChar(); - } -} - -//------------------------------------------------------------------------------ -// ¥ GetIconID -//------------------------------------------------------------------------------ -// Over ride CStandardFlexTable. -// -ResIDT CAddressBookPane::GetIconID(TableIndexT inRow) const -{ - ResIDT iconID = 0; - - StABEntryAttribute value ( GetMessagePane(), inRow , AB_attribEntryType ); - - switch( value.GetEntryType() ) - { - case AB_Person: - iconID = ics8_Person; - break; - - case AB_MailingList: - iconID = ics8_List; - break; - - default: - Assert_( 0 ); // Shouldn't be happening - break; - }; - - return iconID; -} - -//------------------------------------------------------------------------------ -// ¥ DrawCellText -//------------------------------------------------------------------------------ -// Gets the given attribute string for the cell and draws it in the passed in the passed in Rect -// -void CAddressBookPane::DrawCellText( const STableCell& inCell, const Rect& inLocalRect, AB_AttribID inAttrib ) -{ - - StABEntryAttribute value ( GetMessagePane(), inCell.row , inAttrib ); - - DrawTextString( value.GetChar(), &mTextFontInfo, 0, inLocalRect); - if (inCell.row == mDropRow) - ::InvertRect(&inLocalRect); -} - - - -//------------------------------------------------------------------------------ -// ¥ AddRowDataToDrag -//------------------------------------------------------------------------------ -// Adds the type text to the drag. The text data is the full email address (ie "John Doe " ) -// -void CAddressBookTableView::AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef) -{ -#if 0 - char* fullName = GetFullAddress( inRow ); - if( fullName ) - { - Size size = XP_STRLEN ( fullName ); - OSErr err = ::AddDragItemFlavor(inDragRef, inRow, 'TEXT', - fullName, size, 0 ); - XP_FREEIF( fullName ); - FailOSErr_(err); - } -#else -#pragma unused(inRow) -#pragma unused(inDragRef) -#endif -} - - -//------------------------------------------------------------------------------ -// ¥ SortCommandFromColumnType -//------------------------------------------------------------------------------ -// Convert a FE column type into an AB_CommandType -// -AB_CommandType CAddressBookPane::SortCommandFromColumnType(EColType inColType) -{ - Int32 index = inColType - eTableHeaderBase; - return mColumnSortCommand[ index ]; -} - - -//------------------------------------------------------------------------------ -// ¥ GetAttribForColumn -//------------------------------------------------------------------------------ -// Converts a FE column enumeration into a AB_AttribID -// -AB_AttribID CAddressBookPane::GetAttribForColumn( TableIndexT col ) -{ - STableCell cell (1, col ); - PaneIDT id = GetCellDataType(cell) ; - Int32 index = id - eTableHeaderBase; - return mColumnAttribID[ index ]; -} - - -//------------------------------------------------------------------------------ -// ¥ FindCommandStatus -//------------------------------------------------------------------------------ -// Overrides LCommander -// -void CAddressBookPane:: FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName) -{ - - CStandardFlexTable::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - -} - - -//------------------------------------------------------------------------------ -// ¥ ObeyCommand -//------------------------------------------------------------------------------ -// Overrides LCommander -// -Boolean CAddressBookPane::ObeyCommand(CommandT inCommand, void *ioParam) -{ - Boolean rtnVal = true; - - switch ( inCommand ) { - - case CAddressBookPane::eCol0: - case CAddressBookPane::eCol1: - case CAddressBookPane::eCol2: - case CAddressBookPane::eCol3: - case CAddressBookPane::eCol4: - case CAddressBookPane::eCol5: - GetTableHeader()->SimulateClick(inCommand); - rtnVal = true; - break; - - case CAddressBookPane::cmd_SortAscending: - case CAddressBookPane::cmd_SortDescending: - GetTableHeader()->SetSortOrder(inCommand == CAddressBookPane::cmd_SortDescending); - break; - - default: - AB_CommandType abCommand = UAddressBookUtilites::GetABCommand( inCommand); - rtnVal = UAddressBookUtilites::ABCommand( this, abCommand) == AB_SUCCESS ; - if ( !rtnVal ) - rtnVal = Inherited::ObeyCommand(inCommand, ioParam); - break; - } - - return rtnVal; -} - -//------------------------------------------------------------------------------ -// ¥ OpenRow -//------------------------------------------------------------------------------ -// Overrides CStandardFlexTable -// Delegates to ObeyCommand -// -void CAddressBookPane::OpenRow(TableIndexT inRow) -{ - ObeyCommand( UAddressBookUtilites::cmd_EditProperties, (void*)inRow ); -} - -//------------------------------------------------------------------------------ -// ¥ DeleteSelection -//------------------------------------------------------------------------------ -// Overrides CStandardFlexTable -// Delegates to ObeyCommand -// -void CAddressBookPane::DeleteSelection() -{ - ObeyCommand( UAddressBookUtilites::cmd_DeleteEntry, nil ); -} - - -//------------------------------------------------------------------------------ -// ¥ DestroyMessagePane -//------------------------------------------------------------------------------ -// -void CAddressBookPane::DestroyMessagePane(MSG_Pane* inPane) -{ - if ( inPane != nil ) - { - ::SetCursor(*::GetCursor(watchCursor)); // Could take forever - AB_ClosePane( inPane ); - } -} - - -//----------------------------------- -Boolean CAddressBookPane::ItemIsAcceptable( - DragReference inDragRef, - ItemReference inItemRef ) -//----------------------------------- -{ - FlavorFlags flavorFlags; - if (::GetFlavorFlags(inDragRef, inItemRef, mDragFlavor, &flavorFlags) == noErr) - { - CMailSelection selection; - if (!mIsInternalDrop && GetSelectionFromDrag(inDragRef, selection)) - mIsInternalDrop = (selection.xpPane == GetMessagePane()); - return true; - } - return false; -} // CMessageFolderView::ItemIsAcceptable - -//------------------------------------------------------------------------------ -// ¥ RowCanAcceptDrop -//------------------------------------------------------------------------------ -// -Boolean CAddressBookPane::RowCanAcceptDrop( DragReference inDragRef, TableIndexT inDropRow) -{ - Boolean dropOK = false; - - SInt16 modifiers; - ::GetDragModifiers(inDragRef, NULL, &modifiers, NULL); - Boolean doCopy = ((modifiers & optionKey) != 0); - CMailSelection selection; - AB_DragEffect effect; - AB_DragEffect desiredAction = AB_Default_Drag; - if ( doCopy ) - desiredAction = AB_Require_Copy; - if (inDropRow >= 1 && inDropRow <= mRows) - { - if (!GetSelectionFromDrag(inDragRef, selection )) - return false; // Should handle text drags - AB_ContainerInfo* container = GetContainer( inDropRow ); - effect = AB_DragEntriesIntoContainerStatus( - GetMessagePane(), selection.GetSelectionList(), selection.selectionSize, container, desiredAction ); - } - - if ( effect == AB_Require_Copy) - doCopy = true; - - if ( effect > 0 ) - dropOK = true; - - if (dropOK && doCopy) - { - CursHandle copyDragCursor = ::GetCursor(6608); // finder's copy-drag cursor - if (copyDragCursor != nil) - ::SetCursor(*copyDragCursor); - } - else - ::SetCursor(&qd.arrow); - - return dropOK; -} - - -//------------------------------------------------------------------------------ -// ¥ RowCanAcceptDropBetweenAbove -//------------------------------------------------------------------------------ -// -Boolean CAddressBookPane::RowCanAcceptDropBetweenAbove( - DragReference inDragRef, - TableIndexT inDropRow) -{ - if (inDropRow >= 1 && inDropRow <= mRows) - { - AB_DragEffect effect; - AB_DragEffect desiredAction = AB_Default_Drag; - CMailSelection selection; - if (GetSelectionFromDrag(inDragRef, selection)) - { - AB_ContainerInfo* container = GetContainer( inDropRow ); - - effect = AB_DragEntriesIntoContainerStatus( - GetMessagePane(), selection.GetSelectionList(), selection.selectionSize, container, desiredAction ); - if( effect > 0 ) - return true; - } - } - return false; -} - - -//------------------------------------------------------------------------------ -// ¥ ReceiveDragItem -//------------------------------------------------------------------------------ -// Drags can potentially bring up dialogs which will hang the machine. So instead of -// doing the drag right away do it during SpendTime -// -void CAddressBookPane::ReceiveDragItem( - DragReference inDragRef, - DragAttributes /* inDragAttrs */, - ItemReference /* inItemRef */, - Rect& /* inItemBounds */) -{ - mDelayedDragInfo = new SAddressDelayedDragInfo; - if ( GetSelectionFromDrag(inDragRef, mDelayedDragInfo->mDragSelection) ) - { - mDelayedDragInfo->mDragContainer = GetContainer( mDropRow ); - mDelayedDragInfo->mDragRequest = AB_Default_Drag; - - StartIdling(); - } - // Should handle text drag -}; - - -//------------------------------------------------------------------------------ -// ¥ SpendTime -//------------------------------------------------------------------------------ -// See ReceiveDragItem -// -void CAddressBookPane::SpendTime(const EventRecord &/* inMacEvent*/) -{ - if ( mDelayedDragInfo ) - { - - AB_DragEntriesIntoContainer( - mDelayedDragInfo->mDragSelection.xpPane, - mDelayedDragInfo->mDragSelection.GetSelectionList(), - mDelayedDragInfo->mDragSelection.selectionSize, - mDelayedDragInfo->mDragContainer, - mDelayedDragInfo->mDragRequest ) ; - delete mDelayedDragInfo; - mDelayedDragInfo = NULL; - - } - - StopIdling(); -} - - -//------------------------------------------------------------------------------ -// ¥ PaneChanged -//------------------------------------------------------------------------------ -// -void CAddressBookPane::PaneChanged(MSG_Pane *inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -{ - switch (inNotifyCode) - { - case MSG_PaneNotifyStartSearching: - EnableStopButton(true); - break; - - case MSG_PaneNotifyStopSearching: - EnableStopButton(false); - break; - - case MSG_PaneNotifyTypeDownCompleted: - if( value != MSG_VIEWINDEXNONE ) - { - UnselectAllCells(); - STableCell cell(value + 1, 1); - SelectCell( cell ); - ScrollCellIntoFrame( cell ); - } - break; - - // Not sure if I will still get this message - case MSG_PaneDirectoriesChanged: - BroadcastMessage( MSG_PaneDirectoriesChanged, NULL ); - break; - default: - Inherited::PaneChanged(inPane, inNotifyCode, value); - break; - } -} - -//------------------------------------------------------------------------------ -// ¥ SetCellExpansion -//------------------------------------------------------------------------------ -// -void CAddressBookPane::SetCellExpansion( const STableCell& inCell, Boolean inExpanded) -{ - Boolean currentlyExpanded; - if (!CellHasDropFlag(inCell, currentlyExpanded) || (inExpanded == currentlyExpanded)) - return; - ToggleExpandAction(inCell.row); -} - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ CAddressBookTableView -//------------------------------------------------------------------------------ -// Table for showing an addressbook contents - -//------------------------------------------------------------------------------ -// ¥ ~CAddressBookTableView -//------------------------------------------------------------------------------ -// -CAddressBookTableView::~CAddressBookTableView() -{ - SetMessagePane( NULL ); -} - - -//------------------------------------------------------------------------------ -// ¥ LoadAddressBook -//------------------------------------------------------------------------------ -// Loads the given container into the table -// Will create initialize the MSG_Pane if necessary -// -Boolean CAddressBookTableView::LoadAddressBook(AB_ContainerInfo *inContainer, MWContext* inContext ) -{ - - Try_ { - ::SetCursor(*::GetCursor(watchCursor)); // Could take forever - if ( GetMessagePane() != nil ) - { - CAddressBookManager::FailAddressError( AB_ChangeABContainer( GetMessagePane(), inContainer) ); - mContainer = inContainer; - mTableHeader->SetSortOrder(false); - } - else - { - - - MSG_Pane* pane; - CAddressBookManager::FailAddressError( - AB_CreateABPane( &pane, inContext, CMailNewsContext::GetMailMaster() ) - ); - SetMessagePane( pane ); - - uint32 pageSize = 25;// Fix this. Should be calculated based on window size and recomputed when the window resizes - AB_SetFEPageSizeForPane( pane, pageSize); - MSG_SetFEData((MSG_Pane *) GetMessagePane(), CMailCallbackManager::Get()); - mContainer = inContainer; - CAddressBookManager::FailAddressError( AB_InitializeABPane( GetMessagePane(), inContainer ) ); - SetColumnHeaders( ); - - // Register callbacks - CAddressBookManager::FailAddressError( - AB_SetShowPropertySheetForEntryFunc ( GetMessagePane(), MacFe_ShowModelessPropertySheetForAB2 )); - } - } - Catch_(inErr) { - SetMessagePane( NULL ); - mContainer = NULL; - Throw_(inErr); - } - EndCatch_ - - return true; -} - - -//------------------------------------------------------------------------------ -// ¥ ConferenceCall -//------------------------------------------------------------------------------ -// Needs to be update for new addressbook API's -// -void CAddressBookTableView::ConferenceCall( ) -{ -#if 0 - TableIndexT selectedRow = 0; - GetNextSelectedRow( selectedRow ); - if ( !CurrentBookIsPersonalBook() ) - return; - - ABID id = GetEntryID( selectedRow ); - char emailAddress[kMaxEmailAddressLength]; - char ipAddress[kMaxCoolAddress]; - short serverType; - AB_GetUseServer( sCurrentBook, CAddressBookManager::GetAddressBook(), id, &serverType ); - AB_GetEmailAddress( sCurrentBook, CAddressBookManager::GetAddressBook(), id, emailAddress ); - AB_GetCoolAddress( sCurrentBook, CAddressBookManager::GetAddressBook(), id, ipAddress ); - - // Check to see if we have all the data we need - if ( (serverType==kSpecificDLS || serverType==kHostOrIPAddress ) && !XP_STRLEN( ipAddress )) - { - FE_Alert( CAddressBookWindow::GetMailContext(), XP_GetString(MK_MSG_CALL_NEEDS_IPADDRESS)); - return; - } - - if ( (serverType==kSpecificDLS || serverType==kDefaultDLS) && !XP_STRLEN( emailAddress )) - { - FE_Alert( CAddressBookWindow::GetMailContext(), XP_GetString(MK_MSG_CALL_NEEDS_EMAILADDRESS)); - return; - } - - char *ipAddressDirect = NULL; - char *serverAddress = NULL; - char *address = NULL; - switch( serverType) - { - case kDefaultDLS: - address = &emailAddress[0]; - break; - case kSpecificDLS: - address = &emailAddress[0]; - serverAddress = &ipAddress[0]; - break; - case kHostOrIPAddress: - ipAddressDirect = &ipAddress[0]; - break; - default: - break; - } - // And now the AE fun begins - AppleEvent event,reply; - OSErr error; - ProcessSerialNumber targetPSN; - Boolean isAppRunning; - static const OSType kConferenceAppSig = 'Ncq¹'; // This needs to be in a header file - // so that uapp and us share it - isAppRunning = UProcessUtils::ApplicationRunning( kConferenceAppSig, targetPSN ); - if( !isAppRunning) - { - ObeyCommand(cmd_LaunchConference, NULL); - isAppRunning = UProcessUtils::ApplicationRunning( kConferenceAppSig, targetPSN ); - } - - if( !isAppRunning ) // for some reason we were unable to open app - return; - Try_ - { - error = AEUtilities::CreateAppleEvent( 'VFON', 'CALL', event, targetPSN ); - ThrowIfOSErr_(error); - - if( ipAddressDirect) - { - error = ::AEPutParamPtr(&event, '----', typeChar, ipAddressDirect, XP_STRLEN(ipAddressDirect) ); - ThrowIfOSErr_(error); - } - - if( address) - { - error = ::AEPutParamPtr(&event, 'MAIL', typeChar, address, XP_STRLEN(address) ); - ThrowIfOSErr_(error); - } - - if( serverAddress ) - { - error = ::AEPutParamPtr(&event, 'SRVR', typeChar, serverAddress, XP_STRLEN(serverAddress) ); - ThrowIfOSErr_(error); - } - - // NULL reply parameter - reply.descriptorType = typeNull; - reply.dataHandle = nil; - - error = AESend(&event,&reply,kAENoReply + kAENeverInteract - + kAECanSwitchLayer+kAEDontRecord,kAENormalPriority,-1,nil,nil); - ThrowIfOSErr_(error); - - UProcessUtils::PullAppToFront( targetPSN ); - - } - Catch_(inError) // in case of errors do nothing - { - } - AEDisposeDesc(&reply); - AEDisposeDesc(&event); -#endif -} - -//------------------------------------------------------------------------------ -// ¥ SetColumnHeaders -//------------------------------------------------------------------------------ -// Updates column headers for a new container -// -void CAddressBookTableView::SetColumnHeaders( ) -{ - - LTableViewHeader* tableHeader = GetTableHeader(); - PaneIDT headerPaneID; - - for (short col = 1; col < tableHeader->CountColumns(); col ++) - { - headerPaneID = tableHeader->GetColumnPaneID(col); - Int32 index = headerPaneID - eTableHeaderBase+1; - AB_ColumnInfo *info = AB_GetColumnInfo( mContainer, AB_ColumnID( index) ); - mColumnAttribID[ col ] = info->attribID; - - LCaption* headerPane = dynamic_cast(FindPaneByID(headerPaneID)); - - if (headerPane) - { - - headerPane->SetDescriptor( CStr255 (info->displayString) ); - } - AB_FreeColumnInfo( info); - } -} - - -//------------------------------------------------------------------------------ -// ¥ ChangeSort -//------------------------------------------------------------------------------ -// called from LTableHeader to change the column that is sorted on -// -void CAddressBookTableView::ChangeSort(const LTableHeader::SortChange *inSortChange) -{ - Assert_(GetMessagePane() != nil); - - AB_CommandType sortCmd = SortCommandFromColumnType((EColType) inSortChange->sortColumnID); - - ::SetCursor(*::GetCursor(watchCursor)); - - // Call BE to sort the table - - CAddressBookManager::FailAddressError(AB_CommandAB2( GetMessagePane(), sortCmd, nil, 0)); -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateToTypedownText -//------------------------------------------------------------------------------ -// -void CAddressBookTableView::UpdateToTypedownText(CStr255 inTypedownText ) -{ - CAddressBookManager::FailAddressError( - AB_TypedownSearch( GetMessagePane(), inTypedownText, MSG_VIEWINDEXNONE) ); -} - - -//------------------------------------------------------------------------------ -// ¥ ChangeFinished -//------------------------------------------------------------------------------ -// If LDAP searching, pass the results to the XP layer before updating -// -void CAddressBookTableView::ChangeFinished(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount) { - - // If it's an initial insert call, and we're doing LDAP search, then simply pass - // this info on to the addressbook backend. We'll get a MSG_NotifyAll when - // the backend thinks we should redraw. - - if ( /* (mMysticPlane < (kMysticUpdateThreshHold + 2)) && */ - (inChangeCode == MSG_NotifyInsertOrDelete) && - IsLDAPSearching() ) { - - AB_LDAPSearchResultsAB2( GetMessagePane(), inStartRow - 1, inRowCount); - } - - - if( inChangeCode == MSG_NotifyLDAPTotalContentChanged ) - { - Inherited::ChangeFinished( inPane, MSG_NotifyScramble, 0, 0 ); - ScrollRowIntoFrame( inStartRow -1 ); - } - else - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - // Because the search is asynchronous, we - // don't want to cause a redraw every time a row is inserted, because that causes - // drawing of rows in random, unsorted order. - - if (inChangeCode == MSG_NotifyInsertOrDelete && IsLDAPSearching()) - DontRefresh(); - else - Refresh(); - -} - -//------------------------------------------------------------------------------ -// ¥ EnableStopButton -//------------------------------------------------------------------------------ -// -void CAddressBookTableView::EnableStopButton(Boolean inBusy) -{ - SetLDAPSearching( inBusy ); - Inherited::EnableStopButton( inBusy); -} - - - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ CMailingListTableView -//------------------------------------------------------------------------------ -// Handle the table in the mailing list window - -//------------------------------------------------------------------------------ -// ¥ ~CMailingListTableView -//------------------------------------------------------------------------------ -// -CMailingListTableView::~CMailingListTableView() -{ - SetMessagePane( NULL ); -} - - -//------------------------------------------------------------------------------ -// ¥ DestroyMessagePane -//------------------------------------------------------------------------------ -// The Window is responsible for disposing the pane since it is the owner -// -void CMailingListTableView::DestroyMessagePane( MSG_Pane* /* inPane */ ) -{ -} - - -//------------------------------------------------------------------------------ -// ¥ LoadMailingList -//------------------------------------------------------------------------------ -// Initializes the MailingList -// -void CMailingListTableView::LoadMailingList(MSG_Pane* inPane) -{ - SetMessagePane( inPane ); - MSG_SetFEData((MSG_Pane *) GetMessagePane(), CMailCallbackManager::Get()); - CAddressBookManager::FailAddressError( AB_InitializeMailingListPaneAB2( GetMessagePane() ) ); -} - -//------------------------------------------------------------------------------ -// ¥ GetContainer -//------------------------------------------------------------------------------ -// -AB_ContainerInfo* CMailingListTableView::GetContainer( TableIndexT /* inRow */ ) -{ - return AB_GetContainerForMailingList( GetMessagePane() ); -} - - -//------------------------------------------------------------------------------ -// ¥ DrawCellContents -//------------------------------------------------------------------------------ -// Over ride CStandardFlexTable. If the cell is AB_attribEntryType an icon is -// drawn. Otherwise a string is drawn -// -void CMailingListTableView::GetCellDisplayData(const STableCell &inCell, ResIDT& ioIcon, CStr255 &ioDisplayString ) -{ - AB_AttribID attrib = GetAttribForColumn( inCell.col ); - ioIcon = 0; - if ( attrib == AB_attribEntryType ) - { - ioIcon = GetIconID(inCell.row); - } - else - { - uint16 numItems = 1; - AB_AttributeValue* value; - CAddressBookManager::FailAddressError( - AB_GetMailingListEntryAttributes(GetMessagePane(), inCell.row-1, &attrib, &value, & numItems) ); - ioDisplayString = value->u.string ; - AB_FreeEntryAttributeValue ( value ); - } -} - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ CAddressBookContainerView -//------------------------------------------------------------------------------ -// Handles displaying the container table - -//------------------------------------------------------------------------------ -// ¥ CAddressBookContainerView -//------------------------------------------------------------------------------ -CAddressBookContainerView::CAddressBookContainerView(LStream *inStream) : - CAddressBookPane(inStream), mDirectoryRowToLoad( 1 ) -{ -}; - - -//------------------------------------------------------------------------------ -// ¥ ~CAddressBookContainerView -//------------------------------------------------------------------------------ -CAddressBookContainerView::~CAddressBookContainerView() -{ - // This must be done here in order to use the correct DestroyMessagePaneFunction - SetMessagePane( NULL ); -} - - -//------------------------------------------------------------------------------ -// ¥ Setup -//------------------------------------------------------------------------------ -// -void CAddressBookContainerView::Setup( MWContext* inContext ) -{ - MSG_Pane *msgPane; - Assert_( inContext ); - CAddressBookManager::FailAddressError ( - AB_CreateContainerPane( &msgPane, inContext, CMailNewsContext::GetMailMaster() ) ); - SetMessagePane( msgPane ); - // I think this should be done in set pane - MSG_SetFEData( (MSG_Pane *) msgPane, CMailCallbackManager::Get() ); - - CAddressBookManager::FailAddressError ( - AB_InitializeContainerPane( GetMessagePane() ) ); - - CAddressBookManager::FailAddressError( - AB_SetShowPropertySheetForEntryFunc ( GetMessagePane(), MacFe_ShowModelessPropertySheetForAB2 )); - - CAddressBookManager::FailAddressError( - AB_SetShowPropertySheetForDirFunc ( GetMessagePane(), MacFE_ShowPropertySheetForDir )); - SelectRow( mDirectoryRowToLoad ) ; -} - - -//------------------------------------------------------------------------------ -// ¥ CellHasDropFlag -//------------------------------------------------------------------------------ -// -Boolean CAddressBookContainerView::CellHasDropFlag( - const STableCell& inCell, - Boolean& outIsExpanded) const -{ - Int32 msgRow = inCell.row-1; - Boolean returnValue = false; - outIsExpanded = false; - - StABContainerAttribute value ( GetMessagePane(), inCell.row ,attribNumChildren ); - - if ( value.GetNumber() ) - { - returnValue = true; - - Int32 expansionDelta = MSG_ExpansionDelta ( GetMessagePane(), msgRow ); - if ( expansionDelta <= 0 ) - outIsExpanded = true; - } - - return returnValue; -} - -//------------------------------------------------------------------------------ -// ¥ GetNestedLevel -//------------------------------------------------------------------------------ -// -UInt16 CAddressBookContainerView::GetNestedLevel(TableIndexT inRow) const -{ - StABContainerAttribute value ( GetMessagePane(), inRow , attribDepth ); - return value.GetNumber(); -} - - -//------------------------------------------------------------------------------ -// ¥ GetIconID -//------------------------------------------------------------------------------ -// -ResIDT CAddressBookContainerView::GetIconID(TableIndexT inRow) const -{ - ResIDT iconID = 0; - StABContainerAttribute value ( GetMessagePane(), inRow , attribContainerType ); - - switch( value.GetContainerType() ) - { - case AB_LDAPContainer: - iconID = ics8_LDAP; - break; - - case AB_MListContainer: - iconID = ics8_List; - break; - - case AB_PABContainer: - iconID = ics8_PAB; - break; - - default: - Assert_( 0 ); // shouldn't be happening - break; - }; - - return iconID; -} - - -//------------------------------------------------------------------------------ -// ¥ DrawCellText -//------------------------------------------------------------------------------ -// -void CAddressBookContainerView::DrawCellText( const STableCell& inCell, const Rect& inLocalRect ) -{ - StABContainerAttribute value ( GetMessagePane(), inCell.row , attribName ); - DrawTextString( value.GetChar(), &mTextFontInfo, 0, inLocalRect); - // Is this a drop target - if (inCell.row == mDropRow) - ::InvertRect(&inLocalRect); -} - - -//------------------------------------------------------------------------------ -// ¥ DrawCellContents -//------------------------------------------------------------------------------ -// -void CAddressBookContainerView::DrawCellContents( const STableCell& inCell, const Rect& inLocalRect) -{ - // Draw the Container Icon - - SInt16 iconRight = DrawIcons(inCell, inLocalRect); - - // Draw the Container name - Rect textRect = inLocalRect; - textRect.left = iconRight+2; - DrawCellText( inCell, textRect ); -} - -//------------------------------------------------------------------------------ -// ¥ DrawIconsSelf -//------------------------------------------------------------------------------ -// CStandardflexTable applies an undesired transform when the row is selected -// -void CAddressBookContainerView::DrawIconsSelf( - const STableCell& inCell, IconTransformType /*inTransformType*/, const Rect& inIconRect) const -{ - ResIDT iconID = GetIconID(inCell.row); - if (iconID) - DrawIconFamily(iconID, 16, 16, kTransformNone, inIconRect); -} - -//------------------------------------------------------------------------------ -// ¥ GetContainer -//------------------------------------------------------------------------------ -// Returns the currently selected container -// -AB_ContainerInfo* CAddressBookContainerView::GetContainer( TableIndexT inRow ) -{ - StABContainerAttribute value ( GetMessagePane(), inRow , attribContainerInfo ); - return value.GetContainerInfo(); -} - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ CAddressBookController -//------------------------------------------------------------------------------ -// Handles the interaction between the container pane, addressbook pane, -// the popup menu and the edit field - -//------------------------------------------------------------------------------ -// ¥ CAddressBookController -//------------------------------------------------------------------------------ -// -CAddressBookController::CAddressBookController(LStream* inStream ) - :LView( inStream), - mNextTypedownCheckTime(eDontCheckTypedown), - mTypedownName(nil), mSearchButton(nil),mStopButton(nil) -{ -}; - - -//------------------------------------------------------------------------------ -// ¥ ~CAddressBookController -//------------------------------------------------------------------------------ -// -CAddressBookController::~CAddressBookController() -{ -}; - - -//------------------------------------------------------------------------------ -// ¥ ReadStatus -//------------------------------------------------------------------------------ -// -void CAddressBookController::ReadStatus(LStream *inStatusData) -{ - mDividedView->RestorePlace(inStatusData); - mAddressBookTable->GetTableHeader()->ReadColumnState(inStatusData); - Int32 index; - *inStatusData >> index; - mABContainerView->SetIndexToSelectOnLoad( index ); -} - - -//------------------------------------------------------------------------------ -// ¥ WriteStatus -//------------------------------------------------------------------------------ -// -void CAddressBookController::WriteStatus(LStream *outStatusData) -{ - mDividedView->SavePlace(outStatusData); - mAddressBookTable->GetTableHeader()->WriteColumnState(outStatusData); - STableCell cell; - cell = mABContainerView->GetFirstSelectedCell(); - *outStatusData << Int32( cell.row); -} - -//------------------------------------------------------------------------------ -// ¥ HandleKeyPress -//------------------------------------------------------------------------------ -// Tab groups don't work since the commanders are not at the same level -// -Boolean CAddressBookController::HandleKeyPress( const EventRecord &inKeyEvent) -{ - Boolean keyHandled = true; - Char16 theChar = inKeyEvent.message & charCodeMask; - - // Process Tab or Shift-Tab. Pass up if there are any other - // modifiers keys pressed. - - if ((theChar == char_Tab) && (( inKeyEvent.modifiers & ( cmdKey + optionKey + controlKey ) )== 0 ) ) - { - Boolean backwards = (inKeyEvent.modifiers & shiftKey) != 0; - LCommander * currentCommander = LCommander::GetTarget(); - int32 commanderToSelect = 0; - LCommander* commanders[3]; - - commanders[0] = dynamic_cast(mTypedownName); - commanders[1] = dynamic_cast(mAddressBookTable); - commanders[2] = dynamic_cast(mABContainerView); - Int32 i = 2; - - while( i>=0 ) - { - if ( commanders[i] == currentCommander ) - { - commanderToSelect = i + ( backwards ? -1 : 1 ); - break; - } - i--; - } - commanderToSelect = (commanderToSelect+3)%3; - Assert_( commanderToSelect >=0 && commanderToSelect<= 2 ); - SwitchTarget( commanders[ commanderToSelect ] ); - } - else - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - - return keyHandled; -} - -//------------------------------------------------------------------------------ -// ¥ FinishCreateSelf -//------------------------------------------------------------------------------ -// Initializes a bunch of member variables, listens to the controls, and adds the target framer -// -void CAddressBookController::FinishCreateSelf() -{ - mAddressBookTable = dynamic_cast( FindPaneByID( paneID_AddressBookTable )); - FailNILRes_(mAddressBookTable); - - mABContainerView = dynamic_cast< CAddressBookContainerView*>( FindPaneByID( paneID_ContainerView ) ); - FailNILRes_( mABContainerView ); - mABContainerView->AddListener( this ); - - mDividedView = dynamic_cast(FindPaneByID( paneID_DividedView )); - FailNILRes_(mDividedView); - - mSearchButton = dynamic_cast(FindPaneByID( paneID_Search)); - FailNILRes_(mSearchButton); - - mStopButton = dynamic_cast(FindPaneByID( paneID_Stop)); - FailNILRes_(mStopButton); - - mTypedownName = dynamic_cast(FindPaneByID( paneID_TypedownName) ); - FailNILRes_(mTypedownName); - mTypedownName->AddListener(this); - - mTypedownName->SetSuperCommander( mAddressBookTable ); - mAddressBookTable->SetSuperCommander(this ); - - UReanimator::LinkListenerToControls(this, this, 8920); - // - CKeyStealingAttachment* keyStealer = new CKeyStealingAttachment(mAddressBookTable); - mTypedownName->AddAttachment(keyStealer); - keyStealer->StealKey( char_UpArrow ); - keyStealer->StealKey( char_DownArrow ); - keyStealer->StealKey( char_PageUp ); - keyStealer->StealKey( char_PageDown ); - - USearchHelper::SelectEditField(mTypedownName); - // Frame Highlighting - CTargetFramer* framer = new CTargetFramer(); - mAddressBookTable->AddAttachment(framer); - - framer = new CTargetFramer(); - mTypedownName->AddAttachment(framer); - SetLatentSub( mTypedownName ); - - framer = new CTargetFramer(); - mABContainerView->AddAttachment(framer); -} - - -//------------------------------------------------------------------------------ -// ¥ ListenToMessage -//------------------------------------------------------------------------------ -// -void CAddressBookController::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch ( inMessage ) - { - case CSearchEditField::msg_UserChangedText: - // User changed the typedeown text - /*if ( mNextTypedownCheckTime == eDontCheckTypedown )*/ { - mNextTypedownCheckTime = LMGetTicks() + eCheckTypedownInterval; - } - break; - - case UAddressBookUtilites::cmd_NewAddressCard: - case UAddressBookUtilites::cmd_NewAddressList: - case UAddressBookUtilites::cmd_EditProperties: - case UAddressBookUtilites::cmd_DeleteEntry: - case UAddressBookUtilites::cmd_ComposeMailMessage: - LCommander::GetTarget()->ProcessCommand( inMessage, NULL ); - break; - - case CStandardFlexTable::msg_SelectionChanged: - // if the message is from the container view, load a new container into mAddressBookTableView - if( ioParam == mABContainerView && mABContainerView->GetSelectedRowCount() == 1) - { - StABContainerAttribute container( mABContainerView->GetMessagePane(), mABContainerView->GetTableSelector()->GetFirstSelectedRow(), attribContainerInfo ); - SelectDirectoryServer( container.GetContainerInfo() ); - } - break; - - case UAddressBookUtilites::cmd_ConferenceCall: - mAddressBookTable->ConferenceCall(); - break; - - // Status messages - case msg_NSCAllConnectionsComplete: - StopSearch( ); - break; - - case paneID_Search: - Search(); - break; - - case paneID_Stop: - StopSearch( ); - break; - - default: - // No superclass method - break; - } - -} - -//------------------------------------------------------------------------------ -// ¥ ObeyCommand -//------------------------------------------------------------------------------ -// -Boolean CAddressBookController::ObeyCommand(CommandT inCommand, void *ioParam) -{ - Boolean cmdHandled = true; - switch ( inCommand ) - { - case paneID_Search: - Search(); - break; - - case paneID_Stop: - StopSearch( ); - break; - - case UAddressBookUtilites::cmd_HTMLDomains: - MSG_DisplayHTMLDomainsDialog( CAddressBookWindow::GetMailContext() ); - break; - - case cmd_SecurityInfo: - MWContext * context = CAddressBookWindow::GetMailContext(); - SECNAV_SecurityAdvisor( context, NULL ); - break; - - default: - CAddressBookPane* pane = mABContainerView; - if ( mABContainerView->IsTarget() ) - pane = mAddressBookTable; - AB_CommandType abCommand = UAddressBookUtilites::GetABCommand( inCommand); - cmdHandled = UAddressBookUtilites::ABCommand( pane, abCommand) == AB_SUCCESS ; - if ( !cmdHandled ) - cmdHandled = LCommander::ObeyCommand(inCommand, ioParam); - break; - } - return cmdHandled; -} - - -//------------------------------------------------------------------------------ -// ¥ SpendTime -//------------------------------------------------------------------------------ -// If enought time has passed either initiate a LDAP search or perform typedown -// -void CAddressBookController::SpendTime(const EventRecord &inMacEvent) -{ - - if ( inMacEvent.when >= mNextTypedownCheckTime ) - { - Assert_(mTypedownName); - Assert_(mAddressBookTable); - - CStr255 typedownText; - mTypedownName->GetDescriptor(typedownText); - if( typedownText.Length() > 0 ) - { - mAddressBookTable->UpdateToTypedownText(typedownText); - } - mNextTypedownCheckTime = eDontCheckTypedown; - } -} - - -//------------------------------------------------------------------------------ -// ¥ SelectDirectoryServer -//------------------------------------------------------------------------------ -// Load the given AB_ContainerInfo into the AddressBookTableView and then update -// the popup menu -// -void CAddressBookController::SelectDirectoryServer( AB_ContainerInfo* inContainer ) -{ - AssertFail_(mAddressBookTable != nil); - SetCursor(*GetCursor(watchCursor)); - - // Load server into address book table - - if ( !mAddressBookTable->LoadAddressBook(inContainer, mContext) ) - return; - DIR_Server* server = AB_GetDirServerForContainer( inContainer ); - - const Boolean isLDAPServer = (server->dirType == LDAPDirectory); - USearchHelper::EnableDisablePane(mSearchButton, isLDAPServer, true); - - USearchHelper::EnableDisablePane(mStopButton, false,true ); - - mAddressBookTable->SetColumnHeaders(); - // Update the name caption - LCaption* nameCaption = dynamic_cast( FindPaneByID( paneID_DirectoryName ) ); - if ( nameCaption ) - { - AB_ContainerAttribValue* value; - CAddressBookManager::FailAddressError( AB_GetContainerAttribute( - inContainer, attribName, &value) ); - nameCaption->SetDescriptor( CStr255(value->u.string ) ); - AB_FreeContainerAttribValue ( value ); - } -} - - -//------------------------------------------------------------------------------ -// ¥ Search -//------------------------------------------------------------------------------ -// handles the Search Button. Brings up a dialog and initiates a search -// -void CAddressBookController::Search() -{ - - if ( GetAddressBookTable()->CurrentBookIsPersonalBook() || - mAddressBookTable->IsLDAPSearching() ) return; - StDialogHandler handler(8980, nil); - - CLDAPQueryDialog* dialog = dynamic_cast< CLDAPQueryDialog*>( handler.GetDialog() ); - Assert_( dialog ); - AB_ContainerInfo* container = mAddressBookTable->GetContainer( 0 ) ; - - DIR_Server* server = AB_GetDirServerForContainer( container ); - dialog->Setup( mAddressBookTable->GetMessagePane(), server ); - - - Boolean doSearch = false; - // Run the dialog - MessageT message; - - do { - message = handler.DoDialog(); - } while (message != paneID_Search && message != msg_Cancel); - - if ( message == paneID_Search ) - { - CAddressBookManager::FailAddressError(AB_SearchDirectoryAB2( mAddressBookTable->GetMessagePane(), NULL)); - - USearchHelper::EnableDisablePane(mSearchButton, false,true); - USearchHelper::EnableDisablePane(mStopButton, true, true); - } -} - - -//------------------------------------------------------------------------------ -// ¥ StopSearch -//------------------------------------------------------------------------------ -// -void CAddressBookController::StopSearch() -{ - - if ( GetAddressBookTable()->CurrentBookIsPersonalBook() || - !mAddressBookTable->IsLDAPSearching() ) return; - AB_FinishSearchAB2( mAddressBookTable->GetMessagePane() ); - - USearchHelper::EnableDisablePane(mStopButton, false,true); - USearchHelper::EnableDisablePane(mSearchButton, true ,true); - USearchHelper::SelectEditField(mTypedownName); - Refresh(); -} - - -void CAddressBookController::FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName) -{ - AB_CommandType abCommand = UAddressBookUtilites::GetABCommand( inCommand); - if ( abCommand != UAddressBookUtilites::invalid_command ) - { - CAddressBookPane* pane = mABContainerView; - if ( mAddressBookTable->IsTarget() ) - pane = mAddressBookTable; - - UAddressBookUtilites::ABCommandStatus( - pane, abCommand, outEnabled, outUsesMark, outMark, outName); - if( !outEnabled ) - { - CAddressBookPane* pane = mABContainerView; - if ( mABContainerView->IsTarget() ) - pane = mAddressBookTable; - UAddressBookUtilites::ABCommandStatus( - pane, abCommand, outEnabled, outUsesMark, outMark, outName); - } - } - else - { - switch ( inCommand ) - { - case cmd_Stop: - outEnabled = mAddressBookTable->IsLDAPSearching(); - break; - case UAddressBookUtilites::cmd_HTMLDomains: - outEnabled = true; - break; - - default: - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } - } -} - -#endif // NEWADDR diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookViews.h b/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookViews.h deleted file mode 100644 index c0c618b62a7..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookViews.h +++ /dev/null @@ -1,327 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// CAddressBookViews.h - -#include "CMailFlexTable.h" - -#include "PascalString.h" -#include "abcom.h" -#include "dirprefs.h" - -class CSearchEditField; -class LDividedView; -class LGAPushButton; -class CPatternProgressCaption; - -// These should be replaced as there is a JS pref -enum { eDontCheckTypedown = 0xFFFFFFFF, eCheckTypedownInterval = 30 /* 1/2 sec */ , eNewTarget = 'NwTg'}; - -struct SAddressDelayedDragInfo; - -#pragma mark CAddressBookPane -//------------------------------------------------------------------------------ -// ¥ CAddressBookPane -//------------------------------------------------------------------------------ -// -class CAddressBookPane : public CMailFlexTable, public LPeriodical -{ -private: - typedef CMailFlexTable Inherited; - -public: - enum EColType - { // Sort column header ids - eTableHeaderBase = 'col0' - , eCol0 = eTableHeaderBase - , eCol1 - , eCol2 - , eCol3 - , eCol4 - , eCol5 - , eCol6 - }; - - enum - { // Command sort - cmd_SortAscending = 'Ascd' - , cmd_SortDescending = 'Dscd' - }; - - enum - { - eInvalidCachedRowIDType = 0x7FFFFFFF - , eNewEntryID = 0x7FFFFFFF - , eInvalidEntryID = 0 - }; - - enum - { // Icon resource IDs - ics8_Person = 15260 - , ics8_List = 15263 - }; - - CAddressBookPane(LStream *inStream); - - - UInt32 SortTypeFromColumnType(EColType inColType); - AB_CommandType SortCommandFromColumnType(EColType inColType); - - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - virtual void FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName); - - virtual void DeleteSelection(); - virtual AB_ContainerInfo* GetContainer( TableIndexT /* inRow */ ) { return mContainer; } - Boolean CurrentBookIsPersonalBook(); - virtual void PaneChanged( MSG_Pane *inPane, MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, int32 value); - virtual Boolean CellInitiatesDrag(const STableCell &/*inCell*/) const { return true; } - virtual Boolean ItemIsAcceptable( DragReference inDragRef, ItemReference inItemRef ); -protected: - virtual void GetCellDisplayData(const STableCell &inCell, ResIDT &ioIcon, CStr255 &ioDisplayString ); - virtual void DestroyMessagePane(MSG_Pane* inPane); - virtual void SpendTime(const EventRecord &inMacEvent); - virtual Boolean CellHasDropFlag(const STableCell &/*inCell*/, Boolean &/*outIsExpanded*/) const { return false; } - virtual void DrawCellContents(const STableCell &inCell, const Rect &inLocalRect); - - - - AB_AttribID GetAttribForColumn( TableIndexT col ); - virtual ResIDT GetIconID(TableIndexT inRow) const; - void DrawCellText( const STableCell& inCell, const Rect& inLocalRect, AB_AttribID inAttrib ); - - - - virtual void OpenRow(TableIndexT inRow); - void SetCellExpansion( const STableCell& inCell, Boolean inExpanded); - - virtual Boolean RowCanAcceptDrop( - DragReference inDragRef, - TableIndexT inDropRow); - virtual Boolean RowCanAcceptDropBetweenAbove( - DragReference inDragRef, - TableIndexT inDropRow); - virtual void ReceiveDragItem( - DragReference inDragRef, - DragAttributes inDragAttrs, - ItemReference inItemRef, - Rect& inItemBounds); -protected: - AB_ContainerInfo* mContainer; - AB_CommandType mColumnSortCommand[7]; - AB_AttribID mColumnAttribID[7]; - // Delayed drag info - SAddressDelayedDragInfo *mDelayedDragInfo; -}; - -#pragma mark CAddressBookTableView -//------------------------------------------------------------------------------ -// ¥ CAddressBookTableView -//------------------------------------------------------------------------------ -// -class CAddressBookTableView : public CAddressBookPane -{ -private: - typedef CAddressBookPane Inherited; - -public: - enum { class_ID = 'AbTb' }; - enum { eTableEditField = 'TbEd' }; - - CAddressBookTableView(LStream *inStream) : - CAddressBookPane(inStream),mIsLDAPSearching ( false ) { - - }; - - virtual ~CAddressBookTableView(); - - Boolean LoadAddressBook( AB_ContainerInfo* inContainer, MWContext* inContext ); - void SetColumnHeaders(); - virtual void ChangeSort(const LTableHeader::SortChange *inSortChange); - void UpdateToTypedownText(CStr255 inTypedownText); - void ConferenceCall( ); - void SetLDAPSearching( Boolean inIsSearching ) { mIsLDAPSearching = inIsSearching; } - char* GetFullAddress( TableIndexT inRow ); - Boolean IsLDAPSearching() const { return mIsLDAPSearching; } -protected: - - virtual void ChangeFinished(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount); - virtual void AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef); - virtual void EnableStopButton(Boolean inBusy); -private: - Boolean mIsLDAPSearching; -}; - - -#pragma mark CMailingListTableView -//------------------------------------------------------------------------------ -// ¥ CMailingListTableView -//------------------------------------------------------------------------------ -// -class CMailingListTableView : public CAddressBookPane -{ - -private: - typedef CAddressBookPane Inherited; - -public: - enum { class_ID = 'AlTb' }; - - enum { // Broadcast messages - msg_EntriesAddedToList = 'EnAd' // this - , msg_EntriesRemovedFromList ='EnRe' - }; - - CMailingListTableView(LStream *inStream) : - CAddressBookPane(inStream) { - - }; - - virtual ~CMailingListTableView(); - void LoadMailingList( MSG_Pane* inPane ); - virtual AB_ContainerInfo* GetContainer( TableIndexT inRow ); - -protected: - virtual void GetCellDisplayData(const STableCell &inCell, ResIDT& ioIcon, CStr255 &ioDisplayString ); - virtual void DestroyMessagePane(MSG_Pane* inPane); -}; - -#pragma mark CAddressBookContainerView -//------------------------------------------------------------------------------ -// ¥ CAddressBookContainerView -//------------------------------------------------------------------------------ -// -class CAddressBookContainerView : public CAddressBookPane -{ -private: - typedef CAddressBookPane Inherited; - -public: - enum { class_ID = 'AcTb' }; - - // Place holders while I wait for the final art work - enum { - ics8_LDAP = CAddressBookPane::ics8_Person , - ics8_List = CAddressBookPane::ics8_List , - ics8_PAB = CAddressBookPane::ics8_Person - }; - - CAddressBookContainerView(LStream *inStream); - virtual ~CAddressBookContainerView(); - - void Setup( MWContext* inContext); - virtual AB_ContainerInfo* GetContainer( TableIndexT inRow ); - void SetIndexToSelectOnLoad( Int32 index){ mDirectoryRowToLoad = index; } -protected: - virtual Boolean CellHasDropFlag( const STableCell& inCell, Boolean& outIsExpanded) const; - virtual UInt16 GetNestedLevel(TableIndexT inRow) const; - virtual ResIDT GetIconID(TableIndexT inRow) const; - - void DrawCellText( const STableCell& inCell, const Rect& inLocalRect ); - virtual void DrawCellContents( const STableCell& inCell, const Rect& inLocalRect ); - virtual void DrawIconsSelf( const STableCell& inCell, IconTransformType inTransformType, const Rect& inIconRect) const; -private: - MWContext* mContext; - Int32 mDirectoryRowToLoad; - -}; - - -#pragma mark CAddressBookController -//------------------------------------------------------------------------------ -// ¥ CAddressBookController -//------------------------------------------------------------------------------ -// -class CAddressBookController:public LView, - public LListener, public LPeriodical, public LCommander -{ -private: - typedef LView Inherited; - -public: - enum { class_ID = 'AbCn' }; - enum { - paneID_DirServers = 'DRSR' // CDirServersPopupMenu *, this - , paneID_Search = 'SRCH' // MSG_Pane *, search button - , paneID_Stop = 'STOP' // nil, stop button - , paneID_AddressBookTable = 'Tabl' // Address book table - , paneID_TypedownName = 'TYPE' // Typedown name search edit field in window - , paneID_SearchEnclosure = 'SCHE' // Enclosure for search items - , paneID_DividedView = 'A2Vw' // the divided view - , paneID_ContainerView = 'AcTb', - paneID_DirectoryName = 'DiCp' // Directory caption - }; - - - CAddressBookController(LStream* inStream ); - ~CAddressBookController(); - - virtual void ReadStatus(LStream *inStatusData); - virtual void WriteStatus(LStream *outStatusData); - CAddressBookTableView* GetAddressBookTable() const { return mAddressBookTable; } - CAddressBookContainerView* GetAddressBookContainerView() const { return mABContainerView; } - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - virtual void FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName); -protected: - - virtual void FinishCreateSelf(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void SpendTime(const EventRecord &inMacEvent); - virtual void ActivateSelf() { - StartRepeating(); - Inherited::ActivateSelf(); - } - - virtual void DeactivateSelf() { - StopRepeating(); - Inherited::DeactivateSelf(); - } -public: - - void SelectDirectoryServer( AB_ContainerInfo* inContainer ); - void SetContext( MWContext* inContext) { mContext = inContext; } - -protected: - void Search(); - void StopSearch( ); - -protected: - MWContext* mContext; - UInt32 mNextTypedownCheckTime; - - CSearchEditField* mTypedownName; - LDividedView* mDividedView; - CAddressBookTableView* mAddressBookTable; - CMailNewsContext* mAddressBookContext; - - CAddressBookContainerView* mABContainerView; - - LGAPushButton* mSearchButton; - LGAPushButton* mStopButton; - - -}; - - diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookWindows.cp b/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookWindows.cp deleted file mode 100644 index fba9485e270..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookWindows.cp +++ /dev/null @@ -1,1110 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - -// CAddressBookWindows.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ -#define DEBUGGER_ASSERTIONS - - - -#include "CAddressBookWindows.h" -#ifdef MOZ_NEWADDR - -#include "SearchHelpers.h" -#include "CSizeBox.h" -#include "MailNewsgroupWindow_Defines.h" -#include "Netscape_Constants.h" -#include "resgui.h" -#include "CMailNewsWindow.h" -#include "UGraphicGizmos.h" -#include "uprefd.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "CGATabBox.h" -#include "URobustCreateWindow.h" -#include "UStdDialogs.h" -#include "macutil.h" -#include "UStClasses.h" -#include -#include -#include -#include "CTargetFramer.h" -// get string constants -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS - -#include "dirprefs.h" -#include "prefapi.h" -#include "UProcessUtils.h" -#include "CAppleEventHandler.h" -#include "secnav.h" -#include "CTableKeyAttachment.h" -#include "intl_csi.h" -#include "xp_help.h" -#include "CAddressBookViews.h" -#include "CLDAPQueryDialog.h" -// #include "CAddressPickerWindow.h" -#include "MailNewsMediators.h" -#include "CABContainerDialogs.h" -class CNamePropertiesWindow; -class CListPropertiesWindow; - -const ResIDT kConferenceExampleStr = 8901; -const ResIDT kAddressbookErrorStrings = 8902; - -// Junk to allow linking. When libaddr is update these should be removed -#include "abdefn.h" -#include "addrbook.h" -typedef struct ABook ABook; -ABook *FE_GetAddressBook(MSG_Pane * /*pane*/) { - - return NULL; -} - - -int FE_ShowPropertySheetFor (MWContext* /* context */, ABID /* entryID */, PersonEntry* /* pPerson */) -{ - - return 0; -} - // End of obsolete - -#pragma mark - - -const Int32 kNumPersonAttributes = 22; -const Int32 kMaxPersonSize = 4096; //Really should recalc this - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ XP Callbacks -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// ¥ FE_GetDirServers -//------------------------------------------------------------------------------ -// -XP_List *FE_GetDirServers() { - return CAddressBookManager::GetDirServerList(); -} - - -//------------------------------------------------------------------------------ -// ¥ FE_GetAddressBookContext -//------------------------------------------------------------------------------ -// Returns the address book context, creating it if necessary. A mail pane is passed in, -// on the unlikely chance that it might be useful for the FE. If "viewnow" is TRUE, -// then present the address book window to the user; otherwise, don't (unless it is -// already visible). -// -MWContext *FE_GetAddressBookContext(MSG_Pane * /*pane*/, XP_Bool viewnow) { - - if ( viewnow ) { - CAddressBookManager::ShowAddressBookWindow(); - } - - return CAddressBookWindow::GetMailContext(); -} - -//------------------------------------------------------------------------------ -// ¥ FE_ShowPropertySheeetForAB2 -//------------------------------------------------------------------------------ -// The XP layer is requesting that the FE show a property window -// return AB_SUCCESS if the window was brought up -// return AB_Failure if the window couldn't be brought up -// -int MacFe_ShowModelessPropertySheetForAB2( MSG_Pane * pane, MWContext* /* inContext */) -{ - // Get the Resource Id for the property window - ResID resId = 0; - - MSG_PaneType type = MSG_GetPaneType( pane ); - switch( type ) - { - case AB_MAILINGLISTPANE: - resId = CListPropertiesWindow::res_ID; - break; - - case AB_PERSONENTRYPANE: - resId = CNamePropertiesWindow::res_ID; - break; - - default: - assert( 0 ); - return AB_FAILURE; - } - - // Create the new property windows. - try - { - - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - AssertFail_(addressWindow != nil); // Must be around to create name properties window - - LWindow* window = URobustCreateWindow::CreateWindow( resId, addressWindow->GetSuperCommander() ); - CAddressBookChildWindow* propertiesWindow = dynamic_cast( window ); - - propertiesWindow->UpdateUIToBackend( pane ); - propertiesWindow->Show(); - - return AB_SUCCESS; - } catch( ... ) - { - - } - return AB_FAILURE; -} - -int MacFE_ShowPropertySheetForDir( - DIR_Server* server, MWContext* /* context */, MSG_Pane * srcPane, XP_Bool /* newDirectory */) -{ - Boolean isPAB = PABDirectory == server->dirType; - if( isPAB ) - { - CPABPropertyDialogManager dialogManager( server, srcPane ); - } - else - { - CLDAPPropertyDialogManager dialogManager( server, srcPane ); - } - return AB_SUCCESS; -} - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -XP_List *CAddressBookManager::sDirServerList = nil; -Boolean CAddressBookManager::sDirServerListChanged = false; - - -//------------------------------------------------------------------------------ -// ¥ OpenAddressBookManager -//------------------------------------------------------------------------------ -// Open the address book at application startup. This method sets the initial address -// book to the local personal address book for the user (creates one if it doesn't -// exist already). -// I think this whole function is obsolete -// as we are no longer using AB_InitializeAddressBook -void CAddressBookManager::OpenAddressBookManager() { - - AssertFail_(sDirServerList == nil); - - RegisterAddressBookClasses(); - - char fileName[64]; - fileName[63] = '\0'; - char *oldName = nil; - Try_ { - // Get the default address book path - FSSpec spec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - // The real, new way! - CStr255 pfilename; - ::GetIndString(pfilename, 300, addressBookFile); // Get address book name from prefs - strncpy( fileName,(char*)pfilename, 63) ; - // Create directory servers - Int32 error = DIR_GetServerPreferences(&sDirServerList, fileName); - // No listed return error codes, who knows what they are! - FailOSErr_(error); - AssertFail_(sDirServerList != nil); - - // Get the Akbar (v3.0) address book. It's in HTML format (addressbook.html) - spec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - ::GetIndString(spec.name, 300, htmlAddressBook); // Get address book name from prefs - oldName = CFileMgr::GetURLFromFileSpec(spec); - FailNIL_(oldName); - #if 0 - CAddressBookManager::FailAddressError( - AB_InitializeAddressBook(GetPersonalBook(), &sAddressBook, - oldName + XP_STRLEN("file://")) - ); - #endif // OBsolete? - XP_FREE(oldName); - } - Catch_(inErr) { - CAddressBookManager::CloseAddressBookManager(); - XP_FREEIF(oldName); - } - EndCatch_ - - //PREF_RegisterCallback("ldap_1", DirServerListChanged, NULL); -} - - - -//------------------------------------------------------------------------------ -// ¥ CloseAddressBookManager -//------------------------------------------------------------------------------ -// Closes any open resources used by the address book manager. -// -void CAddressBookManager::CloseAddressBookManager() -{ - DIR_ShutDown(); -} - -//------------------------------------------------------------------------------ -// ¥ ImportLDIF -//------------------------------------------------------------------------------ -// We come here in response to an odoc event with an LDIF file. -// Currently no error result. Assuming the back end will put up an alert. -// -void CAddressBookManager::ImportLDIF(const FSSpec& inFileSpec) -{ - char* path = CFileMgr::EncodedPathNameFromFSSpec( - inFileSpec, true /*wantLeafName*/); - if (path) - { - int result = AB_ImportData( - nil, // no container, create new - path, - strlen(path), - AB_Filename // FIX ME: need bit that tells the BE to delete the file. - ); - if (result != AB_SUCCESS) - SysBeep(1); - XP_FREE(path); - } -} - - -//------------------------------------------------------------------------------ -// ¥ ShowAddressBookWindow -//------------------------------------------------------------------------------ -// Show the search dialog by bringing it to the front if it is not already. Create it -// if needed. -// -CAddressBookWindow * CAddressBookManager::ShowAddressBookWindow() -{ - - // Find out if the window is already around - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - - if ( addressWindow == nil ) - { - // Search dialog has not yet been created, so create it here and display it. - addressWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CAddressBookWindow::res_ID, - LCommander::GetTopCommander())); - AssertFail_(addressWindow != nil); - } - - addressWindow->Show(); - addressWindow->Select(); - return addressWindow; -} - - -//------------------------------------------------------------------------------ -// ¥ GetDirServerList -//------------------------------------------------------------------------------ -// Return the list of directory servers for the application. Why are these -// method and variable here? Can also call the BE method FE_GetDirServers() to return -// the same result. -// -XP_List *CAddressBookManager::GetDirServerList() -{ - return DIR_GetDirServers(); -} - - -//------------------------------------------------------------------------------ -// ¥ SetDirServerList -//------------------------------------------------------------------------------ -// This method should be called to set the current directory servers list. The old list -// is destroyed and is replaced with inList; the caller does NOT dispose of inList, since -// it is managed by this class after calling this method. This method also calls the -// BE method DIR_SaveServerPreferences() if inSavePrefs is true. -// -void CAddressBookManager::SetDirServerList(XP_List *inList, Boolean inSavePrefs) -{ - - AssertFail_(inList != nil); - - XP_List *tempDirServerList = sDirServerList; - sDirServerList = inList; // This needs to be set correctly for the callback to work. - if ( inSavePrefs ) { - Int32 error = DIR_SaveServerPreferences(inList); // No listed return error codes, - // who knows what they are! - if (error) - { - sDirServerList = tempDirServerList; // Put this back if there are problems. - } - FailOSErr_(error); - } - - if ( tempDirServerList != nil ) { - Int32 error = DIR_DeleteServerList(tempDirServerList); - Assert_(!error); - } -} - - -//------------------------------------------------------------------------------ -// ¥ GetPersonalBook -//------------------------------------------------------------------------------ -// Return the local personal address book. -// -DIR_Server *CAddressBookManager::GetPersonalBook() -{ - AssertFail_((sDirServerList != nil)); - DIR_Server *personalBook = nil; - DIR_GetPersonalAddressBook(sDirServerList, &personalBook); - AssertFail_(personalBook != nil); - return personalBook; -} - - - -//------------------------------------------------------------------------------ -// ¥ FailAddressError -//------------------------------------------------------------------------------ -// -void CAddressBookManager::FailAddressError(Int32 inError) -{ - if ( inError == AB_SUCCESS ) - return; - switch ( inError ) - { - case AB_FAILURE: - // Should be throwing - break; - case MK_MSG_NEED_FULLNAME: - case MK_MSG_NEED_GIVENNAME: - Throw_( MK_MSG_NEED_FULLNAME ); - break; - case MK_OUT_OF_MEMORY: - Throw_(memFullErr); - break; - case MK_ADDR_LIST_ALREADY_EXISTS: - case MK_ADDR_ENTRY_ALREADY_EXISTS: - Throw_( inError ); - break; - case MK_UNABLE_TO_OPEN_FILE: - case XP_BKMKS_CANT_WRITE_ADDRESSBOOK: - Throw_(ioErr); - break; - case XP_BKMKS_NICKNAME_ALREADY_EXISTS: - Throw_(XP_BKMKS_INVALID_NICKNAME); - break; - default: - Assert_(false); - Throw_(32000); // Who knows? - break; - } -} - - -//------------------------------------------------------------------------------ -// ¥ RegisterAddressBookClasses -//------------------------------------------------------------------------------ -// Register all classes associated with the address book window. -// -void CAddressBookManager::RegisterAddressBookClasses() { - - RegisterClass_(CAddressBookWindow); - RegisterClass_(CAddressBookTableView); - RegisterClass_(CMailingListTableView); - RegisterClass_(CSearchPopupMenu); - - RegisterClass_(CNamePropertiesWindow); - RegisterClass_(CListPropertiesWindow); - - RegisterClass_(CAddressBookController); - RegisterClass_(CLDAPQueryDialog); - RegisterClass_(CAddressBookContainerView); - CGATabBox::RegisterTabBoxClasses(); -} - - -#pragma mark - - -//------------------------------------------------------------------------------ -// ¥ ~CAddressBookWindow -//------------------------------------------------------------------------------ -// -// -CAddressBookWindow::~CAddressBookWindow() -{ - -} - - -//------------------------------------------------------------------------------ -// ¥ GetMailContext -//------------------------------------------------------------------------------ -// Get the mail context for the address book. We must have an address book window to -// access the context, so this method creates the window (but doesn't show it) if the -// window is not yet around. -// -MWContext *CAddressBookWindow::GetMailContext() -{ - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - - if ( addressWindow == nil ) { - // AddressBookWindow dialog has not yet been created, so create it here - addressWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CAddressBookWindow::res_ID, - LCommander::GetTopCommander())); - AssertFail_(addressWindow != nil); - } - - return *(addressWindow->GetWindowContext()); -} - - -//------------------------------------------------------------------------------ -// ¥ FinishCreateSelf -//------------------------------------------------------------------------------ -// -void CAddressBookWindow::FinishCreateSelf() -{ - mAddressBookController = - dynamic_cast< CAddressBookController* >(FindPaneByID( paneID_AddressBookController) ) ; - FailNILRes_(mAddressBookController); - - // Create the context - Inherited::FinishCreateSelf(); - mMailNewsContext->SetWinCSID(INTL_DocToWinCharSetID(mMailNewsContext->GetDefaultCSID())); - - // Have the AddressBook Controller listen to the toolbar and context - UReanimator::LinkListenerToControls(mAddressBookController, this, res_ID); - mMailNewsContext->AddListener(mAddressBookController); - mAddressBookController->SetContext( *mMailNewsContext ); - mAddressBookController->GetAddressBookContainerView()->Setup( *mMailNewsContext ); - - // Stop is in the toolbar. Could do this in constructor but then would have to duplicate the container - LGAPushButton* stopButton = dynamic_cast(FindPaneByID( paneID_Stop)); - if ( stopButton ) - USearchHelper::ShowHidePane(stopButton, false); - - // Update the window title - CStr255 windowTitle; - GetUserWindowTitle(4, windowTitle); - SetDescriptor(windowTitle); -} - - -//------------------------------------------------------------------------------ -// ¥ CreateContext -//------------------------------------------------------------------------------ -// -CNSContext* CAddressBookWindow::CreateContext() const -{ - CNSContext* result = new CNSContext( MWContextAddressBook); - FailNIL_(result); - return result; -} - - -//------------------------------------------------------------------------------ -// ¥ GetActiveTable -//------------------------------------------------------------------------------ -// The active table is the one with the current keyboard focus. If the keyboard focus is in -// the editfield, the AddressBookTable has focus -// -CMailFlexTable* CAddressBookWindow::GetActiveTable() -{ - CMailFlexTable* result = nil; - Assert_( mAddressBookController ); - result = dynamic_cast( mAddressBookController->GetAddressBookContainerView() ); - if (! (result && result->IsOnDuty() ) ) - result = dynamic_cast( mAddressBookController->GetAddressBookTable() ); - return result; -} - - -//------------------------------------------------------------------------------ -// ¥ ReadWindowStatus -//------------------------------------------------------------------------------ -// Adjust the window to stored preferences. -// -void CAddressBookWindow::ReadWindowStatus(LStream *inStatusData) -{ - Inherited::ReadWindowStatus(inStatusData); - if ( inStatusData != nil ) - { - mAddressBookController->ReadStatus( inStatusData ); - } - -} - - -//------------------------------------------------------------------------------ -// ¥ WriteWindowStatus -//------------------------------------------------------------------------------ -// Write window stored preferences. -// -void CAddressBookWindow::WriteWindowStatus(LStream *outStatusData) -{ - Inherited::WriteWindowStatus(outStatusData); - mAddressBookController->WriteStatus(outStatusData); -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ ListenToMessage -//------------------------------------------------------------------------------ -// -void CAddressBookChildWindow::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch ( inMessage ) { - case CSearchEditField::msg_UserChangedText: - if ( ioParam ) - { - switch( (*( (PaneIDT *) ioParam) ) ) - { - case CListPropertiesWindow::paneID_Name: - case CNamePropertiesWindow::paneID_FirstName: - case CNamePropertiesWindow::paneID_LastName: - UpdateTitle(); - break; - default: - break; - - } - } - break; - case msg_OK: - Try_{ - UpdateBackendToUI( ); - - AB_ClosePane( mMSGPane ); - DoClose(); - } Catch_ ( ioParam ) - { - ResIDT stringID = 0; - switch( ioParam ) - { - case XP_BKMKS_INVALID_NICKNAME: - stringID = 4; - break; - case MK_MSG_NEED_FULLNAME: - stringID = 3; - break; - case MK_ADDR_LIST_ALREADY_EXISTS: - stringID = 2; - break; - case MK_ADDR_ENTRY_ALREADY_EXISTS: - stringID = 1; - break; - default: - Throw_( ioParam ); - } - LStr255 errorString( kAddressbookErrorStrings, stringID ); - UStdDialogs::Alert( errorString, eAlertTypeCaution ); - } - break; - - case msg_Cancel: - AB_ClosePane( mMSGPane ); - DoClose(); - break; - - default: - Inherited::ListenToMessage( inMessage, ioParam ); - break; - } -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ PaneChanged -//------------------------------------------------------------------------------ -// -void CMailWindowCallbackListener::PaneChanged( MSG_Pane* /* inPane */, MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, int32 /* value */) -{ - switch (inNotifyCode) - { - case MSG_PaneClose: - mWindow->DoClose(); - break; - default: - break; - } -} - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ CNamePropertiesWindow -//------------------------------------------------------------------------------ -// -// -CNamePropertiesWindow::CNamePropertiesWindow(LStream *inStream) : - CAddressBookChildWindow(inStream), - mFirstNameField(nil), mLastNameField(nil) -{ -} - - -//------------------------------------------------------------------------------ -// ¥ FinishCreateSelf -//------------------------------------------------------------------------------ -// -// -void CNamePropertiesWindow::FinishCreateSelf() -{ - - mFirstNameField = USearchHelper::FindViewEditField(this, paneID_FirstName); - mLastNameField = USearchHelper::FindViewEditField(this, paneID_LastName); - - Inherited::FinishCreateSelf(); - - UReanimator::LinkListenerToControls(this, this, res_ID ); - - // need to listen to first/last name fields to update title - USearchHelper::LinkListenerToBroadcasters(USearchHelper::FindViewSubview(this, paneID_GeneralView), this); - - // Need Cooltalk since we listen to the popup - USearchHelper::LinkListenerToBroadcasters(USearchHelper::FindViewSubview(this, paneID_CooltalkView), this); - -} - - - -//------------------------------------------------------------------------------ -// ¥ ListenToMessage -//------------------------------------------------------------------------------ -// -void CNamePropertiesWindow::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch ( inMessage ) - { - case paneID_ConferencePopup: - SetConferenceText(); - break; - - default: - Inherited::ListenToMessage(inMessage, ioParam); - break; - } -} - - -//------------------------------------------------------------------------------ -// ¥ SetConferenceText -//------------------------------------------------------------------------------ -// Update Caption text in Conference -// The edit field is disable if Netscape DLS server is selected -// -void CNamePropertiesWindow::SetConferenceText( ) -{ - short serverType = USearchHelper::FindSearchPopup( this, paneID_ConferenceServer )->GetValue(); - LStr255 exampleString(kConferenceExampleStr, serverType ); - LCaption* text = dynamic_cast(this->FindPaneByID('CoES')); - Assert_(text); - if( text ) - text->SetDescriptor( exampleString); - LView *view = (LView*)USearchHelper::FindViewEditField( this, paneID_ConferenceAddress); - if( view ) - { - if( serverType == 1 ) - { - view->SetDescriptor("\p"); - view->Disable(); - } - else - view->Enable(); - } -} - - - - -//------------------------------------------------------------------------------ -// ¥ GetPaneAndAttribID -//------------------------------------------------------------------------------ -// Given a Index return the associated Pane and attribute id's. Also returns the -// number of attributes -// -int32 CNamePropertiesWindow::GetPaneAndAttribID( TableIndexT index, PaneIDT& outPaneID, AB_AttribID &outAttrib ) -{ - Int32 personAttributes[][2] = - { - paneID_Nickname , AB_attribNickName - , paneID_FirstName , AB_attribGivenName - , paneID_LastName , AB_attribFamilyName - , paneID_Company , AB_attribCompanyName - , paneID_State , AB_attribRegion - , paneID_EMail , AB_attribEmailAddress - , paneID_Notes , AB_attribInfo - , paneID_PrefersHTML , AB_attribHTMLMail - , paneID_Title , AB_attribTitle - , paneID_Address , AB_attribStreetAddress - , paneID_ZIP , AB_attribZipCode - , paneID_Country , AB_attribCountry - , paneID_WorkPhone , AB_attribWorkPhone - , paneID_FaxPhone , AB_attribFaxPhone - , paneID_HomePhone , AB_attribHomePhone - , paneID_ConferenceAddress, AB_attribCoolAddress - , paneID_ConferenceServer, AB_attribUseServer - , paneID_PagerPhone , AB_attribPager - , paneID_DisplayName , AB_attribDisplayName - , paneID_CelluarPhone , AB_attribCellularPhone - , paneID_Department, AB_attribDistName - }; - outPaneID = paneID_None; - Int32 numEntries = ( sizeof( personAttributes )/ 8 ); - if ( index < numEntries ) - { - outPaneID = PaneIDT( personAttributes[index][0] ); - outAttrib = AB_AttribID( personAttributes[index][1] ); - } - - return numEntries; -}; - -//------------------------------------------------------------------------------ -// ¥ FindPaneForAttribute -//------------------------------------------------------------------------------ -// Given a Index return the associated Pane and attribute id's. Also returns the -// number of attributes -// -PaneIDT CNamePropertiesWindow::FindPaneForAttribute ( AB_AttribID inAttrib ) -{ - Int32 numEntries = 0; - PaneIDT pane = 0; - AB_AttribID attrib; - numEntries = GetPaneAndAttribID ( 0, pane, attrib ); - for ( int32 i = 0 ; i< numEntries ; i++ ) - { - numEntries = GetPaneAndAttribID ( i, pane, attrib ); - if ( attrib == inAttrib ) - return pane; - } - return paneID_None; -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateBackendToUI -//------------------------------------------------------------------------------ -// Update the name properties to the current values in the dialog fields and other settings. -// -void CNamePropertiesWindow::UpdateBackendToUI( ) -{ - char charData[ kMaxPersonSize ]; - Int32 currentTextOffset = 0; - AB_AttribID attribID ; - PaneIDT paneID = paneID_None; - int32 numControls = kNumPersonAttributes - 1 ; - - AB_AttributeValue* attribute = new AB_AttributeValue[ kNumPersonAttributes]; - - // Convert fill array with control values - for ( Int32 i = 0; i< numControls; i++ ) - { - GetPaneAndAttribID ( i, paneID, attribID ); - - attribute[ i ].attrib = attribID; - - LPane* control = FindPaneByID( paneID ); - if ( control ) - { - CSearchEditField* editField = NULL; - LGAPopup* popup = NULL; - LGACheckbox* checkbox = NULL; - if( ( editField = dynamic_cast< CSearchEditField* >( control ) ) != 0) - { - editField->GetText( &charData[ currentTextOffset] ); - Int32 length = XP_STRLEN( &charData[ currentTextOffset] ); - - Assert_( length + currentTextOffset < kMaxPersonSize ); - attribute[i].u.string = &charData[ currentTextOffset ]; - currentTextOffset+= length+1 ; - - } - else if( ( popup = dynamic_cast< LGAPopup* >( control ) ) != 0) - { - attribute[i].u.shortValue = popup->GetValue(); - } - else if ( ( checkbox = dynamic_cast< LGACheckbox *>(control ) )!= 0 ) - { - attribute[i].u.boolValue = checkbox->GetValue(); - } - } - } - - // WinCSID -- I love special cases. - - MWContext* context= CAddressBookWindow::GetMailContext(); - INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(context); - attribute[ numControls ].attrib = AB_attribWinCSID; - attribute [ numControls ].u.shortValue = INTL_GetCSIWinCSID(c); - - // Commit Changes - CAddressBookManager::FailAddressError( AB_SetPersonEntryAttributes ( mMSGPane, attribute, kNumPersonAttributes ) ); - CAddressBookManager::FailAddressError( AB_CommitChanges( mMSGPane ) ); - - delete [] attribute; -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateUIToBackend -//------------------------------------------------------------------------------ -// Update the dialog fields to the current values of the name properties. -// -void CNamePropertiesWindow::UpdateUIToBackend( MSG_Pane* inPane ) -{ - Assert_( inPane ); - mMSGPane = inPane; - MSG_SetFEData( inPane, CMailCallbackManager::Get()); - - // Get the person Attribute - AB_AttribID personAttribs [ kNumPersonAttributes ]; - int32 numPanes = 0; - AB_AttribID attrib; - PaneIDT paneID = 0; - numPanes = GetPaneAndAttribID( 0, paneID, attrib ); - Assert_( numPanes <= kNumPersonAttributes ); - - for( int32 i = 0; i< numPanes; i++ ) - { - GetPaneAndAttribID( i, paneID, attrib ); - personAttribs[ i ] = attrib; - } - uint16 numberAttributes = numPanes; - - // Allocate storage for the attribute values - AB_AttributeValue* attribute; - CAddressBookManager::FailAddressError (AB_GetPersonEntryAttributes ( mMSGPane, personAttribs, &attribute, &numberAttributes ) ); - - for ( Int32 i = 0; i < numberAttributes; i++ ) - { - PaneIDT pane = FindPaneForAttribute( attribute[i].attrib ); - if( pane != paneID_None ) - { - switch( attribute[i].attrib ) - { - case AB_attribUseServer: - USearchHelper::FindSearchPopup( this, pane )->SetValue( attribute[i].u.shortValue + 1 ); // Popups are 1 based - break; - - case AB_attribHTMLMail: - USearchHelper::FindViewControl( this , pane )->SetValue( attribute[i].u.boolValue); - break; - - case AB_attribWinCSID: - break; - - default: - CSearchEditField* editfield = dynamic_cast( FindPaneByID( pane ) ); - if( editfield ) - editfield->SetText ( attribute[i].u.string ); - break; - }; - } - } - AB_FreeEntryAttributeValues( attribute , numberAttributes); - - SetConferenceText( ); -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateTitle -//------------------------------------------------------------------------------ -// Update the window title. -// -void CNamePropertiesWindow::UpdateTitle() { - - CStr255 title; - { - CStr255 first, last; - mFirstNameField->GetDescriptor(first); - mLastNameField->GetDescriptor(last); - if ( last[0] ) first += " "; - first += last; - - ::GetIndString( title, 8903, 1); - ::StringParamText( title, first); - } - SetDescriptor( title ); -} - - -#pragma mark - - - -//------------------------------------------------------------------------------ -// ¥ CListPropertiesWindow -//------------------------------------------------------------------------------ -// Construct the list window. -// -CListPropertiesWindow::CListPropertiesWindow(LStream *inStream) : - CAddressBookChildWindow(inStream), - mAddressBookListTable(nil), - mTitleField(nil) -{ - SetPaneID(pane_ID); -} - - -//------------------------------------------------------------------------------ -// ¥ ~CListPropertiesWindow -//------------------------------------------------------------------------------ -// Dispose of the list window. -// -inline CListPropertiesWindow::~CListPropertiesWindow() -{ - - mAddressBookListTable = nil; -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateUIToBackend -//------------------------------------------------------------------------------ -// Load and display the specified address book mailing listlist -// -void CListPropertiesWindow::UpdateUIToBackend(MSG_Pane* inPane) -{ - AssertFail_(mAddressBookListTable != nil); - Assert_( inPane ); - mMSGPane = inPane; - - mAddressBookListTable->LoadMailingList( inPane ); - - // Set edit fields - AB_AttribID mailingListAttributes[] = { AB_attribFullName, AB_attribNickName, AB_attribInfo }; - uint16 numItems = 3; - // Can't use New since XP code will be freeing the values - AB_AttributeValue* mailingListValues =( AB_AttributeValue*) XP_ALLOC( sizeof( AB_AttributeValue) * numItems ); - if( !mailingListValues ) - Throw_(memFullErr); - CAddressBookManager::FailAddressError( - AB_GetMailingListAttributes( mMSGPane, mailingListAttributes, &mailingListValues, &numItems ) ); - - mTitleField->SetText( mailingListValues[0].u.string ); - dynamic_cast< CSearchEditField *>( USearchHelper::FindViewEditField(this, paneID_Nickname) )->SetText( mailingListValues[1].u.string ); - dynamic_cast< CSearchEditField *>( USearchHelper::FindViewEditField(this, paneID_Description) )->SetText( mailingListValues[2].u.string ); - CAddressBookManager::FailAddressError(AB_FreeEntryAttributeValues( mailingListValues, 3 ) ); - UpdateTitle(); -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateBackendToUI -//------------------------------------------------------------------------------ -// Update the list properties to the current values in the dialog fields. -// -void CListPropertiesWindow::UpdateBackendToUI( ) -{ - char mValue[ kMaxPersonSize ]; - AB_AttributeValue mailingListValues[ 4 ]; - - mailingListValues[0].attrib = AB_attribFullName; - mailingListValues[0].u.string= mTitleField->GetText( &mValue[0] ); - - mailingListValues[1].attrib = AB_attribNickName; - mailingListValues[1].u.string = ( dynamic_cast< CSearchEditField *> - ( USearchHelper::FindViewEditField(this, paneID_Nickname) ) )->GetText( &mValue[256] ); - - mailingListValues[2].attrib = AB_attribInfo; - mailingListValues[2].u.string = ( dynamic_cast< CSearchEditField *> - (USearchHelper::FindViewEditField(this, paneID_Description) ) )->GetText( &mValue[512] ); - // Need to copy in the win CSID - - MWContext* context= CAddressBookWindow::GetMailContext(); - INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(context); - mailingListValues[3].attrib = AB_attribWinCSID; - mailingListValues[3].u.shortValue= INTL_GetCSIWinCSID(c); - - CAddressBookManager::FailAddressError( AB_SetMailingListAttributes( mMSGPane, mailingListValues, 3 ) ); - CAddressBookManager::FailAddressError( AB_CommitChanges( mMSGPane ) ); -} - - - -//------------------------------------------------------------------------------ -// ¥ FinishCreateSelf -//------------------------------------------------------------------------------ -// Initialize the window. -// -void CListPropertiesWindow::FinishCreateSelf() { - - mAddressBookListTable = - dynamic_cast(USearchHelper::FindViewSubview(this, paneID_AddressBookListTable)); - FailNILRes_(mAddressBookListTable); - mTitleField = dynamic_cast< CSearchEditField *> ( USearchHelper::FindViewEditField(this, paneID_Name) ); - - Inherited::FinishCreateSelf(); // Call CMediatedWindow for now since we need to - // create a different context than CMailNewsWindow - - UReanimator::LinkListenerToControls(this, this, res_ID ); - // Lastly, link to our broadcasters, need to link to allow title update - USearchHelper::LinkListenerToBroadcasters(this, this); - -} - - -//------------------------------------------------------------------------------ -// ¥ DrawSelf -//------------------------------------------------------------------------------ -// Draw the window. -// -void CListPropertiesWindow::DrawSelf() { - - Rect frame; - - if ( mAddressBookListTable->CalcPortFrameRect(frame) && ::RectInRgn(&frame, mUpdateRgnH) ) { - - { - StExcludeVisibleRgn excludeRgn(mAddressBookListTable); - Inherited::DrawSelf(); - } - - StColorPenState::Normalize(); - ::EraseRect(&frame); - } else { - Inherited::DrawSelf(); - } - - USearchHelper::RemoveSizeBoxFromVisRgn(this); -} - - -//------------------------------------------------------------------------------ -// ¥ UpdateTitle -//------------------------------------------------------------------------------ -// Update the window title. -// -void CListPropertiesWindow::UpdateTitle() { - - CStr255 title; - { - CStr255 name; - mTitleField->GetDescriptor(name); - ::GetIndString( title, 8903, 2); - ::StringParamText( title, name); - } - SetDescriptor( title ); -} -#endif - diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookWindows.h b/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookWindows.h deleted file mode 100644 index 310d1b8528f..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressBookWindows.h +++ /dev/null @@ -1,299 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - -// CAddressBookWindows.h - -#pragma once -#include "abcom.H" -#ifdef MOZ_NEWADDR -class CComposeAddressTableView; -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CMailNewsWindow.h" -#include "CMailNewsContext.h" -#include "LGADialogBox.h" -#include "MailNewsCallbacks.h" - - -class CSearchEditField; -class LBroadcasterEditField; -class CNamePropertiesWindow; -class CListPropertiesWindow; -class CMailingListTableView; -class CAddressBookController; -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ -typedef struct DIR_Server DIR_Server; -typedef struct _XP_List XP_List; -typedef UInt32 ABID; - - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -// Save window status version - -static const UInt16 cAddressSaveWindowStatusVersion = 0x0219; -static const UInt16 cNamePropertiesSaveWindowStatusVersion = 0x0202; -static const UInt16 cListPropertiesSaveWindowStatusVersion = 0x0202; - -#pragma mark - - -extern "C" -{ -int MacFe_ShowModelessPropertySheetForAB2( MSG_Pane * pane, MWContext* inContext); -int MacFE_ShowPropertySheetForDir( - DIR_Server* server, MWContext* context, MSG_Pane * srcPane, XP_Bool newDirectory ); -} -class CAddressBookWindow; - - -class CAddressBookManager -{ -public: - - // Should be called when the application starts up - static void OpenAddressBookManager(void); - // Should be called when the application closes - static void CloseAddressBookManager(void); - - static void ImportLDIF(const FSSpec& inSpec); - - static CAddressBookWindow* ShowAddressBookWindow(void); - - static XP_List *GetDirServerList(void); - static void SetDirServerList(XP_List *inList, Boolean inSavePrefs = true); - static DIR_Server *GetPersonalBook(void); - - static void FailAddressError(Int32 inError); - - -private: - - static void RegisterAddressBookClasses(void); - static int DirServerListChanged(const char*, void*) - { - CAddressBookManager::sDirServerListChanged = true; - return 0; - } - - // Instance variables - - static XP_List *sDirServerList; - static Boolean sDirServerListChanged; - -}; - -class CAddressBookWindow : public CMailNewsWindow -{ -private: - typedef CMailNewsWindow Inherited; - -public: - - enum { class_ID = 'AbWn', pane_ID = class_ID, res_ID = 8900 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - enum { - paneID_DirServers = 'DRSR' // CDirServersPopupMenu *, this - , paneID_Search = 'SRCH' // MSG_Pane *, search button - , paneID_Stop = 'STOP' // nil, stop button - , paneID_AddressBookTable = 'Tabl' // Address book table - , paneID_TypedownName = 'TYPE' // Typedown name search edit field in window - , paneID_SearchEnclosure = 'SCHE' // Enclosure for search items - , paneID_AddressBookController = 'AbCn' - }; - - // Stream creator method - - CAddressBookWindow(LStream *inStream) : - CMailNewsWindow(inStream, WindowType_Address), - mAddressBookController(nil) - { - SetPaneID(pane_ID); - SetRefreshAllWhenResized(false); - } - virtual ~CAddressBookWindow(); - - virtual ResIDT GetStatusResID() const { return res_ID; } - - static MWContext *GetMailContext(); - virtual CNSContext* CreateContext() const; - virtual CMailFlexTable* GetActiveTable(); - - CAddressBookController* GetAddressBookController() const { return mAddressBookController; } -protected: - - // Overriden methods - - virtual void FinishCreateSelf(); - - // Utility methods - - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual UInt16 GetValidStatusVersion() const { return cAddressSaveWindowStatusVersion; } - -protected: - CAddressBookController *mAddressBookController; -}; - - -class CAddressBookChildWindow : public LGADialogBox -{ -private: - typedef LGADialogBox Inherited; - -public: - CAddressBookChildWindow(LStream *inStream) : - Inherited (inStream), mMSGPane( NULL ) - { - SetRefreshAllWhenResized(false); - } - - virtual void UpdateBackendToUI() = 0L; - virtual void UpdateUIToBackend( MSG_Pane* inPane ) = 0L; - -protected: - // Overriden methods - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual void UpdateTitle()=0; - // Instance variables - MSG_Pane* mMSGPane; -}; - -class CListPropertiesWindow : public CAddressBookChildWindow { - -private: - typedef CAddressBookChildWindow Inherited; - -public: - enum { class_ID = 'LpWn', pane_ID = class_ID, res_ID = 8940 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - enum { - paneID_Name = 'NAME' - , paneID_Nickname = 'NICK' - , paneID_Description = 'DESC' - , paneID_AddressBookListTable = 'Tabl' // Address book list table - }; - - CListPropertiesWindow(LStream *inStream); - virtual ~CListPropertiesWindow(); - - virtual void UpdateBackendToUI(); - virtual void UpdateUIToBackend( MSG_Pane* inPane ); - -protected: - virtual void FinishCreateSelf(); - virtual void DrawSelf(); - virtual void UpdateTitle(); - - // Instance variables - CMailingListTableView *mAddressBookListTable; - CSearchEditField *mTitleField; -}; - -class CMailWindowCallbackListener: public CMailCallbackListener -{ - void CMailWindowCallBackListener( LWindow* inWindow ) - { - mWindow = inWindow; - } -private: - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - LWindow *mWindow; -}; - -//------------------------------------------------------------------------------ -// ¥ CNamePropertiesWindow -//------------------------------------------------------------------------------ -// -class CNamePropertiesWindow : public CAddressBookChildWindow -{ -private: - typedef CAddressBookChildWindow Inherited; - -public: - - enum { class_ID = 'NpWn', pane_ID = class_ID, res_ID = 8930 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - enum { - paneID_GeneralView = 'GNVW' // General preferences view - , paneID_FirstName = 'FNAM' - , paneID_LastName = 'LNAM' - , paneID_DisplayName = 'DNAM' - , paneID_EMail = 'EMAL' - , paneID_Nickname = 'NICK' - , paneID_Notes = 'NOTE' - , paneID_PrefersHTML = 'HTML' - , paneID_ContactView = 'CNVW' // Contact preferences view - , paneID_Company = 'COMP' - , paneID_Title = 'TITL' - , paneID_Department = 'DPRT' - , paneID_Address = 'ADDR' - , paneID_City = 'CITY' - , paneID_State = 'STAT' - , paneID_ZIP = 'ZIP ' - , paneID_Country = 'Coun' - , paneID_WorkPhone = 'WPHO' - , paneID_FaxPhone = 'FPHO' - , paneID_PagerPhone = 'PPHO' - , paneID_HomePhone = 'HPHO' - , paneID_CelluarPhone = 'CPHO' - , paneID_SecurityView = 'SCVW' // Security preferences view - , paneID_CooltalkView = 'CLVW' // Cooltalk preferences view - , paneID_ConferenceAddress = 'CAED' - , paneID_ConferenceServer = 'CnPu' - , paneID_None = 'NONE' - }; - - enum { // Broadcast messages - paneID_ConferencePopup ='CoPU' // conference pop up button - }; - - CNamePropertiesWindow(LStream *inStream); - virtual void UpdateBackendToUI(); - void UpdateUIToBackend( MSG_Pane *inPane ); - void SetConferenceText( ); - -protected: - virtual void FinishCreateSelf(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual void UpdateTitle(); - -private: - int32 GetPaneAndAttribID( TableIndexT index, PaneIDT& outPaneID, AB_AttribID &outAttrib ); - PaneIDT FindPaneForAttribute ( AB_AttribID inAttrib ); -protected: - CMailWindowCallbackListener mCallBackListener; - LBroadcasterEditField *mFirstNameField; - LBroadcasterEditField *mLastNameField; -}; -#endif // NEWADDR \ No newline at end of file diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressPickerWindow.cp b/mozilla/cmd/macfe/MailNews/AddressBook/CAddressPickerWindow.cp deleted file mode 100644 index 449fed6364e..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressPickerWindow.cp +++ /dev/null @@ -1,274 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - -// CAddressPickerWindow.cp - -#include "CAddressPickerWindow.h" -// #include "CAddressBookWindows.h" -#ifdef MOZ_NEWADDR -#include "SearchHelpers.h" -#include "CAddressBookViews.h" -#include "xp_Help.h" -#include "UStdDialogs.h" -#include "libi18n.h" -#include "CProgressListener.h" -#include "StBlockingDialogHandler.h" -#include "CKeyStealingAttachment.h" - -// Code in the tables depends on recieving key up events hence this class -class StKeyUpDialogHandler : public StBlockingDialogHandler -{ -public: - StKeyUpDialogHandler( - ResIDT inDialogResID, - LCommander* inSuper): StBlockingDialogHandler( inDialogResID, inSuper) {}; - void EventKeyUp(const EventRecord &inMacEvent) - { - /* if it's a CKeyUpReceiver, send the key up. We used to send keyups to - * targets if a browser view was on duty, which had two disadvantages: it required - * any potential targets in a browser view to handle a key up, and sometimes - * the commander chain would be incorrect so key ups were sent to a target in a - * view that was not on duty. - */ - if (dynamic_cast(sTarget)) - sTarget->ProcessKeyPress(inMacEvent); - - } -}; - -//------------------------------------------------------------------------------ -// ¥ DoPickerDialog -//------------------------------------------------------------------------------ -// Bring up and runs the picker dialog -// -void CAddressPickerWindow::DoPickerDialog( CComposeAddressTableView* initialTable ) -{ - StKeyUpDialogHandler handler ( 8990, nil ); - CAddressPickerWindow* dialog = dynamic_cast< CAddressPickerWindow* >( handler.GetDialog() ); - dialog->Setup( initialTable ); - dialog->Show(); - MessageT message; - do - { - message = handler.DoDialog(); - } while ( message != eOkayButton && message != eCancelButton ) ; -} - -//------------------------------------------------------------------------------ -// ¥ CAddressPickerWindow -//------------------------------------------------------------------------------ -// -CAddressPickerWindow::CAddressPickerWindow(LStream *inStream) - : Inherited( inStream ), CSaveWindowStatus( this ), mInitialTable( nil ), mPickerAddresses(nil), - mAddressBookController(nil), mProgressListener( nil ), mMailNewsContext ( nil ), mLastAction ( eToButton ) -{ -} - -//------------------------------------------------------------------------------ -// ¥ ~CAddressPickerWindow -//------------------------------------------------------------------------------ -// -CAddressPickerWindow::~CAddressPickerWindow() -{ - if (mMailNewsContext) - mMailNewsContext->RemoveUser(this); - delete mProgressListener; -} - - -//------------------------------------------------------------------------------ -// ¥ Setup -//------------------------------------------------------------------------------ -// Copies takes in a CComposeAddressTableView and copies its data to the picker bucket -// The passed in table will be updated if necessary when the window is closed -// -void CAddressPickerWindow::Setup( CComposeAddressTableView* initialTable ) -{ - // Copy the old table to the new one - Assert_( initialTable ); - Assert_( mPickerAddresses ); - - TableIndexT numRows; - mInitialTable = initialTable; - initialTable->GetNumRows(numRows); - STableCell cell; - Uint32 size; - char* address = NULL; - for ( int32 i = 1; i <= numRows; i++ ) - { - EAddressType type = initialTable->GetRowAddressType( i ); - cell.row = i; - cell.col = 2; - size = sizeof(address); - initialTable->GetCellData(cell, &address, size); - mPickerAddresses->InsertNewRow( type, address, false ); - } -} - - -//------------------------------------------------------------------------------ -// ¥ FinishCreateSelf -//------------------------------------------------------------------------------ -// -void CAddressPickerWindow::FinishCreateSelf() -{ - Inherited::FinishCreateSelf(); - - mAddressBookController = - dynamic_cast< CAddressBookController* >(FindPaneByID( CAddressBookWindow::paneID_AddressBookController) ) ; - CSaveWindowStatus::FinishCreateWindow(); - - // Context creation - mMailNewsContext = new CMailNewsContext( MWContextAddressBook); - if (!mProgressListener) - mProgressListener = new CProgressListener(this, mMailNewsContext); - ThrowIfNULL_(mProgressListener); - // The progress listener should be "just a bit" lazy during network activity - mProgressListener->SetLaziness(CProgressListener::lazy_NotAtAll); - mMailNewsContext->AddListener(mProgressListener); - mMailNewsContext->AddUser(this); - - mMailNewsContext->SetWinCSID(INTL_DocToWinCharSetID(mMailNewsContext->GetDefaultCSID())); - - // Have the AddressBook Controller listen to the context - mMailNewsContext->AddListener(mAddressBookController); - mAddressBookController->SetContext( *mMailNewsContext ); - mAddressBookController->GetAddressBookContainerView()->Setup( *mMailNewsContext ); - mAddressBookController->GetAddressBookTable()->SetNotifyOnSelectionChange( true ); - mAddressBookController->GetAddressBookTable()->StartBroadcasting(); - - mPickerAddresses = dynamic_cast< CComposeAddressTableView* >( FindPaneByID( 'Addr' ) ); - FailNILRes_( mPickerAddresses ); - - (mAddressBookController->GetAddressBookTable() )->AddListener( this ); - UReanimator::LinkListenerToControls(this, this,CAddressPickerWindow:: res_ID); - -// Setup KeySnatcher for our fancy default button behavior - CKeyStealingAttachment* keyStealer = new CKeyStealingAttachment(this); - mAddressBookController->GetAddressBookTable()->AddAttachment(keyStealer); - mAddressBookController->GetAddressBookContainerView()->AddAttachment(keyStealer ); - keyStealer->StealKey( char_Enter ); - keyStealer->StealKey( char_Return ); - - - // Adjust button state - ListenToMessage ( CStandardFlexTable::msg_SelectionChanged, nil ); -} - - -//------------------------------------------------------------------------------ -// ¥ ListenToMessage -//------------------------------------------------------------------------------ -// -void CAddressPickerWindow::ListenToMessage(MessageT inMessage, void * /* ioParam */ ) -{ - switch( inMessage ) - { - case eOkayButton: - SaveStatusInfo(); - CComposeAddressTableStorage* oldTableStorage =dynamic_cast< CComposeAddressTableStorage*> (mInitialTable->GetTableStorage() ); - mPickerAddresses->EndEditCell(); - mInitialTable->SetTableStorage( mPickerAddresses->GetTableStorage() ); - mInitialTable->Refresh(); - mPickerAddresses->SetTableStorage( oldTableStorage ); - break; - - case eHelp: - ShowHelp( HELP_SELECT_ADDRESSES ); - break; - - case eToButton: - mLastAction = eToButton; - AddSelection ( eToType ); - break; - - case eCcButton: - mLastAction = eCcButton; - AddSelection ( eCcType ); - break; - - case eBccButton: - mLastAction = eBccButton; - AddSelection( eBccType ); - break; - - case ePropertiesButton: - break; - - case CStandardFlexTable::msg_SelectionChanged: - Boolean enable = mAddressBookController->GetAddressBookTable()->GetSelectedRowCount() >0; - SetDefaultButton( mLastAction ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,eToButton ), enable, true ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,eCcButton ), enable, true ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,eBccButton ), enable, true ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,ePropertiesButton ), enable, true ); - break; - - default: - break; - } -} - -//------------------------------------------------------------------------------ -// ¥ AddSelection -//------------------------------------------------------------------------------ -// Adds the table selection to the address bucket. -// -// -void CAddressPickerWindow::AddSelection( EAddressType inAddressType ) -{ - char* address = NULL; - Uint32 size= sizeof(address); - TableIndexT row = 0; - - while ( mAddressBookController->GetAddressBookTable()->GetNextSelectedRow( row ) ) - { - address = mAddressBookController->GetAddressBookTable()->GetFullAddress( row ); - mPickerAddresses->InsertNewRow( inAddressType, address, false ); - XP_FREE( address ); - } - - SetDefaultButton( eOkayButton ); -} - -//------------------------------------------------------------------------------ -// ¥ ReadWindowStatus -//------------------------------------------------------------------------------ -// Adjust the window to stored preferences. -// -void CAddressPickerWindow::ReadWindowStatus(LStream *inStatusData) -{ - if ( inStatusData != nil ) - { - mAddressBookController->ReadStatus( inStatusData ); - } - -} - - -//------------------------------------------------------------------------------ -// ¥ WriteWindowStatus -//------------------------------------------------------------------------------ -// Write window stored preferences. -// -void CAddressPickerWindow::WriteWindowStatus(LStream *outStatusData) -{ - mAddressBookController->WriteStatus(outStatusData); -} - -#endif //NEWADDR \ No newline at end of file diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressPickerWindow.h b/mozilla/cmd/macfe/MailNews/AddressBook/CAddressPickerWindow.h deleted file mode 100644 index add96350dd2..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CAddressPickerWindow.h +++ /dev/null @@ -1,81 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// CAddressPickerWindow.h - -#pragma once - -#include "abcom.h" -#ifdef MOZ_NEWADDR -#include "LGADialogBox.h" -#include "CSaveWindowStatus.h" -#include "CComposeAddressTableView.h" -class CAddressBookTableView; -class CAddressBookController; -class CMailNewsContext; -static const UInt16 cAddressPickerWindowStatusVersion = 0x006; -//------------------------------------------------------------------------------ -// ¥ CAddressPickerWindow -//------------------------------------------------------------------------------ -// -class CAddressPickerWindow : public LGADialogBox, public CSaveWindowStatus -{ -public: - static void DoPickerDialog( CComposeAddressTableView* initialTable ); -private: - typedef LGADialogBox Inherited; -public: - enum { class_ID = 'ApWn', pane_ID = class_ID, res_ID = 8990 }; - - // Control IDs - enum EButton { - eOkayButton = 'OkBt', - eCancelButton ='CnBt', - eHelp ='help', - eToButton = 'ToBt', - eCcButton = 'CcBt', - eBccButton = 'BcBt', - ePropertiesButton = 'PrBt' - } ; - - CAddressPickerWindow(LStream *inStream); - ~CAddressPickerWindow(); - void Setup( CComposeAddressTableView* initialTable ); - - virtual ResIDT GetStatusResID() const { return res_ID; } -protected: - virtual void FinishCreateSelf(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - void AddSelection( EAddressType inAddressType ); - - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual UInt16 GetValidStatusVersion() const { return cAddressPickerWindowStatusVersion; } - -private: - - CComposeAddressTableView* mInitialTable; - CComposeAddressTableView* mPickerAddresses; - - CAddressBookController* mAddressBookController; - CMailNewsContext* mMailNewsContext; - CProgressListener* mProgressListener; - EButton mLastAction; -}; -#endif \ No newline at end of file diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CLDAPQueryDialog.cp b/mozilla/cmd/macfe/MailNews/AddressBook/CLDAPQueryDialog.cp deleted file mode 100644 index a24def441a3..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CLDAPQueryDialog.cp +++ /dev/null @@ -1,387 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// CLDAPQueryDialog.cp - -#include "CLDAPQueryDialog.h" -#include "pascalstring.h" -#include "LGAEditField.h" -#include "prefapi.h" -#include "SearchHelpers.h" -#include "resgui.h" -#include "xp_help.h" -//------------------------------------------------------------------------------ -// ¥ CLDAPBasicHandler -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// ¥ Setup -//------------------------------------------------------------------------------ -// -void CLDAPBasicHandler::Setup( MSG_Pane *inSearchPane, DIR_Server *inServer, LView *inView ) -{ - Assert_( inSearchPane != NULL ); - Assert_( inServer != NULL ); - Assert_(inView != NULL ); - - mView = inView; - int maxItems = 4; - - // Get Basic Search attributes - MSG_SearchError error = MSG_GetBasicLdapSearchAttributes ( - inServer, &mSearchAttributes[0], &maxItems); - - - // Update the captions to reflect their new attributes - for( int32 captionNumber = 0; captionNumber < maxItems; captionNumber++ ) - { - LCaption* caption = dynamic_cast< LCaption*>( mView->FindPaneByID (eBasicSearchCaption+ captionNumber ) ); - Assert_( caption ); - caption->SetDescriptor ( CStr255(mSearchAttributes[ captionNumber ].name )); - } - -} - - -//------------------------------------------------------------------------------ -// ¥ GetSearchParameters -//------------------------------------------------------------------------------ -// Get the current search parameters. outSearchParams must be able to hold at least -// 4 elements. Strings are output as c-strings. -// -Int32 CLDAPBasicHandler::GetSearchParameters(SearchLevelParamT* levelParam ) -{ - CStr255 valueString; - MSG_SearchOperator op = (MSG_SearchOperator) opContains;; - int maxItems = 4; - Int32 currentLevel = 0; - - for( int32 i = 0; i < maxItems; i++ ) - { - LGAEditField* editField = dynamic_cast< LGAEditField*>( mView->FindPaneByID (eBasicSearchTerm+ i ) ); - Assert_( editField ); - editField->GetDescriptor ( valueString ); - if ( valueString.Length() ) - { - levelParam[ currentLevel ].val.attribute = MSG_SearchAttribute( mSearchAttributes[ i ].attrib ); - XP_STRCPY( levelParam[ currentLevel ].val.u.string, valueString ); - levelParam[ currentLevel ].op = op; - levelParam[ currentLevel ].boolOp = true; - currentLevel++; - } - } - - return currentLevel; -} - - -//------------------------------------------------------------------------------ -// ¥ SetSearchParameters -//------------------------------------------------------------------------------ -// This works by taking the first occurence of an Param whose attribute -// which matches a basic search criteria attribute. -// -void CLDAPBasicHandler::SetSearchParameters ( SearchLevelParamT* levelParam , int32 numLevels ) -{ - int maxItems = 4; - Int32 currentLevel = 0; - MSG_SearchAttribute attribute; - for( int32 basic = 0; basic < maxItems; basic++ ) - { - attribute = MSG_SearchAttribute( mSearchAttributes[ basic ].attrib ); - for ( int32 currentLevel = 0; currentLevel( mView->FindPaneByID (eBasicSearchTerm+ basic ) ); - Assert_( editField ); - editField->SetDescriptor( CStr255( levelParam[ currentLevel ].val.u.string) ); - break; - } - } - } -} - - -//------------------------------------------------------------------------------ -// ¥ Setup -//------------------------------------------------------------------------------ -// Advanced Search Routines -// Most of the work is done by delagation to the Search Manager -// -void CLDAPAdvancedHandler::Setup( MSG_Pane *inSearchPane, DIR_Server *inServer, LView *inView ) -{ - Assert_( inSearchPane != NULL ); - Assert_( inServer != NULL ); - Assert_(inView != NULL ); - - mSearchFolders.InsertItemsAt(1, LArray::index_First, &inServer); - mSearchManager.InitSearchManager( inView, NULL, scopeLdapDirectory, & mSearchFolders ); - -} - - -//------------------------------------------------------------------------------ -// ¥ GetSearchParameters -//------------------------------------------------------------------------------ -// -Int32 CLDAPAdvancedHandler::GetSearchParameters ( SearchLevelParamT* levelParam ) -{ - mSearchManager.GetSearchParameters( levelParam ); - return mSearchManager.GetNumVisibleLevels(); -} - - -//------------------------------------------------------------------------------ -// ¥ SetSearchParameters -//------------------------------------------------------------------------------ -// -void CLDAPAdvancedHandler::SetSearchParameters ( SearchLevelParamT* levelParam , int32 numLevels ) -{ - mSearchManager.SetSearchParameters ( numLevels, levelParam ); -} - -//------------------------------------------------------------------------------ -// ¥ ~CLDAPQueryDialog -//------------------------------------------------------------------------------ -// -CLDAPQueryDialog::~CLDAPQueryDialog() -{ - if( mMSGPane ) // If the search manager isn't initialized don't save the window data - { - PREF_SetBoolPref("mail.addr_book.useAdvancedSearch", mAdvancedSearch); - CSaveWindowStatus::SaveStatusInfo(); - } -} - - -//------------------------------------------------------------------------------ -// ¥ BuildQuery -//------------------------------------------------------------------------------ -// -Boolean CLDAPQueryDialog::BuildQuery() -{ - // Initial Search setup - Assert_( mMSGPane ); - MSG_SearchFree ( mMSGPane ); - MSG_SearchAlloc ( mMSGPane ); - - - if( MSG_AddLdapScope( mMSGPane, mDirServer ) != SearchError_Success ) - return false; - - if( AddParametersToSearch( ) != SearchError_Success) - return false; - - return true; - -}; - - -//------------------------------------------------------------------------------ -// ¥ AddParametersToSearch -//------------------------------------------------------------------------------ -// -MSG_SearchError CLDAPQueryDialog::AddParametersToSearch( ) -{ - Assert_(mMSGPane != nil); - MSG_SearchError error = SearchError_Success; - - // Get the search parameters - StSearchDataBlock searchParams( mMaxLevels, StSearchDataBlock::eAllocateStrings); - SearchLevelParamT *curLevel = searchParams.GetData(); - int32 numLevels = mHandler[ mAdvancedSearch ]->GetSearchParameters( curLevel ); - - // Add parameters to the search - for ( Int32 i=0; i< numLevels; i++ ) - { - #ifdef FE_IMPLEMENTS_BOOLEAN_OR - error = MSG_AddSearchTerm(mMSGPane, curLevel[i].val.attribute, curLevel[i].op, - &curLevel[i].val, curLevel[i].boolOp, NULL ) ; - #else - error = MSG_AddSearchTerm(mMSGPane, curLevel[i].val.attribute, curLevel[i].op, - &curLevel[i].val) ; - #endif - if ( error != SearchError_Success ) - break; - } - return error; -} - - -//------------------------------------------------------------------------------ -// ¥ Setup -//------------------------------------------------------------------------------ -// -void CLDAPQueryDialog::Setup( MSG_Pane* inPane, DIR_Server* inServer ) -{ - mMSGPane = inPane; - mDirServer = inServer; - - // Set the name of the group box - LView* box = dynamic_cast( FindPaneByID('ScBx') ); - Assert_( box); - CStr255 name; - box->GetDescriptor( name ); - name+= mDirServer->description; - box->SetDescriptor( name ); - - // Setup the Handlers - mBasicView = dynamic_cast( box->FindPaneByID( eBasicEnclosure ) ); - Assert_( mBasicView ); - mHandler[ eBasic ]->Setup( inPane, inServer, mBasicView ); - USearchHelper::LinkListenerToBroadcasters( mBasicView, this ); - - mAdvancedView = dynamic_cast( box->FindPaneByID( eAdvancedEnclosure ) ); - Assert_( mAdvancedView ); - mHandler[ eAdvanced ]->Setup( inPane, inServer, mAdvancedView ); - - CLDAPAdvancedHandler* advancedLDAP = dynamic_cast(mHandler[ eAdvanced ]); - Assert_( advancedLDAP ); - mSearchManager = advancedLDAP->GetSearchManager(); - mSearchManager->AddListener( this ); - - XP_Bool isAdvanced = false; - if (PREF_GetBoolPref("mail.addr_book.useAdvancedSearch", &isAdvanced)== PREF_NOERROR ) - mAdvancedSearch = isAdvanced; - CSaveWindowStatus::FinishCreateWindow(); - - mIsModified = false; - - ShowHandler(); - Show(); - -} - - -//------------------------------------------------------------------------------ -// ¥ ListenToMessage -//------------------------------------------------------------------------------ -// -void CLDAPQueryDialog::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch( inMessage ) - { - case paneID_Search: - BuildQuery(); - break; - - case CSearchManager::msg_SearchParametersResized: - ResizeWindowBy( 0, *((Int16 *) ioParam) ); - break; - - case CSearchEditField::msg_UserChangedText: - mIsModified = true; - break; - - case msg_Help: - if ( mAdvancedSearch ) - ShowHelp( HELP_SEARCH_LDAP_ADVANCED ); - else - ShowHelp( HELP_SEARCH_LDAP_BASIC ); - break; - - case paneID_Advanced: - case paneID_Basic: - if ( !PREF_PrefIsLocked( "mail.addr_book.useAdvancedSearch") ) - mAdvancedSearch = !mAdvancedSearch; - ShowHandler(); - break; - }; - -} - - -//------------------------------------------------------------------------------ -// ¥ FinishCreateSelf -//------------------------------------------------------------------------------ -// -void CLDAPQueryDialog::FinishCreateSelf() -{ - mHandler[ eBasic ] = new CLDAPBasicHandler; - mHandler[ eAdvanced ] = new CLDAPAdvancedHandler; - UReanimator::LinkListenerToControls( this, this, CLDAPQueryDialog::res_ID ); - Inherited::FinishCreateSelf(); -} - - -//------------------------------------------------------------------------------ -// ¥ ShowHandler -//------------------------------------------------------------------------------ -// -void CLDAPQueryDialog::ShowHandler() -{ - Assert_ ( mSearchManager ); - - Int32 windowHeight = 130; - if ( mAdvancedSearch ) - { - Int16 deltaLevels = 5 - mSearchManager->GetNumVisibleLevels(); - windowHeight = 220 - deltaLevels * 23 ; - } - - ResizeWindowTo ( 500, windowHeight ); - // modify contents, always do when going from advanced to basic - // Only do when going from basic to advanced if there has been a modification - if ( mIsModified || !mAdvancedSearch) - { - StSearchDataBlock searchParams( mMaxLevels, StSearchDataBlock::eAllocateStrings); - SearchLevelParamT *curLevel = searchParams.GetData(); - int32 numLevels = mHandler[ !mAdvancedSearch ]->GetSearchParameters( curLevel ); - mHandler[ mAdvancedSearch ]->SetSearchParameters( curLevel, numLevels ); - mIsModified = false; - } - - // Swap the Buttons - USearchHelper::ShowHidePane( FindPaneByID(paneID_Advanced), !mAdvancedSearch); - USearchHelper::ShowHidePane( FindPaneByID( paneID_Basic ), mAdvancedSearch); - - // Swap the panes - USearchHelper::ShowHidePane( mBasicView, !mAdvancedSearch); - USearchHelper::ShowHidePane( mAdvancedView, mAdvancedSearch); -} - - -//------------------------------------------------------------------------------ -// ¥ ReadWindowStatus -//------------------------------------------------------------------------------ -// -void CLDAPQueryDialog::ReadWindowStatus(LStream *inStatusData) -{ - CSaveWindowStatus::ReadWindowStatus(inStatusData); - - mSearchManager->ReadSavedSearchStatus(inStatusData); -} - - -//------------------------------------------------------------------------------ -// ¥ WriteWindowStatus -//------------------------------------------------------------------------------ -// -void CLDAPQueryDialog::WriteWindowStatus(LStream *outStatusData) -{ - CSaveWindowStatus::WriteWindowStatus(outStatusData); - if( mAdvancedSearch == 0 ) - { - mAdvancedSearch = true; - ShowHandler(); - } - mSearchManager->WriteSavedSearchStatus(outStatusData); - -} diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CLDAPQueryDialog.h b/mozilla/cmd/macfe/MailNews/AddressBook/CLDAPQueryDialog.h deleted file mode 100644 index 7961b596f4a..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CLDAPQueryDialog.h +++ /dev/null @@ -1,128 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// CLDAPQueryDialog.h -#pragma once - -#include "LGADialogBox.h" -#include "CSearchManager.h" -#include "CSaveWindowStatus.h" -//------------------------------------------------------------------------------ -// ¥ CLDAPHandlerInterface -//------------------------------------------------------------------------------ -// I am defining a simple interface for getting Search Parameters -// an alternative would have been to subclass CSearchManager -// but that class does a lot more than just building queries -// -class CLDAPHandlerInterface -{ -public: - virtual void Setup( MSG_Pane *inSearchPane, DIR_Server *inServer, LView *inView ) = 0; - virtual Int32 GetSearchParameters ( SearchLevelParamT* levelParam ) = 0; - virtual void SetSearchParameters ( SearchLevelParamT* levelParam , int32 numLevels ) = 0; -protected: - LView * mView; -}; - -//------------------------------------------------------------------------------ -// ¥ CLDAPBasicHandler -//------------------------------------------------------------------------------ -// Handles building queries from basic search pane -// -class CLDAPBasicHandler: public CLDAPHandlerInterface -{ -public: - enum { eBasicSearchTerm = 8965, eBasicSearchCaption = 8961 }; - virtual void Setup( MSG_Pane *inSearchPane, DIR_Server *inServer, LView *inView ); - virtual Int32 GetSearchParameters ( SearchLevelParamT* levelParam ); - virtual void SetSearchParameters ( SearchLevelParamT* levelParam , int32 numLevels ); - -private: - MSG_SearchMenuItem mSearchAttributes[4]; // The names and attributes of the 4 editfields -}; - -//------------------------------------------------------------------------------ -// ¥ CLDAPAdvancedHandler -//------------------------------------------------------------------------------ -// Handles building queries from the advanced pane -// -class CLDAPAdvancedHandler: public CLDAPHandlerInterface -{ -public: - virtual void Setup( MSG_Pane *inSearchPane, DIR_Server *inServer, LView *inView ) ; - virtual Int32 GetSearchParameters ( SearchLevelParamT* levelParam ) ; - virtual void SetSearchParameters ( SearchLevelParamT* levelParam , int32 numLevels ) ; - CSearchManager* GetSearchManager() { return &mSearchManager; } -private: - CSearchManager mSearchManager; - LArray mSearchFolders; -}; - - -static const UInt16 cLDAPSaveWindowStatusVersion = 0x0214; -//------------------------------------------------------------------------------ -// ¥ CLDAPQueryDialog -//------------------------------------------------------------------------------ -// The query building dialog box -// if the user hits okay a query will be build for the given message pane -// -class CLDAPQueryDialog: public LGADialogBox, public CSaveWindowStatus -{ -private: - typedef LGADialogBox Inherited; -public: - enum { class_ID = 'LdDb', res_ID = 8980 }; - enum { eBasic = 0, eAdvanced = 1 }; - enum { eBasicEnclosure = 'BaVw', eAdvancedEnclosure = 'PENC'}; - enum { paneID_Search = 'SRCH', paneID_Advanced = 'AdBt', paneID_Basic = 'BaBt'}; - - CLDAPQueryDialog( LStream* inStream ): LGADialogBox( inStream ), CSaveWindowStatus ( this ) - ,mMaxLevels(5), mAdvancedSearch( 0 ),mSearchManager( NULL ), - mMSGPane(NULL ), mDirServer(NULL ), mIsModified( false) {}; - - ~CLDAPQueryDialog(); - - void Setup( MSG_Pane* inPane, DIR_Server* inServer ); - Boolean BuildQuery(); - - -protected: - virtual void FinishCreateSelf(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); -// Status window - virtual ResIDT GetStatusResID() const { return res_ID; } - virtual UInt16 GetValidStatusVersion() const { return cLDAPSaveWindowStatusVersion; } - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); -private: - void ShowHandler(); - MSG_SearchError AddParametersToSearch(); - - CLDAPHandlerInterface* mHandler[2]; - LView* mBasicView; - LView* mAdvancedView; - - Int32 mAdvancedSearch; - Boolean mIsModified; - - MSG_Pane* mMSGPane; - DIR_Server* mDirServer; - CSearchManager* mSearchManager; - Int32 mMaxLevels; -}; diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CNameCompletionPicker.cp b/mozilla/cmd/macfe/MailNews/AddressBook/CNameCompletionPicker.cp deleted file mode 100644 index d176c6f211c..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CNameCompletionPicker.cp +++ /dev/null @@ -1,414 +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. - */ - - -// CNameCompletionPicker.cp - -#include "abcom.H" -#ifdef MOZ_NEWADDR -#include "CNameCompletionPicker.h" -#include "UStdDialogs.h" -#include "SearchHelpers.h" -#include "LGAPushButton.h" - -LEditField* CNameCompletionPicker::mLastReceivedEditField = nil; -MSG_Pane* CNameCompletionPicker::mLastReceivedPickerPane = nil; -CMailNewsContext* CNameCompletionPicker::mLastReceivedContext = nil; -int CNameCompletionPicker::mLastReceivedNumResults = 0; - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable class [static] -//---------------------------------------------------------------------------- -// -CNameCompletionTable::CNameCompletionTable(LStream* inStream ) - : CMailFlexTable(inStream) -{ -} - - -CNameCompletionTable::~CNameCompletionTable() -{ - SetMessagePane(NULL); - // Do it here so that our DestroyMessagePane() is called. - // If we let the inherited CMailFlexTable do it, it will call - // its own DestroyMessagePane() because ours is already destroyed - // and the PickerPane will be deleted (which is something we - // don't want because it belongs to the CMailAddressEditField). -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable::DestroyMessagePane -//---------------------------------------------------------------------------- -// Don't delete the MSG_PickerPane: it belongs to the CMailAddressEditField -// -void CNameCompletionTable::DestroyMessagePane(MSG_Pane* /*inPane*/) -{ -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable::SetColumnHeaders -//---------------------------------------------------------------------------- -// -void CNameCompletionTable::SetColumnHeaders() -{ - LTableViewHeader* tableHeader = GetTableHeader(); - PaneIDT headerPaneID; - - // Column #1 = 'Type' is the container type (Address Book / LDAP server). - // Column #2 = 'Col0' is the entry type (User / Mailing list). - // The other columns have configurable headers. - for (short col = 2; col <= tableHeader->CountColumns(); col ++) - { - headerPaneID = tableHeader->GetColumnPaneID(col); - Int32 index = headerPaneID - eTableHeaderBase; - AB_ColumnInfo *info = AB_GetColumnInfoForPane(GetMessagePane(), AB_ColumnID(index)); - - LCaption* headerPane = dynamic_cast(GetSuperView()->FindPaneByID(headerPaneID)); - if (headerPane) headerPane->SetDescriptor(CStr255(info->displayString)); - - AB_FreeColumnInfo(info); - } -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable::SelectionChanged -//---------------------------------------------------------------------------- -// -void CNameCompletionTable::SelectionChanged() -{ - Inherited::SelectionChanged(); - StartBroadcasting(); - // Long story: the CTableKeyAttachment from CStandardFlexTable - // calls StopBroadcasting() on keyDown and StartBroadcasting() - // on keyUp. Problem: we are in a dialog and we never get keyUp's. -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable::OpenRow -//---------------------------------------------------------------------------- -// -void CNameCompletionTable::OpenRow(TableIndexT inRow) -{ - if (IsValidRow(inRow)) - { - BroadcastMessage(msg_OK, nil); - } -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable::GetCellDisplayData -//---------------------------------------------------------------------------- -// Entirely copied from CMailingListTableView -// -void CNameCompletionTable::GetCellDisplayData(const STableCell &inCell, ResIDT& ioIcon, CStr255 &ioDisplayString) -{ - ioIcon = 0; - ioDisplayString = ""; - - // Get the attribute corresponding to the current column - LTableViewHeader* tableHeader = GetTableHeader(); - PaneIDT headerPaneID = tableHeader->GetColumnPaneID(inCell.col); - Int32 index = headerPaneID - eTableHeaderBase; - - AB_ColumnInfo *info = AB_GetColumnInfoForPane(GetMessagePane(), AB_ColumnID(index)); - AB_AttribID attrib = info->attribID; - AB_FreeColumnInfo(info); - - // Get the data - uint16 numItems = 1; - AB_AttributeValue* value; - if (AB_GetEntryAttributesForPane(GetMessagePane(), inCell.row-1, &attrib, &value, &numItems) == AB_SUCCESS) - { - if (attrib == AB_attribEntryType) - { - ioIcon = (value->u.entryType == AB_MailingList ? 15263 : 15260); - } - else - { - ioDisplayString = value->u.string ; - } - AB_FreeEntryAttributeValue(value); - } -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable::DrawCellContents -//---------------------------------------------------------------------------- -// Mostly copied from CMailingListTableView -// -void CNameCompletionTable::DrawCellContents(const STableCell &inCell, const Rect &inLocalRect) -{ - ResIDT iconID = 0; - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { - case 'Type': - AB_ContainerType container = AB_GetEntryContainerType(GetMessagePane(), inCell.row-1); - switch (container) - { - case AB_LDAPContainer: iconID = 15250; break; // remote folder - case AB_MListContainer: iconID = 15258; break; // address book - case AB_PABContainer: iconID = 15258; break; // address book - case AB_UnknownContainer: iconID = 0; break; - } - if (iconID) - DrawIconFamily(iconID, 16, 16, 0, inLocalRect); - break; -// case 'Col0': -// ... -// case 'Col6': - default: - CStr255 displayString; - GetCellDisplayData(inCell, iconID, displayString); - if (iconID) - DrawIconFamily(iconID, 16, 16, kTransformNone, inLocalRect); - else - DrawTextString(displayString, &mTextFontInfo, 0, inLocalRect); - break; - } -} - - -#pragma mark - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::DisplayDialog [static] -//---------------------------------------------------------------------------- -// Show the name completion dialog -// -int CNameCompletionPicker::DisplayDialog(LEditField* inEditField, MSG_Pane* inPane, CMailNewsContext* inContext, int inNumResults) -{ - // put up dialog - mLastReceivedEditField = inEditField; - mLastReceivedPickerPane = inPane; - mLastReceivedContext = inContext; - mLastReceivedNumResults = inNumResults; - - RegisterClass_(CNameCompletionPicker); - RegisterClass_(CNameCompletionTable); - - StStdDialogHandler handler(CNameCompletionPicker::res_ID, NULL); - CNameCompletionPicker* dlog = (CNameCompletionPicker*)handler.GetDialog(); - - // run the dialog - MessageT message; - do - { - message = handler.DoDialog(); - } while (message != msg_OK && message != msg_Cancel); - - // return the result - STableCell aCell(0,0); - if (message == msg_OK) - aCell = dlog->GetActiveTable()->GetFirstSelectedCell(); - - // explicitly close the dialog to save its status - dlog->DoClose(); - - return (aCell.row); -} - - -#pragma mark - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker class -//---------------------------------------------------------------------------- -// -CNameCompletionPicker::CNameCompletionPicker(LStream *inStream) - : CMailNewsWindow(inStream, WindowType_NameCompletion) -{ -} - -CNameCompletionPicker::~CNameCompletionPicker() -{ -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::FinishCreateSelf -//---------------------------------------------------------------------------- -// -void CNameCompletionPicker::FinishCreateSelf() -{ - // transmit parameters from the Compose window to the list - ReceiveComposeWindowParameters(); - - mNameCompletionTable = dynamic_cast(USearchHelper::FindViewSubview(this, paneID_NameCompletionTable)); - FailNILRes_(mNameCompletionTable); - mNameCompletionTable->ReceiveMessagePane(mPickerPane); - - // finish create stuff - Inherited::FinishCreateSelf(); - CSaveWindowStatus::FinishCreateWindow(); - - // prepare list - mNameCompletionTable->SetColumnHeaders(); - mNameCompletionTable->SetRowCount(); - STableCell cellToSelect(2, 1); - mNameCompletionTable->SelectCell(cellToSelect); - - // default button - LGAPushButton * defaultBtn = dynamic_cast(FindPaneByID(paneID_OkButton)); - if (defaultBtn) defaultBtn->SetDefaultButton(true, true); - mNameCompletionTable->AddListener(this); - - // show window - this->Show(); - this->Select(); -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::DoClose -//---------------------------------------------------------------------------- -// -void CNameCompletionPicker::DoClose() -{ - // Save table data and window position - SaveStatusInfo(); - - // Close window - Inherited::DoClose(); -} - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::CalcStandardBoundsForScreen -//---------------------------------------------------------------------------- -// Zoom in the vertical direction only. -// -void CNameCompletionPicker::CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const -{ - LWindow::CalcStandardBoundsForScreen(inScreenBounds, outStdBounds); - Rect contRect = UWindows::GetWindowContentRect(mMacWindowP); - - outStdBounds.left = contRect.left; - outStdBounds.right = contRect.right; -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::ListenToMessage -//---------------------------------------------------------------------------- -// -void CNameCompletionPicker::ListenToMessage(MessageT inMessage, void */*ioParam*/) -{ - if (inMessage == msg_OK) - { - LControl* keyButton = (LControl*)FindPaneByID(paneID_OkButton); - keyButton->SimulateHotSpotClick(kControlButtonPart); - } -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::HandleKeyPress -//---------------------------------------------------------------------------- -// Handle Escape and Cmd-Period (copied from LDialogBox) -// -Boolean CNameCompletionPicker::HandleKeyPress(const EventRecord &inKeyEvent) -{ - Boolean keyHandled = false; - PaneIDT keyButtonID = 0; - - switch (inKeyEvent.message & charCodeMask) - { - case char_Enter: - case char_Return: - keyButtonID = paneID_OkButton; - break; - - case char_Escape: - if ((inKeyEvent.message & keyCodeMask) == vkey_Escape) - keyButtonID = paneID_CancelButton; - break; - - default: - if (UKeyFilters::IsCmdPeriod(inKeyEvent)) - keyButtonID = paneID_CancelButton; - else - keyHandled = LWindow::HandleKeyPress(inKeyEvent); - break; - } - - if (keyButtonID != 0) - { - LControl* keyButton = (LControl*)FindPaneByID(keyButtonID); - keyButton->SimulateHotSpotClick(kControlButtonPart); - keyHandled = true; - } - - return keyHandled; -} - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::ReadWindowStatus -//---------------------------------------------------------------------------- -// Put the window next to the edit field and try to restore its last size. -// -void CNameCompletionPicker::ReadWindowStatus(LStream *inStatusData) -{ - // get last window size - Rect savedBounds; - if (inStatusData != nil) - *inStatusData >> savedBounds; - else - { - GetPaneGlobalBounds(this, &savedBounds); - savedBounds.right = savedBounds.left + 320; //¥ TODO: remove these hard-coded values - } - - // put the window at the right of the caret position in the edit field - TEHandle teH = mEditField->GetMacTEH(); - short caretPos = (*teH)->selStart; - - Rect actualBounds; - mEditField->CalcPortFrameRect(actualBounds); - mEditField->PortToGlobalPoint(topLeft(actualBounds)); - actualBounds.top -= 44; //¥ TODO: remove these hard-coded values - actualBounds.left += (caretPos + 3) * 7; //¥ TODO: - actualBounds.bottom = actualBounds.top + (savedBounds.bottom - savedBounds.top); - actualBounds.right = actualBounds.left + (savedBounds.right - savedBounds.left); - - VerifyWindowBounds(this, &actualBounds); - DoSetBounds(actualBounds); - - // restore table data - if (inStatusData != nil) - mNameCompletionTable->ReadSavedTableStatus(inStatusData); -} - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker::WriteWindowStatus -//---------------------------------------------------------------------------- -// Save window size and table data. -// -void CNameCompletionPicker::WriteWindowStatus(LStream *outStatusData) -{ - CSaveWindowStatus::WriteWindowStatus(outStatusData); - mNameCompletionTable->WriteSavedTableStatus(outStatusData); -} -#endif //MOZ_NEWADDR diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/CNameCompletionPicker.h b/mozilla/cmd/macfe/MailNews/AddressBook/CNameCompletionPicker.h deleted file mode 100644 index 565bfc2a798..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/CNameCompletionPicker.h +++ /dev/null @@ -1,135 +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. - */ - - -// CNameCompletionPicker.h - -#pragma once - -#include "abcom.H" -#ifdef MOZ_NEWADDR -#include "CMailNewsWindow.h" -//¥#include "CAddressBookViews.h" -#include "CMailFlexTable.h" -#include "msgcom.h" -#include "PascalString.h" - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionTable class -// -//---------------------------------------------------------------------------- -// -class CNameCompletionTable : public CMailFlexTable -{ -public: - typedef CMailFlexTable Inherited; - enum { class_ID = 'NcVw', pane_ID = 'Tabl' }; - - enum EColType { - eTableHeaderBase = 'Col0' // Columns are called 'Col0', 'Col1', 'Col2' etc... - }; // but 'Col0' is not used (it used to contain the person/list icon) - -public: - CNameCompletionTable(LStream *inStream); - virtual ~CNameCompletionTable(); - void SetColumnHeaders(); - - virtual void DeleteSelection() {}; - virtual void SelectionChanged(); - virtual void OpenRow(TableIndexT inRow); - virtual void ReceiveMessagePane(MSG_Pane* inMsgPane) {SetMessagePane(inMsgPane);}; - virtual void DestroyMessagePane( MSG_Pane* inPane ); - -protected: - virtual void GetCellDisplayData(const STableCell &inCell, ResIDT &ioIcon, CStr255 &ioDisplayString ); - virtual void DrawCellContents( - const STableCell &inCell, - const Rect &inLocalRect); -}; - - -//---------------------------------------------------------------------------- -// ¥ CNameCompletionPicker class -// -//---------------------------------------------------------------------------- -// -static const UInt16 cNameCompletionSaveWindowStatusVersion = 0x0200; - -class CNameCompletionPicker : public CMailNewsWindow - , public LListener -{ -public: - typedef CMailNewsWindow Inherited; - - enum { class_ID = 'NcWn', pane_ID = class_ID, res_ID = 8970 }; - - enum { - paneID_OkButton = 'BtOk', - paneID_CancelButton = 'Canc', - paneID_NameCompletionTable = 'Tabl' - }; - - // Dialog handler - static int DisplayDialog(LEditField* inEditField, MSG_Pane* inPane, CMailNewsContext* inContext, int inNumResults); - - // Stream creator method - CNameCompletionPicker(LStream *inStream); - virtual ~CNameCompletionPicker(); - virtual ResIDT GetStatusResID() const { return res_ID; } - virtual CNSContext* CreateContext() const { return (CNSContext*)mLastReceivedContext; } - virtual void CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const; - virtual void DoClose(); - virtual void ListenToMessage( - MessageT inMessage, - void *ioParam); - - -protected: - - // Overriden methods - virtual void FinishCreateSelf(); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - // Utility methods - virtual CMailFlexTable* GetActiveTable() { return mNameCompletionTable; } - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual UInt16 GetValidStatusVersion() const { return cNameCompletionSaveWindowStatusVersion;} - virtual void ReceiveComposeWindowParameters() { - mEditField = mLastReceivedEditField; - mPickerPane = mLastReceivedPickerPane; - mContext = mLastReceivedContext; - mNumResults = mLastReceivedNumResults; - } - - // Instance variables - CNameCompletionTable *mNameCompletionTable; - LEditField* mEditField; - MSG_Pane* mPickerPane; - CMailNewsContext* mContext; - int mNumResults; - -private: - static LEditField* mLastReceivedEditField; - static MSG_Pane* mLastReceivedPickerPane; - static CMailNewsContext* mLastReceivedContext; - static int mLastReceivedNumResults; -}; -#endif //MOZ_NEWADDR diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/UAddressBookUtilities.cp b/mozilla/cmd/macfe/MailNews/AddressBook/UAddressBookUtilities.cp deleted file mode 100644 index a7c4710a3c4..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/UAddressBookUtilities.cp +++ /dev/null @@ -1,151 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// UAddressBookUtilities.cp - -#include "UAddressBookUtilities.h" -#ifdef MOZ_NEWADDR -#include "MailNewsgroupWindow_Defines.h" -#include "resgui.h" -#include "CMailFlexTable.h" -#include "UMailSelection.h" -#include "CAddressBookViews.h" // Need for pane ID's that should be fixed - -//------------------------------------------------------------------------------ -// ¥ GetABCommand -//------------------------------------------------------------------------------ -// Convert a powerplant command into a AB_CommandType -// -AB_CommandType UAddressBookUtilites::GetABCommand( CommandT inCommand ) -{ - switch ( inCommand ) - { - - case cmd_NewMailMessage: - case cmd_ComposeMailMessage: return AB_NewMessageCmd; - case cmd_ImportAddressBook: return AB_ImportCmd; - case cmd_SaveAs: return AB_SaveCmd; -// case cmd_Close: return AB_CloseCmd; - - case cmd_NewAddressBook: return AB_NewAddressBook; - case cmd_NewDirectory: return AB_NewLDAPDirectory; - - case cmd_Undo: return AB_UndoCmd; - case cmd_Redo: return AB_RedoCmd; - - case UAddressBookUtilites::cmd_DeleteEntry: return AB_DeleteCmd; - -// case return AB_LDAPSearchCmd, - - case CAddressBookPane::eCol0: return AB_SortByColumnID0; - case CAddressBookPane::eCol1: return AB_SortByColumnID1; - case CAddressBookPane::eCol2: return AB_SortByColumnID2; - case CAddressBookPane::eCol3: return AB_SortByColumnID3; - case CAddressBookPane::eCol4: return AB_SortByColumnID4; - case CAddressBookPane::eCol5: return AB_SortByColumnID5; - case CAddressBookPane::cmd_SortAscending: return AB_SortAscending; - case CAddressBookPane::cmd_SortDescending: return AB_SortDescending; - - case cmd_NewAddressCard: return AB_AddUserCmd; - case cmd_NewAddressList: return AB_AddMailingListCmd; - case cmd_EditProperties: return AB_PropertiesCmd; - case cmd_ConferenceCall: return AB_CallCmd; - // case return AB_ImportLdapEntriesCmd - default: return AB_CommandType( invalid_command ); - } -} - -//------------------------------------------------------------------------------ -// ¥ ABCommandStatus -//------------------------------------------------------------------------------ -// Determine if a command should be enabled. -// -// -void UAddressBookUtilites::ABCommandStatus( - CMailFlexTable* inTable, - AB_CommandType inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - if( inCommand != UAddressBookUtilites::invalid_command ) - { - XP_Bool selectable; - MSG_COMMAND_CHECK_STATE checkedState; - const char* display_string = nil; - XP_Bool plural; - - // Get table selection - CMailSelection selection; - inTable->GetSelection(selection); - - // Check command status - if ( AB_CommandStatusAB2( - inTable->GetMessagePane(), - inCommand, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize, - &selectable, - &checkedState, - &display_string, - &plural) - >= 0) - { - outEnabled = (Boolean)selectable; - outUsesMark = true; - if (checkedState == MSG_Checked) - outMark = checkMark; - else - outMark = 0; - - if (display_string && *display_string) - *(CStr255*)outName = display_string; - } - } -} - -//------------------------------------------------------------------------------ -// ¥ ABCommand -//------------------------------------------------------------------------------ -// Execute a menu command -// NOTE: this takes a PowerPlant Command -// -Boolean UAddressBookUtilites::ABCommand( CMailFlexTable* inTable, AB_CommandType inCommand) -{ - Assert_( inTable ); - Boolean enabled, usesMark; - Char16 mark; - Str255 name; - if ( inCommand == invalid_command ) - return AB_INVALID_COMMAND; - // Check to see if the command was enabled for this table - UAddressBookUtilites::ABCommandStatus( inTable, inCommand, enabled, usesMark, mark, name ); - if ( !enabled ) - return AB_INVALID_COMMAND; - - // Get table Selection - CMailSelection selection; - inTable->GetSelection(selection); - - // Execute the command - return AB_CommandAB2( inTable->GetMessagePane(), inCommand, - (MSG_ViewIndex*)selection.GetSelectionList(), selection.selectionSize ); -} -#endif diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/UAddressBookUtilities.h b/mozilla/cmd/macfe/MailNews/AddressBook/UAddressBookUtilities.h deleted file mode 100644 index bee459e1992..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/UAddressBookUtilities.h +++ /dev/null @@ -1,122 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// UAddressBookUtilities.h - -#pragma once -#include "MailNewsAddressBook.h" -#include "abcom.h" -#ifdef MOZ_NEWADDR - - -class CMailFlexTable; -//------------------------------------------------------------------------------ -// ¥ UAddressBookUtilites -//------------------------------------------------------------------------------ -// -class UAddressBookUtilites -{ -public: - enum { // Command IDs - cmd_NewAddressCard = 'NwCd' // New Card - , cmd_NewAddressList = 'NwLs' // New List - , cmd_NewAddressBook = 'NwAb' - , cmd_NewDirectory = 'NwDr' - , cmd_HTMLDomains = 'HtDm' // domains dialog. - , cmd_EditProperties = 'EdPr' // Edit properties for a list or card - , cmd_DeleteEntry = 'DeLe' // Delete list or card - , cmd_ComposeMailMessage = 'Cmps' // Compose a new mail message - , cmd_ConferenceCall = 'CaLL' - , cmd_ViewMyCard = 'vmyC' - , invalid_command = 0xFFFFFFFF - }; - - static AB_CommandType GetABCommand( CommandT inCommand ); - static void ABCommandStatus( - CMailFlexTable* inTable, AB_CommandType inCommand, - Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName - ); - static Boolean ABCommand( CMailFlexTable* inTable, AB_CommandType inCommand); -}; - - -// The following stack based classes are designed to help with the memory managment -// of attributes return from the backend for the Continer and Entry attributes - -//------------------------------------------------------------------------------ -// ¥ StABEntryAttribute -//------------------------------------------------------------------------------ -// Handles memory management for ABEntryAttributes -// -class StABEntryAttribute -{ -public: - StABEntryAttribute ( MSG_Pane* inPane, MSG_ViewIndex inIndex, AB_AttribID inAttrib) - { - if(AB_GetEntryAttributeForPane ( inPane, inIndex-1, inAttrib , &mValue ) != AB_SUCCESS ) - mValue = NULL; - } - - StABEntryAttribute() - { - if ( mValue ) - AB_FreeEntryAttributeValue ( mValue ); - } - - char* GetChar() const { return ( mValue ? mValue->u.string : NULL ); } - Int16 GetShort() const { return ( mValue ? mValue->u.shortValue : 0 ) ;} - XP_Bool GetBoolean() const { return ( mValue ? mValue->u.boolValue : false ); } - AB_EntryType GetEntryType() const { return( mValue ? mValue->u.entryType : AB_Person); } - -private: - AB_AttributeValue *mValue ; -}; - -//------------------------------------------------------------------------------ -// ¥ StABContainerAttribute -//------------------------------------------------------------------------------ -// Handles memory management for ABEContainerAttributes -// -class StABContainerAttribute -{ -public: - StABContainerAttribute ( MSG_Pane* inPane, MSG_ViewIndex inIndex, AB_ContainerAttribute inAttrib) - { - - if( AB_GetContainerAttributeForPane ( inPane, inIndex-1, inAttrib , &mValue ) != AB_SUCCESS ) - mValue = NULL; - } - - StABContainerAttribute() - { - if ( mValue ) - AB_FreeContainerAttribValue ( mValue ); - } - - char* GetChar() const {return( mValue ? mValue->u.string : NULL ); } - Int32 GetNumber() const { return( mValue ? mValue->u.number: 0 ) ;} - AB_ContainerInfo* GetContainerInfo() const { return( mValue ? mValue->u.container : NULL ); } - AB_ContainerType GetContainerType() const { return( mValue ? mValue->u.containerType : AB_PABContainer ); } - -private: - AB_ContainerAttribValue *mValue ; -}; - -#endif diff --git a/mozilla/cmd/macfe/MailNews/AddressBook/temp.txt b/mozilla/cmd/macfe/MailNews/AddressBook/temp.txt deleted file mode 100644 index 8ec30810548..00000000000 --- a/mozilla/cmd/macfe/MailNews/AddressBook/temp.txt +++ /dev/null @@ -1,3 +0,0 @@ -total 8 -drwxr-xr-x 2 sfraser nuucp 4096 May 18 20:47 CVS --rw-r--r-- 1 sfraser nuucp 0 May 18 20:48 temp.txt diff --git a/mozilla/cmd/macfe/MailNews/CBiffButtonAttachment.cp b/mozilla/cmd/macfe/MailNews/CBiffButtonAttachment.cp deleted file mode 100644 index 429aca804d9..00000000000 --- a/mozilla/cmd/macfe/MailNews/CBiffButtonAttachment.cp +++ /dev/null @@ -1,111 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CBiffButtonAttachment.cp - -#include "CBiffButtonAttachment.h" - -#include "LSharable.h" -#include "CButton.h" -#include "CCheckMailContext.h" - -#include - -void SetIconState(LControl* inControl, ResIDT inID); - -//====================================== -#pragma mark --------- class CBiffButtonAttachment -//====================================== - -//----------------------------------- -CBiffButtonAttachment::CBiffButtonAttachment(LStream* inStream) -//----------------------------------- -: LAttachment(inStream) -, mButton(nil) -{ - for (int i = MSG_BIFF_NewMail; i <= MSG_BIFF_Unknown; i++) - *inStream >> mResIDList[i]; - SetMessage(msg_Nothing); // Don't bother calling me, ever. - LAttachable *host = LAttachable::GetDefaultAttachable(); - mButton = dynamic_cast(host); - Assert_(mButton); - if (!mButton) return; -#ifndef MOZ_LITE - CCheckMailContext* theContext = CCheckMailContext::Get(); - theContext->AddUser(this); - theContext->AddListener(this); - // Initialize the icon according to the current state! - SetIconState(mButton, mResIDList[theContext->GetState()]); -#endif // MOZ_LITE -} // CBiffButtonAttachment::CBiffButtonAttachment - -//----------------------------------- -CBiffButtonAttachment::~CBiffButtonAttachment() -//----------------------------------- -{ -#ifndef MOZ_LITE - CCheckMailContext* theContext = CCheckMailContext::Get(); - theContext->RemoveListener(this); - theContext->RemoveUser(this); -#endif // MOZ_LITE -} // CBiffButtonAttachment::~CBiffButtonAttachment - -//----------------------------------- -void SetIconState(LControl* inControl, ResIDT inID) -// sets the icon id of the control according to this. -//----------------------------------- -{ - if (!inID) - return; - CButton* button = dynamic_cast(inControl); - if (button) - { - // CButton case - button->SetGraphicID(inID); - } - else - { - // LGAIconSuiteControl case (may need to support others later...) - LGAIconSuiteControl* lgaButton = dynamic_cast(inControl); - if (lgaButton) - lgaButton->SetIconResourceID(inID); - } - inControl->Refresh(); -} - -//----------------------------------- -void CBiffButtonAttachment::ListenToMessage(MessageT inMessage, void* ioParam) -//----------------------------------- -{ - if (inMessage != CCheckMailContext::msg_MailNotificationState) - return; - SetIconState(mButton, mResIDList[*(MSG_BIFF_STATE*)ioParam]); -} // CBiffButtonAttachment::ListenToMessage - -//----------------------------------- -void CBiffButtonAttachment::ExecuteSelf( - MessageT /* inMessage */, - void* /* ioParam */) -//----------------------------------- -{ - // We have nothing to do, and because we set our message to msg_Nothing, we'll never - // be called. However, I don't want to export this empty method from PP just to satisfy - // the linker. -} diff --git a/mozilla/cmd/macfe/MailNews/CBiffButtonAttachment.h b/mozilla/cmd/macfe/MailNews/CBiffButtonAttachment.h deleted file mode 100644 index eb7873c8c37..00000000000 --- a/mozilla/cmd/macfe/MailNews/CBiffButtonAttachment.h +++ /dev/null @@ -1,50 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CBiffButtonAttachment.h - -#pragma once - -#include "LAttachment.h" - -class LControl; - -//====================================== -class CBiffButtonAttachment : public LAttachment, public LListener -// Just attach this to a control. It will listen for biff broadcasts and -// set the icon id of its host button accordingly. There is no ExecuteSelf method, -// we are only using this attachment so we can add it in Constructor, and it -// will figure out which button it is attached to. -//====================================== -{ -public: - enum { class_ID = 'BfAt' }; - CBiffButtonAttachment(LStream* inStream); - virtual ~CBiffButtonAttachment(); - virtual void ListenToMessage(MessageT inMeesage, void* ioParam); -protected: - virtual void ExecuteSelf( - MessageT inMessage, - void *ioParam); -protected: - LControl* mButton; - ResIDT mResIDList[3]; // indexed by MSG_BIFF_STATE -}; // class CBiffButtonAttachment - diff --git a/mozilla/cmd/macfe/MailNews/CCaption.cp b/mozilla/cmd/macfe/MailNews/CCaption.cp deleted file mode 100644 index 71a7f24960f..00000000000 --- a/mozilla/cmd/macfe/MailNews/CCaption.cp +++ /dev/null @@ -1,162 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CCaption.cp - -#include "CCaption.h" -#include -#include "PascalString.h" -#include -#include - -/////////////////////////////////////////////////////////////////// -// constants -const short booleanStringResID = 901; // resource ID of the boolean strings in macfe.r - -/////////////////////////////////////////////////////////////////// -// CCaption - -void CCaption::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - StColorPenState theColorPenState; - StColorPenState::Normalize (); - StTextState theTextState; - - Int16 just = UTextTraits::SetPortTextTraits(mTxtrID); - - // ¥ Save off the text color as setup by the TextTrait - RGBColor textColor; - ::GetForeColor(&textColor); - ApplyForeAndBackColors(); - ::RGBForeColor(&textColor); - - // the following code adapted from LGARadioButton.cp - - // ¥ Loop over any devices we might be spanning and handle the drawing - // appropriately for each devices screen depth - StDeviceLoop theLoop ( frame ); - Int16 depth; - while ( theLoop.NextDepth ( depth )) - { - if ( depth < 4 ) // ¥ BLACK & WHITE - { - if ( !IsEnabled() ) - { - // ¥ If the caption is dimmed then we use the grayishTextOr - // transfer mode to draw the text - ::TextMode ( grayishTextOr ); - } - } - else if ( depth >= 4 ) // ¥ COLOR - { - if ( !IsEnabled() ) - { - // ¥ If the control is dimmed then we have to do our own version of the - // grayishTextOr as it does not appear to work correctly across - // multiple devices - RGBColor textColor2 = UGraphicsUtilities::Lighten( &textColor ); - ::TextMode ( srcOr ); - ::RGBForeColor ( &textColor2 ); - } - } - - UTextDrawing::DrawWithJustification((Ptr)&mText[1], mText[0], frame, just); - } -} - -void CCaption::EnableSelf() -{ - Draw( nil ); -} - -void CCaption::DisableSelf() -{ - Draw( nil ); -} - -/////////////////////////////////////////////////////////////////// -// CListenerCaption - -// Default constructor -CListenerCaption::CListenerCaption( LStream *inStream ) : labelNum( default_menu_item ), - CCaption ( inStream ) -{ -} - -// Default destructor -CListenerCaption::~CListenerCaption() -{ -} - -// Change label -void -CListenerCaption::ChangeText( const LabelNum& newLabelNum ) -{ - Str255 string; - ::GetIndString( string, resourceID, newLabelNum ); - // needs check and exception - SetDescriptor( string ); - labelNum = newLabelNum; -} - -// Return the label num -LabelNum -CListenerCaption::GetLabelNum() const -{ - return labelNum; -} - -// Return the label num -void -CListenerCaption::SetLabelNum( const LabelNum& newLabelNum ) -{ - labelNum = newLabelNum; -} - -// Override of the ListenToMessage method -// -// *** Needs exceptions -// -void -CListenerCaption::ListenToMessage( MessageT inMessage, void *ioParam) -{ - if( mMsg_changeText == inMessage ) - { - LabelNum menuItem = *( static_cast< LabelNum* >( ioParam ) ); - ChangeText( menuItem ); - } -} - -// Needs to be called before using this class -// -// *** Needs exceptions -// -void -CListenerCaption::Init( const short strResID, const MessageT& getNew_msg ) -{ - if( getNew_msg ) - mMsg_changeText = getNew_msg; - - if( strResID ) - resourceID = strResID; -} diff --git a/mozilla/cmd/macfe/MailNews/CCaption.h b/mozilla/cmd/macfe/MailNews/CCaption.h deleted file mode 100644 index ad0064ae9ab..00000000000 --- a/mozilla/cmd/macfe/MailNews/CCaption.h +++ /dev/null @@ -1,86 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CCaption.h - -#pragma once - -#include -#include - -class LStream; - -typedef Int32 LabelNum; - -// CCaption -// -// Moved from meditdlg.cp to be used as base class for the Listener/Lcaption derived -// class ( CListenerCaption ). -// -// ---- -// -// this class is draw a caption in a disabled state if appropriate -// - -class CCaption : public LCaption -{ - public: - enum { class_ID = 'CapD' }; - - CCaption( LStream* inStream ) : LCaption ( inStream ) {}; - - virtual void DrawSelf(); - virtual void EnableSelf(); - virtual void DisableSelf(); -}; - -// CListenerCaption -// -// A simple label class that is also a listener. It listens to -// messages and changes its content (i.e. text ). -// -// *** The Init method needs to be called before this class can be used. -// -// *** Needs exceptions support - -class CListenerCaption : public CCaption, public LListener -{ - public: - enum { class_ID = 'CCap' }; // class id - enum { default_menu_item = 1 }; // initial defualt menu item - - CListenerCaption( LStream *inStream ); - virtual ~CListenerCaption(); - - virtual void Init( const short strResID, const MessageT& getNew_msg ); - - virtual void ChangeText( const LabelNum& newLabelNum ); - virtual void ListenToMessage( MessageT inMessage, void *ioParam ); - - LabelNum GetLabelNum() const; - void SetLabelNum( const LabelNum& newLabelNum ); - - protected: - - private: - LabelNum labelNum; - short resourceID; - MessageT mMsg_changeText; -}; diff --git a/mozilla/cmd/macfe/MailNews/CCheckMailContext.cp b/mozilla/cmd/macfe/MailNews/CCheckMailContext.cp deleted file mode 100644 index 760aa06d75c..00000000000 --- a/mozilla/cmd/macfe/MailNews/CCheckMailContext.cp +++ /dev/null @@ -1,248 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CCheckMailContext.cp - -#include "CCheckMailContext.h" - -// FE -#include "PascalString.h" - -// XP -#include "prefapi.h" - -extern "C" int GetBiffPrefs(const char* prefnode, void* instanceData); - -//====================================== -// class CCheckMailContext -// -// Context for biff, regular checking for mail. -// Should only be instantiated once. -//====================================== - -CCheckMailContext* CCheckMailContext::sCheckMailContext = nil; - -//----------------------------------- -CCheckMailContext* CCheckMailContext::Get() -//----------------------------------- -{ - if (!sCheckMailContext) - new CCheckMailContext(); - return sCheckMailContext; -} - -#if 0 // seems to be obsolete. -//----------------------------------- -extern "C" int GetBiffPrefs(const char* prefnode, void* /*instanceData*/) -//----------------------------------- -{ - return 0; -} -#endif // 0 - -//----------------------------------- -CCheckMailContext::CCheckMailContext() -//----------------------------------- -: CMailNewsContext(MWContextBiff) -, mCheckMailState(MSG_BIFF_Unknown) -, mOutstandingNotification(false) -, mMailNotifyIcon(nil) -{ - // should only create one - Assert_(sCheckMailContext == nil); - sCheckMailContext = this; - memset(&mNotification, 0, sizeof(NMRec)); -} - -//----------------------------------- -/* static */ void CCheckMailContext::Initialize(void* inUser) -//----------------------------------- -{ - Boolean firstUser = (sCheckMailContext == nil); - CCheckMailContext* biff = CCheckMailContext::Get(); - biff->AddUser(inUser); // must do before initialize call; - Assert_(sCheckMailContext); - if (firstUser) - MSG_BiffInit(*sCheckMailContext, MSG_GetPrefsForMaster(GetMailMaster())); -#if 0 // seems to be obsolete. - GetBiffPrefs(nil, nil); - PREF_RegisterCallback("mail.check_new_mail", GetBiffPrefs, this); - PREF_RegisterCallback("mail.check_time", GetBiffPrefs, this); -#endif // 0 -} // CCheckMailContext::Initialize - -//----------------------------------- -/* static */ void CCheckMailContext::Release(void* inUser) -//----------------------------------- -{ - if (sCheckMailContext) - sCheckMailContext->RemoveUser(inUser); // and delete; -} // CCheckMailContext::Release - -//----------------------------------- -CCheckMailContext::~CCheckMailContext() -//----------------------------------- -{ - Assert_(sCheckMailContext == this); - MSG_BiffCleanupContext(*this); - sCheckMailContext = nil; - RemoveNotification(); -} - -#if 0 -//----------------------------------- -void CCheckMailContext::SetState(MSG_BIFF_STATE state) -// Sets biff state and does all the ui fun to reflect the change -//----------------------------------- -{ - Assert_(sCheckMailContext != nil); - sCheckMailContext->DoSetState(state); -} -#endif - -//----------------------------------- -void CCheckMailContext::SuspendResume() -// End Mac notification of new mail, called on suspend/resume -// -// Actually "resets" notification in for the case -// where we've become the front process having -// posted a notification when not the front process. -// -// This allows us to move the blinking icon from the -// process menu to the apple menu when we become frontmost. - -// NOT ANY MORE!!! -// This logic breaks when you want Dogbert to beep on new mail when -// it's in the background _or_ foreground. This logic also breaks -// when trying to move the blinking icon to the process menu on a suspend -// since we are still the foreground app. -//----------------------------------- -{ -#if 0 - if (sCheckMailContext) - sCheckMailContext->DoSuspendResume(); -#endif -} - -#if 0 -//----------------------------------- -void CCheckMailContext::DoSuspendResume() -//----------------------------------- -{ - RemoveNotification(); - if (GetState() == MSG_BIFF_NewMail) - InstallNotification(); -} -#endif - -//----------------------------------- -void CCheckMailContext::SetState(MSG_BIFF_STATE state) -// Sets biff state and does all the ui fun to reflect the change -//----------------------------------- -{ - if (state != GetState()) - { - mCheckMailState = state; - BroadcastMessage(msg_MailNotificationState, &state); - - // Flash notification icon - if (state == MSG_BIFF_NewMail) - InstallNotification(); - else - RemoveNotification(); - } -} - -//----------------------------------- -void CCheckMailContext::RemoveNotification() -//----------------------------------- -{ - if (mOutstandingNotification) - { - ::NMRemove(&mNotification); - mOutstandingNotification = false; - } - if (mNotification.nmSound) - { - ::DisposeHandle(mNotification.nmSound); - mNotification.nmSound = nil; - } -} - -//----------------------------------- -void CCheckMailContext::InstallNotification() -// If we're not the front process, blink our icon in the process menu and beep. -// If we are the front process, blink our icon in the apple menu (no beep) -//----------------------------------- -{ - if (!mOutstandingNotification) - { - ProcessSerialNumber front, current; - ::GetCurrentProcess(¤t); - ::GetFrontProcess(&front); - Boolean mozillaIsInFront; - OSErr err = ::SameProcess(¤t, &front, &mozillaIsInFront); - - if (err == noErr) - { - if (mMailNotifyIcon == nil) - err = ::GetIconSuite(&mMailNotifyIcon, BIFF_NOTIFY_ICONSUITE, kSelectorSmall8Bit | kSelectorSmall1Bit); - - if (err == noErr && mMailNotifyIcon != nil) - { - Handle soundToPlay = nil; // using nil will play no sound. -// if (!mozillaIsInFront) Always play sound if one specified - { - CStr31 soundName; // constructor initializes to empty. -#define USING_PREF_SOUND 1 -#if USING_PREF_SOUND - char buffer[256]; - int charsReturned = sizeof(buffer); - PREF_GetCharPref("mail.notification.sound", buffer, &charsReturned); - if (strlen(buffer) < sizeof(soundName)) - soundName = buffer; // (PascalString takes care of conversion) -#else - soundName = "Quack"; -#endif - soundToPlay = ::GetNamedResource('snd ', soundName); - if (soundToPlay) - { - ::HNoPurge(soundToPlay); - ::DetachResource(soundToPlay); - } - } - // set up the notification manager record - mNotification.qType = nmType; - mNotification.nmMark = (mozillaIsInFront) ? 0 : 1; // if we're the front process, blink in apple menu, else in process menu - mNotification.nmIcon = mMailNotifyIcon; - mNotification.nmSound = soundToPlay; // can be nil - mNotification.nmStr = nil; // no dialog - mNotification.nmResp = nil; // no callback - - if ( ::NMInstall(&mNotification) == noErr) - mOutstandingNotification = true; - } - } - } -} - - - - diff --git a/mozilla/cmd/macfe/MailNews/CCheckMailContext.h b/mozilla/cmd/macfe/MailNews/CCheckMailContext.h deleted file mode 100644 index 78b81fe42f7..00000000000 --- a/mozilla/cmd/macfe/MailNews/CCheckMailContext.h +++ /dev/null @@ -1,64 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CCheckMailContext.h - -#pragma once - -#include "CMailNewsContext.h" - -//====================================== -class CCheckMailContext : public CMailNewsContext -//====================================== -{ -public: - enum - { - BIFF_NOTIFY_ICONSUITE = 15242, - msg_MailNotificationState = 'malS' - }; -private: // must call GetCheckMailContext - CCheckMailContext(); -public: - - static CCheckMailContext* Get(); - static void SuspendResume(); - static void Initialize(void* inUser); - static void Release(void* inUser); - void SetState(MSG_BIFF_STATE state); - MSG_BIFF_STATE GetState() const { return mCheckMailState; } - -protected: -#if 0 - void DoSuspendResume(); -#endif - void RemoveNotification(); - void InstallNotification(); // do fun mac stuff - virtual ~CCheckMailContext(); - -// -- Data -- -protected: - static CCheckMailContext *sCheckMailContext; - MSG_BIFF_STATE mCheckMailState; - - Boolean mOutstandingNotification; - NMRec mNotification; - Handle mMailNotifyIcon; -}; // class CCheckMailContext diff --git a/mozilla/cmd/macfe/MailNews/CComposeAddressTableView.cp b/mozilla/cmd/macfe/MailNews/CComposeAddressTableView.cp deleted file mode 100644 index dab7259e64b..00000000000 --- a/mozilla/cmd/macfe/MailNews/CComposeAddressTableView.cp +++ /dev/null @@ -1,2094 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CComposeAddressTableView.cp - -#include "abcom.h" -#include "addrbook.h" -#include "CComposeAddressTableView.h" - -#include -#include -#include "NetscapeDragFlavors.h" -#include "msgcom.h" -#include "uprefd.h" -#include "UGraphicGizmos.h" -#include "CMailComposeWindow.h" -#include "CMailFlexTable.h" -#include "dirprefs.h" -#include "CComposeSession.h" -#include "CDrawingState.h" -#include "CPasteSnooper.h" -#include "resgui.h" -#include "CStandardFlexTable.h" -#include "LTableRowSelector.h" -#include "CTSMEditField.h" -#include "libi18n.h" -#include "prefapi.h" - -#include - -const Int16 kIconWidth = 16; -const Int16 kIconMargin = 1; - -const Int16 gsPopup_ArrowHeight = 5; // Actual height of the arrow -const Int16 gsPopup_ArrowWidth = 9; // Actual width of the arrow at widest - -const Int16 kLeftPaddingOfAddressTypeLabel = 14; -const Int16 kLeftPaddingOfPopupArrow = 7; -const Int16 kRightPaddingOfPopupArrow = 3; - -const Int16 kTextDistFromTop = 2; - -#define kAddressTypeTextTraitsID 10009 -#define kAddressTypePopupTextTraitsID 130 - -#ifdef MOZ_NEWADDR -#include "CNameCompletionPicker.h" - - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField class -// -//---------------------------------------------------------------------------- -// -CMailAddressEditField::CMailAddressEditField(LStream* inStream) - : CTSMEditField(inStream) - , mTimeLastCall(0) - , mIsCompletedName(false) - , mNeedToAutoCompleteAtIdleTime(false) - , mMailNewsContext(nil) - , mPickerPane(nil) - , mDisplayString(nil) - , mHeaderString(nil) - , mExpandHeaderString(nil) -{ -} - - -CMailAddressEditField::~CMailAddressEditField() -{ - if (mMailNewsContext) - mMailNewsContext->RemoveUser(this); - - if (mPickerPane) - AB_ClosePane(mPickerPane); - - XP_FREE(mDisplayString); - XP_FREE(mHeaderString); - XP_FREE(mExpandHeaderString); -} - - -void CMailAddressEditField::Init() -{ - mNeedToAutoCompleteAtIdleTime = false; -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::FinishCreateSelf -// -//---------------------------------------------------------------------------- -// -void CMailAddressEditField::FinishCreateSelf() -{ - LEditField::FinishCreateSelf(); - - AddAttachment(new CPasteSnooper("\r\t ", ",,\a")); - -//¥ CMailComposeWindow* window = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); -//¥ ThrowIfNil_(window); - - // Can't reuse the Composition context: we need an Address Book context - mMailNewsContext = new CMailNewsContext(MWContextAddressBook); - mMailNewsContext->SetWinCSID(INTL_DocToWinCharSetID(mMailNewsContext->GetDefaultCSID())); - mMailNewsContext->AddListener(this); - mMailNewsContext->AddUser(this); - StartListening(); - - (void)AB_CreateABPickerPane(&mPickerPane, *mMailNewsContext, CMailNewsContext::GetMailMaster(), 10); - if (mPickerPane) - CMailCallbackListener::SetPane(mPickerPane); -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::HandleKeyPress -// -//---------------------------------------------------------------------------- -// -Boolean CMailAddressEditField::HandleKeyPress(const EventRecord& inKeyEvent) -{ - Boolean keyHandled = true; - EKeyStatus theKeyStatus = keyStatus_Input; - Int16 theKey = inKeyEvent.message & charCodeMask; - - if (inKeyEvent.modifiers & cmdKey) - theKeyStatus = keyStatus_PassUp; // Always pass up when Cmd-Key down - else - if (mKeyFilter != nil) - { - Int16 theChar = inKeyEvent.message & charCodeMask; - - theKeyStatus = (*mKeyFilter)(mTextEditH, inKeyEvent.message, - theChar, inKeyEvent.modifiers); - } - - if (mIsCompletedName) - { - if (mNumResults >= 2) - { - switch (theKey) - { - case char_Enter: - case char_Tab: - case char_Return: - XP_Bool showPicker; - PREF_GetBoolPref("ldap_1.autoComplete.showDialogForMultipleMatches", &showPicker); - if (showPicker) - { - // save location of the edited cell - LWindow* window = LWindow::FetchWindowObject(GetMacPort()); - CComposeAddressTableView* addressTable = dynamic_cast(window->FindPaneByID('Addr')); - ThrowIfNil_(addressTable); - STableCell editCell = addressTable->GetEditCell(); - - // save caret pos & selection - TEHandle teH = GetMacTEH(); - short selStart = (*teH)->selStart; - short selEnd = (*teH)->selEnd; - - // display the name completion picker - int selectedRow = CNameCompletionPicker::DisplayDialog(this, mPickerPane, mMailNewsContext, mNumResults); - - // restore the edited cell - window->Activate(); - window->Select(); - addressTable->StartEditCell(editCell); - - if (selectedRow > 0) - { - // if we have a result, put it in the cell - AB_NameCompletionCookie* cookie = AB_GetNameCompletionCookieForIndex(mPickerPane, selectedRow-1); - NameCompletionBECallbackFunction(cookie, 1, this); - } - else - { - // otherwise restore the previous selection - StFocusAndClipIfHidden focus(this); - ::TESetSelect(selStart, selEnd, teH); - return true; // key was handled - } - } - break; - } - } - - StFocusAndClipIfHidden focus(this); - switch (theKeyStatus) - { - // If the user deletes a char, we need to do 2 deletes. - // The first deletes the nickname completion. - // The second actually erases a character. - case keyStatus_TEDelete: - if ((**mTextEditH).selEnd > 0) - { - if (mTypingAction == nil) - { - mTypingAction = new LTETypingAction(mTextEditH, this, this); - PostAction(mTypingAction); - } - - if (mTypingAction != nil) - mTypingAction->BackwardErase(); - else - ::TEKey(char_Backspace, mTextEditH); - // UserChangedText(); - } - break; - - // If the user moves the cursor, we need to - // get rid of the "multiple names found". - case keyStatus_TECursor: - if (mNumResults >= 2) - { - ::TEKey(char_Backspace, mTextEditH); - mIsCompletedName = false; - switch (theKey) - { - case char_UpArrow: - case char_DownArrow: - return LCommander::HandleKeyPress(inKeyEvent); - - } - } - break; - } - } - else - { - if (theKeyStatus == keyStatus_TEDelete) - { - CStr255 currentText; - GetDescriptor(currentText); - if (currentText.Length() == 0) - return LCommander::HandleKeyPress(inKeyEvent); - } - switch (theKey) - { - case char_UpArrow: - case char_DownArrow: - return LCommander::HandleKeyPress(inKeyEvent); - - } - } - keyHandled = Inherited::HandleKeyPress(inKeyEvent); - return keyHandled; -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::SpendTime -// -//---------------------------------------------------------------------------- -// -void CMailAddressEditField::SpendTime(const EventRecord& inMacEvent) -{ - if (mNeedToAutoCompleteAtIdleTime) - { - if ((::TickCount() - mTimeLastCall) > ::LMGetKeyThresh() / 2) - StartNameCompletion(); - } - Inherited::SpendTime(inMacEvent); -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::UserChangedText -// -//---------------------------------------------------------------------------- -// -void CMailAddressEditField::UserChangedText() -{ - mIsCompletedName = false; - mNeedToAutoCompleteAtIdleTime = true; - - if ((::TickCount() - mTimeLastCall) > ::LMGetKeyThresh() / 2) - StartNameCompletion(); - - mTimeLastCall = ::TickCount(); -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::NameCompletionBECallbackFunction -// -//---------------------------------------------------------------------------- -// -int CMailAddressEditField::NameCompletionBECallbackFunction(AB_NameCompletionCookie* cookie, int numResults, void* FECookie) -{ - CMailAddressEditField* editField = (CMailAddressEditField*)FECookie; - if (cookie != NULL) - { - char* displayString = AB_GetNameCompletionDisplayString(cookie); - char* headerString = AB_GetHeaderString(cookie); - char* expandHeaderString = AB_GetExpandedHeaderString(cookie); - - editField->SetNameCompletionResults(numResults, displayString, headerString, expandHeaderString); - - AB_FreeNameCompletionCookie(cookie); - } - return(0); -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::SetNameCompletionResults -// -//---------------------------------------------------------------------------- -// -void CMailAddressEditField::SetNameCompletionResults(int numResults, char* displayString, char* headerString, char* expandHeaderString) -{ - XP_FREE(mDisplayString); - XP_FREE(mHeaderString); - XP_FREE(mExpandHeaderString); - - TEHandle teH = GetMacTEH(); - short caretPos = (*teH)->selStart; - - mNumResults = numResults; - if (numResults == 1) - { - mDisplayString = displayString; - mHeaderString = headerString; - mExpandHeaderString = expandHeaderString; - - SetDescriptor(CStr255(mDisplayString)); - } - else // we got 2 or more results - { - CStr255 userEntry; - GetDescriptor(userEntry); - userEntry[0] = caretPos; - - mDisplayString = XP_STRDUP(userEntry); - mHeaderString = XP_STRDUP(userEntry); - mExpandHeaderString = XP_STRDUP(userEntry); - - CStr255 multipleHitsStr; - CStr255 resultStr; - ::GetIndString(multipleHitsStr, 10610, 2); - resultStr = mDisplayString + multipleHitsStr; - SetDescriptor(resultStr); - } - StFocusAndClipIfHidden focus(this); - ::TESetSelect(caretPos, 1000, teH); - - mIsCompletedName = true; -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::StartNameCompletion -// -//---------------------------------------------------------------------------- -// -void CMailAddressEditField::StartNameCompletion() -{ - mNeedToAutoCompleteAtIdleTime = false; - - if (!mPickerPane) - return; - - CStr255 currentText; - GetDescriptor(currentText); - (void)AB_NameCompletionSearch(mPickerPane, (char*)currentText, NameCompletionBECallbackFunction, (void*)this); -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::PaneChanged -// -//---------------------------------------------------------------------------- -// - void CMailAddressEditField::PaneChanged( - MSG_Pane* /*inPane*/, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 /*value*/) -{ - switch (inNotifyCode) - { - } -} - - -//---------------------------------------------------------------------------- -// ¥ CMailAddressEditField::FinalizeEdit -// -//---------------------------------------------------------------------------- -// -const char* CMailAddressEditField::FinalizeEdit() -{ - if (mIsCompletedName) - { - mIsCompletedName = false; - - //¥¥¥ should also return mExpandHeaderString - return XP_STRDUP(mHeaderString); - } - else - { - CStr255 currentText; - GetDescriptor(currentText); - return XP_STRDUP(currentText); - } -} - - - - -#else //MOZ_NEWADDR -#pragma mark - -CMailAddressEditField::CMailAddressEditField( LStream* inStream ) - : CTSMEditField( inStream ) - , mTimeLastCall(0) - , mDirServerList(nil) - , mAddressBook(nil) - , mIsCompletedName( false ) - , mCheckAddress( false ) - , mEntryID( MSG_MESSAGEIDNONE ) -{ -} - -void CMailAddressEditField::Init() -{ - mCheckAddress = false; - mEntryID = MSG_MESSAGEIDNONE; -} - -//----------------------------------- -void CMailAddressEditField::FinishCreateSelf() -// override to do address-book name completion. -//----------------------------------- -{ - LEditField::FinishCreateSelf(); - Try_ - { - AddAttachment(new CPasteSnooper("\r\t ", ",,\a")); - XP_List *list = FE_GetDirServers(); - ThrowIf_( DIR_GetComposeNameCompletionAddressBook(list, &mDirServerList) != 0); - #if 0 // Currently FE_GetAddressbook ignores the message pane. - // Since we would like to use this control else where( AddressPicker, and Mailing list window - // its not a good idea for this class to be dependant on being created from a CMailComposeWindow - CMailComposeWindow* window - = dynamic_cast( - LWindow::FetchWindowObject(GetMacPort()) - ); - ThrowIfNil_(window); - - mAddressBook = FE_GetAddressBook( - window->GetComposeSession()->GetMSG_Pane()); - #else if - mAddressBook = FE_GetAddressBook( NULL); - #endif - ThrowIfNil_(mAddressBook); - } - Catch_(inErr) - { - mDirServerList = nil; - mAddressBook = nil; - } - EndCatch_ -} - -void -CMailAddressEditField::SpendTime( - const EventRecord& inMacEvent ) -{ - - if( mCheckAddress ) - { - UInt32 currentTime = ::TickCount(); - if (currentTime - mTimeLastCall > ::LMGetKeyThresh() / 2) - UserChangedText(); - } - LEditField::SpendTime( inMacEvent ); -} -//----------------------------------- -void CMailAddressEditField::UserChangedText() -// override to do address-book name completion. -//----------------------------------- -{ - UInt32 currentTime = ::TickCount(); - mIsCompletedName = false; - mEntryID = MSG_MESSAGEIDNONE; - mCheckAddress = true; - if (currentTime - mTimeLastCall > ::LMGetKeyThresh() / 2) - { - ABID field; - if (mAddressBook) - { - mCheckAddress = false; - // Got a personal address book - if (mDirServerList) - { - // Got a DIR_Server entry for the address book - CStr255 currentText; - GetDescriptor(currentText); - if (::AB_GetIDForNameCompletion( - mAddressBook, - mDirServerList, - &mEntryID, - &field, - currentText) == 0 && mEntryID != MSG_MESSAGEIDNONE) - { - char newText[256]; - newText[0] = '\0'; - if (field == ABNickname) - AB_GetNickname(mDirServerList, mAddressBook, mEntryID, newText); - else - AB_GetFullName(mDirServerList, mAddressBook, mEntryID, newText); - if (newText[0]) - { - // whew! - TEHandle teH = GetMacTEH(); - short selStart = (*teH)->selStart; - SetDescriptor(CStr255(newText)); - FocusDraw(); - ::TESetSelect(selStart, 1000, teH); - mIsCompletedName = true; - } - } - } - } - } - mTimeLastCall = ::TickCount(); -} // CMailAddressEditField::UserChangedText - -Boolean CMailAddressEditField::HandleKeyPress( const EventRecord& inKeyEvent) -{ - Boolean keyHandled = true; - EKeyStatus theKeyStatus = keyStatus_Input; - Int16 theKey = inKeyEvent.message & charCodeMask; - - if (inKeyEvent.modifiers & cmdKey) - { // Always pass up when the command - theKeyStatus = keyStatus_PassUp; // key is down - } - else if (mKeyFilter != nil) - { - Int16 theChar = inKeyEvent.message & charCodeMask; - - theKeyStatus = (*mKeyFilter)(mTextEditH, inKeyEvent.message, - theChar, inKeyEvent.modifiers); - } - - if( mIsCompletedName ) - { - - StFocusAndClipIfHidden focus(this); - // If the user deletes a char we need to do 2 deletes - // The first deletes the nickname completion - // the second actually erases a character - - switch (theKeyStatus) - - case keyStatus_TEDelete:{ - if ((**mTextEditH).selEnd > 0) { - if (mTypingAction == nil) { - mTypingAction = new LTETypingAction(mTextEditH, this, this); - PostAction(mTypingAction); - } - if (mTypingAction != nil) { - mTypingAction->BackwardErase(); - } else { - ::TEKey(char_Backspace, mTextEditH); - } - //UserChangedText(); - } - break; - } - } - else - { - if( theKeyStatus == keyStatus_TEDelete ) - { - CStr255 currentText; - GetDescriptor(currentText); - if( currentText.Length() == 0 ) - return LCommander::HandleKeyPress(inKeyEvent); - } - switch (theKey) - { - case char_UpArrow: - case char_DownArrow: - return LCommander::HandleKeyPress(inKeyEvent); - - } - } - keyHandled = LEditField::HandleKeyPress(inKeyEvent); - return keyHandled; -} -//----------------------------------- -const char* CMailAddressEditField::FinalizeEdit() -//----------------------------------- -{ - char* fullName = nil; - CStr255 currentText; - GetDescriptor(currentText); - if (mDirServerList) - { - if ( mEntryID == MSG_MESSAGEIDNONE ) - { - ABID field; - ::AB_GetIDForNameCompletion( - mAddressBook, - mDirServerList, - &mEntryID, - &field, - currentText); - } - if ( mEntryID != MSG_MESSAGEIDNONE) - { - ::AB_GetExpandedName(mDirServerList, mAddressBook, mEntryID, &fullName); - } - } - if (!fullName) - return XP_STRDUP(currentText); - return fullName; -} // CMailAddressEditField::FinalizeEdit() - -#endif //MOZ_NEWADDR - -#pragma mark - - -CComposeAddressTableView::CComposeAddressTableView(LStream* inStream) : - LTableView(inStream), mInputField(NULL) -, LDragAndDrop(GetMacPort(), this) -, mCurrentlyAddedToDropList(true) // because LDragAndDrop constructor adds us. -, mDirty(false) -, mTextTraits( 10610 ) -, mEditCell( 0, 0) -, mAddressTypeHasFocus(false) -, mTypedownTable(nil) -{ -} - -CComposeAddressTableView::~CComposeAddressTableView() -{ - XP_FREEIF(mTypedownTable); -} - -void CComposeAddressTableView::SetUpTableHelpers() -{ - SetTableGeometry(new LTableMultiGeometry(this, CalculateAddressTypeColumnWidth(), 16)); - SetTableSelector(new LTableRowSelector(this)); - SetTableStorage(new CComposeAddressTableStorage(this)); -} - -void CComposeAddressTableView::FinishCreateSelf() -{ - SetUpTableHelpers(); - - Assert_(mTableStorage != NULL); - - InsertCols(2, 1, NULL, 0, false); - AdjustColumnWidths(); - // Get the Editfield - mInputField = dynamic_cast< CMailAddressEditField*>( FindPaneByID ('Aedt') ); - // highlight colors - RGBColor ignore; - UGraphicGizmos::CalcWindowTingeColors(GetMacPort(), ignore, mDropColor ); - - // Set up table for type-ahead - MenuHandle popupMenu = (MenuHandle)::GetResource('MENU', kAddressTypeMenuID ); - ThrowIfNil_(popupMenu); - - Int16 numItems = CountMItems(popupMenu); - - // this will hold lower case of first letters, with trailing null - mTypedownTable = (char *)XP_ALLOC(numItems + 1); - - for (Int16 i = 1; i <= numItems; i ++) // menu items are 1-based - { - CStr255 itemName; - GetMenuItemText(popupMenu, i, itemName); - mTypedownTable[i - 1] = tolower(itemName[1]); - } - mTypedownTable[numItems] = '\0'; - - ReleaseResource((Handle)popupMenu); -} - -// adjust address column to be width of pane minus width of -// first column -void CComposeAddressTableView::AdjustColumnWidths() -{ - SDimension16 frameSize; - UInt16 firstColWidth = GetColWidth(1); - GetFrameSize(frameSize); - SetColWidth(frameSize.width - firstColWidth, 2, 2); -} - -void CComposeAddressTableView::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -{ - LTableView::ResizeFrameBy( inWidthDelta, inHeightDelta, inRefresh); - AdjustColumnWidths(); - // May have to adjust edit field - if( mEditCell.row!=0 ) - { - Rect cellRect; - if( GetLocalCellRect( mEditCell, cellRect)) - { - // put edit field over cell - cellRect.left += kIconWidth + 3; - cellRect.top +=1; - mInputField->ResizeFrameTo(cellRect.right - cellRect.left, - cellRect.bottom - cellRect.top, - false); - mInputField->PlaceInSuperImageAt(cellRect.left, cellRect.top, false); - } - } -} - - -void CComposeAddressTableView::ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown) -{ - StopInputToAddressColumn(); // on any click - - if (inCell.col == 1) - { -#if 0 - LCommander::SwitchTarget(this); - LTableView::ClickCell(inCell, inMouseDown); //Does nothing -#endif //0 - - EAddressType oldAddressType = GetRowAddressType( inCell.row ); - - // load and install the menu - MenuHandle popupMenu = ::GetMenu( kAddressTypeMenuID ); - if (popupMenu) - { - Int16 result; - - FocusDraw(); - - { - StSysFontState theSysFontState; - - // ¥ We also detach the resource so we don't run into problems - // for cases where there are multiple popups referencing the same - // menu resource. - ::DetachResource( (Handle) popupMenu); - ::InsertMenu( popupMenu, hierMenu); - - Point where = inMouseDown.wherePort; - PortToGlobalPoint( where ); - Rect cellRect; - if (GetLocalCellRect( inCell, cellRect )) - { - where = topLeft( cellRect ); - ::LocalToGlobal( &where ); - } - - // Adjust text traits to be the appropriate text traits for the popup - - theSysFontState.SetTextTraits(/* kAddressTypePopupTextTraitsID */ ); - - Int16 defaultChoice = oldAddressType; - result = ::PopUpMenuSelect( popupMenu, where.v, where.h, defaultChoice ); - } - - // ¥ Clean up the menu - ::DeleteMenu( kAddressTypeMenuID ); - ::DisposeHandle( (Handle) popupMenu); // OK because we detached it. - - STableCell addressCell( inCell.row, 2); - - if (result) - { - if( CellIsSelected( addressCell) ) - SetSelectionAddressType( EAddressType( result ) ); - else - { - SetRowAddressType( inCell.row, EAddressType( result ) ); - RefreshCell( addressCell ); - BroadcastMessage( msg_AddressChanged, NULL ); - } - } - RefreshCell( inCell ); - } - } - else - { // in address cell - // was the click on the icon? - Rect iconRect; - GetLocalCellRect( inCell, iconRect ); - iconRect.right = iconRect.left + kIconWidth+kIconMargin; - if (!(::PtInRect(inMouseDown.whereLocal, &iconRect)) ) - StartEditCell( inCell ); - } -} - -void CComposeAddressTableView::DrawSelf() -{ - Rect r; - if ( CalcLocalFrameRect( r ) ) - EraseRect( &r ); - Int16 bottom = r.bottom; - Int16 right = r.right; - // What Color should these lines be? - RGBColor lightTinge,darkTinge; - UGraphicGizmos::CalcWindowTingeColors(GetMacPort(), lightTinge, darkTinge); - ::RGBForeColor(&lightTinge); - // vertical seperator - short width=mTableGeometry->GetColWidth(1); - ::MoveTo(width,r.top); - ::LineTo(width,r.bottom); - // Horizontal seperators - STableCell topLeftCell, botRightCell; - FetchIntersectingCells(r, topLeftCell, botRightCell); - GetLocalCellRect(topLeftCell,r); - - short height = mTableGeometry->GetRowHeight(1); // All Rows are the same size - short currentHeight = r.top - height; - if (height > 0) - { - - while (currentHeightmenuWidth + kLeftPaddingOfPopupArrow + gsPopup_ArrowWidth + kRightPaddingOfPopupArrow; - - // Release the menu - - ::ReleaseResource((Handle) menu); - - return width; -} - -void CComposeAddressTableView::DrawCell(const STableCell &inCell, const Rect &inLocalRect) -{ - EAddressType type = GetRowAddressType( inCell.row ); - - if ( inCell.col == 1 ) - { - // Draw the hilite region if we are taking keyboard input - if (mAddressTypeHasFocus) - { - STableCell addressCell(mEditCell.row, 1); - Rect cellRect; - - if (GetLocalCellRect(addressCell, cellRect)) - { - StColorPenState stateSaver; - StRegion hiliteRgn; - - cellRect.top ++; - ::RectRgn(hiliteRgn, &cellRect); - - { - StRegion tempRgn(hiliteRgn); - - ::InsetRgn(tempRgn, 2, 2); - ::DiffRgn(hiliteRgn, tempRgn, hiliteRgn); - } - - UDrawingUtils::SetHiliteModeOn(); - ::InvertRgn(hiliteRgn); - } - } - - // Draw the address type string - - UTextTraits::SetPortTextTraits(kAddressTypeTextTraitsID); - - MoveTo(inLocalRect.left + kLeftPaddingOfAddressTypeLabel, inLocalRect.bottom - 4); - - MenuHandle menu = ::GetMenu( kAddressTypeMenuID ); - if ( menu ) - { - // ¥ We also detach the resource so we don't run into problems - // for cases where there are multiple popups referencing the same - // menu resource. - ::DetachResource( (Handle) menu); - Str255 typeText; - :: GetMenuItemText( menu, type, typeText); - ::DrawString( typeText ); - ::DisposeHandle( (Handle) menu); // OK because we detach - } - - // Draw the drop flag - - Rect iconRect; - - UInt32 vDiff = (inLocalRect.bottom - inLocalRect.top - (gsPopup_ArrowHeight - 1)) >> 1; - iconRect.top = inLocalRect.top + vDiff; - iconRect.bottom = iconRect.top + gsPopup_ArrowHeight - 1; - iconRect.left = inLocalRect.right - gsPopup_ArrowWidth - 1 - kRightPaddingOfPopupArrow; - iconRect.right = iconRect.left + gsPopup_ArrowWidth - 1; - - UGraphicGizmos::DrawPopupArrow(iconRect, true, true, false); - } - else - { - // Draw the icon - Rect iconRect = inLocalRect; - iconRect.left += kIconMargin; - iconRect.right = iconRect.left + kIconWidth; - - ResIDT iconResIDT = 15260; // Default is a person id - if( type == eNewsgroupType ) - iconResIDT = 15231 ; - CStandardFlexTable::DrawIconFamily(iconResIDT , 16, 16, 0, iconRect); - - if (inCell.row != mEditCell.row) - { - // we're trying to draw an address string cell that - // isn't the one with the LEditField over it. - char* addr = NULL; - Uint32 size = sizeof(addr); - GetCellData(inCell, &addr, size); - - if (addr) - { - Uint8 stringLen = LString::CStringLength(addr); - UTextTraits::SetPortTextTraits( mTextTraits ); - - Rect textRect = inLocalRect; - - textRect.left = iconRect.right + 3; - textRect.right = inLocalRect.right; - textRect.top += kTextDistFromTop; - - UGraphicGizmos::PlaceTextInRect( addr, stringLen, textRect, teFlushLeft, teFlushTop ); //flushtop to match the TEUpdate used by LEditField - } - } - } -} - - -//----------------------------------- -void CComposeAddressTableView::HiliteRow( TableIndexT inRow, Boolean inUnderline ) -//----------------------------------- -{ - STableCell cell; - Rect r; - - cell.row = inRow; - cell.col = 1; - - GetLocalCellRect(cell, r); - - r.left = 0; - r.right = mFrameSize.width; - - if (inUnderline) - { - r.top = r.bottom-1; - r.bottom += 1; - } - - //RGBColor savedHiliteColor; - UDrawingUtils::SetHiliteModeOn(); - //LMGetHiliteRGB(&savedHiliteColor); - //::HiliteColor(&mDropColor); - ::InvertRect(&r); - //::HiliteColor(&savedHiliteColor); -} - -void CComposeAddressTableView::DirectInputToAddressColumn() -{ - if (mAddressTypeHasFocus) return; - - mAddressTypeHasFocus = true; - SwitchTarget(this); - - STableCell theCell(mEditCell.row, 1); - RefreshCell(theCell); - theCell.col = 2; - RefreshCell(theCell); -} - - -void CComposeAddressTableView::StopInputToAddressColumn() -{ - if (!mAddressTypeHasFocus) return; - - mAddressTypeHasFocus = false; - SwitchTarget(mInputField); - - STableCell theCell(mEditCell.row, 1); - RefreshCell(theCell); - theCell.col = 2; - RefreshCell(theCell); -} - - -Boolean CComposeAddressTableView::HandleKeyPress(const EventRecord &inKeyEvent) -{ - Boolean keyHandled = true; - Boolean cmdKeyDown = (inKeyEvent.modifiers & cmdKey) != 0; - Char16 c = inKeyEvent.message & charCodeMask; - - if (mAddressTypeHasFocus) - { - EAddressType newAddressType = eNoAddressType; - char *thisOne = mTypedownTable; - - for (Int16 i = 0; *thisOne; i++, thisOne ++) - { - if (tolower(c) == *thisOne) - { - newAddressType = (EAddressType)(i + 1); // enum is 1-based - break; - } - } - - if (newAddressType != eNoAddressType) - { - STableCell addressCell(mEditCell.row, 1); - SetRowAddressType(mEditCell.row, newAddressType); - RefreshCell(addressCell); - BroadcastMessage( msg_AddressChanged, NULL ); - return keyHandled; - } - } - - switch (c) - { - case char_Backspace: - case char_FwdDelete: - DeleteSelection(); - return true; - break; - - case char_UpArrow: - EndEditCell(); - STableCell previousCell( GetFirstSelectedCell().row, 2 ); - if( previousCell.row != 1 ) - { - previousCell.row--; - StartEditCell( previousCell ); - } - keyHandled = true; - break; - - - /*EndEditCell(); - STableCell nextCell( GetFirstSelectedCell().row, 2 ); - nextCell.row++; - StartEditCell( nextCell ); - keyHandled = true; - break;*/ - case char_Enter: - if( !mEditCell.IsNullCell() ) - { - EndEditCell(); - STableCell cellToSelect( GetFirstSelectedCell().row, 2); - SelectCell( cellToSelect ); - } - else - { - STableCell cellToSelect( GetFirstSelectedCell().row, 2); - StartEditCell( cellToSelect ); - } - break; - - case char_LeftArrow: - if (!mAddressTypeHasFocus && cmdKeyDown) - DirectInputToAddressColumn(); - else - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - break; - case char_RightArrow: - if (mAddressTypeHasFocus && cmdKeyDown) - StopInputToAddressColumn(); - else - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - break; - case char_DownArrow: - case char_Return: - case char_Tab: - EventRecord tabKeyEvent(inKeyEvent); - tabKeyEvent.message &= ~charCodeMask; // clear char code bits - tabKeyEvent.message |= char_Tab; - Boolean backward = ((inKeyEvent.modifiers & shiftKey) != 0); - TableIndexT nRows, nCols; - GetTableSize(nRows, nCols); - EndEditCell(); - StopInputToAddressColumn(); - STableCell cell( GetFirstSelectedCell().row, 2); - if (backward && cell.row <= 1) - { - keyHandled = LCommander::HandleKeyPress(tabKeyEvent); // tab out of here - break; - } - else if (!backward && cell.row >= nRows) - { - // If we were editing, and we tabbed out... - if (cell.row != 0) - { - // Tabbing out of a non-empty addressee field adds another new addressee - char* addr = NULL; - Uint32 size = sizeof(addr); - GetCellData( cell, &addr, size); - if (addr && *addr && (c != char_Tab) ) - { - EAddressType addressType = GetRowAddressType( nRows ); - char emptyString[1]="\0"; - InsertNewRow( addressType, emptyString, true ); - keyHandled = true; - } - else - { - keyHandled = LCommander::HandleKeyPress(tabKeyEvent); // tab out of here - } - } - else if (nRows==0) - { - InsertNewRow(true, true); - keyHandled = true; - } - break; - } - else if (backward) - cell.row--; - else - cell.row++; - StartEditCell( cell ); - break; - - default: - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - } // switch - return keyHandled; -} - -Boolean CComposeAddressTableView::ClickSelect(const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -{ - - if( inCell.col == 1 ) - { - return true; - } - else - { - SwitchTarget( this ); - EndEditCell(); - if( !mEditCell.IsNullCell() ) - UnselectCell( mEditCell ); - return LTableView::ClickSelect( inCell, inMouseDown ); - } -} - -void -CComposeAddressTableView::ClickSelf( - const SMouseDownEvent &inMouseDown) -{ - STableCell hitCell; - SPoint32 imagePt; - - LocalToImagePoint(inMouseDown.whereLocal, imagePt); - - if (GetCellHitBy(imagePt, hitCell)) { - if (ClickSelect(hitCell, inMouseDown)) { - ClickCell(hitCell, inMouseDown); - } - - } else { // Click is outside of any Cell - InsertNewRow( true, true); // so create a new cell - } -} - -void CComposeAddressTableView::FillInRow( Int32 row, EAddressType inAddressType, const char* inAddress) -{ - STableCell cell; - cell.col = 1; - cell.row = row; - SetCellData( cell, &inAddressType, sizeof(inAddressType)); - RefreshCell( cell ); - cell.col = 2; - SetCellData( cell, inAddress, sizeof(inAddress)); - RefreshCell( cell ); -} - -// Takes in a string explodes it, and inserts it into the table -Int32 CComposeAddressTableView::CommitRow( const char* inString, STableCell cell) -{ - EAddressType originAddressType = GetRowAddressType( cell.row ); - Boolean dirty = false; - // Update and do name replacement - // Explode string to 1 entry per line - MSG_HeaderEntry *returnList = nil; - Int32 numberItems = MSG_ExplodeHeaderField( originAddressType, inString, &returnList ); - Int32 numberRowsAdded = 0; - - if ( numberItems > 1) - { - InsertRows( (numberItems - 1), cell.row, NULL, NULL, false ); - dirty = true; - } - // We will get 0 if we passed in a Null string, this occurs when the user - // deletes an exsiting email address. Should the row be removed? - if (numberItems == 0) - { - if( !dirty ) - { - char *addr = NULL; - Int32 size = sizeof(addr); - GetCellData( cell, &addr, size); - if( addr !=NULL ) - dirty = true; - } - SetCellData( cell, inString, sizeof(inString) ); - } - else if ( numberItems != -1 ) - { - for (Int32 currentItem = 0; currentItem < numberItems; currentItem ++ ) - { - if ( !dirty ) - { - char *addr = NULL; - Int32 size = sizeof(addr); - GetCellData( cell, &addr, size); - if( addr == NULL ) - dirty = true; - else - dirty = XP_STRCMP( addr, returnList[currentItem].header_value); - } - // Use input field to do name expansion on each entry - char* unexpandedName = returnList[currentItem].header_value; - char* actualName = unexpandedName; - EAddressType addressType = (EAddressType)returnList[currentItem].header_type; // this is just what we passed in above - - if ( XP_STRNCASECMP(unexpandedName, "mailto:", 7) == 0 ) - { - actualName = unexpandedName + 7; - //addressType = eToType; - } - else if ( (XP_STRNCASECMP(unexpandedName, "news://", 7) == 0) || - (XP_STRNCASECMP(unexpandedName, "snews://", 8) == 0) ) - { - // test whether this URL points to the current server being used for this message. - // if not, and there is no other news recipient so far, set the news post url - // in the backend, and just enter the group name - //MSG_SetCompHeader( , MSG_NEWSPOSTURL_HEADER_MASK, ); etc - - // no backend support yet, so just put in the whole URL - actualName = unexpandedName; - addressType = eNewsgroupType; - } - else if ( (XP_STRNCASECMP(unexpandedName, "news:", 5) == 0) || - (XP_STRNCASECMP(unexpandedName, "snews:", 6) == 0) ) - { - actualName = unexpandedName + 5; - addressType = eNewsgroupType; - } - - mInputField->Init(); - mInputField->SetDescriptor( CStr255( actualName ) ); - const char* expandedName = mInputField->FinalizeEdit(); - - FillInRow( cell.row, addressType, expandedName ); - - XP_FREE( unexpandedName ); - XP_FREE( (char*)expandedName ); - cell.row++; - } - XP_FREE ( returnList ); - numberRowsAdded = numberItems-1; - } - - if ( dirty ) - BroadcastMessage( msg_AddressChanged, NULL ); - - Refresh(); - - return numberRowsAdded; -} - -Int32 CComposeAddressTableView::FinalizeAddrCellEdit() -{ - int32 numRowsAdded; - const char* fullName = nil; - Try_ - { - fullName = mInputField->FinalizeEdit(); - if (fullName) - { - numRowsAdded = CommitRow( fullName, mEditCell ); - XP_FREE((char*)fullName); - } - } - Catch_(inErr) - { - XP_FREEIF((char*)fullName); - } - EndCatch_ - return numRowsAdded; -} - -Boolean CComposeAddressTableView::ObeyCommand(CommandT inCommand, void *ioParam) -{ - switch (inCommand) - { - case msg_TabSelect: - STableCell cell(1, 2); - StartEditCell( cell ); - return true; - } - return LCommander::ObeyCommand(inCommand, ioParam); -} - -void CComposeAddressTableView::HideEditField() -{ - mInputField->Hide(); - LView::OutOfFocus(NULL); - RefreshCell(mEditCell); -} - -#if 0 -void CComposeAddressTableView::ListenToMessage(MessageT inMessage, void* ioParam) -{ -#if 0 // NO longer have buttons to listen to - switch(inMessage) - { - case msg_AddAddressee: - InsertNewRow(true, true); - break; - case msg_RemoveAddressee: - DeleteSelection(); - break; - } -#endif //0 -} -#endif - -void CComposeAddressTableView::InsertNewRow(Boolean inRefresh, Boolean inEdit) -{ - char* dummy = NULL; - EndEditCell(); - TableIndexT numRows; - GetNumRows(numRows); - InsertRows(1, numRows++, &dummy, sizeof(dummy), inRefresh); - STableCell cell(numRows, 2); - if (inEdit) - StartEditCell(cell); -} - -void CComposeAddressTableView::InsertNewRow(EAddressType inAddressType, const char* inAddress, Boolean inEdit) -{ - InsertNewRow(false, false); - STableCell cell; - cell.col = 1; - GetNumRows(cell.row); - SetCellData(cell, &inAddressType, sizeof(inAddressType)); - RefreshCell(cell); - cell.col = 2; - SetCellData(cell, inAddress, sizeof(inAddress)); // this makes a copy of the data, getting the size from strlen - RefreshCell(cell); - if ( inEdit ) - StartEditCell( cell ); -} - - -void CComposeAddressTableView::StartEditCell(const STableCell &inCell) -{ - UnselectAllCells(); - Assert_( inCell.col == 2 ); - Rect cellRect; - - // Make sure the edit filed is fully visible - ScrollCellIntoFrame(inCell); - // now move edit field over cell - - if (GetLocalCellRect(inCell, cellRect)) - { - // put edit field over cell - mInputField->PutInside(this); - - Rect textRect = cellRect; - - textRect.left += kIconWidth + 3; - textRect.top += kTextDistFromTop; // text is drawn flush top - - mInputField->ResizeFrameTo(textRect.right - textRect.left, - textRect.bottom - textRect.top, - false); - mInputField->PlaceInSuperImageAt(textRect.left, cellRect.bottom - (textRect.bottom - textRect.top), false); - mInputField->Init(); - // set text of edit field - char *addr = NULL; - Uint32 size = sizeof(addr); - GetCellData(inCell, &addr, size); - if (addr) - { - LStr255 pstr(addr); - mInputField->SetDescriptor(pstr); - mInputField->SelectAll(); - } - else - mInputField->SetDescriptor("\p"); - mInputField->Show(); - SwitchTarget(mInputField); - mEditCell.row = inCell.row; - mEditCell.col = inCell.col; - } -} - - -void CComposeAddressTableView::EndEditCell() -{ - if (!mEditCell.IsNullCell()) - { // Copy text out of LEditField into corresponding cell if - // user was editing an address - Int32 numRowsAdded = FinalizeAddrCellEdit(); - HideEditField(); - RefreshCell( mEditCell ); - mEditCell.row += numRowsAdded; - SelectCell( mEditCell ); - mEditCell.row = 0; - mEditCell.col = 0; - } -} - -void CComposeAddressTableView::TakeOffDuty() -{ - // This causes unwanted behaviour -- CommitRow when window is deactivated, - // and causes deactivated windows to lose keyboard focus when reactivated - - - // Unfortunately, we have to do it so that rows are committed when the user - // clicks in the subject or the body without tabbing out of the field first - EndEditCell(); - UnselectAllCells(); -} - -// Commands -void CComposeAddressTableView::DeleteSelection() -{ - EndEditCell(); - TableIndexT currentRow; - TableIndexT nextRow; - nextRow = mTableSelector->GetFirstSelectedRow(); - if( nextRow == 0 ) - return; - while ( nextRow != 0) - { - currentRow = nextRow; - RemoveRows(1, currentRow, true); - nextRow = mTableSelector->GetFirstSelectedRow(); - } - // Set the focus - STableCell currentCell( currentRow, 2 ); - currentCell.col = 2 ; - if( currentCell.row != 1 ) - { - currentCell.row -= 1; - } - else if (mRows == 0 ) - { - InsertNewRow(true, true); - currentCell.row = 1; - } - StartEditCell( currentCell ); -} - -void CComposeAddressTableView::SetSelectionAddressType( EAddressType inAddressType ) -{ - STableCell currentCell; - STableCell currentAddressTypeCell(0,1); - - while ( GetNextSelectedCell( currentCell )) - { - currentAddressTypeCell.row = currentCell.row; - SetRowAddressType( currentAddressTypeCell.row, inAddressType ); - RefreshCell( currentCell ); - RefreshCell( currentAddressTypeCell ); - } - BroadcastMessage( msg_AddressChanged, NULL ); -} // CComposeAddressTableView::SetSelectionAddressType - -// utility functions -void CComposeAddressTableView::GetNumRows(TableIndexT &inRowCount) -{ - TableIndexT colCount; - GetTableSize(inRowCount, colCount); -} - -EAddressType CComposeAddressTableView::GetRowAddressType( TableIndexT inRow ) -{ - EAddressType addressType; - Uint32 size = sizeof( addressType ); - STableCell cell( inRow,1 ); - GetCellData( cell, &addressType, size ); - return addressType; -} // CComposeAddressTableView::GetRowAddressType - - -void CComposeAddressTableView::SetRowAddressType( TableIndexT inRow, EAddressType inAddressType ) -{ - STableCell cell( inRow,1 ); - SetCellData(cell, &inAddressType, sizeof(EAddressType)); - -} // CComposeAddressTableView::GetRowAddressType - - -// utility function to put a comma seperated list of -// addressees of type inAddressType in the table view -// into an LHandleStream -void CComposeAddressTableView::CreateCompHeader(EAddressType inAddressType, LHandleStream& inStream) -{ - TableIndexT rowCount, i = 1; - EAddressType cellType; - STableCell cell; - Uint32 size; - char* addr = NULL; - Boolean first = true; - - GetNumRows(rowCount); - try { - do { - cell.col = 1; - cell.row = i; - size = sizeof(cellType); - GetCellData(cell, &cellType, size); - if (cellType == inAddressType) - { - cell.col = 2; - size = sizeof(addr); - GetCellData(cell, &addr, size); - if (addr) - { - if( strlen( addr ) > 0 ) // ignore cells with no data - { - if (!first) - inStream << (unsigned char) ','; - else - first = false; - inStream.WriteBlock(addr, strlen(addr)); - } - } - } - ++i; - } while (i <= rowCount); - if (inStream.GetMarker() > 0) - // write null terminator if we have data - inStream << (unsigned char) '\0'; - } catch (...) { - // not enough memory to make header! - } -} - -// I hate this. I need to override the default method, because we want -// to ignore the item in drags from CMailFlexTable and descendents that -// contains the selection -Boolean CComposeAddressTableView::DragIsAcceptable(DragReference inDragRef) -{ - Boolean isAcceptable = true; - Boolean gotOneOrMore = false; - - Uint16 itemCount; - ::CountDragItems(inDragRef, &itemCount); - - for (Uint16 item = 1; item <= itemCount; item++) - { - ItemReference itemRef; - ::GetDragItemReferenceNumber(inDragRef, item, &itemRef); - - // ignore flex table selection data - if ( itemRef == CMailFlexTable::eMailNewsSelectionDragItemRefNum ) - { - FlavorFlags flavorFlags; - - if (::GetFlavorFlags( inDragRef, itemRef, kMailNewsSelectionDragFlavor, &flavorFlags) == noErr ) - continue; - } - - isAcceptable = ItemIsAcceptable(inDragRef, itemRef); - if (!isAcceptable) { - break; // Stop looping upon finding an - } // unaccepatable item - - gotOneOrMore = true; - } - - return isAcceptable && gotOneOrMore; -} - -/* - A drag flavor being promoted by Apple for text drags containing mailto - information. Will contain a comma-separated list of email addresses. - One characteristic of this flavor that we don't yet support is that - quotes within the real name part will be escaped, e.g. - - "Joe \"MacHead\" Bloggs" - - Note that the TEXT flavor for this drag contains a tab-separated list. -*/ -#define kAppleMailAddressDragFlavor 'a822' - -// Drag and Drop Support -Boolean CComposeAddressTableView::ItemIsAcceptable( DragReference inDragRef, - ItemReference inItemRef ) -{ - FlavorFlags flavorFlags; - Boolean acceptable = false; - - /* This is no longer used - if (::GetFlavorFlags( inDragRef, inItemRef, kMailAddresseeFlavor, &flavorFlags) == noErr) - acceptable = true ; - */ - - if (::GetFlavorFlags( inDragRef, inItemRef, kAppleMailAddressDragFlavor, &flavorFlags) == noErr) - acceptable = true ; - - if (::GetFlavorFlags( inDragRef, inItemRef, 'TEXT', &flavorFlags) == noErr) - acceptable |= true; - - return acceptable; -} - -void CComposeAddressTableView::ReceiveDragItem( DragReference inDragRef, - DragAttributes /*flags*/, - ItemReference inItemRef, - Rect& itemBounds) -{ - -/* - // Check that correct flavor is present, check to see if the entry is not in the list yet - if ( ::GetFlavorFlags(inDragRef, inItemRef, kMailAddresseeFlavor, &flavorFlags) == noErr ) - { - // Get the ABID of the item being dragged, either person or list - dataSize = sizeof( SAddressDragInfo ); - if ( ::GetFlavorData(inDragRef, inItemRef, kMailAddresseeFlavor, &info, &dataSize, 0) == noErr ) - { - Assert_(dataSize == sizeof( SAddressDragInfo )); - ABook* pABook; - // CMailComposeWindow* window = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - pABook = FE_GetAddressBook( NULL ); - pABook->GetFullAddress( info.dir, info.id, &fullName ); - } - } - else - { -*/ - - OSType dragFlavor = 0; - FlavorFlags flavorFlags = 0; - OSErr err = noErr; - - if ( ::GetFlavorFlags (inDragRef, inItemRef, emBookmarkDrag, &flavorFlags) == noErr ) - dragFlavor = emBookmarkDrag; - else if ( ::GetFlavorFlags (inDragRef, inItemRef, kAppleMailAddressDragFlavor, &flavorFlags) == noErr ) - dragFlavor = kAppleMailAddressDragFlavor; - else if ( ::GetFlavorFlags (inDragRef, inItemRef, 'TEXT', &flavorFlags) == noErr ) - dragFlavor = 'TEXT'; - - if ( dragFlavor == 0) - return; - - Size dataSize = 0; - char *buffer = NULL; - - err = ::GetFlavorDataSize (inDragRef, inItemRef, dragFlavor, &dataSize); - ThrowIfOSErr_ (err); // caught by PP handler - - if (dataSize == 0 || dataSize > 4096) - return; - - DragAttributes theDragAttributes; - err = ::GetDragAttributes(inDragRef, &theDragAttributes); - ThrowIfOSErr_ (err); - - buffer = (char *)XP_ALLOC(dataSize + 1); - ThrowIfNil_(buffer); - - err = ::GetFlavorData (inDragRef, inItemRef, dragFlavor, buffer, &dataSize, 0); - if (err != noErr) { - XP_FREE(buffer); - ThrowIfOSErr_(err); - } - - buffer[dataSize] = '\0'; // Terminate the string - - // we need to munge the text to take out white space etc. - // URLs originating in Communicator are like: /r, and we need to distinguish - // that from plain text containing /r from outside. - - char *title = NULL; - - if ( (theDragAttributes & kDragInsideSenderApplication) == 0) // if an external drag - { - // it would be nice to user the CPasteActionSnooper here to clean stuff up, but we don't - // have a TEHandle to work with. - - char *lastChar = &buffer[dataSize - 1]; - while (lastChar > buffer && (*lastChar == '\r' || *lastChar == '\n' || *lastChar == '\t' || *lastChar == ' ') ) - { - lastChar --; - dataSize --; - } - buffer[dataSize] = '\0'; // Re-terminate the string - - //convert \r or \t to comma so subsequent items get separated - lastChar = buffer; - while (*lastChar) { - if (*lastChar == '\r' || *lastChar == '\t') - *lastChar = ','; - lastChar ++; - } - } - else { - // internal drag - title = strchr(buffer, '\r'); // may return NULL - } - - char *addressText = NULL; - - if ( ( XP_STRNCASECMP( buffer, "news:", 5) == 0 ) || - ( XP_STRNCASECMP( buffer, "snews:", 6) == 0 ) || - ( XP_STRNCASECMP( buffer, "mailto:", 7) == 0 ) ) - { - if (title) - *title = '\0'; // use the URL part of the text - - addressText = XP_STRDUP(buffer); - } - else - { - if (title == NULL) - title = buffer; - else - title ++; // skip the /r and use the text part - - addressText = XP_STRDUP( title ); - } - - XP_FREE(buffer); - buffer = NULL; - - if ( addressText != NULL ) - { - // Find Cell which intersects itemBounds - STableCell topLeftCell, bottomRightCell; - FetchIntersectingCells( itemBounds, topLeftCell, bottomRightCell); - - TableIndexT numRows; - GetNumRows( numRows ); - - // Dropped in a cell which doesn't exist - if ( topLeftCell.row > numRows ) - { - InsertNewRow(false, false); - STableCell cell(0, 1); - - GetNumRows(cell.row); - - CommitRow( addressText, cell ); - } - else - { - if( topLeftCell.row == mEditCell.row) - EndEditCell(); - - topLeftCell.col = 2; - char *addr = NULL; - Int32 size = sizeof(addr); - GetCellData(topLeftCell, &addr, size); - Int32 stringSize = strlen( addr) + strlen(addressText) + 2; - char *newCellStr = new char[ stringSize ]; - - if( XP_STRCMP(addr,"\0") ) - { - XP_STRCPY( newCellStr, addr ); - XP_STRCAT( newCellStr,"," ); - XP_STRCAT( newCellStr, addressText ); - } - else - { - XP_STRCPY( newCellStr, addressText ); - } - //SetRowAddressType(topLeftCell.row, addressType); - CommitRow( newCellStr, topLeftCell ); - delete newCellStr; - } - - XP_FREE( addressText ); - } -} - - - -void CComposeAddressTableView::AddDropAreaToWindow(LWindow* inWindow) -{ - if (!mCurrentlyAddedToDropList) - LDropArea::AddDropArea(this, inWindow->GetMacPort()); - mCurrentlyAddedToDropList = true; -} - -void CComposeAddressTableView::RemoveDropAreaFromWindow(LWindow* inWindow) -{ - if (mCurrentlyAddedToDropList) - LDropArea::RemoveDropArea(this, inWindow->GetMacPort()); - mCurrentlyAddedToDropList = false; -} - -void CComposeAddressTableView::InsideDropArea(DragReference inDragRef) -{ - - Point mouseLoc; - SPoint32 imagePt; - TableIndexT newDropRow; - Boolean newIsDropBetweenFolders; - - FocusDraw(); - - ::GetDragMouse(inDragRef, &mouseLoc, NULL); - ::GlobalToLocal(&mouseLoc); - LocalToImagePoint(mouseLoc, imagePt); - - newDropRow = mTableGeometry->GetRowHitBy(imagePt); - - imagePt.v += 3; - newIsDropBetweenFolders = false; - // (newDropRow != mTableGeometry->GetRowHitBy(imagePt)); - - - if (newDropRow != mDropRow || newIsDropBetweenFolders != mIsDropBetweenFolders) - { - TableIndexT nRows, nCols; - - HiliteRow(mDropRow, mIsDropBetweenFolders); - mIsDropBetweenFolders = newIsDropBetweenFolders; - - GetTableSize(nRows, nCols); - if (newDropRow > 0 && newDropRow <= nRows) - { - HiliteRow(newDropRow, mIsDropBetweenFolders); - mDropRow = newDropRow; - } - else { - mDropRow =0; - } - } -} - -void CComposeAddressTableView::LeaveDropArea(DragReference inDragRef) -{ - - FocusDraw(); - if (mDropRow != 0) { - HiliteRow( mDropRow, false ); - } - mDropRow = 0; - LDragAndDrop::LeaveDropArea( inDragRef); -} - -void CComposeAddressTableView::SetTextTraits( ResIDT textTraits ) -{ - mTextTraits = textTraits; - mInputField->SetTextTraitsID(textTraits); - Refresh(); -} - - -#pragma mark - - -CComposeAddressTableStorage::CComposeAddressTableStorage(LTableView* inTableView) : -LTableStorage(inTableView) -{ - try { - mAddrTypeArray = new LArray(sizeof(EAddressType)); - } catch (...) { - mAddrTypeArray = NULL; - } - try { - mAddrStrArray = new LArray(sizeof(char*)); - } catch (...) { - mAddrStrArray = NULL; - } -} - -CComposeAddressTableStorage::~CComposeAddressTableStorage() -{ - delete mAddrTypeArray; - // iterate over mAddrStrArray, deleting address strings - LArrayIterator iter(*mAddrStrArray, LArrayIterator::from_End); - char* str; - while (iter.Previous(&str)) - delete [] str; - // now we can delete address string array - delete mAddrStrArray; -} - -// --------------------------------------------------------------------------- -// ¥ SetCellData -// --------------------------------------------------------------------------- -// Store data for a particular Cell - -void -CComposeAddressTableStorage::SetCellData( - const STableCell &inCell, - const void *inDataPtr, - Uint32 inDataSize) -{ - if ( inCell.col == 1 ) - mAddrTypeArray->AssignItemsAt(1, inCell.row, inDataPtr, inDataSize); - else - { // copy address string and store string in mAddrStrArray - const char* inStr = (const char*)inDataPtr; - size_t strLength = strlen(inStr); - char* str = new char[strLength + 1]; - ::BlockMoveData(inStr, str, strLength); - str[strLength] = '\0'; - char* current; - // if there's already a string in mAddrStrArray, delete it - if (mAddrStrArray->FetchItemAt(inCell.row, ¤t)) - delete [] current; - mAddrStrArray->AssignItemsAt(1, inCell.row, &str, sizeof(str)); - } -} - -// --------------------------------------------------------------------------- -// ¥ GetCellData -// --------------------------------------------------------------------------- -// Retrieve data for a particular Cell -// -// If outDataPtr is nil, pass back the size of the Cell data -// -// If outDataPtr is not nil, it must point to a buffer of at least -// ioDataSize bytes. On output, ioDataSize is set to the minimum -// of the Cell data size and the input value of ioDataSize and that -// many bytes are copied to outDataPtr. - -void -CComposeAddressTableStorage::GetCellData( - const STableCell &inCell, - void *outDataPtr, - Uint32 &ioDataSize) const -{ - LArray* array = (inCell.col == 1) ? mAddrTypeArray : mAddrStrArray; - if (outDataPtr == nil) - { - ioDataSize = array->GetItemSize(inCell.row); - } - else - { - array->FetchItemAt(inCell.row, outDataPtr, ioDataSize); - } -} - - -// --------------------------------------------------------------------------- -// ¥ FindCellData -// --------------------------------------------------------------------------- -// Pass back the Cell containing the specified data. Returns whether -// or not such a Cell was found. -// For a CComposeAddressTableView, I assume the address string column is the only -// interesting data to find - -Boolean -CComposeAddressTableStorage::FindCellData( - STableCell &outCell, - const void *inDataPtr, - Uint32 inDataSize) const -{ - Boolean found = false; - - Int32 dataIndex = mAddrStrArray->FetchIndexOf(inDataPtr, inDataSize); - - if (dataIndex != LArray::index_Bad) { - outCell.col = 2; - outCell.row = dataIndex; - found = true; - } - - return found; -} - - -// --------------------------------------------------------------------------- -// ¥ InsertRows -// --------------------------------------------------------------------------- -// Insert rows into an ArrayStorage. -// -// inDataPtr points to the data for the new cells. Each new cell will -// have the same data. - -void -CComposeAddressTableStorage::InsertRows( - Uint32 inHowMany, - TableIndexT inAfterRow, - const void* /*inDataPtr*/, - Uint32 /*inDataSize*/) -{ - EAddressType type = eToType; - mAddrTypeArray->InsertItemsAt(inHowMany, inAfterRow + 1, &type, sizeof(type)); - char *nothing = NULL; - mAddrStrArray->InsertItemsAt(inHowMany, inAfterRow + 1, ¬hing, sizeof(nothing)); -} - - -// --------------------------------------------------------------------------- -// ¥ RemoveRows -// --------------------------------------------------------------------------- -// Removes rows from an ArrayStorage - -void -CComposeAddressTableStorage::RemoveRows( - Uint32 inHowMany, - TableIndexT inFromRow) -{ - mAddrTypeArray->RemoveItemsAt(inHowMany, inFromRow); - // deallocate strings in mAddrStrArray - char *string = NULL; - Uint32 itemSize = sizeof(string); - for (TableIndexT i = 0; i < inHowMany; i++) - { - mAddrStrArray->FetchItemAt(inFromRow + i, &string, itemSize); - if (string) - delete [] string; - mAddrStrArray->RemoveItemsAt(inHowMany, inFromRow); - } -} - - -// --------------------------------------------------------------------------- -// ¥ GetStorageSize -// --------------------------------------------------------------------------- -// Pass back the number of rows and columns represented by the data -// in an ArrayStorage - -void -CComposeAddressTableStorage::GetStorageSize( - TableIndexT &outRows, - TableIndexT &outCols) -{ - // An Array is one-dimensional. By default, we assume a - // single column with each element being a sepate row. - - outRows = mAddrStrArray->GetCount(); - outCols = 2; - if (outRows == 0) { - outCols = 0; - } -} diff --git a/mozilla/cmd/macfe/MailNews/CComposeAddressTableView.h b/mozilla/cmd/macfe/MailNews/CComposeAddressTableView.h deleted file mode 100644 index 37add1986ee..00000000000 --- a/mozilla/cmd/macfe/MailNews/CComposeAddressTableView.h +++ /dev/null @@ -1,298 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CComposeAddressTableView.h - -#pragma once - -#include "abcom.h" -#include -#include -#include -#include -#include "MailNewsAddressBook.h" -#include "CTSMEditField.h" -#include "MailNewsCallbacks.h" -#include "CMailNewsContext.h" - -#define kAddressTypeMenuID 10611 - -typedef enum { - eNoAddressType = 0, - eToType, - eCcType, - eBccType, - eReplyType, - eNewsgroupType, - eFollowupType -} EAddressType; - -class ABook; -typedef struct DIR_Server DIR_Server; - -#ifdef MOZ_NEWADDR -//====================================== -class CMailAddressEditField : public CTSMEditField - , public CMailCallbackListener -//====================================== -{ -private: - typedef CTSMEditField Inherited; - -public: - enum { class_ID = 'Aedt' }; - - CMailAddressEditField( LStream* inStream ); - virtual ~CMailAddressEditField(); - - void Init(); - virtual void FinishCreateSelf(); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - virtual void SpendTime(const EventRecord& inMacEvent); - virtual void UserChangedText(); // override to do address-book name completion. - virtual void StartNameCompletion(); - virtual void SetNameCompletionResults( - int numResults, - char* displayString, - char* headerString, - char* expandHeaderString); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - - const char* FinalizeEdit(); // user has tabbed out, etc. Returns Mallocked string. - -protected: - static int NameCompletionBECallbackFunction( - AB_NameCompletionCookie* cookie, - int numResults, - void* FECookie); - - -//----- -// Data -//----- -protected: - UInt32 mTimeLastCall; - Boolean mIsCompletedName; - Boolean mNeedToAutoCompleteAtIdleTime; - CMailNewsContext* mMailNewsContext; - MSG_Pane* mPickerPane; - - int mNumResults; - char* mDisplayString; - char* mHeaderString; - char* mExpandHeaderString; -}; - -#else //MOZ_NEWADDR - -//====================================== -class CMailAddressEditField : public CTSMEditField - // ,public LBroadcaster -//====================================== -{ -public: - enum { class_ID = 'Aedt' }; - CMailAddressEditField( LStream* inStream ); - virtual void FinishCreateSelf(); - virtual void UserChangedText(); // override to do address-book name completion. - const char* FinalizeEdit(); // user has tabbed out, etc. Returns Mallocked string. - virtual Boolean HandleKeyPress( const EventRecord &inKeyEvent ); - virtual void SpendTime( const EventRecord& inMacEvent ); - void Init(); -//protected: -// virtual void TakeOffDuty(); - -//----- -// Data -//----- -protected: - UInt32 mTimeLastCall; - ABook* mAddressBook; - DIR_Server* mDirServerList; - Boolean mIsCompletedName; - Boolean mCheckAddress; - ABID mEntryID; - -}; -#endif //MOZ_NEWADDR - - -const MessageT msg_AddressChanged ='AdCh'; - -//====================================== -class CComposeAddressTableView : public LTableView, - public LCommander, - //public LListener, - public LDragAndDrop, - public LBroadcaster -//====================================== -{ -private: - typedef LTableView Inherited; - -public: - enum { class_ID = 'AdTV' }; - CComposeAddressTableView(LStream* inStream); - - virtual ~CComposeAddressTableView() ; - - virtual void FinishCreateSelf(); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam = nil); - - void SetUpTableHelpers(); - - void AdjustColumnWidths(); - virtual void ResizeFrameBy( Int16 inWidthDelta, Int16 inHeightDelta, - Boolean inRefresh); - - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - virtual Boolean ClickSelect( const STableCell &inCell, - const SMouseDownEvent &inMouseDown ); - virtual void ClickSelf( const SMouseDownEvent &inMouseDown ); - // virtual void ListenToMessage(MessageT inMessage, void* ioParam ); - - void InsertNewRow(Boolean inRefresh, Boolean inEdit ); - void InsertNewRow(EAddressType inAddressType, - const char* inAddress, Boolean inEdit = false); - - void FillInRow( Int32 row, EAddressType inAddressType, const char* inAddress); - void StartEditCell(const STableCell &inCell); - void EndEditCell(); - STableCell GetEditCell() {return mEditCell;} - - void CreateCompHeader(EAddressType inAddressType, LHandleStream& inStream); - // Drag and Drop - virtual void InsideDropArea( DragReference inDragRef); - virtual void LeaveDropArea(DragReference inDragRef); - virtual Boolean DragIsAcceptable(DragReference inDragRef); - virtual Boolean ItemIsAcceptable(DragReference inDragRef, ItemReference inItemRef ); - - virtual void ReceiveDragItem( DragReference inDragRef, - DragAttributes flags, - ItemReference inItemRef, - Rect& itemBounds); - void HiliteRow( TableIndexT inRow, Boolean inUnderline ); - - // utility functions for new compose window because attach view - // is inside a tab switcher - void AddDropAreaToWindow(LWindow* inWindow); - void RemoveDropAreaFromWindow(LWindow* inWindow); - // Commands - void DeleteSelection(); - void SetSelectionAddressType( EAddressType inAddressType ); - // utility functions - void GetNumRows(TableIndexT &inRowCount); - EAddressType GetRowAddressType( TableIndexT inRow ); - void SetRowAddressType( TableIndexT inRow, EAddressType inAddressType ); - - void SetTextTraits( ResIDT textTraits ); - -protected: - - void DirectInputToAddressColumn(); - void StopInputToAddressColumn(); - - virtual void ClickCell(const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - - virtual void DrawCell(const STableCell &inCell, - const Rect &inLocalRect); - - virtual void DrawSelf(); - - - - Int32 FinalizeAddrCellEdit(); - Int32 CommitRow( const char* inString, STableCell cell); - void HideEditField(); - - virtual void TakeOffDuty(); - - virtual Uint16 CalculateAddressTypeColumnWidth(); - -//------ -// data -//------ -protected: - - CMailAddressEditField* mInputField; - STableCell mEditCell; - Boolean mCurrentlyAddedToDropList; - Boolean mAddressTypeHasFocus; - char *mTypedownTable; - RGBColor mDropColor; - TableIndexT mDropRow; - Boolean mIsDropBetweenFolders; // changing order - Boolean mDirty; - ResIDT mTextTraits; -}; - - -//====================================== -class CComposeAddressTableStorage : public LTableStorage -//====================================== -{ -public: - CComposeAddressTableStorage(LTableView* inTableView); - virtual ~CComposeAddressTableStorage(); - - virtual void SetCellData( - const STableCell &inCell, - const void *inDataPtr, - Uint32 inDataSize); - virtual void GetCellData( - const STableCell &inCell, - void *outDataPtr, - Uint32 &ioDataSize) const; - virtual Boolean FindCellData( - STableCell &outCell, - const void *inDataPtr, - Uint32 inDataSize) const; - virtual void InsertRows( - Uint32 inHowMany, - TableIndexT inAfterRow, - const void *inDataPtr, - Uint32 inDataSize); - virtual void InsertCols( - - Uint32 /* inHowMany */, - TableIndexT /* inAfterCol */, - const void* /* inDataPtr */, - Uint32 /* inDataSize */) { }; - virtual void RemoveRows( - Uint32 inHowMany, - TableIndexT inFromRow); - virtual void RemoveCols( - Uint32 /* inHowMany */, - TableIndexT /* inFromCol */) { }; - virtual void GetStorageSize( - TableIndexT &outRows, - TableIndexT &outCols); - -protected: - LArray* mAddrTypeArray; - LArray* mAddrStrArray; -}; - diff --git a/mozilla/cmd/macfe/MailNews/CComposeSession.cp b/mozilla/cmd/macfe/MailNews/CComposeSession.cp deleted file mode 100644 index 3e03f6f0aff..00000000000 --- a/mozilla/cmd/macfe/MailNews/CComposeSession.cp +++ /dev/null @@ -1,452 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CComposeSession.cp - -#include "CComposeSession.h" -#include "CMailNewsContext.h" -#include "CEditView.h" - -// PowerPlant -#include - -// XP -#include "proto.h" // for XP_InterruptContext -#include "addrbook.h" -//#include "aberror.h" -#include "edt.h" -#include "mime.h" -#include "libi18n.h" - -#include "msg_srch.h" // needed for priority -// Mac FE -#include "uerrmgr.h" // ErrorManager -#include "resgui.h" // error string constants -#include "mailNewsgroupWindow_Defines.h" // Tmessages -int FE_QuoteCallback(void* closure, const char* data) -{ - if (data) - { - CComposeSession* session = (CComposeSession*)closure; - // this causes a broadcast from session to compose window - // how do I return an error? - session->InsertQuoteText(data); - } - else - { - CComposeSession* session = (CComposeSession*)closure; - session->AutoQuoteDone(); - } - return 0; -} - -//----------------------------------- -CComposeSession::CComposeSession(Boolean inOpeningAsDraft) -//----------------------------------- -: mCompositionContext(nil), - mXPCompositionPane(nil), - mDontIgnoreAllConnectionsComplete(false), - mDownloadingAttachments(false), - mCloseWindowAfterSavingDraft(false), - mClosing(false), - mAutoQuoting( false ), - mOpeningAsDraft(inOpeningAsDraft) -{ -} - -//----------------------------------- -CComposeSession::~CComposeSession() -//----------------------------------- -{ - if (mClosing) - return; - mClosing = true; - - Stop(); - - if (mXPCompositionPane) - MSG_DestroyPane(mXPCompositionPane); - - mXPCompositionPane = nil; - mCompositionContext->RemoveUser(this); - mCompositionContext->RemoveListener(this); -} - -// --------------------------------------------------------------------------- -MSG_Pane* CComposeSession::CreateBackendData(MWContext* inOldContext, - MSG_CompositionFields* inCompositionFields) -// Create backend data associated with a compose session. This data consists -// of the MWContext and the MSG_CompositionPane object. -// --------------------------------------------------------------------------- -{ - Try_ { - // if we can't allocate CMailCompositionContext, this object does us no good - mCompositionContext = new CMailCompositionContext(); - mCompositionContext->AddListener(this); - mCompositionContext->CreateContextProgress(); - mCompositionContext->AddUser(this); - mCompositionContext->WaitWhileBusy(); - mXPCompositionPane = MSG_CreateCompositionPane( - *mCompositionContext, - inOldContext, - MSG_GetPrefsForMaster(CMailNewsContext::GetMailMaster()), - inCompositionFields, - CMailNewsContext::GetMailMaster()); - // while we're here, set from field using preference -#if 0 // FIX: no need to: 'From' field is already set - if (mXPCompositionPane) - { - char * fromField = MIME_MakeFromField(); - // FIX ME -- what do we do if there is an error? - int err = MSG_SetCompHeader(mXPCompositionPane, - MSG_FROM_HEADER_MASK, - fromField); - XP_FREE(fromField); - } -#endif - } - Catch_(e) - { - // There's a leak here: mCompositionPane will not be cleaned up. - // I couldn't work out how to do it, unless it's to call: - // MSG_MailCompositionAllConnectionsComplete(mXPCompositionPane); - - Throw_(e); - } - EndCatch_ - // I assume that we call this method shortly after creating - // the object itself, so mXPCompositionPane should be NULL before we - // enter this method - return mXPCompositionPane; -} - -void CComposeSession::SetCompositionPaneFEData( void *data ) -{ - if (mXPCompositionPane) - { - // let's set the window here so we can send it a close message after sending the mail - MSG_SetFEData(mXPCompositionPane, data); - } -} - -void CComposeSession::ListenToMessage(MessageT inMessage, void* ioParam) -{ - if (mClosing) - return; - - switch(inMessage) - { - case msg_NSCAllConnectionsComplete: - if (mDownloadingAttachments) - { - // we're done downloading attachments, now do send command - mDownloadingAttachments = false; - switch (mMessage){ - case cmd_SaveDraft: - SaveDraftOrTemplate(inMessage, mCloseWindowAfterSavingDraft ); - break; - case cmd_SaveTemplate: - SaveDraftOrTemplate(inMessage, false ); - break; - default: // Handles SendNow and SendLater - SendMessage(mSendNow); - break; - } - - } - else if (mDontIgnoreAllConnectionsComplete) // MOAN! - { - if (mXPCompositionPane) - { - // We need to call this to let backend know to delete mXPCompositionPane - // Backend will destroy mXPCompositionPane when ready, so we don't need to. - // We'll come here several times for HTML parts messages, so don't do - // anything final. The backend will call FE_DestroyCompositionContext when - // everything is REALLY complete. We'll close the window then. - MSG_MailCompositionAllConnectionsComplete(mXPCompositionPane); - } - } - break; - // pass on broadcast to listeners - default: - BroadcastMessage(inMessage, ioParam); - break; - } -} - -void CComposeSession::SetMessageHeaderData(MSG_HEADER_SET inMessageHeaderType, - LHandleStream& inDataStream) -{ - if (mXPCompositionPane) - { - Handle data = inDataStream.GetDataHandle(); - StHandleLocker lock(data); - int err = MSG_SetCompHeader(mXPCompositionPane,inMessageHeaderType, *data); - // what do we do if there is an error? - } -} - -const char* CComposeSession::GetMessageHeaderData(MSG_HEADER_SET inMessageHeaderType) -{ - return MSG_GetCompHeader(mXPCompositionPane, inMessageHeaderType); -} - -void CComposeSession::SetMessageBody(LHandleStream& inDataStream) -{ - if (mXPCompositionPane) - { - Handle data = inDataStream.GetDataHandle(); - StHandleLocker lock(data); - MSG_SetHTMLMarkup(mXPCompositionPane, false); - int err = MSG_SetCompBody(mXPCompositionPane, *data); - } -} - -void CComposeSession::SetHTMLMessageBody() -{ - if (mXPCompositionPane) - { - XP_HUGE_CHAR_PTR textp = nil; - EDT_SaveToBuffer(*mCompositionContext, &textp); - MSG_SetHTMLMarkup(mXPCompositionPane, true); - int err = MSG_SetCompBody(mXPCompositionPane, textp); - if (textp) - delete textp; - } -} - -void CComposeSession::SendMessage(Boolean inSendNow) -{ - mDontIgnoreAllConnectionsComplete = true; - mSendNow = inSendNow; - MSG_Command(mXPCompositionPane, inSendNow ? MSG_SendMessage : MSG_SendMessageLater, nil, nil); -} - -const char* CComposeSession::GetSubject() -{ - return MSG_GetCompHeader(mXPCompositionPane, MSG_SUBJECT_HEADER_MASK); -} - -MSG_PRIORITY CComposeSession::GetPriority() -{ - // Oh, no! msglib gives us a hard-coded string. What sort of consciousness - // can lead to this type of code. Let's hope that the linker can pool strings for us, - // so that this will only take up 20 extra bytes. - const char *priority = MSG_GetCompHeader( GetMSG_Pane(), MSG_PRIORITY_HEADER_MASK ); - if( priority ) - { - if (strcasestr(priority, "Normal") != NULL) - return MSG_NormalPriority; - else if (strcasestr(priority, "Lowest") != NULL) - return MSG_LowestPriority; - else if (strcasestr(priority, "Highest") != NULL) - return MSG_HighestPriority; - else if (strcasestr(priority, "High") != NULL || - strcasestr(priority, "Urgent") != NULL) - return MSG_HighPriority; - else if (strcasestr(priority, "Low") != NULL || - strcasestr(priority, "Non-urgent") != NULL) - return MSG_LowPriority; - else - return MSG_NoPriority; - } - return MSG_NoPriority; -} - -const struct MSG_AttachmentData* -CComposeSession::GetAttachmentData() -{ - return MSG_GetAttachmentList(mXPCompositionPane); -} - -void CComposeSession::SetAttachmentList(MSG_AttachmentData* inAttachmentList) -{ - try - { - mDownloadingAttachments = true; - int status = MSG_SetAttachmentList(mXPCompositionPane, inAttachmentList); - if (status) throw status; - } - catch (...) - { - mDownloadingAttachments = false; - throw; - } -} - - -void CComposeSession::InsertQuoteText(const char* text) -{ - BroadcastMessage(msg_InsertQuoteText, (void*)text); -} - -void CComposeSession::AutoQuoteDone() -{ - if( mAutoQuoting ) - BroadcastMessage(msg_AutoQuoteDone, NULL); - mAutoQuoting = false; -} - - -void CComposeSession::CheckForAutoQuote() -{ - if (ShouldAutoQuote()) - { - mAutoQuoting = true; - QuoteMessage(); - } -} - -void CComposeSession::QuoteMessage() -{ - MSG_QuoteMessage(mXPCompositionPane, FE_QuoteCallback, this); -} - -#if 0 -// As far as I can tell, this never gets called. -void CComposeSession::QuoteInHTMLMessage( const char *text ) -{ - MWContext* context = (MWContext*)*mCompositionContext; - EDT_BeginOfDocument( context, false ); // before signature, if any. - // insert a blank line between message and quote - EDT_ReturnKey( context ); - EDT_PasteQuote( context, (char *)text ); - // move the insertion caret to the beginning (where it should be) - EDT_BeginOfDocument( context, false ); -} -#endif - -void CComposeSession::SetPriority(MSG_PRIORITY inPriority) -{ - char priorityString[50]; - MSG_GetUntranslatedPriorityName ( inPriority, priorityString, sizeof(priorityString)); - MSG_SetCompHeader( - mXPCompositionPane, - MSG_PRIORITY_HEADER_MASK, - priorityString ); -} - -void CComposeSession::Stop() -{ - // ignore all connections complete message from backend - mDontIgnoreAllConnectionsComplete = false; - XP_InterruptContext(*mCompositionContext); - mDownloadingAttachments = false; -} - -void CComposeSession::SaveDraftOrTemplate(CommandT inCommand, Boolean inCloseWindow ) -{ - MSG_CommandType cmd; - if ( inCloseWindow ) - { - Assert_(inCommand == cmd_SaveDraft); - cmd = MSG_SaveDraftThenClose; - mDontIgnoreAllConnectionsComplete = true; - } - else if (inCommand == cmd_SaveTemplate) - cmd = MSG_SaveTemplate; - else - cmd = MSG_SaveDraft; - - MSG_Command(mXPCompositionPane, cmd , nil, nil); -} - -int CComposeSession::SetCompBoolHeader(MSG_BOOL_HEADER_SET header,XP_Bool value) -{ - return MSG_SetCompBoolHeader(mXPCompositionPane, header,value); -} - - -Uint32 GetAttachmentListLength(const MSG_AttachmentData* inAttachList); -Uint32 GetAttachmentListLength(const MSG_AttachmentData* inAttachList) -{ - UInt32 result = 0; - if (inAttachList) - { - MSG_AttachmentData* iter = const_cast(inAttachList); - while (iter->url != nil) - { - ++result; - ++iter; - } - } - return result; -} - -Int16 CComposeSession::GetDefaultCSID() -{ // Delegate to mCompositionContext - if (mCompositionContext) - return mCompositionContext->GetDefaultCSID(); - else - return 0; -} -void CComposeSession::SetDefaultCSID(Int16 default_csid) -{ // Delegate to mCompositionContext - Assert_(mCompositionContext); - if (mCompositionContext) - { - mCompositionContext->SetDefaultCSID(default_csid); - mCompositionContext->SetDocCSID(default_csid); - mCompositionContext->SetWinCSID(INTL_DocToWinCharSetID(default_csid)); - } -} -int16 CComposeSession::GetWinCSID() -{ - Assert_(mCompositionContext); - if (mCompositionContext) - return mCompositionContext->GetWinCSID(); - else - return 0; -} - -Boolean CComposeSession::NeedToSyncAttachmentList(MSG_AttachmentData* inAttachList) -{ - Boolean result = false; - const MSG_AttachmentData* backendList = MSG_GetAttachmentList(mXPCompositionPane); - if ( (inAttachList != nil && backendList == nil) || - (inAttachList == nil && backendList != nil) ) - { // easy case, one list is empty the other is not - result = true; - } else if (inAttachList != nil && backendList != nil) - { // both lists are non-empty - // first check list lengths - Uint32 inLength = GetAttachmentListLength(inAttachList), - backendLength = GetAttachmentListLength(backendList); - if (inLength != backendLength) - // lengths are different - result = true; - else - { // both same length, now check to see if both lists contain same data - MSG_AttachmentData *inIter = inAttachList, - *backendIter = const_cast(backendList); - while (inIter->url != nil) - { - if (XP_STRCMP(inIter->url, backendIter->url)) - { // URL's are different, need to sync up lists - result = true; - break; - } - ++inIter; - ++backendIter; - } - } - } - return result; -} diff --git a/mozilla/cmd/macfe/MailNews/CComposeSession.h b/mozilla/cmd/macfe/MailNews/CComposeSession.h deleted file mode 100644 index 58bb42f1816..00000000000 --- a/mozilla/cmd/macfe/MailNews/CComposeSession.h +++ /dev/null @@ -1,128 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CComposeSession.h - -#pragma once - -// PowerPlant -#include - -// XP -#include "msgcom.h" -#include "structs.h" // mother of all structs (i.e. MWContext) - -// MacFE -#include "CProgressBroadcaster.h" -#include "CMailComposeWindow.h" // for CMailCompositionContext - -// quote function passed into MSG_QuoteMessage -extern "C" -{ -int FE_QuoteCallback(void* closeure, const char* data); -} - -class CComposeSession : public CProgressBroadcaster, - public LListener -{ -public: - enum { msg_AllConnectionsComplete = 'ACnC', - msg_InsertQuoteText = 'InsQ', - msg_AutoQuoteDone = 'AQDn' }; - - CComposeSession(Boolean inOpeningAsDraft); - virtual ~CComposeSession(); - - virtual void ListenToMessage(MessageT inMessage,void *ioParam); - - MSG_Pane* CreateBackendData(MWContext* inOldContext, - MSG_CompositionFields* inCompositionFields); - -// get data - const char* GetSubject(); - MSG_PRIORITY GetPriority(); - const char* GetMessageHeaderData(MSG_HEADER_SET inMessageHeaderType); - const struct MSG_AttachmentData* - GetAttachmentData(); - Boolean GetDownloadingAttachments() const { return mDownloadingAttachments; } - Boolean GetDeliveryInProgress() const { if ( mXPCompositionPane ) - return MSG_DeliveryInProgress( mXPCompositionPane ); - else - return false; - } - MSG_Pane* GetMSG_Pane() {return mXPCompositionPane;} - void MarkMSGPaneDestroyed() {mXPCompositionPane = nil;} - CMailCompositionContext* GetCompositionContext() {return mCompositionContext;} - Boolean GetAutoQuoting() { return mAutoQuoting; } -// set data - void SetMessageHeaderData(MSG_HEADER_SET inMessageHeaderType, - LHandleStream& inDataStream); - void SetAttachmentList(MSG_AttachmentData* inAttachmentList); - void SetPriority(MSG_PRIORITY inPriority); - void SetMessageBody(LHandleStream& inHandleStream); - void SetHTMLMessageBody(); - void SetCompositionPaneFEData(void *data); - void SetMessage(MessageT command) {mMessage=command;}; - int SetCompBoolHeader(MSG_BOOL_HEADER_SET header,XP_Bool value); - XP_Bool GetCompBoolHeader(MSG_BOOL_HEADER_SET header) - { return MSG_GetCompBoolHeader(mXPCompositionPane, header);} -// quoting - void InsertQuoteText(const char* text); - void AutoQuoteDone(); - Boolean ShouldAutoQuote() const - { return !mOpeningAsDraft - && ::MSG_ShouldAutoQuote(mXPCompositionPane); - } - void CheckForAutoQuote(); - void QuoteInHTMLMessage(const char* text); - -// actions - void WaitWhileContextBusy(); - void SendMessage(Boolean inSendNow); - void SetSendNow(Boolean inSendNow) { mSendNow = inSendNow; } - void SetCloseWindow( Boolean inClose) { mCloseWindowAfterSavingDraft = inClose; } - void QuoteMessage(); - void Stop(); - void SaveDraftOrTemplate(CommandT inCommand, Boolean inCloseWindow); - -// potpourri - Boolean NeedToSyncAttachmentList(MSG_AttachmentData* inAttachList); - - // I18N stuff - virtual Int16 GetDefaultCSID(void); - virtual void SetDefaultCSID(Int16 defaultcsid); - int16 GetWinCSID(); -protected: - - CMailCompositionContext* mCompositionContext; - MSG_Pane* mXPCompositionPane; - // I must say, the reason why I have to do this... - Boolean mDontIgnoreAllConnectionsComplete; - // Double SIGH! - Boolean mDownloadingAttachments; - Boolean mSendNow; - MessageT mMessage; - Boolean mCloseWindowAfterSavingDraft; - Boolean mClosing; - Boolean mAutoQuoting; - Boolean mOpeningAsDraft; -}; - - diff --git a/mozilla/cmd/macfe/MailNews/CFolderThreadController.cp b/mozilla/cmd/macfe/MailNews/CFolderThreadController.cp deleted file mode 100644 index d45468b6e19..00000000000 --- a/mozilla/cmd/macfe/MailNews/CFolderThreadController.cp +++ /dev/null @@ -1,236 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CFolderThreadController.cp - -#include "CFolderThreadController.h" - -#include "CMessageFolderView.h" -#include "CThreadView.h" -#include "MailNewsgroupWindow_Defines.h" -#include "divview.h" -#include "CTargetFramer.h" -#include "CNetscapeWindow.h" - -#include "resgui.h" // for cmd_ShowLocationBar - -#include "prefapi.h" - -const char* Pref_MailShowLocationBarFolders = "mailnews.chrome.show_url_bar.folders"; -const char* Pref_MailShowLocationBarNoFolders = "mailnews.chrome.show_url_bar.nofolders"; - -//---------------------------------------------------------------------------------------- -CFolderThreadController::CFolderThreadController( - LDividedView* inDividedView -, CNSContext* inThreadContext -, CMessageFolderView* inFolderView -, CThreadView* inThreadView -) -//---------------------------------------------------------------------------------------- -: mDividedView(inDividedView) -, mThreadContext(inThreadContext) -, mFolderView(inFolderView) -, mThreadView(inThreadView) -{ - Assert_(mDividedView); - Assert_(mThreadContext); - Assert_(mThreadView); - Assert_(mFolderView); - inDividedView->SetCollapseByDragging(true, true); - mDividedView->AddListener(this); // for msg_DividerChangedPosition - mFolderView->AddListener(this); - mFolderView->SetRightmostVisibleColumn(1); // hide the count columns -} // CFolderThreadController::CFolderThreadController - -//---------------------------------------------------------------------------------------- -CFolderThreadController::~CFolderThreadController() -//---------------------------------------------------------------------------------------- -{ - // See comment in FinishCreateSelf. Destroy the folder and thread views explicitly - // here, so that it's done in the right order. Because of the tab order requirement, - // LCommander::~LCommander would otherwise be deleting these in the opposite order - // to the tab order, namely message/thread/folder. Boom. - delete mFolderView; - mFolderView = nil; - delete mThreadView; - mThreadView = nil; - // The message view remains a subcommander, so will be deleted in the base class - // destructor. -} // CFolderThreadController::~CFolderThreadController - -//---------------------------------------------------------------------------------------- -void CFolderThreadController::FinishCreateSelf() -//---------------------------------------------------------------------------------------- -{ - // It's critical the order we do this. These are added to the end of the - // supercommander's subcommander list, and destroyed in the opposite order. - // Since we have to destroy in the order folder/thread/message, we would like to add - // here in the order message/thread/folder. But unfortunately, the order we add them - // also affects the tab order, which we would like to be folder/thread/message. So - // the order here is for the benefit of the tab order. See the destructor code above. - mFolderView->SetSuperCommander(this); - mThreadView->SetSuperCommander(this); - CTargetFramer* framer = new CTargetFramer(); - mThreadView->AddAttachment(framer); - framer = new CTargetFramer(); - mFolderView->AddAttachment(framer); - SetLatentSub(mFolderView); - - mFolderView->SetFancyDoubleClick(true); -} // CFolderThreadController::FinishCreateSelf - -//---------------------------------------------------------------------------------------- -void CFolderThreadController::ListenToMessage(MessageT inMessage, void *ioParam) -//---------------------------------------------------------------------------------------- -{ - switch (inMessage) - { - case msg_DividerChangedPosition: - { - // Don't take any action during FinishCreate(): assume that the panes - // will be constructed in the same correct positions that they were saved in. - if (mDividedView->IsVisible() && (LDividedView*)ioParam == mDividedView) - NoteDividerChanged(); - break; - } - case CStandardFlexTable::msg_SelectionChanged: - { - Assert_(ioParam == mFolderView); - MSG_FolderInfo* info = nil; - if (mFolderView->GetSelectedRowCount() == 1) - { - // See also CMessageFolderView::OpenRow - info = mFolderView->GetSelectedFolder(); - CMessageFolder folder(info); - if (folder.IsMailServer() - || folder.IsNewsHost() - || !folder.CanContainThreads()) - { - info = nil; - } - } - mThreadView->LoadMessageFolder(mThreadContext, info, false /* delay: don't load now */); - break; - } - default: - break; - } -} // CFolderThreadController::ListenToMessage - -//---------------------------------------------------------------------------------------- -void CFolderThreadController::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//---------------------------------------------------------------------------------------- -{ - switch(inCommand) - { - case cmd_ToggleFolderPane: - outEnabled = (mDividedView != nil); - outUsesMark = false; - if (outEnabled && mDividedView->IsFirstPaneCollapsed()) - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, SHOW_FOLDERPANE_STRING); - else - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, HIDE_FOLDERPANE_STRING); - break; - default: - LTabGroup::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} // CFolderThreadController::FindCommandStatus - -//---------------------------------------------------------------------------------------- -Boolean CFolderThreadController::ObeyCommand( - CommandT inCommand, - void *ioParam) -//---------------------------------------------------------------------------------------- -{ - switch (inCommand) - { - case cmd_ToggleFolderPane: - if (mDividedView) - mDividedView->ToggleFirstPane(); - // force menu items to update show "Show" and "Hide" string changes are reflected - LCommander::SetUpdateCommandStatus(true); - return true; - case cmd_RelocateViewToFolder: - if (mFolderView) - mFolderView->SelectFolder((MSG_FolderInfo*)ioParam); - else - mThreadView->RelocateViewToFolder((MSG_FolderInfo*)ioParam); - return true; - case msg_TabSelect: - // Subcommanders (thread/folder/message) will kick this upstairs here. - return true; - } - return LTabGroup::ObeyCommand(inCommand, ioParam); -} // CFolderThreadController::ObeyCommand - -//---------------------------------------------------------------------------------------- -void CFolderThreadController::ReadStatus(LStream *inStatusData) -//---------------------------------------------------------------------------------------- -{ - mDividedView->RestorePlace(inStatusData); -} // CFolderThreadController::ReadWindowStatus - -//---------------------------------------------------------------------------------------- -void CFolderThreadController::WriteStatus(LStream *outStatusData) -//---------------------------------------------------------------------------------------- -{ - mDividedView->SavePlace(outStatusData); -} // CFolderThreadController::WriteWindowStatus - -//---------------------------------------------------------------------------------------- -void CFolderThreadController::NoteDividerChanged() -//---------------------------------------------------------------------------------------- -{ - Boolean foldersCollapsed = mDividedView->IsFirstPaneCollapsed(); - const char* prefName = foldersCollapsed ? - Pref_MailShowLocationBarNoFolders - : Pref_MailShowLocationBarFolders; - XP_Bool doShow; - if (PREF_GetBoolPref(prefName, &doShow) != PREF_NOERROR) - { - // If the preference is not yet set, the default is to show iff folders are collapsed - doShow = foldersCollapsed; - } - // These commands will be handled by CMailNewsWindow. The values will be written out to the - // prefs file as a side effect of ToggleDragBar, using the virtual method - // GetLocationBarPrefName() which we have provided. - if (doShow) - ObeyCommand(cmd_ShowLocationBar, nil); - else - ObeyCommand(cmd_HideLocationBar, nil); -} // CFolderThreadController::NoteDividerChanged - -//---------------------------------------------------------------------------------------- -const char* CFolderThreadController::GetLocationBarPrefName() const -//---------------------------------------------------------------------------------------- -{ - if (!mDividedView) - return nil; - if (mDividedView->IsFirstPaneCollapsed()) - return Pref_MailShowLocationBarNoFolders; - return Pref_MailShowLocationBarFolders; -} - diff --git a/mozilla/cmd/macfe/MailNews/CFolderThreadController.h b/mozilla/cmd/macfe/MailNews/CFolderThreadController.h deleted file mode 100644 index 1cbd36d0104..00000000000 --- a/mozilla/cmd/macfe/MailNews/CFolderThreadController.h +++ /dev/null @@ -1,79 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CFolderThreadController.h - -#include -#include - -class CMessageFolderView; -class CThreadView; -class CNSContext; -class LDividedView; - -//====================================== -class CFolderThreadController - : public LListener - , public LTabGroup -// This class is here to mediate between the folder pane and the thread pane in a 3-pane -// window. Its function is to allow the thread view class not to know anything about -// the folder view. -//====================================== -{ - public: - CFolderThreadController( - LDividedView* inDividedView - , CNSContext* inThreadContext - , CMessageFolderView* inFolderView - , CThreadView* inThreadView - ); - virtual ~CFolderThreadController(); - // LListener overrides: - protected: - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - // LCommander overrides: - protected: - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - - // CSaveWindowStatus helpers: - public: - void ReadStatus(LStream *inStatusData); - void WriteStatus(LStream *outStatusData); - const char* GetLocationBarPrefName() const; - - // Specials - public: - void FinishCreateSelf(); - void NoteDividerChanged(); - - // Data - protected: - LDividedView* mDividedView; - CMessageFolderView* mFolderView; - CThreadView* mThreadView; - CNSContext* mThreadContext; -}; // class CFolderThreadController diff --git a/mozilla/cmd/macfe/MailNews/CKeyStealingAttachment.cp b/mozilla/cmd/macfe/MailNews/CKeyStealingAttachment.cp deleted file mode 100644 index 8fd6aa710c7..00000000000 --- a/mozilla/cmd/macfe/MailNews/CKeyStealingAttachment.cp +++ /dev/null @@ -1,36 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -#include "CKeyStealingAttachment.h" - -//----------------------------------- -void CKeyStealingAttachment::ExecuteSelf(MessageT, void *ioParam) -//----------------------------------- -{ - EventRecord* event = (EventRecord*)ioParam; - if ((event->what != keyDown) && (event->what != autoKey)) - return; - char theKey = (char)(event->message & charCodeMask); - if (mKeysToSteal.FetchIndexOf(&theKey) != LArray::index_Bad) - { - mTarget->ProcessKeyPress(*event); - event->what = nullEvent; // prevent normal handling. - event->message = 0; // prevent normal handling. - } -} // CKeyStealingAttachment::ExecuteSelf \ No newline at end of file diff --git a/mozilla/cmd/macfe/MailNews/CKeyStealingAttachment.h b/mozilla/cmd/macfe/MailNews/CKeyStealingAttachment.h deleted file mode 100644 index 43ca07a6224..00000000000 --- a/mozilla/cmd/macfe/MailNews/CKeyStealingAttachment.h +++ /dev/null @@ -1,43 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#include -//====================================== -class CKeyStealingAttachment : public LAttachment -// This guy is added at the front of the attachment list in expanded mode, so that -// certain keypresses go to the message view instead of to the table view. -//====================================== -{ -public: - CKeyStealingAttachment(LCommander *inKeyTarget) - : LAttachment(msg_KeyPress) - , mKeysToSteal(sizeof(char)) - , mTarget(inKeyTarget) {} - virtual void ExecuteSelf(MessageT inMessage, void *ioParam); - void StealKey(char keyToSteal) - { - mKeysToSteal.InsertItemsAt( - 1, - LArray::index_Last, - &keyToSteal); - } -protected: - LCommander* mTarget; - LArray mKeysToSteal; -}; - diff --git a/mozilla/cmd/macfe/MailNews/CMailComposeWindow.cp b/mozilla/cmd/macfe/MailNews/CMailComposeWindow.cp deleted file mode 100644 index 8e6a6d2a82e..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailComposeWindow.cp +++ /dev/null @@ -1,2237 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailComposeWindow.cp - -#include "CMailComposeWindow.h" -#include "rosetta.h" - -#include "CSimpleTextView.h" -#include "CEditView.h" -#include "CThreadWindow.h" -#include "CBrowserWindow.h" -#include "CMessageWindow.h" - -//#include -//#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "UOffline.h" -#include "macutil.h" -#include "resgui.h" -#include "uapp.h" -#include "MailNewsgroupWindow_Defines.h" -#include "CComposeSession.h" -#include "UStdDialogs.h" -#include "URobustCreateWindow.h" -#include "LGACheckbox.h" -#include "edt.h" -#include "macgui.h" // MakeLOColor -#include "xpgetstr.h" // for XP_GetString -#include "secnav.h" -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS -#include "CTabControl.h" -#include "meditor.h" // HandleModalDialog -#include "UGraphicGizmos.h" -#include "CPatternButtonPopup.h" -#include "CMailNewsContext.h" -#include "CLargeEditField.h" -#include "CPasteSnooper.h" -#include "UDeferredTask.h" - -#include "MailNewsAddressBook.h" -#include "ABcom.h" -#ifdef MOZ_NEWADDR -#include "CAddressPickerWindow.h" -#endif - -#define cmd_CheckSpelling 'ChSp' - -const Uint32 cDefaultLineWrapLength = 78; -const ResIDT COMPOSEDLG_SAVE_BEFORE_QUIT = 10621; -const MessageT msg_NoSave = 3; - -#include "msg_srch.h" // needed for priority -#define UPDATE_WINDOW_TITLE_ON_IDLE 1 - - -#pragma mark -- libmsg callbacks -- - -#include "prefapi.h" // temporarily include this until MacFE prefs for ComposeHTML are added - -//----------------------------------- -MSG_Pane* FE_CreateCompositionPane( - MWContext* old_context, - MSG_CompositionFields* fields, - const char* initialText, - MSG_EditorType editorType) -//----------------------------------- -{ - MSG_Pane* result = nil; - CMailComposeWindow *win = nil; - try - { - CMailNewsContext::ThrowUnlessPrefsSet(MWContextMessageComposition); - XP_Bool useHtmlEditor; - PREF_GetBoolPref( "mail.html_compose", &useHtmlEditor ); - // override if - if (MSG_HTML_EDITOR == editorType) - useHtmlEditor = TRUE; - else if (MSG_PLAINTEXT_EDITOR == editorType) - useHtmlEditor = FALSE; - else if (IsThisKeyDown(kCtlKey)) - useHtmlEditor = !useHtmlEditor; - - ResIDT id = useHtmlEditor ? - CMailComposeWindow::res_ID - : CMailComposeWindow::text_res_ID; - - win = dynamic_cast( - URobustCreateWindow::CreateWindow( - id, - LCommander::GetTopCommander())); - if (win) - { - // Now here's a hidden meaning I bet you didn't know. Opening from the sent or - // drafts folder is indicated by the value editorType != MSG_DEFAULT! - Boolean openingAsDraft = editorType != MSG_DEFAULT; - result = win->CreateSession(old_context, fields, initialText, openingAsDraft); - } - } - catch (...) - { - if (win) - win->DoClose(); - } - return result; -} // FE_CreateCompositionPane - -void FE_UpdateCompToolbar(MSG_Pane* msgpane) // in -{ - if (msgpane) - { - void *fedata = MSG_GetFEData(msgpane); - if (fedata) - { - CMailComposeWindow *window = (CMailComposeWindow *)fedata; - window->HandleUpdateCompToolbar(); - } - } -} - -void FE_DestroyMailCompositionContext(MWContext* context) -{ - MSG_Pane* msgpane; - msgpane = MSG_FindPane(context, MSG_COMPOSITIONPANE); - if (msgpane) - { - void *fedata = MSG_GetFEData(msgpane); - if (fedata) - { - CMailComposeWindow *window = (CMailComposeWindow *)fedata; - if (window->IsVisible()) - { - if (window->GetComposeSession()) - window->GetComposeSession()->MarkMSGPaneDestroyed(); -// window->BroadcastMessage(msg_NSCAllConnectionsComplete, nil); - window->DoCloseLater(); - } - } - } -} - -void FE_SecurityOptionsChanged( MWContext* context) -{ - MSG_Pane* msgpane = MSG_FindPane(context, MSG_COMPOSITIONPANE); - if (msgpane) - { - void *fedata = MSG_GetFEData( msgpane ); - if (fedata) - { - CMailComposeWindow *window = (CMailComposeWindow *)fedata; - USecurityIconHelpers::UpdateComposeButton( window ); - CMailOptionTabContainer *optionTab= dynamic_cast (window->FindPaneByID('OpTC') ); - if ( optionTab ) // if the option tab is visible update it - window-> ListenToMessage( msg_ActivatingOptionTab, optionTab ); - } - } - -} - -#pragma mark - - -void UComposeUtilities::WordWrap(Handle& inText, - Uint32 inTextLength, - LHandleStream& outTextStream) -{ - Int32 lineWrapLength = cDefaultLineWrapLength; - - PREF_GetIntPref("mailnews.wraplength", &lineWrapLength); - - try { - StHandleLocker lock(inText); - char *scanner = *inText, - *startOfLine = *inText, - *lastSpace = *inText, - *end = *inText + inTextLength; - while (startOfLine < end) - { - // if line starts with "> " skip to next line - if (*startOfLine == '>' && *(startOfLine + 1) == ' ') - { // move to next line - while (scanner < end && *scanner != '\r') - ++scanner; - // move past '\r' - ++scanner; - // copy text into stream - outTextStream.WriteBlock(startOfLine, scanner - startOfLine); - // set startOfLine to scanner - startOfLine = scanner; - } - else - { - // find ' ' in text stream - while (scanner < end && *scanner != '\r' && *scanner != ' ') - ++scanner; - // we spit out a line of text if a) we hit the end of the text, - // b) have enough text to fill a line, or c) hit a carriage return - if (scanner - startOfLine > lineWrapLength || - scanner == end || - *scanner == '\r') - { - if (*scanner == '\r' || scanner == end) - outTextStream.WriteBlock(startOfLine, scanner - startOfLine); - else - outTextStream.WriteBlock(startOfLine, lastSpace - startOfLine); - if (scanner < end) - { - outTextStream << (unsigned char) '\r'; - if (*scanner == '\r') - startOfLine = scanner + 1; - else - startOfLine = lastSpace + 1; - } - else - startOfLine = scanner; - } - lastSpace = scanner; - ++scanner; - } - } - } catch (...) { - } -} - -MSG_HEADER_SET UComposeUtilities::GetMsgHeaderMaskFromAddressType(EAddressType inAddressType) -{ - MSG_HEADER_SET result = 0; - switch (inAddressType) - { - case eToType: - result = MSG_TO_HEADER_MASK; - break; - case eCcType: - result = MSG_CC_HEADER_MASK; - break; - case eBccType: - result = MSG_BCC_HEADER_MASK; - break; - case eReplyType: - result = MSG_REPLY_TO_HEADER_MASK; - break; - case eNewsgroupType: - result = MSG_NEWSGROUPS_HEADER_MASK; - break; - case eFollowupType: - result = MSG_FOLLOWUP_TO_HEADER_MASK; - break; - } - return result; -} - -MSG_PRIORITY UComposeUtilities::GetMsgPriorityFromMenuItem(Int32 inMenuItem) -{ - // These are mapped to MSG_LowPriority, MSG_NormalPriority, MSG_HighPriority, - // and MSG_HighestPriority, respectively. - return (MSG_PRIORITY)(inMenuItem - 1 + MSG_LowestPriority); -} - - -#pragma mark - - -//#define REGISTER_(letter,root) \ -// RegisterClass_(letter##root::class_ID, \ -// (ClassCreatorFunc)letter##root::Create##root##Stream); - -#define REGISTER_(letter,root) \ - RegisterClass_(letter##root); - -#define REGISTERC(root) REGISTER_(C,root) -#define REGISTERL(root) REGISTER_(L,root) - -//----------------------------------- -void UComposeUtilities::RegisterComposeClasses() -//----------------------------------- -{ - REGISTERC(MailComposeWindow) - REGISTERC(MailEditView) - REGISTERC(MailComposeTabContainer) - REGISTERC(MailOptionTabContainer) - REGISTERC(MailAttachmentTabContainer) - REGISTERC(ComposeAddressTableView) - REGISTERC(ComposeTabSwitcher) - REGISTERC(MailAddressEditField) - #ifdef MOZ_NEWADDR - REGISTERC(AddressPickerWindow); - #endif -} - -//----------------------------------- -CMailEditView::CMailEditView(LStream * inStream) : CEditView(inStream) -//----------------------------------- -{ - mEditorDoneLoading = false; - mHasAutoQuoted = false; - mHasInsertSignature =false; - mCursorSet = false; - mComposeSession = nil; - mInitialText = nil; - mStartQuoteOffset = 0; - mEndQuoteOffset = 0; -} - -//----------------------------------- -void CMailEditView::InstallBackgroundColor() -// Overridden to use a white background -//----------------------------------- -{ - memset(&mBackgroundColor, 0xFF, sizeof(mBackgroundColor)); // white is default -} - -void CMailEditView::GetDefaultBackgroundColor(LO_Color* outColor) const -{ - // if the editor is not done initializing then set the color to mBackgroundColor (white) - // we do this to keep the window from changing colors (potentially) - if ( !IsDoneLoading() ) - *outColor = UGraphics::MakeLOColor(mBackgroundColor); - // else - // if the editor has completed initialization then we don't want to change outColor -} - -//----------------------------------- -void CMailEditView::SetInitialText( const char *textp ) -//----------------------------------- -{ - if ( mInitialText ) - { - XP_FREE( mInitialText ); - mInitialText = nil; - } - - if ( textp ) - { - mInitialText = XP_STRDUP( textp ); - } -} - - -//----------------------------------- -void CMailEditView::InitMailCompose() -//----------------------------------- -{ - MWContext *context; - if (GetContext()) - context = *(GetContext()); - else - return; - - XP_Bool composeDirty = EDT_DirtyFlag(context); - - MSG_Pane *msgpane = MSG_FindPane( context, MSG_COMPOSITIONPANE ); - - if (!mEditorDoneLoading) - { - mEditorDoneLoading = true; - MSG_SetHTMLMarkup( msgpane, true ); - - // do InstallBackgroundColor again to set the editor background color - // we need to do this one last time to set the backend editor data to - // have the correct (white) background color - InstallBackgroundColor(); - // if mInitalText is nonNull it means that the message is a draft/Edit Message - // and there fore quoting should not be done. - if (mComposeSession->ShouldAutoQuote() && !mInitialText) - { - mHasAutoQuoted = true; - mStartQuoteOffset = EDT_GetInsertPointOffset( context ); - EDT_EndOfDocument( context, false ); - mComposeSession->QuoteMessage(); - // Then eventually CComposeSession::QuoteInHTMLMessage will be called. - } - else - { - EDT_EndOfDocument( context, false ); - mHasInsertSignature = true; - /* insert signature here!!!! and Drafts too*/ - DisplayDefaultTextBody(); - EDT_BeginOfDocument( context, false ); - //mCursorSet = true; - } - - } - else - { - - mEndQuoteOffset = EDT_GetInsertPointOffset( context ); - if ( !mHasInsertSignature ) - { - mHasInsertSignature = true; - EDT_EndOfDocument( context, false ); - - /* insert signature here!!!! and Drafts too*/ - DisplayDefaultTextBody(); - // EDT_BeginOfDocument( context, false ); - // mCursorSet = true; - } - - if ( !mCursorSet ) - { - mCursorSet = true; - if( mHasAutoQuoted ) - { - int32 eReplyOnTop = 1; - if ( PREF_NOERROR == PREF_GetIntPref("mailnews.reply_on_top", &eReplyOnTop) ) - { - switch (eReplyOnTop) - { - case 0: - EDT_SetInsertPointToOffset( context, mEndQuoteOffset, 0 ); - break; - case 1: - default: - EDT_SetInsertPointToOffset( context, mStartQuoteOffset, 0 ); - break; - case 2: - case 3: - EDT_SetInsertPointToOffset( context, mStartQuoteOffset, - mEndQuoteOffset - mStartQuoteOffset ); - break; - } - } - } - else - { - EDT_BeginOfDocument( context, false ); - mCursorSet = true; - } - } - - } - - if (!composeDirty) - EDT_SetDirtyFlag( context , false ); - -} // CMailEditView::InitMailCompose - - -// Taken from X11 -void CMailEditView::InsertMessageCompositionText(const char* text, - XP_Bool leaveCursorBeginning, XP_Bool isHTML) -{ - - Boolean noTagsP = false; - MWContext *context; - if (GetContext()) - context = *(GetContext()); - else - return; - - ED_BufferOffset ins = -1; - - if ( leaveCursorBeginning ){ - ins = EDT_GetInsertPointOffset( context ); - } - - if (isHTML) { - // - // NOTE: let's try to see if they really have any HTML tags - // in the text they've given us... [ poor man's parser ] - // - if (XP_STRCASESTR(text, "") || - XP_STRCASESTR(text, "") || - XP_STRCASESTR(text, "
")  ||
-				XP_STRCASESTR(text, "\n");
-
-			EDT_PasteQuote( context, (char *) text );
-
-			if (noTagsP)  
-				EDT_PasteQuote( context, "
\n" ); - EDT_PasteQuoteEnd( context ); - } - else { - EDT_PasteText( context, (char *) text ); - } - - if ( leaveCursorBeginning && ins != -1 ) { - EDT_SetInsertPointToOffset( context, ins, 0 ); - } -} - -void CMailEditView::DisplayDefaultTextBody() -{ - - const char *pBody = MSG_GetCompBody(mComposeSession->GetMSG_Pane()); - - if ( mInitialText && strlen(mInitialText) ) { - InsertMessageCompositionText( mInitialText, false, true); - InsertMessageCompositionText( "\n", false, true); - - MSG_SetCompBody(mComposeSession->GetMSG_Pane(), ""); - - XP_FREEIF(mInitialText); - } - else if ( pBody && strlen(pBody) ) { - XP_Bool isHTML =XP_STRCASESTR( pBody,"") ? true:false; - // To prevent quoting the SIG. Is there a more correct way to do this? - EDT_ReturnKey( *GetContext() ); - InsertMessageCompositionText( pBody, true, isHTML ); - } -} - -#pragma mark - - -//----------------------------------- -CMailComposeWindow::CMailComposeWindow(LStream* inStream) : -//----------------------------------- - CMailNewsWindow(inStream, WindowType_Compose), - mComposeSession(nil), - mAddressTableView(nil), - mProgressListener(nil), - mAttachmentList(nil), - mAttachmentView(nil), - mHTMLEditView(nil), - mPlainEditView(nil), - mInitializeState(eUninitialized), - mHeadersDirty( false ), - mOnlineLastFindCommandStatus( true ), - mDefaultWebAttachmentURL("\p"), - mCurrentSaveCommand(cmd_SaveDraft) -{ -} // CMailComposeWindow::CMailComposeWindow - -//----------------------------------- -CMailComposeWindow::~CMailComposeWindow() -//----------------------------------- -{ - StopListening(); - if (mPlainEditView && mPlainEditView->IsOnDuty() ) // for a TSM problem, we have deactivate it first - SwitchTarget(this); - - delete mComposeSession; - - if (mAttachmentView) - mAttachmentView->SetAttachList(nil); - - delete mAttachmentList; - - delete mProgressListener; - RemoveAllAttachments(); - // Kludgy, but prevents crash in LUndoer caused by view being destroyed before - // attachments. -} // CMailComposeWindow::~CMailComposeWindow - -//----------------------------------- -ResIDT CMailComposeWindow::GetStatusResID() const -//----------------------------------- -{ - return mHTMLEditView ? - CMailComposeWindow::res_ID - : CMailComposeWindow::text_res_ID; -} // CMailComposeWindow::GetStatusResID - -//----------------------------------- -void CMailComposeWindow::FinishCreateSelf() -//----------------------------------- -{ - mPlainEditView = dynamic_cast(FindPaneByID('text')); - if (mPlainEditView) - { - -// mPlainEditView->BuildTextObjects(this); // sets the super model - -// SetDefaultSubModel(mPlainEditView->GetTextModel()); - -// LTextSelection* theSelection = mPlainEditView->GetTextSelection(); -// if (theSelection) -// theSelection->SetSelectionRange(LTextEngine::sTextStart); - - mPlainEditView->SetSelection( 0, 0 ); - mPlainEditView->SetTabSelectsAll( false ); - } - else - mHTMLEditView = (CMailEditView *)FindPaneByID(CMailEditView::pane_ID); - - try { - // make the window the undoer. typing actions end up there. - LUndoer* theUndoAttachment = new LUndoer; - AddAttachment(theUndoAttachment); // attach to window - // create attachment list - mAttachmentList = new CAttachmentList; - mHaveInitializedAttachmentsFromBE = false; - } catch (...) { - } - - // link up compose window to addressing table view and vice versa - CComposeAddressTableView* tableView = dynamic_cast(FindPaneByID('Addr')); - mAddressTableView = tableView; - mAddressTableView->AddListener( this ); - - // add an attachment to the subject edit field to strip out CRs - LEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); - Assert_( subjectField ); - subjectField->AddAttachment(new CPasteSnooper(MAKE_RETURNS_SPACES)); - - -// // set subject as latent sub -// jrm 97/02/04 removed this, now done more subtly in CreateSession. -// LEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); -// if (subjectField) -// SetLatentSub(subjectField); - - UReanimator::LinkListenerToControls(this, this, COMPOSE_BUTTON_BAR_ID); - - CComposeTabSwitcher* tabSwitcher = - dynamic_cast(FindPaneByID('TbSw')); - if (tabSwitcher) - tabSwitcher->AddListener(this); - - USecurityIconHelpers::AddListenerToSmallButton( - this /*LWindow**/, - this /*LListener**/); - - LGAIconSuiteControl* offlineButton - = dynamic_cast(FindPaneByID(kOfflineButtonPaneID)); - if (offlineButton) - offlineButton->AddListener(CFrontApp::GetApplication()); - -#if UPDATE_WINDOW_TITLE_ON_IDLE - StartIdling(); -#endif - CSaveWindowStatus::FinishCreateWindow(); - // Build the priority Menu - LMenu* priorityMenu = new LMenu(10620,"\pPriority"); - for( MSG_PRIORITY priorityToInsert = MSG_LowestPriority; priorityToInsert <= MSG_HighestPriority; priorityToInsert=MSG_PRIORITY(priorityToInsert+1) ) - { - char priorityString[255]; - MSG_GetPriorityName ( priorityToInsert, priorityString, sizeof( priorityString ) ); - priorityMenu->InsertCommand(CStr255(priorityString ),0, Int16(priorityToInsert)-2 ); - } - CPatternButtonPopup* button = dynamic_cast(FindPaneByID('Prio')); - if( button ) - button->AdoptMenu( priorityMenu ); - - SetDefaultWebAttachmentURL(); - -} // CMailComposeWindow::FinishCreateSelf - -//----------------------------------- -void CMailComposeWindow::SetDefaultWebAttachmentURL (void) -//----------------------------------- -{ - CWindowIterator lookForIt(WindowType_Any); - CMediatedWindow *parentWindow; - do { - lookForIt.Next(parentWindow); // skip over invisible progress dialog and compose window itself - } while ( - parentWindow && - (parentWindow->GetWindowType() == WindowType_Progress) || - (parentWindow->GetWindowType() == WindowType_Compose)); - - cstring defaultURL = "\p"; - - if (parentWindow) { - switch (parentWindow->GetWindowType()) { - case WindowType_MailThread: - { - CThreadWindow *threadParent = dynamic_cast(parentWindow); - if (threadParent) - defaultURL = threadParent->GetCurrentURL(); - } - case WindowType_Message: - { - CMessageWindow *messageParent = dynamic_cast(parentWindow); - if (messageParent) - defaultURL = messageParent->GetCurrentURL(); - } - case WindowType_Browser: - { - CBrowserWindow *browserParent = dynamic_cast(parentWindow); - if (browserParent) - defaultURL = browserParent->GetWindowContext()->GetCurrentURL(); - } - } - } - mDefaultWebAttachmentURL = (char *)defaultURL; -} - -//----------------------------------- -MSG_Pane* CMailComposeWindow::CreateSession( - MWContext* old_context, - MSG_CompositionFields* inCompositionFields, - const char* initialText, - Boolean inOpeningDraft) -//----------------------------------- -{ - MSG_Pane* result = nil; - try { - mComposeSession = new CComposeSession(inOpeningDraft); - mComposeSession->AddListener(this); - mProgressListener = new CProgressListener(this, mComposeSession); - - result = mComposeSession->CreateBackendData(old_context, inCompositionFields); - if (result) - { - - // now pull data out from backend - // mHTMLEditView will be the flag if we are doing HTML mail or plain text - // if we have an editView we have an HTML mail window - // if we have an editor window, we need to init/load a blank page - // we do this after obtaining the subject and addressees so those - // fields are properly updated - SetSensibleTarget(); - if ( !mHTMLEditView ) - { - //----------------------------------- - // JRM: NOTE THE ORDERING. EACH ONE OF THESE CALLS WILL SET ITSELF AS - // THE TARGET IF IT IS EMPTY. SO THE ORDERING SHOULD BE MESSAGE, SUBJECT, - // ADDRESSEES. - //----------------------------------- - // check to see if we need to quote message at startup - mComposeSession->CheckForAutoQuote(); - const char* body =nil; - body = initialText? initialText:MSG_GetCompBody(mComposeSession->GetMSG_Pane()); - InsertMessageCompositionText( body, true ); - } - else - { - mHTMLEditView->SetInitialText(initialText); - // SwitchTarget(mHTMLEditView); - } - - // get subject - GetSubjectFromBackend(); - // get addresses - GetAllCompHeaders(); - - // Get priority - GetPriorityFromBackend(); - // Set up security button - USecurityIconHelpers::UpdateComposeButton( this ); - - // set fe data - mComposeSession->SetCompositionPaneFEData(this); - // make sure there is at least an empty addressee - EnsureAtLeastOneAddressee(); - - // we initialize the editor which will take care of calling the necessary - // functions for quoting, signatures, etc. (once the editor is done loading) - if ( mHTMLEditView ) - this->InitializeHTMLEditor( mHTMLEditView ); - // Set the default encodings - SetDefaultCSID( DefaultCSIDForNewWindow() ); - } - } catch (...) { - // what do we do if we can't create compose session or backend data? - if (mComposeSession) - mComposeSession->Stop(); - } - - // now that everything is set up, show the window - Show(); - - return result; -} // CMailComposeWindow::CreateSession - -//----------------------------------- -void CMailComposeWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//----------------------------------- -{ - switch(inCommand) - { - case cmd_Toggle_Paragraph_Toolbar: - if (mHTMLEditView != nil) { - outEnabled = true; - outUsesMark = false; - if (mToolbarShown[CMailComposeWindow::FORMATTING_TOOLBAR]) - ::GetIndString(outName, CEditView::STRPOUND_EDITOR_MENUS, - CEditView::EDITOR_MENU_HIDE_FORMAT_TOOLBAR); - else - ::GetIndString(outName, CEditView::STRPOUND_EDITOR_MENUS, - CEditView:: EDITOR_MENU_SHOW_FORMAT_TOOLBAR); - } else { - outEnabled = false; - outUsesMark = false; - } - break; - case cmd_ToggleToolbar: - outEnabled = true; - outUsesMark = false; - if (mToolbarShown[CMailComposeWindow::MESSAGE_TOOLBAR]) - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, HIDE_MESSAGE_TOOLBAR_STRING); - else - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, SHOW_MESSAGE_TOOLBAR_STRING); - break; - case cmd_SendMessage: - case cmd_SendMessageLater: - outEnabled = ( - (!mHTMLEditView || mHTMLEditView->IsDoneLoading()) // HTML edit case - && !mComposeSession->GetDeliveryInProgress() - ); - outUsesMark = false; - if ( mOnlineLastFindCommandStatus != UOffline::AreCurrentlyOnline( ) ) - UpdateSendButton(); - break; - case cmd_Save: - if (mCurrentSaveCommand == cmd_SaveDraft) - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, - SAVE_DRAFT_STRING); - else - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, - SAVE_TEMPLATE_STRING); - // and fall through - case cmd_SaveDraft: - case cmd_SaveTemplate: - case cmd_QuoteMessage: - case cmd_Attach: - case msg_AttachWeb: - case msg_AttachFile: - case cmd_SecurityInfo: - case cmd_AddressBookWindow: - outEnabled = ( - (!mHTMLEditView || mHTMLEditView->IsDoneLoading()) // HTML edit case - && !mComposeSession->GetDeliveryInProgress() - ); - outUsesMark = false; - break; - case cmd_AttachMyAddressBookCard: - outEnabled = ( - (!mHTMLEditView || mHTMLEditView->IsDoneLoading()) // HTML edit case - && !mComposeSession->GetDeliveryInProgress() ); - outUsesMark = true; - outMark = mComposeSession->GetCompBoolHeader( MSG_ATTACH_VCARD_BOOL_HEADER_MASK) - ? checkMark: noMark; - break; - case cmd_PasteQuote: - Int32 offset; - outEnabled = ( - (!mHTMLEditView || mHTMLEditView->IsDoneLoading()) // HTML edit case - && !mComposeSession->GetDeliveryInProgress() - && ::GetScrap(nil, 'TEXT', &offset) > 0); - break; - case cmd_SaveAs: - if( !mHTMLEditView ) - outEnabled = true; - else - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - default: - if(inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) - { - outEnabled = true; - outUsesMark = true; - - int16 csid = CPrefs::CmdNumToDocCsid( inCommand ); - outMark = (csid == mComposeSession->GetDefaultCSID()) ? checkMark : ' '; - } else { - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } - break; - } -} // CMailComposeWindow::FindCommandStatus - -//----------------------------------- -void CMailComposeWindow::HandleUpdateCompToolbar() -// called from FE_UpdateCompToolbar. -//----------------------------------- -{ - if (mInitializeState == eComposeSessionIsSet) - { - CMailCompositionContext* context = mComposeSession->GetCompositionContext(); - if (context) - { - URL_Struct* url = NET_CreateURLStruct( "about:editfilenew", NET_NORMAL_RELOAD ); - mInitializeState = eAboutURLLoading; - context->SwitchLoadURL( url, FO_CACHE_AND_PRESENT ); - } - } -} // CMailComposeWindow::HandleUpdateCompToolbar - -//----------------------------------- -Boolean CMailComposeWindow::HandleTabKey(const EventRecord &inKeyEvent) -//----------------------------------- -{ - Boolean keyHandled = true; - LCommander *body = NULL; - - if ( mHTMLEditView ) - body = dynamic_cast( mHTMLEditView ); - else if ( mPlainEditView ) - body = dynamic_cast( mPlainEditView ); - - Assert_( body != NULL ); - - Boolean tabBack = (inKeyEvent.modifiers & shiftKey) != 0; - - LEditField *subjectBar = dynamic_cast( FindPaneByID('Subj') ); - - Assert_( subjectBar != NULL ); - Assert_( mAddressTableView != NULL ); - - LCommander *curTarget = NULL, *tempTarget = nil; - - // we have to handle the following things here: - // 1. Collapsed drag bars - // 2. Reordering of drag bars - Boolean addressVisible = true, subjectVisible = true; - - // find out ordering in window of subject bar and address panel - SPoint32 subjectLocation, addressLocation; - - subjectBar->GetFrameLocation( subjectLocation ); - mAddressTableView->GetFrameLocation( addressLocation ); - - Int32 curItem = 1; - Int32 curTargetIndex = 1; //assume first item has focus for now - Int32 newTargetIndex, numTargets = 0; - LArray *targetList = new LArray(); - - if (addressVisible ) - { - tempTarget = dynamic_cast( mAddressTableView ); - targetList->InsertItemsAt(1, LArray::index_Last, &tempTarget, sizeof( LCommander *) ); - if (tempTarget->IsOnDuty()) - curTarget = tempTarget; - } - - if ( subjectVisible ) - { - tempTarget = dynamic_cast( subjectBar ); - targetList->InsertItemsAt(1, LArray::index_Last, &tempTarget, sizeof( LCommander *) ); - if (tempTarget->IsOnDuty()) - curTarget = tempTarget; - } - - if (addressVisible && subjectVisible) - { - if ( addressLocation.v >= subjectLocation.v ) // address below subject - targetList->SwapItems(1, 2); - } - - targetList->InsertItemsAt(1, LArray::index_Last, &body, sizeof( LCommander *) ); - if (body->IsOnDuty()) - curTarget = body; - - Assert_(curTarget != NULL); // something should always have focus. - - // now let's work out who is on duty, and get forward and backward - curTargetIndex = targetList->FetchIndexOf(&curTarget, sizeof(LCommander *)); - Assert_( curTargetIndex != LArray::index_Bad); - - // not so stupid as it seems, when we have collapsed bars - numTargets = targetList->GetCount(); - - // choose which one to go to - if ( tabBack ) { - newTargetIndex = curTargetIndex - 1; - if (newTargetIndex < 1) //arrays are 1-based - newTargetIndex += numTargets; - } else { - newTargetIndex = curTargetIndex + 1; - if (newTargetIndex > numTargets) //arrays are 1-based - newTargetIndex -= numTargets; - } - - LCommander *newTarget = NULL; - - if ( targetList->FetchItemAt( newTargetIndex, &newTarget) && (newTarget != curTarget) ) - { - if ( newTarget->ProcessCommand(msg_TabSelect) ) - { - // ProcessCommand sets the correct target for the mAddressTAbleView so Don't do it here - if( newTarget != mAddressTableView ) - SwitchTarget( newTarget ); - } - else - SwitchTarget( body ); - } - - delete targetList; - - return keyHandled; // always true for now -} - -//----------------------------------- -Boolean CMailComposeWindow::HandleKeyPress(const EventRecord &inKeyEvent) -//----------------------------------- -{ - Boolean keyHandled = true; - Char16 theKey = inKeyEvent.message & charCodeMask; - - if ( theKey == char_Tab ) - keyHandled = HandleTabKey( inKeyEvent ); - else - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - - return keyHandled; -} - -//----------------------------------- -void CMailComposeWindow::InitializeHTMLEditor( CMailEditView* inEditorView ) -//----------------------------------- -{ - // initialize editor by loading url: "about:editfilenew" - if ( inEditorView ) - { - - CMailCompositionContext* context = mComposeSession->GetCompositionContext(); - inEditorView->SetContext( context ); - - // we need to set the compose session for auto-quoting (later) - inEditorView->SetComposeSession( mComposeSession ); - mInitializeState = eComposeSessionIsSet; - - if (!XP_IsContextBusy(*context)) - { - // we won't get an FE_UpdateCompToolbar call, so do it ourselves! - if (mInitializeState == eComposeSessionIsSet) - { - HandleUpdateCompToolbar(); - } - } - } - -} - -//----------------------------------- -void CMailComposeWindow::ListenToMessage(MessageT inMessage, void* ioParam) -//----------------------------------- -{ - CAttachmentView* attachView; - MSG_HTMLComposeAction action; - switch (inMessage) - { - // cmd's sent from toolbar buttons - case cmd_SendMessage: - SetSensibleTarget(); - XP_Bool sendNow; - PREF_GetBoolPref("network.online" , &sendNow); - SendMessage( sendNow ); - break; - case cmd_SendMessageLater: - SetSensibleTarget(); - SendMessage(false); - break; - case cmd_Save: - // This does a "save as template/draft according to last command. - inMessage = mCurrentSaveCommand; - // FALL THROUGH - case cmd_SaveDraft: - case cmd_SaveTemplate: - mCurrentSaveCommand = inMessage; - mComposeSession->SetMessage(inMessage); //needed for a relatively clean Drafts imp. - SetSensibleTarget(); - SaveDraftOrTemplate(inMessage); - break; - case cmd_QuoteMessage: - SetSensibleTarget(); - mComposeSession->QuoteMessage(); - break; - case cmd_Stop: - SetSensibleTarget(); - mComposeSession->Stop(); - // EnableButtons(); - break; - // messages from CComposeSession - case CComposeSession::msg_InsertQuoteText: - //SetSensibleTarget(); - InsertMessageCompositionText(reinterpret_cast(ioParam)); - break; - case CComposeSession::msg_AutoQuoteDone: - int32 eReplyOnTop = 1; - -// LTextEngine* theTextEngine = mPlainEditView->GetTextEngine(); -// LTextSelection* theSelection = mPlainEditView->GetTextSelection(); -// TextRangeT theBeforeRange = theSelection->GetSelectionRange(); - - SInt32 selStart = 0; - SInt32 selEnd = 0; - - mPlainEditView->GetSelection( &selStart, &selEnd ); - - if ( PREF_NOERROR ==PREF_GetIntPref("mailnews.reply_on_top", &eReplyOnTop) ) - { - switch (eReplyOnTop) - { - case 0: - // Cursor is in the right spot - break; - case 1: - default: - -// theBeforeRange.SetStart( 0 ); -// theSelection->SetSelectionRange(theBeforeRange); - - selEnd = selEnd - selStart; - selStart = 0; - - mPlainEditView->SetSelection( selStart, selEnd ); - - break; - case 2: - case 3: - -// long end = theBeforeRange.Start(); -// theBeforeRange.SetStart( 0 ); -// theBeforeRange.SetEnd( end ); -// theSelection->SetSelectionRange(theBeforeRange); - - selEnd = selStart; - selStart = 0; - - mPlainEditView->SetSelection( selStart, selEnd ); - - break; - } - } - break; - - case cmd_CheckSpelling: - if( mHTMLEditView ) - mHTMLEditView->ObeyCommand( inMessage, ioParam ); - else - { - if( mPlainEditView ) - mPlainEditView->ObeyCommand( inMessage, ioParam ); - } - break; - // message from CComposeTabSwitcher - // This is the only semi-clean way that I know of to synchronize - // the attachment list with the CAttachmentView. - case msg_ActivatingAttachTab: - SetSensibleTarget(); - attachView = reinterpret_cast(ioParam); - if (mAttachmentList && !attachView->GetAttachList()) - { - GetAttachmentsFromBackend(); - mHaveInitializedAttachmentsFromBE = true; - attachView->SetAttachList(mAttachmentList); - mAttachmentView = attachView; - mAttachmentView->AddListener( this ); - } - attachView->AddDropAreaToWindow(this); - break; - case msg_DeactivatingAttachTab: - SetSensibleTarget(); - attachView = reinterpret_cast(ioParam); - attachView->RemoveDropAreaFromWindow(this); - break; - case msg_ActivatingAddressTab: - SetSensibleTarget(); - mAddressTableView->AddDropAreaToWindow(this); - break; - case msg_DeactivatingAddressTab: - SetSensibleTarget(); - mAddressTableView->RemoveDropAreaFromWindow(this); - break; - case msg_ActivatingOptionTab: - SetSensibleTarget(); - CMailOptionTabContainer* optionView = reinterpret_cast(ioParam); - - LGACheckbox *control=dynamic_cast (optionView-> FindPaneByID( 'OtRe' )); - Assert_(control); - control->SetValue( mComposeSession->GetCompBoolHeader( MSG_RETURN_RECEIPT_BOOL_HEADER_MASK) ); - - HG43287 - - LGAPopup *popup = dynamic_cast( optionView->FindPaneByID('OtHa') ); - Assert_( popup != nil ); - if( mHTMLEditView ) - { - action = MSG_GetHTMLAction( mComposeSession->GetMSG_Pane() ); - Int32 popupValue = 0; - switch( action) - { - case MSG_HTMLAskUser: - popupValue = 1; - break; - case MSG_HTMLConvertToPlaintext: - popupValue = 2; - break; - case MSG_HTMLSendAsHTML: - popupValue = 3; - break; - case MSG_HTMLUseMultipartAlternative: - popupValue = 4; - break; - } - popup->SetValue( popupValue ); - } - else - popup->Disable(); // Not used for plain text editing - break; - case cmd_SecurityInfo: - SetSensibleTarget(); - // Update Header fields - try - { - SyncAddressLists(); - SECNAV_SecurityAdvisor((MWContext*)*(mComposeSession->GetCompositionContext()), - (URL_Struct_*)nil); - } catch (...) { - // couldn't allocate memory for buffer - } - break; - case cmd_AddressBookWindow: - SetSensibleTarget(); - #ifdef MOZ_NEWADDR - CAddressPickerWindow::DoPickerDialog( mAddressTableView ); - #else - CAddressBookManager::ShowAddressBookWindow( ); - #endif - break; - // Option Tab - case msg_ReturnRecipt: - mComposeSession->SetCompBoolHeader( MSG_RETURN_RECEIPT_BOOL_HEADER_MASK, *(Int32*)ioParam); - break; - case msg_Garbled: - HG43288 - break; - case msg_Signed: - mComposeSession->SetCompBoolHeader( MSG_SIGNED_BOOL_HEADER_MASK, *(Int32*)ioParam); - USecurityIconHelpers::UpdateComposeButton( this); - break; - case msg_UUEncode: - mComposeSession->SetCompBoolHeader( MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, *(Int32*)ioParam); - break; - #if 0 - case msg_8BitEncoding: - MIME_ConformToStandard( value ? 0 : 1 ); - break; - #endif //0 - case msg_HTMLAction: - switch( *(Int32*)ioParam ) - { - case 1: - action = MSG_HTMLAskUser; - break; - case 2: - action = MSG_HTMLConvertToPlaintext; - break; - case 3: - action = MSG_HTMLSendAsHTML; - break; - case 4: - action = MSG_HTMLUseMultipartAlternative; - break; - } - MSG_SetHTMLAction( mComposeSession->GetMSG_Pane(), action ); - break; - // Attachments - case msg_AttachFile: - case msg_AttachWeb: - // Create an attachment view by switching to it and then switch back - CComposeTabSwitcher* tabSwitcher = - dynamic_cast(FindPaneByID('TbSw')); - tabSwitcher->ManuallySwitchToTab( 2 ); - mAttachmentView->ListenToMessage( inMessage, (void *)((unsigned char *)mDefaultWebAttachmentURL)); - break; - - case cmd_AttachMyAddressBookCard: - mComposeSession->SetCompBoolHeader(MSG_ATTACH_VCARD_BOOL_HEADER_MASK , - !mComposeSession->GetCompBoolHeader( MSG_ATTACH_VCARD_BOOL_HEADER_MASK)); - break; - // mDirtyHeaders - case msg_AddressChanged: - case CAttachmentView::msg_AttachmentsAdded: - case CAttachmentView::msg_AttachmentsRemoved: - mHeadersDirty = true; - break; - } -} - -void CMailComposeWindow::UpdateSendButton() -{ - mOnlineLastFindCommandStatus = UOffline::AreCurrentlyOnline( ); - - CPatternButton *sendNowButton = dynamic_cast(FindPaneByID(cSendButtonPaneID)); - const ResIDT kSendNowGraphicID = 15319, kSendLaterGraphicID = 15323; - sendNowButton->SetGraphicID( - mOnlineLastFindCommandStatus - ? kSendNowGraphicID - : kSendLaterGraphicID); - sendNowButton->Refresh(); -} - -Boolean CMailComposeWindow::ObeyCommand(CommandT inCommand, void *ioParam) -{ - Boolean cmdHandled = true; - - switch (inCommand) - { - case cmd_ToggleToolbar: - ToggleDragBar(cMessageToolbar, CMailNewsWindow::MESSAGE_TOOLBAR); - cmdHandled = true; - break; - - case cmd_Toggle_Paragraph_Toolbar: - ToggleDragBar(cFormattingToolbar, CMailComposeWindow::FORMATTING_TOOLBAR); - cmdHandled = true; - break; - - case cmd_PasteQuote: - SetSensibleTarget(); - int32 textLen; - textLen = LClipboard::GetClipboard()->GetData( 'TEXT', nil ); - if (textLen > 0) - { - Handle textHandle = ::NewHandle(textLen + 1); - if (textHandle) - { - LClipboard::GetClipboard()->GetData( 'TEXT', textHandle ); - ::HLock(textHandle); - (*textHandle)[textLen] = '\0'; - if( mHTMLEditView ) - MSG_PastePlaintextQuotation(mComposeSession->GetMSG_Pane(), *textHandle); - else - { //plain text case - char *quotedText = MSG_ConvertToQuotation (*textHandle); - if( quotedText ) - { - InsertMessageCompositionText( quotedText ); - XP_FREE( quotedText ); - } - } - ::DisposeHandle(textHandle); - } - } - break; - case cmd_SaveAs: - if( mHTMLEditView ) - cmdHandled =false; - else - { - StandardFileReply reply; - short format; - CStr31 defaultFileName; - GetDescriptor( defaultFileName ); - UStdDialogs::AskSaveAsSource( reply, defaultFileName , format ); - if ( reply.sfGood ) - mPlainEditView->Save( reply.sfFile ); - } - break; - // Commands that have button bar equivalents - case cmd_SendMessage: - case cmd_SendMessageLater: - case cmd_QuoteMessage: - case cmd_SaveDraft: - case cmd_SaveTemplate: - case msg_AttachWeb: - case msg_AttachFile: - case cmd_AttachMyAddressBookCard: - ListenToMessage( inCommand, ioParam); - break; - default: - if(inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) - { - SetDefaultCSID(CPrefs::CmdNumToDocCsid(inCommand)); - cmdHandled = true; - } else { - cmdHandled = Inherited::ObeyCommand(inCommand, ioParam); - } - break; - } - return cmdHandled; -} -void CMailComposeWindow::SetDefaultCSID(Int16 defaultcsid) -{ - Assert_(mComposeSession); - if(mComposeSession) - { - - int16 wincsid = INTL_DocToWinCharSetID(defaultcsid); - ResIDT textTraitID = CPrefs::GetTextFieldTextResIDs(wincsid); - - // Set the HTML editor, if present - if (mHTMLEditView) - { - if( !mHTMLEditView->SetDefaultCSID(defaultcsid) ) - return; - } - // Set the plain text editor, if present - if ( mPlainEditView ) { - mPlainEditView->SetInitialTraits(textTraitID); - mPlainEditView->ResetModCount(); // fix for bug # 104805 ask save on close - } - - // Set The Subject Font - if(LEditField* subjectField = dynamic_cast(FindPaneByID('Subj'))) - { - subjectField->SetTextTraitsID(textTraitID); - subjectField->Refresh(); - } - - // Set The Address Font - if( mAddressTableView ) - mAddressTableView->SetTextTraits( textTraitID ); - - // Set the Session - mComposeSession->SetDefaultCSID(defaultcsid); - -#if 0 - // To Work Around Our TSMTE problem - Int32 dummyVer; - if( (defaultcsid & MULTIBYTE ) && - (noErr == ::Gestalt(gestaltTSMTEAttr, &dummyVer)) && - ((dummyVer & (1 << gestaltTSMTEPresent) ) != 0) - ) { - this->SetSensibleTarget(); - } -#endif //0 - } -} - - -void CMailComposeWindow::SyncAddressLists() -{ - - // Clear the comp headers in case entries were deleted from the - // address view - // Save & Restore the (Reply To) and (Followup To) fields - char* replyto = nil; - replyto = XP_STRDUP( - mComposeSession->GetMessageHeaderData( MSG_REPLY_TO_HEADER_MASK ) ); - FailNIL_(replyto); - char* followupto = nil; - followupto = XP_STRDUP( - mComposeSession->GetMessageHeaderData( MSG_FOLLOWUP_TO_HEADER_MASK ) ); - FailNIL_(followupto); - MSG_ClearComposeHeaders ( mComposeSession->GetMSG_Pane() ); - MSG_SetCompHeader( mComposeSession->GetMSG_Pane(), - MSG_REPLY_TO_HEADER_MASK, replyto ); - MSG_SetCompHeader( mComposeSession->GetMSG_Pane(), - MSG_FOLLOWUP_TO_HEADER_MASK, followupto ); - XP_FREE( replyto ); - XP_FREE( followupto ); - - // set composition headers - for (int type = eToType; type <= eFollowupType; type++) - SetCompHeader((EAddressType)type); -} - -Boolean CMailComposeWindow::PrepareMessage( Boolean isDraft) -{ - // disable all toolbar buttons except stop - //DisableAllButtonsExceptStop(); - if (mComposeSession) - { - SyncAddressLists(); - // set subject - char* subject = GetSubject(); - // if (**teHandle).teLength == 0, we should probably ask the user - // if they want to enter a subject right about here - if (subject && XP_STRLEN( subject )) - { - // Copy subject out of TEHandle in edit field and pass it to - // msglib. Don't forget to dispose of buffer. - MSG_SetCompHeader(mComposeSession->GetMSG_Pane(),MSG_SUBJECT_HEADER_MASK, subject); - - XP_FREE( subject ); - } -#if 1 // This is a temporary hack till we really fix bug #42878. - else if( !isDraft ) - { - LEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); // use CTSMEditField to support Asian Inline input - SysBeep(1); - SwitchTarget(subjectField); - CStr255 errorSubject(XP_GetString(MK_MIME_NO_SUBJECT)); - subjectField->SetDescriptor(errorSubject); - subjectField->SelectAll(); - return false; - } -#endif - // set priority - // pkc -- 10/8/96 priority isn't ready in backend - LControl* priorityMenu = dynamic_cast(FindPaneByID('Prio')); - Int32 priority = priorityMenu->GetValue(); - mComposeSession->SetPriority(UComposeUtilities::GetMsgPriorityFromMenuItem(priority)); - - // set body - if ( mPlainEditView ) - { -// LTextEngine* textEngine = dynamic_cast(mPlainEditView->GetTextEngine()); - - Handle msgBody = mPlainEditView->GetTextHandle(); - if (msgBody) - { - try { - LHandleStream handleStream; - // preallocate handle - handleStream.SetLength(1024); - -// TextRangeT textRange = textEngine->GetTotalRange(); - UInt32 textLength = mPlainEditView->GetTextLength(); - - UComposeUtilities::WordWrap(msgBody, textLength, handleStream); - handleStream << (unsigned char) '\0'; - mComposeSession->SetMessageBody(handleStream); - } catch (...) { - // couldn't allocate memory for LHandleStream - } - } - } - else - { - // send HTML text - // all of the HTML is gotten from the MWContext - mComposeSession->SetHTMLMessageBody(); - } - } - if( !mHaveInitializedAttachmentsFromBE ) - { - GetAttachmentsFromBackend(); - mHaveInitializedAttachmentsFromBE = true; - } - - return true; -} // CMailComposeWindow::PrepareMessage - -extern "C" void MSG_ResetUUEncode(MSG_Pane *pane); - -void CMailComposeWindow::SaveDraftOrTemplate(CommandT inCommand, Boolean inCloseWindow) -{ - mComposeSession->SetMessage( inCommand ); - MSG_AttachmentData* attachList = nil; - try { - - // ### mwelch Reset the uuencode UI state so the - // dialog pops up once per send attempt. - MSG_ResetUUEncode(mComposeSession->GetMSG_Pane()); - - PrepareMessage( true ); - // set attachments - attachList = mAttachmentList->NewXPAttachmentList(); - if (mComposeSession->NeedToSyncAttachmentList(attachList)) - { // send attachments - // there's no need to call mComposeSession->SaveDraftOrTemplate() - // because the compose session will catch the FE_AllConnectionsComplete - // callback when loading the attachments and will SaveDraft then - mComposeSession->SetAttachmentList(attachList); - mComposeSession->SetCloseWindow( inCloseWindow ); - XP_FREE(attachList); - } - else - { - // just save the Draft - mComposeSession->SaveDraftOrTemplate(inCommand, inCloseWindow); - } - } catch (...) { - XP_FREEIF(attachList); - // most likely, couldn't allocate memory for attachList - } - mHeadersDirty = false; - if( mPlainEditView ) - { - -// LTextEngine* theTextEngine = mPlainEditView->GetTextEngine(); -// theTextEngine->SetTextChanged( false ); - - mPlainEditView->ResetModCount(); - - } -} - -void CMailComposeWindow::SendMessage(Boolean inSendNow) -{ - // See if we have to spell check - XP_Bool needToSpellCheck = false; - PREF_GetBoolPref("mail.SpellCheckBeforeSend", &needToSpellCheck); - if ( needToSpellCheck ) - { - ListenToMessage( cmd_CheckSpelling, NULL ); - ObeyCommand( cmd_CheckSpelling, NULL ); - } - - MSG_AttachmentData* attachList = nil; - //Boolean needToSave = NeedToSave(); - if( PrepareMessage( false ) ) - { - // set attachments - try { - // ### mwelch. Reset the uuencode UI state so the - // dialog pops up once per send attempt. - MSG_ResetUUEncode(mComposeSession->GetMSG_Pane()); - - attachList = mAttachmentList->NewXPAttachmentList(); - if (mComposeSession->NeedToSyncAttachmentList(attachList)) - { // send attachments - // there's no need to call mComposeSession->SendMessage() - // because the compose session will catch the FE_AllConnectionsComplete - // callback when loading the attachments and will call SendMessage then - mComposeSession->SetAttachmentList(attachList); - XP_FREE(attachList); - mComposeSession->SetSendNow(inSendNow); - } - else - { - // just send message - mComposeSession->SendMessage(inSendNow); - } - } catch (...) { - XP_FREEIF(attachList); - // ### mwelch. We can get exceptions by running out of memory - // or if the user hit "Cancel" to a uuencode confirmation - // dialog. (Yes, the back end throws an exception here.) - // See MSG_DeliverMimeAttachment::SnarfAttachment in - // ns/lib/libmsg/msgsend.cpp. - } - } - //mHeadersDirty = needToSave; // if send fails, dirty flag is still preserved -} - -void CMailComposeWindow::SetCompHeader(EAddressType inAddressType) -{ - if (mComposeSession && mAddressTableView) - { - try { - LHandleStream stream; - // preallocate handle - stream.SetLength(512); - stream.SetMarker(0, streamFrom_Start); - mAddressTableView->CreateCompHeader(inAddressType, stream); - if (stream.GetMarker() > 0) - mComposeSession->SetMessageHeaderData( - UComposeUtilities::GetMsgHeaderMaskFromAddressType(inAddressType), - stream); - } catch (...) { - } - } -} - - -//----------------------------------- -void CMailComposeWindow::GetCompHeader(EAddressType inAddressType) -//----------------------------------- -{ - Assert_(mAddressTableView && mComposeSession); - char* scanner = (char *)mComposeSession->GetMessageHeaderData( - UComposeUtilities::GetMsgHeaderMaskFromAddressType(inAddressType)); - MSG_HeaderEntry *returnList=nil; - Int32 numberItems= MSG_ExplodeHeaderField( inAddressType, scanner, &returnList ); - if ( numberItems!=-1 ) - { - for(Int32 currentItem=0; currentItemInsertNewRow(EAddressType(returnList[currentItem].header_type), - returnList[currentItem].header_value ); - XP_FREE( returnList[currentItem].header_value ); - } - XP_FREE ( returnList ); - } - - #if 0 // MSGComh. has a better function - if (scanner) - { - // now parse comma delimited string - char *addr = scanner; - while (*scanner != nil) - { - // find end of address - while (*scanner != nil && *scanner != ',') - ++scanner; - try { - char* addrStr = new char[scanner - addr + 1]; - ::BlockMoveData(addr, addrStr, scanner - addr); - addrStr[scanner - addr] = '\0'; - mAddressTableView->InsertNewRow(inAddressType, addrStr); - delete [] addrStr; - } catch (...) { - } - while (*scanner != nil && (*scanner == ',' || *scanner == ' ' || *scanner == '\t')) - ++scanner; - addr = scanner; - } - } - #endif //0 -} // CMailComposeWindow::GetCompHeader - -//----------------------------------- -Int16 CMailComposeWindow::DefaultCSIDForNewWindow() -//----------------------------------- -{ - if(mComposeSession) - return mComposeSession->GetDefaultCSID(); // Delgate to mComposeSession - else - return 0; -} // CMailComposeWindow::DefaultCSIDForNewWindow() - -//----------------------------------- -void CMailComposeWindow::GetAllCompHeaders() -//----------------------------------- -{ - for (int i = eToType; i <= eFollowupType; i++) - if (i != eReplyType) - GetCompHeader((EAddressType)i); -} - -//----------------------------------- -char* CMailComposeWindow::GetSubject() -// Caller responsible for freeing return value -//----------------------------------- -{ - char* result = nil; - CLargeEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); // use CTSMEditField to support Asian Inline input - if (subjectField) - result = subjectField->GetLongDescriptor(); - Assert_(result); - return result; -} // CMailComposeWindow::GetSubjectTEHandle - -//----------------------------------- -void CMailComposeWindow::GetSubjectFromBackend() -//----------------------------------- -{ - Assert_(mComposeSession); - const char* subject = mComposeSession->GetSubject(); - - // We need to set up the TextTrait of Subject according to the csid. - CLargeEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); - - if (subject && *subject) - subjectField->SetLongDescriptor( subject ); - else - { - SwitchTarget( subjectField ); - } -} // CMailComposeWindow::GetSubjectFromBackend - - -void CMailComposeWindow::GetPriorityFromBackend() -{ - LControl *priority = dynamic_cast( FindPaneByID('Prio') ); - if( priority ) - { - // Need to do this to ensure that we refresh the menu with new value - priority->SetValue( 1 ); - MSG_PRIORITY backendPriority = mComposeSession->GetPriority(); - if( backendPriority == MSG_NoPriority ) - backendPriority = MSG_NormalPriority; - // MSG_NoPriority isn't a popup item so all numbers off by 1 - Int32 value = Int32( backendPriority) - Int32( MSG_NoPriority ); - priority->SetValue( value ); - } -} -//----------------------------------- -void CMailComposeWindow::GetAttachmentsFromBackend() -//----------------------------------- -{ - Assert_(mComposeSession); - const struct MSG_AttachmentData* attachData = - mComposeSession->GetAttachmentData(); - if (attachData) - { - Assert_(mAttachmentList); - mAttachmentList->InitializeFromXPAttachmentList(attachData); - } -} - -//----------------------------------- -void CMailComposeWindow::EnsureAtLeastOneAddressee() -//----------------------------------- -{ - Assert_(mAddressTableView); - TableIndexT numRows; - mAddressTableView->GetNumRows(numRows); - Boolean insertNewRow = true; - while ( numRows ) - { - EAddressType addressType = mAddressTableView->GetRowAddressType( numRows ); - if( addressType != eBccType) - { - insertNewRow = false; - break; - } - numRows--; - } - - if ( insertNewRow ) - { - mAddressTableView->InsertNewRow( true, true); - } - -} - -//----------------------------------- -void CMailComposeWindow::SetSensibleTarget() -//----------------------------------- -{ - - if (mPlainEditView) - { - SwitchTarget(mPlainEditView); - } - if (mHTMLEditView) - SwitchTarget(mHTMLEditView); -} - -//----------------------------------- -ExceptionCode CMailComposeWindow::InsertMessageCompositionText(const char* text, Boolean leaveCursorinFront) -// this code taken straight from mailmac.cp -// Actually seems to be called only for plain-text quoting. -//----------------------------------- -{ -#define SUCCESS 0 - ExceptionCode err = SUCCESS; -// if (text == nil) // Don't do this. -// Even if text is nil, this function must set the target to the appropriate text view. -// return err; - - StWatchCursor watchCursor; - - try // TextReplaceByPtr can throw - { - - Assert_(mPlainEditView); // seems to be called only for simple text. - if (mPlainEditView) - { - // SwitchTarget(mPlainEditView); - if (!text || !*text) - return SUCCESS; - - Boolean textChanged = (mPlainEditView->GetModCount() > 0); - - - // - // Blast the text into the text field. - // - // We must first ensure that the field is not marked - // read-only (which is likely since we've probably been - // asked by XP to disable toolbar buttons, at which - // point we also disable the body field). - // - // Save the field's attributes, mark it writable, - // blast the text, restore the attributes. - // - - Boolean isReadOnly = mPlainEditView->IsReadOnly(); - - if ( isReadOnly ) - mPlainEditView->SetReadOnly( false ); - - SInt32 oldSelStart = 0; - SInt32 oldSelEnd = 0; - - mPlainEditView->GetSelection( &oldSelStart, &oldSelEnd ); - - SInt32 textLen = text ? XP_STRLEN(text) : 0; - - if (text != NULL) - mPlainEditView->InsertPtr( const_cast(text), textLen, NULL, NULL, false, false ); - - // We need to move the selection range manually - - if ( !leaveCursorinFront ) - { - oldSelStart = oldSelStart + textLen; - - if ( oldSelEnd < oldSelStart ) - oldSelEnd = oldSelStart; - } - - mPlainEditView->SetSelection( oldSelStart, oldSelEnd ); - - if (! textChanged) - mPlainEditView->ResetModCount(); - } - - } - catch (ExceptionCode inErr) - { - err = inErr; - } - - return err; -} // CMailComposeWindow::InsertMessageCompositionText - -Boolean CMailComposeWindow::NeedToSave() -{ - - // attachments and addresses broadcast when changed - SetSensibleTarget(); - if( mHeadersDirty ) - return true; - Boolean dirty = true; - - // Subject - CStr255 subject( mComposeSession->GetSubject() ); - LEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); - CStr255 currentText; - if (subjectField) - subjectField->GetDescriptor(currentText); - dirty = (currentText != subject); - if (dirty) - return dirty; - //Body - - if (mHTMLEditView) - dirty = EDT_DirtyFlag( mComposeSession->GetCompositionContext() ->operator MWContext*() ); - else - { - -// LTextEngine* theTextEngine = mPlainEditView->GetTextEngine(); - - dirty = (mPlainEditView->GetModCount() > 0); - - } - return dirty; - -} // CMailComposeWindow::NeedToSave - -Boolean CMailComposeWindow::AskIfUserWantsToClose() -{ - MessageT itemHit = HandleModalDialog( COMPOSEDLG_SAVE_BEFORE_QUIT, nil, nil ); - if (itemHit == cancel) - return false; - - if (itemHit == ok) - { - SaveDraftOrTemplate(cmd_SaveDraft, true ); - return false ; // Drafts will close the window Clean up for 4.02 - } - return true; -} - -void CMailComposeWindow::AttemptClose() -{ - Select(); // This helps for "close all" - if (mComposeSession->GetDownloadingAttachments() - || XP_IsContextBusy(*mComposeSession->GetCompositionContext())) - { - mComposeSession->Stop(); - return; // do we really want to return here? See bug #73544 - // need this return to cancel close of aborted send - // but it might leave open a window with partially - // loaded attachments, which could cause us to send - // bad data. - // see also bug 107078 that prompted this comment. - } - else - { - if (NeedToSave() && !AskIfUserWantsToClose()) - return; - } - Inherited::AttemptClose(); -} // CMailComposeWindow::AttemptClose() - -//---------------------------------------------------------------------------------------- -Boolean CMailComposeWindow::AttemptQuitSelf(Int32 inSaveOption) -//---------------------------------------------------------------------------------------- -{ - if (mComposeSession->GetDownloadingAttachments() - || XP_IsContextBusy(*mComposeSession->GetCompositionContext())) - { - mComposeSession->Stop(); - return false; - } - - if (NeedToSave() && !AskIfUserWantsToClose()) - return false; - return Inherited::AttemptQuitSelf(inSaveOption); -} // CMailComposeWindow::AttemptQuitSelf - -//---------------------------------------------------------------------------------------- -void CMailComposeWindow::DoCloseLater() -//---------------------------------------------------------------------------------------- -{ - CDeferredCloseTask::DeferredClose(this); -} // CMailComposeWindow::DoCloseLater - -//---------------------------------------------------------------------------------------- -void CMailComposeWindow::SpendTime(const EventRecord &/*inMacEvent*/) -//---------------------------------------------------------------------------------------- -{ - // Update the window title to match the subject - LEditField* subjectField = dynamic_cast(FindPaneByID('Subj')); - CStr255 currentSubject; - if (subjectField) - { - subjectField->GetDescriptor(currentSubject); - // Leave the default window title until they've typed something. - if (currentSubject != CStr255::sEmptyString) - { - CStr255 windowTitle; - this->GetDescriptor(windowTitle); - // Test for equality to avoid flickering. - if (windowTitle != currentSubject) - this->SetDescriptor(currentSubject); - } - } -} // CMailComposeWindow::SpendTime - -#pragma mark - - -CTabContainer::CTabContainer(LStream* inStream) : -CPatternBevelView(inStream) -{ -} - -void CTabContainer::DrawBeveledFrame(void) -{ - // Overridden to draw a partial-rect border - Rect theFrame; - CalcLocalFrameRect(theFrame); - SBooleanRect theBevelSides = { true, false, true, true }; - UGraphicGizmos::BevelTintPartialRect(theFrame, mMainBevel, 0x4000, 0x4000, theBevelSides); -} - -void CTabContainer::DrawSelf() -{ -#if 0 - Inherited::DrawSelf(); - Rect theFrame; - if (CalcLocalFrameRect(theFrame)) - { - StColorPenState theSaver; - theSaver.Normalize(); - - SBevelColorDesc theDesc; - UGraphicGizmos::LoadBevelTraits(5000, theDesc); - - StClipRgnState theClipSaver(theFrame); - StColorState::Normalize(); - - theFrame.left-=5; - ::FrameRect(&theFrame); - - SBooleanRect theBevelSides = { false, true, true, true }; - UGraphicGizmos::BevelPartialRect(theFrame, 1, eStdGrayBlack, eStdGrayBlack, theBevelSides); - ::InsetRect(&theFrame, 1, 1); - UGraphicGizmos::BevelPartialRect(theFrame, 2, theDesc.topBevelColor, theDesc.bottomBevelColor, theBevelSides); - } -#endif - Inherited::DrawSelf(); - Rect theFrame; - if (CalcLocalFrameRect(theFrame)) - { - StColorPenState theSaver; - theSaver.Normalize(); - - StClipRgnState theClipSaver(theFrame); - StColorState::Normalize(); - - theFrame.top -= 5; // to hide the top - ::FrameRect(&theFrame); - } -} - -CMailTabContainer::CMailTabContainer(LStream* inStream) : CTabContainer( inStream ) -{ -} - -void CMailTabContainer::DrawBeveledFrame(void) -{ - // Overridden to draw a partial-rect border - Rect theFrame; - CalcLocalFrameRect(theFrame); - SBooleanRect theBevelSides = { false, true, true, true }; - UGraphicGizmos::BevelTintPartialRect(theFrame, mMainBevel, 0x4000, 0x4000, theBevelSides); -} - -void CMailTabContainer::DrawSelf() -{ - Inherited::DrawSelf(); - Rect theFrame; - if (CalcLocalFrameRect(theFrame)) - { - StColorPenState theSaver; - theSaver.Normalize(); - - StClipRgnState theClipSaver(theFrame); - StColorState::Normalize(); - - theFrame.left -= 5; // to hide the left - ::FrameRect(&theFrame); - } -} - -#pragma mark - - -CMailComposeTabContainer::CMailComposeTabContainer(LStream* inStream) : -CMailTabContainer(inStream) -{ -} - -void CMailComposeTabContainer::FinishCreateSelf() -{ - //UReanimator::LinkListenerToControls(dynamic_cast(FindPaneByID('Addr')),this,10611); -} - - -#pragma mark - - -CMailAttachmentTabContainer::CMailAttachmentTabContainer(LStream* inStream) : -CMailTabContainer(inStream) -{ -} - -void CMailAttachmentTabContainer::FinishCreateSelf() -{ -// CAttachmentView* attachView = dynamic_cast(FindPaneByID('Attv')); -// try { -// attachView->SetAttachList(new CAttachmentList); -// } catch (...) { -// } - UReanimator::LinkListenerToControls(dynamic_cast(FindPaneByID('Attv')),this,10612); -} - -#pragma mark - - -CMailCompositionContext::CMailCompositionContext() : -CBrowserContext(MWContextMessageComposition) -{ - MWContext *mwcontext = operator MWContext*(); - if ( mwcontext ) - { - mwcontext->is_editor = true; - mwcontext->bIsComposeWindow = true; - } -} - -void CMailCompositionContext::AllConnectionsComplete() -{ - StSharer share(this); - CBrowserContext::AllConnectionsComplete(); -} - -void CMailCompositionContext::CreateContextProgress() -{ - try { - mProgress = new CContextProgress; - mProgress->AddUser(this); - } catch (...) { - } -} - -#pragma mark - - -CComposeTabSwitcher::CComposeTabSwitcher(LStream* inStream) : -CTabSwitcher(inStream) -{ -} - -void CComposeTabSwitcher::ManuallySwitchToTab( int32 tabID) -{ - CTabControl* theTabControl = (CTabControl*)FindPaneByID(mTabControlID); - theTabControl->SetValue( tabID ); -} -void CComposeTabSwitcher::DoPostLoad(LView* inLoadedPage, Boolean /*inWillCache*/) -{ - - LView* view = (LView*)inLoadedPage->FindPaneByID('Attv'); - if (view) - { - CAttachmentView* attachView = dynamic_cast(view); - BroadcastMessage(msg_ActivatingAttachTab, attachView); - } - else if ((LView*)inLoadedPage->FindPaneByID('Addr')) - { - BroadcastMessage(msg_ActivatingAddressTab,nil); - } - - view = ( LView*)inLoadedPage->FindPaneByID('OpTC'); - if( view ) - { - CMailOptionTabContainer* optionView = dynamic_cast(view); - BroadcastMessage( msg_ActivatingOptionTab, optionView ); - } - -} - -void CComposeTabSwitcher::DoPreDispose(LView* inLeavingPage, Boolean /*inWillCache*/) -{ - LView* view = (LView*)inLeavingPage->FindPaneByID('Attv'); - if (view) - BroadcastMessage(msg_DeactivatingAttachTab, view); - else if ((LView*)inLeavingPage->FindPaneByID('Addr')) - { - BroadcastMessage(msg_DeactivatingAddressTab, nil); - } -} - -//====================================== -// class CMailOptionTabContainer : public CTabContainer -//====================================== -CMailOptionTabContainer::CMailOptionTabContainer(LStream* inStream):CMailTabContainer(inStream) -{ - -} - -void CMailOptionTabContainer::FinishCreateSelf() -{ - CMailComposeWindow* window - = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if( window ) - { - UReanimator::LinkListenerToControls( window, this, 10617); - } -} diff --git a/mozilla/cmd/macfe/MailNews/CMailComposeWindow.h b/mozilla/cmd/macfe/MailNews/CMailComposeWindow.h deleted file mode 100644 index d2b944c9690..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailComposeWindow.h +++ /dev/null @@ -1,305 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailComposeWindow.h - -#pragma once - -// C/C++ headers -//#include - -// PowerPlant -#include -#include -#include -#include -#include - -// Mail/News MacFE stuff -#include "CBrowserContext.h" -#include "CComposeAddressTableView.h" -//#include "VEditField.h" -#include "CTSMEditField.h" - -// UI elements - -#include "CMailNewsWindow.h" -#include "CPatternBevelView.h" -#include "CTabSwitcher.h" -// #include "CGrayBevelView.h" - -// Netscape stuff -#include "msgcom.h" -#include "mattach.h" -#include "PascalString.h" - -class CSimpleTextView; -extern "C" void FE_SecurityOptionsChanged( MWContext* context); - - -const MessageT msg_DeleteCompositionContext = 'DCmC'; - -const MessageT msg_FinalizeAddrCellEdit = 'FAdC'; - -const MessageT msg_RefreshAddrCellEdit = 'RfAC'; - -const MessageT msg_ActivatingAttachTab = 'AcAT'; -const MessageT msg_DeactivatingAttachTab = 'DeAT'; -const MessageT msg_ActivatingAddressTab = 'AcAD'; -const MessageT msg_DeactivatingAddressTab = 'DeAD'; -const MessageT msg_ActivatingOptionTab = 'AcOT'; -const MessageT msg_DeactivatingOptionTab = 'DeOT'; - -const PaneIDT cSendButtonPaneID = 'Send'; -const PaneIDT cSendLaterButtonPaneID = 'Sl8r'; -const PaneIDT cQuoteButtonPaneID = 'Quot'; -const PaneIDT cStopButtonPaneID = 'Stop'; -const PaneIDT cAddressTab = 10611; -const PaneIDT cAttachTab = 10612; -const PaneIDT cOptionTab = 10617; -const PaneIDT cFormattingToolbar = 'HTbr'; - -const CommandT cmd_Attach = 'Batc'; -const MessageT msg_ReturnRecipt = 'OtRe'; -const MessageT msg_Garbled = 'OtEn'; -// const MessageT msg_8BitEncoding = 'Ot8b'; -const MessageT msg_Signed = 'OtSi'; -const MessageT msg_UUEncode = 'OtUU'; -const MessageT msg_HTMLAction = 'OtHa'; -const CommandT cmd_AttachMyAddressBookCard = 'AtMA'; -class CMailComposeWindow; -class CProgressListener; -class CComposeSession; - -//====================================== -class UComposeUtilities -//====================================== -{ -public: - static void WordWrap(Handle& inText, - Uint32 inTextLength, - LHandleStream& outTextStream); - - static MSG_HEADER_SET GetMsgHeaderMaskFromAddressType(EAddressType inAddressType); - - static MSG_PRIORITY GetMsgPriorityFromMenuItem(Int32 inMenuItem); - - static void RegisterComposeClasses(); -}; - -//====================================== -class CMailCompositionContext : public CBrowserContext -//====================================== -{ -public: - CMailCompositionContext(); - virtual ~CMailCompositionContext() {} - - void Cleanup() { BroadcastMessage(msg_DeleteCompositionContext); } - - virtual void AllConnectionsComplete(); // call this method - - void CreateContextProgress(); -}; - - - -//====================================== -class CTabContainer : public CPatternBevelView -//====================================== -{ -private: typedef CPatternBevelView Inherited; -public: - enum { class_ID = 'C_TC' }; - CTabContainer(LStream* inStream); - - virtual ~CTabContainer() { }; - - virtual void DrawSelf(); - virtual void DrawBeveledFrame(); -}; - -//====================================== -class CMailTabContainer : public CTabContainer -//========================================= -{ -public: - CMailTabContainer(LStream* inStream); - - virtual ~CMailTabContainer() { }; - virtual void DrawBeveledFrame(); - virtual void DrawSelf(); -}; - -//====================================== -class CMailComposeTabContainer : public CMailTabContainer -//====================================== -{ -private: typedef CTabContainer Inherited; - -public: - enum { class_ID = 'CmTC' }; - - CMailComposeTabContainer(LStream* inStream); - virtual ~CMailComposeTabContainer() { }; - virtual void FinishCreateSelf(); -}; - -//====================================== -class CMailAttachmentTabContainer : public CMailTabContainer -//====================================== -{ -private: typedef CTabContainer Inherited; -public: - enum { class_ID = 'AtTC' }; - - CMailAttachmentTabContainer(LStream* inStream); - virtual ~CMailAttachmentTabContainer() { }; - - virtual void FinishCreateSelf(); -}; - - - -typedef struct TERec **TEHandle; -class CMailEditView; - -//====================================== -class CMailComposeWindow : public CMailNewsWindow, - public LBroadcaster, - public LListener, - public LPeriodical -//====================================== -{ -private: - typedef CMailNewsWindow Inherited; -public: - enum { class_ID = 'mail', res_ID = 10610, text_res_ID = 10614 }; // this is same class_ID as old compose window - // Index into mToolbarShown for tracking visibility of toolbars - // Start at 2 because CMailNewsWindow uses 0 and 1 - enum { FORMATTING_TOOLBAR = 2}; - enum { COMPOSE_BUTTON_BAR_ID = 10618}; - CMailComposeWindow(LStream* inStream); - virtual ~CMailComposeWindow(); - virtual void FinishCreateSelf(); - - MSG_Pane* CreateSession(MWContext* old_context, - MSG_CompositionFields* inCompositionFields, - const char* initialText, - Boolean inOpeningAsDraft); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - virtual void AttemptClose(); - virtual Boolean AttemptQuitSelf(Int32 inSaveOption); - CComposeSession* GetComposeSession() { return mComposeSession; } - void HandleUpdateCompToolbar(); // from FE_UpdateCompToolbar. - - virtual Boolean HandleTabKey(const EventRecord &inKeyEvent); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - void DoCloseLater(); - virtual void SpendTime(const EventRecord &inMacEvent); - - // I18N stuff - virtual Int16 DefaultCSIDForNewWindow(void); - virtual void SetDefaultCSID(Int16 default_csid); - -protected: - void SetDefaultWebAttachmentURL(); - void SendMessage(Boolean inSendNow); - void UpdateSendButton(); - void SaveDraftOrTemplate(CommandT inCommand, Boolean inCloseWindow = false ); - Boolean PrepareMessage(Boolean isDraft = false); - void SyncAddressLists(); - void GetSubjectFromBackend(); - void GetPriorityFromBackend(); - void GetAttachmentsFromBackend(); - void InitializeHTMLEditor(CMailEditView* inEditorView); - void GetAllCompHeaders(); - void SetCompHeader(EAddressType inAddressType); - void GetCompHeader(EAddressType inAddressType); - void EnsureAtLeastOneAddressee(); - void SetSensibleTarget(); - char* GetSubject(); - - ExceptionCode InsertMessageCompositionText(const char* text, Boolean leaveCursorinFront = false); - void TargetMessageCompositionText(); - Boolean NeedToSave(); - Boolean AskIfUserWantsToClose(); - virtual ResIDT GetStatusResID(void) const; - virtual UInt16 GetValidStatusVersion(void) const { return 0x0115; } - - CComposeSession* mComposeSession; - CComposeAddressTableView* mAddressTableView; - CAttachmentList* mAttachmentList; - CAttachmentView* mAttachmentView; - CProgressListener* mProgressListener; - CMailEditView* mHTMLEditView; // nil unless HTML mode! - CSimpleTextView* mPlainEditView; // nil unless in PlainTextMode - Boolean mHeadersDirty; // The address, attachment - Boolean mHaveInitializedAttachmentsFromBE; - enum EInitializeState { - eUninitialized, - eComposeSessionIsSet, - eAboutURLLoading, - eDone }; - EInitializeState mInitializeState; - Boolean mOnlineLastFindCommandStatus; - - CStr255 mDefaultWebAttachmentURL; - CommandT mCurrentSaveCommand; // cmd_SaveDraft, cmd_SaveTemplate -}; // class CMailComposeWindow - -//====================================== -class CComposeTabSwitcher : public CTabSwitcher, - public LBroadcaster -//====================================== -{ -public: - enum { class_ID = 'CmTb' }; - CComposeTabSwitcher(LStream* inStream); - virtual ~CComposeTabSwitcher() { }; - virtual void ManuallySwitchToTab( int32 tabID); - virtual void DoPostLoad(LView* inLoadedPage, Boolean inWillCache); - virtual void DoPreDispose(LView* inLeavingPage, Boolean inWillCache); -}; - -//====================================== -class CMailOptionTabContainer : public CMailTabContainer -//====================================== -{ -private: typedef CTabContainer Inherited; - -public: - enum { class_ID = 'OpTC' }; - - CMailOptionTabContainer(LStream* inStream); - virtual ~CMailOptionTabContainer() { }; - virtual void FinishCreateSelf(); -}; - diff --git a/mozilla/cmd/macfe/MailNews/CMailFlexTable.cp b/mozilla/cmd/macfe/MailNews/CMailFlexTable.cp deleted file mode 100644 index a1024f23325..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailFlexTable.cp +++ /dev/null @@ -1,869 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -#include "CMailFlexTable.h" - -// PP -#include -#include - -#include "LFlexTableGeometry.h" -//#include "LTableRowSelector.h" - -// Want a command number? They hide in several places... -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" -#include "UMessageLibrary.h" - - -#include "CPrefsDialog.h" -#include "CNSContext.h" -#include "UMailSelection.h" - -#include "uapp.h" // for UpdateMenus(). Ugh. -#include "CPaneEnabler.h" -#include "CMailNewsContext.h" -#include "UOffline.h" -#include "CBookmarksAttachment.h" -#include "CMailProgressWindow.h" -#include "macutil.h" -#include "prefapi.h" - -// XP -#include "shist.h" - -//----------------------------------- -CMailFlexTable::CMailFlexTable(LStream *inStream) -//----------------------------------- -: Inherited(inStream) -, mMsgPane(NULL) -, mMysticPlane(0) -, mStillLoading(false) -, mContext(nil) -, mFirstRowToRefresh(0) -, mLastRowToRefresh(0) -, mClosing(false) -{ - *inStream >> mDragFlavor; -} // CMailFlexTable::CMailFlexTable - -//----------------------------------- -CMailFlexTable::~CMailFlexTable() -//----------------------------------- -{ - mClosing = true; - SetMessagePane(NULL); -} // CMailFlexTable::~CMailFlexTable - -//----------------------------------- -void CMailFlexTable::DrawSelf() -//----------------------------------- -{ - ApplyForeAndBackColors(); - - // This function is similar to what we had when the "Erase On Update" - // LWindow attribute was set in Constructor. This flag has been removed - // because it created a lot of flickers when browsing mails. - // The other objects in the Thread window continued to behave correctly - // but the CThreadView showed some update problems. Instead of fixing - // them as we are supposed to (ie. by invalidating and erasing only what - // needs to be redrawn), I prefered to emulate the way it used to work - // when "Erase On Update" was set. My apologies for this easy solution - // but we have something to ship next week. - - // OK, I made it better by only erasing what was below the last cell (if anything). - // jrm 97/08/18 - - const STableCell bottomCell(mRows, 1); - Int32 cellLeft, cellTop, cellRight, cellBottom; - mTableGeometry->GetImageCellBounds(bottomCell, cellLeft, cellTop, - cellRight, cellBottom); - // Convert from image coordinates to port coordinates - cellBottom += mImageLocation.v; - Int32 frameBottom = mFrameLocation.v + mFrameSize.height; - if (cellBottom < frameBottom) // Note the "=", edge case for deleting the last row. - { - // erase everything - Rect frame; - CalcLocalFrameRect(frame); - frame.top = frame.bottom - (frameBottom - cellBottom); - ::EraseRect(&frame); - } - - // redraw everything - Inherited::DrawSelf(); -} // CMailFlexTable::DrawSelf - -//----------------------------------- -void CMailFlexTable::DestroyMessagePane(MSG_Pane* inPane ) -//----------------------------------- -{ - if (mContext) - XP_InterruptContext((MWContext*)*mContext); - CMailCallbackListener::SetPane(nil); // turn off callbacks - if ( GetMessagePane() != NULL ) - ::MSG_DestroyPane( inPane); -}// CMailFlexTable::DestroyMessagePane - -//----------------------------------- -void CMailFlexTable::SetMessagePane(MSG_Pane* inPane) -//----------------------------------- -{ - DestroyMessagePane( mMsgPane ); - mMsgPane = inPane; - CMailCallbackListener::SetPane(inPane); -} - -//----------------------------------- -void CMailFlexTable::SetRowCount() -// Queries the back end pane and sets the number of rows. -//----------------------------------- -{ - TableIndexT rows, cols; - GetTableSize(rows, cols); - SInt32 diff = mMsgPane ? (::MSG_GetNumLines(mMsgPane) - rows) : -rows; - if (diff > 0) - InsertRows(diff, 1, NULL, 0, false); - else if (diff < 0) - RemoveRows(-diff, 1, false); - -} // CMailFlexTable::SetRowCount() - -#if 0 -//====================================== -class StProgressWindowHandler : public StDialogHandler -//====================================== -{ -private: - typedef StDialogHandler Inherited; -public: -}; -#endif - -static Boolean gCanceled = false; -static Boolean CancelCallback() -{ - gCanceled = true; - return false; -} -//----------------------------------- -void CMailFlexTable::OpenSelection() -// Overrides the base class, in order to show progress. -//----------------------------------- -{ - TableIndexT total = GetSelectedRowCount(); - if (!total) - return; - if (total < 10) - { - Inherited::OpenSelection(); - return; - } - - TableIndexT selectedRow = 0; - StDialogHandler handler(CMailProgressWindow::res_ID_modal, LCommander::GetTopCommander()); - CMailProgressWindow* pw = dynamic_cast(handler.GetDialog()); - if (!pw) - throw memFullErr; - - CStr255 description; - ::GetIndString(description, 7099, 17); - pw->SetCancelCallback(CancelCallback); - CContextProgress progress; - progress.mAction = description; - progress.mTotal = total; - progress.mInitCount = 0; - progress.mPercent = 0; - progress.mRead = 0; - progress.mStartTime = ::TickCount(); - gCanceled = false; - pw->Show(); - pw->UpdatePort(); - pw->ListenToMessage(msg_NSCProgressBegin, &progress); - while (GetNextSelectedRow(selectedRow) && !gCanceled) - { - // Handle plenty of events - activates, updates coming on strong... - for (int i = 1; i <= 20; i++) - { - handler.DoDialog(); - if (gCanceled) - break; - } - OpenRow(selectedRow); - ::GetIndString(description, 7099, 18); - ::StringParamText(description, ++progress.mRead, progress.mTotal, 0, 0); - progress.mPercent = ((Int32)(progress.mRead) * 100/ total); -// progress.mMessage = description; -// pw->ListenToMessage(msg_NSCProgressUpdate, &progress); -// Someone turned off support for msg_NSCProgressUpdate, so: - pw->ListenToMessage(msg_NSCProgressMessageChanged, (char*)description); - pw->ListenToMessage(msg_NSCProgressPercentChanged, &progress.mPercent); - } - // No. Handler will delete! pw->ListenToMessage(msg_NSCAllConnectionsComplete, nil); -} // CMailFlexTable::OpenSelection - -//----------------------------------- -Boolean CMailFlexTable::GetSelection(CMailSelection& selection) -// CStandardFlexTable has one-based lists which are lists of TableIndexT. -// CMailSelection requires zero-based lists which are lists of MSG_ViewIndex -// This routine clones and converts. -//----------------------------------- -{ - selection.xpPane = mMsgPane; - // Assert, cuz we're going to cast and to convert an array in place! - Assert_(sizeof(TableIndexT) == sizeof(MSG_ViewIndex)); - // if we've got a selection list, it's assumed up to date, - // so DON't convert it to a MSG_Index. When the selection changes, we just get - // rid of it (in SelectionChanged()) and set mSelectionList to NULL - Boolean usingCachedSelection = (mSelectionList != NULL); - selection.selectionList - = (MSG_ViewIndex*)Inherited::GetUpdatedSelectionList( - (TableIndexT&)selection.selectionSize); - if (!selection.selectionList) - return false; - if (usingCachedSelection) - return true; - // Have selection, not cached, so convert in place from 1-based to 0-based - MSG_ViewIndex* index = selection.selectionList; - for (TableIndexT i = 0; i < selection.selectionSize; i++, index++) - (*index)--; - return true; -} // CMailFlexTable::GetSelection - -//----------------------------------- -const TableIndexT* CMailFlexTable::GetUpdatedSelectionList(TableIndexT& /*outSelectionSize*/) -// This override is here to stop people calling it. Mail table requires a different type -// for the index and a zero-based one at that! -//----------------------------------- -{ - Assert_(false); // Use GetSelection() instead. - return NULL; -} // CMailFlexTable::GetUpdatedSelectionList - -//---------------------------------------------------------------------------------------- -void CMailFlexTable::AddSelectionToDrag( - DragReference inDragRef, - RgnHandle inDragRgn) -// Adds a single drag item, which is an array of the -// selected row indices. -// Throws drag manager errors. -//---------------------------------------------------------------------------------------- -{ - Inherited::AddSelectionToDrag(inDragRef, inDragRgn); - - // Our drag data is just a pointer to a list of our selected items - // Danger: the list changes when the selection changes, - // so this pointer's lifetime is limited. - CMailSelection selection; - if (GetSelection(selection)) - { - mDragFlavor = kMailNewsSelectionDragFlavor; - OSErr err = ::AddDragItemFlavor(inDragRef, eMailNewsSelectionDragItemRefNum, - mDragFlavor, &selection, sizeof(selection), flavorSenderOnly); - ThrowIfOSErr_(err); - } -} // CMailFlexTable::AddSelectionToDrag - -//---------------------------------------------------------------------------------------- -void CMailFlexTable::AddRowToDrag( - TableIndexT inRow, - DragReference inDragRef, - RgnHandle inDragRgn) -// 98/04/03 added to support dragging of an unselected item. -// Adds a single drag item, which is an array of ONE row index, probably not currently -// selected! -// Throws drag manager errors. -//---------------------------------------------------------------------------------------- -{ - if (inRow == LArray::index_Bad) - return; - Inherited::AddRowToDrag(inRow, inDragRef, inDragRgn); - - // Our drag data is just a pointer to a pseudo selection - // Danger: the list changes when the selection changes, - // so this pointer's lifetime is limited. - CMailSelection selection; - // Subtract 1 to make a MSG_ViewIndex (0-based) from the TableIndexT (1-based) - selection.xpPane = mMsgPane; - selection.SetSingleSelection(inRow - 1); - mDragFlavor = kMailNewsSelectionDragFlavor; - OSErr err = ::AddDragItemFlavor(inDragRef, eMailNewsSelectionDragItemRefNum, - mDragFlavor, &selection, sizeof(selection), flavorSenderOnly); - ThrowIfOSErr_(err); -} // CMailFlexTable::AddSelectionToDrag - -//---------------------------------------------------------------------------------------- -Boolean CMailFlexTable::GetSelectionFromDrag( - DragReference inDragRef, - CMailSelection& outSelection) -// Get the selection back out from the drag data. -// NOTE: this is called by the DESTINATION pane of the drop. -// The only flavor we need is kMailNewsSelectionDragFlavor -//---------------------------------------------------------------------------------------- -{ - Size dataSize; - dataSize = sizeof(CMailSelection); - if (noErr != ::GetFlavorData( - inDragRef, - eMailNewsSelectionDragItemRefNum, - kMailNewsSelectionDragFlavor, - &outSelection, - &dataSize, - 0)) - return false; - Assert_(dataSize == sizeof(CMailSelection)); - outSelection.Normalize(); - Assert_(outSelection.GetSelectionList() != NULL); - return true; -} // CMailFlexTable::GetSelectionFromDrag - -//----------------------------------- -void CMailFlexTable::ToggleExpandAction(TableIndexT row) -//----------------------------------- -{ - // rowDelta tells us how many items are added or removed. We don't - // need it, because we call ChangeFinished in the FE_LIstChangeFinished - // callback. - SInt32 rowDelta; - MSG_ToggleExpansion(mMsgPane, row - 1, &rowDelta); -} // CMailFlexTable::ToggleExpansion - -//----------------------------------- -void CMailFlexTable::ChangeStarting( - MSG_Pane* /* inPane */, - MSG_NOTIFY_CODE /* inChangeCode */, - TableIndexT /* inStartRow */, - SInt32 /* inRowCount */) -//----------------------------------- -{ - ++mMysticPlane; -} // CMailFlexTable::ChangeStarting - -//----------------------------------- -void CMailFlexTable::RowsChanged(TableIndexT inFirst, TableIndexT inCount) -// Accumulate a range of rows to update. We use this to delay refreshing until -// mMysticPlane has reached zero (outer call). -//----------------------------------- -{ - if (inCount == 0 || inFirst == 0) - return; - if (inFirst > mRows) - return; - if (mFirstRowToRefresh == 0 || inFirst < mFirstRowToRefresh) - mFirstRowToRefresh = inFirst; - TableIndexT maxCount = mRows - inFirst + 1; - if (inCount > maxCount) - mLastRowToRefresh = ULONG_MAX; - else - { - TableIndexT last = inFirst + inCount - 1; - if (last > mLastRowToRefresh) - mLastRowToRefresh = last; - } -} // CMailFlexTable::RowsChanged - -//----------------------------------- -void CMailFlexTable::ChangeFinished( - MSG_Pane* /* inPane */, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -//----------------------------------- -{ - if (mMysticPlane > 0) - --mMysticPlane; - if (mMsgPane && (mMysticPlane <= (kMysticUpdateThreshHold+1))) switch (inChangeCode) - { - case MSG_NotifyInsertOrDelete: - { - if (inRowCount > 0) - { - if (mRows + inRowCount > ::MSG_GetNumLines(mMsgPane)) - { - // Undo bug. Undo inserts extra rows. - Assert_(FALSE); // congrats! The backend "extra ghost row on undo" bug. - } - else - { - // InsertRows has an "inAfterRow" parameter, but the meaning of - // inStartRow as received from libmsg is that it is the index of - // the first INSERTED row! - InsertRows(inRowCount, inStartRow - 1, NULL, 0, false); // line order... - RowsChanged(inStartRow, ULONG_MAX); // ...does matter - } - } - else if (inRowCount < 0 && mRows > 0) - { - if (inStartRow - inRowCount - 1 <= mRows) - { - RowsChanged(inStartRow, ULONG_MAX); // line order... - RemoveRows(-inRowCount, inStartRow, false); // ...does matter - } - } - break; - } - case MSG_NotifyChanged: - { - RowsChanged(inStartRow, inRowCount); - break; - } - case MSG_NotifyScramble: - case MSG_NotifyAll: - SetRowCount(); -// TableIndexT rows, cols; -// GetTableSize(rows, cols); - mFirstRowToRefresh =1 ; - mLastRowToRefresh = ULONG_MAX; - break; - default: - case MSG_NotifyNone: - break; - } // switch - if (mMysticPlane == 0 && mFirstRowToRefresh != 0) - { - const STableCell topLeftCell(mFirstRowToRefresh, 1); - const STableCell botRightCell( - mLastRowToRefresh > mRows ? mRows : mLastRowToRefresh, mCols); - if (mLastRowToRefresh > mRows) - { - // (note that we're refreshing all the way to the bottom here). - // Because of the complication of "reconcile - // overhang", we really need to refresh all --- but only if part of the - // range is visible. To do this, we need only check if the top of the top cell - // is above the bottom of the frame. - Int32 cellLeft, cellTop, cellRight, cellBottom; - mTableGeometry->GetImageCellBounds(topLeftCell, cellLeft, cellTop, - cellRight, cellBottom); - // Convert from image coordinates to port coordinates - cellTop += mImageLocation.v; - Int32 frameBottom = mFrameLocation.v + mFrameSize.height; - if (cellTop <= frameBottom) // Note the "=", edge case for deleting the last row. - Refresh(); - } - else - RefreshCellRange(topLeftCell, botRightCell); - mFirstRowToRefresh = 0; - mLastRowToRefresh = 0; - } -} // CMailFlexTable::ChangeFinished - -//----------------------------------- -void CMailFlexTable::PaneChanged( - MSG_Pane* /* inPane */, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 /* value */) -//----------------------------------- -{ - switch (inNotifyCode) - { - case MSG_PanePastPasswordCheck: - //EnableStopButton(true); - break; - } -} // CMailFlexTable::PaneChanged - -//----------------------------------- -Boolean CMailFlexTable::FindMessageLibraryCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -// returns false if not a msglib command. -//----------------------------------- -{ - CMailSelection selection; - GetSelection(selection); - return UMessageLibrary::FindMessageLibraryCommandStatus( - GetMessagePane(), - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize, - inCommand, - outEnabled, - outUsesMark, - outMark, - outName); -} - -//----------------------------------- -void CMailFlexTable::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//----------------------------------- -{ - if (mClosing) // don't respond to BE callbacks when being destroyed - return; - - if (inCommand == cmd_Stop && mStillLoading) - { - outEnabled = true; // stop button on, nothing else. - return; - // ... otherwise, fall through and pass it up to the window - } - - if (!mMsgPane) - { - LCommander::GetTopCommander()->FindCommandStatus( - inCommand, outEnabled, outUsesMark, outMark, outName); - return; - } - switch (inCommand) - { - case cmd_AddToBookmarks: - { - outEnabled = mContext && SHIST_GetCurrent(&((MWContext*)*mContext)->hist); - return; - } - } - if (!FindMessageLibraryCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName) - || !outEnabled) - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); -} // CMailFlexTable::FindCommandStatus - -//----------------------------------- -Boolean CMailFlexTable::ObeyMessageLibraryCommand( - CommandT inCommand, - void * /* ioParam*/) -// Commands handled here are enabled/disabled in -// UMessageLibrary::FindMessageLibraryCommandStatus. -//----------------------------------- -{ - CStr255 commandName; - MSG_CommandType cmd; - switch (inCommand) - { - case cmd_CompressAllFolders: - inCommand = cmd_CompressFolder; - cmd = MSG_CompressFolder; // see hack below. - break; - default: - // Callers rely on this to check if it really is a msglib command. - // Do that first. - cmd = UMessageLibrary::GetMSGCommand(inCommand); - break; - } - if (!UMessageLibrary::IsValidCommand(cmd)) - return false; - // For msglib commands, we have to be careful to check whether the command - // can be handled for THIS pane, because (in the case of a thread pane) - // the message pane might have enabled the menu item. Failing to check - // again here leads to a nasty crash. - Boolean enabled; Boolean usesMark; Char16 mark; - if (inCommand == cmd_Undo) - { - inCommand = mUndoCommand; - // set it for next time - mUndoCommand = (inCommand == cmd_Undo) ? cmd_Redo : cmd_Undo; - } - else - mUndoCommand = cmd_Undo; - if (!FindMessageLibraryCommandStatus(inCommand, enabled, usesMark, mark, commandName) - || !enabled) - { - if (inCommand == cmd_CompressFolder) - { - // Hack. - // The logic is: if the selection permits MSG_CompressFolder, then do that. - // Otherwise, try for MSG_CompressAllFolders. We can't change the resources - // now (localization freeze). So the menu may have either of these commands - // in it. - - // I don't think that we will ever get here since FindCommand status does a - // a conversion between CompressFolder and CompressALLFolders --djm - inCommand = cmd_CompressAllFolders; - cmd = MSG_CompressAllFolders; - if (!FindMessageLibraryCommandStatus(inCommand, enabled, usesMark, mark, commandName) - || !enabled) - return false; - } - else - return false; - } - // YAH (Yet another Hack) FindMessageLibraryCommandStatus is going to return true since it internally - // does a conversion between cmd_CompressAllFolders and cmd_CompressFolder. The command then never - // gets switched - if ( inCommand == cmd_CompressFolder ) - { - CMailSelection selection; - GetSelection(selection); - XP_Bool plural; - XP_Bool enabledCommand = false; - MSG_COMMAND_CHECK_STATE checkedState; - const char* display_string = nil; - MSG_CommandStatus( GetMessagePane(), MSG_CompressFolder, - (MSG_ViewIndex*)selection.GetSelectionList(), selection.selectionSize, - &enabledCommand, &checkedState, &display_string, &plural) ; - // If the Compress Folder isn't enabled then Compress all is enabled - if ( !enabledCommand ) - { - inCommand = cmd_CompressAllFolders; - cmd = MSG_CompressAllFolders; - } - - } - - try - { -#define ALLOW_MODELESS_PROGRESS 1 -#define ALLOW_MODAL_PROGRESS 1 - - Boolean cmdHandled = false; - switch (cmd) - { - case MSG_GetNewMail: - case MSG_GetNextChunkMessages: - if (NET_IsOffline()) - { - // Bug #105393. This fails unhelpfully if the user is offline. There - // used to be a test for this here, but for some reason it was - // removed. This being so, the newly agreed-upon fix is that, if - // the user requests new messages while offline, we should instead - // present the "Go Online" dialog. See also CMessageView.cp. - // - 98/02/10 jrm. - PREF_SetBoolPref("offline.download_discussions", true); - PREF_SetBoolPref("offline.download_mail", true); - PREF_SetBoolPref("offline.download_directories", false); - UOffline::ObeySynchronizeCommand(); - cmdHandled = true; - } - else if (ALLOW_MODELESS_PROGRESS) - { - // Modeless window with separate context and pane - CMailProgressWindow::ObeyMessageLibraryCommand( - CMailProgressWindow::res_ID_modeless, - GetMessagePane(), cmd, commandName); - cmdHandled = true; - } - break; - - case MSG_MarkAllRead: - // Can't display a dialog with command(s) which apply to - // all the messages at once in the list because we don't - // get the callbacks from the BE which allow to update - // the progress bar and close the Progress window. - break; - - case MSG_CompressFolder: - case MSG_CompressAllFolders: - // Bug #90378 (BE problem which is much easier to fix in the FE) - // Make these commands run inside their own separate context. - CMailSelection selection; - GetSelection(selection); - CMailProgressWindow::ObeyMessageLibraryCommand( - CMailProgressWindow::res_ID_modeless, - GetMessagePane(), cmd, commandName, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize); - cmdHandled = true; - break; - - default: - if (ALLOW_MODAL_PROGRESS && !NET_IsOffline()) - { - // Modal parasite window with same context and pane - CMailProgressWindow::CreateModalParasite( - CMailProgressWindow::res_ID_modal, - GetMessagePane(), commandName); - } - break; - } - if (! cmdHandled) - { - CMailSelection selection; - GetSelection(selection); - MSG_Command(GetMessagePane(), cmd, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize); - } - } - catch(...) - { - } - return true; -} // CMailFlexTable::ObeyMessageLibraryCommand - -//----------------------------------- -Boolean CMailFlexTable::ObeyCommand( - CommandT inCommand, - void *ioParam) -//----------------------------------- -{ - if (mClosing) // don't respond to BE callbacks when being destroyed - return false; - - if (mStillLoading && inCommand != cmd_Stop) - return false; - - if (!mMsgPane) - return LCommander::GetTopCommander()->ObeyCommand(inCommand, ioParam); - - switch (inCommand) - { - case cmd_Stop: - { - if (mContext) - XP_InterruptContext(*mContext); - EnableStopButton(false); - return true; - } - case cmd_AddToBookmarks: - { - // MSG_GetFolderInfoFromURL() does not work for URLs pointing to Mail & News messages. - // SHIST_GetCurrent(&((MWContext*)*mContext)->hist) - // ); - - // Nova: BM_Entry *entry = SHIST_CreateHotlistStructFromHistoryEntry( - // SHIST_GetCurrent(&((MWContext*)*mContext)->hist) ); - - History_entry *entry = mContext->GetCurrentHistoryEntry(); // Mozilla - - if (entry) - CBookmarksAttachment::AddToBookmarks(entry->address, entry->title); - else - SysBeep(1); - break; - } - case cmd_Preferences: - CPrefsDialog::EditPrefs(CPrefsDialog::eExpandMailNews); - return true; - default: - return ObeyMessageLibraryCommand(inCommand, ioParam) - || Inherited::ObeyCommand(inCommand, ioParam); - } - return false; -} // CMailFlexTable::ObeyCommand - -//----------------------------------- -void CMailFlexTable::EnableStopButton(Boolean inBusy) -//----------------------------------- -{ - if (inBusy == mStillLoading) - return; - mStillLoading = inBusy; - (CFrontApp::GetApplication())->UpdateMenus(); - // done in CFrontApp::UpdateMenus() already. CPaneEnabler::UpdatePanes(); -} - -//----------------------------------- -void CMailFlexTable::DrawCountCell( - Int32 inCount, - const Rect& inLocalRect) -// inCount < 0 indicates unknown value -//----------------------------------- -{ - char sizeString[32]; - if (inCount >= 0) - sprintf(sizeString, "%d", inCount); - else - sprintf(sizeString, "?"); - DrawTextString(sizeString, &mTextFontInfo, 2, inLocalRect, true, truncEnd); -} // CMessageFolderView::DrawCountCell - -//----------------------------------- -void CMailFlexTable::ListenToMessage(MessageT inMessage, void* ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case CMailCallbackManager::msg_PaneChanged: - case CMailCallbackManager::msg_ChangeStarting: - case CMailCallbackManager::msg_ChangeFinished: - if (IsMyPane(ioParam)) - CMailCallbackListener::ListenToMessage(inMessage, ioParam); - break; - case msg_NSCStartLoadURL: - case msg_NSCProgressBegin: - EnableStopButton(true); - break; - case msg_NSCAllConnectionsComplete: - EnableStopButton(false); - break; - default: - if (!IsOnDuty() || !ObeyCommand(inMessage, ioParam)) - ListenToHeaderMessage(inMessage, ioParam); - } -} // CMailFlexTable::ListenToMessage - -//--------------------------------------------------------------------- -char* CMailFlexTable::GetTextFromDrag( - DragReference inDragRef, - ItemReference inItemRef) -// Check if this drag is a URL and returns the URL if it is. -// *** It is the responsibility of the client to delete the returned -// result by calling XP_FREEIF() -//--------------------------------------------------------------------- -{ - // get the drag data size - Size dataSize = 0; - OSErr err = ::GetFlavorDataSize(inDragRef, inItemRef, 'TEXT', &dataSize); - if (err) - return nil; // we can't throw during a drag! Inconvenient in MWDebug. - char* result = (char*)XP_ALLOC(1 + dataSize); - if (!result) - return nil; - unsigned long offset = 0; - // get the data out of the drag and put it into the buffer - err = ::GetFlavorData(inDragRef, inItemRef, 'TEXT', result, &dataSize, offset); - if (!err) - { - // terminate the string with a null char - result[dataSize] = '\0'; - return result; - } - XP_FREEIF(result); - return nil; -} // CMailFlexTable::GetTextFromDrag - -//--------------------------------------------------------------------- -MessageKey CMailFlexTable::MessageKeyFromURLDrag( - DragReference inDragRef, - ItemReference inItemRef) -// Check if this drag is the URL of a message and returns the message key if it is. -//--------------------------------------------------------------------- -{ - MessageKey result = MSG_MESSAGEKEYNONE; - char* url = GetTextFromDrag(inDragRef, inItemRef); - if (!url) - return MSG_MESSAGEKEYNONE; - MSG_MessageLine messageLine; - int status = MSG_GetMessageLineForURL( CMailNewsContext::GetMailMaster(), url, &messageLine ); - if (status >= 0) - result = messageLine.messageKey; - XP_FREEIF(url); - return result; -} // CMailFlexTable::MessageKeyFromURLDrag - -//--------------------------------------------------------------------- -MSG_FolderInfo* CMailFlexTable::GetFolderInfoFromURLDrag( - DragReference inDragRef, - ItemReference inItemRef) -// Check if this drag is the URL of a folder and returns the folderInfo if it is. -//--------------------------------------------------------------------- -{ - char* url = GetTextFromDrag(inDragRef, inItemRef); - if (!url) - return nil; - MSG_FolderInfo* result = MSG_GetFolderInfoFromURL(CMailNewsContext::GetMailMaster(), url, false); - XP_FREEIF(url); - return result; -} // CMailFlexTable::GetFolderInfoFromURLDrag - diff --git a/mozilla/cmd/macfe/MailNews/CMailFlexTable.h b/mozilla/cmd/macfe/MailNews/CMailFlexTable.h deleted file mode 100644 index a1ee3e3378e..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailFlexTable.h +++ /dev/null @@ -1,195 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -#pragma once - -#include "msgcom.h" -#include "CStandardFlexTable.h" -#include "MailNewsCallbacks.h" - -const kMysticUpdateThreshHold = 10; - - -class CMailNewsContext; -class CMailProgressWindow; -class CMailSelection; - -//======================================================================================== -class CMailFlexTable - : public CStandardFlexTable - , public CMailCallbackListener -// Like CStandardFlexTable, an abstract class. -//======================================================================================== -{ -private: - typedef CStandardFlexTable Inherited; -public: - enum - { class_ID = 'mfTb' - }; - - enum - { - eMailNewsSelectionDragItemRefNum = 0 - }; - - CMailFlexTable(LStream *inStream); - virtual ~CMailFlexTable(); - virtual void SetRowCount(); - Boolean IsStillLoading() const { return mStillLoading; } - - //----------------------------------- - // Drawing - //----------------------------------- - virtual void DrawSelf(); - - //----------------------------------- - // Selection - //----------------------------------- - virtual Boolean GetSelection(CMailSelection&); - // CStandardFlexTable has one-based lists which are lists of TableIndexT. - // CMailSelection requires zero-based lists which are lists of MSG_ViewIndex - // This routine clones and converts. - virtual void OpenSelection(); - - //----------------------------------- - // Drag/drop - //----------------------------------- - FlavorType GetMessageFlavor(TableIndexT /*inMessageRow*/) const - { return mDragFlavor; } - - virtual void AddSelectionToDrag( - DragReference inDragRef, RgnHandle inDragRgn); - virtual void AddRowToDrag( - TableIndexT inRow, - DragReference inDragRef, - RgnHandle inDragRgn); - - Boolean GetSelectionFromDrag( - DragReference inDragRef, - CMailSelection& outSelection); - - CNSContext* GetContext() const { return mContext; } - - //----------------------------------- - // CMailCallbackListener overrides - //----------------------------------- - virtual void ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - MSG_Pane* GetMessagePane(void) const - { return mMsgPane; } - virtual void DestroyMessagePane( MSG_Pane* inPane ); - void ListenToMessage(MessageT inMessage, void* ioParam); - -protected: - - void SetMessagePane(MSG_Pane* inPane); - - static char* GetTextFromDrag( - DragReference inDragRef, - ItemReference inItemRef); - // Caller must XP_FREE the result. - - static MSG_FolderInfo* GetFolderInfoFromURLDrag( - DragReference inDragRef, - ItemReference inItemRef); - // Check if this drag is the URL of a folder - // and returns the folderInfo if it is. - - static MessageKey MessageKeyFromURLDrag( - DragReference inDragRef, - ItemReference inItemRef); - // Check if this drag is the URL of a message - // and returns the message key if it is. - - //----------------------------------- - // Commands - //----------------------------------- -protected: - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); - Boolean FindMessageLibraryCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - // returns false if not a msglib command. - Boolean ObeyMessageLibraryCommand( - CommandT inCommand, - void *ioParam); - void NotifySelfAll() { // Manual notification for BE bugs! - ChangeStarting(mMsgPane, MSG_NotifyAll, 0, 0); - ChangeFinished(mMsgPane, MSG_NotifyAll, 0, 0); - } -public: - void EnableStopButton(Boolean inBusy); - - //----------------------------------- - // Internal helpers - //----------------------------------- -protected: - void DrawCountCell( - Int32 inCount, - const Rect& inLocalRect); - void RowsChanged(TableIndexT inFirst, TableIndexT inCount); - - //----------------------------------- - // Window Saving - //----------------------------------- -private: - virtual const TableIndexT* GetUpdatedSelectionList(TableIndexT& outSelectionSize); - // This does an assert: the idea is to use only GetSelection, above. -protected: - //----------------------------------- - // Discloser support - //----------------------------------- - void ToggleExpandAction(TableIndexT row); -protected: - CNSContext* mContext; // Belongs to the window, not us. - SInt32 mMysticPlane; // for keeping track of callback level - FlavorType mDragFlavor; - Boolean mStillLoading; - TableIndexT mFirstRowToRefresh; - TableIndexT mLastRowToRefresh; - Boolean mClosing; - CommandT mUndoCommand; // cmd_Undo or cmd_Redo - -private: - MSG_Pane* mMsgPane; // MUST be private. Must call Get/Set. -}; // class CMailFlexTable diff --git a/mozilla/cmd/macfe/MailNews/CMailFolderButtonPopup.cp b/mozilla/cmd/macfe/MailNews/CMailFolderButtonPopup.cp deleted file mode 100644 index d27bdfbdbd0..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailFolderButtonPopup.cp +++ /dev/null @@ -1,503 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailFolderButtonPopup.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CMailFolderButtonPopup.h" -#include "StSetBroadcasting.h" -#include "MailNewsgroupWindow_Defines.h" -#include "CDrawingState.h" -#include "CMessageFolder.h" - - -#pragma mark - - -/*====================================================================================== - Call UpdateMailFolderMixins() to initialize the menu. -======================================================================================*/ - -void CMailFolderButtonPopup::FinishCreateSelf(void) { - - CPatternButtonPopup::FinishCreateSelf(); - - CMailFolderMixin::UpdateMailFolderMixinsNow(this); -} - - -/*====================================================================================== - Instead of broadcasting the actual value, broadcast the new folder string. -======================================================================================*/ - -void CMailFolderButtonPopup::BroadcastValueMessage(void) { - - if ( mValueMessage != msg_Nothing ) - { - BroadcastMessage(mValueMessage, MGetSelectedFolder().GetFolderInfo()); - } -} - - -/*====================================================================================== - When the user selects a new item, we don't really want to change the currently - selected item in the menu, just broadcast the item that the user selected and - reset the currently selected item. -======================================================================================*/ - -Boolean CMailFolderButtonPopup::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) { - - // Store the current value - - Int32 oldValue = mValue; - OSErr thrownErr = noErr; - Boolean result; - - Try_ { - result = CPatternButtonPopup::TrackHotSpot(inHotSpot, inPoint, inModifiers); - } - Catch_(inErr) { - thrownErr = inErr; - } - EndCatch_ - - // Reset the old value - - StSetBroadcasting setBroadcasting(this, false); // Don't broadcast anything here - SetValue(oldValue); - FailOSErr_(thrownErr); - - return result; -} - - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CMailFolderButtonPopup::MGetSystemMenuHandle(void) -{ - MenuHandle menuH = nil; - - if (GetMenu()) - { - menuH = GetMenu()->GetMacMenuH(); - } - - return menuH; -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CMailFolderButtonPopup::MRefreshMenu(void) { - - // Nothing, no user menu displayed unless clicked -} - -#pragma mark - - -//----------------------------------- -CMailFolderPatternTextPopup::CMailFolderPatternTextPopup(LStream *inStream) -: CPatternButtonPopupText(inStream) -//----------------------------------- -{ - mUseFolderIcons = eUseFolderIcons; - // This is for the relocation menu, so add newsgroups. - CMailFolderMixin::mDesiredFolderFlags = - (FolderChoices)(int(mDesiredFolderFlags) | int(eWantNews)); -} - -/*====================================================================================== - Call UpdateMailFolderMixins() to initialize the menu. -======================================================================================*/ - -void CMailFolderPatternTextPopup::FinishCreateSelf(void) -{ - Inherited::FinishCreateSelf(); - CMailFolderMixin::UpdateMailFolderMixinsNow(this); -} - - -/*====================================================================================== - Instead of broadcasting the actual value, broadcast the new folder string. -======================================================================================*/ - -void CMailFolderPatternTextPopup::BroadcastValueMessage(void) { - - if ( mValueMessage != msg_Nothing ) { - BroadcastMessage(mValueMessage, MGetSelectedFolder().GetFolderInfo()); - } -} - - -/*====================================================================================== - Unlike CMailFolderButtonPopup, when the user selects a new item, we DO really want - to change the currently selected item in the menu, not just broadcast the item that - the user selected and reset the currently selected item. -======================================================================================*/ - -Boolean CMailFolderPatternTextPopup::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) -{ - return Inherited::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - -void CMailFolderPatternTextPopup::HandlePopupMenuSelect( Point inPopupLoc, - Int16 inCurrentItem, - Int16 &outMenuID, - Int16 &outMenuItem) -{ - Int16 saveFont = ::LMGetSysFontFam(); - Int16 saveSize = ::LMGetSysFontSize(); - - StMercutioMDEFTextState theMercutioMDEFTextState; - - Inherited::HandlePopupMenuSelect(inPopupLoc, inCurrentItem, outMenuID, outMenuItem); - - // Restore the system font - - ::LMSetSysFontFam(saveFont); - ::LMSetSysFontSize(saveSize); - ::LMSetLastSPExtra(-1L); - -} - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CMailFolderPatternTextPopup::MGetSystemMenuHandle(void) { - if ( GetMenu() ) - return GetMenu()->GetMacMenuH(); - - return NULL; -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CMailFolderPatternTextPopup::MRefreshMenu(void) { - - // Nothing, no user menu displayed unless clicked -} - - -#pragma mark - - -//----------------------------------- -CMailFolderGAPopup::CMailFolderGAPopup(LStream *inStream) -: LGAPopup(inStream) -//----------------------------------- -{ - mUseFolderIcons = eUseFolderIcons; - // This is for the relocation menu, so add newsgroups. - CMailFolderMixin::mDesiredFolderFlags = - (FolderChoices)(int(mDesiredFolderFlags) | int(eWantNews)); -} - -/*====================================================================================== - Call UpdateMailFolderMixins() to initialize the menu. -======================================================================================*/ - -void CMailFolderGAPopup::FinishCreateSelf(void) -{ - LGAPopup::FinishCreateSelf(); - CMailFolderMixin::UpdateMailFolderMixinsNow(this); -} - - -/*====================================================================================== - Instead of broadcasting the actual value, broadcast the new folder string. -======================================================================================*/ - -void CMailFolderGAPopup::BroadcastValueMessage(void) { - - if ( mValueMessage != msg_Nothing ) { - BroadcastMessage(mValueMessage, MGetSelectedFolder().GetFolderInfo()); - } -} - - -/*====================================================================================== - Unlike CMailFolderButtonPopup, when the user selects a new item, we DO really want - to change the currently selected item in the menu, not just broadcast the item that - the user selected and reset the currently selected item. -======================================================================================*/ - -Boolean CMailFolderGAPopup::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) -{ - return LGAPopup::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - -void CMailFolderGAPopup::HandlePopupMenuSelect( Point inPopupLoc, - Int16 inCurrentItem, - Int16 &outMenuID, - Int16 &outMenuItem) -{ - Int16 saveFont = ::LMGetSysFontFam(); - Int16 saveSize = ::LMGetSysFontSize(); - - StMercutioMDEFTextState theMercutioMDEFTextState; - - LGAPopup::HandlePopupMenuSelect(inPopupLoc, inCurrentItem, outMenuID, outMenuItem); - - // Restore the system font - - ::LMSetSysFontFam(saveFont); - ::LMSetSysFontSize(saveSize); - ::LMSetLastSPExtra(-1L); - -} - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CMailFolderGAPopup::MGetSystemMenuHandle(void) { - return GetMacMenuH(); -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CMailFolderGAPopup::MRefreshMenu(void) { - - // Nothing, no user menu displayed unless clicked -} - - -#pragma mark - - -//----------------------------------- -CFolderScopeGAPopup::CFolderScopeGAPopup(LStream* inStream) -//----------------------------------- -: CMailFolderGAPopup(inStream) -{ - // This is for the scope menu in the message search window. - mUseFolderIcons = eUseFolderIcons; - CMailFolderMixin::mDesiredFolderFlags = - (FolderChoices)(int(mDesiredFolderFlags) | int(eWantNews) | int(eWantHosts)); -} - -#pragma mark - - -// Class static members - -CMailFolderSubmenu *CMailFolderSubmenu::sMoveMessageMenu = nil; -CMailFolderSubmenu *CMailFolderSubmenu::sCopyMessageMenu = nil; - -// Helper functions - -static void CreateMailFolderSubmenu(Int16 inMENUid, CMailFolderSubmenu **outMenu) { - - if ( *outMenu == nil ) { - Try_ { - *outMenu = new CMailFolderSubmenu(inMENUid); - if ( *outMenu ) { - CMailFolderMixin::UpdateMailFolderMixinsNow(*outMenu); - } - } - Catch_(inErr) { - if ( *outMenu ) { - delete *outMenu; - *outMenu = nil; - } - } - EndCatch_ - } -} - -static void InstallMailFolderSubmenu(CommandT inCommand, CMailFolderSubmenu *inMenu) { - - if ( inMenu && !inMenu->IsInstalled() ) { - ResIDT menuID; - MenuHandle menuHandle; - Int16 menuItem; - - LMenuBar::GetCurrentMenuBar()->FindMenuItem(inCommand, menuID, - menuHandle, menuItem); - - if ( menuHandle != nil ) { - LMenuBar::GetCurrentMenuBar()->InstallMenu(inMenu, hierMenu); - - // Install the submenu (hierarchical menu) - - ::SetItemCmd(menuHandle, menuItem, hMenuCmd); - ::SetItemMark(menuHandle, menuItem, inMenu->GetMenuID()); - } - } -} - -static void RemoveMailFolderSubmenu(CMailFolderSubmenu *inMenu) { - - if ( inMenu && inMenu->IsInstalled() ) { - LMenuBar::GetCurrentMenuBar()->RemoveMenu(inMenu); - } -} - -/*====================================================================================== - Install the mail folder submenus (file, copy) into the current menu bar. If the - menu bar already contains the submenus, do nothing. This method should be called - when a window using the menus becomes active. - - This method can be called at any time. -======================================================================================*/ - -void CMailFolderSubmenu::InstallMailFolderSubmenus(void) { - - // Create and initialize the menus if they don't exist yet - CreateMenus(); - - // Install the menus - InstallMailFolderSubmenu(cmd_MoveMailMessages, sMoveMessageMenu); - InstallMailFolderSubmenu(cmd_CopyMailMessages, sCopyMessageMenu); -} - - -/*====================================================================================== - Remove the mail folder submenus (file, copy) from the current menu bar. If the - menu bar doesn't contain the submenus, do nothing. This method should be called - when a window using the menus becomes inactive or a new menu bar is installed. - - This method can be called at any time. -======================================================================================*/ - -void CMailFolderSubmenu::RemoveMailFolderSubmenus(void) { - - // Remove the menus - RemoveMailFolderSubmenu(sMoveMessageMenu); - RemoveMailFolderSubmenu(sCopyMessageMenu); -} - -//----------------------------------- -void CMailFolderSubmenu::SetSelectedFolder(const MSG_FolderInfo* inInfo) -// Set the currently selected folder item in the hierarchical menus. If inInfo is nil -// or empty, all items are unselected. -// -// This method can be called at any time. -//----------------------------------- -{ - // Create and initialize the menus if they don't exist yet - CreateMenus(); - - if ( sMoveMessageMenu != nil ) - sMoveMessageMenu->MSetSelectedFolder(inInfo); - if ( sCopyMessageMenu != nil ) - sCopyMessageMenu->MSetSelectedFolder(inInfo); -} - -//----------------------------------- -Boolean CMailFolderSubmenu::IsMailFolderCommand(CommandT *ioMenuCommand, const char** outName) -// Determine if the specified synthetic menu command passed to ObeyCommand() is from -// a mail folder menu. If it is, reassign ioMenuCommand to represent the actual mail -// folder command ID and set outName to the name of the selected mail folder and return -// true. Otherwise, return false and do nothing. outName can be nil, in which case no -// name is assigned. -// -// This method can be called at any time. -//----------------------------------- -{ - ResIDT menuID; - Int16 menuItem; - if ( LCommander::IsSyntheticCommand(*ioMenuCommand, menuID, menuItem) ) - { - if ( menuID == menuID_MoveMessage ) - { - if ( sMoveMessageMenu != nil ) - { - *ioMenuCommand = cmd_MoveMailMessages; - if ( outName != nil ) - *outName = sMoveMessageMenu->MGetFolderName(menuItem); - return true; - } - } - else if ( menuID == menuID_CopyMessage ) - { - if ( sCopyMessageMenu != nil ) - { - *ioMenuCommand = cmd_CopyMailMessages; - if ( outName != nil ) - *outName = sCopyMessageMenu->MGetFolderName(menuItem); - return true; - } - } - } - return false; -} - -/*====================================================================================== - Create the hierarchical menus if they don't already exist. - - This method can be called at any time. -======================================================================================*/ - -void CMailFolderSubmenu::CreateMenus(void) { - - // Create and initialize the menus if they don't exist yet - CreateMailFolderSubmenu(CMailFolderSubmenu::menuID_MoveMessage, &sMoveMessageMenu); - CreateMailFolderSubmenu(CMailFolderSubmenu::menuID_CopyMessage, &sCopyMessageMenu); - -} - -#pragma mark - - -/*====================================================================================== -======================================================================================*/ -CFolderMoveGAPopup::CFolderMoveGAPopup(LStream *inStream) : - CMailFolderGAPopup( inStream ) -{ -} - -CFolderMoveGAPopup::~CFolderMoveGAPopup() -{ -} - -// reset the default menu item to the original value -Boolean -CFolderMoveGAPopup::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) -{ - Int32 oldValue = GetValue(); - bool result = false; - - result = LGAPopup::TrackHotSpot(inHotSpot, inPoint, inModifiers); - if (oldValue != GetValue()) - { - BroadcastMessage(mValueMessage, MGetSelectedFolder().GetFolderInfo()); - } - else - { - // we want to prevent a broadcast because we have already - // sent one out when we set the value of the control - StSetBroadcasting broacast(this, false); - SetValue(oldValue); - } - return result; -} - - - diff --git a/mozilla/cmd/macfe/MailNews/CMailFolderButtonPopup.h b/mozilla/cmd/macfe/MailNews/CMailFolderButtonPopup.h deleted file mode 100644 index c9ee7353df9..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailFolderButtonPopup.h +++ /dev/null @@ -1,198 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailFolderButtonPopup.h - -#pragma once - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CPatternButtonPopup.h" -#include "CPatternButtonPopupText.h" -#include "UMailFolderMenus.h" - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - CMailFolderButtonPopup - -//====================================== -class CMailFolderButtonPopup : public CPatternButtonPopup, - public CMailFolderPopupMixin -// Class for the button popup -//====================================== -{ -public: - - enum { class_ID = 'MfPu' }; - - CMailFolderButtonPopup(LStream *inStream) : - CPatternButtonPopup(inStream) { - } - - -protected: - - virtual void FinishCreateSelf(void); - virtual void BroadcastValueMessage(void); - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - - virtual MenuHandle MGetSystemMenuHandle(void); - virtual void MRefreshMenu(void); -}; - -#pragma mark - CMailFolderPatternTextPopup - -//====================================== -class CMailFolderPatternTextPopup : public CPatternButtonPopupText, - public CGAPopupFolderMixin -// Class for the relocation popup menu in the thread pane -//====================================== -{ -private: - typedef CPatternButtonPopupText Inherited; - -public: - enum { class_ID = 'MfPT' }; - - CMailFolderPatternTextPopup(LStream *inStream); - -protected: - - virtual void FinishCreateSelf(void); - virtual void BroadcastValueMessage(void); - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - virtual void HandlePopupMenuSelect( Point inPopupLoc, - Int16 inCurrentItem, - Int16 &outMenuID, - Int16 &outMenuItem); - - virtual MenuHandle MGetSystemMenuHandle(void); - virtual void MRefreshMenu(void); - -}; // class CMailFolderPatternTextPopup - -#pragma mark - CMailFolderGAPopup - -//====================================== -class CMailFolderGAPopup : public LGAPopup, - public CGAPopupFolderMixin -// Class for the relocation popup menu in the thread pane -//====================================== -{ -public: - - enum { class_ID = 'MfPM' }; - - CMailFolderGAPopup(LStream *inStream); - - -protected: - - virtual void FinishCreateSelf(void); - virtual void BroadcastValueMessage(void); - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - virtual void HandlePopupMenuSelect( Point inPopupLoc, - Int16 inCurrentItem, - Int16 &outMenuID, - Int16 &outMenuItem); - - virtual MenuHandle MGetSystemMenuHandle(void); - virtual void MRefreshMenu(void); -}; // class CMailFolderGAPopup - -#pragma mark - CFolderScopeGAPopup - -//====================================== -class CFolderScopeGAPopup : public CMailFolderGAPopup -// differs from CMailFolderGAPopup only in the setting of mDesiredFolderFlags -//====================================== -{ -public: - - enum { class_ID = 'SsPM' }; - - CFolderScopeGAPopup(LStream *inStream); -}; // class CFolderScopeGAPopup - -#pragma mark - CFolderMoveGAPopup - -//====================================== -class CFolderMoveGAPopup : public CMailFolderGAPopup -//====================================== -{ - typedef CMailFolderGAPopup Inherited; - -public: - - enum { class_ID = 'SsFM' }; - - CFolderMoveGAPopup(LStream *inStream); - virtual ~CFolderMoveGAPopup(); - -protected: - virtual Boolean TrackHotSpot( - Int16 inHotSpot, - Point inPoint, - Int16 inModifiers); - -}; // class CFolderScopeGAPopup - -#pragma mark - CMailFolderSubmenu - -//====================================== -class CMailFolderSubmenu : public LMenu, - public CMenuMailFolderMixin -// Class for the hierarchical menu -//====================================== -{ -public: - - static void InstallMailFolderSubmenus(void); - static void RemoveMailFolderSubmenus(void); - static void SetSelectedFolder(const MSG_FolderInfo* inInfo); - static Boolean IsMailFolderCommand(CommandT *ioMenuCommand, const char** outName = nil); - - CMailFolderSubmenu(Int16 inMENUid, - CommandT inMenuCommand = cmd_UseMenuItem) : - LMenu(inMENUid), - CMenuMailFolderMixin(inMenuCommand) { - } - -protected: - - enum { - menuID_MoveMessage = 44 - , menuID_CopyMessage = 46 - }; - - static void CreateMenus(void); - - // Instance variables - - // Class variables - - static CMailFolderSubmenu *sMoveMessageMenu; - static CMailFolderSubmenu *sCopyMessageMenu; -}; - diff --git a/mozilla/cmd/macfe/MailNews/CMailNewsContext.cp b/mozilla/cmd/macfe/MailNews/CMailNewsContext.cp deleted file mode 100644 index 81b457f155e..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailNewsContext.cp +++ /dev/null @@ -1,426 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailNewsContext.cp - -#include "CMailNewsContext.h" - -#include "ufilemgr.h" - -#include "CCheckMailContext.h" -#include "UStdDialogs.h" -#include "CMessageFolderView.h" - -// Command numbers -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" - -#include "uprefd.h" -#include "prefapi.h" -#include "shist.h" -#include "macutil.h" -#include "macgui.h" -#include "uerrmgr.h" - -// get string constants -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS - -#include "mimages.h" -#include "layers.h" -#include "CDrawable.h" -#include "CBrowserContext.h" - -#include "CNSContextCallbacks.h" -#include "CMailProgressWindow.h" - -// The message master from which all life springs... -MSG_Master* CMailNewsContext::sMailMaster = NULL; -Int32 CMailNewsContext::sMailMasterRefCount = 0; -MSG_Prefs* CMailNewsContext::sMailPrefs = NULL; - -//---------------------------------------------------------------------------------------- -CMailNewsContext::CMailNewsContext(MWContextType inContextType) -//---------------------------------------------------------------------------------------- -: Inherited(inContextType) -, mWasPromptOkay( false ) -{ - ThrowUnlessPrefsSet(inContextType); - GetMailMaster(); // make sure it's there. - sMailMasterRefCount++; - SHIST_InitSession(&mContext); -#if 0 - // Bug: hang when replying to a thread with attachment icons - // from the collapsed thread window. - - // The following is left here as a caution to young programmers who might need a lesson - // learned the hard way by a foolish forerunner - me. The easy solution - // is to set the output_function pointer in mimemoz.c to a stub, so that no - // HTML is generated. - - // Adding an image context avoids the hang by handling the attachment icon images. - CreateImageContext( &mContext ); - - // Adding a compositor to avoid the HTML dialog complaining about window.document.layers - // having "no properties" mime converter was adding javascript that referred to them. - CRouterDrawable* onscreenDrawable = new CRouterDrawable(); - CL_Drawable * theDrawable = CL_NewDrawable(100, 100, CL_WINDOW, - &mfe_drawable_vtable, (void *) onscreenDrawable); - CL_Compositor* c = CL_NewCompositor(theDrawable, nil, 0, 0, 100, 100, 10); - CSharableCompositor* compositor = new CSharableCompositor(c); - compositor->AddUser(this); // shared by context and view. - NEVER REMOVED/ TEST/ - mContext.compositor = *compositor; - CL_SetCompositorEnabled(*compositor, PR_TRUE); -#endif -} // CMailNewsContext::CMailNewsContext - -//---------------------------------------------------------------------------------------- -CMailNewsContext::~CMailNewsContext() -//---------------------------------------------------------------------------------------- -{ - XP_InterruptContext(*this); // This must happen before the master is deleted! - #if 1 //CNSContext::NoMoreUsers is responsible for disposing the history sessions - // yes, but 97/05/22 CNSContext::NoMoreUsers now has "NoMoreUsers". - LO_DiscardDocument(&mContext); - SHIST_EndSession(&mContext); - MimeDestroyContextData(&mContext); - // No java - // No layers - // No mocha - #endif //0 - if (sMailMasterRefCount == 1) - { - // If we are about to delete the last mail-news context... - // (WARNING: there's a backend bug: MSG_CleanupNeeded will continue to return - // true even after the cleanup is finished. So be sure not to get into an - // infinite loop.) - if (mContext.type != MWContextMailNewsProgress && MSG_CleanupNeeded(sMailMaster)) - { - try - { - CMailProgressWindow::CleanUpFolders(); - } - catch(...) - { - // Don't throw here, we're trying to quit. - } - } - } - Assert_(sMailMaster); - Assert_(sMailMasterRefCount); - sMailMasterRefCount--; - if (sMailMasterRefCount == 0) - { - MSG_DestroyMaster(sMailMaster); - sMailMaster = NULL; - } -} // CMailNewsContext::~CMailNewsContext - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsContext::IsPrefSet(const char* inPrefKey) -//---------------------------------------------------------------------------------------- -{ - char buffer[512]; int bufferLength = sizeof(buffer); - PREF_GetCharPref(inPrefKey, buffer, &bufferLength); - if (*buffer) - return true; - return false; -} // CMailNewsContext::IsPrefSet - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsContext::ThrowUnlessPrefSet( - const char* inPrefKey, - PREF_Enum inPrefPaneSelector) -//---------------------------------------------------------------------------------------- -{ - if (IsPrefSet(inPrefKey)) - return true; - AlertPrefAndThrow(inPrefPaneSelector); - return false; // dead, but the compiler needs this, see? -} // CMailNewsContext::ThrowUnlessPrefSet - -//---------------------------------------------------------------------------------------- -void CMailNewsContext::AlertPrefAndThrow(PREF_Enum inPrefPaneSelector) -//---------------------------------------------------------------------------------------- -{ - // OK. We're going to throw, but first, we prompt and send them to the prefs pane. - // Ask "Would you like to set the preference?" - short strID; - switch (inPrefPaneSelector) - { - case PREF_EmailAddress: strID = 23; break; // I don't know why but all string IDs from - case PREF_Pop3ID: strID = 21; break; // STR# 7099 are hard-coded in other parts - case PREF_SMTPHost: strID = 21; break; // of the code: let's continue! - case PREF_PopHost: strID = 21; break; - case PREF_NewsHost: strID = 22; break; - default: strID = 24; break; - } - CStr255 whereString; - ::GetIndString(whereString, 7099, strID); - - CStr255 alertString; - ::GetIndString(alertString, 7099, 7); - - ::StringParamText(alertString, (char*)whereString, nil, nil, nil); - - if (UStdDialogs::AskOkCancel(alertString, nil, nil)) // if "ok" - FE_EditPreference(inPrefPaneSelector); - throw (OSErr)userCanceledErr; // we already presented the alert. This avoids another. -} // CMailNewsContext::AlertPrefAndThrow - -//---------------------------------------------------------------------------------------- -/* static */ Boolean CMailNewsContext::UserHasNoLocalInbox() -//---------------------------------------------------------------------------------------- -{ - // Check whether there is an inbox in their local mail tree. If not, assume - // first time setup. - FSSpec inboxSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); -// *(CStr63*)(inboxSpec.name) = XP_GetString(MK_MSG_INBOX_L10N_NAME); -// if (FSMakeFSSpec(inboxSpec.vRefNum, inboxSpec.parID, inboxSpec.name, &spec2) == fnfErr) -// return true; - FSSpec spec2; - *(CStr63*)(inboxSpec.name) = XP_GetString(MK_MSG_TRASH_L10N_NAME); - if (FSMakeFSSpec(inboxSpec.vRefNum, inboxSpec.parID, inboxSpec.name, &spec2) == fnfErr) - return true; - return false; -} // CMailNewsContext::UserHasNoLocalInbox - -//---------------------------------------------------------------------------------------- -/* static */ void CMailNewsContext::ThrowIfNoLocalInbox() -//---------------------------------------------------------------------------------------- -{ - if (UserHasNoLocalInbox()) - AlertPrefAndThrow(PREF_PopHost); -} // CMailNewsContext::ThrowIfNoLocalInbox - -//---------------------------------------------------------------------------------------- -void CMailNewsContext::ThrowUnlessPrefsSet(MWContextType inContextType) -//---------------------------------------------------------------------------------------- -{ - if (inContextType == MWContextBiff - || inContextType == MWContextSearch - || inContextType == MWContextAddressBook - || inContextType == MWContextMailFilters) - return; // no prefs required for biff. - -#ifdef HAVE_SEPARATE_SMTP_USERNAME_PREF - //if (we are using POP) - // ThrowUnlessPrefSet("mail.pop_name",PREF_Pop3ID); - - ThrowUnlessPrefSet("mail.smtp_name", PREF_Pop3ID); -#else - // temporary code while the backend is still using pop_name for smtp_name - if ( !IsPrefSet("mail.pop_name") ) - { - char *smtpName = NULL; - - if (PREF_CopyCharPref("mail.smtp_name", &smtpName) == PREF_NOERROR) - { - int prefError = PREF_SetCharPref("mail.pop_name", smtpName); - Assert_(prefError == PREF_NOERROR || prefError == PREF_VALUECHANGED); - } - - XP_FREEIF(smtpName); - } -#endif - - if (!IsPrefSet("network.hosts.pop_server") && !IsPrefSet("network.hosts.imap_servers")) - AlertPrefAndThrow(PREF_PopHost); - // OK, she has the basic stuff. Now for the fancy stuff. I know it's plain wrong - // to have a switch like this in an object-oriented world, but time is of the essence. - switch (inContextType) - { - case MWContextNews: // A news reader window - case MWContextNewsMsg: // A window to display a news msg - ThrowUnlessPrefSet( - "network.hosts.nntp_server", - PREF_NewsHost); - break; - case MWContextMessageComposition: // A news-or-mail message editing window - ThrowUnlessPrefSet( - "network.hosts.smtp_server", - PREF_SMTPHost); - ThrowUnlessPrefSet( - "mail.identity.useremail", - PREF_EmailAddress); - break; - } -} // CMailNewsContext::ThrowUnlessPrefsSet - -//---------------------------------------------------------------------------------------- -/* static */ MSG_Master* CMailNewsContext::GetMailMaster() -//---------------------------------------------------------------------------------------- -{ - if (!sMailMaster) - { - sMailMaster = MSG_InitializeMail(GetMailPrefs()); - ThrowIfNULL_(sMailMaster); - } - return sMailMaster; -} - -/* -//---------------------------------------------------------------------------------------- -void CMailNewsContext::DoProgress(const char* message, int level) -//---------------------------------------------------------------------------------------- -{ - StatusInfo info; // constructor zeroes fields - info.message = message; - info.level = level; - BroadcastMessage(CProgressBroadcaster::msg_StatusText, &info); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsContext::DoSetProgressBarPercent(int32 percent) -//---------------------------------------------------------------------------------------- -{ - StatusInfo info; // constructor zeroes fields - info.percent = percent; - BroadcastMessage(CProgressBroadcaster::msg_StatusPercent, &info); -} -//---------------------------------------------------------------------------------------- -void CMailNewsContext::AllConnectionsComplete() -//---------------------------------------------------------------------------------------- -{ - CNSContext::AllConnectionsComplete(); - StatusInfo info; // constructor zeroes fields - BroadcastMessage(CProgressBroadcaster::msg_StatusText, &info); - BroadcastMessage(CProgressBroadcaster::msg_StatusPercent, &info); - BroadcastMessage(CProgressBroadcaster::msg_StatusComplete, &info); -} -*/ - -//---------------------------------------------------------------------------------------- -/* static */ MSG_Prefs* CMailNewsContext::GetMailPrefs() -//---------------------------------------------------------------------------------------- -{ - if (!sMailPrefs) - { - sMailPrefs = MSG_CreatePrefs(); - ThrowIfNULL_(sMailPrefs); - FSSpec mailFolder = CPrefs::GetFolderSpec(CPrefs::MailFolder); - char* mailFolderPath = CFileMgr::EncodedPathNameFromFSSpec(mailFolder, true); - - MSG_SetFolderDirectory(sMailPrefs, mailFolderPath); - XP_FREE(mailFolderPath); - } - return sMailPrefs; -} - -//---------------------------------------------------------------------------------------- -char* CMailNewsContext::PromptWithCaption( - const char* inTitleBarText, - const char* inMessage, - const char* inDefaultText) -//---------------------------------------------------------------------------------------- -{ - char* result = NULL; - CStr255 mesg(inMessage), ioString(inDefaultText); - mesg = NET_UnEscape(mesg); - - uint8 maxLength; - switch (GetCurrentCommand()) - { - case cmd_RenameFolder: - case cmd_NewFolder: - maxLength = 27; - break; - default: - maxLength = 255; - break; - } - - mWasPromptOkay = UStdDialogs::AskStandardTextPrompt( - inTitleBarText, mesg, ioString, NULL, NULL, maxLength ); - - if ( mWasPromptOkay ) - { - if (ioString.Length() > 0) - { - if ( GetCurrentCommand() == cmd_NewFolder || - GetCurrentCommand() == cmd_RenameFolder ) - { - ioString = NET_UnEscape(ioString); // make sure the path... - char * temp = NET_Escape(ioString, URL_PATH); // ...is fully escaped - if (temp) - { - ioString = temp; - XP_FREE(temp); - } - } - - result = (char*)XP_STRDUP((const char*)ioString); - } - } - - // If result is null then set as canceled - if ( !result ) - { - mWasPromptOkay = false; - SetCurrentCommand(cmd_Nothing); - } - return result; -} - -//---------------------------------------------------------------------------------------- -void CMailNewsContext::NoMoreUsers() -//---------------------------------------------------------------------------------------- -{ - Inherited::NoMoreUsers(); -#if 0 - // CNSContext::NoMoreUsers has so much unnecessary stuff in it now, that - // we have to AVOID calling it. We don't have mocha, images, layers, or any of that - // stuff. All we have is session history. - MWContext* cx = (MWContext*)*this; - LSharable::NoMoreUsers(); // which says "delete this". - cx->fe.newContext = nil; // prevent callbacks (and crashes). -//#if DEBUG - // Make sure we assert instead of crashing. - CNSContextCallbacks* theCallbacks = CNSContextCallbacks::GetContextCallbacks(); - Assert_(theCallbacks != NULL); - cx->funcs = &(theCallbacks->GetInternalCallbacks()); -//#endif -#endif // 0 -} - -//---------------------------------------------------------------------------------------- -void CMailNewsContext::SwitchLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat) -//---------------------------------------------------------------------------------------- -{ - Inherited::SwitchLoadURL(inURL, inOutputFormat); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsContext::AllConnectionsComplete() -//---------------------------------------------------------------------------------------- -{ - // Note: since this might lead to deletion of our host window (eg, a progress context), - // we might lose all our users after broadcasting here. On the other hand, we may be - // called from our destructor, in which case making a StSharer here led to - // double deletion on exit (when StSharer goes out of scope). - // The solution? Don't do anything if we know we are in a destruction sequence. - if (GetUseCount() <= 0) - return; - StSharer theShareLock(this); - Inherited::AllConnectionsComplete(); -} // CMailNewsContext::AllConnectionsComplete diff --git a/mozilla/cmd/macfe/MailNews/CMailNewsContext.h b/mozilla/cmd/macfe/MailNews/CMailNewsContext.h deleted file mode 100644 index 625c23bedeb..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailNewsContext.h +++ /dev/null @@ -1,90 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailNewsContext.h - -#pragma once - -// XP -#include "msgcom.h" - -// MacFE - -#include "CNSContext.h" - -//====================================== -class CMailNewsContext -//====================================== -: public CNSContext -{ -private: - typedef CNSContext Inherited; -public: - - CMailNewsContext(MWContextType inContextType = MWContextMail); - virtual ~CMailNewsContext(); - -// Overrides -public: -// virtual void DoProgress(const char* message, int level); // 1 called by netlib -// virtual void DoSetProgressBarPercent(int32 percent); - -// Safe and guaranteed access -protected: - static MSG_Prefs* GetMailPrefs(); -public: - static MSG_Master* GetMailMaster(); - - // This is for offline/online support. - // If mail/news isn't up and running, we shouldn't call GetMailMaster. - // This allows us to determine if we've already allocated the MSG_Master - static Boolean HaveMailMaster() - { return sMailMaster != NULL; } - static Boolean UserHasNoLocalInbox(); - - // Prompt callback support - virtual char* PromptWithCaption( - const char* inTitleBarText, - const char* inMessage, - const char* inDefaultText); - virtual void SwitchLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat); - virtual void AllConnectionsComplete(); - Boolean GetWasPromptOkay() { return mWasPromptOkay; } - // LSharable - virtual void NoMoreUsers(); - static void ThrowUnlessPrefsSet(MWContextType inContextType); - static void AlertPrefAndThrow(PREF_Enum inPrefPaneSelector); - static void ThrowIfNoLocalInbox(); - -protected: - static Boolean IsPrefSet(const char* inPrefKey); - static Boolean ThrowUnlessPrefSet( - const char* inPrefKey, - PREF_Enum inPrefPaneSelector); - -// Data -private: - static MSG_Prefs* sMailPrefs; - static MSG_Master* sMailMaster; - static Int32 sMailMasterRefCount; - Boolean mWasPromptOkay; -}; // class CMailNewsContext diff --git a/mozilla/cmd/macfe/MailNews/CMailNewsWindow.cp b/mozilla/cmd/macfe/MailNews/CMailNewsWindow.cp deleted file mode 100644 index 607dbcc7749..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailNewsWindow.cp +++ /dev/null @@ -1,449 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailNewsWindow.cp - -#include "CMailNewsWindow.h" - -#include "MailNewsgroupWindow_Defines.h" -#include "CGrayBevelView.h" -#include "CProgressListener.h" -#include "CMailNewsContext.h" -#include "LTableViewHeader.h" -#include "CMailFlexTable.h" -#include "CMessageFolderView.h" -#include "CPrefsDialog.h" -#include "CPatternButton.h" -#include "URobustCreateWindow.h" -#include "CSpinningN.h" -#include "CProxyPane.h" -#include "CDragBarContainer.h" -#include "UDeferredTask.h" -#include "CWindowMenu.h" - -#include "resgui.h" -#include "macutil.h" -// helper function used by CThreadWindow and CMessageWindow to set the default action of -// the folder button. -#include "prefapi.h" - - - -#pragma mark - - -//====================================== -// class CMailNewsWindow -//====================================== - -const char* Pref_MailShowToolbar = "mailnews.chrome.show_toolbar"; -const char* Pref_MailShowLocationBar = "mailnews.chrome.show_url_bar"; - -//---------------------------------------------------------------------------------------- -CMailNewsWindow::CMailNewsWindow(LStream *inStream, DataIDT inWindowType) -//---------------------------------------------------------------------------------------- -: Inherited(inStream, inWindowType) -, CSaveWindowStatus(this) -, mProgressListener(NULL) -, mMailNewsContext(NULL) -{ - mToolbarShown[LOCATION_TOOLBAR] = false; // set to true in base class -} - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::DoDefaultPrefs() -//---------------------------------------------------------------------------------------- -{ - CPrefsDialog::EditPrefs(CPrefsDialog::eExpandMailNews); -} - - -//---------------------------------------------------------------------------------------- -CMailNewsWindow::~CMailNewsWindow() -//---------------------------------------------------------------------------------------- -{ - if (mMailNewsContext) - mMailNewsContext->RemoveUser(this); - delete mProgressListener; -} - -//---------------------------------------------------------------------------------------- -const char* CMailNewsWindow::GetLocationBarPrefName() const -//---------------------------------------------------------------------------------------- -{ - return Pref_MailShowLocationBar; -} - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::ReadGlobalDragbarStatus() - // Unfortunately, the visibility of the drag bars is determined in several ways, all - // of which must be kept in synch. These ways include, but are not limited to, - // the PPob resource (through the visible flag), the saved window status (through - // Read/WriteWindowStatus and Save/RestorePlace etc) and the preferences, which are - // used to save the values of mToolbarShown. -//---------------------------------------------------------------------------------------- -{ - XP_Bool value; - if (PREF_GetBoolPref(Pref_MailShowToolbar, &value) == PREF_NOERROR) - mToolbarShown[MESSAGE_TOOLBAR] = value; - if (PREF_GetBoolPref(GetLocationBarPrefName(), &value) == PREF_NOERROR) - mToolbarShown[LOCATION_TOOLBAR] = value; -} // CMailNewsWindow::ReadGlobalDragbarStatus - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::WriteGlobalDragbarStatus() -//---------------------------------------------------------------------------------------- -{ - PREF_SetBoolPref(Pref_MailShowToolbar, mToolbarShown[MESSAGE_TOOLBAR]); - PREF_SetBoolPref(GetLocationBarPrefName(), mToolbarShown[LOCATION_TOOLBAR]); -} // CMailNewsWindow::WriteGlobalDragbarStatus - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::FinishCreateSelf() -//---------------------------------------------------------------------------------------- -{ - Inherited::FinishCreateSelf(); - SetAttribute(windAttr_DelaySelect); - // should be in resource, but there's a resource freeze. - try - { - //================================================================================ - // WARNING! WARNING! WARNING! - // CThreadWindow::FinishCreateSelf() does not call CMailNewsWindow::FinishCreateSelf. - // So if you add any new stuff here, you have to add it there, too. - //================================================================================ - - ReadGlobalDragbarStatus(); - - // Let there be a mail-news context - mMailNewsContext = CreateContext(); - StSharer theLock(mMailNewsContext); - // Let there be a progress listener, placed in my firmament, - // which shall listen to the mail-news context - if (mProgressListener) - mMailNewsContext->AddListener(mProgressListener); - else - mProgressListener = new CProgressListener(this, mMailNewsContext); - ThrowIfNULL_(mProgressListener); - // The progress listener should be "just a bit" lazy during network activity - // and "not at all" at idle time to display the URLs pointed by the mouse cursor. - mProgressListener->SetLaziness(CProgressListener::lazy_NotAtAll); - mMailNewsContext->AddListener(mProgressListener); - mMailNewsContext->AddUser(this); - CMailFlexTable* table = GetActiveTable(); - if (table) - { - SetLatentSub(table); - mMailNewsContext->AddListener(table); // listen for all connections complete. - } - CSpinningN* theN = dynamic_cast(FindPaneByID(CSpinningN::class_ID)); - if (theN) - mMailNewsContext->AddListener(theN); - } - catch (...) { - throw; - } - // And behold, he saw that it was good. - CSaveWindowStatus::FinishCreateWindow(); -} // CMailNewsWindow::FinishCreateSelf - -//---------------------------------------------------------------------------------------- -CNSContext* CMailNewsWindow::CreateContext() const -//---------------------------------------------------------------------------------------- -{ - CMailNewsContext* result = new CMailNewsContext(); - FailNIL_(result); - return result; -} //CMailNewsWindow::CreateContext - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::AboutToClose() -//---------------------------------------------------------------------------------------- -{ - //================================================================================ - // WARNING! WARNING! WARNING! - // CThreadWindow::AboutToClose() does not call CMailNewsWindow::AboutToClose. - // So if you add any new stuff here, you have to add it there, too. - //================================================================================ - CSaveWindowStatus::AttemptCloseWindow(); // Do this first: uses table - WriteGlobalDragbarStatus(); - // Bug fix: must delete the pane before killing the context, because - // the destructor of the pane references the context when it cleans up. - CMailFlexTable* t = GetActiveTable(); - if (t) - { - if (mMailNewsContext) - mMailNewsContext->RemoveListener(t); // bad time to listen for all connections complete. - delete t; - } -} // CMailNewsWindow::AboutToClose - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::AttemptClose() -//---------------------------------------------------------------------------------------- -{ - CDeferredCloseTask::DeferredClose(this); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::DoClose() -//---------------------------------------------------------------------------------------- -{ - AboutToClose(); - Inherited::DoClose(); -} - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsWindow::AttemptQuitSelf(Int32 /* inSaveOption */) -// Derived classes should be careful to call DeferredClose if they override this fn. -//---------------------------------------------------------------------------------------- -{ - CDeferredCloseTask::DeferredClose(this); - return true; -} - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::ReadWindowStatus(LStream *inStatusData) -//---------------------------------------------------------------------------------------- -{ - CSaveWindowStatus::ReadWindowStatus(inStatusData); - CDragBarContainer* dragContainer = (CDragBarContainer*)FindPaneByID('DbCt'); - if (dragContainer && inStatusData) - dragContainer->RestorePlace(inStatusData); - - // CThreadWindow does this now - //CMailFlexTable* table = GetActiveTable(); - //if (table && inStatusData) - // table->GetTableHeader()->ReadColumnState(inStatusData); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::WriteWindowStatus(LStream *outStatusData) -//---------------------------------------------------------------------------------------- -{ - CSaveWindowStatus::WriteWindowStatus(outStatusData); - CDragBarContainer* dragContainer = (CDragBarContainer*)FindPaneByID('DbCt'); - if (dragContainer && outStatusData) - dragContainer->SavePlace(outStatusData); - - // CThreadWindow does this now - //CMailFlexTable* table = GetActiveTable(); - //if (table && outStatusData) - // table->GetTableHeader()->WriteColumnState(outStatusData); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//---------------------------------------------------------------------------------------- -{ - outUsesMark = false; - - switch (inCommand) { - - case cmd_ToggleToolbar: - outEnabled = true; - if (mToolbarShown[MESSAGE_TOOLBAR]) - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, HIDE_MESSAGE_TOOLBAR_STRING); - else - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, SHOW_MESSAGE_TOOLBAR_STRING); - break; - - case cmd_ToggleLocationBar: - outEnabled = true; - if (mToolbarShown[LOCATION_TOOLBAR]) - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, HIDE_LOCATION_TOOLBAR_STRING); - else - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, SHOW_LOCATION_TOOLBAR_STRING); - break; - case cmd_ShowLocationBar: - outEnabled = !mToolbarShown[LOCATION_TOOLBAR]; - break; - case cmd_HideLocationBar: - outEnabled = mToolbarShown[LOCATION_TOOLBAR]; - break; - default: - CNetscapeWindow::FindCommandStatus( - inCommand, outEnabled, outUsesMark, outMark, outName); - } -} // CMailNewsWindow::FindCommandStatus - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsWindow::ObeyCommand( - CommandT inCommand, - void *ioParam) -//---------------------------------------------------------------------------------------- -{ - Boolean cmdHandled = false; - switch (inCommand) { - - case cmd_ToggleToolbar: - ToggleDragBar(cMessageToolbar, MESSAGE_TOOLBAR, Pref_MailShowToolbar); - cmdHandled = true; - break; - - case cmd_ShowLocationBar: - case cmd_HideLocationBar: - if (mToolbarShown[LOCATION_TOOLBAR] != (inCommand == cmd_ShowLocationBar)) - ToggleDragBar(cMailNewsLocationToolbar, LOCATION_TOOLBAR, GetLocationBarPrefName()); - cmdHandled = true; - break; - - case cmd_ToggleLocationBar: - ToggleDragBar(cMailNewsLocationToolbar, LOCATION_TOOLBAR, GetLocationBarPrefName()); - cmdHandled = true; - break; - - default: - cmdHandled = CNetscapeWindow::ObeyCommand(inCommand, ioParam); - - } - - return cmdHandled; -} // CMailNewsWindow::ObeyCommand - -#pragma mark - - -//====================================== -// class CMailNewsFolderWindow -//====================================== - -//---------------------------------------------------------------------------------------- -/* static */ CMailNewsFolderWindow* CMailNewsFolderWindow::FindAndShow( - Boolean inMakeNew, - CommandT inCommand) -// Handle the menu command that creates/shows/selects the MailNews window. -// Currently there can only be one of these. -//---------------------------------------------------------------------------------------- -{ - CMailNewsFolderWindow* result = NULL; - try - { - CMailNewsContext::ThrowUnlessPrefsSet(MWContextMail); - if (inCommand == cmd_NewsGroups) - CMailNewsContext::ThrowUnlessPrefsSet(MWContextNews); - CWindowIterator iter(WindowType_MailNews); - iter.Next(result); - if (!result && inMakeNew) - { - result = dynamic_cast( - URobustCreateWindow::CreateWindow(res_ID, LCommander::GetTopCommander()) - ); - ThrowIfNULL_(result); - } - if (result) - { - result->Show(); - result->Select(); - } - if (inCommand) - { - CMessageFolderView* folderView = (CMessageFolderView*)result->GetActiveTable(); - if (folderView) - { - switch (inCommand) - { - case cmd_NewsGroups: // Select first news host - case cmd_MailNewsFolderWindow: // Select first mail host - folderView->SelectFirstFolderWithFlags( - inCommand == cmd_NewsGroups - ? MSG_FOLDER_FLAG_NEWS_HOST - : MSG_FOLDER_FLAG_MAIL); - break; - default: - folderView->ObeyCommand(inCommand, nil); - } - } - } - } - catch( ... ) - { - } - return result; -} - -//---------------------------------------------------------------------------------------- -CMailNewsFolderWindow::CMailNewsFolderWindow(LStream *inStream) -//---------------------------------------------------------------------------------------- -: CMailNewsWindow(inStream, WindowType_MailNews) -{ -} - -//---------------------------------------------------------------------------------------- -CMailNewsFolderWindow::~CMailNewsFolderWindow() -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CMailNewsFolderWindow::FinishCreateSelf() -//---------------------------------------------------------------------------------------- -{ - Inherited::FinishCreateSelf(); - CMessageFolderView* list = (CMessageFolderView*)GetActiveTable(); - Assert_(list); - LCaption* locationCaption = (LCaption*)FindPaneByID('LCap'); - if (locationCaption && list) - { - CStr255 tempString; - list->GetLongWindowDescription(tempString); - locationCaption->SetDescriptor(tempString); - CProxyPane* proxy = dynamic_cast(FindPaneByID(CProxyPane::class_ID)); - if (proxy) - { - proxy->ListenToMessage(msg_NSCDocTitleChanged, (char*)tempString); - proxy->SetIconIDs(15393, 15393); - } - } - list->LoadFolderList(mMailNewsContext); - UReanimator::LinkListenerToControls((CMailFlexTable*)list, this, res_ID); -} // CMailNewsWindow::FinishCreateSelf - -//---------------------------------------------------------------------------------------- -void CMailNewsFolderWindow::CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const -//---------------------------------------------------------------------------------------- -{ - LWindow::CalcStandardBoundsForScreen(inScreenBounds, outStdBounds); - Rect contRect = UWindows::GetWindowContentRect(mMacWindowP); - - outStdBounds.left = contRect.left; - outStdBounds.right = contRect.right; -} - -//---------------------------------------------------------------------------------------- -UInt16 CMailNewsFolderWindow::GetValidStatusVersion(void) const -//---------------------------------------------------------------------------------------- -{ - return 0x0113; -} - -//---------------------------------------------------------------------------------------- -CMailFlexTable* CMailNewsFolderWindow::GetActiveTable() -// Get the currently active table in the window. The active table is the table in -// the window that the user considers to be receiving input. -//---------------------------------------------------------------------------------------- -{ - return dynamic_cast(FindPaneByID('Flst')); -} diff --git a/mozilla/cmd/macfe/MailNews/CMailNewsWindow.h b/mozilla/cmd/macfe/MailNews/CMailNewsWindow.h deleted file mode 100644 index 013a78f182f..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailNewsWindow.h +++ /dev/null @@ -1,125 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailNewsWindow.h - -#pragma once - -// Mac UI Lib -#include "CNetscapeWindow.h" -#include "CSaveWindowStatus.h" - -class CProgressListener; -class CMailNewsContext; -class CMailNewsFolderContext; -class CMailFlexTable; - -const PaneIDT cMessageToolbar = 'BBar'; -const PaneIDT cMailNewsLocationToolbar = 'BnBr'; - - -//====================================== -class CMailNewsWindow : public CNetscapeWindow, public CSaveWindowStatus -// Base class for all content windows in mail. -// implements the progress bar and the status line etc. -//====================================== -{ -private: - typedef CNetscapeWindow Inherited; // trick suggested by the ANSI committee. - -protected: - // Indices into mToolbarShown for tracking visibility of toolbars - enum { MESSAGE_TOOLBAR, LOCATION_TOOLBAR }; - CMailNewsWindow(LStream *inStream, DataIDT inWindowType); - -public: - virtual ~CMailNewsWindow(); - - virtual CNSContext* CreateContext() const; // allow each window to create its own - virtual void FinishCreateSelf(); - virtual CNSContext* GetWindowContext() const { return (CNSContext*)mMailNewsContext; } - - // Return the currently active table in the window, nil if none. - // Can't be const, because derived classes need to call FindPaneByID(), which isn't. - virtual CMailFlexTable* GetActiveTable() { return nil; } - virtual CMailFlexTable* GetSearchTable() { return GetActiveTable(); } - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam = nil); - - //----------------------------------- - // Window closing and saving - overrides for CSaveWindowStatus - //----------------------------------- -public: - virtual void AttemptClose(); - virtual Boolean AttemptQuitSelf(Int32 /* inSaveOption */); - virtual void DoClose(); - CProgressListener* GetProgressListener() {return mProgressListener;} -protected: - virtual void AboutToClose(); // place to put common code from [Attempt|Do]Close() - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual void ReadGlobalDragbarStatus(); - virtual void WriteGlobalDragbarStatus(); - virtual const char* GetLocationBarPrefName() const; - - //----------------------------------- - // Preferences - //----------------------------------- - virtual void DoDefaultPrefs(); - - //----------------------------------- - //data - //----------------------------------- -protected: - CProgressListener* mProgressListener; - CNSContext* mMailNewsContext; - -}; - -//====================================== -class CMailNewsFolderWindow : public CMailNewsWindow -//====================================== -{ -private: - typedef CMailNewsWindow Inherited; -public: - enum { class_ID = 'mnWN', res_ID = 10507}; - - virtual ~CMailNewsFolderWindow(); - CMailNewsFolderWindow(LStream *inStream); - virtual ResIDT GetStatusResID(void) const { return res_ID; } - virtual UInt16 GetValidStatusVersion(void) const; - - virtual void FinishCreateSelf(); - virtual void CalcStandardBoundsForScreen(const Rect &inScreenBounds, - Rect &outStdBounds) const; - - // Return the currently active table in the window, nil if none - static CMailNewsFolderWindow* FindAndShow(Boolean inMakeNew, CommandT inCommand = 0); - virtual CMailFlexTable* GetActiveTable(); -}; - diff --git a/mozilla/cmd/macfe/MailNews/CMailProgressWindow.cp b/mozilla/cmd/macfe/MailNews/CMailProgressWindow.cp deleted file mode 100644 index ab51d74006b..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailProgressWindow.cp +++ /dev/null @@ -1,513 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailProgressWindow.cp - -#include "CMailProgressWindow.h" - -#include "MailNewsCallbacks.h" -#include "URobustCreateWindow.h" -#include "CMailNewsContext.h" -#include "PascalString.h" -#include "CProgressBar.h" -#include "COffscreenCaption.h" -#include "uapp.h" // to check if we're quitting. -#include "CWindowMenu.h" -#include "prefapi.h" -#include "CNetscapeWindow.h" -#include "UOffline.h" -#include "StSetBroadcasting.h" - -const ResIDT cOfflineListID = 16010; -const Int16 cOfflineStrIndex = 3; - - -//====================================== -class CDownloadListener : public CMailCallbackListener -// All Connections Complete is not always sent by operations within msglib. Therefore, -// we must listen for the MSG_PaneProgressDone message via the pane-changed mechanism, too. -// So the progress window "has a" CDownloadListener, which has authority to force the -// progress window to close itself. -//====================================== -{ -public: - CDownloadListener( - CMailProgressWindow* inWindow, MSG_Pane* inPane); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); // must always be supported. - CMailProgressWindow* mProgressWindow; -}; // class CDownloadListener - -//----------------------------------- -CDownloadListener::CDownloadListener(CMailProgressWindow* inWindow, MSG_Pane* inPane) -//----------------------------------- -: mProgressWindow(inWindow) -{ - SetPane(inPane); -} - -//----------------------------------- -void CDownloadListener::PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -//----------------------------------- -{ -#pragma unused (inPane) -#pragma unused (value) - if (inNotifyCode == MSG_PaneProgressDone - || inNotifyCode == MSG_PaneNotifySelectNewFolder // Bug #106165 - || inNotifyCode == MSG_PaneNotifyNewFolderFailed // '' - || inNotifyCode == MSG_PaneNotifyCopyFinished) // Bug #113142 and #113860 - { - mProgressWindow->ListenToMessage(msg_NSCAllConnectionsComplete, nil); - } -} - -//====================================== -// class CMailProgressWindow -//====================================== - -CMailProgressWindow* CMailProgressWindow::sModalMailProgressWindow = nil; -// if you initiate a get mail command, you can't start getting mail again before the -// first CMailProgressWindow closes -Boolean CMailProgressWindow::sGettingMail = false; - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::CreateWindow( - ResIDT inResID, - MSG_Pane* inPane, - const CStr255& inCommandName) -//----------------------------------- -{ - CMailProgressWindow* progressWindow = nil; - try - { - MSG_SetFEData(inPane, CMailCallbackManager::Get()); - progressWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(inResID, LCommander::GetTopCommander())); - ThrowIfNULL_(progressWindow); - progressWindow->SetWindowContext(ExtractNSContext(MSG_GetContext(inPane))); - // the window will be shown after a decent interval. - if (inCommandName.Length() > 0) - progressWindow->SetDescriptor(inCommandName); - progressWindow->ListenToPane(inPane); - } - catch (...) - { - delete progressWindow; - throw; - } - return progressWindow; -} // CMailProgressWindow::CreateWindow - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::CreateIndependentWindow( - ResIDT inResID, - MSG_Pane* inPane, - const CStr255& inCommandName, - UInt16 inDelay) -// This is private to the class. The pane passed in must have been made by this class. -//----------------------------------- -{ - CMailProgressWindow* progressWindow = CreateWindow(inResID, inPane, inCommandName); - progressWindow->mPane = inPane; // This is the sign that we made it. - progressWindow->SetDelay(inDelay); - if (inDelay == 0) - progressWindow->Show(); - return progressWindow; -} // CMailProgressWindow::CreateModelessWindow - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::CreateModalParasite( - ResIDT inResID, - MSG_Pane* inPane, - const CStr255& inCommandName) -//----------------------------------- -{ - sModalMailProgressWindow = CreateWindow(inResID, inPane, inCommandName); - return sModalMailProgressWindow; -} // CMailProgressWindow::CreateModalParasite - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::ObeyMessageLibraryCommand( - ResIDT inResID, - MSG_Pane* inPane, - MSG_CommandType inCommand, - const CStr255& inCommandName, - MSG_ViewIndex* inSelectedIndices, - int32 inNumIndices) -//----------------------------------- -{ - CMailProgressWindow* progressWindow = nil; - try - { - CMailNewsContext* context = new CMailNewsContext(MWContextMailNewsProgress); - MSG_Pane* pane = MSG_CreateProgressPane(*context, CMailNewsContext::GetMailMaster(), inPane); - ThrowIfNULL_(pane); - progressWindow = CreateIndependentWindow(inResID, pane, inCommandName); - progressWindow->mParentPane = inPane; - - // remember if we're getting mail or news... - progressWindow->mCommandBeingServiced = inCommand; - // only allowed to get mail one dialog at a time... (in other words, you can't - // have two of these dialogs open at the same time both of them getting mail) - if (inCommand == MSG_GetNewMail) - { - sGettingMail = true; - // Note: for MSG_GetNewMail, we get the pane notification CopyFinished when - // messages are filtered, and later we get allconnectionscomplete from the - // context. So avoid closing the window too early by turning off pane - // notifications. - progressWindow->ListenToPane(nil); - - // This is getting messy. I think CDownloadListener should have a new built-in - // data member, which stores the notify code which it will use to destroy the window. - // eg, for a file copy, set this to MSG_PaneNotifyCopyFinished, etc etc. The problem - // now is that some operations, like GetNewMail, send one of these AS WELL AS all - // connections complete. Whereas some operations send only one or the other of these. - } - - ::MSG_Command(pane, inCommand, inSelectedIndices, inNumIndices); - } - catch (...) - { - delete progressWindow; - throw; - } - - return progressWindow; -} // CMailProgressWindow::ObeyMessageLibraryCommand - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::CleanUpFolders() -//----------------------------------- -{ - CMailProgressWindow* progressWindow = nil; - try - { - CMailNewsContext* context = new CMailNewsContext(MWContextMailNewsProgress); - MSG_Pane* pane = MSG_CreateFolderPane(*context, CMailNewsContext::GetMailMaster()); - ThrowIfNULL_(pane); - - progressWindow = CreateIndependentWindow(res_ID_modeless, pane, ""); - progressWindow->mCommandBeingServiced = (MSG_CommandType)'ClnF'; - MSG_CleanupFolders(pane); - // Of course, that should be "CleanUpFolders" - // Sigh. It's asynchronous. It works in the background. But we may be trying to quit. - Boolean quitting = (CFrontApp::GetApplication()->GetState() == programState_Quitting); - if (quitting) - { - do - { - // progress call will hide wind when done. - // Or user will cancel (and close and delete). This will set mPane to nil. - CFrontApp::GetApplication()->ProcessNextEvent(); - } while (progressWindow->IsVisible() && progressWindow->mPane == pane); - if (progressWindow->mPane == pane) - progressWindow->DoClose(); // close it if it's not closed already - } - - } - catch (...) - { - delete progressWindow; - throw; - } - return progressWindow; -} // CMailProgressWindow::CleanUpFolders - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::SynchronizeForOffline( - const CStr255& inCommandName, - ResIDT inResID) -//----------------------------------- -{ - CMailProgressWindow* progressWindow = nil; - try - { - // Read the prefs - XP_Bool getNews, getMail, sendMail, getDirectories, goOffline; - PREF_GetBoolPref("offline.download_discussions", &getNews); - PREF_GetBoolPref("offline.download_mail", &getMail); - PREF_GetBoolPref("offline.download_messages", &sendMail); - PREF_GetBoolPref("offline.download_directories", &getDirectories); - PREF_GetBoolPref("offline.offline_after_sync", &goOffline); - - // Synchronize - CMailNewsContext* context = new CMailNewsContext(MWContextMailNewsProgress); - MSG_Pane* pane = MSG_CreateFolderPane(*context, CMailNewsContext::GetMailMaster()); - ThrowIfNULL_(pane); - progressWindow = CreateIndependentWindow(inResID, pane, inCommandName); - ::MSG_SynchronizeOffline(CMailNewsContext::GetMailMaster(), pane, - getNews, getMail, sendMail, getDirectories, goOffline); - } - catch (...) - { - delete progressWindow; - throw; - } - return progressWindow; -} // CMailProgressWindow::SynchronizeForOffline - -//----------------------------------- -/*static*/ CMailProgressWindow* CMailProgressWindow::ToggleOffline( - ResIDT inResID) -//----------------------------------- -{ - CMailProgressWindow* progressWindow = nil; - try - { - CMailNewsContext* context = new CMailNewsContext(MWContextMailNewsProgress); - MSG_Pane* pane = MSG_CreateFolderPane(*context, CMailNewsContext::GetMailMaster()); - ThrowIfNULL_(pane); - progressWindow = CreateIndependentWindow(inResID, pane, "\p", 60); - ::MSG_GoOffline(CMailNewsContext::GetMailMaster(), pane, false, false, false, false); - - // force a menu update to toggle the menu command name - LCommander::SetUpdateCommandStatus(true); - - // display a status msg in all windows - LStr255 offlineString(""); - if (!UOffline::AreCurrentlyOnline()) - offlineString = LStr255(cOfflineListID, cOfflineStrIndex); - CNetscapeWindow::DisplayStatusMessageInAllWindows(offlineString); - } - catch (...) - { - delete progressWindow; - throw; - } - return progressWindow; -} // CMailProgressWindow::ToggleOffline - -//----------------------------------- -/*static*/ MSG_Pane* CMailProgressWindow::JustGiveMeAPane( - const CStr255& inCommandName, - MSG_Pane* inParentPane) -//----------------------------------- -{ - CMailProgressWindow* progressWindow = nil; - MSG_Pane* pane = nil; - try - { - CMailNewsContext* context = new CMailNewsContext(MWContextMailNewsProgress); - pane = ::MSG_CreateProgressPane( - *context, CMailNewsContext::GetMailMaster(), inParentPane); - ThrowIfNULL_(pane); - progressWindow = CreateIndependentWindow(res_ID_modeless, pane, inCommandName); - } - catch (...) - { - delete progressWindow; - throw; - } - return pane; -} // CMailProgressWindow::GoOffline - -//----------------------------------- -CMailProgressWindow::CMailProgressWindow(LStream* inStream) -//----------------------------------- -: CDownloadProgressWindow(inStream) -, mStartTime(::TickCount()) -, mCallbackListener(nil) -, mLastCall(0) -, mPane(nil) -, mParentPane(nil) -, mCancelCallback(nil) -{ - *inStream >> mDelay; - - // Don't list these windows in the window menu (unfortunately, the constructor - // of CMediatedWindow has already added us at this point). So tell Mr. WindowMenu - // that we're dead, dead, dead. Do this by calling Hide(), which has the side-effect - // of causing a broadcast that we've disappeared. The window is currently invisible - // anyway. - Hide(); - //CWindowMenu::sWindowMenu->ListenToMessage(msg_WindowDisposed, this); - - // Watch out for commands that never call us back: we won't have cleaned up - // the previous window until now... - delete sModalMailProgressWindow; - // this static is reassigned in the routine that makes modal ones. -} // CMailProgressWindow::CMailProgressWindow - -//----------------------------------- -CMailProgressWindow::~CMailProgressWindow() -//----------------------------------- -{ - if (sModalMailProgressWindow == this) - sModalMailProgressWindow = nil; - - // if we're the window servicing the get mail request then after we're destroyed, - // someone else can get issue a get mail command too - if ((mCommandBeingServiced == MSG_GetNewMail) && sGettingMail) - sGettingMail = false; - - delete mCallbackListener; - mCallbackListener = nil; - if (mPane) // ie, I made it... - { - // clear mPane so e won't come into this block again. - MSG_Pane* temp = mPane; - mPane = nil; - - // Now let the back end run its course - CNSContext* context = GetWindowContext(); - if (context) - XP_InterruptContext((MWContext*)*context); - ::MSG_DestroyPane(temp); - - // When we delete a progress pane it can affect CommandStatus for commands like GetMail - // since the window has already been activated, FindCommandStatus needs to be called - SetUpdateCommandStatus( true ); - } -} // CMailProgressWindow::~CMailProgressWindow - -//----------------------------------- -ResIDT CMailProgressWindow::GetStatusResID() const -//----------------------------------- -{ - return res_ID_modal; -} // client must provide! - -//----------------------------------- -UInt16 CMailProgressWindow::GetValidStatusVersion() const -//----------------------------------- -{ - return 0x0001; -} // CDownloadProgressWindow::GetValidStatusVersion - -//----------------------------------- -void CMailProgressWindow::FinishCreateSelf() -//----------------------------------- -{ - Inherited::FinishCreateSelf(); - if (HasAttribute(windAttr_Modal)) - { - Assert_(!sModalMailProgressWindow); - sModalMailProgressWindow = this; - } - StartIdling(); -} // CMailProgressWindow::FinishCreateSelf - -//----------------------------------- -void CMailProgressWindow::ListenToPane(MSG_Pane* inPane) -//----------------------------------- -{ - if (!mCallbackListener) - mCallbackListener = new CDownloadListener(this, inPane); - else - mCallbackListener->SetPane(inPane); -} - -//----------------------------------- -void CMailProgressWindow::SpendTime(const EventRecord&) -//----------------------------------- -{ - UInt32 time = ::TickCount(); - // First time, set the time called. - if (mLastCall == 0) - { - mLastCall = time; - return; - } - // If this is not the first call, but we're not getting tickled, close. - if (time > mStartTime + mDelay * 2 && !IsVisible()) - { - // prevent re-entrancy (DoClose can take time, because of callbacks - // from interrupt context.) - StopRepeating(); - DoClose(); - return; - } - // Normal case. Make sure the barber-pole spins. - if (mBar->GetValue() == CProgressBar::eIndefinite) - mBar->Refresh(); -} // CMailProgressWindow::SpendTime - -//----------------------------------- -void CMailProgressWindow::Show() -//----------------------------------- -{ - // Keep it out of the window menu! - StSetBroadcasting saver(CWindowMediator::GetWindowMediator(), false); - Inherited::Show(); -} - -//----------------------------------- -void CMailProgressWindow::ListenToMessage( - MessageT inMessage, - void* ioParam) -//----------------------------------- -{ - const UInt32 kMinTimeBetweenUpdates = 20; - UInt32 time = ::TickCount(); - if (!IsVisible() // ooh, it's been comfy here, invisible, but maybe there's work... - && inMessage != msg_NSCAllConnectionsComplete // heck, I'm not showing up for this... - && time > mStartTime + mDelay) // I only show up for LONG processes. - Show(); - mLastCall = time; - switch (inMessage) - { - case msg_NSCProgressUpdate: - // Ignore that message in mail/news windows (it's ignored on - // Windows too). Otherwise, the progress bar alternates between - // a percent value and a barber pole. - return; - - case msg_NSCAllConnectionsComplete: - if (mParentPane) - { - // send a fake progress-done call to parent pane. This helps with "get new mail" - // because the inbox has to scroll to display it. - FE_PaneChanged( - mParentPane, - PR_TRUE, // async - MSG_PaneProgressDone, - msg_NSCAllConnectionsComplete); - } - Hide(); // So that on idle we'll close. - // This avoids the base class behavior (calling DoClose()) immediately, - // and instead waits till idle time to close. - mDelay = 0 ; // Don't want to wait a long time to destroy the window - StopListening(); // Don't show ourselves on subsequent messages. - ListenToPane(nil); - return; - case msg_Cancel: - if (mCancelCallback && !mCancelCallback()) // result true means "execute default" - return; - break; - } - Inherited::ListenToMessage(inMessage, ioParam); -} // CMailProgressWindow::ListenToMessage - -//----------------------------------- -void CMailProgressWindow::NoteProgressBegin(const CContextProgress& inProgress) -//----------------------------------- -{ - // Base class will clobber the window title with a null string. Don't do that! - if (inProgress.mAction.length()) - SetDescriptor(CStr255(inProgress.mAction)); - mMessage->SetDescriptor(inProgress.mMessage); - mComment->SetDescriptor(inProgress.mComment); -} // CMailProgressWindow::NoteProgressBegin diff --git a/mozilla/cmd/macfe/MailNews/CMailProgressWindow.h b/mozilla/cmd/macfe/MailNews/CMailProgressWindow.h deleted file mode 100644 index 32bed3ff1cd..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMailProgressWindow.h +++ /dev/null @@ -1,120 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMailProgressWindow.h - -#include "CDownloadProgressWindow.h" - -#include "msgcom.h" - -class CMailCallbackListener; -class CMailNewsContext; -class CStr255; -class CContextProgress; - -//----------------------------------- -class CMailProgressWindow : public CDownloadProgressWindow, public LPeriodical -// This class exists because mail stuff does not get the "progress begin/end/update" calls. -// Also, it has a timer, and shows itself automatically after a short delay. It also -// takes itself down if nobody told it to come down after some time. -//----------------------------------- -{ - private: - typedef CDownloadProgressWindow Inherited; - public: - enum { class_ID = 'MPWd', res_ID_modal = 10526, res_ID_modeless = 10527 }; - //-------- - // static - //-------- - static CMailProgressWindow* CreateModalParasite( - ResIDT inResID, - MSG_Pane* inPane, - const CStr255& inCommandName); - static void RemoveModalParasite() { delete sModalMailProgressWindow; } - static CMailProgressWindow* GetModal() { return sModalMailProgressWindow; } - static CMailProgressWindow* ObeyMessageLibraryCommand( - ResIDT inResID, - MSG_Pane* inPane, - MSG_CommandType inCommand, - const CStr255& inCommandName, - MSG_ViewIndex* inSelectedIndices = nil, - int32 inNumIndices = 0); - static CMailProgressWindow* ToggleOffline( - ResIDT inResID = res_ID_modeless); - static CMailProgressWindow* SynchronizeForOffline( - const CStr255& inCommandName, - ResIDT inResID = res_ID_modeless); - static CMailProgressWindow* CleanUpFolders(); - static Boolean GettingMail () { return sGettingMail; } - - static MSG_Pane* JustGiveMeAPane( - const CStr255& inCommandName, - MSG_Pane* inParentPane = nil); - // creates a MSG_Pane attached to - // a modeless progress window. - //-------- - // non-static - //-------- - CMailProgressWindow(LStream* inStream); - virtual ~CMailProgressWindow(); - virtual ResIDT GetStatusResID() const; // client must provide! - virtual UInt16 GetValidStatusVersion() const; // client must provide! - - virtual void Show(); - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - virtual void NoteProgressBegin(const CContextProgress& inProgress); - - void ListenToPane(MSG_Pane* inPane); - virtual void SpendTime(const EventRecord&); - void SetDelay(UInt16 delay) { mDelay = delay; } - void SetCancelCallback(Boolean (*f)()) { mCancelCallback = f; } - MSG_CommandType GetCommandBeingServiced() const { return mCommandBeingServiced; } - - protected: - - static CMailProgressWindow* CreateWindow( - ResIDT inResID, - MSG_Pane* inPane, - const CStr255& inCommandName); - static CMailProgressWindow* CreateIndependentWindow( - ResIDT inResID, - MSG_Pane* inPane, - const CStr255& inCommandName, - UInt16 inDelay = 0); - virtual void FinishCreateSelf(); - -//------- -// data -//------- - protected: - - UInt32 mStartTime; // in ticks; - UInt16 mDelay; // ditto - CMailCallbackListener* mCallbackListener; - UInt32 mLastCall; // ticks - MSG_Pane* mPane; // only used for the modeless window. - MSG_Pane* mParentPane; // ditto. - Boolean (*mCancelCallback)(); - MSG_CommandType mCommandBeingServiced; // the command we're handling -static Boolean sGettingMail; // true if an instance of us is getting mail -static CMailProgressWindow* sModalMailProgressWindow; -}; // CMailProgressWindow diff --git a/mozilla/cmd/macfe/MailNews/CMessageAttachmentView.cp b/mozilla/cmd/macfe/MailNews/CMessageAttachmentView.cp deleted file mode 100644 index 1847a421a44..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageAttachmentView.cp +++ /dev/null @@ -1,621 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageAttachmentView.cp - -#include "CMessageAttachmentView.h" - -#include "UDebugging.h" -#include "PascalString.h" -#include "UGraphicGizmos.h" -#include "xp_str.h" -#define WANT_ENUM_STRING_IDS // why don't we just have a header that does this? -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS -#include "UDrawingUtils.h" -#include "CMessageView.h" -#include -#include -#include "CSwatchBrokerView.h" -#include "CURLDispatcher.h" -#include "cstring.h" -#include "CBrowserContext.h" -#include "uerrmgr.h" -#include "resgui.h" -#include "cstring.h" -#include -#include "macutil.h" -#include "ufilemgr.h" -#include "MoreDesktopMgr.h" -#include "CDeviceLoop.h" -#include "CContextMenuAttachment.h" -#include "CBevelView.h" -#include "macutil.h" -#include "miconutils.h" - -const Uint16 kColWidth = 100; -const Uint16 kRowHeight = 50; -const Uint16 kExpandedHeight = 56; - -CMessageAttachmentView::CMessageAttachmentView(LStream* inStream): - Inherited(inStream), LDragAndDrop(GetMacPort(), this), - mAttachmentList(NULL), - mMSGPane(NULL), - mExpandedHeight(kExpandedHeight), - mNumberAttachments(0), - mClickCountToOpen(2), - mAttachmentIconList(nil) -{ - SetUseDragSelect( false ); - mSendDataUPP = NewDragSendDataProc(LDropArea::HandleDragSendData); - Assert_(mSendDataUPP != NULL); - SetUpTableHelpers(); - LWindow* window = LWindow::FetchWindowObject( GetMacPort() ); - if( window ) - mBrokeredView = dynamic_cast(window->FindPaneByID( 'MAtV' ) ); - -} // CMessageAttachmentView::CMessageAttachmentView - -CMessageAttachmentView::~CMessageAttachmentView() -{ - if ( mSendDataUPP != NULL ) - DisposeRoutineDescriptor(mSendDataUPP); - - ClearMessageAttachmentView(); -} // CMessageAttachmentView::~CMessageAttachmentView() - -void CMessageAttachmentView::FinishCreateSelf() -{ - -} // CMessageAttachmentView::FinishCreateSelf - -void CMessageAttachmentView::SetUpTableHelpers() -{ - SetTableGeometry(new LTableMonoGeometry(this, kColWidth, kRowHeight) ); - SetTableSelector(new LTableMultiSelector(this)); -} // CMessageAttachmentView::SetUpTableHelpers - -void CMessageAttachmentView::SetMessageAttachmentList( MSG_Pane* pane, int32 numberAttachments ) -{ - ClearMessageAttachmentView(); - mMSGPane = pane; - if (numberAttachments <= 0) - { - Hide(); - return; - } - mNumberAttachments = numberAttachments; - Assert_( mMSGPane != NULL ); - MWContext* context = MSG_GetContext( mMSGPane ); - mMessageView = dynamic_cast( context->fe.newView ); - Assert_( mMessageView != NULL ); - - XP_Bool isAllAttachments; - MSG_GetViewedAttachments( mMSGPane, &mAttachmentList, &isAllAttachments); - if (mAttachmentList == nil) - { - ClearMessageAttachmentView(); - return; - } - CalculateRowsColumns(); - mAttachmentIconList = new CAttachmentIcon*[mNumberAttachments]; //careful! - - MSG_AttachmentData* attachment = &mAttachmentList[0]; - - for (int i = 0; i < mNumberAttachments; i++, attachment++) - { - CAttachmentIcon *attachIcon = NULL; - - if (attachment->x_mac_creator && attachment->x_mac_type) - { - OSType fileCreator; - OSType fileType; - - // creator and type are 8-byte hex representations... - sscanf(attachment->x_mac_creator, "%X", &fileCreator); - sscanf(attachment->x_mac_type, "%X", &fileType); - - attachIcon = new CAttachmentIcon(fileCreator, fileType); - } - else - { - attachIcon = new CAttachmentIcon(attachment->real_type); - } - - mAttachmentIconList[i] = attachIcon; - } -} // CMessageAttachmentView::SetMessageAttachmentList - - - -void CMessageAttachmentView::ClearMessageAttachmentView() -{ - if (mAttachmentIconList) - { - for (int i = 0; i < mNumberAttachments; i++) - { - CAttachmentIcon *thisAttachmentIcon = mAttachmentIconList[i]; - delete thisAttachmentIcon; - } - delete mAttachmentIconList; - mAttachmentIconList = NULL; - } - - if (mMSGPane && mAttachmentList) - { - MSG_FreeAttachmentList( mMSGPane, mAttachmentList); - } - mAttachmentList = NULL; - mMSGPane = NULL; - mNumberAttachments = 0; -} // CMessageAttachmentView::ClearMessageAttachmentView - -void CMessageAttachmentView::OpenSelection( Int32 action) -{ - STableCell selectedCell( 0,0); - while ( GetNextSelectedCell(selectedCell) ) - { - Int32 attachmentIndex = CalculateAttachmentIndex (selectedCell ); - const char* url = mAttachmentList[ attachmentIndex ].url; - URL_Struct* theURL = NET_CreateURLStruct( url, NET_DONT_RELOAD); - ThrowIfNULL_(theURL); - HandleURL(theURL, action ); - } -} // CMessageAttachmentView::OpenSelection() - -void CMessageAttachmentView::HandleURL( URL_Struct* inURL, int32 action ) -{ - CBrowserContext* browserContext = mMessageView->GetContext(); - if( browserContext ) - { - cstring theReferer = browserContext->GetCurrentURL(); - if (theReferer.length() > 0) - inURL->referer = XP_STRDUP(theReferer); - inURL->window_target = NULL; - if( action == FO_SAVE_AS ) - { - CStr31 fileName; - fe_FileNameFromContext(*browserContext, inURL->address, fileName); - StandardFileReply reply; - ::StandardPutFile(GetPString(SAVE_AS_RESID), fileName, &reply); - if (reply.sfGood) - { - CURLDispatcher::DispatchToStorage( inURL, reply.sfFile, FO_SAVE_AS, false); - } - } - else - mMessageView->DispatchURL( inURL, browserContext, false, false, action); - } -} // CMessageAttachmentView::HandleURL - -void CMessageAttachmentView::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -{ - LTableView::ResizeFrameBy( inWidthDelta, inHeightDelta, inRefresh); - CalculateRowsColumns(); -} // CMessageAttachmentView::ResizeFrameBy - -void CMessageAttachmentView::ToggleVisibility() -{ - if ( IsVisible() ) - Hide(); - else - Show(); -} // CMessageAttachmentView::ToggleVisibility - -void CMessageAttachmentView::Hide() -{ - if( mBrokeredView ) - { - if( mBrokeredView->IsVisible() ) - Remove(); - } -} // CMessageAttachmentView::Hide - -void CMessageAttachmentView::Show() -{ - - if ( mBrokeredView ) - { - if( !mBrokeredView->IsVisible() && mNumberAttachments ) - { - mBrokeredView->Show(); - mBrokeredView->MoveBy( 0, -mExpandedHeight, true ); - mBrokeredView->ResizeFrameBy(0, mExpandedHeight, true ); - CBevelView::SubPanesChanged(this, true); - Rect portRect; - if ( CalcPortFrameRect( portRect ) ) - ::EraseRect( &portRect ); - - } - } -} // CMessageAttachmentView::Show() - -void CMessageAttachmentView::Remove() -{ - if ( mBrokeredView ) - { - if ( mBrokeredView->IsVisible() ) - { - mBrokeredView->ResizeFrameBy(0, -mExpandedHeight, true); - mBrokeredView->MoveBy( 0, mExpandedHeight, false ); - mBrokeredView->Hide(); - } - } -} // CMessageAttachmentView::Remove - -void CMessageAttachmentView::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - switch (inCommand) - { - //case cmd_GetInfo: - // outEnabled = GetSelectedRowCount() == 1; - // break; - case cmd_SaveAs: - STableCell dummyCell( 0,0 ); - outEnabled = GetNextSelectedCell( dummyCell); - break; - case cmd_SelectAll: - outEnabled = true; - break; - default: - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} // CCMessageAttachmentView::FindCommandStatus - - -Boolean CMessageAttachmentView::ObeyCommand( - CommandT inCommand, - void *ioParam) -{ - Boolean result = false; - switch(inCommand) - { - case cmd_SaveAs: - OpenSelection( FO_SAVE_AS ); - return true; - - case cmd_Open: - OpenSelection( FO_CACHE_AND_PRESENT ); - return true; - - default: - return mMessageView->ObeyCommand( inCommand, ioParam ); - } -} // CMessageAttachmentView::ObeyCommand - -void CMessageAttachmentView::HiliteCell( - const STableCell &inCell, - Boolean /* inHilite */ ) - -{ - Rect cellRect; - if ( GetLocalCellRect( inCell, cellRect) ) - { - FocusDraw(); - DrawCell( inCell, cellRect ); - } -} // CMessageAttachmentView::HiliteCell - -void CMessageAttachmentView::HiliteSelection( - Boolean /* inActively */, - Boolean inHilite ) -{ - STableCell theCell; - - while (GetNextSelectedCell(theCell)) - { - if( !inHilite ) - UnselectCell( theCell ); - HiliteCell( theCell, inHilite ); - } -} - -Boolean CMessageAttachmentView::ClickSelect( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -{ - - // select the cell - if (LTableView::ClickSelect(inCell, inMouseDown)) - { - // Handle it ourselves if the popup attachment doesn't want it. - CContextMenuAttachment::SExecuteParams params; - params.inMouseDown = &inMouseDown; - if (ExecuteAttachments(CContextMenuAttachment::msg_ContextMenu, (void*)¶ms)) - { - // drag ? - don't become target - if ( ::WaitMouseMoved(inMouseDown.macEvent.where)) - DragSelection(inCell, inMouseDown); - else - { - // become target - if (!IsTarget()) - SwitchTarget(this); - // open selection if we've got the right click count - if (GetClickCount() == mClickCountToOpen) - OpenSelection( FO_CACHE_AND_PRESENT ); - } - } - return true; - } - return false; -} // CMessageAttachmentView::ClickSelect - - - -void CMessageAttachmentView::DragSelection( - const STableCell& /*inCell*/, - const SMouseDownEvent& inMouseDown ) -{ - - DragReference dragRef = 0; - - if (!FocusDraw()) return; - - try - { - //StRegion dragRgn; - OSErr err; - - CBrowserDragTask attachmentDrag( inMouseDown.macEvent ); - - AddSelectionToDrag( attachmentDrag.GetDragReference() , attachmentDrag.GetDragRegion() ); - err = ::SetDragSendProc( attachmentDrag.GetDragReference() , mSendDataUPP, (LDragAndDrop*)this); - attachmentDrag.DoDrag(); - } - catch( ... ) {} -} //CMessageAttachmentView::DragSelection - -void CMessageAttachmentView::AddSelectionToDrag(DragReference /* inDragRef */, RgnHandle inDragRgn) -{ - StRegion tempRgn; - STableCell cell; - Rect cellRect; - - ::SetEmptyRgn(inDragRgn); - - cell.col = 1; - cell.row = 0; - while (GetNextSelectedCell(cell)) - { - if (GetLocalCellRect(cell, cellRect)) - { - Int32 attachmentIndex = CalculateAttachmentIndex( cell ); - - /* - ::LocalToGlobal(&(topLeft(cellRect))); - ::LocalToGlobal(&(botRight(cellRect))); - ::RectRgn(tempRgn, &cellRect); - ::UnionRgn(tempRgn, inDragRgn, inDragRgn); - */ - CAttachmentIcon *attachmentIcon = mAttachmentIconList[attachmentIndex]; - - if (attachmentIcon) - { - ::SetEmptyRgn(tempRgn); - - attachmentIcon->AddIconOutlineToRegion(tempRgn, CAttachmentIcon::kIconSizeLarge); - - int16 horizontalOffset = ( cellRect.right - cellRect.left - 32 ) / 2; - Rect localRect = cellRect; - ::LocalToGlobal(&(topLeft(cellRect))); - - OffsetRgn(tempRgn, horizontalOffset + localRect.left + cellRect.left - localRect.left, localRect.top + (cellRect.top - localRect.top)); - - ::UnionRgn(tempRgn, inDragRgn, inDragRgn); - } - } - } - - ::CopyRgn(inDragRgn, tempRgn); - ::InsetRgn(tempRgn, 1, 1); - ::DiffRgn(inDragRgn, tempRgn, inDragRgn); -} - -void CMessageAttachmentView::DoDragSendData(FlavorType inFlavor, - ItemReference inItemRef, - DragReference inDragRef) -{ - OSErr theErr; - cstring theUrl; - STableCell selectedCell( 0,0); - switch( inFlavor ) - { - case 'TEXT': - while ( GetNextSelectedCell(selectedCell) ) - { - Int32 attachmentIndex = CalculateAttachmentIndex (selectedCell ); - const char* url = mAttachmentList[ attachmentIndex ].url; - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, url, strlen(url), 0); - ThrowIfOSErr_ (theErr); - } - break; - - case emBookmarkFileDrag: - // Get the target drop location - AEDesc dropLocation; - - theErr = ::GetDropLocation(inDragRef, &dropLocation); - if (theErr != noErr) - return; - - // Get the directory ID and volume reference number from the drop location - SInt16 volume; - SInt32 directory; - - theErr = GetDropLocationDirectory(&dropLocation, &directory, &volume); - - // Ok, this is a hack, and here's why: This flavor type is sent with the FlavorFlag 'flavorSenderTranslated' which - // means that this send data routine will get called whenever someone accepts this flavor. The problem is that - // it is also called whenever someone calls GetFlavorDataSize(). This routine assumes that the drop location is - // something HFS related, but it's perfectly valid for something to query the data size, and not be a HFS - // derrivative (like the text widget for example). - // So, if the coercion to HFS thingy fails, then we just punt to the textual representation. - if (theErr == errAECoercionFail) - { - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, theUrl, strlen(theUrl), 0); - return; - } - - if (theErr != noErr) - return; - - // Combine with the unique name to make an FSSpec to the new file - FSSpec prototypeFilespec; - FSSpec locationSpec; - prototypeFilespec.vRefNum = volume; - prototypeFilespec.parID = directory; - - // Save the selection - while ( GetNextSelectedCell( selectedCell ) ) - { - MSG_AttachmentData* attachment = &mAttachmentList[ CalculateAttachmentIndex( selectedCell ) ]; - char* fileName = CFileMgr::MacPathFromUnixPath(attachment->real_name ); - if ( fileName ) - { - theErr = CFileMgr::UniqueFileSpec( prototypeFilespec, fileName , locationSpec ); - if (theErr && theErr != fnfErr) // need a unique name, so we want fnfErr! - ThrowIfOSErr_(theErr); - Int32 attachmentIndex = CalculateAttachmentIndex (selectedCell ); - const char* url = mAttachmentList[ attachmentIndex ].url; - URL_Struct* theURL = NET_CreateURLStruct( url, NET_DONT_RELOAD ); - theErr = ::SetDragItemFlavorData( inDragRef, inItemRef, inFlavor, &locationSpec, sizeof(FSSpec), 0 ); - ThrowIfOSErr_(theErr); - ThrowIfNULL_(theURL); - CURLDispatcher::DispatchToStorage( theURL, locationSpec, FO_SAVE_AS, true ); - XP_FREE( fileName ); - } - } - break; - } -} //CMessageAttachmentView::AddSelectionToDrag - - -void CMessageAttachmentView::DrawSelf() -{ - // This function is similar to what we had when the "Erase On Update" - // LWindow attribute was set in Constructor. This flag has been removed - // because it created a lot of flickers when browsing mails. - // The other objects in the Thread window continued to behave correctly - // but the CThreadView showed some update problems. Instead of fixing - // them as we are supposed to (ie. by invalidating and erasing only what - // needs to be redrawn), I prefered to emulate the way it used to work - // when "Erase On Update" was set. My apologies for this easy solution - // but we have something to ship next week. - - - // erase everything - ApplyForeAndBackColors(); - Rect frame; - CalcLocalFrameRect(frame); - ::EraseRect(&frame); - - // redraw everything - Inherited::DrawSelf(); -}// CMessageAttachmentView::DrawSelf() - - -void CMessageAttachmentView::DrawCell( const STableCell &inCell, const Rect &inLocalRect ) -{ - const Int32 kIconSize = 32; - Int32 attachmentIndex = CalculateAttachmentIndex( inCell ); - if( attachmentIndex < 0 || attachmentIndex >= mNumberAttachments ) - return ; - - MSG_AttachmentData& attachment = mAttachmentList[attachmentIndex]; - - char* attachmentName = NULL; - - if (attachment.real_name != NULL) - attachmentName = CFileMgr::MacPathFromUnixPath(attachment.real_name ); - else - attachmentName = XP_STRDUP( XP_GetString(XP_MSG_NONE)); - - Uint32 nameLength; - if( attachmentName ) - nameLength= XP_STRLEN(attachmentName); - - // file icon - Rect iconRect; - int16 horizontalOffset = ( inLocalRect.right - inLocalRect.left - kIconSize )/2; - iconRect.left = inLocalRect.left + horizontalOffset; - iconRect.right = iconRect.left + kIconSize; - iconRect.top = inLocalRect.top + 2; - iconRect.bottom = iconRect.top + kIconSize; - IconTransformType transformType = CellIsSelected(inCell) ? kTransformSelected : kTransformNone; - - CAttachmentIcon *attachmentIcon = mAttachmentIconList[attachmentIndex]; - - if (attachmentIcon != NULL) - attachmentIcon->PlotIcon(iconRect, kAlignNone, transformType); - - // file name and yes, you can have attachments without names - if( attachmentName != NULL ) - { - Rect textRect = inLocalRect; - textRect.left+=4; - textRect.top = iconRect.bottom; - FontInfo fontInfo; - UTextTraits::SetPortTextTraits( 130 ); - ::GetFontInfo(&fontInfo); - UGraphicGizmos::PlaceTextInRect( - attachmentName, nameLength, textRect, teCenter, teCenter, &fontInfo, true, truncMiddle); - XP_FREE( attachmentName ); - } -} // CMessageAttachmentView::DrawCell - -void CMessageAttachmentView::CalculateRowsColumns() -{ - SDimension16 frameSize; - GetFrameSize(frameSize); - if( mNumberAttachments <= 0 ) - return; - int16 numCols = frameSize.width / kColWidth; - if ( numCols == 0 ) - numCols = 1; // if the only cell is a fractionally visible cell, use it - if ( numCols > mNumberAttachments ) - numCols = mNumberAttachments; - - int16 numRows = mNumberAttachments / numCols; - if ( mNumberAttachments % numCols ) - numRows ++; - // Remove old table geometry - RemoveRows( mRows,0, false ); - RemoveCols (mCols, 0, false ); - // Insert the new geometry - InsertCols( numCols, 1, NULL, 0, false); - InsertRows( numRows, 1, NULL, 0, true ); -} // CMessageAttachmentView::CalculateRowsColumns() - -Int32 CMessageAttachmentView::CalculateAttachmentIndex( STableCell inCell) -{ - Int32 attachmentIndex = ( (inCell.row-1)*(mCols) + inCell.col -1 ); // Attachment Lists are zero based - Assert_( attachmentIndex >= 0 ); - return attachmentIndex; -} // CMessageAttachmentView::CalculateAttachmentIndex diff --git a/mozilla/cmd/macfe/MailNews/CMessageAttachmentView.h b/mozilla/cmd/macfe/MailNews/CMessageAttachmentView.h deleted file mode 100644 index 6c4a74ec234..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageAttachmentView.h +++ /dev/null @@ -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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageAttachmentView.h - -#pragma once -#include "LTableView.h" -#include "msgcom.h" -#include - - -class CMessageView; -class CBrokeredView; -class CAttachmentIcon; - - -class CMessageAttachmentView: public LTableView, public LCommander, public LDragAndDrop -{ - -private: - typedef LTableView Inherited; -public: - enum { class_ID = 'MATv' }; - CMessageAttachmentView(LStream* inStream); - - virtual ~CMessageAttachmentView(); - virtual void FinishCreateSelf(); - virtual void SetUpTableHelpers(); - - void SetMessageAttachmentList( MSG_Pane* pane, int32 numberAttachments ); - void ClearMessageAttachmentView(); - virtual void OpenSelection( int32 action ); - virtual void HandleURL( URL_Struct* inURL, int32 action ); - -// LPane - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); - void ToggleVisibility(); - virtual void Hide(); - virtual void Show(); - void Remove(); - - -// LCommander - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand( CommandT inCommand, void *ioParam ); - -// LTableView - virtual void HiliteSelection( - Boolean inActively, - Boolean inHilite); - virtual void HiliteCell( - const STableCell &inCell, - Boolean inHilite); - virtual Boolean ClickSelect( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - -// LDragandDrop -// ------------------------------------------------------------ - virtual void DragSelection(const STableCell& /*inCell*/, const SMouseDownEvent &inMouseDown); - virtual void AddSelectionToDrag(DragReference inDragRef, RgnHandle inDragRgn); - virtual void DoDragSendData(FlavorType inFlavor, - ItemReference inItemRef, - DragReference inDragRef); -protected: - virtual void DrawSelf(); - virtual void DrawCell( const STableCell &inCell, const Rect &inLocalRect ); - void CalculateRowsColumns(); - Int32 CalculateAttachmentIndex( STableCell inCell); - - CBrokeredView* mBrokeredView; - MSG_Pane *mMSGPane; - CMessageView *mMessageView; - Int16 mExpandedHeight; - Int16 mClickCountToOpen; - - MSG_AttachmentData *mAttachmentList; - Int32 mNumberAttachments; - CAttachmentIcon **mAttachmentIconList; - DragSendDataUPP mSendDataUPP; -}; diff --git a/mozilla/cmd/macfe/MailNews/CMessageFolder.cp b/mozilla/cmd/macfe/MailNews/CMessageFolder.cp deleted file mode 100644 index a9ba01d2e2a..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageFolder.cp +++ /dev/null @@ -1,469 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageFolder.cp - -#include "CMessageFolder.h" - -#include "MailNewsCallbacks.h" -#include "CMailNewsContext.h" - -//====================================== -#pragma mark --- CCachedFolderLine -//====================================== - -#if 0 -//====================================== -class CMessageFolderListener : public CMailCallbackListener -//====================================== -{ -public: - CMessageFolderListener() { sMessageFolderListener = this; } - ~CMessageFolderListener() { sMessageFolderListener = nil; } - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); // must always be supported. - static CMessageFolderListener* sMessageFolderListener; -}; -#endif // 0 - -//====================================== -class CFolderLineComparator : public LComparator -//====================================== -{ - virtual Int32 Compare( - const void* inItemOne, - const void* inItemTwo, - Uint32 inSizeOne, - Uint32 inSizeTwo) const; - virtual Int32 CompareToKey( - const void* inItem, - Uint32 /* inSize */, - const void* inKey) const; -}; // class CFolderLineComparator - -LArray* CCachedFolderLine::sLineList = nil; - -//---------------------------------------------------------------------------------------- -Int32 CFolderLineComparator::Compare( - const void* inItemOne, - const void* inItemTwo, - Uint32 /*inSizeOne*/, - Uint32 /*inSizeTwo*/) const -//---------------------------------------------------------------------------------------- -{ - return (Int32)(*(const CCachedFolderLine**)inItemOne)->mFolderLine.id - - (Int32)(*(const CCachedFolderLine**)inItemTwo)->mFolderLine.id; -} - -//---------------------------------------------------------------------------------------- -Int32 CFolderLineComparator::CompareToKey( - const void* inItem, - Uint32 /* inSize */, - const void* inKey) const -//---------------------------------------------------------------------------------------- -{ - return (Int32)(*(CCachedFolderLine**)inItem)->mFolderLine.id - - (Int32)(const MSG_FolderInfo*)inKey; -} - -//---------------------------------------------------------------------------------------- -CCachedFolderLine::CCachedFolderLine(MSG_Pane* inFolderPane, MSG_FolderInfo* inID) -//---------------------------------------------------------------------------------------- -: mRefCount(0) -{ - mFolderLine.id = inID; // set this up for the FolderInfoChanged() call. - FolderInfoChanged(inFolderPane); - // Listen for changes to the folder info. - // if (!CMessageFolderListener::sMessageFolderListener) - // new CMessageFolderListener; - if (!sLineList) - { - // Initialize the sorted array - sLineList = new LArray(sizeof(CCachedFolderLine*), new CFolderLineComparator, true); - sLineList->AdjustAllocation(50); // Allow for 50 items initially - } - sLineList->InsertItemsAt(1, 0/*ignored*/, &this); -} // CCachedFolderLine::CCachedFolderLine - -//---------------------------------------------------------------------------------------- -CCachedFolderLine::~CCachedFolderLine() -//---------------------------------------------------------------------------------------- -{ - if (sLineList) - { - sLineList->Remove(&this); - // When the last cached folderline goes, no need to have a listener. - if (sLineList->GetCount() == 0) - { - delete sLineList; - sLineList = nil; -// delete CMessageFolderListener::sMessageFolderListener; - } - } -} // CCachedFolderLine::~CCachedFolderLine - -//---------------------------------------------------------------------------------------- -void CCachedFolderLine::FolderInfoChanged(MSG_Pane* inFolderPane) -//---------------------------------------------------------------------------------------- -{ - MSG_FolderInfo* id = mFolderLine.id; // this is non-volatile - if (id) - { - MSG_ViewIndex index = MSG_VIEWINDEXNONE; - if (inFolderPane && ::MSG_GetPaneType(inFolderPane) == MSG_FOLDERPANE) - { - // Only relative to a pane can we get the "elided" bit right, to tell - // whether or not the twistie is open. - index = ::MSG_GetFolderIndex(inFolderPane, id); - } - if (index != MSG_VIEWINDEXNONE) - ::MSG_GetFolderLineByIndex(inFolderPane, index, 1, &mFolderLine); - else - ::MSG_GetFolderLineById(CMailNewsContext::GetMailMaster(), id, &mFolderLine); - } - else - { - // There is a hack in which we add a NULL MSG_FolderInfo* to the cache. - // Rather than call msglib to initialize the folder line (which will cause - // an assert) just zero out the folderline ourselves. - memset(&mFolderLine, 0, sizeof(MSG_FolderLine)); - } - Assert_(id==mFolderLine.id); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolder::FolderLevelChanged(MSG_Pane* inFolderPane) -// Calls FolderInfoChanged on this and all its descendents. -//---------------------------------------------------------------------------------------- -{ - FolderInfoChanged(inFolderPane); - UInt32 childCount = CountSubFolders(); - if (childCount) - { - typedef MSG_FolderInfo* mfip; - try - { - MSG_FolderInfo** childList = new mfip[childCount]; // throws... - ::MSG_GetFolderChildren( - CMailNewsContext::GetMailMaster(), - GetFolderInfo(), - childList, - childCount); - MSG_FolderInfo** child = &childList[0]; - for (SInt32 j = 0; j < childCount; j++, child++) - { - CMessageFolder childFolder(*child, inFolderPane); - childFolder.FolderLevelChanged(inFolderPane); - } - delete [] childList; - } - catch(...) - { - } - } -} // CMessageFolder::FolderLevelChanged - -//---------------------------------------------------------------------------------------- -void CCachedFolderLine::FolderInfoChanged(MSG_Pane* inFolderPane, MSG_FolderInfo* inID) -//---------------------------------------------------------------------------------------- -{ - CCachedFolderLine* folder = FindFolderFor(inID); - if (folder) - folder->FolderInfoChanged(inFolderPane); -} - -//---------------------------------------------------------------------------------------- -CCachedFolderLine* CCachedFolderLine::FindFolderFor(MSG_FolderInfo* inID) -//---------------------------------------------------------------------------------------- -{ - if (!sLineList) - return nil; - CCachedFolderLine* result = nil; - ArrayIndexT arrayIndex = sLineList->FetchIndexOfKey(inID); - if (arrayIndex != LArray::index_Bad) - { - sLineList->FetchItemAt(arrayIndex, &result); - } - return result; -} - -//---------------------------------------------------------------------------------------- -CCachedFolderLine* CCachedFolderLine::GetFolderFor(MSG_Pane* inFolderPane, MSG_FolderInfo* inID) -//---------------------------------------------------------------------------------------- -{ - CCachedFolderLine* folderLine = FindFolderFor(inID); - if (!folderLine) - folderLine = new CCachedFolderLine(inFolderPane, inID); - return folderLine; -} - -//---------------------------------------------------------------------------------------- -CCachedFolderLine* CCachedFolderLine::GetFolderFor(MSG_Pane* inFolderPane, MSG_ViewIndex inIndex) -//---------------------------------------------------------------------------------------- -{ - MSG_FolderInfo* id = ::MSG_GetFolderInfo(inFolderPane, inIndex); - CCachedFolderLine* folderLine = FindFolderFor(id); - if (!folderLine) - folderLine = new CCachedFolderLine(inFolderPane, id); - return folderLine; -} - -#if 0 -//====================================== -#pragma mark --- CMessageFolderListener -//====================================== - -CMessageFolderListener* CMessageFolderListener::sMessageFolderListener = nil; - -//---------------------------------------------------------------------------------------- -void CMessageFolderListener::PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -//---------------------------------------------------------------------------------------- -{ - if (inNotifyCode == MSG_PaneNotifyFolderInfoChanged) - CCachedFolderLine::FolderInfoChanged((MSG_FolderInfo*)value); -} -#endif // 0 - -//====================================== -#pragma mark --- CMessageFolder -//====================================== - -//---------------------------------------------------------------------------------------- -CMessageFolder::CMessageFolder(TableIndexT inRow, MSG_Pane* inFolderList) -//---------------------------------------------------------------------------------------- -{ - mCachedFolderLine = CCachedFolderLine::GetFolderFor(inFolderList, inRow - 1); - mCachedFolderLine->AddUser(this); -} - -//---------------------------------------------------------------------------------------- -CMessageFolder::CMessageFolder(const MSG_FolderInfo* id, MSG_Pane* inFolderPane) -//---------------------------------------------------------------------------------------- -{ - mCachedFolderLine = CCachedFolderLine::GetFolderFor(inFolderPane, (MSG_FolderInfo*)id); - mCachedFolderLine->AddUser(this); -} - -//---------------------------------------------------------------------------------------- -CMessageFolder::CMessageFolder(const CMessageFolder& inFolder) -//---------------------------------------------------------------------------------------- -{ - mCachedFolderLine = inFolder.mCachedFolderLine; - mCachedFolderLine->AddUser(this); -} - -//---------------------------------------------------------------------------------------- -CMessageFolder::~CMessageFolder() -//---------------------------------------------------------------------------------------- -{ - mCachedFolderLine->RemoveUser(this); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolder::operator=(const CMessageFolder& other) -//---------------------------------------------------------------------------------------- -{ - if (!(*this == other)) // uses operator == - { - mCachedFolderLine->RemoveUser(this); - mCachedFolderLine = other.mCachedFolderLine; - mCachedFolderLine->AddUser(this); - } -} - -//---------------------------------------------------------------------------------------- -MSG_FolderInfo* CMessageFolder::GetFolderInfo() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.id; -} - -//---------------------------------------------------------------------------------------- -void CMessageFolder::SetFolderInfo(const MSG_FolderInfo* id, MSG_Pane* inFolderPane) -//---------------------------------------------------------------------------------------- -{ - if (id != GetFolderInfo()) - { - mCachedFolderLine->RemoveUser(this); - mCachedFolderLine = CCachedFolderLine::GetFolderFor(inFolderPane, (MSG_FolderInfo*)id); - mCachedFolderLine->AddUser(this); - } -} - -//---------------------------------------------------------------------------------------- -MSG_Pane* CMessageFolder::GetThreadPane() const -//---------------------------------------------------------------------------------------- -{ - return ::MSG_FindPaneOfType( - CMailNewsContext::GetMailMaster(), - GetFolderInfo(), - MSG_THREADPANE); -} - -//---------------------------------------------------------------------------------------- -MSG_Pane* CMessageFolder::GetFolderPane() -//---------------------------------------------------------------------------------------- -{ - return ::MSG_FindPane( - nil, // Don't care about context matching - MSG_FOLDERPANE); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolder::FolderInfoChanged(MSG_Pane* inFolderPane) -//---------------------------------------------------------------------------------------- -{ - mCachedFolderLine->FolderInfoChanged(inFolderPane); -} - -//---------------------------------------------------------------------------------------- -Int32 CMessageFolder::CountMessages() const -//---------------------------------------------------------------------------------------- -{ - if (mCachedFolderLine->mFolderLine.unseen < 0) - return -1; // hack: this indicates unknown. - return mCachedFolderLine->mFolderLine.total; -} - -//---------------------------------------------------------------------------------------- -UInt32 CMessageFolder::GetDeletedBytes() const -//---------------------------------------------------------------------------------------- -{ - if (mCachedFolderLine->mFolderLine.deletedBytes < 0) - return -1; // hack: this indicates unknown. - return mCachedFolderLine->mFolderLine.deletedBytes; -} - -// -// Icon suite IDs -// -enum -{ - - kNormalMessageFolderIconID = 15238 -, kInboxMessageFolderIconID = 15240 -, kInboxWithNewMailMessageFolderIconID = 15242 -, kOutboxMessageFolderIconID = 15244 -, kSentMailMessageFolderIconID = 15246 -, kDraftsMessageFolderIconID = 15248 -, kRemoteMessageFolderIconID = 15250 -, kEmptyTrashMessageFolderIcon = 270 -, kNonEmptyTrashMessageFolderIcon = 270 - - // Icons for message folders. These need to be in a menu, so their numbers are 256+ - // Add 1 for the "open" state (except for trash) - -, kMailServerFolderIconID = 15225 - // Icons for news groups/hosts -, kNewsHostFolderIconID = 15227 -, kNewsGroupFolderIconID = 15227 - -}; - - - -static ResIDT gIconIDTable[] = { -//---------------------------------------------------------------------------------------- -//NAME READ UNREAD -// LOCAL ONLINE LOCAL ONLINE -// DEFAULT SPECIAL DEFAULT SPECIAL DEFAULT SPECIAL DEFAULT SPECIAL -//---------------------------------------------------------------------------------------- -/* Folder*/ 15238 , 15238 , 15250 , 15250 , 15238 , 15394 , 15250 , 15394 , -/* Inbox */ 15240 , 15240 , 15240 , 15240 , 15242 , 15242 , 15242 , 15242 , -/* Outbox*/ 15244 , 15244 , 15244 , 15244 , 15244 , 15244 , 15244 , 15244 , -/* Sent */ 15246 , 15246 , 15246 , 15246 , 15246 , 15246 , 15246 , 15246 , -/* Drafts*/ 15248 , 15248 , 15248 , 15248 , 15248 , 15248 , 15248 , 15248 , -/* Trash */ 15252 , 15252 , 15252 , 15252 , 15252 , 15252 , 15252 , 15252 , -/* Newsgrp*/ 0 , 0 , 15231 , 15233 , 0 , 0 , 15231 , 15232 -}; - -enum { - kSpecial = 1 // offset -, kOnline = 2 // offset -, kNewMessages = 4 // offset -, kKindsPerRow = 8 -, kIconBaseIx = 0 // SPECIAL = Got new -, kInboxIx = 1 * kKindsPerRow // SPECIAL = Got new -, kOutboxIx = 2 * kKindsPerRow // SPECIAL = OCCUPIED -, kSentIx = 3 * kKindsPerRow -, kDraftsIx = 4 * kKindsPerRow -, kTrashIx = 5 * kKindsPerRow // SPECIAL = OCCUPIED -, kNewsGroupIx = 6 * kKindsPerRow // SPECIAL = SUBSCRIBED -}; - -//---------------------------------------------------------------------------------------- -ResIDT CMessageFolder::GetIconID() const -// To do: deal with the "Open" state, the "read" state, etc. -//---------------------------------------------------------------------------------------- -{ - UInt32 folderFlags = this->GetFolderType(); - if (GetLevel() == kRootLevel) - { - if ((folderFlags & MSG_FOLDER_FLAG_NEWS_HOST)) - return kNewsHostFolderIconID; // li'l computer - return kMailServerFolderIconID; // li'l computer - } - short iconIndex = kIconBaseIx; - switch (folderFlags & ~(MSG_FOLDER_FLAG_MAIL | MSG_FOLDER_FLAG_IMAPBOX)) - { - case MSG_FOLDER_FLAG_NEWSGROUP: - iconIndex = kNewsGroupIx + kOnline; // always online! - if (this->IsSubscribedNewsgroup()) - iconIndex += kSpecial; // special = subscribed - break; - case MSG_FOLDER_FLAG_TRASH: - iconIndex = kTrashIx; - if (this->CountMessages() != 0) - iconIndex += kSpecial; // special = nonempty - break; - case MSG_FOLDER_FLAG_SENTMAIL: - iconIndex = kSentIx; - break; - case MSG_FOLDER_FLAG_TEMPLATES: - case MSG_FOLDER_FLAG_DRAFTS: - iconIndex = kDraftsIx; - break; - case MSG_FOLDER_FLAG_QUEUE: - iconIndex = kOutboxIx; - if (this->CountMessages() != 0) - iconIndex += kSpecial; // special = nonempty - break; - case MSG_FOLDER_FLAG_INBOX: - iconIndex = kInboxIx; - if (this->HasNewMessages()) - iconIndex += kSpecial; // special = got new messages - break; - default: - iconIndex = kIconBaseIx; - if (this->HasNewMessages()) - iconIndex += kSpecial; // special = got new messages - } - if (this->HasNewMessages() ) - iconIndex += kNewMessages; - if ((folderFlags & MSG_FOLDER_FLAG_IMAPBOX) != 0) - iconIndex += kOnline; - return gIconIDTable[iconIndex]; -} // CMessageFolder::GetIconID - diff --git a/mozilla/cmd/macfe/MailNews/CMessageFolder.h b/mozilla/cmd/macfe/MailNews/CMessageFolder.h deleted file mode 100644 index c6bcbfa6cf3..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageFolder.h +++ /dev/null @@ -1,322 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -#pragma once - -enum -{ kRootLevel = 1 // news host, local mail etc. -, kSpecialFolderLevel = 2 // inbox, sent, drafts... -}; - -#include // for TableIndexT -#include "msgcom.h" - -struct CCachedFolderLine; // forward - -//======================================================================================== -class CMessageFolder -//======================================================================================== -{ -public: - CMessageFolder(TableIndexT inRow, MSG_Pane* inFolderPane); - // In the next constructor (and similar functions that - // take a MSG_FolderInfo*, there is a MSG_Pane* param - // which is optional. Supplying the pane will allow - // the ELIDED flag to work properly, because it is - // a property of the "view" and not an intrinsic property - // of the folder itself. - CMessageFolder( - const MSG_FolderInfo* id = nil, - MSG_Pane* inFolderPane = nil); - // inFolderPane can be nil, as can id. - CMessageFolder(const CMessageFolder& inFolder); - ~CMessageFolder(); - - void operator=(const CMessageFolder& other); - Boolean operator==(const CMessageFolder& other) const; - operator MSG_FolderInfo*() const { return GetFolderInfo(); } - void SetFolderInfo(const MSG_FolderInfo* id, MSG_Pane* inFolderPane = nil); - // inFolderPane can be nil, as can id. - void FolderInfoChanged(MSG_Pane* inFolderPane = nil); - void FolderLevelChanged(MSG_Pane* inFolderPane = nil); - // calls FolderInfoChanged on children, too. - // inFolderPane can be nil. - UInt32 GetFolderType() const; - const char* GetName() const; - const char* GetPrettyName() const; - UInt32 GetLevel() const; - SInt32 CountMessages() const; // neg if unknown - SInt32 CountUnseen() const; // neg if unknown - SInt32 CountDeepUnseen() const; // neg if unknown - UInt32 CountSubFolders() const; - UInt32 GetDeletedBytes() const; - Boolean IsOpen() const; - MSG_ViewIndex GetIndex() const; - MSG_FolderInfo* GetFolderInfo() const; - const MSG_FolderLine* GetFolderLine() const; - MSG_Pane* GetThreadPane() const; // Returns a threadpane viewing this. - static MSG_Pane* GetFolderPane(); - // Flag property accessors: - UInt32 GetFolderFlags() const; - UInt32 GetFolderPrefFlags() const; - Boolean HasNewMessages() const; - Boolean ContainsCategories() const; - Boolean IsInbox() const; - Boolean IsTrash() const; - Boolean IsMailServer() const; - Boolean IsMailFolder() const; - Boolean IsLocalMailFolder() const; - Boolean IsIMAPMailFolder() const; - Boolean IsNewsgroup() const; - Boolean IsNewsHost() const; - Boolean CanContainThreads() const; - Boolean IsSubscribedNewsgroup() const; - ResIDT GetIconID() const; -// Data -// NOTE WELL: This class is currently 4 bytes. Many users rely on its being light weight, -// and it is passed around by value, not by reference. Note that the copy -// constructor does the right thing with reference counting. -// So BE VERY RELUCTANT TO ADD NEW DATA MEMBERS! -protected: - CCachedFolderLine* mCachedFolderLine; -}; // class CMessageFolder - -//======================================================================================== -class CCachedFolderLine -//======================================================================================== -{ -private: - CCachedFolderLine(MSG_Pane* inFolderPane, MSG_FolderInfo* id); - // inFolderPane can be nil. - ~CCachedFolderLine(); - static CCachedFolderLine* FindFolderFor(MSG_FolderInfo* id); - // doesn't create -public: - void AddUser(CMessageFolder*) { mRefCount++; } - void RemoveUser(CMessageFolder*) { if (--mRefCount <= 0) delete this; } - void FolderInfoChanged(MSG_Pane* inFolderPane); - // inFolderPane can be nil. - static void FolderInfoChanged(MSG_Pane* inFolderPane, MSG_FolderInfo* inID); - // inFolderPane can be nil. - static CCachedFolderLine* GetFolderFor(MSG_Pane* inFolderPane, MSG_FolderInfo* id); - // creates if nec. inFolderPane can be nil. - static CCachedFolderLine* GetFolderFor(MSG_Pane* inFolderPane, MSG_ViewIndex inIndex); - // creates if nec.inFolderPane IS REQUIRED. - - -//----- -// Data -//----- -public: - MSG_FolderLine mFolderLine; -private: - Int32 mRefCount; - static LArray* sLineList; -}; // class CCachedFolderLine - -#define kMessageFolderTypeMask ( MSG_FOLDER_FLAG_NEWSGROUP | \ - MSG_FOLDER_FLAG_NEWS_HOST | \ - MSG_FOLDER_FLAG_MAIL | \ - MSG_FOLDER_FLAG_TRASH | MSG_FOLDER_FLAG_SENTMAIL | \ - MSG_FOLDER_FLAG_DRAFTS | MSG_FOLDER_FLAG_QUEUE | \ - MSG_FOLDER_FLAG_TEMPLATES | MSG_FOLDER_FLAG_PERSONAL_SHARED | \ - MSG_FOLDER_FLAG_IMAP_OTHER_USER | MSG_FOLDER_FLAG_IMAP_PUBLIC | \ - MSG_FOLDER_FLAG_INBOX | MSG_FOLDER_FLAG_IMAPBOX) - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::operator==(const CMessageFolder& other) const -//---------------------------------------------------------------------------------------- -{ - return GetFolderInfo() == other.GetFolderInfo(); -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessageFolder::GetFolderPrefFlags() const -//---------------------------------------------------------------------------------------- -{ - return ::MSG_GetFolderPrefFlags(GetFolderInfo()); -} - -//---------------------------------------------------------------------------------------- -inline const MSG_FolderLine* CMessageFolder::GetFolderLine() const -//---------------------------------------------------------------------------------------- -{ - return &mCachedFolderLine->mFolderLine; -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessageFolder::GetFolderType() const -//---------------------------------------------------------------------------------------- -{ - return (mCachedFolderLine->mFolderLine.flags & kMessageFolderTypeMask); -} - -//---------------------------------------------------------------------------------------- -inline const char* CMessageFolder::GetName() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.name; -} - -//---------------------------------------------------------------------------------------- -inline const char* CMessageFolder::GetPrettyName() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.prettyName; -} - -//---------------------------------------------------------------------------------------- -inline MSG_ViewIndex CMessageFolder::GetIndex() const -//---------------------------------------------------------------------------------------- -{ - Assert_(false); // this is probably a bad function, now that multiple f. panes exist. - return MSG_GetFolderIndex(GetFolderPane(), GetFolderInfo()); -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessageFolder::GetFolderFlags() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.flags; -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessageFolder::GetLevel() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.level; -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::CanContainThreads() const -//---------------------------------------------------------------------------------------- -{ - return GetLevel() > kRootLevel; -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsSubscribedNewsgroup() const -//---------------------------------------------------------------------------------------- -{ -#define SUBSCRIBED_NEWSGROUP (MSG_FOLDER_FLAG_SUBSCRIBED | MSG_FOLDER_FLAG_NEWSGROUP) - return ((GetFolderFlags() & SUBSCRIBED_NEWSGROUP) == SUBSCRIBED_NEWSGROUP ); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::HasNewMessages() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_GOT_NEW) != 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsNewsgroup() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) != 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsMailServer() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_MAIL) == MSG_FOLDER_FLAG_MAIL - && GetLevel() == kRootLevel); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsMailFolder() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_MAIL) == MSG_FOLDER_FLAG_MAIL); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsIMAPMailFolder() const -//---------------------------------------------------------------------------------------- -{ -#define IMAP_FOLDER (MSG_FOLDER_FLAG_IMAPBOX | MSG_FOLDER_FLAG_MAIL) - return ((GetFolderFlags() & IMAP_FOLDER) == IMAP_FOLDER); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsLocalMailFolder() const -//---------------------------------------------------------------------------------------- -{ - // folder bit set and imap bit clear. - return ((GetFolderFlags() & IMAP_FOLDER) == MSG_FOLDER_FLAG_MAIL); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsNewsHost() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_NEWS_HOST) != 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsInbox() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_INBOX) != 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsTrash() const -//---------------------------------------------------------------------------------------- -{ - return ((GetFolderFlags() & MSG_FOLDER_FLAG_TRASH) != 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::ContainsCategories() const -//---------------------------------------------------------------------------------------- -{ -#define NEWSGROUP_WITH_CATEGORIES (MSG_FOLDER_FLAG_CAT_CONTAINER | MSG_FOLDER_FLAG_NEWSGROUP) - return ((GetFolderFlags() & NEWSGROUP_WITH_CATEGORIES) == NEWSGROUP_WITH_CATEGORIES ); -} - -//---------------------------------------------------------------------------------------- -inline Int32 CMessageFolder::CountUnseen() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.unseen; -} - -//---------------------------------------------------------------------------------------- -inline Int32 CMessageFolder::CountDeepUnseen() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.deepUnseen; -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessageFolder::CountSubFolders() const -//---------------------------------------------------------------------------------------- -{ - return mCachedFolderLine->mFolderLine.numChildren; -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessageFolder::IsOpen() const -//---------------------------------------------------------------------------------------- -{ - return ((mCachedFolderLine->mFolderLine.flags & MSG_FOLDER_FLAG_ELIDED) == 0); -} // CMessageFolder::IsOpen diff --git a/mozilla/cmd/macfe/MailNews/CMessageFolderView.cp b/mozilla/cmd/macfe/MailNews/CMessageFolderView.cp deleted file mode 100644 index f8d8bca7c4c..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageFolderView.cp +++ /dev/null @@ -1,1186 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - - -#include "CMessageFolderView.h" - -// PowerPlant -#include -#include - -#include "prefapi.h" -#include "shist.h" -#include "uprefd.h" -#include "Secnav.h" - -// MacFE -#include "macutil.h" -#include "ufilemgr.h" - -// Netscape Mac Libs -#include "UGraphicGizmos.h" -#include "resgui.h" - -// Mail/News Specific -#include "UOffline.h" -#include "MailNewsgroupWindow_Defines.h" -#include "CThreadWindow.h" -#include "CMailProgressWindow.h" -#include "LTableViewHeader.h" -#include "CProgressListener.h" -#include "CMessageFolder.h" -#include "CMailNewsContext.h" -#include "CNewsSubscriber.h" -#include "UMailFolderMenus.h" -#include "StGetInfoHandler.h" -#include "UNewFolderDialog.h" -#include "CMessageWindow.h" -#include "UMailSelection.h" -#include "UMessageLibrary.h" - -#include "CPrefsDialog.h" -#include "CProxyDragTask.h" -#include "UDeferredTask.h" -#include "CInlineEditField.h" - -//======================================================================================== -class CFolderWatchingTask -//======================================================================================== -: public CDeferredTask -{ - public: - CFolderWatchingTask( - CMessageFolderView* inFolderView, - MSG_FolderInfo* inFolderInfo) - : mFolderView(inFolderView) - , mWatchedFolder(inFolderInfo, inFolderView->GetMessagePane()) - , mWatchedFolderChildCount( mWatchedFolder.CountSubFolders()) - , mAnotherExecuteAttemptCount(0) - { - } - virtual ExecuteResult ExecuteSelf(); - protected: - CMessageFolderView* mFolderView; - CMessageFolder mWatchedFolder; - UInt32 mWatchedFolderChildCount; - UInt32 mAnotherExecuteAttemptCount; -}; - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CFolderWatchingTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - // This is here for the case when folders were dragged into (or deleted into) - // a folder which was closed in the message center. We need to refresh the - // cache, because the newly added children have changed their level in the - // hierarchy. We don't get notified unless the new parent is expanded. - // Currently, this only goes one folder deep, which covers the most common case - // of folder deletion (move to trash). - if (++mAnotherExecuteAttemptCount >= 500) - return eDoneDelete; // give up and die - CNSContext* context = mFolderView->GetContext(); - if (context->GetCurrentCommand() == cmd_MoveMailMessages ) - context->SetCurrentCommand(cmd_Nothing); - mWatchedFolder.FolderInfoChanged(mFolderView->GetMessagePane()); // get new backend data - if (!mWatchedFolder.GetFolderInfo()) - return eDoneDelete; - UInt32 childCount = mWatchedFolder.CountSubFolders(); - if (childCount <= mWatchedFolderChildCount) - return eWaitStepBack; // no change yet, but ok to run another task. - // OK, it's stale. Fix it. - mWatchedFolder.FolderLevelChanged(mFolderView->GetMessagePane()); - MSG_ViewIndex index = ::MSG_GetFolderIndex(mFolderView->GetMessagePane(), mWatchedFolder); - if (index != MSG_VIEWINDEXNONE) - mFolderView->RefreshRowRange(index + 1, index + 1); - return eDoneDelete; -} // CFolderWatchingTask::ExecuteSelf - -#pragma mark -- CDeleteSelectionTask - -//======================================================================================== -class CDeleteSelectionTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeleteSelectionTask( - CMessageFolderView* inFolderView, - const CMailSelection& inSelection) - : mSelection(inSelection) - , mFolderView(inFolderView) - {} - virtual ExecuteResult ExecuteSelf(); - protected: - CPersistentFolderSelection mSelection; - CMessageFolderView* mFolderView; -}; // class CDeleteSelectionTask - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeleteSelectionTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - CNetscapeWindow* win = dynamic_cast - (LWindow::FetchWindowObject(mFolderView->GetMacPort())); - // Wait till any pending URLs are finished - if (win->IsAnyContextBusy()) - return eWaitStayFront; - const MSG_ViewIndex* indices = mSelection.GetSelectionList(); - MSG_ViewIndex numIndices = mSelection.selectionSize; - mFolderView->DoDeleteSelection(mSelection); - return eDoneDelete; -} // CDeleteSelectionTask::ExecuteSelf - -#pragma mark -- CDeferredDragTask - -//======================================================================================== -class CDeferredDragTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredDragTask( - CMessageFolderView* inFolderView, - const CMessageFolder& inDestFolder, - Boolean inDoCopy) - : mFolderView(inFolderView) - , mDestFolder(inDestFolder) - , mDoCopy(inDoCopy) - {} - protected: - CMessageFolderView* mFolderView; - CMessageFolder mDestFolder; - Boolean mDoCopy; // rather than move -}; - -//======================================================================================== -class CDeferredDragFolderTask -//======================================================================================== -: public CDeferredDragTask -{ - public: - CDeferredDragFolderTask( - CMessageFolderView* inFolderView, - const CMailSelection& inSelection, - const CMessageFolder& inDestFolder, - Boolean inDoCopy) - : CDeferredDragTask( - inFolderView - , inDestFolder - , inDoCopy) - , mSelection(inSelection) - {} - virtual ExecuteResult ExecuteSelf(); - protected: - CPersistentFolderSelection mSelection; -}; // class CDeferredDragFolderTask - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredDragFolderTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - // display modal dialog -// if (!NET_IsOffline()) // ? 97/08/13 someone removed this line. - // 98/01/26 it's because moving messages can take some time - even offline - { - short stringID = 15; // Copying / Moving Messages - CStr255 commandString; - ::GetIndString(commandString, 7099, stringID); - CMailProgressWindow* progressWindow = CMailProgressWindow::CreateModalParasite( - CMailProgressWindow::res_ID_modal, - mSelection.xpPane, - commandString); - if (progressWindow) - progressWindow->SetDelay(0); - } - - // copy / move messages - if (mDestFolder.IsTrash()) - { - // Special case. Back-end doesn't translate this into a delete, and - // presents an alert unless you're dragging mail folders. But it should - // work for news servers etc. So: - XP_Bool confirmPref; // Don't ever confirm a drag. - PREF_GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmPref); - if (confirmPref) - PREF_SetBoolPref("mailnews.confirm.moveFoldersToTrash", FALSE); - mFolderView->DoDeleteSelection(mSelection); - if (confirmPref) - PREF_SetBoolPref("mailnews.confirm.moveFoldersToTrash", confirmPref); - } - else - { - mFolderView->GetContext()->SetCurrentCommand(cmd_MoveMailMessages); - mFolderView->WatchFolderForChildren(mDestFolder); - ::MSG_MoveFoldersInto( - mSelection.xpPane, - mSelection.GetSelectionList(), - mSelection.selectionSize, - mDestFolder - ); - } - return eDoneDelete; -} // CDeferredDragFolderTask::ExecuteSelf - -//======================================================================================== -class CDeferredDragMessageTask -//======================================================================================== -: public CDeferredDragTask -{ - public: - CDeferredDragMessageTask( - CMessageFolderView* inFolderView, - const CMailSelection& inSelection, - const CMessageFolder& inDestFolder, - Boolean inDoCopy) - : CDeferredDragTask( - inFolderView - , inDestFolder - , inDoCopy) - , mSelection(inSelection) - {} - virtual ExecuteResult ExecuteSelf(); - protected: - CPersistentMessageSelection mSelection; -}; // class CDeferredDragMessageTask - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredDragMessageTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - mFolderView->DropMessages(mSelection, mDestFolder, mDoCopy); - return eDoneDelete; -} // CDeferredDragMessageTask::ExecuteSelf - -#pragma mark -- CMessageFolderView - -//---------------------------------------------------------------------------------------- -CMessageFolderView::CMessageFolderView(LStream *inStream) -//---------------------------------------------------------------------------------------- -: Inherited(inStream) -, mUpdateMailFolderMenus(false) -{ - mAllowDropAfterLastRow = false; -} // CMessageFolderView::CMessageFolderView - - -//---------------------------------------------------------------------------------------- -CMessageFolderView::~CMessageFolderView() -//---------------------------------------------------------------------------------------- -{ -} // CMessageFolderView::~CMessageFolderView - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::ItemIsAcceptable( - DragReference inDragRef, - ItemReference inItemRef ) -//---------------------------------------------------------------------------------------- -{ - FlavorFlags flavorFlags; - if (::GetFlavorFlags(inDragRef, inItemRef, kMailNewsSelectionDragFlavor, &flavorFlags) == noErr) - { - CMailSelection selection; - if (!mIsInternalDrop && GetSelectionFromDrag(inDragRef, selection)) - mIsInternalDrop = (selection.xpPane == GetMessagePane()); - return true; - } - return false; -} // CMessageFolderView::ItemIsAcceptable - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::GetSelectionAndCopyStatusFromDrag( - DragReference inDragRef, - CMessageFolder& inDestFolder, - CMailSelection& outSelection, - Boolean& outCopy) -// Return true if this is an OK drop operation. -//---------------------------------------------------------------------------------------- -{ - if (!GetSelectionFromDrag(inDragRef, outSelection)) - return false; - Boolean isFolderDrop = (::MSG_GetPaneType(outSelection.xpPane) == MSG_FOLDERPANE); - // Don't do anything if the user aborted by dragging back into the same first row. - // There are other cases, but the backend will alert anyway. In this simple case, - // the back-end alert is annoying. - - SInt16 modifiers; - ::GetDragModifiers(inDragRef, NULL, &modifiers, NULL); - outCopy = ((modifiers & optionKey) != 0); - MSG_DragEffect effect = outCopy ? MSG_Require_Copy : MSG_Default_Drag; - - // Ask the back end for guidance on what is possible: - if (isFolderDrop) - { - effect = ::MSG_DragFoldersIntoStatus( - outSelection.xpPane, - outSelection.GetSelectionList(), - outSelection.selectionSize, - inDestFolder, - effect); - if (effect == MSG_Drag_Not_Allowed && outCopy) - { - // Well, maybe a move is ok - effect = ::MSG_DragFoldersIntoStatus( - outSelection.xpPane, - outSelection.GetSelectionList(), - outSelection.selectionSize, - inDestFolder, - MSG_Default_Drag); - } - } - else - { - effect = ::MSG_DragMessagesIntoFolderStatus( - outSelection.xpPane, - outSelection.GetSelectionList(), - outSelection.selectionSize, - inDestFolder, - effect); - if (effect == MSG_Drag_Not_Allowed && outCopy) - { - // Well, maybe a move is ok - effect = ::MSG_DragMessagesIntoFolderStatus( - outSelection.xpPane, - outSelection.GetSelectionList(), - outSelection.selectionSize, - inDestFolder, - MSG_Default_Drag); - } - } - outCopy = (effect & MSG_Require_Copy) != 0; - return (effect != MSG_Drag_Not_Allowed); // this looks ok as a drop operation. -} // CMessageFolderView::GetSelectionAndCopyStatusFromDrag - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::DropMessages( - const CMailSelection& inSelection, - const CMessageFolder& inDestFolder, - Boolean inDoCopy) -//---------------------------------------------------------------------------------------- -{ - // display modal dialog -// if (!NET_IsOffline()) // ? 97/08/13 someone removed this line. - // 98/01/26 it's because moving messages can take some time - even offline - { - short stringID = (inDoCopy ? 19 : 15 ); // Copying / Moving Messages - CStr255 commandString; - ::GetIndString(commandString, 7099, stringID); - CMailProgressWindow* progressWindow = CMailProgressWindow::CreateModalParasite( - CMailProgressWindow::res_ID_modal, - inSelection.xpPane, - commandString); - if (progressWindow) - progressWindow->SetDelay(0); - } - - // Close any windows associated with these messages, if the preferences - // say we should. - CMessageWindow::NoteSelectionFiledOrDeleted(inSelection); - if (!inDoCopy) - ::MSG_MoveMessagesIntoFolder( - inSelection.xpPane, - inSelection.GetSelectionList(), - inSelection.selectionSize, - inDestFolder - ); - else - ::MSG_CopyMessagesIntoFolder( - inSelection.xpPane, - inSelection.GetSelectionList(), - inSelection.selectionSize, - inDestFolder - ); - -} // CMessageFolderView::DropMessages - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::CanDoInlineEditing() -// (override from CStandardFlexTable) -//---------------------------------------------------------------------------------------- -{ - CMessageFolder folder(mRowBeingEdited, GetMessagePane()); - Boolean outEnabled; - Boolean outUsesMark; - Char16 outMark; - Str255 outName; - FindCommandStatus(cmd_RenameFolder, outEnabled, outUsesMark, outMark, outName); - return outEnabled; -} - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::InlineEditorTextChanged() -// (override from CStandardFlexTable) -//---------------------------------------------------------------------------------------- -{ -} -//---------------------------------------------------------------------------------------- -void CMessageFolderView::InlineEditorDone() -// (override from CStandardFlexTable) -//---------------------------------------------------------------------------------------- -{ - if (mRowBeingEdited == LArray::index_Bad || !mNameEditor) - return; - CMessageFolder folder(mRowBeingEdited, GetMessagePane()); - char oldName[256]; - CMailFolderMixin::GetFolderNameForDisplay(oldName, folder); - CStr255 newName; - mNameEditor->GetDescriptor(newName); - if (newName != oldName) - { - char* newNameC = XP_STRDUP(newName); - if (newNameC) - { - ::MSG_RenameMailFolder(GetMessagePane(), folder, newNameC); - folder.FolderInfoChanged(GetMessagePane()); - XP_FREE(newNameC); - } - } -} // CMessageFolderView::InlineEditorDone - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::RowCanAcceptDrop( - DragReference inDragRef, - TableIndexT inDropRow) -// (override from CStandardFlexTable) -//---------------------------------------------------------------------------------------- -{ - Boolean dropOK = false; - - SInt16 modifiers; - ::GetDragModifiers(inDragRef, NULL, &modifiers, NULL); - Boolean doCopy = ((modifiers & optionKey) != 0); - - if (inDropRow >= 1 && inDropRow <= mRows) - { - CMessageFolder destFolder(inDropRow, GetMessagePane()); - CMailSelection selection; - dropOK = (GetSelectionAndCopyStatusFromDrag( - inDragRef, destFolder, - selection, doCopy)); - } - if (dropOK && doCopy) - { - CursHandle copyDragCursor = ::GetCursor(curs_CopyDrag); // finder's copy-drag cursor - if (copyDragCursor != nil) - ::SetCursor(*copyDragCursor); - } - else - ::SetCursor(&qd.arrow); - return dropOK; -} // CMessageFolderView::RowCanAcceptDrop - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::RowCanAcceptDropBetweenAbove( - DragReference inDragRef, - TableIndexT inDropRow) -// (override from CStandardFlexTable) -//---------------------------------------------------------------------------------------- -{ - if (inDropRow >= 1 && inDropRow <= mRows) - { - CMailSelection selection; - if (GetSelectionFromDrag(inDragRef, selection)) - { - // Dropping between rows signifies reordering. This is only allowed when the - // source pane of the drag is our own pane. - if (selection.xpPane != GetMessagePane()) - return false; - CMessageFolder destFolder(inDropRow, GetMessagePane()); - CMailSelection selection; - Boolean doCopy; - return GetSelectionAndCopyStatusFromDrag( - inDragRef, destFolder, - selection, doCopy); - } - } - return false; -} // CMessageFolderView::RowCanAcceptDropBetweenAbove - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::ReceiveDragItem( - DragReference inDragRef, - DragAttributes /*inDragAttrs*/, - ItemReference /*inItemRef*/, - Rect& /*inItemBounds*/) -//---------------------------------------------------------------------------------------- -{ - if (mDropRow == 0) return; // FIXME: when move to top level is implemented, do that! - - // What is the destination folder? - CMessageFolder destFolder(mDropRow, GetMessagePane()); - - // What are the items being dragged? - CMailSelection selection; - Boolean doCopy = false; - if (!GetSelectionAndCopyStatusFromDrag(inDragRef, destFolder, selection, doCopy)) - return; - - // We have to delay the drag in order to display any confirmation dialog - // from the BE (when moving a folder to the trash, for instance). - // Displaying a dialog in here crashes the Mac. - CDeferredDragTask* task = nil; - MSG_PaneType paneType = ::MSG_GetPaneType(selection.xpPane); - if (paneType == MSG_FOLDERPANE) - CDeferredTaskManager::Post( - new CDeferredDragFolderTask(this, selection, destFolder, doCopy), this); - else if (paneType == MSG_MESSAGEPANE) - CDeferredTaskManager::Post( - new CDeferredDragMessageTask(this, selection, destFolder, doCopy), this); - else // search pane? - DropMessages(selection, destFolder, doCopy); // devil take the hindmost. -} // CMessageFolderView::ReceiveDragItem - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::WatchFolderForChildren(MSG_FolderInfo* inFolderInfo) -//---------------------------------------------------------------------------------------- -{ - CFolderWatchingTask* task = new CFolderWatchingTask(this, inFolderInfo); - CDeferredTaskManager::Post(task, this); -} // CMessageFolderView::WatchFolderForChildren - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::DoAddNewsGroup() -//---------------------------------------------------------------------------------------- -{ - try - { - MSG_ViewIndex* indexList = NULL; - UInt32 numIndices = 0; - CMailSelection selection; - if (GetSelection(selection)) - { - //...unless there's a single item selected, and it's a newsgroup - if (selection.selectionSize == 1) - { - MSG_ViewIndex index = *(MSG_ViewIndex*)selection.GetSelectionList(); - MSG_FolderInfo* info = ::MSG_GetFolderInfo(GetMessagePane(), index); - CMessageFolder folder(info, GetMessagePane()); - if (folder.IsNewsHost()) - { - indexList = &index; - numIndices = 1; - } - } - } - MSG_Command( - GetMessagePane(), - MSG_AddNewsGroup, - indexList, - numIndices); - Refresh(); // works around a bug - we don't get notified. - } - catch(...) - { - } -} // CMessageFolderView::DoOpenNewsHost() - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::DeleteSelection() -// Delete all selected folders -//---------------------------------------------------------------------------------------- -{ - CMailSelection selection; - if (GetSelection(selection)) - { - // Deletion cannot occur if we are viewing the contents in a thread pane. - // So make a task (which clones the selection) then unselect the selected - // item (triggering an unload of the folder pane). Then post a delete - // task. - CDeleteSelectionTask* task = new CDeleteSelectionTask(this, selection); - UnselectAllCells(); - CDeferredTaskManager::Post(task, this); - } -} // CMessageFolderView::DeleteSelection - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::DoDeleteSelection(const CMailSelection& inSelection) -//---------------------------------------------------------------------------------------- -{ - try - { - mContext->SetCurrentCommand(cmd_Clear); // in case it was a keystroke - // If there's one mail folder in the selection being deleted, then - // watch the destination folder until the folder count changes. Otherwise - // (eg dragging newsgroups) we will wait forever, in vain... - MSG_ViewIndex* cur = (MSG_ViewIndex*)inSelection.GetSelectionList(); - MSG_FolderInfo* folderToWatch = nil; - for (int i = 0; i < inSelection.selectionSize; i++, cur++) - { - MSG_FolderInfo* info = ::MSG_GetFolderInfo(GetMessagePane(), *cur); - CMessageFolder folder(info, GetMessagePane()); - if (folder.IsMailFolder()) - { - ::MSG_GetFoldersWithFlag( - CMailNewsContext::GetMailMaster(), - MSG_FOLDER_FLAG_TRASH, - &folderToWatch, - 1); - break; - } - } - MSG_CommandType cmd = UMessageLibrary::GetMSGCommand(cmd_Clear); -#if 1 // (MSG_Delete != MSG_DeleteFolder) - if (cmd == MSG_Delete) - cmd = MSG_DeleteFolder; // This can go away when winfe becomes compliant. -#endif - ::MSG_Command( - GetMessagePane(), - cmd, - const_cast(inSelection.GetSelectionList()), - inSelection.selectionSize); - if (folderToWatch) - WatchFolderForChildren(folderToWatch); - } - catch(...) - { - } -} // CMessageFolderView::DoDeleteSelection() - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef) -//---------------------------------------------------------------------------------------- -{ - if (inRow == LArray::index_Bad || inRow > mRows) - return; - - Inherited::AddRowDataToDrag(inRow, inDragRef); // does nothing right now - - CMessageFolder folder(inRow, GetMessagePane()); - - // allow newsgroup text drags into compose window - if (folder.IsNewsgroup()) - { - MSG_FolderInfo *folderInfo = folder.GetFolderInfo(); - - URL_Struct *theURLStruct = ::MSG_ConstructUrlForFolder(GetMessagePane(), folderInfo); - - if (theURLStruct != nil) - { - - OSErr err = ::AddDragItemFlavor( inDragRef, inRow, 'TEXT', - theURLStruct->address, XP_STRLEN(theURLStruct->address), flavorSenderOnly); - - NET_FreeURLStruct(theURLStruct); - } - } - -} // CMessageFolderView::AddRowToDrag - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::CellInitiatesDrag(const STableCell& inCell) const -//---------------------------------------------------------------------------------------- -{ - return (GetCellDataType(inCell) == kFolderNameColumn); -} // CMessageFolderView::CellInitiatesDrag - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::GetRowDragRgn(TableIndexT inRow, RgnHandle ioHiliteRgn) const -// The drag region is the hilite region plus the icon -// Note that the row we are dragging may or may not be selected, so don't rely -// on the selection for anything. -//---------------------------------------------------------------------------------------- -{ - ::SetEmptyRgn(ioHiliteRgn); - Rect cellRect; - - TableIndexT col = GetHiliteColumn(); - if ( !col ) - col = 1; - STableCell cell(inRow, col); - if (!GetLocalCellRect(cell, cellRect)) - return false; - ResIDT iconID = GetIconID(inRow); - if (iconID) - { - GetIconRect(cell, cellRect, cellRect); - ::IconIDToRgn(ioHiliteRgn, &cellRect, kAlignNone, iconID); - } - StRegion cellRgn; - GetRowHiliteRgn(inRow, cellRgn); - ::UnionRgn(ioHiliteRgn, cellRgn, ioHiliteRgn); - - CMessageFolder folder(inRow, GetMessagePane()); - - // If this row is an expanded folder with children, then we need to - // add each child row to the drag also. - // If one of these child rows is selected, and we are dragging the selection, - // then it will get added twice, but this should not be a problem. - if (folder.CountSubFolders() > 0 && folder.IsOpen()) - { - UInt32 folderLevel = folder.GetLevel(); - STableCell nextCell(cell.row + 1, 1); - StRegion tempRgn; - - while (GetNextCell(nextCell)) - { - CMessageFolder subFolder(nextCell.row, GetMessagePane()); - UInt32 subFolderLevel = subFolder.GetLevel(); - - if (subFolderLevel <= folderLevel) - break; - - Inherited::GetRowDragRgn(nextCell.row, tempRgn); - ::UnionRgn(tempRgn, ioHiliteRgn, ioHiliteRgn); - } - } - - return true; -} // CStandardFlexTable::GetRowHiliteRgn - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::GetInfo() -//---------------------------------------------------------------------------------------- -{ - CMessageFolder folder(GetSelectedFolder()); - if (folder.GetFolderInfo()) - UGetInfo::ConductFolderInfoDialog(folder, this); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::OpenRow(TableIndexT inRow) -// See also CFolderThreadController::ListenToMessage -//---------------------------------------------------------------------------------------- -{ - CMessageFolder folder(inRow, GetMessagePane()); - if (folder.IsMailServer()) - { - UGetInfo::ConductFolderInfoDialog(folder, this); - return; - } - if (folder.IsNewsHost()) - { - MSG_Host* selectedHost = MSG_GetHostForFolder(folder); - CNewsSubscriber::DoSubscribeNewsGroup(selectedHost); - return; - } - if (!folder.CanContainThreads()) - return; - - Boolean forceNewWindow = false; - if (GetSelectedRowCount() > 1 && inRow != GetTableSelector()->GetFirstSelectedRow()) - { - STableCell cell(inRow, 1); - if (CellIsSelected(cell)) - forceNewWindow = true; - } - - CThreadWindow* threadWindow - = CThreadWindow::FindAndShow( - folder.GetFolderInfo(), - CThreadWindow::kMakeNew, - cmd_Nothing, - forceNewWindow); // Force new window for multiple selection. -} // CMessageFolderView::OpenRow - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::GetLongWindowDescription(CStr255& outDescription) -//---------------------------------------------------------------------------------------- -{ - ::GetIndString(outDescription, 7099, 11); // "Message Center For ^0" - char buffer[256]; int bufferLength = sizeof(buffer); - ::PREF_GetCharPref("mail.identity.username", buffer, &bufferLength); - ::StringParamText(outDescription, buffer); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::SelectionChanged() -//---------------------------------------------------------------------------------------- -{ - Inherited::SelectionChanged(); - TableIndexT rowCount = GetSelectedRowCount(); - URL_Struct* url = nil; - char entryName[128]; - entryName[0] = '\0'; - if (rowCount == 1) - { - CMailSelection selection; - GetSelection( selection ); - MSG_ViewIndex index = *(MSG_ViewIndex*)selection.GetSelectionList(); - MSG_FolderInfo* info = MSG_GetFolderInfo(GetMessagePane(), index); - MSG_FolderLine folderLine; - XP_Bool gotIt = ::MSG_GetFolderLineById( - CMailNewsContext::GetMailMaster(), - info, - &folderLine); - if (gotIt) - { - url = ::MSG_ConstructUrlForFolder(GetMessagePane(), info); - strcpy(entryName, folderLine.name); - } - } - else - { - // Use the name in the location bar for any potential bookmarks... - url = ::MSG_ConstructUrlForPane(GetMessagePane()); - CStr255 tempString; - GetLongWindowDescription(tempString); - strcpy(entryName, tempString); - } - if (url && *entryName) - { - // i18n problem- we need to convert entryName to UTF8 before call SHIST_CreateHistryEntry - // We didn't do that because mail/news is not alive yet.... - History_entry* theNewEntry = SHIST_CreateHistoryEntry( - url, - entryName); - SHIST_AddDocument(*mContext, theNewEntry); - } - XP_FREEIF(url); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::ListenToMessage(MessageT inMessage, void* ioParam) -//---------------------------------------------------------------------------------------- -{ - // button messages. - if (!IsOnDuty() || !ObeyCommand(inMessage, ioParam)) - { - Inherited::ListenToMessage(inMessage, ioParam); - } -} // CMessageFolderView::ListenToMessage - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::FindMessageLibraryCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -// returns false if not a msglib command. -//---------------------------------------------------------------------------------------- -{ - // Interpret MarkSelectedRead as "mark all read" (ie, in this folder) - if (inCommand == cmd_MarkSelectedRead) - inCommand = cmd_MarkAllRead; - return Inherited::FindMessageLibraryCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); -} - -//---------------------------------------------------------------------------------------- -void CMessageFolderView::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//---------------------------------------------------------------------------------------- -{ - // Preprocessing before calling UMessageLibrary - switch (inCommand) - { - case cmd_NewFolder: - outEnabled = true; - return; - case cmd_NewNewsgroup: - MSG_FolderInfo* folderInfo = GetSelectedFolder(); - inCommand = cmd_NewFolder; - if (folderInfo != nil) - { - CMessageFolder folder(folderInfo, GetMessagePane()); - if (folder.IsNewsgroup() || folder.IsNewsHost()) - inCommand = cmd_NewNewsgroup; - } - break; - - case cmd_OpenSelection: // enabled in base class - { - MSG_FolderInfo* folderInfo = GetSelectedFolder(); - if (folderInfo != nil) - { - CMessageFolder folder(folderInfo, GetMessagePane()); - short strID = 0; - if (folder.IsNewsgroup()) - strID = kOpenDiscussionStrID; - else if (folder.IsMailServer()) - strID = kOpenMailServerStrID; - else if (folder.IsNewsHost()) - strID = kOpenNewsServerStrID; - else if (folder.IsMailFolder()) - strID = kOpenFolderStrID; - if (strID != 0) - ::GetIndString(outName, kMailNewsMenuStrings, strID); - } - break; - } - case cmd_OpenSelectionNewWindow: - { - MSG_FolderInfo* folderInfo = GetSelectedFolder(); - if (folderInfo != nil) - { - CMessageFolder folder(folderInfo, GetMessagePane()); - if (folder.IsMailServer() || folder.IsNewsHost()) - { - outEnabled = false; - return; - } - } - break; - } - case cmd_GetMoreMessages: - CStr255 cmdStr; - CStr255 numStr; - ::GetIndString(cmdStr, kMailNewsMenuStrings, kNextChunkMessagesStrID); - ::NumToString(CPrefs::GetLong(CPrefs::NewsArticlesMax), numStr); - cmdStr += numStr; - memcpy(outName, (StringPtr)cmdStr, cmdStr.Length() + 1); - break; - - case cmd_Stop: - if (mStillLoading) - { - outEnabled = true; // stop button on, nothing else. - return; - } - break; - #if 0 - // 97/10/20. Fall through to the inherited version. - // We don't handle it as a menu command - only internally. - case cmd_NewsGroups: // Expand news host - case cmd_MailNewsFolderWindow: // Expand mail host - outEnabled = true; - return; -#endif // 0 - case cmd_GetInfo: - if (GetSelectedRowCount() != 1) - { - outEnabled = false; - return; - } - outEnabled = true; - return; - - case cmd_Clear: - folderInfo = GetSelectedFolder(); - if (folderInfo != nil) { - CMessageFolder folder(folderInfo, GetMessagePane()); - if (!folder.IsMailServer()) - outEnabled = true; - } - return; - - case cmd_AddToBookmarks: - { - MSG_FolderInfo* folderInfo = GetSelectedFolder(); - if (folderInfo != nil) - { - CMessageFolder folder(folderInfo, GetMessagePane()); - if (folder.IsIMAPMailFolder() || folder.IsNewsHost()) - { - outEnabled = false; - return; - } - } - break; // call inherited:: - } - } // switch - - if (!mStillLoading && FindMessageLibraryCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName)) - return; - - switch (inCommand) - { - case cmd_OpenNewsHost: - case cmd_AddNewsgroup: - case cmd_SubscribeNewsgroups: - outEnabled = !mStillLoading; - break; - default: - Inherited::FindCommandStatus( - inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} // CMessageFolderView::FindCommandStatus - -//---------------------------------------------------------------------------------------- -Boolean CMessageFolderView::ObeyCommand( - CommandT inCommand, - void *ioParam) -//---------------------------------------------------------------------------------------- -{ - if (!mContext) - return false; - - Boolean cmdHandled = false; - CNSContext* originalContext = mContext; // in case we close the window & delete it! - CommandT saveCommand = mContext->GetCurrentCommand(); - mContext->SetCurrentCommand(inCommand); - switch (inCommand) - { - case msg_TabSelect: - return (IsVisible()); // Allow selection only if pane is visible -#if 0 - // This now HAS to be handled by the top commander (application), because the behavior - // has to be different depending on whether we are in a message center window or a 3-pane - // thread window. - case cmd_NewsGroups: // Select first news host - case cmd_MailNewsFolderWindow: // Select first mail host - SelectFirstFolderWithFlags( - inCommand == cmd_NewsGroups - ? MSG_FOLDER_FLAG_NEWS_HOST - : MSG_FOLDER_FLAG_MAIL); - cmdHandled = true; - break; -#endif // 0 - case cmd_SecurityInfo: - MWContext * context = *mContext; - SECNAV_SecurityAdvisor( context, NULL ); - cmdHandled =true; - break; - //----------------------------------- - // News - //---------------------------------------------------------------------------------------- - case cmd_OpenNewsHost: - CNewsSubscriber::DoAddNewsHost(); - cmdHandled = true; - break; - case cmd_SubscribeNewsgroups: - MSG_Host* selectedHost = MSG_GetHostForFolder(GetSelectedFolder()); - CNewsSubscriber::DoSubscribeNewsGroup(selectedHost); - cmdHandled = true; - break; - case cmd_AddNewsgroup: - DoAddNewsGroup(); - cmdHandled = true; - break; - //----------------------------------- - // Special cases - //---------------------------------------------------------------------------------------- -#if 0 - // Not needed - have inline editing now (and the menu item is gone). - case cmd_RenameFolder: - UpdateMailFolderMenusOnNextUpdate(); - break; -#endif - case cmd_NewFolder: - case cmd_NewNewsgroup: - { - MSG_FolderInfo* folderInfo = GetSelectedFolder(); - CMessageFolder folder(folderInfo, GetMessagePane()); - if (folderInfo && (folder.IsNewsgroup() || folder.IsNewsHost())) - inCommand = cmd_NewNewsgroup; // no 'cmdHandled = true' here - else - { - UFolderDialogs::ConductNewFolderDialog(folder); - cmdHandled = true; - } - break; - } - } - //----------------------------------- - // MSGLIB commands - //----------------------------------- - if (!cmdHandled) - cmdHandled = ObeyMessageLibraryCommand(inCommand, ioParam) - || Inherited::ObeyCommand(inCommand, ioParam); - //----------------------------------- - // Cleanup - //----------------------------------- - // The following test against originalContext protects against the cases (quit, close) - // when the object has been deleted. The test against cmdHandled protects against - // re-entrant calls to ListenToMessage. - - if (cmdHandled && mContext == originalContext) - mContext->SetCurrentCommand(cmd_Nothing); - - if (! cmdHandled) - mContext->SetCurrentCommand(saveCommand); - return cmdHandled; -} // CMessageFolderView::ObeyCommand - -#if defined(QAP_BUILD) -//---------------------------------------------------------------------------------------- -void CMessageFolderView::GetQapRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -// Calculate the text and (if ioRect is not passed in as null) a rectangle that fits it. -// Return result indicates if any of the text is visible in the cell -//---------------------------------------------------------------------------------------- -{ - if (!outText || inMaxBufferLength == 0) - return; - - cstring rowText(""); - char tempStr[cMaxMailFolderNameLength]; - CMessageFolder folder(inRow, GetMessagePane()); - short colCount = mTableHeader->CountVisibleColumns(); - - CMailNewsWindow * myWindow = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (!myWindow) return; - - for (short col = 1; col <= colCount; col ++) - { - STableCell aCell(inRow, col); - LTableHeader::SColumnData * colData = mTableHeader->GetColumnData(col); - if (!colData) break; - LPane * colPane = myWindow->FindPaneByID(colData->paneID); - if (!colPane) break; - - // get column name - CStr255 descriptor; - colPane->GetDescriptor(descriptor); - rowText += descriptor; - rowText += "=\042"; - - // add cell text - switch (GetCellDataType(aCell)) - { - case kFolderNameColumn: - Boolean expanded; - if (CellHasDropFlag(aCell, expanded)) - { - if (expanded) - rowText += "-"; - else - rowText += "+"; - } - else - rowText += " "; - - CMailFolderMixin::GetFolderNameForDisplay(tempStr, folder); - NET_UnEscape(tempStr); - rowText += tempStr; - break; - - case kFolderNumUnreadColumn: - if (folder.CanContainThreads()) - if (folder.CountMessages() != 0) - { - sprintf(tempStr, "%d", folder.CountUnseen()); - rowText += tempStr; - } - break; - - case kFolderNumTotalColumn: - if (folder.CanContainThreads()) - if (folder.CountMessages() != 0) - { - sprintf(tempStr, "%d", folder.CountMessages()); - rowText += tempStr; - } - break; - } - if (col < colCount) - rowText += "\042 | "; - else - rowText += "\042\r"; - } - strncpy(outText, (char*)rowText, inMaxBufferLength); - outText[inMaxBufferLength - 1] = '\0'; -} // CMessageFolderView::GetQapRowText -#endif //QAP_BUILD diff --git a/mozilla/cmd/macfe/MailNews/CMessageFolderView.h b/mozilla/cmd/macfe/MailNews/CMessageFolderView.h deleted file mode 100644 index abd337f110a..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageFolderView.h +++ /dev/null @@ -1,149 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageFolderView.h - -#pragma once - -#include -#include - -#include "CSimpleFolderView.h" -#include "msgcom.h" - -class CThreadView; -class CThreadWindow; -class CStr255; -class CMessageFolder; -class CMailSelection; - -//====================================== -class CMessageFolderView : public CSimpleFolderView -//====================================== -{ -private: - typedef CSimpleFolderView Inherited; -public: - enum - { class_ID = 'msFv' - }; - - CMessageFolderView(LStream *inStream); - virtual ~CMessageFolderView(); - - // ------------------------------------------------------------ - // Command implementation - // ------------------------------------------------------------ - void DoAddNewsGroup(); - - virtual void DeleteSelection(); - void DoDeleteSelection(const CMailSelection& inSelection); - - void GetLongWindowDescription(CStr255& outDescription); - virtual void OpenRow(TableIndexT inRow); - virtual void SelectionChanged(); // maintain history - virtual void GetInfo(); // called from the base class. - void DropMessages( - const CMailSelection& inSelection, - const CMessageFolder& inDestFolder, - Boolean doCopy); - -protected: - - inline void OpenFolder(UInt32 inFolderIndex) { OpenRow(inFolderIndex); } - - // ------------------------------------------------------------ - // Hierarchy - // ------------------------------------------------------------ - virtual Boolean CellInitiatesDrag(const STableCell& inCell) const; - virtual Boolean GetRowDragRgn(TableIndexT inRow, RgnHandle ioHiliteRgn) const; - - // ------------------------------------------------------------ - // LDragAndDrop overrides - // ------------------------------------------------------------ - virtual void AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef); - virtual Boolean ItemIsAcceptable(DragReference inDragRef, ItemReference inItemRef); - virtual void ReceiveDragItem( - DragReference inDragRef, - DragAttributes inDragAttrs, - ItemReference inItemRef, - Rect& inItemBounds); - - // Specials from CStandardFlexTable - virtual Boolean CanDoInlineEditing(); - virtual void InlineEditorTextChanged(); - virtual void InlineEditorDone(); - virtual Boolean RowCanAcceptDrop( - DragReference inDragRef, - TableIndexT inDropRow); - virtual Boolean RowCanAcceptDropBetweenAbove( - DragReference inDragRef, - TableIndexT inDropRow); - Boolean GetSelectionAndCopyStatusFromDrag( - DragReference inDragRef, - CMessageFolder& inDestFolder, - CMailSelection& outSelection, - Boolean& outCopy); - - //----------------------------------- - // Commands - //----------------------------------- - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); -public: - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); -protected: - virtual Boolean FindMessageLibraryCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - //----------------------------------- - // Messaging - //----------------------------------- - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - // msg - -public: - void WatchFolderForChildren(MSG_FolderInfo* inFolderInfo); - - // ------------------------------------------------------------ - // QA Partner support - // ------------------------------------------------------------ -#if defined(QAP_BUILD) -public: - virtual void GetQapRowText(TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const; -#endif - - // ------------------------------------------------------------ - // Data - // ------------------------------------------------------------ - - Boolean mUpdateMailFolderMenus; -}; // class CMessageFolderView - diff --git a/mozilla/cmd/macfe/MailNews/CMessageSearchWindow.cp b/mozilla/cmd/macfe/MailNews/CMessageSearchWindow.cp deleted file mode 100644 index 568eb5d2865..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageSearchWindow.cp +++ /dev/null @@ -1,328 +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. - */ - - - -// CMessageSearchWindow.cp - -#define DEBUGGER_ASSERTIONS - -#include "CMessageSearchWindow.h" -#include "LGAPushButton.h" -#include "SearchHelpers.h" -#include "CMessageWindow.h" -#include "CMessageView.h" -#include "msgcom.h" -#include "CMailNewsContext.h" -#include "CSearchTableView.h" -#include "CMailFolderButtonPopup.h" -#include "libi18n.h" -#include "nc_exception.h" -#include "UIHelper.h" -#include "UMailSelection.h" - -//----------------------------------- -CMessageSearchWindow::CMessageSearchWindow(LStream *inStream) : - CSearchWindowBase(inStream, WindowType_SearchMailNews), - mGoToFolderBtn( nil ), mMsgScopePopup( nil ), - mFileMessagePopup( nil ), scopeInfo( nil ) -//----------------------------------- -{ - SetPaneID( pane_ID ); - mNumBasicScopeMenuItems = 3; -} - -//----------------------------------- -CMessageSearchWindow::~CMessageSearchWindow() -//----------------------------------- -{ -} - -//----------------------------------- -void CMessageSearchWindow::FinishCreateSelf() -//----------------------------------- -{ - // get controls - FindUIItemPtr( this, paneID_MsgScopePopup, mMsgScopePopup ); - FindUIItemPtr( this, paneID_GoToFolder, mGoToFolderBtn ); - FindUIItemPtr( this, paneID_FilePopup, mFileMessagePopup ); - - // initialize the move popup control - CMailFolderMixin::FolderChoices filePopupChoices - = static_cast(CMailFolderMixin::eWantPOP + CMailFolderMixin::eWantIMAP); - mFileMessagePopup->MSetFolderChoices( filePopupChoices ); - CMailFolderMixin::UpdateMailFolderMixinsNow( mFileMessagePopup ); - - // add listeners - mGoToFolderBtn->AddListener( this ); - mFileMessagePopup->AddListener( this ); - mMsgScopePopup->AddListener( this ); - - // disable the selection controls until we get a result - DisableSelectionControls(); - - Inherited::FinishCreateSelf(); -} - -//----------------------------------- -void CMessageSearchWindow::SetUpBeforeSelecting() -// Set up the window just before it is selected and brought to the front of other -// windows in the app. -//----------------------------------- -{ - // Clear the selected search list - mSearchFolders.RemoveItemsAt(LArray::index_Last, LArray::index_First); - - // Determine front window status - CMailFlexTable* frontSearchTable = nil; - CMailNewsWindow* frontMailWindow = nil; - GetDefaultSearchTable(frontMailWindow, frontSearchTable); - - //Figure out which folderinfo to use as the scope. - MSG_FolderInfo* msgFolderInfo = nil; - - if (frontSearchTable) - { - // Get the xp message pane - MSG_Pane* msgPane = frontSearchTable->GetMessagePane(); - // Set up search flags and selected folder list - AssertFail_(msgPane != nil); - MSG_PaneType paneType = MSG_GetPaneType(msgPane); - switch ( paneType ) - { - case MSG_FOLDERPANE: - if (!frontSearchTable->IsValidRow(1)) - return; - // If there's a single selection, make it the default. Otherwise, - // use the first row. - CMailSelection theSelection; - frontSearchTable->GetSelection(theSelection); - AssertFail_(MSG_GetPaneType(theSelection.xpPane) == MSG_FOLDERPANE); - AssertFail_(theSelection.xpPane == msgPane); - MSG_ViewIndex defaultIndex = 0; - if (theSelection.selectionSize == 1) - defaultIndex = *theSelection.GetSelectionList(); - msgFolderInfo = ::MSG_GetFolderInfo( - theSelection.xpPane, - defaultIndex); - break; - - case MSG_THREADPANE: - msgFolderInfo = ::MSG_GetCurFolder(msgPane); - AssertFail_(msgFolderInfo); - break; - - default: - AssertFail_(false); // No other types accepted now! - break; - } // switch - } - else // message window case - { - CMessageWindow* messageWindow = dynamic_cast(frontMailWindow); - if (messageWindow) - { - CMessageView* messageView = messageWindow->GetMessageView(); - if (messageView) - msgFolderInfo = messageView->GetFolderInfo(); - } - } - // As a last resort, use the inbox - if (!msgFolderInfo) - { - ::MSG_GetFoldersWithFlag( - CMailNewsContext::GetMailMaster(), - MSG_FOLDER_FLAG_INBOX, - &msgFolderInfo, - 1); - } - AssertFail_(msgFolderInfo); - mMsgScopePopup->MSetSelectedFolder(msgFolderInfo, false); - - // Get the folder csid and set it - SetWinCSID(INTL_DocToWinCharSetID( MSG_GetFolderCSID( msgFolderInfo ) )); - - mSearchFolders.InsertItemsAt(1, LArray::index_Last, &msgFolderInfo); - mSearchManager.SetSearchScope( - (MSG_ScopeAttribute)CSearchManager::cScopeMailSelectedItems, - &mSearchFolders); -} // CMessageSearchWindow::SetUpBeforeSelecting - -//----------------------------------- -void CMessageSearchWindow::MessageWindStop(Boolean inUserAborted) -//----------------------------------- -{ - if ( mSearchManager.IsSearching() ) - { - Inherited::MessageWindStop(inUserAborted); - - // enable controls - EnableSelectionControls(); - UpdatePort(); - } -} - -//----------------------------------- -void CMessageSearchWindow::MessageWindSearch() -//----------------------------------- -{ - // Disable controls - DisableSelectionControls(); - UpdatePort(); - - Inherited::MessageWindSearch(); -} // CMessageSearchWindow::MessageWindSearch() - - -//----------------------------------- -void CMessageSearchWindow::UpdateTableStatusDisplay() -//----------------------------------- -{ - AssertFail_(mResultsTable != nil); - Inherited::UpdateTableStatusDisplay(); - - XP_Bool enabled = false; - TableIndexT numSelectedItems = mResultsTable->GetSelectedRowCount(); - if ( numSelectedItems > 0 ) - { - CMailSelection selection; - mResultsTable->GetSelection(selection); - enabled = MSG_GoToFolderStatus(mSearchManager.GetMsgPane(), - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize); - } - - if (enabled) - EnableSelectionControls(); - else - DisableSelectionControls(); -} // CMessageSearchWindow::UpdateTableStatusDisplay() - -//----------------------------------- -void CMessageSearchWindow::EnableSelectionControls() -// -// Enable selection controls -//----------------------------------- -{ - mGoToFolderBtn->Enable(); - mFileMessagePopup->Enable(); -} - -//----------------------------------- -void CMessageSearchWindow::DisableSelectionControls() -// -// Disable selection controls -//----------------------------------- -{ - mGoToFolderBtn->Disable(); - mFileMessagePopup->Disable(); -} - -//----------------------------------- -void CMessageSearchWindow::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case msg_FilePopup: - // make sure we have a result table - AssertFail_(mResultsTable != nil); - - // get the selection from the table - CMailSelection moveSelection; - mResultsTable->GetSelection( moveSelection ); - - // get the destination - MSG_FolderInfo* selectedDestination = ( (MSG_FolderInfo*) ioParam ); - - // get the search pane - MSG_Pane *searchPane = mSearchManager.GetMsgPane(); - - // sanity check - #ifdef DEBUG - if( selectedDestination == nil || searchPane == nil ) - throw ; - #endif - - try - { - // move the selected messages - int status = MSG_MoveMessagesIntoFolder( searchPane, moveSelection.GetSelectionList(), - moveSelection.selectionSize, selectedDestination ); - - // Currently the enum eSuccess is doubly defined in two different BE headers. So in order - // to prevent possible conflicts I just check for the succes value ( 0 ) - if ( status != 0 ) - throw mail_exception( eMoveMessageError ); - } - catch( mail_exception& error ) - { - error.DisplaySimpleAlert(); - } - break; - - case msg_GoToFolder: - AssertFail_(mResultsTable != nil); - CMailSelection selection; - mResultsTable->GetSelection(selection); - for (MSG_ViewIndex index = 0; index < selection.selectionSize; index ++) - { - mResultsTable->FindOrCreateThreadWindowForMessage( - selection.GetSelectionList()[index]); - } - - { - // HACK to support opening of more than one folder - EventRecord ignoredEvent = {0}; - LPeriodical::DevoteTimeToIdlers(ignoredEvent); - } - - for (MSG_ViewIndex index = 0; index < selection.selectionSize; index ++) - { - mResultsTable->ShowMessage( - selection.GetSelectionList()[index], - CSearchTableView::kAddToThreadWindowSelection); - } - break; - - case msg_MsgScope: - // get folder info - scopeInfo = ( ( MSG_FolderInfo*) ioParam ); - if (mSearchFolders.GetCount() == 0) - mSearchFolders.InsertItemsAt(1, 1, &scopeInfo); - else - mSearchFolders.AssignItemsAt(1, 1, &scopeInfo); - - // set the scope - mSearchManager.SetSearchScope( static_cast( CSearchManager::cScopeMailSelectedItems ), - &mSearchFolders ); - - SetWinCSID(INTL_DocToWinCharSetID(MSG_GetFolderCSID((MSG_FolderInfo *) ioParam))); - break; - - default: - Inherited::ListenToMessage(inMessage, ioParam); - break; - } -} // CMessageSearchWindow::ListenToMessage - -MSG_ScopeAttribute -CMessageSearchWindow::GetWindowScope() const -{ - return static_cast( CSearchManager::cScopeMailSelectedItems ); -} diff --git a/mozilla/cmd/macfe/MailNews/CMessageSearchWindow.h b/mozilla/cmd/macfe/MailNews/CMessageSearchWindow.h deleted file mode 100644 index 083db8c6a90..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageSearchWindow.h +++ /dev/null @@ -1,76 +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. - */ - - - -// CMessageSearchWindow.h - -#pragma once - -#include "CSearchWindowBase.h" - -class LGAPushButton; -class CFolderScopeGAPopup; -class CFolderMoveGAPopup; - -//====================================== -class CMessageSearchWindow : public CSearchWindowBase -//====================================== -{ -private: - typedef CSearchWindowBase Inherited; -public: - - enum { class_ID = 'SchW', pane_ID = class_ID, res_ID = 8600 }; - - enum { - paneID_GoToFolder = 'GOTO' - ,paneID_FilePopup = 'FILm' - ,paneID_MsgScopePopup = 'SCOP' - }; - - enum { - msg_FilePopup = 'FILm' - ,msg_GoToFolder = 'GOTO' - ,msg_MsgScope = 'ScMs' - }; - - CMessageSearchWindow(LStream *inStream); - virtual ~CMessageSearchWindow(); - virtual void SetUpBeforeSelecting(); - -protected: - virtual MSG_ScopeAttribute GetWindowScope() const; - - virtual void FinishCreateSelf(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual ResIDT GetStatusResID() const { return res_ID; } - virtual void MessageWindStop(Boolean inUserAborted); - virtual void MessageWindSearch(); - virtual void UpdateTableStatusDisplay(); - -private: - void EnableSelectionControls(); - void DisableSelectionControls(); - - CFolderScopeGAPopup *mMsgScopePopup; - LGAPushButton *mGoToFolderBtn; - CFolderMoveGAPopup *mFileMessagePopup; - MSG_FolderInfo *scopeInfo; - -}; // class CMessageSearchWindow diff --git a/mozilla/cmd/macfe/MailNews/CMessageView.cp b/mozilla/cmd/macfe/MailNews/CMessageView.cp deleted file mode 100644 index 12fc524a472..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageView.cp +++ /dev/null @@ -1,1367 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageView.cp - -#include "CMessageView.h" - -#include "CMailNewsContext.h" -#include "CBrowserContext.h" - -#include "resgui.h" -#include "Netscape_Constants.h" -#include "MailNewsgroupWindow_Defines.h" - -#include "CNewsSubscriber.h" -#include "UMessageLibrary.h" -#include "UMailFolderMenus.h" -#include "CMailFolderButtonPopup.h" -#include "CMailProgressWindow.h" -#include "CHTMLClickRecord.h" -#include "CHyperScroller.h" -#include "UOffline.h" - -#include "msg_srch.h" - -#include "uprefd.h" -#include "libi18n.h" // for INTL_CanAutoSelect proto -#include "secnav.h" -#include "CMessageAttachmentView.h" -#include "CApplicationEventAttachment.h" -#include "macutil.h" // TrySetCursor -#include "uerrmgr.h" // GetPString prototype -#include "ufilemgr.h" -#include "URobustCreateWindow.h" -#include "CUrlDispatcher.h" -#include "UDeferredTask.h" - -#include "shist.h" -#include "prefapi.h" - -#include "CURLDispatcher.h" -// The msglib callbacks -// The call backs -extern "C" -{ - - void MacFe_AttachmentCount(MSG_Pane *messagepane, void* closure, - int32 numattachments, XP_Bool finishedloading); - void MacFe_UserWantsToSeeAttachments(MSG_Pane* messagepane, void* closure); -} - -//---------------------------------------------------------------------------------------- -void MacFe_AttachmentCount(MSG_Pane *messagepane, void* /*closure*/, - int32 numattachments, XP_Bool finishedloading) -//---------------------------------------------------------------------------------------- -{ - MWContext * context = MSG_GetContext( messagepane); - CMessageView* messageView =dynamic_cast( context->fe.newView); - - if( messageView ) - { - LWindow* window = LWindow::FetchWindowObject(messageView->GetMacPort()); - - CMessageAttachmentView* attachmentView = - dynamic_cast(window->FindPaneByID('MATv')); - - if( attachmentView ) - { - #if 0 // code automatically shows attachment pane - // should be disabled when the attachment button works - if( numattachments >0 ) - attachmentView->Show(); - #endif - if( finishedloading || attachmentView->IsVisible() ) - { - attachmentView->SetMessageAttachmentList(messagepane, numattachments); - } - } - } -} - -//---------------------------------------------------------------------------------------- -void MacFe_UserWantsToSeeAttachments(MSG_Pane* messagepane, void* /*closure*/) -//---------------------------------------------------------------------------------------- -{ - MWContext * context = MSG_GetContext( messagepane); - CMessageView* messageView =dynamic_cast( context->fe.newView); - - if( messageView ) - { - LWindow* window = LWindow::FetchWindowObject(messageView->GetMacPort()); - - CMessageAttachmentView* attachmentView = - dynamic_cast(window->FindPaneByID('MATv')); - if( attachmentView ) - attachmentView->ToggleVisibility(); - } -} - -MSG_MessagePaneCallbacks MsgPaneCallBacks = { - MacFe_AttachmentCount, - MacFe_UserWantsToSeeAttachments -}; - -#pragma mark - - -//======================================================================================== -class CDeferredMessageViewTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredMessageViewTask(CMessageView* inView); - protected: - Boolean AvailableForDeferredTask() const; -// data - protected: - CMessageView* mMessageView; - UInt32 mEarliestExecuteTime; -}; // class CDeferredLoadKeyTask - - // It's expensive to load a message, and if the user is nervously clicking - // on multiple messages we only want to load the last one. -#define LOAD_MESSAGE_DELAY 15 // was GetDblTime() - -//---------------------------------------------------------------------------------------- -CDeferredMessageViewTask::CDeferredMessageViewTask(CMessageView* inView) -//---------------------------------------------------------------------------------------- -: mMessageView(inView) -, mEarliestExecuteTime(::TickCount() + LOAD_MESSAGE_DELAY) -{ -} - -//---------------------------------------------------------------------------------------- -Boolean CDeferredMessageViewTask::AvailableForDeferredTask() const -//---------------------------------------------------------------------------------------- -{ - // Wait till any pending URLs are finished - CNSContext* context = mMessageView->GetContext(); - if (!context) - return false; - if (XP_IsContextBusy((MWContext*)(*context))) - return false; - if (CMailProgressWindow::GetModal()) - return false; // wait until other modal tasks are done. - // Wait for the earliest execute time. - if (::TickCount() < mEarliestExecuteTime) - return false; - return true; -} // CDeferredMessageViewTask::AvailableForDeferredTask - -#pragma mark - - -//======================================================================================== -class CDeferredLoadKeyTask -//======================================================================================== -: public CDeferredMessageViewTask -{ - public: - CDeferredLoadKeyTask( - CMessageView* inView, - MSG_FolderInfo* inFolder, - MessageKey inKey); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - MSG_FolderInfo* mFolderToLoadAtIdle; - MessageKey mMessageToLoadAtIdle; -}; // class CDeferredLoadKeyTask - -//---------------------------------------------------------------------------------------- -CDeferredLoadKeyTask::CDeferredLoadKeyTask( - CMessageView* inView, - MSG_FolderInfo* inFolder, - MessageKey inKey) -//---------------------------------------------------------------------------------------- -: CDeferredMessageViewTask(inView) -, mFolderToLoadAtIdle(inFolder) -, mMessageToLoadAtIdle(inKey) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredLoadKeyTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (!AvailableForDeferredTask()) - return eWaitStayFront; - mMessageView->ShowMessage( - CMailNewsContext::GetMailMaster(), - mFolderToLoadAtIdle, - mMessageToLoadAtIdle, - true); - return eDoneDelete; -} // CDeferredLoadKeyTask::ExecuteSelf - -#pragma mark - - -//======================================================================================== -class CDeferredLoadURLTask -//======================================================================================== -: public CDeferredMessageViewTask -{ - public: - CDeferredLoadURLTask( - CMessageView* inView, - const char* inURLToLoadAtIdle); - virtual ~CDeferredLoadURLTask(); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - const char* mURLToLoadAtIdle; -}; // class CDeferredLoadURLTask - -//---------------------------------------------------------------------------------------- -CDeferredLoadURLTask::CDeferredLoadURLTask( - CMessageView* inView, - const char* inURLToLoadAtIdle) -//---------------------------------------------------------------------------------------- -: CDeferredMessageViewTask(inView) -, mURLToLoadAtIdle(XP_STRDUP(inURLToLoadAtIdle)) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredLoadURLTask::~CDeferredLoadURLTask() -//---------------------------------------------------------------------------------------- -{ - XP_FREEIF((char*)mURLToLoadAtIdle); -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredLoadURLTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (!AvailableForDeferredTask()) - return eWaitStayFront; - mMessageView->ShowURLMessage(mURLToLoadAtIdle, true); - return eDoneDelete; -} // CDeferredLoadURLTask::ExecuteSelf - -#pragma mark - - -//---------------------------------------------------------------------------- -CMessageView::CMessageView(LStream* inStream) -// --------------------------------------------------------------------------- -#ifdef INHERIT_FROM_BROWSERVIEW -: CBrowserView(inStream) -#else -: CHTMLView(inStream) -#endif -, mMessagePane(nil) -, mMasterCommander(nil) -, mClosing(false) -, mAttachmentView(nil) -, mLoadingNakedURL(false) -, mMotionPendingCommand((MSG_MotionType)-1) -, mDeferredCloseTask(nil) -{ -} // CMessageView::CMessageView - -// --------------------------------------------------------------------------- -CMessageView::~CMessageView() -// --------------------------------------------------------------------------- -{ - mClosing = true; - - if (mMessagePane) - { - MSG_SetMessagePaneCallbacks( mMessagePane, NULL, NULL); - MSG_DestroyPane(mMessagePane); - } -} // CMessageView::~CMessageView - -// --------------------------------------------------------------------------- -void CMessageView::FinishCreateSelf() -// --------------------------------------------------------------------------- -{ - Inherited::FinishCreateSelf(); - SetDefaultScrollMode(LO_SCROLL_YES); // always display scrollbars - SetEraseBackground(FALSE); // don't erase background when browsing mails -} - -// --------------------------------------------------------------------------- -Boolean CMessageView::IsDueToCloseLater() const -// --------------------------------------------------------------------------- -{ - return mDeferredCloseTask != nil; -} - -// --------------------------------------------------------------------------- -void CMessageView::SetDueToCloseLater() -// --------------------------------------------------------------------------- -{ - mDeferredCloseTask = CDeferredCloseTask::DeferredClose(this); -} - - -// --------------------------------------------------------------------------- -void CMessageView::ShowMessage( - MSG_Master* inMsgMaster, - MSG_FolderInfo* inMsgFolderInfo, - MessageKey inMessageKey, - Boolean inLoadNow) -// --------------------------------------------------------------------------- -{ - // There has to be a folder, unless we're clearing the message. - Assert_(inMsgMaster && (inMsgFolderInfo || inMessageKey == MSG_MESSAGEKEYNONE)); - if (!inLoadNow) - { - CDeferredLoadKeyTask* task = new CDeferredLoadKeyTask(this, inMsgFolderInfo, inMessageKey); - CDeferredTaskManager::Post1(task, this); - return; - } - if (!mMessagePane) - { - mMessagePane = ::MSG_CreateMessagePane(*mContext, inMsgMaster); - ThrowIfNULL_(mMessagePane); - ::MSG_SetFEData(mMessagePane, CMailCallbackManager::Get()); - CMailCallbackListener::SetPane( mMessagePane ); - ::MSG_SetMessagePaneCallbacks( mMessagePane, &MsgPaneCallBacks, NULL); - - } - if (inMessageKey != GetCurMessageKey()) - { - if( mAttachmentView ) - { - mAttachmentView->ClearMessageAttachmentView(); - mAttachmentView->Hide(); - } - // ::SetCursor(*::GetCursor(watchCursor)); - mLoadingNakedURL = false; - - if (::MSG_LoadMessage(mMessagePane, inMsgFolderInfo, inMessageKey) != 0) - { - CloseLater(); - throw (OSErr)memFullErr; - } - if (inMessageKey == MSG_MESSAGEKEYNONE) - ClearMessageArea(); // please read comments in that routine. - } -} // CMessageView::ShowMessage - -// --------------------------------------------------------------------------- -void CMessageView::ClearMessageArea() -// MSG_LoadMessage, with MSG_MESSAGEKEYNONE calls msg_ClearMessageArea, which -// has a bug (drawing the background in grey). So I just changed MSG_LoadMessage() to -// do nothing for XP_MAC except set its m_Key to MSG_MESSAGEKEYNONE and exit. This transfers -// the responsibility for clearing the message area to the front end. So far, so good. -// -// Now, it's no good just painting the area, because the next refresh will redraw using the -// existing history entry. So somehow we have to remove the history entry. -// There's no API for doing this, except calling SHIST_AddDocument with an entry whose -// address string is null or empty. -// -// If this state of affairs changes, this code will break, but I put in asserts to -// notify us about it. 98/01/21 -// --------------------------------------------------------------------------- -{ - if ( XP_IsContextBusy((MWContext*)(*mContext)) ) // #107826 - return; - LO_DiscardDocument(*mContext); // Necessary cleanup. See also CThreadView::UpdateHistoryEntry(). - // To create a URL_Struct, you have to pass a non-null string for the address, or it returns nil. - // Next-best thing is an empty string, which works. - URL_Struct* url = NET_CreateURLStruct("", NET_NORMAL_RELOAD); - Assert_(url); - History_entry* newEntry = ::SHIST_CreateHistoryEntry(url, "Nobody Home"); - XP_FREEIF(url); - Assert_(newEntry); - // Using an empty address string will cause "AddDocument" to do a removal of the old entry, - // then delete the new entry, and exit. - ::SHIST_AddDocument(*mContext, newEntry); - Assert_(!mContext->GetCurrentHistoryEntry()); // Yay! That was the point of all this. - Refresh(); - // HTMLView will now clear the background on redraw. -} // CMessageView::ClearMessageArea - -// --------------------------------------------------------------------------- -void CMessageView::AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent) -// --------------------------------------------------------------------------- -{ - if (GetCurMessageKey() == MSG_MESSAGEKEYNONE) - ::SetCursor(&qd.arrow); - else if (mContext && XP_IsContextBusy((MWContext*)(*mContext))) - ::SetCursor(*::GetCursor(watchCursor)); - else - Inherited::AdjustCursorSelf(inPortPt, inMacEvent); -} // CMessageView::AdjustCursorSelf - -// --------------------------------------------------------------------------- -void CMessageView::ShowURLMessage( - const char* inURL, - Boolean inLoadNow) -// --------------------------------------------------------------------------- -{ - Assert_(inURL); - if (!inLoadNow) - { - CDeferredLoadURLTask* task = new CDeferredLoadURLTask(this, inURL); - CDeferredTaskManager::Post1(task, this); - return; - } - if (!mMessagePane) - { - mMessagePane = MSG_CreateMessagePane(*mContext, CMailNewsContext::GetMailMaster()); - ThrowIfNULL_(mMessagePane); - MSG_SetFEData(mMessagePane, CMailCallbackManager::Get()); - CMailCallbackListener::SetPane( mMessagePane ); - MSG_SetMessagePaneCallbacks(mMessagePane, &MsgPaneCallBacks, NULL); - } - ::SetCursor(*::GetCursor(watchCursor)); - SetDefaultCSID(mContext->GetDefaultCSID()); - URL_Struct* urls = NET_CreateURLStruct(inURL, NET_DONT_RELOAD); - ThrowIfNULL_(urls); - urls->msg_pane = mMessagePane; - mContext->SwitchLoadURL(urls, FO_CACHE_AND_PRESENT); - mLoadingNakedURL = true; // so we can synthesise FE_PaneChanged on AllConnectionsComplete. - //FE_PaneChanged(GetMessagePane(), false, MSG_PaneNotifyMessageLoaded, 0); - -} // CMessageView::ShowURLMessage - -// --------------------------------------------------------------------------- -void CMessageView::ShowSearchMessage( - MSG_Master *inMsgMaster, - MSG_ResultElement *inResult, - Boolean inNoFolder) -// --------------------------------------------------------------------------- -{ - Assert_(inMsgMaster); - if (!mMessagePane) - { - mMessagePane = MSG_CreateMessagePane(*mContext, inMsgMaster); - ThrowIfNULL_(mMessagePane); - MSG_SetFEData(mMessagePane, CMailCallbackManager::Get()); - } - mLoadingNakedURL = inNoFolder; - MSG_SearchError error = MSG_OpenResultElement(inResult, mMessagePane); - if ( error != SearchError_Success ) { - if ( (error == SearchError_OutOfMemory) || (error == SearchError_NullPointer) ) { - FailOSErr_(memFullErr); - } else { - FailOSErr_(paramErr); - } - } -} // CMessageView::ShowSearchMessage - -// --------------------------------------------------------------------------- -void CMessageView::FileMessageToSelectedPopupFolder(const char *ioFolderName, - Boolean inMoveMessages) -// File selected messages to the specified BE folder. If inMoveMessages is true, move -// the messages, otherwise copy them. -// --------------------------------------------------------------------------- -{ -#ifdef Debug_Signal - const char *curName = ::MSG_GetFolderNameFromID(GetFolderInfo()); - Assert_(strcasecomp(curName, ioFolderName) != 0); - // Specified folder should not be the same as this folder -#endif // Debug_Signal - - if ( GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP ) - inMoveMessages = false; - - MSG_ViewIndex index = GetCurMessageViewIndex(); - if ( inMoveMessages ) { - ::MSG_MoveMessagesInto(GetMessagePane(), &index, 1, ioFolderName); - } else { - ::MSG_CopyMessagesInto(GetMessagePane(), &index, 1, ioFolderName); - } -} // CThreadWindow::FileMessagesToSelectedPopupFolder - -// --------------------------------------------------------------------------- -void CMessageView::YieldToMaster() -// An ugly solution, but after trying many, it's the only one that worked. -// make sure this view isn't target if there's a thread view in the same window. -// --------------------------------------------------------------------------- -{ - if (mMasterCommander) - SwitchTarget(mMasterCommander); -} - -// --------------------------------------------------------------------------- -void CMessageView::ClickSelf(const SMouseDownEvent& where) -// make sure a message view isn't target if there's a thread view. -// 97/10/21. In Gromit (v5.0), we don't do this any more. -// --------------------------------------------------------------------------- -{ - Inherited::ClickSelf(where); -// YieldToMaster(); -} // CMessageView::ClickSelf - -// --------------------------------------------------------------------------- -void CMessageView::FindCommandStatus( - CommandT inCommand, - Boolean& outEnabled, - Boolean& outUsesMark, - Char16& outMark, - Str255 outName) -// --------------------------------------------------------------------------- -{ - outUsesMark = false; - outEnabled = false; - if (mClosing) // don't respond to BE callbacks when being destroyed - return; - // Need to this up here other wise the HTMLView gets a crack at this command - if( inCommand == cmd_SecurityInfo ) - { - if( mMessagePane ) - outEnabled = ( GetCurMessageKey() != MSG_MESSAGEKEYNONE ); - return; - } - - if (mMessagePane && mContext) - { - if (XP_IsContextBusy((MWContext*)(*mContext))) - { - // Disable everything except the "stop" button - // (and cmd_About: kludge for BUG#68886) - // - // It is of course really bad that the recalculation - // of command status is being short-circuited like this. - // TODO: Someone should fix this the right way. - if (inCommand == cmd_Stop) - { - outEnabled = true; - ::GetIndString(outName, STOP_STRING_LIST, STOP_LOADING_INDEX ); - } - else if (inCommand == cmd_About) - { - outEnabled = true; - } - return; - } - - - switch (inCommand) - { - // Should always be enabled - case cmd_SubscribeNewsgroups: - outEnabled = true; - return; - - case cmd_ViewSource: - case cmd_DocumentInfo: - if (GetCurMessageKey() == MSG_MESSAGEKEYNONE) - return; - break; - - case cmd_Stop: - { - // Note that the context is not busy, but "stop" might mean "stop animations" - if (mContext->IsContextLooping()) - { - outEnabled = true; - ::GetIndString(outName, STOP_STRING_LIST, STOP_ANIMATIONS_INDEX ); - } - return; - } - - } // switch - if (inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) - { - // yeah, I know, this code isn't pretty, but I copied and - // pasted this from Akbar (v3.0) - outEnabled = true; - outUsesMark = true; - - Int16 csid = CPrefs::CmdNumToDocCsid( inCommand ); - outMark = (csid == mContext->GetDefaultCSID()) ? checkMark : ' '; - return; - } - if (mLoadingNakedURL) - { - // Do NOT allow any message library commands - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, - outMark, outName); - return; - } - if (UMessageLibrary::FindMessageLibraryCommandStatus( - GetMessagePane(), - NULL, - 0, - inCommand, - outEnabled, - outUsesMark, - outMark, - outName)) - return; - MSG_MotionType cmd = UMessageLibrary::GetMotionType(inCommand); - if (UMessageLibrary::IsValidMotion(cmd)) - { - XP_Bool selectable; - outEnabled = ( - mMessagePane - && MSG_NavigateStatus(mMessagePane, cmd, GetCurMessageViewIndex(), &selectable, NULL) == 0 - && selectable - ); - outUsesMark = false; - return; - } - else if ( (inCommand == cmd_MoveMailMessages) || (inCommand == cmd_CopyMailMessages) || - CMailFolderSubmenu::IsMailFolderCommand(&inCommand) ) - { - // Mail folder commands - outEnabled = true; - return; - } - } - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, - outMark, outName); -} // CMessageView::FindCommandStatus - -// --------------------------------------------------------------------------- -Boolean CMessageView::ObeyMotionCommand(MSG_MotionType cmd) -// --------------------------------------------------------------------------- -{ - if (!mMessagePane) return false; - Assert_(UMessageLibrary::IsValidMotion(cmd)); - try - { - MSG_ViewIndex resultIndex; - MessageKey resultKey; - MSG_FolderInfo* finfo; - if (MSG_ViewNavigate( - mMessagePane, - cmd, - GetCurMessageViewIndex(), - &resultKey, - &resultIndex, - NULL, - &finfo) == 0) - { - /*ThrowIfError_(MSG_LoadMessage( - mMessagePane, - finfo ? finfo : GetFolderInfo(), - resultKey));*/ - if (resultKey != MSG_MESSAGEKEYNONE) - { - ShowMessage( - CMailNewsContext::GetMailMaster(), - finfo ? finfo : GetFolderInfo(), - resultKey); - } - else if ( finfo != NULL ) - { - switch( cmd ) - { - case MSG_NextFolder: - case MSG_NextMessage: - mMotionPendingCommand = MSG_FirstMessage; - break; - case MSG_NextUnreadMessage: - case MSG_NextUnreadThread: - case MSG_NextUnreadGroup: - case MSG_LaterMessage: - case (MSG_MotionType)MSG_ToggleThreadKilled: - mMotionPendingCommand = MSG_NextUnreadMessage; - break; - default: - break; - } - MSG_LoadFolder( mMessagePane, finfo ); - } - return true; - } - } - catch (...) - { - SysBeep(1); - } - return false; - -} // CMessageView::ObeyMotionCommand - -//---------------------------------------------------------------------------------------- -void CMessageView::CloseLater() -//---------------------------------------------------------------------------------------- -{ - // Oh, I wish: - //((MWContext*)*mContext)->msgCopyInfo->moveState.nextKeyToLoad = MSG_MESSAGEKEYNONE; - SetDueToCloseLater(); // delete me next time - StartIdling(); -} // CMessageView::CloseLater - -//---------------------------------------------------------------------------------------- -Boolean CMessageView::MaybeCloseLater(CommandT inCommand) -// This checks that we are a stand-alone message window, then, according to the preference, -// marks the window for death on the next idle. -//---------------------------------------------------------------------------------------- -{ - // If we are not a stand-alone pane, don't do this. To detect if we're stand-alone, use - // mMasterCommander, which will be set to the thread view if we're in a multipane view. - if (mMasterCommander) - return false; - const char* prefName = nil; - if (inCommand == cmd_Clear) - prefName = "mail.close_message_window.on_delete"; - else if (inCommand == cmd_MoveMailMessages || inCommand == cmd_CopyMailMessages) - prefName = "mail.close_message_window.on_file"; - else - return false; - XP_Bool closeOption; - if (PREF_GetBoolPref("mail.close_message_window.on_delete", &closeOption) == PREF_NOERROR - && closeOption) - { - CloseLater(); - return true; - } - return false; -} // CMessageView::MaybeCloseLater - -// --------------------------------------------------------------------------- -Boolean CMessageView::ObeyCommand(CommandT inCommand, void *ioParam) -// --------------------------------------------------------------------------- -{ - if (!mContext) - return false; - if (mClosing) // don't respond to BE callbacks when being destroyed - return false; - if (inCommand != cmd_Stop && XP_IsContextBusy((MWContext*)(*mContext))) - return false; - - // If you're reading a discussion message, and you want to compose a new message, the new - // message is, by default, addressed to that discussion group... this test and reassignment - // are necessary to make this happen - if ( (inCommand == cmd_NewMailMessage) && (GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) ) { - inCommand = cmd_PostNew; - } - - switch (inCommand) - { - case msg_TabSelect: - return (GetCurMessageKey()); // Allow selection only if a message is loaded. - case cmd_Stop: - { - TrySetCursor(watchCursor); - XP_InterruptContext(*mContext); - SetCursor( &qd.arrow ); - return true; - } - - // Implement this here instead of browser view since for browser windows we want - // the benefit of AE recording. The AE sending/receiving code is currenty in - // CBrowserWindow and we don't want the view to know about the window. - case cmd_Reload: - { - if (GetContext()) - { - CBrowserContext* theTopContext = GetContext()->GetTopContext(); - - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) || - CApplicationEventAttachment::CurrentEventHasModifiers(shiftKey)) - { - theTopContext->LoadHistoryEntry(CBrowserContext::index_Reload, true); - } - else - { - theTopContext->LoadHistoryEntry(CBrowserContext::index_Reload); - } - } - - return true; - } - break; - - case cmd_SecurityInfo: - { - URL_Struct* url = MSG_ConstructUrlForMessage(GetMessagePane(), GetCurMessageKey()); - SECNAV_SecurityAdvisor((MWContext*)*(GetContext()), url ); - NET_FreeURLStruct(url); - return true; - } - - case cmd_SubscribeNewsgroups: - { - MSG_Host* selectedHost = MSG_GetHostForFolder(GetFolderInfo()); - CNewsSubscriber::DoSubscribeNewsGroup(selectedHost); - return true; - } - - - #if 0 // CHTMLView handles this - case cmd_SAVE_LINK_AS: - { - - // Convert cmd_SAVE_LINK_AS to cmd_OPEN_LINK for an attachment link. - // This is a temporary fix for the issue that "Save link as" will save - // mime otherwise. A better solution would be to have a different command - // in the context menu (cmd_SAVE_ATTACHMENT_AS). - CHTMLClickRecord* cr = mCurrentClickRecord; // for brevity. - const char* url = cr->GetClickURL(); - if (!strncasecomp (url, "mailbox:", 8)) - { - if (XP_STRSTR(url, "?part=") || XP_STRSTR(url, "&part=")) - { - // Yep, mail attachment. - URL_Struct* theURL = NET_CreateURLStruct( url, NET_DONT_RELOAD); - ThrowIfNULL_(theURL); - FSSpec locationSpec; - memset(&locationSpec, 0, sizeof(locationSpec)); - CURLDispatcher::GetURLDispatcher()->DispatchToStorage( - theURL, locationSpec, FO_SAVE_AS, true); - return true; - } - } - break; - - } - #endif // 0 - } // switch - Boolean cmdHandled = false; - MSG_CommandType cmd = UMessageLibrary::GetMSGCommand(inCommand); - if (UMessageLibrary::IsValidCommand(cmd)) - { - // If there is a the thread view (we're not really supposed to know about it, :-) ) - // then give it first crack. - if (mMasterCommander && mMasterCommander->ObeyCommand(inCommand, ioParam)) - return true; - Boolean enabled; Boolean usesMark; Char16 mark; CStr255 commandName; - - if (! UMessageLibrary::FindMessageLibraryCommandStatus( - GetMessagePane(), - (MSG_ViewIndex*)nil, - 0, - inCommand, enabled, usesMark, mark, commandName) - || !enabled) - return false; - try - { - if (cmd == MSG_GetNewMail || cmd == MSG_GetNextChunkMessages) - { - if (NET_IsOffline()) - { - // Bug #105393. This fails unhelpfully if the user is offline. There - // used to be a test for this here, but for some reason it was - // removed. This being so, the newly agreed-upon fix is that, if - // the user requests new messages while offline, we should instead - // present the "Go Online" dialog. See also CMailFlexTable.cp. - // - 98/02/10 jrm. - PREF_SetBoolPref("offline.download_discussions", cmd==MSG_GetNextChunkMessages); - PREF_SetBoolPref("offline.download_mail", cmd==MSG_GetNewMail); - UOffline::ObeySynchronizeCommand(); - } - else - { - CMailProgressWindow::ObeyMessageLibraryCommand( - CMailProgressWindow::res_ID_modeless, - GetMessagePane(), - cmd, - commandName); - } - } - else - { - MSG_Command(GetMessagePane(), cmd, nil, 0); - MaybeCloseLater(inCommand); - } - } - catch(...) - { - } - cmdHandled = true; - } - if (!cmdHandled) - { - MSG_MotionType mcmd = UMessageLibrary::GetMotionType(inCommand); - if (UMessageLibrary::IsValidMotion(mcmd)) - { - if (mMasterCommander) // give these to the thread view (for select after delete) - return mMasterCommander->ObeyCommand(inCommand, ioParam); - cmdHandled = ObeyMotionCommand(mcmd); - } - - } - if (!cmdHandled) - { - // Mail folder commands. We come here either from a button (broadcast) or - // from a menu command (synthetic). - const char* folderPath = nil; - if (inCommand == cmd_MoveMailMessages || inCommand == cmd_CopyMailMessages) - { - // Button case - if ( ioParam ) - folderPath = ::MSG_GetFolderNameFromID((MSG_FolderInfo*)ioParam); - } - else if (!CMailFolderSubmenu::IsMailFolderCommand(&inCommand, &folderPath)) // menu case - { - folderPath = nil; // any other case. - } - if (folderPath && *folderPath) - { - if (mMasterCommander) // give these to the thread view (for select after delete) - return mMasterCommander->ObeyCommand(inCommand, ioParam); - FileMessageToSelectedPopupFolder( - folderPath, - inCommand == cmd_MoveMailMessages); - MaybeCloseLater(inCommand); - return true; - } - } - - if (!cmdHandled) - { - switch ( inCommand ) - { - case cmd_SaveDefaultCharset: - { - Int32 default_csid = mContext->GetDefaultCSID(); - CPrefs::SetLong(default_csid, CPrefs::DefaultCharSetID); - cmdHandled = true; - } - break; - - default: - { - if ( inCommand > ENCODING_BASE && inCommand < ENCODING_CEILING ) - { - SetDefaultCSID(CPrefs::CmdNumToDocCsid(inCommand)); - cmdHandled = true; - } - } - } - } - if (!cmdHandled) - cmdHandled = Inherited::ObeyCommand(inCommand, ioParam); - return cmdHandled; -} // CMessageView::ObeyCommand - -// --------------------------------------------------------------------------- -void CMessageView::ListenToMessage(MessageT inMessage, void* ioParam) -// --------------------------------------------------------------------------- -{ - switch(inMessage) - { - case msg_NSCAllConnectionsComplete: - SetCursor(&UQDGlobals::GetQDGlobals()->arrow); - if (mLoadingNakedURL) - FE_PaneChanged(GetMessagePane(), false, MSG_PaneNotifyMessageLoaded, 0); - if( mMotionPendingCommand != (MSG_MotionType)-1 ) - { - ObeyMotionCommand( mMotionPendingCommand ); - mMotionPendingCommand = (MSG_MotionType)-1; - } - // Need to enable the menus since we may just have loaded a new message using imap - SetUpdateCommandStatus( true ); - break; - - /* - case cmd_SecurityInfo: - case cmd_Reload: - case cmd_Stop: - ObeyCommand(inMessage, ioParam); - return; - */ - - default: - if (!IsOnDuty() || !ObeyCommand(inMessage, ioParam)) - Inherited::ListenToMessage(inMessage, ioParam); - } // switch - - CMailCallbackListener::ListenToMessage(inMessage, ioParam); -} // CMessageView::ListenToMessage - -// --------------------------------------------------------------------------- -Boolean CMessageView::HandleKeyPress(const EventRecord& inKeyEvent) -// --------------------------------------------------------------------------- -{ - if (inKeyEvent.what == keyUp) - return false; - Char16 c = inKeyEvent.message & charCodeMask; - switch (c) - { - case char_Backspace: - case char_FwdDelete: - ObeyCommand(cmd_Clear, NULL); - return true; - - case char_Space: - CHyperScroller* messageViewScroller = GetScroller(); - Boolean shiftKeyDown = (inKeyEvent.modifiers & shiftKey) != 0; - - if ( messageViewScroller ) - { - if ( !shiftKeyDown && messageViewScroller->ScrolledToMaxVerticalExtent() ) - { - CDeferredCommand* deferredGoCommand = new CDeferredCommand(mMasterCommander, cmd_NextMessage, NULL); - CDeferredTaskManager::Post1(deferredGoCommand, this); - return true; - } - - if ( shiftKeyDown && messageViewScroller->ScrolledToMinVerticalExtent() ) - { - CDeferredCommand* deferredGoCommand = new CDeferredCommand(mMasterCommander, cmd_PreviousMessage, NULL); - CDeferredTaskManager::Post1(deferredGoCommand, this); - return true; - } - } - // FALL THROUGH - - default: - Inherited::HandleKeyPress(inKeyEvent); - return true; - } // switch - return false; -} // CMessageView::HandleKeyPress - -// --------------------------------------------------------------------------- -MessageKey CMessageView::GetCurMessageKey() const -// --------------------------------------------------------------------------- -{ - MessageKey result = MSG_MESSAGEKEYNONE; - if (mMessagePane && !mLoadingNakedURL) - ::MSG_GetCurMessage(mMessagePane, NULL, &result, NULL); - return result; -} // CMessageView::GetCurMessageKey - -// --------------------------------------------------------------------------- -MSG_FolderInfo* CMessageView::GetFolderInfo() const -// --------------------------------------------------------------------------- -{ - MSG_FolderInfo* result = NULL; - if (mMessagePane) - ::MSG_GetCurMessage(mMessagePane, &result, NULL, NULL); - return result; -} // CMessageView::GetFolderInfo - -// --------------------------------------------------------------------------- -MSG_ViewIndex CMessageView::GetCurMessageViewIndex() const -// --------------------------------------------------------------------------- -{ - MSG_ViewIndex result; - ::MSG_GetCurMessage(mMessagePane, NULL, NULL, &result); - return result; -} // CMessageView::GetCurMessageViewIndex - -// --------------------------------------------------------------------------- -uint32 CMessageView::GetFolderFlags() const -// --------------------------------------------------------------------------- -{ - MSG_FolderInfo* folderInfo = GetFolderInfo(); - if (folderInfo) - { - MSG_FolderLine folderLine; - MSG_GetFolderLineById(CMailNewsContext::GetMailMaster(), folderInfo, &folderLine); - return folderLine.flags; - } - return 0; -} // CMessageView::GetFolderFlags - -// --------------------------------------------------------------------------- -uint32 CMessageView::GetCurMessageFlags() const -// --------------------------------------------------------------------------- -{ - MessageKey key = GetCurMessageKey(); - if (key != MSG_MESSAGEKEYNONE) - { - MSG_MessageLine info; - ::MSG_GetThreadLineById(mMessagePane, key, &info); - return info.flags; - } - return 0; -} // CMessageView::GetCurMessageFlags - -enum { MSG_PaneNotifyOKToLoadNewMessage = 999 }; // also in msgmpane.cpp - -// --------------------------------------------------------------------------- -void CMessageView::PaneChanged( - MSG_Pane*, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -// --------------------------------------------------------------------------- -{ - switch (inNotifyCode) - { - case MSG_PaneNotifyOKToLoadNewMessage: - *(XP_Bool*)value = !IsDueToCloseLater(); - return; - case MSG_PaneNotifyFolderLoaded: - /*if (mMotionPendingCommand != (MSG_MotionType)-1) - { - ObeyMotionCommand( mMotionPendingCommand ); - mMotionPendingCommand = (MSG_MotionType)-1; - }*/ - break; - - case MSG_PaneNotifyMessageLoaded: - if (!mMasterCommander) - { - // If we're in a a stand-alone message window, we're responsible for - // this. Otherwise, the thread view is. - if (MSG_GetBacktrackState(GetMessagePane()) == MSG_BacktrackIdle) - { - MSG_AddBacktrackMessage( - GetMessagePane(), - GetFolderInfo(), - GetCurMessageKey()); - } - else - MSG_SetBacktrackState(GetMessagePane(), MSG_BacktrackIdle); - // Need to enable the menus since we may just have loaded a new message using imap - SetUpdateCommandStatus(true); - } - break; - case MSG_PaneNotifyFolderDeleted: - if ((MSG_FolderInfo*)value != GetFolderInfo()) - break; - // else fall through - case MSG_PaneNotifyMessageDeleted: - // As of 98/01/23, this notification is never received. - LWindow* win = LWindow::FetchWindowObject(GetMacPort()); - if (win) - win->AttemptClose(); - break; - case MSG_PaneNotifyCopyFinished: - // This means that a copy that was run in this messagepane has completed. - MaybeCloseLater(cmd_MoveMailMessages); - break; - default: - break; - } -} // CMessageView::PaneChanged - -// --------------------------------------------------------------------------- -void CMessageView::SetContext(CBrowserContext* inNewContext) -// --------------------------------------------------------------------------- -{ - if (mAttachmentView) - { - mAttachmentView->ClearMessageAttachmentView(); // before we destroy the pane! - mAttachmentView->Hide(); - } - // If this is a "set to nil" call, then we must call MSG_DestroyPane - // before calling the inherited method, because MSG_Lib will attempt - // to call back into the context during destruction.... - if (!inNewContext && mMessagePane) - { - // Interrupting the context later after the message pane is destroyed can - // cause problems. - // Bug #106218 (crash closing before load finished). - // Before calling interrupt context, make sure it doesn't call us back. Previously, - // this next call was after the call to XP_InterruptContext() -- jrm 98/02/13 - ::MSG_SetMessagePaneCallbacks(mMessagePane, NULL, NULL); - if( mContext ) - XP_InterruptContext(*mContext); - ::MSG_DestroyPane(mMessagePane); - mMessagePane = nil; - } - Inherited::SetContext(inNewContext); -} // CMessageView::SetContext - -// --------------------------------------------------------------------------- -void CMessageView::InstallBackgroundColor() -// Overridden to use a white background -// --------------------------------------------------------------------------- -{ - // ¥ install the user's default solid background color & pattern - memset(&mBackgroundColor, 0xFF, sizeof(mBackgroundColor)); // white is default -} - -// --------------------------------------------------------------------------- -void CMessageView::SetBackgroundColor( - Uint8 /*inRed*/, - Uint8 /*inGreen*/, - Uint8 /*inBlue*/) -// Overridden to use a white background -// --------------------------------------------------------------------------- -{ - // Do not allow the layout weenies to clobber mail message backgrounds. - Inherited::SetBackgroundColor(0xFF, 0xFF, 0xFF); // white is default -} - -// --------------------------------------------------------------------------- -Boolean CMessageView::SetDefaultCSID(Int16 default_csid, Boolean forceRepaginate /* = false */) -// --------------------------------------------------------------------------- -{ - if (mContext && default_csid != mContext->GetDefaultCSID()) - mContext->SetDocCSID(default_csid); - - Inherited::SetDefaultCSID(default_csid); // ¥¥¥ do we want the repaginate fix?? - return true; -} // CMessageView::SetDefaultCSID - -// --------------------------------------------------------------------------- -void CMessageView::GetDefaultFileNameForSaveAs(URL_Struct* url, CStr31& defaultName) -// --------------------------------------------------------------------------- -{ - // Overridden by CMessageView to use the message subject. - MSG_MessageLine info; - MSG_GetThreadLineById(GetMessagePane(), GetCurMessageKey(), &info); - // remove useless and bad characters. - char buf[32]; - char* dst = buf; - char* src = info.subject; - size_t len = strlen(src); - char* srcEnd = src + len - 1; - while (*srcEnd == ']') - { - *srcEnd-- = '\0'; - len--; - } - while (true) - { - char* bracket = strchr(src, '['); - if (bracket) - { - len -= (bracket - src + 1); - src = bracket + 1; - continue; - } - break; - } - - char* lastPlaceInBuffer = buf+31; - char c; - do - { - c = *src++; - // rough stab at removing junk from the subject. - if (c == ':' || c == '[' || c == ']') - continue; - *dst++ = c; - } while (c && dst < lastPlaceInBuffer ); - defaultName = buf; // CStr31 does the truncation. - if (defaultName.Length() == 0) - Inherited::GetDefaultFileNameForSaveAs(url, defaultName); -} // CMessageView::GetDefaultFileNameForSaveAs - - -// 97-06-18 -// This method gets called when window changes size. -// Make sure we call mContext->Repaginate() -// In mail/news call reload method to NET_NORMAL_RELOAD -// ** NOTE: ** -// This method goes around CHTMLView::AdaptToSuperFrameSize, so if that code -// changes, we should make the appropriate changes here also. -// --------------------------------------------------------------------------- -void CMessageView::AdaptToSuperFrameSize( -// --------------------------------------------------------------------------- - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh) -{ - LView::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh); - - if (IsRootHTMLView()) - { - if ((mContext != NULL) && ((inSurrWidthDelta != 0) || (inSurrHeightDelta != 0))) - mContext->Repaginate(NET_NORMAL_RELOAD); - } -} - -// --------------------------------------------------------------------------- -void CMessageView::DispatchURL( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - Boolean inDelay, - Boolean inForceCreate, - FO_Present_Types inOutputFormat) -// --------------------------------------------------------------------------- -{ - Inherited::DispatchURL(inURLStruct, inTargetContext, inDelay, inForceCreate, inOutputFormat); -} - -// --------------------------------------------------------------------------- -void CMessageView::DispatchURL(CURLDispatchInfo* inDispatchInfo) -// --------------------------------------------------------------------------- -{ - Boolean openBrowserWindow = true; - const char* urlOfLink = inDispatchInfo->GetURL(); - - char* mimeType = MimeGetURLContentType((MWContext *)(*mContext), urlOfLink); - - if (mimeType) - { - CMimeMapper* mapper = CPrefs::sMimeTypes.FindMimeType( mimeType ); - if (mapper) - switch (mapper->GetLoadAction()) { - case CMimeMapper::Save: - case CMimeMapper::Launch: - case CMimeMapper::Unknown: - openBrowserWindow = false; - break; - } - if (!XP_STRCMP( mimeType, MULTIPART_APPLEDOUBLE )) - openBrowserWindow = false; - - XP_FREE(mimeType); - } - - if (!openBrowserWindow) { - // Decide where to put the file... - CStr31 fileName; - OSErr err; - FSSpec parentFolder; - FSSpec destSpec; - - fe_FileNameFromContext(*mContext, urlOfLink, fileName); - parentFolder = CPrefs::GetFilePrototype( CPrefs::DownloadFolder ); - err = CFileMgr::UniqueFileSpec( parentFolder, fileName, destSpec ); - ThrowIfError_(err); - - - - inDispatchInfo->SetFileSpec(destSpec); - CBrowserContext* theContext = nil; - CDownloadProgressWindow* theProgressWindow = nil; - try - { - theContext = new CBrowserContext(MWContextSaveToDisk); - ThrowIfNULL_(theContext); - theProgressWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(WIND_DownloadProgress, LCommander::GetTopCommander())); - ThrowIfNULL_(theProgressWindow); - - theProgressWindow->SetWindowContext(theContext); - - theProgressWindow->Show(); - theProgressWindow->Select(); - - theContext->ImmediateLoadURL(inDispatchInfo->ReleaseURLStruct(), FO_CACHE_AND_PRESENT); - } - catch(...) - { - delete theContext; - delete theProgressWindow; - } - } else { - - // Set target context to nil if we're not dispatching to an internal anchor - // so that we don't lay out into message view. An internal anchor will START - // with a '#'. Note that dispatching to a new window from a message view - // is never wrong. But loading weird stuff into the same message view IS. - if (!XP_STRCHR(urlOfLink, '#')) - inDispatchInfo->SetTargetContext(nil); // not an anchor of any kind - else if (urlOfLink[0] != '#') // If starts with '#', definitely internal - doesn't occur in practice. - { - // It's an anchor. But is it internal? - URL_Struct* urlStructForMessage = MSG_ConstructUrlForMessage(GetMessagePane(), GetCurMessageKey()); - const char* urlForMessage = urlStructForMessage->address; - if (strstr(urlOfLink, urlForMessage) != urlOfLink) - { - // it's not a link to THIS message - inDispatchInfo->SetTargetContext(nil); - } - NET_FreeURLStruct(urlStructForMessage); - } - Inherited::DispatchURL(inDispatchInfo); - } -} // CMessageView::DispatchURL diff --git a/mozilla/cmd/macfe/MailNews/CMessageView.h b/mozilla/cmd/macfe/MailNews/CMessageView.h deleted file mode 100644 index fcb11a963e5..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageView.h +++ /dev/null @@ -1,167 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageView.h - -#pragma once - -#define INHERIT_FROM_BROWSERVIEW -#ifdef INHERIT_FROM_BROWSERVIEW -#include "CBrowserView.h" -#else -#include "CHTMLView.h" -#endif - -#include "MailNewsCallbacks.h" - -typedef struct MSG_ResultElement MSG_ResultElement; -class CMessageAttachmentView; -class CURLDispatchInfo; -class CDeferredCloseTask; - -//====================================== -class CMessageView -#ifdef INHERIT_FROM_BROWSERVIEW - : public CBrowserView -#else - : public CHTMLView -#endif - , public CMailCallbackListener -//====================================== -{ - private: -#ifdef INHERIT_FROM_BROWSERVIEW - typedef CBrowserView Inherited; -#else - typedef CHTMLView Inherited; -#endif - public: - enum { class_ID = 'MsVw' }; - public: - CMessageView(LStream* inStream); - virtual ~CMessageView(); - virtual void FinishCreateSelf(void); - - virtual void ClickSelf(const SMouseDownEvent& where); - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - void SetAttachmentView( CMessageAttachmentView* attachmentView) - { mAttachmentView = attachmentView; } - void SetMasterCommander(LCommander* inCommander) - { mMasterCommander = inCommander; } - LCommander* GetMasterCommander() const - { return mMasterCommander; } - virtual void SetContext( - CBrowserContext* inNewContext); - MSG_Pane* GetMessagePane() const { return mMessagePane; } - - // Info about the parent folder: must be queried, not cached! - MSG_FolderInfo* GetFolderInfo() const; - uint32 GetFolderFlags() const; - - // Info about the message currently displayed. - MSG_ViewIndex GetCurMessageViewIndex() const; - MessageKey GetCurMessageKey() const; - uint32 GetCurMessageFlags() const; - Boolean IsDueToCloseLater() const; - void SetDueToCloseLater(); - - void ShowMessage(MSG_Master* inMsgMaster, - MSG_FolderInfo* inMsgFolderInfo, - MessageKey inMessageKey, - Boolean inLoadNow = false); - void ClearMessageArea(); - - void ShowURLMessage( - const char* url, - Boolean inLoadNow = false); - void ShowSearchMessage( - MSG_Master *inMsgMaster, - MSG_ResultElement *inResult, - Boolean inNoFolder = false); - void FileMessageToSelectedPopupFolder(const char *ioFolderName, - Boolean inMoveMessages);//¥¥TSM - - - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - - virtual void FindCommandStatus( - CommandT inCommand, - Boolean& outEnabled, Boolean& outUsesMark, - Char16& outMark,Str255 outName); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - Boolean ObeyMotionCommand(MSG_MotionType inCommand); - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - virtual Boolean SetDefaultCSID(Int16 default_csid, Boolean forceRepaginate = false); - - virtual void AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh); - virtual void AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent); - Boolean MaybeCloseLater(CommandT inCommand); // check prefs - - protected: - - void YieldToMaster(); - // An ugly solution, but after trying many, it's the only one that worked. - // This makes sure this view isn't target if there's a thread view in the same - // window. - - virtual void InstallBackgroundColor(); - // Sets mBackgroundColor. Called from ClearBackground(). - // The base class implementation uses the text background - // preference, but derived classes can override this. - virtual void SetBackgroundColor( - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue); - // Avoids changing the color, cheats and sets it to white, which - // is what we want for mail messages. 98/01/13. - virtual void GetDefaultFileNameForSaveAs(URL_Struct* url, CStr31& defaultName); - // overridden by CMessageView to use subject. - - virtual void DispatchURL( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - Boolean inDelay = false, - Boolean inForceCreate = false, - FO_Present_Types inOutputFormat = FO_CACHE_AND_PRESENT - ); - - virtual void DispatchURL(CURLDispatchInfo* inDispatchInfo); - - void CloseLater(); // Close on next idle - - - protected: - MSG_Pane* mMessagePane; - LCommander* mMasterCommander; // Not the super commander. See YieldToMaster. - Boolean mLoadingNakedURL; - CMessageAttachmentView* mAttachmentView; // the attachment pane - Boolean mClosing; - MSG_MotionType mMotionPendingCommand; - CDeferredCloseTask* mDeferredCloseTask; - - friend class CMessageAttachmentView; -}; diff --git a/mozilla/cmd/macfe/MailNews/CMessageWindow.cp b/mozilla/cmd/macfe/MailNews/CMessageWindow.cp deleted file mode 100644 index 2e37f5e128f..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageWindow.cp +++ /dev/null @@ -1,571 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageWindow.cp - -#include "CMessageWindow.h" - -#include "CMessageAttachmentView.h" -#include "CThreadView.h" // for CMessage - -#include "uapp.h" -#include "ntypes.h" -#include "macutil.h" -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" - -#include "CBrowserContext.h" -#include "CMessageView.h" -#include "CProgressListener.h" -#include "CMailFolderButtonPopup.h" -#include "CThreadWindow.h" -#include "CMailNewsContext.h" -#include "CSpinningN.h" -#include "prefapi.h" -#include "URobustCreateWindow.h" -#include "CApplicationEventAttachment.h" -#include "CProxyPane.h" -#include "CProxyDragTask.h" -#include "UMailSelection.h" -#include "CSearchTableView.h" - -#include "libi18n.h" - -#include - -//---------------------------------------------------------------------------------------- -CMessageWindow::CMessageWindow(LStream* inStream) -//---------------------------------------------------------------------------------------- -: CMailNewsWindow(inStream, WindowType_Message) -, mContext(NULL) -{ -} - -//---------------------------------------------------------------------------------------- -CMessageWindow::~CMessageWindow() -//---------------------------------------------------------------------------------------- -{ - SetWindowContext(nil); -} - -//---------------------------------------------------------------------------------------- -void CMessageWindow::FinishCreateSelf() -//---------------------------------------------------------------------------------------- -{ - UReanimator::LinkListenerToControls(this, this, res_ID); - Inherited::FinishCreateSelf(); - CMessageView* messageView = GetMessageView(); - Assert_(messageView); - SetLatentSub(messageView); - CMessageAttachmentView* attachmentView = - dynamic_cast( FindPaneByID('MATv') ); - if( attachmentView ) - { - messageView->SetAttachmentView( attachmentView ); - attachmentView->ClearMessageAttachmentView(); - attachmentView->Hide(); - } - - // the location toolbar is a waste of space and should be hidden by default - LPane *locationBar = FindPaneByID(cMailNewsLocationToolbar); - if (mToolbarShown[CMailNewsWindow::LOCATION_TOOLBAR]) - ToggleDragBar(cMailNewsLocationToolbar, CMailNewsWindow::LOCATION_TOOLBAR); - - USecurityIconHelpers::AddListenerToSmallButton( - this /*LWindow**/, - (CHTMLView*)messageView /*LListener**/); -} - -//---------------------------------------------------------------------------------------- -CMessageView* CMessageWindow::GetMessageView() -//---------------------------------------------------------------------------------------- -{ - return dynamic_cast(FindPaneByID(CMessageView::class_ID)); -} - -//---------------------------------------------------------------------------------------- -void CMessageWindow::SetWindowContext(CBrowserContext* inContext) -//---------------------------------------------------------------------------------------- -{ - CBrowserContext* oldContext = mContext; // save for below. - CSpinningN* theN = dynamic_cast(FindPaneByID(CSpinningN::class_ID)); - mContext = inContext; - if (mContext != NULL) - { - mContext->AddListener(this); - mContext->AddUser(this); - Assert_(mProgressListener != NULL); - mContext->AddListener(mProgressListener); - mContext->AddListener( &mSecurityListener); - if (theN) - mContext->AddListener(theN); - } - CMessageView* theMessageView = GetMessageView(); - Assert_(theMessageView); // Can happen in lowmem, if creation fails - if (theMessageView) - { - theMessageView->SetContext(mContext); - mSecurityListener.SetMessageView( theMessageView ); - // This call links up the model object hierarchy for any potential - // sub model that gets created within the scope of the html view. - theMessageView->SetFormElemBaseModel(this); - } - // Now it's safe to delete the old context, because the view's done with it. - if (oldContext) - { - oldContext->RemoveListener( &mSecurityListener ); - mSecurityListener.SetMessageView( NULL ); - oldContext->RemoveListener(this); - if (theN) - oldContext->RemoveListener(theN); - oldContext->RemoveUser(this); // and delete, probably. - } -} // CMessageWindow::SetWindowContext - -//---------------------------------------------------------------------------------------- -cstring CMessageWindow::GetCurrentURL() -//---------------------------------------------------------------------------------------- -{ - if (mContext) - return mContext->GetCurrentURL(); - else - return cstring(""); -} - -//---------------------------------------------------------------------------------------- -Int16 CMessageWindow::DefaultCSIDForNewWindow() -//---------------------------------------------------------------------------------------- -{ - Int16 csid = 0; - if (mContext != NULL) - csid = mContext->GetDefaultCSID(); - if(0 == csid) - { - CMessageView* theMessageView = GetMessageView(); - Assert_(theMessageView != NULL); - csid = theMessageView->DefaultCSIDForNewWindow(); - } - return csid; -} // CMessageWindow::DefaultCSIDForNewWindow - -//---------------------------------------------------------------------------------------- -void CMessageWindow::ListenToMessage(MessageT inMessage, void* ioParam) -//---------------------------------------------------------------------------------------- -{ - switch (inMessage) - { - case msg_NSCDocTitleChanged: - { - CStr255 theTitle((const char*)ioParam); - // if we have a message view use the subject as the title - CMessageView* messageView = GetMessageView(); - if (messageView) - { - MessageKey id = messageView->GetCurMessageKey(); - if (id != MSG_MESSAGEKEYNONE ) - { - MSG_MessageLine messageLine; - ::MSG_GetThreadLineById(messageView->GetMessagePane(), id, &messageLine); - char buffer[256]; - const char* raw = CMessage::GetSubject(&messageLine, buffer, sizeof(buffer)-1); - char* conv = IntlDecodeMimePartIIStr(raw, GetWindowContext()->GetWinCSID(), FALSE); - theTitle = CStr255((conv != NULL) ? conv : raw); - if (conv) - XP_FREE(conv); - } - } - SetDescriptor(theTitle); - CProxyPane* proxy = dynamic_cast(FindPaneByID(CProxyPane::class_ID)); - if (proxy) - proxy->ListenToMessage(inMessage, (char*)theTitle); - break; - } - case msg_NSCLayoutNewDocument: - //NoteBeginLayout(); - break; - - case msg_NSCFinishedLayout: - //NoteFinishedLayout(); - break; - - case msg_NSCAllConnectionsComplete: - //NoteAllConnectionsComplete(); - CSpinningN* theN = dynamic_cast(FindPaneByID(CSpinningN::class_ID)); - if (theN) - theN->StopSpinningNow(); - break; - case CMailCallbackManager::msg_ChangeStarting: - case CMailCallbackManager::msg_ChangeFinished: - case CMailCallbackManager::msg_PaneChanged: - CMailCallbackListener::SetPane(GetMessageView()->GetMessagePane()); - if (IsMyPane(ioParam)) - CMailCallbackListener::ListenToMessage(inMessage, ioParam); - break; - default: - // assume it's a button message. - GetMessageView()->ObeyCommand(inMessage, ioParam); - } -} // CMessageWindow::ListenToMessage - -//---------------------------------------------------------------------------------------- -void CMessageWindow::ChangeStarting( - MSG_Pane* /*inPane*/, - MSG_NOTIFY_CODE /*inChangeCode*/, - TableIndexT /*inStartRow*/, - SInt32 /*inRowCount*/) -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CMessageWindow::ChangeFinished( - MSG_Pane* /*inPane*/, - MSG_NOTIFY_CODE /*inChangeCode*/, - TableIndexT /*inStartRow*/, - SInt32 /*inRowCount*/) -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CMessageWindow::PaneChanged( - MSG_Pane* /*inPane*/, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -//---------------------------------------------------------------------------------------- -{ - switch (inNotifyCode) - { - case MSG_PaneNotifyMessageLoaded: - AdaptToolbarToMessage(); - if (!GetMessageView()->IsDueToCloseLater()) - Show(); - break; - case MSG_PaneNotifyLastMessageDeleted: - // AttemptClose() here leads to nasty re-entrant interrrupt-context. - // What to do? Should close the window, but how? - break; - case MSG_PaneNotifyFolderDeleted: - if ((MSG_FolderInfo*)value != GetMessageView()->GetFolderInfo()) - break; - // ELSE FALL THROUGH... - case MSG_PaneNotifyMessageDeleted: - AttemptClose(); // Causes reentrant InterruptContext call. - break; - } -} // CMessageWindow::PaneChanged - -//---------------------------------------------------------------------------------------- -CMessageWindow* CMessageWindow::FindAndShow(MessageKey inMessageKey) -//---------------------------------------------------------------------------------------- -{ - CWindowIterator iter(WindowType_Message, false); - CMessageWindow* window; - for (iter.Next(window); window; iter.Next(window)) - { - window = dynamic_cast(window); - ThrowIfNULL_(window); - CMessageView* messageView = window->GetMessageView(); - // inMessageKey zero means return the first message window of any kind - if (!inMessageKey || (messageView && messageView->GetCurMessageKey() == inMessageKey)) - return window; - } - return nil; -} // CMessageWindow::FindAndShow - -//---------------------------------------------------------------------------------------- -void CMessageWindow::OpenFromURL(const char* url) -//---------------------------------------------------------------------------------------- -{ - MSG_MessageLine msgLine; - MSG_GetMessageLineForURL(CMailNewsContext::GetMailMaster(), url, &msgLine); - CMessageWindow* messageWindow = CMessageWindow::FindAndShow(msgLine.messageKey); - if (messageWindow) - { - // Found it. Bring it to the front. - messageWindow->Select(); - return; - } - XP_Bool prefReuseWindow = 0; // recycle any message window - PREF_GetBoolPref("mailnews.reuse_message_window", &prefReuseWindow); - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) ^ prefReuseWindow) - { - messageWindow = CMessageWindow::FindAndShow(0); - } - // If we couldn't (or shouldn't) recycle one, make a new one. - if (!messageWindow) - { - try - { - messageWindow = - (CMessageWindow*)URobustCreateWindow::CreateWindow( - CMessageWindow::res_ID, - LCommander::GetTopCommander()); - CBrowserContext* theContext = new CBrowserContext(MWContextMailMsg); - StSharer theShareLock(theContext); // if we throw, theContext will have no users & die - messageWindow->SetWindowContext(theContext); - } - catch(...) - { - delete messageWindow; - messageWindow = NULL; - throw; - } - } - // Whether it's a new one or an old one, load the message now. - if (messageWindow) - { - try - { - CMessageView* messageView = messageWindow->GetMessageView(); - ThrowIfNULL_(messageView); - messageView->ShowURLMessage(url, false); - messageWindow->Select(); - messageWindow->Show(); - } - catch(...) - { - delete messageWindow; - messageWindow = NULL; - throw; - } - } -} // CMessageWindow::OpenFromURL - -//---------------------------------------------------------------------------------------- -/* static */ void CMessageWindow::CloseAll(MessageKey inMessageKey) -//---------------------------------------------------------------------------------------- -{ - CMessageWindow* win; - do { - win = CMessageWindow::FindAndShow(inMessageKey); - if (win ) - win->AttemptClose(); - } while (win); -} // CMessageWindow::CloseAll - -//---------------------------------------------------------------------------------------- -/* static */ void CMessageWindow::NoteSelectionFiledOrDeleted(const CMailSelection& inSelection) -// Tell every relevant message window that its message has been moved, so that it -// can, according to the preferences, close itself. -//---------------------------------------------------------------------------------------- -{ - const MSG_ViewIndex* index = inSelection.GetSelectionList(); - MSG_PaneType paneType = ::MSG_GetPaneType(inSelection.xpPane); - for (int count = 0; count < inSelection.selectionSize; count++, index++) - { - MessageKey key; - switch (paneType) - { - case MSG_THREADPANE: - // These are the list panes: - key = ::MSG_GetMessageKey(inSelection.xpPane, *index); - break; - case MSG_SEARCHPANE: - // These are the list panes: - MSG_ResultElement* ignoredElement; - MSG_FolderInfo* ignoredFolder; - if (!CSearchTableView::GetMessageResultInfo( - inSelection.xpPane, - *index, - ignoredElement, - ignoredFolder, - key)) - continue; - break; - case MSG_MESSAGEPANE: - // The message pane itself is running the copy. It will be notified - // on completion and close itself. Fall through and return. - default: - return; // no messages involved! Zero loop iterations. - } - CWindowIterator iter(WindowType_Message, false); - CMessageWindow* window; - for (iter.Next(window); window; iter.Next(window)) - { - window = dynamic_cast(window); - Assert_(window); - CMessageView* messageView = window->GetMessageView(); - if (messageView->GetCurMessageKey() == key) - messageView->MaybeCloseLater(cmd_MoveMailMessages); - } // for iter - } // for count -} // CMessageWindow::CloseAll - -//---------------------------------------------------------------------------------------- -void CMessageWindow::ActivateSelf() -//---------------------------------------------------------------------------------------- -{ - CMailNewsWindow::ActivateSelf(); -} - -//---------------------------------------------------------------------------------------- -void CMessageWindow::AdaptToolbarToMessage() -//---------------------------------------------------------------------------------------- -{ - - const PaneIDT paneID_MessageFileButton = 'Bfil'; - const PaneIDT paneID_MessageReplyButton = 'Brep'; - - const PaneIDT paneID_MessageGetMailButton = 'Bget'; // mail - const PaneIDT paneID_MessageGetNewsButton = 'Bmor'; // news - - const PaneIDT paneID_MessageComposeButton = 'Bcmp'; // mail - const PaneIDT paneID_MessagePostNewButton = 'Bpst'; // news - - const PaneIDT paneID_MessagePrintButton = 'Bprn'; // mail - const PaneIDT paneID_MessageBackButton = 'Bbck'; // news - - const PaneIDT paneID_MessageDeleteButton = 'Bdel'; // mail - const PaneIDT paneID_MessageMarkButton = 'Bmrk'; // news - - CMessageView* messageView = GetMessageView(); - Assert_(messageView != NULL); - - uint32 folderFlags = messageView->GetFolderFlags(); - - // Set the window title to the subject of the message. - MessageKey id = messageView->GetCurMessageKey(); - if (id != MSG_MESSAGEKEYNONE) - { - MSG_MessageLine messageLine; - ::MSG_GetThreadLineById(messageView->GetMessagePane(), id, &messageLine); - char buffer[256]; - const char* raw = CMessage::GetSubject(&messageLine, buffer, sizeof(buffer)-1); - char* conv = IntlDecodeMimePartIIStr(raw, GetWindowContext()->GetWinCSID(), FALSE); - SetDescriptor(CStr255((conv != NULL) ? conv : raw)); - if (conv) - XP_FREE(conv); - } - - // show/hide buttons depending on the window type (News vs Mail) - LControl * aControl; - Boolean isNewsWindow = ((folderFlags & MSG_FOLDER_FLAG_NEWSGROUP) != 0); - const short kBtnCount = 3; - - PaneIDT mailBtn[kBtnCount] = - { - paneID_MessageGetMailButton, - paneID_MessageComposeButton, - paneID_MessageDeleteButton // update kBtnCount if you add a btn - }; - - PaneIDT newsBtn[kBtnCount] = - { - paneID_MessageGetNewsButton, - paneID_MessagePostNewButton, - paneID_MessageMarkButton // update kBtnCount if you add a btn - }; - - for (short btnIndex = 0; btnIndex < kBtnCount; btnIndex ++) - { - if (isNewsWindow) - { - aControl = dynamic_cast(FindPaneByID(mailBtn[btnIndex])); - if (aControl != nil) aControl->Hide(); - aControl = dynamic_cast(FindPaneByID(newsBtn[btnIndex])); - if (aControl != nil) aControl->Show(); - } - else - { - aControl = dynamic_cast(FindPaneByID(newsBtn[btnIndex])); - if (aControl != nil) aControl->Hide(); - aControl = dynamic_cast(FindPaneByID(mailBtn[btnIndex])); - if (aControl != nil) aControl->Show(); - } - } - - // other changes depending on the window type - - if (isNewsWindow) - { - aControl = dynamic_cast(FindPaneByID(paneID_MessageReplyButton)); - if (aControl != nil) aControl->SetValueMessage(cmd_PostReply); // quick-click default - } - else - { - aControl = dynamic_cast(FindPaneByID(paneID_MessageReplyButton)); - if (aControl != nil) aControl->SetValueMessage(cmd_ReplyToSender); // quick-click default - } - - UInt32 messageFlags = messageView->GetCurMessageFlags(); - ResIDT iconID = (id == MSG_MESSAGEKEYNONE) - ? CProxyPane::kProxyIconNormalID - : CMessage::GetIconID(folderFlags, messageFlags); - LIconPane* proxyIcon = dynamic_cast(FindPaneByID('poxy')); - if (proxyIcon) - { - proxyIcon->SetIconID(iconID); - } - CProxyPane* newProxy = dynamic_cast(FindPaneByID(CProxyPane::class_ID)); - if (newProxy) - { - newProxy->SetIconIDs(iconID, iconID); - } -} // CMessageWindow::AdaptToolbarToMessage - -//---------------------------------------------------------------------------------------- -CExtraFlavorAdder* CMessageWindow::CreateExtraFlavorAdder() const -//---------------------------------------------------------------------------------------- -{ - class MessageWindowFlavorAdder : public CExtraFlavorAdder - { - public: - MessageWindowFlavorAdder(CMessageView* inMessageView) - : mMessageView(inMessageView) - { - } - virtual void AddExtraFlavorData(DragReference inDragRef, ItemReference inItemRef) - { - #if 1 - // Pass a selection using the message view. Not sure if this will work with the BE - mSelection.xpPane = mMessageView->GetMessagePane(); - if (!mSelection.xpPane) - return; - MSG_ViewIndex viewIndex = mMessageView->GetCurMessageViewIndex(); - #else - // Pass a selection, as if this is done from a thread view. - mSelection.xpPane = ::MSG_FindPaneOfType( - CMailNewsContext::GetMailMaster(), - mMessageView->GetFolderInfo(), - MSG_THREADPANE); - if (!mSelection.xpPane) - return; // drat. This is a real drag. - MSG_ViewIndex viewIndex = mMessageView->GetCurMessageKey(); - MSG_ViewIndex viewIndex = MSG_GetIndexForKey(mSelection.xpPane, key, true); - #endif - if (viewIndex == MSG_VIEWINDEXNONE) - return; - mSelection.SetSingleSelection(viewIndex); - ::AddDragItemFlavor( - inDragRef, - inItemRef, - kMailNewsSelectionDragFlavor, - &mSelection, - sizeof(mSelection), - 0); - } - private: - CMessageView* mMessageView; - CMailSelection mSelection; - }; - return new MessageWindowFlavorAdder(const_cast(this)->GetMessageView()); - -} // CMessageWindow::CreateExtraFlavorAdder diff --git a/mozilla/cmd/macfe/MailNews/CMessageWindow.h b/mozilla/cmd/macfe/MailNews/CMessageWindow.h deleted file mode 100644 index 496383d9cb3..00000000000 --- a/mozilla/cmd/macfe/MailNews/CMessageWindow.h +++ /dev/null @@ -1,119 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CMessageWindow.h - -#pragma once - -#include "CMailNewsWindow.h" - -#include - -#include "CSaveWindowStatus.h" -#include "MailNewsCallbacks.h" -#include "CSecurityButton.h" -#include "cstring.h" - -const ResIDT cMessageWindowPPobID = 10667; - -class CBrowserContext; -class CNSContext; -class CMessageView; -class CMailSelection; -struct SPaneChangeInfo; - -//====================================== -class CMessageWindow - : public CMailNewsWindow - , public CMailCallbackListener -//====================================== -{ -private: - typedef CMailNewsWindow Inherited; // trick suggested by the ANSI committee. -public: - enum { class_ID = 'MsgW', res_ID = cMessageWindowPPobID }; - - CMessageWindow(LStream* inStream); - virtual ~CMessageWindow(); - virtual void FinishCreateSelf(); - -// MY VERSION - virtual void SetWindowContext(CBrowserContext* inContext); - virtual CNSContext* GetWindowContext() const { return (CNSContext*)mContext; } -public: - CMessageView* GetMessageView(); - static CMessageWindow* FindAndShow(MessageKey inMessageKey); - static void OpenFromURL(const char* url); - static void CloseAll(MessageKey inMessageKey); - static void NoteSelectionFiledOrDeleted(const CMailSelection& inSelection); - virtual void ActivateSelf(void); - cstring GetCurrentURL(); - -// CMailCallbackListener overrides: - virtual void ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - virtual void ListenToMessage(MessageT inMessage,void *ioParam); -/* - virtual void SetWindowContext(CBrowserContext* inContext); - - // Info about the parent folder: must be queried, not cached! - MessageKey GetMessageKey() const; - MSG_FolderInfo* GetFolderInfo() const; - MSG_ViewIndex GetViewIndex() const; - uint16 GetFolderFlags() const; - - void ShowMessage(MSG_Master* inMsgMaster, - MSG_FolderInfo* inMsgFolderInfo, - MessageKey inMessageKey); - void ShowSearchMessage(MSG_Master *inMsgMaster, - MSG_ResultElement *inResult); -*/ - - // I18N stuff - virtual Int16 DefaultCSIDForNewWindow(void); - -// CNetscapeWindow overrides - virtual CExtraFlavorAdder* CreateExtraFlavorAdder() const; - - //----------------------------------- - // Window Saving - overrides for CSaveWindowStatus. - //----------------------------------- -protected: - virtual ResIDT GetStatusResID(void) const { return res_ID; } - virtual UInt16 GetValidStatusVersion(void) const { return 0x0113; } - virtual void AdaptToolbarToMessage(void); - -protected: - CBrowserContext* mContext; - CMailSecurityListener mSecurityListener; -}; - diff --git a/mozilla/cmd/macfe/MailNews/CNewsSubscriber.cp b/mozilla/cmd/macfe/MailNews/CNewsSubscriber.cp deleted file mode 100644 index 69d96ea4892..00000000000 --- a/mozilla/cmd/macfe/MailNews/CNewsSubscriber.cp +++ /dev/null @@ -1,305 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CNewsSubscriber.cp - -#include "CNewsSubscriber.h" - -#include "CMailNewsContext.h" -#include "CSubscribeWindow.h" - -#include "UModalDialogs.h" -#include "LGAEditField.h" -#include "LGACheckbox.h" -#include "LGARadioButton.h" - -#include "prefapi.h" -#include "msgcom.h" -#include "uprefd.h" -#include "uerrmgr.h" - -extern "C" -{ - extern int MK_NNTP_SERVER_NOT_CONFIGURED; -} - -MSG_Host* CNewsSubscriber::mHost = nil; - - -//----------------------------------- -Boolean CNewsSubscriber::DoSubscribeNewsGroup(MSG_Host* host, Boolean inModal) -//----------------------------------- -{ - - Boolean result = false; - - // When no host is specified, we try to use the previously - // accessed host or the default host. If there isn't any, - // we display an alert and ask the user to configure one. - if (host == nil) - host = GetHost(); - - if (host == nil) - host = (MSG_Host*)MSG_GetDefaultNewsHost(CMailNewsContext::GetMailMaster()); - - if (host == nil) - { - FE_Alert(nil, XP_GetString(MK_NNTP_SERVER_NOT_CONFIGURED)); - FE_EditPreference(PREF_NewsHost); - } - else - { - SetHost(host); - if (inModal) - { - result = CSubscribeWindow::DisplayDialog(); - } - else - { - CSubscribeWindow::FindAndShow(true); - result = true; - } - } - return result; - -} // CMessageFolderView::DoSubscribeNewsGroup - - -//----------------------------------- -Boolean CNewsSubscriber::DoAddNewsHost() -//----------------------------------- -{ - // Put up dialog - StDialogHandler handler(14000, NULL); - - // Select the "Host" edit field - LWindow* dialog = handler.GetDialog(); - LGAEditField *hostfield = (LGAEditField*)dialog->FindPaneByID('Host'); - SignalIf_(!hostfield); - LGAEditField* portfield = (LGAEditField*)dialog->FindPaneByID('Port'); - SignalIf_(!portfield); - LGACheckbox* securebox = (LGACheckbox*)dialog->FindPaneByID('Secu'); - SignalIf_(!securebox); - if (!hostfield || ! portfield || !securebox) - return false; - dialog->SetLatentSub(hostfield); - - // Run the dialog - MessageT message = 'Secu'; // so that the port is initialized correctly. - CStr255 porttext; - Int32 port = 0; - Boolean userChangedPort = false; - LControl* okButton = dynamic_cast(dialog->FindPaneByID ('Add_') ); - XP_ASSERT( okButton ); - do { - if (message == 'Secu' && !userChangedPort) - { - port = securebox->GetValue() ? 563 : 119; - NumToString(port, porttext); - portfield->SetDescriptor(porttext); - } - message = handler.DoDialog(); - portfield->GetDescriptor(porttext); - Int32 newport; - StringToNum(porttext, &newport); - userChangedPort = (newport != port); - port = newport; - - CStr255 hosttext; - hostfield->GetDescriptor(hosttext); - if( hosttext.Length() > 0 ) - okButton->Enable(); - else - okButton->Disable(); - } while (message != msg_OK && message != msg_Cancel); - - // Use the result. - if (message == msg_OK) - { - CStr255 hosttext; - hostfield->GetDescriptor(hosttext); - MSG_NewsHost* newHost = MSG_CreateNewsHost(CMailNewsContext::GetMailMaster(), - hosttext, securebox->GetValue(), port); - - CNewsSubscriber::SetHost(MSG_GetMSGHostFromNewsHost(newHost)); // make it the default host - - // Be kind to the user: if there was no News server configured yet, - // then use this one (otherwise, we'll throw the Prefs dialog - // on the next common MSG_ call, such as MSG_SubscribeSetNewsHost()) - if (MSG_GetDefaultNewsHost(CMailNewsContext::GetMailMaster()) == NULL) - (void)CPrefs::SetString(hosttext, CPrefs::NewsHost); - } - return (message == msg_OK); -} // CNewsSubscriber::DoAddNewsHost() - -//====================================== -// FE_NewsDownloadPrompt -//====================================== - -// From listngst.cpp -extern "C" XP_Bool FE_NewsDownloadPrompt( - MWContext *context, - int32 numMessagesToDownload, - XP_Bool *downloadAll); - -//----------------------------------- -class StDownloadDialogHandler: public StDialogHandler -//----------------------------------- -{ - public: - StDownloadDialogHandler( - MWContext* context, - int32 numMessagesToDownload, - XP_Bool& downloadAll); - Boolean InitFields(); - void ReadFields(); - - UInt32 mNumberOfMessages; - XP_Bool mDownloadSome; - Int32 mDownloadMax; - XP_Bool mMarkRead; - - LGAEditField* mMaxHeadersField; - LGACheckbox* mMarkReadCheckbox; - LGARadioButton* mDownloadSomeRadio; -}; // class StDownloadDialogHandler - -//----------------------------------- -StDownloadDialogHandler::StDownloadDialogHandler( - MWContext* context, - int32 numMessages, - XP_Bool& downloadAll) -//----------------------------------- -: StDialogHandler(14001, NULL) -, mNumberOfMessages(numMessages) -, mDownloadMax(0) -, mDownloadSome(false) -, mMarkRead(false) - -, mMaxHeadersField(NULL) -, mMarkReadCheckbox(NULL) -, mDownloadSomeRadio(NULL) -{ -#pragma unused (context) -#pragma unused (downloadAll) -} - -//----------------------------------- -void StDownloadDialogHandler::ReadFields() -//----------------------------------- -{ - mDownloadSome = mDownloadSomeRadio->GetValue(); - mMarkRead = mMarkReadCheckbox->GetValue(); - CStr255 headersText; - mMaxHeadersField->GetDescriptor(headersText); - StringToNum(headersText, &mDownloadMax); - if (mDownloadSome) - { - PREF_SetBoolPref("news.mark_old_read", mMarkRead); - PREF_SetIntPref("news.max_articles", mDownloadMax); - } -} - -//----------------------------------- -Boolean StDownloadDialogHandler::InitFields() -//----------------------------------- -{ - // Select the "Host" edit field - LWindow* dialog = GetDialog(); - - mMaxHeadersField = (LGAEditField*)dialog->FindPaneByID('maxH'); - SignalIf_(!mMaxHeadersField); - - mMarkReadCheckbox = (LGACheckbox*)dialog->FindPaneByID('MkUn'); - SignalIf_(!mMarkReadCheckbox); - - mDownloadSomeRadio = (LGARadioButton*)dialog->FindPaneByID('DnSm'); - SignalIf_(!mDownloadSomeRadio); - - LCaption* messagefield = (LCaption*)dialog->FindPaneByID('Mesg'); - SignalIf_(!messagefield); - - if (!messagefield || !mMaxHeadersField || !mMarkReadCheckbox || !mDownloadSomeRadio) - return false; - - // The caption has the message format string with %d in it... - CStr255 messageText; - messagefield->GetDescriptor(messageText); - char messageString[255]; - sprintf(messageString, messageText, mNumberOfMessages); - messageText = messageString; - messagefield->SetDescriptor(messageText); - - PREF_GetBoolPref( "news.mark_old_read", &mMarkRead ); - mMarkReadCheckbox->SetValue(mMarkRead); - - PREF_GetIntPref("news.max_articles", &mDownloadMax); - CStr255 downloadString; - NumToString(mDownloadMax, downloadString); - mMaxHeadersField->SetDescriptor(downloadString); - - return true; -} - -//----------------------------------- -XP_Bool FE_NewsDownloadPrompt( - MWContext* context, - int32 numMessagesToDownload, - XP_Bool* downloadAll) -//----------------------------------- -{ - // Put up dialog - StDownloadDialogHandler handler(context, numMessagesToDownload, *downloadAll); - - // Set up the dialog - if (!handler.InitFields()) - return false; - - // Run the dialog - MessageT message = msg_Nothing; - do { - message = handler.DoDialog(); - } while (message != msg_Cancel && message != msg_OK); - - // Use the result. - if (message == msg_OK) - { - handler.ReadFields(); - *downloadAll = !handler.mDownloadSome; - return true; - } - return false; -} // FE_NewsDownloadPrompt - - -//----------------------------------- -XP_Bool FE_CreateSubscribePaneOnHost( - MSG_Master* master, - MWContext* parentContext, - MSG_Host* host) -//----------------------------------- -{ -#pragma unused (master) -#pragma unused (parentContext) - XP_Bool result; - result = CNewsSubscriber::DoSubscribeNewsGroup(host, false); - // modeless, as required by API spec for this call. - return result; -} diff --git a/mozilla/cmd/macfe/MailNews/CNewsSubscriber.h b/mozilla/cmd/macfe/MailNews/CNewsSubscriber.h deleted file mode 100644 index 6a7a817f196..00000000000 --- a/mozilla/cmd/macfe/MailNews/CNewsSubscriber.h +++ /dev/null @@ -1,42 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CNewsSubscriber.h - -#pragma once -#include "msgcom.h" - -//====================================== -class CNewsSubscriber -//====================================== -{ - public: - - static Boolean DoAddNewsHost(); - static Boolean DoSubscribeNewsGroup(MSG_Host* host = nil, Boolean inModal = false); - - static void SetHost(MSG_Host* host) { mHost = host; }; - static MSG_Host* GetHost() { return mHost; }; - - private: - - static MSG_Host* mHost; - -}; // class CNewsSubscriber diff --git a/mozilla/cmd/macfe/MailNews/COfflinePicker.cp b/mozilla/cmd/macfe/MailNews/COfflinePicker.cp deleted file mode 100644 index 2c2b08dbeb5..00000000000 --- a/mozilla/cmd/macfe/MailNews/COfflinePicker.cp +++ /dev/null @@ -1,925 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// COfflinePicker.cp - -#include "COfflinePicker.h" - -#include "CMessageFolder.h" -#include "MailNewsAddressBook.h" -#include "URobustCreateWindow.h" -#include "UModalDialogs.h" - -#include "cstring.h" -#include "macutil.h" -#include "MailNewsgroupWindow_Defines.h" -#include "LGAPushButton.h" -#include "dirprefs.h" - -enum -{ - kCheckedIconID = 15237 -, kUncheckedIconID = 15235 -, kLDAPHdrIconID = 15258 //15226 -, kLDAPIconID = 15258 -}; - - -//------------------------------------------------------------------------------ -// ¥ COfflineItem -//------------------------------------------------------------------------------ -// -class COfflineItem -{ -public: - COfflineItem(const TableIndexT inRow, const COfflinePickerView* inPickerView); - ~COfflineItem(); - - UInt32 GetLevel() const; - ResIDT GetIconID() const; - const char* GetName() const; - - UInt32 GetFolderPrefFlags() const; - void SetFolderPrefFlags(const UInt32) const; - - Boolean IsOpen() const; - Boolean IsNewsgroup() const; - Boolean IsLocalMailFolder() const; - Boolean IsIMAPMailFolder() const; - Boolean IsLDAPDirectory() const; - - Boolean HasNewMessages() const; - UInt32 CountSubFolders() const; - - - TableIndexT GetRow() const {return mRow;}; - COfflinePickerView::RowType GetRowType() const {return mRowType;}; - void * GetInfo() const {return (mMessageFolder ? (void*)mMessageFolder->GetFolderInfo() : (void*)mDirServer);}; - -protected: - const COfflinePickerView * mPickerView; - const TableIndexT mRow; - COfflinePickerView::RowType mRowType; - CMessageFolder * mMessageFolder; - DIR_Server * mDirServer; -}; - -// ¥ COfflineItem -COfflineItem::COfflineItem(const TableIndexT inRow, const COfflinePickerView* inPickerView) - : mPickerView(inPickerView) - , mRow(inRow) - , mMessageFolder(nil) - , mDirServer(nil) -{ - mRowType = mPickerView->GetRowType(inRow); - if (mRowType == COfflinePickerView::kRowMailNews) - mMessageFolder = new CMessageFolder(inRow, inPickerView->GetMessagePane()); - else - if (mRowType == COfflinePickerView::kRowLDAP) - { - TableIndexT outRows, outCols; - mPickerView->GetTableSize(outRows, outCols); - mDirServer = (DIR_Server *)XP_ListGetObjectNum(mPickerView->mLDAPList, outRows - mRow + 1); - } -} - -// ¥ ~COfflineItem -COfflineItem::~COfflineItem() -{ - delete mMessageFolder; -} - -// ¥ GetLevel -UInt32 COfflineItem::GetLevel() const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: return mMessageFolder->GetLevel(); - case COfflinePickerView::kRowLDAPHdr: return kRootLevel; - case COfflinePickerView::kRowLDAP: return kRootLevel + 1; - } - return kRootLevel; -} - -// ¥ GetIconID -ResIDT COfflineItem::GetIconID() const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: return mMessageFolder->GetIconID(); - case COfflinePickerView::kRowLDAPHdr: return kLDAPHdrIconID; - case COfflinePickerView::kRowLDAP: return kLDAPIconID; - } - return 0; -} - -// ¥ GetName -const char* COfflineItem::GetName() const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: return mMessageFolder->GetName(); - case COfflinePickerView::kRowLDAPHdr: return (char*)&mPickerView->mLDAPHdrStr[1]; - case COfflinePickerView::kRowLDAP: return mDirServer->description; - } - return nil; -} - -// ¥ GetFolderPrefFlags -UInt32 COfflineItem::GetFolderPrefFlags() const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: return mMessageFolder->GetFolderPrefFlags(); - case COfflinePickerView::kRowLDAPHdr: return 0; - case COfflinePickerView::kRowLDAP: return (DIR_TestFlag(mDirServer, DIR_REPLICATION_ENABLED) ? MSG_FOLDER_PREF_OFFLINE : 0); - } - return 0; -} - -// ¥ SetFolderPrefFlags -void COfflineItem::SetFolderPrefFlags(const UInt32 inPrefFlags) const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: - ::MSG_SetFolderPrefFlags(mMessageFolder->GetFolderInfo(), inPrefFlags); - break; - case COfflinePickerView::kRowLDAPHdr: - // nothing - break; - case COfflinePickerView::kRowLDAP: - DIR_ForceFlag(mDirServer, DIR_REPLICATION_ENABLED, ((inPrefFlags & MSG_FOLDER_PREF_OFFLINE) != 0)); - break; - } -} - -// ¥ IsOpen -Boolean COfflineItem::IsOpen() const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: return mMessageFolder->IsOpen(); - case COfflinePickerView::kRowLDAPHdr: return mPickerView->IsLDAPExpanded(); - case COfflinePickerView::kRowLDAP: return false; - } - return false; -} - -// ¥ IsNewsgroup -Boolean COfflineItem::IsNewsgroup() const -{ - return (mMessageFolder ? mMessageFolder->IsNewsgroup() : false); -} - -// ¥ IsLocalMailFolder -Boolean COfflineItem::IsLocalMailFolder() const -{ - if (mRowType == COfflinePickerView::kRowMailNews) - return mMessageFolder->IsLocalMailFolder(); - return false; -} - -// ¥ IsIMAPMailFolder -Boolean COfflineItem::IsIMAPMailFolder() const -{ - return (mMessageFolder ? mMessageFolder->IsIMAPMailFolder() : false); -} - -// ¥ IsLDAPDirectory -Boolean COfflineItem::IsLDAPDirectory() const -{ - return (mRowType == COfflinePickerView::kRowLDAP); -} - -// ¥ HasNewMessages -Boolean COfflineItem::HasNewMessages() const -{ - return (mMessageFolder ? mMessageFolder->HasNewMessages() : false); -} - -// ¥ CountSubFolders -UInt32 COfflineItem::CountSubFolders() const -{ - switch (mRowType) - { - case COfflinePickerView::kRowMailNews: return mMessageFolder->CountSubFolders(); - case COfflinePickerView::kRowLDAPHdr: return mPickerView->CountLDAPItems(); - case COfflinePickerView::kRowLDAP: return 0; - } - return 0; - -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ COfflinePickerView -//------------------------------------------------------------------------------ -// -COfflinePickerView::COfflinePickerView(LStream *inStream) - : Inherited(inStream) - , mWantLDAP(true) - , mLDAPList(nil) - , mLDAPCount(0) - , mLDAPExpanded(false) - , mSaveItemArray(sizeof(SSaveItemRec)) -{ -} - - -//------------------------------------------------------------------------------ -// ¥ ~COfflinePickerView -//------------------------------------------------------------------------------ -// -COfflinePickerView::~COfflinePickerView() -{ - if (mLDAPList) - XP_ListDestroy(mLDAPList); -} - - -//------------------------------------------------------------------------------ -// ¥ View / GetRowType -//------------------------------------------------------------------------------ -// -COfflinePickerView::RowType - COfflinePickerView::GetRowType(TableIndexT inRow) const -{ - if (! mWantLDAP) - return kRowMailNews; - - TableIndexT outRows, outCols; - GetTableSize(outRows, outCols); - - TableIndexT ldapHdrRow; - if (mLDAPExpanded) - ldapHdrRow = outRows - mLDAPCount; - else - ldapHdrRow = outRows; - - if (inRow < ldapHdrRow) - return kRowMailNews; - else if (inRow == ldapHdrRow) - return kRowLDAPHdr; - else - return kRowLDAP; -} - - -//------------------------------------------------------------------------------ -// ¥ View / AppendLDAPList -//------------------------------------------------------------------------------ -// -void COfflinePickerView::AppendLDAPList() -{ - if (!mWantLDAP) - return; - - // get list (which also contains Personal ABook + HTML directories) - XP_List *serverList = CAddressBookManager::GetDirServerList(); - if (!serverList) - { - mWantLDAP = false; - return; - } - mLDAPList = XP_ListNew(); - ThrowIfNULL_(mLDAPList); - - // extract LDAP items - int totalCount = XP_ListCount(serverList); - for (Int32 i = 1; i <= totalCount ; i++) - { - DIR_Server *server = (DIR_Server *) XP_ListGetObjectNum(serverList, i); - if (server->dirType == LDAPDirectory) - XP_ListAddObject(mLDAPList, server); - } - mLDAPCount = XP_ListCount(mLDAPList); - if (mLDAPCount == 0) - { - XP_ListDestroy(mLDAPList); - mLDAPList = nil; - mWantLDAP = false; - return; - } - - // get the LDAP header string and insert a row at the end of the list - ::GetIndString(mLDAPHdrStr, 7099, 26); - mLDAPHdrStr[mLDAPHdrStr[0]+1] = '\0'; - - TableIndexT outRows, outCols; - GetTableSize(outRows, outCols); - InsertRows(1, outRows, nil, 0, true); -} - - -//---------------------------------------------------------------------------- -// ¥ View / SaveItemPrefFlags -//---------------------------------------------------------------------------- -// -void COfflinePickerView::SaveItemPrefFlags(const COfflineItem * inOfflineItem, UInt32 inPrefsFlags) -{ - // prepare new item to save - SSaveItemRec newItemRec; - newItemRec.itemType = inOfflineItem->GetRowType(); - newItemRec.itemInfo = inOfflineItem->GetInfo(); - newItemRec.originalPrefsFlags = inPrefsFlags; - - // check if item has already been saved - LArrayIterator iterator(mSaveItemArray, LArrayIterator::from_Start); - SSaveItemRec itemRec; - while (iterator.Next(&itemRec)) - { - if ((itemRec.itemType == newItemRec.itemType) - && (itemRec.itemInfo == newItemRec.itemInfo)) - return; // item already saved - } - - // save new item - mSaveItemArray.InsertItemsAt(1, LArray::index_Last, (void*)&newItemRec, sizeof(newItemRec)); -} - - -//---------------------------------------------------------------------------- -// ¥ View / CancelSelection -//---------------------------------------------------------------------------- -// -void COfflinePickerView::CancelSelection() -{ - LArrayIterator iterator(mSaveItemArray, LArrayIterator::from_Start); - SSaveItemRec itemRec; - while (iterator.Next(&itemRec)) - { - switch (itemRec.itemType) - { - case COfflinePickerView::kRowMailNews: - ::MSG_SetFolderPrefFlags((MSG_FolderInfo *)itemRec.itemInfo, itemRec.originalPrefsFlags); - break; - - case COfflinePickerView::kRowLDAP: - DIR_ForceFlag((DIR_Server *)itemRec.itemInfo, DIR_REPLICATION_ENABLED, ((itemRec.originalPrefsFlags & MSG_FOLDER_PREF_OFFLINE) != 0)); - DIR_SaveServerPreferences(CAddressBookManager::GetDirServerList()); - break; - } - } - mSaveItemArray.RemoveItemsAt(1, mSaveItemArray.GetCount()); -} - - -//---------------------------------------------------------------------------- -// ¥ View / CommitSelection -//---------------------------------------------------------------------------- -// -void COfflinePickerView::CommitSelection() -{ - if (mLDAPList) - DIR_SaveServerPreferences(CAddressBookManager::GetDirServerList()); -} - - -//---------------------------------------------------------------------------- -// ¥ View / DrawCell -//---------------------------------------------------------------------------- -// -void COfflinePickerView::DrawCell(const STableCell& inCell, const Rect& inLocalRect) -{ - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { - case kFolderNameColumn: - Inherited::DrawCell(inCell, inLocalRect); - break; - - case kSelectFolderColumn: - COfflineItem item(inCell.row, this); - if (item.GetLevel() > kRootLevel) - { - short iconID, transformType; - if (item.IsLocalMailFolder()) - { - iconID = kCheckedIconID; - transformType = ttDisabled; - } - else - { - UInt32 folderPrefFlags = item.GetFolderPrefFlags(); - if (folderPrefFlags & MSG_FOLDER_PREF_OFFLINE) - iconID = kCheckedIconID; - else - iconID = kUncheckedIconID; - transformType = ttNone; - } - DrawIconFamily(iconID, 16, 16, transformType, inLocalRect); - } - break; - } -} - - -//---------------------------------------------------------------------------- -// ¥ View / ClickSelect -//---------------------------------------------------------------------------- -// We don't want any fancy behavior on mouse clicks: no cell selection, -// no Finder selection, nothing. Just toggle the check-box. -// - Boolean COfflinePickerView::ClickSelect( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -{ -#pragma unused (inCell) -#pragma unused (inMouseDown) - return true; -} - - -//---------------------------------------------------------------------------- -// ¥ View / ClickCell -//---------------------------------------------------------------------------- -// We don't want any fancy behavior on mouse clicks: no cell selection, -// no Finder selection, nothing. Just toggle the check-box. -// -void COfflinePickerView::ClickCell( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -{ - SPoint32 currentPoint; - STableCell hitCell = inCell; - - currentPoint.h = inMouseDown.whereLocal.h; - currentPoint.v = inMouseDown.whereLocal.v; - - COfflineItem item(hitCell.row, this); - if (item.GetLevel() > kRootLevel) - { - if (item.IsNewsgroup() || item.IsIMAPMailFolder() || item.IsLDAPDirectory()) - { - UInt32 folderPrefFlags = item.GetFolderPrefFlags(); - SaveItemPrefFlags(&item, folderPrefFlags); - - folderPrefFlags ^= MSG_FOLDER_PREF_OFFLINE; - item.SetFolderPrefFlags(folderPrefFlags); - - for (int i = 1; i <= mTableHeader->CountVisibleColumns(); i++) - { - hitCell.col = i; - RefreshCell(hitCell); - } - } - } -} - - -// --------------------------------------------------------------------------- -// ¥ View / HandleKeyPress -// --------------------------------------------------------------------------- -// Overide CStandardFlexTable: Return and Enter don't open the selection. -// - -Boolean -COfflinePickerView::HandleKeyPress( - const EventRecord &inKeyEvent) -{ - Boolean keyHandled = false; - LControl *keyButton = nil; - - switch (inKeyEvent.message & charCodeMask) - { - case char_Enter: - case char_Return: - LCommander::HandleKeyPress(inKeyEvent); - return true; - } - - return Inherited::HandleKeyPress(inKeyEvent); -} - - -//---------------------------------------------------------------------------- -// ¥ View / GetQapRowText -//---------------------------------------------------------------------------- -// Return info for QA Partner -// -#if defined(QAP_BUILD) -void COfflinePickerView::GetQapRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -{ - if (!outText || inMaxBufferLength == 0) - return; - - cstring rowText(""); - short colCount = mTableHeader->CountVisibleColumns(); - COfflineItem item(inRow, this); - - CMailNewsWindow * myWindow = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (!myWindow) return; - - for (short col = 1; col <= colCount; col ++) - { - STableCell aCell(inRow, col); - LTableHeader::SColumnData * colData = mTableHeader->GetColumnData(col); - if (!colData) break; - LPane * colPane = myWindow->FindPaneByID(colData->paneID); - if (!colPane) break; - - // get column name - CStr255 descriptor; - colPane->GetDescriptor(descriptor); - rowText += descriptor; - rowText += "=\042"; - - // add cell text - switch (PaneIDT dataType = GetCellDataType(aCell)) - { - case kFolderNameColumn: - Boolean isExpanded; - if (CellHasDropFlag(aCell, isExpanded)) - { - if (isExpanded) - rowText += "-"; - else - rowText += "+"; - } - else - rowText += " "; - rowText += item.GetName(); - break; - - case kSelectFolderColumn: - if (item.GetLevel() > kRootLevel) - { - UInt32 folderPrefFlags = item.GetFolderPrefFlags(); - if (folderPrefFlags & MSG_FOLDER_PREF_OFFLINE) - rowText += "+"; - } - break; - } - - if (col < colCount) - rowText += "\042 | "; - else - rowText += "\042\r"; - } - strncpy(outText, (char*)rowText, inMaxBufferLength); - outText[inMaxBufferLength - 1] = '\0'; -} -#endif //QAP_BUILD - - -#pragma mark -- -//------------------------------------------------------------------------------ -// ¥ View / GetIconID -//------------------------------------------------------------------------------ -// -ResIDT COfflinePickerView::GetIconID(TableIndexT inRow) const -{ - COfflineItem item(inRow, this); - return item.GetIconID(); -} - - -//------------------------------------------------------------------------------ -// ¥ View / GetNestedLevel -//------------------------------------------------------------------------------ -// -UInt16 COfflinePickerView::GetNestedLevel(TableIndexT inRow) const -{ - COfflineItem item(inRow, this); - return item.GetLevel() - 1; -} - - -//------------------------------------------------------------------------------ -// ¥ View / ApplyTextStyle -//------------------------------------------------------------------------------ -// -void COfflinePickerView::ApplyTextStyle(TableIndexT inRow) const -{ - COfflineItem item(inRow, this); - ::TextFace(item.HasNewMessages() ? bold : normal); -} - - -//------------------------------------------------------------------------------ -// ¥ View / CellHasDropFlag -//------------------------------------------------------------------------------ -// Check if a cell has a twistee icon and if the twistee is open. -// -Boolean COfflinePickerView::CellHasDropFlag( - const STableCell& inCell, - Boolean& outIsExpanded) const -{ - COfflineItem item(inCell.row, this); - if (GetCellDataType(inCell) == kFolderNameColumn && item.CountSubFolders() != 0) - { - outIsExpanded = item.IsOpen(); - return true; - } - return false; -} - - -//------------------------------------------------------------------------------ -// ¥ View / SetCellExpansion -//------------------------------------------------------------------------------ -// -void COfflinePickerView::SetCellExpansion( - const STableCell& inCell, - Boolean inExpand) -{ - switch (GetRowType(inCell.row)) - { - case kRowMailNews: - Inherited::SetCellExpansion(inCell, inExpand); - break; - - case kRowLDAPHdr: - mLDAPExpanded = inExpand; - TableIndexT outRows, outCols; - GetTableSize(outRows, outCols); - if (inExpand) - InsertRows(mLDAPCount, outRows, nil, 0, true); - else - RemoveRows(mLDAPCount, outRows - mLDAPCount, true); - break; - - case kRowLDAP: - break; - } -} - - -//------------------------------------------------------------------------------ -// ¥ View / GetMainRowText -//------------------------------------------------------------------------------ -// -void COfflinePickerView::GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -{ - switch (GetRowType(inRow)) - { - case kRowMailNews: - Inherited::GetMainRowText(inRow, outText, inMaxBufferLength); - break; - - case kRowLDAPHdr: - case kRowLDAP: - if (outText) - { - COfflineItem item(inRow, this); - ::strncpy(outText, item.GetName(), inMaxBufferLength); - } - break; - } -} - - -//------------------------------------------------------------------------------ -// ¥ View / ChangeFinished -//------------------------------------------------------------------------------ -// - -void COfflinePickerView::ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -{ - // call the inherited method, restoring the original BE row count - // to work around a check in CMailFlexTable::ChangeFinished() - // on MSG_NotifyInsertOrDelete - if ((mLDAPCount > 0) && (inChangeCode == MSG_NotifyInsertOrDelete)) - { - mRows -= (mLDAPExpanded ? mLDAPCount + 1 : 1); - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - mRows += (mLDAPExpanded ? mLDAPCount + 1 : 1); - } - else - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - - switch (inChangeCode) - { - case MSG_NotifyScramble: - case MSG_NotifyAll: - if (mWantLDAP) - { - COfflineItem item(1, this); - if (item.IsLocalMailFolder() && item.IsOpen()) - { - STableCell aCell(1, 1); - SetCellExpansion(aCell, false); - } - AppendLDAPList(); - } - break; - } -} - - -#pragma mark - - -//------------------------------------------------------------------------------ -// ¥ COfflinePickerWindow -//------------------------------------------------------------------------------ -// -COfflinePickerWindow::COfflinePickerWindow(LStream *inStream) - : CMailNewsWindow(inStream, WindowType_OfflinePicker) - , mList(nil) -{ -} - - -//------------------------------------------------------------------------------ -// ¥ ~COfflinePickerWindow -//------------------------------------------------------------------------------ -// -COfflinePickerWindow::~COfflinePickerWindow() -{ -} - - -//------------------------------------------------------------------------------ -// ¥ Window / FinishCreateSelf -//------------------------------------------------------------------------------ -// -void COfflinePickerWindow::FinishCreateSelf() -{ - Inherited::FinishCreateSelf(); - mList = (COfflinePickerView*)GetActiveTable(); - Assert_(mList); - mList->LoadFolderList(mMailNewsContext); - - UReanimator::LinkListenerToControls(this, this, GetPaneID()); - - LGAPushButton * okBtn = dynamic_cast(FindPaneByID(paneID_OkButton)); - if (okBtn) okBtn->SetDefaultButton(true, true); - - Show(); - Select(); -} - - -//------------------------------------------------------------------------------ -// ¥ Window / CalcStandardBoundsForScreen -//------------------------------------------------------------------------------ -// Zoom in the vertical direction only. -// -void COfflinePickerWindow::CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const -{ - LWindow::CalcStandardBoundsForScreen(inScreenBounds, outStdBounds); - Rect contRect = UWindows::GetWindowContentRect(mMacWindowP); - - outStdBounds.left = contRect.left; - outStdBounds.right = contRect.right; -} - - -//---------------------------------------------------------------------------- -// ¥ Window / ListenToMessage -//---------------------------------------------------------------------------- - -void COfflinePickerWindow::ListenToMessage(MessageT inMessage, void* ioParam) -{ -#pragma unused (ioParam) - switch (inMessage) - { - case msg_Cancel: - if (mList) - mList->CancelSelection(); - Inherited::DoClose(); - break; - - case msg_OK: - if (mList) - mList->CommitSelection(); - Inherited::DoClose(); - break; - } -} - - -// --------------------------------------------------------------------------- -// ¥ Window / HandleKeyPress -// --------------------------------------------------------------------------- -// As usual, copied and adapted from LDialogBox. -// Can't we do an attachment with that? -// - -Boolean -COfflinePickerWindow::HandleKeyPress( - const EventRecord &inKeyEvent) -{ - Boolean keyHandled = false; - LControl *keyButton = nil; - - switch (inKeyEvent.message & charCodeMask) { - - case char_Enter: - case char_Return: - keyButton = (LControl*) FindPaneByID(paneID_OkButton); - break; - - case char_Escape: - if ((inKeyEvent.message & keyCodeMask) == vkey_Escape) { - keyButton = (LControl*) FindPaneByID(paneID_CancelButton); - } - break; - - default: - if (UKeyFilters::IsCmdPeriod(inKeyEvent)) { - keyButton = (LControl*) FindPaneByID(paneID_CancelButton); - } else { - keyHandled = LWindow::HandleKeyPress(inKeyEvent); - } - break; - } - - if (keyButton != nil) { - keyButton->SimulateHotSpotClick(kControlButtonPart); - keyHandled = true; - } - - return keyHandled; -} - - -//------------------------------------------------------------------------------ -// ¥ Window / GetActiveTable -//------------------------------------------------------------------------------ -// From CMailNewsWindow. Get the currently active table in the window. -// The active table is the one that the user considers to be receiving input. -// -CMailFlexTable* COfflinePickerWindow::GetActiveTable() -{ - return dynamic_cast(FindPaneByID('Flst')); -} - - -//------------------------------------------------------------------------------ -// ¥ Window / FindAndShow [static] -//------------------------------------------------------------------------------ -// Creates/shows/selects the Offline Picker window. There can only be one of these. -// Use COfflinePickerWindow::DisplayDialog() for a modal dialog. -// -COfflinePickerWindow* COfflinePickerWindow::FindAndShow(Boolean inMakeNew) -{ - COfflinePickerWindow* result = NULL; - try - { - CWindowIterator iter(WindowType_OfflinePicker); - iter.Next(result); - if (!result && inMakeNew) - { - result = dynamic_cast( - URobustCreateWindow::CreateWindow( - res_ID, LCommander::GetTopCommander())); - ThrowIfNULL_(result); - } - } - catch (...) - { - } - return result; -} - - -//------------------------------------------------------------------------------ -// ¥ Window / DisplayDialog [static] -//------------------------------------------------------------------------------ -// Creates/shows/selects the Offline Picker window. There can only be one of these. -// Use COfflinePickerWindow::FindAndShow() for a non-modal window. -// -Boolean COfflinePickerWindow::DisplayDialog() -{ - StDialogHandler handler(res_ID, NULL); - - MessageT message; - do - { - message = handler.DoDialog(); - } while (message != msg_OK && message != msg_Cancel); - - return (message == msg_OK); -} diff --git a/mozilla/cmd/macfe/MailNews/COfflinePicker.h b/mozilla/cmd/macfe/MailNews/COfflinePicker.h deleted file mode 100644 index 2acb33631ff..00000000000 --- a/mozilla/cmd/macfe/MailNews/COfflinePicker.h +++ /dev/null @@ -1,172 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// COfflinePicker.h - -#pragma once - -#include "CMailNewsWindow.h" -#include "CSimpleFolderView.h" - - -//------------------------------------------------------------------------------ -// ¥ COfflinePickerView -//------------------------------------------------------------------------------ -// -class COfflinePickerView : public CSimpleFolderView -{ - friend class COfflineItem; - -private: - typedef CSimpleFolderView Inherited; - -public: - enum { class_ID = 'ofVW' }; - - COfflinePickerView(LStream *inStream); - virtual ~COfflinePickerView(); - - //----------------------------------- - // LDAP folders - //----------------------------------- -protected: - typedef enum { kRowMailNews = 1, kRowLDAPHdr, kRowLDAP} RowType; - - typedef struct SSaveItemRec - { - RowType itemType; - void * itemInfo; - UInt32 originalPrefsFlags; - } SSaveItemRec; - - virtual RowType GetRowType(TableIndexT inRow) const; - virtual UInt16 CountLDAPItems() const {return mLDAPCount;}; - virtual Boolean IsLDAPExpanded() const {return mLDAPExpanded;}; - virtual void AppendLDAPList(); - virtual void SaveItemPrefFlags(const COfflineItem * inOfflineItem, UInt32 inPrefsFlags); - -public: - virtual void CancelSelection(); - virtual void CommitSelection(); - - //----------------------------------- - // Command implementation - //----------------------------------- -public: - virtual void DrawCell( - const STableCell &inCell, - const Rect &inLocalRect); - virtual Boolean ClickSelect( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - virtual void ClickCell( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - - //----------------------------------- - // Commands - //----------------------------------- - - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - //----------------------------------- - // Drawing (Overrides of CSimpleFolderView) - //----------------------------------- - virtual Boolean TableDesiresSelectionTracking ( ) { return false; } - virtual ResIDT GetIconID(TableIndexT inRow) const; - virtual UInt16 GetNestedLevel(TableIndexT inRow) const; - - virtual void ApplyTextStyle(TableIndexT inRow) const; - - virtual Boolean CellHasDropFlag(const STableCell& inCell, Boolean& outIsExpanded) const; - virtual void SetCellExpansion(const STableCell& inCell, Boolean inExpand); - virtual void GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const; - - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - - // ------------------------------------------------------------ - // QA Partner support - // ------------------------------------------------------------ -#if defined(QAP_BUILD) -public: - virtual void GetQapRowText(TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const; -#endif - - //----------------------------------- - // Data - //----------------------------------- -protected: - Boolean mWantLDAP; - XP_List * mLDAPList; - UInt16 mLDAPCount; - Boolean mLDAPExpanded; - Str63 mLDAPHdrStr; - - LArray mSaveItemArray; -}; - - -//------------------------------------------------------------------------------ -// ¥ COfflinePickerWindow -//------------------------------------------------------------------------------ -// -class COfflinePickerWindow : public CMailNewsWindow, - public LListener -{ -private: - typedef CMailNewsWindow Inherited; - -public: - enum { class_ID = 'ofWN', res_ID = 20003}; - - enum { - paneID_OkButton = 'BtOk', - paneID_CancelButton = 'Canc' - }; - -protected: - virtual ResIDT GetStatusResID(void) const { return res_ID; } - virtual UInt16 GetValidStatusVersion(void) const { return 0x0112; } - -public: - COfflinePickerWindow(LStream *inStream); - virtual ~COfflinePickerWindow(); - - virtual void FinishCreateSelf(); - virtual void CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const; - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - virtual CMailFlexTable * GetActiveTable(); - static COfflinePickerWindow * FindAndShow(Boolean inMakeNew); - static Boolean DisplayDialog(); - -protected: - COfflinePickerView * mList; -}; diff --git a/mozilla/cmd/macfe/MailNews/CProgressBroadcaster.h b/mozilla/cmd/macfe/MailNews/CProgressBroadcaster.h deleted file mode 100644 index 3057b9c5d17..00000000000 --- a/mozilla/cmd/macfe/MailNews/CProgressBroadcaster.h +++ /dev/null @@ -1,49 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CProgressBroadcaster.h - -#pragma once - -#include - -//====================================== -class CProgressBroadcaster : public LBroadcaster -//====================================== -{ -public: - enum { msg_StatusText = 'StRp', - msg_StatusPercent = 'StPc', - msg_StatusComplete = 'StCt' - }; - - - struct StatusInfo - { - const char* message; - Int32 percent; - int level; - - StatusInfo () : message(NULL), percent(0), level(0) {} - }; - - CProgressBroadcaster() {} - virtual ~CProgressBroadcaster() {} -}; diff --git a/mozilla/cmd/macfe/MailNews/CSearchManager.cp b/mozilla/cmd/macfe/MailNews/CSearchManager.cp deleted file mode 100644 index e63ec923236..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSearchManager.cp +++ /dev/null @@ -1,1760 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSearchManager.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#define DEBUGGER_ASSERTIONS - -#include "CSearchManager.h" -#include "SearchHelpers.h" - -#include "uerrmgr.h" -#include "CMailNewsContext.h" -#include "libi18n.h" -#include "uprefd.h" -#include -#include -#include "LGARadioButton.h" -#include "CCaption.h" -#include "prefapi.h" -#include -#include "CSingleTextColumn.h" -#include "UMailFilters.h" -#include "CTSMEditField.h" -#include -#include "UIHelper.h" -#include "nc_exception.h" - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -const UInt16 deltaAttributes = 8; // extra array elements to allocate for the attributes menu -const UInt16 resIDT_CustomHeadersDialog = 8652; // resource id for the custom header edit dialog box -const UInt16 resIDT_CustomHeadersInputDialog = 8654; // resource id for the input dialog box for custom header -const UInt16 kMaxStringLength = 256; - -const char kCustomHeaderPref[] = "mailnews.customHeaders"; // preference name for custom headers - -// custom headers messages -const MessageT msg_NewHeader = 'chNW'; // new custom header message -const MessageT msg_EditHeader = 'chED'; // edit custom header message -const MessageT msg_DeleteHeader = 'chDE'; // delete custom header message - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ -#pragma mark - - -//----------------------------------- -CSearchManager::CSearchManager() : - LListener(), - LBroadcaster(), - mNumLevels(0), - mNumVisLevels(0), - mLastMenuItemsScope((MSG_ScopeAttribute) -1), - mLastMenuItemsAttribute((MSG_SearchAttribute) -1), - mNumLastMenuItems(0), - mCurrentScope((MSG_ScopeAttribute) -1), - mMoreButton(nil), - mFewerButton(nil), - mMsgPane(nil), - mCanRotateTarget(true), - mBroadcastUserChanges(true), - mFolderScopeList(nil), - mIsSearching(false), - mMatchAllRadio(nil), - mMatchAnyRadio(nil), - mBoolOperator( true ), - mAttributeItems( nil ), - mLastNumOfAttributes( 0 ) -//----------------------------------- -{ - memset(mLevelFields, 0, sizeof(SearchLevelInfoT) * cMaxNumSearchLevels); -} - -//----------------------------------- -CSearchManager::~CSearchManager(void) -//----------------------------------- -{ - AboutToClose(); - delete mAttributeItems; -} - -//----------------------------------- -void CSearchManager::AboutToClose() -//----------------------------------- -{ - // Designed to be safe to call multiple times. - Assert_(!IsSearching()); -} - -//----------------------------------- -OSErr CSearchManager::InitSearchManager( - LView *inContainer, CSearchTabGroup *inTabGroup, - MSG_ScopeAttribute inScope, LArray *inFolderScopeList ) -// Initialize the window. This class assumes that all level parameters are defined -// within the paneID_ParamEncl view in the correct order. -//----------------------------------- -{ - OSErr error = noErr; - - StValueChanger change(mBroadcastUserChanges, false); - - Try_ { - if ( inTabGroup ) inTabGroup->SetRotateWatchValue(&mCanRotateTarget); - mParamEnclosure = USearchHelper::FindViewSubview(inContainer, paneID_ParamEncl); - - - FindUIItemPtr( mParamEnclosure, paneID_More, mMoreButton ); - FindUIItemPtr( mParamEnclosure, paneID_Fewer, mFewerButton ); - FindUIItemPtr( mParamEnclosure, paneID_MatchAllRadio, mMatchAllRadio ); - FindUIItemPtr( mParamEnclosure, paneID_MatchAnyRadio, mMatchAnyRadio ); - - // Link up this object to its sub broadcasters - USearchHelper::LinkListenerToBroadcasters(mParamEnclosure, this); - - // Locate and cache references to the relevant search fields - LArray *subPanes; - LView *theView = dynamic_cast(mParamEnclosure->FindPaneByID(paneID_ParamSubEncl)); - - if ( theView != nil ) { - subPanes = &theView->GetSubPanes(); - theView->SetRefreshAllWhenResized(false); - } else { - subPanes = &mParamEnclosure->GetSubPanes(); - } - - LArrayIterator iterator(*subPanes); - - AssertFail_(mNumLevels == 0); - AssertFail_(mNumVisLevels == 0); - - LPane *pane; - while ( iterator.Next(&pane) ) - { - Int32 userCon = pane->GetUserCon() - 1; - Boolean updateNumLevels = true; - PaneIDT thePane = pane->GetPaneID(); - switch ( thePane ) - { - case paneID_Attributes: - AssertFail_(IsBetween(userCon, 0, cMaxNumSearchLevels - 1)); - mLevelFields[userCon].attributesPopup = dynamic_cast(pane); - break; - case paneID_Operators: - AssertFail_(IsBetween(userCon, 0, cMaxNumSearchLevels - 1)); - mLevelFields[userCon].operatorsPopup = dynamic_cast(pane); - break; - case paneID_TextValue: - AssertFail_(IsBetween(userCon, 0, cMaxNumSearchLevels - 1)); - mLevelFields[userCon].valueText = dynamic_cast(pane); - break; - case paneID_IntValue: - AssertFail_(IsBetween(userCon, 0, cMaxNumSearchLevels - 1)); - mLevelFields[userCon].valueInt = dynamic_cast(pane); - break; - case paneID_PopupValue: - AssertFail_(IsBetween(userCon, 0, cMaxNumSearchLevels - 1)); - mLevelFields[userCon].valuePopup = dynamic_cast(pane); - break; - case paneID_DateValue: - AssertFail_(IsBetween(userCon, 0, cMaxNumSearchLevels - 1)); - mLevelFields[userCon].valueDate = dynamic_cast(pane); - break; - default: - updateNumLevels = false; - // Pass to next pane - break; - } // switch - if ( updateNumLevels ) - { - if ( userCon >= mNumLevels ) - { - mNumLevels = userCon + 1; - mNumVisLevels = mNumLevels; - } - } - } // while -#ifdef Debug_Signal - // Validate all the fields - AssertFail_(mNumLevels > 0); - for (Int32 i = 0; i < mNumLevels; ++i) - { - AssertFail_((mLevelFields[i].attributesPopup != nil) && (mLevelFields[i].operatorsPopup != nil) && - (mLevelFields[i].valueText != nil) && (mLevelFields[i].valuePopup != nil) && - (mLevelFields[i].valueDate != nil) && (mLevelFields[i].valueInt != nil) ); - } -#endif // gDebugSignal - - mParamEnclosure->SetRefreshAllWhenResized(false); - - // Find the margin between search levels - if ( mNumLevels > 1 ) - { - Rect portFrame; - mLevelFields[1].attributesPopup->CalcPortFrameRect(portFrame); - mLevelResizeV = portFrame.bottom; - mLevelFields[0].attributesPopup->CalcPortFrameRect(portFrame); - mLevelResizeV -= portFrame.bottom; - } - SetSearchScope(inScope, inFolderScopeList); // 97/03/03 second param was NULL. - } - Catch_(inErr) - { - error = inErr; - } - EndCatch_ - - return error; -} // CSearchManager::InitSearchManager - -//----------------------------------- -Boolean CSearchManager::CanSearch(void) const -//----------------------------------- -{ - if ( IsSearching() ) return false; - - for (Int32 i = 0; i < mNumVisLevels; ++i) - { - if ( (USearchHelper::GetEditFieldLength(mLevelFields[i].valueText) < 1) && mLevelFields[i].valueText->IsVisible() ) - return false; - } - return true; -} - - -/*====================================================================================== - React to scope message. -======================================================================================*/ - -void CSearchManager::SetSearchScope(MSG_ScopeAttribute inScope, LArray *inFolderScopeList) -{ - // Set the scope and the list of folders selected. Currently only one - // selection at the time is available - 11/19/97 - - StValueChanger change(mBroadcastUserChanges, false); - - mCurrentScope = inScope; - mFolderScopeList = inFolderScopeList; - - PopulateAttributesMenus(mCurrentScope); - - for (Int32 i = 0; i < mNumLevels; ++i) - { -// SearchLevelInfoT *levelInfo = &mLevelFields[inAttributesMenu->GetUserCon() - 1]; - MessageAttributes(mLevelFields[i]); - } -} - - -/*====================================================================================== - Set the number of visible levels. -======================================================================================*/ - -void CSearchManager::SetNumVisibleLevels(Int32 inNumLevels) { - - Int16 resizeAmount; - - { // Begin scope for stack-based classes. - - StValueChanger change(mBroadcastUserChanges, false); - StValueChanger change2(mIsBroadcasting, false); - - if ( inNumLevels < 1 ) { - inNumLevels = 1; - } else if ( inNumLevels > mNumLevels ) { - inNumLevels = mNumLevels; - } - Int32 delta = inNumLevels - mNumVisLevels; - - Boolean more = (delta < 0) ? false : true; - - SDimension16 startFrameSize; - mParamEnclosure->GetFrameSize(startFrameSize); - - // Hide or show the levels - delta = abs( delta ); - while ( delta != 0 ) - { - MessageMoreFewer( more ); - --delta; - } - - SDimension16 endFrameSize; - mParamEnclosure->GetFrameSize(endFrameSize); - resizeAmount = endFrameSize.height - startFrameSize.height; - - } // End scope for stack-based classes. - - - BroadcastMessage(msg_SearchParametersResized, &resizeAmount); -} - - -/*====================================================================================== - React to stop message. Pass in a valid context if the user cancelled. -======================================================================================*/ - -void CSearchManager::StopSearch(MWContext *inContext) { - - if ( !IsSearching() ) return; - - mIsSearching = false; - - if ( inContext ) { - Int32 rtnVal = MSG_InterruptSearch(inContext); - } - - mParamEnclosure->Enable(); -} - - -/*====================================================================================== - React to save message. -======================================================================================*/ - -/* Not implemented -void CSearchManager::SaveSearchResults(void) -{ -} -*/ - -/*====================================================================================== - Adjust the search parameters to saved status data. -======================================================================================*/ - -void CSearchManager::ReadSavedSearchStatus(LStream *inStatusData) -{ - - StValueChanger change(mBroadcastUserChanges, false); - - if ( inStatusData == nil ) - SetNumVisibleLevels(1); - else - { - Int32 numVisibleLevels; - *inStatusData >> numVisibleLevels; - - SetNumVisibleLevels(numVisibleLevels); - - Int32 numLevels; - *inStatusData >> numLevels; - *inStatusData >> mBoolOperator; - - (mBoolOperator ? mMatchAllRadio : mMatchAnyRadio)->SetValue(Button_On); - - SearchLevelInfoT *curLevel = mLevelFields; - for (int i = 0; i < numLevels; i++) - { - CommandT command1, command2; - SearchTextValueT text; - long age; - Str255 ageStr; - - *inStatusData >> command1; - *inStatusData >> command2; - *inStatusData >> ((StringPtr) text.text); - *inStatusData >> age; - // be cautious: if some future version supports a larger number of levels, - // just skip the data, don't do anything with it. This caused a crash - // when the search window was used in 4.01 after running it in 4.02 (7/30 build). - if (i < mNumLevels) - { - curLevel->attributesPopup->SetCurrentItemByCommand(command1); - curLevel->operatorsPopup->SetCurrentItemByCommand(command2); - curLevel->valueText->SetDescriptor((StringPtr) text.text); - ::NumToString( age, ageStr ); - curLevel->valueInt->SetDescriptor( ageStr ); - curLevel++; - } - - } - } -} - - -Boolean -CSearchManager::GetBooleanOperator() const -{ - return mBoolOperator; -} - -/*====================================================================================== - Get the search status to save. -======================================================================================*/ - -void CSearchManager::WriteSavedSearchStatus(LStream *outStatusData) -{ - - *outStatusData << mNumVisLevels; - *outStatusData << mNumLevels; - *outStatusData << mBoolOperator; - - SearchLevelInfoT *curLevel = mLevelFields; - SearchLevelInfoT *endLevel = curLevel + mNumLevels; - - SearchTextValueT text; - Str255 ageStr; - long age; - - do { - *outStatusData << curLevel->attributesPopup->GetCurrentItemCommandNum(); - *outStatusData << curLevel->operatorsPopup->GetCurrentItemCommandNum(); - *outStatusData << curLevel->valueText->GetDescriptor((StringPtr) text.text); - curLevel->valueInt->GetDescriptor( ageStr ); - ::StringToNum(ageStr, &age); - *outStatusData << age; - } while ( ++curLevel < endLevel ); -} - - -/*====================================================================================== - Get the current search parameters. outSearchParams must be able to hold at least - GetNumVisibleLevels() elements. Strings are output as c-strings. -======================================================================================*/ - -void CSearchManager::GetSearchParameters(SearchLevelParamT *outSearchParams) { - - SearchLevelInfoT *curLevel = mLevelFields; - SearchLevelInfoT *endLevel = curLevel + mNumVisLevels; - - do { - CommandT attributeCommand = curLevel->attributesPopup->GetCurrentItemCommandNum(); - outSearchParams->val.attribute = ((MSG_SearchAttribute) attributeCommand ); - - // *** if custom header get the the menu location and save it - if( attributeCommand == attribOtherHeader ) - outSearchParams->customHeaderPos = curLevel->attributesPopup->GetValue(); - else - outSearchParams->customHeaderPos = 0; - - outSearchParams->op = (MSG_SearchOperator) - curLevel->operatorsPopup->GetCurrentItemCommandNum(); - - outSearchParams->boolOp = mBoolOperator; - - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(outSearchParams->val.attribute, &widget)); - - switch ( widget ) { - case widgetText: { - if ( curLevel->valueText->IsVisible() ) { - curLevel->valueText->GetDescriptor((StringPtr) outSearchParams->val.u.string); - if ( outSearchParams->val.u.string[0] == 0 ) { - outSearchParams->op = opIsEmpty; - } else { - P2CStr((StringPtr) outSearchParams->val.u.string); - } - } else { - outSearchParams->op = opIsEmpty; - *outSearchParams->val.u.string = '\0'; - } - } - break; - - case widgetInt: - if ( curLevel->valueInt->IsVisible() ) - { - Str255 age; - curLevel->valueInt->GetDescriptor( age ); - if ( age[0] == 0 ) - outSearchParams->op = opIsEmpty; - else - { - Int32 ageNum; - ::StringToNum( age, &ageNum); - outSearchParams->val.u.age = ageNum; - } - } - else - { - outSearchParams->op = opIsEmpty; - outSearchParams->val.u.age = 0; - } - break; - - case widgetDate: { - AssertFail_(curLevel->valueDate->IsVisible()); - Int16 year; UInt8 month, day; - curLevel->valueDate->GetDate(&year, &month, &day); - tm time; - - time.tm_sec = 1; - time.tm_min = 1; - time.tm_hour = 1; - time.tm_mday = day; - time.tm_mon = month - 1; - time.tm_year = year - 1900; - time.tm_wday = -1; - time.tm_yday = -1; - time.tm_isdst = -1; - - outSearchParams->val.u.date = ::mktime(&time); -#ifdef Debug_Signal - tm *checkTime = ::localtime(&outSearchParams->val.u.date); - Assert_((time.tm_sec == checkTime->tm_sec) && (time.tm_min == checkTime->tm_min) && - (time.tm_hour == checkTime->tm_hour) && (time.tm_mday == checkTime->tm_mday) && - (time.tm_mon == checkTime->tm_mon) && (time.tm_year == checkTime->tm_year)); -#endif // Debug_Signal - } - break; - - case widgetMenu: { - AssertFail_(curLevel->valuePopup->IsVisible()); - if ( outSearchParams->val.attribute == attribPriority ) { - outSearchParams->val.u.priority = (MSG_PRIORITY) - curLevel->valuePopup->GetCurrentItemCommandNum(); - } else { - AssertFail_(outSearchParams->val.attribute == attribMsgStatus); - outSearchParams->val.u.msgStatus = (uint32) - curLevel->valuePopup->GetCurrentItemCommandNum(); - } - } - break; - - default: - FailOSErr_(paramErr); // Should never get here! - break; - } - ++outSearchParams; - } while ( ++curLevel < endLevel ); -} - - -/*====================================================================================== - Set the current search parameters. inSearchParams must hold at least inNumVisLevels - elements. If inNumVisLevels < GetNumLevels(), the remaining levels are set - to their cleared values. The InitSearchManager() method must be called before calling - this method. Set inSearchParams to nil to clear all the values. Strings are input - as c-strings. -======================================================================================*/ - -void CSearchManager::SetSearchParameters(Int16 inNumVisLevels, const SearchLevelParamT *inSearchParams) { - - AssertFail_((mNumVisLevels > 0) && (mNumLevels > 0) && IsBetween(inNumVisLevels, 1, mNumLevels)); - StValueChanger change(mBroadcastUserChanges, false); - - SetNumVisibleLevels(inNumVisLevels); - - AssertFail_(inNumVisLevels == mNumVisLevels); - - if ( inSearchParams != nil ) { - SearchLevelInfoT *curLevel = mLevelFields, *endLevel = curLevel + mNumVisLevels; - const SearchLevelParamT *curParam = inSearchParams; - do { - curLevel->attributesPopup->SetCurrentItemByCommand(curParam->val.attribute); - curLevel->operatorsPopup->SetCurrentItemByCommand(curParam->op); - - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(curParam->val.attribute, &widget)); - switch ( widget ) { - case widgetText: - { -// if (curParam->op == opIsEmpty) // -// *curParam->val.u.string = '\0'; // - CStr255 string(curParam->val.u.string); - if ( string.Length() == 0 ) - curLevel->operatorsPopup->SetCurrentItemByCommand(opIsEmpty); - curLevel->valueText->SetDescriptor(string); - } - curLevel->valueDate->SetToToday(); - curLevel->valuePopup->SetToDefault(); - break; - - case widgetInt: - if( curParam->val.u.age == 0 ) - { - curLevel->operatorsPopup->SetCurrentItemByCommand(opIsEmpty); - curLevel->valueInt->SetDescriptor( CStr255("") ); - } - else - { - Str255 ageString; - ::NumToString( curParam->val.u.age, ageString); - curLevel->valueInt->SetDescriptor( ageString ); - } - curLevel->valueDate->SetToToday(); - curLevel->valuePopup->SetToDefault(); - break; - - case widgetDate: { - tm *time = ::localtime(&curParam->val.u.date); - AssertFail_(time != nil); -#ifdef Debug_Signal - time_t checkTime = ::mktime(time); - Assert_(checkTime == curParam->val.u.date); -#endif // Debug_Signal - curLevel->valueDate->SetDate(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday); - } - curLevel->valueText->SetDescriptor("\p"); - curLevel->valuePopup->SetToDefault(); - break; - - case widgetMenu: - if ( curParam->val.attribute == attribPriority ) { - curLevel->valuePopup->SetCurrentItemByCommand(curParam->val.u.priority); - } else { - AssertFail_(curParam->val.attribute == attribMsgStatus); // Only other option! - curLevel->valuePopup->SetCurrentItemByCommand(curParam->val.u.msgStatus); - } - curLevel->valueText->SetDescriptor("\p"); - curLevel->valueDate->SetToToday(); - break; - - default: - AssertFail_(false); // Should never get here! - break; - } - ++curParam; - } while ( ++curLevel < endLevel ); - } else { - inNumVisLevels = 0; - } - - if ( inNumVisLevels < mNumLevels ) { - ClearSearchParams(inNumVisLevels + 1, mNumLevels); - } -} - - - - -#if 0 -/*====================================================================================== - If the returned MWContext is non-nil, the specified row is currently open and the - returned context belongs to the opened pane. This method always return the context - type of the specified result element. -======================================================================================*/ - -MWContext *CSearchManager::IsResultElementOpen(MSG_ViewIndex inIndex, MWContextType *outType) { - - UpdateMsgResult(inIndex); - - MWContext *rtnContext = MSG_IsResultElementOpen(mResultElement); - *outType = MSG_GetResultElementType(mResultElement); - - return rtnContext; -} - -#endif - - - -/*====================================================================================== - Populate the priority menu. -======================================================================================*/ - -void CSearchManager::PopulatePriorityMenu(CSearchPopupMenu *inMenu) { - - // Call BE to get menu items - - if ( (mLastMenuItemsScope != (MSG_ScopeAttribute) cPriorityScope) || (mLastMenuItemsAttribute != kNumAttributes) ) { - MSG_SearchMenuItem *curMenuItem = mSearchMenuItems; - for (Int32 i = MSG_LowestPriority; i <= (Int32) MSG_HighestPriority; ++i, ++curMenuItem) { - MSG_GetPriorityName((MSG_PRIORITY) i, curMenuItem->name, sizeof(curMenuItem->name)); - C2PStr(curMenuItem->name); - curMenuItem->attrib = i; - curMenuItem->isEnabled = true; - } - mNumLastMenuItems = curMenuItem - mSearchMenuItems; - mLastMenuItemsScope = (MSG_ScopeAttribute) cPriorityScope; - mLastMenuItemsAttribute = kNumAttributes; - } - - UInt32 populateID = 0x7000000; - inMenu->PopulateMenu(mSearchMenuItems, mNumLastMenuItems, MSG_NormalPriority, populateID); -} - - -/*====================================================================================== - Populate the status menu. -======================================================================================*/ - -void CSearchManager::PopulateStatusMenu(CSearchPopupMenu *inMenu) { - - const int32 cStatusValues[] = { MSG_FLAG_READ, - MSG_FLAG_REPLIED, - MSG_FLAG_FORWARDED }; - - uint16 nStatus = sizeof(cStatusValues) / sizeof(int32); - - // Call BE to get menu items - - if ( (mLastMenuItemsScope != (MSG_ScopeAttribute) cStatusScope) || (mLastMenuItemsAttribute != kNumAttributes) ) { - MSG_SearchMenuItem *curMenuItem = mSearchMenuItems; - for (Int32 i = 0; i < nStatus && i < cMaxNumSearchMenuItems; ++i) { - Int32 status = cStatusValues[i]; - MSG_GetStatusName(status, curMenuItem->name, sizeof(curMenuItem->name)); - C2PStr(curMenuItem->name); - if ( curMenuItem->name[0] > 0 ) { - curMenuItem->attrib = status; - curMenuItem->isEnabled = true; - ++curMenuItem; - } - } - mNumLastMenuItems = curMenuItem - mSearchMenuItems; - mLastMenuItemsScope = (MSG_ScopeAttribute) cStatusScope; - mLastMenuItemsAttribute = kNumAttributes; - } - - UInt32 populateID = 0x6000000; - inMenu->PopulateMenu(mSearchMenuItems, mNumLastMenuItems, MSG_FLAG_READ, populateID); -} - - -/*====================================================================================== - Respond to broadcaster messages. -======================================================================================*/ - -void CSearchManager::ListenToMessage(MessageT inMessage, void *ioParam) { - - Boolean userChanged = true; - - switch ( inMessage ) { - - case paneID_Attributes: - CSearchPopupMenu* currentSearchPopup = static_cast( ioParam ); - - // Check if the attribute is the customize command. - // If it is execute it. - CommandT command = currentSearchPopup->GetCurrentItemCommandNum( currentSearchPopup->GetValue() ); - if( command == eCustomizeSearchItem ) - { - StValueChanger change(mBroadcastUserChanges, false); // stop broadcasting inside this scope - EditCustomHeaders(); - userChanged = false; - } - else - { - MessageAttributes( mLevelFields[currentSearchPopup->GetUserCon() - 1] ); - if ( mBroadcastUserChanges ) - SelectSearchLevel(((CSearchPopupMenu *) ioParam)->GetUserCon(), eCheckNothing); - } - break; - - case paneID_Operators: - MessageOperators((CSearchPopupMenu *) ioParam); - if ( mBroadcastUserChanges ) SelectSearchLevel(((CSearchPopupMenu *) ioParam)->GetUserCon(), eCheckNothing); - break; - - case msg_AND_OR_Toggle: - mBoolOperator = (mMatchAllRadio->GetValue() == Button_On ? true : false); - break; - - case paneID_More: - case paneID_Fewer: { - StValueChanger change(mCanRotateTarget, false); - Int32 curSelectedLevel = GetSelectedSearchLevel(); - MessageMoreFewer(inMessage == paneID_More); - if ( mBroadcastUserChanges ) { - if ( (inMessage == paneID_More) || !curSelectedLevel || - (curSelectedLevel == (mNumVisLevels + 1)) ) { - SelectSearchLevel(mNumVisLevels, eCheckBackward); - } - } - } - break; - - case paneID_Clear: - MessageClear(); - if ( mBroadcastUserChanges ) SelectSearchLevel(1, eCheckForward); - break; - - case CSearchEditField::msg_UserChangedText: - break; - - default: - userChanged = false; - // Nothing to do, no inherited method - break; - } - - if ( userChanged ) UserChangedParameters(); -} - - -//----------------------------------- -MSG_ScopeAttribute CSearchManager::GetBEScope(MSG_ScopeAttribute inScope) const -// Convert the current search scope as we store it in this manager to a scope that is -// understood by the BE. -//----------------------------------- -{ - MSG_ScopeAttribute beScope = scopeMailFolder; - - if ( (inScope == scopeNewsgroup) || (inScope == cScopeNewsSelectedItems) ) - beScope = scopeNewsgroup; - else if ( inScope == scopeLdapDirectory ) - beScope = scopeLdapDirectory; - return beScope; -} // CSearchManager::GetBEScope - -//----------------------------------- -void CSearchManager::PopulateAttributesMenus(MSG_ScopeAttribute inScope) -// Populate the attributes menus according to the specified scope. -//----------------------------------- -{ - MSG_ScopeAttribute beScope = GetBEScope(inScope); - - // Call BE to get menu items - - - if ( (mLastMenuItemsScope != beScope) || (mLastMenuItemsAttribute != kNumAttributes) ) - { - // mNumLastMenuItems = cMaxNumSearchMenuItems; - void* scopeItem = nil; - - if (!mFolderScopeList) - { - // This happens with filters. Get a folder info for the inbox. - MSG_FolderInfo* inbox; - ::MSG_GetFoldersWithFlag( - CMailNewsContext::GetMailMaster(), - MSG_FOLDER_FLAG_INBOX, - &inbox, - 1); - scopeItem = inbox; - } - else if (!mFolderScopeList->FetchItemAt(LArray::index_First, &scopeItem)) - return; - - if (scopeItem) - { - // *** get number of items - mLastNumOfAttributes = GetNumberOfAttributes( beScope, scopeItem ); - - if (mFolderScopeList) - FailSearchError(::MSG_GetAttributesForSearchScopes( - CMailNewsContext::GetMailMaster(), - beScope, - &scopeItem, - 1, - mAttributeItems, - &mLastNumOfAttributes)); - else - FailSearchError(::MSG_GetAttributesForFilterScopes( - CMailNewsContext::GetMailMaster(), - beScope, - &scopeItem, - 1, - mAttributeItems, - &mLastNumOfAttributes)); - - // Finish creating the attributes menu for the filter and message search - if( beScope != scopeLdapDirectory ) - FinishCreateAttributeMenu( mAttributeItems, mLastNumOfAttributes ); - - mLastMenuItemsScope = beScope; - mLastMenuItemsAttribute = kNumAttributes; - - // Convert to pascal string - for (Int32 j = 0; j < mLastNumOfAttributes; ++j) - C2PStr(mAttributeItems[j].name); - - //UInt32 populateID = ((((UInt32) beScope)<<16) | ((UInt32) 0) | 0x4000000); - UInt32 populateID = (UInt32)scopeItem; - for (Int32 i = 0; i < mNumLevels; ++i) - { - mLevelFields[i].attributesPopup->PopulateMenu( - mAttributeItems, mLastNumOfAttributes, attribSender, populateID); - } - } - } -} // CSearchManager::PopulateAttributesMenus - -//----------------------------------- -void CSearchManager::PopulateOperatorsMenus(MSG_ScopeAttribute inScope) -// Populate the operators menus according to the specified scope. This method assumes -// that the attributes menus have been setup to the scope already by calling the -// PopulateAttributesMenus() method. -//----------------------------------- -{ - MSG_ScopeAttribute beScope = GetBEScope(inScope); - - // Call BE to get menu items - - MSG_SearchAttribute lastAttrib = kNumAttributes; - CommandT newCommandIfInvalid; - UInt32 populateID; - - void* scopeItem = nil; - if (!mFolderScopeList) - { - // This happens with filters. Get a folder info for the inbox. - MSG_FolderInfo* inbox; - ::MSG_GetFoldersWithFlag( - CMailNewsContext::GetMailMaster(), - MSG_FOLDER_FLAG_INBOX, - &inbox, - 1); - scopeItem = inbox; - } - else if (!mFolderScopeList->FetchItemAt(LArray::index_First, &scopeItem)) - return; - if (!scopeItem) - return; - for (Int32 i = 0; i < mNumLevels; ++i) - { - MSG_SearchAttribute attrib - = (MSG_SearchAttribute)mLevelFields[i].attributesPopup->GetCurrentItemCommandNum(); - if ( lastAttrib != attrib ) - { - if ( (mLastMenuItemsScope != beScope) || (mLastMenuItemsAttribute != attrib) ) - { - mNumLastMenuItems = cMaxNumSearchMenuItems; - if (mFolderScopeList) - FailSearchError(MSG_GetOperatorsForSearchScopes( - CMailNewsContext::GetMailMaster(), - beScope, - &scopeItem, - 1, - attrib, - mSearchMenuItems, - &mNumLastMenuItems)); - else - FailSearchError(MSG_GetOperatorsForFilterScopes( - CMailNewsContext::GetMailMaster(), - beScope, - &scopeItem, - 1, - attrib, - mSearchMenuItems, - &mNumLastMenuItems)); - mLastMenuItemsScope = beScope; - mLastMenuItemsAttribute = attrib; - // Convert to pascal string - for (Int32 j = 0; j < mNumLastMenuItems; ++j) - C2PStr(mSearchMenuItems[j].name); - } - lastAttrib = attrib; - - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(lastAttrib, &widget)); - - switch ( widget ) { - case widgetText: newCommandIfInvalid = opContains; break; - case widgetDate: newCommandIfInvalid = opIsBefore; break; - case widgetMenu: newCommandIfInvalid = opIs; break; - case widgetInt: newCommandIfInvalid = opIsGreaterThan; break; - default: - AssertFail_(false); // Should never get here! - newCommandIfInvalid = 0; - break; - } - //populateID = ((((UInt32) beScope)<<16) | ((UInt32) lastAttrib) | 0x5000000); - populateID = ((((UInt32) scopeItem)<<16) | ((UInt32) lastAttrib) | 0x5000000); - } - mLevelFields[i].operatorsPopup->PopulateMenu( - mSearchMenuItems, mNumLastMenuItems, - newCommandIfInvalid, populateID); - } // for -} // CSearchManager::PopulateOperatorsMenus - -/*====================================================================================== - Select the active input search field in the specified search parameter level. -======================================================================================*/ - -void CSearchManager::SelectSearchLevel(Int16 inBeginLevel, ECheckDirection inCheckDirection) { - - if ( !IsBetween(inBeginLevel, 1, mNumVisLevels) ) return; - Int32 inc, end; - - switch ( inCheckDirection ) { - case eCheckForward: inc = 1; end = mNumVisLevels + 1; break; - case eCheckBackward: inc = -1; end = 0; break; - default: inc = 1; end = inBeginLevel + 1; break; - } - - for (Int32 i = inBeginLevel; i != end; i += inc) { - SearchLevelInfoT *levelInfo = &mLevelFields[i - 1]; - MSG_SearchAttribute attrib = (MSG_SearchAttribute) levelInfo->attributesPopup->GetCurrentItemCommandNum(); - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(attrib, &widget)); - - if ( widget == widgetText ) - { - Assert_(levelInfo->valueText->IsLatentVisible()); - USearchHelper::SelectEditField(levelInfo->valueText); - return; - } - else if ( widget == widgetDate ) - { - Assert_(levelInfo->valueDate->IsLatentVisible()); - USearchHelper::SelectDateView(levelInfo->valueDate); - return; - } - else if( widget == widgetInt ) - { - Assert_(levelInfo->valueInt->IsLatentVisible()); - USearchHelper::SelectEditField(levelInfo->valueInt); - return; - } - } -} -/*====================================================================================== - Set the wincsid for the editfield -======================================================================================*/ - -void CSearchManager::SetWinCSID(int16 wincsid) { - ResIDT textTraitsID = 8603; - if( wincsid != INTL_CharSetNameToID(INTL_ResourceCharSet()) ) - textTraitsID = CPrefs::GetTextFieldTextResIDs(wincsid); - - for (Int32 i = 0; i < mNumVisLevels ; i++) { - SearchLevelInfoT *levelInfo = &mLevelFields[i]; - MSG_SearchAttribute attrib = (MSG_SearchAttribute) levelInfo->attributesPopup->GetCurrentItemCommandNum(); - if( attrib == eCustomizeSearchItem ) - attrib = (MSG_SearchAttribute) levelInfo->attributesPopup->GetOldItemCommand(); - - // ******************************************************************************* - // - // !!! HACK ALERT !!! - // - // The current search architecture assumes that the location of the menu item correspond to the - // command number. Bad assumption. The "Age in Days" attribute does not follow this system. The - // following code is a hack to fix this problem. It checks for the item number and current scope - // and substitutes the correct command for the bad assumption. - // - // 12/3/97 - // - // ******************************************************************************* - - if( mCurrentScope != scopeLdapDirectory && attrib == attribCommonName ) - attrib = attribAgeInDays; - - // ******************************************************************************* - - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(attrib, &widget)); - - if ( widget == widgetText ) - { - Assert_(levelInfo->valueText->IsLatentVisible()); - levelInfo->valueText->SetTextTraitsID(textTraitsID); - levelInfo->valueText->Refresh(); - } - else if ( widget == widgetInt ) - { - Assert_(levelInfo->valueInt->IsLatentVisible()); - levelInfo->valueInt->SetTextTraitsID(textTraitsID); - levelInfo->valueInt->Refresh(); - } - } -} - - -/*====================================================================================== - Find the currently selected (i.e. active user input) search level, 0 if none. -======================================================================================*/ - -Int32 CSearchManager::GetSelectedSearchLevel(void) { - - SearchLevelInfoT *curlevelInfo = &mLevelFields[0]; - SearchLevelInfoT *endlevelInfo = curlevelInfo + mNumVisLevels; - - while ( curlevelInfo < endlevelInfo ) { - if ( curlevelInfo->valueText->IsTarget() || curlevelInfo->valueDate->ContainsTarget() - || curlevelInfo->valueInt->IsTarget() ) - { - return (curlevelInfo - &mLevelFields[0] + 1); - } - ++curlevelInfo; - } - return 0; -} - - -/*====================================================================================== - React to attributes message. -======================================================================================*/ - -//void CSearchManager::MessageAttributes(CSearchPopupMenu *inAttributesMenu) { -void CSearchManager::MessageAttributes( SearchLevelInfoT& searchLevel ) { - -// SearchLevelInfoT *levelInfo = &mLevelFields[inAttributesMenu->GetUserCon() - 1]; - CSearchPopupMenu* inAttributesMenu = searchLevel.attributesPopup; - - PopulateOperatorsMenus(mCurrentScope); - - // Find out which value type to display - - MSG_SearchAttribute attrib = (MSG_SearchAttribute) inAttributesMenu->GetCurrentItemCommandNum(); - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(attrib, &widget)); - - if ( widget == widgetMenu ) { - if ( attrib == attribPriority ) { - PopulatePriorityMenu(searchLevel.valuePopup); - } else { - PopulateStatusMenu(searchLevel.valuePopup); - } - } - - if ( inAttributesMenu->IsLatentVisible() ) { - // !!! - USearchHelper::ShowHidePane(searchLevel.valueText, widget == widgetText); - USearchHelper::ShowHidePane(searchLevel.valueInt, widget == widgetInt); - USearchHelper::ShowHidePane(searchLevel.valueDate, widget == widgetDate); - USearchHelper::ShowHidePane(searchLevel.valuePopup, widget == widgetMenu); - } else { - switch ( widget ) - // !!! need to add support for days - { - case widgetText: searchLevel.lastVisibleValue = searchLevel.valueText; break; - case widgetInt: searchLevel.lastVisibleValue = searchLevel.valueInt; break; - case widgetDate: searchLevel.lastVisibleValue = searchLevel.valueDate; break; - case widgetMenu: searchLevel.lastVisibleValue = searchLevel.valuePopup; break; - default: - AssertFail_(false); // Should never get here! - break; - } - } - - MessageOperators(searchLevel.operatorsPopup); -} - - -/*====================================================================================== - React to operators message. -======================================================================================*/ - -void CSearchManager::MessageOperators(CSearchPopupMenu *inOperatorsMenu) { - - SearchLevelInfoT *levelInfo = &mLevelFields[inOperatorsMenu->GetUserCon() - 1]; - - MSG_SearchOperator op = (MSG_SearchOperator) inOperatorsMenu->GetCurrentItemCommandNum(); - MSG_SearchAttribute attrib = (MSG_SearchAttribute) levelInfo->attributesPopup->GetCurrentItemCommandNum(); - MSG_SearchValueWidget widget; - FailSearchError(MSG_GetSearchWidgetForAttribute(attrib, &widget)); - - if ( widget == widgetText ) - { - if ( op == opIsEmpty ) levelInfo->lastVisibleValue = nil; - if ( inOperatorsMenu->IsLatentVisible() ) - USearchHelper::ShowHidePane(levelInfo->valueText, op != opIsEmpty); - } - else if ( widget == widgetInt ) - { - if ( op == opIsEmpty ) levelInfo->lastVisibleValue = nil; - if ( inOperatorsMenu->IsLatentVisible() ) - USearchHelper::ShowHidePane(levelInfo->valueInt, op != opIsEmpty); - } -} - - -/*====================================================================================== - React to more message. -======================================================================================*/ - -void CSearchManager::MessageMoreFewer(Boolean inMore) { - - AssertFail_((mNumLevels > 0) && (mNumLevels <= cMaxNumSearchLevels)); - AssertFail_((mNumVisLevels > 0) && (mNumVisLevels <= mNumLevels)); - AssertFail_(!(inMore && (mNumVisLevels == mNumLevels)) || (!inMore && (mNumVisLevels == 1))); - - // Show/hide subviews - - SearchLevelInfoT *showHideLevel = &mLevelFields[inMore ? mNumVisLevels : (mNumVisLevels - 1)]; - - if ( !inMore ) { - if ( showHideLevel->valuePopup->IsLatentVisible() ) { - showHideLevel->lastVisibleValue = showHideLevel->valuePopup; - } else if ( showHideLevel->valueText->IsLatentVisible() ) { - showHideLevel->lastVisibleValue = showHideLevel->valueText; - } else if ( showHideLevel->valueInt->IsLatentVisible() ) { - showHideLevel->lastVisibleValue = showHideLevel->valueInt; - } else if ( showHideLevel->valueDate->IsLatentVisible() ) { - showHideLevel->lastVisibleValue = showHideLevel->valueDate; - } else { - showHideLevel->lastVisibleValue = nil; - } - } - USearchHelper::ShowHidePane(showHideLevel->attributesPopup, inMore); - USearchHelper::ShowHidePane(showHideLevel->operatorsPopup, inMore); - - if ( showHideLevel->lastVisibleValue != nil ) { - USearchHelper::ShowHidePane(showHideLevel->lastVisibleValue, inMore); - } - - // Resize the enclosing pane - - Int16 resizeAmount = inMore ? mLevelResizeV : -mLevelResizeV; - mParamEnclosure->ResizeFrameBy(0, resizeAmount, true); - - // Enable/disable more/fewer - - mNumVisLevels += (inMore ? 1 : -1); - USearchHelper::EnableDisablePane(mMatchAllRadio, (mNumVisLevels > 1)); - USearchHelper::EnableDisablePane(mMatchAnyRadio, (mNumVisLevels > 1)); - USearchHelper::EnableDisablePane(mMoreButton, (mNumVisLevels < mNumLevels)); - USearchHelper::EnableDisablePane(mFewerButton, (mNumVisLevels > 1)); - - BroadcastMessage(msg_SearchParametersResized, &resizeAmount); -} - - -/*====================================================================================== - React to clear message. inStartLevel and inEndLevel are 1 based. -======================================================================================*/ - -void CSearchManager::MessageClear(void) { - - ClearSearchParams(1, mNumLevels); - - BroadcastMessage(msg_SearchParametersCleared); -} - - -/*====================================================================================== - Clear the search params for the specified levels. -======================================================================================*/ - -void CSearchManager::ClearSearchParams(Int16 inStartLevel, Int16 inEndLevel) { - - AssertFail_(IsBetween(inStartLevel, 1, mNumLevels)); - AssertFail_(IsBetween(inEndLevel, 1, mNumLevels)); - AssertFail_(inStartLevel <= inEndLevel); - - SearchLevelInfoT *curLevel = mLevelFields + inStartLevel - 1; - SearchLevelInfoT *endLevel = mLevelFields + inEndLevel; - - do { - curLevel->attributesPopup->SetToDefault(); - curLevel->operatorsPopup->SetToDefault(); - curLevel->valueText->SetDescriptor("\p"); - curLevel->valueInt->SetDescriptor( CStr255("") ); - curLevel->valueDate->SetToToday(); - curLevel->valuePopup->SetToDefault(); - } while ( ++curLevel < endLevel ); -} - - - - -//----------------------------------- -void CSearchManager::AddScopesToSearch(MSG_Master *inMaster) -//----------------------------------- -{ - AssertFail_(mMsgPane != nil); - Boolean addedScope = false; - switch (mCurrentScope) - { - case cScopeMailFolderNewsgroup: - FailSearchError(MSG_AddAllScopes(mMsgPane, inMaster, scopeMailFolder)); - FailSearchError(MSG_AddAllScopes(mMsgPane, inMaster, scopeNewsgroup)); - addedScope = true; - break; - case scopeMailFolder: - case scopeNewsgroup: - FailSearchError(MSG_AddAllScopes(mMsgPane, inMaster, mCurrentScope)); - addedScope = true; - break; - case scopeLdapDirectory: - { - // In this case, mFolderScopeList contains only the single LDAP directory. - LArrayIterator iterator(*mFolderScopeList); - DIR_Server *dirServer; - while ( iterator.Next(&dirServer) ) - { - FailSearchError(MSG_AddLdapScope(mMsgPane, dirServer)); - addedScope = true; // in the loop, in case there are no servers! - } - break; - } - } - if ( !addedScope ) - { - // SOME scope must be specified! - if ( (mFolderScopeList == nil) || (mFolderScopeList->GetCount() < 1) || - ((mCurrentScope != cScopeMailSelectedItems) && (mCurrentScope != cScopeNewsSelectedItems)) ) - { - FailOSErr_(paramErr); - } - LArrayIterator iterator(*mFolderScopeList); - MSG_FolderInfo *msgFolderInfo; - while ( iterator.Next(&msgFolderInfo) ) - { - MSG_FolderLine folderLine; - if( MSG_GetFolderLineById(inMaster, - msgFolderInfo, - &folderLine)) - { - FailSearchError( - MSG_AddScopeTerm(mMsgPane, - (folderLine.flags & MSG_FOLDER_FLAG_MAIL) ? scopeMailFolder : scopeNewsgroup, - msgFolderInfo) ); - } - } - } -} // CSearchManager::AddScopesToSearch - -//----------------------------------- -void CSearchManager::AddParametersToSearch(void) -//----------------------------------- -{ - AssertFail_(mMsgPane != nil); - - // Get the search parameters - StSearchDataBlock searchParams(mNumVisLevels, StSearchDataBlock::eAllocateStrings); - GetSearchParameters(searchParams.GetData()); - - // Add parameters to the search - SearchLevelParamT *curLevel = searchParams.GetData(); - SearchLevelParamT *endLevel = curLevel + mNumVisLevels; - do { - char *customHeader = nil; - - // *** If the attribute is a custom header pass it in using the variable - // customHeader, otherwise pass a nil value. - if( curLevel->val.attribute == attribOtherHeader ) - customHeader = GetSelectedCustomHeader( curLevel ); - - FailSearchError(MSG_AddSearchTerm(mMsgPane, curLevel->val.attribute, curLevel->op, - &curLevel->val, mBoolOperator, customHeader )); - - } while ( ++curLevel < endLevel ); -} // CSearchManager::AddParametersToSearch - -//----------------------------------- -void CSearchManager::FailSearchError(MSG_SearchError inError) -// Raise a relevant exception if MSG_SearchError is not SearchError_Success. -//----------------------------------- -{ - if ( inError == SearchError_Success ) return; - - switch ( inError ) - { - case SearchError_OutOfMemory: - Throw_(memFullErr); - break; - - case SearchError_NotImplemented: - { -#ifdef Debug_Signal - CStr255 errorString; - USearchHelper::AssignUString( - USearchHelper::uStr_SearchFunctionNotImplemented, errorString); - ErrorManager::PlainAlert((StringPtr) errorString); -#endif // Debug_Signal - Throw_(unimpErr); - } - break; - - case SearchError_InvalidPane: // probably searching a server with no subscribed groups - CStr255 errorString; - USearchHelper::AssignUString(USearchHelper::uStr_SearchFunctionNothingToSearch, errorString); - ErrorManager::PlainAlert((StringPtr) errorString); - Throw_(userCanceledErr); - break; - - case SearchError_NullPointer: - case SearchError_ScopeAgreement: - case SearchError_ListTooSmall: - case SearchError_InvalidAttribute: - case SearchError_InvalidScope: - case SearchError_InvalidOperator: - case SearchError_InvalidSearchTerm: - case SearchError_InvalidScopeTerm: - case SearchError_InvalidResultElement: - case SearchError_InvalidStream: - case SearchError_InvalidFolder: { -#ifdef Debug_Signal - CStr255 errorString; - USearchHelper::AssignUString(USearchHelper::uStr_SearchFunctionParamError, errorString); - ErrorManager::PlainAlert((StringPtr) errorString); -#endif // Debug_Signal - Throw_(paramErr); - } - break; - - case SearchError_ResultSetEmpty: - Throw_(paramErr); - break; - - case SearchError_ResultSetTooBig: - Throw_(memFullErr); - break; - - default: - AssertFail_(false); - Throw_(32000); // Who knows? - break; - - } -} - - - - -#pragma mark - -#pragma mark CUSTOM HEADERS -#pragma mark ÊÊÊ -//////////////////////////////////////////////////////////////////////////////////////// -// -// Custom headers -// -// Code to support the "Custom Header" feature. -// -// 12/1/97 -// -//////////////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////////////// -// FinishCreateAttributeMenu( MSG_SearchMenuItem* inMenuItems, UInt16& inNumItems ) -// -// Finish creating the attributes menu. Add the item separator and the "EditÉ" item. - -void -CSearchManager::FinishCreateAttributeMenu( MSG_SearchMenuItem* inMenuItems, UInt16& inNumItems ) -{ - if( PREF_PrefIsLocked(kCustomHeaderPref) ) // check if the preference is locked - return; // if it is bail out. - - inMenuItems[inNumItems].attrib = 0; // add the seaparation item - inMenuItems[inNumItems].name[0] = '-'; - inMenuItems[inNumItems].name[1] = '\0'; - inMenuItems[inNumItems].isEnabled = false; // disabled - - CStr31 string; - ::GetIndString( string, eSTRINGS_RES_ID, eEditMenuItem ); // get Edit item from resource ( macfe.r) - - strcpy( inMenuItems[inNumItems + 1].name, string); // add the edit item - inMenuItems[inNumItems + 1].isEnabled = true; // enabled - inMenuItems[inNumItems + 1].attrib = eCustomizeSearchItem; - - inNumItems = inNumItems + 2; // increase the menu item total -} - -//////////////////////////////////////////////////////////////////////////////////////// -// GetNumberOfAttributes( MSG_ScopeAttribute& scope, void* scopeItem ) -// -// Get the current number of attributes from the BE - -UInt16 -CSearchManager::GetNumberOfAttributes( MSG_ScopeAttribute& scope, void* scopeItem ) -{ - UInt16 numberOfAttributes; - - FailSearchError(::MSG_GetNumAttributesForSearchScopes( - CMailNewsContext::GetMailMaster(), - scope, - &scopeItem, - 1, - &numberOfAttributes)); - - // check if the array is allocated - if( mAttributeItems == nil ) - mAttributeItems = new MSG_SearchMenuItem[numberOfAttributes + deltaAttributes]; - else - // check that is allocated and big enough - if( numberOfAttributes > mLastNumOfAttributes ) - { - delete mAttributeItems; - mAttributeItems = new MSG_SearchMenuItem[numberOfAttributes + deltaAttributes]; - } - - // return the number of attributes - return numberOfAttributes; -} - - -//////////////////////////////////////////////////////////////////////////////////////// -// EditCustomHeaders() -// -// Bring up the dialog for editing the custom headers - -void -CSearchManager::EditCustomHeaders() -{ - StDialogHandler customHeadersDlgHandler( resIDT_CustomHeadersDialog, nil ); - - LWindow* customHeadersDlg = customHeadersDlgHandler.GetDialog(); - AssertFail_( customHeadersDlg != nil ); - - // get the new, edit, delete buttons and table - LGAPushButton* newHeaderBtn = dynamic_cast( customHeadersDlg->FindPaneByID('chNW') ); - AssertFail_( newHeaderBtn != nil ); - - LGAPushButton* editHeaderBtn = dynamic_cast( customHeadersDlg->FindPaneByID('chED') ); - AssertFail_( editHeaderBtn != nil ); - - LGAPushButton* deleteHeaderBtn = dynamic_cast( customHeadersDlg->FindPaneByID('chDE') ); - AssertFail_( deleteHeaderBtn != nil ); - - CSingleTextColumn* customHeaderTbl = dynamic_cast( customHeadersDlg->FindPaneByID('chTL') ); - AssertFail_( customHeaderTbl != nil ); - - // get the custom headers - char *customHeaderBuffer = nil; - try - { - int error = ::PREF_CopyCharPref( kCustomHeaderPref, &customHeaderBuffer ); - } - catch( mail_exception& error ) - { - error.DisplaySimpleAlert(); - return; - } - - // fill up the table - STableCell cell(1, 1); - if ((customHeaderBuffer != nil) && (*customHeaderBuffer != '\0')) // make sure you got something to display - { - FillUpCustomHeaderTable( customHeaderBuffer, customHeaderTbl ); - customHeaderTbl->SelectCell( cell ); - } - - // free the custom header buffer - if (customHeaderBuffer) - XP_FREE(customHeaderBuffer); - - customHeaderTbl->AddListener( &customHeadersDlgHandler ); - customHeadersDlg->FocusDraw(); - - // loop while the dialog box is up - bool notDone = true; - MessageT theMessage; - - while( notDone ) - { - // pool the message - theMessage = customHeadersDlgHandler.DoDialog(); - switch( theMessage ) - { - case msg_OK: - const char *customHeadersBuffer = GetCustomHeadersFromTable( customHeaderTbl ); - ::PREF_SetCharPref( kCustomHeaderPref, customHeadersBuffer ); - ::PREF_SavePrefFile(); - delete customHeadersBuffer; // delete the buffer - notDone = false; - break; - - case msg_Cancel: - notDone = false; - break; - - case msg_NewHeader: - Str255 newHeader; - if( InputCustomHeader( newHeader, true) ) - { - customHeaderTbl->InsertRows(1, 0, newHeader, (newHeader[0] + 1), true ); - customHeaderTbl->SelectCell( STableCell(1, 1) ); - } - break; - - case msg_EditHeader: - case msg_SingleTextColumnDoubleClick: - cell.SetCell(0, 0); - Str255 chosenHeader; - Uint32 size = kMaxStringLength; - if( customHeaderTbl->GetNextSelectedCell( cell )) // get selected cell - { - customHeaderTbl->GetCellData( cell, chosenHeader, size ); - if( InputCustomHeader( chosenHeader, false ) ) - { - customHeaderTbl->RemoveRows(1L, cell.row, true ); - customHeaderTbl->InsertRows(1, 0, chosenHeader, (chosenHeader[0] + 1), true ); - customHeaderTbl->SelectCell( STableCell(1, 1) ); - if( !deleteHeaderBtn->IsEnabled() ) - { - deleteHeaderBtn->EnableSelf(); - editHeaderBtn->EnableSelf(); - } - } - } - break; - - case msg_DeleteHeader: - cell.SetCell(0, 0); - if( customHeaderTbl->GetNextSelectedCell( cell ) ) // get selected cell - { - customHeaderTbl->RemoveRows(1L, cell.row, true ); // remove it - STableCell firstCell(1, 1); - customHeaderTbl->SelectCell( firstCell ); - } - break; - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////// -// InputCustomHeader( const StringPtr ioHeader, bool new ) -// -// Edit or input new custom header - -bool -CSearchManager::InputCustomHeader( const StringPtr ioHeader, bool newHeader ) -{ - StDialogHandler inputHeadersDlgHandler( resIDT_CustomHeadersInputDialog, nil ); - - LWindow* inputHeadersDlg = inputHeadersDlgHandler.GetDialog(); - AssertFail_( inputHeadersDlg != nil ); - - CSearchEditField* inHeaderField = dynamic_cast( inputHeadersDlg->FindPaneByID('chIO') ); - AssertFail_( inHeaderField != nil ); - - // initialize edit field - - if( !newHeader ) - { - inHeaderField->SetDescriptor( ioHeader ); - inHeaderField->SelectAll(); - } - else - inHeaderField->SetDescriptor( CStr255("") ); - - LCommander::SwitchTarget(inHeaderField); - inHeaderField->Refresh(); - - // attach the custom header validation field - inHeaderField->SetKeyFilter( UMailFilters::CustomHeaderFilter ); - - MessageT theMessage; - bool changed = false; - bool notDone = true; - - while( notDone ) - { - // pool the message - theMessage = inputHeadersDlgHandler.DoDialog(); - switch( theMessage ) - { - case msg_OK: - inHeaderField->GetDescriptor( ioHeader ); - changed = true; - notDone = false; - break; - - case msg_Cancel: - notDone = false; - break; - } - } - return changed; -} - -//////////////////////////////////////////////////////////////////////////////////////// -// FillUpCustomHeaderTable( const char* buffer, const CSingleTextColumn* table ) -// -// Fill up the table in the dialog - -void -CSearchManager::FillUpCustomHeaderTable( const char* buffer, CSingleTextColumn* table ) -{ - int i; - int start = 0; - int stringLength; - char customHeaderStr[256]; - Uint32 bufferLength = strlen(buffer); - Uint32 customHeaderLength; - TableIndexT row = 0; - - // get the individual custom headers - for (i = 0; i <= bufferLength; i++) - { - if (buffer[i] == eCustomHeaderSeparator || buffer[i] == '\0') - { - // fill up a string - stringLength = MIN(i - start, sizeof(customHeaderStr) - 1); - strncpy(&customHeaderStr[0], &buffer[start], stringLength); - customHeaderStr[stringLength] = '\0'; - start = i + 1; - customHeaderLength = strlen(customHeaderStr) + 1; - // proper insertion - table->InsertRows(1, row++, c2pstr(customHeaderStr), customHeaderLength, false); - } - } - table->Refresh(); -} - -//////////////////////////////////////////////////////////////////////////////////////// -// GetCustomHeadersFromTable( CSingleTextColumn* table, char *buffer ) -// -// Return the data from the custom header table, properly formated for the preferences -// -// *** Be aware that you have to delete the returned pointer *** -// -const char* -CSearchManager::GetCustomHeadersFromTable( CSingleTextColumn* table ) -{ - STableCell cell; - Uint32 bufferSize; - Uint32 customHeaderLength; - - // get size of custom headers - bufferSize = 0; - cell.SetCell(0, 0); - while( table->GetNextCell( cell ) ) - { - customHeaderLength = 0; - table->GetCellData( cell, nil, customHeaderLength ); - bufferSize += customHeaderLength; // the header is a pascal string, the space taken by the extra - // byte at offset 0 will be used to store the string separators - } - - // allocate buffer for custom headers - char* buffer = nil; - char* marker = nil; - - if (bufferSize == 0) - bufferSize = 1; // need space for '\0' - buffer = new char[ bufferSize ]; - if( buffer == nil ) // if can't allocate throw exception - throw bufferSize; - marker = buffer; - - // separators - char separator = eCustomHeaderSeparator; - Str255 temp; - - cell.SetCell(0, 0); // reset the cell to beginning of the table - while( table->GetNextCell( cell ) ) - { - customHeaderLength = kMaxStringLength; - table->GetCellData( cell, temp, customHeaderLength ); // get the cell data - customHeaderLength = temp[0]; // find its length - memcpy( marker, &temp[1], customHeaderLength ); // copy it to the buffer - marker += customHeaderLength; // increase the data marker - *(marker ++) = eCustomHeaderSeparator; // add the headers separator - } - - // add the end of line character - if (marker > buffer) - marker --; // overwrite the last separator - *marker = '\0'; - - return buffer; -} - -//////////////////////////////////////////////////////////////////////////////////////// -// GetSelectedCustomHeader( const SearchLevelInfoT* curLevel ) const -// -// Returns the string corresponding to the particular custom header menu item - -char* -CSearchManager::GetSelectedCustomHeader( const SearchLevelParamT* curLevel ) const -{ - return mAttributeItems[curLevel->customHeaderPos - 1].name; -} diff --git a/mozilla/cmd/macfe/MailNews/CSearchManager.h b/mozilla/cmd/macfe/MailNews/CSearchManager.h deleted file mode 100644 index ef3a91042c7..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSearchManager.h +++ /dev/null @@ -1,342 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSearchManager.h - -#pragma once - -/*====================================================================================== - DESCRIPTION: Handles interaction with BE and management of search window. - All calls to the BE search engine bottleneak through this class. -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -// BE stuff - -#include "msg_srch.h" - -// Other files - -//"search.cpp" - -class CSearchPopupMenu; -class CSearchEditField; -class CSearchDateField; -class CSearchTabGroup; -class CStr255; - -class LGAPushButton; -class LGAPopup; -class LGARadioButton; -class CSingleTextColumn; - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - -// Information about a given search level -typedef struct { -// CListenerCaption *booleanOperator; no longer used: we have a global AND/OR now (the code was removed, it was not very clean anyway) - CSearchPopupMenu *attributesPopup; - CSearchPopupMenu *operatorsPopup; - CSearchPopupMenu *valuePopup; - CSearchEditField *valueText; - CSearchEditField *valueInt; - CSearchDateField *valueDate; - LPane *lastVisibleValue; -} SearchLevelInfoT; - -typedef struct { - char text[128]; -} SearchTextValueT; - -typedef struct { - MSG_SearchValue val; - MSG_SearchOperator op; - XP_Bool boolOp; // we have a global AND/OR now but we continue to use - // that flag for compatibility with existing rules - long customHeaderPos; -} SearchLevelParamT; - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class CSearchManager : public LListener, - public LBroadcaster { - -public: - CSearchManager(); - virtual ~CSearchManager(); - void AboutToClose(); - Boolean GetBooleanOperator() const; - - // IDs for panes in associated view, also messages that are broadcast to this object - - enum { - paneID_Attributes = 'ATTR' // CSearchPopupMenu *, attributes popup - , paneID_Operators = 'OPER' // CSearchPopupMenu *, operators popup - , paneID_TextValue = 'TXVL' // nil, text value - , paneID_IntValue = 'ioNT' // nil, integer value - , paneID_PopupValue = 'POVL' // nil, popup value - , paneID_DateValue = 'DTVL' // nil, date value - , paneID_More = 'MORE' // nil, more button - , paneID_Fewer = 'FEWR' // nil, fewer button - , paneID_Clear = 'CLER' // nil, clear button - , paneID_ParamEncl = 'PENC' // nil, parameter enclosure - , paneID_ParamSubEncl = 'SENC' // nil, subview parameter enclosure - , paneID_MatchAllRadio = 'MAND' // AND radio - , paneID_MatchAnyRadio = 'MOR ' // OR radio - }; - - // Messages that this object broadcasts - - enum { - msg_SearchParametersResized = paneID_ParamEncl // Int16 *, search parameters enclosure was resized - , msg_SearchParametersCleared = paneID_Clear // nil, search parameters were cleared - , msg_UserChangedSearchParameters = 'UCHG' // nil, search parameters were changed, broadcast - // on ANY change of the parameters by the user - , msg_AND_OR_Toggle = 'ANOR' - }; - - // Other constants - - enum { - cMaxNumSearchLevels = 5 - , cMaxNumSearchMenuItems = 20 - , cScopeMailFolderNewsgroup = 20 - , cScopeMailSelectedItems = 21 - , cScopeNewsSelectedItems = 22 - , cPriorityScope = 30 - , cStatusScope = 31 - }; - - // this constants are used for the search dialogs - enum { - eAND_STR = 1, // location of the AND string in macfe.r - eOR_STR = 2, // location of the OR string in macfe.r - eEditMenuItem = 3, // location of the Customize string in macfe.r - eSTRINGS_RES_ID = 901, // string resource number - eCustomizeSearchItem = -3 // command number for the customize menu item - }; - - OSErr InitSearchManager(LView *inContainer, CSearchTabGroup *inTabGroup, - MSG_ScopeAttribute inScope, LArray *inFolderScopeList = nil ); - - Boolean CanSearch() const; - void SetIsSearching( Boolean inValue ) { mIsSearching = inValue; } - Boolean IsSearching() const { - return mIsSearching; - } - MSG_Pane *GetMsgPane() const { - return mMsgPane; - } - Int16 GetNumVisibleLevels() const { - return mNumVisLevels; - } - Int16 GetNumDefaultLevels() const { - return 1; - } - Int16 GetNumLevels() const { - return mNumLevels; - } - Int32 GetNumResultRows() const { - return (mMsgPane == nil) ? 0 : MSG_GetNumLines(mMsgPane); - } - - void SetSearchScope(MSG_ScopeAttribute inScope, LArray *inFolderScopeList = nil); - void SetNumVisibleLevels(Int32 inNumLevels); - - - void StopSearch(MWContext *inContext = nil); - void StartSearch() - { - // Don't switch target when disabling - StValueChanger change(mCanRotateTarget, false); - mParamEnclosure->Disable(); - } - /* void SaveSearchResults(); Not implemented -- 10/30/97 */ - - void ReadSavedSearchStatus(LStream *inStatusData); - void WriteSavedSearchStatus(LStream *outStatusData); - - void GetSearchParameters(SearchLevelParamT *outSearchParams); - void SetSearchParameters(Int16 inNumVisLevels, const SearchLevelParamT *inSearchParams); - - // For accessing result data - - - -// MWContext *IsResultElementOpen(MSG_ViewIndex inIndex, MWContextType *outType); - - void PopulateAttributesMenus(MSG_ScopeAttribute inScope); - void PopulatePriorityMenu(CSearchPopupMenu *inMenu); - void PopulateStatusMenu(CSearchPopupMenu *inMenu); - static void FailSearchError(MSG_SearchError inError); - void SetWinCSID(int16 wincsid); - - //////////////////////////////////////////////////////////////////////////////////////// - // Custom headers - virtual char* GetSelectedCustomHeader( const SearchLevelParamT* curLevel ) const; - virtual UInt16 GetNumberOfAttributes( MSG_ScopeAttribute& scope, void* scopeItem ); - virtual const char* GetCustomHeadersFromTable( CSingleTextColumn* table ); - virtual const MSG_SearchMenuItem* GetSearchMenuItems() const { return mAttributeItems; } - virtual const UInt16& GetLastNumOfAttributes() const { return mLastNumOfAttributes; }; - - void AddScopesToSearch(MSG_Master *inMaster); - void AddParametersToSearch(); - void SetMSGPane( MSG_Pane* inPane) { mMsgPane = inPane ;} -protected: - - void MessageAttributes( SearchLevelInfoT& searchLevel ); - - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - - // Utility methods - - MSG_ScopeAttribute GetBEScope(MSG_ScopeAttribute inScope) const; - - void PopulateOperatorsMenus(MSG_ScopeAttribute inScope); - - enum ECheckDirection { eCheckForward = 1, eCheckBackward = 2, eCheckNothing = 3 }; - void SelectSearchLevel(Int16 inBeginLevel, ECheckDirection inCheckDirection); - Int32 GetSelectedSearchLevel(); - -// void MessageAttributes(CSearchPopupMenu *inAttributesMenu); - - void MessageOperators(CSearchPopupMenu *inOperatorsMenu); - void MessageSave(); - void MessageMoreFewer(Boolean inMore); - void MessageClear(); - - void ClearSearchParams(Int16 inStartLevel, Int16 inEndLevel); - - - - - //void UpdateMsgResult(MSG_ViewIndex inIndex); - - void UserChangedParameters() { - if ( mBroadcastUserChanges ) BroadcastMessage(msg_UserChangedSearchParameters); - } - - //////////////////////////////////////////////////////////////////////////////////////// - // Custom headers - virtual void EditCustomHeaders(); - virtual void FillUpCustomHeaderTable( const char buffer[], CSingleTextColumn* table ); - virtual void FinishCreateAttributeMenu( MSG_SearchMenuItem* inMenuItems, UInt16& inNumItems ); - virtual bool InputCustomHeader( const StringPtr ioHeader, bool newHeader ); - - - enum { - eCustomHeaderSeparator = ' ' - }; - - // Instance variables - - Int32 mNumLevels; // Number of possible search levels - Int32 mNumVisLevels; // Number of currently visible search levels - Int32 mLevelResizeV; // Visible margin between levels - - SearchLevelInfoT mLevelFields[cMaxNumSearchLevels]; - - LGAPushButton *mMoreButton; - LGAPushButton *mFewerButton; - LGARadioButton *mMatchAllRadio; - LGARadioButton *mMatchAnyRadio; - LView *mParamEnclosure; - - Boolean mCanRotateTarget; - Boolean mIsSearching; - - // BE related - - MSG_SearchMenuItem mSearchMenuItems[cMaxNumSearchMenuItems]; - - // *** Attributes menu support - MSG_SearchMenuItem *mAttributeItems; // menu items array for attributes - UInt16 mLastNumOfAttributes; // last number of attributes - - MSG_ScopeAttribute mLastMenuItemsScope; - MSG_SearchAttribute mLastMenuItemsAttribute; - UInt16 mNumLastMenuItems; - - MSG_ScopeAttribute mCurrentScope; - LArray *mFolderScopeList; // List of MSG_FolderInfo * for current scope - - MSG_Pane *mMsgPane; // Search message pane during an actual search - - - - Boolean mBroadcastUserChanges; - - Boolean mBoolOperator; -}; - - -// StSearchDataBlock - -class StSearchDataBlock { - -public: - - enum { eAllocateStrings = true, eDontAllocateStrings = false }; - - StSearchDataBlock() : - mData(nil) { - } - StSearchDataBlock(Int16 inNumSearchLevels, Boolean inAllocateStrings = true) : - mData(nil) { - Allocate(inNumSearchLevels, inAllocateStrings); - } - ~StSearchDataBlock() { - Dispose(); - } - - void Allocate(Int16 inNumSearchLevels, Boolean inAllocateStrings = true) { - Int32 size = inAllocateStrings ? ((sizeof(SearchLevelParamT) + sizeof(SearchTextValueT)) * inNumSearchLevels) : - (sizeof(SearchLevelParamT) * inNumSearchLevels); - - delete mData; - - mData = (SearchLevelParamT *) new char[size]; - FailNIL_(mData); - SearchLevelParamT *data = mData; - SearchTextValueT *text = (SearchTextValueT *) &data[inNumSearchLevels]; - for (Int16 i = 0; i < inNumSearchLevels; ++i) data[i].val.u.string = inAllocateStrings ? text[i].text : nil; - } - void Dispose() { - delete mData; - mData = nil; - - } - SearchLevelParamT *GetData() { - return mData; - } -private: - - SearchLevelParamT *mData; -}; diff --git a/mozilla/cmd/macfe/MailNews/CSearchTableView.cp b/mozilla/cmd/macfe/MailNews/CSearchTableView.cp deleted file mode 100644 index dfddfdbb4cc..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSearchTableView.cp +++ /dev/null @@ -1,809 +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. - */ - - - -#define DEBUGGER_ASSERTIONS -#include "CSearchTableView.h" - -#include "CApplicationEventAttachment.h" -#include "CSearchWindowBase.h" -#include "CMessageSearchWindow.h" -#include "LFlexTableGeometry.h" -#include "CTableKeyAttachment.h" -#include "CThreadWindow.h" -#include "CThreadView.h" -#include "CMessageWindow.h" -#include "CMessageView.h" -#include "UMessageLibrary.h" -#include "UMailSelection.h" -#include "UMailFolderMenus.h" -#include "UGraphicGizmos.h" - -#include "UException.h" -#include "UIHelper.h" -#include "CBrowserContext.h" -#include "LSharable.h" -#include "CComposeAddressTableView.h" -#include "libi18n.h" -#include "LCommander.h" - -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" - -#include "ntypes.h" - -//----------------------------------- -CSearchTableView::~CSearchTableView() -//----------------------------------- -{ - SetMessagePane( NULL ); -} - -void CSearchTableView::SetSearchManager(CSearchManager *inSearchManager) -{ - mSearchManager = inSearchManager; - SetMessagePane( inSearchManager->GetMsgPane() ); -} - -//----------------------------------- -void CSearchTableView::DrawCellContents( const STableCell& inCell, const Rect& inLocalRect) - -//----------------------------------- -{ - // Get the text to display - CStr255 displayText; - MSG_SearchAttribute inAttribute = CSearchWindowBase::AttributeFromDataType(GetCellDataType(inCell)); - - if ( !GetDisplayText(inCell.row - 1, inAttribute, displayText) ) - return; // Error occurred getting the text - - // Display the text - - Boolean cellIsSelected = CellIsSelected(inCell); - - Rect cellDrawFrame = inLocalRect; - ::InsetRect(&cellDrawFrame, 2, 0); // For a nicer look between cells - - StSectClipRgnState saveSetClip(&cellDrawFrame); - - displayText = NET_UnEscape(displayText); - if ( cellIsSelected ) - { - - UGraphicGizmos::PlaceTextInRect((char *) &displayText[1], displayText[0], cellDrawFrame, teFlushLeft, teCenter, - &mTextFontInfo, true, truncMiddle); - // PlaceHilitedTextInRect((char *) &displayText[1], displayText[0], cellDrawFrame, teFlushLeft, teCenter, - // &mTextFontInfo, true, truncMiddle); - } - else - UGraphicGizmos::PlaceTextInRect((char *) &displayText[1], displayText[0], cellDrawFrame, teFlushLeft, teCenter, - &mTextFontInfo, true, truncMiddle); -} - - - -/*====================================================================================== - Set up helpers for the table. -======================================================================================*/ - -//----------------------------------- -void CSearchTableView::SetUpTableHelpers() -//----------------------------------- -{ - SetTableGeometry( new LFlexTableGeometry(this, mTableHeader) ); - SetTableSelector( new LTableRowSelector(this) ); - - // standard keyboard navigation. - AddAttachment( new CTableKeyAttachment(this) ); - -} - -//----------------------------------- -void CSearchTableView::ListenToMessage( - MessageT inCommand, - void *ioParam) -//----------------------------------- -{ - if (!ObeyCommand((CommandT)inCommand, ioParam)) - CMailFlexTable::ListenToMessage(inCommand, ioParam); -} - -//----------------------------------- -Boolean -CSearchTableView::ObeyCommand( CommandT inCommand, void* ioParam ) -//----------------------------------- -{ - Boolean commandObeyed = false; - - switch( inCommand ) - { - case msg_TabSelect: - break; - - default: - commandObeyed = Inherited::ObeyCommand( inCommand, ioParam ); - break; - } - - return commandObeyed; -} - -//----------------------------------- -// Delete selected messages either via menu command or -// key. -// -//----------------------------------- -void CSearchTableView::DeleteSelection() -//----------------------------------- -{ - // see if you got a selection - CMailSelection selection; - if ( GetSelection( selection ) ) - { - const MSG_ViewIndex *indices = selection.GetSelectionList(); - MSG_ViewIndex numIndices = selection.selectionSize; - MSG_Pane* searchPane = GetMessagePane(); - - // try closing all the open message windows - MSG_ResultElement* outElement; - MSG_FolderInfo* outFolder; - MessageKey outKey; - - const MSG_ViewIndex *indexCounter = indices; - for ( int i = 0; i < numIndices; i++, indexCounter++ ) - { - if( GetMessageResultInfo( *indexCounter, outElement, outFolder, outKey ) ) - CMessageWindow::CloseAll( outKey ); - } - - // Get correct BE message. It can either be for mail or news messages, but not for both - CMessageFolder messageFolder( outFolder ); - UInt32 folderFlags = messageFolder.GetFolderFlags(); - MSG_CommandType cmd = MSG_CancelMessage; // news posting - cancel command - - if ( (folderFlags & MSG_FOLDER_FLAG_NEWSGROUP) == 0 ) - cmd = UMessageLibrary::GetMSGCommand( cmd_Clear ); // mail message - delete command - - // send command to the BE. Copy the index list, because it gets clobbered by - // RemoveRows(). - MSG_ViewIndex* copyOfIndices = new MSG_ViewIndex[numIndices]; - const MSG_ViewIndex* src = &indices[0]; - MSG_ViewIndex* dst = ©OfIndices[0]; - for (int i = 0; i < numIndices; i++, src++, dst++) - *dst = *src; - - // BE delete command - MSG_Command( searchPane, cmd, copyOfIndices, numIndices ); - - // delete the list - delete [] copyOfIndices; - - SelectionChanged(); - } -} - -//----------------------------------- -void CSearchTableView::OpenRow(TableIndexT inRow) -//----------------------------------- -{ - MSG_ViewIndex index = inRow - 1; - ShowMessage(index, kInMessageWindow); -} - -//----------------------------------- -void CSearchTableView::FindOrCreateThreadWindowForMessage(MSG_ViewIndex inMsgIndex) -//----------------------------------- -{ - AssertFail_(mSearchManager != nil); - Try_ - { - MSG_ResultElement *elem = NULL; - MSG_GetResultElement(GetMessagePane(), inMsgIndex, &elem); - if (!elem) - return; - - MWContextType cxType = MSG_GetResultElementType(elem); - if (! (cxType == MWContextMail || cxType == MWContextMailMsg - || cxType == MWContextNews || cxType == MWContextNewsMsg)) - return; - - // Get info about the message - MSG_SearchValue *value; - MSG_GetResultAttribute(elem, attribFolderInfo, &value); - MSG_FolderInfo *folderInfo = value->u.folder; - if (!folderInfo) - return; - - // Create the thread window if it doesn't exist - CThreadWindow *threadWindow = CThreadWindow::FindOrCreate( folderInfo, CThreadView::cmd_UnselectAllCells); - } - Catch_(inErr) - { - Throw_(inErr); - } - EndCatch_ -} // CSearchTableView::FindOrCreateThreadWindowForMessage - - -//----------------------------------- -void CSearchTableView::FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) -//----------------------------------- -{ - ResIDT menuID; - Int16 menuItem; - - // Check for synthetic commands - if( IsSyntheticCommand( inCommand, menuID, menuItem ) ) - { - switch( menuID ) - { - case menu_Navigator: // enable menus - outEnabled = true; - break; - - case menu_Go: // disable menus - case menu_View: - outEnabled = false; - break; - } - } - else // check for regular commands - { - switch (inCommand) - { - case cmd_AboutPlugins: // always enabled - case cmd_About: - case cmd_Quit: - case cmd_Close: - case cmd_Preferences: - outEnabled = true; - break; - - case cmd_SelectAll: // need at least one result - if( IsValidRow( 1 ) ) - outEnabled = true; - else - outEnabled = false; - break; - - - case cmd_Clear: // need at least one result and one selection - // Only support deleting of Mail Messages not news. - CMailSelection selection; - if ( GetSelection( selection ) ) - { - const MSG_ViewIndex *indices = selection.GetSelectionList(); - - - MSG_ResultElement* outElement; - MSG_FolderInfo* outFolder; - MessageKey outKey; - - GetMessageResultInfo( *indices, outElement, outFolder, outKey ); - - - CMessageFolder messageFolder( outFolder ); - UInt32 folderFlags = messageFolder.GetFolderFlags(); - - if ( (folderFlags & MSG_FOLDER_FLAG_NEWSGROUP) == 0 ) - outEnabled = true; // mail message - delete command - } - break; - - default: - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } - } -} - -//----------------------------------- -Boolean CSearchTableView::GetMessageResultInfo( - MSG_ViewIndex inMsgIndex, - MSG_ResultElement*& outElement, - MSG_FolderInfo*& outFolder, - MessageKey& outKey) -//----------------------------------- -{ - return GetMessageResultInfo( - GetMessagePane(), inMsgIndex, outElement, outFolder, outKey); -} // SearchTableView::GetMessageResultInfo - -//----------------------------------- -Boolean CSearchTableView::GetMessageResultInfo( - MSG_Pane* inPane, - MSG_ViewIndex inMsgIndex, - MSG_ResultElement*& outElement, - MSG_FolderInfo*& outFolder, - MessageKey& outKey) -//----------------------------------- -{ - MSG_SearchError err; - err = ::MSG_GetResultElement(inPane, inMsgIndex, &outElement); - if (err != SearchError_Success || outElement == nil) - return false; - - MWContextType cxType = ::MSG_GetResultElementType(outElement); - if (! (cxType == MWContextMail || cxType == MWContextMailMsg - || cxType == MWContextNews || cxType == MWContextNewsMsg)) - return false; - - // Get info about the message - MSG_SearchValue *value; - err = ::MSG_GetResultAttribute(outElement, attribMessageKey, &value); - if (err != SearchError_Success || value == nil) - return false; - - outKey = value->u.key; - if (outKey == MSG_MESSAGEKEYNONE) - return false; - - // Get info about the folder the message is in - err = ::MSG_GetResultAttribute(outElement, attribFolderInfo, &value); - if (err == SearchError_Success && value != nil) - outFolder = value->u.folder; - return true; -} // SearchTableView::GetMessageResultInfo - -//----------------------------------- -void CSearchTableView::AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef) -// Base class implementation is for a message search. Return the URL. -//----------------------------------- -{ - - MSG_ResultElement *elem = NULL; - MSG_FolderInfo *folderInfo = nil; - MessageKey key; - - // get key and folder info - if (!GetMessageResultInfo(inRow - 1, elem, folderInfo, key)) - return; - - if (folderInfo == nil) - return; - -// MSG_Pane* pane = ::MSG_FindPaneOfType( -// CMailNewsContext::GetMailMaster(), folderInfo, MSG_THREADPANE); - - MSG_Pane* pane = GetMessagePane(); // get search pane from the search manager - - if (!pane) // fails unless there is a threadpane open to this folder. Too bad. - return; // That's why I turned off dragging. - - - // create URL - URL_Struct* url = ::MSG_ConstructUrlForMessage( pane, key ); - if (!url) - return; // we always return here, as far as I can see - - // add the drag item - OSErr err = ::AddDragItemFlavor( inDragRef, inRow, 'TEXT', url->address, XP_STRLEN(url->address), flavorSenderOnly); - - NET_FreeURLStruct(url); -} - -//----------------------------------- -void CSearchTableView::ShowMessage(MSG_ViewIndex inMsgIndex, SearchWindowOpener inWindow) -//----------------------------------- -{ - AssertFail_(mSearchManager != nil); - Try_ - { - MSG_ResultElement *elem = NULL; - MSG_FolderInfo *folderInfo = nil; - MessageKey key; - if (!GetMessageResultInfo(inMsgIndex, elem, folderInfo, key)) - return; - if (folderInfo == nil && inWindow != kInMessageWindow) - return; - - // Got the info we wanted: we can display now... - if (inWindow == kInMessageWindow) - { - // Check if there's an open window with this message. - CMessageWindow *messageWindow = CMessageWindow::FindAndShow(key); - if (messageWindow) - { - messageWindow->Select(); - return; - } - - // If option key down, try to reuse a window - if ( CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) ) - { - messageWindow = CMessageWindow::FindAndShow(0); - messageWindow->Select(); - } - - // Create the window - if (messageWindow == nil) - { - // We should probably create a generic utility function to generate - // windows that contain a CHTMLView - CBrowserContext *theContext = new CBrowserContext(MWContextMailMsg); - FailNIL_(theContext); - StSharer theShareLock(theContext); - - // Create a message window with this view as its super commander. - LWindow *theWindow = LWindow::CreateWindow(cMessageWindowPPobID, LCommander::GetTopCommander()); - FailNIL_(theWindow); - messageWindow = dynamic_cast(theWindow); - FailNIL_(messageWindow); - - messageWindow->SetWindowContext(theContext); - } - - // Show the message - messageWindow->GetMessageView()->ShowSearchMessage( - CMailNewsContext::GetMailMaster(), - elem, - folderInfo == nil); - } - else - { - CommandT command; - switch (inWindow) - { - case kInThreadWindow: command = CThreadView::cmd_UnselectAllCells; break; - case kAddToThreadWindowSelection: command = cmd_Nothing; break; - default: return; - } - - // Check if there's an open window with this folder, and open one if needed - CThreadWindow *threadWindow = CThreadWindow::FindAndShow(folderInfo, true, command); - if (threadWindow) - { - // Show the message - threadWindow->ShowMessageKey(key); - } - } - } - Catch_(inErr) - { - Throw_(inErr); - } - EndCatch_ -} // CSearchTableView::ShowMessage - - -//----------------------------------- -Boolean CSearchTableView::IsValidRow(TableIndexT inRow) const -// *** WARNING *** -// USING mRows is WRONG WHEN DELETING ROWS, it's possibly changed already! -// Use the Table Selector's value instead. That's why this override is here! -//----------------------------------- -{ - if (inRow < 1) - return false; - if (inRow > mRows ) /* ((LTableRowSelector*)mTableSelector)->GetRowCount()) */ - return false; - return true; -} - - -//----------------------------------- -MessageKey CSearchTableView::GetRowMessageKey(TableIndexT inRow) -// Get the message key for the specified row. Return MSG_MESSAGEKEYNONE if the -// specified inRow is invalid. -//----------------------------------- -{ - AssertFail_(mSearchManager != nil); - if ( !IsValidRow(inRow) ) return MSG_MESSAGEKEYNONE; - MSG_ViewIndex inIndex = inRow - 1; - - UpdateMsgResult(inIndex); - - MSG_SearchValue *value = nil; - - MSG_SearchAttribute attribute = attribMessageKey; - - CSearchManager::FailSearchError(MSG_GetResultAttribute(mResultElement, attribute, &value)); - MessageKey key = value->u.key; - - MSG_SearchError error = MSG_DestroySearchValue(value); - AssertFail_(error == SearchError_Success); // What to do with an error? - - return key; -} - -//----------------------------------- -MSG_ResultElement* CSearchTableView::GetCurrentResultElement(TableIndexT inRow) -//----------------------------------- -{ - AssertFail_(mSearchManager != nil); - if ( !IsValidRow(inRow) ) return nil; - MSG_ResultElement *result; - CSearchManager::FailSearchError(MSG_GetResultElement(GetMessagePane(), inRow-1, &result)); - return result; -} - - -/*====================================================================================== - Get the current sort params for the result data. -======================================================================================*/ - -void CSearchTableView::GetSortParams(MSG_SearchAttribute *outSortKey, Boolean *outSortBackwards) -{ - AssertFail_(mTableHeader != nil); - AssertFail_(mSearchManager != nil); - PaneIDT sortColumnID; - mTableHeader->GetSortedColumn(sortColumnID); - *outSortKey = CSearchWindowBase::AttributeFromDataType(sortColumnID); - AssertFail_(*outSortKey != kNumAttributes); - *outSortBackwards = mTableHeader->IsSortedBackwards(); -} - - -/*====================================================================================== - Force a sort to occur based upon the current sort column. -======================================================================================*/ - -void CSearchTableView::ForceCurrentSort() -{ - MSG_SearchAttribute sortKey; - Boolean sortBackwards; - - GetSortParams(&sortKey, &sortBackwards); - - CSearchManager::FailSearchError(MSG_SortResultList(GetMessagePane(), sortKey, sortBackwards)); -} - -//----------------------------------- -void CSearchTableView::ChangeSort(const LTableHeader::SortChange *inSortChange) -// Notification to sort the table. -//----------------------------------- -{ - AssertFail_(mSearchManager != nil); - - Inherited::ChangeSort(inSortChange); - - MSG_SearchAttribute sortKey = CSearchWindowBase::AttributeFromDataType(inSortChange->sortColumnID); - - if ( sortKey != kNumAttributes ) { - - ::SetCursor(*::GetCursor(watchCursor)); - // Call BE to sort the table - AssertFail_(GetMessagePane() != nil); - CSearchManager::FailSearchError(MSG_SortResultList(GetMessagePane(), sortKey, inSortChange->reverseSort)); - } -} - -//----------------------------------- -void CSearchTableView::SetWinCSID(Int16 wincsid) -// Set the font for the view -//----------------------------------- -{ - if (wincsid == INTL_CharSetNameToID(INTL_ResourceCharSet())) - this->SetTextTraits( 8603 ); - else - this->SetTextTraits(CPrefs::GetTextFieldTextResIDs(wincsid)); - Refresh(); -} - -//----------------------------------- -//void CSearchTableView::AddSelectionToDrag( -// DragReference inDragRef, -// RgnHandle inDragRgn ) -//----------------------------------- -//{ - // Since we inherit from CMailFlexTable, we want to avoid it and just call the - // CStandardFlexTable method, thereby avoiding the CMailFlexTable behavior - -// CStandardFlexTable::AddSelectionToDrag(inDragRef, inDragRgn); - -//} // CAddressSearchTableView::AddSelectionToDrag - - -//----------------------------------- -void CSearchTableView::SelectionChanged() -// adjust the 'Move Message To' popup accordingly to the current selection -//----------------------------------- -{ - Inherited::SelectionChanged(); - - // Set the 'Move Message' popup to the folder of the first selected item - CMailSelection selection; - if (GetSelection(selection)) - { - CMessageSearchWindow* myWindow = dynamic_cast - (LWindow::FetchWindowObject(GetMacPort())); - if (myWindow) - { - CMailFolderPopupMixin* fileMessagePopup; - FindUIItemPtr(myWindow, CMessageSearchWindow::paneID_FilePopup, fileMessagePopup); - - const MSG_ViewIndex *indices = selection.GetSelectionList(); - MSG_ViewIndex numIndices = selection.selectionSize; - MSG_ResultElement* outElement; - MSG_FolderInfo* outFolder; - MessageKey outKey; - - if (GetMessageResultInfo(*indices, outElement, outFolder, outKey)) - fileMessagePopup->MSetSelectedFolder(outFolder, false); - } - } -} -// - -/*====================================================================================== - Get the display text for the specified attribute and table row index. Return - true if the text could be gotten. -======================================================================================*/ - -Boolean CSearchTableView::GetDisplayText(MSG_ViewIndex inIndex, MSG_SearchAttribute inAttribute, - CStr255& outString) -{ - AssertFail_(GetMessagePane() != nil); - UpdateMsgResult(inIndex); - - MSG_SearchValue *value = nil; - - MSG_SearchError error = MSG_GetResultAttribute(mResultElement, inAttribute, &value); - //Assert_(error == SearchError_Success); - if ( error != SearchError_Success ) return false; - - Int16 wincsid = 0; - MSG_SearchValue *folderinfoValue = nil; - error = MSG_GetResultAttribute(mResultElement, attribFolderInfo, &folderinfoValue); - if( ( error == SearchError_Success ) && folderinfoValue && folderinfoValue->u.folder) - { - folderinfoValue->attribute = attribFolderInfo; - wincsid = INTL_DocToWinCharSetID(MSG_GetFolderCSID(folderinfoValue->u.folder)); - error = MSG_DestroySearchValue(folderinfoValue); - Assert_(error == SearchError_Success); - } - - switch ( inAttribute ) { - - case attribSender: - case attribSubject: - outString = ""; - char *buf = IntlDecodeMimePartIIStr(value->u.string, - wincsid, - FALSE); - if (buf) { - outString = buf; - XP_FREE(buf); - break; - } - outString = value->u.string; - break; - - case attribLocation: - case attribCommonName: - case attrib822Address: - case attribOrganization: - case attribLocality: - case attribPhoneNumber: - outString = value->u.string; - break; - - case attribDate: - outString = MSG_FormatDate(GetMessagePane(), value->u.date); - break; - - case attribMsgStatus: - case attribPriority: - { - char name[32]; - if ( inAttribute == attribMsgStatus ) { - MSG_GetStatusName(value->u.msgStatus, name, sizeof(name)); - } else { - MSG_GetPriorityName(value->u.priority, name, sizeof(name)); - } - outString = name; - } - break; - - default: - AssertFail_(false); - break; - } - - error = MSG_DestroySearchValue(value); - Assert_(error == SearchError_Success); - - return true; -} - -/*====================================================================================== - Call this method whenever the indexes in the message pane change. -======================================================================================*/ - -void CSearchTableView::UpdateMsgResult(MSG_ViewIndex inIndex) { - - AssertFail_(GetMessagePane() != nil); - - if ( (mResultElement == nil) || (mResultIndex != inIndex) ) { - - mResultElement = nil; - - CSearchManager::FailSearchError(MSG_GetResultElement(GetMessagePane(), inIndex, &mResultElement)); - - mResultIndex = inIndex; - } -} - -/*====================================================================================== - React to search message. -======================================================================================*/ - -void CSearchTableView::StartSearch(MWContext *inContext, MSG_Master *inMaster, MSG_SearchAttribute inSortKey, - Boolean inSortBackwards) { - - if ( !mSearchManager->CanSearch() || mSearchManager->IsSearching() ) return; - - MsgPaneChanged(); // For results - - // Prepare for a new search session - NewSearchSession(inContext, inMaster, inSortKey, inSortBackwards); - mSearchManager->SetMSGPane( GetMessagePane() ); - // Add scopes to search - mSearchManager->AddScopesToSearch(inMaster); - - // Add search parameters - mSearchManager->AddParametersToSearch(); - - CSearchManager::FailSearchError(MSG_Search(GetMessagePane())); - - mSearchManager->StartSearch(); - - mSearchManager->SetIsSearching( true ); -} - -/*====================================================================================== - Prepare for a new search session. -======================================================================================*/ - -void CSearchTableView::NewSearchSession(MWContext *inContext, MSG_Master *inMaster, MSG_SearchAttribute inSortKey, - Boolean inSortBackwards) -{ - AssertFail_(inContext != nil); - AssertFail_(inMaster != nil); - - if ( GetMessagePane() == nil ) - { - // Create the search pane and store related date - MSG_Pane* msgPane = MSG_CreateSearchPane(inContext, inMaster); - FailNIL_(msgPane); - SetMessagePane( msgPane ); - MSG_SetFEData( GetMessagePane(), CMailCallbackManager::Get() ); - - } else - { - // Free any previously allocated search memory - CSearchManager::FailSearchError(MSG_SearchFree(GetMessagePane())); - } - - // Alloc mem for new search parameters - CSearchManager::FailSearchError(MSG_SearchAlloc(GetMessagePane())); - - // Setup the sort order - CSearchManager::FailSearchError( - MSG_SortResultList(GetMessagePane(), inSortKey, inSortBackwards) ); - -} - -void CSearchTableView::ChangeFinished(MSG_Pane * inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount) -{ - MsgPaneChanged(); - CMailFlexTable::ChangeFinished( inPane, inChangeCode, inStartRow, inRowCount ); -} diff --git a/mozilla/cmd/macfe/MailNews/CSearchTableView.h b/mozilla/cmd/macfe/MailNews/CSearchTableView.h deleted file mode 100644 index 8f5f1ff5b43..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSearchTableView.h +++ /dev/null @@ -1,141 +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. - */ - - - -// CSearchTableView.h - -#pragma once - -#include "SearchHelpers.h" -#include "CSearchManager.h" -#include "CDateView.h" -#include "NetscapeDragFlavors.h" - -/////////////////////////////////////////////////////////////////////////////////// -// CSearchTableView -class CSearchTableView : public CMailFlexTable -{ -private: - typedef CMailFlexTable Inherited; - -public: - enum { class_ID = 'SrTb' }; - enum { - menu_Navigator = 305, - menu_View = 502, - menu_Go = 503 - }; - typedef enum { - kInMessageWindow, - kInThreadWindow, - kAddToThreadWindowSelection - } SearchWindowOpener; - - CSearchTableView(LStream *inStream); - virtual ~CSearchTableView(); - - void SetSearchManager(CSearchManager *inSearchManager); - - - void ForceCurrentSort(); - void GetSortParams(MSG_SearchAttribute *outSortKey, Boolean *outSortBackwards); - - virtual void ChangeSort(const LTableHeader::SortChange *inSortChange); - virtual void OpenRow(TableIndexT inRow); - - - virtual void ShowMessage(MSG_ViewIndex inMsgIndex, SearchWindowOpener inWindow); - virtual void FindOrCreateThreadWindowForMessage(MSG_ViewIndex inMsgIndex); - virtual void FindCommandStatus( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName); - - MessageKey GetRowMessageKey(TableIndexT inRow); - MSG_ResultElement* GetCurrentResultElement(TableIndexT inRow); - virtual void SetWinCSID(Int16 wincsid); - - virtual void ListenToMessage( MessageT inCommand, void *ioParam); - virtual Boolean ObeyCommand( CommandT inCommand, void* ioParam ); - void StartSearch(MWContext *inContext, MSG_Master *inMaster, - MSG_SearchAttribute inSortKey, Boolean inSortBackwards); - static Boolean GetMessageResultInfo( - MSG_Pane* inPane, - MSG_ViewIndex inMsgIndex, MSG_ResultElement*& outElement, - MSG_FolderInfo*& outFolder, MessageKey& outKey); -protected: - Boolean GetDisplayText(MSG_ViewIndex inIndex, MSG_SearchAttribute inAttribute, - CStr255& outString); - void UpdateMsgResult(MSG_ViewIndex inIndex); - void NewSearchSession(MWContext *inContext, MSG_Master *inMaster, MSG_SearchAttribute inSortKey, - Boolean inSortBackwards); - - - - virtual Boolean IsValidRow(TableIndexT inRow) const; - virtual void SetUpTableHelpers(); - virtual void DeleteSelection(); - virtual void DrawCellContents(const STableCell &inCell, const Rect &inLocalRect); - - virtual void MsgPaneChanged(); - virtual Int32 GetBENumRows(); - Boolean GetMessageResultInfo( MSG_ViewIndex inMsgIndex, MSG_ResultElement*& outElement, - MSG_FolderInfo*& outFolder, MessageKey& outKey); - -// drag support - virtual Boolean CellInitiatesDrag(const STableCell&) const { return true; } - // uncomment the line above to turn on drag from the message search - // results window. Problem is, URL not obtainable for message search - // unless the enclosing folder is open in a thread window. SO it's - // turned off for now. -// virtual void AddSelectionToDrag( DragReference inDragRef, RgnHandle inDragRgn ); - virtual void AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef); - virtual void SelectionChanged(); - virtual void ChangeFinished(MSG_Pane */*inPane*/, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount); - // Instance variables ========================================================== - enum { eInvalidResultIndex = -1 }; - - CSearchManager *mSearchManager; // Belongs to the window, not us. - MSG_ResultElement *mResultElement; - MSG_ViewIndex mResultIndex; -}; - -/////////////////////////////////////////////////////////////////////////////////// -// inlines - -inline -CSearchTableView::CSearchTableView(LStream *inStream) -: CMailFlexTable(inStream), mSearchManager(nil), mResultElement( nil ), mResultIndex (eInvalidResultIndex ) -{ - mDragFlavor = kMailNewsSelectionDragFlavor; - SetRefreshAllWhenResized(false); -} - - -inline void -CSearchTableView::MsgPaneChanged() -{ - mResultElement = nil; -} - -inline Int32 -CSearchTableView::GetBENumRows() -{ - return (GetMessagePane() == nil) ? 0 : MSG_GetNumLines(GetMessagePane()); -} - diff --git a/mozilla/cmd/macfe/MailNews/CSearchWindowBase.cp b/mozilla/cmd/macfe/MailNews/CSearchWindowBase.cp deleted file mode 100644 index 259ba1956f6..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSearchWindowBase.cp +++ /dev/null @@ -1,931 +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. - */ - - - -// CSearchWindowBase.cp - -#define DEBUGGER_ASSERTIONS - -#include "CSearchWindowBase.h" -#include "SearchHelpers.h" -#include "CMailNewsContext.h" -#include "CSearchTableView.h" -#include "libi18n.h" -#include "LGAPushButton.h" -#include "CPatternProgressBar.h" -#include "MailNewsgroupWindow_Defines.h" -#include "resgui.h" -#include -#include "prefapi.h" -#include "LGARadioButton.h" -#include "UStClasses.h" -#include "CThreadWindow.h" -#include "CMessageWindow.h" -#include "CProgressListener.h" - -const UInt16 resIDT_SearchOptionsDialog = 8851; -const char* const searchSubfolderPrefName = "mailnews.searchSubFolders"; -const char* const searchServerPrefName = "mailnews.searchServer"; - -//----------------------------------- -CSearchWindowBase::CSearchWindowBase(LStream *inStream, DataIDT inWindowType) : - CMailNewsWindow(inStream, inWindowType), - LListener(), - LPeriodical(), - mSearchManager(), - mResultsEnclosure(nil), - mResultsTable(nil), - mResultsVertWindExtension(0), - mResultsTableVisible(true), - mSearchFolders(), - mProgressBar(nil), - mSearchButton(nil), - mSearchOptionsButton(nil) -//----------------------------------- -{ - SetRefreshAllWhenResized(false); -} - -CSearchWindowBase::~CSearchWindowBase() -// Stop any current search. -//----------------------------------- -{ - Boolean canRotate = false; - if ( IsVisible() ) - USearchHelper::FindWindowTabGroup(&mSubCommanders)->SetRotateWatchValue(&canRotate); -} // CSearchWindowBase::~CSearchWindowBase - -// -------------------------------------------------------------------------- -UInt16 -CSearchWindowBase::GetValidStatusVersion() const -// -// -- 10/30/97 --------------------------------------------------------- -// -// This is the proper place for this method, because -// every time the two subclasses of this class stream out they stream out a member of -// this class ( CSearchManager). Therefore when the search manager parameters for stream out -// are changed both subclasses are affected. -// -// Copied the following comments from the CAddressSearchWindow implementation, now defunct. -// -// --------------------------------------------------------------------------- -// So here's the skinny on the directory (aka address) search window. -// You see, when we shipped version 4.01, there were three "levels" of criteria, -// and the version we shipped with was: -// -// static const UInt16 cAddressSearchSaveWindowStatusVersion = 0x0203; -// -// Then on 97/06/30, the number of levels has changed from 3 to 5 in MailNewsSearch.cnst, -// in the enclosures include view. That meant that builds from 7/1 - 7/30 were writing -// out saved window status records containing five levels of criteria. -// Unfortunately, the data is written out as: -// -// bounds/vertextension/levelsdata/tableheaderdata -// -// so that the extra data was written out in the middle. In version 4.01, the routine -// CSearchManager::ReadSavedSearchStatus was not skipping the extra fields, so a crash -// occurred when reading in the table header stuff. This happened when the search window -// was used in 4.01 after running it in 4.02 (7/30 build). -// -// This is bug #78713. There are two parts of the fix. (1) start with a version number -// of zero. Then, version 4.01 will ignore the resource as being "too old", and write -// out a resource with version 0x203. This will be handled OK by version 4.02. -// -// The other part of the fix is that CSearchManager::ReadSavedSearchStatus will now skip -// extra fields, so that this crash won't happen if somebody further increases the number -// of levels. -// -// FINAL NOTE (97/10/13) Because of this same problem, I changed CSaveWindowStatus so that -// it always writes out zero in the first field, which will be interpreted as a zero version -// by Communicator 4.0x, and ignored. So now it's OK to increment this as originally -// intended. -{ - return eValidStreamVersion; -} - -//----------------------------------- -void CSearchWindowBase::AboutToClose() -//----------------------------------- -{ - // Not re-entrant! Don't call this twice. - CSearchWindowBase::MessageWindStop(true); - - Inherited::AttemptCloseWindow(); // Do this first: uses table - - // Bug fix: Do these things in the right order here - if (mMailNewsContext) - mMailNewsContext->RemoveUser(this); - mMailNewsContext = nil; - mSearchManager.AboutToClose(); - - if (mResultsTable) - { - if (mMailNewsContext) - mMailNewsContext->RemoveListener(mResultsTable); // bad time to listen for all connections complete. - delete mResultsTable; - mResultsTable = nil; - } -} - -//----------------------------------- -void CSearchWindowBase::FinishCreateSelf() -//----------------------------------- -{ - // Create context and and progress listener - - mMailNewsContext = new CMailNewsContext(MWContextSearch); - FailNIL_(mMailNewsContext); - - mMailNewsContext->AddUser(this); - mMailNewsContext->AddListener(this); - - CMediatedWindow::FinishCreateSelf(); // Call CMediatedWindow for now since we need to - // create a different context than CMailNewsWindow - if (mProgressListener) - mMailNewsContext->AddListener(mProgressListener); - else - mProgressListener = new CProgressListener(this, mMailNewsContext); - - // SetAttribute(windAttr_DelaySelect); put in resource - // should be in resource, but there's a resource freeze. - - mMailNewsContext->SetWinCSID(INTL_DocToWinCharSetID(mMailNewsContext->GetDefaultCSID())); - - USearchHelper::FindWindowTabGroup(&mSubCommanders)->SetRotateWatchValue(&mCanRotateTarget); - - // Populate scope window - - mResultsEnclosure = USearchHelper::FindViewSubview(this, paneID_ResultsEnclosure); - FailNILRes_(mResultsEnclosure); - mResultsTable = dynamic_cast(USearchHelper::FindViewSubview(this, paneID_ResultsTable)); - FailNILRes_(mResultsTable); - mSearchButton = dynamic_cast(USearchHelper::FindViewControl(this, paneID_Search)); - FailNILRes_(mSearchButton); - mProgressBar = dynamic_cast(USearchHelper::FindViewSubpane(this, paneID_ProgressBar)); - FailNILRes_(mProgressBar); - - mResultsTable->AddListener(this); - mSearchButton->SetDefaultButton(true, false); - mResultsEnclosure->SetRefreshAllWhenResized(false); - - Rect windowBounds; - this->CalcPortFrameRect(windowBounds); - mMinVResultsSize = windowBounds.bottom - windowBounds.top; - - UReanimator::LinkListenerToControls(this, this, GetStatusResID()); - - ShowHideSearchResults(false); - - // Initialize the search manager - mSearchManager.AddListener(this); - mSearchManager.InitSearchManager( - this, USearchHelper::FindWindowTabGroup(&mSubCommanders), - GetWindowScope(), - &mSearchFolders ); - mResultsTable->SetSearchManager(&mSearchManager); - - // Call inherited method - FinishCreateWindow(); -} - -//----------------------------------- -Boolean CSearchWindowBase::ObeyCommand(CommandT inCommand, void *ioParam) -//----------------------------------- -{ - if ( IsResultsTableVisible() ) - { - switch ( inCommand ) - { - case cmd_PreviousMessage: - case cmd_NextMessage: - case cmd_NextUnreadMessage: - return true; - - case cmd_SortBySubject: - case cmd_SortBySender: - case cmd_SortByDate: - case cmd_SortByLocation: - case cmd_SortByPriority: - case cmd_SortByStatus: - { - LTableHeader *theHeader = mResultsTable->GetTableHeader(); - PaneIDT dataType = DataTypeFromSortCommand(inCommand); - if ( theHeader != nil ) - { - theHeader->SetSortedColumn(theHeader->ColumnFromID(dataType), - mResultsTable->IsSortedBackwards(), true); - } - } - return true; - - case cmd_SortAscending: - case cmd_SortDescending: - LTableHeader *theHeader = mResultsTable->GetTableHeader(); - if ( theHeader != nil ) - { - theHeader->SetSortedColumn(theHeader->ColumnFromID(mResultsTable->GetSortedColumn()), - inCommand == cmd_SortDescending, true); - } - return true; - - case msg_TabSelect: - break; - - } - } - - switch ( inCommand ) { - - default: - return Inherited::ObeyCommand(inCommand, ioParam); - } -} - -//----------------------------------- -void CSearchWindowBase::FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName) -//----------------------------------- -{ - // Boolean isLineSelected = (GetSelectedRowCount() > 0); - - if ( IsResultsTableVisible() ) - { - switch ( inCommand ) - { - case cmd_PreviousMessage: - case cmd_NextMessage: - case cmd_NextUnreadMessage: - outEnabled = true; - outUsesMark = false; - return; - - case cmd_SortBySubject: - case cmd_SortBySender: - case cmd_SortByDate: - case cmd_SortByLocation: - case cmd_SortByPriority: - case cmd_SortByStatus: - { - PaneIDT dataType = DataTypeFromSortCommand(inCommand); - PaneIDT paneID = mResultsTable->GetSortedColumn(); - outUsesMark = true; - outEnabled = true; - outMark = ((dataType == paneID) ? checkMark : noMark); - } - return; - - case cmd_SortAscending: - case cmd_SortDescending: - outMark = - ((inCommand == cmd_SortDescending) == mResultsTable->IsSortedBackwards()) ? - checkMark : 0; - outUsesMark = true; - outEnabled = true; - return; - } - } - - switch ( inCommand ) { - - default: - if (inCommand == cmd_OpenSelection) // enabled in base class - ::GetIndString(outName, kMailNewsMenuStrings, kOpenMessageStrID); - - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, - outName); - break; - } -} - -//----------------------------------- -void CSearchWindowBase::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch ( inMessage ) - { - case paneID_Search: - if (mProgressBar) mProgressBar->SetDescriptor("\p"); - MessageWindSearch(); - break; - - case paneID_SearchOptions: - SearchOptions(); - break; - - case paneID_Stop: - MessageWindStop(true); - UpdateTableStatusDisplay(); - break; - - case CStandardFlexTable::msg_SelectionChanged: - UpdateTableStatusDisplay(); - break; - - case CSearchManager::msg_SearchParametersCleared: - ShowHideSearchResults(false); - break; - - case CSearchManager::msg_SearchParametersResized: - MessageSearchParamsResized(*((Int16 *) ioParam)); - break; - - // Status messages - - case msg_NSCAllConnectionsComplete: - MessageWindStop(false); - UpdateTableStatusDisplay(); - // no break here - - default: - // No superclass method - break; - } -} // CSearchWindowBase::ListenToMessage - -//----------------------------------- -void CSearchWindowBase::SearchOptions() -// This function allows the user to set the following prefs: -// - search in subfolders [yes / no] -// - search locally / on server -// After changing these prefs, it is necessary to reconstruct the attributes menu -// because a search on server usually doesn't offer as many criteria as a local search. -// So we call PopulateAttributesMenus() which will do a MSG_GetAttributesForSearchScopes(). -//----------------------------------- -{ - StDialogHandler theOptionsDialogHandler( resIDT_SearchOptionsDialog, dynamic_cast(this) ); - - // get the options dialog - LWindow* theOptionsDialog = theOptionsDialogHandler.GetDialog(); - AssertFail_( theOptionsDialog != nil ); - - int prefResult; - XP_Bool searchSubFolderPref = false; - XP_Bool searchServerPref = false; - - // set the default value for the subfolder search from the preferences - LGACheckbox* searchSubChkb - = dynamic_cast( theOptionsDialog->FindPaneByID( 'SUBF' ) ); - AssertFail_( searchSubChkb != nil ); - - prefResult = PREF_GetBoolPref( searchSubfolderPrefName, &searchSubFolderPref ); - if ( prefResult == PREF_ERROR ) searchSubFolderPref = true; // default from spec. - searchSubFolderPref ? searchSubChkb->SetValue( Button_On ) : searchSubChkb->SetValue( Button_Off ); - - // set the default value for the local/server search from the preferences - LGARadioButton* searchServerBtn - = dynamic_cast( theOptionsDialog->FindPaneByID( 'SRCS' ) ); - LGARadioButton* searchLocalBtn - = dynamic_cast( theOptionsDialog->FindPaneByID( 'SRCL' ) ); - AssertFail_( searchServerBtn != nil ); - - prefResult = PREF_GetBoolPref( searchServerPrefName, &searchServerPref ); - if ( prefResult == PREF_ERROR ) searchServerPref = true; // default from spec. - if( searchServerPref ) - { - searchServerBtn->SetValue( Button_On ); // Other radio will be turned off via LTabGroup - } - else - { - searchLocalBtn->SetValue( Button_On ); // ditto - } - - MessageT theMessage; - - while( true ) - { - theMessage = theOptionsDialogHandler.DoDialog(); - - if( theMessage == msg_OK ) - { - Boolean choice; - if( ( choice = searchSubChkb->IsSelected() ) != searchSubFolderPref ) - PREF_SetBoolPref( searchSubfolderPrefName, choice ); - if( ( choice = searchServerBtn->IsSelected() ) != searchServerPref ) - PREF_SetBoolPref( searchServerPrefName, choice ); - // See the comment in the function header - mSearchManager.PopulateAttributesMenus(GetWindowScope()); - break; - } - else - if( theMessage == msg_Cancel ) - break; - } -} - -//----------------------------------- -Boolean CSearchWindowBase::HandleKeyPress(const EventRecord &inKeyEvent) -//----------------------------------- -{ - Int16 theKey = inKeyEvent.message & charCodeMask; - - if ( ((theKey == char_Enter) || (theKey == char_Return)) && !mSearchManager.IsSearching() ) - { - mSearchButton->SimulateHotSpotClick(kControlButtonPart); - return true; - } - else if ( (((theKey == char_Escape) && ((inKeyEvent.message & keyCodeMask) == vkey_Escape)) || - UKeyFilters::IsCmdPeriod(inKeyEvent)) && mSearchManager.IsSearching() ) - { - - USearchHelper::FindViewControl(this, paneID_Stop)->SimulateHotSpotClick(kControlButtonPart); - return true; - } - - return Inherited::HandleKeyPress(inKeyEvent); -} - -//----------------------------------- -void CSearchWindowBase::SpendTime(const EventRecord &/*inMacEvent*/) -//----------------------------------- -{ - USearchHelper::EnableDisablePane(mSearchButton, mSearchManager.CanSearch()); -} - -//----------------------------------- -void CSearchWindowBase::Activate() -// Start repeating. -//----------------------------------- -{ - StopIdling(); - StartRepeating(); - -// CSearchTabGroup *theTabGroup = USearchHelper::FindWindowTabGroup(&mSubCommanders); -// Boolean couldRotate = theTabGroup->SetCanRotate(false); // Don't rotate when activating - - Inherited::Activate(); - -// theTabGroup->SetCanRotate(couldRotate); -} - -//----------------------------------- -void CSearchWindowBase::DeactivateSelf() -//----------------------------------- -{ - StopRepeating(); - StartIdling(); - - Inherited::DeactivateSelf(); -} - -//----------------------------------- -void CSearchWindowBase::DrawSelf() -//----------------------------------- -{ - Boolean doResultsTable = IsResultsTableVisible(); - Rect frame; - - if ( doResultsTable && mResultsTable->CalcPortFrameRect(frame) && - ::RectInRgn(&frame, mUpdateRgnH) ) - { - { - StExcludeVisibleRgn excludeRgn(mResultsTable); - Inherited::DrawSelf(); - } - - StColorPenState::Normalize(); - ::EraseRect(&frame); - } - else - { - Inherited::DrawSelf(); - } - - USearchHelper::RemoveSizeBoxFromVisRgn(this); -} - -//----------------------------------- -void CSearchWindowBase::SetDescriptor(ConstStr255Param inDescriptor) -//----------------------------------- -{ - if ( !::EqualString(inDescriptor, *((WindowPeek) GetMacPort())->titleHandle, true, true) ) - { - Inherited::SetDescriptor(inDescriptor); - } -} - -//----------------------------------- -void CSearchWindowBase::MessageSearchParamsResized(Int16 inResizeAmount) -// React to more message. -//----------------------------------- -{ - LPane *resultsView = USearchHelper::FindViewSubpane(this, paneID_ResultsEnclosure); - - if ( inResizeAmount > 0 ) { // Make refresh look good! - resultsView->ResizeFrameBy(0, -inResizeAmount, true); - resultsView->MoveBy(0, inResizeAmount, true); - } - else - { - resultsView->MoveBy(0, inResizeAmount, true); - resultsView->ResizeFrameBy(0, -inResizeAmount, true); - } - - if ( !IsResultsTableVisible() ) - { - Rect bounds; - CSaveWindowStatus::GetPaneGlobalBounds(this, &bounds); - bounds.bottom += inResizeAmount; - this->DoSetBounds(bounds); // Update window size - } - - RecalcMinMaxStdSizes(); -} - -//----------------------------------- -void CSearchWindowBase::MessageWindSearch() -//----------------------------------- -{ - AssertFail_(mSearchManager.CanSearch()); - - MSG_SearchAttribute attrib; - Boolean sortBackwards; - mResultsTable->GetSortParams(&attrib, &sortBackwards); - - mResultsTable->StartSearch(*mMailNewsContext, CMailNewsContext::GetMailMaster(), - attrib, sortBackwards); - - mSearchButton->Hide(); - USearchHelper::FindViewSubpane(this, paneID_Stop)->Show(); - USearchHelper::FindViewSubpane(this, paneID_ScopeEnclosure)->Disable(); - - ShowHideSearchResults(true); - UpdatePort(); -} // CSearchWindowBase::MessageWindSearch() - -//----------------------------------- -void CSearchWindowBase::RecalcMinMaxStdSizes() -// Recalculate the window's min/max and std sizes based on the current window state. -//----------------------------------- -{ - if ( IsResultsTableVisible() ) - { - mMinMaxSize.top = mMinVResultsSize; - mMinMaxSize.bottom = 16000; - mStandardSize.height = max_Int16; - } - else - { - Rect bounds; - CSaveWindowStatus::GetPaneGlobalBounds(this, &bounds); - mMinMaxSize.top = mMinMaxSize.bottom = mStandardSize.height = (bounds.bottom - bounds.top); - } -} - -//----------------------------------- -void CSearchWindowBase::ShowHideSearchResults(Boolean inDoShow) -// Show or hide the search results in this window by resizing the window vertically. -// If the results are being hidden, the last window vertical extension is stored in -// mResultsVertWindExtension, otherwise mResultsVertWindExtension is used for determining -// the amount to resize the window. -// -// If search results are hidden, all current results are deleted from the result table. -//----------------------------------- -{ - if ( IsResultsTableVisible() ) - return; - - Rect curBounds; - - CSaveWindowStatus::GetPaneGlobalBounds(this, &curBounds); - - Rect newBounds = curBounds; - - if ( inDoShow ) - { - if ( mResultsVertWindExtension < 0 ) mResultsVertWindExtension = -mResultsVertWindExtension; // Undo initialization - newBounds.bottom += mResultsVertWindExtension; - mResultsEnclosure->Show(); - if ( (newBounds.bottom - newBounds.top) < mMinVResultsSize ) - { - newBounds.bottom = newBounds.top + mMinVResultsSize; - } - } - else - { - Rect bounds2; - CSaveWindowStatus::GetPaneGlobalBounds(USearchHelper::FindViewSubpane(this, CSearchManager::paneID_ParamEncl), - &bounds2); - Int16 newBottom = (bounds2.left - newBounds.left) + bounds2.bottom; - if ( mResultsVertWindExtension >= 0 ) mResultsVertWindExtension = newBounds.bottom - newBottom; - newBounds.bottom = newBottom; - mResultsEnclosure->Hide(); - } - - mResultsTableVisible = inDoShow; - mMinMaxSize.bottom = max_Int16; // Set so that VerifyWindowBounds() can do its work correctly! - mMinMaxSize.top = 100; // Set so that VerifyWindowBounds() can do its work correctly! - - CSaveWindowStatus::VerifyWindowBounds(this, &newBounds); - if ( !::EqualRect(&newBounds, &curBounds) ) - { - this->DoSetBounds(newBounds); - } - - RecalcMinMaxStdSizes(); -} - -//----------------------------------- -void CSearchWindowBase::UpdateResultsVertWindExtension() -// Update the vertical window extension variable. -//----------------------------------- -{ - if ( IsResultsTableVisible() && (mResultsVertWindExtension >= 0) ) - { - Rect windBounds, enclBounds; - CSaveWindowStatus::GetPaneGlobalBounds(this, &windBounds); - CSaveWindowStatus::GetPaneGlobalBounds(USearchHelper::FindViewSubpane( - this, CSearchManager::paneID_ParamEncl), &enclBounds); - Int16 enclBottom = (enclBounds.left - windBounds.left) + enclBounds.bottom; - mResultsVertWindExtension = windBounds.bottom - enclBottom; - } -} - -//----------------------------------- -void CSearchWindowBase::ReadWindowStatus(LStream *inStatusData) -//----------------------------------- -{ - if ( inStatusData != nil ) - { - Rect bounds; - *inStatusData >> bounds; - - CSaveWindowStatus::MoveWindowTo(this, topLeft(bounds)); - - Int16 resultsVertWindExtension; - - *inStatusData >> resultsVertWindExtension; - if ( resultsVertWindExtension > 0 ) - { - mResultsVertWindExtension = -resultsVertWindExtension; // See the ShowHideSearchResults(), set to negative - // to mean initialization - } - } - else - { - CSaveWindowStatus::MoveWindowToAlertPosition(this); - } - - mSearchManager.ReadSavedSearchStatus(inStatusData); - if( inStatusData ) - mResultsTable->GetTableHeader()->ReadColumnState(inStatusData); -} - -//----------------------------------- -void CSearchWindowBase::WriteWindowStatus(LStream *outStatusData) -//----------------------------------- -{ - CSaveWindowStatus::WriteWindowStatus(outStatusData); - - UpdateResultsVertWindExtension(); - - *outStatusData << ((Int16) ((mResultsVertWindExtension > 0) ? mResultsVertWindExtension : - (-mResultsVertWindExtension))); - - mSearchManager.WriteSavedSearchStatus(outStatusData); - - mResultsTable->GetTableHeader()->WriteColumnState(outStatusData); -} - -//----------------------------------- -void CSearchWindowBase::UpdateTableStatusDisplay() -//----------------------------------- -{ - if ( !IsResultsTableVisible() ) return; - - AssertFail_(mResultsTable != nil); - - TableIndexT numItems, numSelectedItems; - - mResultsTable->GetTableSize(numItems, numSelectedItems); - numSelectedItems = mResultsTable->GetSelectedRowCount(); - - CStr255 messageString; - if ( numItems > 0 ) - { - CStr31 numString, selectedString; - ::NumToString(numItems, numString); - if ( numSelectedItems > 0 ) - { - ::NumToString(numSelectedItems, selectedString); - USearchHelper::AssignUString( - (numItems == 1) ? - USearchHelper::USearchHelper::uStr_OneMessageFoundSelected : - USearchHelper::uStr_MultipleMessagesSelected, - messageString); - } - else - USearchHelper::AssignUString((numItems == 1) ? USearchHelper::uStr_OneMessageFound : USearchHelper::uStr_MultipleMessagesFound, - messageString); - ::StringParamText(messageString, numString, selectedString); - - } - else - USearchHelper::AssignUString(USearchHelper::uStr_NoMessagesFound, messageString); - - mProgressBar->SetDescriptor(messageString); - -} - -//----------------------------------- -Boolean CSearchWindowBase::GetDefaultSearchTable( - CMailNewsWindow*& outMailNewsWindow, - CMailFlexTable*& outMailFlexTable) -// Using the current PP window hierarchy, determine if the current top regular window is -// a window that we can use to associate with our search window. This method is -// called just before the search window is brought to the front of the regular window -// hierarchy. If the method returns false, no window was found that could be associated -// with our search window and the output parameters are set to nil. If the method returns -// true, a window was found that has an active flex table, and both objects are returned -// in the output parameters. -//----------------------------------- -{ - outMailNewsWindow = nil; - outMailFlexTable = nil; - - // Get the current top regular window of the type we need - CMediatedWindow *theFoundWindow = nil; - CWindowIterator theIterator(WindowType_Any); - do - { - if (theIterator.Next(theFoundWindow)) - { - DataIDT windowType = theFoundWindow->GetWindowType(); - switch (windowType) - { - case WindowType_SearchMailNews: - continue; // Found ourselves. - - case WindowType_MailNews: - outMailNewsWindow = dynamic_cast(theFoundWindow); - break; - - case WindowType_MailThread: - case WindowType_Newsgroup: - outMailNewsWindow = dynamic_cast(theFoundWindow); - break; - - case WindowType_Message: - outMailNewsWindow = dynamic_cast(theFoundWindow); - break; - } - if (outMailNewsWindow) - break; // Found a MailNews window that can return a "search table" - } - else - theFoundWindow = nil; - } - while (theFoundWindow != nil); - - if (outMailNewsWindow) - { - // Is there an active target table? - outMailFlexTable = outMailNewsWindow->GetSearchTable(); - if (outMailFlexTable == nil) - outMailNewsWindow = nil; - - } - return (outMailFlexTable != nil); -} - - -//----------------------------------- -void CSearchWindowBase::MessageWindStop(Boolean inUserAborted) -//----------------------------------- -{ - if ( mSearchManager.IsSearching() ) - { - mSearchManager.StopSearch(inUserAborted ? ((MWContext *) *mMailNewsContext) : nil); - mSearchButton->Show(); - USearchHelper::FindViewSubpane(this, paneID_Stop)->Hide(); - USearchHelper::FindViewSubpane(this, paneID_ScopeEnclosure)->Enable(); - - // This call fixes a bug in the BE search row insertion - mResultsTable->ForceCurrentSort(); - } -} - -/*====================================================================================== - Return a display name for the specified folder name. -======================================================================================*/ - -CStr255& CSearchWindowBase::GetFolderDisplayName(const char *inFolderName, CStr255& outFolderName) -{ - outFolderName = inFolderName; - char* temp = (char*)outFolderName; - NET_UnEscape(temp); - outFolderName = temp; - return outFolderName; -} - - -/*====================================================================================== - Get the display text for the specified attribute and table row index. Return - kNumAttributes if the inCellDataType is invalid. -======================================================================================*/ - -MSG_SearchAttribute CSearchWindowBase::AttributeFromDataType(PaneIDT inCellDataType) -{ - MSG_SearchAttribute rtnVal; - - switch ( inCellDataType ) - { - // Message search columns - case kSubjectMessageColumn: rtnVal = attribSubject; break; - case kSenderMessageColumn: rtnVal = attribSender; break; - case kDateMessageColumn: rtnVal = attribDate; break; - case kStatusMessageLocation: rtnVal = attribLocation; break; - case kPriorityMessageColumn: rtnVal = attribPriority; break; - case kStatusMessageColumn: rtnVal = attribMsgStatus; break; - default: rtnVal = kNumAttributes; break; - } - - return rtnVal; -} - - - - -/*====================================================================================== - Return a sort data type from the specified sort command. Return 0L if the - inSortCommand is invalid. -======================================================================================*/ - -PaneIDT CSearchWindowBase::DataTypeFromSortCommand(CommandT inSortCommand) -{ - PaneIDT rtnVal; - - switch ( inSortCommand ) - { - case cmd_SortBySubject: rtnVal = kSubjectMessageColumn; break; - case cmd_SortBySender: rtnVal = kSenderMessageColumn; break; - case cmd_SortByDate: rtnVal = kDateMessageColumn; break; - case cmd_SortByLocation: rtnVal = kStatusMessageLocation; break; - case cmd_SortByPriority: rtnVal = kPriorityMessageColumn; break; - case cmd_SortByStatus: rtnVal = kStatusMessageColumn; break; - // Do we need these commands for column sorting in the LDAP search result pane? - default: rtnVal = cmd_Nothing; break; - } - - return rtnVal; -} - - -//----------------------------------- -void CSearchWindowBase::AddOneScopeMenuItem( - Int16 inStringIndex, - Int16 inAttrib - ) -//----------------------------------- -{ - CStr255 string; - USearchHelper::AssignUString(inStringIndex, string); - AddOneScopeMenuItem(string, inAttrib); -} - -//----------------------------------- -void CSearchWindowBase::AddOneScopeMenuItem( - const CStr255& inString, - Int16 inAttrib - ) -//----------------------------------- -{ - Assert_(mNumBasicScopeMenuItems < MAX_SEARCH_MENU_ITEMS); - if (mNumBasicScopeMenuItems < MAX_SEARCH_MENU_ITEMS) - { - MSG_SearchMenuItem& curItem = mSearchMenuItems[mNumBasicScopeMenuItems]; - LString::CopyPStr(inString, (UInt8*)curItem.name, sizeof(curItem.name)); - curItem.attrib = inAttrib; - curItem.isEnabled = true; - ++mNumBasicScopeMenuItems; - } -} - - -//----------------------------------- -void CSearchWindowBase::SetWinCSID(Int16 wincsid) -//----------------------------------- -{ - if(mMailNewsContext) - mMailNewsContext->SetWinCSID(wincsid); - if(mResultsTable) - mResultsTable->SetWinCSID(wincsid); - mSearchManager.SetWinCSID(wincsid); -} - diff --git a/mozilla/cmd/macfe/MailNews/CSearchWindowBase.h b/mozilla/cmd/macfe/MailNews/CSearchWindowBase.h deleted file mode 100644 index af289bffa92..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSearchWindowBase.h +++ /dev/null @@ -1,147 +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. - */ - - - -// CSearchWindowBase.h - -#pragma once - -#include "CMailNewsWindow.h" -#include "LPeriodical.h" -#include "LListener.h" -#include "msg_srch.h" -#include "PascalString.h" -#include "CSearchManager.h" -#include "MailNewsgroupWindow_Defines.h" - -class LGAPushButton; -class CPatternProgressCaption; -class CSearchTableView; - -const long MAX_SEARCH_MENU_ITEMS = 16; - -//====================================== -class CSearchWindowBase : public CMailNewsWindow, - public LPeriodical, - public LListener -//====================================== -{ - typedef CMailNewsWindow Inherited; - -public: - // IDs for panes in associated view, also messages that are broadcast to this object - - enum - { - paneID_Search = 'SRCH' // MSG_Pane *, search button - , paneID_Stop = 'STOP' // nil, stop button - , paneID_ResultsEnclosure = 'RENC' // Results enclosure - , paneID_ScopeEnclosure = 'SENC' // Scope enclosure - , paneID_ResultsTable = 'Tabl' // Results table - , paneID_ProgressBar = kMailNewsStatusPaneID // Progress bar - , paneID_SearchOptions = 'SOPT' // Search options dialog - }; - - // Stream version number - // This must be changed every time you change the streamed parameters - enum { eValidStreamVersion = 0x000b }; - - CSearchWindowBase(LStream *inStream, DataIDT inWindowType); - virtual ~CSearchWindowBase(); - virtual void SetUpBeforeSelecting() = 0; - - static MSG_SearchAttribute AttributeFromDataType(PaneIDT inCellDataType); - static PaneIDT DataTypeFromSortCommand(CommandT inSortCommand); - -protected: - - // Overriden methods - virtual MSG_ScopeAttribute GetWindowScope() const = 0; - - virtual void FinishCreateSelf(); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam = nil); - virtual void FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - virtual void SpendTime(const EventRecord &inMacEvent); - virtual void DrawSelf(); - virtual void SetDescriptor(ConstStr255Param inDescriptor); - virtual void Activate(); - virtual void DeactivateSelf(); - virtual void AboutToClose(); - virtual void SearchOptions() ; - - // Utility methods - - void RecalcMinMaxStdSizes(); - void ShowHideSearchResults(Boolean inDoShow); - void UpdateResultsVertWindExtension(); - Boolean IsResultsTableVisible() - { - return mResultsTableVisible; - } - Boolean GetDefaultSearchTable( CMailNewsWindow*& outWindow, CMailFlexTable*& outMailFlexTable); - - CStr255& GetFolderDisplayName(const char *inFolderName, CStr255& outFolderName); - - void MessageSearchParamsResized(Int16 inResizeAmount); - virtual void MessageWindSearch(); - virtual void MessageWindStop(Boolean inUserAborted); - - void AddOneScopeMenuItem( - Int16 inStringIndex, - Int16 inAttrib); - void AddOneScopeMenuItem( - const CStr255& inString, - Int16 inAttrib); - - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual void UpdateTableStatusDisplay(); - - - virtual void SetWinCSID(Int16 wincsid); - virtual UInt16 GetValidStatusVersion() const; - - // Instance variables - - Int16 mMinVResultsSize; - Int16 mResultsVertWindExtension; - Boolean mResultsTableVisible; - LPane *mResultsEnclosure; - CSearchTableView *mResultsTable; - LGAPushButton *mSearchButton; - - Boolean mCanRotateTarget; - - CSearchManager mSearchManager; - LArray mSearchFolders; - - CPatternProgressCaption *mProgressBar; - Int16 mNumBasicScopeMenuItems; - Int16 mNumMenuItems; - MSG_SearchMenuItem mSearchMenuItems[MAX_SEARCH_MENU_ITEMS]; - - private: - - LGAPushButton *mSearchOptionsButton; - -}; // class CSearchWindowBase diff --git a/mozilla/cmd/macfe/MailNews/CSecurityButton.cp b/mozilla/cmd/macfe/MailNews/CSecurityButton.cp deleted file mode 100644 index f2083985a4e..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSecurityButton.cp +++ /dev/null @@ -1,145 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSecurityButton.cp - -#include "CSecurityButton.h" -/* #include "CMailComposeWindow.h" */ -/* #include "msgcom.h" */ -#include "CComposeSession.h" -/* #include "CBrowserContext.h" */ -#include "CButton.h" -#include "LGAIconSuiteControl.h" - -#include "CMessageView.h" -#include "ssl.h" - -void USecurityIconHelpers::UpdateMailWindow( CMessageView *messageView ) -{ - if ( messageView ) - { - CMailNewsWindow* window = dynamic_cast(LWindow::FetchWindowObject( - messageView->GetMacPort())); - if ( !window ) - return; - MWContext* context = NULL; - context = (MWContext*)*messageView->GetContext(); - uint32 folderFlags = messageView->GetFolderFlags(); - XP_Bool isEncrypted = 0; - XP_Bool isSigned = 0; - - MIME_GetMessageCryptoState( context , 0 ,0, &isSigned, &isEncrypted ); - - Boolean isNewsGroup = ((folderFlags & MSG_FOLDER_FLAG_NEWSGROUP)!=0) ; - if ( isNewsGroup ) - { - // news message encryption depends if the News group is secure - int secLevel = XP_GetSecurityStatus( context ); - isEncrypted = (secLevel != SSL_SECURITY_STATUS_OFF); - } - if ( isSigned >1 || isSigned<0) - isSigned = 0; - if ( isEncrypted>1 || isEncrypted<0 ) - isEncrypted = 0; - - USecurityIconHelpers::ChangeToSecurityState( window, isEncrypted, isSigned ); - } -} - -void USecurityIconHelpers::UpdateComposeButton( CMailComposeWindow *window ) -{ - Assert_( window !=NULL ); - CComposeSession * session = window->GetComposeSession(); - XP_Bool isEncrypted = 0; - XP_Bool isSigned = 0; - isEncrypted = session->GetCompBoolHeader( MSG_ENCRYPTED_BOOL_HEADER_MASK ); - isSigned = session->GetCompBoolHeader( MSG_SIGNED_BOOL_HEADER_MASK ); - USecurityIconHelpers::ChangeToSecurityState( window, isEncrypted, isSigned ); -} - -void USecurityIconHelpers::SetNoMessageLoadedSecurityState( LWindow * window ) -{ - Assert_( window != NULL ); - USecurityIconHelpers::ChangeToSecurityState( window, false, false ); -} - -void USecurityIconHelpers::AddListenerToSmallButton(LWindow* inWindow, LListener* inListener) -{ - LGAIconSuiteControl* button = dynamic_cast(inWindow->FindPaneByID( eSmallEncryptedButton )); - if (button) - button->AddListener(inListener); - button = dynamic_cast(inWindow->FindPaneByID( eSmallSignedButton )); - if (button) - button->AddListener(inListener); -} - -void USecurityIconHelpers::ChangeToSecurityState( - LWindow* inWindow, - Boolean inEncrypted, - Boolean inSigned ) -{ - if (!inWindow) - return; - CButton* button = dynamic_cast(inWindow->FindPaneByID( eBigSecurityButton )); - if (button) - { - static const ResIDT bigSecurityIcons[4]={ 15439, 15435, 15447, 15443 }; - ResIDT newIconID = bigSecurityIcons[ inSigned + 2*inEncrypted ]; - if (button->GetGraphicID() != newIconID ) - { - button->SetGraphicID( newIconID); - button->Refresh(); - } - } - LGAIconSuiteControl* smallButton - = dynamic_cast(inWindow->FindPaneByID( eSmallEncryptedButton )); - if (smallButton) - { - ResIDT newIconID = inEncrypted ? 15336 : 15335; - if (smallButton->GetIconResourceID() != newIconID ) - { - smallButton->SetIconResourceID( newIconID); - smallButton->Refresh(); - } - } - smallButton - = dynamic_cast(inWindow->FindPaneByID( eSmallSignedButton )); - if (smallButton) - { - if (inSigned) - smallButton->Show(); - else - smallButton->Hide(); - } -} - -void CMailSecurityListener::ListenToMessage(MessageT inMessage, void* ioParam) -{ -#pragma unused (ioParam) - switch( inMessage ) - { - case msg_NSCAllConnectionsComplete: - USecurityIconHelpers::UpdateMailWindow( mMessageView); - break; - - default: - break; - } -} diff --git a/mozilla/cmd/macfe/MailNews/CSecurityButton.h b/mozilla/cmd/macfe/MailNews/CSecurityButton.h deleted file mode 100644 index b5edbfe9769..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSecurityButton.h +++ /dev/null @@ -1,59 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSecurityButton.h - -#pragma once -#include -class CMailComposeWindow; -class CMailNewsWindow; -class CMessageView; -class LWindow; -// Modifies the Security button to reflect wether the message is -// signed/encrypted -class CMailSecurityListener : public LListener -{ -public: - CMailSecurityListener() : mMessageView(NULL) {}; - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - void SetMessageView( CMessageView* view) { mMessageView = view;} -private: - CMessageView *mMessageView; -}; - -class USecurityIconHelpers -{ -public: - enum State { eNone, eSigned, eEncrypted, eSignedEncrypted}; - enum { eBigSecurityButton = 'Bsec', - eSmallEncryptedButton = 'SBsc', - eSmallSignedButton = 'SBsg' }; - // Large security buttons must be 'Bsec' - // Small security buttons must be 'SBsc' (encryption) or 'SBsg' (signed) - static void UpdateComposeButton( CMailComposeWindow *window ); - static void UpdateMailWindow( CMessageView *messageView); - static void SetNoMessageLoadedSecurityState( LWindow * window ); - static void AddListenerToSmallButton(LWindow* inWindow, LListener* inListener); -private: - static void ChangeToSecurityState( - LWindow* window, - Boolean inEncrypted, - Boolean inSigned ); -}; diff --git a/mozilla/cmd/macfe/MailNews/CSimpleFolderView.cp b/mozilla/cmd/macfe/MailNews/CSimpleFolderView.cp deleted file mode 100644 index 4e20a2ac537..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSimpleFolderView.cp +++ /dev/null @@ -1,565 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSimpleFolderView.cp - -/* - This class allows to get a list of containers: - - Mail servers & folders - - News servers & groups - - It was originally developed as part of CMessageFolderView - which implements the Message Center. Having a separate class - allows to implement folder lists in other places (Offline Picker). - - It inherits from CMailFlexTable and CStandardFlexTable. - It handles the selection and clicks on the twistee icons but - it doesn't handle any command, except for the Stop button. - - Mail and News folders are obtained from the Back-End by creating - a Folder Pane. - - - History: - ¥ In version 1.1 of this file, there was a mechanism to save/restore - the selection in case of MSG_NotifyScramble or MSG_NotifyAll (like - in CThreadView). This mechanism was removed because the folder view - does not support sort commands. -*/ - -#include "CSimpleFolderView.h" - -// Netscape Mac Libs -#include "resgui.h" - -// Mail/News Specific -#include "CMailNewsWindow.h" -#include "MailNewsgroupWindow_Defines.h" -#include "CProgressListener.h" -#include "CMessageFolder.h" -#include "CMailNewsContext.h" -#include "UMailFolderMenus.h" - -#define cmd_ExpandCellKludge 'Expd' // fake command number used in a - // kludge to avoid multiple redraws - - -//------------------------------------------------------------------------------ -// ¥ CSimpleFolderView -//------------------------------------------------------------------------------ -// -CSimpleFolderView::CSimpleFolderView(LStream *inStream) - : Inherited(inStream) - , mUpdateMailFolderMenusWhenComplete(false) - , mUpdateMailFolderMenusOnNextUpdate(false) - , mSelectHilitesWholeRow(false) -{ -} - - -//------------------------------------------------------------------------------ -// ¥ ~CSimpleFolderView -//------------------------------------------------------------------------------ -// -CSimpleFolderView::~CSimpleFolderView() -{ -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ LoadFolderList -//------------------------------------------------------------------------------ -// Given a context, starts getting the list. Typically called in the -// FinishCreateSelf() of the parent window which is the one which creates the context. -// -void CSimpleFolderView::LoadFolderList(CNSContext* inContext) -{ - Assert_(inContext != NULL); - mContext = inContext; - if (GetMessagePane() == NULL) - { - SetMessagePane(MSG_CreateFolderPane(*inContext, CMailNewsContext::GetMailMaster())); - ThrowIfNULL_(GetMessagePane()); - MSG_SetFEData(GetMessagePane(), CMailCallbackManager::Get()); - } - - NotifySelfAll(); // notify ourselves that everything has changed -} - - -//------------------------------------------------------------------------------ -// ¥ GetSelectedFolder -//------------------------------------------------------------------------------ -// Public utility: return the ID of the selected folder. -// -MSG_FolderInfo* CSimpleFolderView::GetSelectedFolder() const -{ - TableIndexT row = 0; - if (GetMessagePane() && GetNextSelectedRow(row)) - return MSG_GetFolderInfo(GetMessagePane(), row - 1); - return NULL; -} - - -//------------------------------------------------------------------------------ -// ¥ SelectFirstFolderWithFlags -//------------------------------------------------------------------------------ -// Public utility: used to select the Inbox on "Window | Message Center" -// or the first news server on "Prefs | Launch Collabra Discussions". -// -void CSimpleFolderView::SelectFirstFolderWithFlags(uint32 inFlags) -{ - MSG_FolderInfo* folderInfo; - - ::MSG_GetFoldersWithFlag(CMailNewsContext::GetMailMaster(), inFlags, &folderInfo, 1); - SelectFolder(folderInfo); -} - - -//------------------------------------------------------------------------------ -// ¥ SelectFolder -//------------------------------------------------------------------------------ -// Public utility: can be used to select the parent folder of a Thread window. -// -void CSimpleFolderView::SelectFolder(const MSG_FolderInfo* inFolderInfo) -{ - if (inFolderInfo) - { - MSG_ViewIndex index = ::MSG_GetFolderIndexForInfo( - GetMessagePane(), (MSG_FolderInfo*)inFolderInfo, true); - ArrayIndexT lineNumber = 1 + index; - STableCell cellToSelect(lineNumber, 1); - - SetNotifyOnSelectionChange(false); - UnselectAllCells(); - SetNotifyOnSelectionChange(true); - - ScrollCellIntoFrame(cellToSelect); // show folder before selecting it - SelectCell(cellToSelect); - } - else - UnselectAllCells(); -} - - -//------------------------------------------------------------------------------ -// ¥ DeleteSelection -//------------------------------------------------------------------------------ -// Required by CStandardFlexTable. We don't want to implement that here: -// the Message Center will certainly stay the only place where a folder can be -// deleted. If this were to change, move the code from CMessageFolderView back -// to here along with the 'mWatchedFolder' hack. -// -void CSimpleFolderView::DeleteSelection() -{ -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ GetIconID -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Return the folder icon for that row. -// -ResIDT CSimpleFolderView::GetIconID(TableIndexT inRow) const -{ - CMessageFolder folder(inRow, GetMessagePane()); - return folder.GetIconID(); -} - - -//------------------------------------------------------------------------------ -// ¥ GetNestedLevel -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Return the ident for that row. -// This method goes together with GetHiliteTextRect(). -// -UInt16 CSimpleFolderView::GetNestedLevel(TableIndexT inRow) const -{ - CMessageFolder folder(inRow, GetMessagePane()); - return folder.GetLevel() - 1; -} - - -//------------------------------------------------------------------------------ -// ¥ GetHiliteColumn -//------------------------------------------------------------------------------ -// From CStandardFlexTable. When a row is selected, we can hilite the -// whole row (default behavior of the base class) or just the folder name. -// This method goes together with GetHiliteTextRect(). -// -TableIndexT CSimpleFolderView::GetHiliteColumn() const -{ - if (mSelectHilitesWholeRow) - return Inherited::GetHiliteColumn(); - - return mTableHeader->ColumnFromID(kFolderNameColumn); -} - - -//------------------------------------------------------------------------------ -// ¥ GetHiliteTextRect -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Pass back the rect to hilite for that row (either -// the whole row, either just the folder name). Return true if rect is not empty. -// This method goes together with GetHiliteColumn() and GetNestedLevel(). -// -Boolean CSimpleFolderView::GetHiliteTextRect( - const TableIndexT inRow, - Rect& outRect) const -{ - if (mSelectHilitesWholeRow) - return Inherited::GetHiliteTextRect(inRow, outRect); - - STableCell cell(inRow, GetHiliteColumn()); - if (!GetLocalCellRect(cell, outRect)) - return false; - - Rect iconRect; - GetIconRect(cell, outRect, iconRect); - outRect.left = iconRect.right; - char folderName[cMaxMailFolderNameLength + 1]; - GetHiliteText(inRow, folderName, sizeof(folderName), &outRect); - return true; -} - - -//------------------------------------------------------------------------------ -// ¥ ApplyTextStyle -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Set the text style for that row. -// -void CSimpleFolderView::ApplyTextStyle(TableIndexT inRow) const -{ - CMessageFolder folder(inRow, GetMessagePane()); - // According to the latest UI spec (4/16/98), bold is used for folders with unread messages - int32 textStyle = normal; - if( folder.IsOpen() ) - { - if ( folder.CountUnseen()> 0 ) - textStyle = bold; - } - else - { - // if the folder is closed we want to bold the folder if any subfolder has unread messages - if ( folder.CountDeepUnseen()> 0 ) - textStyle = bold; - } - ::TextFace( textStyle ); -} - - -//------------------------------------------------------------------------------ -// ¥ DrawCellContents -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Pass a cell and a rect: it draws it. -// It knows how to draw the name column (with a twistee if necessary + -// the icon corresponding to the item) and the 'Unread' and 'Total' -// columns. If you have additional columns, overide this method. -// -void CSimpleFolderView::DrawCellContents( - const STableCell& inCell, - const Rect& inLocalRect) -{ - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { - case kFolderNameColumn: - { - // Draw icons (item icon + twistee) - SInt16 iconRight = DrawIcons(inCell, inLocalRect); - - if (mRowBeingEdited != inCell.row || !mNameEditor) - { - - // Draw folder name - Rect textRect = inLocalRect; - textRect.left = iconRight; - char folderName[cMaxMailFolderNameLength + 1]; - if (GetHiliteText(inCell.row, folderName, sizeof(folderName), &textRect)) - { - DrawTextString(folderName, &mTextFontInfo, 0, textRect); - if (inCell.row == mDropRow) - ::InvertRect(&textRect); - } - } - break; - } - - case kFolderNumUnreadColumn: - { - CMessageFolder folder(inCell.row, GetMessagePane()); - if (folder.CanContainThreads()) - if (folder.CountMessages() != 0) - DrawCountCell(folder.CountUnseen(), inLocalRect); - break; - } - - case kFolderNumTotalColumn: - { - CMessageFolder folder(inCell.row, GetMessagePane()); - if (folder.CanContainThreads()) - if (folder.CountMessages() != 0) - DrawCountCell(folder.CountMessages(), inLocalRect); - break; - } - } -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ CellHasDropFlag -//------------------------------------------------------------------------------ -// Check if a cell has a twistee icon and if the twistee is open. -// -Boolean CSimpleFolderView::CellHasDropFlag( - const STableCell& inCell, - Boolean& outIsExpanded) const -{ - CMessageFolder folder(inCell.row, GetMessagePane()); - if (GetCellDataType(inCell) == kFolderNameColumn && folder.CountSubFolders() != 0) - { - outIsExpanded = folder.IsOpen(); - return true; - } - return false; -} - - -//------------------------------------------------------------------------------ -// ¥ SetCellExpansion -//------------------------------------------------------------------------------ -// Open or close the twistee icon of a folder. -// -void CSimpleFolderView::SetCellExpansion( - const STableCell& inCell, - Boolean inExpand) -{ - // check current state - CMessageFolder folder(inCell.row, GetMessagePane()); - if (inExpand == folder.IsOpen()) - return; - - // kludge: slow down the status bar refresh rate - // to reduce flickers and improve performance - if (inExpand) - { - if (folder.IsNewsHost() || folder.IsIMAPMailFolder()) - { - CMailNewsWindow * myWindow = dynamic_cast - (LWindow::FetchWindowObject(GetMacPort())); - - if (myWindow) - myWindow->GetProgressListener()->SetLaziness( - CProgressListener::lazy_VeryButForThisCommandOnly); - } - } - - // kludge to avoid multiple redraws (see ChangeFinished()) - mContext->SetCurrentCommand(cmd_ExpandCellKludge); - - // toggle twistee - ToggleExpandAction(inCell.row); - folder.FolderInfoChanged(); -} - - -//------------------------------------------------------------------------------ -// ¥ GetMainRowText -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Return the folder name for that row. -// Implemented here because the folder name is likely to stay -// the main text of the row for the users of the class. -// -void CSimpleFolderView::GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -{ - if (!outText || inMaxBufferLength == 0) - return; - - if (inMaxBufferLength < cMaxMailFolderNameLength + 1) - { - *outText = '\0'; - return; - } - - CMessageFolder folder(inRow, GetMessagePane()); - CMailFolderMixin::GetFolderNameForDisplay(outText, folder); - NET_UnEscape(outText); -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ FindCommandStatus -//------------------------------------------------------------------------------ -// Enable Stop button when list is loading. -// -void CSimpleFolderView::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - if (mStillLoading) - { - if (inCommand == cmd_Stop) - { - outEnabled = true; - return; - } - } - else - { - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } -} - - -//------------------------------------------------------------------------------ -// ¥ ListenToMessage -//------------------------------------------------------------------------------ -// When list is complete, update folder menus across the app. -// -void CSimpleFolderView::ListenToMessage(MessageT inMessage, void* ioParam) -{ - Inherited::ListenToMessage(inMessage, ioParam); - - if (inMessage == msg_NSCAllConnectionsComplete) - { - if (mUpdateMailFolderMenusWhenComplete) - { - mUpdateMailFolderMenusWhenComplete = false; - CMailFolderMixin::UpdateMailFolderMixins(); - } - mContext->SetCurrentCommand(cmd_Nothing); - } -} - - -#pragma mark - -//------------------------------------------------------------------------------ -// ¥ ChangeFinished -//------------------------------------------------------------------------------ -// A list of hacks to update our list + the folder menus across the app. -// Also restores the selection after a 'sort' command (see ChangeStarting()). -// -void CSimpleFolderView::ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -{ - //-------- - // When opening a News host by toggling the twistee in the Message Center, - // we get one notification for each subscribed newsgroup and it generates - // a lot of flicker. - // - // The following is a kludge which just ignores the notifications because - // a News host info never changes anyway. However we're not guaranteed - // that it will always be the case in the future. A bug report (#79163) - // has been opened asking the Back-End folks to fix the problem and - // reassign the bug to a Mac engineer in order to remove that kludge. - // - if (inChangeCode == MSG_NotifyChanged) - { - if (inRowCount == 1) - { - CMessageFolder folder(inStartRow, GetMessagePane()); - folder.FolderInfoChanged(); - UInt32 folderFlags = folder.GetFolderFlags(); - if (((folderFlags & MSG_FOLDER_FLAG_NEWS_HOST) != 0) && - ((folderFlags & MSG_FOLDER_FLAG_DIRECTORY) != 0)) - inChangeCode = MSG_NotifyNone; - } - } - // - //-------- - - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - - if (mMysticPlane < kMysticUpdateThreshHold) - { - switch (inChangeCode) - { - case MSG_NotifyScramble: - case MSG_NotifyAll: - UnselectAllCells(); - CMailFolderMixin::UpdateMailFolderMixins(); // This should really be somewhere else! - break; - - case MSG_NotifyInsertOrDelete: - CMailFolderMixin::UpdateMailFolderMixins(); - // When rows are inserted or deleted because the user has moved a folder hierarchy, - // then we have to invalidate the cache for the inserted rows, because - // the folder levels have possibly changed. This also applies to cmd_Clear, - // which (unless the option key is down) is a move in disguise. When expanding - // folders, we need to do this too, just to cover the case when a folder was - // moved into another folder and is now being displayed for the first time. - CommandT currentCommand = mContext->GetCurrentCommand(); - if ((currentCommand == cmd_MoveMailMessages - || currentCommand == cmd_Clear - || currentCommand == cmd_ExpandCellKludge) - && inRowCount > 0) - FoldersChanged(inStartRow, inRowCount); - break; - - case MSG_NotifyChanged: - if (mContext->GetCurrentCommand() == cmd_ExpandCellKludge) - mUpdateMailFolderMenusWhenComplete = true; - else - if (mUpdateMailFolderMenusOnNextUpdate) - { - mUpdateMailFolderMenusOnNextUpdate = false; - CMailFolderMixin::UpdateMailFolderMixins(); - } - else - { - FoldersChanged(inStartRow, inRowCount); - } - break; - } - } -} - - -//------------------------------------------------------------------------------ -// ¥ FoldersChanged -//------------------------------------------------------------------------------ -// Mark a range of folders as 'changed': invalidate the cached line for each. -// -void CSimpleFolderView::FoldersChanged( - TableIndexT inStartRow, - SInt32 inRowCount) const -{ - if (inRowCount < 0) - inRowCount = -inRowCount; - - for (SInt32 i = 0; i < inRowCount; i ++) - { - CMessageFolder folder(inStartRow + i, GetMessagePane()); - folder.FolderInfoChanged(); - } -} diff --git a/mozilla/cmd/macfe/MailNews/CSimpleFolderView.h b/mozilla/cmd/macfe/MailNews/CSimpleFolderView.h deleted file mode 100644 index a402cad4b6d..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSimpleFolderView.h +++ /dev/null @@ -1,137 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSimpleFolderView.h - -#pragma once - -#include "CMailFlexTable.h" - -class CThreadView; -class CThreadWindow; -class CStr255; -class CMessageFolder; - - - -//------------------------------------------------------------------------------ -// ¥ CSimpleFolderView -//------------------------------------------------------------------------------ -// -class CSimpleFolderView : public CMailFlexTable -{ -private: - typedef CMailFlexTable Inherited; - -public: - enum - { class_ID = 'SFVw' - }; - - CSimpleFolderView(LStream *inStream); - virtual ~CSimpleFolderView(); - -protected: - - //----------------------------------- - // Public folder fun - //----------------------------------- -public: - void LoadFolderList(CNSContext* inContext); - - //----------------------------------- - // Command implementation - //----------------------------------- - MSG_FolderInfo* GetSelectedFolder() const; - void SelectFirstFolderWithFlags(uint32 inFlags); - void SelectFolder(const MSG_FolderInfo* inFolderInfo); - void SelectHilitesWholeRow(const Boolean inWholeRow) - { mSelectHilitesWholeRow = inWholeRow;}; - virtual void DeleteSelection(); - - //----------------------------------- - // Drawing (specials from CStandardFlexTable) - //----------------------------------- -protected: - virtual ResIDT GetIconID(TableIndexT inRow) const; - virtual UInt16 GetNestedLevel(TableIndexT inRow) const; - - virtual TableIndexT GetHiliteColumn() const; - virtual Boolean GetHiliteTextRect( - const TableIndexT inRow, - Rect& outRect) const; - - virtual void ApplyTextStyle(TableIndexT inRow) const; - virtual void DrawCellContents( - const STableCell &inCell, - const Rect &inLocalRect); - - //----------------------------------- - // Hierarchy - //----------------------------------- - virtual Boolean CellHasDropFlag(const STableCell& inCell, Boolean& outIsExpanded) const; - virtual void SetCellExpansion(const STableCell& inCell, Boolean inExpand); - virtual void GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const; - - //----------------------------------- - // Commands - //----------------------------------- - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); -public: - - //----------------------------------- - // Messaging - //----------------------------------- - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - - //----------------------------------- - // Data change notification (callbacks from MSGlib) - //----------------------------------- - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - void FoldersChanged( - TableIndexT inStartRow, - SInt32 inRowCount) const; -protected: - void UpdateMailFolderMenusOnNextUpdate() - { mUpdateMailFolderMenusOnNextUpdate = true; } - - //----------------------------------- - // Data - //----------------------------------- - - Boolean mSelectHilitesWholeRow; // select whole row vs. just the name - - Boolean mUpdateMailFolderMenusWhenComplete; - Boolean mUpdateMailFolderMenusOnNextUpdate; -}; - diff --git a/mozilla/cmd/macfe/MailNews/CSubscribeView.cp b/mozilla/cmd/macfe/MailNews/CSubscribeView.cp deleted file mode 100644 index bbb7e26d18b..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSubscribeView.cp +++ /dev/null @@ -1,1188 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSubscribeView.cp - -#include "CSubscribeView.h" - -// MacOS -#include - -// PowerPlant -#include -#include - -// XP -#include "msgcom.h" - -// MacFE -#include "macutil.h" -#include "macgui.h" -#include "resgui.h" -#include "CPaneEnabler.h" - -// Mail/News Specific -#include "CMailNewsContext.h" -#include "CSubscribeWindow.h" -#include "MailNewsgroupWindow_Defines.h" -#include "UMailFolderMenus.h" -#include "UMailSelection.h" - -/* - -Overview: ---------- - - CSubscribeView: - It inherits from CMailFlexTable and displays the list of newsgroups. - It has 3 states (or MSG_SubscribeMode) which correspond to the 3 panels - of the CSubscribeWindow: All, Search and New. In each state, you can - select the newsgroups you want to subscribe to. - - CNewsgroup: - It corresponds to an entry in the CSubscribeView and allows - you to access to the properties of the entry. Its purpose - is more informational than functional. Most of the methods - are simple accessors. Some of them are not used but left - here for future generations. - - -Hints: ------- - - Loading of the newsgroup list is done in the idler because it's a synchronous - operation and we don't want it to be done before the window is displayed. It - could potentially take a long time. - - The methods you need to know about are RefreshList() and the usual - pair of FindCommandStatus() and ObeyCommand(). The rest is mostly for - internal use. - - Most of the commands handled by the CSubscribeView are of type cmd_NewsXXX - (cmd_NewsToggleSubscribe for instance) and they correspond to the different buttons - of the CSubscribeWindow. The commands which don't fit in that scheme (ie. for - which a higher and better level of abstraction might have been possible) are: - - * msg_EditField: sent by the editable field of the "All Groups" tab panel, - it allows to do a type-ahead search in the list of newsgroups. Enabled - here in FindCommandStatus() and processed by CSubscribeWindow. - - * cmd_OpenNewsHost: sent by the Add Server button. Enabled here in - FindCommandStatus() and processed by CSubscribeWindow. - - * msg_TabSelect: sent by the LTabGroup. Processed here. - - The communication with the news servers has two states. In the first one, - we download the list of newsgroup names: it happens the first time we - connect to the server (the list is then stored in a cache file), or - everytime we click the Get Groups button. In that state, the user is not - allowed to do anything except cancel or connect to another server. - In the second state, we download the number of postings in each newsgroup: - it happens everytime we switch to another tab panel or open a folder in - the list. Since it is much more common, it is done asynchronously and - all (or almost all) the commands must be available to the user. So, we have - two flags which indicate how busy we are. The first one, mStillLoading, - is inherited from CMailFlexTable and is set whenever we talk to the host. - The second flag, mStillLoadingFullList, is defined here and is set when - we downnload the newsgroup list. - - More info about the window in "CSubscribeWindow.cp". - -History: --------- - November 97: - Added the mCommitState for IMAP public folders support. It is set - when the user clicks OK: while the BE talks to the IMAP server, - the dialog is put in a state where the only possible action is - to click the Stop button. -*/ - - -enum -{ - kNormalMessageFolderIconID = 15238 -, kNewsgroupIconID = 15231 -, kSubscribedIconID = 15237 -, kUnsubscribedIconID = 15235 - -}; - -#define kIconMargin 4 -#define kIndentPerLevel 16 -#define kIconWidth 16 - - -#pragma mark --- CNewsgroup - -//---------------------------------------------------------------------------- -// CNewsgroup -// -// Constructor -// Cache functions -//---------------------------------------------------------------------------- - -MSG_GroupNameLine CNewsgroup::sNewsgroupData; -MSG_ViewIndex CNewsgroup::sCachedIndex; - - -CNewsgroup::CNewsgroup(TableIndexT inRow, MSG_Pane* inNewsgroupList) - : mIndex(inRow - 1) - , mNewsgroupList(inNewsgroupList) -{ - InvalidateCache(); - UpdateCache(); -} - -void CNewsgroup::InvalidateCache() const -{ - sCachedIndex = LONG_MAX; -} - -void CNewsgroup::UpdateCache() const -{ - if (mIndex != sCachedIndex) - { - MSG_GetGroupNameLineByIndex(mNewsgroupList, mIndex, 1, &sNewsgroupData); - sCachedIndex = mIndex; - } -} - - -//---------------------------------------------------------------------------- -// CNewsgroup / Newsgroup info accessor functions -// -// GetNewsgroupLine -// -// GetName -// GetPrettyName -// CountPostings -// GetLevel -// CanContainThreads -// CountChildren -// GetIconID -//---------------------------------------------------------------------------- - -MSG_GroupNameLine* CNewsgroup::GetNewsgroupLine() const -{ - UpdateCache(); - return &sNewsgroupData; -} - - -char* CNewsgroup::GetName() const { return GetNewsgroupLine()->name;} -char* CNewsgroup::GetPrettyName() const { return GetNewsgroupLine()->name;} -Int32 CNewsgroup::CountPostings() const { return GetNewsgroupLine()->total;} -UInt32 CNewsgroup::GetLevel() const { return GetNewsgroupLine()->level;} -Boolean CNewsgroup::CanContainThreads() const { return GetLevel() > kRootLevel;} - - -UInt32 CNewsgroup::CountChildren() const -{ - if (HasChildren()) - return sNewsgroupData.total; - return 0; -} - - -ResIDT CNewsgroup::GetIconID() const -{ - //¥ TO DO ¥: deal with the "Open" state, the "read" state, etc. - if (this->HasChildren()) - return kNormalMessageFolderIconID; - else - return kNewsgroupIconID; -} - - -//---------------------------------------------------------------------------- -// CNewsgroup / Flags accessor functions -// -// GetNewsgroupFlags -// -// IsOpen -// HasChildren -// IsSubscribed -// IsNew -//---------------------------------------------------------------------------- - -UInt32 CNewsgroup::GetNewsgroupFlags() const -{ - UpdateCache(); - return sNewsgroupData.flags; -} - - -Boolean CNewsgroup::IsOpen() const -{ - return ((GetNewsgroupFlags() & MSG_GROUPNAME_FLAG_ELIDED) == 0); -} - - -Boolean CNewsgroup::HasChildren() const -{ - return ((GetNewsgroupFlags() & MSG_GROUPNAME_FLAG_HASCHILDREN) != 0); -} - - -Boolean CNewsgroup::IsSubscribed() const -{ - return ((GetNewsgroupFlags() & MSG_GROUPNAME_FLAG_SUBSCRIBED) != 0); -} - - -Boolean CNewsgroup::IsNew() const -{ - return ((GetNewsgroupFlags() & MSG_GROUPNAME_FLAG_NEW_GROUP) != 0); -} - - -#pragma mark --- CSubscribeView - -//---------------------------------------------------------------------------- -// CSubscribeView Constructor/Destructor -// -//---------------------------------------------------------------------------- - -CSubscribeView::CSubscribeView(LStream *inStream) -: Inherited(inStream), - mStillLoadingFullList(false), - mCommitState(kIdle) -{ -} - - -CSubscribeView::~CSubscribeView() -{ -// Warning: Don't call MSG_DestroyPane() here: -// CMailFlexTable calls SetMessagePane(NULL) in its destructor. -} - - -//---------------------------------------------------------------------------- -// CloseParentWindow -// -//---------------------------------------------------------------------------- -void CSubscribeView::CloseParentWindow() -{ - CSubscribeWindow * myWindow = - dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (myWindow) - myWindow->AttemptClose(); -} - - -//---------------------------------------------------------------------------- -// SetProgressBarLaziness -// -//---------------------------------------------------------------------------- -void CSubscribeView::SetProgressBarLaziness( - CProgressListener::ProgressBarLaziness inLaziness) -{ - CSubscribeWindow * myWindow = - dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (myWindow) - { - CProgressListener * myProgress = myWindow->GetProgressListener(); - if (myProgress) - myProgress->SetLaziness(inLaziness); - } -} - - -//---------------------------------------------------------------------------- -// ProcessKeyPress -// -// Update buttons depending on the selection when scrolling through the list -//---------------------------------------------------------------------------- - -Boolean CSubscribeView::ProcessKeyPress(const EventRecord &inKeyEvent) -{ - Boolean keyHandled = Inherited::ProcessKeyPress(inKeyEvent); - CPaneEnabler::UpdatePanes(); - return keyHandled; -} - - -//---------------------------------------------------------------------------- -// GetIconID -// -//---------------------------------------------------------------------------- - -ResIDT CSubscribeView::GetIconID(TableIndexT inRow) const -{ - CNewsgroup newsgroup(inRow, GetMessagePane()); - return newsgroup.GetIconID(); -} - -//---------------------------------------------------------------------------- -// DrawCell -// -//---------------------------------------------------------------------------- - -void CSubscribeView::DrawCell(const STableCell& inCell, const Rect& inLocalRect) -{ - // check if we are in the update region - RgnHandle updateRgn = GetLocalUpdateRgn(); - if (!updateRgn) - return; - - Rect updateRect = (**updateRgn).rgnBBox; - ::DisposeRgn(updateRgn); - - Rect intersection; - if (!::SectRect(&updateRect, &inLocalRect, &intersection)) - return; - - // draw the cell - StClipRgnState savedClip; - ::ClipRect(&intersection); - PaneIDT cellType = GetCellDataType(inCell); - CNewsgroup newsgroup(inCell.row, GetMessagePane()); - switch (cellType) - { - case kNewsgroupNameColumn: - SInt16 newLeft = DrawIcons(inCell, inLocalRect); - Rect textRect = inLocalRect; - textRect.left = newLeft; - char groupName[cMaxMailFolderNameLength+1]; - if (GetHiliteText(inCell.row, groupName, sizeof(groupName), &textRect)) - DrawTextString(groupName, &mTextFontInfo, 0, textRect); - break; - - case kNewsgroupSubscribedColumn: - if (CanSubscribeToNewsgroup(newsgroup)) - { - short iconID = (newsgroup.IsSubscribed() ? - kSubscribedIconID : kUnsubscribedIconID); - DrawIconFamily(iconID, 16, 16, 0, inLocalRect); - } - break; - - case kNewsgroupPostingsColumn: - if (CanSubscribeToNewsgroup(newsgroup)) - DrawCountCell(newsgroup.CountPostings(), inLocalRect); - break; - - } -} - - -//---------------------------------------------------------------------------- -// RefreshList -// -//---------------------------------------------------------------------------- - -void CSubscribeView::RefreshList(MSG_Host* newsHost, MSG_SubscribeMode subscribeMode) -{ - mNewsHost = newsHost; - mSubscribeMode = subscribeMode; - StartIdling(); -} - - -//---------------------------------------------------------------------------- -// SpendTime -// -//---------------------------------------------------------------------------- - -void CSubscribeView::SpendTime(const EventRecord &) -{ - // stop idling first (avoid infinite recursive calls if BE calls FE_Alert) - StopIdling(); - - Assert_(mContext != NULL); - if (mContext == NULL) - return; - - StSpinningBeachBallCursor beachBallCursor; - - // create the list - if (GetMessagePane() == NULL) - { - SetMessagePane(MSG_CreateSubscribePaneForHost( - *mContext, CMailNewsContext::GetMailMaster(), mNewsHost)); - ThrowIfNULL_(GetMessagePane()); - MSG_SetFEData(GetMessagePane(), CMailCallbackManager::Get()); - - // force a refresh of the postings count - SetProgressBarLaziness(CProgressListener::lazy_VeryButForThisCommandOnly); - MSG_Command(GetMessagePane(), MSG_UpdateMessageCount, NULL, NULL); - } - else - { - // display the list (it is read from the cache file) - SetProgressBarLaziness(CProgressListener::lazy_VeryButForThisCommandOnly); - MSG_SubscribeSetHost(GetMessagePane(), mNewsHost); - } - MSG_SubscribeSetMode(GetMessagePane(), mSubscribeMode); - - switch (mSubscribeMode) - { - case MSG_SubscribeAll: - MSG_GroupNameLine aLine; - // If the list (ie. the cache file) is empty, download it from the server. - if (! MSG_GetGroupNameLineByIndex(GetMessagePane(), 0, 1, &aLine)) - { - SetProgressBarLaziness(CProgressListener::lazy_JustABit); - MSG_Command(GetMessagePane(), MSG_FetchGroupList, NULL, NULL); - } - break; - - case MSG_SubscribeSearch: - // don't get the list yet: wait until user clicks Search button - break; - - case MSG_SubscribeNew: - // Always get the list of new newsgroups from the server - SetProgressBarLaziness(CProgressListener::lazy_VeryButForThisCommandOnly); - MSG_Command(GetMessagePane(), MSG_CheckForNew, NULL, NULL); - break; - } - - // notify ourselves - NotifySelfAll(); - - // Since fetching the group list is a synchronous operation, we may have a lot of - // unresponded to clicks and key strokes in the event queue. Flush them. - ::FlushEvents(mDownMask | mUpMask | keyDownMask | keyUpMask | autoKeyMask, 0); -} - - -//---------------------------------------------------------------------------- -// SearchForString -// -//---------------------------------------------------------------------------- -void CSubscribeView::SearchForString(const StringPtr searchStr) -{ - P2CStr(searchStr); - switch (MSG_SubscribeGetMode(GetMessagePane())) - { - case MSG_SubscribeAll: - MSG_ViewIndex theRow; - theRow = MSG_SubscribeFindFirst(GetMessagePane(), (const char *)searchStr); - STableCell theCell(theRow + 1, 1); - SetNotifyOnSelectionChange(false); - UnselectAllCells(); - SetNotifyOnSelectionChange(true); - SelectCell(theCell); - ScrollCellIntoFrame(theCell); - CPaneEnabler::UpdatePanes(); - break; - - case MSG_SubscribeSearch: - MSG_SubscribeFindAll(GetMessagePane(), (const char *)searchStr); - // beep when list is empty - MSG_GroupNameLine aLine; - if (! MSG_GetGroupNameLineByIndex(GetMessagePane(), 0, 1, &aLine)) - ::SysBeep(1); - break; - } -} - - -//---------------------------------------------------------------------------- -// SubscribeCancel -// -//---------------------------------------------------------------------------- -void CSubscribeView::SubscribeCancel() -{ - if (GetMessagePane() != NULL) - MSG_SubscribeCancel(GetMessagePane()); - CloseParentWindow(); -} - - -//---------------------------------------------------------------------------- -// SubscribeCommit -// -//---------------------------------------------------------------------------- -void CSubscribeView::SubscribeCommit() -{ - if (GetMessagePane() != NULL) - { - mContext->AddListener(this); - if (XP_IsContextBusy(*mContext)) - { - mCommitState = kInterrupting; - XP_InterruptContext(*mContext); - } - else - { - mCommitState = kCommitting; - MSG_SubscribeCommit(GetMessagePane()); - } - } - else - CloseParentWindow(); -} - - -//---------------------------------------------------------------------------- -// CellHasDropFlag -// -//---------------------------------------------------------------------------- - -Boolean CSubscribeView::CellHasDropFlag( - const STableCell& inCell, - Boolean& outIsExpanded) const -{ - PaneIDT cellType = GetCellDataType(inCell); - CNewsgroup newsgroup(inCell.row, GetMessagePane()); - if (cellType == kNewsgroupNameColumn && newsgroup.CountChildren() != 0) - { - outIsExpanded = newsgroup.IsOpen(); - return true; - } - return false; -} - - -//---------------------------------------------------------------------------- -// SetCellExpansion -// -//---------------------------------------------------------------------------- - -void CSubscribeView::SetCellExpansion( - const STableCell& inCell, - Boolean inExpand) -{ - CNewsgroup newsgroup(inCell.row, GetMessagePane()); - if (inExpand == newsgroup.IsOpen()) - return; - ToggleExpandAction(inCell.row); -} - -//------------------------------------------------------------------------------ -// GetNestedLevel -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Return the ident for that row. -// This method goes together with GetHiliteTextRect(). -// -UInt16 CSubscribeView::GetNestedLevel(TableIndexT inRow) const -{ - CNewsgroup newsgroup(inRow, GetMessagePane()); - return newsgroup.GetLevel(); -} - -//------------------------------------------------------------------------------ -// GetHiliteColumn -//------------------------------------------------------------------------------ -// From CStandardFlexTable. When a row is selected, we can -// hilite the whole row or just the folder name. -// This method goes together with GetHiliteTextRect(). -// -TableIndexT CSubscribeView::GetHiliteColumn() const -{ - return mTableHeader->ColumnFromID(kNewsgroupNameColumn); -} - - -//------------------------------------------------------------------------------ -// GetHiliteTextRect -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Pass back the rect to hilite for that row (either -// the whole row, either just the folder name). Return true if rect is not empty. -// This method goes together with GetHiliteColumn() and GetNestedLevel(). -// -Boolean CSubscribeView::GetHiliteTextRect( - const TableIndexT inRow, - Rect& outRect) const -{ - STableCell cell(inRow, GetHiliteColumn()); - if (!GetLocalCellRect(cell, outRect)) - return false; - - Rect iconRect; - GetIconRect(cell, outRect, iconRect); - outRect.left = iconRect.right; - char folderName[cMaxMailFolderNameLength + 1]; - GetHiliteText(inRow, folderName, sizeof(folderName), &outRect); - return true; -} - - -//------------------------------------------------------------------------------ -// GetMainRowText -//------------------------------------------------------------------------------ -// From CStandardFlexTable. Return the folder name for that row. -// -void CSubscribeView::GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -{ - if (!outText || inMaxBufferLength == 0) - return; - - if (inMaxBufferLength < cMaxMailFolderNameLength + 1) - { - *outText = '\0'; - return; - } - - CNewsgroup newsgroup(inRow, GetMessagePane()); - // ¥¥¥ FIX ME -> Get the BE to store the newsgroup name already unescaped - XP_STRCPY(outText, newsgroup.GetPrettyName()); - NET_UnEscape(outText); -} - - -//---------------------------------------------------------------------------- -// ChangeStarting -// -//---------------------------------------------------------------------------- - -void CSubscribeView::ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -{ - switch ( inChangeCode ) - { - case MSG_NotifyScramble: - case MSG_NotifyAll: - mStillLoadingFullList = true; - break; - } - - Inherited::ChangeStarting(inPane, inChangeCode, inStartRow, inRowCount); -} - -//---------------------------------------------------------------------------- -// ChangeFinished -// -//---------------------------------------------------------------------------- - -void CSubscribeView::ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -{ - switch ( inChangeCode ) - { - case MSG_NotifyScramble: - case MSG_NotifyAll: - mStillLoadingFullList = false; - break; - } - - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - - if ( mMysticPlane < kMysticUpdateThreshHold ) - { - switch ( inChangeCode ) - { - case MSG_NotifyScramble: - case MSG_NotifyAll: - UnselectAllCells(); - break; - } - } -} - -//---------------------------------------------------------------------------- -// OpenRow -// -//---------------------------------------------------------------------------- -// Called on enter/return or double-click. -// Hack: don't do anything when multiple items are selected. -// -void CSubscribeView::OpenRow(TableIndexT inRow) -{ - if (inRow > 0) - { - CMailSelection selection; - if (selection.selectionSize <= 1) - { - STableCell aCell(inRow, 1); - Boolean outIsExpanded; - if (CellHasDropFlag(aCell, outIsExpanded)) - { - MSG_ToggleExpansion (GetMessagePane(), inRow - 1, NULL); - } - } - } -} - - -//---------------------------------------------------------------------------- -// ListenToMessage -// -//---------------------------------------------------------------------------- - -void CSubscribeView::ListenToMessage(MessageT inMessage, void* ioParam) -{ - if (! ObeyCommand(inMessage, ioParam)) // check button messages first - { - switch (inMessage) - { - case msg_NSCAllConnectionsComplete: - if (mCommitState == kInterrupting) - { - mCommitState = kCommitting; - MSG_SubscribeCommit(GetMessagePane()); - } - else if (mCommitState == kCommitting) - { - mCommitState = kIdle; - CloseParentWindow(); // the window is closed here... - return; // ...so exit now because I'm dead - } - /* no break; */ - - default: - Inherited::ListenToMessage(inMessage, ioParam); - break; - } - } -} - - -//---------------------------------------------------------------------------- -// FindCommandStatus -// -//---------------------------------------------------------------------------- - -void CSubscribeView::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - // The pane can be null when no server has been configured. - // In that case, we only enable the Add Server button. - if (GetMessagePane() == NULL) - { - outEnabled = (inCommand == cmd_OpenNewsHost); - return; - } - - // When committing, allow only the Stop button... - if (mCommitState == kCommitting) - { - outEnabled = (inCommand == cmd_Stop); - return; - } - else if (mCommitState == kInterrupting) - { - outEnabled = false; - return; - } - - // ...otherwise the Stop button is enabled whenever we talk to the server - if (inCommand == cmd_Stop) - { - outEnabled = (mStillLoading | mStillLoadingFullList); - return; - } - - // Handle basic commands as long as we're not - // downloading the full newsgroups list - if (! mStillLoadingFullList) - { - if (FindMessageLibraryCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName)) - return; - } - - switch (inCommand) - { - case msg_EditField: // similar in behaviour to cmd_NewsSearch - case cmd_OpenNewsHost: - case cmd_NewsHostChanged: - case cmd_NewsToggleSubscribe: - case cmd_NewsSetSubscribe: - case cmd_NewsClearSubscribe: - case cmd_NewsExpandGroup: - case cmd_NewsExpandAll: - case cmd_NewsCollapseGroup: - case cmd_NewsCollapseAll: - case cmd_NewsGetGroups: - case cmd_NewsSearch: - case cmd_NewsGetNew: - case cmd_NewsClearNew: - FindSubscribeCommandStatus(inCommand, outEnabled); - break; - - default: - Inherited::FindCommandStatus( - inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} - - -//---------------------------------------------------------------------------- -// FindSubscribeCommandStatus -// -//---------------------------------------------------------------------------- -void CSubscribeView::FindSubscribeCommandStatus( - CommandT inCommand, - Boolean &outEnabled) -{ - Assert_(GetMessagePane() != NULL); - if (GetMessagePane() == NULL) - { - outEnabled = false; - return; - } - - // When downloading the newsgroups list, can't do - // anything but connect to a different server. - if (mStillLoadingFullList) - { - outEnabled = (inCommand == cmd_NewsHostChanged); - return; - } - - // When connected to an IMAP server, the Search and New tab panels - // are completely disabled except for connect to a different server. - if (MSG_IsIMAPHost(mNewsHost)) - { - switch (MSG_SubscribeGetMode(GetMessagePane())) - { - case MSG_SubscribeSearch: - case MSG_SubscribeNew: - outEnabled = (inCommand == cmd_NewsHostChanged); - return; // <-- note it - } - } - - switch (inCommand) - { - // Expand All is enabled if the selection - // contains a non-expanded folder and - // if the host is not an IMAP host - case cmd_NewsExpandAll: - { - if (! MSG_IsIMAPHost(mNewsHost)) - { - CMailSelection selection; - GetSelection(selection); - if (selection.selectionSize > 0) - { - STableCell aCell; - Boolean outIsExpanded; - for (long index = 0; index < selection.selectionSize; index ++) - { - aCell.SetCell(selection.GetSelectionList()[index] + 1, 1); - if (CellHasDropFlag(aCell, outIsExpanded) && (! outIsExpanded)) - { - outEnabled = true; - break; - } - } - } - } - } - break; - - // These commands require a selection. Note: Collapse All - // does not really require a selection but it is prettier - // when it is not activated just after the list is displayed. - case cmd_NewsToggleSubscribe: - case cmd_NewsExpandGroup: - case cmd_NewsCollapseGroup: - case cmd_NewsCollapseAll: - { - CMailSelection selection; - GetSelection(selection); - outEnabled = (selection.selectionSize > 0); - } - break; - - // These commands require a selection _and_ the subscribed/unsubscribed - // state of the selected items must match the command. - case cmd_NewsSetSubscribe: - case cmd_NewsClearSubscribe: - { - Boolean lookingForBool = (inCommand == cmd_NewsSetSubscribe ? false : true); - - CMailSelection selection; - if (GetSelection(selection)) - { - const MSG_ViewIndex* index = selection.GetSelectionList(); - for (int i = 0; i < selection.selectionSize; i ++, index++) - { - CNewsgroup newsgroup((*index + 1), GetMessagePane()); // add one to convert to TableIndexT - if (CanSubscribeToNewsgroup(newsgroup)) - { - if (lookingForBool == newsgroup.IsSubscribed()) - { - outEnabled = true; // found what I was looking for - break; - } - } - } - } - } - break; - - // Don't enable Get Groups when I'm downloading the number of postings. - // This is not required but forcing the user to click Stop before is - // a way to notify him that something is going on on the network. - case cmd_NewsGetGroups: - outEnabled = (! mStillLoading); - break; - - // This commands are always enabled, except when downloading - // the newsgroups list but this is checked above - case msg_EditField: // similar in behaviour to cmd_NewsSearch - case cmd_NewsSearch: - case cmd_NewsGetNew: - case cmd_NewsClearNew: - default: - outEnabled = true; - break; - } -} - - -//---------------------------------------------------------------------------- -// ObeyCommand -// -//---------------------------------------------------------------------------- - -Boolean CSubscribeView::ObeyCommand( - CommandT inCommand, - void *ioParam) -{ - Boolean result = false; - mContext->SetCurrentCommand(inCommand); - switch(inCommand) - { - //----------------------------------- - // TabGroup command - //----------------------------------- - case msg_TabSelect: - if (GetMessagePane() != NULL) - { - CMailSelection selection; - GetSelection(selection); - if (selection.selectionSize == 0) - { - // set a selection to activate the button enablers - STableCell cell(1,1); - SelectCell(cell); - } - } - result = true; - break; - - //----------------------------------- - // Button commands - //----------------------------------- - -// now handled by the window -// case cmd_NewsHostChanged: -// if (mStillLoading || mStillLoadingFullList) -// ObeyCommand(cmd_Stop, NULL); -// MSG_Host* newsHost = (MSG_Host*)(ioParam); -// RefreshList(newsHost, MSG_SubscribeGetMode(GetMessagePane())); -// result = true; -// break; - - case cmd_NewsExpandAll: - case cmd_NewsCollapseAll: - case cmd_NewsToggleSubscribe: - case cmd_NewsSetSubscribe: - case cmd_NewsClearSubscribe: - case cmd_NewsGetGroups: - case cmd_NewsGetNew: - case cmd_NewsClearNew: - MSG_CommandType theCommand; - switch (inCommand) - { - case cmd_NewsExpandAll: theCommand = MSG_ExpandAll; break; - case cmd_NewsCollapseAll: theCommand = MSG_CollapseAll; break; - case cmd_NewsToggleSubscribe: theCommand = MSG_ToggleSubscribed; break; - case cmd_NewsSetSubscribe: theCommand = MSG_SetSubscribed; break; - case cmd_NewsClearSubscribe: theCommand = MSG_ClearSubscribed; break; - case cmd_NewsGetGroups: theCommand = MSG_FetchGroupList; break; - case cmd_NewsGetNew: theCommand = MSG_CheckForNew; break; - case cmd_NewsClearNew: theCommand = MSG_ClearNew; break; - } - - if (inCommand == cmd_NewsExpandAll || inCommand == cmd_NewsCollapseAll) - UCursor::SetWatch(); - - CMailSelection selection; // not all commands require the selection... - GetSelection(selection); // ...in these cases, it will just be ignored - MSG_Command(GetMessagePane(), - theCommand, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize - ); - - UCursor::SetArrow(); - result = true; - break; - - //----------------------------------- - // MSGLIB commands - //----------------------------------- - default: - if (inCommand == cmd_Stop) - { - if (mCommitState != kIdle) - { - mCommitState = kIdle; - mContext->RemoveListener(this); - } - } - result = (ObeyMessageLibraryCommand(inCommand, ioParam) - || Inherited::ObeyCommand(inCommand, ioParam)); - break; - } - return result; -} - -//---------------------------------------------------------------------------- -// ClickSelect -// -// Handle clicks in the Subscribe column. -//---------------------------------------------------------------------------- - -Boolean CSubscribeView::ClickSelect( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -{ - PaneIDT cellType = GetCellDataType(inCell); - if (cellType == kNewsgroupSubscribedColumn) - return true; - else - return Inherited::ClickSelect(inCell, inMouseDown); -} - -//---------------------------------------------------------------------------- -// ClickCell -// -// Handle clicks in the Subscribe column. -//---------------------------------------------------------------------------- - -void CSubscribeView::ClickCell( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown) - -{ - Boolean clickInSubscribeColumn = false; - - PaneIDT cellType = GetCellDataType(inCell); - if (cellType == kNewsgroupSubscribedColumn) - { - CNewsgroup newsgroup(inCell.row, GetMessagePane()); - if (CanSubscribeToNewsgroup(newsgroup)) - { - clickInSubscribeColumn = true; - Inherited::ClickCell(inCell, inMouseDown); - - MSG_ViewIndex viewIndex = inCell.row - 1; - MSG_Command(GetMessagePane(), MSG_ToggleSubscribed, &viewIndex, 1); - } - } - - if (! clickInSubscribeColumn) - Inherited::ClickCell(inCell, inMouseDown); -} - - -//---------------------------------------------------------------------------- -// GetQapRowText -// -// Return info for QA Partner -//---------------------------------------------------------------------------- - -#if defined(QAP_BUILD) -void CSubscribeView::GetQapRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -{ - if (!outText || inMaxBufferLength == 0) - return; - - cstring rowText(""); - short colCount = mTableHeader->CountVisibleColumns(); - CNewsgroup newsgroup(inRow, GetMessagePane()); - - CMailNewsWindow * myWindow = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (!myWindow) return; - - for (short col = 1; col <= colCount; col ++) - { - STableCell aCell(inRow, col); - LTableHeader::SColumnData * colData = mTableHeader->GetColumnData(col); - if (!colData) break; - LPane * colPane = myWindow->FindPaneByID(colData->paneID); - if (!colPane) break; - - // get column name - CStr255 descriptor; - colPane->GetDescriptor(descriptor); - rowText += descriptor; - rowText += "=\042"; - - // add cell text - switch (PaneIDT dataType = GetCellDataType(aCell)) - { - - case kNewsgroupNameColumn: - if (newsgroup.CountChildren() != 0) - { - if (newsgroup.IsOpen()) - rowText += "-"; - else - rowText += "+"; - } - else - rowText += " "; - rowText += newsgroup.GetName(); - break; - - case kNewsgroupSubscribedColumn: - if (CanSubscribeToNewsgroup(newsgroup)) - if (newsgroup.IsSubscribed()) - rowText += "+"; - break; - - case kNewsgroupPostingsColumn: - int theNum = newsgroup.CountPostings(); - if (theNum >= 0) - { - char tempStr[32]; - sprintf(tempStr, "%d", theNum); - rowText += tempStr; - } - else - rowText += "?"; - break; - } - - if (col < colCount) - rowText += "\042 | "; - else - rowText += "\042\r"; - } - strncpy(outText, (char*)rowText, inMaxBufferLength); - outText[inMaxBufferLength - 1] = '\0'; -} // CSubscribeView::GetQapRowText -#endif //QAP_BUILD diff --git a/mozilla/cmd/macfe/MailNews/CSubscribeView.h b/mozilla/cmd/macfe/MailNews/CSubscribeView.h deleted file mode 100644 index 5e94f918c4a..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSubscribeView.h +++ /dev/null @@ -1,228 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSubscribeView.h - -#pragma once - -// PowerPlant -#include -#include - -// Mail/News FE -#include "CMailFlexTable.h" -#include "CProgressListener.h" - -#define kRootLevel 1 // news host, local mail etc. - -//---------------------------------------------------------------------------- -// CNewsgroup -// -//---------------------------------------------------------------------------- - -class CNewsgroup -{ -public: - CNewsgroup(TableIndexT inRow, MSG_Pane* inNewsgroupList); - - // Cache management - void InvalidateCache() const; - void UpdateCache() const; - - // misc. info accessors - MSG_GroupNameLine* GetNewsgroupLine() const; - char* GetName() const; - char* GetPrettyName() const; - Int32 CountPostings() const; // neg if unknown - UInt32 GetLevel() const; - Boolean CanContainThreads() const; - UInt32 CountChildren() const; - ResIDT GetIconID() const; - - // Flag property accessors: - UInt32 GetNewsgroupFlags() const; - Boolean IsOpen() const; - Boolean HasChildren() const; - Boolean IsSubscribed() const; - Boolean IsNew() const; - - - // Data -public: - MSG_ViewIndex mIndex; - -protected: - static MSG_GroupNameLine sNewsgroupData; - static MSG_ViewIndex sCachedIndex; - MSG_Pane* mNewsgroupList; -}; - - - -//---------------------------------------------------------------------------- -// CSubscribeView -// -//---------------------------------------------------------------------------- - -class CSubscribeView : public CMailFlexTable, - public LPeriodical -{ -private: - typedef CMailFlexTable Inherited; - -public: - CSubscribeView(LStream *inStream); - enum { class_ID = 'subV' }; - virtual ~CSubscribeView(); - - //----------------------------------- - // Public folder fun - //----------------------------------- - void SetContext(CNSContext* inContext) - {mContext = inContext;}; - - void RefreshList( - MSG_Host* newsHost, - MSG_SubscribeMode subscribeMode); - - void SearchForString(const StringPtr searchStr); - - virtual void SubscribeCancel(); - virtual void SubscribeCommit(); - - - //----------------------------------- - // Command implementation - //----------------------------------- - virtual void OpenRow(TableIndexT inRow); - - virtual Boolean ProcessKeyPress( - const EventRecord& inKeyEvent); - - virtual void DrawCell( - const STableCell &inCell, - const Rect &inLocalRect); - - //----------------------------------- - // Hierarchy - //----------------------------------- - virtual Boolean CellHasDropFlag( - const STableCell& inCell, - Boolean& outIsExpanded) const; - - virtual void SetCellExpansion( - const STableCell& inCell, - Boolean inExpand); - - virtual TableIndexT GetHiliteColumn() const; - virtual UInt16 GetNestedLevel(TableIndexT inRow) const; - virtual Boolean GetHiliteTextRect( - const TableIndexT inRow, - Rect& outRect) const; - virtual void GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const; - virtual ResIDT GetIconID(TableIndexT inRow) const; - - - virtual void DeleteSelection(void) { /* do nothing */ }; - - - //----------------------------------- - // Commands - //----------------------------------- - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); - - virtual Boolean ClickSelect( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - virtual void ClickCell( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - - //----------------------------------- - // Messaging - //----------------------------------- -protected: - virtual void ListenToMessage( - MessageT inMessage, - void *ioParam); - - virtual void FindSubscribeCommandStatus( - CommandT inCommand, - Boolean &outEnabled); - - virtual void SpendTime(const EventRecord &); - - //----------------------------------- - // Other - //----------------------------------- - virtual void CloseParentWindow(); - void SetProgressBarLaziness( - CProgressListener::ProgressBarLaziness inLaziness); - Boolean CanSubscribeToNewsgroup(const CNewsgroup& newsgroup) const - { return ((newsgroup.CountChildren() == 0) || MSG_IsIMAPHost(mNewsHost));} - - - //----------------------------------- - // Data change notification - // Callbacks from MSGlib come here. - //----------------------------------- - virtual void ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - - // ------------------------------------------------------------ - // QA Partner support - // ------------------------------------------------------------ -#if defined(QAP_BUILD) -public: - virtual void GetQapRowText(TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const; -#endif - - //----------------------------------- - // Data - //----------------------------------- - Boolean mStillLoadingFullList; - -private: - MSG_Host* mNewsHost; - MSG_SubscribeMode mSubscribeMode; - enum { kIdle, kInterrupting, kCommitting } mCommitState; -}; diff --git a/mozilla/cmd/macfe/MailNews/CSubscribeWindow.cp b/mozilla/cmd/macfe/MailNews/CSubscribeWindow.cp deleted file mode 100644 index 879a875b221..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSubscribeWindow.cp +++ /dev/null @@ -1,871 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSubscribeWindow.cp - -#include "CSubscribeWindow.h" -#include "CSubscribeView.h" -#include "CMailNewsContext.h" -#include "CNewsSubscriber.h" -#include "CProgressListener.h" -#include "CPaneEnabler.h" -#include "CTabControl.h" -#include "URobustCreateWindow.h" -#include "UMenuUtils.h" -#include "UMailFolderMenus.h" - -#include -#include -#include -#include "CLargeEditField.h" -#include "macgui.h" -//#include "newshost.h" -#include "miconutils.h" -#include "MercutioAPI.h" - -extern "C" { - #include "asyncCursors.h" -} - -// Command Numbers -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" - - -/* - -Overview: ---------- - - CSubscribeWindow: - This window displays the list of newsgroups available on the - different news servers and lets you select the newsgroups you - want to subscribe to. Technically speaking, the CSubscribeWindow - handles the interactions between a CSubscribeView and a small bunch - of buttons and edit fields, plus sother elements listed below. - - CSubscribeHostPopup: - Popup menu to select the news server you want to connect to. - - CNewsHostIterator: - Simple iterator to access the list of news servers. - Used by the CSubscribeHostPopup. - - -Hints: ------- - The newsgroup list (a CSubscribeView) should not be disposed when switching - panels in order to keep its state (ie. its Context) and not reload it - everytime from the cache file or from the server. The list is originally - attached to the window and when a panel is activated, a CPlaceHolderView - puts it inside the panel. The list is linked where it belongs in the commander - chain after the CTabControl broadcasts the activation of a tab panel. - - We have a similar problem with the CSubscribeHostPopup: it must keep its - state when switching panels. This is done by storing the last selected - host in a static variable of the CNewsSubscriber (which has been delegated - this role because it only contains static stuff). The same static variable - is used when bringing up the CSubscribeWindow in order to display the list - corresponding to the host currently selected in the Message Center. - - More info about the list in "CSubscribeView.cp". - -History: --------- - November 97: - Converted BE calls to the new API in order to support IMAP public folders. - Added Mercutio callback to display imap/news server icons in the popup menu. - - March 98: - Disabled "Search" and "New" panels when an IMAP host is selected. It required to - put the host popup menu in a CPlaceHolderView too in order to avoid deleting - and recreating it when a switch from a News host to an IMAP host causes - the tab panel to automatically display "All Groups" (it's bad to delete a - control when it's broadcasting). -*/ - - -static const ResIDT resID_SubscribeTab1 = 14002; // PPob resources -static const ResIDT resID_SubscribeTab2 = 14003; -static const ResIDT resID_SubscribeTab3 = 14004; -static const ResIDT resID_SubscribeWindow = 14006; - -static const PaneIDT paneID_OkButton = 'BtOk'; // generic buttons -static const PaneIDT paneID_CancelButton = 'Canc'; -static const PaneIDT paneID_EditField = 'NuEd'; -static const PaneIDT paneID_FolderList = 'Slst'; -static const PaneIDT paneID_FolderView = 'SbVw'; -static const PaneIDT paneID_TabSwitcher = 'SbTb'; -static const PaneIDT paneID_TabControl = 'TabC'; -static const PaneIDT paneID_SubscribeButton = 'Subs'; -static const PaneIDT paneID_UnsubscribeButton = 'UnSb'; -static const PaneIDT paneID_ServerPopup = 'SPop'; -static const PaneIDT paneID_StopButton = 'Stop'; - -static const PaneIDT paneID_AllTabPanel = 'Sub1'; // tab #1 buttons -static const PaneIDT paneID_ExpandButton = 'Expn'; -static const PaneIDT paneID_CollapseButton = 'Coll'; -static const PaneIDT paneID_GetGroupsButton = 'GetG'; -static const PaneIDT paneID_AddServerButton = 'AddS'; - -static const PaneIDT paneID_SearchTabPanel = 'Sub2'; // tab #2 buttons -static const PaneIDT paneID_SearchButton = 'Srch'; - -static const PaneIDT paneID_NewTabPanel = 'Sub3'; // tab #3 buttons -static const PaneIDT paneID_GetNewButton = 'GetN'; -static const PaneIDT paneID_ClearNewButton = 'ClrN'; - - -//---------------------------------------------------------------------------- -// USubscribeUtilities -// -//---------------------------------------------------------------------------- - -//#define REGISTER_(letter,root) \ -// RegisterClass_(letter##root::class_ID, \ -// (ClassCreatorFunc)letter##root::Create##root##Stream); - -#define REGISTER_(letter,root) \ - RegisterClass_(letter##root); - -#define REGISTERC(root) REGISTER_(C,root) -#define REGISTERL(root) REGISTER_(L,root) - - -void USubscribeUtilities::RegisterSubscribeClasses() -{ - REGISTERC(SubscribeWindow) - REGISTERC(SubscribeHostPopup) - REGISTERC(TabContainer) // reusing CTabContainer from CMailComposeWindow.cp -} - - -#pragma mark - - -//---------------------------------------------------------------------------- -// CNewsHostIterator -// -//---------------------------------------------------------------------------- -MSG_Host* CNewsHostIterator::mHostList[CNewsHostIterator::kMaxNewsHosts]; -Int32 CNewsHostIterator::mHostCount = 0; - -CNewsHostIterator::CNewsHostIterator(MSG_Master* master) -{ - mHostCount = MSG_GetSubscribingHosts(master, - &mHostList[0], - CNewsHostIterator::kMaxNewsHosts); - mIndex = 0; -} - - -Boolean CNewsHostIterator::Current(MSG_Host*& outNewsHost) -{ - outNewsHost = nil; - if (mIndex < mHostCount) - outNewsHost = mHostList[mIndex]; - return (outNewsHost != nil); -} - - -Boolean CNewsHostIterator::Next(MSG_Host*& outNewsHost) -{ - Boolean valid = Current(outNewsHost); - ResetTo(GetCurrentIndex() + 1); - return valid; -} - - -Boolean CNewsHostIterator::FindIndex(const MSG_Host* inNewsHost, Int32& outIndex) -{ - Int32 index; - for (index = 0; index < mHostCount; index ++) - { - if (inNewsHost == mHostList[index]) - { - outIndex = index; - return true; - } - } - outIndex = 0; - return false; -} - - -#pragma mark - - - -//---------------------------------------------------------------------------- -// FindAndShow [static] -// Handle the menu command that creates/shows/selects the MailNews window. -// Currently there can only be one of these. -//---------------------------------------------------------------------------- - -CSubscribeWindow* CSubscribeWindow::FindAndShow(Boolean makeNew) -{ - CSubscribeWindow* result = NULL; - try - { - CWindowIterator iter(WindowType_SubscribeNews); - iter.Next(result); - if (!result && makeNew) - { - result = dynamic_cast - (URobustCreateWindow::CreateWindow( - res_ID, LCommander::GetTopCommander())); - ThrowIfNULL_(result); - } - if (result) - { - result->Show(); - result->Select(); - } - } - catch( ... ) - { - } - return result; -} - - -//------------------------------------------------------------------------------ -// DisplayDialog [static] -//------------------------------------------------------------------------------ - -Boolean CSubscribeWindow::DisplayDialog() -{ - StDialogHandler handler(res_ID, NULL); - - MessageT message; - do - { - message = handler.DoDialog(); - } while (message != paneID_OkButton && message != paneID_CancelButton); - - return (message == paneID_OkButton); -} - - -//---------------------------------------------------------------------------- -// CSubscribeWindow Constructor / Destructor -// -//---------------------------------------------------------------------------- - -CSubscribeWindow::CSubscribeWindow(LStream* inStream) : - CMailNewsWindow(inStream, WindowType_SubscribeNews), - mList(nil) -{ -} - -CSubscribeWindow::~CSubscribeWindow() -{ - stopAsyncCursors(); -} - - -//---------------------------------------------------------------------------- -// FinishCreateSelf -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::FinishCreateSelf() -{ - // Finish create context and other things - Inherited::FinishCreateSelf(); - - mProgressListener->SetLaziness(CProgressListener::lazy_JustABit); - - mList = dynamic_cast(GetActiveTable()); - if (mList) mList->SetContext((CMailNewsContext*)this->GetWindowContext()); - - // Hook up listeners - UReanimator::LinkListenerToControls(this, this, GetPaneID()); - - CTabControl* tabControl = dynamic_cast(FindPaneByID(paneID_TabControl)); - if (tabControl) tabControl->AddListener(this); - - // Initialize dialog to display first tab (hack because the CTabControl has - // already broadcasted its value message but nobody was listening at that time) - long msg = resID_SubscribeTab1; - ListenToMessage(msg_TabSwitched, &msg); - - // "Search" and "New" are not supported for IMAP - if (MSG_IsIMAPHost(CNewsSubscriber::GetHost())) - { - CTabControl* tabControl = dynamic_cast(FindPaneByID(paneID_TabControl)); - Assert_(tabControl); - tabControl->SetTabEnable(resID_SubscribeTab2, false); - tabControl->SetTabEnable(resID_SubscribeTab3, false); - } -} - - -//---------------------------------------------------------------------------- -// DoClose -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::DoClose() -{ - // Update the Mail Folder popup menu - CMailFolderMixin::UpdateMailFolderMixins(); - - // Update the Message Center - CMailNewsFolderWindow* messageCenter = NULL; - CWindowIterator iter(WindowType_MailNews); - iter.Next(messageCenter); - if (messageCenter) - { - messageCenter->Refresh(); - } - - // Close window - Inherited::DoClose(); -} - - -//---------------------------------------------------------------------------- -// GetActiveTable -// -// Get the currently active table in the window. The active table is -// the table in the window that the user considers to be receiving input. -//---------------------------------------------------------------------------- - -CMailFlexTable* CSubscribeWindow::GetActiveTable() -{ - CMailFlexTable* list = dynamic_cast - (FindPaneByID(paneID_FolderList)); - Assert_(list); - return list; -} - - -//---------------------------------------------------------------------------- -// CalcStandardBoundsForScreen -// -// Zoom in the vertical direction only. -//---------------------------------------------------------------------------- - -void CSubscribeWindow::CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const -{ - LWindow::CalcStandardBoundsForScreen(inScreenBounds, outStdBounds); - Rect contRect = UWindows::GetWindowContentRect(mMacWindowP); - - outStdBounds.left = contRect.left; - outStdBounds.right = contRect.right; -} - - -//---------------------------------------------------------------------------- -// CommandDelegatesToSubscribeList -// -//---------------------------------------------------------------------------- - -Boolean CSubscribeWindow::CommandDelegatesToSubscribeList(CommandT inCommand) -{ - switch(inCommand) - { - case cmd_Stop: - - case cmd_OpenNewsHost: - case cmd_NewsHostChanged: - - case cmd_NewsToggleSubscribe: - case cmd_NewsSetSubscribe: - case cmd_NewsClearSubscribe: - case cmd_NewsExpandGroup: - case cmd_NewsExpandAll: - case cmd_NewsCollapseGroup: - case cmd_NewsCollapseAll: - case cmd_NewsGetGroups: - case cmd_NewsSearch: - case cmd_NewsGetNew: - case cmd_NewsClearNew: - return true; - } - return false; -} - - -//---------------------------------------------------------------------------- -// FindCommandStatus -// -// Pass down commands to the list (ie. the CSubscribeView) when another -// object (ie. the edit field) is the target -//---------------------------------------------------------------------------- - -void CSubscribeWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - if (mList == nil) - { - outEnabled = (inCommand == paneID_CancelButton); - } - else - { - if (CommandDelegatesToSubscribeList(inCommand)) - { - mList->FindCommandStatus(inCommand, outEnabled, outUsesMark, - outMark, outName); - } - else - { - CMediatedWindow::FindCommandStatus(inCommand, outEnabled, outUsesMark, - outMark, outName); - } - } -} - - -//---------------------------------------------------------------------------- -// ObeyCommand -// -//---------------------------------------------------------------------------- - -Boolean CSubscribeWindow::ObeyCommand( - CommandT inCommand, - void *ioParam) -{ -#pragma unused (ioParam) - if (inCommand == cmd_Stop) - { - if (mList) - { - // Re-enable main controls in case we were committing - mList->Enable(); - LButton * btn; - btn = (LButton *)FindPaneByID(paneID_CancelButton); - if (btn) btn->Enable(); - btn = (LButton *)FindPaneByID(paneID_OkButton); - if (btn) btn->Enable(); - } - } - return false; -} - - -//---------------------------------------------------------------------------- -// ListenToMessage -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::ListenToMessage(MessageT inMessage, void* ioParam) -{ -#pragma unused (ioParam) - switch (inMessage) - { - // Selecting another host - case cmd_NewsHostChanged: - if (mList) - { - mList->ObeyCommand(cmd_Stop, NULL); - - MSG_Host* newsHost = (MSG_Host*)(ioParam); - MSG_SubscribeMode subscribeMode = MSG_SubscribeGetMode(mList->GetMessagePane()); - CTabControl* tabControl = dynamic_cast(FindPaneByID(paneID_TabControl)); - Assert_(tabControl); - - if (MSG_IsIMAPHost(newsHost)) - { - // "Search" and "New" are not supported for IMAP... - tabControl->SetTabEnable(resID_SubscribeTab2, false); - tabControl->SetTabEnable(resID_SubscribeTab3, false); - // ... so switch back to "All" - if (tabControl->GetValue() != 1) - tabControl->SetValue(1); // will refresh the list too - else - mList->RefreshList(newsHost, subscribeMode); - } - else - { - tabControl->SetTabEnable(resID_SubscribeTab2, true); - tabControl->SetTabEnable(resID_SubscribeTab3, true); - mList->RefreshList(newsHost, subscribeMode); - } - } - break; - - // Switching tabs - case msg_TabSwitched: - long paneID = *(long*)ioParam; - switch (paneID) - { - case resID_SubscribeTab1: HandleAllGroupsTabActivate(); break; - case resID_SubscribeTab2: HandleSearchGroupsTabActivate(); break; - case resID_SubscribeTab3: HandleNewGroupsTabActivate(); break; - } - UReanimator::LinkListenerToControls(mList, this, paneID); - break; - - // Search: paneID_EditField or paneID_SearchButton - case msg_EditField2: - case cmd_NewsSearch: - HandleSearchInList(); - break; - - // Add Server button: paneID_AddServerButton - case cmd_OpenNewsHost: - if (CNewsSubscriber::DoAddNewsHost()) - { - CSubscribeHostPopup* popup = dynamic_cast - (FindPaneByID(paneID_ServerPopup)); - Assert_(popup); - if (popup) popup->ReloadMenu(); - } - break; - - // OK/Cancel buttons - case paneID_CancelButton: - if (mList) - mList->SubscribeCancel(); - else - AttemptClose(); - break; - - case paneID_OkButton: - if (mList) - { - mList->Disable(); - LButton * btn; - btn = (LButton *)FindPaneByID(paneID_CancelButton); - if (btn) btn->Disable(); - btn = (LButton *)FindPaneByID(paneID_OkButton); - if (btn) btn->Disable(); - - startAsyncCursors(); - mList->SubscribeCommit(); - } - else - AttemptClose(); - break; - } -} - - -//---------------------------------------------------------------------------- -// HandleKeyPress -// -// Handle Escape and Cmd-Period (copied from LDialogBox) -// Handle Enter and Return in the edit fields -//---------------------------------------------------------------------------- - -Boolean CSubscribeWindow::HandleKeyPress( - const EventRecord &inKeyEvent) -{ - Boolean keyHandled = false; - PaneIDT keyButtonID = 0; - - switch (inKeyEvent.message & charCodeMask) - { - case char_Enter: - case char_Return: - if (mList == nil) - return false; - switch (MSG_SubscribeGetMode(mList->GetMessagePane())) - { - case MSG_SubscribeAll: - mList->OpenSelection(); - keyHandled = true; - break; - - case MSG_SubscribeSearch: - keyButtonID = paneID_SearchButton; - break; - } - break; - - case char_Escape: - if ((inKeyEvent.message & keyCodeMask) == vkey_Escape) - keyButtonID = paneID_CancelButton; - break; - - default: - if (UKeyFilters::IsCmdPeriod(inKeyEvent)) - keyButtonID = paneID_CancelButton; - else - keyHandled = LWindow::HandleKeyPress(inKeyEvent); - break; - } - - if (keyButtonID != 0) - { - LControl* keyButton = (LControl*)FindPaneByID(keyButtonID); - keyButton->SimulateHotSpotClick(kControlButtonPart); - keyHandled = true; - } - - return keyHandled; -} - - -//---------------------------------------------------------------------------- -// HandleAllGroupsTabActivate -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::HandleAllGroupsTabActivate() -{ - if (! mList) - return; - - LControl* addServerBtn = dynamic_cast(FindPaneByID(paneID_AddServerButton)); - if (addServerBtn) addServerBtn->AddListener(this); - - CSubscribeHostPopup* popup = dynamic_cast(FindPaneByID(paneID_ServerPopup)); - if (popup) popup->AddListener(this); - - CLargeEditFieldBroadcast* groupEdit = dynamic_cast - (FindPaneByID(paneID_EditField)); - if (groupEdit) - { - groupEdit->AddListener(this); - - // put the list in my LTabGroup... - mList->SetSuperCommander(groupEdit->GetSuperCommander()); - - // ... but make me the target - SwitchTarget(groupEdit); - LCommander::SetUpdateCommandStatus(true); - } - - // refresh the list - mList->RefreshList(CNewsSubscriber::GetHost(), MSG_SubscribeAll); -} - - -//---------------------------------------------------------------------------- -// HandleSearchGroupsTabActivate -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::HandleSearchGroupsTabActivate() -{ - if (! mList) - return; - - LControl* searchBtn = dynamic_cast(FindPaneByID(paneID_SearchButton)); - if (searchBtn) searchBtn->AddListener(this); - - CSubscribeHostPopup* popup = dynamic_cast(FindPaneByID(paneID_ServerPopup)); - if (popup) popup->AddListener(this); - - LEditField* searchEdit = dynamic_cast(FindPaneByID(paneID_EditField)); - if (searchEdit) - { - // put the list in my LTabGroup... - mList->SetSuperCommander(searchEdit->GetSuperCommander()); - - // ... but make me the target - SwitchTarget(searchEdit); - LCommander::SetUpdateCommandStatus(true); - } - - LGAPushButton * defaultBtn = dynamic_cast(FindPaneByID(paneID_SearchButton)); - if (defaultBtn) defaultBtn->SetDefaultButton(true, true); - - // refresh the list - mList->RefreshList(CNewsSubscriber::GetHost(), MSG_SubscribeSearch); -} - - -//---------------------------------------------------------------------------- -// HandleNewGroupsTabActivate -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::HandleNewGroupsTabActivate() -{ - if (! mList) - return; - - CSubscribeHostPopup* popup = dynamic_cast(FindPaneByID(paneID_ServerPopup)); - if (popup) popup->AddListener(this); - - SwitchTarget(mList); - LCommander::SetUpdateCommandStatus(true); - - // refresh the list - mList->RefreshList(CNewsSubscriber::GetHost(), MSG_SubscribeNew); -} - - -//---------------------------------------------------------------------------- -// HandleSearchInList -// -//---------------------------------------------------------------------------- - -void CSubscribeWindow::HandleSearchInList() -{ - if ((! mList) || (! mList->GetMessagePane())) - return; - - Str255 editStr; - LEditField* editField = dynamic_cast(FindPaneByID(paneID_EditField)); - Assert_(editField); - if (editField) - { - editField->GetDescriptor(editStr); - mList->SearchForString(editStr); - } -} - - -#pragma mark - - - -//---------------------------------------------------------------------------- -// CSubscribeHostPopup -// -//---------------------------------------------------------------------------- - -void* CSubscribeHostPopup::sMercutioCallback = nil; - -static Int16 cIMAPHostIconID = 15226; -static Int16 cNewsHostIconID = 15227; - -//----------------------------------- -static pascal void SubscribeMercutioCallback( - Int16 menuID, - Int16 previousModifiers, - RichItemDataYadaYada& inItemData) -//----------------------------------- -{ -#pragma unused (menuID) -#pragma unused (previousModifiers) - RichItemData& itemData = (RichItemData&)inItemData; - switch (itemData.cbMsg) - { - case cbBasicDataOnlyMsg: - itemData.flags |= - (ksameAlternateAsLastTime|kIconIsSmall|kHasIcon/*|kChangedByCallback*/|kdontDisposeIcon); - itemData.flags &= ~(kIsDynamic); - return; - - case cbIconOnlyMsg: - break; // look out below! - - default: - return; - } - - MSG_Host * host = CNewsHostIterator::GetHostList()[itemData.itemID - 1]; - Int16 iconID = 0; - if (MSG_IsNewsHost(host)) - iconID = cNewsHostIconID; - else if (MSG_IsIMAPHost(host)) - iconID = cIMAPHostIconID; - - itemData.hIcon = CIconList::GetIconSuite(iconID); - itemData.iconType = 'suit'; -} - -//-------------------------------------- -CSubscribeHostPopup::CSubscribeHostPopup(LStream * inStream) - : LGAPopup(inStream), - mNewsHostIterator(nil) -{ -} - -//----------------------------------------- -CSubscribeHostPopup::~CSubscribeHostPopup() -{ - delete mNewsHostIterator; -} - -//------------------------------------------ -void CSubscribeHostPopup::FinishCreateSelf() -{ - LGAPopup::FinishCreateSelf(); // line order... - MenuHandle menuH = GetMacMenuH(); // ...does matter - if (MDEF_IsCustomMenu(menuH)) - { - if (!sMercutioCallback) - sMercutioCallback = NewMercutioCallback(SubscribeMercutioCallback); - FailNIL_(sMercutioCallback); - MDEF_SetCallbackProc(menuH, (MercutioCallbackUPP)sMercutioCallback); - - // Items with 'condense' style will be drawn by the Mercutio callback - MenuPrefsRec myPrefs; - ::memset(&myPrefs, 0, sizeof(myPrefs)); - myPrefs.useCallbackFlag.s = condense; - MDEF_SetMenuPrefs(menuH, &myPrefs); - } - ReloadMenu(); -} - -//------------------------------------ -void CSubscribeHostPopup::ReloadMenu() -{ - // empty menu - for (Int32 index = 0; index < GetMaxValue(); index ++) { - ::DeleteMenuItem(GetMacMenuH(), 1); - } - - // reload menu - delete mNewsHostIterator; - mNewsHostIterator = new CNewsHostIterator(CMailNewsContext::GetMailMaster()); - MSG_Host* outNewsHost; - MenuHandle menuH = GetMacMenuH(); - while (mNewsHostIterator->Next(outNewsHost)) - { - // Add the menu item - LStr255 pstr(MSG_GetHostUIName(outNewsHost)); - Int16 itemIndex = UMenuUtils::AppendMenuItem(menuH, pstr, true); - - // Ask for a callback so we can set the icon - if (MDEF_IsCustomMenu(menuH)) - ::SetItemStyle(menuH, itemIndex, condense); - } - - // select the default host - Int32 hostIndex; - Boolean found = mNewsHostIterator->FindIndex(CNewsSubscriber::GetHost(), hostIndex); - if (! found) - { - mNewsHostIterator->ResetTo(hostIndex = 0); - - MSG_Host* outNewsHost; - mNewsHostIterator->Current(outNewsHost); - CNewsSubscriber::SetHost(outNewsHost); - } - - SetMaxValue(mNewsHostIterator->GetCount()); - mValue = -1; // force BroadcastValueMessage(); - SetValue(hostIndex + 1); // iterator is 0-based, menu is 1-based -} - - -void CSubscribeHostPopup::BroadcastValueMessage() -{ - MSG_Host* outNewsHost; - mNewsHostIterator->ResetTo(mValue - 1); - mNewsHostIterator->Current(outNewsHost); - CNewsSubscriber::SetHost(outNewsHost); - - if (mValueMessage != msg_Nothing) { - BroadcastMessage(mValueMessage, (void*)outNewsHost); - } -} - diff --git a/mozilla/cmd/macfe/MailNews/CSubscribeWindow.h b/mozilla/cmd/macfe/MailNews/CSubscribeWindow.h deleted file mode 100644 index ca33c539ea5..00000000000 --- a/mozilla/cmd/macfe/MailNews/CSubscribeWindow.h +++ /dev/null @@ -1,182 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CSubscribeWindow.h - -#pragma once - -// C/C++ headers -//#include - -// PowerPlant -#include -#include -#include -#include -#include -#include - -// Mail/News MacFE stuff -#include "CBrowserContext.h" -#include "CComposeAddressTableView.h" - -// UI elements -#include "CMailNewsWindow.h" -#include "CMailComposeWindow.h" -#include "CPatternBevelView.h" -#include "CTabSwitcher.h" -#include "UMailFolderMenus.h" - -// Netscape stuff -#include "msgcom.h" -#include "mattach.h" -//#include "MailNewsGUI.h" - - -class CMailComposeWindow; -class CProgressListener; -class CComposeSession; -class CSubscribeView; - - -//---------------------------------------------------------------------------- -// USubscribeUtilities -// -//---------------------------------------------------------------------------- -class USubscribeUtilities -{ -public: - static void RegisterSubscribeClasses(); -}; - - -//---------------------------------------------------------------------------- -// CNewsHostIterator -// -//---------------------------------------------------------------------------- - -class CNewsHostIterator -{ - public: - enum { kMaxNewsHosts = 32 }; - - CNewsHostIterator(MSG_Master* master); - Boolean Current(MSG_Host*& outNewsHost); - Boolean Next(MSG_Host*& outNewsHost); - - Boolean FindIndex(const MSG_Host* inNewsHost, Int32& outIndex); - - void ResetTo(Int32 current) {mIndex = current;}; - Int32 GetCurrentIndex() {return mIndex;}; - static Int32 GetCount() {return mHostCount;}; - static MSG_Host** GetHostList() {return mHostList;}; - - protected: - static MSG_Host* mHostList[kMaxNewsHosts]; - static Int32 mHostCount; - Int32 mIndex; -}; - - -//---------------------------------------------------------------------------- -// CSubscribeHostPopup -// -//---------------------------------------------------------------------------- - -class CSubscribeHostPopup : public LGAPopup -{ -public: - enum { class_ID = 'SHpp' }; - - CSubscribeHostPopup(LStream* inStream); - virtual ~CSubscribeHostPopup(); - - virtual void FinishCreateSelf(); - virtual void ReloadMenu(); - -protected: - virtual void BroadcastValueMessage(); - -protected: - CNewsHostIterator* mNewsHostIterator; - static void* sMercutioCallback; -}; - - -//---------------------------------------------------------------------------- -// CSubscribeWindow -// -//---------------------------------------------------------------------------- - -class CSubscribeWindow : public CMailNewsWindow, - public LBroadcaster, - public LListener -{ -private: - typedef CMailNewsWindow Inherited; // trick suggested by the ANSI committee. - -public: - enum { class_ID = 'Subs', res_ID = 14006 }; - -protected: - virtual ResIDT GetStatusResID(void) const { return res_ID; } - virtual UInt16 GetValidStatusVersion(void) const { return 0x0112; } - -public: - static CSubscribeWindow* FindAndShow(Boolean makeNew); - static Boolean DisplayDialog(); - - CSubscribeWindow(LStream* inStream); - virtual ~CSubscribeWindow(); - - virtual void FinishCreateSelf(); - virtual void DoClose(); - - CMailFlexTable* GetActiveTable(); - - virtual void CalcStandardBoundsForScreen( - const Rect &inScreenBounds, - Rect &outStdBounds) const; - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); - - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - -protected: - Boolean CommandDelegatesToSubscribeList(CommandT inCommand); - - void HandleAllGroupsTabActivate(); - void HandleSearchGroupsTabActivate(); - void HandleNewGroupsTabActivate(); - void HandleSearchInList(); - - CSubscribeView* mList; -}; diff --git a/mozilla/cmd/macfe/MailNews/CThreadMessageController.cp b/mozilla/cmd/macfe/MailNews/CThreadMessageController.cp deleted file mode 100644 index ca7a9a87e4f..00000000000 --- a/mozilla/cmd/macfe/MailNews/CThreadMessageController.cp +++ /dev/null @@ -1,657 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CThreadMessageController.cp - -#include "CThreadMessageController.h" - -#include "CMessageView.h" -#include "CMailNewsWindow.h" -#include "CThreadView.h" -#include "CBrowserContext.h" -#include "CProgressListener.h" -#include "UMailSelection.h" - -#include "macutil.h" -#include "secnav.h" -#include "prefapi.h" - -// Command numbers -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" - -const Int16 kBottomBevelHeight = 0; - -#define THREE_PANE 1 - -#include "CKeyStealingAttachment.h" - -#pragma mark - - -//----------------------------------- -void CThreadWindowExpansionData::ReadStatus(LStream* inStream) -//----------------------------------- -{ - if (!inStream) return; -// *inStream >> mHeight >> mExpandoHeight; -} // CThreadWindowExpansionData::ReadStatus - -//----------------------------------- -void CThreadWindowExpansionData::WriteStatus(LStream* inStream) -//----------------------------------- -{ - if (!inStream) return; -// *inStream << mHeight << mExpandoHeight; -} // CThreadWindowExpansionData::WriteStatus - -#pragma mark - - -//----------------------------------- -CThreadMessageController::CThreadMessageController( - CExpandoDivider* inExpandoDivider -, CThreadView* inThreadView -, CMessageView* inMessageView -, CMessageAttachmentView* inAttachmentView -#if !ONECONTEXTPERWINDOW -, LListener** inMessageContextListeners - // Null-terminated list of pointers, owned by - // this controller henceforth. -#endif -) -//----------------------------------- -: CExpandoListener(&mClosedData, &mOpenData) -, mExpandoDivider(inExpandoDivider) -, mThreadView(inThreadView) -, mMessageView(inMessageView) -, mAttachmentView(inAttachmentView) -, mMessageContext(nil) -, mStoreStatusEnabled(true) -, mThreadKeyStealingAttachment(nil) -#if !ONECONTEXTPERWINDOW -, mMessageContextListeners(inMessageContextListeners) -#endif -{ - Assert_(mExpandoDivider); - Assert_(mThreadView); - Assert_(mMessageView); -} // CThreadMessageController::CThreadMessageController - -//----------------------------------- -CThreadMessageController::~CThreadMessageController() -//----------------------------------- -{ -#if !ONECONTEXTPERWINDOW - delete [] mMessageContextListeners; -#endif -} // CThreadMessageController::~CThreadMessageController - -//----------------------------------- -void CThreadMessageController::InitializeDimensions() -//----------------------------------- -{ - // In case this is the first instantiation, set up the defaults - StoreCurrentDimensions(); // get the closed state from PPOb - // Set the default open state depending on the initial closed state - *(CThreadWindowExpansionData*)mStates[open_state] - = *(CThreadWindowExpansionData*)mStates[closed_state]; -// ExpandoHeight(open_state) -= kBottomBevelHeight; -} // CThreadMessageController::InitializeDimensions - -//----------------------------------- -void CThreadMessageController::FinishCreateSelf() -//----------------------------------- -{ - mMessageView->SetMasterCommander(mThreadView); - LWindow* win = FindOwningWindow(); - LCaption* statisticsCaption = (LCaption*)win->FindPaneByID('Tstt'); - // Initialize the format string. - if (statisticsCaption) - { - statisticsCaption->GetDescriptor(mThreadStatisticsFormat); - statisticsCaption->Hide(); - } -} // CThreadMessageController::FinishCreateSelf - -//----------------------------------- -void CThreadMessageController::ReadStatus(LStream *inStatusData) -//----------------------------------- -{ - mExpandoDivider->ReadStatus(inStatusData); - CExpandable::ReadStatus(inStatusData); -} // CThreadMessageController::ReadWindowStatus - -//----------------------------------- -void CThreadMessageController::WriteStatus(LStream *inStatusData) -//----------------------------------- -{ - mExpandoDivider->WriteStatus(inStatusData); - CExpandable::WriteStatus(inStatusData); -} // CThreadMessageController::WriteWindowStatus - -//----------------------------------- -LWindow* CThreadMessageController::FindOwningWindow() const -//----------------------------------- -{ - return LWindow::FetchWindowObject(mMessageView->GetMacPort()); -} - -//----------------------------------- -void CThreadMessageController::SetExpandState(ExpandStateT inExpand) -//----------------------------------- -{ - if (!mExpandoDivider) return; - if (mStoreStatusEnabled) // don't do this during the reading-in phase - StoreCurrentDimensions(); - mExpandState = inExpand; - Rect myRect; - mExpandoDivider->CalcPortFrameRect(myRect); // relative is fine - ::EraseRect(&myRect); - LWindow* win = FindOwningWindow(); - win->Refresh(); - if (inExpand) - { - // Ordering is important! If we resize the expando pane - // when in the closed position, we change the first frame size. So - // always do the "recall" step when the expando pane has the "open" - // bindings. - mExpandoDivider->SetExpandState(inExpand); // set expando properties - RecallCurrentDimensions(); // resize myself and the expando pane - } - else - { - // Ordering is important! - RecallCurrentDimensions(); // resize myself and the expando pane - mExpandoDivider->SetExpandState(inExpand); - } - InstallMessagePane(inExpand); - - if (inExpand) - { - // Since "expanding" means that the threadview gets smaller, it often happens - // that the user's selection is out of the frame after "expansion". - mThreadView->ScrollSelectionIntoFrame(); - } - - // Set the fancy double-click behavior, which is only needed for the expanded state - mThreadView->SetFancyDoubleClick(inExpand); - - // Set the "select after deletion" behavior of the thread view. The correct macui - // behavior is NOT to do this. But when the thread view is controlling the message - // view, it makes sense to go along with the "Netscape" behavior, ie the wintel - // behavior. - Boolean doSelect = inExpand; // (As I just said) - // ... but some big customer may want the Macintosh behavior in both cases, so check - // for the special preference. - XP_Bool noNextRowSelection; - if (PREF_GetBoolPref("mail.no_select_after_delete", &noNextRowSelection) == PREF_NOERROR - && noNextRowSelection) - doSelect = false; // no matter what. - mThreadView->SetSelectAfterDelete(doSelect); - // The kludge to fix the bottom of the message view has moved to CExpandoDivider. -} // CThreadMessageController::SetExpandState - -//----------------------------------- -void CThreadMessageController::StoreDimensions(CExpansionData&) -//----------------------------------- -{ -} // CThreadMessageController::StoreDimensions() - -//----------------------------------- -void CThreadMessageController::RecallDimensions(const CExpansionData&) -//----------------------------------- -{ -} // CThreadMessageController::RecallDimensions() - -//----------------------------------- -cstring CThreadMessageController::GetCurrentURL() const -//----------------------------------- -{ - if (mMessageContext) - return mMessageContext->GetCurrentURL(); - else - return cstring(""); -} - -//----------------------------------- -void CThreadMessageController::InstallMessagePane( - Boolean inInstall) -//----------------------------------- -{ - // Disable the message view to prevent a crash in layout code, - // called from CHTMLView::AdjustCursorSelf() - Assert_(mMessageView); - mMessageView->Disable(); - OSErr err = noErr; - CMailNewsWindow* win = dynamic_cast(FindOwningWindow()); - ThrowIfNil_(win); -#ifndef THREE_PANE - SwitchTarget(nil); // necessary paranoia if closing window. - // Do before changing the supercommander chain, so that powerplant will correctly - // take the current chain off duty. -#endif - if (inInstall) - { - Try_ - { -#if ONECONTEXTPERWINDOW - mMessageContext = dynamic_cast(win->GetWindowContext()); - ThrowIfNil_(mMessageContext); - ((MWContext*)*mMessageContext)->type = MWContextMailMsg; -#else - mMessageContext = new CBrowserContext(MWContextMailMsg); -#endif - StSharer theShareLock(mMessageContext); - mMessageContext->AddUser(this); - //mMessageContext->AddListener(this); - mMessageView->SetContext(mMessageContext); - // This call links up the model object hierarchy for any potential - // sub model that gets created within the scope of the html view. - if (win) - mMessageView->SetFormElemBaseModel(win); // ? Probably wrong. - mThreadView->AddListener((CExpandoListener*)this); // for msg_SelectionChanged - // When the message view is installed, we still want the thread view to - // have first crack at all the commands, and then to pass to message view if - // not handled. So we insert the message view between us and the thread view, - // and set the target to the thread view. -#ifndef THREE_PANE - mThreadView->SetSuperCommander(mMessageView); - mMessageView->SetSuperCommander(this); -#endif - CNSContext* context = mThreadView->GetContext(); - if (context) - mMessageView->SetDefaultCSID(context->GetDefaultCSID()); - // Add the attachment that will divert certain key events to the message pane. - // This is added first so that it is executed first, and can disable normal - // response to keypresses. - mThreadKeyStealingAttachment = new CKeyStealingAttachment(mMessageView); - mThreadView->AddAttachmentFirst(mThreadKeyStealingAttachment); -#ifndef THREE_PANE - mThreadKeyStealingAttachment->StealKey(char_Home); - mThreadKeyStealingAttachment->StealKey(char_End); - mThreadKeyStealingAttachment->StealKey(char_PageUp); - mThreadKeyStealingAttachment->StealKey(char_PageDown); -#endif // THREE_PANE - mThreadKeyStealingAttachment->StealKey(' '); - - // Tell message view about its attachment pane and hide it - if (mAttachmentView) - { - mMessageView->SetAttachmentView(mAttachmentView); - //mAttachmentView->Remove(); - } - // Tell the thread view its selection changed, so it will broadcast. - // If a message was selected, this will cause it to display in the message pane. - mThreadView->SelectionChanged(); - mMessageView->Enable(); -#if !ONECONTEXTPERWINDOW - LListener** nextListener = mMessageContextListeners; - while (*nextListener) - mMessageContext->AddListener(*nextListener++); -#endif - mSecurityListener.SetMessageView( mMessageView ); - mMessageContext->AddListener( &mSecurityListener); - } - Catch_(localErr) - { - inInstall = false; - } - EndCatch_ - } - if (!inInstall) // called with de-install, or threw above... - { - if (mThreadView) - { - mThreadView->RemoveListener((CMailCallbackListener*)mMessageView); // for msg_SelectionChanged - // While the message view is installed, it is inserted in the command chain - // between this and the message view. -#ifndef THREE_PANE - mThreadView->SetSuperCommander(this); -#endif - // If mThreadView is nil, we have deleted it and the attachment will be deleted, too. - delete mThreadKeyStealingAttachment; //... which will remove itself as an attachment - mThreadKeyStealingAttachment = nil; - } - // If a message is loading when we de-install the pane we want to stop the load - if (mMessageContext) - XP_InterruptContext(*mMessageContext); - - if (mMessageView) - { - mMessageView->SetFormElemBaseModel(nil); // ? Probably wrong. - mMessageView->SetContext(nil); - } - if (mMessageContext) - { -#if !ONECONTEXTPERWINDOW - LListener** nextListener = mMessageContextListeners; - while (*nextListener) - mMessageContext->RemoveListener(*nextListener++); -#endif - mSecurityListener.SetMessageView( NULL ); - mMessageContext->RemoveListener( &mSecurityListener); - USecurityIconHelpers::SetNoMessageLoadedSecurityState( win ); - - ((MWContext*)*mMessageContext)->type = MWContextMail; // see hack in mimemoz.c - mMessageContext->RemoveUser(this); // and delete. - mMessageContext = nil; - } - } -#ifndef THREE_PANE - if (mThreadView) - SwitchTarget(mThreadView); -#endif -} // CThreadMessageController::InstallMessagePane - -//----------------------------------- -void CThreadMessageController::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case CStandardFlexTable::msg_SelectionChanged: - if (!mThreadView) - return; - LWindow* win = FindOwningWindow(); - USecurityIconHelpers::SetNoMessageLoadedSecurityState(win); - if (GetExpandState() == open_state) - { - if (mMessageView) - { - CMailSelection selection; - mThreadView->GetSelection(selection); - MSG_FolderInfo* folder = mThreadView->GetOwningFolder(); - if (folder && selection.selectionSize == 1) - { - LCommander::SetUpdateCommandStatus(true); - CMessage message(*selection.GetSelectionList() + 1, selection.xpPane); - // (add one to convert MSG_ViewIndex to TableIndexT) - MessageKey id = message.GetMessageKey(); - mMessageView->ShowMessage( - CMailNewsContext::GetMailMaster(), - folder, - id, - false); // load on next idle. - - if (MSG_GetBacktrackState(mThreadView->GetMessagePane()) == MSG_BacktrackIdle) - MSG_AddBacktrackMessage(mThreadView->GetMessagePane(), folder, id); - else - MSG_SetBacktrackState(mThreadView->GetMessagePane(), MSG_BacktrackIdle); - } - else - { - // blank out the message view. - mMessageView-> - ShowMessage( - CMailNewsContext::GetMailMaster(), - folder, MSG_MESSAGEKEYNONE, false); // But on next idle! #107826 - } - } - } -#if ONECONTEXTPERWINDOW - else -#endif // with multiple contexts, always do this. If shared, only when message pane not there. - mThreadView->UpdateHistoryEntry(); - break; - case CMailCallbackManager::msg_ChangeStarting: - case CMailCallbackManager::msg_ChangeFinished: - case CMailCallbackManager::msg_PaneChanged: - if (mThreadView != nil) - { - // Set the pane in order to receive XP messages. - // Note: SetPane() can't be called in FinishCreateSelf(), instead we - // have to wait until we are notified that a folder is first loaded into - // the mThreadView. Well, we just chose to call it on every notification... - CMailCallbackListener::SetPane(mThreadView->GetMessagePane()); - if (IsMyPane(ioParam)) - { - // Check if the notification is about _my_ folder - SPaneChangeInfo * callbackInfo = reinterpret_cast(ioParam); - MSG_FolderInfo * folderInfo = reinterpret_cast(callbackInfo->value); - if (mThreadView->GetOwningFolder() == folderInfo) - CMailCallbackListener::ListenToMessage(inMessage, ioParam); - } - } - break; - - default: - CExpandoListener::ListenToMessage(inMessage, ioParam); - break; - } -} // CThreadMessageController::ListenToMessage - -//----------------------------------- -void CThreadMessageController::ChangeStarting( - MSG_Pane* , - MSG_NOTIFY_CODE , - TableIndexT , - SInt32 /*inRowCount*/) -//----------------------------------- -{ -} - -//----------------------------------- -void CThreadMessageController::ChangeFinished( - MSG_Pane* , - MSG_NOTIFY_CODE , - TableIndexT , - SInt32 /*inRowCount*/) -//----------------------------------- -{ -} - -//----------------------------------- -void CThreadMessageController::PaneChanged( - MSG_Pane* , - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 /*value*/) -//----------------------------------- -{ - switch (inNotifyCode) - { - case MSG_PaneNotifyMessageLoaded: - case MSG_PaneNotifyMessageDeleted: - case MSG_PaneNotifyLastMessageDeleted: - // nothing to do for now - break; - case MSG_PaneNotifyFolderDeleted: -#if !THREE_PANE - LWindow* win = FindOwningWindow(); - win->AttemptClose(); -#endif // THREE_PANE - return; // duh! - } - if (inNotifyCode != MSG_PaneNotifyMessageDeleted) - { - // Refresh the statistics on the location bar. - LWindow* win = FindOwningWindow(); - if (win) - { - LCaption* statisticsCaption = (LCaption*)win->FindPaneByID('Tstt'); - if (statisticsCaption && mThreadView) - { - CStr255 tempString = mThreadStatisticsFormat; - CMessageFolder folder(mThreadView->GetOwningFolder()); - SInt32 total = folder.CountMessages(), unread = folder.CountUnseen(); - if (total >= 0 && unread >= 0) - ::StringParamText(tempString, total, unread, 0, 0); - else - ::GetIndString(tempString, 7099, 8); // " Message counts unavailable" - statisticsCaption->SetDescriptor(tempString); - statisticsCaption->Show(); - } - } - } -} // CThreadMessageController::PaneChanged - -//----------------------------------- -Boolean CThreadMessageController::CommandDelegatesToMessagePane(CommandT inCommand) -//----------------------------------- -{ - Boolean isOneLineSelected = mThreadView && mThreadView->GetSelectedRowCount() == 1; - if (GetExpandState() == open_state && isOneLineSelected) - switch (inCommand) - { - case cmd_Copy: - case cmd_Print: - case cmd_PrintOne: - case cmd_SecurityInfo: - case cmd_MarkReadByDate: - case cmd_Stop: - case cmd_LoadImages: - case cmd_Reload: - case cmd_ViewSource: - case cmd_DocumentInfo: - case cmd_WrapLongLines: - case cmd_Find: - case cmd_FindAgain: - return true; - - // Plus Commands msglib can tell us about. - case cmd_Back: - case cmd_GoForward: - case cmd_NextMessage: - case cmd_NextUnreadMessage: - case cmd_PreviousMessage: - case cmd_PreviousUnreadMessage: - - case cmd_NextUnreadThread: - case cmd_NextUnreadGroup: - case cmd_NextFolder: - case cmd_FirstFlagged: - case cmd_PreviousFlagged: - case cmd_NextFlagged: - - case cmd_GetMoreMessages: - case cmd_Clear: - case cmd_ReplyToSender: - case cmd_PostReply: - case cmd_PostAndMailReply: - case cmd_PostNew: - case cmd_ReplyToAll: - case cmd_ForwardMessage: - case cmd_ForwardMessageQuoted: - - case cmd_ShowMicroMessageHeaders: - case cmd_ShowSomeMessageHeaders: - case cmd_ShowAllMessageHeaders: - - case cmd_AttachmentsAsLinks: - case cmd_AttachmentsInline: - return true; - } - return false; -} // CThreadMessageController::CommandDelegatesToMessagePane - -//----------------------------------- -void CThreadMessageController::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -// The message pane, if it exists, is never the target (the thread pane is). -// Therefore, some commands must be explicitly passed down to the message pane -// by this, the window object. -//----------------------------------- -{ -#if 0 - switch (inCommand) - { - case cmd_SelectSelection: - outEnabled = true; - return; - } -#endif // 0 - if (CommandDelegatesToMessagePane(inCommand)) - { - if (mMessageView) - { - // Set the super commander of the message view to nil, because otherwise - // when it calls the inherited method, we'll get called here again, with - // infinite recursion! - LCommander* savedCommander = mMessageView->GetSuperCommander(); - mMessageView->SetSuperCommander(nil); - mMessageView->FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - mMessageView->SetSuperCommander(savedCommander); - } - return; - } - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); -} // CThreadMessageController::FindCommandStatus - -//----------------------------------- -Boolean CThreadMessageController::ObeyCommand( - CommandT inCommand, - void *ioParam) -//----------------------------------- -{ -#if 0 - switch (inCommand) - { - case cmd_RelocateViewToFolder: - // Command was not (could not be) handled by the ThreadView, - // so we leave the window as it is and just update the Location popup. - UpdateFilePopupCurrentItem(); - return true; - - case cmd_SelectSelection: - // This command comes from the context menu, as the default in the thread view. - LControl* twistie = dynamic_cast(FindPaneByID(kTwistieID)); - if (twistie) - twistie->SetValue(true); - // and nature will take its course... - return true; - } -#endif // 0 - if (CommandDelegatesToMessagePane(inCommand)) - { - if (mMessageView) - { - // Set the super commander of the message view to nil, because otherwise - // when it calls the inherited method, we'll get called here again, with - // infinite recursion! - LCommander* savedCommander = mMessageView->GetSuperCommander(); - mMessageView->SetSuperCommander(nil); - LCommander* savedMasterCommander = mMessageView->GetMasterCommander(); - mMessageView->SetMasterCommander(nil); - Boolean result = mMessageView->ObeyCommand(inCommand, ioParam); - if (result) - { - // This doesn't work, because the load does not complete. - STableCell cell(mMessageView->GetCurMessageViewIndex() + 1,1); - mThreadView->SetNotifyOnSelectionChange(false); - mThreadView->UnselectAllCells(); - mThreadView->SetNotifyOnSelectionChange(true); - mThreadView->SelectCell(cell); - } - mMessageView->SetMasterCommander(savedMasterCommander); - mMessageView->SetSuperCommander(savedCommander); - return result; - } - } - if ( inCommand == cmd_SecurityInfo ) - { -// MWContext* context = *GetWindowContext(); - MWContext* context = *mThreadView->GetContext(); - SECNAV_SecurityAdvisor(context, NULL ); - return true; - } - return LCommander::ObeyCommand(inCommand, ioParam); -} // CThreadMessageController::ObeyCommand diff --git a/mozilla/cmd/macfe/MailNews/CThreadMessageController.h b/mozilla/cmd/macfe/MailNews/CThreadMessageController.h deleted file mode 100644 index be11d582c11..00000000000 --- a/mozilla/cmd/macfe/MailNews/CThreadMessageController.h +++ /dev/null @@ -1,145 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CThreadMessageController.h - -#pragma once - -#include "CExpandoDivider.h" -#include "MailNewsCallbacks.h" -#include "CSecurityButton.h" -#include "cstring.h" - -class CThreadView; -class CMessageView; -class CMessageAttachmentView; -class CExpandoDivider; -class CSpinningN; -class CBrowserContext; -class CProgressListener; -class CKeyStealingAttachment; - -//====================================== -class CThreadWindowExpansionData : public CExpansionData -//====================================== -{ -public: - virtual void ReadStatus(LStream* inStream); - virtual void WriteStatus(LStream* inStream); -}; // class CThreadWindowExpansionData - -//====================================== -class CThreadMessageController - : public CExpandoListener - , public CMailCallbackListener - , public LCommander -// This manages the thread and message panes in the thread window. In 4.0x, this -// was all handled by CThreadWindow. This code moved here on 97/09/30. -//====================================== -{ -public: -// Construction/Destruction - CThreadMessageController( - CExpandoDivider* inExpandoDivider - , CThreadView* inThreadView - , CMessageView* inMessageView - , CMessageAttachmentView* inAttachmentView - #if !ONECONTEXTPERWINDOW - , LListener** inMessageContextListeners - // Null-terminated list of pointers, owned by - // this controller henceforth. - #endif - ); - virtual ~CThreadMessageController(); - - void ReadStatus(LStream *inStatusData); - void WriteStatus(LStream *inStatusData); - void InitializeDimensions(); - void FinishCreateSelf(); - void InstallMessagePane( - Boolean inInstall); - LWindow* FindOwningWindow() const; - -// Accessors/Mutators - CMessageView* GetMessageView() const { return mMessageView; } - cstring GetCurrentURL() const; - void SetStoreStatusEnabled(Boolean inEnabled) - { mStoreStatusEnabled = inEnabled; } - void SetThreadView(CThreadView* inThreadView) - { mThreadView = inThreadView; } - -// CMailCallbackListener overrides: -protected: - virtual void ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - -// LCommander Overrides -protected: - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); -// command helpers -protected: - Boolean CommandDelegatesToMessagePane(CommandT inCommand); - -// CExpandoListener overrides: -protected: - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - -// CExpandable overrides: -protected: - virtual void SetExpandState(ExpandStateT inExpanded); - virtual void StoreDimensions(CExpansionData&); - virtual void RecallDimensions(const CExpansionData&); - -// Data -protected: - CExpandoDivider* mExpandoDivider; - CThreadView* mThreadView; - CMessageView* mMessageView; - CMessageAttachmentView* mAttachmentView; -#if !ONECONTEXTPERWINDOW - LListener** mMessageContextListeners; -#endif - CThreadWindowExpansionData mClosedData, mOpenData; - Boolean mStoreStatusEnabled; - CBrowserContext* mMessageContext; - CMailSecurityListener mSecurityListener; - CKeyStealingAttachment* mThreadKeyStealingAttachment; // installed when window expanded. - Str255 mThreadStatisticsFormat; // format string -}; // class CThreadMessageController diff --git a/mozilla/cmd/macfe/MailNews/CThreadView.cp b/mozilla/cmd/macfe/MailNews/CThreadView.cp deleted file mode 100644 index 800fa7d985a..00000000000 --- a/mozilla/cmd/macfe/MailNews/CThreadView.cp +++ /dev/null @@ -1,3264 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// Created 3/25/96 - Tim Craycroft - -#include "CThreadView.h" - -// App specific -#include "resgui.h" -#include "macutil.h" -#include "Netscape_Constants.h" -#include "CBrowserContext.h" - -#include "libi18n.h" - -// Mail/News Specific -#include "CNewsSubscriber.h" -#include "Netscape_Constants.h" -#include "CMailNewsContext.h" -#include "CMessageWindow.h" -#include "CMessageView.h" -#include "MailNewsgroupWindow_Defines.h" -#include "LTableViewHeader.h" -#include "CThreadWindow.h" -#include "UMailFolderMenus.h" -#include "CMailFolderButtonPopup.h" -#include "UMessageLibrary.h" -#include "CMailProgressWindow.h" -#include "CProgressListener.h" -#include "UMailSelection.h" - -// utility -#include "UPropFontSwitcher.h" -#include "UUTF8TextHandler.h" -#include "SearchHelpers.h" -#include "CDrawingState.h" -#include "URobustCreateWindow.h" -#include "CApplicationEventAttachment.h" -// remove next line when we move the PlaceUTF8TextInRect to utility classes -#include "UGraphicGizmos.h" -#include "CTargetedUpdateMenuRegistry.h" -#include "CProxyDragTask.h" -#include "UNewFolderDialog.h" -#include "UDeferredTask.h" - -// XP -#include "ntypes.h" -#include "msg_srch.h" // for MSG_GetPriorityName, MSG_GetStatusName - -// application -#include "uapp.h" -#include "prefapi.h" -#include "secnav.h" -#include "shist.h" - -// PowerPlant -#include -#include -#include -#include -#include -#include - -// Mac -#include - -// ANSI -#include -#include - -#define kPriorityMenuID 10528 - -enum { - kThreadedIcon = 10501, - kUnthreadedIcon = 10502 -}; - -static const UInt16 kMaxSubjectLength = 256; - -#pragma mark - - -MSG_MessageLine CMessage::sMessageLineData; -MSG_Pane* CMessage::sCacheMessageList = NULL; -MSG_ViewIndex CMessage::sCacheIndex = 0; - -//---------------------------------------------------------------------------------------- -CMessage::CMessage(MSG_ViewIndex inIndex, MSG_Pane* inMessageList) -//---------------------------------------------------------------------------------------- -: mIndex(inIndex-1) -, mMessageList(inMessageList) -{ -} - -//---------------------------------------------------------------------------------------- -CMessage::~CMessage() -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -Boolean CMessage::UpdateMessageCache() const -//---------------------------------------------------------------------------------------- -{ - if (mMessageList && (mIndex != sCacheIndex || mMessageList != sCacheMessageList)) - { - if (!::MSG_GetThreadLineByIndex(mMessageList, mIndex, 1, &sMessageLineData)) - { - InvalidateCache(); - return false; - } - sCacheIndex = mIndex; - sCacheMessageList = mMessageList; - } - return true; -} // CMessage::UpdateMessageCache - -//---------------------------------------------------------------------------------------- -void CMessage::InvalidateCache() -//---------------------------------------------------------------------------------------- -{ - sCacheMessageList = NULL; -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::TestXPFlag(UInt32 inMask) const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return ((sMessageLineData.flags & inMask) != 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::IsOffline() const // db has offline news article -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_OFFLINE); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::IsDeleted() const -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_IMAP_DELETED); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::IsTemplate() const -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_TEMPLATE); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::HasBeenRead() const -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_READ); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::IsFlagged() const -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_MARKED); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::IsThread() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return (sMessageLineData.numChildren > 0); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::HasAttachments() const -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_ATTACHMENT); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::IsOpenThread() const -//---------------------------------------------------------------------------------------- -{ - Assert_(IsThread()); - return !TestXPFlag(MSG_FLAG_ELIDED); -} - -//---------------------------------------------------------------------------------------- -inline Boolean CMessage::HasBeenRepliedTo() const -//---------------------------------------------------------------------------------------- -{ - return TestXPFlag(MSG_FLAG_REPLIED); -} - -//---------------------------------------------------------------------------------------- -inline MessageId CMessage::GetThreadID() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.threadId; -} - -//---------------------------------------------------------------------------------------- -MessageKey CMessage::GetMessageKey() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.messageKey; -} - -//---------------------------------------------------------------------------------------- -uint16 CMessage::GetNumChildren() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.numChildren; -} - -//---------------------------------------------------------------------------------------- -uint16 CMessage::GetNumNewChildren() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.numNewChildren; -} - -//---------------------------------------------------------------------------------------- -/* static */ const char* CMessage::GetSubject( - MSG_MessageLine* data, - char* buffer, - UInt16 bufSize) -//---------------------------------------------------------------------------------------- -{ - *buffer = 0; - if ((data->flags & MSG_FLAG_HAS_RE) != 0) - { - const CString** sh = (const CString**)GetString(REPLY_FORM_RESID); - if (sh) - { - Assert_(bufSize > (**sh).Length()); - XP_SAFE_SPRINTF(buffer, bufSize - 1, (const char*)(**sh), data->subject); - ::ReleaseResource((Handle)sh); - return buffer; - } - } - return XP_STRNCPY_SAFE(buffer, data->subject, bufSize); -} - -//---------------------------------------------------------------------------------------- -const char* CMessage::GetSubject(char* buffer, UInt16 bufSize) const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return GetSubject(&sMessageLineData, buffer, bufSize); -} - -//---------------------------------------------------------------------------------------- -const char* CMessage::GetSubject() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.subject; -} - -//---------------------------------------------------------------------------------------- -inline MSG_PRIORITY CMessage::GetPriority() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.priority; -} - -//---------------------------------------------------------------------------------------- -void CMessage::GetPriorityColor(MSG_PRIORITY priority, RGBColor& priorityColor) /* static */ -//---------------------------------------------------------------------------------------- -{ - // Initialize to black - memset(&priorityColor, 0, sizeof(RGBColor)); - switch (priority) - { - case MSG_LowestPriority: // green - priorityColor.green = 0x7FFF; - break; - case MSG_LowPriority: // blue - priorityColor.blue = 0xFFFF; - break; - case MSG_HighPriority: // purple - priorityColor.red = 0x7FFF; - priorityColor.blue = 0x7FFF; - break; - case MSG_HighestPriority: // red - priorityColor.red = 0xFFFF; - break; - case MSG_NormalPriority: - case MSG_PriorityNotSet: - case MSG_NoPriority: - default: - break; - } -} // CMessage::GetPriorityColor - -//---------------------------------------------------------------------------------------- -void CMessage::GetPriorityColor(RGBColor& priorityColor) const -//---------------------------------------------------------------------------------------- -{ - // Don't draw deleted messages in color. - MSG_PRIORITY priority = IsDeleted() ? MSG_NormalPriority : GetPriority(); - GetPriorityColor(priority, priorityColor); -} // CMessage::GetPriorityColor - -//---------------------------------------------------------------------------------------- -inline Int16 CMessage::PriorityToMenuItem(MSG_PRIORITY inPriority) /* static */ -//---------------------------------------------------------------------------------------- -{ - return (inPriority > MSG_NoPriority) ? inPriority - 1 : 3; -} - -//---------------------------------------------------------------------------------------- -inline MSG_PRIORITY CMessage::MenuItemToPriority(Int16 inMenuItem) /* static */ -//---------------------------------------------------------------------------------------- -{ - return (MSG_PRIORITY)(inMenuItem + 1); -} - -//---------------------------------------------------------------------------------------- -inline const char* CMessage::GetSender() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.author; -} - -//---------------------------------------------------------------------------------------- -inline const char* CMessage::GetDateString() const -//---------------------------------------------------------------------------------------- -{ -// UpdateMessageCache(); - return MSG_FormatDate(mMessageList, GetDate()); -} - -//---------------------------------------------------------------------------------------- -inline const char* CMessage::GetAddresseeString() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.author; -} - -//---------------------------------------------------------------------------------------- -const char * CMessage::GetSizeStr() const -// ¥ FIX ME: Is there an XP call for constructing the size string ? -//---------------------------------------------------------------------------------------- -{ - static char sizeString[32]; - UInt32 messageSize = GetSize(); - CStr255 formatString; - if (messageSize > (1024*1000)) - { - ::GetIndString(formatString, 7099, 4); - float floatSize = (float)messageSize / (1024*1000); - sprintf(sizeString, formatString, floatSize); - } - else - { - if (messageSize > 1024) - { - ::GetIndString(formatString, 7099, 5); - messageSize /= 1024; - } - else - { - ::GetIndString(formatString, 7099, 6); - } - sprintf(sizeString, formatString, messageSize); - } - return sizeString; -} - -//---------------------------------------------------------------------------------------- -const char * CMessage::GetPriorityStr() const -//---------------------------------------------------------------------------------------- -{ - static char buffer[256]; - buffer[0] = '\0'; - MSG_PRIORITY priority = GetPriority(); - if (priority == MSG_PriorityNotSet - || priority == MSG_NoPriority - || priority == MSG_NormalPriority) - return buffer; - MSG_GetPriorityName(priority, buffer, sizeof(buffer)-1); - return buffer; -} - - -//---------------------------------------------------------------------------------------- -const char * CMessage::GetStatusStr() const -//---------------------------------------------------------------------------------------- -{ - static char buffer[256]; - MSG_GetStatusName(GetStatus(), buffer, sizeof(buffer)-1); - return buffer; -} - -//---------------------------------------------------------------------------------------- -inline time_t CMessage::GetDate() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.date; -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessage::GetSize() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.messageLines; // bytes for mail, lines for news. Oh well! -} - -//---------------------------------------------------------------------------------------- -inline UInt32 CMessage::GetStatus() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.flags; - // actually, not all bits are relevant, but there's no mask in msgcom.h. -} - -//---------------------------------------------------------------------------------------- -inline int8 CMessage::GetThreadLevel() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return sMessageLineData.level; -} - -//====================================== -// Icon suite IDs -//====================================== -#pragma mark -enum IconTable -{ - kMessageReadIcon = 15234 // icon to mark a message as read -, kFlagIcon = 15236 // icon to mark a message as read - - // Icons for representing mail messages -, kMailMessageIcon = 15228 -, kReadMailMessageIcon = 15229 -, kMailMessageWithAttachmentIcon = 10511 -, kFlaggedMailMessageIcon = 10512 -, kFlaggedMailMessageWithAttachmentIcon = 10513 - - // News articles -, kNewsArticleMessageIcon = 15231 -, kReadNewsArticleMessageIcon = 15232 -, kNewsArticleReadFlaggedMessageIcon = 15232 -, kNewsArticleFlaggedMessageIcon = 15234 -}; - -static ResIDT gIconIDTable[] = { -//------------------------------------------------------------------------------------------------------------- -// NAME UNREAD READ NEW (UNUSED) -// LOCAL ONLINE LOCAL ONLINE LOCAL ONLINE LOCAL ONLINE -//------------------------------------------------------------------------------------------------------------- -/* POP */ 15228 , 0 , 15229 , 0 , 15407 , 0 , 0 , 0 , -/* IMAP */ 15228 , 15226 , 15229 , 15226 , 15407 , 15407 , 15523 , 15523 , -/* Art */ 15518 , 15233 , 15519 , 15396 , 0 , 0 , 0 , 0 , -/* Drft */ 15230 , 15230 , 15230 , 15230 , 15230 , 15230 , 0 , 0 , -}; //---------------------------------------------------------------------------------------------------- - -enum { - kOnline = 1 // offset -, kRead = 2 // offset -, kNew = 4 // offset -, kDeleted = 6 // offset -, kKindsPerRow = 8 -, kMessageIx = 0 -, kIMAPIx = 1 * kKindsPerRow -, kArticleIx = 2 * kKindsPerRow -, kDraftIx = 3 * kKindsPerRow -}; - -//---------------------------------------------------------------------------------------- -ResIDT CMessage::GetIconID(UInt16 inFolderFlags) const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - return GetIconID(inFolderFlags, sMessageLineData.flags); -} // CMessage::GetIconID - -//---------------------------------------------------------------------------------------- -ResIDT CMessage::GetIconID(UInt16 inFolderFlags, UInt32 inMessageFlags) -//---------------------------------------------------------------------------------------- -{ -#define IMAP_FOLDER (MSG_FOLDER_FLAG_IMAPBOX | MSG_FOLDER_FLAG_MAIL) - short iconIndex = 0; - // Special case of pop folder because MSG_FLAG_OFFLINE is not correct for pop folders. - Boolean isPopFolder = (inFolderFlags & IMAP_FOLDER) == MSG_FOLDER_FLAG_MAIL; - Boolean isNews = (inFolderFlags & MSG_FOLDER_FLAG_NEWSGROUP) == MSG_FOLDER_FLAG_NEWSGROUP; - - // First, what kind of folder are we in (determines the basic icon type, the row in - // the table above) - if ((inFolderFlags & IMAP_FOLDER) == IMAP_FOLDER) - iconIndex = kIMAPIx; - else if (inFolderFlags & MSG_FOLDER_FLAG_MAIL) - iconIndex = kMessageIx; // FIXME: How do we tell whether it has attachments? - else if (inFolderFlags & MSG_FOLDER_FLAG_NEWSGROUP) - iconIndex = kArticleIx; - else if (inFolderFlags & MSG_FOLDER_FLAG_DRAFTS) - iconIndex = kDraftIx; - - // Next, which of the four major columns are we in. - if (!isNews && !isPopFolder && (inMessageFlags & MSG_FLAG_IMAP_DELETED) != 0) - iconIndex += kDeleted; - else if (!isNews && (inMessageFlags & MSG_FLAG_NEW) != 0) - iconIndex += kNew; - else if ((inMessageFlags & MSG_FLAG_READ) != 0) - iconIndex += kRead; - - // Finally, choose the local/offline column. - // Note: pop does not support the "offline" flag bit, it should always be set - // (but isn't) - if (!isPopFolder && (inMessageFlags & MSG_FLAG_OFFLINE) == 0) - iconIndex += kOnline; - - return gIconIDTable[iconIndex]; -} // CMessage::GetIconID - -//====================================== -// Thread Icon IDs -//====================================== -enum ThreadIconTable -{ - // Icons for representing threaded messages - kThreadIcon = 15399 -, kNewThreadIcon = 15401 -, kWatchedThreadIcon = 15403 -, kWatchedNewThreadIcon = 15404 -, kIgnoredThreadIcon = 15429 - -}; - -static ResIDT gThreadIconIDTable[] = { -//----------------------------------------------------------- -// NAME UNWATCHED WATCHED -// OLD UNREAD OLD UNREAD -//----------------------------------------------------------- -/* Thread */ 15399 , 15401 , 15403 , 15404 -}; //-------------------------------------------------- - -enum { - kUnread = 1 // offset -, kWatched = 2 // offset -}; - -//---------------------------------------------------------------------------------------- -ResIDT CMessage::GetThreadIconID() const -//---------------------------------------------------------------------------------------- -{ - UpdateMessageCache(); - short iconIndex = 0; - if ((sMessageLineData.flags & MSG_FLAG_IGNORED) != 0) - return kIgnoredThreadIcon; - if (GetNumNewChildren() > 0) - iconIndex += kUnread; - if ((sMessageLineData.flags & MSG_FLAG_WATCHED) != 0) - iconIndex += kWatched; - return gThreadIconIDTable[iconIndex]; -} // CMessage::GetIconID - -#pragma mark - - -//======================================================================================== -class CDeferredLoadFolderTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredLoadFolderTask( - CThreadView* inView, - CNSContext* inContext, - CMessageFolder inFolder); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CThreadView* mThreadView; - CNSContext* mContextToLoadAtIdle; - CMessageFolder mFolderToLoadAtIdle; - UInt32 mEarliestExecuteTime; -}; // class CDeferredLoadFolderTask - -//---------------------------------------------------------------------------------------- -CDeferredLoadFolderTask::CDeferredLoadFolderTask( - CThreadView* inView, - CNSContext* inContext, - CMessageFolder inFolder) -//---------------------------------------------------------------------------------------- -: mThreadView(inView) -, mContextToLoadAtIdle(inContext) -, mFolderToLoadAtIdle(inFolder) -, mEarliestExecuteTime(::TickCount() + GetDblTime()) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredLoadFolderTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - // Wait for the earliest execute time. It's expensive to load a folder, and if the - // user is nervously clicking on multiple folders, we only want to load the last one. - if (::TickCount() < mEarliestExecuteTime) - return eWaitStayFront; - if (CMailProgressWindow::GetModal()) - return eWaitStayFront; // wait until other modal tasks are done. - mThreadView->LoadMessageFolder(mContextToLoadAtIdle, mFolderToLoadAtIdle, true); - return eDoneDelete; -} // CDeferredLoadFolderTask::ExecuteSelf - -#pragma mark - - -//======================================================================================== -class CDeferredUndoTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredUndoTask( - CThreadView* inView); - void SetUndoStatus(UndoStatus inStatus) - { - mUndoStatus = inStatus; - } - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CThreadView* mThreadView; - UndoStatus mUndoStatus; -}; // class CDeferredUndoTask - -//---------------------------------------------------------------------------------------- -CDeferredUndoTask::CDeferredUndoTask( - CThreadView* inView) -//---------------------------------------------------------------------------------------- -: mThreadView(inView) -, mUndoStatus(UndoInProgress) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredUndoTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (mUndoStatus == UndoComplete) - return eDoneDelete; // remove from queue - else if (mUndoStatus == UndoInProgress) - { - mUndoStatus = MSG_GetUndoStatus(mThreadView->GetMessagePane()); - switch (mUndoStatus) - { - case UndoComplete: - MSG_FolderInfo* finfo; - MessageKey key; - MSG_Pane* pane = mThreadView->GetMessagePane(); - if (MSG_GetUndoMessageKey(pane, &finfo, &key)) - { - if (finfo && finfo != mThreadView->GetOwningFolder()) - { - mThreadView->LoadMessageFolder(mThreadView->GetContext(), finfo, false); - } - mThreadView->SelectMessageWhenReady(key); - } - break; - case UndoInProgress: - return eWaitStayFront; // block, leave in queue - default: - return eDoneDelete; - } // switch - } - return eDoneDelete; // remove from queue -} // CDeferredUndoTask::ExecuteSelf - -#pragma mark - - -//======================================================================================== -class CDeferredSelectRowTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredSelectRowTask( - CThreadView* inView, - TableIndexT inRow); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CThreadView* mThreadView; - TableIndexT mRow; -}; // class CDeferredSelectRowTask - -//---------------------------------------------------------------------------------------- -CDeferredSelectRowTask::CDeferredSelectRowTask( - CThreadView* inView, - TableIndexT inRow) -//---------------------------------------------------------------------------------------- -: mThreadView(inView) -, mRow(inRow) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredSelectRowTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - mThreadView->SelectAfterDelete(mRow); - return eDoneDelete; // remove from queue -} // CDeferredSelectRowTask::ExecuteSelf - -#pragma mark - - -//======================================================================================== -class CScrollToNewMailTask -//======================================================================================== -: public CDeferredTask -{ - public: - CScrollToNewMailTask( - CThreadView* inView); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CThreadView* mThreadView; -}; // class CScrollToNewMailTask - -//---------------------------------------------------------------------------------------- -CScrollToNewMailTask::CScrollToNewMailTask( - CThreadView* inView) -//---------------------------------------------------------------------------------------- -: mThreadView(inView) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CScrollToNewMailTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - mThreadView->ScrollToGoodPlace(); - return eDoneDelete; // remove from queue -} // CScrollToNewMailTask::ExecuteSelf - -#pragma mark - - -//======================================================================================== -class CDeferredSelectKeyTask -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredSelectKeyTask( - CThreadView* inView, - MessageKey inKey); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CThreadView* mThreadView; - MessageKey mPendingMessageKeyToSelect; // Hack to support ShowSearchMessage() -}; // class CDeferredSelectKeyTask - -//---------------------------------------------------------------------------------------- -CDeferredSelectKeyTask::CDeferredSelectKeyTask( - CThreadView* inView, - MessageKey inKey) -//---------------------------------------------------------------------------------------- -: mThreadView(inView) -, mPendingMessageKeyToSelect(inKey) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredSelectKeyTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - mThreadView->SelectMessageWhenReady(mPendingMessageKeyToSelect); - return eDoneDelete; -} // CDeferredSelectKeyTask::ExecuteSelf - -#pragma mark - - -//======================================================================================== -class CDeferredThreadViewCommand -//======================================================================================== -: public CDeferredCommand -{ - private: - typedef CDeferredCommand Inherited; - public: - CDeferredThreadViewCommand( - CThreadView* inView, - CommandT inCommand, - void* ioParam); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CThreadView* mThreadView; -}; // class CDeferredThreadViewCommand - -//---------------------------------------------------------------------------------------- -CDeferredThreadViewCommand::CDeferredThreadViewCommand( - CThreadView* inView, - CommandT inCommand, - void* ioParam) -//---------------------------------------------------------------------------------------- -: CDeferredCommand(inView, inCommand, ioParam) -, mThreadView(inView) -{ -} - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredThreadViewCommand::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (mCommand == cmd_GetNewMail) - { - if (mThreadView->IsStillLoading()) - return eWaitStayFront; // don't stop idling -// && ((mXPFolder.GetFolderFlags() & MSG_FOLDER_FLAG_INBOX) != 0) && // if this is an inbox -// ((mXPFolder.GetFolderFlags() & MSG_FOLDER_FLAG_IMAPBOX) == 0) // and our server is pop - } - return Inherited::ExecuteSelf(); -} // CDeferredThreadViewCommand::ExecuteSelf - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CThreadView::CThreadView(LStream *inStream) -//---------------------------------------------------------------------------------------- -: Inherited(inStream) -, mXPFolder(NULL) -, mSavedSelection(nil) -, mExpectingNewMail(false) -, mGotNewMail(false) -, mRowToSelect(0) -, mSelectAfterDelete(false) // This new "hidden" pref was a demand from a big customer -, mMotionPendingCommand((MSG_MotionType)-1) -, mUndoTask(nil) -, mScrollToShowNew(false) -{ - XP_Bool noNextRowSelection; - if (PREF_GetBoolPref("mail.no_select_after_delete", &noNextRowSelection) == PREF_NOERROR - && noNextRowSelection) - SetSelectAfterDelete(false); -} - -//---------------------------------------------------------------------------------------- -CThreadView::~CThreadView() -//---------------------------------------------------------------------------------------- -{ - SaveSelectedMessage(); - delete mSavedSelection; -} - -//---------------------------------------------------------------------------------------- -void CThreadView::ApplyTextStyle(TableIndexT inRow) const -//---------------------------------------------------------------------------------------- -{ - CMessage message(inRow, GetMessagePane()); - // Set bold if new - if (!message.HasBeenRead()) - ::TextFace(bold); - else if (message.IsThread() && !message.IsOpenThread() && message.GetNumNewChildren() > 0) - ::TextFace(underline); - else - ::TextFace(normal); - ::TextMode(message.IsDeleted() ? grayishTextOr : srcOr); -} // CMessageFolderView::ApplyTextStyle - -//---------------------------------------------------------------------------------------- -void CThreadView::ApplyTextColor(TableIndexT inRow) const -//---------------------------------------------------------------------------------------- -{ - CMessage message(inRow, GetMessagePane()); - // Set up the text color based on priority - RGBColor priorityColor; - message.GetPriorityColor(priorityColor); - ::RGBForeColor(&priorityColor); -} // CMessageFolderView::ApplyTextStyle - -//---------------------------------------------------------------------------------------- -void CThreadView::DrawCellContents( - const STableCell &inCell, - const Rect &inLocalRect) -//---------------------------------------------------------------------------------------- -{ - ApplyTextColor(inCell.row); - - CMessage message(inCell.row, GetMessagePane()); - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { - case kThreadMessageColumn: - { - // draw a "thread dragger" /*if we're sorted by thread and*/ this - // message is a thread header... or if we are watched/ignored - //if (GetSortedColumn() == kThreadMessageColumn && message.IsThread()) - - ResIDT iconID = message.GetThreadIconID(); - if( /*GetSortedColumn() == kThreadMessageColumn &&*/ ( message.IsThread() || iconID >= kWatchedThreadIcon ) ) - DrawIconFamily( iconID, 16, 16, 0, inLocalRect); - break; - - } - case kMarkedReadMessageColumn: - { - if (!message.HasBeenRead()) - DrawIconFamily(kMessageReadIcon, 16, 16, 0, inLocalRect); - break; - } - case kFlagMessageColumn: - if (message.IsFlagged()) - DrawIconFamily(kFlagIcon, 16, 16, 0, inLocalRect); - break; - case kSubjectMessageColumn: - SInt16 newLeft = DrawIcons(inCell, inLocalRect); - Rect subjectRect = inLocalRect; - subjectRect.left = newLeft; - DrawMessageSubject(inCell.row, subjectRect); - break; - case kSenderMessageColumn: - { - const char* raw = message.GetSender(); - char* conv = IntlDecodeMimePartIIStr(raw, mContext->GetWinCSID(), FALSE); - - if(mContext->GetWinCSID() == CS_UTF8) - DrawUTF8TextString((conv ? conv : raw), &mTextFontInfo, 2, inLocalRect); - else - DrawTextString((conv ? conv : raw), &mTextFontInfo, 2, inLocalRect); - - if(conv) - XP_FREE(conv); - } - break; - case kDateMessageColumn: - DrawTextString(message.GetDateString(), &mTextFontInfo, 2, inLocalRect, teFlushLeft, true, truncEnd); - break; - case kPriorityMessageColumn: - DrawMessagePriority(message, inLocalRect); - break; - case kSizeMessageColumn: - DrawMessageSize(message, inLocalRect); - break; - case kStatusMessageColumn: - DrawMessageStatus(message, inLocalRect); - break; - case kAddresseeMessageColumn: - { - const char* raw = message.GetAddresseeString(); - char* conv = IntlDecodeMimePartIIStr(raw, mContext->GetWinCSID(), FALSE); - if(mContext->GetWinCSID() == CS_UTF8) - DrawUTF8TextString((conv ? conv : raw), &mTextFontInfo, 2, inLocalRect); - else - DrawTextString((conv ? conv : raw), &mTextFontInfo, 2, inLocalRect); - DrawTextString((conv ? conv : raw), &mTextFontInfo, 2, inLocalRect); - if(conv) - XP_FREE(conv); - } - break; - case kTotalMessageColumn: - if (GetSortedColumn() == kThreadMessageColumn && message.IsThread()) - DrawCountCell(message.GetNumChildren(), inLocalRect); - break; - case kUnreadMessageColumn: - if (GetSortedColumn() == kThreadMessageColumn && message.IsThread()) - DrawCountCell(message.GetNumNewChildren(), inLocalRect); - break; - default: - Assert_(false); - break; - } - // The selection of a new message after one is removed is handled by a timer, and is keyed - // off mRowToSelect. This data member is set when we are notified that a row has been removed. - // We used to start this timer immediately on initiating the delete operation (in DeleteSelection) - // but this ended up firing before the refresh occurred, resulting in two rows selected, which - // was ugly. So we turn on the idler here, now, to make sure that the row isn't selected until - // after the refresh is done. 98/01/14 - if (mRowToSelect) - { - CDeferredTaskManager::Post1(new CDeferredSelectRowTask(this, mRowToSelect), this); - mRowToSelect = LArray::index_Bad; - } - if (mScrollToShowNew) - { - CDeferredTaskManager::Post1(new CScrollToNewMailTask(this), this); - mScrollToShowNew = false; - } -} // CThreadView::DrawCellContents - -//---------------------------------------------------------------------------------------- -void CThreadView::DrawIconsSelf( - const STableCell& inCell, - IconTransformType inTransformType, - const Rect& inIconRect) const -//---------------------------------------------------------------------------------------- -{ - const ResIDT kPaperClipBackLayer = 15555; - const ResIDT kPaperClipFrontLayer = 15556; - CMessage message(inCell.row, GetMessagePane()); - Boolean hasAttachments = message.HasAttachments(); - if (hasAttachments) - DrawIconFamily(kPaperClipBackLayer, 16, 16, inTransformType, inIconRect); - Inherited::DrawIconsSelf(inCell, inTransformType, inIconRect); - if (hasAttachments) - DrawIconFamily(kPaperClipFrontLayer, 16, 16, inTransformType, inIconRect); -} // CThreadView::DrawIconsSelf - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::GetDragCopyStatus( - DragReference inDragRef -, const CMailSelection& inSelection -, Boolean& outCopy) -//---------------------------------------------------------------------------------------- -{ - SInt16 modifiers; - ::GetDragModifiers(inDragRef, NULL, &modifiers, NULL); - outCopy = ((modifiers & optionKey) != 0); // user wants copy if possible. - MSG_DragEffect effect = outCopy ? MSG_Require_Copy : MSG_Default_Drag; - MSG_FolderInfo* destFolder = GetOwningFolder(); - if (!destFolder) - return false; // eg, when the pane is blank because a server is selected. - // Ask the back end for guidance on what is possible: - effect = ::MSG_DragMessagesIntoFolderStatus( - inSelection.xpPane, - inSelection.GetSelectionList(), - inSelection.selectionSize, - destFolder, - effect); - if (effect == MSG_Drag_Not_Allowed && outCopy) - { - // Well, maybe a move is ok - effect = ::MSG_DragMessagesIntoFolderStatus( - inSelection.xpPane, - inSelection.GetSelectionList(), - inSelection.selectionSize, - destFolder, - MSG_Default_Drag); - } - outCopy = (effect & MSG_Require_Copy) != 0; - return (effect != MSG_Drag_Not_Allowed); // this looks ok as a drop operation. -} // CThreadView::GetSelectionAndCopyStatusFromDrag - -//---------------------------------------------------------------------------------------- -void CThreadView::EnterDropArea( - DragReference inDragRef, - Boolean inDragHasLeftSender) -// CStandardFlexTable overrides the LDropArea base method, because it assumes a drop-on-row -// scenario -//---------------------------------------------------------------------------------------- -{ - LDragAndDrop::EnterDropArea(inDragRef, inDragHasLeftSender); -} - -//---------------------------------------------------------------------------------------- -void CThreadView::LeaveDropArea(DragReference inDragRef) -// CStandardFlexTable overrides the LDropArea base method, because it assumes a drop-on-row -// scenario -//---------------------------------------------------------------------------------------- -{ - LDragAndDrop::LeaveDropArea(inDragRef); - mDropRow = 0; - mIsDropBetweenRows = false; - mIsInternalDrop = false; -} - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::ItemIsAcceptable( - DragReference inDragRef, - ItemReference /*inItemRef*/ ) -//---------------------------------------------------------------------------------------- -{ - Boolean dropOK = false; - Boolean doCopy = false; - - CMailSelection selection; - if (GetSelectionFromDrag(inDragRef, selection) - && selection.xpPane != GetMessagePane() - && GetDragCopyStatus(inDragRef, selection, doCopy)) - dropOK = true; - if (dropOK && doCopy) - { - CursHandle copyDragCursor = ::GetCursor(curs_CopyDrag); - if (copyDragCursor != nil) - ::SetCursor(*copyDragCursor); - } - else - ::SetCursor(&qd.arrow); - return dropOK; -} // CThreadView::ItemIsAcceptable - -//---------------------------------------------------------------------------------------- -void CThreadView::ReceiveDragItem( - DragReference inDragRef, - DragAttributes /*inDragAttrs*/, - ItemReference inItemRef, - Rect& /*inItemBounds*/) -//---------------------------------------------------------------------------------------- -{ - Assert_(inItemRef == CMailFlexTable::eMailNewsSelectionDragItemRefNum); - - // What are the items being dragged? - CMailSelection selection; - if (!GetSelectionFromDrag(inDragRef, selection)) - return; - - // Don't do anything if the user aborted by dragging back into the same view. - if (selection.xpPane == GetMessagePane()) - return; - - Boolean copyMessages; - if (!GetDragCopyStatus(inDragRef, selection, copyMessages)) - return; - - // display modal dialog - short stringID = (copyMessages ? 19 : 15); // Copying / Moving Messages - CStr255 commandString; - ::GetIndString(commandString, 7099, stringID); - CMailProgressWindow* progressWindow = CMailProgressWindow::CreateModalParasite( - CMailProgressWindow::res_ID_modal, - selection.xpPane, - commandString); - if (progressWindow) - progressWindow->SetDelay(0); - - // copy / move messages - if (! copyMessages) - ::MSG_MoveMessagesIntoFolder( - selection.xpPane, - selection.GetSelectionList(), - selection.selectionSize, - mXPFolder.GetFolderInfo() - ); - else - ::MSG_CopyMessagesIntoFolder( - selection.xpPane, - selection.GetSelectionList(), - selection.selectionSize, - mXPFolder.GetFolderInfo() - ); - // Close any windows associated with these messages, if the preferences - // say we should. - CMessageWindow::NoteSelectionFiledOrDeleted(selection); - mUndoCommand = cmd_Undo; -} // CThreadView::ReceiveDragItem - -//---------------------------------------------------------------------------------------- -void CThreadView::DrawMessageSize( - const CMessage& inMessage, - const Rect& inLocalRect ) -//---------------------------------------------------------------------------------------- -{ - DrawTextString(inMessage.GetSizeStr(), - &mTextFontInfo, 2, inLocalRect, teFlushLeft, true, truncEnd); -} // CThreadView::DrawMessageSize - -//---------------------------------------------------------------------------------------- -void CThreadView::DrawMessagePriority( - const CMessage& inMessage, - const Rect& inLocalRect) -//---------------------------------------------------------------------------------------- -{ - DrawTextString(inMessage.GetPriorityStr(), - &mTextFontInfo, 0, inLocalRect); -} // CThreadView::DrawMessagePriority - -//---------------------------------------------------------------------------------------- -void CThreadView::DrawMessageStatus( - const CMessage& inMessage, - const Rect& inLocalRect) -//---------------------------------------------------------------------------------------- -{ - DrawTextString(inMessage.GetStatusStr(), - &mTextFontInfo, 0, inLocalRect); -} //CThreadView::DrawMessageStatus - -//---------------------------------------------------------------------------------------- -ResIDT CThreadView::GetIconID(TableIndexT inRow) const -//---------------------------------------------------------------------------------------- -{ - CMessage message(inRow, GetMessagePane()); - return message.GetIconID(mXPFolder.GetFolderFlags()); -} // CMessageFolderView::GetIconID - -//---------------------------------------------------------------------------------------- -UInt16 CThreadView::GetNestedLevel(TableIndexT inRow) const -//---------------------------------------------------------------------------------------- -{ - CMessage message(inRow, GetMessagePane()); - return message.GetThreadLevel(); -} // CThreadView::GetNestedLevel - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::GetHiliteTextRect( - const TableIndexT inRow, - Rect& outRect) const -//---------------------------------------------------------------------------------------- -{ - STableCell cell(inRow, GetHiliteColumn()); - if (!GetLocalCellRect(cell, outRect)) - return false; - Rect iconRect; - GetIconRect(cell, outRect, iconRect); - outRect.left = iconRect.right; - char subject[kMaxSubjectLength]; - GetHiliteText(inRow, subject, sizeof(subject), &outRect); - return true; -} // CThreadView::GetHiliteRect - -//---------------------------------------------------------------------------------------- -void CThreadView::GetDropFlagRect( - const Rect& inLocalCellRect, - Rect& outFlagRect ) const -//---------------------------------------------------------------------------------------- -{ - Inherited::GetDropFlagRect(inLocalCellRect, outFlagRect); - if (GetSortedColumn() != kThreadMessageColumn) - { - // Return a rectangle of zero width. - outFlagRect.left = inLocalCellRect.left; - outFlagRect.right = outFlagRect.left; - } -} // CThreadView::GetDropFlagRect - -//---------------------------------------------------------------------------------------- -void CThreadView::GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -// Calculate the text and (if ioRect is not passed in as null) a rectangle that fits it. -// Return result indicates if any of the text is visible in the cell -//---------------------------------------------------------------------------------------- -{ - if (!outText || inMaxBufferLength < 2) - return; - CMessage message(inRow, GetMessagePane()); - const char* raw = message.GetSubject(outText, inMaxBufferLength - 1); - char* conv = IntlDecodeMimePartIIStr(raw, mContext->GetWinCSID(), FALSE); - if (conv) - { - XP_STRNCPY_SAFE(outText, conv, inMaxBufferLength); - XP_FREE(conv); - } -} // CThreadView::GetMainRowText - -//---------------------------------------------------------------------------------------- -void CThreadView::DrawMessageSubject( - TableIndexT inRow, - const Rect& inLocalRect) -// Draw the message drop flag, icon and subject -//---------------------------------------------------------------------------------------- -{ - // draw a drop flag if we're sorted by thread and this - // message is a thread header... - char subject[kMaxSubjectLength]; - Rect textRect = inLocalRect; - if (GetHiliteText(inRow, subject, sizeof(subject), &textRect)) - { - if (mContext->GetWinCSID() == CS_UTF8) - { - textRect.right = inLocalRect.right; // calculation will have been wrong. - DrawUTF8TextString(subject, &mTextFontInfo, 0, textRect); - } - else - DrawTextString(subject, &mTextFontInfo, 0, textRect); -// if (inRow == mDropRow) -// ::InvertRect(&textRect); - } -} // CThreadView::DrawMessageSubject - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::CellSelects(const STableCell& inCell) const -//---------------------------------------------------------------------------------------- -{ - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { - case kThreadMessageColumn: - { - CMessage message(inCell.row, GetMessagePane()); - return (message.IsThread()); - } - case kMarkedReadMessageColumn: - case kFlagMessageColumn: - return false; - default: - return true; - } -} // CThreadView::CellSelects - -//----------------------------------- -void CThreadView::SetRowCount() -// Queries the back end pane and sets the number of rows. -// Overridden to call MSG_GetThreadLineByIndex, which forces -// authentication if the preference specifies it. A result of false -// means that the folder is password protected. -//----------------------------------- -{ - MSG_MessageLine ignored; - MSG_Pane* pane = GetMessagePane(); - if (!pane || !::MSG_GetThreadLineByIndex(pane, 0, 1, &ignored)) - { - // Access denied! - TableIndexT rows, cols; - GetTableSize(rows, cols); - if (rows > 0) - RemoveRows(rows, 1, false); - return; - } - Inherited::SetRowCount(); -} // CThreadView::SetRowCount() - - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::CellWantsClick ( const STableCell& inCell ) const -// Overloaded to ensure that certain columns get the mouse click -//---------------------------------------------------------------------------------------- -{ - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { -// case kThreadMessageColumn: - case kMarkedReadMessageColumn: - case kFlagMessageColumn: - case kPriorityMessageColumn: - return true; - - default: - return false; - } - -} // CThreadView::CellWantsClick - - -//---------------------------------------------------------------------------------------- -void CThreadView::ClickCell( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -// Handles marking message read/unread -//---------------------------------------------------------------------------------------- -{ - CMailProgressWindow::RemoveModalParasite(); - PaneIDT cellType = GetCellDataType(inCell); - switch (cellType) - { - case kThreadMessageColumn: - { - if (GetSortedColumn() == kThreadMessageColumn) - { - CMessage message(inCell.row, GetMessagePane()); - if (message.IsThread()) - { - if (! message.IsOpenThread()) - ToggleExpandAction(inCell.row); - DoSelectThread(inCell.row); - CMessage::InvalidateCache(); // Because BE has changed the message state - } - } - break; - } - // toggle the message's read/unread state - case kMarkedReadMessageColumn: - { - MSG_ViewIndex index = inCell.row - 1; - MSG_Command(GetMessagePane(), MSG_ToggleMessageRead, &index, 1); - CMessage::InvalidateCache(); // Because BE has changed the message state - RefreshCell(inCell); - break; - } - case kFlagMessageColumn: - { - CMessage message(inCell.row, GetMessagePane()); - MSG_CommandType cmd = message.IsFlagged() ? MSG_UnmarkMessages : MSG_MarkMessages; - MSG_ViewIndex index = inCell.row - 1; - MSG_Command(GetMessagePane(), cmd, &index, 1); - CMessage::InvalidateCache(); // Because BE has changed the message state - RefreshCell(inCell); - break; - } - case kPriorityMessageColumn: - { - if ((mXPFolder.GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) != 0) - break; // no priority for news. - - // calculate popup location - FocusDraw(); - Point where = inMouseDown.wherePort; - PortToGlobalPoint(where); - Rect cellRect; - if (GetLocalCellRect(inCell, cellRect)) - { - where = topLeft(cellRect); - ::LocalToGlobal(&where); - } - - // get popup default value - CMessage message(inCell.row, GetMessagePane()); - MSG_PRIORITY oldPriority = message.GetPriority(); - Int16 defaultChoice = CMessage::PriorityToMenuItem(oldPriority); - - // display popup - Int16 menuItem = 0; - LMenu * thePopup = new LMenu(kPriorityMenuID); - - { // copied from HandlePopupMenuSelect() - - MenuHandle menuH = thePopup->GetMacMenuH(); - -// we decided that all the context menus should look the same and -// this meant drawing them in the system font (at least for 4.0) -// to re-enable drawing in another font just take out my #ifdef's -// and #endif's -#ifdef USE_SOME_OTHER_FONT_FOR_THE_PRIORITY_MENU - Int16 saveFont = ::LMGetSysFontFam(); - Int16 saveSize = ::LMGetSysFontSize(); - - StMercutioMDEFTextState theMercutioMDEFTextState; -#endif - try { -#ifdef USE_SOME_OTHER_FONT_FOR_THE_PRIORITY_MENU - - // Reconfigure the system font so that the menu will be drawn in our desired - // font and size - if ( mTextTraitsID ) { - FocusDraw(); - TextTraitsH traitsH = UTextTraits::LoadTextTraits(mTextTraitsID); - if ( traitsH ) { - // Bug #64133 - // If setting to application font, get the application font for current script - if((**traitsH).fontNumber == 1) - ::LMSetSysFontFam ( ::GetScriptVariable(::FontToScript(1), smScriptAppFond) ); - else - ::LMSetSysFontFam ( (**traitsH).fontNumber ); - ::LMSetSysFontSize((**traitsH).size); - ::LMSetLastSPExtra(-1L); - } - } -#endif - // Handle the actual insertion into the hierarchical menubar - ::InsertMenu(menuH, hierMenu); - - // Call PopupMenuSelect and wait for it to return - Int32 result = ::PopUpMenuSelect(menuH, where.v, where.h, defaultChoice); - - // Extract the values from the returned result. - menuItem = LoWord(result); - } - catch(...) { - // Ignore errors - } - -// this is the last one of these that you'd want to take out in order -// to re-enable the ability to use some font (other than the system font) -// to draw the priority context menu -#ifdef USE_SOME_OTHER_FONT_FOR_THE_PRIORITY_MENU - // Restore the system font - ::LMSetSysFontFam(saveFont); - ::LMSetSysFontSize(saveSize); - ::LMSetLastSPExtra(-1L); -#endif - // Finally get the menu removed - ::DeleteMenu(kPriorityMenuID); - } - - if (menuItem) - { - MSG_PRIORITY newPriority = CMessage::MenuItemToPriority(menuItem); - if (newPriority != oldPriority) - { - // BE bug? We're not getting told that a change happened. So - // do it ourselves. If this gets fixed later, we can remove these - // change calls. - ChangeStarting(GetMessagePane(), MSG_NotifyChanged, inCell.row, 1); - MSG_SetPriority(GetMessagePane(), message.GetMessageKey(), newPriority); - ChangeFinished(GetMessagePane(), MSG_NotifyChanged, inCell.row, 1); - CMessage::InvalidateCache(); // Because BE has changed the message state - } - } - break; - } - default: - break; - } -} // CThreadView::ClickCell - -//---------------------------------------------------------------------------------------- -TableIndexT CThreadView::GetHiliteColumn() const -//---------------------------------------------------------------------------------------- -{ - return mTableHeader->ColumnFromID(kSubjectMessageColumn); -} // CThreadView::GetHiliteColumn - -//---------------------------------------------------------------------------------------- -void CThreadView::SetCellExpansion( - const STableCell& inCell, - Boolean inExpanded) -//---------------------------------------------------------------------------------------- -{ - Boolean currentlyExpanded; - if (!CellHasDropFlag(inCell, currentlyExpanded) || (inExpanded == currentlyExpanded)) - return; - ToggleExpandAction(inCell.row); - CMessage::InvalidateCache(); // Because BE has changed the message state -} // CThreadView::SetCellExpansion - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::CellInitiatesDrag(const STableCell& inCell) const -//---------------------------------------------------------------------------------------- -{ - PaneIDT cellType = GetCellDataType(inCell); - return (cellType == kSubjectMessageColumn - || (cellType == kThreadMessageColumn && GetSortedColumn() == kThreadMessageColumn)); -} // CThreadView::CellInitiatesDrag - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::CellHasDropFlag( - const STableCell& inCell, - Boolean& outExpanded) const -//---------------------------------------------------------------------------------------- -{ - PaneIDT cellType = GetCellDataType(inCell); - - // Only show drop flags when we're sorted by thread - if (cellType == kSubjectMessageColumn && GetSortedColumn() == kThreadMessageColumn) - { - CMessage message(inCell.row, GetMessagePane()); - if (message.IsThread()) - { - outExpanded = message.IsOpenThread(); - return true; - } - } - return false; -} // CThreadView::CellHasDropFlag - -//---------------------------------------------------------------------------------------- -TableIndexT CThreadView::CountExtraRowsControlledByCell(const STableCell& inCell) const -//---------------------------------------------------------------------------------------- -{ - PaneIDT cellType = GetCellDataType(inCell); - // Only show drop flags when we're sorted by thread - if (cellType != kThreadMessageColumn || GetSortedColumn() != kThreadMessageColumn) - return 0; - int32 msgExpansionDelta = MSG_ExpansionDelta(GetMessagePane(), inCell.row - 1); - if (msgExpansionDelta >= 0) - return 0; - return -msgExpansionDelta; -} // CThreadView::CountExtraRowsControlledByCell - -//---------------------------------------------------------------------------------------- -void CThreadView::OpenRow(TableIndexT inRow) -// Open the message into its own window. -//---------------------------------------------------------------------------------------- -{ - Assert_(mContext); - - // Check the application heap. - if (Memory_MemoryIsLow() || ::MaxBlock() < 100*1024) - throw memFullErr; - // Check the Mozilla allocator - void* temp = XP_ALLOC(20*1024); - if (!temp) - throw memFullErr; - XP_FREE(temp); - - ::SetCursor(*::GetCursor(watchCursor)); - Boolean multipleSelection = GetSelectedRowCount() > 1; - CMessage message(inRow, GetMessagePane()); - // if a Draft, template, or Queue message open the compose window - if ( - (mXPFolder.GetFolderFlags() - & (MSG_FOLDER_FLAG_DRAFTS | MSG_FOLDER_FLAG_QUEUE | MSG_FOLDER_FLAG_TEMPLATES)) - || message.IsTemplate() - ) - { - ::MSG_OpenDraft(GetMessagePane() , mXPFolder.GetFolderInfo(), message.GetMessageKey()); - return; - } - // First see if there's an open window open to this message. If there is, - // bring it to the front. - CMessageWindow* messageWindow = CMessageWindow::FindAndShow(message.GetMessageKey()); - if (messageWindow) - { - messageWindow->GetMessageView()->SetDefaultCSID(mContext->GetDefaultCSID()); - // Found it. Bring it to the front. - messageWindow->Select(); - return; - } - // First, if recycling a window is indicated, ask for any existing one. - if (mContext->GetCurrentCommand() != cmd_OpenSelectionNewWindow) - { - // With a multiple selection, we never recycle! - XP_Bool prefReuseWindow = 0; // recycle any message window - PREF_GetBoolPref("mailnews.reuse_message_window", &prefReuseWindow); - if (!multipleSelection && - (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) ^ prefReuseWindow)) - { - messageWindow = CMessageWindow::FindAndShow(0); - } - } - // If we couldn't (or shouldn't) recycle one, make a new one. - if (!messageWindow) - { - try - { - messageWindow = - (CMessageWindow*)URobustCreateWindow::CreateWindow( - CMessageWindow::res_ID, - LCommander::GetTopCommander()); - CBrowserContext* theContext = new CBrowserContext(MWContextMailMsg); - StSharer theShareLock(theContext); // if we throw, theContext will have no users & die - messageWindow->SetWindowContext(theContext); - } - catch(...) - { - delete messageWindow; - messageWindow = NULL; - throw; - } - } - // Whether it's a new one or an old one, load the message now. - if (messageWindow) - { - try - { - messageWindow->GetMessageView()->ShowMessage( - CMailNewsContext::GetMailMaster(), - mXPFolder.GetFolderInfo(), - message.GetMessageKey()); // pass flags to tell what sort of message it is - messageWindow->GetMessageView()->SetDefaultCSID(mContext->GetDefaultCSID()); - messageWindow->Select(); -// messageWindow->Show(); - // The window will now show itself when a successful load occurs - } - catch(...) - { - delete messageWindow; - messageWindow = NULL; - throw; - } - } - CMessage::InvalidateCache(); // So that the "read" flag gets changed. -} // CThreadView::OpenRow - -#define THREE_PANE 1 - -//---------------------------------------------------------------------------------------- -void CThreadView::SaveSelectedMessage() -//---------------------------------------------------------------------------------------- -{ - MSG_Pane* curPane = GetMessagePane(); - if (curPane) - { - MSG_FolderInfo* curFolder = ::MSG_GetThreadFolder(curPane); - if (curFolder) - { - if (GetSelectedRowCount() == 1) - { - TableIndexT curRow = mTableSelector->GetFirstSelectedRow(); - CMessage message(curRow, curPane); - MessageKey curMessage = message.GetMessageKey(); - ::MSG_SetLastMessageLoaded(curFolder, curMessage); - } - else - ::MSG_SetLastMessageLoaded(curFolder, MSG_MESSAGEKEYNONE); - } - } -} // CThreadView::SaveSelectedMessage - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::RestoreSelectedMessage() -// Called on FolderLoaded pane notification. We probably should check the preference. -//---------------------------------------------------------------------------------------- -{ - XP_Bool remember = true; - if (PREF_NOERROR != PREF_GetBoolPref("mailnews.remember_selected_message", &remember)) - return false; - if (!remember) - return false; - MSG_Pane* curPane = GetMessagePane(); - if (curPane) - { - MSG_FolderInfo* curFolder = ::MSG_GetThreadFolder(curPane); - if (curFolder) - { - MessageKey savedMessage = ::MSG_GetLastMessageLoaded(curFolder); - if (savedMessage != MSG_MESSAGEKEYNONE) - { - MSG_ViewIndex index = ::MSG_GetMessageIndexForKey(curPane, savedMessage, true); - if (index != MSG_VIEWINDEXNONE) - { - mRowToSelect = index + 1; - return true; - } - } - } - } - return false; -} // CThreadView::RestoreSelectedMessage - -//---------------------------------------------------------------------------------------- -void CThreadView::LoadMessageFolder( - CNSContext* inContext, // My window's context - const CMessageFolder& inFolder, - Boolean inLoadNow) -// Load a given message folder into the message table view. -//---------------------------------------------------------------------------------------- -{ - Assert_(inContext); - // Load the folder into the message list. We'll get a PaneChanged message - // when loading is complete, and another one to say that the folder info - // has changed. When these callbacks occur, we'll call SetFolder(). However, - // the first time the window is initialized, the title needs to look nice - // even during the load process. Hence this call, which will be made twice: - SetFolder(inFolder); - if (!inLoadNow) - { - CDeferredLoadFolderTask* task - = new CDeferredLoadFolderTask(this, inContext, inFolder); - CDeferredTaskManager::Post1(task, this); - return; - } - try - { - ::SetCursor(*::GetCursor(watchCursor)); - SaveSelectedMessage(); - UnselectAllCells(); - // Else it crashes, because the messageview (if displaying a message), doesn't - // get cleaned up properly. #81060 - mContext = inContext; -#if !ONECONTEXTPERWINDOW - SetMessagePane(nil); // release the memory first. -#endif - // A null inFolder is possible, and the result should be to clear the thread area. - // This behavior is new in 5.0 with the 3-pane window - 97/10/06 - if (!inFolder.GetFolderInfo()) - { - RemoveAllRows( true ); - SetMessagePane(nil); - return; - } -#if ONECONTEXTPERWINDOW - if (!GetMessagePane()) -#endif - { - SetMessagePane(::MSG_CreateThreadPane(*inContext, CMailNewsContext::GetMailMaster())); - ThrowIfNULL_(GetMessagePane()); - // plug into the view so we get notified when the data changes - ::MSG_SetFEData(GetMessagePane(), CMailCallbackManager::Get()); - } - if (inFolder.GetFolderInfo() == MSG_GetThreadFolder(GetMessagePane())) - return; - -#if USING_MODAL_FOLDER_LOAD - CStr255 commandString; - ::GetIndString(commandString, 7099, 16); // "Loading Folder" - CMailProgressWindow::CreateModalParasite( - CMailProgressWindow::res_ID_modal, - GetMessagePane(), - commandString); -#endif - // Close any other windows showing this folder - CWindowIterator iter(WindowType_MailThread); - CThreadWindow* thisWindow - = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - - CThreadWindow* window; - for (iter.Next(window); window; iter.Next(window)) - { - window = dynamic_cast(window); - if (window && window != thisWindow) - { - CMessageView* messageView = window->GetMessageView(); - if (inFolder.GetFolderInfo() == messageView->GetFolderInfo()) - window->AttemptClose(); - } - } -#if 1 - // IMAP mailboxes do "get new mail" automatically. So set up the flags to expect new - // mail. - if ((inFolder.GetFolderFlags() & MSG_FOLDER_FLAG_IMAPBOX) == MSG_FOLDER_FLAG_IMAPBOX) - ExpectNewMail(); -#else - // IMAP inbox does "get new mail" automatically. So set up the flags to expect new - // mail. - #define IMAP_INBOX (MSG_FOLDER_FLAG_INBOX | MSG_FOLDER_FLAG_IMAPBOX) - if ((inFolder.GetFolderFlags() & IMAP_INBOX) == IMAP_INBOX) - ExpectNewMail(); -#endif - // Now finally, load the folder - ThrowIfError_(::MSG_LoadFolder(GetMessagePane(), inFolder.GetFolderInfo())); - - #ifndef THREE_PANE - SwitchTarget(this); - #endif - - // Change the i18n encoding and font to match the new folder: - int foldercsid = ::MSG_GetFolderCSID(inFolder.GetFolderInfo()); - if ((CS_UNKNOWN == foldercsid) || (CS_DEFAULT == foldercsid)) - { - foldercsid = INTL_DefaultDocCharSetID(0); - ::MSG_SetFolderCSID(inFolder.GetFolderInfo(), foldercsid); - } - SetDefaultCSID(foldercsid); - ResetTextTraits(); // May need to change the font when we change folder - } - catch(...) - { - } -} // CThreadView::LoadMessageFolder - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::RelocateViewToFolder(const CMessageFolder& inFolder) -// Retarget the view to the specified BE folder. -//---------------------------------------------------------------------------------------- -{ - if (!inFolder.GetFolderInfo() || inFolder == mXPFolder) - return false; - - if (CThreadWindow::FindAndShow(inFolder.GetFolderInfo()) == nil) - { - MSG_Master* master = CMailNewsContext::GetMailMaster(); - LoadMessageFolder(mContext, inFolder); - return true; - } - return false; -} // CThreadWindow::RelocateViewToFolder - - -//---------------------------------------------------------------------------------------- -void CThreadView::FileMessagesToSelectedPopupFolder(const char *inFolderName, - Boolean inMoveMessages) -// File selected messages to the specified BE folder. If inMoveMessages is true, move -// the messages, otherwise copy them. -//---------------------------------------------------------------------------------------- -{ - if (!inFolderName || !*inFolderName) - return; - CMailSelection selection; - if ( !GetSelection(selection) ) { - Assert_(false); // Method should not be called in this case! - return; // Nothing selected! - } - -#ifdef Debug_Signal - const char *curName = ::MSG_GetFolderNameFromID(GetOwningFolder()); - Assert_(strcasecomp(curName, inFolderName) != 0); // Specified folder should not be the same as this folder -#endif // Debug_Signal - - CStr255 commandString; - ::GetIndString(commandString, 7099, (inMoveMessages ? 15 : 19)); // "Moving/Copying Messages" - CMailProgressWindow* progressWindow = CMailProgressWindow::CreateModalParasite( - CMailProgressWindow::res_ID_modal, - GetMessagePane(), - commandString); - if (progressWindow) - progressWindow->SetDelay(0); - if ( inMoveMessages ) - ::MSG_MoveMessagesInto(selection.xpPane, selection.GetSelectionList(), selection.selectionSize, - inFolderName); - else - ::MSG_CopyMessagesInto(selection.xpPane, selection.GetSelectionList(), selection.selectionSize, - inFolderName); - mUndoCommand = cmd_Undo; -} // CThreadWindow::FileMessagesToSelectedPopupFolder - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::ScrollToGoodPlace() -//---------------------------------------------------------------------------------------- -{ - if (mRows == 0) - return false; - MessageKey id; - MSG_ViewIndex index; - MSG_ViewIndex threadIndex; - MSG_ViewNavigate(GetMessagePane(), MSG_FirstNew, 0, &id, &index, &threadIndex, NULL); - if (index != MSG_VIEWINDEXNONE) - { - ScrollRowIntoFrame(mRows); // show bottom cell... - ScrollRowIntoFrame(index + 1); // ... then show first unread. - return true; - } - return false; -} // CThreadView::ScrollToGoodPlace - -//---------------------------------------------------------------------------------------- -void CThreadView::NoteSortByThreadColumn(Boolean isThreaded) const -//---------------------------------------------------------------------------------------- -{ - if (isThreaded) - GetTableHeader()->ChangeIconOfColumn(kThreadMessageColumn, kThreadedIcon); - else - GetTableHeader()->ChangeIconOfColumn(kThreadMessageColumn, kUnthreadedIcon); -} - -//---------------------------------------------------------------------------------------- -void CThreadView::ChangeSort(const LTableHeader::SortChange* inSortChange) -//---------------------------------------------------------------------------------------- -{ - CStandardFlexTable::ChangeSort(inSortChange); - if (GetMessagePane() != NULL) - { - MSG_CommandType sortCommand; - switch (inSortChange->sortColumnID) - { - case kDateMessageColumn: sortCommand = MSG_SortByDate; break; - case kSubjectMessageColumn: sortCommand = MSG_SortBySubject; break; - case kThreadMessageColumn: sortCommand = MSG_SortByThread; break; - case kSenderMessageColumn: - case kAddresseeMessageColumn: sortCommand = MSG_SortBySender; break; - - case kMarkedReadMessageColumn: sortCommand = MSG_SortByUnread; break; - case kPriorityMessageColumn: sortCommand = MSG_SortByPriority; break; - case kSizeMessageColumn: sortCommand = MSG_SortBySize; break; - case kStatusMessageColumn: sortCommand = MSG_SortByStatus; break; - case kFlagMessageColumn: sortCommand = MSG_SortByFlagged; break; - case kHiddenOrderReceivedColumn: sortCommand = MSG_SortByMessageNumber; break; - //case kUnreadMessageColumn: sortCommand = - //case kTotalMessageColumn: sortCommand = - - default: sortCommand = (MSG_CommandType) 0; - } - if (sortCommand != 0) - { - CMailProgressWindow::RemoveModalParasite(); - ::MSG_Command(GetMessagePane(), sortCommand, NULL, 0); - // Make sure the menus and headers reflect the new state of affairs - SyncSortToBackend(); - } - } -} // CThreadView::ChangeSort - -//---------------------------------------------------------------------------------------- -void CThreadView::DeleteSelection() -// Delete all selected messages -//---------------------------------------------------------------------------------------- -{ - try - { - CMailSelection selection; - if (GetSelection(selection)) - { -#if 0 - // Don't do this any more! Interrupting IMAP will cause a crash if the timing - // is just right. 98/03/31 - CThreadWindow* threadWindow - = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - XP_ASSERT(threadWindow); - CMessageView* messageView - = dynamic_cast(threadWindow-> - FindPaneByID(CMessageView::class_ID)); - XP_ASSERT(messageView); - messageView->ObeyCommand(cmd_Stop, NULL); -#endif - // Try to close any open windows on these messages - const MSG_ViewIndex* index = selection.GetSelectionList(); - for (int i = 0; i < selection.selectionSize; i++,index++) - { - CMessage message((*index + 1), GetMessagePane()); - // (Add one to convert to TableIndexT) - CMessageWindow::CloseAll(message.GetMessageKey()); - } - MSG_CommandType cmd = - ((mXPFolder.GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) == 0) - ? UMessageLibrary::GetMSGCommand(cmd_Clear) - : MSG_CancelMessage; // cancel my posting, if possible. - CMailProgressWindow::RemoveModalParasite(); - MSG_Command( - GetMessagePane(), - cmd, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize); - UnselectAllCells(); - } - // The selection of a new message after one is removed is handled by a deferred task. - // We used to start this timer immediately on initiating the delete operation (here) - // but this ended up firing before the refresh occurred, resulting in two rows - // selected, which was ugly. So we moved the posting call to DrawCellContents, - // to make sure that the row isn't selected until after the refresh is done. 98/01/14 - } - catch(...) {} -} // CThreadView::DeleteSelection() - -//---------------------------------------------------------------------------------------- -void CThreadView::ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -//---------------------------------------------------------------------------------------- -{ - if (mMysticPlane <= kMysticUpdateThreshHold - && (inChangeCode == MSG_NotifyScramble || inChangeCode == MSG_NotifyAll)) - { - try - { - // Get the selection, convert it to non-volatile MSG_FolderInfo... - CMailSelection selection; - if (GetSelection(selection)) - { - delete mSavedSelection; - mSavedSelection = new CPersistentMessageSelection(selection); - } - } - catch (...) {} - } - Inherited::ChangeStarting(inPane, inChangeCode, inStartRow, inRowCount); -} // CThreadView::ChangeStarting - -//---------------------------------------------------------------------------------------- -void CThreadView::ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount) -//---------------------------------------------------------------------------------------- -{ - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - if (mMysticPlane <= kMysticUpdateThreshHold) - { - switch (inChangeCode) - { - case MSG_NotifyScramble: - case MSG_NotifyAll: - { - SetNotifyOnSelectionChange(false); - try - { - UnselectAllCells(); - if (mSavedSelection) - { - const MSG_ViewIndex* index = mSavedSelection->GetSelectionList(); - MSG_ViewIndex count = mSavedSelection->selectionSize; - for (MSG_ViewIndex i = 0; i < count; i++, index++) - { - if (*index != MSG_VIEWINDEXNONE) - SelectRow(1 + *index); - } - } - } - catch (...) {} - SetNotifyOnSelectionChange(true); - SelectionChanged(); - delete mSavedSelection; - mSavedSelection = NULL; - } - break; - case MSG_NotifyInsertOrDelete: - if (CMailProgressWindow::GettingMail()) // could happen from the folder pane etc. - mExpectingNewMail = true; - if (mExpectingNewMail || inRowCount > 0) - mGotNewMail = true; - // If we're deleting the only selected row, we may need to select - // something later. Don't do this as a result of "get new mail", though. - // The intention here is that this behavior is only to happen as a result - // of an explicit user delete, on the current machine (Note that you may - // log on to another machine and delete the message that is currently - // selected. Note also that, during folder load, filters can cause a - // "row-deleted" message here.) - if (inRowCount == -1 // one row was deleted - && mSelectAfterDelete // the preference to do this is on - && GetSelectedRowCount() == 0 // there is nothing selected now - && inStartRow <= mRows + 1 // range check (+1 if deleting last row) - && !mExpectingNewMail) // this is not a folder load, or get mail - mRowToSelect = inStartRow; - break; - } - CMessage::InvalidateCache(); // most changes will make the index invalid. - } -} // CThreadView::ChangeFinished - -//---------------------------------------------------------------------------------------- -void CThreadView::SetFolder(const CMessageFolder& inFolder) -// Set the window title to the folder name. -//---------------------------------------------------------------------------------------- -{ - mXPFolder = inFolder; - - Boolean isNewsgroup = ((mXPFolder.GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) != 0); - - char newName[255]; - const char* nameToUse = (inFolder.GetPrettyName() ? - inFolder.GetPrettyName() : inFolder.GetName()); - if (nameToUse) - { - strcpy(newName, nameToUse); - NET_UnEscape(newName); - } - else - *newName = '\0'; - - CThreadWindow* threadWindow - = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (threadWindow) - threadWindow->SetFolderName(newName, isNewsgroup); -} // CThreadView::SetFolderName - -// ------------------------- -void CThreadView::SyncSortToBackend() -//--------------------------- -{ - // This is ugly it would be better if we did this in FindCommandStatus. - // since the BE could provide us the needed info. The difficutly would be in keeping - // the headers in sync. If done properly would help simplify FindCommandStatus - // and eliminate all this extra stuff - // Something to think about for 5.0 - MSG_Pane* inPane = GetMessagePane(); - XP_Bool selectable; - MSG_COMMAND_CHECK_STATE checkedState; - const char* display_string = nil; - MSG_CommandType cmd; - XP_Bool plural; - for (cmd = MSG_SortByDate; - cmd <= MSG_SortByUnread; - cmd = MSG_CommandType( int(cmd) + 1)) - { - ::MSG_CommandStatus( - inPane, cmd, nil, 0, &selectable, &checkedState, &display_string, &plural ); - if (checkedState == MSG_Checked) - break; - } - PaneIDT pane = 0; - switch ( cmd ) - { - case MSG_SortByDate: pane = kDateMessageColumn; break; - case MSG_SortBySubject: pane = kSubjectMessageColumn; break; - case MSG_SortBySender: pane = kSenderMessageColumn; break; - case MSG_SortByUnread: pane = kMarkedReadMessageColumn;break; - case MSG_SortByPriority: pane = kPriorityMessageColumn; break; - case MSG_SortBySize: pane = kSizeMessageColumn; break; - case MSG_SortByStatus: pane = kStatusMessageColumn; break; - case MSG_SortByFlagged: pane = kFlagMessageColumn; break; - case MSG_SortByMessageNumber: pane = kHiddenOrderReceivedColumn; break; - default: - case MSG_SortByThread: pane = kThreadMessageColumn; break; - } - NoteSortByThreadColumn(cmd == MSG_SortByThread); - UInt16 col = mTableHeader->ColumnFromID( pane ); - ::MSG_CommandStatus( - inPane, MSG_SortBackward, nil, 0, &selectable, &checkedState, - &display_string, &plural); - Boolean backwards = checkedState == MSG_Checked; - mTableHeader->SetWithoutSort( col, backwards, true ); - // Make sure the sort submenus on the menu bar are showing the correct state. - UpdateSortMenuCommands(); -} // CThreadView::SyncSortToBackend() - -//---------------------------------------------------------------------------------------- -void CThreadView::PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -//---------------------------------------------------------------------------------------- -{ - switch (inNotifyCode) - { - case MSG_PaneNotifyFolderLoaded: - if (value > 0) - { - LWindow* win = LWindow::FetchWindowObject(GetMacPort()); - if (win) - win->Show(); - SetFolder(CMessageFolder((MSG_FolderInfo*)value)); - CMessage::InvalidateCache(); - SetRowCount(); - Refresh(); - } - // This is the first opportunity to do stuff that needs the folder etc. - // Update history entry and load an empty message into the message view. - // Calling SelectionChanged will do these things. - - SelectionChanged(); - - EnableStopButton(false); - if (mMotionPendingCommand != (MSG_MotionType)-1) - { - ObeyMotionCommand( mMotionPendingCommand ); - mMotionPendingCommand = (MSG_MotionType)-1; - } -#ifdef PREFERENCE_IMPLEMENTED - if (!RestoreSelectedMessage()) - ScrollToGoodPlace(); -#else - RestoreSelectedMessage(); // select the last selected message AND - mScrollToShowNew = true; - //ScrollToGoodPlace(); // scroll to show anything new. -#endif - DontExpectNewMail(); - // break; NO! Fall through, because we need to update the rowcount and sort order. - case MSG_PaneNotifyFolderInfoChanged: - if (mXPFolder == (MSG_FolderInfo*)value) - { - SyncSortToBackend(); - CMessage::InvalidateCache(); - } - mXPFolder.FolderInfoChanged(); - break; - case MSG_PaneProgressDone: // comes from progress window - if ((MessageT)value == msg_NSCAllConnectionsComplete) - { - if (GotNewMail()) // ie in THIS folder in THIS operation - { - CMessage::InvalidateCache(); - SetRowCount(); - Refresh(); - ScrollToGoodPlace(); - } - if (CMailProgressWindow::GettingMail()) - DontExpectNewMail(); - } - break; - case MSG_PaneNotifyFolderDeleted: - if ((MSG_FolderInfo*)value == mXPFolder.GetFolderInfo()) - { - RemoveAllRows( false ); - ::MSG_LoadFolder(GetMessagePane(), nil); - mXPFolder.SetFolderInfo(nil); // prevent crashes - } - break; - default: - Inherited::PaneChanged(inPane, inNotifyCode, value); - } -} // CThreadView::PaneChanged - -//---------------------------------------------------------------------------------------- -void CThreadView::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -//---------------------------------------------------------------------------------------- -{ - Inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - ScrollSelectionIntoFrame(); -} // CThreadView::ResizeFrameBy - -//---------------------------------------------------------------------------------------- -void CThreadView::FindSortCommandStatus(CommandT inCommand, Int16& outMark) -//---------------------------------------------------------------------------------------- -{ - PaneIDT paneID = GetSortedColumn(); - outMark = 0; - switch (inCommand) - { - case cmd_SortByDate: - if (paneID == kDateMessageColumn) - outMark = checkMark; - break; - case cmd_SortBySubject: - if (paneID == kSubjectMessageColumn) - outMark = checkMark; - break; - case cmd_SortBySender: - if (paneID == kSenderMessageColumn || paneID == kAddresseeMessageColumn) - outMark = checkMark; - break; - case cmd_SortByThread: - if (paneID == kThreadMessageColumn) - outMark = checkMark; - break; - case cmd_SortByPriority: - if (paneID == kPriorityMessageColumn) - outMark = checkMark; - break; - case cmd_SortBySize: - if (paneID == kSizeMessageColumn) - outMark = checkMark; - break; - case cmd_SortByReadness: - if (paneID == kMarkedReadMessageColumn) - outMark = checkMark; - break; - case cmd_SortByStatus: - if (paneID == kStatusMessageColumn) - outMark = checkMark; - break; - case cmd_SortByFlagged: - if (paneID == kFlagMessageColumn) - outMark = checkMark; - break; - case cmd_SortByOrderReceived: - if (paneID == kHiddenOrderReceivedColumn) - outMark = checkMark; - break; - case cmd_SortAscending: - case cmd_SortDescending: - outMark = - ((inCommand == cmd_SortDescending) == IsSortedBackwards()) ? - checkMark : 0; - break; - } -} // CThreadView::FindSortCommandStatus - -// ------------------------- -void CThreadView::UpdateSortMenuCommands() const -//--------------------------- -{ - list commandsToUpdate; - commandsToUpdate.push_front(cmd_SortByDate); - commandsToUpdate.push_front(cmd_SortBySubject); - commandsToUpdate.push_front(cmd_SortBySender); - commandsToUpdate.push_front(cmd_SortByThread); - commandsToUpdate.push_front(cmd_SortByPriority); - commandsToUpdate.push_front(cmd_SortBySize); - commandsToUpdate.push_front(cmd_SortByReadness); - commandsToUpdate.push_front(cmd_SortByStatus); - commandsToUpdate.push_front(cmd_SortByFlagged); - commandsToUpdate.push_front(cmd_SortByOrderReceived); - commandsToUpdate.push_front(cmd_SortAscending); - commandsToUpdate.push_front(cmd_SortDescending); - CTargetedUpdateMenuRegistry::SetCommands(commandsToUpdate); - CTargetedUpdateMenuRegistry::UpdateMenus(); -} // CThreadView::UpdateSortMenuCommands - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::ObeySortCommand(CommandT inCommand) -//---------------------------------------------------------------------------------------- -{ - PaneIDT oldColumnID = GetSortedColumn(); - Boolean oldReverse = IsSortedBackwards(); - PaneIDT newColumnID; - Boolean newReverse = oldReverse; - switch (inCommand) - { - case cmd_SortByDate: - newColumnID = kDateMessageColumn; - break; - case cmd_SortBySubject: - newColumnID = kSubjectMessageColumn; - break; - case cmd_SortBySender: - newColumnID = kSenderMessageColumn; - break; - case cmd_SortByThread: - newColumnID = kThreadMessageColumn; - break; - case cmd_SortByPriority: - newColumnID = kPriorityMessageColumn; - break; - case cmd_SortBySize: - newColumnID = kSizeMessageColumn; - break; - case cmd_SortByReadness: - newColumnID = kMarkedReadMessageColumn; - break; - case cmd_SortByStatus: - newColumnID = kStatusMessageColumn; - break; - case cmd_SortByFlagged: - newColumnID = kFlagMessageColumn; - break; - case cmd_SortByOrderReceived: - newColumnID = kHiddenOrderReceivedColumn; - break; - case cmd_SortAscending: - case cmd_SortDescending: - newColumnID = GetSortedColumn(); - newReverse = (cmd_SortDescending == inCommand); - break; - default: - return false; - } - if (oldColumnID != newColumnID || oldReverse != newReverse) - { - mTableHeader->SetSortedColumn(mTableHeader->ColumnFromID(newColumnID), newReverse, true); - } - return true; -} // CThreadView::ObeySortCommand - -//---------------------------------------------------------------------------------------- -void CThreadView::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//---------------------------------------------------------------------------------------- -{ - outEnabled =false; // This is probably unnecessary, I think PP does it before calling. - if (::StillDown()) - { - // Assume this is a call from the context menu attachment. - Point whereLocal; - ::GetMouse(&whereLocal); - SPoint32 imagePoint; - LocalToImagePoint(whereLocal, imagePoint); - STableCell hitCell; - if (GetCellHitBy(imagePoint, hitCell)) - { - PaneIDT cellType = GetCellDataType(hitCell); - if (cellType == kPriorityMessageColumn) - return; // disable all commands, because we do it ourselves. - // Fix me: there's no reason why the priority popup can't be done - // using the context menu mechanism now. - } - } - if (inCommand == cmd_Stop && mStillLoading) - { - outEnabled = true; // stop button on, nothing else. - return; - // ... otherwise, fall through and pass it up to the window - } - // Note: for cmd_Stop, the window may also be able to handle the command, if - // a message pane exists. - CMailSelection selection; - GetSelection(selection); - switch (inCommand) - { - // Single-selection items - case cmd_SelectThread: - outEnabled = selection.selectionSize == 1; - return; - // Items always available - case cmd_SubscribeNewsgroups: - outEnabled = true; - return; - case cmd_AddToBookmarks: - outEnabled = (mXPFolder.GetFolderFlags() & MSG_FOLDER_FLAG_IMAPBOX) == 0; - return; - case cmd_SelectMarkedMessages: - case cmd_MarkReadByDate: - case cmd_NewFolder: - outEnabled = true; - outUsesMark = false; - return; - case cmd_GetMoreMessages: - CStr255 cmdStr; - CStr255 numStr; - ::GetIndString(cmdStr, kMailNewsMenuStrings, kNextChunkMessagesStrID); - ::NumToString(CPrefs::GetLong(CPrefs::NewsArticlesMax), numStr); - cmdStr += numStr; - memcpy(outName, (StringPtr)cmdStr, cmdStr.Length() + 1); - break; - } - // Now check for message library commands. Remember (###), some of these are - // handled by CMessageView(), and that might be our super commander, so - // return here only if msglib enables the item for the thread pane. - // Also don't want the message pane to only deal with cases where 1 message is selected - if (FindMessageLibraryCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName) - && ( outEnabled || selection.selectionSize != 1) ) - return; - MSG_MotionType cmd = UMessageLibrary::GetMotionType(inCommand); - if (UMessageLibrary::IsValidMotion(cmd)) - { - XP_Bool selectable; - outEnabled = ( - GetMessagePane() - && MSG_NavigateStatus( - GetMessagePane(), - cmd, - selection.GetSelectionList() ? *selection.GetSelectionList() : MSG_VIEWINDEXNONE, - &selectable, - NULL) == 0 - && selectable - ); - outUsesMark = false; - if (outEnabled) // ONLY in this case. See the previous comment (###). - return; - } - if ( (inCommand == cmd_MoveMailMessages) || (inCommand == cmd_CopyMailMessages) || - CMailFolderSubmenu::IsMailFolderCommand(&inCommand) ) { - // Mail folder commands - outEnabled = (GetSelectedRowCount() > 0); - return; - } - // Default for if and switch: fall through into second switch - switch (inCommand) - { - case cmd_GetInfo: - outEnabled = false; // FIXME: implement it. - break; - case cmd_SortByDate: - case cmd_SortBySubject: - case cmd_SortBySender: - case cmd_SortByThread: - case cmd_SortByPriority: - case cmd_SortBySize: -// case cmd_SortByTotal: - case cmd_SortByReadness: - case cmd_SortByStatus: - case cmd_SortByFlagged: - case cmd_SortByOrderReceived: - case cmd_SortAscending: - case cmd_SortDescending: - if (!mStillLoading) - { - outUsesMark = true; - outEnabled = true; - FindSortCommandStatus(inCommand, outMark); - } - break; - default: - if (inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) - { - if (mContext) - { - outUsesMark = true; - outEnabled = true; - - int16 csid = CPrefs::CmdNumToDocCsid( inCommand ); - outMark = (csid == mContext->GetDefaultCSID()) ? 0x12 : ' '; - } - } - else - { - // if (inCommand == cmd_OpenSelection) - // outEnabled = false; - // else - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } - } -} // CThreadView::FindCommandStatus - -//---------------------------------------------------------------------------------------- -void CThreadView::SelectAfterDelete(TableIndexT row) -// Called from ObeyCommand after command completion. -// In "expanded mode", the user probably wants a new message to -// be loaded into the message pane after a deletion. -// So detect the case when a message was showing and the message has -// been moved from the folder. We want to display a new message. -//---------------------------------------------------------------------------------------- -{ - SetUpdateCommandStatus(true); // Always do this. - if (row > 0) - SelectRow(row > mRows ? mRows : row); -} // CThreadView::SelectAfterDelete - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::ObeyMotionCommand(MSG_MotionType cmd) -//---------------------------------------------------------------------------------------- -{ - if (!GetMessagePane()) return false; - Assert_(UMessageLibrary::IsValidMotion(cmd)); - try - { - CMailSelection selection; - GetSelection(selection); - MSG_ViewIndex resultIndex; - MessageKey resultKey = MSG_MESSAGEKEYNONE; - MSG_FolderInfo* finfo; - if (MSG_ViewNavigate( - GetMessagePane(), - cmd, - selection.GetSelectionList() ? *selection.GetSelectionList() : MSG_VIEWINDEXNONE, - &resultKey, - &resultIndex, - NULL, - &finfo) == 0) - { - if (resultKey != MSG_MESSAGEKEYNONE) - { - SetNotifyOnSelectionChange(false); - UnselectAllCells(); - SetNotifyOnSelectionChange(true); - if (finfo && finfo != GetOwningFolder()) - RelocateViewToFolder(finfo); - SelectMessageWhenReady(resultKey); - } - else if (finfo) - { - switch( cmd ) - { - case MSG_NextFolder: - case MSG_NextMessage: - mMotionPendingCommand = MSG_FirstMessage; - break; - case MSG_NextUnreadMessage: - case MSG_NextUnreadThread: - case MSG_NextUnreadGroup: - case MSG_LaterMessage: - case (MSG_MotionType)MSG_ToggleThreadKilled: - mMotionPendingCommand = MSG_NextUnreadMessage; - break; - default: - break; - } - RelocateViewToFolder( finfo ); - } - return true; - } - mUndoCommand = cmd_Undo; - } - catch (...) - { - SysBeep(1); - } - return false; -} // CThreadView::ObeyMotionCommand - -//---------------------------------------------------------------------------------------- -void CThreadView::SelectionChanged() -//---------------------------------------------------------------------------------------- -{ - Inherited::SelectionChanged(); -} // CThreadView::SelectionChanged - -//---------------------------------------------------------------------------------------- -void CThreadView::SelectMessageWhenReady(MessageKey inKey) -//---------------------------------------------------------------------------------------- -{ - if (mStillLoading || (!GetMessagePane())) - CDeferredTaskManager::Post1(new CDeferredSelectKeyTask(this, inKey), this); - else - SelectMessage(inKey); -} // CThreadView::SelectMessageWhenReady - -//---------------------------------------------------------------------------------------- -void CThreadView::SelectMessage(MessageKey inKey) -//---------------------------------------------------------------------------------------- -{ - Assert_(GetMessagePane()); - if (GetMessagePane()) - { - MSG_ViewIndex index = ::MSG_GetMessageIndexForKey(GetMessagePane(), inKey, true); - if (index != MSG_VIEWINDEXNONE) - SelectRow(index + 1); - } -} // CThreadView::SelectMessage - -//---------------------------------------------------------------------------------------- -void CThreadView::UpdateHistoryEntry() -//---------------------------------------------------------------------------------------- -{ - TableIndexT rowCount = GetSelectedRowCount(); - MSG_Pane* pane = GetMessagePane(); - if (!pane) - return; // e.g., during window creation - URL_Struct* url = nil; - char entryName[64]; - entryName[0] = '\0'; - if (rowCount == 1) - { -#if 0 // Auto-scroll should not be done here (+ it was redundant) - if (!CApplicationEventAttachment::CurrentEventHasModifiers(cmdKey) && - !CApplicationEventAttachment::CurrentEventHasModifiers(shiftKey)) - { - STableCell cell = GetFirstSelectedCell(); - if (IsValidCell(cell)) - ScrollCellIntoFrame(cell); - } -#endif - CMailSelection selection; - GetSelection( selection ); - CMessage message(*selection.GetSelectionList() + 1, selection.xpPane); - MessageKey id = message.GetMessageKey(); - url = ::MSG_ConstructUrlForMessage(pane, id); - message.GetSubject(entryName, sizeof(entryName)); - } - else - { - // zero selection or multiple selection - use folder for history entry - url = CreateURLForProxyDrag(entryName); - } - if (url && *entryName) - { - LO_DiscardDocument(*mContext); - // i18n problem- we need to convert entryName to UTF8 before call SHIST_CreateHistryEntry - // We didn't do that because mail/news is not alive yet.... - - History_entry* theNewEntry = ::SHIST_CreateHistoryEntry( - url, - entryName); - ::SHIST_AddDocument(*mContext, theNewEntry); - } - XP_FREEIF(url); -} // CThreadView::UpdateHistoryEntry - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::ObeyMarkReadByDateCommand() -//---------------------------------------------------------------------------------------- -{ - StDialogHandler handler(10525, NULL); - LWindow* dlog = handler.GetDialog(); - if (! dlog) - return true; - - CSearchDateField* dateField = dynamic_cast - (dlog->FindPaneByID(CSearchDateField::class_ID)); - if (dateField) - { - dateField->SetToToday(); - MessageT message; - do - { - message = handler.DoDialog(); - } while (message != msg_OK && message != msg_Cancel); - if (message == msg_OK) - { - Int16 outYear; UInt8 outMonth, outDay; - dateField->GetDate(&outYear, &outMonth, &outDay); - - tm time; - time.tm_sec = 1; - time.tm_min = 1; - time.tm_hour = 1; - time.tm_mday = outDay; - time.tm_mon = outMonth - 1; - time.tm_year = outYear - 1900; - time.tm_wday = -1; - time.tm_yday = -1; - time.tm_isdst = -1; - - time_t endDate = ::mktime(&time); - MSG_MarkReadByDate(GetMessagePane(), 0, endDate); - } - } - return true; -} // CThreadView::ObeyMarkReadByDateCommand - -//---------------------------------------------------------------------------------------- -void CThreadView::DoSelectThread(TableIndexT inSelectedRow) -// Select all messages belonging to the same thread as this row. -//---------------------------------------------------------------------------------------- -{ - CMessage message(inSelectedRow, GetMessagePane()); - MSG_ViewIndex threadIndex = MSG_ThreadIndexOfMsg(GetMessagePane(), message.GetMessageKey()); - if (threadIndex == MSG_VIEWINDEXNONE) - return; - TableIndexT first = 1 + threadIndex; - STableCell firstCell(first, 1); - TableIndexT last = first + CountExtraRowsControlledByCell(firstCell); - Assert_(first < last || first == inSelectedRow); - if (LTableRowSelector * selector = dynamic_cast(mTableSelector)) - { - // Powerplant's ClickSelect has already been called, so use the sense of the - // clicked cell and turn all other cells in the thread on or off to match. - STableCell clickedCell(inSelectedRow, 1); - Boolean doSelect = selector->CellIsSelected(clickedCell); - SetNotifyOnSelectionChange(false); - try - { - if (!CApplicationEventAttachment::CurrentEventHasModifiers(shiftKey|cmdKey)) - UnselectAllCells(); - for (TableIndexT i = first; i <= last; i++) - selector->DoSelect(i, doSelect, true, false); - } - catch (...) {} - SetNotifyOnSelectionChange(true); - SelectionChanged(); - } -} // CThreadView::DoSelectThread - -//---------------------------------------------------------------------------------------- -void CThreadView::DoSelectFlaggedMessages() -//---------------------------------------------------------------------------------------- -{ - SetNotifyOnSelectionChange(false); - try - { - if (!CApplicationEventAttachment::CurrentEventHasModifiers(shiftKey|cmdKey)) - UnselectAllCells(); - for (TableIndexT i = 1; i <= mRows; i++) - { - CMessage message(i, GetMessagePane()); - if (message.IsFlagged()) - SelectCell(STableCell(i, 1)); - } - } - catch (...) {} - SetNotifyOnSelectionChange(true); - SelectionChanged(); -} // CThreadView::DoSelectFlaggedMessages - -//---------------------------------------------------------------------------------------- -Boolean CThreadView::ObeyCommand( - CommandT inCommand, - void *ioParam) -//---------------------------------------------------------------------------------------- -{ - if (!mContext) - return false; - - if (inCommand == cmd_UnselectAllCells) - { - UnselectAllCells(); - return true; - } - - if (inCommand != cmd_Stop && XP_IsContextBusy((MWContext*)(*mContext))) - return LCommander::GetTopCommander()->ObeyCommand(inCommand, ioParam); // global commands OK. - if (inCommand == msg_TabSelect) - return (GetOwningFolder() != nil); // Allow selection only if a folder is loaded. - - Boolean commandHandled = false; - CommandT originalCommand = mContext->GetCurrentCommand(); - CNSContext* originalContext = mContext; // in case we close the window & delete it! - mContext->SetCurrentCommand(inCommand); - if (inCommand == cmd_GetNewMail || inCommand == cmd_GetMoreMessages) - { - ExpectNewMail(); - - // getting new messages: slow down the status bar - // to reduce flickers and improve performance - CThreadWindow* threadWindow - = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (threadWindow) - threadWindow->GetProgressListener()->SetLaziness( - CProgressListener::lazy_VeryButForThisCommandOnly); - } - // Don't let msgLib do the deletion since we want(?) to close open mail windows - if ( inCommand == cmd_Clear ) - { - DeleteSelection(); - return true; - } - if ( inCommand == cmd_NewFolder ) - { - UFolderDialogs::ConductNewFolderDialog(GetOwningFolder()); - return true; - } - - // If you're reading a news group, and you want to compose a new message, the new message - // is, by default, addressed to that news group... this test and reassignment are necessary - // to make this happen - if ( (inCommand == cmd_NewMailMessage) && (GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) ) { - inCommand = cmd_PostNew; - } - - // For msglib commands, we have to be careful to check whether the command - // can be handled for THIS pane, because the message pane might have - // enabled the menu item. Failing to check again here leads to a nasty - // crash. - Boolean enabled; Boolean usesMark; Char16 mark; Str255 name; - if (FindMessageLibraryCommandStatus(inCommand, enabled, usesMark, mark, name) - && enabled) - { - commandHandled = ObeyMessageLibraryCommand(inCommand, ioParam); - if (inCommand == cmd_Undo || inCommand == cmd_Redo) - { - UnselectAllCells(); - mUndoTask = new CDeferredUndoTask(this); - CDeferredTaskManager::Post1(mUndoTask, this); - } - else if (mUndoTask) - CDeferredTaskManager::Remove(mUndoTask, this); - } - if (!commandHandled) - { - MSG_MotionType mcmd = UMessageLibrary::GetMotionType(inCommand); - if (UMessageLibrary::IsValidMotion(mcmd)) - commandHandled = ObeyMotionCommand(mcmd); - if (!commandHandled) - { - // Mail folder commands. We come here either from a button (broadcast) or - // from a menu command (synthetic). - const char* folderPath = nil; - if (inCommand == cmd_MoveMailMessages || inCommand == cmd_CopyMailMessages) - { - // Button case - if ( ioParam ) // The BE dereferences this ASAP - folderPath = ::MSG_GetFolderNameFromID((MSG_FolderInfo*)ioParam); - } - else if (!CMailFolderSubmenu::IsMailFolderCommand(&inCommand, &folderPath)) // menu case - { - folderPath = nil; // any other case. - } - if (folderPath && *folderPath) - { - FileMessagesToSelectedPopupFolder( - folderPath, - inCommand == cmd_MoveMailMessages); - commandHandled = true; - } - } - } - if (!commandHandled) switch(inCommand) - { - case cmd_SubscribeNewsgroups: - MSG_Host* selectedHost = MSG_GetHostForFolder(GetOwningFolder()); - CNewsSubscriber::DoSubscribeNewsGroup(selectedHost); - break; - case cmd_MarkReadByDate: - ObeyMarkReadByDateCommand(); - commandHandled = true; - break; -#if 0 - case cmd_RelocateViewToFolder: - // Don't handle this in the three-pane view. The folder pane has to change, too, - // so pass it up to CThreadWindow and let it delegate. - commandHandled = RelocateViewToFolder((MSG_FolderInfo*)ioParam); - break; -#endif // 0 - case cmd_SortByDate: - case cmd_SortBySubject: - case cmd_SortBySender: - case cmd_SortByThread: - case cmd_SortByPriority: - case cmd_SortBySize: - case cmd_SortByStatus: - case cmd_SortByFlagged: - case cmd_SortByOrderReceived: - case cmd_SortByReadness: - case cmd_SortAscending: - case cmd_SortDescending: - if (ObeySortCommand(inCommand)) - commandHandled = true; - break; - case cmd_SelectThread: - CMailSelection selection; - GetSelection( selection ); - TableIndexT selectedRow = *selection.GetSelectionList() + 1; - DoSelectThread(selectedRow); - break; - case cmd_SelectMarkedMessages: - DoSelectFlaggedMessages(); - break; - } // switch - if (!commandHandled && inCommand > ENCODING_BASE && inCommand < ENCODING_CEILING) - { - Int16 default_csid = CPrefs::CmdNumToDocCsid(inCommand); - SetDefaultCSID(default_csid); - LCommander::SetUpdateCommandStatus(true); // bug #80474 - commandHandled = true; - } - if (!commandHandled) - commandHandled = Inherited::ObeyCommand(inCommand, ioParam); - //----------------------------------- - // Cleanup - //----------------------------------- - // The following test against originalContext protects against the cases (quit, close) - // when the object has been deleted. The test against cmdHandled protects against - // re-entrant calls to ListenToMessage. - if (mContext == originalContext) - if (commandHandled) - mContext->SetCurrentCommand(cmd_Nothing); // watch out for re-entrant broadcast msgs. - else - { - // It wasn't a command, so restore damage done if we're processing a broadcast. - mContext->SetCurrentCommand(originalCommand); - } - return commandHandled; -} // CThreadView::ObeyCommand - -//---------------------------------------------------------------------------------------- -void CThreadView::ResetTextTraits() -//---------------------------------------------------------------------------------------- -{ - Int16 wincsid = mContext->GetWinCSID(); - ResIDT newTextTraitsID; - // ## Begin Hacky Code copy from Akbar (v3.0) mnews.cp - // This will make everyone happy. - // If the window is MAC_ROMAN, it will use the default mnews font. - // Otherwise, get it from the Font preference - if ( wincsid == INTL_CharSetNameToID(INTL_ResourceCharSet()) ) - newTextTraitsID = 130; - else - newTextTraitsID = CPrefs::GetTextFieldTextResIDs(wincsid); - // ## End of Hacky Code copy from Akbar (v3.0) mnews.cp - - if (newTextTraitsID != mTextTraitsID ) - { - SetTextTraits(newTextTraitsID); - Refresh(); - } -} // CThreadView::ResetTextTraits - -//---------------------------------------------------------------------------------------- -Int16 CThreadView::DefaultCSIDForNewWindow(void) -//---------------------------------------------------------------------------------------- -{ - if (mContext) - return mContext->GetDefaultCSID(); - return 0; -} // CThreadView::DefaultCSIDForNewWindow - -//---------------------------------------------------------------------------------------- -void CThreadView::SetDefaultCSID(Int16 default_csid) -//---------------------------------------------------------------------------------------- -{ - // Set the csid in the context - mContext->SetDefaultCSID(default_csid); - mContext->SetWinCSID(INTL_DocToWinCharSetID(default_csid)); - - // Set the csid for the folder - MSG_SetFolderCSID(GetOwningFolder(), default_csid); - - // We need to set the csid for the view with the window - // Ask the CThreadWindow to do it. - CThreadWindow* threadWindow - = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (threadWindow) - threadWindow->SetDefaultCSID(default_csid); - - // We need to change the text info and redraw all the header - ResetTextTraits(); - - // If we have Message Window appear, we need to set the csid for it. - try { - // Find the all the MessageWindow which view the some folder - // and set the default csid for its view. - - CWindowIterator iter(WindowType_Message); - CMessageWindow* window; - for (iter.Next(window); window; iter.Next(window)) - { - window = dynamic_cast(window); - if (window) - { - CMessageView* messageView = window->GetMessageView(); - if (GetOwningFolder() == messageView->GetFolderInfo()) - { - messageView->SetDefaultCSID(default_csid); - } - } - } - } - catch( ... ) - { - } - -} // CThreadView::SetDefaultCSID - -// ¥¥ÊFix me, this should go into some utility classes -//---------------------------------------------------------------------------------------- -void CThreadView::DrawUTF8TextString( - const char* inText, - const FontInfo* inFontInfo, - SInt16 inMargin, - const Rect& inBounds, - SInt16 inJustification, - Boolean inDoTruncate, - TruncCode inTruncWhere) -//---------------------------------------------------------------------------------------- -{ - Rect r = inBounds; - - r.left += inMargin; - r.right -= inMargin; - - PlaceUTF8TextInRect(inText, - strlen(inText), - r, - inJustification, - teCenter, - inFontInfo, - inDoTruncate, - inTruncWhere ); -} - -// ¥¥ÊFix me, this should go into some utility classes -//---------------------------------------------------------------------------------------- -void CThreadView::PlaceUTF8TextInRect( - const char* inText, - Uint32 inTextLength, - const Rect &inRect, - Int16 inHorizJustType, - Int16 inVertJustType, - const FontInfo* /*inFontInfo*/, - Boolean inDoTruncate, - TruncCode /*inTruncWhere*/) -//---------------------------------------------------------------------------------------- -{ - FontInfo utf8FontInfo; - UFontSwitcher *fs; - UMultiFontTextHandler *th; - th = UUTF8TextHandler::Instance(); - fs = UPropFontSwitcher::Instance(); - th->GetFontInfo(fs, &utf8FontInfo); - - const char* text = inText; - short length = inTextLength; - if (inDoTruncate) - { - // ¥¥ Fix ME: Don't know how to do text truncation for UTF8 now. - } - Point thePoint = UGraphicGizmos::CalcStringPosition( - inRect, - th->TextWidth(fs, (char*)text, length), - inHorizJustType, - inVertJustType, - &utf8FontInfo); - ::MoveTo(thePoint.h, thePoint.v); - th->DrawText(fs, (char*)text ,length); -} // CThreadView::PlaceUTF8TextInRect - -//---------------------------------------------------------------------------------------- -void CThreadView::ListenToMessage( - MessageT inCommand, - void *ioParam) -//---------------------------------------------------------------------------------------- -{ - // Check ObeyCommand first, for a button message, but ONLY IF WE'RE ON DUTY. - if (!IsOnDuty() || !ObeyCommand((CommandT)inCommand, ioParam)) // button message? - { - Inherited::ListenToMessage(inCommand, ioParam); - switch (inCommand) - { - case msg_NSCAllConnectionsComplete: - { -// if (mPendingCommand) -// { -// CommandT cmd = mPendingCommand; -// mPendingCommand = 0; -// ObeyCommand(cmd, nil); -// -// } -// else -#ifdef REMOVED_870427 - if (GotNewMail()) - { - ScrollToGoodPlace(); - DontExpectNewMail(); - } - break; -#endif - if (GetContext()->GetCurrentCommand() == cmd_GetNewMail) - DontExpectNewMail(); - } - } // switch - } -} // CThreadView::ListenToMessage - -//---------------------------------------------------------------------------------------- -void CThreadView::ActivateSelf() -//---------------------------------------------------------------------------------------- -{ - Inherited::ActivateSelf(); -} // CThreadView::ActivateSelf - -//---------------------------------------------------------------------------------------- -void CThreadView::ObeyCommandWhenReady(CommandT inCommand) -//---------------------------------------------------------------------------------------- -{ - if (inCommand != cmd_Nothing) - CDeferredTaskManager::Post(new CDeferredThreadViewCommand(this, inCommand, nil), this); -} - -//---------------------------------------------------------------------------------------- -URL_Struct* CThreadView::CreateURLForProxyDrag(char* outTitle) -//---------------------------------------------------------------------------------------- -{ - MSG_Pane* pane = GetMessagePane(); - if (!pane) - return nil; - MSG_FolderInfo* folderInfo = GetOwningFolder(); - if (!folderInfo) - return nil; - CMessageFolder folder(folderInfo); - if (outTitle) - { - strcpy(outTitle, folder.GetName()); - NET_UnEscape(outTitle); - } - return ::MSG_ConstructUrlForFolder(pane, folderInfo); -} // CThreadView::CreateURLForProxyDrag - -#if defined(QAP_BUILD) -//---------------------------------------------------------------------------------------- -void CThreadView::GetQapRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const -// Calculate the text and (if ioRect is not passed in as null) a rectangle that fits it. -// Return result indicates if any of the text is visible in the cell -//---------------------------------------------------------------------------------------- -{ - if (!outText || inMaxBufferLength == 0) - return; - - cstring rowText(""); - short colCount = mTableHeader->CountVisibleColumns(); - CMessage message(inRow, GetMessagePane()); - - CMailNewsWindow * myWindow = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - if (!myWindow) return; - - for (short col = 1; col <= colCount; col ++) - { - STableCell aCell(inRow, col); - LTableHeader::SColumnData * colData = mTableHeader->GetColumnData(col); - if (!colData) break; - LPane * colPane = myWindow->FindPaneByID(colData->paneID); - if (!colPane) break; - - // get column name - CStr255 descriptor; - switch (GetCellDataType(aCell)) - { - case kThreadMessageColumn: descriptor = "Thread"; break; - case kMarkedReadMessageColumn: descriptor = "MarkRead"; break; - case kFlagMessageColumn: descriptor = "Flag"; break; - default: - colPane->GetDescriptor(descriptor); - break; - } - rowText += descriptor; - rowText += "=\042"; - - // add cell text - switch (PaneIDT dataType = GetCellDataType(aCell)) - { - case kThreadMessageColumn: - if (message.IsThread()) - { - if (message.IsOpenThread()) - rowText += "-"; - else - rowText += "+"; - } - else - rowText += " "; - break; - - // note: no intl conversions (yet?) for subject, sender and addressee - case kMarkedReadMessageColumn: rowText += (message.HasBeenRead() ? "+" : " "); break; - case kFlagMessageColumn: rowText += (message.IsFlagged() ? "+" : " "); break; - case kSubjectMessageColumn: rowText += message.GetSubject(); break; - case kSenderMessageColumn: rowText += message.GetSender(); break; - case kDateMessageColumn: rowText += message.GetDateString(); break; - case kPriorityMessageColumn: rowText += message.GetPriorityStr(); break; - case kSizeMessageColumn: rowText += message.GetSizeStr(); break; - case kStatusMessageColumn: rowText += message.GetStatusStr(); break; - case kAddresseeMessageColumn: rowText += message.GetAddresseeString(); break; - - case kTotalMessageColumn: - case kUnreadMessageColumn: - if (GetSortedColumn() == kThreadMessageColumn && message.IsThread()) - { - int theNum = (dataType == kTotalMessageColumn - ? message.GetNumChildren() - : message.GetNumNewChildren()); - char tempStr[32]; - sprintf(tempStr, "%d", theNum); - rowText += tempStr; - } - break; - } - if (col < colCount) - rowText += "\042 | "; - else - rowText += "\042\r"; - } - strncpy(outText, (char*)rowText, inMaxBufferLength); - outText[inMaxBufferLength - 1] = '\0'; -} // CThreadView::GetQapRowText -#endif //QAP_BUILD diff --git a/mozilla/cmd/macfe/MailNews/CThreadView.h b/mozilla/cmd/macfe/MailNews/CThreadView.h deleted file mode 100644 index 870dc890fb1..00000000000 --- a/mozilla/cmd/macfe/MailNews/CThreadView.h +++ /dev/null @@ -1,387 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CThreadView.h - -#pragma once - -// PowerPlant -#include -#include -#include - -#include "msgcom.h" - -// Mac Netscape Lib -#include "CMailFlexTable.h" -#include "LTableHeader.h" -#include "NetscapeDragFlavors.h" - -// MacFE -#include "CMailNewsContext.h" -#include "CMessageFolder.h" - -class CMessageWindow; -class CDeferredUndoTask; -class CPersistentMessageSelection; - -//====================================== -class CMessage -//====================================== -{ -public: - CMessage(TableIndexT inIndex, MSG_Pane* mMessageList); - virtual ~CMessage(); - - // Sometimes the new mMessageList has the same - // address as the sCacheMessageList. So, when we are - // loading a new message folder, call InvalidateCache - static void InvalidateCache(); - - MessageId GetThreadID() const; - MessageKey GetMessageKey() const; - - Boolean HasBeenRead() const; - Boolean IsFlagged() const; - Boolean HasBeenRepliedTo() const; - - const char* GetSubject(char* buffer, UInt16 bufSize) const; - const char* GetSubject() const; - const char* GetSender() const; - const char* GetDateString() const; - const char* GetAddresseeString() const; - const char* GetSizeStr() const; - const char* GetPriorityStr() const; - const char* GetStatusStr() const; - void GetPriorityColor(RGBColor&) const; - static void GetPriorityColor(MSG_PRIORITY inPriority, RGBColor& outColor); - static Int16 PriorityToMenuItem(MSG_PRIORITY inPriority); - static MSG_PRIORITY MenuItemToPriority(Int16 inMenuItem); - static const char* GetSubject(MSG_MessageLine* data, char* buffer, UInt16 bufSize); - - inline time_t GetDate() const; - inline UInt32 GetSize() const; - MSG_PRIORITY GetPriority() const; - inline UInt32 GetStatus() const; - int8 GetThreadLevel() const; - uint16 GetNumChildren() const; - uint16 GetNumNewChildren() const; - - Boolean HasAttachments() const; - Boolean IsThread() const; - Boolean IsOpenThread() const; - Boolean IsOffline() const; // db has offline news or IMAP msg body - Boolean IsDeleted() const; - Boolean IsTemplate() const; - - ResIDT GetIconID(UInt16 inFolderFlags) const; - static ResIDT GetIconID(UInt16 inFolderFlags, UInt32 inMessageFlags); - ResIDT GetThreadIconID() const; - - Boolean UpdateMessageCache() const; - -protected: - - Boolean TestXPFlag(UInt32 inMask) const; - - MSG_ViewIndex mIndex; - MSG_Pane* mMessageList; - - - static MSG_MessageLine sMessageLineData; - static MSG_Pane* sCacheMessageList; - static MSG_ViewIndex sCacheIndex; -}; // class CMessage - -//====================================== -class CThreadView : public CMailFlexTable -//====================================== -{ - friend class CThreadMessageController; - friend class CFolderThreadController; -private: - typedef CMailFlexTable Inherited; -public: - enum {class_ID = 'msTb'}; - - // ------------------------------------------------------------ - // Construction - // ------------------------------------------------------------ - CThreadView(LStream *inStream); - virtual ~CThreadView(); - void LoadMessageFolder( - CNSContext* inContext, - const CMessageFolder& inFolder, - Boolean loadNow = false); - - void FileMessagesToSelectedPopupFolder(const char *ioFolderName, - Boolean inMoveMessages);//¥¥TSM - - MSG_FolderInfo* GetOwningFolder() const - { - return mXPFolder.GetFolderInfo(); - } - - uint32 GetFolderFlags() const - { - return mXPFolder.GetFolderFlags(); - } - - - // ------------------------------------------------------------ - // Data change notification - // Callbacks from MSGlib come here. - // ------------------------------------------------------------ - virtual void ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount - ); - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount - ); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - -protected: - void SetFolder(const CMessageFolder& inFolder); - void SetFolder(const MSG_FolderInfo* inFolderLine); - - // ------------------------------------------------------------ - // Clicking - // ------------------------------------------------------------ -protected: - virtual void ClickCell( - const STableCell &inCell, - const SMouseDownEvent &inMouseDown); - virtual Boolean CellSelects(const STableCell& inCell) const; - virtual Boolean CellWantsClick( const STableCell& inCell ) const; - - // ------------------------------------------------------------ - // Drawing - // ------------------------------------------------------------ -protected: - - virtual void DrawCellContents( - const STableCell &inCell, - const Rect &inLocalRect); - void DrawMessageSubject( - TableIndexT inRow, - const Rect& inLocalRect); - void DrawMessageSize( - const CMessage& inMessage, - const Rect& inLocalRect ); - void DrawMessagePriority( - const CMessage& inMessage, - const Rect& inLocalRect ); - void DrawMessageStatus( - const CMessage& inMessage, - const Rect& inLocalRect ); - - // Specials from CStandardFlexTable - virtual TableIndexT GetHiliteColumn() const; - virtual ResIDT GetIconID(TableIndexT inRow) const; - virtual UInt16 GetNestedLevel(TableIndexT inRow) const; - virtual void GetDropFlagRect( const Rect& inLocalCellRect, - Rect& outFlagRect) const; - virtual void GetMainRowText( - TableIndexT inRow, - char* outText, - UInt16 inMaxBufferLength) const; - virtual Boolean GetHiliteTextRect( - const TableIndexT inRow, - Rect& outRect) const; - virtual void ApplyTextStyle(TableIndexT inRow) const; - virtual void ApplyTextColor(TableIndexT inRow) const; - virtual void DrawIconsSelf( - const STableCell& inCell, - IconTransformType inTransformType, - const Rect& inIconRect) const; - - // ------------------------------------------------------------ - // Mail and news - // ------------------------------------------------------------ -public: - void ExpectNewMail() { mExpectingNewMail = true; mGotNewMail = false; } - void DontExpectNewMail() { mExpectingNewMail = false; mGotNewMail = false; } - Boolean GotNewMail() { return mExpectingNewMail && mGotNewMail; } - void SaveSelectedMessage(); - Boolean RestoreSelectedMessage(); - - // ------------------------------------------------------------ - // Drag and Drop - // ------------------------------------------------------------ -public: - URL_Struct* CreateURLForProxyDrag(char* outTitle); - -protected: - virtual Boolean ItemIsAcceptable(DragReference inDragRef, ItemReference inItemRef); - //virtual void InsideDropArea(DragReference inDragRef); - virtual void EnterDropArea(DragReference inDragRef, Boolean inDragHasLeftSender); - virtual void LeaveDropArea(DragReference inDragRef); - virtual void ReceiveDragItem( - DragReference inDragRef - , DragAttributes inDragAttrs - , ItemReference inItemRef - , Rect& inItemBounds); - Boolean GetDragCopyStatus( - DragReference inDragRef - , const CMailSelection& inSelection - , Boolean& outCopy); - - // ------------------------------------------------------------ - // Row Expansion/Collapsing - // ------------------------------------------------------------ -protected: - virtual void SetCellExpansion(const STableCell &inCell, Boolean inExpanded); - virtual Boolean CellHasDropFlag( - const STableCell& inCell, - Boolean& outExpanded) const; - virtual Boolean CellInitiatesDrag(const STableCell& inCell) const; - virtual TableIndexT CountExtraRowsControlledByCell(const STableCell& inCell) const; - - //----------------------------------- - // Commands - //----------------------------------- -public: - enum {cmd_UnselectAllCells = 'UnSl'}; - - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); - - void ObeyCommandWhenReady(CommandT inCommand); - -protected: - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - void FindSortCommandStatus(CommandT inCommand, Int16& inOutMark); - Boolean ObeySortCommand(CommandT inCommand); - Boolean ObeyMotionCommand(MSG_MotionType inCommand); - Boolean ObeyMarkReadByDateCommand(); - - virtual void DeleteSelection(); - virtual void ListenToMessage( - MessageT inCommand, - void *ioParam); - - // ------------------------------------------------------------ - // Miscellany - PP - // ------------------------------------------------------------ -public: - virtual void ActivateSelf(); - -protected: - void NoteSortByThreadColumn(Boolean isThreaded) const; - virtual void OpenRow(TableIndexT inRow); - - // ------------------------------------------------------------ - // Miscellany - Selection management - // ------------------------------------------------------------ -public: - Boolean ScrollToGoodPlace(); // as, to first unread message - virtual void SelectionChanged(); // overridden to scroll into view - - void SelectMessageWhenReady(MessageKey inKey); - void SetSelectAfterDelete(Boolean inDoSelect) { mSelectAfterDelete = inDoSelect; } - void SelectAfterDelete(TableIndexT inRow); - -protected: - void SelectMessage(MessageKey inKey); - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); - virtual void SetRowCount(); - - // ------------------------------------------------------------ - // Miscellany - i18n support - // ------------------------------------------------------------ -public: - void SetDefaultCSID(Int16 default_csid); - virtual Int16 DefaultCSIDForNewWindow(); - - // The following two should really go into utility class - static void DrawUTF8TextString( const char* inText, - const FontInfo* inFontInfo, - SInt16 inMargin, - const Rect& inBounds, - SInt16 inJustification = teFlushLeft, - Boolean doTruncate = true, - TruncCode truncWhere = truncMiddle); - static void PlaceUTF8TextInRect( - const char* inText, - Uint32 inTextLength, - const Rect &inRect, - Int16 inHorizJustType = teCenter, - Int16 inVertJustType = teCenter, - const FontInfo* inFontInfo = NULL, - Boolean inDoTruncate = false, - TruncCode inTruncWhere = truncMiddle); -protected: - void ResetTextTraits(); - -protected: - virtual void ChangeSort(const LTableHeader::SortChange* inSortChange); - void SyncSortToBackend(); - void UpdateSortMenuCommands() const; - Boolean RelocateViewToFolder(const CMessageFolder& inFolder); - // Retarget the view to the specified BE folder. - void UpdateHistoryEntry(); // For bookmark support. - void DoSelectThread(TableIndexT inSelectedRow); - void DoSelectFlaggedMessages(); - - // ------------------------------------------------------------ - // QA Partner support - // ------------------------------------------------------------ -#if defined(QAP_BUILD) -public: - virtual void GetQapRowText(TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const; -#endif - - // ------------------------------------------------------------ - // Data - // ------------------------------------------------------------ - -protected: - CMessageFolder mXPFolder; // The unique id of the folder we are viewing. Owned by backend. - - CPersistentMessageSelection* mSavedSelection; // Used while the window is being rearranged. - - Boolean mExpectingNewMail; - Boolean mGotNewMail; - Boolean mIsIdling; - Boolean mSelectAfterDelete; // This was a demand from a big customer - TableIndexT mRowToSelect; // hack to help coordinate thread/message panes. - Boolean mScrollToShowNew; - MSG_MotionType mMotionPendingCommand; - CDeferredUndoTask* mUndoTask; - -}; // class CThreadView diff --git a/mozilla/cmd/macfe/MailNews/CThreadWindow.cp b/mozilla/cmd/macfe/MailNews/CThreadWindow.cp deleted file mode 100644 index b4e2d3c28b7..00000000000 --- a/mozilla/cmd/macfe/MailNews/CThreadWindow.cp +++ /dev/null @@ -1,1093 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CThreadWindow.cp -// This is the 3-pane mail window - -#include "CThreadWindow.h" - -#include "CMessageFolder.h" -#include "CGrayBevelView.h" -#include "CProgressListener.h" -#include "CBrowserContext.h" -#include "CThreadView.h" -#include "CMessageView.h" -#include "CMessageFolderView.h" -#include "CMailFolderButtonPopup.h" -#include "CSpinningN.h" -#include "CApplicationEventAttachment.h" -#include "CMailProgressWindow.h" -#include "CProxyPane.h" -#include "CProxyDragTask.h" -#include "LTableViewHeader.h" -#include "CTargetFramer.h" - -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" - -#include "msg_srch.h" -//#include "secnav.h" - -#include "uapp.h" -#include "macutil.h" -#include "StSetBroadcasting.h" -#include "earlmgr.h" -#include "prefapi.h" -#include -#include -#include "CMessageAttachmentView.h" -#include "CThreadMessageController.h" -#include "CFolderThreadController.h" -#include "UDeferredTask.h" -#include "UMailSelection.h" - -#define kTwistieID 'Twst' -static const PaneIDT paneID_ThreadFileButton = 'Bfil'; -static const PaneIDT paneID_ThreadReplyButton = 'Brep'; -static const PaneIDT paneID_ThreadGetMailButton = 'Bget'; // mail -static const PaneIDT paneID_ThreadGetNewsButton = 'Bmor'; // news -static const PaneIDT paneID_ThreadComposeButton = 'Bcmp'; // mail -static const PaneIDT paneID_ThreadPostNewButton = 'Bpst'; // news -static const PaneIDT paneID_ThreadPrintButton = 'Bprn'; // mail -static const PaneIDT paneID_ThreadBackButton = 'Bbck'; // news -static const PaneIDT paneID_ThreadDeleteButton = 'Bdel'; // mail -static const PaneIDT paneID_ThreadMarkButton = 'Bmrk'; // news - -const PaneIDT paneID_ThreadRelocateButton = 'MfPM'; - - -//----------------------------------- -CThreadWindow::CThreadWindow(LStream *inStream) -//----------------------------------- -: Inherited(inStream, WindowType_MailThread) -, mStatusResID(res_ID) -, mThreadView(nil) -, mFolderContext(nil) -, mFolderView(nil) -, mFolderThreadController(nil) -, mThreadMessageController(nil) -{ -} // CThreadWindow::CThreadWindow - -//----------------------------------- -CThreadWindow::~CThreadWindow() -//----------------------------------- -{ - if (mFolderContext) - { - mFolderContext->RemoveUser(this); - mFolderContext = nil; - } -} // CThreadWindow::~CThreadWindow - -#define kButtonBarResID 10513 - // Common included button bar for thread windows. - // This has the RIdl for the buttons. - -//----------------------------------- -void CThreadWindow::FinishCreateSelf() -//----------------------------------- -{ - CNetscapeWindow::FinishCreateSelf(); // SKIP CMailNewsWindow, and roll our own! - // should be in resource, but there's a resource freeze. - CExpandoDivider* threadMessageExpandoView = dynamic_cast(FindPaneByID('Expo')); - - // Initialize our stored view pointers. - CMessageView* messageView = GetMessageView(); - Assert_(messageView); - GetThreadView(); - Assert_(mThreadView); // Else you're deadybones! - - CMessageAttachmentView* attachmentView = - dynamic_cast( FindPaneByID('MATv') ); - mFolderView = dynamic_cast(FindPaneByID('Flst')); - ThrowIfNil_(mFolderView); - - //----------- - // The following code is analogous to - // CMailNewsWindow::FinishCreateSelf() except it deals with mFolderContext - // as well as mMailNewsContext - //----------- - // Let there be a thread context - mMailNewsContext = CreateContext(); - mMailNewsContext->AddUser(this); - - // Let there be a progress listener, placed in my firmament, - // which shall listen to both contexts - mProgressListener = new CProgressListener(this, mMailNewsContext); - - // Let there be a folder context - mFolderContext = new CMailNewsContext(MWContextMail); - StSharer theLock(mFolderContext); - mFolderContext->AddUser(this); - // The progress listener must also listen to the folder context - mFolderContext->AddListener(mProgressListener); - -#if !ONECONTEXTPERWINDOW - // Make a listener list for the message context - typedef LListener* SListenerPointer; - const UInt8 kNumberOfListeners = 2; - LListener** messageContextListeners = new SListenerPointer[kNumberOfListeners + 1]; - // The progress listener must also listen to the message context. - messageContextListeners[0] = mProgressListener; -#endif - - // The progress listener is "just a bit" lazy during network activity and - // "not at all" at idle time to display the URLs pointed by the mouse cursor. - mProgressListener->SetLaziness(CProgressListener::lazy_NotAtAll); - - // The spinning N must listen to all three contexts - CSpinningN* theN = dynamic_cast(FindPaneByID(CSpinningN::class_ID)); - if (theN) - { - mFolderContext->AddListener(theN); - mMailNewsContext->AddListener(theN); -#if !ONECONTEXTPERWINDOW - messageContextListeners[1] = theN; -#endif - } - -#if !ONECONTEXTPERWINDOW - // Terminate the listener list - messageContextListeners[kNumberOfListeners] = 0; -#endif - - mThreadMessageController = new CThreadMessageController( - threadMessageExpandoView - , mThreadView - , messageView - , attachmentView -#if !ONECONTEXTPERWINDOW - , messageContextListeners -#endif - ); - - mThreadMessageController->InitializeDimensions(); - - // ThreadMessageController is a CExpandoListener, so let it do some listening! - LControl* twistie = dynamic_cast(FindPaneByID(kTwistieID)); - if (twistie) twistie->AddListener((CExpandoListener*)mThreadMessageController); - - //----------- - // The next part of this code code is analogous to - // CMailNewsFolderWindow::FinishCreateSelf() except it deals with mFolderContext - // instead of mMailNewsContext - //----------- - mFolderView->LoadFolderList(mFolderContext); - UReanimator::LinkListenerToControls(mFolderView, this, kButtonBarResID); - - // Make the Folder/Thread Controller - LDividedView* folderThreadExpandoView - = dynamic_cast(FindPaneByID('ExCt')); - mFolderThreadController = new CFolderThreadController( - folderThreadExpandoView, - mMailNewsContext, - mFolderView, - mThreadView); - - SetLatentSub(mFolderView); - mMailNewsContext->AddListener(mThreadView); // listen for all connections complete. - mFolderContext->AddListener(mFolderView); // listen for all connections complete. - - mThreadMessageController->FinishCreateSelf(); - // The folder-thread controller is a tabgroup, tabbing between the folder, thread, - // and message views. We have to add the message view explicitly to the folder- - // thread controller here, because it doesn't know about the message view. And we have to - // do that after the folder-thread controller adds the folder and thread subcommanders. - mFolderThreadController->FinishCreateSelf(); - messageView->SetSuperCommander(mFolderThreadController); - CTargetFramer* framer = new CTargetFramer(); - messageView->AddAttachment(framer); - - // make the message view listen to buttons - UReanimator::LinkListenerToControls((CMessageView::Inherited *)messageView, this, kButtonBarResID); - - // If the folder-thread controller can't handle a command (because the wrong pane - // is the target), let it pass it up to the thread-message controller, which has a - // mechanism for delegating to the message view. - mFolderThreadController->SetSuperCommander(mThreadMessageController); - mThreadMessageController->SetSuperCommander(this); - - // The 2-pane and 3-pane thread view have the same pane controls, so: - UReanimator::LinkListenerToControls(mThreadView, this, kButtonBarResID); - USecurityIconHelpers::AddListenerToSmallButton( - this /*LWindow**/, - mThreadView /*LListener**/); - - LGAIconSuiteControl* offlineButton - = dynamic_cast(FindPaneByID(kOfflineButtonPaneID)); - if (offlineButton) - offlineButton->AddListener(CFrontApp::GetApplication()); - - LControl* stopButton - = dynamic_cast(FindPaneByID('Bstp')); - if (stopButton) - stopButton->AddListener((CHTMLView*)messageView); - - // Create the new window just like the frontmost one of the same type, if possible - CWindowIterator iter(WindowType_MailThread); - CMediatedWindow* window; - CThreadWindow* templateWindow = nil; - for (iter.Next(window); window; iter.Next(window)) - { - templateWindow = dynamic_cast(window); - if (!templateWindow || templateWindow != this) - break; - } - if (templateWindow && templateWindow != this) - { - // Use the template window - CSaveWindowStatus::FinishCreateWindow(templateWindow); - } - else - { - //Get it from disk - CSaveWindowStatus::FinishCreateWindow(); - } - ReadGlobalDragbarStatus(); - AdjustStagger(WindowType_MailThread); - - // And behold, he saw that it was good. - SetLatentSub(mThreadView); - SwitchTarget(mThreadView); // only one of these will work. -} // CThreadWindow::FinishCreateSelf - -//----------------------------------- -void CThreadWindow::AboutToClose() -//----------------------------------- -{ - CSaveWindowStatus::AttemptCloseWindow(); // Do this first: uses table and calls the window's WriteWindowStatus() method - WriteGlobalDragbarStatus(); - mFolderView = nil; - // This is special: - mFolderContext->RemoveListener(mProgressListener); - if (mFolderView) - { - if (mFolderContext) - mFolderContext->RemoveListener(mFolderView); // don't listen for all connections complete. - mFolderView = nil; - } - mThreadView = nil; - // This is special: - mMailNewsContext->RemoveListener(mProgressListener); - if (mThreadView) - { - if (mMailNewsContext) - mMailNewsContext->RemoveListener(mThreadView); // don't listen for all connections complete. - mThreadView = nil; - } - - if (mThreadMessageController) - { - mThreadMessageController->InstallMessagePane(false); - mThreadMessageController->SetThreadView(nil); -// delete mThreadMessageController; No, it's a subcommander and will be deleted when we are. - mThreadMessageController = nil; - } - - // InstallMessagePane(false) can call InterruptContext, which in turn can show the window - // so we must call Hide() here. Hiding is necessary so that views in the window are not - // the current target while we are deleting them here. - if (IsVisible()) - Hide(); - - // Delete the folder-thread controller now, thus deleting all the msglib panes. We have - // to do that first before deleting the context, because the destructor of the pane - // references the context. Caution: Commanders delete all their subcommanders - // when they die. So detach it before we delete it, so that our destructor doesn't - // perform a double-deletion. - - //SwitchTarget(this); - - mFolderThreadController->SetSuperCommander(nil); - delete mFolderThreadController; - mFolderThreadController = nil; - - CSpinningN* theN = dynamic_cast(FindPaneByID(CSpinningN::class_ID)); - if (theN) - mFolderContext->RemoveListener(theN); -} // CThreadWindow::AboutToClose - -//---------------------------------------------------------------------------------------- -CNSContext* CThreadWindow::CreateContext() const -//---------------------------------------------------------------------------------------- -{ -#if ONECONTEXTPERWINDOW - CNSContext* result = new CBrowserContext(MWContextMailMsg); - FailNIL_(result); - return result; -#else - return Inherited::CreateContext(); -#endif -} //CMailNewsWindow::CreateContext - -//---------------------------------------------------------------------------------------- -static void InterruptTableContext(CMailFlexTable* inTable) -//---------------------------------------------------------------------------------------- -{ - if (inTable) - { - CNSContext* context = inTable->GetContext(); - if (context) - XP_InterruptContext(*context); - } -} - -//---------------------------------------------------------------------------------------- -static Boolean IsTableContextBusy(CMailFlexTable* inTable) -//---------------------------------------------------------------------------------------- -{ - if (inTable) - { - CNSContext* context = inTable->GetContext(); - if (context) - return XP_IsContextBusy(*context); - } - return false; -} - -//---------------------------------------------------------------------------------------- -void CThreadWindow::StopAllContexts() -//---------------------------------------------------------------------------------------- -{ - InterruptTableContext(GetFolderView()); - InterruptTableContext(GetThreadView()); -#if !ONECONTEXTPERWINDOW - CMessageView* mv = GetMessageView(); - if (mv) - { - CBrowserContext* context = mv->GetContext(); - if (context) - XP_InterruptContext(*context); - } -#endif -} - -//---------------------------------------------------------------------------------------- -Boolean CThreadWindow::IsAnyContextBusy() -//---------------------------------------------------------------------------------------- -{ - Boolean busy = IsTableContextBusy(GetFolderView()); - if (!busy) - busy = IsTableContextBusy(GetThreadView()); -#if !ONECONTEXTPERWINDOW - if (!busy) - { - CMessageView* mv = GetMessageView(); - if (mv) - { - CBrowserContext* context = mv->GetContext(); - if (context) - return XP_IsContextBusy(*context); - } - } -#endif - return busy; -} - -//----------------------------------- -void CThreadWindow::UpdateFilePopupCurrentItem() -//----------------------------------- -{ - CThreadView *threadView = GetThreadView(); - MSG_FolderInfo* folderInfo = nil; - if (threadView != nil) - folderInfo = threadView->GetOwningFolder(); - - CMailFolderPatternTextPopup *popup2 = - dynamic_cast(FindPaneByID(paneID_ThreadRelocateButton)); - if ( popup2 != nil && threadView->GetOwningFolder()) - { - StSetBroadcasting setBroadcasting(popup2, false); // Don't broadcast anything here - popup2->MSetSelectedFolder(folderInfo); - } - - CMailFolderSubmenu::SetSelectedFolder(folderInfo); -} // CThreadWindow::UpdateFilePopupCurrentItem - -//----------------------------------- -void CThreadWindow::ActivateSelf() -//----------------------------------- -{ - Inherited::ActivateSelf(); -#if 0 - // Don't do this for the 3-pane UI - // make sure the message view isn't target - CMailFlexTable* threadView = GetThreadView(); - if (threadView) - { - SwitchTarget(threadView); - } -#endif - UpdateFilePopupCurrentItem(); // Is this really necessary? -} // CThreadWindow::ActivateSelf - - -//----------------------------------- -void CThreadWindow::AdaptToolbarToFolder() -//----------------------------------- -{ - CThreadView* threadView = GetThreadView(); - if (threadView == nil) - return; - - // show/hide buttons depending on the window type (News vs Mail) - LControl * aControl; - Boolean isNewsWindow = ((threadView->GetFolderFlags() & MSG_FOLDER_FLAG_NEWSGROUP) != 0); - static const short kBtnCount = 3; - - PaneIDT mailBtn[kBtnCount] = - { - paneID_ThreadGetMailButton, - paneID_ThreadComposeButton, - paneID_ThreadDeleteButton // update kBtnCount if you add a btn - }; - - PaneIDT newsBtn[kBtnCount] = - { - paneID_ThreadGetNewsButton, - paneID_ThreadPostNewButton, - paneID_ThreadMarkButton // update kBtnCount if you add a btn - }; - - - for (short btnIndex = 0; btnIndex < kBtnCount; btnIndex ++) - { - if (isNewsWindow) - { - aControl = dynamic_cast(FindPaneByID(mailBtn[btnIndex])); - if (aControl != nil) aControl->Hide(); - aControl = dynamic_cast(FindPaneByID(newsBtn[btnIndex])); - if (aControl != nil) aControl->Show(); - } - else - { - aControl = dynamic_cast(FindPaneByID(newsBtn[btnIndex])); - if (aControl != nil) aControl->Hide(); - aControl = dynamic_cast(FindPaneByID(mailBtn[btnIndex])); - if (aControl != nil) aControl->Show(); - } - } - - // other changes depending on the window type - if (isNewsWindow) - { - aControl = dynamic_cast(FindPaneByID(paneID_ThreadReplyButton)); - if (aControl != nil) aControl->SetValueMessage(cmd_PostReply); // quick-click default - } - else - { - aControl = dynamic_cast(FindPaneByID(paneID_ThreadReplyButton)); - if (aControl != nil) aControl->SetValueMessage(cmd_ReplyToSender); // quick-click default - } - CMessageFolder owningFolder(threadView->GetOwningFolder()); - ResIDT iconID = owningFolder.GetIconID(); - - LIconPane* proxyIcon = dynamic_cast(FindPaneByID('poxy')); - if (proxyIcon) - proxyIcon->SetIconID(iconID); - - CProxyPane* newProxy = dynamic_cast(FindPaneByID(CProxyPane::class_ID)); - if (newProxy) - { - newProxy->SetIconIDs(iconID, iconID); - } - -} // CThreadWindow::AdaptToolbarToFolder - -//----------------------------------- -CMailFlexTable* CThreadWindow::GetActiveTable() -// Get the currently active table in the window. The active table is the table in -// the window that the user considers to be receiving input. -//----------------------------------- -{ - CMailFlexTable* result = GetFolderView(); - if (result && result->IsOnDuty()) - return result; - return GetThreadView(); -} // CThreadWindow::GetActiveTable - -//----------------------------------- -CMailFlexTable* CThreadWindow::GetSearchTable() -// Get the table which should be used to set the search base node. The base class -// returns GetActiveTable() for this, but now life is more complicated... -// The fix is to return the folder view, even if it is not currently the target. Otherwise, -// if we try to return the thread view and it's not currently displaying a folder, bad things -// can happen. -//----------------------------------- -{ - CMailFlexTable* result = GetFolderView(); - if (result) - return result; - result = GetThreadView(); - if (::MSG_GetCurFolder(result->GetMessagePane())) - return result; - return nil; -} // CThreadWindow::GetActiveTable - -//----------------------------------- -CMessageFolderView* CThreadWindow::GetFolderView() -//----------------------------------- -{ - return mFolderView; -} // CThreadWindow::GetFolderView - -//----------------------------------- -CThreadView* CThreadWindow::GetThreadView() -//----------------------------------- -{ - if (!mThreadView) - mThreadView = dynamic_cast(FindPaneByID('Tabl')); - return mThreadView; -} // CThreadWindow::GetThreadView - - -//----------------------------------- -CMessageView* CThreadWindow::GetMessageView() -//----------------------------------- -{ - return dynamic_cast(FindPaneByID(CMessageView::class_ID)); -} - -//----------------------------------- -void CThreadWindow::ShowMessageKey(MessageKey inKey) -//----------------------------------- -{ - CThreadView* threadView = GetThreadView(); - Assert_(threadView); - - threadView->SelectMessageWhenReady(inKey); - -} // CThreadWindow::ShowSearchMessage - -//----------------------------------- -CThreadWindow* CThreadWindow::FindOrCreate( - const MSG_FolderInfo* inFolderInfo, - CommandT inCommand) -//----------------------------------- -{ - // First see if there's an open window open to this folder. - ThrowIf_(Memory_MemoryIsLow()); - CWindowIterator iter(WindowType_MailThread); - CMediatedWindow* window; - CThreadWindow* threadWindow = nil; - for (iter.Next(window); window; iter.Next(window)) - { - threadWindow = dynamic_cast(window); - ThrowIfNULL_(threadWindow); - CThreadView* threadView = threadWindow->GetThreadView(); - ThrowIfNULL_(threadView); - if (threadView->GetOwningFolder() == inFolderInfo) - { - if (inCommand != cmd_Nothing) - threadView->ObeyCommand(inCommand, nil); - return threadWindow; - } - } - - // Window not found: let's create it - return FindAndShow(inFolderInfo, true, inCommand, true); - -} // CThreadWindow::FindOrCreate - -//----------------------------------- -CThreadWindow* CThreadWindow::FindAndShow( - const MSG_FolderInfo* inFolderInfo, - Boolean inMakeNew, - CommandT inCommand, - Boolean forceNewWindow) -//----------------------------------- -{ - // NOTE: all references to 'categories' have been removed from - // this function in v1.63 on Tuesday 97/06/03. - - // First see if there's an open window open to this folder. - // If there is, bring it to the front. - ThrowIf_(Memory_MemoryIsLow()); - CWindowIterator iter(WindowType_MailThread, false); // false, don't want hidden windows. - CMediatedWindow* window; - CThreadWindow* existingThreadWindow = nil; - CThreadWindow* threadWindow = nil; - for (iter.Next(window); window; iter.Next(window)) - { - existingThreadWindow = dynamic_cast(window); - ThrowIfNULL_(existingThreadWindow); - CThreadView* tempThreadView = existingThreadWindow->GetThreadView(); - ThrowIfNULL_(tempThreadView); - if (tempThreadView->GetOwningFolder() == inFolderInfo) - { - threadWindow = existingThreadWindow; // Found it! - break; - } - } - if (!threadWindow && !inMakeNew) - return nil; - - // Re-use another Thread window, if possible... - if (!threadWindow && !forceNewWindow) - { - XP_Bool prefReuseWindow; - PREF_GetBoolPref("mailnews.reuse_thread_window", &prefReuseWindow); - if ( CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) ) - prefReuseWindow = !prefReuseWindow; - if (prefReuseWindow) - { - CWindowIterator iter(WindowType_MailThread); - iter.Next(threadWindow); // use the frontmost open thread window - } - } - - // ...Otherwise create a new window - CMessageFolder folder(inFolderInfo); - if (!threadWindow) - { - try - { - ::SetCursor(*::GetCursor(watchCursor)); - SetDefaultCommander(LCommander::GetTopCommander()); - SetDefaultAttachable(nil); - threadWindow = (CThreadWindow*) UReanimator::ReadObjects('PPob', res_ID); -#if 0 - // FIX ME: for CSaveWindowStatus, use one resID for inbox, and 2-pane resid - // for all other thread panes. We will not use staggering for inbox. - threadWindow->SetStatusResID(folder.IsInbox() ? res_ID : res_ID_Alt); -#endif - threadWindow->SetStatusResID(res_ID); - threadWindow->FinishCreate(); - } - catch (...) - { - delete threadWindow; - threadWindow = nil; - throw; - } - } - - CThreadView* messageList = threadWindow->GetThreadView(); - ThrowIfNULL_(messageList); - - // Load in the Mail messages or News postings - if (messageList->GetOwningFolder() != inFolderInfo) - { - try - { - ::SetCursor(*::GetCursor(watchCursor)); - if (threadWindow->mProgressListener) - threadWindow->mProgressListener->SetLaziness( - CProgressListener::lazy_VeryButForThisCommandOnly); - messageList->EnableStopButton(true); - CMessageFolderView* folderView = threadWindow->GetFolderView(); - if (folderView) - folderView->SelectFolder(inFolderInfo); - else - messageList->LoadMessageFolder( - (CMailNewsContext*)threadWindow->GetWindowContext(), // thread view's own context - folder); // loadNow = false. - } - catch(...) - { - // Note, threadView has timer that will delete window. - throw; - } - } - - if (inCommand == cmd_GetNewMail) - { - // only do a get new mail here if were are executing the command on an existing window - // (because the user must have really wanted it if the command was passed in) - // or if we are online and the folder is pop (because IMAP gets new mail automatically - // if the folder is loaded for the first time). - if (threadWindow == existingThreadWindow - || (!NET_IsOffline() && !(folder.GetFolderFlags() & MSG_FOLDER_FLAG_IMAPBOX))) - { - // A thread window has two panes that can handle this command. If the thread - // pane is busy, why not give the folder pane something to do? - Boolean handled = false; - CNSContext* context = messageList->GetContext(); - if (context && XP_IsContextBusy(*context)) - { - CMessageFolderView* fv = threadWindow->GetFolderView(); - if (fv) - { - context = fv->GetContext(); - if (context && !XP_IsContextBusy(*context)) - { - CDeferredTaskManager::Post(new CDeferredCommand(fv, inCommand, nil), fv); - handled = true; - } - } - } - if (!handled) - messageList->ObeyCommandWhenReady(inCommand); - } - } - else if (inCommand != cmd_Nothing) - messageList->ObeyCommandWhenReady(inCommand); - - threadWindow->Show(); - threadWindow->Select(); - - // HACK TO SUPPORT OPENING OF MORE THAN ONE FOLDER. - // Otherwise, the BE doesn't initialize itself completely and the second window - // fails. - EventRecord ignoredEvent = {0}; - TheEarlManager.SpendTime(ignoredEvent); - return threadWindow; -} // CThreadWindow::FindAndShow - -//----------------------------------- -CThreadWindow* CThreadWindow::OpenFromURL(const char* url) -//----------------------------------- -{ - CThreadWindow* threadWindow = nil; - MSG_FolderInfo* folderInfo = MSG_GetFolderInfoFromURL( - CMailNewsContext::GetMailMaster(), - url, true); - if (!folderInfo) - return nil; - if (!CThreadWindow::FindAndShow(folderInfo, CThreadWindow::kDontMakeNew)) - threadWindow - = CThreadWindow::FindAndShow(folderInfo, CThreadWindow::kMakeNew); - return threadWindow; -} - -//----------------------------------- -cstring CThreadWindow::GetCurrentURL() const -//----------------------------------- -{ - if (mThreadMessageController) - return mThreadMessageController->GetCurrentURL(); - else - return cstring(""); -} - -//----------------------------------- -void CThreadWindow::SetFolderName(const char* inFolderName, Boolean inIsNewsgroup) -//----------------------------------- -{ - UpdateFilePopupCurrentItem(); - AdaptToolbarToFolder(); - - if (!inFolderName) - return; -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#else -#error "There'll probably be a bug here." -#endif - struct WindowTemplate { - Rect boundsRect; - short procID; - Boolean visible; - Boolean filler1; - Boolean goAwayFlag; - Boolean filler2; - long refCon; - Str255 title; - }; -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - // Name of window in PPob is "Netscape ^0 Ò^1Ó - WindowTemplate** wt = (WindowTemplate**)GetResource('WIND', CThreadWindow::res_ID); - Assert_(wt); - if (wt) - { - StHandleLocker((Handle)wt); - CStr255 windowTitle((*wt)->title); - ReleaseResource((Handle)wt); - CStr255 typeString; - // Get "folder" or "newsgroup" as appropriate - GetIndString(typeString, 7099, 1 + inIsNewsgroup); - ::StringParamText(windowTitle, (const char*)typeString, inFolderName); - SetDescriptor(windowTitle); - CProxyPane* proxy = dynamic_cast(FindPaneByID(CProxyPane::class_ID)); - if (proxy) - proxy->ListenToMessage(msg_NSCDocTitleChanged, (char*)windowTitle); - } -} // CThreadWindow::SetFolderName - -//----------------------------------- -void CThreadWindow::CloseAll(const MSG_FolderInfo* inFolderInfo) -//----------------------------------- -{ - CThreadWindow* win; - do { - win = CThreadWindow::FindAndShow(inFolderInfo); - if (win) - win->AttemptClose(); - } while (win); -} // CThreadWindow::CloseAll - -//----------------------------------- -CThreadWindow* CThreadWindow::ShowInbox(CommandT inCommand) -//----------------------------------- -{ - CThreadWindow* result = nil; - if (!CMailProgressWindow::GettingMail()) - { - CMailNewsContext::ThrowIfNoLocalInbox(); // prefs have not been set up. - - MSG_FolderInfo* inboxFolderInfo = nil; - int32 numberOfInboxes = MSG_GetFoldersWithFlag( - CMailNewsContext::GetMailMaster(), - MSG_FOLDER_FLAG_INBOX, - &inboxFolderInfo, - 1); - - if (!numberOfInboxes || inboxFolderInfo == nil) - CMailNewsContext::AlertPrefAndThrow(PREF_PopHost); - - result = FindAndShow(inboxFolderInfo, true, inCommand); - } - return result; -} // CThreadWindow::ShowInbox - -//----------------------------------- -UInt16 CThreadWindow::GetValidStatusVersion() const -//----------------------------------- -{ - return 0x0132; - // to be updated whenever the form of the saved window data changes -} // CThreadWindow::GetValidStatusVersion() - -//----------------------------------- -void CThreadWindow::ReadWindowStatus(LStream *inStatusData) -//----------------------------------- -{ - //LCommander::SwitchTarget(mFolderView); // make sure it's the active table - - Inherited::ReadWindowStatus(inStatusData); - - if (inStatusData) - { - if (mFolderView) - mFolderView->ReadSavedTableStatus(inStatusData); - - if (mThreadView) - mThreadView->ReadSavedTableStatus(inStatusData); - - mThreadMessageController->ReadStatus(inStatusData); - mFolderThreadController->ReadStatus(inStatusData); - - // We are currently closed, whatever the value of mExpandState may say (after - // all, we only just read in the value). So we set mExpandState back to - // closed_state, and bang the twistie to set everything the right way. - ExpandStateT state = mThreadMessageController->GetExpandState(); - mThreadMessageController->NoteExpandState(closed_state); - LControl* twistie = dynamic_cast(FindPaneByID(kTwistieID)); - mThreadMessageController->SetStoreStatusEnabled(false); - if (twistie) - twistie->SetValue(state); - mThreadMessageController->SetStoreStatusEnabled(true); - } -} // CThreadWindow::ReadWindowStatus - -//----------------------------------- -void CThreadWindow::WriteWindowStatus(LStream *outStatusData) -// Overridden to stagger in the default case. -//----------------------------------- -{ - // don't mess with targets when closing windows any more - //LCommander::SwitchTarget(mFolderView); // make sure it's the active table - - Inherited::WriteWindowStatus(outStatusData); // write the drag bar status and window location - - if (outStatusData) - { - if (mFolderView) - mFolderView->WriteSavedTableStatus(outStatusData); - - if (mThreadView) - mThreadView->WriteSavedTableStatus(outStatusData); - - mThreadMessageController->WriteStatus(outStatusData); // write expando status - mFolderThreadController->WriteStatus(outStatusData); // write divided view status - } -} // CThreadWindow::WriteWindowStatus - -//----------------------------------- -ResIDT CThreadWindow::GetStatusResID() const -//----------------------------------- -{ - return mStatusResID; -} // CThreadWindow::GetStatusResID() - -#if 0 -//----------------------------------- -Boolean CThreadWindow::ObeyMotionCommand(MSG_ViewIndex index, MSG_MotionType cmd) -//----------------------------------- -{ - if (GetExpandState() == closed_state) return false; - Try_ - { - CMessageView* messageView = GetMessageView(); - if (messageView && messageView->ObeyMotionCommand(cmd)) - { - CThreadView* threadView = GetThreadView(); - STableCell cell(resultIndex + 1,1); - threadView->UnselectAllCells(); - threadView->SelectCell(cell); - } - else - Throw_(noErr); - } - Catch_ (err) - { - SysBeep(1); - } - EndCatch_ - return false; -} // CThreadWindow::ObeyMotionCommand -#endif // 0 - -//----------------------------------- -Boolean CThreadWindow::ObeyCommand( - CommandT inCommand, - void *ioParam) -//----------------------------------- -{ - switch (inCommand) - { - case cmd_RelocateViewToFolder: - // Command was not (could not be) handled by the ThreadView, - // so we leave the window as it is and just update the Location popup. - UpdateFilePopupCurrentItem(); - return true; - - case cmd_SelectSelection: - // This command comes from the context menu, as the default in the thread view. - LControl* twistie = dynamic_cast(FindPaneByID(kTwistieID)); - if (twistie) - twistie->SetValue(true); - // and nature will take its course... - return true; - } - return Inherited::ObeyCommand(inCommand, ioParam); -} // CThreadWindow::ObeyCommand - -//----------------------------------- -void CThreadWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//----------------------------------- -{ - switch (inCommand) - { - case cmd_SelectSelection: - outEnabled = true; - return; - } - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); -} // CThreadWindow::FindCommandStatus - -//----------------------------------- -Int16 CThreadWindow::DefaultCSIDForNewWindow() -//----------------------------------- -{ - Int16 csid = 0; - CMessageView* messageView = GetMessageView(); - if (messageView) - csid = messageView->DefaultCSIDForNewWindow(); - if( 0 == csid) - { - CThreadView* threadView = GetThreadView(); - if(threadView) - csid = threadView->DefaultCSIDForNewWindow(); - } - return csid; -} // CThreadWindow::DefaultCSIDForNewWindow - -//----------------------------------- -void CThreadWindow::SetDefaultCSID(Int16 default_csid) -//----------------------------------- -{ - CMessageView* messageView = GetMessageView(); - if (messageView) - messageView->SetDefaultCSID(default_csid, true); // force repagination -} // CThreadWindow::SetDefaultCSID - -//----------------------------------- -URL_Struct* CThreadWindow::CreateURLForProxyDrag(char* outTitle) -//----------------------------------- -{ - return mThreadView->CreateURLForProxyDrag(outTitle); -} // CThreadWindow::CreateURLForProxyDrag - -//---------------------------------------------------------------------------------------- -const char* CThreadWindow::GetLocationBarPrefName() const -//---------------------------------------------------------------------------------------- -{ - if (mFolderThreadController) - { - const char* result = mFolderThreadController->GetLocationBarPrefName(); - if (result) - return result; - } - return Inherited::GetLocationBarPrefName(); -} - -//---------------------------------------------------------------------------------------- -CExtraFlavorAdder* CThreadWindow::CreateExtraFlavorAdder() const -//---------------------------------------------------------------------------------------- -{ - class ThreadWindowFlavorAdder : public CExtraFlavorAdder - { - public: - ThreadWindowFlavorAdder(MSG_Pane* inFolderPane, MSG_FolderInfo* inFolderInfo) - : mFolderPane(inFolderPane) - , mFolderInfo(inFolderInfo) - { - } - virtual void AddExtraFlavorData(DragReference inDragRef, ItemReference inItemRef) - { - // Pass a selection, as if this is done from a folder view. - mSelection.xpPane = mFolderPane; - if (!mSelection.xpPane) - return; // drat. This is a real drag. - MSG_ViewIndex viewIndex = ::MSG_GetFolderIndexForInfo( - mFolderPane, - mFolderInfo, - true /*expand*/); - if (viewIndex == MSG_VIEWINDEXNONE) - return; - mSelection.SetSingleSelection(viewIndex); - ::AddDragItemFlavor( - inDragRef, - inItemRef, - kMailNewsSelectionDragFlavor, - &mSelection, - sizeof(mSelection), - 0); - } - private: - MSG_Pane* mFolderPane; - MSG_FolderInfo* mFolderInfo; - CMailSelection mSelection; - }; - - CThreadView* threadView = const_cast(this)->GetThreadView(); - MSG_FolderInfo* folderInfo = threadView->GetOwningFolder(); - MSG_Pane* folderPane = ::MSG_FindPane(nil, MSG_FOLDERPANE); - return new ThreadWindowFlavorAdder(folderPane, folderInfo); -} // CMessageWindow::CreateExtraFlavorAdder diff --git a/mozilla/cmd/macfe/MailNews/CThreadWindow.h b/mozilla/cmd/macfe/MailNews/CThreadWindow.h deleted file mode 100644 index f545a9f7ea7..00000000000 --- a/mozilla/cmd/macfe/MailNews/CThreadWindow.h +++ /dev/null @@ -1,135 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// CThreadWindow.h - -#pragma once -// Mac UI Lib -#include "CMailNewsWindow.h" -#include "msgcom.h" -#include "cstring.h" - -class CMessageView; -class CThreadView; -class CMessageFolderView; -class CThreadMessageController; -class CFolderThreadController; - -typedef struct MSG_ResultElement MSG_ResultElement; - -//====================================== -class CThreadWindow - : public CMailNewsWindow -// This window can have up to three contexts (folder, thread, message). The -// one managed by the base class is the THREAD context. -//====================================== -{ -private: - typedef CMailNewsWindow Inherited; -public: - enum { class_ID = 'thWN', res_ID = 10509, res_ID_Alt = 10508 }; - - - CThreadWindow(LStream *inStream); - virtual ~CThreadWindow(); - virtual void FinishCreateSelf(); - - virtual void AboutToClose(); // place to put common code from [Attempt|Do]Close() - - static CThreadWindow* ShowInbox(CommandT inCommand); - - enum { kDontMakeNew = false, kMakeNew = true }; - static CThreadWindow* FindAndShow( - const MSG_FolderInfo* inFolderInfo, - Boolean makeNew = kDontMakeNew, - CommandT inCommand = cmd_Nothing, - Boolean forceNewWindow = false); - - static CThreadWindow* FindOrCreate( - const MSG_FolderInfo* inFolderInfo, - CommandT inCommand = cmd_Nothing); - - static CThreadWindow* OpenFromURL(const char* url); - cstring GetCurrentURL() const; - static void CloseAll(const MSG_FolderInfo* inFolderInfo); - virtual CNSContext* CreateContext() const; - virtual void StopAllContexts(); - virtual Boolean IsAnyContextBusy(); - virtual CMailFlexTable* GetActiveTable(); - // Return the currently active table in the window, nil if none - virtual CMailFlexTable* GetSearchTable(); - CThreadView* GetThreadView(); - CMessageFolderView* GetFolderView(); - CMessageView* GetMessageView(); - // Return the message view. Note: there may be no MSG_Pane in it! - void SetFolderName(const char* inFolderName, Boolean inIsNewsgroup); - -// CSaveWindowStatus Overrides: - virtual void ReadWindowStatus(LStream *inStatusData); - // Overridden to stagger in the default case. - virtual void WriteWindowStatus(LStream *inStatusData); - virtual UInt16 GetValidStatusVersion() const; - virtual ResIDT GetStatusResID() const; - - // I18N stuff - virtual Int16 DefaultCSIDForNewWindow(void); - void SetDefaultCSID(Int16 default_csid); - void ShowMessageKey(MessageKey inKey); - -protected: - - void SetStatusResID(ResIDT id) { mStatusResID = id; } - - void UpdateFilePopupCurrentItem(); - virtual void ActivateSelf(void); - - virtual void AdaptToolbarToFolder(void); - -// LCommander overrides -protected: - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam); - -// CNetscapeWindow overrides -protected: - virtual URL_Struct* CreateURLForProxyDrag(char* outTitle = nil); - virtual CExtraFlavorAdder* CreateExtraFlavorAdder() const; - -// CMailNewsWindow overrides -protected: - virtual const char* GetLocationBarPrefName() const; - -//DATA: -protected: - ResIDT mStatusResID; - CThreadView* mThreadView; - CThreadMessageController* mThreadMessageController; - CMessageFolderView* mFolderView; - CMailNewsContext* mFolderContext; - CFolderThreadController* mFolderThreadController; -}; // class CThreadWindow - diff --git a/mozilla/cmd/macfe/MailNews/LGABox_fixes.cp b/mozilla/cmd/macfe/MailNews/LGABox_fixes.cp deleted file mode 100644 index 46fdacb6c2f..00000000000 --- a/mozilla/cmd/macfe/MailNews/LGABox_fixes.cp +++ /dev/null @@ -1,159 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// LGABox_fixes.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "LGABox_fixes.h" - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - - -/*====================================================================================== - Turds be gone! Assumes entire frame is visible through superview. -======================================================================================*/ - -void LGABox_fixes::ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, - Boolean inRefresh) { - - - if ( mHasBorder && (mBorderStyle != borderStyleGA_NoBorder) && !mRefreshAllWhenResized ) { - Rect borderRect; - CalcBorderRect(borderRect); - Point beforeBotRight = botRight(borderRect); - Rect invalRect; - CalcPortFrameRect(invalRect); - Point portBeforeBotRight = botRight(invalRect); - - inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - - CalcPortFrameRect(invalRect); - CalcBorderRect(borderRect); - Point portAfterBotRight = botRight(invalRect); - - if ( inWidthDelta != 0 ) { - if ( beforeBotRight.h < borderRect.right ) { - ::SetRect(&invalRect, beforeBotRight.h - mContentOffset.right, - borderRect.top, portBeforeBotRight.h, portBeforeBotRight.v); - } else { - ::SetRect(&invalRect, borderRect.right - mContentOffset.right, - borderRect.top, portAfterBotRight.h, portAfterBotRight.v); - } - LocalToPortPoint(topLeft(invalRect)); - LocalToPortPoint(botRight(invalRect)); - InvalPortRect(&invalRect); - } - if ( inHeightDelta != 0 ) { - if ( beforeBotRight.v < borderRect.bottom ) { - ::SetRect(&invalRect, borderRect.left, beforeBotRight.v - mContentOffset.bottom, - portBeforeBotRight.h, portBeforeBotRight.v); - } else { - ::SetRect(&invalRect, borderRect.left, borderRect.bottom - mContentOffset.bottom, - portAfterBotRight.h, portAfterBotRight.v); - } - LocalToPortPoint(topLeft(invalRect)); - LocalToPortPoint(botRight(invalRect)); - InvalPortRect(&invalRect); - } - } else { - inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - } -} - - -/*====================================================================================== - Fix bug where everything was not refreshed correctly. -======================================================================================*/ - -void LGABox_fixes::RefreshBoxBorder(void) { - - Rect theFrame; - if ( IsVisible() && CalcLocalFrameRect(theFrame) && (mSuperView) ) { - Rect revealed; - mSuperView->GetRevealedRect(revealed); - Point delta = topLeft(revealed); - PortToLocalPoint(topLeft(revealed)); - PortToLocalPoint(botRight(revealed)); - delta.h -= revealed.left; delta.v -= revealed.top; - if ( ::SectRect(&theFrame, &revealed, &revealed) ) { - RgnHandle borderRgn = GetBoxBorderRegion(revealed); - ::OffsetRgn(borderRgn, delta.h, delta.v); - InvalPortRgn(borderRgn); - ::DisposeRgn(borderRgn); - } - } -} - - -/*====================================================================================== - Fix bug where everything was not refreshed correctly. -======================================================================================*/ - -void LGABox_fixes::RefreshBoxTitle(void) { - - Rect theFrame; - if ( IsVisible() && CalcPortFrameRect(theFrame) && (mSuperView) ) { - Rect revealed; - mSuperView->GetRevealedRect(revealed); - if ( ::SectRect(&theFrame, &revealed, &theFrame) ) { - Rect titleRect; - CalcTitleRect(titleRect); - LocalToPortPoint(topLeft(titleRect)); - LocalToPortPoint(botRight(titleRect)); - if ( ::SectRect(&titleRect, &revealed, &titleRect) ) { - InvalPortRect(&titleRect); - } - } - } -} - - -/*====================================================================================== - Fix bug where everything was not refreshed correctly. -======================================================================================*/ - -void LGABox_fixes::Disable(void) { - - LView::Disable(); - - RefreshBoxBorder(); - RefreshBoxTitle(); -} - - -/*====================================================================================== - Get rid of the flicker. -======================================================================================*/ - -void LGABox_fixes::Enable(void) { - - LView::Enable(); - - RefreshBoxBorder(); - RefreshBoxTitle(); -} - - diff --git a/mozilla/cmd/macfe/MailNews/LGABox_fixes.h b/mozilla/cmd/macfe/MailNews/LGABox_fixes.h deleted file mode 100644 index 525d90e9c1f..00000000000 --- a/mozilla/cmd/macfe/MailNews/LGABox_fixes.h +++ /dev/null @@ -1,79 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// LGABox_fixes.h - -#pragma once - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include - - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark EXTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class LGABox_fixes : public LGABox { - -#if !defined(__MWERKS__) || (__MWERKS__ >= 0x2000) - typedef LGABox inherited; -#endif - -public: - - enum { class_ID = 'Gbo_' }; - LGABox_fixes(LStream *inStream) : - LGABox(inStream) { - - SetRefreshAllWhenResized(false); - } - - virtual void ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, - Boolean inRefresh); - virtual void RefreshBoxBorder(void); - virtual void RefreshBoxTitle(void); - -protected: - - virtual void Disable(void); - virtual void Enable(void); -}; - diff --git a/mozilla/cmd/macfe/MailNews/MailNewsAddressBook.cp b/mozilla/cmd/macfe/MailNews/MailNewsAddressBook.cp deleted file mode 100644 index a6ee65a82f0..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsAddressBook.cp +++ /dev/null @@ -1,3915 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsAddressBook.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#define DEBUGGER_ASSERTIONS - - -#include "ABCom.h" -#ifndef MOZ_NEWADDR -#include "MailNewsAddressBook.h" -#include "SearchHelpers.h" -#include "CSizeBox.h" -#include "MailNewsgroupWindow_Defines.h" -#include "Netscape_Constants.h" -#include "resgui.h" -#include "CMailNewsWindow.h" -#include "CMailNewsContext.h" -#include "UGraphicGizmos.h" -#include "LFlexTableGeometry.h" -#include "CProgressBroadcaster.h" -#include "CPatternProgressBar.h" -#include "CThreadWindow.h" -#include "CGAStatusBar.h" -#include "uprefd.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "PascalString.h" -#include "CGATabBox.h" -#include "CGAStatusBar.h" -#include "URobustCreateWindow.h" -#include "UMailSelection.h" // Couldn't detect any order here, just stuck it in - jrm -#include "CMouseDragger.h" -#include "UStdDialogs.h" -#include "macutil.h" -#include "UStClasses.h" -#include "CComposeAddressTableView.h" -#include "msgcom.h" - -#include -#include -#include -#include "divview.h" -#include "CTargetFramer.h" -// get string constants -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS -#include "MailNewsSearch.h" -#include "addrbook.h" -#include "msgcom.h" -#include "msg_srch.h" -#include "abdefn.h" -#include "dirprefs.h" -#include "prefapi.h" -#include "UProcessUtils.h" -#include "CAppleEventHandler.h" - -#include "secnav.h" -#include "CTableKeyAttachment.h" -#include "intl_csi.h" -#include "xp_help.h" -#include "CLDAPQueryDialog.h" - -class CNamePropertiesWindow; -class CListPropertiesWindow; -class CAddressBookListTableView; -class CAddressBookController; - -const ResIDT kConferenceExampleStr = 8901; -const ResIDT kAddressbookErrorStrings = 8902; -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -// Save window status version - -static const UInt16 cAddressSaveWindowStatusVersion = 0x0218; -static const UInt16 cNamePropertiesSaveWindowStatusVersion = 0x0200; -static const UInt16 cListPropertiesSaveWindowStatusVersion = 0x0200; - - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - -#define ASSERT_ADDRESS_ERROR(err) Assert_(!(err) || ((err) == 1)) - - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -// CAddressBookPane - - -class CAddressBookPane : public CMailFlexTable { - -private: - typedef CMailFlexTable Inherited; - -public: - - CAddressBookPane(LStream *inStream) : - Inherited(inStream), - - mProgressBar(nil) { - SetRefreshAllWhenResized(false); - } - - enum EColType { // Sort column header ids - eColType = 'Type' - , eColName = 'Name' - , eColEmail = 'Emal' - , eColCompany = 'Comp' - , eColLocality = 'Loca' - , eColNickname = 'Nick' - , eColWorkPhone ='Phon' - }; - - enum { // Command sort - cmd_SortAscending = 'Ascd' - , cmd_SortDescending = 'Dscd' - }; - - enum { eInvalidCachedRowIDType = 0x7FFFFFFF, eNewEntryID = 0x7FFFFFFF, eInvalidEntryID = 0 }; - - enum { - paneID_ProgressBar = 'Prog' - }; - - // Unimplemented string IDs - - enum { - uStr_OneEntryFoundSelected = 8906 - , uStr_NoEntriesFound = 8907 - , uStr_MultipleEntriesFound = 8908 - , uStr_OneEntryFound = 8909 - , uStr_MultipleEntriesSelected = 8910 - }; - - void GetEntryIDAndType(TableIndexT inRow, ABID *outID, ABID *outType); - ABID GetEntryID(TableIndexT inRow); - TableIndexT GetRowOfEntryID(ABID inEntryID) { - Assert_(GetMessagePane() != nil); - return (AB_GetIndexOfEntryID( (AddressPane*) GetMessagePane(), inEntryID) + 1); - } - - void GetFullAddress( TableIndexT inRow, char** inName ) - { - ABID id; - ABID type; - ABook* pABook = CAddressBookManager::GetAddressBook(); - GetEntryIDAndType( inRow, &id, &type ); - //pABook->GetFullAddress( sCurrentBook, id, inName ); - AB_GetExpandedName(sCurrentBook, pABook, id, inName); - } - - - static UInt32 SortTypeFromColumnType(EColType inColType); - static AB_CommandType SortCommandFromColumnType(EColType inColType); - - static Int32 GetBENumEntries(ABID inType, ABID inListID = eInvalidEntryID); - virtual - - - void ComposeMessage(); - void ShowEditWindowByEntryID(ABID inEntryID, Boolean inOptionKeyDown); - void ShowEditWindow(ABID inID, ABID inType); - static DIR_Server* GetCurrentBook(){ return sCurrentBook; } -protected: - - enum { // Icon resource IDs - ics8_Person = 15260 - , ics8_List = 15263 - }; - - void DestroyMessagePane(MSG_Pane* inPane); - virtual void FinishCreateSelf(); - - virtual void SetUpTableHelpers(); - - virtual void DrawCellContents(const STableCell &inCell, const Rect &inLocalRect); - - virtual void AddSelectionToDrag(DragReference inDragRef, RgnHandle inDragRgn); - virtual void AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef); - - void GetSortParams(UInt32 *outSortKey, Boolean *outSortBackwards); - - // Backend methods - static void GetDisplayData(EColType inColType, ABID inEntryID, ABID inType, - CStr255 *outDisplayText, ResIDT *outIconID); - - // Instance variables ========================================================== - - CGAStatusBar *mProgressBar; - - static DIR_Server *sCurrentBook; // Current address book server -}; - - -// CAddressBookChildWindow - -class CAddressBookChildWindow : public CMediatedWindow, - public LListener, - public LBroadcaster, - public CSaveWindowStatus { - -private: - typedef CMediatedWindow Inherited; - -public: - - CAddressBookChildWindow(LStream *inStream, DataIDT inWindowType) : - CMediatedWindow(inStream, inWindowType), - LListener(), - LBroadcaster(), - CSaveWindowStatus(this), - mEntryID(CAddressBookPane::eNewEntryID) - { - SetRefreshAllWhenResized(false); - } - virtual ~CAddressBookChildWindow() { - } - void FinishCreateSelf(); - ABID GetEntryID() const { - return mEntryID; - } - virtual void UpdateBackendToUI(DIR_Server *inDir, ABook *inABook) = 0L; - virtual void UpdateUIToBackend(DIR_Server *inDir, ABook *inABook, - ABID inEntryID) = 0L; - - - virtual void DoClose() { - Inherited::AttemptClose(); - } - virtual Boolean HandleKeyPress( const EventRecord &inKeyEvent); - -protected: - - // Overriden methods - - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual void UpdateTitle()=0; - // Instance variables - - ABID mEntryID; // BE ID of the property that this window is editing - // CAddressBookPane::eInvalidEntryID if none - -}; - - -// CAddressBookTableView - -class CAddressBookTableView : public CAddressBookPane { - -private: - typedef CAddressBookPane Inherited; - -public: - - enum { class_ID = 'AbTb' }; - enum { // Command IDs - cmd_NewAddressCard = 'NwCd' // New Card - , cmd_NewAddressList = 'NwLs' // New List - , cmd_HTMLDomains = 'HtDm' // domains dialog. - , cmd_EditProperties = 'EdPr' // Edit properties for a list or card - , cmd_DeleteEntry = 'DeLe' // Delete list or card - , cmd_ComposeMailMessage = 'Cmps' // Compose a new mail message - , cmd_ConferenceCall = 'CaLL' - , cmd_ViewMyCard = 'vmyC' - }; - CAddressBookTableView(LStream *inStream) : - CAddressBookPane(inStream) { - SetRefreshAllWhenResized(false); - } - virtual ~CAddressBookTableView(); - - void ButtonMessageToCommand( MessageT inMessage, void* ioParam = NULL ); - - Boolean LoadAddressBook( DIR_Server *inDir = nil); - - void NewCard(PersonEntry* pPerson = nil); - void NewList(); - void SaveAs(); - virtual void ChangeSort(const LTableHeader::SortChange *inSortChange); - virtual void DeleteSelection(); - - static Boolean CurrentBookIsPersonalBook() { - return (sCurrentBook == CAddressBookManager::GetPersonalBook()); - } - void ImportAddressBook(); - - void UpdateToTypedownText(Str255 inTypedownText); - void ConferenceCall( ); - virtual void PaneChanged(MSG_Pane *inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - void SetColumnHeaders(DIR_Server* server); - void ShowMyAddressCard(); - void SetModalWindow( Boolean value) { mModalWindow = value; } - - - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam = nil); - virtual void FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName); -protected: - virtual void OpenRow(TableIndexT inRow); - virtual Boolean CellInitiatesDrag(const STableCell &/*inCell*/) const { - return true; - } - - void CloseEditWindow(ABID inID, ABID inType); - - void ForceCurrentSort(); - - //void DisposeAddressBookPane(Boolean inRefresh = false); - - Boolean IsLDAPSearching(); - - // Backend methods - - virtual void ChangeFinished(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount); - - virtual Int32 GetBENumRows() { - return Inherited::GetBENumEntries(ABTypeAll); - } -private: - Boolean mModalWindow; -}; - - -class CListPropertiesWindow : public CAddressBookChildWindow { - -private: - typedef CAddressBookChildWindow Inherited; - -public: - - enum { class_ID = 'LpWn', pane_ID = class_ID, res_ID = 8940 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - - enum { - paneID_Name = 'NAME' - , paneID_Nickname = 'NICK' - , paneID_Description = 'DESC' - , paneID_AddressBookListTable = 'Tabl' // Address book list table - }; - - enum { // Broadcast messages - msg_ListPropertiesHaveChanged = 'lpCH' // this - }; - - // Unimplemented string IDs - - enum { - uStr_ListWindowTitle = 8912 - , uStr_ListDefaultName = 8914 - , uStr_ListEmptyWindowTitle = 8916 - }; - - // Stream creator method - - CListPropertiesWindow(LStream *inStream); - virtual ~CListPropertiesWindow(); - - virtual ResIDT GetStatusResID() const { return res_ID; } - - virtual void UpdateBackendToUI(DIR_Server *inDir, ABook *inABook); - virtual void UpdateUIToBackend(DIR_Server *inDir, ABook *inABook, - ABID inEntryID); -protected: - - // Overriden methods - - virtual void FinishCreateSelf(); - virtual void DrawSelf(); - virtual UInt16 GetValidStatusVersion() const { - return cListPropertiesSaveWindowStatusVersion; - } - virtual void UpdateTitle(); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam = nil); - - // Instance variables - - CAddressBookListTableView *mAddressBookListTable; - LBroadcasterEditField *mTitleField; -}; - - -// CAddressBookListTableView - -//====================================== -class CAddressBookListTableView : public CAddressBookPane -//====================================== -{ - -private: - typedef CAddressBookPane Inherited; - -public: - - enum { class_ID = 'AlTb' }; - - enum { // Broadcast messages - msg_EntriesAddedToList = 'EnAd' // this - , msg_EntriesRemovedFromList ='EnRe' - }; - CAddressBookListTableView(LStream *inStream) : - CAddressBookPane(inStream), - mNumItemsDragAdded(0) { - SetRefreshAllWhenResized(false); - } - virtual ~CAddressBookListTableView(); - - void LoadAddressBookList(ABID &ioEntryListID); - //Drag Support -protected: - virtual Boolean DragIsAcceptable(DragReference inDragRef); - virtual Boolean ItemIsAcceptable(DragReference inDragRef, ItemReference inItemRef); - virtual void ReceiveDragItem(DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect &inItemBounds); - - virtual Boolean RowCanAcceptDropBetweenAbove( DragReference /*inDragRef*/, TableIndexT /*inDropRow*/) - { return true; } - Boolean CanInsertDragItem( DragReference inDragRef, ItemReference inItemRef, - SAddressDragInfo *outInfo); - Boolean RowCanAcceptDrop( DragReference /*inDragRef*/, TableIndexT /*inDropRow*/) - { return true; } -protected: - - virtual void FinishCreateSelf(); - - virtual void DeleteSelection(); - virtual void OpenRow(TableIndexT inRow); - - virtual Boolean CellInitiatesDrag(const STableCell &/*inCell*/) const { - return CAddressBookTableView::CurrentBookIsPersonalBook(); - } - - // Backend methods - - virtual Int32 GetBENumRows() { - return Inherited::GetBENumEntries(ABTypeAll, ((CListPropertiesWindow *) - USearchHelper::GetPaneWindow(this))->GetEntryID()); - } - - void DisposeAddressListPane(Boolean inRefresh = false); - - // Instance variables ========================================================== - - TableIndexT mNumItemsDragAdded; -}; - -class CAddressBookWindow : public CMailNewsWindow - { -private: - typedef CMailNewsWindow Inherited; -public: - - enum { class_ID = 'AbWn', pane_ID = class_ID, res_ID = 8900 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - - enum { - paneID_DirServers = 'DRSR' // CDirServersPopupMenu *, this - , paneID_Search = 'SRCH' // MSG_Pane *, search button - , paneID_Stop = 'STOP' // nil, stop button - , paneID_AddressBookTable = 'Tabl' // Address book table - , paneID_TypedownName = 'TYPE' // Typedown name search edit field in window - , paneID_SearchEnclosure = 'SCHE' // Enclosure for search items - , paneID_AddressBookController = 'AbCn' - }; - #if 0 - enum { // Command IDs - cmd_NewAddressCard = 'NwCd' // New Card - , cmd_NewAddressList = 'NwLs' // New List - , cmd_HTMLDomains = 'HtDm' // domains dialog. - , cmd_EditProperties = 'EdPr' // Edit properties for a list or card - , cmd_DeleteEntry = 'DeLe' // Delete list or card - , cmd_ComposeMailMessage = 'Cmps' // Compose a new mail message - , cmd_ConferenceCall = 'CaLL' - , cmd_ViewMyCard = 'vmyC' - }; - #endif - // Stream creator method - - CAddressBookWindow(LStream *inStream) : - CMailNewsWindow(inStream, WindowType_Address), - mAddressBookController(nil) - { - SetPaneID(pane_ID); - SetRefreshAllWhenResized(false); - } - virtual ~CAddressBookWindow(); - - virtual ResIDT GetStatusResID() const { return res_ID; } - - - static Boolean CloseAddressBookChildren(); - static MWContext *GetMailContext(); - - - void ShowEditWindowByEntryID(ABID inEntryID, Boolean inOptionKeyDown); - - //CAddressBookTableView * GetAddressBookTable() { return mAddressBookTable; } - CAddressBookController * GetAddressBookController() { return mAddressBookController;} -protected: - - // Overriden methods - - virtual void FinishCreateSelf(); - - // Utility methods - - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual UInt16 GetValidStatusVersion() const { return cAddressSaveWindowStatusVersion; } - - // Instance variables - CAddressBookController *mAddressBookController; -}; - - -class CNamePropertiesWindow : public CAddressBookChildWindow { - -private: - typedef CAddressBookChildWindow Inherited; - -public: - - enum { class_ID = 'NpWn', pane_ID = class_ID, res_ID = 8930 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - - enum { - paneID_GeneralView = 'GNVW' // General preferences view - , paneID_FirstName = 'FNAM' - , paneID_LastName = 'LNAM' - , paneID_EMail = 'EMAL' - , paneID_Nickname = 'NICK' - , paneID_Notes = 'NOTE' - , paneID_PrefersHTML = 'HTML' - , paneID_ContactView = 'CNVW' // Contact preferences view - , paneID_Company = 'COMP' - , paneID_Title = 'TITL' - , paneID_Address = 'ADDR' - , paneID_City = 'CITY' - , paneID_State = 'STAT' - , paneID_ZIP = 'ZIP ' - , paneID_Country = 'Coun' - , paneID_WorkPhone = 'WPHO' - , paneID_FaxPhone = 'FPHO' - , paneID_HomePhone = 'HPHO' - , paneID_SecurityView = 'SCVW' // Security preferences view - , paneID_CooltalkView = 'CLVW' // Cooltalk preferences view - , paneID_ConferenceAddress = 'CAED', - paneID_ConferenceServer = 'CnPu' - }; - - enum { // Broadcast messages - paneID_ConferencePopup ='CoPU' // conference pop up button - }; - - - // Stream creator method - - CNamePropertiesWindow(LStream *inStream) : - CAddressBookChildWindow(inStream, WindowType_AddressPerson), - mFirstNameField(nil), - mLastNameField(nil) { - - SetPaneID(pane_ID); - - } - - virtual ResIDT GetStatusResID() const { return res_ID; } - virtual void UpdateBackendToUI(DIR_Server *inDir, ABook *inABook ); - void UpdateUIToPerson( PersonEntry* person , ABID inEntryID ); - void UpdateUIToBackend(DIR_Server *inDir, ABook *inABook, ABID inEntryID); - void SetConferenceText( ); -protected: - - // Overriden methods - - virtual void FinishCreateSelf(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual UInt16 GetValidStatusVersion() const { return cNamePropertiesSaveWindowStatusVersion; } - - virtual void UpdateTitle(); - - // Instance variables - - LBroadcasterEditField *mFirstNameField; - LBroadcasterEditField *mLastNameField; -}; - - -// StPersonEntry - -class StPersonEntry { - -public: - - StPersonEntry(); - ~StPersonEntry() { - XP_FREEIF(mPerson); - } - - PersonEntry *GetEntry() { - return mPerson; - } -private: - PersonEntry *mPerson; -}; - - -// StMailingListEntry - -class StMailingListEntry { - -public: - - StMailingListEntry(); - ~StMailingListEntry() { - XP_FREEIF(mMailingList); - } - - MailingListEntry *GetEntry() { - return mMailingList; - } -private: - MailingListEntry *mMailingList; -}; - - -// The CAddressBookController handles the interaction between the container pane, CAddressBookTableView, -// and the typedown edit field - -class CAddressBookController:public LView, LCommander, public LListener, public LPeriodical -{ -private: - typedef LView Inherited; -public: - enum { class_ID = 'AbCn' }; - enum { eDontCheckTypedown = 0xFFFFFFFF, eCheckTypedownInterval = 20 /* 1/3 sec */ }; - - enum { - paneID_DirServers = 'DRSR' // CDirServersPopupMenu *, this - , paneID_Search = 'SRCH' // MSG_Pane *, search button - , paneID_Stop = 'STOP' // nil, stop button - , paneID_AddressBookTable = 'Tabl' // Address book table - , paneID_TypedownName = 'TYPE' // Typedown name search edit field in window - , paneID_SearchEnclosure = 'SCHE' // Enclosure for search items - , paneID_DividedView = 'A2Vw' // the divided view - }; - - - - CAddressBookController(LStream* inStream ):LView( inStream), - mNextTypedownCheckTime(eDontCheckTypedown), - mTypedownName(nil), mSearchButton(nil),mStopButton(nil) - {}; - ~CAddressBookController(){ }; -protected: - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - -// LCommander overrides: -protected: - - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - virtual void ActivateSelf() { - StartRepeating(); - Inherited::ActivateSelf(); - } - - virtual void DeactivateSelf() { - StopRepeating(); - Inherited::DeactivateSelf(); - } - -// LPeriodical - virtual void SpendTime(const EventRecord &inMacEvent); - -// CSaveWindowStatus helpers: -public: - void ReadStatus(LStream *inStatusData); - void WriteStatus(LStream *outStatusData); - -// Specials -public: - void FinishCreateSelf(); - void UpdateToDirectoryServers(); - void PopulateDirectoryServers(); - void SelectDirectoryServer(DIR_Server *inServer, Int32 inServerIndex); - Boolean IsLDAPSearching() { - return ((mStopButton != nil) ? mStopButton->IsVisible() : false); - } - Int32 GetServerIndexFromPopup(); - void SetPopupFromServerIndex(Int32 inServerIndex); - CAddressBookTableView* GetAddressBookTable(){ - Assert_( mAddressBookTable ); - return mAddressBookTable; - } - -protected: - void MessageWindSearch( char* text = NULL); - void MessageWindStop(Boolean inUserAborted); - -// Data -protected: - CSearchEditField* mTypedownName; - LDividedView* mDividedView; - CAddressBookTableView* mAddressBookTable; - //CAddressBookContainerView* mABContainerView; - UInt32 mNextTypedownCheckTime; - - LGAPushButton *mSearchButton; - LGAPushButton *mStopButton; - CPatternProgressCaption *mProgressCaption; - CMailNewsContext *mAddressBookContext; - -}; - -class UAddressBookUtilites -{ -public: - enum { invalid_command = 0xFFFFFFFF }; - static AB_CommandType GetABCommand( CommandT inCommand ); - static void ABCommandStatus( - CMailFlexTable* inTable, CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); -}; - -AB_CommandType UAddressBookUtilites::GetABCommand( CommandT inCommand ) -{ - switch ( inCommand ) - { - - case cmd_NewMailMessage: - case CAddressBookTableView::cmd_ComposeMailMessage: return AB_NewMessageCmd; - case cmd_ImportAddressBook: return AB_ImportCmd; - case cmd_SaveAs: return AB_SaveCmd; -// case cmd_Close: return AB_CloseCmd; - -// case return AB_NewAddressBook -// case return AB_NewLDAPDirectory - - //case return AB_UndoCmd - - //case return AB_RedoCmd - - case CAddressBookTableView::cmd_DeleteEntry: return AB_DeleteCmd; - -// case return AB_LDAPSearchCmd, - - case CAddressBookPane::eColType: return AB_SortByTypeCmd; - case CAddressBookPane::eColName: return AB_SortByFullNameCmd; - case CAddressBookPane::eColLocality: return AB_SortByLocality; - case CAddressBookPane::eColNickname: return AB_SortByNickname; - case CAddressBookPane::eColEmail: return AB_SortByEmailAddress; - case CAddressBookPane::eColCompany: return AB_SortByCompanyName; - case CAddressBookPane::cmd_SortAscending: return AB_SortAscending; - case CAddressBookPane::cmd_SortDescending: return AB_SortDescending; - - case CAddressBookTableView::cmd_NewAddressCard: return AB_AddUserCmd; - case CAddressBookTableView::cmd_NewAddressList: return AB_AddMailingListCmd; - case CAddressBookTableView::cmd_EditProperties: return AB_PropertiesCmd; - case CAddressBookTableView::cmd_ConferenceCall: return AB_CallCmd; - // case return AB_ImportLdapEntriesCmd - default: return AB_CommandType( invalid_command ); - } -} - -void UAddressBookUtilites::ABCommandStatus( - CMailFlexTable* inTable, - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - AB_CommandType abCommand = AB_CommandType(inCommand); - if( abCommand != UAddressBookUtilites::invalid_command ) - { - CMailSelection selection; - inTable->GetSelection(selection); - - XP_Bool selectable; - MSG_COMMAND_CHECK_STATE checkedState; - const char* display_string = nil; - XP_Bool plural; - - - if ( AB_CommandStatus( - (ABPane*)inTable->GetMessagePane(), - abCommand, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize, - &selectable, - &checkedState, - &display_string, - &plural) - >= 0) - { - - outEnabled = (Boolean)selectable; - outUsesMark = true; - if (checkedState == MSG_Checked) - outMark = checkMark; - else - outMark = 0; - - if (display_string && *display_string) - *(CStr255*)outName = display_string; - } - } -} - - -#pragma mark - -/*====================================================================================*/ -#pragma mark Address Picker class -/*====================================================================================*/ -static const UInt16 cAddressPickerWindowStatusVersion = 0x004; -class CAddressPickerWindow : public CAddressBookWindow, public LListener -{ -public: - enum { class_ID = 'ApWn', pane_ID = class_ID, res_ID = 8990 }; - enum { eOkayButton = 'OkBt', eCancelButton ='CnBt', eHelp ='help'}; - // Buttons to enable and disable - enum { eToButton = 'ToBt', eCcButton = 'CcBt', eBccButton = 'BcBt',ePropertiesButton = 'PrBt' }; - - CAddressPickerWindow(LStream *inStream): CAddressBookWindow( inStream ), LListener(), - mInitialTable( nil ), mPickerAddresses(nil), mAddressBookTable(nil) {}; - void Setup( CComposeAddressTableView* initialTable ); - virtual void FinishCreateSelf(); - - -protected: - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual ResIDT GetStatusResID() const { return res_ID; } - virtual UInt16 GetValidStatusVersion() const { return cAddressPickerWindowStatusVersion; } -private: - void AddSelection( EAddressType inAddressType ); - CAddressBookTableView * mAddressBookTable; - CComposeAddressTableView* mInitialTable; - CComposeAddressTableView* mPickerAddresses; -}; - - -#pragma mark - -/*====================================================================================*/ - #pragma mark BE CALLBACKS -/*====================================================================================*/ - -/*====================================================================================== - Get the global address book database. -======================================================================================*/ - -XP_List *FE_GetDirServers() { - return CAddressBookManager::GetDirServerList(); -} - - -/*====================================================================================== - Get the global address book database. -======================================================================================*/ - -ABook *FE_GetAddressBook(MSG_Pane *pane) { -#pragma unused (pane) - return CAddressBookManager::GetAddressBook(); -} - - -/*====================================================================================== - Returns the address book context, creating it if necessary. A mail pane is passed in, - on the unlikely chance that it might be useful for the FE. If "viewnow" is TRUE, - then present the address book window to the user; otherwise, don't (unless it is - already visible). -======================================================================================*/ - -MWContext *FE_GetAddressBookContext(MSG_Pane *pane, XP_Bool viewnow) { -#pragma unused (pane) - - if ( viewnow ) { - CAddressBookManager::ShowAddressBookWindow(); - } - - return CAddressBookWindow::GetMailContext(); -} - -/**************************************************************************** -This is a callback into the FE to bring up a modal property sheet for modifying -an existing entry or creating a new one from a person structure. If -entryId != MSG_MESSAGEIDNONE then it is the entryID of the entry to modify. -Each FE should Return TRUE if the user hit ok return FALSE if they hit cancel -and return -1 if there was a problem creating the window or something -****************************************************************************/ -int FE_ShowPropertySheetFor (MWContext* context, ABID entryID, PersonEntry* pPerson) -{ -#pragma unused (context) - CAddressBookWindow * addressWindow = CAddressBookManager::ShowAddressBookWindow(); - - addressWindow->GetAddressBookController()->SelectDirectoryServer(CAddressBookManager::GetPersonalBook(), 0); - - if (entryID == MSG_MESSAGEIDNONE) - { - addressWindow->GetAddressBookController()->GetAddressBookTable()->NewCard(pPerson); - } - else - { - // Not implemented yet const Boolean optionKeyDown = USearchHelper::KeyIsDown(USearchHelper::char_OptionKey); - const Boolean optionKeyDown = false; - AB_ModifyUser(CAddressBookManager::GetPersonalBook(), CAddressBookManager::GetAddressBook(), entryID, pPerson); - addressWindow->GetAddressBookController()->GetAddressBookTable()->ShowEditWindowByEntryID(entryID, optionKeyDown); - } - return true; -} - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -XP_List *CAddressBookManager::sDirServerList = nil; -ABook *CAddressBookManager::sAddressBook = nil; -Boolean CAddressBookManager::sDirServerListChanged = false; - -/*====================================================================================== - Open the address book at application startup. This method sets the initial address - book to the local personal address book for the user (creates one if it doesn't - exist already). -======================================================================================*/ - -void CAddressBookManager::OpenAddressBookManager() { - - AssertFail_(sDirServerList == nil); - - RegisterAddressBookClasses(); - - char fileName[64]; - fileName[63] = '\0'; - char *oldName = nil; - Try_ { - // Get the default address book path - FSSpec spec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - // The real, new way! - CStr255 pfilename; - ::GetIndString(pfilename, 300, addressBookFile); // Get address book name from prefs - strncpy( fileName,(char*)pfilename, 63) ; - // Create directory servers - Int32 error = DIR_GetServerPreferences(&sDirServerList, fileName); - // No listed return error codes, who knows what they are! - FailOSErr_(error); - AssertFail_(sDirServerList != nil); - - // Get the akbar address book. It's in HTML format (addressbook.html) - spec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - ::GetIndString(spec.name, 300, htmlAddressBook); // Get address book name from prefs - oldName = CFileMgr::GetURLFromFileSpec(spec); - FailNIL_(oldName); - - CAddressBookManager::FailAddressError( - AB_InitializeAddressBook(GetPersonalBook(), &sAddressBook, - oldName + XP_STRLEN("file://")) - ); - XP_FREE(oldName); - } - Catch_(inErr) { - CAddressBookManager::CloseAddressBookManager(); - XP_FREEIF(oldName); - } - EndCatch_ - - PREF_RegisterCallback("ldap_1", DirServerListChanged, NULL); -} - - -/*====================================================================================== - Closes any open resources used by the address book manager. -======================================================================================*/ - -void CAddressBookManager::CloseAddressBookManager() { - - if ( sAddressBook != nil ) { - Int32 error = AB_CloseAddressBook(&sAddressBook); - sAddressBook = nil; - ASSERT_ADDRESS_ERROR(error); - } - - if ( sDirServerList != nil ) { - Int32 error = DIR_DeleteServerList(sDirServerList); - sDirServerList = nil; - Assert_(!error); - } -} - - -/*====================================================================================== - Stupid comment that explains something that doesn't occur till after the comment. -======================================================================================*/ - -void CAddressBookManager::ImportLDIF(const FSSpec& inFileSpec) { - - char* path = CFileMgr::EncodedPathNameFromFSSpec(inFileSpec, true /*wantLeafName*/); - if (path) - { - int result = AB_ImportData( - nil, // no container, create new - path, - strlen(path), - AB_Filename // FIX ME: need the bit that tells the backend to delete the file. - ); - XP_FREE(path); - } -} - - -/*====================================================================================== - Show the search dialog by bringing it to the front if it is not already. Create it - if needed. -======================================================================================*/ - -CAddressBookWindow * CAddressBookManager::ShowAddressBookWindow() { - - // Find out if the window is already around - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - - if ( addressWindow == nil ) { - // Search dialog has not yet been created, so create it here and display it. - addressWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CAddressBookWindow::res_ID, - LCommander::GetTopCommander())); - AssertFail_(addressWindow != nil); - } - - // Select the window - - addressWindow->Show(); - addressWindow->Select(); - return addressWindow; -} - - -/*====================================================================================== - Return the list of directory servers for the application. Why are this - method and variable here? Can also call the BE method FE_GetDirServers() to return - the same result. -======================================================================================*/ - -XP_List *CAddressBookManager::GetDirServerList() { - - AssertFail_(sDirServerList != nil); - - if (sDirServerListChanged) { - // directory list may have been updated via a remote admin file - sDirServerListChanged = false; - XP_List* newList = nil; - CStr255 pfilename; - ::GetIndString(pfilename, 300, addressBookFile); - - if ( DIR_GetServerPreferences(&newList, pfilename) == 0 && newList ) { - SetDirServerList(newList, false); - } - } - - return sDirServerList; -} - - -/*====================================================================================== - This method should be called to set the current directory servers list. The old list - is destroyed and is replaced with inList; the caller does NOT dispose of inList, since - it is managed by this class after calling this method. This method also calls the - BE method DIR_SaveServerPreferences() if inSavePrefs is true. -======================================================================================*/ - -void CAddressBookManager::SetDirServerList(XP_List *inList, Boolean inSavePrefs) { - - AssertFail_(inList != nil); - - XP_List *tempDirServerList = sDirServerList; - sDirServerList = inList; // This needs to be set correctly for the callback to work. - if ( inSavePrefs ) { - Int32 error = DIR_SaveServerPreferences(inList); // No listed return error codes, - // who know what they are! - if (error) - { - sDirServerList = tempDirServerList; // Put this back if there are problems. - } - FailOSErr_(error); - } - - if ( tempDirServerList != nil ) { - Int32 error = DIR_DeleteServerList(tempDirServerList); - Assert_(!error); - } -} - - -/*====================================================================================== - Return the local personal address book. -======================================================================================*/ - -DIR_Server *CAddressBookManager::GetPersonalBook() { - - AssertFail_((sDirServerList != nil)); - DIR_Server *personalBook = nil; - DIR_GetPersonalAddressBook(sDirServerList, &personalBook); - AssertFail_(personalBook != nil); - return personalBook; -} - - -/*====================================================================================== - Return the address book database. Can also call the BE method FE_GetAddressBook() to - return the same result. -======================================================================================*/ - -ABook *CAddressBookManager::GetAddressBook() { - - AssertFail_(sAddressBook != nil); - return sAddressBook; -} - -void CAddressBookManager::FailAddressError(Int32 inError) -{ - if ( inError == 0 ) return; - switch ( inError ) - { - case MK_MSG_NEED_FULLNAME: - case MK_MSG_NEED_GIVENNAME: - Throw_( MK_MSG_NEED_FULLNAME ); - break; - case MK_OUT_OF_MEMORY: - Throw_(memFullErr); - break; - case MK_ADDR_LIST_ALREADY_EXISTS: - case MK_ADDR_ENTRY_ALREADY_EXISTS: - Throw_( inError ); - break; - case MK_UNABLE_TO_OPEN_FILE: - case XP_BKMKS_CANT_WRITE_ADDRESSBOOK: - Throw_(ioErr); - break; - case XP_BKMKS_NICKNAME_ALREADY_EXISTS: - Throw_(XP_BKMKS_INVALID_NICKNAME); - break; - default: - Assert_(false); - Throw_(32000); // Who knows? - break; - } -} - - -/*====================================================================================== - Register all classes associated with the address book window. -======================================================================================*/ - -void CAddressBookManager::RegisterAddressBookClasses() { - - RegisterClass_(CAddressBookWindow); - RegisterClass_(CAddressBookTableView); - RegisterClass_(CAddressBookListTableView); - RegisterClass_(CAddressPickerWindow); - RegisterClass_(CSearchPopupMenu); - - RegisterClass_(CNamePropertiesWindow); - RegisterClass_(CListPropertiesWindow); - - RegisterClass_(CAddressBookController); - RegisterClass_( CLDAPQueryDialog ); - CGATabBox::RegisterTabBoxClasses(); -} - -/*====================================================================================== - Find an open instance of the name properties window with the specified ID. -======================================================================================*/ - -CNamePropertiesWindow *CAddressBookManager::FindNamePropertiesWindow(ABID inEntryID) { - - CNamePropertiesWindow *propertiesWindow = nil; - - // Try to locate the specific window - CMediatedWindow *theWindow; - CWindowIterator theIterator(WindowType_AddressPerson); - - while ( theIterator.Next(theWindow) ) { - propertiesWindow = dynamic_cast(theWindow); - AssertFail_(propertiesWindow != nil); - if ( propertiesWindow->GetEntryID() == inEntryID ) { - break; // We found our window! - } else { - propertiesWindow = nil; - } - } - - return propertiesWindow; -} - - -/*====================================================================================== - Return an instance of the name properties window. If inEntryID is not equal to - CAddressBookPane::eNewEntryID, try to locate the window with the specified entry - ID; otherwise, try to locate the first top window. If inDoCreate is true, create the - window if it is not found, otherwise return the found window or nil. The caller should - always call Show() and Select() on the window. -======================================================================================*/ - -CNamePropertiesWindow *CAddressBookManager::GetNamePropertiesWindow(ABID inEntryID, Boolean inOptionKeyDown) { - - CNamePropertiesWindow *propertiesWindow = nil; - - // Try to locate a window with the specified ID - - if ( inEntryID != CAddressBookPane::eNewEntryID ) { - propertiesWindow = FindNamePropertiesWindow(inEntryID); - } - - if ( propertiesWindow == nil ) { - // Couldn't find a window with the specified ID - if ( inOptionKeyDown ) { - // Try to locate the top window - propertiesWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_AddressPerson)); - } - if ( propertiesWindow == nil ) { - // Create a new window - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - AssertFail_(addressWindow != nil); // Must be around to create name properties window - - // Create the window - propertiesWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CNamePropertiesWindow::res_ID, - addressWindow->GetSuperCommander())); - AssertFail_(propertiesWindow != nil); - } - } - - return propertiesWindow; -} - - -/*====================================================================================== - Find an open instance of the list properties window with the specified ID. -======================================================================================*/ - -CListPropertiesWindow *CAddressBookManager::FindListPropertiesWindow(ABID inEntryID) { - - CListPropertiesWindow *propertiesWindow = nil; - - // Try to locate the specific window - CMediatedWindow *theWindow; - CWindowIterator theIterator(WindowType_AddressList); - - while ( theIterator.Next(theWindow) ) { - propertiesWindow = dynamic_cast(theWindow); - AssertFail_(propertiesWindow != nil); - if ( propertiesWindow->GetEntryID() == inEntryID ) { - break; // We found our window! - } else { - propertiesWindow = nil; - } - } - - return propertiesWindow; -} - -//----------------------------------- -CListPropertiesWindow *CAddressBookManager::GetListPropertiesWindow(ABID inEntryID, Boolean inOptionKeyDown) -// Return an instance of the list properties window. If inEntryID is not equal to -// CAddressBookPane::eNewEntryID, try to locate the window with the specified entry -// ID; otherwise, try to locate the first top window. If inDoCreate is true, create the -// window if it is not found, otherwise return the found window or nil. The caller should -// always call Show() and Select() on the window. -//----------------------------------- -{ - - CListPropertiesWindow *propertiesWindow = nil; - - // Try to locate a window with the specified ID - - if ( inEntryID != CAddressBookPane::eNewEntryID ) { - propertiesWindow = FindListPropertiesWindow(inEntryID); - } - - if ( propertiesWindow == nil ) { - // Couldn't find a window with the specified ID - if ( inOptionKeyDown ) { - // Try to locate the top window - propertiesWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_AddressList)); - } - if ( propertiesWindow == nil ) { - // Create a new window - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - AssertFail_(addressWindow != nil); // Must be around to create name properties window - - // Create the window - propertiesWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CListPropertiesWindow::res_ID, - addressWindow->GetSuperCommander())); - AssertFail_(propertiesWindow != nil); - } - } - - return propertiesWindow; -} // CAddressBookWindow::GetListPropertiesWindow -#pragma mark - -/*====================================================================================== - Stop any current search. -======================================================================================*/ - -CAddressBookWindow::~CAddressBookWindow() { - - // Loop though current visible windows to close any name properties or list view windows - - CloseAddressBookChildren(); -#if 0 // Don't know why this code exists - Boolean canRotate = false; - if ( IsVisible() ) { - USearchHelper::FindWindowTabGroup(&mSubCommanders)->SetRotateWatchValue(&canRotate); - } -#endif // 0 - -} - - -/*====================================================================================== - Try to close the address book children windows. Return true if all windows were closed - successfully, or false if the user cancelled closing an open window. -======================================================================================*/ - -Boolean CAddressBookWindow::CloseAddressBookChildren() { - - // Loop though current visible windows to close any name properties or list view windows - - CWindowMediator *mediator = CWindowMediator::GetWindowMediator(); - Assert_(mediator != nil); - - CMediatedWindow *theWindow; - - Boolean rtnVal = true; - - Try_ { - - while ( ((theWindow = mediator->FetchTopWindow(WindowType_AddressPerson)) != nil) || - ((theWindow = mediator->FetchTopWindow(WindowType_AddressList)) != nil) ) { - - theWindow->DoClose(); - } - } - Catch_(inErr) { - rtnVal = false; - } - EndCatch_ - - return rtnVal; -} - - -/*====================================================================================== - Get the mail context for the address book. We must have an address book window to - access the context, so this method creates the window (but doesn't show it) if the - window is not yet around. -======================================================================================*/ - -MWContext *CAddressBookWindow::GetMailContext() { - - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - - if ( addressWindow == nil ) { - // Search dialog has not yet been created, so create it here and display it. - addressWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CAddressBookWindow::res_ID, - LCommander::GetTopCommander())); - AssertFail_(addressWindow != nil); - } - - return *(addressWindow->GetWindowContext()); -} - - -//----------------------------------- -void CAddressBookWindow::FinishCreateSelf() -//----------------------------------- -{ - - mAddressBookController = dynamic_cast< CAddressBookController* > - (FindPaneByID( paneID_AddressBookController) ) ; - FailNILRes_(mAddressBookController); - - CMediatedWindow::FinishCreateSelf(); // Call CMediatedWindow for now since we need to - // create a different context than CMailNewsWindow - - UReanimator::LinkListenerToControls(mAddressBookController, this,CAddressBookWindow:: res_ID); - - // Create context and and progress listener - - mMailNewsContext = new CMailNewsContext(MWContextAddressBook); - FailNIL_(mMailNewsContext); - mMailNewsContext->AddUser(this); - mMailNewsContext->AddListener(mAddressBookController); - - - mMailNewsContext->SetWinCSID(INTL_DocToWinCharSetID(mMailNewsContext->GetDefaultCSID())); - - - CMediatedWindow::FinishCreateSelf(); // Call CMediatedWindow for now since we need to - // create a different context than CMailNewsWindow - - CStr255 windowTitle; - GetUserWindowTitle(4, windowTitle); - SetDescriptor(windowTitle); - - // Call inherited method - FinishCreateWindow(); -} - - - -//----------------------------------- -void CAddressBookWindow::ReadWindowStatus(LStream *inStatusData) -// Adjust the window to stored preferences. -//----------------------------------- -{ - Int32 directoryIndex = 1; - Inherited::ReadWindowStatus(inStatusData); - if ( inStatusData != nil ) - { - - *inStatusData >> directoryIndex; - mAddressBookController->ReadStatus( inStatusData ); - } - - // The popup is set up to item 1, and setting the value does nothing if the value - // is the same as the existing value. Hence this special case. - if (directoryIndex == 1) - mAddressBookController->SelectDirectoryServer(nil, directoryIndex); - else - mAddressBookController->SetPopupFromServerIndex(directoryIndex); - -} - -//----------------------------------- -void CAddressBookWindow::WriteWindowStatus(LStream *outStatusData) -// Write window stored preferences. -//----------------------------------- -{ - - Inherited::WriteWindowStatus(outStatusData); - *outStatusData << mAddressBookController->GetServerIndexFromPopup(); - mAddressBookController->WriteStatus(outStatusData); - -} - -#pragma mark - - -DIR_Server *CAddressBookPane::sCurrentBook = nil; - -//----------------------------------- -void CAddressBookPane::FinishCreateSelf() -//----------------------------------- -{ - LPane *pane = USearchHelper::GetPaneWindow(this)->FindPaneByID(paneID_ProgressBar); - mProgressBar = dynamic_cast(pane); - Inherited::FinishCreateSelf(); -} - -//----------------------------------- -void CAddressBookPane::DrawCellContents(const STableCell &inCell, const Rect &inLocalRect) -// Draw the table view cell. -//----------------------------------- -{ - CStr255 displayText; - ResIDT iconID; - - ABID entryID, type; - GetEntryIDAndType(inCell.row, &entryID, &type); - - GetDisplayData((EColType) GetCellDataType(inCell), entryID, type, &displayText, &iconID); - - Rect cellDrawFrame; - - if ( iconID != 0 ) { - ::SetRect(&cellDrawFrame, 0, 0, 16, 16); - UGraphicGizmos::CenterRectOnRect(cellDrawFrame, inLocalRect); - } else { - cellDrawFrame = inLocalRect; - ::InsetRect(&cellDrawFrame, 2, 0); // For a nicer look between cells - } - - Boolean cellIsSelected = CellIsSelected(inCell); - - StSectClipRgnState saveSetClip(&cellDrawFrame); - - //if ( cellIsSelected && DrawHiliting() ) { - if ( iconID != 0 ) { - // Display an icon - ::PlotIconID(&cellDrawFrame, ttNone, ttNone, iconID); - } else { - DrawTextString( displayText, &mTextFontInfo, 0, - cellDrawFrame, teFlushLeft, - true, truncMiddle); - } - #if 0 - } else { - if ( iconID != 0 ) { - // Display an icon - ::PlotIconID(&cellDrawFrame, ttNone, ttNone, iconID); - } else { - // Display text - if ( displayText.Length() > 0 ) { - UGraphicGizmos::PlaceTextInRect((char *) &displayText[1], displayText[0], - cellDrawFrame, teFlushLeft, teCenter, - &mTextFontInfo, true, truncMiddle); - } - } - - } - #endif -} // CAddressBookPane::DrawCell - - -//----------------------------------- -void CAddressBookPane::SetUpTableHelpers() -//----------------------------------- -{ - - SetTableGeometry(new LFlexTableGeometry(this, mTableHeader)); - SetTableSelector(new LTableRowSelector(this)); - - AddAttachment( new CTableRowKeyAttachment(this) ); // need for arrow naviagation - // We don't need table storage. It's safe to have a null one. - AssertFail_(mTableStorage == nil); -} - -//----------------------------------- -void CAddressBookPane::GetEntryIDAndType(TableIndexT inRow, ABID *outID, ABID *outType) -// Get the entry ID and data type for the specified row. -//----------------------------------- -{ - - Assert_(GetMessagePane() != nil); - Assert_(sCurrentBook != nil); - - *outID = AB_GetEntryIDAt((AddressPane*) GetMessagePane(), inRow - 1); - Int32 error = AB_GetType(sCurrentBook, CAddressBookManager::GetAddressBook(), - *outID, outType); - ASSERT_ADDRESS_ERROR(error); -} - -//----------------------------------- -ABID CAddressBookPane::GetEntryID(TableIndexT inRow) -//----------------------------------- -{ - Assert_(GetMessagePane() != nil); - Assert_((inRow <= mRows) && (inRow > 0)); - if (inRow > mRows || inRow == 0) - return MSG_MESSAGEIDNONE; - - ABID id = AB_GetEntryIDAt( (AddressPane*) GetMessagePane(), inRow - 1); - Assert_(id != MSG_MESSAGEIDNONE); - - return id; -} - - -//----------------------------------- -void CAddressBookPane::GetDisplayData(EColType inColType, ABID inEntryID, ABID inType, - CStr255 *outDisplayText, ResIDT *outIconID) -//----------------------------------- -{ - *outDisplayText = CStr255::sEmptyString; - *outIconID = 0; - - switch ( inColType ) { - - case eColType: { - if ( inType == ABTypeList ) { - *outIconID = ics8_List; - } else { - *outIconID = ics8_Person; - } - } - break; - - case eColName: { - Int32 error = AB_GetFullName(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, - (char *) ((UInt8 *) &(*outDisplayText)[0])); - ASSERT_ADDRESS_ERROR(error); - } - break; - - case eColEmail: { - Int32 error = AB_GetEmailAddress(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, - (char *) ((UInt8 *) &(*outDisplayText)[0])); - ASSERT_ADDRESS_ERROR(error); - } - break; - - case eColCompany: { - Int32 error = AB_GetCompanyName(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, - (char *) ((UInt8 *) &(*outDisplayText)[0])); - ASSERT_ADDRESS_ERROR(error); - } - break; - - case eColLocality: { - Int32 error = AB_GetLocality(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, - (char *) ((UInt8 *) &(*outDisplayText)[0])); - ASSERT_ADDRESS_ERROR(error); - } - break; - - case eColNickname: { - Int32 error = AB_GetNickname(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, - (char *) ((UInt8 *) &(*outDisplayText)[0])); - ASSERT_ADDRESS_ERROR(error); - } - break; - case eColWorkPhone: - Int32 error = AB_GetWorkPhone(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, - (char *) ((UInt8 *) &(*outDisplayText)[0])); - ASSERT_ADDRESS_ERROR(error); - break; - - - default: - Assert_(false); // Should never get here! - break; - } - - if ( outDisplayText->Length() > 0 ) { - // We have a c string, convert to pascal - C2PStr((char *) ((UInt8 *) &(*outDisplayText)[0])); - } -} - - -/*====================================================================================== - Get the current sort params for the address book data. -======================================================================================*/ - -void CAddressBookPane::GetSortParams(UInt32 *outSortKey, Boolean *outSortBackwards) { - - AssertFail_(mTableHeader != nil); - PaneIDT sortColumnID; - mTableHeader->GetSortedColumn(sortColumnID); - *outSortKey = SortTypeFromColumnType((EColType) sortColumnID); - *outSortBackwards = mTableHeader->IsSortedBackwards(); -} - - -/*====================================================================================== - Call CStandardFlexTable's method and add actual ABIDs instead. -======================================================================================*/ - -void CAddressBookPane::AddSelectionToDrag(DragReference inDragRef, RgnHandle inDragRgn) { - - CStandardFlexTable::AddSelectionToDrag(inDragRef, inDragRgn); -} - - -/*====================================================================================== - Add the actual ABID. -======================================================================================*/ - -void CAddressBookPane::AddRowDataToDrag(TableIndexT inRow, DragReference inDragRef) { - - - AssertFail_(mDragFlavor == kMailAddresseeFlavor); - - SAddressDragInfo info; - info.id = GetEntryID(inRow); - info.dir = sCurrentBook; - - OSErr err = ::AddDragItemFlavor(inDragRef, inRow, mDragFlavor, - &info, sizeof(info), flavorSenderOnly); - FailOSErr_(err); - - - // temporary while the old address book is still being used. - char* fullName = NULL; - - GetFullAddress( inRow, &fullName); - - Size dataSize = XP_STRLEN ( fullName ); - err = ::AddDragItemFlavor(inDragRef, inRow, 'TEXT', fullName, dataSize, 0 ); - - XP_FREE(fullName); - - FailOSErr_(err); - -} - - -/*====================================================================================== - Return a valid BE sort type from the specified column type. -======================================================================================*/ - -UInt32 CAddressBookPane::SortTypeFromColumnType(EColType inColType) { - - UInt32 rtnVal; - - switch ( inColType ) { - case eColType: rtnVal = ABTypeEntry; break; - case eColName: rtnVal = ABFullName; break; - case eColEmail: rtnVal = ABEmailAddress; break; - case eColCompany: rtnVal = ABCompany; break; - case eColLocality: rtnVal = ABLocality; break; - case eColNickname: rtnVal = ABNickname; break; - default: rtnVal = ABFullName; break; - } - - return rtnVal; -} - - -/*====================================================================================== - Return a valid BE sort type from the specified column type. -======================================================================================*/ - -AB_CommandType CAddressBookPane::SortCommandFromColumnType(EColType inColType) { - - AB_CommandType rtnVal; - - switch ( inColType ) { - case eColType: rtnVal = AB_SortByTypeCmd; break; - case eColName: rtnVal = AB_SortByFullNameCmd; break; - case eColEmail: rtnVal = AB_SortByEmailAddress; break; - case eColCompany: rtnVal = AB_SortByCompanyName; break; - case eColLocality: rtnVal = AB_SortByLocality; break; - case eColNickname: rtnVal = AB_SortByNickname; break; - default: rtnVal = AB_SortByFullNameCmd; break; - } - - return rtnVal; -} - - -/*====================================================================================== - Get the number of entries for the specified entry. -======================================================================================*/ - -Int32 CAddressBookPane::GetBENumEntries(ABID inType, ABID inListID) { - - UInt32 numRows; - Int32 error = AB_GetEntryCount(sCurrentBook, CAddressBookManager::GetAddressBook(), - &numRows, inType, inListID); - ASSERT_ADDRESS_ERROR(error); - return numRows; -} - - -/*====================================================================================== - Compose a mail message with the selected items. -======================================================================================*/ - -void CAddressBookPane::ComposeMessage() { - - AssertFail_(GetMessagePane() != nil); - - CMailSelection selection; - if ( GetSelection(selection) ) - { - Try_ { - - CAddressBookManager::FailAddressError(AB_Command((ABPane *) GetMessagePane(), - AB_NewMessageCmd, - (MSG_ViewIndex*)selection.GetSelectionList(), - selection.selectionSize)); - } - Catch_(inErr) { - Throw_(inErr); - } - EndCatch_ - } -} - -/*====================================================================================== - Open and show an edit window for the specified address book entry (list or person). -======================================================================================*/ - -void CAddressBookPane::ShowEditWindowByEntryID(ABID inEntryID, Boolean inOptionKeyDown) { -#pragma unused (inOptionKeyDown) - ABID type; - Int32 error = AB_GetType(sCurrentBook, CAddressBookManager::GetAddressBook(), inEntryID, &type); - ASSERT_ADDRESS_ERROR(error); - - ShowEditWindow(inEntryID, type); -} - - -#pragma mark - - -/*====================================================================================== - Adjust the window to stored preferences. -======================================================================================*/ - -CAddressBookTableView::~CAddressBookTableView() { - - SetMessagePane( NULL ); -} - - -/*====================================================================================== - Dispose of the address book pane. -======================================================================================*/ - -void CAddressBookPane::DestroyMessagePane(MSG_Pane* inPane) { - -// if ( inRefresh && (mRows > 0) ) RemoveRows(mRows, 1, true); - - if ( inPane != nil ) { - ::SetCursor(*::GetCursor(watchCursor)); // Could take forever - Int32 error = AB_CloseAddressBookPane((ABPane **) &inPane); - - ASSERT_ADDRESS_ERROR(error); - // sCurrentBook = nil; - } - - -} - - -//----------------------------------- -Boolean CAddressBookTableView::LoadAddressBook(DIR_Server *inDir) -// Load and display the specified address book. A reference is stored to the specified -// DIR_Server, so it should not be deleted without deleting the pane. If the method -// returns true, the address book was able to be loaded; if the method returns false, -// the address book could not be loaded because the user decided to continue modifying -// the current one. -//----------------------------------- -{ - AssertFail_(inDir != nil); - -// if ( inDir == sCurrentBook ) return true; // Already set! - - - TableIndexT rows, cols; - GetTableSize(rows, cols); - if (rows > 0) - RemoveRows(rows, 1, false); - - sCurrentBook = inDir; - - Try_ { - ::SetCursor(*::GetCursor(watchCursor)); // Could take forever - if ( GetMessagePane() != nil ) - { - CAddressBookManager::FailAddressError(AB_ChangeDirectory((ABPane *) GetMessagePane(), inDir)); - mTableHeader->SetSortOrder(false); - // Big hack to avoid having to fix some notification - SetRowCount(); - Refresh(); - } - else - { - MWContext *context = CAddressBookWindow::GetMailContext(); - UInt32 sortKey; - Boolean sortBackwards; - GetSortParams(&sortKey, &sortBackwards); - // Sorting on Keys other than ABFullname, ABEmailAddress, ABNickname - // is slow ( see bug #81275 ) - switch ( sortKey ) - { - case ABFullName: - case ABEmailAddress: - case ABNickname: - break; - default: - sortKey = ABFullName; - mTableHeader->SetWithoutSort( - mTableHeader->ColumnFromID( eColName ), sortBackwards, true ); - } - MSG_Pane* pane; - CAddressBookManager::FailAddressError( - AB_CreateAddressBookPane( - (ABPane **) &pane, - context, - CMailNewsContext::GetMailMaster()) - ); - SetMessagePane( pane ); - sCurrentBook = inDir; - MSG_SetFEData((MSG_Pane *) GetMessagePane(), CMailCallbackManager::Get()); - CAddressBookManager::FailAddressError( - AB_InitializeAddressBookPane( - (ABPane *) GetMessagePane(), - inDir, - CAddressBookManager::GetAddressBook(), - sortKey, - !sortBackwards) - ); - } - - } - Catch_(inErr) { - SetMessagePane( NULL ); - Throw_(inErr); - } - EndCatch_ - - return true; -} // CAddressBookTableView::LoadAddressBook - -//------------------------------------ -void CAddressBookTableView::ButtonMessageToCommand( MessageT inMessage, void* ioParam ) -//------------------------------------ -{ - ObeyCommand( inMessage, ioParam ); -} // CAddressBookTableView::ButtonMessageToCommand - - -//---------------------------------- -Boolean CAddressBookTableView::ObeyCommand(CommandT inCommand, void *ioParam) -//----------------------------------- -{ - Boolean rtnVal = true; - - switch ( inCommand ) { - - case CAddressBookPane::eColType: - case CAddressBookPane::eColName: - case CAddressBookPane::eColEmail: - case CAddressBookPane::eColCompany: - case CAddressBookPane::eColLocality: - case CAddressBookPane::eColNickname: - GetTableHeader()->SimulateClick(inCommand); - rtnVal = true; - break; - - case CAddressBookPane::cmd_SortAscending: - case CAddressBookPane::cmd_SortDescending: - GetTableHeader()->SetSortOrder(inCommand == CAddressBookPane::cmd_SortDescending); - break; - - case cmd_NewAddressCard: - NewCard(); - break; - - case cmd_NewAddressList: - NewList(); - break; - - case cmd_HTMLDomains: - MSG_DisplayHTMLDomainsDialog( CAddressBookWindow::GetMailContext() ); - break; - - case cmd_EditProperties: - OpenSelection(); - break; - - case cmd_DeleteEntry: - DeleteSelection(); - break; - - case cmd_ImportAddressBook: - ImportAddressBook(); - break; - - case cmd_NewMailMessage: - case cmd_ComposeMailMessage: - ComposeMessage(); - break; - - - case cmd_SaveAs: - SaveAs(); - break; - case cmd_SecurityInfo: - MWContext * context = CAddressBookWindow::GetMailContext(); - SECNAV_SecurityAdvisor( context, NULL ); - return true; - - case cmd_ViewMyCard: - ShowMyAddressCard(); - break; - - default: - rtnVal = Inherited::ObeyCommand(inCommand, ioParam); - break; - } - - return rtnVal; -} - -//----------------------------------- -void CAddressBookTableView:: FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName) -//----------------------------------- -{ - - switch ( inCommand ) { - - case CAddressBookPane::eColType: - case CAddressBookPane::eColName: - case CAddressBookPane::eColEmail: - case CAddressBookPane::eColCompany: - case CAddressBookPane::eColLocality: - case CAddressBookPane::eColNickname: - outEnabled = IsColumnVisible(inCommand); - outUsesMark = true; - if ( outEnabled ) { - outMark = (GetSortedColumn() == inCommand) ? checkMark : noMark; - } else { - outMark = noMark; - } - break; - - case CAddressBookPane::cmd_SortAscending: - case CAddressBookPane::cmd_SortDescending: - outEnabled = true; - outUsesMark = true; - if ( inCommand == CAddressBookPane::cmd_SortAscending ) { - outMark = (IsSortedBackwards() ? noMark : checkMark); - } else { - outMark = (IsSortedBackwards() ? checkMark : noMark); - } - break; - - case cmd_NewAddressCard: - case cmd_NewAddressList: - case cmd_ImportAddressBook: - case cmd_SaveAs: - case cmd_ViewMyCard: - case cmd_ConferenceCall: - outEnabled = CAddressBookTableView::CurrentBookIsPersonalBook(); - break; - - case cmd_HTMLDomains: - outEnabled = true; - break; - - case cmd_EditProperties: - case cmd_DeleteEntry: - if ( GetSelectedRowCount() > 0 ) { - outEnabled = CAddressBookTableView::CurrentBookIsPersonalBook(); - } - break; - - case cmd_ComposeMailMessage: - outEnabled = true; - break; - - default: - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} -//----------------------------------- -void CAddressBookTableView::DeleteSelection() -// Delete all selected items. -//----------------------------------- -{ - if ( !CAddressBookTableView::CurrentBookIsPersonalBook() ) return; - - AssertFail_(GetMessagePane() != nil); - - TableIndexT *indices = nil; - - CMailSelection selection; - - if ( GetSelection( selection ) ) - { - TableIndexT count = selection.selectionSize; - indices = (MSG_ViewIndex*)selection.GetSelectionList(); - Try_ { - - { // Close all open windows to delete - ABID id; - ABID type; - - for( Int32 index = 0; index < count; index ++ ) - { - GetEntryIDAndType( indices[ index ]+1 , &id, &type); - CloseEditWindow(id, type); - } - } - - CAddressBookManager::FailAddressError(AB_Command((ABPane *) GetMessagePane(), - AB_DeleteCmd, indices, count)); - - } - Catch_(inErr) { - - Throw_(inErr); - } - EndCatch_ - } -} - - -/*====================================================================================== - Import an address book and append it to the local address book. -======================================================================================*/ - -void CAddressBookTableView::ImportAddressBook() { - - AssertFail_(GetMessagePane() != nil); - AssertFail_(sCurrentBook == CAddressBookManager::GetPersonalBook()); - - CAddressBookManager::FailAddressError(AB_ImportFromFile((ABPane *) GetMessagePane(), - CAddressBookWindow::GetMailContext())); -} - -// Save As - -void CAddressBookTableView::SaveAs() -{ - CAddressBookManager::FailAddressError( - AB_ExportToFile( (ABPane *) GetMessagePane(),(MWContext*) CAddressBookWindow::GetMailContext() ) ); -} - - - - -/*====================================================================================== - Create a new card. -======================================================================================*/ - -void CAddressBookTableView::NewCard(PersonEntry* pPerson) { - - if ( !CAddressBookTableView::CurrentBookIsPersonalBook() ) return; - - ABID entryID = CAddressBookPane::eNewEntryID; - - CNamePropertiesWindow *namePropertiesWindow = - CAddressBookManager::GetNamePropertiesWindow(entryID, false); - AssertFail_(namePropertiesWindow != nil); // Must be there! - - namePropertiesWindow->AddListener(this); - - // Update the window properties - if( pPerson ) - namePropertiesWindow->UpdateUIToPerson( pPerson, entryID ); - namePropertiesWindow->SetConferenceText( ); - namePropertiesWindow->Show(); - namePropertiesWindow->Select(); -} - - -/*====================================================================================== - Create a new list. -======================================================================================*/ - -void CAddressBookTableView::NewList() { - - if ( !CAddressBookTableView::CurrentBookIsPersonalBook() ) return; - ABID entryID = CAddressBookPane::eNewEntryID; - #if HOTEDITWINDOWS - { - StMailingListEntry listEntry; - CAddressBookManager::FailAddressError(AB_AddMailingList(sCurrentBook, CAddressBookManager::GetAddressBook(), - listEntry.GetEntry(), &entryID)); - } - #endif // HOTEDITWINDOWS - ShowEditWindow(entryID, ABTypeList); -} - - -/*====================================================================================== - Open the selected message into its own window. -======================================================================================*/ - -void CAddressBookTableView::OpenRow(TableIndexT inRow) { - - if ( !CAddressBookTableView::CurrentBookIsPersonalBook() ) return; - - ABID id; - ABID type; - GetEntryIDAndType(inRow, &id, &type); - - ShowEditWindow(id, type); -} - - -/*====================================================================================== - Open the selected person or list into its own window. -======================================================================================*/ - -void CAddressBookPane::ShowEditWindow(ABID inID, ABID inType) { - - // Find out if the option key is down - -// Not implemented yet const Boolean optionKeyDown = USearchHelper::KeyIsDown(USearchHelper::char_OptionKey); - const Boolean optionKeyDown = false; - - LWindow *theWindow; - - if ( inType == ABTypeList ) { - CListPropertiesWindow *listPropertiesWindow = - CAddressBookManager::GetListPropertiesWindow(inID, optionKeyDown); - AssertFail_(listPropertiesWindow != nil); // Must be there! - - - // Update the window properties - listPropertiesWindow->UpdateUIToBackend(sCurrentBook, CAddressBookManager::GetAddressBook(), inID); - theWindow = listPropertiesWindow; - } else { - Assert_(inType == ABTypePerson); - CNamePropertiesWindow *namePropertiesWindow = - CAddressBookManager::GetNamePropertiesWindow(inID, optionKeyDown); - AssertFail_(namePropertiesWindow != nil); // Must be there! - - - // Update the window properties - - namePropertiesWindow->UpdateUIToBackend(sCurrentBook, CAddressBookManager::GetAddressBook(), inID); - theWindow = namePropertiesWindow; - } - - theWindow->Show(); - theWindow->Select(); -} - -// Call the selected person -void CAddressBookTableView::ConferenceCall( ) -{ - TableIndexT selectedRow=0; - GetNextSelectedRow( selectedRow ); - if ( !CAddressBookTableView::CurrentBookIsPersonalBook() ) - return; - - ABID id; - ABID type; - GetEntryIDAndType( selectedRow, &id, &type ); - char emailAddress[kMaxEmailAddressLength]; - char ipAddress[kMaxCoolAddress]; - short serverType; - AB_GetUseServer( sCurrentBook, CAddressBookManager::GetAddressBook(), id, &serverType ); - AB_GetEmailAddress( sCurrentBook, CAddressBookManager::GetAddressBook(), id, emailAddress ); - AB_GetCoolAddress( sCurrentBook, CAddressBookManager::GetAddressBook(), id, ipAddress ); - - // Check to see if we have all the data we need - if ( (serverType==kSpecificDLS || serverType==kHostOrIPAddress ) && !XP_STRLEN( ipAddress )) - { - FE_Alert( CAddressBookWindow::GetMailContext(), XP_GetString(MK_MSG_CALL_NEEDS_IPADDRESS)); - return; - } - if ( (serverType==kSpecificDLS || serverType==kDefaultDLS) && !XP_STRLEN( emailAddress )) - { - FE_Alert( CAddressBookWindow::GetMailContext(), XP_GetString(MK_MSG_CALL_NEEDS_EMAILADDRESS)); - return; - } - char *ipAddressDirect = NULL; - char *serverAddress = NULL; - char *address = NULL; - switch( serverType) - { - case kDefaultDLS: - address = &emailAddress[0]; - break; - case kSpecificDLS: - address = &emailAddress[0]; - serverAddress = &ipAddress[0]; - break; - case kHostOrIPAddress: - ipAddressDirect = &ipAddress[0]; - break; - default: - break; - } - // And now the AE fun begins - AppleEvent event,reply; - OSErr error; - ProcessSerialNumber targetPSN; - Boolean isAppRunning; - static const OSType kConferenceAppSig = 'Ncq¹'; // This needs to be in a header file - // so that uapp and us share it - isAppRunning = UProcessUtils::ApplicationRunning( kConferenceAppSig, targetPSN ); - if( !isAppRunning) - { - ObeyCommand(cmd_LaunchConference, NULL); - isAppRunning = UProcessUtils::ApplicationRunning( kConferenceAppSig, targetPSN ); - } - - if( !isAppRunning ) // for some reason we were unable to open app - return; - Try_ - { - error = AEUtilities::CreateAppleEvent( 'VFON', 'CALL', event, targetPSN ); - ThrowIfOSErr_(error); - if( ipAddressDirect) - { - error = ::AEPutParamPtr(&event, '----', typeChar, ipAddressDirect, XP_STRLEN(ipAddressDirect) ); - ThrowIfOSErr_(error); - } - if( address) - { - error = ::AEPutParamPtr(&event, 'MAIL', typeChar, address, XP_STRLEN(address) ); - ThrowIfOSErr_(error); - } - if( serverAddress ) - { - error = ::AEPutParamPtr(&event, 'SRVR', typeChar, serverAddress, XP_STRLEN(serverAddress) ); - ThrowIfOSErr_(error); - } - - // NULL reply parameter - reply.descriptorType = typeNull; - reply.dataHandle = nil; - - error = AESend(&event,&reply,kAENoReply + kAENeverInteract - + kAECanSwitchLayer+kAEDontRecord,kAENormalPriority,-1,nil,nil); - ThrowIfOSErr_(error); - - UProcessUtils::PullAppToFront( targetPSN ); - - } - Catch_(inError) // in case of errors do nothing - { - } - AEDisposeDesc(&reply); - AEDisposeDesc(&event); - -} -/*====================================================================================== - Close the selected person or list properties window if there is one. -======================================================================================*/ - -void CAddressBookTableView::CloseEditWindow(ABID inID, ABID inType) { - - LWindow *theWindow; - - if ( inType == ABTypeList ) { - theWindow = CAddressBookManager::FindListPropertiesWindow(inID); - } else { - Assert_(inType == ABTypePerson); - theWindow = CAddressBookManager::FindNamePropertiesWindow(inID); - } - - if ( theWindow != nil ) theWindow->DoClose(); -} - -//----------------------------------- -void CAddressBookTableView::SetColumnHeaders(DIR_Server* server) -//----------------------------------- -{ - MSG_SearchAttribute attr; - DIR_AttributeId id; - STableCell aCell; - const char* colName; - LTableViewHeader* tableHeader = GetTableHeader(); - PaneIDT headerPaneID; - - for (short col = 1; col <= tableHeader->CountColumns(); col ++) - { - headerPaneID = tableHeader->GetColumnPaneID(col); - switch (headerPaneID) - { - case CAddressBookPane::eColName: attr = attribCommonName; break; - case CAddressBookPane::eColEmail: attr = attrib822Address; break; - case CAddressBookPane::eColCompany: attr = attribOrganization; break; - case CAddressBookPane::eColLocality: attr = attribLocality; break; - case CAddressBookPane::eColWorkPhone: attr = attribPhoneNumber; break; - case CAddressBookPane::eColNickname: // no break; - default: attr = kNumAttributes; break; - } - - if (attr < kNumAttributes) - { - MSG_SearchAttribToDirAttrib(attr, &id); - colName = DIR_GetAttributeName(server, id); - if (colName && *colName) - { - LCaption* headerPane = dynamic_cast(FindPaneByID(headerPaneID)); - if (headerPane) - { - CStr255 cStr(colName); - headerPane->SetDescriptor((StringPtr)cStr); - } - } - } - } -} - -/*====================================================================================== - Force a sort to occur based upon the current sort column. -======================================================================================*/ - -void CAddressBookTableView::ForceCurrentSort() { - - UInt32 sortKey; - Boolean sortBackwards; - - GetSortParams(&sortKey, &sortBackwards); - -/* - mSearchManager->SortSearchResults(sortKey, sortBackwards); -*/ -} - - -/*====================================================================================== - Notification to sort the table. -======================================================================================*/ - -void CAddressBookTableView::ChangeSort(const LTableHeader::SortChange *inSortChange) { - - Assert_(GetMessagePane() != nil); - Assert_(sCurrentBook != nil); - - AB_CommandType sortCmd = SortCommandFromColumnType((EColType) inSortChange->sortColumnID); - - ::SetCursor(*::GetCursor(watchCursor)); - - // Call BE to sort the table - - CAddressBookManager::FailAddressError(AB_Command((ABPane *) GetMessagePane(), sortCmd, nil, 0)); -} - - -/*====================================================================================== - Update the currently displayed and selected row based upon the typed down text. -======================================================================================*/ - -void CAddressBookTableView::UpdateToTypedownText(Str255 inTypedownText) { - - MSG_ViewIndex index = eInvalidCachedRowIDType; - Int32 error = AB_GetIndexMatchingTypedown((ABPane *) GetMessagePane(), &index, P2CStr(inTypedownText), 0); - ASSERT_ADDRESS_ERROR(error); - - if ( index != eInvalidCachedRowIDType ) { - STableCell selectedCell = GetFirstSelectedCell(); - if ( IsValidCell(selectedCell) ) { - if ( (GetSelectedRowCount() > 1) || (selectedCell.row != (index + 1)) ) { - UnselectAllCells(); - } - } - STableCell cell(index + 1, 1); - SelectCell( cell ); - ScrollCellIntoFrame( cell ); - } -} - - -/*====================================================================================== - Return whether or not we are currently performing an LDAP search. -======================================================================================*/ - -Boolean CAddressBookTableView::IsLDAPSearching() { - - return ((CAddressBookWindow *) USearchHelper::GetPaneWindow(this))-> - GetAddressBookController()->IsLDAPSearching(); -} - - -/*====================================================================================== - Notification from the BE that something is finished changing in the display table. -======================================================================================*/ - -void CAddressBookTableView::ChangeFinished(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount) { - - // If it's an initial insert call, and we're doing LDAP search, then simply pass - // this info on to the addressbook backend. We'll get a MSG_NotifyAll when - // the backend thinks we should redraw. - - if ( (mMysticPlane < (kMysticUpdateThreshHold + 2)) && - (inChangeCode == MSG_NotifyInsertOrDelete) && - IsLDAPSearching() ) { - - AB_LDAPSearchResults((ABPane *) GetMessagePane(), inStartRow - 1, inRowCount); - } - Inherited::ChangeFinished(inPane, inChangeCode, inStartRow, inRowCount); - // Because the search is asynchronous, we - // don't want to cause a redraw every time a row is inserted, because that causes - // drawing of rows in random, unsorted order. - - if (inChangeCode == MSG_NotifyInsertOrDelete && IsLDAPSearching()) - DontRefresh(); - else - Refresh(); - -} - -void CAddressBookTableView::PaneChanged(MSG_Pane *inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -{ - switch (inNotifyCode) - { - case MSG_PaneDirectoriesChanged: - BroadcastMessage( MSG_PaneDirectoriesChanged, NULL ); - break; - default: - Inherited::PaneChanged(inPane, inNotifyCode, value); - break; - } -} - -//----------------------------------- -void CAddressBookTableView::ShowMyAddressCard () -//----------------------------------- -{ - // the StPersonEntry will take care of freeing up it's memory - PersonEntry person; - person.Initialize(); - - const char *userEmail = FE_UsersMailAddress(); - const char *userName = FE_UsersFullName(); - - if (userEmail) - person.pGivenName = XP_STRDUP(userName); - if (userName) - person.pEmailAddress = XP_STRDUP(userEmail); - - DIR_Server *pab = NULL; - ABID entryID; - ABook *abook = CAddressBookManager::GetAddressBook(); - - DIR_GetPersonalAddressBook(CAddressBookManager::GetDirServerList(), &pab); - XP_ASSERT(pab); - if (!pab) return; - - // this allocates pFamilyName - AB_BreakApartFirstName (abook, &person); - AB_GetEntryIDForPerson(pab, abook, &entryID, &person); - - if (entryID == MSG_MESSAGEKEYNONE) - NewCard(&person); - else - ShowEditWindowByEntryID(entryID, false); - - // pFamilyName was allocated in AB_BreakApartFirstName - XP_FREEIF(person.pGivenName); - XP_FREEIF(person.pFamilyName); - XP_FREEIF(person.pEmailAddress); -} - - -#pragma mark - - - - -/*====================================================================================== - Adjust the window to stored preferences. -======================================================================================*/ - -CAddressBookListTableView::~CAddressBookListTableView() { - - SetMessagePane( NULL ); -} - - -/*====================================================================================== - Dispose of the address list pane. -======================================================================================*/ -#if 0 -void CAddressBookListTableView::DisposeAddressListPane(Boolean inRefresh) { - - //if ( inRefresh && (mRows > 0) ) RemoveRows(mRows, 1, true); - - if ( GetMessagePane() != nil ) { - Int32 error = AB_CloseMailingListPane((MLPane **) &GetMessagePane()); - GetMessagePane() = nil; - ASSERT_ADDRESS_ERROR(error); - } -} -#endif - -/*====================================================================================== - Load and display the specified address book list. -======================================================================================*/ - -void CAddressBookListTableView::LoadAddressBookList(ABID &ioEntryListID) { - - Try_ { - if ( GetMessagePane() == nil ) - { - MWContext *context = CAddressBookWindow::GetMailContext(); - MSG_Pane * pane; - CAddressBookManager::FailAddressError( AB_CreateMailingListPane((MLPane **) &pane, - context, CMailNewsContext::GetMailMaster() ) ); - SetMessagePane( pane ); - MSG_SetFEData((MSG_Pane *) GetMessagePane(), CMailCallbackManager::Get()); - CMailCallbackListener::SetPane( (MSG_Pane*) GetMessagePane() ); - - CAddressBookManager::FailAddressError( - AB_InitializeMailingListPane((MLPane *) GetMessagePane(), &ioEntryListID, - sCurrentBook, CAddressBookManager::GetAddressBook() ) ); - } - } - Catch_(inErr) { - - SetMessagePane( NULL ); - - Throw_(inErr); - } - EndCatch_ -} - -/*====================================================================================== - Return whether a DropArea can accept the specified Drag. Override inherited method - to return true if ANY item is acceptable, instead of ALL items. -======================================================================================*/ - -Boolean CAddressBookListTableView::DragIsAcceptable(DragReference inDragRef) { - - Uint16 itemCount; - ::CountDragItems(inDragRef, &itemCount); - - for (Uint16 item = 1; item <= itemCount; item++) { - ItemReference itemRef; - ::GetDragItemReferenceNumber(inDragRef, item, &itemRef); - - if ( ItemIsAcceptable(inDragRef, itemRef) ) { - return true; // return on first successful item - } - } - - return false; -} - - -/*====================================================================================== - Return whether a Drag item is acceptable. -======================================================================================*/ - -Boolean CAddressBookListTableView::ItemIsAcceptable(DragReference inDragRef, - ItemReference inItemRef) { - - SAddressDragInfo info; - return CanInsertDragItem(inDragRef, inItemRef, &info); -} - - -/*====================================================================================== - Process an Item which has been dragged into a DropArea. -======================================================================================*/ - -void CAddressBookListTableView::ReceiveDragItem(DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect &inItemBounds) { - -#pragma unused (inDragAttrs) -#pragma unused (inItemBounds) - SAddressDragInfo info; - if (mDropRow == LArray::index_Last) - { - mDropRow = mRows; - } - Int32 insertRow = mDropRow; - if( mIsDropBetweenRows ) - insertRow --; - if( insertRow < 0 ) - insertRow = 0; - if ( insertRow > GetBENumRows() ) - insertRow = GetBENumRows(); - if ( CanInsertDragItem(inDragRef, inItemRef, &info) ) { - Try_ { - - CAddressBookManager::FailAddressError( - AB_AddIDToMailingListAt( (MLPane *) GetMessagePane(), info.id, - insertRow ) ); - - mDropRow++; - } - Catch_(inErr) { - - } - EndCatch_ - } -} - - -/*====================================================================================== - Initialize the table. -======================================================================================*/ - -void CAddressBookListTableView::FinishCreateSelf() -{ - - CAddressBookPane::FinishCreateSelf(); -} - - -/*====================================================================================== - Delete all selected items. -======================================================================================*/ - -void CAddressBookListTableView::DeleteSelection() { - - AssertFail_(GetMessagePane() != nil); - CMailSelection selection; - - if ( GetSelection( selection ) ) - { - TableIndexT count = selection.selectionSize; - TableIndexT *indices = (MSG_ViewIndex*)selection.GetSelectionList(); - int32 numRemoved = count; - while ( numRemoved-- >=0 ) - { - Try_ { - CAddressBookManager::FailAddressError(AB_RemoveIDFromMailingListAt((MLPane *) GetMessagePane(), - indices[numRemoved])); - } - Catch_(inErr) { - - Throw_(inErr); - } - EndCatch_ - } - } - -} - - -/*====================================================================================== - Open the selected message into its own window. -======================================================================================*/ - -void CAddressBookListTableView::OpenRow(TableIndexT inRow) -{ - const Boolean optionKeyDown = false; - - ShowEditWindowByEntryID(GetEntryID(inRow), optionKeyDown); -} - - -/*====================================================================================== - Return true if the specified drag item can be inserted into the list. -======================================================================================*/ - -Boolean CAddressBookListTableView::CanInsertDragItem(DragReference inDragRef, ItemReference inItemRef, - SAddressDragInfo *outInfo) { - - FlavorFlags flavorFlags; - - // Check that correct flavor is present, check to see if the entry is not in the list yet - if ( ::GetFlavorFlags(inDragRef, inItemRef, kMailAddresseeFlavor, &flavorFlags) == noErr ) { - - // Get the ABID of the item being dragged, either person or list - Size dataSize = sizeof(SAddressDragInfo); - - if ( ::GetFlavorData(inDragRef, inItemRef, kMailAddresseeFlavor, outInfo, &dataSize, 0) == noErr ) { - Assert_(dataSize == sizeof(SAddressDragInfo)); - - // Check with BE to see if the entry is already in the list - - if ( (((CAddressBookChildWindow *) USearchHelper::GetPaneWindow(this))->GetEntryID() != outInfo->id) && - (AB_GetIndexOfEntryID((AddressPane*)GetMessagePane(), outInfo->id) == MSG_VIEWINDEXNONE) ) { - return true; - } - } - } - return false; -} - - - -#pragma mark - -void CAddressBookChildWindow::FinishCreateSelf() -{ - LGAPushButton *control = dynamic_cast ( FindPaneByID('OkBt') ); - if( control ) - { - control->AddListener( this ); - control->SetDefaultButton( true ); - } - control = dynamic_cast ( FindPaneByID('CnBt') ); - if( control ) - control->AddListener( this ); -} - -/*====================================================================================== - Respond to broadcaster messages. -======================================================================================*/ - -void CAddressBookChildWindow::ListenToMessage(MessageT inMessage, void *ioParam) { - - switch ( inMessage ) { - case CSearchEditField::msg_UserChangedText: - if ( ioParam ) - { - switch( (*( (PaneIDT *) ioParam) ) ) - { - case CListPropertiesWindow::paneID_Name: - case CNamePropertiesWindow::paneID_FirstName: - case CNamePropertiesWindow::paneID_LastName: - UpdateTitle(); - break; - default: - break; - - } - } - break; - case msg_OK: - Try_{ - UpdateBackendToUI( - CAddressBookManager::GetPersonalBook(), CAddressBookManager::GetAddressBook() ); - DoClose(); - } Catch_ ( ioParam ) - { - ResIDT stringID = 0; - switch( ioParam ) - { - case XP_BKMKS_INVALID_NICKNAME: - stringID = 4; - break; - case MK_MSG_NEED_FULLNAME: - stringID = 3; - break; - case MK_ADDR_LIST_ALREADY_EXISTS: - stringID = 2; - break; - case MK_ADDR_ENTRY_ALREADY_EXISTS: - stringID = 1; - break; - default: - Throw_( ioParam ); - } - LStr255 errorString( kAddressbookErrorStrings, stringID ); - UStdDialogs::Alert( errorString, eAlertTypeCaution ); - } - break; - case msg_Cancel: - DoClose(); - break; - - default: - break; - } -} - -Boolean CAddressBookChildWindow::HandleKeyPress( - const EventRecord &inKeyEvent) -{ - Boolean keyHandled = false; - LControl *keyButton = nil; - - switch (inKeyEvent.message & charCodeMask) { - - case char_Enter: - case char_Return: - keyButton = dynamic_cast ( FindPaneByID('OkBt') ); - break; - - case char_Escape: - if ((inKeyEvent.message & keyCodeMask) == vkey_Escape) { - keyButton = dynamic_cast( FindPaneByID('CnBt') ); - } - break; - - default: - if (UKeyFilters::IsCmdPeriod(inKeyEvent)) { - keyButton = dynamic_cast( FindPaneByID('CnBt') ); - } else { - keyHandled = LWindow::HandleKeyPress(inKeyEvent); - } - break; - } - - if (keyButton != nil) { - keyButton->SimulateHotSpotClick(kControlButtonPart); - keyHandled = true; - } - - return keyHandled; -} - - -#pragma mark - - -/*====================================================================================== - Initialize the window. -======================================================================================*/ - -void CNamePropertiesWindow::FinishCreateSelf() { - - mFirstNameField = USearchHelper::FindViewEditField(this, paneID_FirstName); - mLastNameField = USearchHelper::FindViewEditField(this, paneID_LastName); - - Inherited::FinishCreateSelf(); // Call CMediatedWindow for now since we need to - // create a different context than CMailNewsWindow - CAddressBookChildWindow::FinishCreateSelf(); - // Call inherited method - FinishCreateWindow(); - - // Lastly, only link to broadcasters in our views - // need to listen to first/last name fields to update title - USearchHelper::LinkListenerToBroadcasters(USearchHelper::FindViewSubview(this, paneID_GeneralView), this); - - // Need Cooltalk since we listen to the popup - USearchHelper::LinkListenerToBroadcasters(USearchHelper::FindViewSubview(this, paneID_CooltalkView), this); -} - - -/*====================================================================================== - Respond to broadcaster messages. -======================================================================================*/ - -void CNamePropertiesWindow::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch ( inMessage ) - { - - case paneID_ConferencePopup: - SetConferenceText(); - break; - - default: - Inherited::ListenToMessage(inMessage, ioParam); - break; - } -} - - -/*====================================================================================== - Update the name properties to the current values in the dialog fields. -======================================================================================*/ - -void CNamePropertiesWindow::UpdateBackendToUI(DIR_Server *inDir, ABook *inABook) { - - LView *view; - StPersonEntry personEntry; - PersonEntry *entry = personEntry.GetEntry(); - - // General - view = USearchHelper::FindViewSubview(this, paneID_GeneralView); - - P2CStr(mFirstNameField->GetDescriptor((StringPtr) entry->pGivenName)); - P2CStr(mLastNameField->GetDescriptor((StringPtr) entry->pFamilyName)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_EMail)->GetDescriptor((StringPtr) entry->pEmailAddress)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_Nickname)->GetDescriptor((StringPtr) entry->pNickName)); - ((CSearchEditField *) USearchHelper::FindViewEditField(view, paneID_Notes))->GetText(entry->pInfo); - entry->HTMLmail = !(USearchHelper::FindViewControl(view, paneID_PrefersHTML)->GetValue() == 0); - P2CStr(USearchHelper::FindViewEditField(view, paneID_Company)->GetDescriptor((StringPtr) entry->pCompanyName)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_Title)->GetDescriptor((StringPtr) entry->pTitle)); - // Contact - view = USearchHelper::FindViewSubview(this, paneID_ContactView); - - - P2CStr(USearchHelper::FindViewEditField(view, paneID_Address)->GetDescriptor((StringPtr) entry->pAddress)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_City)->GetDescriptor((StringPtr) entry->pLocality)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_State)->GetDescriptor((StringPtr) entry->pRegion)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_ZIP)->GetDescriptor((StringPtr) entry->pZipCode)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_Country)->GetDescriptor((StringPtr) entry->pCountry)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_WorkPhone)->GetDescriptor((StringPtr) entry->pWorkPhone)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_FaxPhone)->GetDescriptor((StringPtr) entry->pFaxPhone)); - P2CStr(USearchHelper::FindViewEditField(view, paneID_HomePhone)->GetDescriptor((StringPtr) entry->pHomePhone)); - - // Conference - view = USearchHelper::FindViewSubview( this, paneID_CooltalkView ); - P2CStr(USearchHelper::FindViewEditField( view, paneID_ConferenceAddress)->GetDescriptor((StringPtr) entry->pCoolAddress) ); - entry->UseServer =short( (USearchHelper::FindSearchPopup( view, paneID_ConferenceServer )->GetValue())-1);// entries are 0 based - // need to do CSID - MWContext* context= CAddressBookWindow::GetMailContext(); - INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(context); - entry->WinCSID = INTL_GetCSIWinCSID(c); - if ( mEntryID != CAddressBookPane::eNewEntryID ) // Existing entry - { - // Update BE - CAddressBookManager::FailAddressError( AB_ModifyUser(inDir, inABook, mEntryID, entry) ); - } - else // new entry - { - ABID entryID; - CAddressBookManager::FailAddressError( AB_AddUser( inDir, CAddressBookManager::GetAddressBook(), entry, &entryID) ); - } -} -// Update Caption text in Conference -void CNamePropertiesWindow::SetConferenceText( ) -{ - short serverType = USearchHelper::FindSearchPopup( this, paneID_ConferenceServer )->GetValue(); - LStr255 exampleString(kConferenceExampleStr, serverType ); - LCaption* text = dynamic_cast(this->FindPaneByID('CoES')); - Assert_(text); - if( text ) - text->SetDescriptor( exampleString); - LView *view = (LView*)USearchHelper::FindViewEditField( this, paneID_ConferenceAddress); - if( view ) - { - if( serverType == 1 ) - { - view->SetDescriptor("\p"); - view->Disable(); - } - else - view->Enable(); - } - -} - -/*====================================================================================== - Update the dialog fields to the current values of the name properties. -======================================================================================*/ - -void CNamePropertiesWindow::UpdateUIToBackend(DIR_Server *inDir, ABook *inABook, - ABID inEntryID) { - - if ( mEntryID == inEntryID ) return; - - - // Turn off listening - - StValueChanger change(mIsListening, false); - - LView *view = USearchHelper::FindViewSubview(this, paneID_GeneralView); - - char value[1024]; - - // General - - value[0] = 0; AB_GetGivenName(inDir, inABook, inEntryID, value); - mFirstNameField->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetFamilyName(inDir, inABook, inEntryID, value); - mLastNameField->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetEmailAddress(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_EMail)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetNickname(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_Nickname)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetInfo(inDir, inABook, inEntryID, value); - ((CSearchEditField *) USearchHelper::FindViewEditField(view, paneID_Notes))->SetText(value); - - XP_Bool prefersHTML; AB_GetHTMLMail(inDir, inABook, inEntryID, &prefersHTML); - USearchHelper::FindViewControl(view, paneID_PrefersHTML)->SetValue(prefersHTML ? 1 : 0); - - value[0] = 0; AB_GetCompanyName(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_Company)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetTitle(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_Title)->SetDescriptor(C2PStr(value)); - - // Contact - view = USearchHelper::FindViewSubview(this, paneID_ContactView); - - - value[0] = 0; AB_GetStreetAddress(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_Address)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetLocality(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_City)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetRegion(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_State)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetZipCode(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_ZIP)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetCountry(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_Country)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetWorkPhone(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_WorkPhone)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetFaxPhone(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_FaxPhone)->SetDescriptor(C2PStr(value)); - - value[0] = 0; AB_GetHomePhone(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_HomePhone)->SetDescriptor(C2PStr(value)); - - // Conference - view = USearchHelper::FindViewSubview(this, paneID_CooltalkView); - value[0] = 0; AB_GetCoolAddress(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(view, paneID_ConferenceAddress)->SetDescriptor(C2PStr(value)); - - short serverType; - AB_GetUseServer( inDir,inABook, inEntryID, &serverType); - serverType++; // Popups and resources are 1 based - USearchHelper::FindSearchPopup( view, paneID_ConferenceServer )->SetValue( serverType ); - - SetConferenceText( ); - // - - mEntryID = inEntryID; - UpdateTitle(); -} - -void CNamePropertiesWindow::UpdateUIToPerson( PersonEntry* person, ABID inEntryID ) -{ - - LView *view = USearchHelper::FindViewSubview(this, paneID_GeneralView); - - // General - - mFirstNameField->SetDescriptor( CStr255( person->pGivenName )); - - mLastNameField->SetDescriptor( CStr255( person->pFamilyName )); - - USearchHelper::FindViewEditField(view, paneID_EMail)->SetDescriptor(CStr255( person->pEmailAddress )); - - mEntryID = inEntryID; -#if 0 // Currently this is only called from new card which leaves the rest of these fields nil pointers - USearchHelper::FindViewEditField(view, paneID_Nickname)->SetDescriptor(CStr255( person->pNickName )); - if( person->pInfo ) - ((CSearchEditField *) USearchHelper::FindViewEditField(view, paneID_Notes))->SetText( person->pInfo ); - - USearchHelper::FindViewControl(view, paneID_PrefersHTML)->SetValue( person->HTMLmail ? 1 : 0); - - // Contact - view = USearchHelper::FindViewSubview(this, paneID_ContactView); - - USearchHelper::FindViewEditField(view, paneID_Company)->SetDescriptor(CStr255( person->pCompanyName )); - - USearchHelper::FindViewEditField(view, paneID_Title)->SetDescriptor(CStr255( person->pTitle )); - - USearchHelper::FindViewEditField(view, paneID_Address)->SetDescriptor(CStr255( person->pAddress )); - - USearchHelper::FindViewEditField(view, paneID_City)->SetDescriptor(CStr255( person->pLocality )); - - USearchHelper::FindViewEditField(view, paneID_State)->SetDescriptor(CStr255( person->pRegion)); - - USearchHelper::FindViewEditField(view, paneID_ZIP)->SetDescriptor(CStr255( person->pZipCode )); - - USearchHelper::FindViewEditField(view, paneID_WorkPhone)->SetDescriptor(CStr255( person->pWorkPhone)); - - USearchHelper::FindViewEditField(view, paneID_FaxPhone)->SetDescriptor(CStr255( person->pFaxPhone )); - - USearchHelper::FindViewEditField(view, paneID_HomePhone)->SetDescriptor(CStr255( person->pHomePhone)); -#endif - // Conference - view = USearchHelper::FindViewSubview(this, paneID_CooltalkView); - USearchHelper::FindViewEditField(view, paneID_ConferenceAddress)->SetDescriptor(CStr255( person->pCoolAddress )); - - USearchHelper::FindSearchPopup( view, paneID_ConferenceServer )->SetValue( person->UseServer+1 ); - - SetConferenceText( ); - - UpdateTitle(); - -} - -/*====================================================================================== - Update the window title. -======================================================================================*/ - -void CNamePropertiesWindow::UpdateTitle() { - - CStr255 title; - { - CStr255 first, last; - mFirstNameField->GetDescriptor(first); - mLastNameField->GetDescriptor(last); - if ( last[0] ) first += " "; - first += last; - - ::GetIndString( title, 8903, 1); - ::StringParamText( title, first); - } - SetDescriptor( title ); -} - - -#pragma mark - - -/*====================================================================================== - Construct the list window. -======================================================================================*/ - -CListPropertiesWindow::CListPropertiesWindow(LStream *inStream) : - CAddressBookChildWindow(inStream, WindowType_AddressList), - mAddressBookListTable(nil), - mTitleField(nil) { - - SetPaneID(pane_ID); - -} - - -/*====================================================================================== - Dispose of the list window. -======================================================================================*/ - -CListPropertiesWindow::~CListPropertiesWindow() { -// Boolean canRotate = false; -// if ( IsVisible() ) { -// USearchHelper::FindWindowTabGroup(&mSubCommanders)->SetRotateWatchValue(&canRotate); -// } -// delete mAddressBookListTable; - mAddressBookListTable = nil; -} - -/*====================================================================================== - Load and display the specified address book list. -======================================================================================*/ - -void CListPropertiesWindow::UpdateUIToBackend(DIR_Server *inDir, ABook *inABook, ABID inEntryID) { - - AssertFail_(mAddressBookListTable != nil); - - // Update any currently pending data - - // Turn off listening - - StValueChanger change(mIsListening, false); - if( inEntryID != CAddressBookPane::eNewEntryID ) - mEntryID = inEntryID; // Needs to be set here - else - mEntryID = 0; - mAddressBookListTable->LoadAddressBookList( mEntryID ); - - if ( inEntryID != CAddressBookPane::eNewEntryID ) - { - char value[1024]; - - // Set edit fields - value[0] = 0; AB_GetFullName(inDir, inABook, inEntryID, value); - mTitleField->SetDescriptor(CStr255(value)); - - value[0] = 0; AB_GetNickname(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(this, paneID_Nickname)->SetDescriptor(CStr255(value)); - - value[0] = 0; AB_GetInfo(inDir, inABook, inEntryID, value); - USearchHelper::FindViewEditField(this, paneID_Description)->SetDescriptor(CStr255(value)); - - } - else - { - - CStr255 defaultName; - USearchHelper::AssignUString(uStr_ListDefaultName, defaultName); - mTitleField->SetDescriptor(defaultName); - } - - UpdateTitle(); -} - -/*====================================================================================== - Update the list properties to the current values in the dialog fields. -======================================================================================*/ - -void CListPropertiesWindow::UpdateBackendToUI(DIR_Server *inDir, ABook *inABook) { - -#pragma unused (inDir) -#pragma unused (inABook) - StMailingListEntry listEntry; - MailingListEntry *entry = listEntry.GetEntry(); - P2CStr(mTitleField->GetDescriptor((StringPtr) entry->pFullName)); - P2CStr(USearchHelper::FindViewEditField(this, paneID_Nickname)->GetDescriptor((StringPtr) entry->pNickName)); - P2CStr(USearchHelper::FindViewEditField(this, paneID_Description)->GetDescriptor((StringPtr) entry->pInfo)); - // Need to copy in the win CSID - MWContext* context= CAddressBookWindow::GetMailContext(); - INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(context); - entry->WinCSID = INTL_GetCSIWinCSID(c); - - MSG_ViewIndex index = 0; - CAddressBookManager::FailAddressError( AB_ModifyMailingListAndEntriesWithChecks( - (MLPane *)mAddressBookListTable->GetMessagePane(), entry, &index, 0 ) ); -} - - -/*====================================================================================== - Initialize the window. -======================================================================================*/ - -void CListPropertiesWindow::FinishCreateSelf() { - - mAddressBookListTable = - dynamic_cast(USearchHelper::FindViewSubview(this, paneID_AddressBookListTable)); - FailNILRes_(mAddressBookListTable); - mTitleField = USearchHelper::FindViewEditField(this, paneID_Name); - - Inherited::FinishCreateSelf(); // Call CMediatedWindow for now since we need to - // create a different context than CMailNewsWindow - CAddressBookChildWindow::FinishCreateSelf(); // Link OK Cancel Button - // Call inherited method - FinishCreateWindow(); - - // Lastly, link to our broadcasters, need to link to allow title update - USearchHelper::LinkListenerToBroadcasters(this, this); - -} - - - -/*====================================================================================== - Draw the window. -======================================================================================*/ - -void CListPropertiesWindow::DrawSelf() { - Rect frame; - - if ( mAddressBookListTable->CalcPortFrameRect(frame) && ::RectInRgn(&frame, mUpdateRgnH) ) { - - { - StExcludeVisibleRgn excludeRgn(mAddressBookListTable); - Inherited::DrawSelf(); - } - - StColorPenState::Normalize(); - ::EraseRect(&frame); - } else { - Inherited::DrawSelf(); - } - - USearchHelper::RemoveSizeBoxFromVisRgn(this); -} - - -/*====================================================================================== - Update the window title. -======================================================================================*/ - -void CListPropertiesWindow::UpdateTitle() { - - CStr255 title; - { - CStr255 name; - mTitleField->GetDescriptor(name); - ::GetIndString( title, 8903, 2); - ::StringParamText( title, name); - } - SetDescriptor( title ); -} - -//----------------------------------- -Boolean CListPropertiesWindow::ObeyCommand(CommandT inCommand, void *ioParam) -//----------------------------------- -{ - Boolean rtnVal = true; - - switch ( inCommand ) { - - case cmd_NewMailMessage: - mAddressBookListTable->ComposeMessage(); - break; - default: - rtnVal = Inherited::ObeyCommand(inCommand, ioParam); - break; - } - - return rtnVal; -} - -#pragma mark - - -/*====================================================================================== - Allocate and initialize the person entry data record. -======================================================================================*/ - -StPersonEntry::StPersonEntry() : - mPerson(nil) { - - UInt32 allocSize = sizeof(PersonEntry) + (kMaxNameLength + kMaxNameLength + kMaxNameLength + kMaxNameLength + - kMaxCompanyLength + kMaxLocalityLength + kMaxRegionLength + kMaxEmailAddressLength + - kMaxInfo + kMaxTitle + kMaxAddress + kMaxZipCode + kMaxPhone + kMaxPhone + kMaxPhone + - 1 + kMaxCoolAddress+ kMaxCountryLength); - - mPerson = (PersonEntry *) XP_CALLOC(1, allocSize); - FailNIL_(mPerson); - - char *currentString = ((char *) mPerson) + sizeof(PersonEntry); - - mPerson->pNickName = currentString; currentString += kMaxNameLength; - mPerson->pGivenName = currentString; currentString += kMaxNameLength; - mPerson->pMiddleName = currentString; currentString += kMaxNameLength; - mPerson->pFamilyName = currentString; currentString += kMaxNameLength; - mPerson->pCompanyName = currentString; currentString += kMaxCompanyLength; - mPerson->pLocality = currentString; currentString += kMaxLocalityLength; - mPerson->pRegion = currentString; currentString += kMaxRegionLength; - mPerson->pEmailAddress = currentString; currentString += kMaxEmailAddressLength; - mPerson->pInfo = currentString; currentString += kMaxInfo; - mPerson->pTitle = currentString; currentString += kMaxTitle; - mPerson->pAddress = currentString; currentString += kMaxAddress; - mPerson->pZipCode = currentString; currentString += kMaxZipCode; - mPerson->pCountry = currentString; currentString+= kMaxCountryLength; - mPerson->pWorkPhone = currentString; currentString += kMaxPhone; - mPerson->pFaxPhone = currentString; currentString += kMaxPhone; - mPerson->pHomePhone = currentString; currentString += kMaxPhone; - mPerson->pDistName = currentString; currentString += 1; //??? - mPerson->pCoolAddress = currentString; currentString += kMaxCoolAddress; - - AssertFail_(currentString == (((char *) mPerson) + allocSize)); - - mPerson->Security = 0; - mPerson->UseServer = 1; - mPerson->HTMLmail = 1; - mPerson->WinCSID = 0; - -} - - -#pragma mark - - -/*====================================================================================== - Allocate and initialize the person entry data record. -======================================================================================*/ - -StMailingListEntry::StMailingListEntry() : - mMailingList(nil) { - - UInt32 allocSize = sizeof(MailingListEntry) + (kMaxFullNameLength + kMaxNameLength + kMaxInfo + 1); - - mMailingList = (MailingListEntry *) XP_CALLOC(1, allocSize); - FailNIL_(mMailingList); - - char *currentString = ((char *) mMailingList) + sizeof(MailingListEntry); - - mMailingList->pFullName = currentString; currentString += kMaxFullNameLength; - mMailingList->pNickName = currentString; currentString += kMaxNameLength; - mMailingList->pInfo = currentString; currentString += kMaxInfo; - mMailingList->pDistName = currentString; currentString += 1; - - AssertFail_(currentString == (((char *) mMailingList) + allocSize)); - mMailingList->WinCSID = 0; - -} - -// CAddressBookController -void CAddressBookController::FinishCreateSelf() -{ - mAddressBookTable = dynamic_cast( FindPaneByID( paneID_AddressBookTable )); - mAddressBookTable->AddListener( this ); - FailNILRes_(mAddressBookTable); - - mDividedView = dynamic_cast(FindPaneByID( paneID_DividedView )); - FailNILRes_(mDividedView); - - LWindow* window = dynamic_cast( LWindow::FetchWindowObject(GetMacPort()) ); - mProgressCaption = dynamic_cast(window->FindPaneByID(kMailNewsStatusPaneID)); - FailNILRes_(mProgressCaption); - - mSearchButton = dynamic_cast(FindPaneByID( paneID_Search)); - FailNILRes_(mSearchButton); - - mStopButton = dynamic_cast(FindPaneByID( paneID_Stop)); - FailNILRes_(mStopButton); - - mTypedownName = dynamic_cast(FindPaneByID( paneID_TypedownName) ); - FailNILRes_(mTypedownName); - mTypedownName->AddListener(this); - SwitchTarget( mTypedownName ); - UReanimator::LinkListenerToControls(this, this, 8920); - PopulateDirectoryServers(); - - // Frame Highlighting - CTargetFramer* framer = new CTargetFramer(); - mAddressBookTable->AddAttachment(framer); - framer = new CTargetFramer(); - mTypedownName->AddAttachment(framer); -} - -void CAddressBookController::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch ( inMessage ) - { - case CSearchEditField::msg_UserChangedText: - // User changed the typedeown text - if ( mNextTypedownCheckTime == eDontCheckTypedown ) { - mNextTypedownCheckTime = LMGetTicks() + eCheckTypedownInterval; - } - break; - case CAddressBookTableView::cmd_NewAddressCard: - case CAddressBookTableView::cmd_NewAddressList: - case CAddressBookTableView::cmd_EditProperties: - case CAddressBookTableView::cmd_DeleteEntry: - case CAddressBookTableView::cmd_ComposeMailMessage: - case cmd_SearchAddresses: - mAddressBookTable->ButtonMessageToCommand(inMessage); - break; - - case paneID_DirServers: - SelectDirectoryServer(nil, GetServerIndexFromPopup()); - break; - - case CAddressBookTableView::cmd_ConferenceCall: - mAddressBookTable->ConferenceCall(); - break; - - // Status messages - case msg_NSCAllConnectionsComplete: - MessageWindStop(false); // line order.. - mProgressCaption->SetSeamless(); // ...does matter - Refresh(); // ? - break; - - case msg_NSCProgressEnd: - break; - - case msg_NSCProgressMessageChanged: - if ( ioParam != nil ) { - mProgressCaption->SetDescriptor(TString((const char*)ioParam)); - } else { - mProgressCaption->SetDescriptor("\p"); - } - break; - - case msg_NSCProgressPercentChanged: - mProgressCaption->SetValue(*(Int32*)ioParam); - break; - - case paneID_Search: - MessageWindSearch(); - break; - - case paneID_Stop: - MessageWindStop(true); - break; - - case MSG_PaneDirectoriesChanged: - UpdateToDirectoryServers(); - break; - - default: - // No superclass method - break; - } - -} - -Boolean CAddressBookController::ObeyCommand(CommandT inCommand, void *ioParam) -{ - Boolean cmdHandled = true; - switch ( inCommand ) - { - case paneID_Search: - MessageWindSearch(); - break; - - case paneID_Stop: - MessageWindStop(true); - break; - default: - cmdHandled = LCommander::ObeyCommand(inCommand, ioParam); - break; - } - return cmdHandled; -} - -void CAddressBookController::ReadStatus(LStream *inStatusData) -{ - mDividedView->RestorePlace(inStatusData); - mAddressBookTable->GetTableHeader()->ReadColumnState(inStatusData); -} - -void CAddressBookController::WriteStatus(LStream *outStatusData) -{ - - mDividedView->SavePlace(outStatusData); - mAddressBookTable->GetTableHeader()->WriteColumnState(outStatusData); -} - - -//----------------------------------- -void CAddressBookController::SpendTime(const EventRecord &inMacEvent) -// Check to see if the user has typed in text that needs to be searched. -//----------------------------------- -{ - if ( CAddressBookTableView::CurrentBookIsPersonalBook() ) { - if ( inMacEvent.when >= mNextTypedownCheckTime ) { - Assert_(mTypedownName); - Assert_(mAddressBookTable); - - Str255 typedownText; - mTypedownName->GetDescriptor(typedownText); - - mAddressBookTable->UpdateToTypedownText(typedownText); - mNextTypedownCheckTime = eDontCheckTypedown; - } - } else if ( !IsLDAPSearching() ) { - USearchHelper::EnableDisablePane(mSearchButton, !IsLDAPSearching()/*mTypedownName->GetTextLength() > 0*/, true); - } -} - - - -//----------------------------------- -void CAddressBookController::PopulateDirectoryServers() -// Populate the directory server popup menu with the current servers. -//----------------------------------- -{ - - CSearchPopupMenu *popup = USearchHelper::FindSearchPopup(this, paneID_DirServers); - popup->ClearMenu(); // Remove any current items - - XP_List *serverList = CAddressBookManager::GetDirServerList(); - if ( !serverList ) return; - for (Int32 i = 1; i <= XP_ListCount(serverList); i++) { - DIR_Server *server = (DIR_Server *) XP_ListGetObjectNum(serverList, i); - if ( (server->dirType == LDAPDirectory) || (server->dirType == PABDirectory) ) { - CStr255 string(server->description); - if ( string.Length() == 0 ) string += "????"; // Bug in string generation! - popup->AppendMenuItemCommand(i, string, true); - } - } - popup->SetValue(1); -} // CAddressBookWindow::PopulateDirectoryServers - -//----------------------------------- -void CAddressBookController::SelectDirectoryServer(DIR_Server *inServer, Int32 inServerIndex) -// Select the specified directory server into the address book table view. If inServer -// is not nil, select that server,; otherwise use the 1-based index given by -// inServerIndex to select the directory server at that index in the list returned -// by CAddressBookManager::GetDirServerList(). If the specified server cannot be -// found or is not a valid server that can be displayed, do nothing. -//----------------------------------- -{ - mProgressCaption->SetDescriptor("\p"); - AssertFail_(mAddressBookTable != nil); - SetCursor(*GetCursor(watchCursor)); - XP_List *serverList = CAddressBookManager::GetDirServerList(); - if ( !serverList ) return; - - if ( inServer == nil ) - inServer = (DIR_Server *) XP_ListGetObjectNum(serverList, inServerIndex); - else - { - DIR_Server *foundServer = nil; - for (Int32 i = 1; i <= (XP_ListCount(serverList) + 1); i++) - { - foundServer = (DIR_Server *) XP_ListGetObjectNum(serverList, i); - if ( foundServer == inServer ) break; - } - inServer = foundServer; - } - // Validate server - if ( (inServer == nil) || - !((inServer->dirType == LDAPDirectory) || (inServer->dirType == PABDirectory)) ) - return; // Can't find it - // Load server into address book table - - if ( !mAddressBookTable->LoadAddressBook(inServer) ) return; - - const Boolean isLDAPServer = (inServer->dirType == LDAPDirectory); - USearchHelper::ShowHidePane(mSearchButton, isLDAPServer); - USearchHelper::EnableDisablePane(mSearchButton, mTypedownName->GetTextLength() > 0, true); - USearchHelper::ShowHidePane(mStopButton, false); - USearchHelper::SelectEditField(mTypedownName); - mAddressBookTable->SetColumnHeaders(inServer); - - UpdatePort(); -} // CAddressBookWindow::SelectDirectoryServer - - - -//----------------------------------- -void CAddressBookController::MessageWindSearch( char* text) -// React to search message. -//----------------------------------- -{ - - if ( CAddressBookTableView::CurrentBookIsPersonalBook() || - IsLDAPSearching() ) return; - - - - - MessageT message = paneID_Search; - if( text == NULL ) - { - StDialogHandler handler(8980, nil); - // Select the "URL" edit field - CLDAPQueryDialog* dialog = dynamic_cast< CLDAPQueryDialog*>( handler.GetDialog() ); - Assert_( dialog ); - - dialog->Setup( mAddressBookTable->GetMessagePane(), mAddressBookTable->GetCurrentBook() ); - - - Boolean doSearch = false; - // Run the dialog - - - do { - message = handler.DoDialog(); - } while (message != paneID_Search && message != msg_Cancel); - } - if ( message == paneID_Search ) - { - CAddressBookManager::FailAddressError(AB_SearchDirectory((ABPane *) mAddressBookTable->GetMessagePane(), - text ) ); - - //USearchHelper::FindViewSubpane(this, paneID_SearchEnclosure)->Disable(); - USearchHelper::ShowHidePane(mSearchButton, false); - USearchHelper::ShowHidePane(mStopButton, true); - // UpdatePort(); - - } -} - -/*====================================================================================== - Update the window to the current directory servers. -======================================================================================*/ - -void CAddressBookController::UpdateToDirectoryServers() { - - CAddressBookWindow *addressWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Address)); - - if ( addressWindow == nil ) return; - - PopulateDirectoryServers(); -} - -//----------------------------------- -Int32 CAddressBookController::GetServerIndexFromPopup() -//----------------------------------- -{ - CSearchPopupMenu *popup = USearchHelper::FindSearchPopup(this, paneID_DirServers); - if ( !popup ) return -1; - return popup->GetCurrentItemCommandNum(); -} - -//----------------------------------- -void CAddressBookController::SetPopupFromServerIndex(Int32 inServerIndex) -//----------------------------------- -{ - CSearchPopupMenu *popup = USearchHelper::FindSearchPopup(this, paneID_DirServers); - if ( !popup ) return; - popup->SetCurrentItemByCommand(inServerIndex); -} - -//----------------------------------- -void CAddressBookController::MessageWindStop(Boolean inUserAborted) -// React to stop message. -//----------------------------------- -{ - -#pragma unused (inUserAborted) - if ( CAddressBookTableView::CurrentBookIsPersonalBook() || - !IsLDAPSearching() ) return; - - AB_FinishSearch((ABPane *) mAddressBookTable->GetMessagePane(), CAddressBookWindow::GetMailContext()); - - //USearchHelper::FindViewSubpane(this, paneID_SearchEnclosure)->Enable(); - USearchHelper::ShowHidePane(mStopButton, false); - USearchHelper::ShowHidePane(mSearchButton, true); - USearchHelper::SelectEditField(mTypedownName); - UpdatePort(); -} - -//----------------------------------- -Boolean CAddressBookController::HandleKeyPress(const EventRecord &inKeyEvent) -//----------------------------------- -{ - Int16 theKey = inKeyEvent.message & charCodeMask; - - if (((theKey == char_Enter) || (theKey == char_Return)) && !IsLDAPSearching()) - { - CStr255 typedownText; - mTypedownName->GetDescriptor(typedownText); - if (typedownText.Length() > 0 ) - MessageWindSearch( typedownText ); - } - else if ( (((theKey == char_Escape) && ((inKeyEvent.message & keyCodeMask) == vkey_Escape)) || - UKeyFilters::IsCmdPeriod(inKeyEvent)) && IsLDAPSearching() ) - { - mStopButton->SimulateHotSpotClick(kControlButtonPart); - return true; - } - return false; -} - - -#if 1 -void CAddressBookManager::DoPickerDialog( CComposeAddressTableView* initialTable ) -{ - StDialogHandler handler ( 8990, nil ); - CAddressPickerWindow* dialog = dynamic_cast< CAddressPickerWindow* >( handler.GetDialog() ); - dialog->Setup( initialTable ); - dialog->Show(); - MessageT message; - do { - message = handler.DoDialog(); - } while ( message != CAddressPickerWindow::eOkayButton && - message != CAddressPickerWindow::eCancelButton ) ; -} - -// Mail News address picker -#pragma mark - - -void CAddressPickerWindow::FinishCreateSelf() -{ - mPickerAddresses = dynamic_cast< CComposeAddressTableView* >( FindPaneByID( 'Addr' ) ); - FailNILRes_( mPickerAddresses ); - - mAddressBookTable = dynamic_cast( FindPaneByID( paneID_AddressBookTable )); - FailNILRes_(mAddressBookTable); - mAddressBookTable->AddListener( this ); - UReanimator::LinkListenerToControls(this, this,CAddressPickerWindow:: res_ID); - // Adjust button state - ListenToMessage ( CStandardFlexTable::msg_SelectionChanged, nil ); - - CAddressBookWindow::FinishCreateSelf(); - -} - -void CAddressPickerWindow::Setup( CComposeAddressTableView* initialTable ) -{ - // Copy the old table to the new one - Assert_( initialTable ); - Assert_( mPickerAddresses ); - - TableIndexT numRows; - mInitialTable = initialTable; - initialTable->GetNumRows(numRows); - STableCell cell; - Uint32 size; - char* address = NULL; - for ( int32 i = 1; i <= numRows; i++ ) - { - EAddressType type = initialTable->GetRowAddressType( i ); - cell.row = i; - cell.col = 2; - size = sizeof(address); - initialTable->GetCellData(cell, &address, size); - mPickerAddresses->InsertNewRow( type, address, false ); - } -} - -void CAddressPickerWindow::ListenToMessage(MessageT inMessage, void *ioParam) -{ -#pragma unused (ioParam) - switch( inMessage ) - { - case eOkayButton: - CComposeAddressTableStorage* oldTableStorage =dynamic_cast< CComposeAddressTableStorage*> (mInitialTable->GetTableStorage() ); - mPickerAddresses->EndEditCell(); - mInitialTable->SetTableStorage( mPickerAddresses->GetTableStorage() ); - mPickerAddresses->SetTableStorage( oldTableStorage ); - break; - - case eHelp: - ShowHelp( HELP_SELECT_ADDRESSES ); - break; - - case eToButton: - AddSelection ( eToType ); - break; - - case eCcButton: - AddSelection ( eCcType ); - break; - - case eBccButton: - AddSelection( eBccType ); - break; - - case ePropertiesButton: - break; - case CStandardFlexTable::msg_SelectionChanged: - Boolean enable = mAddressBookTable->GetSelectedRowCount() >0; - - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,eToButton ), enable, true ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,eCcButton ), enable, true ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,eBccButton ), enable, true ); - USearchHelper::EnableDisablePane( USearchHelper::FindViewControl( this ,ePropertiesButton ), enable, true ); - break; - - default: - break; - } - - -} - -void CAddressPickerWindow::AddSelection( EAddressType inAddressType ) -{ - - char* address = NULL; - //Uint32 size= sizeof(address); - TableIndexT row = 0; - - while ( mAddressBookTable->GetNextSelectedRow( row ) ) - { - mAddressBookTable->GetFullAddress( row, &address ); - mPickerAddresses->InsertNewRow( inAddressType, address, false ); - } -} - -#endif -#endif // MOZ_NEWADDR diff --git a/mozilla/cmd/macfe/MailNews/MailNewsAddressBook.h b/mozilla/cmd/macfe/MailNews/MailNewsAddressBook.h deleted file mode 100644 index 285b2dad5ac..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsAddressBook.h +++ /dev/null @@ -1,110 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsAddressBook.h - -#pragma once - -//#define MOZ_NEWADDR -#ifdef MOZ_NEWADDR - #include "CAddressBookWindows.h" -#else -class CComposeAddressTableView; - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - -typedef struct ABook ABook; -typedef struct DIR_Server DIR_Server; -typedef struct _XP_List XP_List; -typedef UInt32 ABID; -class CNamePropertiesWindow; -class CListPropertiesWindow; -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class CAddressBookWindow; - -struct SAddressDragInfo -{ - ABID id; - DIR_Server* dir; -}; - -class CAddressBookManager -{ -public: - - // Should be called when the application starts up - static void OpenAddressBookManager(void); - // Should be called when the application closes - static void CloseAddressBookManager(void); - - static void ImportLDIF(const FSSpec& inSpec); - - static CAddressBookWindow* ShowAddressBookWindow(void); - - static XP_List *GetDirServerList(void); - static void SetDirServerList(XP_List *inList, Boolean inSavePrefs = true); - static DIR_Server *GetPersonalBook(void); - static ABook *GetAddressBook(void); - - static void FailAddressError(Int32 inError); - static CNamePropertiesWindow *FindNamePropertiesWindow(ABID inEntryID); - static CNamePropertiesWindow *GetNamePropertiesWindow(ABID inEntryID, Boolean inOptionKeyDown); - static CListPropertiesWindow *FindListPropertiesWindow(ABID inEntryID); - static CListPropertiesWindow *GetListPropertiesWindow(ABID inEntryID, Boolean inOptionKeyDown); - static void DoPickerDialog( CComposeAddressTableView* initialTable ); - -private: - - static void RegisterAddressBookClasses(void); - static int DirServerListChanged(const char*, void*) - { - sDirServerListChanged = true; - return 0; - } - - // Instance variables - - static XP_List *sDirServerList; - static Boolean sDirServerListChanged; - static ABook *sAddressBook; // Really, the global address book database - // used in conjunction with all address books - // (local and remote) associated with the - // application. This object is opened at application - // startup and not closed until the application closes. -}; -#endif // MOZ_NEWADDR diff --git a/mozilla/cmd/macfe/MailNews/MailNewsCallbacks.cp b/mozilla/cmd/macfe/MailNews/MailNewsCallbacks.cp deleted file mode 100644 index 37671fa2c5d..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsCallbacks.cp +++ /dev/null @@ -1,333 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsCallbacks.cp - -#include "MailNewsCallbacks.h" - -// XP headers -#include "fe_proto.h" -//#include "errcode.h" -//#include "msglpane.h" -#include "addrbook.h" - - -// FE -#include "CCheckMailContext.h" -#include "uprefd.h" -#include "macutil.h" - -#include "CMailFlexTable.h" -#include "CMessageWindow.h" -#include "CThreadWindow.h" - -#include "UMailFolderMenus.h" -#include "CMessageFolder.h" -#include "ufilemgr.h" - -//====================================== -// class CMailCallbackManager -//====================================== - -CMailCallbackManager* CMailCallbackManager::sMailCallbackManager = nil; - -//----------------------------------- -CMailCallbackManager::CMailCallbackManager() -//----------------------------------- -{ - sMailCallbackManager = this; -} - -//----------------------------------- -CMailCallbackManager::~CMailCallbackManager() -//----------------------------------- -{ - sMailCallbackManager = nil; -} - -//----------------------------------- -CMailCallbackManager* CMailCallbackManager::Get() -//----------------------------------- -{ - if (!sMailCallbackManager) - new CMailCallbackManager; - return sMailCallbackManager; -} - -//----------------------------------- -Boolean CMailCallbackManager::ValidData(MSG_Pane *inPane) -//----------------------------------- -{ - void* data = MSG_GetFEData(inPane); - //? We WERE getting callbacks before MSG_SetFEData was called. Assert_(data == this); - return (data == this); -} - -//----------------------------------- -void CMailCallbackManager::PaneChanged( - MSG_Pane *inPane, - XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -//----------------------------------- -{ - if (inNotifyCode == MSG_PaneNotifyFolderDeleted) - { - // A folder can be deleted even with no active pane (eg, in IMAP synchronization). - // In this case, we get a call with inPane == NULL. - CMailFolderMixin::UpdateMailFolderMixins(); - } - if (ValidData(inPane)) - { - // the backend can give us a MSG_VIEWINDEXNONE (-1) in value, which we need to change to a 0 - if (value == MSG_VIEWINDEXNONE) - value = 0; - - // Because of the caching scheme for folders, we must update the caches first: - if (inNotifyCode == MSG_PaneNotifyFolderInfoChanged) - { - CCachedFolderLine::FolderInfoChanged(inPane, (MSG_FolderInfo*)value); - } - SPaneChangeInfo info(inPane, asynchronous, inNotifyCode, value); - BroadcastMessage(msg_PaneChanged, &info); - } -} // CMailCallbackManager::PaneChanged - -//----------------------------------- -void CMailCallbackManager::ChangeStarting( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inNotifyCode, - MSG_ViewIndex inWhere, - int32 inCount) -//----------------------------------- -{ - if (ValidData(inPane)) - { - SLineChangeInfo info(inPane, inAsync, inNotifyCode, inWhere + 1, inCount); - BroadcastMessage(msg_ChangeStarting, &info); - } -} // CMailCallbackManager::ChangeStarting - -//----------------------------------- -void CMailCallbackManager::ChangeFinished( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inNotifyCode, - MSG_ViewIndex inWhere, - int32 inCount) -//----------------------------------- -{ - if (ValidData(inPane)) - { - SLineChangeInfo info(inPane, inAsync, inNotifyCode, inWhere + 1, inCount); - BroadcastMessage(msg_ChangeFinished, &info); - } -} // CMailCallbackManager::ChangeFinished - -//====================================== -// class CMailCallbackListener -//====================================== - -//----------------------------------- -CMailCallbackListener::CMailCallbackListener() -//----------------------------------- -: LListener() -, mPane(nil) -{ - CMailCallbackManager::Get()->AddUser(this); - CMailCallbackManager::Get()->AddListener(this); -} - -//----------------------------------- -CMailCallbackListener::~CMailCallbackListener() -//----------------------------------- -{ - mPane = nil; // stop derived classes from listening to callbacks. - CMailCallbackManager::Get()->RemoveListener(this); - CMailCallbackManager::Get()->RemoveUser(this); -} - -//----------------------------------- -void CMailCallbackListener::ListenToMessage(MessageT inMessage, void* ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case CMailCallbackManager::msg_PaneChanged: - if ( IsMyPane(ioParam) ) { - SPaneChangeInfo* info = reinterpret_cast(ioParam); - PaneChanged(info->pane, info->notifyCode, info->value); - } - break; - - case CMailCallbackManager::msg_ChangeStarting: - if ( IsMyPane(ioParam) ) { - SLineChangeInfo* info = reinterpret_cast(ioParam); - ChangeStarting(info->pane, info->changeCode, info->startRow, info->rowCount); - } - break; - - case CMailCallbackManager::msg_ChangeFinished: - if ( IsMyPane(ioParam) ) { - SLineChangeInfo* info = reinterpret_cast(ioParam); - ChangeFinished(info->pane, info->changeCode, info->startRow, info->rowCount); - } - break; - } -} // CMailCallbackListener::ListenToMessage - -//----------------------------------- -Boolean CMailCallbackListener::IsMyPane(void* info) const -//----------------------------------- -{ - return (mPane == reinterpret_cast(info)->pane); -} - -//----------------------------------- -void CMailCallbackListener::ChangeStarting( - MSG_Pane* /*inPane*/, - MSG_NOTIFY_CODE /*inChangeCode*/, - TableIndexT /*inStartRow*/, - SInt32 /*inRowCount*/) -//----------------------------------- -{ -} - -//----------------------------------- -void CMailCallbackListener::ChangeFinished( - MSG_Pane* /*inPane*/, - MSG_NOTIFY_CODE /*inChangeCode*/, - TableIndexT /*inStartRow*/, - SInt32 /*inRowCount*/) -//----------------------------------- -{ -} -//====================================== - - -//----------------------------------- -void FE_UpdateBiff(MSG_BIFF_STATE inState) -// Called when "check for mail" state changes. -//----------------------------------- -{ - CCheckMailContext::Get()->SetState(inState); -} - -// -// inDir argument is a Mac path. -uint32 FE_DiskSpaceAvailable( MWContext* inContext, const char* inDir) -//----------------------------------- -{ - Boolean isMailContext - = ( inContext->type == MWContextMailMsg - || inContext->type == MWContextMail - || inContext->type == MWContextMessageComposition - || inContext->type == MWContextMailNewsProgress); - - if (isMailContext) - { - FSSpec folder = CPrefs::GetFolderSpec( CPrefs::MailFolder ); - return GetFreeSpaceInBytes( folder.vRefNum ); - } - else - { - FSSpec folder; - Str255 fileName; - OSErr err; - if (inDir) - { - XP_MEMCPY(fileName, inDir, 255); - c2pstr((char*)fileName); - folder.vRefNum = folder.parID = 0; - err = FSMakeFSSpec(folder.vRefNum, folder.parID, fileName, &folder); - } - else - err = fnfErr; - if ( err != noErr) - { - XP_ASSERT(FALSE); - return -1; - } - else - return GetFreeSpaceInBytes( folder.vRefNum ); - } - -} - -//----------------------------------- -void FE_ListChangeStarting( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inNotifyCode, - MSG_ViewIndex inWhere, - int32 inCount) -//----------------------------------- -{ - CMailCallbackManager::Get() - ->ChangeStarting(inPane, inAsync, inNotifyCode, inWhere, inCount); -} // FE_ListChangeStarting - -//----------------------------------- -void FE_ListChangeFinished( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inNotifyCode, - MSG_ViewIndex inWhere, - int32 inCount) -//----------------------------------- -{ - CMailCallbackManager::Get() - ->ChangeFinished(inPane, inAsync, inNotifyCode, inWhere, inCount); -} // FE_ListChangeFinished - -//----------------------------------- -void FE_PaneChanged( - MSG_Pane *inPane, - XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) -//----------------------------------- -{ - CMailCallbackManager::Get()->PaneChanged(inPane, asynchronous, inNotifyCode, value); -} - -// ¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ -// -// Awaiting a real composition implementation, -// at which point, these should move there. -// -// ¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ - - -extern "C" void FE_InsertMessageCompositionText( MWContext* /*inContext*/, const char* /*text*/, XP_Bool /*leaveCursorAtBeginning*/); -void FE_InsertMessageCompositionText( MWContext* /*inContext*/, const char* /*text*/, XP_Bool /*leaveCursorAtBeginning*/) {} - -extern "C" void FE_MsgShowHeaders(MSG_Pane *pPane, MSG_HEADER_SET mhsHeaders); -void FE_MsgShowHeaders (MSG_Pane* /*comppane*/, MSG_HEADER_SET /*headers*/) {} - - -extern void FE_UpdateCompToolbar(MSG_Pane* /*comppane*/); // in CMailComposeWindow.cp - -MSG_Master* FE_GetMaster() -{ - // implement get master - return CMailNewsContext::GetMailMaster(); -} diff --git a/mozilla/cmd/macfe/MailNews/MailNewsCallbacks.h b/mozilla/cmd/macfe/MailNews/MailNewsCallbacks.h deleted file mode 100644 index 7b5bef81f11..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsCallbacks.h +++ /dev/null @@ -1,157 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsCallbacks.h - -#pragma once - -#include -#include - -#include "msgcom.h" - -//====================================== -class CMailCallbackManager : public LBroadcaster, public LSharable -//====================================== -{ - -public: - - enum - { - msg_PaneChanged = 'PnCh' - , msg_ChangeFinished = 'ChFn' - , msg_ChangeStarting = 'ChSt' - }; - CMailCallbackManager(); - virtual ~CMailCallbackManager(); - static CMailCallbackManager* Get(); - -public: - - void PaneChanged( - MSG_Pane *inPane, - XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value); - void ChangeStarting( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inNotifyCode, - MSG_ViewIndex inWhere, - int32 inCount); - void ChangeFinished( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inNotifyCode, - MSG_ViewIndex inWhere, - int32 inCount); -private: - - Boolean ValidData(MSG_Pane *inPane); - -protected: - - static CMailCallbackManager* sMailCallbackManager; -}; - -//----------------------------------- -struct SMailCallbackInfo -//----------------------------------- -{ - MSG_Pane* pane; - XP_Bool async; - - SMailCallbackInfo(MSG_Pane* inPane, XP_Bool inAsync) : pane(inPane), async(inAsync){} -}; - -//----------------------------------- -struct SPaneChangeInfo : public SMailCallbackInfo -//----------------------------------- -{ - MSG_PANE_CHANGED_NOTIFY_CODE notifyCode; - int32 value; - - SPaneChangeInfo( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 inValue) - : SMailCallbackInfo(inPane, inAsync) - , notifyCode(inNotifyCode) - , value(inValue) {} -}; - -typedef Uint32 TableIndexT; - -//----------------------------------- -struct SLineChangeInfo : public SMailCallbackInfo -//----------------------------------- -{ - MSG_NOTIFY_CODE changeCode; - MSG_ViewIndex startRow; - int32 rowCount; - - SLineChangeInfo( - MSG_Pane* inPane, - XP_Bool inAsync, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - int32 inCount) - : SMailCallbackInfo(inPane, inAsync) - , changeCode(inChangeCode) - , startRow(inStartRow) - , rowCount(inCount) {} -}; - -//====================================== -class CMailCallbackListener : public LListener -//====================================== -{ -protected: - CMailCallbackListener(); -public: - ~CMailCallbackListener(); - void SetPane(MSG_Pane* inPane) { mPane = inPane; } -protected: - virtual void ListenToMessage(MessageT message, void* ioParam); - virtual Boolean IsMyPane(void* info) const; // info from a ListenToMessage... -private: - void PaneChanged(void* ioParam); - void ChangeStarting(void* ioParam); - void ChangeFinished(void* ioParam); - - virtual void ChangeStarting( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void ChangeFinished( - MSG_Pane* inPane, - MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, - SInt32 inRowCount); - virtual void PaneChanged( - MSG_Pane* inPane, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) = 0; // must always be supported. -private: - MSG_Pane* mPane; -}; diff --git a/mozilla/cmd/macfe/MailNews/MailNewsClasses.cp b/mozilla/cmd/macfe/MailNews/MailNewsClasses.cp deleted file mode 100644 index 619428da02f..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsClasses.cp +++ /dev/null @@ -1,108 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsClasses.cp - -#include "MailNewsClasses.h" - -//#define REGISTER_(letter,root) \ -// RegisterClass_(letter##root::class_ID, \ -// (ClassCreatorFunc)letter##root::Create##root##Stream); - -#define REGISTER_(letter,root) \ - RegisterClass_(letter##root); - -#define REGISTERC(root) REGISTER_(C,root) -#define REGISTERL(root) REGISTER_(L,root) - -// ### General Purpose UI Classes - #include "CSimpleTextView.h" - -// ### MailNews Specific UI Classes - #include "CThreadView.h" - #include "CSimpleFolderView.h" - #include "CMessageFolderView.h" - #include "CMessageWindow.h" - #include "CMailNewsWindow.h" - #include "CSubscribeView.h" - #include "COfflinePicker.h" - #include "CThreadWindow.h" - #include "CMessageWindow.h" - #include "CMessageView.h" - #include "CMailComposeWindow.h" - #include "CBiffButtonAttachment.h" - #include "CSubscribeWindow.h" - #include "CGAStatusBar.h" - #include "LGABox_fixes.h" - #include "SearchHelpers.h" - #include "CSizeBox.h" - - #include "CExpandoDivider.h" - - #include "MailNewsSearch.h" - #include "MailNewsFilters.h" - - #include "CMailFolderButtonPopup.h" - #include "StGetInfoHandler.h" - #include "CMailProgressWindow.h" - #include "CMessageAttachmentView.h" -//----------------------------------- -void RegisterAllMailNewsClasses(void) -//----------------------------------- -{ - // ### General Purpose UI Classes - REGISTERC(SimpleTextView) - - // stuff that was being registered twice (usually once in address book, the other time - // in a search window). Since the new PP complains when you do this, do it once and for - // all when we init mail/news - RegisterClass_(CGAStatusBar); - RegisterClass_(LGABox_fixes); - RegisterClass_(CSearchEditField); - RegisterClass_(CSizeBox); - RegisterClass_(CSearchCaption); - RegisterClass_(CSearchTabGroup); - - // ### MailNews Specific UI Classes - REGISTERC(MailNewsFolderWindow) - REGISTERC(ThreadWindow) - REGISTERC(ThreadView) - REGISTERC(SimpleFolderView) - REGISTERC(MessageFolderView) - REGISTERC(SubscribeView) - REGISTERC(OfflinePickerView) - REGISTERC(OfflinePickerWindow) - REGISTERC(ExpandoDivider) - REGISTERC(MessageWindow) - REGISTERC(MessageView) - REGISTERC(MailFolderButtonPopup) - REGISTERC(MailFolderPatternTextPopup) - REGISTERC(MailFolderGAPopup) - REGISTERC(AttachmentView) - REGISTERC(BiffButtonAttachment); - REGISTERC(MailProgressWindow) - REGISTERC(MessageAttachmentView) - - UComposeUtilities::RegisterComposeClasses(); - USubscribeUtilities::RegisterSubscribeClasses(); - CSearchWindowManager::RegisterSearchClasses(); - CFiltersWindowManager::RegisterFiltersClasses(); - UGetInfo::RegisterGetInfoClasses(); -} // RegisterAllMailNewsClasses diff --git a/mozilla/cmd/macfe/MailNews/MailNewsClasses.h b/mozilla/cmd/macfe/MailNews/MailNewsClasses.h deleted file mode 100644 index 6ccf9741441..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsClasses.h +++ /dev/null @@ -1,25 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsClasses.h - -#pragma once - -void RegisterAllMailNewsClasses(void); diff --git a/mozilla/cmd/macfe/MailNews/MailNewsFilters.cp b/mozilla/cmd/macfe/MailNews/MailNewsFilters.cp deleted file mode 100644 index a1cdaa19924..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsFilters.cp +++ /dev/null @@ -1,2556 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsFilters.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#define DEBUGGER_ASSERTIONS - -#include "MailNewsFilters.h" -#include "CSearchManager.h" -#include "SearchHelpers.h" -#include "UMailFolderMenus.h" -#include "CCAption.h" - -#include "UStClasses.h" -#include "CMouseDragger.h" -#include "uprefd.h" -#include "macutil.h" -#include "MailNewsgroupWindow_Defines.h" -#include "uerrmgr.h" -#include "CMailNewsContext.h" -#include "Netscape_Constants.h" -#include "xp_str.h" -#include "UGraphicGizmos.h" -#include "LFlexTableGeometry.h" -#include "CTableKeyAttachment.h" -#include "URobustCreateWindow.h" -#include "CInlineEditField.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "UIHelper.h" -#include "CMessageFolder.h" -#include - -// BE Files - -#include "msg_filt.h" - -class CFiltersTableView; - -// Related files - -//#include "filters.cpp" -//#include "allxpstr.h" -//#include "msg.h" -//#include "msgcom.h" -//#include "msg_filt.h" -//#include "pmsgfilt.h" -//#include "pmsgsrch.h" -//#include "msgglue.cpp" -//#include "ptrarray.h" - -#define TABLE_TO_FILTER_INDEX(a) ((a) - 1) -#define ABS_VAL(v) (((v) < 0) ? -(v) : (v)) - -#define USE_NEW_FILTERS_SAVE - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -static const ResIDT cEnabledCheckCursorID = 29200; -static const ResIDT cHandOpenCursorID = 29201; -static const ResIDT cHandClosedCursorID = 29202; - -static const Int16 cColTextHMargin = 3; - -static const Int16 cDisclosureVMargin = 4; -static const Int16 cFiltersVMargin = 21; - -// Save window status version - -static const UInt16 cFiltersSaveWindowStatusVersion = 0x0008; - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - - - - -// CMailFolderPopup - -class CMailFolderPopup : public CGAIconPopup, - public CGAIconPopupFolderMixin { - -public: - - enum { class_ID = 'FDPU' }; - CMailFolderPopup(LStream *inStream) : - CGAIconPopup(inStream) { - } - virtual void GetCurrentItemTitle(Str255 outItemTitle) { - MGetCurrentMenuItemName(outItemTitle); - } - - virtual void FinishCreateSelf(void) { - CGAIconPopup::FinishCreateSelf(); - CMailFolderMixin::UpdateMailFolderMixinsNow(this); - } -protected: - -}; - - -class CMailFiltersWindow : public CMediatedWindow, - public CSaveWindowStatus, - public LListener { - -public: - - typedef CMediatedWindow Inherited; - - // Stream creator method - - enum { class_ID = 'FilT', pane_ID = class_ID, res_ID = 8700 }; - - // IDs for panes in associated view, also messages that are broadcast to this object - - enum { - paneID_New = 'NEWF' // New filter - , paneID_Duplicate = 'DUPL' // Duplicate filter - , paneID_Table = 'Tabl' // Filter table - , paneID_Description = 'DESC' // Filter description - , paneID_FiltersLog = 'FLOG' // Filter log checkbox - , paneID_DiscloseFilterAction = 'DFLT' // Disclosure triangle - , paneID_TopFrameEnclosure = 'TOPE' // Enclosure for top frame panes - , paneID_FilterActionView = 'FAVW' // Enclosure for filter action panes - , paneID_Actions = 'ACTN' // CSearchPopupMenu *, actions popup - , paneID_Folders = 'FLDR' // CSearchPopupMenu *, folders popup - , paneID_Priority = 'PRIO' // CSearchPopupMenu *, priority popup - , paneID_MatchAllRadio = 'MAND' // AND radio - , paneID_MatchAnyRadio = 'MOR ' // OR radio - , paneID_ServerSideFilterButton = 'SFBT' // Server side filters button - , paneID_FolderToFilterScopePopup = 'MfPM' // folder popup - - }; - - CMailFiltersWindow(LStream *inStream) : - CMediatedWindow(inStream, WindowType_MailFilters), - CSaveWindowStatus(this), - LListener(), - mFiltersTable(nil), - mFilterDescriptor(nil), - mDiscreteVSizing(1), - mDescriptionTextChangedIndex(0), - mFilterActionChangedIndex(0), - mFilterActionDisclosure(nil), - mFilterActionView(nil), - mMailFoldersPopup(nil), - mMailPriorityPopup(nil), - mSavedChanges(false), - mMailNewsContext(nil), - mRepopulateFlag( 0 ), mRuleType( filterInboxRule ) - { - SetPaneID(pane_ID); - SetRefreshAllWhenResized(false); - } - virtual ~CMailFiltersWindow(void); - - void RecalcMinMaxStdSizes(void); - - virtual const CSearchManager& GetSearchManager() const { return mSearchManager; } - virtual void Activate(); - virtual void Deactivate() - { - SaveCurrentFilterModifications(); - Inherited::Deactivate(); - } - void LoadFolderToFilter( ); -protected: - - // Overriden PowerPlant - - virtual void FinishCreateSelf(void); - virtual void DrawSelf(void); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual void AttemptClose(void) { - AttemptCloseWindow(); - CMediatedWindow::AttemptClose(); - } - virtual void DoClose(void) { - AttemptCloseWindow(); - CMediatedWindow::DoClose(); - } - virtual void DoSetBounds(const Rect &inBounds); - - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - virtual UInt16 GetValidStatusVersion(void) const { - return cFiltersSaveWindowStatusVersion; - } - - void UpdateToFilterLevels(Int16 inDeltaV); - - // Command and message methods - - void FilterSelectionChanged(void); - void ShowHideFilterAction(void); - Boolean FilterActionIsVisible(void) const { - return (mFilterActionDisclosure ? (mFilterActionDisclosure->GetValue() != 0) : false); - } - - void PopulateActionsMenu(void); - - void MessageActions(CSearchPopupMenu *inActionsMenu); - void SaveCurrentFilterModifications(void); - - void OpenFiltersList(void); - void UpdateActionToFilter(Boolean inEvenIfNotVisible = false); - void UpdateFilterToAction(Int32 inRow); - char * GetEscapedTempString(char * inStr); - - void EnableDisableFrameBindings(Boolean inEnable, SBooleanRect *ioTopFrameBinding, - SBooleanRect *ioActionBinding, SBooleanRect *ioDisclosureBinding); - - virtual ResIDT GetStatusResID(void) const { return res_ID; } - - - // Instance variables ========================================================== - UInt32 mRepopulateFlag; - CFiltersTableView *mFiltersTable; - LBroadcasterEditField *mFilterDescriptor; - Int32 mDescriptionTextChangedIndex; - Int32 mFilterActionChangedIndex; - Int16 mDiscreteVSizing; // Discrete vertical sizing for the window - Int16 mMinActionViewPortTop; // Minimum location for the filter action view top - Int16 mMinVSizeNoAction; // Minimum size for the window - - Boolean mSavedChanges; - - LControl *mDuplicateButton; - LControl *mFilterActionDisclosure; - LView *mFilterActionView; - - CMailFolderPopup *mMailFoldersPopup; - CSearchPopupMenu *mMailPriorityPopup; - CMailFolderPopup *mFolderToFilerPopup; - CSearchManager mSearchManager; - CMailNewsContext *mMailNewsContext; - LGARadioButton *mMatchAllRadio; - LGARadioButton *mMatchAnyRadio; - MSG_FilterType mRuleType; -}; - - -// CFiltersTableView - -class CFiltersTableView : public CStandardFlexTable, public LListener { -private: - typedef CStandardFlexTable Inherited; -public: - - // Broadcast messages - - enum { - msg_FilterTableSelectionChanged = 'chng' // nil - , msg_DoubleClickCell = 'doub' // nil - , msg_DeleteCell = 'dele' // nil - , msg_SaveModifications = 'save' // nil - }; - - // IDs for panes in associated view, also messages that are broadcast to this object - - enum { - paneID_OrderCaption = 'ORDR' - , paneID_NameCaption = 'NAME' - , paneID_EnabledCaption = 'ENBL' - , paneID_EditTitle = 'EDTL' // Edit field for title - }; - - enum { // Icon IDs - icm8_EnabledCheck = 29201 - , kEnabledCheckIconID = 15237 - , kDisabledCheckIconID = 15235 - , cSmallIconWidth = 16 - , cSmallIconHeight = 16 - }; - - enum { class_ID = 'FlTb' }; - CFiltersTableView(LStream *inStream) : - CStandardFlexTable(inStream), - mEditFilterName(nil), - mEditFilterNameRow(0), - mFilterList(nil), mRuleType( filterInboxRule ) { - SetRefreshAllWhenResized(false); - } - virtual ~CFiltersTableView(void); - - virtual void RemoveRows(Uint32 inHowMany, TableIndexT inFromRow, Boolean inRefresh); - void MoveRow(TableIndexT inCurrRow, TableIndexT inNewRow, - Boolean inRefresh); - - virtual void ApplyForeAndBackColors(void) const { // Make the thing public! - LTableView::ApplyForeAndBackColors(); - } - - void UpdateFilterNameChanged(void); - void SelectEditFilterName(TableIndexT inRow); - - - MSG_Filter *GetFilterAtRow(TableIndexT inRow) { - AssertFail_(mFilterList != nil); - MSG_Filter *filter = nil; - Int32 error = MSG_GetFilterAt(mFilterList, TABLE_TO_FILTER_INDEX(inRow), &filter); - AssertFail_(error == FilterError_Success); - AssertFail_(filter != nil); - return filter; - } - void GetFilterNameAtRow(TableIndexT inRow, CStr255 *outName) { - char *name = nil; - Int32 error = MSG_GetFilterName(GetFilterAtRow(inRow), &name); - Assert_(error == FilterError_Success); - Assert_(name != nil); - *outName = name; - } - Boolean GetFilterEnabledAtRow(TableIndexT inRow) { - XP_Bool enabled; - Int32 error = MSG_IsFilterEnabled(GetFilterAtRow(inRow), &enabled); - Assert_(error == FilterError_Success); - return enabled; - } - void GetFilterDescription(TableIndexT inRow, CStr255 *outDescription) { - char *description = nil; - Int32 error = MSG_GetFilterDesc(GetFilterAtRow(inRow), &description); - Assert_(error == FilterError_Success); - Assert_(description != nil); - *outDescription = description; - } - Boolean GetLogFiltersEnabled(void) { - Assert_(mFilterList != nil); - Boolean isEnabled = MSG_IsLoggingEnabled(mFilterList) ? true : false; - return isEnabled; - } - void GetFilterActionAtRow(TableIndexT inRow, StSearchDataBlock *outData, Int16 *outNumLevels, - MSG_RuleActionType *outAction, void **outValue); - void SetFilterActionAtRow(TableIndexT inRow, StSearchDataBlock *inData, - Int16 inNumLevels, MSG_RuleActionType inAction, - void *inValue); - - void SetFilterList(MSG_FilterList *inFilterList) { - mFilterList = inFilterList; - } - void SetFilterNameAtRow(TableIndexT inRow, const CStr255 *inName) { - FailFiltersError(MSG_SetFilterName(GetFilterAtRow(inRow), *inName)); - } - void SetFilterEnabledAtRow(TableIndexT inRow, Boolean inEnable) { - FailFiltersError(MSG_EnableFilter(GetFilterAtRow(inRow), inEnable)); - } - void SetFilterDescription(Int32 inRow, const CStr255 *inDescription) { - FailFiltersError(MSG_SetFilterDesc(GetFilterAtRow(inRow), *inDescription)); - } - - void NewFilter(void); - void DeleteFilter(void); - void DuplicateFilter(void); - void InsertFilterAt(TableIndexT inTableFilterRow, MSG_Filter *inFilter); - void RemoveFilterAt(TableIndexT inTableFilterRow, MSG_Filter **outFilter); - void SetLogFilters(Boolean inDoLog); - void SaveChangedFilterList(Int32 inRow = 0); - MSG_FilterList* GetFilterList() { return mFilterList; } - void LoadFiltersList(MSG_FolderInfo* folder, MSG_FilterType type); - void SetRuleType ( MSG_FilterType inType ) { mRuleType = inType; } -protected: - - // Unimplemented string IDs - - enum { - uStr_FilterFunctionNotImplemented = 29143 - , uStr_FilterFunctionParamError = 29144 - , uStr_FilterDefaultName = 8753 - , uStr_FilterDefaultDescription = 8754 - }; - - virtual void FinishCreateSelf(void); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - virtual void ReconcileFrameAndImage(Boolean inRefresh); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - - virtual void AdjustCursorSelf(Point inPortPt, const EventRecord &/*inMacEvent*/); - virtual Boolean ClickSelect(const STableCell &inCell, const SMouseDownEvent &inMouseDown); - virtual void TrackSelection( const SMouseDownEvent & /* inMouseDown */ ) { - // do nothing - }; - virtual void ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown); - virtual void ScrollBits(Int32 inLeftDelta, Int32 inTopDelta) { - USearchHelper::ScrollViewBits(this, inLeftDelta, inTopDelta); - } - virtual void SelectionChanged(void) { - BroadcastMessage(msg_FilterTableSelectionChanged); - } - enum EMouseTableLocation { eInNone = 0, eInEnabledCheck = 1, eInTitle = 2, eInCellContent = 3 }; - EMouseTableLocation GetMouseTableLocation(Point inPortPt, Rect *outLocationRect = nil); - - void GetFilterTitleRect(TableIndexT inRow, Rect *outTitleRect, - CStr255 *outNameString = nil); - void SwitchEditFilterName(TableIndexT inRow, const Rect *inNameLocalFrame, - CStr255 *inNameString, SMouseDownEvent *ioMouseDown); - void GetDisplayData(const STableCell &inCell, CStr255 *outDisplayText, - Int16 *outHorizJustType, ResIDT *outIconID); - void ToggleFilterEnabled(TableIndexT inRow, Rect *inLocalIconRect); - - virtual void DrawCellContents(const STableCell &inCell, const Rect &inLocalRect); - virtual void SetUpTableHelpers(void); - virtual void DeleteSelection(void); - - virtual Int32 GetBENumRows(void) { - Assert_(mFilterList != nil); - Int32 numFilters; - FailFiltersError(MSG_GetFilterCount(mFilterList, &numFilters)); - return numFilters; - } - - - - static void FailFiltersError(MSG_FilterError inError); - static void BEDeleteFilter(Int32 inFilterIndex, MSG_FilterList *ioFilterList); - static void BEMoveFilter(Int32 inFromIndex, Int32 inToIndex, MSG_FilterList *ioFilterList); - - // Instance variables ========================================================== - - CInlineEditField *mEditFilterName; - Int32 mEditFilterNameRow; - MSG_FilterList *mFilterList; // BE filter list - MSG_FilterType mRuleType; -}; - - -// CDeleteFilterAction - -class CDeleteFilterAction : public LAction { - -public: - - CDeleteFilterAction(CFiltersTableView *inTable, TableIndexT inTableFilterRow) : - LAction(CMailFiltersWindow::res_ID, 1) { - mTable = inTable; - mTableFilterRow = inTableFilterRow; - mFilter = nil; - } - - virtual void Finalize(void) { - if ( mFilter != nil ) { - MSG_FilterError error = MSG_DestroyFilter(mFilter); - mFilter = nil; - Assert_(error == FilterError_Success); - } - } - - virtual void RedoSelf(void) { - if ( mFilter == nil ) { - mTable->RemoveFilterAt(mTableFilterRow, &mFilter); - } - } - - virtual void UndoSelf(void) { - if ( mFilter != nil ) { - mTable->InsertFilterAt(mTableFilterRow, mFilter); - mFilter = nil; - } - } - -protected: - - // Instance variables ========================================================== - - CFiltersTableView *mTable; - TableIndexT mTableFilterRow; // The row that the filter belonged to - MSG_Filter *mFilter; // The filter itself -}; - - -// CMoveFilterAction - -class CMoveFilterAction : public LAction { - -public: - - CMoveFilterAction(CFiltersTableView *inTable, TableIndexT inStartFilterRow, - TableIndexT inEndFilterRow) : - LAction(CMailFiltersWindow::res_ID, 2) { - mTable = inTable; - mStartFilterRow = inStartFilterRow; - mEndFilterRow = inEndFilterRow; - } - - virtual void RedoSelf(void) { - mTable->MoveRow(mStartFilterRow, mEndFilterRow, true); - mTable->SelectScrollCell(STableCell(mEndFilterRow, 1)); - } - - virtual void UndoSelf(void) { - mTable->MoveRow(mEndFilterRow, mStartFilterRow, true); - mTable->SelectScrollCell(STableCell(mStartFilterRow, 1)); - } - -protected: - - // Instance variables ========================================================== - - CFiltersTableView *mTable; - TableIndexT mStartFilterRow; // Starting row, before redo - TableIndexT mEndFilterRow; // Ending row, after redo -}; - -#if 0 -// CFilterTableSelector - -class CFilterTableSelector : public CRowTableSelector { - -public: - - CFilterTableSelector(CFiltersTableView *inTableView) : - CRowTableSelector(inTableView, false) { - - } - -protected: - - virtual UInt32 GetRowUniqueID(const TableIndexT inRow) const { - return inRow; - } - virtual TableIndexT GetUniqueIDRow(const UInt32 inID) const { - return inID; - } -}; -#endif - -// CFilterTableKeyAttachment - -class CFilterTableKeyAttachment : public CTableKeyAttachment { - -public: - - CFilterTableKeyAttachment(CFiltersTableView *inTableView) : - CTableKeyAttachment(inTableView) { - - } - -protected: - - virtual void SelectCell(const STableCell &inCell, Boolean /*multiple*/ = false) { - AssertFail_(mTableView != nil); - (dynamic_cast(mTableView))->SelectScrollCell(inCell); - } -}; - - -#pragma mark - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -#pragma mark - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - - -/*====================================================================================== - Register all classes associated with the filters window. -======================================================================================*/ - -void CFiltersWindowManager::RegisterFiltersClasses(void) -{ - RegisterClass_(CMailFiltersWindow); - RegisterClass_(CFiltersTableView); - RegisterClass_(CInlineEditField); - RegisterClass_(CMailFolderPopup); -} - - -/*====================================================================================== - Show the filters dialog by bringing it to the front if it is not already. Create it - if needed. -======================================================================================*/ - -void CFiltersWindowManager::ShowFiltersWindow(void) { - - // Find out if the window is already around - CMailFiltersWindow *filtersDialog = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_MailFilters)); - - if ( filtersDialog == nil ) { - // Search dialog has not yet been created, so create it here and display it. - filtersDialog = dynamic_cast( - URobustCreateWindow::CreateWindow(CMailFiltersWindow::res_ID, - LCommander::GetTopCommander())); - } - - // Select the window - - filtersDialog->Select(); -} - - -#pragma mark - - -/*====================================================================================== - Update any current status info. -======================================================================================*/ - -CMailFiltersWindow::~CMailFiltersWindow(void) { - - RemoveAllAttachments(); - // Kludgy, but prevents crash in LUndoer caused by view being destroyed before - // attachments. - - Boolean canRotate = false; - if ( IsVisible() ) { - SaveCurrentFilterModifications(); - USearchHelper::FindWindowTabGroup(&mSubCommanders)->SetRotateWatchValue(&canRotate); - } - delete mFiltersTable; - mFiltersTable = nil; - if ( mMailNewsContext ) { - mMailNewsContext->RemoveUser(this); - } -} - -/*====================================================================================== - Activate window -======================================================================================*/ - -void -CMailFiltersWindow::Activate() -{ - mSearchManager.SetSearchScope( scopeMailFolder, nil); - Inherited::Activate(); -} - -/*====================================================================================== - Finish creating the filters dialog. -======================================================================================*/ - -void CMailFiltersWindow::FinishCreateSelf(void) { - - CMediatedWindow::FinishCreateSelf(); - - // This is lame. The only reason we are creating a context is so that - // we can have ownership of the master without it being deleted! We'll need - // to change this later! - mMailNewsContext = new CMailNewsContext(MWContextMailFilters); - FailNIL_(mMailNewsContext); - mMailNewsContext->AddUser(this); - - AddAttachment(new LUndoer); - - mFiltersTable = dynamic_cast( - USearchHelper::FindViewSubpane(this, paneID_Table)); - - mFilterDescriptor = USearchHelper::FindViewEditField(this, paneID_Description); - AssertFail_(mFiltersTable != nil); - - FindUIItemPtr(this, paneID_Duplicate, mDuplicateButton); - FindUIItemPtr(this, paneID_DiscloseFilterAction, mFilterActionDisclosure); -// mDuplicateButton = USearchHelper::FindViewControl(this, paneID_Duplicate); -// mFilterActionDisclosure = USearchHelper::FindViewControl(this, paneID_DiscloseFilterAction); - mFilterActionView = USearchHelper::FindViewSubview(this, paneID_FilterActionView); - mMailFoldersPopup = dynamic_cast(USearchHelper::FindViewSubpane(this, paneID_Folders)); - AssertFail_(mMailFoldersPopup != nil); - mMailPriorityPopup = USearchHelper::FindSearchPopup(this, paneID_Priority); - - mFilterActionView->SetRefreshAllWhenResized(false); - USearchHelper::FindViewSubview(this, paneID_TopFrameEnclosure)->SetRefreshAllWhenResized(false); - - { // Get the discrete sizing for the window and resize it if necessary to make - // the table size integral with the table's row height - Rect frame; - mFiltersTable->CalcPortFrameRect(frame); - Int16 rowHeight = mFiltersTable->GetRowHeight(1); - Int16 tableHeight = frame.bottom - frame.top; - Int16 vResize = tableHeight % rowHeight; // Make integral of the table row height - if ( vResize != 0 ) { - CSaveWindowStatus::GetPaneGlobalBounds(this, &frame); - Int16 deltaV = rowHeight - vResize; - frame.bottom += deltaV; - mMinMaxSize.top += deltaV; - - CMediatedWindow::DoSetBounds(frame); // Don't call our DoSetBounds()! - } - - mFilterActionView->CalcPortFrameRect(frame); - mMinActionViewPortTop = frame.top; - mMinVSizeNoAction = mMinMaxSize.top; - mDiscreteVSizing = rowHeight; - } - - // initialize the foldertofilter popup control - FindUIItemPtr( this, paneID_FolderToFilterScopePopup, mFolderToFilerPopup ); - CMailFolderMixin::FolderChoices filePopupChoices - = static_cast(CMailFolderMixin::eWantNews + CMailFolderMixin::eWantDividers - + CMailFolderMixin::eWantInbox + CMailFolderMixin::eWantPublicFolder); - mFolderToFilerPopup->MSetFolderChoices( filePopupChoices ); - CMailFolderMixin::UpdateMailFolderMixinsNow( mFolderToFilerPopup ); - - // Load selected folder - LoadFolderToFilter( ); - - // Initialize the search manager - mSearchManager.AddListener(this); - mSearchManager.InitSearchManager(this, USearchHelper::FindWindowTabGroup(&mSubCommanders), - scopeMailFolder); - - - // Link to listeners - - mFiltersTable->AddListener(this); - mFilterDescriptor->AddListener(this); - USearchHelper::FindSearchPopup(this, paneID_Actions)->AddListener(this); - FindUIItemPtr(this, paneID_MatchAllRadio, mMatchAllRadio ); - FindUIItemPtr(this, paneID_MatchAnyRadio, mMatchAnyRadio ); - - mMailFoldersPopup->AddListener(this); - mMailPriorityPopup->AddListener(this); - - UReanimator::LinkListenerToControls(this, this, GetStatusResID()); - - // Call inherited method - FinishCreateWindow(); - -} - - -/*====================================================================================== - Draw the window. -======================================================================================*/ - -void CMailFiltersWindow::DrawSelf(void) { - - Rect frame; - - if ( mFiltersTable->CalcPortFrameRect(frame) && ::RectInRgn(&frame, mUpdateRgnH) ) { - { - StExcludeVisibleRgn excludeRgn(mFiltersTable); - CMediatedWindow::DrawSelf(); - } - - StColorPenState::Normalize(); - ::EraseRect(&frame); - } else { - CMediatedWindow::DrawSelf(); - } - - USearchHelper::RemoveSizeBoxFromVisRgn(this); -} - - -/*====================================================================================== - React to message broadcast by the controls. -======================================================================================*/ - -void CMailFiltersWindow::ListenToMessage(MessageT inMessage, void *ioParam) { - - switch ( inMessage ) { - case paneID_ServerSideFilterButton: - { - Assert_( mFolderToFilerPopup ); - CMessageFolder folder = mFolderToFilerPopup->MGetSelectedFolder(); - MSG_FolderInfo* folderInfo = (MSG_FolderInfo*)folder.GetFolderInfo(); - (void)MSG_GetAdminUrlForFolder(*mMailNewsContext, folderInfo, MSG_AdminServerSideFilters); - break; - } - - case paneID_FolderToFilterScopePopup: - LoadFolderToFilter(); - break; - - case CFiltersTableView::msg_FilterTableSelectionChanged: - FilterSelectionChanged(); - break; - - case paneID_New: - mFiltersTable->NewFilter(); - Boolean actionVisible = (mFilterActionDisclosure->GetValue() != 0); - if (!actionVisible) - { - mFilterActionDisclosure->SetValue(1); - ShowHideFilterAction(); - } - break; - - case paneID_Duplicate: - mFiltersTable->DuplicateFilter(); - break; - - case paneID_FiltersLog: - mFiltersTable->SetLogFilters((*((Int32 *) ioParam) != Button_Off)); - break; - - case paneID_DiscloseFilterAction: - ShowHideFilterAction(); - break; - - case CFiltersTableView::msg_DeleteCell: - mFiltersTable->DeleteFilter(); - break; - - case CFiltersTableView::msg_SaveModifications: - SaveCurrentFilterModifications(); - break; - - case CSearchEditField::msg_UserChangedText: - if ( (*((PaneIDT *) ioParam) == paneID_Description) && (mDescriptionTextChangedIndex < 0) ) { - // Positive value indicates user changed - mDescriptionTextChangedIndex = -mDescriptionTextChangedIndex; - } - break; - - case CSearchManager::msg_UserChangedSearchParameters: - if ( mFilterActionChangedIndex < 0 ) { - // Positive value indicates user changed - mFilterActionChangedIndex = -mFilterActionChangedIndex; - } - break; - - case paneID_Actions: - MessageActions((CSearchPopupMenu *) ioParam); - if ( mFilterActionChangedIndex < 0 ) { - // Positive value indicates user changed - mFilterActionChangedIndex = -mFilterActionChangedIndex; - } - break; - - case paneID_Folders: - case paneID_Priority: - if ( mFilterActionChangedIndex < 0 ) { - // Positive value indicates user changed - mFilterActionChangedIndex = -mFilterActionChangedIndex; - } - break; - - case CSearchManager::msg_SearchParametersResized: - UpdateToFilterLevels(*((Int16 *) ioParam)); - break; - - default: - // No inherited method - break; - } -} - - -/*====================================================================================== - Adjust the window to stored preferences. -======================================================================================*/ - -void CMailFiltersWindow::ReadWindowStatus(LStream *inStatusData) { - - if ( inStatusData != nil ) { - - Rect bounds; - *inStatusData >> bounds; - - Boolean actionVisible; - *inStatusData >> actionVisible; - - mFilterActionDisclosure->SetValue(actionVisible ? 1 : 0); - - CSaveWindowStatus::MoveWindowTo(this, topLeft(bounds)); - - TableIndexT lastSelectedRow; - CStr255 lastSelectedName; - - *inStatusData >> lastSelectedRow; - *inStatusData >> (StringPtr) lastSelectedName; -// Int32 booleanPopupValue; - - Boolean didSelectCell = false; - - // Try to select the last selected filter - if ( (lastSelectedRow != 0) && mFiltersTable->IsValidRow(lastSelectedRow) ) { - CStr255 name; - mFiltersTable->GetFilterNameAtRow(lastSelectedRow, &name); - if ( ::EqualString(name, lastSelectedName, true, true) ) { - mFiltersTable->SelectScrollCell(STableCell(lastSelectedRow, 1)); - didSelectCell = true; - } - } - - // Finally, try to display the last number of visible cells - - Int16 numVisibleCells; - *inStatusData >> numVisibleCells; - - SDimension16 frameSize; - mFiltersTable->GetFrameSize(frameSize); - - Int16 shouldBeHeight = mFiltersTable->GetRowHeight(1) * numVisibleCells; - - if (shouldBeHeight != frameSize.height) { - CSaveWindowStatus::GetPaneGlobalBounds(this, &bounds); - bounds.bottom += (shouldBeHeight - frameSize.height); - CSaveWindowStatus::VerifyWindowBounds(this, &bounds); - DoSetBounds(bounds); - } - - mFiltersTable->ReadSavedTableStatus(inStatusData); - - if ( didSelectCell ) return; - } else { - mFilterActionDisclosure->SetValue(0); // Hide action by default - CSaveWindowStatus::MoveWindowToAlertPosition(this); - } - - mSearchManager.SetNumVisibleLevels(1); - RecalcMinMaxStdSizes(); - FilterSelectionChanged(); -} - - -/*====================================================================================== - Get window stored preferences. -======================================================================================*/ - -void CMailFiltersWindow::WriteWindowStatus(LStream *outStatusData) { - - CSaveWindowStatus::WriteWindowStatus(outStatusData); - - TableIndexT lastSelectedRow = 0; - CStr255 lastSelectedName = CStr255::sEmptyString; - - // Try to store the last selected filter - STableCell selectedCell = mFiltersTable->GetFirstSelectedCell(); - if ( mFiltersTable->IsValidCell(selectedCell) ) { - lastSelectedRow = selectedCell.row; - mFiltersTable->GetFilterNameAtRow(lastSelectedRow, &lastSelectedName); - } - - *outStatusData << (Boolean) FilterActionIsVisible(); - *outStatusData << lastSelectedRow; - *outStatusData << (StringPtr) lastSelectedName; - - // Save number of visible rows in the table - - SDimension16 frameSize; - mFiltersTable->GetFrameSize(frameSize); - - Int16 numVisibleCells = frameSize.height / mFiltersTable->GetRowHeight(1); - *outStatusData << numVisibleCells; - - mFiltersTable->WriteSavedTableStatus(outStatusData); -} - - -/*====================================================================================== - Make resizing of the window integral to the row size of the filter table. -======================================================================================*/ - -void CMailFiltersWindow::DoSetBounds(const Rect &inBounds) { - - Rect newBounds = inBounds; - - USearchHelper::CalcDiscreteWindowResizing(this, &newBounds, 1, mDiscreteVSizing); - - CMediatedWindow::DoSetBounds(newBounds); -} - - -/*====================================================================================== - Recalculate the window's std sizes based on the current number of filters. -======================================================================================*/ - -void CMailFiltersWindow::RecalcMinMaxStdSizes(void) { - - Rect windBounds, viewBounds; - CalcPortFrameRect(windBounds); - mStandardSize.width = windBounds.right - windBounds.left; - - if ( FilterActionIsVisible() ) { - mFilterActionView->CalcPortFrameRect(viewBounds); - Assert_(viewBounds.top >= mMinActionViewPortTop); - mMinMaxSize.top = windBounds.bottom - (viewBounds.top - mMinActionViewPortTop); - } else { - mMinMaxSize.top = mMinVSizeNoAction; - } - - mFiltersTable->CalcPortFrameRect(viewBounds); - - TableIndexT rows, cols; - mFiltersTable->GetTableSize(rows, cols); - - Int32 deltaVSize = (rows * (Int32) mFiltersTable->GetRowHeight(1)) - - (Int32) (viewBounds.bottom - viewBounds.top); - - Int32 newHeight = (Int32) (windBounds.bottom - windBounds.top) + deltaVSize; - if ( newHeight > mMinMaxSize.bottom ) { - newHeight = mMinMaxSize.bottom; - } else if ( newHeight < mMinMaxSize.top ) { - newHeight = mMinMaxSize.top; - } - mStandardSize.height = newHeight; -} - - -/*====================================================================================== - The selection of a filter changed in the table. -======================================================================================*/ - -void CMailFiltersWindow::FilterSelectionChanged(void) { - - SaveCurrentFilterModifications(); - - STableCell selectedCell = mFiltersTable->GetFirstSelectedCell(); - Boolean filtersAreSelected = mFiltersTable->IsValidCell(selectedCell); - - // We don't really have a way to display JavaScript filters right now - MSG_FilterType filterType; - - Boolean enableDuplicateButton = filtersAreSelected; - Boolean enableFilterDescription = filtersAreSelected; - Boolean enableFilterActionView = filtersAreSelected; - - if (filtersAreSelected) { - MSG_Filter *selectedFilter; - selectedFilter = mFiltersTable->GetFilterAtRow(selectedCell.row); - MSG_GetFilterType(selectedFilter, &filterType); - if (filterType == filterInboxJavaScript || filterType == filterNewsJavaScript) { - enableDuplicateButton = false; - enableFilterActionView = false; - } - } - - USearchHelper::EnableDisablePane(mDuplicateButton, enableDuplicateButton); - USearchHelper::EnableDisablePane(mFilterDescriptor->GetSuperView(), enableFilterDescription ); - USearchHelper::EnableDisablePane(mFilterActionView, enableFilterActionView); - - Boolean enableAndOrRadios = enableFilterActionView && (mSearchManager.GetNumVisibleLevels() > 1); - USearchHelper::EnableDisablePane(mMatchAllRadio, enableAndOrRadios); - USearchHelper::EnableDisablePane(mMatchAnyRadio, enableAndOrRadios); - // If the filter text changed, update the BE - - CStr255 filterDescriptor; - - // Update the displayed text - if ( filtersAreSelected ) { - mFiltersTable->GetFilterDescription(selectedCell.row, &filterDescriptor); - mDescriptionTextChangedIndex = -selectedCell.row; - } else { - filterDescriptor[0] = 0; - } - - mFilterDescriptor->SetDescriptor(filterDescriptor); - - UpdateActionToFilter(); - - if ( IsVisible() ) UpdatePort(); // For immediate action -} - - -/*====================================================================================== - Setup the dialog so that the specified number of search levels are visible. -======================================================================================*/ - -void CMailFiltersWindow::UpdateToFilterLevels(Int16 inDeltaV) { - - if ( (inDeltaV == 0) ) return; - - // Disable bottom binding of necessary panes - - SBooleanRect topFrameBinding, actionBinding, disclosureBinding; - EnableDisableFrameBindings(false, &topFrameBinding, &actionBinding, &disclosureBinding); - - // Resize window - - mFilterActionView->ResizeFrameBy(0, inDeltaV, true); - - if ( FilterActionIsVisible() ) { - Rect bounds; - CSaveWindowStatus::GetPaneGlobalBounds(this, &bounds); - bounds.bottom += inDeltaV; - CMediatedWindow::DoSetBounds(bounds); // Update window size - RecalcMinMaxStdSizes(); - } - - // Reenable bottom binding of top panes - - EnableDisableFrameBindings(true, &topFrameBinding, &actionBinding, &disclosureBinding); -} - - -/*====================================================================================== - Show or hide the filter action depending upon its current state. -======================================================================================*/ - -void CMailFiltersWindow::ShowHideFilterAction(void) { - - Boolean actionVisible = (mFilterActionDisclosure->GetValue() != 0); - LView *paramEnclosure = USearchHelper::FindViewSubview(mFilterActionView, CSearchManager::paneID_ParamEncl); - - if ( actionVisible ) { - StValueChanger change(*((Int32 *) &mFilterActionDisclosure), nil); - UpdateActionToFilter(true); - } - - Rect windowBounds, disclosureRect; - CSaveWindowStatus::GetPaneGlobalBounds(this, &windowBounds); - CSaveWindowStatus::GetPaneGlobalBounds(mFilterActionDisclosure, &disclosureRect); - - // Disable bottom binding of necessary panes - - SBooleanRect topFrameBinding, actionBinding, disclosureBinding; - EnableDisableFrameBindings(false, &topFrameBinding, &actionBinding, &disclosureBinding); - - // Resize window - - if ( actionVisible ) { - Rect enclosureBounds; - CSaveWindowStatus::GetPaneGlobalBounds(mFilterActionView, &enclosureBounds); - Int16 newBottom = enclosureBounds.bottom /*+ cFiltersVMargin*/; - windowBounds.bottom = newBottom; - CMediatedWindow::DoSetBounds(windowBounds); - paramEnclosure->Show(); - ((LGABox *) mFilterActionView)->SetBorderStyle(borderStyleGA_BezelBorder); - } else { - Int16 newBottom = disclosureRect.bottom + cDisclosureVMargin; - windowBounds.bottom = newBottom; - CMediatedWindow::DoSetBounds(windowBounds); - paramEnclosure->Hide(); - ((LGABox *) mFilterActionView)->SetBorderStyle(borderStyleGA_NoBorder); - } - - // Reenable bottom binding of top panes - - EnableDisableFrameBindings(true, &topFrameBinding, &actionBinding, &disclosureBinding); - - RecalcMinMaxStdSizes(); -} - -//----------------------------------- -void CMailFiltersWindow::UpdateActionToFilter(Boolean inEvenIfNotVisible) -//----------------------------------- -{ - - mFilterActionChangedIndex = 0; - - if ( !FilterActionIsVisible() && !inEvenIfNotVisible ) return; - - STableCell selectedCell = mFiltersTable->GetFirstSelectedCell(); - if ( !mFiltersTable->IsValidCell(selectedCell) ) return; - - // don't try and do anything with JavaScript filters because we can't - MSG_Filter *selectedFilter; - selectedFilter = mFiltersTable->GetFilterAtRow(selectedCell.row); - MSG_FilterType filterType; - MSG_GetFilterType(selectedFilter, &filterType); - if (filterType == filterInboxJavaScript || filterType == filterNewsJavaScript) { - mSearchManager.SetNumVisibleLevels(1); - LEditField *txtField = dynamic_cast(FindPaneByID(CSearchManager::paneID_TextValue)); - if (txtField != NULL) - txtField->SetDescriptor("\p"); - - return; - } - - Try_ { - - StSearchDataBlock paramData; - Int16 numLevels; - MSG_RuleActionType action; - void *value; - - mFiltersTable->GetFilterActionAtRow(selectedCell.row, ¶mData, &numLevels, &action, &value); - - // Update to filter levels - mSearchManager.SetSearchParameters(numLevels, paramData.GetData()); - - // Update to filter action - USearchHelper::FindSearchPopup(this, paneID_Actions)->SetCurrentItemByCommand(action); - - SearchLevelParamT* currentData = paramData.GetData(); - (currentData->boolOp ? mMatchAllRadio : mMatchAnyRadio)->SetValue(Button_On); - - mDescriptionTextChangedIndex = selectedCell.row; - - switch ( action ) - { - case acMoveToFolder: - // Set the folder name - value = GetEscapedTempString((char*)value); - if ( !mMailFoldersPopup->MSetSelectedFolderName((const char*) value) ) - mFilterActionChangedIndex = selectedCell.row; - break; - case acChangePriority: - // Get the priority - AssertFail_(mMailPriorityPopup->IsLatentVisible()); - mMailPriorityPopup->SetCurrentItemByCommand(*((MSG_PRIORITY *) &value)); - break; - case acDelete: - case acMarkRead: - case acKillThread: - case acWatchThread: - break; - default: - AssertFail_(false); // Should never get here! - break; - } - } - Catch_(inErr) - { - USearchHelper::GenericExceptionAlert(inErr); - // Don't throw here! Should really never get an error! - } - EndCatch_ - - if ( mFilterActionChangedIndex != 0 || mDescriptionTextChangedIndex != 0) SaveCurrentFilterModifications(); - mFilterActionChangedIndex = -selectedCell.row; - mDescriptionTextChangedIndex = -selectedCell.row; -} - -//----------------------------------- -void CMailFiltersWindow::UpdateFilterToAction(Int32 inRow) -//----------------------------------- -{ - // don't try and do anything with JavaScript filters because we can't - MSG_Filter *selectedFilter; - selectedFilter = mFiltersTable->GetFilterAtRow(inRow); - MSG_FilterType filterType; - MSG_GetFilterType(selectedFilter, &filterType); - if (filterType == filterInboxJavaScript || filterType == filterNewsJavaScript) - return; - - Try_ { - // Get rules - - Int16 numVisLevels = mSearchManager.GetNumVisibleLevels(); - AssertFail_(numVisLevels > 0); // Make sure we get something back! - - StSearchDataBlock ruleData(numVisLevels, StSearchDataBlock::eAllocateStrings); - mSearchManager.GetSearchParameters(ruleData.GetData()); - - MSG_RuleActionType action = (MSG_RuleActionType) - USearchHelper::FindSearchPopup(this, paneID_Actions)->GetCurrentItemCommandNum(); - - void *value = nil; - MSG_PRIORITY priority; - switch ( action ) - { - case acMoveToFolder: - // Get the folder name - value = (void *) mMailFoldersPopup->MGetSelectedFolderName(); - AssertFail_(value != nil); - value = GetEscapedTempString((char*)value); - break; - - case acChangePriority: - // Get the priority - Assert_(mMailPriorityPopup->IsLatentVisible()); - priority = (MSG_PRIORITY) mMailPriorityPopup->GetCurrentItemCommandNum(); - value = (void *) priority; - break; - - case acDelete: - case acMarkRead: - case acKillThread: - case acWatchThread: - break; - - default: - AssertFail_(false); // Should never get here! - break; - } - - mFiltersTable->SetFilterActionAtRow(inRow, &ruleData, numVisLevels, action, value); - - } - Catch_(inErr) - { - USearchHelper::GenericExceptionAlert(inErr); - // Don't throw here! Should really never get an error! - } - EndCatch_ -} - -//----------------------------------- -char * CMailFiltersWindow::GetEscapedTempString(char * inStr) -//----------------------------------- -{ - // Make sure that the name is fully escaped - static char escapedName[256]; - XP_STRCPY(escapedName, inStr); - NET_UnEscape(escapedName); - char * temp = NET_Escape(escapedName, URL_PATH); - if (temp) - { - XP_STRCPY(escapedName, temp); - XP_FREE(temp); - } - return escapedName; -} - - -/*====================================================================================== - The specified filter has changed. Save the filter list to disk. If inRow is 0, - the entire list has changed, so save it all. -======================================================================================*/ - -void CMailFiltersWindow::SaveCurrentFilterModifications(void) { - - if ( ((mDescriptionTextChangedIndex > 0) || (mFilterActionChangedIndex > 0)) ) { - - Try_ { - Int16 saveChangeIndex = 0; - - if ( (mDescriptionTextChangedIndex > 0) ) { - CStr255 filterDescriptor; - mFilterDescriptor->GetDescriptor(filterDescriptor); - mFiltersTable->SetFilterDescription(mDescriptionTextChangedIndex, &filterDescriptor); - saveChangeIndex = mDescriptionTextChangedIndex; - } - - if ( (mFilterActionChangedIndex > 0) ) { - UpdateFilterToAction(mFilterActionChangedIndex); - Assert_(saveChangeIndex ? (saveChangeIndex == mFilterActionChangedIndex) : true); - saveChangeIndex = mFilterActionChangedIndex; - } - - mFiltersTable->SaveChangedFilterList(saveChangeIndex); - } - Catch_(inErr) { - // Do nothing, we should never really get an error here - USearchHelper::GenericExceptionAlert(inErr); - } - EndCatch_ - - mDescriptionTextChangedIndex = 0; - mFilterActionChangedIndex = 0; - } -} - - -/*====================================================================================== - Enable or disable frame bindings in preparation for changing the window size. -======================================================================================*/ - -void CMailFiltersWindow::EnableDisableFrameBindings(Boolean inEnable, SBooleanRect *ioTopFrameBinding, - SBooleanRect *ioActionBinding, SBooleanRect *ioDisclosureBinding) { - - LView *topFrameEnclosure = USearchHelper::FindViewSubview(this, paneID_TopFrameEnclosure); - LView *disclosureSuper = mFilterActionDisclosure->GetSuperView(); - - if ( !inEnable ) { - topFrameEnclosure->GetFrameBinding(*ioTopFrameBinding); - mFilterActionView->GetFrameBinding(*ioActionBinding); - disclosureSuper->GetFrameBinding(*ioDisclosureBinding); - - ioTopFrameBinding->bottom = ioActionBinding->bottom = ioDisclosureBinding->bottom = false; - } else { - ioTopFrameBinding->bottom = ioActionBinding->bottom = ioDisclosureBinding->bottom = true; - } - - topFrameEnclosure->SetFrameBinding(*ioTopFrameBinding); - mFilterActionView->SetFrameBinding(*ioActionBinding); - disclosureSuper->SetFrameBinding(*ioDisclosureBinding); -} - - -/*====================================================================================== - Populate the actions menu. -======================================================================================*/ - -static const Int16 cMaxNumActionItems = 8; - -void CMailFiltersWindow::PopulateActionsMenu(void) { - - CSearchPopupMenu *theMenu = USearchHelper::FindSearchPopup(this, paneID_Actions); - - Assert_(theMenu->GetNumCommands() == 6); - theMenu->SetIndexCommand(1, acMoveToFolder); - theMenu->SetIndexCommand(2, acChangePriority); - theMenu->SetIndexCommand(3, acDelete); - theMenu->SetIndexCommand(4, acMarkRead); - theMenu->SetIndexCommand(5, acKillThread); - theMenu->SetIndexCommand(6, acWatchThread); - -#if 0 // BE strings are lame! - theMenu->ClearMenu(); - - StPointerBlock menuData(sizeof(MSG_RuleMenuItem) * cMaxNumActionItems); - - MSG_RuleMenuItem *menuItems = (MSG_RuleMenuItem *) menuData.mPtr; - UInt16 numMenuItems = cMaxNumActionItems; - - FailFiltersError(MSG_GetRuleActionMenuItems(mRuleType, menuItems, - &numMenuItems)); - AssertFail_(numMenuItems > 0); - - MSG_RuleMenuItem *endItem = menuItems + numMenuItems; - - do { - theMenu->AppendMenuItemCommand(menuItems->attrib, C2PStr(menuItems->name), true); - } while ( ++menuItems < endItem ); -#endif // 0 -} - - -/*====================================================================================== - React to actions message. -======================================================================================*/ - -void CMailFiltersWindow::MessageActions(CSearchPopupMenu *inActionsMenu) { - - MSG_RuleActionType action = (MSG_RuleActionType) inActionsMenu->GetCurrentItemCommandNum(); - - Boolean showPriorities = false, showFolders = false; - - if ( action == acMoveToFolder ) { - showFolders = true; - } else if ( action == acChangePriority ) { - showPriorities = true; - } - - USearchHelper::ShowHidePane(mMailPriorityPopup, showPriorities); - USearchHelper::ShowHidePane(mMailFoldersPopup, showFolders); -} - -void CMailFiltersWindow::LoadFolderToFilter( ) -{ - Assert_( mFolderToFilerPopup ); - CMessageFolder folder = mFolderToFilerPopup->MGetSelectedFolder(); - MSG_FolderInfo* folderInfo = (MSG_FolderInfo*)folder.GetFolderInfo(); - MSG_FilterType type = filterInbox; - mRuleType = filterInboxRule; - if ( folder.IsNewsgroup() ) - { - type = filterNews; - mRuleType = filterNewsRule; - } - - mFiltersTable->SetRuleType( mRuleType ); - PopulateActionsMenu(); - mSearchManager.PopulatePriorityMenu(mMailPriorityPopup); - - mFiltersTable->LoadFiltersList( folderInfo, type ); - - LGACheckbox *logBox; - FindUIItemPtr(this, paneID_FiltersLog, logBox); -// USearchHelper::FindViewControl(this, paneID_FiltersLog) - logBox->SetValue( mFiltersTable->GetLogFiltersEnabled() ? 1 : 0); - // Does the server support server side filters? - XP_Bool enable = false; - - enable = MSG_HaveAdminUrlForFolder( folderInfo, MSG_AdminServerSideFilters ); - LControl* serverFilterButton = dynamic_cast(FindPaneByID( CMailFiltersWindow::paneID_ServerSideFilterButton )); - if( serverFilterButton) - USearchHelper::EnableDisablePane( serverFilterButton ,enable, true ); -} - - -#pragma mark - -/*====================================================================================== - Update any current status info. -======================================================================================*/ - -CFiltersTableView::~CFiltersTableView(void) { - - if ( IsVisible() ) { - UpdateFilterNameChanged(); - } - if ( mFilterList != nil ) { - MSG_CancelFilterList(mFilterList); - mFilterList = nil; - } -} - - -/*====================================================================================== - Finish initializing the object. -======================================================================================*/ - -void CFiltersTableView::FinishCreateSelf(void) { - -// long isDoubleByte; - - CStandardFlexTable::FinishCreateSelf(); - - mEditFilterName = (CInlineEditField *) USearchHelper::FindViewEditField(this, paneID_EditTitle); -#if 0 - // See CInlineEditField.cp for explanation of double byte wierdness - isDoubleByte = ::GetScriptManagerVariable(smDoubleByte); - mEditFilterName->SetGrowableBorder(!isDoubleByte); -#endif - mEditFilterName->AddListener(this); - -} - - -/*====================================================================================== - Obey commands. -======================================================================================*/ - -Boolean CFiltersTableView::ObeyCommand(CommandT inCommand, void *ioParam) { - - Boolean cmdHandled = true; - - switch (inCommand) { - - case msg_TabSelect: - break; - - default: - cmdHandled = CStandardFlexTable::ObeyCommand(inCommand, ioParam); - break; - } - - return cmdHandled; -} - - -/*====================================================================================== - React to message broadcast by the controls. -======================================================================================*/ - -void CFiltersTableView::ListenToMessage(MessageT inMessage, void *ioParam) { - - switch ( inMessage ) { - - case CInlineEditField::msg_InlineEditFieldChanged: - if ( (*((PaneIDT *) ioParam) == paneID_EditTitle) && (mEditFilterNameRow < 0) ) { - mEditFilterNameRow = -mEditFilterNameRow; // Text has changed - } - break; - - case CInlineEditField::msg_HidingInlineEditField: - if ( (*((PaneIDT *) ioParam) == paneID_EditTitle) ) { - UpdateFilterNameChanged(); - mEditFilterNameRow = 0; - } - break; - - default: - //Inherited::ListenToMessage(inMessage, ioParam); - break; - } -} - - -/*====================================================================================== - Load the filters list and initialize the table accordingly. -======================================================================================*/ - -void CFiltersTableView::LoadFiltersList(MSG_FolderInfo* folder, MSG_FilterType type ) -{ - Assert_( folder ); - if( folder == NULL ) - return; - // If there is a filterlist save it before loading in the new list - if ( mFilterList ) - SaveChangedFilterList(); - // Open the filters list - //FailFiltersError(MSG_OpenFilterList(CMailNewsContext::GetMailMaster(), filterInbox, - // &mFilterList)); - - - FailFiltersError( MSG_OpenFolderFilterListFromMaster(CMailNewsContext::GetMailMaster(), folder, type, &mFilterList) ); - - // Initialize the filters table with the new data - Int32 numFilters = GetBENumRows(); - RemoveAllRows(true); - Assert_(mRows == 0); - InsertRows(numFilters, 0, nil, 0, true); - -} - - -/*====================================================================================== - The specified filter has changed. Save the filter list to disk. If inRow is 0, - the entire list has changed, so save it all. -======================================================================================*/ - -void CFiltersTableView::SaveChangedFilterList(Int32 /*inRow*/) { - - // This is a temp fix waiting for a solution! - - Try_ { - AssertFail_(mFilterList != nil); - -#ifdef USE_NEW_FILTERS_SAVE - FailFiltersError(MSG_SaveFilterList(mFilterList)); -#else // USE_NEW_FILTERS_SAVE - // Close filter list to save it - FailFiltersError(MSG_CloseFilterList(mFilterList)); - mFilterList = nil; - // Open the filters list again - FailFiltersError(MSG_OpenFilterList(CMailNewsContext::GetMailMaster(), filterInbox, - &mFilterList)); -#endif // USE_NEW_FILTERS_SAVE - - } - Catch_(inErr) { - // This is obviously a major error! Just close and delete the window in this case - USearchHelper::GenericExceptionAlert(inErr); - } - EndCatch_ - - if ( mFilterList == nil ) { - USearchHelper::GetPaneWindow(this)->DoClose(); // Bad, bad, bad boy! Will change later - } -} - - -/*====================================================================================== - Get the filter action data for the specified row. Caller must delete memory using - ::DisposePtr(). -======================================================================================*/ - -void CFiltersTableView::GetFilterActionAtRow( - TableIndexT inRow, StSearchDataBlock *outData, Int16 *outNumLevels, - MSG_RuleActionType *outAction, void **outValue) -{ - MSG_Filter *filter = GetFilterAtRow(inRow); - - MSG_Rule *rule = nil; - FailFiltersError(MSG_GetFilterRule(filter, &rule)); - AssertFail_(rule != nil); - - { - Int32 tempNumLevels; - FailFiltersError(MSG_RuleGetNumTerms(rule, &tempNumLevels)); - *outNumLevels = tempNumLevels; - } - AssertFail_(*outNumLevels > 0); - - outData->Allocate(*outNumLevels, StSearchDataBlock::eDontAllocateStrings); - SearchLevelParamT *curLevel = outData->GetData(); - Int16 index = 0; - - do { - FailFiltersError(MSG_RuleGetTerm(rule, index, &curLevel->val.attribute, - &curLevel->op, &curLevel->val, &curLevel->boolOp, nil )); - ++curLevel; - } while ( ++index < *outNumLevels ); - - FailFiltersError(MSG_RuleGetAction(rule, outAction, outValue)); -} - - -/*====================================================================================== - Update the filter to the user specified action. -======================================================================================*/ - -void CFiltersTableView::SetFilterActionAtRow(TableIndexT inRow, StSearchDataBlock *inData, - Int16 inNumLevels, MSG_RuleActionType inAction, - void *inValue) { - - MSG_Filter *newFilter = nil; - - Try_ { - - // Contruct a new filter (this is the only way! :-( ) - - MSG_Filter *filter = GetFilterAtRow(inRow); - - char *text; - FailFiltersError(MSG_GetFilterName(filter, &text)); - - FailFiltersError(MSG_CreateFilter(mRuleType, text, &newFilter)); - - FailFiltersError(MSG_GetFilterDesc(filter, &text)); - FailFiltersError(MSG_SetFilterDesc(newFilter, text)); - - XP_Bool isEnabled; - FailFiltersError(MSG_IsFilterEnabled(filter, &isEnabled)); - FailFiltersError(MSG_EnableFilter(newFilter, isEnabled)); - - MSG_Rule *newRule; - FailFiltersError(MSG_GetFilterRule(newFilter, &newRule)); - - // Add rules to filter - - SearchLevelParamT *curLevel = inData->GetData(), *endLevel = curLevel + inNumLevels; - - do { - char *customHeader = nil; - - if( curLevel->val.attribute == attribOtherHeader ) - { - CMailFiltersWindow *filterWindow = dynamic_cast( USearchHelper::GetPaneWindow(this) ); - customHeader = ( filterWindow->GetSearchManager() ).GetSelectedCustomHeader( curLevel ); - } - - FailFiltersError(MSG_RuleAddTerm(newRule, curLevel->val.attribute, - curLevel->op, &curLevel->val, curLevel->boolOp, customHeader )); - } while ( ++curLevel < endLevel ); - - // Add filter action - - FailFiltersError(MSG_RuleSetAction(newRule, inAction, inValue)); - - Int32 filterIndex = TABLE_TO_FILTER_INDEX(inRow); - - Int32 numFilters = GetBENumRows(); - - // Add the new filter to the end of the list (API doesn't let us do it any other way!) - FailFiltersError(MSG_SetFilterAt(mFilterList, numFilters, newFilter)); - newFilter = nil; - - // Remove and delete the old edit filter from the list - BEDeleteFilter(filterIndex, mFilterList); - --numFilters; - - // Move new filter into the correct position - if ( filterIndex != numFilters ) { - BEMoveFilter(numFilters, filterIndex, mFilterList); - } - } - Catch_(inErr) { - if ( newFilter != nil ) { - MSG_FilterError error = MSG_DestroyFilter(newFilter); - newFilter = nil; - Assert_(error == FilterError_Success); - } - - Throw_(inErr); - } - EndCatch_ -} - - -/*====================================================================================== - Create a new filter by bringing up a dialog for user interaction. -======================================================================================*/ - -void CFiltersTableView::NewFilter(void) { - - STableCell selectedCell = GetFirstSelectedCell(); - if ( !IsValidCell(selectedCell) ) { - // Add new filter to end of table if no cells selected - GetTableSize(selectedCell.row, selectedCell.col); - } - ++selectedCell.row; - - // Create a new default filter - - MSG_Filter *newFilter = nil; - PostAction(nil); - - Try_ { - AssertFail_(mFilterList != nil); - - Int32 numFilters = GetBENumRows(); - - // Contruct a new filter - - CStr255 macString; - USearchHelper::AssignUString(uStr_FilterDefaultName, macString); - FailFiltersError(MSG_CreateFilter( mRuleType, macString, &newFilter)); - - USearchHelper::AssignUString(uStr_FilterDefaultDescription, macString); - FailFiltersError(MSG_SetFilterDesc(newFilter, macString)); - - XP_Bool isEnabled = 1; - FailFiltersError(MSG_EnableFilter(newFilter, isEnabled)); - - MSG_Rule *rule = nil; - FailFiltersError(MSG_GetFilterRule(newFilter, &rule)); - AssertFail_(rule != nil); - - USearchHelper::AssignUString(uStr_FilterDefaultName, macString); - MSG_SearchValue value; - value.attribute = attribSender; - value.u.string = ""; - XP_Bool boolOp = true; - FailFiltersError(MSG_RuleAddTerm(rule, attribSender, opContains, &value, boolOp, nil )); - - // Add filter action - - macString[0] = 0; - FailFiltersError(MSG_RuleSetAction(rule, acMoveToFolder, (char*)macString)); - - // Add the new filter to the end of the list (API doesn't let us do it any other way!) - FailFiltersError(MSG_SetFilterAt(mFilterList, numFilters, newFilter)); - newFilter = nil; - - // Move new filter into the correct position - if ( TABLE_TO_FILTER_INDEX(selectedCell.row) != numFilters ) { - BEMoveFilter(numFilters, TABLE_TO_FILTER_INDEX(selectedCell.row), mFilterList); - } - - SaveChangedFilterList(selectedCell.row); - - InsertRows(1, selectedCell.row - 1, nil, 0, true); - ScrollCellIntoFrame(selectedCell); - SelectEditFilterName(selectedCell.row); - ((CMailFiltersWindow *) USearchHelper::GetPaneWindow(this))->RecalcMinMaxStdSizes(); - } - Catch_(inErr) { - if ( newFilter != nil ) { - MSG_FilterError error = MSG_DestroyFilter(newFilter); - newFilter = nil; - Assert_(error == FilterError_Success); - } - Refresh(); - Throw_(inErr); - } - EndCatch_ -} - - -/*====================================================================================== - Duplicate selected filters. -======================================================================================*/ - -void CFiltersTableView::DuplicateFilter(void) { - SaveChangedFilterList(); - STableCell selectedCell = GetFirstSelectedCell(); - AssertFail_(IsValidCell(selectedCell)); - - AssertFail_(mFilterList != nil); - - MSG_Filter *newFilter = nil; - PostAction(nil); - - Try_ { - - Int32 newIndex = TABLE_TO_FILTER_INDEX(selectedCell.row); - - MSG_Filter *selectedFilter; - FailFiltersError(MSG_GetFilterAt(mFilterList, newIndex, &selectedFilter)); - AssertFail_(selectedFilter != nil); - - char *text; - FailFiltersError(MSG_GetFilterName(selectedFilter, &text)); - MSG_FilterType filterType; - FailFiltersError(MSG_GetFilterType(selectedFilter, &filterType)); - - // Contruct a new filter - FailFiltersError(MSG_CreateFilter(filterType, text, &newFilter)); - - FailFiltersError(MSG_GetFilterDesc(selectedFilter, &text)); - FailFiltersError(MSG_SetFilterDesc(newFilter, text)); - - XP_Bool isEnabled; - FailFiltersError(MSG_IsFilterEnabled(selectedFilter, &isEnabled)); - FailFiltersError(MSG_EnableFilter(newFilter, isEnabled)); - - MSG_Rule *selectedRule, *newRule; - FailFiltersError(MSG_GetFilterRule(selectedFilter, &selectedRule)); - FailFiltersError(MSG_GetFilterRule(newFilter, &newRule)); - - Int32 numTerms; - FailFiltersError(MSG_RuleGetNumTerms(selectedRule, &numTerms)); - - { - MSG_SearchAttribute attrib; - MSG_SearchOperator op; - MSG_SearchValue value; - XP_Bool boolOp; - SearchTextValueT searchText; - value.u.string = searchText.text; - - for (Int32 curTerm = 0; curTerm < numTerms; ++curTerm) { - - FailFiltersError(MSG_RuleGetTerm(selectedRule, curTerm, &attrib, - &op, &value, &boolOp, nil )); - FailFiltersError(MSG_RuleAddTerm(newRule, attrib, op, &value, boolOp, nil )); - } - } - - MSG_RuleActionType actionType; - void *actionValue; - FailFiltersError(MSG_RuleGetAction(selectedRule, &actionType, &actionValue)); - FailFiltersError(MSG_RuleSetAction(newRule, actionType, actionValue)); - - Int32 numFilters = GetBENumRows(); - - // Add the new filter to the end of the list (API doesn't let us do it any other way!) - FailFiltersError(MSG_SetFilterAt(mFilterList, numFilters, newFilter)); - newFilter = nil; - - // Move new filter into the correct position - ++newIndex; - if ( newIndex != numFilters ) BEMoveFilter(numFilters, newIndex, mFilterList); - - SaveChangedFilterList(++selectedCell.row); - InsertRows(1, selectedCell.row - 1, nil, 0, true); - ScrollCellIntoFrame(selectedCell); - SelectEditFilterName(selectedCell.row); - ((CMailFiltersWindow *) USearchHelper::GetPaneWindow(this))->RecalcMinMaxStdSizes(); - } - Catch_(inErr) { - if ( newFilter != nil ) { - MSG_FilterError error = MSG_DestroyFilter(newFilter); - newFilter = nil; - Assert_(error == FilterError_Success); - } - Refresh(); - Throw_(inErr); - } - EndCatch_ -} - - -/*====================================================================================== - Delete selected filters. -======================================================================================*/ - -void CFiltersTableView::DeleteFilter(void) { - - STableCell selectedCell = GetFirstSelectedCell(); -// AssertFail_(IsValidCell(selectedCell)); // don't assert: list can be empty - if (IsValidCell(selectedCell)) - { - CDeleteFilterAction *action = new CDeleteFilterAction(this, selectedCell.row); - FailNIL_(action); - - // Update our table - if ( (selectedCell.row == mRows) && (selectedCell.row > 1) ) { - --selectedCell.row; // Move up one cell - } - Boolean validNewCell = selectedCell.row != 0; - { - // Turn off listening if we have a valid cell so that we are not - // updated during an empty table selection - StValueChanger change(mIsListening, !validNewCell); - PostAction(action); - } - if ( validNewCell ) SelectScrollCell(selectedCell); - ((CMailFiltersWindow *) USearchHelper::GetPaneWindow(this))->RecalcMinMaxStdSizes(); - } -} - - -/*====================================================================================== - Insert the specified filter into the table. -======================================================================================*/ - -void CFiltersTableView::InsertFilterAt(TableIndexT inTableFilterRow, MSG_Filter *inFilter) { - - Int32 numFilters = GetBENumRows(); - - // Add the new filter to the end of the list (API doesn't let us do it any other way!) - FailFiltersError(MSG_SetFilterAt(mFilterList, numFilters, inFilter)); - - // Move new filter into the correct position - if ( TABLE_TO_FILTER_INDEX(inTableFilterRow) != numFilters ) { - BEMoveFilter(numFilters, TABLE_TO_FILTER_INDEX(inTableFilterRow), mFilterList); - } - SaveChangedFilterList(inTableFilterRow); - - InsertRows(1, inTableFilterRow - 1, nil, 0, true); - SelectScrollCell(STableCell(inTableFilterRow, 1)); -} - - -/*====================================================================================== - Insert the specified filter into the table. -======================================================================================*/ - -void CFiltersTableView::RemoveFilterAt(TableIndexT inTableFilterRow, MSG_Filter **outFilter) { - - MSG_Filter *filter = GetFilterAtRow(inTableFilterRow); - FailFiltersError(MSG_RemoveFilterAt(mFilterList, TABLE_TO_FILTER_INDEX(inTableFilterRow))); - SaveChangedFilterList(inTableFilterRow); - - RemoveRows(1, inTableFilterRow, true); - *outFilter = filter; -} - - -/*====================================================================================== - Move the row given by inCurrRow to the row given by inNewRow. If the row is selected, - it remains selected. -======================================================================================*/ - -void CFiltersTableView::RemoveRows(Uint32 inHowMany, TableIndexT inFromRow, Boolean inRefresh) { - - STableCell selectedCell = GetFirstSelectedCell(); - Boolean cellWasSelected = IsValidCell(selectedCell); - - LTableView::RemoveRows(inHowMany, inFromRow, inRefresh); - - if ( cellWasSelected ) { - selectedCell = GetFirstSelectedCell(); - if ( !IsValidCell(selectedCell) ) { - // Selected cell was removed! - if ( mEditFilterName->IsVisible() || (mEditFilterNameRow > 0) ) { - mEditFilterName->Hide(); - mEditFilterNameRow = 0; - } - SelectionChanged(); - } - } -} - - -/*====================================================================================== - Move the row given by inCurrRow to the row given by inNewRow. If the row is selected, - it remains selected. -======================================================================================*/ - -void CFiltersTableView::MoveRow(TableIndexT inCurrRow, TableIndexT inNewRow, Boolean inRefresh) { - - Assert_(IsValidRow(inCurrRow) && IsValidRow(inNewRow)); - if ( inCurrRow == inNewRow ) return; - - STableCell currCell(inCurrRow, 1); - Boolean isSelected = CellIsSelected(currCell); - - // Save any current filter modifications, since they will become invalid after the filter is moved - - BroadcastMessage(msg_SaveModifications); - - // Call BE to move the filter - - AssertFail_(mFilterList != nil); - BEMoveFilter(TABLE_TO_FILTER_INDEX(inCurrRow), TABLE_TO_FILTER_INDEX(inNewRow), mFilterList); - SaveChangedFilterList(); - - // Update our table - if ( isSelected ) { - // Hide selections from displaying - StVisRgn emptyVisRgn(GetMacPort()); - StopBroadcasting(); // Don't broadcast that the selection has changed, because it really hasn't - SelectCell(STableCell(inNewRow, 1)); - StartBroadcasting(); - } - - if ( inRefresh ) { - RefreshRowRange(inCurrRow, inNewRow); - } -} - - -/*====================================================================================== - Adjusts the Image so that it fits within the Frame. Get rid of the flicker! -======================================================================================*/ - -void CFiltersTableView::ReconcileFrameAndImage(Boolean /*inRefresh*/) { - - SPoint32 oldScrollPos; - GetScrollPosition(oldScrollPos); - - LTableView::ReconcileFrameAndImage(false); - - SPoint32 newScrollPos; - GetScrollPosition(newScrollPos); - - if ( ((newScrollPos.v != oldScrollPos.v) || (newScrollPos.h != oldScrollPos.h)) ) { - Refresh(); - } -} - - -/*====================================================================================== - Setup the helpers for the table. -======================================================================================*/ - -void CFiltersTableView::SetUpTableHelpers(void) { - - // Add helpers - - LFlexTableGeometry *geometry = new LFlexTableGeometry(this, mTableHeader); - FailNIL_(geometry); - SetTableGeometry(geometry); - - //CFilterTableSelector *selector = new LTableRowSelector(this); - // FailNIL_(selector); - SetTableSelector(new LTableRowSelector(this, false)); - - CFilterTableKeyAttachment *ketAttachment = new CFilterTableKeyAttachment(this); - FailNIL_(ketAttachment); - AddAttachment(ketAttachment); -} - - -/*====================================================================================== - Draw the cell. -======================================================================================*/ - -void CFiltersTableView::DrawCellContents(const STableCell &inCell, const Rect &inLocalRect) -{ - - CStr255 displayText; - ResIDT iconID; - Int16 horizJustType; - GetDisplayData(inCell, &displayText, &horizJustType, &iconID); - - Rect cellDrawFrame; - - if ( iconID != 0 ) - { - ::SetRect(&cellDrawFrame, 0, 0, cSmallIconWidth, cSmallIconHeight); - UGraphicGizmos::CenterRectOnRect(cellDrawFrame, inLocalRect); - ::PlotIconID(&cellDrawFrame, ttNone, ttNone, iconID); - } else - { - cellDrawFrame = inLocalRect; - ::InsetRect(&cellDrawFrame, cColTextHMargin, 0); // For a nicer look between cells - if ( displayText.Length() > 0 ) - { - UGraphicGizmos::PlaceTextInRect((char *) &displayText[1], displayText[0], - cellDrawFrame, horizJustType, teCenter, - &mTextFontInfo, true, truncMiddle); - } - } -} - - -/*====================================================================================== - Adjust a cell's cursor. -======================================================================================*/ - -void CFiltersTableView::AdjustCursorSelf(Point inPortPt, const EventRecord &inMacEvent) { - - EMouseTableLocation location = GetMouseTableLocation(inPortPt); - - switch ( location ) { -// case eInEnabledCheck: -// TrySetCursor(cEnabledCheckCursorID); -// break; - case eInTitle: - TrySetCursor(iBeamCursor); - break; - case eInCellContent: - TrySetCursor(cHandOpenCursorID); - break; - default: - LTableView::AdjustCursorSelf(inPortPt, inMacEvent); - break; - } -} - - -/*====================================================================================== - Adjust selection in response to a click in the specified cell. -======================================================================================*/ - -Boolean CFiltersTableView::ClickSelect(const STableCell &inCell, const SMouseDownEvent &inMouseDown) { - - Rect localClickRect; - - EMouseTableLocation location = GetMouseTableLocation(inMouseDown.wherePort, &localClickRect); - - switch ( location ) { - case eInEnabledCheck: - ToggleFilterEnabled(inCell.row, &localClickRect); - return false; - case eInTitle: { - SMouseDownEvent mouseEvent = inMouseDown; - SwitchEditFilterName(inCell.row, &localClickRect, nil, &mouseEvent); - } - return false; - default: - LCommander::SwitchTarget(this); - break; - } - - return LTableView::ClickSelect(inCell, inMouseDown); -} - - -/*====================================================================================== - Click the cell. -======================================================================================*/ - -void CFiltersTableView::ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown) { - - if ( LPane::GetClickCount() == 2 ) { - - BroadcastMessage(msg_DoubleClickCell); - - } else if ( mRows > 1 ) { - - CTableRowDragger dragger(inCell.row); - - SPoint32 startMouseImagePt; - LocalToImagePoint(inMouseDown.whereLocal, startMouseImagePt); - - // Restrict dragging to a thin vertical column the height of the image - - LImageRect dragPinRect; - { - Int32 left, top, right, bottom; - GetImageCellBounds(inCell, left, top, right, bottom); - dragPinRect.Set(startMouseImagePt.h, startMouseImagePt.v - top, startMouseImagePt.h, - mImageSize.height - (bottom - startMouseImagePt.v) + 1); - } - - TrySetCursor(cHandClosedCursorID); - dragger.DoTrackMouse(this, &startMouseImagePt, &dragPinRect, 2, 2); - - TableIndexT newRow = dragger.GetDraggedRow(); - - if ( newRow ) { - CMoveFilterAction *action = new CMoveFilterAction(this, inCell.row, newRow); - FailNIL_(action); - PostAction(action); - } - } -} - - -/*====================================================================================== - Determine if the mouse location is in the enabled check box. -======================================================================================*/ - -CFiltersTableView::EMouseTableLocation CFiltersTableView::GetMouseTableLocation(Point inPortPt, - Rect *outLocationRect) { - - PortToLocalPoint(inPortPt); - SPoint32 imagePoint; - LocalToImagePoint(inPortPt, imagePoint); - STableCell hitCell; -// Rect localCellRect; - - EMouseTableLocation rtnVal = eInNone; - - if ( GetCellHitBy(imagePoint, hitCell) ) { - - const PaneIDT colType = GetCellDataType(hitCell); - - switch ( colType ) { - - case paneID_OrderCaption: - rtnVal = eInCellContent; - break; - - case paneID_NameCaption: { - Rect checkRect; - GetFilterTitleRect(hitCell.row, &checkRect); - if ( ::PtInRect(inPortPt, &checkRect) ) { - if ( outLocationRect != nil ) *outLocationRect = checkRect; - rtnVal = eInTitle; - } else { - rtnVal = eInCellContent; - } - } - break; - - case paneID_EnabledCaption: - if ( outLocationRect ) { - Rect localCellRect; - GetLocalCellRect(hitCell, localCellRect); - ::SetRect(outLocationRect, 0, 0, cSmallIconWidth, cSmallIconHeight); - UGraphicGizmos::CenterRectOnRect(*outLocationRect, localCellRect); - } - rtnVal = eInEnabledCheck; - break; - - default: - Assert_(false); // Should never get here! - break; - } - } - - return rtnVal; -} - - -/*====================================================================================== - Get the rect bounding the specified filter's title. -======================================================================================*/ - -void CFiltersTableView::GetFilterTitleRect(TableIndexT inRow, Rect *outTitleRect, - CStr255* /*outNameString*/) { - - STableCell filterCell(inRow, mTableHeader->ColumnFromID(paneID_NameCaption)); - - Assert_(IsValidCell(filterCell)); - - GetLocalCellRect(filterCell, *outTitleRect); - ::InsetRect(outTitleRect, cColTextHMargin, 0); - - GetSuperView()->EstablishPort(); - UTextTraits::SetPortTextTraits(mTextTraitsID); - - ::InsetRect(outTitleRect, -CInlineEditField::cEditBoxMargin, 0); -} - - -/*====================================================================================== - Switch the current filter name being edited. -======================================================================================*/ - -void CFiltersTableView::SwitchEditFilterName(TableIndexT inRow, const Rect *inNameLocalFrame, - CStr255 *inNameString, SMouseDownEvent *ioMouseDown) { - - UpdateFilterNameChanged(); - - if ( inRow != 0 ) { - mEditFilterNameRow = -inRow; - - SPoint32 imagePoint; - LocalToImagePoint(topLeft(*inNameLocalFrame), imagePoint); - imagePoint.h -= 1; imagePoint.v += 1; - - LCommander::SwitchTarget(mEditFilterName); - - StopBroadcasting(); // Don't broadcast that the selection has changed until we update the edit field - SelectCell(STableCell(inRow, 1)); - StartBroadcasting(); - - CStr255 nameString; - if ( inNameString == nil ) { - inNameString = &nameString; - GetFilterNameAtRow(inRow, inNameString); - } - - mEditFilterName->UpdateEdit(*inNameString, &imagePoint, ioMouseDown); - - SelectionChanged(); - } -} - - -/*====================================================================================== - If the filter name has changed, update the filter name in the filter list. -======================================================================================*/ - -void CFiltersTableView::UpdateFilterNameChanged(void) { - - if ( mEditFilterName->IsVisible() || mEditFilterNameRow > 0 ) { - // Filter is currently being edited - TableIndexT row = mEditFilterNameRow < 0 ? -mEditFilterNameRow : mEditFilterNameRow; - CStr255 name; - mEditFilterName->GetDescriptor(name); - SetFilterNameAtRow(row, &name); - SaveChangedFilterList(row); - } -} - - -/*====================================================================================== - Select the filter's name for editing. -======================================================================================*/ - -void CFiltersTableView::SelectEditFilterName(TableIndexT inRow) { - - Rect titleRect; - CStr255 nameString; - GetFilterTitleRect(inRow, &titleRect, &nameString); - SwitchEditFilterName(inRow, &titleRect, &nameString, nil); -} - - -/*====================================================================================== - Delete all selected items. -======================================================================================*/ - -void CFiltersTableView::DeleteSelection(void) { - - BroadcastMessage(msg_DeleteCell); -} - - -/*====================================================================================== - Get the display data for the specified cell. -======================================================================================*/ - -void CFiltersTableView::GetDisplayData(const STableCell &inCell, CStr255 *outDisplayText, - Int16 *outHorizJustType, ResIDT *outIconID) { - - const PaneIDT colType = GetCellDataType(inCell); - - *outDisplayText = CStr255::sEmptyString; - *outIconID = 0; - - switch ( colType ) { - - case paneID_OrderCaption: { - Str15 numString; - ::NumToString(inCell.row, numString); - *outDisplayText = numString; - *outHorizJustType = /*teFlushRight*/teCenter; - } - break; - - case paneID_NameCaption: { - if ( inCell.row != ABS_VAL(mEditFilterNameRow) ) { - GetFilterNameAtRow(inCell.row, outDisplayText); - *outHorizJustType = teFlushLeft; - } - } - break; - - case paneID_EnabledCaption: { - if ( GetFilterEnabledAtRow(inCell.row) ) { - *outIconID = kEnabledCheckIconID; - } else { - *outIconID = kDisabledCheckIconID; - } - } - break; - - default: - Assert_(false); // Should never get here! - break; - } -} - - -/*====================================================================================== - Toggle the enabled setting of the filter at the specified row. -======================================================================================*/ - -void CFiltersTableView::ToggleFilterEnabled(TableIndexT inRow, Rect *inLocalIconRect) { - - Boolean doEnable = !GetFilterEnabledAtRow(inRow); - SetFilterEnabledAtRow(inRow, doEnable); - - if ( doEnable ) { - if ( FocusExposed() ) { - ::PlotIconID(inLocalIconRect, ttNone, ttNone, kEnabledCheckIconID); - } - } else { - LocalToPortPoint(topLeft(*inLocalIconRect)); - LocalToPortPoint(botRight(*inLocalIconRect)); - InvalPortRect(inLocalIconRect); - UpdatePort(); - } - SaveChangedFilterList(inRow); -} - - -/*====================================================================================== - Set the enabled setting of the filter log. -======================================================================================*/ - -void CFiltersTableView::SetLogFilters(Boolean inDoLog) { - - Assert_(mFilterList != nil); - Boolean isEnabled = MSG_IsLoggingEnabled(mFilterList) ? true : false; - if ( isEnabled != inDoLog ) { - FailFiltersError(MSG_EnableLogging(mFilterList, inDoLog)); - SaveChangedFilterList(); - } -} - - -/*====================================================================================== - Remove the specified filter from the list and delete it. -======================================================================================*/ - -void CFiltersTableView::BEDeleteFilter(Int32 inFilterIndex, MSG_FilterList *ioFilterList) { - - // Remove and delete the old edit filter - MSG_Filter *filter = nil; - FailFiltersError(MSG_GetFilterAt(ioFilterList, inFilterIndex, &filter)); - AssertFail_(filter != nil); - FailFiltersError(MSG_RemoveFilterAt(ioFilterList, inFilterIndex)); - FailFiltersError(MSG_DestroyFilter(filter)); -} - - -/*====================================================================================== - Remove the specified filter from the list and delete it. -======================================================================================*/ - -void CFiltersTableView::BEMoveFilter(Int32 inFromIndex, Int32 inToIndex, MSG_FilterList *ioFilterList) { - - AssertFail_(inFromIndex != inToIndex); - - Int32 increment = (inFromIndex > inToIndex) ? -1 : 1; - MSG_FilterMotion motion = (increment < 0) ? filterUp : filterDown; - - for (Int32 curRow = inFromIndex; curRow != inToIndex; curRow += increment) { - FailFiltersError(MSG_MoveFilterAt(ioFilterList, curRow, motion)); - } -} - - -/*====================================================================================== - Raise a relevant exception if MSG_SearchError is not SearchError_Success. -======================================================================================*/ - -void CFiltersTableView::FailFiltersError(MSG_FilterError inError) { - - if ( inError == FilterError_Success ) return; - - switch ( inError ) { - - case FilterError_OutOfMemory: - Throw_(memFullErr); - break; - - case FilterError_NotImplemented: { -#ifdef Debug_Signal - CStr255 errorString; - USearchHelper::AssignUString(uStr_FilterFunctionNotImplemented, errorString); - ErrorManager::PlainAlert((StringPtr) errorString); -#endif // Debug_Signal - Throw_(unimpErr); - } - break; - - case FilterError_InvalidVersion: - case FilterError_InvalidIndex: - case FilterError_InvalidMotion: - case FilterError_InvalidFilterType: - case FilterError_NullPointer: - case FilterError_NotRule: - case FilterError_NotScript: - case FilterError_SearchError: { -#ifdef Debug_Signal - CStr255 errorString; - USearchHelper::AssignUString(uStr_FilterFunctionParamError, errorString); - ErrorManager::PlainAlert((StringPtr) errorString); -#endif // Debug_Signal - Throw_(paramErr); - } - break; - - case FilterError_FileError: - Throw_(ioErr); - break; - - default: - AssertFail_(false); - Throw_(32000); // Who knows? - break; - - } -} diff --git a/mozilla/cmd/macfe/MailNews/MailNewsFilters.h b/mozilla/cmd/macfe/MailNews/MailNewsFilters.h deleted file mode 100644 index 568f955d856..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsFilters.h +++ /dev/null @@ -1,63 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsFilters.h - -#pragma once - -/*====================================================================================== - DESCRIPTION: Defines classes related to the Mail & News search dialog. The search - dialog is really implemented as a normal window. -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class CFiltersWindowManager { - -public: - - static void RegisterFiltersClasses(void); - static void ShowFiltersWindow(void); - -private: - -}; - diff --git a/mozilla/cmd/macfe/MailNews/MailNewsSearch.cp b/mozilla/cmd/macfe/MailNews/MailNewsSearch.cp deleted file mode 100644 index af0603a53cb..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsSearch.cp +++ /dev/null @@ -1,96 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsSearch.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#define DEBUGGER_ASSERTIONS - -#include "MailNewsSearch.h" -#include "SearchHelpers.h" -#include "CDateView.h" -#include "CMessageSearchWindow.h" -#include "CSearchTableView.h" -#include "CCaption.h" -#include "CSingleTextColumn.h" -#include "CTSMEditField.h" -#include "URobustCreateWindow.h" -#include "LCommander.h" - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -//----------------------------------- -void CSearchWindowManager::RegisterSearchClasses() -// Register all classes associated with the search window. -//----------------------------------- -{ - - USearchHelper::RegisterClasses(); - CDateView::RegisterDateClasses(); - - RegisterClass_(CMessageSearchWindow); - - RegisterClass_(CSearchTableView); - RegisterClass_(CListenerCaption); - - RegisterClass_(LTableView); - RegisterClass_(CSingleTextColumn); - - -} // CSearchWindowManager::RegisterSearchClasses - -//----------------------------------- -void CSearchWindowManager::ShowSearchWindow() -// Show the search dialog by bringing it to the front if it is not already. Create it -// if needed. -//----------------------------------- -{ - - // Find out if the window is already around - CMessageSearchWindow *searchWindow = dynamic_cast( - CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_SearchMailNews)); - - if ( searchWindow == nil ) - { - // Search dialog has not yet been created, so create it here and display it. - searchWindow = dynamic_cast( - URobustCreateWindow::CreateWindow(CMessageSearchWindow::res_ID, - LCommander::GetTopCommander())); - } - - // Select the window - if (searchWindow) - { - // We set the scope of the search window only when the user issues the - // Search command. Previously, it was done on Activate and ReadWindowStatus. - searchWindow->SetUpBeforeSelecting(); - searchWindow->Select(); - } -} // CSearchWindowManager::ShowSearchWindow - - - - diff --git a/mozilla/cmd/macfe/MailNews/MailNewsSearch.h b/mozilla/cmd/macfe/MailNews/MailNewsSearch.h deleted file mode 100644 index adb7bf8a5ab..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsSearch.h +++ /dev/null @@ -1,39 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsSearch.h - -#pragma once - -#define NOLDAPWINDOW -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class CSearchWindowManager { - -public: - - static void RegisterSearchClasses(void); - static void ShowSearchWindow(void); - -private: - -}; diff --git a/mozilla/cmd/macfe/MailNews/MailNewsgroupWindow_Defines.h b/mozilla/cmd/macfe/MailNews/MailNewsgroupWindow_Defines.h deleted file mode 100644 index 5ea41c0205e..00000000000 --- a/mozilla/cmd/macfe/MailNews/MailNewsgroupWindow_Defines.h +++ /dev/null @@ -1,275 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// MailNewsgroupWindow_Defines.h - -#pragma once - -// ID space -// -// All resources and cmd#s should fall within this range -// -// Mail/Newsgroups 10500-10999 - - -// Menu ResIDs -enum -{ - kMailNewsViewMenuID = 10500 -, kMailNewsMessageMenuID = 10501 -, kMailNewsFolderMenuID = 10502 -, kMailMenuID = 10503 -}; - - -//----------------------------------- -// COMMAND #s -// There are more command numbers in MailNewsGUI.h -//----------------------------------- -enum -{ - // these require messages to be selected -// cmd_OpenMailMessage = cmd_Open - cmd_OpenMailMessage = 10500 -//, cmd_DeleteMessage = 10500 // NO. Use cmd_Clear -, cmd_ReplyToSender = 10510 -, cmd_ReplyToAll = 10511 -, cmd_ForwardMessage = 10512 -, cmd_ForwardMessageQuoted = 10513 -, cmd_AddSenderToAddressBook = 10514 -, cmd_AddAllToAddressBook = 10515 -, cmd_MarkRead = 10516 -, cmd_MarkUnread = 10517 -, cmd_ForwardMessageAttachment = 10518 -, cmd_ForwardMessageInline = 10519 - -// these require folders to be selected -//, cmd_DeleteFolder = 10501 // No. Use cmd_Clear -, cmd_RenameFolder = 10520 - - - // these do not require a selection -//, cmd_NewMailMessage = cmd_New -, cmd_NewMailMessage = 10530 - -, cmd_EmptyTrash = 10531 -, cmd_MailFilters = 10532 -, cmd_NextMessage = 10534 -, cmd_NextUnreadMessage = 10535 -, cmd_PreviousMessage = 10536 - - -, cmd_FirstSortCommand = 10537 -, cmd_SortByDate = 10537 -, cmd_SortBySubject = 10538 -, cmd_SortBySender = 10539 -, cmd_SortByThread = 10540 -, cmd_SortByPriority = 10541 -, cmd_SortBySize = 10542 -, cmd_SortByStatus = 10543 -, cmd_SortByLocation = 10544 -, cmd_SortByFlagged = 10545 -, cmd_SortByReadness = 10546 -, cmd_SortByOrderReceived = 10547 // note new item here, and changed IDs below -, cmd_SortAscending = 10548 -, cmd_SortDescending = 10549 -, cmd_LastSortCommand = cmd_SortByReadness - -, cmd_MarkReadByDate = 10550 -, cmd_MarkReadForLater = 10551 - -, cmd_NewsGroups = 10701 // Show folder window with news selected -, cmd_ToolbarMode = 0 // ¥¥¥ FIX ME: common!! advanced <-> novice -, cmd_SendOutboxMail = 10702 // ¥¥¥ Message Menu - -, cmd_CloseAll = 10703 - -, cmd_NextUnreadGroup = 10704 -, cmd_NextFolder = 10705 -, cmd_FirstFlagged = 10706 -, cmd_PreviousFlagged = 10707 -, cmd_NextFlagged = 10708 -, cmd_NextUnreadThread = 10709 - -, cmd_SendMessage = 10610 -, cmd_QuoteMessage = 10611 -, cmd_SendMessageLater = 10612 -, cmd_SaveDraft = 10613 - -, cmd_CopyMailMessages = 10614 //ioParam = (char *), BE name of filing folder -, cmd_MoveMailMessages = 10615 //ioParam = (char *), BE name of filing folder - -, cmd_ViewAllThreads = 10616 -, cmd_ViewKilledThreads = 10617 -, cmd_ViewThreadsWithNew = 10618 -, cmd_ViewWatchedThreadsWithNew= 10619 -, cmd_ViewNewOnly = 10620 - -, cmd_ToggleThreadWatched = 10621 -, cmd_ToggleThreadKilled = 10622 - -, cmd_AttachmentsInline = 10623 -, cmd_AttachmentsAsLinks = 10624 - -, cmd_SearchAddresses = 10627 // LDAP address search - -, cmd_ToggleOffline = 10628 // Go Offline/Go Online -, cmd_SelectForOffline = 10629 -, cmd_FlaggedForOffline = 10630 -, cmd_SynchronizeForOffline = 10631 - -, cmd_ToggleFolderPane = 10635 -, cmd_SaveTemplate = 10636 - -, cmd_RelocateViewToFolder= 'MfPM' // same as the class ID of the button that does it. - -, cmd_NewsFirst = 14000 // Subscribe window -, cmd_NewsToggleSubscribe = cmd_NewsFirst+0 -, cmd_NewsExpandGroup = cmd_NewsFirst+1 -, cmd_NewsExpandAll = cmd_NewsFirst+2 -, cmd_NewsCollapseGroup = cmd_NewsFirst+3 -, cmd_NewsCollapseAll = cmd_NewsFirst+4 -, cmd_NewsGetGroups = cmd_NewsFirst+5 -, cmd_NewsSearch = cmd_NewsFirst+6 -, cmd_NewsGetNew = cmd_NewsFirst+7 -, cmd_NewsClearNew = cmd_NewsFirst+8 -, cmd_NewsHostChanged = cmd_NewsFirst+9 -, cmd_NewsSetSubscribe = cmd_NewsFirst+10 -, cmd_NewsClearSubscribe = cmd_NewsFirst+11 -}; - -// String stuff for menus that change -enum -{ - kMailNewsMenuStrings = 10500 -, kOpenFolderStrID = 1 -, kOpenDiscussionStrID -, kOpenMessageStrID -, kOpenMailServerStrID -, kOpenNewsServerStrID -, kNextChunkMessagesStrID -}; - - - - -// -// Window PPob IDs -// -enum -{ - kMailNewsWindowPPob = 10500 -, kMailMessageWindowPPob = 10506 -, kNewsgroupWindowPPob = 10507 - -, kRenameFolderDialogPPob = 10510 -, kNewFolderDialogPPob = 10511 - -, kMailComposeWindowPPob = 10610 -}; - - -// MailNews window pane ID's -enum -{ - kMailNewsTabSwitcherPaneID = 'TbSw' -, kMailNewsTabContainerPaneID = 'Cont' -, kMailNewsStatusPaneID = 'Stat' -, kOfflineButtonPaneID = 'SBof' -}; - -// -// Tab IDs -// -// The message ID's associated with each tab. -// -// Independent of tab-order. -// -// These also match the ppob id's of each view -// - -enum -{ - kInboxTabID = 10501 -, kDraftsTabID = 10502 -, kOutboxTabID = 10503 -, kFiledMailTabID = 10504 -, kNewsgroupsTabID = 10505 -}; - -// -// Table Column IDs -// -// The column header panes must have these id's -// -enum -{ - /* CThreadView */ - kMarkedReadMessageColumn = 'Read' -, kThreadMessageColumn = 'Thrd' // also used for Icon column in dir. search results -, kSubjectMessageColumn = 'Subj' -, kSenderMessageColumn = 'Sndr' -, kAddresseeMessageColumn = 'SdTo' -, kDateMessageColumn = 'Date' -, kPriorityMessageColumn = 'Prio' -, kSizeMessageColumn = 'Size' -, kUnreadMessageColumn = 'Unrd' -, kStatusMessageColumn = 'Stus' -, kTotalMessageColumn = 'Totl' -, kFlagMessageColumn = 'Flag' -, kHiddenOrderReceivedColumn = 'Rcvd' - - /* CMessageFolderView */ -, kFolderNameColumn = 'FNam' -, kFolderNumUnreadColumn = 'NumU' -, kFolderNumTotalColumn = 'NumT' - - /* COfflinePickerView */ -, kSelectFolderColumn = 'SelF' - - /* CSubscribeView */ -, kNewsgroupNameColumn = 'NuNm' -, kNewsgroupSubscribedColumn = 'NuSb' -, kNewsgroupPostingsColumn = 'NuPo' - - - /* CSearchTableView */ -, kStatusMessageLocation = 'Loca' -, kNameEntryColumn = 'Name' -, kEmailEntryColumn = 'Emal' -, kCompanyEntryColumn = 'Comp' -, kCityEntryColumn = 'City' -, kPhoneEntryColumn = 'Phon' -}; - -// -// ID#s of 'Cols' resources, for saving the column -// positions of the various table views... -// -enum -{ - kSavedInboxColumnStateID = 10501, - kSavedDraftsColumnStateID = 10502, - kSavedOutboxColumnStateID = 10503, - kSavedFiledMailColumnStateID = 10504, - kSavedFiledMailFolderColumnStateID = 10506, - - kSavedNewsgroupColumnStateID = 10505 -}; diff --git a/mozilla/cmd/macfe/MailNews/SearchHelpers.cp b/mozilla/cmd/macfe/MailNews/SearchHelpers.cp deleted file mode 100644 index c7114a14c75..00000000000 --- a/mozilla/cmd/macfe/MailNews/SearchHelpers.cp +++ /dev/null @@ -1,2021 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// SearchHelpers.cp - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#define DEBUGGER_ASSERTIONS - -#include "SearchHelpers.h" -#include "CMailFolderButtonPopup.h" -#include "uprefd.h" -#include "uerrmgr.h" -#include "CDeviceLoop.h" -#include "LTableViewHeader.h" -#include "UGraphicGizmos.h" -#include "PascalString.h" - -#include -#include -#include -#include -#include "UStClasses.h" -#include "CSearchManager.h" - -// BE stuff - -#define B3_SEARCH_API -#include "msg_srch.h" - - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - -static pascal void DoNothingStdRect(GrafVerb /*theVerb*/, Rect */*theRect*/) { } -static pascal void DoNothingStdRgn(GrafVerb /*theVerb*/, RgnHandle /*theRgn*/) { } -static pascal void ForgetRoutineDesc(UniversalProcPtr *routineDesc) { -#ifdef powerc // Only do for power pc - if ( *routineDesc ) - { - DisposeRoutineDescriptor(*routineDesc); - *routineDesc = nil; - } -#else // powerc // Only do for power pc - #pragma unused(routineDesc) -#endif // powerc -} - -static const Int16 cWindowDesktopMargin = 4; - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -CQDProcs USearchHelper::sStdProcs = { (QDTextUPP) -1L }; - -/*====================================================================================== - Register classes in this file. -======================================================================================*/ - -void USearchHelper::RegisterClasses() -{ - RegisterClass_(CFolderScopeGAPopup); - RegisterClass_(CFolderMoveGAPopup); - RegisterClass_(CSearchDateField); -} - -/*====================================================================================== - Find the specified dialog control. -======================================================================================*/ - -LControl *USearchHelper::FindViewControl(LView *inView, PaneIDT inID) -{ - LControl *theControl = dynamic_cast(inView->FindPaneByID(inID)); - AssertFail_(theControl != nil); - return theControl; -} - -/*====================================================================================== - Find the specified view subpane. -======================================================================================*/ - -LPane *USearchHelper::FindViewSubpane(LView *inView, PaneIDT inID) -{ - LPane *thePane = inView->FindPaneByID(inID); - AssertFail_(thePane != nil); - - return thePane; -} - -/*====================================================================================== - Find the specified view subpane. -======================================================================================*/ - -LView *USearchHelper::FindViewSubview(LView *inView, PaneIDT inID) -{ - LView *theView = dynamic_cast(inView->FindPaneByID(inID)); - AssertFail_(theView != nil); - - return theView; -} - - -/*====================================================================================== - Find the specified view edit field. -======================================================================================*/ - -LBroadcasterEditField *USearchHelper::FindViewEditField(LView *inView, PaneIDT inID) -{ - LBroadcasterEditField *theEditField = dynamic_cast(inView->FindPaneByID(inID)); - AssertFail_(theEditField != nil); - - return theEditField; -} - -/*====================================================================================== - Find the specified view popup menu. -======================================================================================*/ - -CFolderScopeGAPopup *USearchHelper::FindFolderScopePopup(LView *inView, PaneIDT inID) -{ - CFolderScopeGAPopup *thePopup = dynamic_cast(inView->FindPaneByID(inID)); - AssertFail_(thePopup != nil); - - return thePopup; -} - -CSearchPopupMenu *USearchHelper::FindSearchPopup(LView *inView, PaneIDT inID) -{ - CSearchPopupMenu *thePopup = dynamic_cast(inView->FindPaneByID(inID)); - AssertFail_(thePopup != nil); - - return thePopup; -} - -/*====================================================================================== - Find the specified date view. -======================================================================================*/ - -CSearchDateField *USearchHelper::FindViewDateField(LView *inView, PaneIDT inID) -{ - CSearchDateField *theDateField = dynamic_cast(inView->FindPaneByID(inID)); - AssertFail_(theDateField != nil); - - return theDateField; -} - -/*====================================================================================== - Get the window associated with the specified pane. -======================================================================================*/ - -LWindow *USearchHelper::GetPaneWindow(LPane *inPane) -{ - LWindow *theWindow = LWindow::FetchWindowObject(inPane->GetMacPort()); - AssertFail_(theWindow != nil); - - return theWindow; -} - -/*====================================================================================== - Find the first view subpane with the specified id if it is visible. -======================================================================================*/ - -LPane *USearchHelper::FindViewVisibleSubpane(LView *inView, PaneIDT inID) -{ - static LPane *sPane = nil; // Reduce recursive requirements - static LPane *sSub; - - if ( (inID == inView->GetPaneID()) && inView->IsVisible() ) - { - sPane = inView; - } else - { - // Search all subpanes - LArrayIterator iterator(inView->GetSubPanes(), LArrayIterator::from_Start); - while ( iterator.Next(&sSub) ) - { - LView *theView = dynamic_cast(sSub); - if ( theView != nil ) - { - sPane = FindViewVisibleSubpane(theView, inID); - } else if ( (inID == sSub->GetPaneID()) && sSub->IsVisible() ) - { - sPane = sSub; - break; - } - } - } - - return sPane; -} - - - - - -/*====================================================================================== - Find the tab group for the view. -======================================================================================*/ - -CSearchTabGroup *USearchHelper::FindWindowTabGroup(LArray *inSubcommanders) -{ - LArrayIterator iterator(*inSubcommanders); - LCommander *theSub; - CSearchTabGroup *theTabGroup = nil; - - while ( (theTabGroup == nil) && iterator.Next(&theSub) ) - { - theTabGroup = dynamic_cast(theSub); - } - - AssertFail_(theTabGroup != nil); - return theTabGroup; -} - - - - -/*====================================================================================== - Remove the size box area of the window from the visible region. This method should - be called at the end of the window's DrawSelf() method. -======================================================================================*/ - -void USearchHelper::RemoveSizeBoxFromVisRgn(LWindow *inWindow) -{ - Rect sizeBox; - RgnHandle visRgn = inWindow->GetMacPort()->visRgn; - - inWindow->CalcPortFrameRect(sizeBox); - sizeBox.left = sizeBox.right - 15; - sizeBox.top = sizeBox.bottom - 15; - - if ( ::RectInRgn(&sizeBox, visRgn) ) - { - StRegion diffRgn(sizeBox); - ::DiffRgn(visRgn, diffRgn, visRgn); - } -} - - -/*====================================================================================== - Refresh the specified port rect for the given pane. -======================================================================================*/ - -void USearchHelper::RefreshPortFrameRect(LPane *inPane, Rect *inPortRect) -{ - if ( !inPane->IsVisible() || (inPane->GetSuperView() == nil) ) return; - - Rect superRevealed; - inPane->GetSuperView()->GetRevealedRect(superRevealed); - if ( ::SectRect(inPortRect, &superRevealed, inPortRect) ) - { - inPane->InvalPortRect(inPortRect); - } -} - - -/*====================================================================================== - Refresh the specified local rect for the given pane. -======================================================================================*/ - -void USearchHelper::RefreshLocalFrameRect(LPane *inPane, Rect *inLocalRect) -{ - inPane->LocalToPortPoint(topLeft(*inLocalRect)); - inPane->LocalToPortPoint(botRight(*inLocalRect)); - - RefreshPortFrameRect(inPane, inLocalRect); -} - - -/*====================================================================================== - Link the specified listener to the any and all pane broadcasters within the view - specified by inContainer. -======================================================================================*/ - -void USearchHelper::LinkListenerToBroadcasters(LView *inContainer, LListener *inListener) -{ - // First, check out the container itself - - if ( (dynamic_cast(inContainer)) != inListener ) - { - LBroadcaster *broadcaster = dynamic_cast(inContainer); - if ( broadcaster != nil ) broadcaster->AddListener(inListener); - } - - // Iterate through all subviews - - LArrayIterator iterator(inContainer->GetSubPanes()); - - LPane *pane; - - while ( iterator.Next(&pane) ) - { - LView *view = dynamic_cast(pane); - if ( view != nil ) - { - LinkListenerToBroadcasters(view, inListener); - } else - { - LBroadcaster *broadcaster = dynamic_cast(pane); - if ( broadcaster != nil ) broadcaster->AddListener(inListener); - } - } -} - - -/*====================================================================================== - Get the length of the specified edit field text. -======================================================================================*/ - -Int16 USearchHelper::GetEditFieldLength(LEditField *inEditField) -{ - - return (**inEditField->GetMacTEH()).teLength; -} - - -/*====================================================================================== - Return a display name for the specified folder name. -======================================================================================*/ - -void USearchHelper::AssignUString(Int16 inStringIndex, CString& outString) -{ - ::GetIndString(outString, 8600, inStringIndex); -} - - -/*====================================================================================== - Enable or disable the specified button without redrawing it! -======================================================================================*/ - -void USearchHelper::EnableDisablePane(LPane *inPane, Boolean inEnable, Boolean inRefresh) -{ - Boolean isEnabled = inPane->IsEnabled(); - Boolean isVisible = inPane->IsVisible(); - - if ( isVisible && ((isEnabled && inEnable) || (!isEnabled && !inEnable)) ) return; - - if ( isVisible ) inPane->Hide(); - if ( inEnable ) - { - inPane->Enable(); - } else - { - inPane->Disable(); - } - if ( isVisible ) inPane->Show(); - if ( !inRefresh ) - { - inPane->DontRefresh(); - } -} - - -/*====================================================================================== - Show or hide the specified pane. -======================================================================================*/ - -void USearchHelper::ShowHidePane(LPane *inPane, Boolean inDoShow) -{ - if ( inDoShow ) - { - inPane->Show(); - } else - { - inPane->Hide(); - } -} - - -/*====================================================================================== - Handle a dialog Enter, Return, and Cancel keys. Return true if the key was - handled, false otherwise. -======================================================================================*/ - -Boolean USearchHelper::HandleDialogKey(LView *inView, const EventRecord &inKeyEvent) -{ - Int16 theKey = inKeyEvent.message & charCodeMask; - - if ( ((theKey == char_Enter) || (theKey == char_Return)) ) - { - - USearchHelper::FindViewControl(inView, paneID_Okay)->SimulateHotSpotClick(kControlButtonPart); - return true; - } else if ( (((theKey == char_Escape) && ((inKeyEvent.message & keyCodeMask) == vkey_Escape)) || - UKeyFilters::IsCmdPeriod(inKeyEvent)) ) -{ - - USearchHelper::FindViewControl(inView, paneID_Cancel)->SimulateHotSpotClick(kControlButtonPart); - return true; - } - - return false; -} - - -/*====================================================================================== - Set the descriptor for the pane if it is different from the current descriptor. -======================================================================================*/ - -void USearchHelper::SetPaneDescriptor(LPane *inPane, const CStr255& inDescriptor) -{ - CStr255 currentDesc; - inPane->GetDescriptor(currentDesc); - - if ( currentDesc != inDescriptor ) - { - inPane->SetDescriptor(inDescriptor); - } -} - - -/*====================================================================================== - Set the default status of the specified button. -======================================================================================*/ - -void USearchHelper::SetDefaultButton(LView *inView, PaneIDT inID, Boolean inIsDefault) -{ - LControl *theControl = USearchHelper::FindViewControl(inView, inID); - LGAPushButton *pushButton = dynamic_cast(theControl); - Assert_(pushButton != nil); - - if ( pushButton != nil ) pushButton->SetDefaultButton(inIsDefault, true); -} - - -/*====================================================================================== - If the specified edit field is not already the target, select its text and make it - the current target. -======================================================================================*/ - -void USearchHelper::SelectEditField(LEditField *inEditField) -{ - if ( !inEditField->IsTarget() && inEditField->IsVisible() && - LCommander::SwitchTarget(inEditField) ) { // Become the current target - { - StExcludeVisibleRgn emptyRgn(inEditField); - inEditField->SelectAll(); // Select all text - } - inEditField->Refresh(); - } -} - - -/*====================================================================================== - If the specified date view is not already the target, select its text and make it - the current target. -======================================================================================*/ - -void USearchHelper::SelectDateView(CDateView *inDateView) -{ - if ( !inDateView->ContainsTarget() && inDateView->IsVisible() ) { // Become the current target - { - StExcludeVisibleRgn emptyRgn(inDateView); - inDateView->Select(); - } - inDateView->Refresh(); - } -} - - -/*====================================================================================== - Determine if the last clicked pane interacted with the user in some way (return true) - or if the last click was just a dead click. -======================================================================================*/ - -Boolean USearchHelper::LastPaneWasActiveClickPane() -{ - LPane *lastPane = LPane::GetLastPaneClicked(); - - if ( lastPane == nil ) return false; - - // Check for any control - void *result = dynamic_cast(lastPane); - - if ( result == nil ) - { - // Check for commander - result = dynamic_cast(lastPane); - } - - return (result != nil); -} - - -/*====================================================================================== - Recalculate the bounds for the window based upon increment amounts for changing the - window's size. Make sure that the new window size will not extend beyond the - desktop bounds. Note that this method does NOT check against the min/max size for - the window, just as the LWindow::DoSetBounds() doesn't. The inSizeBoxLeft and - inSizeBoxTop parameters represent the distance between the bottom, right of the - window and the top, left corner of the size box (always >= 0). -======================================================================================*/ - -void USearchHelper::CalcDiscreteWindowResizing(LWindow *inWindow, Rect *ioNewBounds, - const Int16 inHIncrement, const Int16 inVIncrement, - Boolean inCheckDesktop, Int16 inSizeBoxLeft, - Int16 inSizeBoxTop) -{ - Rect currentBounds, minMaxSizes; - - CSaveWindowStatus::GetPaneGlobalBounds(inWindow, ¤tBounds); - inWindow->GetMinMaxSize(minMaxSizes); - - Assert_((inSizeBoxLeft >= 0) && (inSizeBoxTop >= 0)); - const Int16 curHeight = currentBounds.bottom - currentBounds.top; - const Int16 curWidth = currentBounds.right - currentBounds.left; - const Int16 vResizeAmount = ioNewBounds->bottom - ioNewBounds->top - curHeight; - const Int16 hResizeAmount = ioNewBounds->right - ioNewBounds->left - curWidth; - - if ( (vResizeAmount != 0) || (hResizeAmount != 0) ) - { - Int16 vDelta = vResizeAmount % inVIncrement; - Int16 hDelta = hResizeAmount % inHIncrement; - Int16 vResize = vResizeAmount, hResize = hResizeAmount; - - if ( vDelta != 0 ) - { - if ( vDelta < 0 ) vDelta = -vDelta; - vDelta = ((vDelta > (inVIncrement>>1)) ? inVIncrement - vDelta : -vDelta); - vResize += (vResizeAmount < 0) ? -vDelta : vDelta; - } - if ( hDelta != 0 ) - { - if ( hDelta < 0 ) hDelta = -vDelta; - hDelta = ((hDelta > (inVIncrement>>1)) ? inHIncrement - hDelta : -hDelta); - hResize += (hResizeAmount < 0) ? -hDelta : hDelta; - } - - AssertFail_(!(vResize % inVIncrement)); // Should be integral - AssertFail_(!(hResize % inHIncrement)); // Should be integral - - if ( inCheckDesktop ) - { - // Make sure we don't extend beyond the bounds of the desktop - Point desktopBotRight = botRight((**(::GetGrayRgn())).rgnBBox); - if ( (vResize > 0) && - (currentBounds.bottom + vResize + cWindowDesktopMargin - inSizeBoxTop) > desktopBotRight.v ) - { - vResize -= inVIncrement; - } - if ( (hResize > 0) && - (currentBounds.right + hResize + cWindowDesktopMargin - inSizeBoxLeft) > desktopBotRight.h ) - { - hResize -= inHIncrement; - } - } - - ioNewBounds->bottom = ioNewBounds->top + curHeight + vResize; - ioNewBounds->right = ioNewBounds->left + curWidth + hResize; - - // Check against min/max sizes - - Int16 newHeight = ioNewBounds->bottom - ioNewBounds->top; - Int16 newWidth = ioNewBounds->right - ioNewBounds->left; - - if ( newHeight < minMaxSizes.top ) - { - ioNewBounds->bottom += inVIncrement; - } else if ( newHeight > minMaxSizes.bottom ) - { - ioNewBounds->bottom -= inVIncrement; - } - if ( newWidth < minMaxSizes.left ) - { - ioNewBounds->right += inHIncrement; - } else if ( newWidth > minMaxSizes.right ) - { - ioNewBounds->right -= inHIncrement; - } - } -} - -/*====================================================================================== - Scroll the views bit without redrawing the update region with the window's background - color. -======================================================================================*/ - -void USearchHelper::ScrollViewBits(LView *inView, Int32 inLeftDelta, Int32 inTopDelta) -{ - if ( !inView->FocusDraw() ) return; - - if ( sStdProcs.textProc == ((QDTextUPP) -1L) ) - { - SetStdCProcs(&sStdProcs); - sStdProcs.rectProc = NewQDRectProc(DoNothingStdRect); - sStdProcs.rgnProc = NewQDRgnProc(DoNothingStdRgn); - if ( !sStdProcs.rectProc || !sStdProcs.rgnProc ) - { - ForgetRoutineDesc((UniversalProcPtr *) &sStdProcs.rectProc); - ForgetRoutineDesc((UniversalProcPtr *) &sStdProcs.rgnProc); - sStdProcs.textProc = (QDTextUPP) -1L; - FailOSErr_(memFullErr); - } - } - - Rect frame; - Point offset; - - // Get Frame in Port coords - inView->GetRevealedRect(frame); - offset = topLeft(frame); - inView->PortToLocalPoint(topLeft(frame)); - inView->PortToLocalPoint(botRight(frame)); - offset.h = offset.h - frame.left; - offset.v = offset.v - frame.top; - - // Scroll Frame, clipping to the update region - RgnHandle updateRgnH = NewRgn(); - - GrafPtr currentPort = UQDGlobals::GetCurrentPort(); - - if ( currentPort->grafProcs ) - { - QDRectUPP saveStdRect = currentPort->grafProcs->rectProc; - QDRgnUPP saveStdRgn = currentPort->grafProcs->rgnProc; - currentPort->grafProcs->rectProc = sStdProcs.rectProc; - currentPort->grafProcs->rgnProc = sStdProcs.rgnProc; - ::ScrollRect(&frame, -inLeftDelta, -inTopDelta, updateRgnH); - currentPort->grafProcs->rectProc = saveStdRect; - currentPort->grafProcs->rgnProc = saveStdRgn; - } else - { - QDProcsPtr saveProcs = currentPort->grafProcs; - currentPort->grafProcs = (QDProcsPtr) &sStdProcs; - ::ScrollRect(&frame, -inLeftDelta, -inTopDelta, updateRgnH); - currentPort->grafProcs = saveProcs; - } - - // Force redraw of update region - ::OffsetRgn(updateRgnH, offset.h, offset.v); - inView->InvalPortRgn(updateRgnH); - ::DisposeRgn(updateRgnH); -} - - -/*====================================================================================== - KeyIsDown - - Determine whether or not the specified key is being pressed. Keys are specified by - hardware-specific key scan code (NOT the character). See PP_KeyCodes.h. -======================================================================================*/ - -Boolean USearchHelper::KeyIsDown(Int16 inKeyCode) -{ - KeyMap theKeys; - - ::GetKeys(theKeys); - - return (::BitTst(((char *) &theKeys) + inKeyCode / 8, (long) 7 - (inKeyCode % 8))); -} - - -/*====================================================================================== - Show a generic exception alert. -======================================================================================*/ - -void USearchHelper::GenericExceptionAlert(OSErr inErr) -{ - CStr255 errorString; - CStr31 numString; - ::NumToString(inErr, numString); - USearchHelper::AssignUString(uStr_ExceptionErrorOccurred, errorString); - ::StringParamText(errorString, numString); - ::SetCursor(&qd.arrow); - ErrorManager::PlainAlert((StringPtr) errorString); - ::HiliteMenu(0); -} - - -#ifdef NOT_YET -/*====================================================================================== - Return a display name for the specified folder name. -======================================================================================*/ - -LStr255 *USearchHelper::GetFolderDisplayName(const char *inFolderName, - LStr255 *outFolderName) -{ - outFolderName->Assign(inFolderName); - P2CStr(((StringPtr) *outFolderName)); - NET_UnEscape((char *) ((StringPtr) *outFolderName)); - C2PStr((char *) ((StringPtr) *outFolderName)); - return outFolderName; -} - - -#endif // NOT_YET - - -#pragma mark - - -//----------------------------------- -CSearchPopupMenu::CSearchPopupMenu(LStream *inStream) : - CGAIconPopup(inStream), mCommands(sizeof(CommandT)), - mLastPopulateID(0), mDefaultItem(1), mOldValue( 1 ) -//----------------------------------- -{ -} - -//----------------------------------- -CommandT -CSearchPopupMenu::GetOldItemCommand() const -//----------------------------------- -{ - return mOldValue; -} - -//----------------------------------- -void CSearchPopupMenu::PopulateMenu(MSG_SearchMenuItem *inMenuItems, const Int16 inNumItems, - CommandT inNewCommandIfInvalid, UInt32 inPopulateID) -// Populate the menu with the specified items. The strings in inMenuItems have been -// converted to pascal strings. The MSG_SearchMenuItem.attrib field is used for the -// menu command. inNewCommandIfInvalid specifies the new menu item to make current -// if the currently selected menu item becomes invalid. inPopulateID is a unique -// non-zero identifier used for determining whether or not we actually need to repopulate -// the menu. If inPopulateID is 0, the menu is always repopulated. -//----------------------------------- -{ - // We need to remember here, that since the menu is cached, it might not jive with - // the command array (i.e. menu items might have been set in another instance of - // this class). The mCommands array store data related to our state. - - MenuHandle menuH = GetMacMenuH(); - Int16 startNumMenuItems = ::CountMItems(menuH); - Int16 startNumCommands = mCommands.GetCount(); - -// if ( (inPopulateID != 0) && (inPopulateID == mLastPopulateID) ) -// { -// AssertFail_(startNumMenuItems == inNumItems); -// AssertFail_(startNumCommands == inNumItems); -// return; // Already populated! -// } - - const Int16 curItem = GetValue(); - Boolean curItemChanged = (startNumCommands > 0) ? false : true; - Boolean curItemTextChanged = (startNumCommands == 0) && (inNumItems > 0); - mDefaultItem = 1; - - // Do we need to adjust the menu? - if ( inNumItems < startNumMenuItems ) - { - do - { - ::DeleteMenuItem(menuH, startNumMenuItems--); - } while ( startNumMenuItems != inNumItems ); - } - // Do we need to adjust the command array? - if ( inNumItems < startNumCommands ) - { - Int16 deleteStartIndex = inNumItems + 1; - if ( IsBetween(curItem, deleteStartIndex, startNumCommands) ) - { - curItemChanged = true; - } - mCommands.RemoveItemsAt(LArray::index_Last, deleteStartIndex); - startNumCommands = inNumItems; - } else if ( inNumItems > startNumCommands ) - { - mCommands.AdjustAllocation(inNumItems - startNumCommands); - } - - // Add new items - MSG_SearchMenuItem *curMenuItem = inMenuItems; - - for (Int32 i = 1; i <= inNumItems; ++i, ++curMenuItem) - { - CommandT command = curMenuItem->attrib; - if ( inNewCommandIfInvalid == command && curMenuItem->isEnabled) - { - mDefaultItem = i; - } - // Do we need to adjust the menu? - if ( i <= startNumMenuItems ) - { - // There is already an item in the menu - CStr255 curMenuString; // Strings are not necessary 31 character file names - ::GetMenuItemText(menuH, i, curMenuString); - if ( !::EqualString(curMenuString, (UInt8 *) curMenuItem->name, true, true) ) - { - ::SetMenuItemText(menuH, i, (UInt8 *) curMenuItem->name); - if ( i == curItem ) - { - curItemTextChanged = true; - } -// the isEnabled flag is obsolete and basically random. -// if ( curMenuItem->isEnabled ) -// { -// ::EnableItem(menuH, i); -// } else -// { -// ::DisableItem(menuH, i); -// } - } - } else - { - ::AppendMenu(menuH, (UInt8 *) curMenuItem->name); - // curMenuItem->name can have meta character data in it - // So this really is necessary - ::SetMenuItemText( menuH, i, (UInt8 *) curMenuItem->name); -// the isEnabled flag is obsolete and basically random. -// if ( !curMenuItem->isEnabled ) -// { -// ::DisableItem(menuH, i); -// } - } - // Do we need to adjust the commands? - if ( i <= startNumCommands ) - { - // There is already an item in the menu - mCommands.AssignItemsAt(1, i, &command); - if ( !curMenuItem->isEnabled && (i == curItem) ) - { - curItemChanged = true; - } - } else - { - mCommands.InsertItemsAt(1, i, &command); - } - } - - if ( inNumItems != startNumCommands ) - { - SetPopupMinMaxValues(); - } - - if ( curItemChanged ) - { - mValue = mDefaultItem; - RefreshMenu(); - } else if ( curItemTextChanged ) - { - RefreshMenu(); - } - - mLastPopulateID = inPopulateID; -} - - -/*====================================================================================== - Get the command for the specified menu item. Pass 0 for inMenuItem to get the - currently selected menu item. If the index is invalid, return cmd_InvalidMenuItem. -======================================================================================*/ - -CommandT CSearchPopupMenu::GetCurrentItemCommandNum(Int16 inMenuItem) -{ - ArrayIndexT index = (inMenuItem > 0) ? inMenuItem : mValue; - CommandT command = cmd_InvalidMenuItem; - - // check if valid index - if( mCommands.ValidIndex(index) ) - command = *((CommandT *) mCommands.GetItemPtr(index)); - else - return mOldValue; - - if( command == cmd_InvalidMenuItem ) - return mOldValue; - else - return command; - -// return cmd_InvalidMenuItem; -} - - -/*====================================================================================== - Select the item with the specified command. -======================================================================================*/ - -void CSearchPopupMenu::SetCurrentItemByCommand(CommandT inMenuCommand) -{ - Int16 index = GetCommandItemIndex(inMenuCommand); - if ( index && (GetValue() != index) ) - { - SetValue(index); - } -} - - - -/*====================================================================================== - Refresh instead of drawing immediately. Also fixes bug in PowerPlant if an exception - is raised when broadcasting the value message. -======================================================================================*/ - -void CSearchPopupMenu::SetValue(Int32 inValue) -{ - CommandT menuCommand; - bool success = mCommands.FetchItemAt( inValue, &menuCommand ); -// *** const Int16 oldValue = GetValue(); - mOldValue = GetValue(); - -// if ( oldValue != inValue ) - if ( mOldValue != inValue ) - { - RefreshMenu(); - MenuHandle menuH = GetMacMenuH(); - if( menuCommand == CSearchManager::eCustomizeSearchItem && success ) - { - mValue = inValue; - BroadcastValueMessage(); -// inValue = oldValue; - inValue = mOldValue; - FocusDraw(); - } - if ( menuH ) SetupCurrentMenuItem(menuH, inValue); - Try_ - { - LControl::SetValue(inValue); - } - Catch_(inErr) - { - // Reset the old value, new value is unacceptable -// if ( menuH ) SetupCurrentMenuItem(menuH, oldValue); - if ( menuH ) SetupCurrentMenuItem(menuH, mOldValue); -// mValue = oldValue; - mValue = mOldValue; - SetHiliteState(false); - Throw_(inErr); - } - EndCatch_ - } -} - - -/*====================================================================================== - Get the index of the item with the specified command. -======================================================================================*/ - -Int16 CSearchPopupMenu::GetCommandItemIndex(CommandT inMenuCommand) -{ - ArrayIndexT index = mCommands.FetchIndexOf(&inMenuCommand); - - return ((index != LArray::index_Bad) ? index : 0); -} - - -/*====================================================================================== - Clear all items in the menu. -======================================================================================*/ - -void CSearchPopupMenu::ClearMenu(Int16 inStartItem) -{ - if ( GetNumCommands() < inStartItem ) return; - - mCommands.RemoveItemsAt(LArray::index_Last, inStartItem); - MenuHandle menuH = GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - while ( numMenuItems >= inStartItem ) - { - ::DeleteMenuItem(menuH, numMenuItems--); - } - SetPopupMinMaxValues(); -} - - -/*====================================================================================== - Append the specified menu item to the menu. -======================================================================================*/ - -void CSearchPopupMenu::AppendMenuItemCommand(CommandT inCommand, ConstStr255Param inName, - Boolean inIsEnabled) -{ - MenuHandle menuH = GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - - AssertFail_(numMenuItems == mCommands.GetCount()); - - mCommands.InsertItemsAt(1, LArray::index_Last, &inCommand); - ::AppendMenu(menuH, inName); - // I assume that we don't want Metacharacter data - ::SetMenuItemText( menuH, numMenuItems+1, inName ); - if ( !inIsEnabled ) - { - ::DisableItem(menuH, numMenuItems + 1); - } - SetPopupMinMaxValues(); -} - - -/*====================================================================================== - Set the specified menu item in the menu. -======================================================================================*/ - -void CSearchPopupMenu::SetMenuItemCommand(CommandT inOldCommand, CommandT inNewCommand, - ConstStr255Param inName, Boolean inIsEnabled) -{ - Int16 index = GetCommandItemIndex(inOldCommand); - if ( !index ) return; // Not found! - - Boolean doRefresh = (GetValue() == index); - - MenuHandle menuH = GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - - AssertFail_(numMenuItems == mCommands.GetCount()); - - mCommands.AssignItemsAt(1, index, &inNewCommand); - - if ( doRefresh ) - { - Str255 tempString; - ::GetMenuItemText(menuH, index, tempString); - doRefresh = !::EqualString(tempString, inName, true, true); - } - ::SetMenuItemText(menuH, index, inName); - - if ( inIsEnabled ) - { - ::EnableItem(menuH, numMenuItems + 1); - } else - { - ::DisableItem(menuH, numMenuItems + 1); - } - if ( doRefresh ) - { - RefreshMenu(); - } -} - - -/*====================================================================================== - Remove the specified menu item from the menu. -======================================================================================*/ - -void CSearchPopupMenu::RemoveMenuItemCommand(CommandT inRemoveCommand, - CommandT inNewCommandIfInvalid) -{ - Int16 index = GetCommandItemIndex(inRemoveCommand); - if ( !index ) return; // Not found! - - Boolean doRefresh = (GetValue() == index); - - MenuHandle menuH = GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - - AssertFail_(numMenuItems == mCommands.GetCount()); - - mCommands.RemoveItemsAt(1, index); - ::DeleteMenuItem(menuH, index); - - SetPopupMinMaxValues(); - - if ( doRefresh ) - { - index = GetCommandItemIndex(inNewCommandIfInvalid); - if ( !index ) index = 1; - mValue = index; - RefreshMenu(); - } -} - - -/*====================================================================================== - Finish creating the search popup menu. -======================================================================================*/ - -void CSearchPopupMenu::FinishCreateSelf() -{ - Inherited::FinishCreateSelf(); - - MenuHandle menuH = GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - - if ( numMenuItems > 0 ) - { - AssertFail_(mCommands.GetCount() == 0); - CommandT command = 0; - mCommands.InsertItemsAt(numMenuItems, LArray::index_Last, &command); - } -} - - -/*====================================================================================== - Send a reference to ourselves as the param. -======================================================================================*/ - -void CSearchPopupMenu::BroadcastValueMessage() -{ - BroadcastMessage(mValueMessage, this); -} - - -/*====================================================================================== - Don't do a double draw of the popup. -======================================================================================*/ - -Boolean CSearchPopupMenu::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) -{ - Boolean rtnVal = Inherited::TrackHotSpot(inHotSpot, inPoint, inModifiers); - if ( rtnVal ) DontRefresh(); - - return rtnVal; -} - - -#pragma mark - -/*====================================================================================== - Just update the text area. Don't allow more than mMaxChars to be set. -======================================================================================*/ - -void CSearchEditField::SetDescriptor(ConstStr255Param inDescriptor) -{ - { - Str255 curDesc; - GetDescriptor(curDesc); - if ( ::EqualString(inDescriptor, curDesc, true, true) ) return; - } - - Int16 length = -1; - if ( inDescriptor[0] > mMaxChars ) - { - length = inDescriptor[0]; - ((UInt8 *) inDescriptor)[0] = mMaxChars; - } - - ::TESetText(inDescriptor + 1, inDescriptor[0], mTextEditH); - - if ( length >= 0 ) ((UInt8 *) inDescriptor)[0] = length; - - Draw(nil); - - BroadcastValueMessage(); -} - - -/*====================================================================================== - Set the text for the field. This can be used for text that is greater than 255 in - length. -======================================================================================*/ - -void CSearchEditField::SetText(const char *inText) -{ - if( inText != NULL ) - { - Int16 length = LString::CStringLength(inText); - if ( length > mMaxChars ) length = mMaxChars; - - ::TESetText(inText, length, mTextEditH); - } - Draw(nil); - - BroadcastValueMessage(); -} - - -/*====================================================================================== - Get the text for the field. This can be used for text that is greater than 255 in - length. The returned string is null-terminated. -======================================================================================*/ - -char *CSearchEditField::GetText(char *outText) -{ - CharsHandle theText = ::TEGetText(mTextEditH); - Int16 length = ::GetHandleSize(theText); - Assert_(length <= mMaxChars); - - ::BlockMoveData(*theText, outText, length); - - outText[length] = 0; - - return outText; -} - - -/*====================================================================================== - Just invalidate the right side of the pane. -======================================================================================*/ - -static const Int16 cRefreshEditMargin = 4; -void CSearchEditField::ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, - Boolean inRefresh) -{ - Assert_(!inHeightDelta); - if ( !inWidthDelta ) return; - - Inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - - if ( inRefresh && IsVisible() ) - { - Rect invalRect; - CalcPortFrameRect(invalRect); - ::InsetRect(&invalRect, -1, -1); // Make bigger for shadows - if ( inWidthDelta < 0 ) - { - invalRect.left = invalRect.right - cRefreshEditMargin; - invalRect.right -= inWidthDelta; - } else - { - invalRect.left = invalRect.right - inWidthDelta - cRefreshEditMargin; - } - InvalPortRect(&invalRect); - } -} - - -/*====================================================================================== - Don't call LBroadcasterEditField::HandleKeyPress() since it intecepts Enter and - Return keys. -======================================================================================*/ - -Boolean CSearchEditField::HandleKeyPress(const EventRecord &inKeyEvent) -{ -// return LBroadcasterEditField::LEditField_HandleKeyPress(inKeyEvent); - return LEditField::HandleKeyPress(inKeyEvent); -} - - -#pragma mark - -/*====================================================================================== - Only rotate the target if mCanRotate is true. Also, fix a bug in PowerPlant. -======================================================================================*/ - -void CSearchTabGroup::RotateTarget(Boolean inBackward) -{ - if ( (mCanRotate != nil) && !(*mCanRotate) ) return; - - LCommander *onDutySub = GetTarget(); //GetOnDutySub(); - Int32 pos = (onDutySub != nil) ? mSubCommanders.FetchIndexOf(onDutySub) : - mSubCommanders.GetCount() + 1; - - if ( (pos > 1) || (onDutySub != nil) ) { - Boolean switched = false; - Int32 startingPos = pos; - if ( startingPos > mSubCommanders.GetCount() ) - { - startingPos = mSubCommanders.GetCount(); - } else if ( startingPos < 0 ) - { - startingPos = 0; - } - LCommander *newTarget; - do - { - if (inBackward) - { - if (--pos <= 0) - { - // Wrap around to last cmdr - pos = mSubCommanders.GetCount(); - } - - } else - { - if (++pos > mSubCommanders.GetCount()) - { - pos = 1; // Wrap around to first cmdr - } - } - // Find SubCommander by position - // and see if it wants to become - // the new target - mSubCommanders.FetchItemAt(pos, newTarget); - switched = newTarget->ProcessCommand(msg_TabSelect); - - } while (!switched && (pos != startingPos)); - - if (switched) { // We found a willing subcommander - SwitchTarget(newTarget); - } - } -} - - -#pragma mark - -/*====================================================================================== - Draw when disabled as grayish text. -======================================================================================*/ - -void CSearchCaption::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - Int16 just = UTextTraits::SetPortTextTraits(mTxtrID); - - RGBColor textColor; - ::GetForeColor(&textColor); - - ApplyForeAndBackColors(); - - if ( IsEnabled() ) - { - ::RGBForeColor(&textColor); - UTextDrawing::DrawWithJustification((Ptr) &mText[1], mText[0], frame, just); - } else - { - StDeviceLoop theLoop(frame); - Int16 depth; - while ( theLoop.NextDepth(depth) ) - { - if ( depth < 4 ) - { - ::TextMode(grayishTextOr); - } else - { - textColor = UGAColorRamp::GetColor(7); - ::RGBForeColor(&textColor); - } - UTextDrawing::DrawWithJustification((Ptr) &mText[1], mText[0], frame, just); - } - ::TextMode(srcOr); - ::ForeColor(blackColor); - } -} - - - -#pragma mark - - -RgnHandle StSectClipRgnState::sClipRgn = nil; -Boolean StSectClipRgnState::sSetClip = false; - -/*====================================================================================== - Clip to the intersection of the BOUNDS of the current clipping region. Don't create - more than one of these objects at a time! If inDisplayRect is non-nil, the routine - first checks to see if inDisplayRect is completely within inLocalRect AND the - current clipping region, and if so, does nothing. -======================================================================================*/ - -StSectClipRgnState::StSectClipRgnState(const Rect *inLocalRect, const Rect *inDisplayRect) -{ - Assert_(!sSetClip); - - if ( inDisplayRect != nil ) - { - if ( ((**UQDGlobals::GetCurrentPort()->clipRgn).rgnSize == sizeof(Region)) && - RectEnclosesRect(&(**UQDGlobals::GetCurrentPort()->clipRgn).rgnBBox, inDisplayRect) && - RectEnclosesRect(inLocalRect, inDisplayRect) ) - { - - return; // All's well - } - } - if ( sClipRgn == nil ) sClipRgn = ::NewRgn(); - if ( sClipRgn != nil ) - { - ::GetClip(sClipRgn); - Rect newClip; - ::SectRect(inLocalRect, &(**sClipRgn).rgnBBox, &newClip); - ::ClipRect(&newClip); - sSetClip = true; - } -} - - -/*====================================================================================== - Restore original clip region. -======================================================================================*/ - -StSectClipRgnState::~StSectClipRgnState() -{ - - if ( sSetClip ) - { - Assert_(sClipRgn != nil); - ::SetClip(sClipRgn); - if ( (**sClipRgn).rgnSize > 128 ) - { - ::EmptyRgn(sClipRgn); - } - sSetClip = false; - } -} - - -/*====================================================================================== - Return true if inInsideRect is completely enclosed by inEnclosingRect. -======================================================================================*/ - -Boolean StSectClipRgnState::RectEnclosesRect(const Rect *inEnclosingRect, - const Rect *inInsideRect) -{ - - return ((inEnclosingRect->left <= inInsideRect->left) && - (inEnclosingRect->top <= inInsideRect->top) && - (inEnclosingRect->right >= inInsideRect->right) && - (inEnclosingRect->bottom >= inInsideRect->bottom)); -} - - -#pragma mark - - -#if 0 -/*====================================================================================== - Determine if the specified cell is selected. -======================================================================================*/ - -Boolean CRowTableSelector::CellIsSelected(const STableCell &inCell) const -{ - if ( GetSelectedRowCount() > 0 ) -{ - - AssertFail_(GetCount() == GetSelectedRowCount()); - UInt32 id = GetRowUniqueID(inCell.row); - - if ( id != eInvalidID ) - { - return (FetchIndexOf(&id) != LArray::index_Bad); - } - } - - return false; -} - - -/*====================================================================================== - Select the specified cell. -======================================================================================*/ - -void CRowTableSelector::DoSelect(const TableIndexT inRow, Boolean inSelect, - Boolean inHilite, Boolean inNotify) -{ - UInt32 id = GetRowUniqueID(inRow); - if ( id == eInvalidID ) return; - - STableCell theCell(inRow, 1); - const ArrayIndexT index = FetchIndexOf(&id); - - if ( (index != LArray::index_Bad) == inSelect ) return; - - if ( inSelect && !mAllowMultiple ) - { - if ( mSelectedRowCount > 0 ) - { - DoSelectAll(false, false); - mSelectedRowCount = 0; // to be safe - } - } - - // Maintain the count - if ( inSelect ) - { - InsertItemsAt(1, LArray::index_First, &id); - ++mSelectedRowCount; - } - - if ( inHilite ) - { - mTableView->HiliteCell(theCell, inSelect); - - /* - // hilite (or unhilite) the entire row - UInt32 nCols, nRows; - - mTableView->GetTableSize(nRows, nCols); - - theCell.row = inRow; - for (theCell.col = 1; theCell.col <= nCols; theCell.col++) - { - mTableView->HiliteCell(theCell, inSelect); - } - */ - } - - if ( !inSelect ) - { - RemoveItemsAt(1, index); - --mSelectedRowCount; - } - - if ( inNotify ) mTableView->SelectionChanged(); -} - - -/*====================================================================================== - Remove the specified cells from the table. -======================================================================================*/ - -void CRowTableSelector::RemoveRows(Uint32 inHowMany, TableIndexT inFromRow) -{ - Boolean notify = false; - Assert_(mSelectedRowCount == mItemCount); - // mSelectedRowCount is inherited from LTableRowSelector. - // mItemCount is inherited from LArray. - // They should always agree! - if (mRowCount== 0) - { - AssertFail_(mRowCount >= mSelectedRowCount); // # selected <= # total rows - TableIndexT cols; - mTableView->GetTableSize(mRowCount, cols); - return; // nothing to do. - } - if ( inHowMany >= mRowCount ) - { - // Removing all rows from the table - AssertFail_(mRowCount >= mSelectedRowCount); // # selected <= # total rows - mRowCount = 0; // maintain the table count - if (mItemCount > 0) // clear the array - RemoveItemsAt(LArray::index_Last, LArray::index_First); - notify = (mSelectedRowCount > 0); - mSelectedRowCount = 0; - } - else - { - UInt32 curRow, nRows = mRowCount; // (table row count) - if ( nRows > (inFromRow + inHowMany - 1) ) - nRows = (inFromRow + inHowMany - 1); - for (curRow = inFromRow; curRow <= nRows; ++curRow) - { - UInt32 id = GetRowUniqueID(curRow); - ArrayIndexT index = FetchIndexOf(&id); - if ( index != LArray::index_Bad ) - { - RemoveItemsAt(1, index); - --mSelectedRowCount; - notify = true; - } - } - AssertFail_(mRowCount >= inHowMany); - mRowCount -= inHowMany; - } - - if ( notify ) mTableView->SelectionChanged(); -} - - -/*====================================================================================== - Return the first selected cell's row, defined as the min row & col (closest to - top-left corner). Return 0 if no row is selected. -======================================================================================*/ - -TableIndexT CRowTableSelector::GetFirstSelectedRow() const -{ - Int32 count = GetCount(); - TableIndexT row = 0x7FFFFFFF; - - if ( count > 0 ) -{ - - Int32 curItem = 1; - - do - { - TableIndexT curRow = GetUniqueIDRow(*((UInt32 *) GetItemPtr(curItem))); - if ( curRow < row ) row = curRow; - } while ( ++curItem <= count ); - } - - return ((row == 0x7FFFFFFF) ? 0 : row); -} - - -/*====================================================================================== - Return an array of selected row indices with the base given by inBase. The caller - must dispose of the returned memory using ::DisposePtr(). The function returns - the number of elements in outIndices, and 0 if no elements are selected and - nothing is allocated. -======================================================================================*/ - -TableIndexT CRowTableSelector::GetSelectedIndices(TableIndexT **outIndices, Int16 inBase) const -{ - TableIndexT count = GetCount(); - *outIndices = nil; - - if ( count > 0 ) -{ - - *outIndices = (TableIndexT *) XP_ALLOC(count * sizeof(TableIndexT)); - FailNIL_(*outIndices); - TableIndexT curItem = 1; - - do - { - (*outIndices)[curItem - 1] = - GetUniqueIDRow(*((UInt32 *) GetItemPtr(curItem))) - 1 + inBase; - } while ( ++curItem <= count ); - } - - return count; -} - #endif - -#pragma mark - -#if 0 -/*====================================================================================== - Adjust the window to stored preferences. -======================================================================================*/ - -void CExTable::ReadSavedTableStatus(LStream *inStatusData) -{ - if ( inStatusData != nil ) - { - - AssertFail_(mTableHeader != nil); - - mTableHeader->ReadColumnState(inStatusData); - } -} - - -/*====================================================================================== - Get window stored preferences. -======================================================================================*/ - -void CExTable::WriteSavedTableStatus(LStream *outStatusData) -{ - AssertFail_(mTableHeader != nil); - - mTableHeader->WriteColumnState(outStatusData); -} - - -/*====================================================================================== - Find status. Override it because of the overload in the inherited class. -======================================================================================*/ - -void CExTable::FindCommandStatus(CommandT inCommand, Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName) -{ - CStandardFlexTable::FindCommandStatus(inCommand, outEnabled, outUsesMark, - outMark, outName); -} - - -/*====================================================================================== - Obey commands. -======================================================================================*/ - -Boolean CExTable::ObeyCommand(CommandT inCommand, void *ioParam) -{ - Boolean cmdHandled = true; - - switch (inCommand) - { - - case msg_TabSelect: - break; - - default: - cmdHandled = CStandardFlexTable::ObeyCommand(inCommand, ioParam); - break; - } - - return cmdHandled; -} - - -/*====================================================================================== - Draw when disabled as grayish text. -======================================================================================*/ - -void CExTable::ScrollBits(Int32 inLeftDelta, Int32 inTopDelta) -{ - USearchHelper::ScrollViewBits(this, inLeftDelta, inTopDelta); -} - - -/*====================================================================================== - Draw the table. -======================================================================================*/ - -void CExTable::DrawSelf() -{ - UTextTraits::SetPortTextTraits(mTextTraitsID); - - RgnHandle localUpdateRgnH = GetLocalUpdateRgn(); - Rect updateRect = (**localUpdateRgnH).rgnBBox; - ::DisposeRgn(localUpdateRgnH); - - STableCell topLeftCell, botRightCell; - FetchIntersectingCells(updateRect, topLeftCell, botRightCell); - - Boolean isActive = IsActive() && IsTarget(); - - STableCell cell(1, 1); - for (cell.row = topLeftCell.row; cell.row <= botRightCell.row; cell.row++) - { - DrawCellRow(cell, false, isActive); - } - -} - - -/*====================================================================================== - Activate the table. -======================================================================================*/ - -void CExTable::ActivateSelf() -{ - FocusDrawSelectedCells(true); - // Do nothing -} - - -/*====================================================================================== - Deactivate the table. -======================================================================================*/ - -void CExTable::DeactivateSelf() -{ - // Do nothing -} - - -/*====================================================================================== - Become the current target. -======================================================================================*/ - -void CExTable::BeTarget() -{ - FocusDrawSelectedCells(true); -} - - -/*====================================================================================== - Don't be the current target. -======================================================================================*/ - -void CExTable::DontBeTarget() -{ - StValueChanger change(mFlags, mFlags | flag_IsLoosingTarget); - FocusDrawSelectedCells(true); -} - - -/*====================================================================================== - Hilite the current selection. -======================================================================================*/ - - -void CExTable::HiliteSelection(Boolean /* inActively */, Boolean inHilite ) -{ - if ( mFlags & flag_IsDrawingSelf ) return; - FocusDrawSelectedCells(inHilite); -} - - -/*====================================================================================== - Hilite the current selection. -======================================================================================*/ - -void CExTable::HiliteCellInactively(const STableCell &inCell, Boolean inHilite) -{ - FocusDrawSelectedCells(inHilite, &inCell); -} - - -/*====================================================================================== - Hilite the current selection. -======================================================================================*/ - -void CExTable::HiliteCellActively(const STableCell &inCell, Boolean inHilite) -{ - FocusDrawSelectedCells(inHilite, &inCell); -} - - -/*====================================================================================== - Focus the table and draw the specified cell. -======================================================================================*/ - -void CExTable::FocusDrawSelectedCells(Boolean inHilite, const STableCell *inCell) -{ - TableIndexT startRow, endRow; - - if ( FocusExposed() && GetVisibleRowRange(&startRow, &endRow) ) - { - STableCell selectedCell; - if ( inCell == nil ) - { - selectedCell.row = startRow; - selectedCell.col = 1; - } else - { - selectedCell = *inCell; - } - if ( IsValidCell(selectedCell) && (selectedCell.row >= startRow) && - (selectedCell.row <= endRow) ) - { - Boolean isActive = (DrawFullHiliting() && IsActive() && IsTarget()); - - StValueChanger change(mFlags, inHilite ? mFlags : - mFlags | flag_DontDrawHiliting); - UTextTraits::SetPortTextTraits(mTextTraitsID); - StColorPenState::Normalize(); - do - { - if ( CellIsSelected(selectedCell) ) - { - DrawCellRow(selectedCell, true, isActive); - } - } while ( (inCell == nil) && (++selectedCell.row <= endRow) ); - } - } -} - - -/*====================================================================================== - Draw the table. -======================================================================================*/ - -void CExTable::DrawCellRow(STableCell &inCell, Boolean inErase, Boolean inActive) -{ - TableIndexT numRows, numCols; - GetTableSize(numRows, numCols); - - Rect hiliteRect, cellRect; - - // Draw the hiliting - - Boolean drawHilited = CellIsSelected(inCell) && DrawHiliting(); - - if ( drawHilited || inErase ) - { - GetLocalCellRect(STableCell(inCell.row, 1), hiliteRect); - GetLocalCellRect(STableCell(inCell.row, numCols), cellRect); - - hiliteRect.right = cellRect.right; - } - - if ( drawHilited ) - { - RGBColor hiliteColor; - LMGetHiliteRGB(&hiliteColor); - - Int16 depth; - CDeviceLoop deviceLoop(hiliteRect, depth); - - if ( depth ) do - { - mBlackAndWhiteHiliting = inActive && ((depth < 4) || ((hiliteColor.red == 0) && - (hiliteColor.green == 0) && - (hiliteColor.blue == 0))); - if ( mBlackAndWhiteHiliting ) - { - ::ForeColor(blackColor); - } else - { - ::RGBForeColor(&hiliteColor); - } - if ( inActive ) - { - ::PaintRect(&hiliteRect); - } else - { - if ( inErase ) - { - ::InsetRect(&hiliteRect, 1, 1); - ::EraseRect(&hiliteRect); - ::InsetRect(&hiliteRect, -1, -1); - } - ::FrameRect(&hiliteRect); - } - - ::ForeColor(blackColor); - - for (inCell.col = 1; inCell.col <= numCols; inCell.col++) - { - GetLocalCellRect(inCell, cellRect); - DrawCell(inCell, cellRect); - } - } while ( deviceLoop.NextDepth(depth) ); - - } else -{ - - mBlackAndWhiteHiliting = false; // Doesn't matter here, we aren't drawing hilited - - if ( inErase ) ::EraseRect(&hiliteRect); - - // Draw the cell data - - for (inCell.col = 1; inCell.col <= numCols; inCell.col++) - { - GetLocalCellRect(inCell, cellRect); - DrawCell(inCell, cellRect); - } - } - - inCell.col = numCols; -} - - -/*====================================================================================== - Draw hilited text in the table. -======================================================================================*/ - -void CExTable::PlaceHilitedTextInRect(const char *inText, Uint32 inTextLength, const Rect &inRect, - Int16 inHorizJustType, Int16 inVertJustType, - const FontInfo *inFontInfo, Boolean inDoTruncate, - TruncCode inTruncWhere) -{ - if ( inTextLength > 0 ) - { - RGBColor foreColor; - ::GetForeColor(&foreColor); - Boolean drawBW = GetBlackAndWhiteHiliting(); - ::ForeColor(drawBW ? whiteColor : blackColor); - UGraphicGizmos::PlaceTextInRect(inText, inTextLength, inRect, inHorizJustType, - inVertJustType, inFontInfo, inDoTruncate, - inTruncWhere); - ::RGBForeColor(&foreColor); - } -} - - -/*====================================================================================== - Get the range of visible rows in the table's frame. -======================================================================================*/ - -Boolean CExTable::GetVisibleRowRange(TableIndexT *inStartRow, TableIndexT *inEndRow) -{ - Rect visRect; - GetRevealedRect(visRect); // Check if Table is revealed - - if ( !::EmptyRect(&visRect) ) - { - PortToLocalPoint(topLeft(visRect)); - PortToLocalPoint(botRight(visRect)); - STableCell topLeftCell, botRightCell; - FetchIntersectingCells(visRect, topLeftCell, botRightCell); - if ( IsValidCell(topLeftCell) && IsValidCell(botRightCell) ) - { - *inStartRow = topLeftCell.row; - *inEndRow = botRightCell.row; - return true; - } - } - - return false; -} - -void CExTable::ChangeStarting(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount) -{ - switch ( inChangeCode ) - { - // Do this before the change occurs, because the code for removing - // the rows queries the backend for the message key. By the time the change - // has finished, this call won't work. - case MSG_NotifyInsertOrDelete: - if ( inRowCount < 0 ) - RemoveRows(-inRowCount, inStartRow, true); - break; - default: - Inherited::ChangeStarting(inPane, inChangeCode, inStartRow, inRowCount); - break; - } -} - -/*====================================================================================== - Notification from the BE that something is finished changing in the display table. -======================================================================================*/ - -void CExTable::ChangeFinished(MSG_Pane */*inPane*/, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount) -{ - if ( (--mMysticPlane) > (kMysticUpdateThreshHold + 1) ) return; - - MsgPaneChanged(); - - switch ( inChangeCode ) - { - case MSG_NotifyInsertOrDelete: - Assert_(inRowCount != 0); - if ( inRowCount > 0 ) - { - InsertRows(inRowCount, inStartRow - 1, nil, 0, true); - } else - { - //RemoveRows(-inRowCount, inStartRow, true); See ChangeStarting(); - } - break; - - case MSG_NotifyChanged: - { - STableCell topLeft, botRight; - TableIndexT rows; - - topLeft.col = 1; - topLeft.row = inStartRow; - - GetTableSize(rows, botRight.col); - botRight.row = inStartRow + inRowCount - 1; - RefreshCellRange(topLeft, botRight); - } - break; - - case MSG_NotifyScramble: - case MSG_NotifyAll: - if ( mMysticPlane < kMysticUpdateThreshHold ) - { - SInt32 diff = GetBENumRows() - mRows; - if ( diff > 0 ) - { - InsertRows(diff, 1, nil, 0, false); - } else if ( diff < 0 ) - { - RemoveRows(-diff, 1, false); - } - Refresh(); - } - break; - - default: - break; - } -} -#endif diff --git a/mozilla/cmd/macfe/MailNews/SearchHelpers.h b/mozilla/cmd/macfe/MailNews/SearchHelpers.h deleted file mode 100644 index 7fe2a284c45..00000000000 --- a/mozilla/cmd/macfe/MailNews/SearchHelpers.h +++ /dev/null @@ -1,561 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// SearchHelpers.h - -#pragma once - -/*====================================================================================== - DESCRIPTION: Defines classes related to the Mail & News search dialog. -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CDateView.h" -#include "CGAIconPopup.h" -#include "CSaveWindowStatus.h" -#include "LTableRowSelector.h" -#include "CMailFlexTable.h" - -#include -#include - -// FE Stuff - -#include "macutil.h" - -class CFolderScopeGAPopup; -class CSearchPopupMenu; -class LBroadcasterEditField; -class CSearchDateField; -class CSearchTabGroup; -class LTableView; -class CString; - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - -typedef struct MSG_SearchMenuItem MSG_SearchMenuItem; - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark EXTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - -inline Boolean IsBetween(Int32 inVal, Int32 inMin, Int32 inMax) { - return ((inVal >= inMin) && (inVal <= inMax)); -} - -#ifdef DEBUGGER_ASSERTIONS - #undef AssertFail_ - #undef Assert_ - #ifdef Debug_Signal - #define AssertFail_(test) ThrowIfNot_(test) - #define Assert_(test) do { \ - if ( !(test) ) { \ - Try_ { \ - Throw_(noErr); \ - } \ - Catch_(inErr) { \ - } \ - EndCatch_ \ - } \ - } while ( 0 ) - #else // Debug_Signal - #define AssertFail_(test) ((void) 0) - #define Assert_(test) ((void) 0) - #endif // Debug_Signal -#endif // DEBUGGER_ASSERTIONS - -#undef FailNILRes_ -#define FailNILRes_(res) ThrowIfResFail_(res) -#undef FailResErr_ -#define FailResErr_() ThrowIfResError_() - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -// USearchHelper - -class USearchHelper { - -public: - - // Indexes into STR#8600 - - enum { - uStr_AllMailFolders = 1 - , uStr_AllNewsgroups - , uStr_AllMailFoldersNewsgroups - , uStr_OneMessageFoundSelected - , uStr_NoMessagesFound - , uStr_MultipleMessagesFound - , uStr_OneMessageFound - , uStr_MultipleMessagesSelected - , uStr_SelectedMailFolders - , uStr_SelectedNewsgroups - , uStr_SelectedMailFoldersNewsgroups - , uStr_InFrontFolder - , uStr_SearchForMessages - , uStr_SearchForAddresses - , uStr_FilterDefaultName - , uStr_FilterDefaultDescription - , uStr_SearchFunctionNotImplemented - , uStr_SearchFunctionParamError - , uStr_ExceptionErrorOccurred - , uStr_FilterFunctionNotImplemented - , uStr_FilterFunctionParamError - , uStr_SearchFunctionNothingToSearch - }; - - static void RegisterClasses(); - - static LControl *FindViewControl(LView *inView, PaneIDT inID); - static LPane *FindViewSubpane(LView *inView, PaneIDT inID); - static LPane *FindViewVisibleSubpane(LView *inView, PaneIDT inID); - static LView *FindViewSubview(LView *inView, PaneIDT inID); - static LBroadcasterEditField *FindViewEditField(LView *inView, PaneIDT inID); - static CSearchPopupMenu *FindSearchPopup(LView *inView, PaneIDT inID); - static CFolderScopeGAPopup *FindFolderScopePopup(LView *inView, PaneIDT inID); - static CSearchDateField *FindViewDateField(LView *inView, PaneIDT inID); - static CSearchTabGroup *FindWindowTabGroup(LArray *inSubcommanders); - - static void RemoveSizeBoxFromVisRgn(LWindow *inWindow); - static void RefreshPortFrameRect(LPane *inPane, Rect *inPortRect); - static void RefreshLocalFrameRect(LPane *inPane, Rect *inLocalRect); - - static LWindow *GetPaneWindow(LPane *inPane); - static void LinkListenerToBroadcasters(LView *inContainer, LListener *inListener); - static Int16 GetEditFieldLength(LEditField *inEditField); - static void AssignUString(Int16 inStringIndex, CString& outString); - static void EnableDisablePane(LPane *inPane, Boolean inEnable, Boolean inRefresh = true); - static void ShowHidePane(LPane *inPane, Boolean inDoShow); - static void SetPaneDescriptor(LPane *inPane, const CStr255& inDescriptor); - static void SetDefaultButton(LView *inView, PaneIDT inID, Boolean inIsDefault = true); - static void SelectEditField(LEditField *inEditField); - static void SelectDateView(CDateView *inDateView); - static Boolean LastPaneWasActiveClickPane(); - static void CalcDiscreteWindowResizing(LWindow *inWindow, Rect *ioNewBounds, - const Int16 inHIncrement, const Int16 inVIncrement, - Boolean inCheckDesktop = true, Int16 inSizeBoxLeft = 15, - Int16 inSizeBoxTop = 15); - static void ScrollViewBits(LView *inView, Int32 inLeftDelta, Int32 inTopDelta); - - enum { - char_OptionKey = 0x003A - , char_ControlKey = 0x003B - , char_CommandKey = 0x0037 - , char_ShiftKey = 0x0038 - }; - static Boolean KeyIsDown(Int16 inKeyCode); - static void GenericExceptionAlert(OSErr inErr); - - - enum { - paneID_Okay = 'OKAY' // OK button - , paneID_Cancel = 'CNCL' // Cancel button - }; - static Boolean HandleDialogKey(LView *inView, const EventRecord &inKeyEvent); - - static Boolean MenuItemIsEnabled(MenuHandle inMenuH, Int16 inItem) { - return ((**inMenuH).enableFlags & (1L<<(inItem - 0))); - } - -#ifdef NOT_YET - static void GetFolderDisplayName(const char *inFolderName, - CStr255& outFolderName); -#endif // NOT_YET - -private: - - // Instance variables ========================================================== - - static CQDProcs sStdProcs; -}; - -//////////////////////////////////////////////////////////////////////////////////////////// -// CSearchPopupMenu - -class CSearchPopupMenu : public CGAIconPopup { - - - typedef CGAIconPopup Inherited; - - -public: - - enum { class_ID = 'SPUP' }; - - CSearchPopupMenu(LStream *inStream); - - Boolean IsLatentVisible() { - return ((mVisible == triState_Latent) || (mVisible == triState_On)); - } - - enum { cmd_InvalidMenuItem = -1, cmd_DividerMenuItem = -2 }; - - virtual CommandT GetCurrentItemCommandNum(Int16 inMenuItem = 0); - Int16 GetCommandItemIndex(CommandT inMenuCommand); - void SetCurrentItemByCommand(CommandT inMenuCommand); - Int16 GetNumCommands() { - return mCommands.GetCount(); - } - CommandT GetOldItemCommand() const; - - virtual void SetValue(Int32 inValue); - void SetToDefault() { - SetValue(mDefaultItem); - } - - void PopulateMenu(MSG_SearchMenuItem *inMenuItems, const Int16 inNumItems, - CommandT inNewCommandIfInvalid, UInt32 inPopulateID = 0); - void ClearMenu(Int16 inStartItem = 1); - void AppendMenuItemCommand(CommandT inCommand, ConstStr255Param inName, Boolean inIsEnabled); - void SetMenuItemCommand(CommandT inOldCommand, CommandT inNewCommand, - ConstStr255Param inName, Boolean inIsEnabled); - void SetIndexCommand(Int16 inIndex, CommandT inCommand) { - mCommands.AssignItemsAt(1, inIndex, &inCommand); - } - void RemoveMenuItemCommand(CommandT inRemoveCommand, - CommandT inNewCommandIfInvalid); -// unused code - 11/21/97 -// -// Boolean UpdateMenuItemCommand(Int16 inMenuItem, CommandT inNewCommand, -// ConstStr255Param inName, Boolean inIsEnabled); -// void SetCurrentItemByName(ConstStr255Param inName); - -protected: - - virtual void FinishCreateSelf(); - virtual void BroadcastValueMessage(); - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - - // Instance variables ========================================================== - - LArray mCommands; - UInt32 mLastPopulateID; - Int16 mDefaultItem; - Int16 mOldValue; - -}; // CSearchPopupMenu - -// CSearchEditField - -class CSearchEditField : public LGAEditField { - - - typedef LGAEditField Inherited; - - -public: - - enum { class_ID = 'SEFD' }; - - // Broadcast messages - - enum { - msg_UserChangedText = 'cTxt' // PaneIDT * - }; - - CSearchEditField(LStream *inStream) : - LGAEditField(inStream) { - SetRefreshAllWhenResized(false); - } - - Int16 GetTextLength() { - return (**mTextEditH).teLength; - } - Boolean IsLatentVisible() { - return ((mVisible == triState_Latent) || (mVisible == triState_On)); - } - virtual void UserChangedText() { - PaneIDT paneID = mPaneID; - BroadcastMessage(msg_UserChangedText, &paneID); - } - virtual void SetDescriptor(ConstStr255Param inDescriptor); - - void SetText(const char *inText); - char *GetText(char *outText); - virtual void ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, - Boolean inRefresh); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - -protected: - -}; - - -// CSearchDateField - -class CSearchDateField : public CDateView { - -public: - - enum { class_ID = 'SDFD' }; - - CSearchDateField(LStream *inStream) : - CDateView(inStream) { - } - - Boolean IsLatentVisible() { - return ((mVisible == triState_Latent) || (mVisible == triState_On)); - } - -protected: - -}; - - -// CSearchTabGroup - -class CSearchTabGroup : public LTabGroup { - -public: - - // Stream creator method - - enum { class_ID = 'SrTg' }; - - CSearchTabGroup(LStream* /*inStream*/) : - LTabGroup(), - mCanRotate(nil) { - } - CSearchTabGroup() : - LTabGroup(), - mCanRotate(nil) { - } - - void SetRotateWatchValue(Boolean *inWatchValue) { - mCanRotate = inWatchValue; - } - virtual void RotateTarget(Boolean inBackward); - -protected: - - // Instance variables ========================================================== - - Boolean *mCanRotate; -}; - - -// CSearchCaption - -class CSearchCaption : public LCaption { - -public: - - // Stream creator method - - enum { class_ID = 'SrCp' }; - - CSearchCaption(LStream *inStream) : - LCaption(inStream) { - } - -protected: - - virtual void DrawSelf(); - virtual void EnableSelf() { - Draw(nil); - } - virtual void DisableSelf() { - Draw(nil); - } -}; - -// StTableClipRgnState - -class StSectClipRgnState { - -public: - - StSectClipRgnState(const Rect *inLocalRect, const Rect *inDisplayRect = nil); - ~StSectClipRgnState(); - - static Boolean RectEnclosesRect(const Rect *inEnclosingRect, const Rect *inInsideRect); - -protected: - - // Instance variables ========================================================== - - static RgnHandle sClipRgn; - static Boolean sSetClip; -#ifdef Debug_Signal - static Boolean sTableClipRgnAround; -#endif // Debug_Signal -}; - -#if 0 -// CRowTableSelector - -class CRowTableSelector : public LTableRowSelector { - -public: - - CRowTableSelector(LTableView *inTableView, Boolean inAllowMultiple = true) : - LTableRowSelector(inTableView, inAllowMultiple), - mRowCount(0) { - - mItemSize = sizeof(UInt32); - mComparator = LLongComparator::GetComparator(); - mKeepSorted = true; - } - - virtual Boolean CellIsSelected(const STableCell &inCell) const; - virtual TableIndexT GetSelectedIndices(TableIndexT **outIndices, Int16 inBase) const; - virtual TableIndexT GetFirstSelectedRow() const; - UInt32 GetRowCount() const { return mRowCount; } - -protected: - - enum { eInvalidID = 0xFFFFFFFF }; - virtual UInt32 GetRowUniqueID(const TableIndexT inRow) const = 0L; - virtual TableIndexT GetUniqueIDRow(const UInt32 inID) const = 0L; - - virtual void DoSelect(const TableIndexT inRow, Boolean inSelect, - Boolean inHilite, Boolean inNotify); - virtual void InsertRows(UInt32 inHowMany, TableIndexT /*inAfterRow*/) { - mRowCount += inHowMany; - } - virtual void RemoveRows(Uint32 inHowMany, TableIndexT inFromRow); - - // Instance variables ========================================================== - - UInt32 mRowCount; // Count of the number of rows in the table. Need this - // since RemoveRows() is called after rows have been removed! -}; -#endif //0 -#if 0 //0 -// CExTable - -class CExTable : public CMailFlexTable { - -private: - typedef CMailFlexTable Inherited; - -public: - - CExTable(LStream *inStream) : - CMailFlexTable(inStream), - mFlags(0), - mBlackAndWhiteHiliting(false) { - - } - - Boolean CellsAreSelected() { - return IsValidCell(GetFirstSelectedCell()); - } - TableIndexT GetNumRows() { - return mRows; - } - void SelectScrollCell(const STableCell &inCell) { - SelectCell(inCell); - ScrollCellIntoFrame(inCell); - } - - void RefreshRowRange(TableIndexT inStartRow, TableIndexT inEndRow) { - TableIndexT topRow, botRow; - if ( inStartRow < inEndRow ) { - topRow = inStartRow; botRow = inEndRow; - } else { - topRow = inEndRow; botRow = inStartRow; - } - RefreshCellRange(STableCell(topRow, 1), STableCell(botRow, mCols)); - } - virtual void ReadSavedTableStatus(LStream *inStatusData); - virtual void WriteSavedTableStatus(LStream *outStatusData); - virtual Boolean CellHasDropFlag(const STableCell &/*inCell*/, Boolean &/*outIsExpanded*/) const { return false; } - -protected: - - enum { // Flags - flag_DontDrawHiliting = 0x01 - , flag_IsDrawingSelf = 0x02 - , flag_IsLoosingTarget = 0x04 - }; - - virtual MSG_Pane *GetBEPane() const = 0L; - virtual Boolean IsMyPane(void* info) const { - return (GetBEPane() == reinterpret_cast(info)->pane); - } - - virtual void FindCommandStatus(CommandT inCommand, Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam = nil); - - virtual void ScrollBits(Int32 inLeftDelta, Int32 inTopDelta); - virtual void DrawSelf(); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - virtual void BeTarget(); - virtual void DontBeTarget(); - virtual void HiliteSelection(Boolean inActively, Boolean inHilite); - virtual void HiliteCellInactively(const STableCell &inCell, Boolean inHilite); - virtual void HiliteCellActively(const STableCell &inCell, Boolean inHilite); - - Boolean GetBlackAndWhiteHiliting() { - return mBlackAndWhiteHiliting; - } - Boolean DrawHiliting() { - return !(mFlags & flag_DontDrawHiliting); - } - Boolean DrawFullHiliting() { - return !(mFlags & flag_IsLoosingTarget); - } - - void FocusDrawSelectedCells(Boolean inHilite, const STableCell *inCell = nil); - void DrawCellRow(STableCell &inCell, Boolean inErase, Boolean inActive); - void PlaceHilitedTextInRect(const char *inText, Uint32 inTextLength, const Rect &inRect, - Int16 inHorizJustType, Int16 inVertJustType, - const FontInfo *inFontInfo, Boolean inDoTruncate, - TruncCode inTruncWhere); - Boolean GetVisibleRowRange(TableIndexT *inStartRow, TableIndexT *inEndRow); - - // Backend methods -#if 0 - virtual void MsgPaneChanged() = 0L; - virtual Int32 GetBENumRows() = 0L; - virtual void ChangeStarting(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount); - virtual void ChangeFinished(MSG_Pane *inPane, MSG_NOTIFY_CODE inChangeCode, - TableIndexT inStartRow, SInt32 inRowCount); -#endif - // Instance variables ========================================================== - - UInt8 mFlags; - Boolean mBlackAndWhiteHiliting; -}; - -#endif diff --git a/mozilla/cmd/macfe/MailNews/StGetInfoHandler.cp b/mozilla/cmd/macfe/MailNews/StGetInfoHandler.cp deleted file mode 100644 index c0d8182fe27..00000000000 --- a/mozilla/cmd/macfe/MailNews/StGetInfoHandler.cp +++ /dev/null @@ -1,1229 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// StGetInfoHandler.cp - -#include "StGetInfoHandler.h" - -#include "XP_Core.h" // typedefs -#include "msgcom.h" - -#include "CMessageFolder.h" -#include "CMailNewsContext.h" -#include "MPreference.h" -#include "CPasteSnooper.h" -#include "UMailFilters.h" -//#include "MailNewsMediators.h" - -#include "ufilemgr.h" -#include "prefapi.h" - -#include - - -//====================================== -#pragma mark -class StFolderGetInfoHandler : public StGetInfoHandler -//====================================== -{ - public: - StFolderGetInfoHandler( - ResIDT resID, - CMessageFolder& folder, - LCommander *inSuperCommander); -//---- -// Data -//---- - CMessageFolder mFolder; - Int32 mFolderPrefFlags; -}; // class StFolderGetInfoHandler - -//====================================== -#pragma mark -class StMailFolderGetInfoHandler : public StFolderGetInfoHandler -//====================================== -{ - public: - StMailFolderGetInfoHandler( - CMessageFolder& folder, - LCommander *inSuperCommander) - : StFolderGetInfoHandler(12500, folder, inSuperCommander) {} - ~StMailFolderGetInfoHandler(); - virtual void ReadDataFields(); - virtual void WriteDataFields(); - virtual Boolean UserDismissed(); -}; // class StMailFolderGetInfoHandler - -//====================================== -#pragma mark -class StNewsGroupGetInfoHandler : public StFolderGetInfoHandler -//====================================== -{ - public: - StNewsGroupGetInfoHandler( - CMessageFolder& folder, - LCommander *inSuperCommander) - : StFolderGetInfoHandler(12501, folder, inSuperCommander) {} - ~StNewsGroupGetInfoHandler(); - virtual void ReadDataFields(); - virtual void WriteDataFields(); - virtual Boolean UserDismissed(); -//---- -// Data -//---- - XP_Bool mUseRetrievalDefaults, mUseBodyPurgeDefaults, mUseHeaderPurgeDefaults; - XP_Bool mByReadness; - XP_Bool mUnreadOnly; - XP_Bool mByDate; - XP_Bool mHTML; - int32 mDaysOld; - int32 mHeaderDaysKeep; - int32 mBodyDaysKeep; - XP_Bool mKeepUnreadOnly; - MSG_PurgeByPreferences mBodyPurgeBy; - MSG_PurgeByPreferences mHeaderPurgeBy; - int32 mNumHeadersToKeep; -}; // class StNewsGroupGetInfoHandler - -//====================================== -class StNewsHostGetInfoHandler : public StGetInfoHandler -//====================================== -{ - public: - StNewsHostGetInfoHandler( - MSG_Host* inHost, - LCommander *inSuperCommander); - ~StNewsHostGetInfoHandler(); - virtual void ReadDataFields(); - virtual void WriteDataFields(); -//---- -// Data -//---- - MSG_Host* mHost; - XP_Bool mPromptPassword; -}; // class StNewsHostGetInfoHandler - - -//====================================== -#pragma mark -class StMailServerInfoHandler : public StGetInfoHandler -//====================================== -{ - private: - typedef StGetInfoHandler Inherited; - - public: - enum { - kMailServerNameCaption = 'SNAM', - kMailServerNameEditText = 'SNME', - kMailServerTypeCaption = 'TYPE', - kMailServerTypePopup = 'TYPP', - kIMAPServerUserNameEditText = 'IUSR', - kPOPServerUserNameEditText = 'PUSR', - kIMAPServerSavePasswordCheckbox = 'IRMB', - kPOPServerSavePasswordCheckbox = 'PRMB', - kIMAPServerCheckMailCheckbox = 'ICHK', - kPOPServerCheckMailCheckbox = 'PCHK', - kIMAPServerCheckTimeEditText = 'IMIN', - kPOPServerCheckTimeEditText = 'PMIN' - }; - - StMailServerInfoHandler( - CStr255& ioName, - Boolean& ioPOP, - Boolean inIsNewServer, - Boolean inAllowServerNameEdit, - Boolean inAllowServerTypeEdit, - ServerNameValidationFunc inValidationFunc, - CServerListMediator* inValidationServerList, - LCommander* inSuperCommander); - - ~StMailServerInfoHandler(); - virtual void ReadDataFields(); - virtual void WriteDataFields(); - virtual Boolean UserDismissed(); - virtual Boolean GetPop() { return mPOP; } - virtual void GetServerName(CStr255 &outName); - - protected: - void SetPOP(Boolean inDialogInit); - void SetIMAP(Boolean inDialogInit); - void SetDefaultUserName(); -//---- -// Data -//---- - protected: - - - Boolean mPOP; - Boolean mOriginallyPOP; - Boolean mIsNewServer; - Boolean mAllowServerNameEdit; - Boolean mAllowServerTypeEdit; - CStr255 mName; - ServerNameValidationFunc mServerNameValidationFunc; - CServerListMediator* mValidationServerList; - - enum { kNumPolyprefControls = 4 }; - enum PopupValues { kPOP = 1, kIMAP = 2 }; - // Popup menu values are 1-based. So - // these are the actual IntPref values PLUS ONE -}; // class StMailServerInfoHandler - -#pragma mark - - -//---------------------------------------------------------------------------------------- -StGetInfoHandler::~StGetInfoHandler() -//---------------------------------------------------------------------------------------- -{ - Assert_( mMessage == msg_Cancel || mDataWritten); -} - -//---------------------------------------------------------------------------------------- -MessageT StGetInfoHandler::DoDialog() -//---------------------------------------------------------------------------------------- -{ - ReadDataFields(); - do { - mMessage = StStdDialogHandler::DoDialog(); - } while (!UserDismissed()); - - return mMessage; -} - -//---------------------------------------------------------------------------------------- -Boolean StGetInfoHandler::UserDismissed() -//---------------------------------------------------------------------------------------- -{ - return (mMessage == msg_OK) || (mMessage == msg_Cancel); -} - - -//---------------------------------------------------------------------------------------- -void StGetInfoHandler::HideAndCripplePane(PaneIDT paneID) -//---------------------------------------------------------------------------------------- -{ - HidePane(paneID); - MPreferenceBase::SetPaneWritePref(GetDialog(), paneID, false); -} - - -//---------------------------------------------------------------------------------------- -void StGetInfoHandler::ShowAndUncripplePane(PaneIDT paneID) -//---------------------------------------------------------------------------------------- -{ - ShowPane(paneID); - MPreferenceBase::SetPaneWritePref(GetDialog(), paneID, true); -} - - -#pragma mark - - -//---------------------------------------------------------------------------------------- -StFolderGetInfoHandler::StFolderGetInfoHandler( - ResIDT inResID, - CMessageFolder& inFolder, - LCommander *inSuperCommander) -//---------------------------------------------------------------------------------------- -: StGetInfoHandler(inResID, inSuperCommander) -, mFolder(inFolder) -, mFolderPrefFlags((inFolder.GetFolderPrefFlags())) -{ - mFolder.FolderInfoChanged(); // make sure it's the latest. -} - -#pragma mark - - -//---------------------------------------------------------------------------------------- -StMailFolderGetInfoHandler::~StMailFolderGetInfoHandler() -//---------------------------------------------------------------------------------------- -{ - if (mMessage != msg_Cancel) - WriteDataFields(); -} - -//---------------------------------------------------------------------------------------- -void StMailFolderGetInfoHandler::ReadDataFields() -//---------------------------------------------------------------------------------------- -{ - { // <- scope for buffer string (allow compiler to recycle) - char buffer[256]; - strcpy(buffer, mFolder.GetName()); - NET_UnEscape(buffer); - SetText('FNAM', CStr255(buffer)); - } // <- scope for buffer string (allow compiler to recycle) - - if (mFolder.IsLocalMailFolder()) - { - HidePane('SHAR'); // Hide the tab button for "sharing" - HidePane('CNTC'); // Hide the tab button for "download" - - const char* unixPath = MSG_GetFolderNameFromID(mFolder.GetFolderInfo()); - // note: this is a shared reference, should not be freed. - if (unixPath) - { - XP_StatStruct stats; - if (XP_Stat(unixPath, &stats, xpMailFolder) == 0) - { - SetNumberText('USED', stats.st_size); - } - char* macPath = CFileMgr::MacPathFromUnixPath(unixPath); - if (macPath) - SetText('LNAM', CStr255(macPath)); - XP_FREEIF((char*)macPath); - } - int32 deletedBytes = mFolder.GetDeletedBytes(); - if (deletedBytes >= 0) - SetNumberText('WAST', deletedBytes); - } - else // remote folder - { - HidePane('WPan'); // Hide all the disk/wasted stats and the cleanup button. - - - MSG_FolderInfo* theFolderInfo = mFolder.GetFolderInfo(); - - Assert_(theFolderInfo); - - // fill in the folder type in caption 'FTYP' - char *folderType = ::MSG_GetFolderTypeName(theFolderInfo); - - if (folderType) - SetText('FTYP', CStr255(folderType)); - XP_FREEIF((char*)folderType); - - - // fill in the folder description in caption 'FDSC' - char *folderDesc = ::MSG_GetFolderTypeDescription(theFolderInfo); - - if (folderDesc) - SetText('FDSC', CStr255(folderDesc)); - XP_FREEIF((char*)folderDesc); - - // fill in folder permissions in 'PERT' - - char *folderRightsString = ::MSG_GetACLRightsStringForFolder(theFolderInfo); - if (folderRightsString) - SetText('PERT', CStr255(folderRightsString)); - XP_FREEIF((char*)folderRightsString); - - if ( ::MSG_HaveAdminUrlForFolder( theFolderInfo, MSG_AdminFolder) ) - { - // show ACL panel 'SPRP' - LPane *aclPanelView = GetPane('SPRP'); - ThrowIfNil_(aclPanelView); - aclPanelView->Show(); - - // hide message 'NSHF' - LPane *noSharingMessage = GetPane('NSHF'); - ThrowIfNil_(noSharingMessage); - noSharingMessage->Hide(); - } - else - { - LPane *aclPanelView = GetPane('SPRP'); - ThrowIfNil_(aclPanelView); - aclPanelView->Hide(); - - // hide message 'NSHF' - LPane *noSharingMessage = GetPane('NSHF'); - ThrowIfNil_(noSharingMessage); - noSharingMessage->Show(); - } - - } - - SInt32 count = mFolder.CountUnseen(); - if (count >= 0) - SetNumberText('UNRD', count); - count = mFolder.CountMessages(); - if (count >= 0) - SetNumberText('TOTL', count); - SetBoolean('DnMe', (mFolderPrefFlags & MSG_FOLDER_PREF_OFFLINE) != 0); -} - -//---------------------------------------------------------------------------------------- -void StMailFolderGetInfoHandler::WriteDataFields() -//---------------------------------------------------------------------------------------- -{ - CStr255 newName; - // we do this to get around the fact that CString (from which CStr255 - // is derived) implememts operator const char*() by using a circular buffer - // of 4 static strings. If more than four clients use this "cast", the - // first client's string will be overwritten. Here, MSG_RenameMailFolder - // ends up presenting a prompt dialog, and enough calls to - // CString::operator const char*() are made that this happens! - GetText('FNAM', newName); - if (newName != CStr255(mFolder.GetName())) - { - char* temp = ::NET_Escape((const char *)newName, URL_PATH); - if (temp) - ::MSG_RenameMailFolder(mFolder.GetFolderPane(), mFolder.GetFolderInfo(), temp); - XP_FREEIF(temp); - } - if (GetBoolean('DnMe')) - mFolderPrefFlags |= MSG_FOLDER_PREF_OFFLINE; - else - mFolderPrefFlags &= ~MSG_FOLDER_PREF_OFFLINE; - MSG_SetFolderPrefFlags(mFolder.GetFolderInfo(), mFolderPrefFlags); - mDataWritten = true; -} - -//---------------------------------------------------------------------------------------- -Boolean StMailFolderGetInfoHandler::UserDismissed() -//---------------------------------------------------------------------------------------- -{ - if (mMessage == 'CMPR') - { - MSG_ViewIndex index = mFolder.GetIndex(); - ::MSG_Command( - mFolder.GetFolderPane(), - MSG_CompressFolder, - &index, - 1); - return true; - } - - // user clicked privileges button. Do ACL URL - if (mMessage == 'PRIV') - { - // Get ourselves a context for the URL dispatch. - // If it's not a browser context, the right thing happens and a browser context is made - MSG_Pane *folderPane = mFolder.GetFolderPane(); - - Assert_(folderPane); // since this properties dialog was brough up from the folder pane, - // one should exist - - ::MSG_GetAdminUrlForFolder(::MSG_GetContext(folderPane), mFolder.GetFolderInfo(), MSG_AdminFolder); - } - - return StFolderGetInfoHandler::UserDismissed(); -} - -#pragma mark - - -//---------------------------------------------------------------------------------------- -StNewsGroupGetInfoHandler::~StNewsGroupGetInfoHandler() -//---------------------------------------------------------------------------------------- -{ - if (mMessage != msg_Cancel) - WriteDataFields(); -} - -//---------------------------------------------------------------------------------------- -void StNewsGroupGetInfoHandler::ReadDataFields() -//---------------------------------------------------------------------------------------- -{ - CStr255 prettyName(mFolder.GetPrettyName()); - if (prettyName.Length() > 0) - { - SetText('FNAM', prettyName); - CStr255 geekNameFormat; - GetText('GNAM', geekNameFormat); - char buf[255]; - XP_SPRINTF(buf, geekNameFormat, mFolder.GetName()); - SetText('GNAM', CStr255(buf)); - } - else - { - SetText('FNAM', CStr255(mFolder.GetName())); - SetText('GNAM', "\p"); - } - const char* unixPath = MSG_GetFolderNameFromID(mFolder.GetFolderInfo()); - if (unixPath) - { - XP_StatStruct stats; - if (XP_Stat(unixPath, &stats, xpMailFolder) == 0) - { - SetNumberText('USED', stats.st_size); - } - char* macPath = CFileMgr::MacPathFromUnixPath(unixPath); - XP_FREEIF((char*)unixPath); - } - - SInt32 count = mFolder.CountUnseen(); - if (count >= 0) - SetNumberText('UNRD', count); - count = mFolder.CountMessages(); - if (count >= 0) - SetNumberText('TOTL', count); - SetBoolean('DnMe', (mFolderPrefFlags & MSG_FOLDER_PREF_OFFLINE) != 0); - - MSG_GetOfflineRetrievalInfo( - (MSG_FolderInfo*)mFolder.GetFolderInfo(), - &mUseRetrievalDefaults, - &mByReadness, - &mUnreadOnly, - &mByDate, - &mDaysOld); - SetBoolean('UDFL', mUseRetrievalDefaults); - if (mUseRetrievalDefaults) - { - LControl *theControl; - - XP_Bool unreadOnly = true; - PREF_GetBoolPref("offline.news.download.unread_only", &unreadOnly); - theControl = (LControl *)mDialog->FindPaneByID('OUNR'); - XP_ASSERT(theControl); - theControl->SetValue(unreadOnly); - theControl->Disable(); - - XP_Bool byDate = true; - PREF_GetBoolPref("offline.news.download.by_date", &byDate); - theControl = (LControl *)mDialog->FindPaneByID('BYDT'); - XP_ASSERT(theControl); - theControl->SetValue(byDate); - theControl->Disable(); - - int32 daysOld = 30; - PREF_GetIntPref("offline.news.download.days", &daysOld); - theControl = (LControl *)mDialog->FindPaneByID('DAYS'); - XP_ASSERT(theControl); - theControl->SetValue(daysOld); - theControl->Disable(); - } - else - { - SetBoolean('OUNR', mUnreadOnly); - SetBoolean('BYDT', mByDate); - SetNumberText('DAYS', mDaysOld); - } - - SetBoolean( - 'HTML', - ::MSG_IsHTMLOK(CMailNewsContext::GetMailMaster(), mFolder.GetFolderInfo()) - ); - //MSG_PurgeByPreferences bodyPurgeBy; - MSG_GetArticlePurgingInfo( - (MSG_FolderInfo*)mFolder.GetFolderInfo(), - &mUseBodyPurgeDefaults, - &mBodyPurgeBy, - &mBodyDaysKeep); - Assert_(mBodyPurgeBy != MSG_PurgeByNumHeaders); - SetBoolean('RmBd', mBodyPurgeBy == MSG_PurgeByAge); - SetNumberText('BdDy', mBodyDaysKeep); - - MSG_GetHeaderPurgingInfo( - (MSG_FolderInfo*)mFolder.GetFolderInfo(), - &mUseHeaderPurgeDefaults, - &mHeaderPurgeBy, - &mKeepUnreadOnly, - &mHeaderDaysKeep, - &mNumHeadersToKeep); - switch (mHeaderPurgeBy) - { - case MSG_PurgeNone: - SetBoolean('KpAl', true); - break; - case MSG_PurgeByAge: - SetBoolean('KpDa', true); - break; - case MSG_PurgeByNumHeaders: - SetBoolean('KpNw', true); - break; - } - SetBoolean('KpUn', mKeepUnreadOnly); - SetNumberText('KDYS', mHeaderDaysKeep); - SetNumberText('KpCt', mNumHeadersToKeep); - - // if we are offline the download now button needs to be disabled - LPane *downloadButton = mDialog->FindPaneByID('DOWN'); - XP_ASSERT(downloadButton != nil); - XP_Bool online = true; - PREF_GetBoolPref("network.online", &online); - if (!online) - downloadButton->Disable(); - -} // StNewsGroupGetInfoHandler::ReadDataFields - -//---------------------------------------------------------------------------------------- -void StNewsGroupGetInfoHandler::WriteDataFields() -//---------------------------------------------------------------------------------------- -{ - if (GetBoolean('DnMe')) - mFolderPrefFlags |= MSG_FOLDER_PREF_OFFLINE; - else - mFolderPrefFlags &= ~MSG_FOLDER_PREF_OFFLINE; - MSG_SetFolderPrefFlags((MSG_FolderInfo*)mFolder.GetFolderInfo(), mFolderPrefFlags); - - XP_Bool useDefaults = GetBoolean('UDFL'); - XP_Bool unreadOnly; - XP_Bool byReadness; - XP_Bool byDate; - int32 daysOld; - int32 headerDaysKeep = GetNumberText('KDYS'); - if (useDefaults) - { - // if we are using pref defaults then just restore what we read in - byReadness = mByReadness; - unreadOnly = mUnreadOnly; - byDate = mByDate; - daysOld = mDaysOld; - } - else - { - byReadness = unreadOnly = GetBoolean('OUNR'); - byDate = GetBoolean('BYDT'); - daysOld = GetNumberText('DAYS'); - } - MSG_SetOfflineRetrievalInfo( - (MSG_FolderInfo*)mFolder.GetFolderInfo(), - useDefaults, - byReadness, - unreadOnly, - byDate, - daysOld); - - - int32 bodyDaysKeep = GetNumberText('BdDy'); - MSG_PurgeByPreferences bodyPurgeBy = MSG_PurgeNone; - if (GetBoolean('RmBd')) - bodyPurgeBy = MSG_PurgeByAge; - useDefaults = (mUseBodyPurgeDefaults - && bodyPurgeBy == mBodyPurgeBy - && bodyDaysKeep == mBodyDaysKeep); - MSG_SetArticlePurgingInfo( - (MSG_FolderInfo*)mFolder.GetFolderInfo(), - useDefaults, - bodyPurgeBy, - bodyDaysKeep); - - MSG_PurgeByPreferences headerPurgeBy = MSG_PurgeNone; - if (GetBoolean('KpDa')) - headerPurgeBy = MSG_PurgeByAge; - else if (GetBoolean('KpNw')) - headerPurgeBy = MSG_PurgeByNumHeaders; - unreadOnly = GetBoolean('KpUn'); - int32 numHeadersToKeep = GetNumberText('KpCt'); - useDefaults = (mUseHeaderPurgeDefaults - && headerPurgeBy == mHeaderPurgeBy - && unreadOnly == mUnreadOnly - && headerDaysKeep == mHeaderDaysKeep - && numHeadersToKeep == mNumHeadersToKeep - && unreadOnly == mKeepUnreadOnly); - MSG_SetHeaderPurgingInfo( - (MSG_FolderInfo*)mFolder.GetFolderInfo(), - useDefaults, - headerPurgeBy, - unreadOnly, - headerDaysKeep, - numHeadersToKeep - ); - ::MSG_SetIsHTMLOK( - CMailNewsContext::GetMailMaster(), - mFolder.GetFolderInfo(), - nil, - GetBoolean('HTML')); - mDataWritten = true; -} // StNewsGroupGetInfoHandler::WriteDataFields - -//---------------------------------------------------------------------------------------- -Boolean StNewsGroupGetInfoHandler::UserDismissed() -//---------------------------------------------------------------------------------------- -{ - if (mMessage == 'SYNC') - return true; - // 'DOWN' is the pane ID of the download now button - if (mMessage == 'DOWN') - { - // only allowed to download now once - LPane *downloadButton = mDialog->FindPaneByID('DOWN'); - XP_ASSERT(downloadButton != nil); - downloadButton->Disable(); - // make call to backend - ::MSG_DownloadFolderForOffline( - CMailNewsContext::GetMailMaster(), - mFolder.GetFolderPane(), - (MSG_FolderInfo*)mFolder.GetFolderInfo()); - return false; - } - if ('UDFL' == mMessage) - { - LControl *theControl; - - if (GetBoolean('UDFL')) - { - XP_Bool unreadOnly = true; - PREF_GetBoolPref("offline.news.download.unread_only", &unreadOnly); - theControl = (LControl *)mDialog->FindPaneByID('OUNR'); - XP_ASSERT(theControl); - theControl->SetValue(unreadOnly); - theControl->Disable(); - - XP_Bool byDate = true; - PREF_GetBoolPref("offline.news.download.by_date", &byDate); - theControl = (LControl *)mDialog->FindPaneByID('BYDT'); - XP_ASSERT(theControl); - theControl->SetValue(byDate); - theControl->Disable(); - - int32 daysOld = 30; - PREF_GetIntPref("offline.news.download.days", &daysOld); - theControl = (LControl *)mDialog->FindPaneByID('DAYS'); - XP_ASSERT(theControl); - theControl->SetValue(daysOld); - theControl->Disable(); - } - else - { - theControl = (LControl *)mDialog->FindPaneByID('OUNR'); - XP_ASSERT(theControl); - theControl->SetValue(mUnreadOnly); - theControl->Enable(); - - theControl = (LControl *)mDialog->FindPaneByID('BYDT'); - XP_ASSERT(theControl); - theControl->SetValue(mByDate); - theControl->Enable(); - - theControl = (LControl *)mDialog->FindPaneByID('DAYS'); - XP_ASSERT(theControl); - theControl->SetValue(mDaysOld); - theControl->Enable(); - } - return false; - } - return StGetInfoHandler::UserDismissed(); -} - -#pragma mark - - -//---------------------------------------------------------------------------------------- -StNewsHostGetInfoHandler::StNewsHostGetInfoHandler( - MSG_Host* inHost, - LCommander *inSuperCommander) -//---------------------------------------------------------------------------------------- -: StGetInfoHandler(12502, inSuperCommander) -, mHost(inHost) -{ -} - -//---------------------------------------------------------------------------------------- -StNewsHostGetInfoHandler::~StNewsHostGetInfoHandler() -//---------------------------------------------------------------------------------------- -{ - if (mMessage != msg_Cancel) - WriteDataFields(); -} - -//---------------------------------------------------------------------------------------- -void StNewsHostGetInfoHandler::ReadDataFields() -//---------------------------------------------------------------------------------------- -{ - SetText('FNAM', CStr255(::MSG_GetHostName(mHost))); - SetNumberText('PORT', ::MSG_GetHostPort(mHost)); - CStr255 securityString; - ::GetIndString(securityString, 7099, 13 + ::MSG_IsHostSecure(mHost)); - SetText('SECU', securityString); - mPromptPassword = ::MSG_GetNewsHostPushAuth(MSG_GetNewsHostFromMSGHost(mHost)); - if (mPromptPassword) - SetBoolean('AskP', true); - else - SetBoolean('Anon', true); -} // StNewsHostGetInfoHandler::ReadDataFields - -//---------------------------------------------------------------------------------------- -void StNewsHostGetInfoHandler::WriteDataFields() -//---------------------------------------------------------------------------------------- -{ - XP_Bool promptPassword = GetBoolean('AskP'); - if (promptPassword != mPromptPassword) - ::MSG_SetNewsHostPushAuth(MSG_GetNewsHostFromMSGHost(mHost), promptPassword); - mDataWritten = true; -} // StNewsHostGetInfoHandler::WriteDataFields - -#pragma mark - - - - -//---------------------------------------------------------------------------------------- -StMailServerInfoHandler::StMailServerInfoHandler( - CStr255& ioName, - Boolean& ioPOP, - Boolean inIsNewServer, - Boolean inAllowServerNameEdit, - Boolean inAllowServerTypeEdit, - ServerNameValidationFunc inValidationFunc, - CServerListMediator* inValidationServerList, - LCommander* inSuperCommander) -//---------------------------------------------------------------------------------------- -: StGetInfoHandler(12503, inSuperCommander) -, mPOP(ioPOP) -, mOriginallyPOP(ioPOP) -, mIsNewServer(inIsNewServer) -, mAllowServerNameEdit(inAllowServerNameEdit) -, mAllowServerTypeEdit(inAllowServerTypeEdit) -, mName(ioName) -, mServerNameValidationFunc(inValidationFunc) -, mValidationServerList(inValidationServerList) -{ -} - -//---------------------------------------------------------------------------------------- -StMailServerInfoHandler::~StMailServerInfoHandler() -//---------------------------------------------------------------------------------------- -{ - if (mMessage == msg_OK) - { - MPreferenceBase::SetWriteOnDestroy(true); - WriteDataFields(); - } -} - -//---------------------------------------------------------------------------------------- -Boolean StMailServerInfoHandler::UserDismissed() -//---------------------------------------------------------------------------------------- -{ - LWindow* window = GetDialog(); - - if (mMessage == kMailServerTypePopup) // type popup menu (IMAP/POP) - { - Boolean wantPOP = (GetValue(kMailServerTypePopup) == kPOP); - if (wantPOP != mPOP) - { - if (wantPOP) - SetPOP(false); - else - SetIMAP(false); - } - } - - // Disable OK if server name is a duplicate of an existing server - LEditField *nameEdit = dynamic_cast(window->FindPaneByID(kMailServerNameEditText)); - Assert_(nameEdit); - - CStr255 serverName; - nameEdit->GetDescriptor(serverName); - - if (mServerNameValidationFunc != nil) - { - if ( (*mServerNameValidationFunc)(serverName, mIsNewServer, mValidationServerList) ) - EnablePane('OKOK'); - else - DisablePane('OKOK'); - } - - // should also disable OK if the user name field is empty - - - MessageT result = Inherited::UserDismissed(); - - if (mMessage == msg_OK) - { - mName = serverName; - } - - return result; -} - -//---------------------------------------------------------------------------------------- -void StMailServerInfoHandler::SetPOP(Boolean inDialogInit) -//---------------------------------------------------------------------------------------- -{ - HidePane('IMPB'); // hide the imap tab - HidePane('ADVB'); // hide the advanced tab - ShowPane('POPB'); // show the POP tab - - SetText(kMailServerTypeCaption, "\pPOP"); // I don't think this has to be localized - SetValue(kMailServerTypePopup, kPOP); // set the POP popup to true - - // Copy the user name from the - HideAndCripplePane(kIMAPServerUserNameEditText); - HideAndCripplePane(kIMAPServerSavePasswordCheckbox); - HideAndCripplePane(kIMAPServerCheckMailCheckbox); - HideAndCripplePane(kIMAPServerCheckTimeEditText); - - ShowAndUncripplePane(kPOPServerUserNameEditText); - ShowAndUncripplePane(kPOPServerSavePasswordCheckbox); - ShowAndUncripplePane(kPOPServerCheckMailCheckbox); - ShowAndUncripplePane(kPOPServerCheckTimeEditText); - - if (! inDialogInit) // copy the user name over - { - CopyTextValue(kIMAPServerUserNameEditText, kPOPServerUserNameEditText); - CopyTextValue(kIMAPServerCheckTimeEditText, kPOPServerCheckTimeEditText); - - CopyNumberValue(kIMAPServerSavePasswordCheckbox, kPOPServerSavePasswordCheckbox); - CopyNumberValue(kIMAPServerCheckMailCheckbox, kPOPServerCheckMailCheckbox); - } - - mPOP = true; -} // StMailServerInfoHandler::SetPOP - -//---------------------------------------------------------------------------------------- -void StMailServerInfoHandler::SetIMAP(Boolean inDialogInit) -//---------------------------------------------------------------------------------------- -{ - HidePane('POPB'); // hide the POP tab - ShowPane('IMPB'); // show the imap tab - ShowPane('ADVB'); // show the advanced tab - - SetText(kMailServerTypeCaption, "\pIMAP"); // I don't think this has to be localized - SetValue(kMailServerTypePopup, kIMAP); // set the POP popup to IMAP - - HideAndCripplePane(kPOPServerUserNameEditText); - HideAndCripplePane(kPOPServerSavePasswordCheckbox); - HideAndCripplePane(kPOPServerCheckMailCheckbox); - HideAndCripplePane(kPOPServerCheckTimeEditText); - - ShowAndUncripplePane(kIMAPServerUserNameEditText); - ShowAndUncripplePane(kIMAPServerSavePasswordCheckbox); - ShowAndUncripplePane(kIMAPServerCheckMailCheckbox); - ShowAndUncripplePane(kIMAPServerCheckTimeEditText); - - if (! inDialogInit) // copy the user name over - { - CopyTextValue(kPOPServerUserNameEditText, kIMAPServerUserNameEditText); - CopyTextValue(kPOPServerCheckTimeEditText, kIMAPServerCheckTimeEditText); - - CopyNumberValue(kPOPServerSavePasswordCheckbox, kIMAPServerSavePasswordCheckbox); - CopyNumberValue(kPOPServerCheckMailCheckbox, kIMAPServerCheckMailCheckbox); - } - - mPOP = false; -} // StMailServerInfoHandler::SetIMAP - -//---------------------------------------------------------------------------------------- -void StMailServerInfoHandler::SetDefaultUserName() -// Set username to identity.username if it is not set. This -// gives a sensible default for the username field. -//---------------------------------------------------------------------------------------- -{ - CStr255 uname; - - if (mPOP) - GetText(kPOPServerUserNameEditText, uname); - else - GetText(kIMAPServerUserNameEditText, uname); - - if (uname.IsEmpty()) - { - UGetInfo::GetDefaultUserName(uname); - - if (mPOP) - SetText(kPOPServerUserNameEditText, uname); - else - SetText(kIMAPServerUserNameEditText, uname); - } -} - - -//---------------------------------------------------------------------------------------- -void StMailServerInfoHandler::GetServerName(CStr255 &outName) -//---------------------------------------------------------------------------------------- -{ - outName = mName; -} - - -//---------------------------------------------------------------------------------------- -void StMailServerInfoHandler::ReadDataFields() -//---------------------------------------------------------------------------------------- -{ - LWindow* window = GetDialog(); - // It's only legal to switch from POP to IMAP or back if there is exactly one server - // in question. - // In this case we also need to be careful to copy the text between the POP user name - // and IMAP user name fields for consistency when flipping between them - - if (mAllowServerTypeEdit) - { - HidePane(kMailServerTypeCaption); // the static text - ShowPane(kMailServerTypePopup); // the popup menu - SetValue(kMailServerTypePopup, kIMAP); // set the popup to IMAP as default - } - else - { - HidePane(kMailServerTypePopup); // the popup menu. - ShowPane(kMailServerTypeCaption); // the static text - } - - if (mAllowServerNameEdit) - { - HidePane(kMailServerNameCaption); - ShowPane(kMailServerNameEditText); // edittext - SetText(kMailServerNameEditText, mName); - - // A paste snooper to filter out bad characters - LBroadcasterEditField *serverNameEditField = dynamic_cast(window->FindPaneByID(kMailServerNameEditText)); - ThrowIfNil_(serverNameEditField); - serverNameEditField->AddAttachment(new CPasteSnooper("\r\n\t :;,/", "\b\b\b\b____")); - - // Also set a key filter. Are we paranoid or what? - serverNameEditField->SetKeyFilter(UMailFilters::ServerNameKeyFilter); - - } - else - { - ShowPane(kMailServerNameCaption); - HidePane(kMailServerNameEditText); // edittext - SetText(kMailServerNameCaption, mName); - SetText(kMailServerNameEditText, mName); // used to write prefs on destruction - } - - // show and hide the right controls - if (mPOP) - SetPOP(true); - else - SetIMAP(true); - - SetDefaultUserName(); - window->Show(); - // No need to do anything about the other prefs, - // the prefs controls have already read and initialize themselves. -} // StMailServerInfoHandler::ReadDataFields - -//---------------------------------------------------------------------------------------- -void StMailServerInfoHandler::WriteDataFields() -//---------------------------------------------------------------------------------------- -{ - mDataWritten = true; // this is just for the assert in the base class destructor - - if (! MPreferenceBase::GetWriteOnDestroy()) - return; - -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - // Popup is now a pref control. Server name is now an invisible edit field in the prefs - // pane (and that's the only case where it is changeable). - PREF_SetIntPref("mail.server_type", (int)!mPOP); // 0=POP, 1=IMAP - if (mPOP) - PREF_SetCharPref("network.hosts.pop_server", mName); -#endif - -#if 0 - if (mCreate || (mOriginallyPOP && !mPOP)) - { - // If we changed from POP to IMAP, we have to create the IMAP server doohicky here - - if (!mPOP) - { - // Create the host date in msglib first, using default values. Then, write out - // the preferences (automatic when the dialog is destroyed) so that they get - // suitably modified. - CStr255 uname; - GetText(kIMAPServerUserNameEditText, uname); - const char* userNameString = nil; - const char* serverNameString = nil; - try - { - userNameString = XP_STRDUP(uname); - ThrowIfNil_(userNameString); - serverNameString = XP_STRDUP(mName); - ThrowIfNil_(userNameString); - ::MSG_CreateIMAPHost( - CMailNewsContext::GetMailMaster(), - serverNameString, - false, // XP_Bool isSecure, - userNameString, // const char *userName, - false, // XP_Bool checkNewMail, - 0, // int biffInterval, - false, // XP_Bool rememberPassword, - true, // XP_Bool usingSubscription, - false, // XP_Bool overrideNamespaces, - nil, // const char *personalOnlineDir, - nil, // const char *publicOnlineDir, - nil // const char *otherUsersOnlineDir - ); - } - catch(...) - { - } - XP_FREEIF(const_cast(userNameString)); - XP_FREEIF(const_cast(serverNameString)); - } - } -#endif - - // No need to do anything else, the prefs controls will write themselves if WriteOnDestroy is true -} // StMailServerInfoHandler::WriteDataFields - -#pragma mark - - -//---------------------------------------------------------------------------------------- -UInt32 UGetInfo::CountIMAPServers() -//---------------------------------------------------------------------------------------- -{ - char *serverList = nil; - PREF_CopyCharPref("network.hosts.imap_servers", &serverList); - char* residue = serverList; - UInt32 result = 0; - do - { - if (residue) - { - residue++; // skip the comma (or, on the first pass, the initial char). - result++; - residue = XP_STRCHR(residue, ','); - } - } while (residue); - XP_FREEIF(serverList); - return result; -} - -//---------------------------------------------------------------------------------------- -void UGetInfo::ConductFolderInfoDialog(CMessageFolder& inFolder, LCommander* inSuper) -//---------------------------------------------------------------------------------------- -{ - if (inFolder.IsMailServer()) - { - try - { - CStr255 pname(inFolder.GetName()); - if (inFolder.IsLocalMailFolder()) - { - // More special POP dreck - char* name = nil; - ::PREF_CopyCharPref("network.hosts.pop_server", &name); - pname = name; - XP_FREEIF(name); - } - Boolean usePOP = !inFolder.IsIMAPMailFolder(); - - if (ConductMailServerInfoDialog(pname, usePOP, false, false, false, - kStandAloneDialog, nil, nil, inSuper)) - { - PREF_SavePrefFile(); - } - } - catch(...) - { - } - } - else if (inFolder.IsMailFolder()) - { - StMailFolderGetInfoHandler handler(inFolder, inSuper); - handler.DoDialog(); - } - else if (inFolder.IsNewsHost()) - { - StNewsHostGetInfoHandler handler(::MSG_GetHostForFolder(inFolder), inSuper); - handler.DoDialog(); - } - else if (inFolder.IsNewsgroup()) - { - StNewsGroupGetInfoHandler handler(inFolder, inSuper); - handler.DoDialog(); - } -} // UGetInfo::ConductGetInfoDialog - -//---------------------------------------------------------------------------------------- -Boolean UGetInfo::ConductMailServerInfoDialog( - CStr255& ioName, - Boolean& ioPOP, - Boolean inIsNewServer, - Boolean inAllowServerNameEdit, - Boolean inAllowTypeChange, - Boolean inUsePrefsCache, - ServerNameValidationFunc inValidationFunc, - CServerListMediator* inValidationServerMediator, - LCommander* inSuper) -// -// The mail server properties dialog is brought up from two places; the folder -// pane, as a Get Info dialog, and in the preferences, as the mail server edit -// dialog. When instantiated from the prefs dialog, we only want to save out -// the prefs if the user OKs the entire prefs dialog. To achieve this we -// have the controls write out their values into a temp prefs tree, e.g. -// "temp_prefs_mac.network.mail.check_time". When the user OKs the prefs dialog -// all these prefs are copied to the main preferences, in CPrefsDialog::Finished(). -// -// This prefs cacheing functionality is perfomed by MPreferenceBase. -// -// When used as a properties dialog, the controls write their values directly -// into the main prefs. -// -//---------------------------------------------------------------------------------------- -{ - MessageT result; - - // Use the nifty "mail.imap.server.." preference convention. Our - // constructor resources have "mail.imap.server.^0.", and the MPreferenceBase - // class knows how to replace ^0 by the replacement string. - - { - MPreferenceBase::StReplacementString stringSetter(ioName); // used for replacing ^0 in the controls prefs - // strings with the server name - MPreferenceBase::StWriteOnDestroy writeSetter(false); - MPreferenceBase::StUseTempPrefCache tempSetter(inUsePrefsCache); // used to force the controls to read (if pos) - // and write to a temp prefs tree - - { // <-- StMailServerInfoHandler scope - StMailServerInfoHandler theHandler(ioName, ioPOP, inIsNewServer, inAllowServerNameEdit, inAllowTypeChange, - inValidationFunc, inValidationServerMediator, inSuper); - - result = theHandler.DoDialog(); - - // The user may have modified the server name. Update the replacement string before handler destruction - CStr255 newServerName; - theHandler.GetServerName(newServerName); - - ioName = newServerName; - ioPOP = theHandler.GetPop(); - - MPreferenceBase::SetReplacementString(newServerName); - - // Handler is destroyed, and prefs saved. Write on destroy is set in the destructor - } // <-- StMailServerInfoHandler scope - } - - return (result == msg_OK); -} // UGetInfo::ConductMailServerInfoDialog - -//---------------------------------------------------------------------------------------- -Boolean UGetInfo::ConductNewsServerInfoDialog( - MSG_Host* inHost, - LCommander* inSuper) -//---------------------------------------------------------------------------------------- -{ - StNewsHostGetInfoHandler handler(inHost, inSuper); - MessageT result = handler.DoDialog(); - return (result == msg_OK); -} // UGetInfo::ConductNewsServerInfoDialog - -//---------------------------------------------------------------------------------------- -/* static */ void UGetInfo::GetDefaultUserName(CStr255& outName) -// Set username to identity.username if it is not set. This -// gives a sensible default for the username field. -//---------------------------------------------------------------------------------------- -{ - char cname[256]; - int cnamelength = sizeof(cname); - // Many people set up their profiles as "user@bar.com". Check for - // that format (no space, and an '@') - PREF_GetCharPref("mail.identity.username", cname, &cnamelength); - char* atPos = XP_STRCHR(cname, '@'); - char* spacePos = XP_STRCHR(cname, ' '); - if (spacePos || !atPos) - { - // Oh well, try using the email address up to the '@' - PREF_GetCharPref("mail.identity.useremail", cname, &cnamelength); - // strip off the username from the email address. - atPos = XP_STRCHR(cname, '@'); - } - if (atPos) - *atPos = 0; - outName = cname; -} - -//---------------------------------------------------------------------------------------- -void UGetInfo::RegisterGetInfoClasses() -//---------------------------------------------------------------------------------------- -{ -} - diff --git a/mozilla/cmd/macfe/MailNews/StGetInfoHandler.h b/mozilla/cmd/macfe/MailNews/StGetInfoHandler.h deleted file mode 100644 index ec39eea4eb3..00000000000 --- a/mozilla/cmd/macfe/MailNews/StGetInfoHandler.h +++ /dev/null @@ -1,84 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// StGetInfoHandler.h - -#pragma once -#include "UStdDialogs.h" - -class LCommander; -class CMessageFolder; -class CServerListMediator; -class MSG_Host; - - -//====================================== -class StGetInfoHandler : public StStdDialogHandler -//====================================== -{ - public: - StGetInfoHandler(ResIDT inDialogResID, - LCommander *inSuper) - : StStdDialogHandler(inDialogResID, inSuper) - , mDataWritten(false) - {} - virtual ~StGetInfoHandler(); - virtual void ReadDataFields() = 0; - virtual void WriteDataFields() = 0; - virtual Boolean UserDismissed(); - virtual MessageT DoDialog(); - - virtual void HideAndCripplePane(PaneIDT paneID); // crippled panes don't write their prefs out - virtual void ShowAndUncripplePane(PaneIDT paneID); - - protected: - Boolean mDataWritten; - -}; // class StGetInfoHandler - - -typedef Boolean (*ServerNameValidationFunc)(const CStr255& inServerName, Boolean inNewServer, const CServerListMediator* inServerList); - - -//====================================== -class UGetInfo -//====================================== -{ - public: - static UInt32 CountIMAPServers(); - static void ConductFolderInfoDialog(CMessageFolder&, LCommander* inSuper); - enum { kStandAloneDialog = false, kSubDialogOfPrefs = true }; - static Boolean ConductMailServerInfoDialog( - CStr255& ioName, - Boolean& ioPOP, - Boolean inIsNewServer, - Boolean inAllowServerNameEdit = false, - Boolean inAllowTypeChange = false, // whether to allow the user to change POP to IMAP or v.v. - Boolean inFromPrefsDialog = false, - ServerNameValidationFunc inValidationFunc = nil, - CServerListMediator* inValidationServerMediator = nil, - LCommander* inSuper = nil); - static Boolean ConductNewsServerInfoDialog( - MSG_Host* inHost, - LCommander* inSuper = nil); - static void RegisterGetInfoClasses(); - static void GetDefaultUserName(CStr255&); -}; - diff --git a/mozilla/cmd/macfe/MailNews/UIHelper.h b/mozilla/cmd/macfe/MailNews/UIHelper.h deleted file mode 100644 index f3cbb8d02cf..00000000000 --- a/mozilla/cmd/macfe/MailNews/UIHelper.h +++ /dev/null @@ -1,59 +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. - */ - - - -// UIHelper.h - -#pragma once - -/////////////////////////////////////////////////////////////////////////////////// -// -// This file contains some helper functions for UI manipulation. -// -/////////////////////////////////////////////////////////////////////////////////// -// -// FindUIItemPtr - returns a pointer to the proper item -// Usage: -// -// LGAPushButton* button; -// LView view; -// PaneIDT paneID; -// -// FindUIItem( view, paneID, button ); -// -// It will throw an exception if the element is missing or the passed -// pointer is the wrong type. -// -/////////////////////////////////////////////////////////////////////////////////// - -#include "PP_Types.h" -#include "LView.h" -#include "nc_exception.h" - -/////////////////////////////////////////////////////////////////////////////////// -// FindUIItemPtr -template -inline -void -FindUIItemPtr( LView *inView, long inID, T*& outItemPtr ) -{ - outItemPtr = dynamic_cast( inView->FindPaneByID( inID ) ); - if( !outItemPtr ) - throw nc_exception( eUIResourceError ); -} diff --git a/mozilla/cmd/macfe/MailNews/UIMAPSubscriptionUpgrade.cp b/mozilla/cmd/macfe/MailNews/UIMAPSubscriptionUpgrade.cp deleted file mode 100644 index 202f4d94cb9..00000000000 --- a/mozilla/cmd/macfe/MailNews/UIMAPSubscriptionUpgrade.cp +++ /dev/null @@ -1,89 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -// This file implements a callback declared in msgcom.h, for presenting the IMAP -// subscription upgrade dialog. - -#include "msgcom.h" // For the prototype, and the enum for the return value. - -#include "PascalString.h" -#include "macutil.h" -#include "UStdDialogs.h" -#include "resgui.h" // for msg_Help -#include "xp_help.h" -#include -#include // for SysBeep() - -//---------------------------------------------------------------------------------------- -MSG_IMAPUpgradeType FE_PromptIMAPSubscriptionUpgrade(MWContext*, const char* hostName) -//---------------------------------------------------------------------------------------- -{ - StDialogHandler handler(14007, NULL); - LWindow* dialog = handler.GetDialog(); // initially invisible. - - // Find the radio button for the "Automatic" choice. - LGARadioButton* autoButton = (LGARadioButton*)dialog->FindPaneByID('AUTO'); - SignalIf_(!autoButton); - if (!autoButton) - return MSG_IMAPUpgradeDont; - - // Replace ^0 in the radio button string with the host name that was given to us - CStr255 workString; - autoButton->GetDescriptor(workString); - StringParamText(workString, hostName); - autoButton->SetDescriptor(workString); - - // Run the dialog - MSG_IMAPUpgradeType result = MSG_IMAPUpgradeAutomatic; - MessageT message = msg_Nothing; - if (UStdDialogs::TryToInteract()) - { - dialog->Show(); - do { - message = handler.DoDialog(); - switch (message) - { - case msg_Help: - ShowHelp( HELP_IMAP_UPGRADE ); - break; -#if 0 - // This doesn't work, and here's why. When one of the radio buttons is - // clicked, first the value message gets broadcast (good), and then - // the radio group broadcasts "msg_ControlClicked". Unfortunately, - // StDialogHandler merely stores the last message it receives! - case 'AUTO': - result = MSG_IMAPUpgradeAutomatic; - break; - case 'PICK': - result = MSG_IMAPUpgradeCustom; - break; -#endif - } - } while (message != msg_OK && message != msg_Cancel); - } - // Use the OK/Cancel message together with the value of the the radio button for - // the automatic choice to determine the result. - if (message != msg_OK) - result = MSG_IMAPUpgradeDont; - else if (autoButton->GetValue() == Button_On) - result = MSG_IMAPUpgradeAutomatic; - else - result = MSG_IMAPUpgradeCustom; - return result; -} // FE_PromptIMAPSubscriptionUpgrade diff --git a/mozilla/cmd/macfe/MailNews/UMailFilters.cp b/mozilla/cmd/macfe/MailNews/UMailFilters.cp deleted file mode 100644 index f8e42f6a3d2..00000000000 --- a/mozilla/cmd/macfe/MailNews/UMailFilters.cp +++ /dev/null @@ -1,84 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UMailFilters.cp - -//////////////////////////////////////////////////////////////////////////////////////// -// -// File containing key filters for Mail/News -// -// Usage -// ----- -// -// LEditField* edit = dynamic_cast( theWindow->FindPaneByID('XyWz') ); -// edit->SetKeyFilter( UMailFilters::HeaderField ); -// -// -//////////////////////////////////////////////////////////////////////////////////////// - -#include "UKeyFilters.h" -#include "UMailFilters.h" - - -EKeyStatus -UMailFilters::CustomHeaderFilter(TEHandle /*inMacTEH*/, Char16 inKeyCode, Char16 &ioCharCode, SInt16 /*inModifiers*/) -{ - if( IsTEDeleteKey( inKeyCode ) ) // need to trap this before the printing characters - return keyStatus_Input; - - if( IsActionKey( inKeyCode ) ) // need to trap this before the printing characters - return keyStatus_PassUp; - - if ( !IsPrintingChar( ioCharCode ) ) // ASCII 23 to 126 - return keyStatus_Reject; - - if ( ioCharCode == ':' || ioCharCode == ' ' ) // ':' and SPACE - { - ::SysBeep(32); - return keyStatus_Reject; - } - - return keyStatus_Input; -} - - - -// --------------------------------------------------------------------------- -// * ServerNameKeyFilter [static] -// --------------------------------------------------------------------------- - -EKeyStatus -UMailFilters::ServerNameKeyFilter(TEHandle /*inMacTEH*/, Char16 inKeyCode, Char16 &ioCharCode, SInt16 /*inModifiers*/) -{ - EKeyStatus theKeyStatus = keyStatus_PassUp; - - if (IsTEDeleteKey(inKeyCode)) - theKeyStatus = keyStatus_TEDelete; - else if (IsTECursorKey(inKeyCode)) - theKeyStatus = keyStatus_TECursor; - else if (IsExtraEditKey(inKeyCode)) - theKeyStatus = keyStatus_ExtraEdit; - else if (ioCharCode == ',' || ioCharCode == ' ' || ioCharCode == '/' || ioCharCode == ':' || ioCharCode == ';') - theKeyStatus = keyStatus_Reject; - else if (IsPrintingChar(ioCharCode)) - theKeyStatus = keyStatus_Input; - - return theKeyStatus; -} diff --git a/mozilla/cmd/macfe/MailNews/UMailFilters.h b/mozilla/cmd/macfe/MailNews/UMailFilters.h deleted file mode 100644 index 614a73f032f..00000000000 --- a/mozilla/cmd/macfe/MailNews/UMailFilters.h +++ /dev/null @@ -1,50 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UMailFilters.h - -#pragma once - -//////////////////////////////////////////////////////////////////////////////////////// -// -// File containing key filters for Mail/News -// -// Usage -// ----- -// -// LEditField* edit = dynamic_cast( theWindow->FindPaneByID('XyWz') ); -// edit->SetKeyFilter( UMailFilters::HeaderField ); -// -//////////////////////////////////////////////////////////////////////////////////////// - - -class UMailFilters : public UKeyFilters -{ - public: - - static EKeyStatus CustomHeaderFilter(TEHandle inMacTEH, Char16 inKeyCode, Char16 &ioCharCode, SInt16 inModifiers); - - static EKeyStatus ServerNameKeyFilter(TEHandle inMacTEH, Char16 inKeyCode, Char16 &ioCharCode, SInt16 inModifiers); - - protected: - - private: -}; - diff --git a/mozilla/cmd/macfe/MailNews/UMailSelection.cp b/mozilla/cmd/macfe/MailNews/UMailSelection.cp deleted file mode 100644 index 1360c960941..00000000000 --- a/mozilla/cmd/macfe/MailNews/UMailSelection.cp +++ /dev/null @@ -1,142 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -#include "UMailSelection.h" - -#include "msgcom.h" - -//---------------------------------------------------------------------------------------- -CMailSelection::CMailSelection() -//---------------------------------------------------------------------------------------- -: selectionList(NULL) -, xpPane(NULL) -, selectionSize(0) -, singleIndex(MSG_VIEWINDEXNONE) -{ -} - -//---------------------------------------------------------------------------------------- -void /*sic*/ CMailSelection::operator=(const CMailSelection& original) -//---------------------------------------------------------------------------------------- -{ - xpPane = original.xpPane; - singleIndex = original.singleIndex; - if (singleIndex != MSG_VIEWINDEXNONE) - SetSingleSelection(singleIndex); - else - { - selectionSize = original.selectionSize; - selectionList = const_cast(original.GetSelectionList()); - } -} - -//---------------------------------------------------------------------------------------- -const MSG_ViewIndex* CMailSelection::GetSelectionList() const -//---------------------------------------------------------------------------------------- -{ - return selectionList; -} // CMailSelection::GetSelectionList - -//---------------------------------------------------------------------------------------- -void CMailSelection::Normalize() -//---------------------------------------------------------------------------------------- -{ - // If singleIndex is a real index, then fix selectionList to - // point to it (eg, after assignment or fetching the bits out of - // a drag object) - if (singleIndex != MSG_VIEWINDEXNONE) - SetSingleSelection(singleIndex); -} - -//---------------------------------------------------------------------------------------- -CPersistentMailSelection::~CPersistentMailSelection() -// Can't be implemented inline, because it's a virtual function in a shared header file. -//---------------------------------------------------------------------------------------- -{ - DestroyData(); -} // CPersistentMailSelection::~CPersistentMailSelection - -//---------------------------------------------------------------------------------------- -const MSG_ViewIndex* CPersistentMailSelection::GetSelectionList() const -//---------------------------------------------------------------------------------------- -{ - CPersistentMailSelection* s = const_cast(this); - Assert_(s); - s->MakeAllVolatile(); - return selectionList; -} // CPersistentMailSelection::GetSelectionList - -//---------------------------------------------------------------------------------------- -void CPersistentMailSelection::CloneData() -//---------------------------------------------------------------------------------------- -{ - if (selectionSize == 0 || singleIndex != MSG_VIEWINDEXNONE) - return; // nothing to do - MSG_ViewIndex* src = selectionList; // owned by somebody else - selectionList = new MSG_ViewIndex[selectionSize]; - MSG_ViewIndex* dst = selectionList; - for (int i = 0; i < selectionSize; i++,dst++) - *dst = *src++; -} - -//---------------------------------------------------------------------------------------- -void CPersistentMailSelection::DestroyData() -//---------------------------------------------------------------------------------------- -{ - // You must call this if you called CloneData. - if (selectionSize != 0 && singleIndex == MSG_VIEWINDEXNONE) - delete [] selectionList; -} -//---------------------------------------------------------------------------------------- -void CPersistentFolderSelection::MakePersistent(MSG_ViewIndex& ioKey) const -//---------------------------------------------------------------------------------------- -{ - ioKey = (MSG_ViewIndex)::MSG_GetFolderInfo( - xpPane, - ioKey); -} - -//---------------------------------------------------------------------------------------- -void CPersistentFolderSelection::MakeVolatile(MSG_ViewIndex& ioKey) const -//---------------------------------------------------------------------------------------- -{ - ioKey = ::MSG_GetFolderIndexForInfo( - xpPane, - (MSG_FolderInfo *)ioKey, - true); -} - -//---------------------------------------------------------------------------------------- -void CPersistentMessageSelection::MakePersistent(MSG_ViewIndex& ioKey) const -//---------------------------------------------------------------------------------------- -{ - ioKey = (MSG_ViewIndex)::MSG_GetMessageKey( - xpPane, - ioKey); -} - -//---------------------------------------------------------------------------------------- -void CPersistentMessageSelection::MakeVolatile(MSG_ViewIndex& ioKey) const -//---------------------------------------------------------------------------------------- -{ - ioKey = ::MSG_GetMessageIndexForKey( - xpPane, - (MessageKey)ioKey, - true); -} diff --git a/mozilla/cmd/macfe/MailNews/UMailSelection.h b/mozilla/cmd/macfe/MailNews/UMailSelection.h deleted file mode 100644 index e1585dbdf43..00000000000 --- a/mozilla/cmd/macfe/MailNews/UMailSelection.h +++ /dev/null @@ -1,167 +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) 1996 Netscape Communications Corporation. All Rights - * Reserved. - */ - - -#pragma once - -typedef unsigned long MSG_ViewIndex; -typedef struct MSG_Pane MSG_Pane; - -//======================================================================================== -class CMailSelection -// Represents a selection in a CMailFlexTable (which can be folders or messages). Used -// for drag and drop, and all msglib command execution. -//======================================================================================== -{ -public: - CMailSelection(); - CMailSelection(const CMailSelection& original) - { - *this = original; // the assignment op. doesn't need to destroy anything... - } - void /*sic*/ operator=(const CMailSelection& original); - - virtual const MSG_ViewIndex* GetSelectionList() const; - - void SetSingleSelection(MSG_ViewIndex inSingleIndex) - { selectionSize = 1; - singleIndex = inSingleIndex; - selectionList = &singleIndex; - } - void Normalize(); - -public: - MSG_Pane* xpPane; // (threadpane or folder pane) - MSG_ViewIndex selectionSize; // # of selected indices (1-based) - MSG_ViewIndex singleIndex; // Something for selectionList to point to, without - // the need for an actual list to be present. Useful for - // the proxy drag case, e.g. -protected: - friend class CMailFlexTable; - MSG_ViewIndex* selectionList; // List of selected indices (zero-based), - // a reference to the mSelectionList in the table, - // so none of this data needs to be deleted by this - // object. -}; // class CMailSelection - -//======================================================================================== -class CPersistentMailSelection -// "Owns" its data. Clones data when duplicated, destroys data when deleted. -// The list of selected items can either be a list of indices (volatile) or a list of -// persistent keys (persistent). This state is indicated by the mDataIsVolatile member. -// Constructors and assignment operators always convert any non-trivial data to persistent -// form. -// GetSelectionList() still returns a list of indices (ie, the volatile form of the data), -// so it converts to volatile form before returning the result. -// This is an abstract class, because the form of the persistent key is particular to the -// view. See also the derived classes, CPersistentFolderSelection, and -// CPersistentMessageSelection. These classes override the MakePersistent() and -// MakeVolatile() methods. -//======================================================================================== -: public CMailSelection -{ - typedef CMailSelection Inherited; - -public: - // No copy constructor in the base class.! - // Since MakeAllPersistent() needs virtual functions, and we - // need the inherited behavior, we can't implement a copy constructor (indeed, - // it will crash if we do. Therefore we provide only a void constructor, - // forcing clients to use the assignment operator, which is safe. - CPersistentMailSelection() - : mDataIsVolatile (true) - { - } - virtual ~CPersistentMailSelection(); - - void /*sic*/ operator=(const CMailSelection& original) - { - DestroyData(); // like all good little assignment operators - CMailSelection::operator=(original); - mDataIsVolatile = true; - CloneData(); - MakeAllPersistent(); - } - virtual const MSG_ViewIndex* GetSelectionList() const; - -protected: - // We need versions of these for folders (MSG_FolderInfo*) and messages (MessageKey) - // See CPersistentFolderSelection and CPersistentMessageSelection. - virtual void MakePersistent(MSG_ViewIndex& ioKey) const = 0; - virtual void MakeVolatile(MSG_ViewIndex& ioKey) const = 0; - - void MakeAllVolatile() - { - if (mDataIsVolatile) - return; - MSG_ViewIndex* cur = selectionList; - for (int i = 0; i < selectionSize; i++,cur++) - MakeVolatile(*cur); - mDataIsVolatile = true; - } - void MakeAllPersistent() - { - if (!mDataIsVolatile) - return; - MSG_ViewIndex* cur = selectionList; - for (int i = 0; i < selectionSize; i++,cur++) - MakePersistent(*cur); - mDataIsVolatile = false; - } - void CloneData(); - - void DestroyData(); - - // data - Boolean mDataIsVolatile; -}; // class CPersistentMailSelection - -//======================================================================================== -class CPersistentFolderSelection -//======================================================================================== -: public CPersistentMailSelection -{ - public: - CPersistentFolderSelection(const CMailSelection& orig) - : CPersistentMailSelection() - { - // Void constructor of base class has now been - // called. Call the assignment operator to copy - // and convert. - CPersistentMailSelection::operator=(orig); - } - virtual void MakePersistent(MSG_ViewIndex& ioKey) const; - virtual void MakeVolatile(MSG_ViewIndex& ioKey) const; -}; // class CPersistentFolderSelection - -//======================================================================================== -class CPersistentMessageSelection -//======================================================================================== -: public CPersistentMailSelection -{ - public: - CPersistentMessageSelection(const CMailSelection& original) - : CPersistentMailSelection() - { - // Void constructor of base class has now been called. - // Call the assignment operator to copy and convert. - CPersistentMailSelection::operator=(original); - } - virtual void MakePersistent(MSG_ViewIndex& ioKey) const; - virtual void MakeVolatile(MSG_ViewIndex& ioKey) const; -}; // class CPersistentMessageSelection diff --git a/mozilla/cmd/macfe/MailNews/UMessageLibrary.cp b/mozilla/cmd/macfe/MailNews/UMessageLibrary.cp deleted file mode 100644 index 59eac59948f..00000000000 --- a/mozilla/cmd/macfe/MailNews/UMessageLibrary.cp +++ /dev/null @@ -1,251 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UMessageLibrary.cp - -#include "UMessageLibrary.h" - -// Want a command number? They hide in several places... -#include "Netscape_Constants.h" -#include "resgui.h" -#include "MailNewsgroupWindow_Defines.h" -#include "CApplicationEventAttachment.h" - -// necessary for hack that makes sure we can only have one -// open MSG_GetNewMail command at a time -#include "CMailProgressWindow.h" - -#include "macutil.h" -#include "PascalString.h" -#include "UOffline.h" - -//====================================== -// class UMessageLibrary -// Utility calls -//====================================== - -//----------------------------------- -/*static*/ Boolean UMessageLibrary::FindMessageLibraryCommandStatus( - MSG_Pane* inPane, - MSG_ViewIndex* inIndices, - int32 inNumIndices, - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -// returns false if not a msglib command. -// Commands enabled/disabled here are obeyed in CMailFlexTable::ObeyMessageLibraryCommand -//----------------------------------- -{ - MSG_CommandType cmd; - switch (inCommand) - { - case cmd_ToggleOffline: - case cmd_SynchronizeForOffline: - UOffline::FindOfflineCommandStatus(inCommand, outEnabled, outName); - return true; - case cmd_ToggleThreadKilled: - // cmd_ToggleThreadKilled: ugh! it's a navigate command, but navigatestatus - // doesn't support it! So when testing for enabling, we have to call commandstatus, - // but in executing, we have to call navigate. UMessageLibrary now treats this - // as a navigate command, hence this hack here to override this behavior. - cmd = MSG_ToggleThreadKilled; - break; - case cmd_CompressAllFolders: - cmd = MSG_CompressFolder; // see hack below. - break; - default: - cmd = UMessageLibrary::GetMSGCommand(inCommand); - break; - } - - - if (!UMessageLibrary::IsValidCommand(cmd)) - return false; - if (inPane == nil) - return false; - - XP_Bool selectable = false; - MSG_COMMAND_CHECK_STATE checkedState; - const char* display_string = nil; - XP_Bool plural; - if (MSG_CommandStatus( - inPane, - cmd, - inIndices, - inNumIndices, - &selectable, - &checkedState, - &display_string, - &plural) - >= 0) - { - // The logic is: if the selection permits MSG_CompressFolder, then do that. - // Otherwise, try for MSG_CompressAllFolders. - if (cmd == MSG_CompressFolder && !selectable) - { - const char* redo_string = nil; - if (MSG_CommandStatus( - inPane, - MSG_CompressAllFolders, - inIndices, - inNumIndices, - &selectable, - &checkedState, - &redo_string, - &plural) - >= 0 && selectable) - { - display_string = redo_string; - } - } - outEnabled = (Boolean)selectable; - outUsesMark = true; - if (checkedState == MSG_Checked) - outMark = checkMark; - else - outMark = 0; - switch (cmd) - { - // commands where we don't like the back end's command strings: - case MSG_AddSender: - case MSG_AddAll: - case MSG_ReplyToSender: - case MSG_ReplyToAll: - case MSG_PostReply: - case MSG_PostAndMailReply: - case MSG_DoRenameFolder: - case MSG_DeleteMessage: - case MSG_DeleteMessageNoTrash: - break; - // All other commands, use the back-end string, if any. - default: - if (display_string && *display_string) - *(CStr255*)outName = display_string; - } - } - - if ((cmd == MSG_GetNewMail) && selectable) - if (CMailProgressWindow::GettingMail()) - outEnabled = false; - - return true; -} - -//----------------------------------- -MSG_CommandType UMessageLibrary::GetMSGCommand(CommandT inCommand) -//----------------------------------- -{ - switch (inCommand) - { - case cmd_Undo: return MSG_Undo; - case cmd_Redo: return MSG_Redo; - case cmd_Clear: - return ( - CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) - ? MSG_DeleteNoTrash - : MSG_Delete - ); - case cmd_NewFolder: return MSG_NewFolder; - case cmd_RenameFolder: return MSG_DoRenameFolder; - case cmd_EmptyTrash: return MSG_EmptyTrash; - case cmd_CompressFolder: return MSG_CompressFolder; - case cmd_CompressAllFolders: return MSG_CompressAllFolders; - case cmd_ManageMailAccount: return MSG_ManageMailAccount; - case cmd_NewNewsgroup: return MSG_NewNewsgroup; - case cmd_ModerateNewsgroup: return MSG_ModerateNewsgroup; - - case cmd_NewMailMessage: return MSG_MailNew; - case cmd_ReplyToSender: return MSG_ReplyToSender; - case cmd_PostReply: return MSG_PostReply; - case cmd_PostAndMailReply: return MSG_PostAndMailReply; - case cmd_PostNew: return MSG_PostNew; - case cmd_ReplyToAll: return MSG_ReplyToAll; - case cmd_ForwardMessage: return MSG_ForwardMessage; - case cmd_ForwardMessageQuoted: return MSG_ForwardMessageQuoted; - case cmd_ForwardMessageAttachment: return MSG_ForwardMessageAttachment; - case cmd_ForwardMessageInline: return MSG_ForwardMessageInline; - case cmd_MarkMessage: return MSG_MarkMessages; // same cmd - case cmd_MarkSelectedMessages: return MSG_MarkMessages; // '' '' - case cmd_MarkUnread: return MSG_MarkMessagesUnread; - case cmd_MarkRead: return MSG_MarkMessagesRead; - case cmd_UnmarkSelectedMessages: return MSG_UnmarkMessages; - case cmd_MarkThreadRead: return MSG_MarkThreadRead; - case cmd_MarkAllRead: return MSG_MarkAllRead; - - case cmd_GetNewMail: return MSG_GetNewMail; - case cmd_SelectForOffline: return MSG_RetrieveSelectedMessages; - case cmd_FlaggedForOffline: return MSG_RetrieveMarkedMessages; - - case cmd_GetMoreMessages: return MSG_GetNextChunkMessages; - case cmd_ShowOnlyUnreadMessages: return MSG_ViewNewOnly; - case cmd_ShowMicroMessageHeaders: return MSG_ShowMicroHeaders; - case cmd_ShowSomeMessageHeaders: return MSG_ShowSomeHeaders; - case cmd_ShowAllMessageHeaders: return MSG_ShowAllHeaders; - case cmd_DeliverQueuedMessages: return MSG_DeliverQueuedMessages; - case cmd_UpdateMessageCount: return MSG_UpdateMessageCount; - case cmd_ShowAllMessages: return MSG_ViewAllThreads; - - case cmd_AttachmentsInline: return MSG_AttachmentsInline; - case cmd_AttachmentsAsLinks: return MSG_AttachmentsAsLinks; - case cmd_AddSenderToAddressBook: return MSG_AddSender; - case cmd_AddAllToAddressBook: return MSG_AddAll; - //case cmd_ToggleThreadKilled: return MSG_ToggleThreadKilled; // actually a motiontype! - case cmd_ToggleThreadWatched: return MSG_ToggleThreadWatched; - case cmd_ViewAllThreads: return MSG_ViewAllThreads; - case cmd_ViewKilledThreads: return MSG_ViewKilledThreads; - case cmd_ViewThreadsWithNew: return MSG_ViewThreadsWithNew; - case cmd_ViewWatchedThreadsWithNew: return MSG_ViewWatchedThreadsWithNew; - case cmd_ViewNewOnly: return MSG_ViewNewOnly; - case cmd_EditMessage: return MSG_OpenMessageAsDraft; - case cmd_WrapLongLines: return MSG_WrapLongLines; - -//#define MAP_CMD_TO_MSG(verb) case cmd_##verb: return MSG_##verb; - - } - return (MSG_CommandType)invalid_command; -} - -//----------------------------------- -MSG_MotionType UMessageLibrary::GetMotionType(CommandT inCommand) -//----------------------------------- -{ - switch (inCommand) - { - case cmd_Back: return MSG_Back; - case cmd_GoForward: return MSG_Forward; - case cmd_NextMessage: return MSG_NextMessage; - case cmd_NextUnreadMessage: return MSG_NextUnreadMessage; - case cmd_PreviousUnreadMessage: return MSG_PreviousUnreadMessage; - case cmd_PreviousMessage: return MSG_PreviousMessage; - case cmd_NextUnreadGroup: return MSG_NextUnreadGroup; - case cmd_NextUnreadThread: return MSG_NextUnreadThread; - case cmd_MarkReadForLater: return MSG_LaterMessage; - case cmd_NextFolder: return MSG_NextFolder; - case cmd_FirstFlagged: return MSG_FirstFlagged; - case cmd_PreviousFlagged: return MSG_PreviousFlagged; - case cmd_NextFlagged: return MSG_NextFlagged; - case cmd_ToggleThreadKilled: return (MSG_MotionType)MSG_ToggleThreadKilled; - - } - return (MSG_MotionType)invalid_command; -} - diff --git a/mozilla/cmd/macfe/MailNews/UMessageLibrary.h b/mozilla/cmd/macfe/MailNews/UMessageLibrary.h deleted file mode 100644 index 7ac87258bed..00000000000 --- a/mozilla/cmd/macfe/MailNews/UMessageLibrary.h +++ /dev/null @@ -1,52 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UMessageLibrary.h - -#pragma once -#include "msgcom.h" - -//====================================== -class UMessageLibrary -// Utility calls -//====================================== -{ -public: - enum { invalid_command = 0xFFFFFFFF }; - - static MSG_MotionType GetMotionType(CommandT inCommand); - // Converts a FE command number to a msgcom.h motion command ID. - // Test result with IsValidMotion() - static Boolean IsValidMotion(MSG_MotionType cmd) { return cmd != invalid_command; } - - static MSG_CommandType GetMSGCommand(CommandT inCommand); - // Converts a FE command number to a msgcom.h command ID. - // Test result with IsValidCommand - static Boolean IsValidCommand(MSG_CommandType cmd) { return cmd != invalid_command; } - static Boolean FindMessageLibraryCommandStatus( - MSG_Pane* inPane, - MSG_ViewIndex* inIndices, - int32 inNumIndices, - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); -}; // class UMessageLibrary diff --git a/mozilla/cmd/macfe/MailNews/UNewFolderDialog.cp b/mozilla/cmd/macfe/MailNews/UNewFolderDialog.cp deleted file mode 100644 index f3f72d7fe68..00000000000 --- a/mozilla/cmd/macfe/MailNews/UNewFolderDialog.cp +++ /dev/null @@ -1,566 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UNewFolderDialog.cp - -#ifndef MOZ_LITE - -#include "UNewFolderDialog.h" - -#include "CMessageFolder.h" -#include "PascalString.h" -#include "UMailFolderMenus.h" -#include "CMailFolderButtonPopup.h" -#include "CMailNewsContext.h" -#include "CMailProgressWindow.h" -#include "MailNewsCallbacks.h" - -#include "prefapi.h" -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS - -#include "macutil.h" -#include "uerrmgr.h" -#include "ufilemgr.h" -#include "uprefd.h" - -#include -#include -#include - -//---------------------------------------------------------------------------------------- -Boolean UFolderDialogs::ConductNewFolderDialog( - const CMessageFolder& inParentFolder, - CMailCallbackListener* inListener) -//---------------------------------------------------------------------------------------- -{ - // Put up dialog - StDialogHandler handler(14010, NULL); - - // Select the "Host" edit field - LWindow* dialog = handler.GetDialog(); - LGAEditField *namefield = (LGAEditField*)dialog->FindPaneByID('Name'); - SignalIf_(!namefield); - CMailFolderGAPopup* folderPopup = (CMailFolderGAPopup*)dialog->FindPaneByID('MfPM'); - SignalIf_(!folderPopup); - if (!folderPopup || ! namefield) - return false; - dialog->SetLatentSub(namefield); - CMailFolderMixin::FolderChoices c - = (CMailFolderMixin::FolderChoices)( - (int)CMailFolderMixin::eWantPOP - | (int)CMailFolderMixin::eWantIMAP - | (int)CMailFolderMixin::eWantHosts); - folderPopup->MSetFolderChoices(c); - CMailFolderMixin::UpdateMailFolderMixinsNow(folderPopup); - MSG_Master* master = CMailNewsContext::GetMailMaster(); - MSG_FolderInfo* suggestedParent - = ::MSG_SuggestNewFolderParent(inParentFolder, master); - folderPopup->MSetSelectedFolder(suggestedParent, false); - - // Run the dialog - MessageT message = msg_Nothing; - Boolean userChangedPort = false; - do { - message = handler.DoDialog(); - } while (message != msg_OK && message != msg_Cancel); - - // Use the result. - Boolean folderCreated = false; - if (message == msg_OK) - { - CStr255 nametext; - namefield->GetDescriptor(nametext); - CStr255 commandName; - dialog->GetDescriptor(commandName); - - try - { - dialog->Hide(); - MSG_Pane* pane = CMailProgressWindow::JustGiveMeAPane(commandName); - // this throws if appropriate - if (inListener) - inListener->SetPane(pane); - folderCreated = ::MSG_CreateMailFolderWithPane( - pane, - master, - (MSG_FolderInfo*)folderPopup->MGetSelectedFolder(), - nametext) == 0; - if( folderCreated == false ) - { - // Send a message out to close the progress window - FE_PaneChanged( pane, false , MSG_PaneProgressDone, 0); - } - } - catch (...) - { - throw; - } - } - return folderCreated; -} // ConductNewFolderDialog - -//---------------------------------------------------------------------------------------- -Boolean UFolderDialogs::GetDefaultFolderName( - FolderKind inKind, - CStr255& outFolderName) -//---------------------------------------------------------------------------------------- -{ - switch (inKind) - { - case mail_fcc: - case news_fcc: - outFolderName = XP_GetString(MK_MSG_SENT_L10N_NAME); - return true; - case drafts: - outFolderName = XP_GetString(MK_MSG_DRAFTS_L10N_NAME); - return true; - case templates: - outFolderName = XP_GetString(MK_MSG_TEMPLATES_L10N_NAME); - return true; - } - return false; -} // GetDefaultFolderName - -//---------------------------------------------------------------------------------------- -Boolean UFolderDialogs::FindLocalMailHost(CMessageFolder& outFolder) -//---------------------------------------------------------------------------------------- -{ - MSG_Master* master = CMailNewsContext::GetMailMaster(); - // See also UMailFolderMenus::UpdateMailFolderMixinsNow - Int32 numFoldersMail = ::MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_MAIL, nil, 0); - Assert_(numFoldersMail > 0); // Should have at least some permanent mail folders! - StPointerBlock folderInfoData(sizeof(MSG_FolderInfo *) * numFoldersMail); - MSG_FolderInfo **folderInfo = (MSG_FolderInfo **) folderInfoData.mPtr; - Int32 numFolders2 = ::MSG_GetFoldersWithFlag( - master, MSG_FOLDER_FLAG_MAIL, folderInfo, numFoldersMail); - Assert_(numFolders2 > 0); // Should have at least some permanent mail folders! - Assert_(numFolders2 == numFoldersMail); - for (int i = 0; i < numFoldersMail; i++, folderInfo++) - { - CMessageFolder f(*folderInfo); - if (!f.IsIMAPMailFolder() && f.GetLevel() == kRootLevel) - { - outFolder = f; - return true; - } - } - return false; -} // UFolderDialogs::FindLocalMailHost - -//---------------------------------------------------------------------------------------- -Boolean UFolderDialogs::GetFolderAndServerNames( - const CMessageFolder& inFolder, - FolderKind inKind, - CStr255& outFolderName, - CMessageFolder& outServer, - Boolean* outMatchesDefault) -//---------------------------------------------------------------------------------------- -{ - CStr255 defaultFolderName; - if (!GetDefaultFolderName(inKind, defaultFolderName)) - return false; - if (inFolder.GetFolderInfo() == nil) - { - if (!FindLocalMailHost(outServer)) - return false; - outFolderName = defaultFolderName; - if (outMatchesDefault) - *outMatchesDefault = true; - return true; - } - else if (inFolder.IsMailServer()) - { - outServer = inFolder; - outFolderName = defaultFolderName; - if (outMatchesDefault) - *outMatchesDefault = true; - return true; - } - else if (inFolder.IsLocalMailFolder()) - { - // GetHostFolderinfo doesn't work for local folders... - if (!FindLocalMailHost(outServer)) - return false; - } - else - outServer.SetFolderInfo(GetHostFolderInfo(inFolder)); - outFolderName = inFolder.GetName(); - if (outMatchesDefault) - *outMatchesDefault = (defaultFolderName == outFolderName - && inFolder.GetLevel() == kSpecialFolderLevel); - return true; -} // UFolderDialogs::GetFolderAndServerNames - -//---------------------------------------------------------------------------------------- -Boolean UFolderDialogs::GetFolderAndServerNames( - const char* inPrefName, - CMessageFolder& outFolder, - CStr255& outFolderName, - CMessageFolder& outServer, - Boolean* outMatchesDefault) -//---------------------------------------------------------------------------------------- -{ - FolderKind kind; - if (XP_STRSTR(inPrefName, ".default_fcc")) - { - if (XP_STRSTR(inPrefName, "news") == inPrefName) - kind = news_fcc; - else - kind = mail_fcc; - // The Dogbert (v4.0) pref was binary (a mac alias); If we're upgrading from Dogbert, - // Even in 4.5, local folders still use this - // scheme. - AliasHandle aliasH = NULL; - int size; - void* alias; - if (PREF_CopyBinaryPref(inPrefName, &alias, &size ) == 0) - { - PtrToHand(alias, &(Handle)aliasH, size); - XP_FREE(alias); - - FSSpec target; - Boolean wasChanged; // ignored - OSErr err = ResolveAlias(nil, aliasH, &target, &wasChanged); - DisposeHandle((Handle)aliasH); - - if (err == noErr) - { - // We have to work out whether this is the default folder. There are two - // possibilities that should cause a match. - CStr255 defaultFolderName; - GetDefaultFolderName(kind, defaultFolderName); // eg "Sent", "Templates"... - - // Case (1) - // The spec is the spec of the - // root of the local mail folder tree (usually "Mail", but user-settable). - // This, by convention, signifies the folder with the default name (eg "Sent") - // for this type of special folder. - FSSpec mailTop = CPrefs::GetFolderSpec(CPrefs::MailFolder); - Boolean matchesDefault = mailTop. vRefNum == target.vRefNum - && mailTop.parID == target.parID - && *(CStr63*)mailTop.name == *(CStr63*)target.name; - - if (matchesDefault) - { - // Change target spec to be the spec of the actual folder - CStr255 relativePath; - relativePath += ':'; - relativePath += *(CStr63*)mailTop.name; - relativePath += ':'; - relativePath += defaultFolderName; - err = FSMakeFSSpec( - mailTop.vRefNum, - mailTop.parID, - relativePath, - &target); - if (err != fnfErr) - ThrowIfOSErr_(err); // This would be bad? - } - // Case (2) - // The spec is explicitly the spec of the default folder. - else - { - // Get a prototype for a file inside the top mail folder - // Try again with that plus the default name. - mailTop = CPrefs::GetFilePrototype(CPrefs::MailFolder); - matchesDefault = mailTop. vRefNum == target.vRefNum - && mailTop.parID == target.parID - && defaultFolderName == *(CStr63*)target.name; - } - if (outMatchesDefault) - *outMatchesDefault = matchesDefault; - outFolderName = target.name; - // Check whether the directory exists. - FInfo info; - err = FSpGetFInfo(&target, &info); - if (err == fnfErr) - { - outFolder.SetFolderInfo(nil); - } - else - { - char* appPath = CFileMgr::EncodedPathNameFromFSSpec(target, true); - if (!appPath) - return false; - char* url = XP_STRDUP("mailbox:"); - StrAllocCat(url, appPath); - XP_FREE(appPath); - if (!url) - return false; - MSG_FolderInfo* info = ::MSG_GetFolderInfoFromURL( - CMailNewsContext::GetMailMaster(), - url, false); - XP_FREE(url); - outFolder.SetFolderInfo(info); - } - FindLocalMailHost(outServer); - return true; - } - } - } - // Remaining cases are URL paths. - else if (XP_STRCMP(inPrefName, "news.imap_sentmail_path") == 0) - kind = news_fcc; - else if (XP_STRCMP(inPrefName, "mail.imap_sentmail_path") == 0) - kind = mail_fcc; - else if (XP_STRSTR(inPrefName, "drafts")) - kind = drafts; - else if (XP_STRSTR(inPrefName, "templates")) - kind = templates; - // Here's the new way. It's always a char pref, and a URL. - char* url; - int prefResult = PREF_CopyCharPref(inPrefName, &url); - if (prefResult == PREF_NOERROR) - { - MSG_FolderInfo* info = ::MSG_GetFolderInfoFromURL( - CMailNewsContext::GetMailMaster(), - url, false); - outFolder.SetFolderInfo(info); - } - return GetFolderAndServerNames( - outFolder, - kind, - outFolderName, - outServer, - outMatchesDefault); -} // UFolderDialogs::GetFolderAndServerNames - -//---------------------------------------------------------------------------------------- -static Boolean SavePrefAsAlias(UFolderDialogs::FolderKind kind) -// More mess here, because the mail_fcc and news_fcc prefs are either: -// Binary prefs (aliases) if they're local, or -// String prefs (URLs) if they're IMAP. -//---------------------------------------------------------------------------------------- -{ - XP_Bool useIMAP; - if (kind == UFolderDialogs::mail_fcc) - { - if (PREF_NOERROR != PREF_GetBoolPref("mail.use_imap_sentmail", &useIMAP) || !useIMAP) - return true; - } - else if (kind == UFolderDialogs::news_fcc) - { - if (PREF_NOERROR != PREF_GetBoolPref("news.use_imap_sentmail", &useIMAP) || !useIMAP) - return true; - } - return false; -} // SavePrefAsAlias - -//---------------------------------------------------------------------------------------- -void UFolderDialogs::BuildPrefName(FolderKind kind, CStr255& outPrefName, Boolean& outSaveAsAlias) // e.g. Sent -//---------------------------------------------------------------------------------------- -{ - outPrefName = "\p^0.default_^1"; - outSaveAsAlias = false; - const char* r1 = (kind == news_fcc) ? "news" : "mail"; - const char* r2; - switch (kind) - { - case drafts: - r2 = "drafts"; - break; - case templates: - r2 = "templates"; - break; - case news_fcc: - case mail_fcc: - outSaveAsAlias = SavePrefAsAlias(kind); - if (!outSaveAsAlias) - { - // IMAP case : completely different prefname - outPrefName = "^0.imap_sentmail_path"; - } - r2 = "fcc"; - break; - } - StringParamText(outPrefName, r1, r2); -} // UFolderDialogs::BuildPrefName - -//====================================== -class CCreateFolderListener -// This is so we can get notified when the new folder is created, and select it in -// the popup menu. -//====================================== -: public CMailCallbackListener -{ -public: - CCreateFolderListener(CMailFolderGAPopup* inPopup) - : CMailCallbackListener() - , mPopup(inPopup) {} - virtual void PaneChanged( - MSG_Pane*, - MSG_PANE_CHANGED_NOTIFY_CODE inNotifyCode, - int32 value) - { - MSG_FolderInfo* info = nil; - // not notified for local folders. GRR!!! - if (inNotifyCode == MSG_PaneNotifySelectNewFolder) - { - MSG_ViewIndex index = (MSG_ViewIndex)value; - if (index == MSG_VIEWINDEXNONE) - return; // This is what we used to get - MSG_Pane* folderPane = ::MSG_FindPaneOfType( - CMailNewsContext::GetMailMaster(), - nil, - MSG_FOLDERPANE); - if (!folderPane) - return; - info = ::MSG_GetFolderInfo(folderPane, index); - } - else if (inNotifyCode != MSG_PaneProgressDone) - return; - if (mPopup) - CMailFolderMixin::UpdateMailFolderMixinsNow(mPopup); - if (info) - mPopup->MSetSelectedFolder(info, false); - } - CMailFolderGAPopup* mPopup; -}; // class CCreateFolderListener - -//---------------------------------------------------------------------------------------- -CMessageFolder UFolderDialogs::ConductSpecialFolderDialog( - FolderKind inKind, // e.g. Sent - const CMessageFolder& inCurFolder // URL of currentURL if pref is not saved yet - ) -// Returns nil if user cancels, URL otherwise. -// Sorry about the spaghetti. It's all single-purpose code. Ugh. -//---------------------------------------------------------------------------------------- -{ - // Get the strings we'll need - CStr255 defaultFolderName; - GetDefaultFolderName(inKind, defaultFolderName); - - // Construct the prefname from the kind - CStr255 prefName; - Boolean saveAsAlias; - BuildPrefName(inKind, prefName, saveAsAlias); - - // Put up dialog (which is initially invisible, because fiddling with the title - // is unsightly after it is visible). - StDialogHandler handler(14011, NULL); - - LWindow* dialog = handler.GetDialog(); - CStr255 workString; - dialog->GetDescriptor(workString); - StringParamText(workString, defaultFolderName); - dialog->SetDescriptor(workString); - - LCaption* blurb = (LCaption*)dialog->FindPaneByID('Blrb'); - SignalIf_(!blurb); - if (!blurb) - return nil; - blurb->GetDescriptor(workString); - StringParamText(workString, defaultFolderName); - blurb->SetDescriptor(workString); - - LGARadioButton* simpleCaseRadio = (LGARadioButton*)dialog->FindPaneByID('Fldr'); - SignalIf_(!simpleCaseRadio); - if (!simpleCaseRadio) - return nil; - simpleCaseRadio->GetDescriptor(workString); - StringParamText(workString, defaultFolderName); - simpleCaseRadio->SetDescriptor(workString); - - CMailFolderGAPopup* serverPopup = (CMailFolderGAPopup*)dialog->FindPaneByID('Srvr'); - SignalIf_(!serverPopup); - if (!serverPopup) - return nil; - - LGARadioButton* customCaseRadio = (LGARadioButton*)dialog->FindPaneByID('Othr'); - SignalIf_(!customCaseRadio); - if (!customCaseRadio) - return nil; - - CMailFolderGAPopup* folderPopup = (CMailFolderGAPopup*)dialog->FindPaneByID('MfPM'); - SignalIf_(!folderPopup); - if (!folderPopup) - return nil; - - // Set up the popup folder menus, and select the current preference - CStr255 curFolderName; - CMessageFolder curFolder = inCurFolder, curServer; - Boolean matchesDefault; - // If we were passed a current default from an unsaved pref, use that. - if (inCurFolder.GetFolderInfo() != nil) - GetFolderAndServerNames( - inCurFolder, - inKind, - curFolderName, - curServer, - &matchesDefault); - else if (!GetFolderAndServerNames( - prefName, - curFolder, - curFolderName, - curServer, - &matchesDefault)) - Assert_(false); - - if (matchesDefault) - simpleCaseRadio->SetValue(1); - else - customCaseRadio->SetValue(1); - - CMailFolderMixin::FolderChoices c - = (CMailFolderMixin::FolderChoices)((int)CMailFolderMixin::eWantPOP + (int)CMailFolderMixin::eWantIMAP); - folderPopup->MSetFolderChoices(c); - CMailFolderMixin::UpdateMailFolderMixinsNow(folderPopup); - folderPopup->MSetSelectedFolder(curFolder, false); - CCreateFolderListener creationListener(folderPopup); - // create a listener to reset the menu when a folder's created. - - c = (CMailFolderMixin::FolderChoices)((int)CMailFolderMixin::eWantHosts); - serverPopup->MSetFolderChoices(c); - CMailFolderMixin::UpdateMailFolderMixinsNow(serverPopup); - serverPopup->MSetSelectedFolder(curServer, false); - - // Run the dialog - MessageT message = msg_Nothing; - dialog->Show(); - do { - message = handler.DoDialog(); - switch (message) - { - case 'NewÉ': // the "new folder" button - { - CMessageFolder parent(nil); - ConductNewFolderDialog(parent, &creationListener); - break; - } - case 'HELP': - SysBeep(1); - break; - } - } while (message != msg_OK && message != msg_Cancel); - - // Use the result. - if (message == msg_OK) - { - if (simpleCaseRadio->GetValue() == 1) - return serverPopup->MGetSelectedFolder(); - else - return folderPopup->MGetSelectedFolder(); - } - return nil; -} // ConductSpecialFolderDialog - -#endif // MOZ_LITE diff --git a/mozilla/cmd/macfe/MailNews/UNewFolderDialog.h b/mozilla/cmd/macfe/MailNews/UNewFolderDialog.h deleted file mode 100644 index a4af9520644..00000000000 --- a/mozilla/cmd/macfe/MailNews/UNewFolderDialog.h +++ /dev/null @@ -1,69 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UNewFolderDialog.h - -#pragma once - -class CMessageFolder; -class CMailCallbackListener; -class CStr255; -struct MSG_Pane; -struct MSG_FolderInfo; - -//====================================== -class UFolderDialogs -//====================================== -{ -public: - static Boolean ConductNewFolderDialog( - const CMessageFolder& inParentFolder, - CMailCallbackListener* inListener = nil); - // Can listen for MSG_PaneNotifySelectNewFolder - enum FolderKind { drafts, templates, mail_fcc, news_fcc, num_kinds }; - static CMessageFolder - ConductSpecialFolderDialog( - FolderKind inKind, // e.g. Sent - const CMessageFolder& inCurFolder // if pref is not saved yet - ); - // Returns nil if user cancels, chosen folder. - - static void BuildPrefName( - FolderKind inKind, - CStr255& outPrefName, - Boolean& outSaveAsAlias); - static Boolean FindLocalMailHost( - CMessageFolder& outFolder); - static Boolean GetDefaultFolderName( - FolderKind inKind, - CStr255& outFolderName); - static Boolean GetFolderAndServerNames( - const char* inPrefName, - CMessageFolder& outFolder, - CStr255& outFolderName, - CMessageFolder& outServer, - Boolean* outMatchesDefault = nil); - static Boolean GetFolderAndServerNames( - const CMessageFolder& inFolder, - FolderKind inKind, - CStr255& outFolderName, - CMessageFolder& outServer, - Boolean* outMatchesDefault = nil); -}; // class UFolderDialogs diff --git a/mozilla/cmd/macfe/MailNews/UOffline.cp b/mozilla/cmd/macfe/MailNews/UOffline.cp deleted file mode 100644 index c1f9d50f8e7..00000000000 --- a/mozilla/cmd/macfe/MailNews/UOffline.cp +++ /dev/null @@ -1,180 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UOffline.cp - -#include "UOffline.h" - -#include "MailNewsgroupWindow_Defines.h" -#include "CMailNewsContext.h" -#include "CMailProgressWindow.h" -#include "COfflinePicker.h" -#include "UModalDialogs.h" -#include "MPreference.h" -#include "macutil.h" -#include "uapp.h" - -#include "prefapi.h" -#include "msgcom.h" -#include "PascalString.h" -#include "xp_help.h" - -//------------------------------------------------------------------------------ -// ¥ ObeySynchronizeCommand -//------------------------------------------------------------------------------ -// Run the "Download Offline Items" dialog where the user can check what kind -// of items should be downloaded: Mail Folders, Discussion Groups or Directories. -// Since we are using the magic CPrefCheckbox(es) in that dialog, we have to -// delete the dialog and its handler for the check-boxes to actually write their -// new state on disk and update the Prefs file. -// -Boolean UOffline::ObeySynchronizeCommand(Boolean stayModal) -{ - - Str255 windowTitle; // Get it from the offline dialog, to use in the progress dialog. - - { // <-- start of scope for StDialogHandler - - // Save and restore the prefs write state - MPreferenceBase::StWriteOnDestroy stateSetter(true); - - // Put up dialog. - StDialogHandler aHandler(20002, NULL); - - LWindow* dialog = aHandler.GetDialog(); - dialog->GetDescriptor(windowTitle); - - // Run the dialog - MessageT message = msg_OK; // first pass message - do - { - switch (message) - { - case 'Sele': // Select button - COfflinePickerWindow::DisplayDialog(); - break; - - case 'Help': - ShowHelp(HELP_MAILNEWS_SYNCHRONIZE); - break; - - case 'GetM': // check-boxes - case 'GetN': - case 'GetD': - case 'SndM': - case msg_OK: // first pass - LControl *getmailBox = (LControl*)dialog->FindPaneByID('GetM'); - LControl *getnewsBox = (LControl*)dialog->FindPaneByID('GetN'); - LControl *getdirBox = (LControl*)dialog->FindPaneByID('GetD'); - LControl *sendBox = (LControl*)dialog->FindPaneByID('SndM'); - LControl *flaggedBox = (LControl*)dialog->FindPaneByID('GetF'); - LControl *syncButton = (LControl*)dialog->FindPaneByID('Sync'); - SignalIf_(!((getmailBox && getnewsBox && getdirBox && sendBox && flaggedBox && syncButton))); - - if ((getmailBox->GetValue() == 0) - && (getnewsBox->GetValue() == 0)) - { - flaggedBox->Disable(); - } - else - { - flaggedBox->Enable(); - } - - if ((getmailBox->GetValue() == 0) - && (getnewsBox->GetValue() == 0) - && (getdirBox->GetValue() == 0) - && (sendBox->GetValue() == 0)) - { - syncButton->Disable(); - } - else - { - syncButton->Enable(); - } - break; - } - - message = aHandler.DoDialog(); - - } while (message != msg_OK && message != msg_Cancel); - - // Use the result. - if (message != msg_OK) - return false; - } // <-- End of scope for StDialogHandler (need to save prefs before calling SynchronizeForOffline) - - // Start the download, using the prefs - ResIDT resID = (stayModal ? CMailProgressWindow::res_ID_modal : CMailProgressWindow::res_ID_modeless); - CMailProgressWindow* progressWindow = CMailProgressWindow::SynchronizeForOffline(windowTitle, resID); - if (progressWindow && stayModal) - { - CNSContext* cnsContext = progressWindow->GetWindowContext(); - if (cnsContext) - { - do - { - CFrontApp::GetApplication()->ProcessNextEvent(); - } while (XP_IsContextBusy(*cnsContext)); - } - } - - return true; -} - -//------------------------------------------------------------------------------ -// ¥ ObeyToggleOfflineCommand -//------------------------------------------------------------------------------ -// -Boolean UOffline::ObeyToggleOfflineCommand() -{ - CMailProgressWindow::ToggleOffline(); - return true; -} - - -//------------------------------------------------------------------------------ -// ¥ FindOfflineCommandStatus -//------------------------------------------------------------------------------ -// -void UOffline::FindOfflineCommandStatus(CommandT inCommand, Boolean& enabled, Str255 name) -{ - enabled = true; - switch (inCommand) - { - case cmd_ToggleOffline: - ::GetIndString(name, 1037, (UOffline::AreCurrentlyOnline() ? 4 : 3)); - break; - - case cmd_SynchronizeForOffline: - enabled = UOffline::AreCurrentlyOnline(); - break; - } -} - - -//------------------------------------------------------------------------------ -// ¥ AreCurrentlyOnline -//------------------------------------------------------------------------------ -// -Boolean UOffline::AreCurrentlyOnline() -{ - return !NET_IsOffline(); -} diff --git a/mozilla/cmd/macfe/MailNews/UOffline.h b/mozilla/cmd/macfe/MailNews/UOffline.h deleted file mode 100644 index eda32da5015..00000000000 --- a/mozilla/cmd/macfe/MailNews/UOffline.h +++ /dev/null @@ -1,39 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - - - -// UOffline.h - -#pragma once -struct MSG_Pane; - -//----------------------------------- -class UOffline -//----------------------------------- -{ -public: - enum { syncModal = true, syncModeless = false }; - - static Boolean AreCurrentlyOnline(); - - static Boolean ObeyToggleOfflineCommand(); - static Boolean ObeySynchronizeCommand(Boolean stayModal = syncModal); - static void FindOfflineCommandStatus(CommandT inCommand, Boolean& enabled, Str255 name); - // Handles the Go Online/Go offline command -}; diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews.mcp b/mozilla/cmd/macfe/MailNews/build/MailNews.mcp deleted file mode 100644 index cc28986a07a..00000000000 Binary files a/mozilla/cmd/macfe/MailNews/build/MailNews.mcp and /dev/null differ diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews_DebugHeaders.pch b/mozilla/cmd/macfe/MailNews/build/MailNews_DebugHeaders.pch deleted file mode 100644 index 54e0ef3f2d6..00000000000 --- a/mozilla/cmd/macfe/MailNews/build/MailNews_DebugHeaders.pch +++ /dev/null @@ -1,46 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// MailNews_Headers.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix_debug.h" - -#ifdef powerc - #pragma precompile_target "MailNews_HeadersPPC" -#else - #pragma precompile_target "MailNews_Headers68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews_DebugHeaders.pch++ b/mozilla/cmd/macfe/MailNews/build/MailNews_DebugHeaders.pch++ deleted file mode 100644 index a868884702d..00000000000 --- a/mozilla/cmd/macfe/MailNews/build/MailNews_DebugHeaders.pch++ +++ /dev/null @@ -1,52 +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. - */ -// - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// MailNews_Headers.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix_debug.h" - -#ifdef powerc - #pragma precompile_target "MailNews_HeadersPPC++" -#else - #pragma precompile_target "MailNews_Headers68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews_DebugPrefix.h b/mozilla/cmd/macfe/MailNews/build/MailNews_DebugPrefix.h deleted file mode 100644 index b18dd9376fa..00000000000 --- a/mozilla/cmd/macfe/MailNews/build/MailNews_DebugPrefix.h +++ /dev/null @@ -1,50 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// MailNews_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "IDE_Options.h" - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "MailNews_HeadersPPC++" - #else - #include "MailNews_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "MailNews_Headers68K++" - #else - #include "MailNews_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews_Headers.pch b/mozilla/cmd/macfe/MailNews/build/MailNews_Headers.pch deleted file mode 100644 index 4dce1a9906e..00000000000 --- a/mozilla/cmd/macfe/MailNews/build/MailNews_Headers.pch +++ /dev/null @@ -1,46 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// MailNews_Headers.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -#ifdef powerc - #pragma precompile_target "MailNews_HeadersPPC" -#else - #pragma precompile_target "MailNews_Headers68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews_Headers.pch++ b/mozilla/cmd/macfe/MailNews/build/MailNews_Headers.pch++ deleted file mode 100644 index 9cc6fe16310..00000000000 --- a/mozilla/cmd/macfe/MailNews/build/MailNews_Headers.pch++ +++ /dev/null @@ -1,52 +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. - */ -// - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// MailNews_Headers.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -#ifdef powerc - #pragma precompile_target "MailNews_HeadersPPC++" -#else - #pragma precompile_target "MailNews_Headers68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/MailNews/build/MailNews_Prefix.h b/mozilla/cmd/macfe/MailNews/build/MailNews_Prefix.h deleted file mode 100644 index de808c6e020..00000000000 --- a/mozilla/cmd/macfe/MailNews/build/MailNews_Prefix.h +++ /dev/null @@ -1,51 +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. - */ - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// MailNews_Prefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "IDE_Options.h" - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "MailNews_HeadersPPC++" - #else - #include "MailNews_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "MailNews_Headers68K++" - #else - #include "MailNews_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/MailNews/nc_exception.h b/mozilla/cmd/macfe/MailNews/nc_exception.h deleted file mode 100644 index d64010515d7..00000000000 --- a/mozilla/cmd/macfe/MailNews/nc_exception.h +++ /dev/null @@ -1,291 +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. - */ - - - -// nc_exception.h - -#pragma once - -////////////////////////////////////////////////////////////////////////// -// -// This file contains several classes for exceptions support in Communicator. -// The classes can be used as they are or they can be further subclassed. -// -// When using the supplied classes as they are, the user should check if -// the current codes and strings, stored in "exception_codes.h" and -// "exception_str.r", suffice his/her needs. If they don't he/she should -// add the proper codes and strings to the two aforementioned files. -// -// When the user needs to subclass the supplied classes, usually to supply -// additional granularity, he/she should provide a constructor, a specific getter -// method for the error code and override the GetStringResID, method in order -// to return the proper resource ID for the exception strings. He/she should -// also add a new enum and string resource. -// -// Only code declared in the proper enums in the file "exception_codes.h" should -// be used for exceptions. This will ensure compatibility and proper documentation. -// -// By appropiatelly subclassing and keeping the policy to declare and maintain -// suclass enum as error code we can be assured of consistent errors and -// proper documentation. -// -////////////////////////////////////////////////////////////////////////// -// -// USAGE: -// -// try{ -// foo(); -// } -// catch( nc_exception_subclass& error ) -// { -// // do something -// } -// catch( nc_exception& error ) -// { -// // do something -// } -// catch( ... ) -// { -// // do something -// } -// ... -// -// foo() { -// throw nc_exception_subclass( eSampleException ); -// } -// -////////////////////////////////////////////////////////////////////////// -// -// When What -// ----- ----- -// -// 12/3/97 Genesis -// 1/6/97 Changed to reflect the usage of string resources for internationalization. -// -////////////////////////////////////////////////////////////////////////// - -#pragma exceptions on // make sure that exceptions are on - -#include "exception_codes.h" // file containing the exception codes -#include "reserr.h" - -#pragma mark class nc_exception -////////////////////////////////////////////////////////////////////////// -// -// nc_exception -// -// Base class for all the exceptions. -// -// Methods: -// -// nc_exception( const int errorCode ) - constructor used to set the proper -// exception code -// -// GetErrorCode() - getter that returns the error code -// -// DisplaySimpleAlert() - methods that displays the default alert using the -// string from the default resource. -// -////////////////////////////////////////////////////////////////////////// - -class nc_exception -{ - public: - nc_exception( const GenericCode errorCode ); - virtual ~nc_exception(); - - virtual void DisplaySimpleAlert() const; - - protected: - - const int GetErrorCode() const; - void SetErrorCode( const GenericCode errorCode ); - void SetErrorCode( const int errorCode ); - - virtual short GetStringResID() const; - - private: - nc_exception(); // private - empty constructor is not allowed - - int mErrorCode; - -}; - -////////////////////////////////////////////////////////////////////////// -// nc_exception inlines - -inline -nc_exception::nc_exception() -{ -} - -inline -nc_exception::~nc_exception() -{ -} - -inline -nc_exception::nc_exception( const GenericCode errorCode ) : - mErrorCode( (int) errorCode ) -{ -} - -inline -short -nc_exception::GetStringResID() const -{ - return genericExStringsID; -} - -inline -void -nc_exception::DisplaySimpleAlert() const -{ - Str255 errorString, codeString; - short stringResID = GetStringResID(); - - ::GetIndString( errorString, stringResID, mErrorCode ); - ::NumToString( mErrorCode, codeString ); - ::ParamText( errorString, codeString, nil, nil ); - ::CautionAlert( ALRT_ErrorOccurred, nil ); -} - -inline -void -nc_exception::SetErrorCode( const int errorCode ) -{ - mErrorCode = errorCode; -} - -inline -const int -nc_exception::GetErrorCode() const -{ - return mErrorCode; -} - -#pragma mark - -#pragma mark class mail_exception -////////////////////////////////////////////////////////////////////////// -// mail_exception -// -// subclass for the mail/news errors. -// -////////////////////////////////////////////////////////////////////////// - -class mail_exception : public nc_exception -{ - -public: - - mail_exception( const MailCode errorCode ); - const MailCode GetMailErrorCode() const; - -protected: - - virtual short GetStringResID() const; -private: - - mail_exception(); // private - empty constructor is not allowed - -}; - -////////////////////////////////////////////////////////////////////////// -// mail_exception inlines - -inline -mail_exception::mail_exception() -{ -} - -inline -mail_exception::mail_exception( const MailCode errorCode ) -{ - SetErrorCode( (int) errorCode ); -} - -inline -const MailCode -mail_exception::GetMailErrorCode() const -{ - return ( ( MailCode ) GetErrorCode() ); -} - -inline -short -mail_exception::GetStringResID() const -{ - return mailExStringsID; -} - - -#pragma mark - -#pragma mark class browser_exception -////////////////////////////////////////////////////////////////////////// -// browser_exception -// -// subclass for the browser errors. -// -////////////////////////////////////////////////////////////////////////// - -class browser_exception : public nc_exception -{ - -public: - - browser_exception( const BrowserCode errorCode ); - const BrowserCode GetBrowserErrorCode() const; - -protected: - - virtual short GetStringResID() const; -private: - - browser_exception(); // private - empty constructor is not allowed - -}; - -////////////////////////////////////////////////////////////////////////// -// browser_exception inlines - -inline -browser_exception::browser_exception() -{ -} - -inline -browser_exception::browser_exception( const BrowserCode errorCode ) -{ - SetErrorCode( (int) errorCode ); -} - -inline -const BrowserCode -browser_exception::GetBrowserErrorCode() const -{ - return ( ( BrowserCode ) GetErrorCode() ); -} - -inline -short -browser_exception::GetStringResID() const -{ - return browserExStringsID; -} - diff --git a/mozilla/cmd/macfe/applevnt/mplugin.cp b/mozilla/cmd/macfe/applevnt/mplugin.cp deleted file mode 100644 index e1ed68797c4..00000000000 --- a/mozilla/cmd/macfe/applevnt/mplugin.cp +++ /dev/null @@ -1,2190 +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. - */ - -// All the code-resource handling stuff has been adopted from: -// Multi-Seg CR example in CW -// Classes: -// CPluginInstance - one per plugin instance. Needs to call the functions -// CPluginHandler - one per plugin MIME type - -#include "CHTMLView.h" - -#include "macutil.h" -#include "npapi.h" -#include "mplugin.h" -#include "uprefd.h" -#include "ufilemgr.h" -#include "uapp.h" // might be unnecessary when we get rid of CFrontApp -#include "resgui.h" -#include "miconutils.h" -#include "uerrmgr.h" -#include "macgui.h" -#include "resae.h" -#include "edt.h" // for EDT_RegisterPlugin() -#include "CApplicationEventAttachment.h" - -#if defined(JAVA) -#include "java.h" // for LJ_AddToClassPath -#endif - -#include "np.h" -#include "nppg.h" -#include "prlink.h" - -#include "npglue.h" -#include "nsIEventHandler.h" - -#ifdef LAYERS -#include "layers.h" -#include "mkutils.h" -#endif // LAYERS - -#include "MixedMode.h" -#include "MoreMixedMode.h" -#include - -#include "LMenuSharing.h" -#include "CBrowserWindow.h" - -// On a powerPC, plugins depend on being able to find qd in our symbol table -#ifdef powerc -// #pragma export qd -// beard: this seems to be an illegal pragma -#endif - -const ResIDT nsPluginSig = 128; // STR#, MIME type is #1 - -struct _np_handle; - - -// ************************************************************************************* -// -// class CPluginHandler -// -// ************************************************************************************* - -class CPluginHandler -{ - friend void FE_UnloadPlugin(void* plugin, struct _np_handle* handle); - friend NPPluginFuncs* FE_LoadPlugin(void* plugin, NPNetscapeFuncs *, struct _np_handle* handle); - -public: - -// ¥¥ constructors - CPluginHandler(FSSpec& plugFile); - ~CPluginHandler(); - -// ¥¥ xp->macfe - static Boolean CheckExistingHandlers(FSSpec& file); - NPPluginFuncs* LoadPlugin(NPNetscapeFuncs * funcs, _np_handle* handle); - void UnloadPlugin(); - -// plugin -> netscape - static void Status(const char * message); - - static CPluginHandler* FindHandlerForPlugin(const CStr255& pluginName); - -private: - -// ¥¥ funcs - OSErr InitCodeResource(NPNetscapeFuncs * funcs, _np_handle* handle); - void CloseCodeResource(_np_handle* handle = NULL); - void ResetPlugFuncTable(); - void OpenPluginResourceFork(Int16 inPrivileges); - -// ¥¥ vars - short fRefCount; - PRLibrary* fLibrary; // For PPC - Handle fCode; // For 68K - NPPluginFuncs fPluginFuncs; // xp->plugin - NPP_MainEntryUPP fMainEntryFunc; - NPP_ShutdownUPP fUnloadFunc; - LFile* fFile; // File containing the plugin - CStr255 fPluginName; // Name of plug-in - - CPluginHandler* fNextHandler; // Link to next handler in the global list - static CPluginHandler* sHandlerList; // Global list of all handlers -}; - -CPluginHandler* CPluginHandler::sHandlerList = NULL; - -void* GetPluginDesc(const CStr255& pluginName) -{ - return CPluginHandler::FindHandlerForPlugin(pluginName); -} - -// -// Find a handler given a plug-in name (currently only -// called from CFrontApp:RegisterMimeType). -// -CPluginHandler* CPluginHandler::FindHandlerForPlugin(const CStr255& pluginName) -{ - CPluginHandler* handler = CPluginHandler::sHandlerList; - while (handler != NULL) - { - if (handler->fPluginName == pluginName) - return handler; - - handler = handler->fNextHandler; - } - - return nil; -} - - -// -// Check the handlers we already have registered against -// the given file spec. We donÕt want to redundantly -// create handlers for the same plugin file. -// -Boolean CPluginHandler::CheckExistingHandlers(FSSpec& file) -{ - CPluginHandler* handler = CPluginHandler::sHandlerList; - while (handler != NULL) - { - if (handler->fFile) - { - FSSpec existingFile; - handler->fFile->GetSpecifier(existingFile); - if (existingFile.vRefNum == file.vRefNum && existingFile.parID == file.parID) - { - if (EqualString(existingFile.name, file.name, true, true)) - return false; - } - } - handler = handler->fNextHandler; - } - return true; -} - - -// ¥¥ constructors - -CPluginHandler::CPluginHandler(FSSpec& plugFile) -{ - // Variables - fRefCount = 0; - fCode = NULL; - fLibrary = NULL; - fFile = NULL; - fMainEntryFunc = NULL; - fUnloadFunc = NULL; - fNextHandler = NULL; - fPluginName = ""; - - Try_ - { - fFile = new LFile(plugFile); - fFile->OpenResourceFork(fsRdPerm); - - // Look for the plug-in description resource - CStringListRsrc descRsrc(126); - CStr255 pluginDescription; - - // Read plug-in description if available; if not, use blank description - short descCount = descRsrc.CountStrings(); - if (descCount > 0) - descRsrc.GetString(1, pluginDescription); - if (descCount <= 0 || ResError()) - pluginDescription = ""; - - // Read plug-in name if available; if not, use file name - if (descCount > 1) - descRsrc.GetString(2, fPluginName); - if (descCount <= 1 || ResError()) - fPluginName = plugFile.name; - - // cstring fileName((const unsigned char*) plugFile.name); - char* fileName = CFileMgr::EncodedPathNameFromFSSpec(plugFile, TRUE); - ThrowIfNil_(fileName); - fileName = NET_UnEscape(fileName); - NPError err = NPL_RegisterPluginFile(fPluginName, fileName, pluginDescription, this); - XP_FREE(fileName); - ThrowIfOSErr_(err); - - CStringListRsrc mimeList(128); - CStringListRsrc descList(127); - - UInt32 mimeTotal = mimeList.CountStrings() >> 1; // 2 strings per entry - UInt32 descTotal = descList.CountStrings(); - UInt32 count, mimeIndex, descIndex; - ThrowIf_(mimeTotal == 0); - - for (count = mimeIndex = descIndex = 1; count <= mimeTotal; count++, mimeIndex += 2, descIndex++) - { - CStr255 mimeType; - CStr255 extensions; - CStr255 description; - - mimeList.GetString(mimeIndex, mimeType); - if (ResError()) - continue; - - mimeList.GetString(mimeIndex + 1, extensions); - if (ResError()) - continue; - - // - // Get the description string from the plug-in. - // If they didn't specify one, use a pre-existing - // description if it exists (e.g. we know by default - // that video/quicktime is "Quicktime Video"). If - // we still didn't find a description, just use the - // MIME type. - // - Boolean gotDescription = false; - if (descIndex <= descTotal) - { - descList.GetString(descIndex, description); - gotDescription = (ResError() == noErr); - } - if (!gotDescription) - { - NET_cdataStruct temp; - NET_cdataStruct* cdata; - char* mimetype = (char*) mimeType; - - memset(&temp, 0, sizeof(temp)); - temp.ci.type = mimetype; - cdata = NET_cdataExist(&temp); - if (cdata && cdata->ci.desc) - description = cdata->ci.desc; - else - description = mimeType; - } - - // - // Look up this type in the MIME table. If it's not found, then - // the user hasn't seen this plug-in type before, so make a new - // mapper for the table with the type defaulted to be handled by - // the plug-in. If it was found, but was from an old prefs file - // (that didn't contain plug-in information), make sure the plug- - // in still gets priority so users don't freak out the first time - // they run a new Navigator and the plug-ins stop working. If it - // was found but was latent (disabled because the plug-in was - // missing), re-enable it now because the plug-in is present again. - // - cstring type((const unsigned char*) mimeType); - CMimeMapper* mapper = CPrefs::sMimeTypes.FindMimeType(type); - if (mapper == NULL) - { - mapper = new CMimeMapper(CMimeMapper::Plugin, mimeType, "", extensions, '????', '????'); - ThrowIfNil_(mapper); - mapper->SetPluginName(fPluginName); - mapper->SetDescription(description); - CPrefs::sMimeTypes.InsertItemsAt(1, LArray::index_Last, &mapper); - CPrefs::SetModified(); - mapper->WriteMimePrefs(); // convert mapper to xp prefs - } - else if (mapper->FromOldPrefs()) - { - mapper->SetPluginName(fPluginName); - mapper->SetExtensions(extensions); - mapper->SetDescription(description); - mapper->SetLoadAction(CMimeMapper::Plugin); - CPrefs::SetModified(); - mapper->WriteMimePrefs(); // convert mapper to xp prefs - } - else if (mapper->LatentPlugin()) - { - XP_ASSERT(mapper->GetLoadAction() == CMimeMapper::Unknown); - mapper->SetLoadAction(CMimeMapper::Plugin); - CPrefs::SetModified(); - } - else - { - // - // Only update the description if (a) thereÕs a description - // from the plug-in itself (as opposed to a default description), - // and (b) the current description is blank (we donÕt want to - // overwrite a user-edited description). - // - if (gotDescription && mapper->GetDescription() == "") - { - mapper->SetDescription(description); - CPrefs::SetModified(); - } - } - - // Now we know whether the plug-in should be enabled or not - Boolean enabled = ((mapper->GetLoadAction() == CMimeMapper::Plugin) && - (fPluginName == mapper->GetPluginName())); - NPL_RegisterPluginType(type, (char*) mapper->GetExtensions(), (char*) mapper->GetDescription(), NULL, this, enabled); - } - - fFile->CloseResourceFork(); - - } - Catch_(inErr) - { - if (fFile != NULL) - fFile->CloseResourceFork(); - - } - EndCatch_; - - ResetPlugFuncTable(); - - // Link us into the global list of handlers - fNextHandler = CPluginHandler::sHandlerList; - CPluginHandler::sHandlerList = this; -} - - -CPluginHandler::~CPluginHandler() // This code never gets called -{ - // CloseCodeResource(); - - if (fFile) - delete fFile; - - if (this == CPluginHandler::sHandlerList) - CPluginHandler::sHandlerList = NULL; - else - { - CPluginHandler* handler = CPluginHandler::sHandlerList; - while (handler != NULL) - { - if (this == handler->fNextHandler) - { - handler->fNextHandler = this->fNextHandler; - break; - } - handler = handler->fNextHandler; - } - } -} - - -void CPluginHandler::ResetPlugFuncTable() -{ - fMainEntryFunc = NULL; - fUnloadFunc = NULL; - memset(&fPluginFuncs, 0, sizeof(NPPluginFuncs)); -} - - -NPPluginFuncs * CPluginHandler::LoadPlugin(NPNetscapeFuncs * funcs, _np_handle* handle) -{ - // XXX Needs to be fixed for C++ Plugin API - OSErr err = InitCodeResource(funcs, handle); - if (err == noErr) - return &fPluginFuncs; - - return NULL; -} - -OSErr CPluginHandler::InitCodeResource(NPNetscapeFuncs* funcs, _np_handle* handle) -{ - fRefCount++; - - if (fCode != NULL || fLibrary != 0) // Already loaded - return noErr; - - OSErr err = noErr; -#ifdef DEBUG - EDebugAction oldThrow = UDebugging::gDebugThrow; - EDebugAction oldSignal = UDebugging::gDebugSignal; - UDebugging::gDebugThrow = debugAction_Nothing; - UDebugging::gDebugSignal = debugAction_Nothing; -#endif - Try_ - { - OpenPluginResourceFork(fsRdWrPerm); - Try_ - { // PPC initialization - - if (!UEnvironment::HasGestaltAttribute(gestaltCFMAttr, gestaltCFMPresent)) - Throw_((OSErr)cfragNoLibraryErr); // No CFM - - FSSpec fileSpec; - fFile->GetSpecifier(fileSpec); - - char* cFullPath = CFileMgr::PathNameFromFSSpec(fileSpec, TRUE); - ThrowIfNil_(cFullPath); - - fLibrary = PR_LoadLibrary(cFullPath); - ThrowIfNil_(fLibrary); - - // PCB: Let's factor this into an XP function, please! - nsFactoryProc nsGetFactory = (nsFactoryProc) PR_FindSymbol(fLibrary, "NSGetFactory"); - if (nsGetFactory != NULL) { - nsresult res = NS_OK; - if (thePluginManager == NULL) { - // For now, create the plugin manager on demand. - static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID); - res = nsPluginManager::Create(NULL, kIPluginManagerIID, (void**)&thePluginManager); - ThrowIf_(res != NS_OK || thePluginManager == NULL); - } - static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID); - nsIPlugin* plugin = NULL; - res = nsGetFactory(kIPluginIID, (nsIFactory**)&plugin); - ThrowIf_(res != NS_OK || plugin == NULL); - // beard: establish the primary reference. - plugin->AddRef(); - res = plugin->Initialize((nsIPluginManager2*)thePluginManager); - ThrowIf_(res != NS_OK); - handle->userPlugin = plugin; - } else { - fMainEntryFunc = (NPP_MainEntryUPP) PR_FindSymbol(fLibrary, "mainRD"); - ThrowIfNil_(fMainEntryFunc); - } - } - Catch_(inErr) - { // 68K if PPC fails - fLibrary = NULL; // No PPC - fCode = Get1Resource(emPluginFile, 128); - ThrowIfNil_(fCode); - ::MoveHHi(fCode); - ::HNoPurge(fCode); - ::HLock(fCode); - - //get the address of main and typecast it into a MainEntryProcUPP - fMainEntryFunc = (NPP_MainEntryUPP)(*fCode); - } EndCatch_ - - if (fMainEntryFunc != NULL) { - fPluginFuncs.version = funcs->version; - fPluginFuncs.size = sizeof(NPPluginFuncs); - err = CallNPP_MainEntryProc(fMainEntryFunc, funcs, &fPluginFuncs, &fUnloadFunc); - ThrowIfOSErr_(err); - if ((fPluginFuncs.version >> 8) < NP_VERSION_MAJOR) - Throw_((OSErr)NPERR_INCOMPATIBLE_VERSION_ERROR); - } - } - Catch_(inErr) - { - CloseCodeResource(); - err = inErr; - } - EndCatch_ - CPrefs::UseApplicationResFile(); // Revert the resource chain -#ifdef DEBUG - UDebugging::gDebugThrow = oldThrow; - UDebugging::gDebugSignal = oldSignal; -#endif - return err; -} - -// Dispose of the code -void CPluginHandler::CloseCodeResource(_np_handle* handle) -{ - // Already unloaded? - if (fRefCount == 0) - return; - - // If there are still outstanding references, don't unload yet - fRefCount--; - if (fRefCount > 0) - return; - - if (handle != NULL) { - nsIPlugin* userPlugin = handle->userPlugin; - if (userPlugin != NULL) { - userPlugin->Release(); - handle->userPlugin = NULL; - } - } else - if (fUnloadFunc != NULL) - CallNPP_ShutdownProc(fUnloadFunc); - -// Dispose of the code -// 68K, just release the resource - if (fCode != NULL) - { - ::HUnlock(fCode); - ::HPurge(fCode); - ::ReleaseResource(fCode); - fCode = NULL; - } -// PPC, close the connections - if (fLibrary != NULL) - { - int err = PR_UnloadLibrary(fLibrary); - Assert_(err == 0); - fLibrary = NULL; - } - - ResetPlugFuncTable(); - - Try_ - { - fFile->CloseResourceFork(); - } - Catch_(inErr){} EndCatch_ - Try_ - { - fFile->CloseDataFork(); - } - Catch_(inErr){} EndCatch_ -} - - -typedef struct ResourceMapEntry ResourceMapEntry, **ResourceMapHandle; - -// See More Macintosh Toolbox, pp. 1-122, 1-123. -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#endif -struct ResourceMapEntry -{ - UInt32 dataOffset; - UInt32 mapOffset; - UInt32 dataLength; - UInt32 mapLength; - ResourceMapHandle nextMap; - UInt16 refNum; -}; -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - -// -// Open the plug-inÕs resource fork BELOW the the applicationÕs -// resource fork. If we just opened the plug-in above the -// application but set the current res file to the app, the -// plug-in will be made current by the Resource Manager if the -// current res file is closed, which can happen when we close -// our prefs file after writing something to it. Once the plug- -// in is the current res file, if there are any resource conflicts -// between the two weÕll get the plug-inÕs resource instead of -// ours, causing woe. -// -void CPluginHandler::OpenPluginResourceFork(Int16 inPrivileges) -{ - Try_ - { - Int16 plugRef = fFile->OpenResourceFork(inPrivileges); // Open normally - - // The plug-in should now be at the top of the chain - ResourceMapHandle plugMap = (ResourceMapHandle) LMGetTopMapHndl(); - ThrowIf_((**plugMap).refNum != plugRef); - - // Search down the chain to find the appÕs map - short appRef = LMGetCurApRefNum(); - ResourceMapHandle appMap = (ResourceMapHandle) LMGetTopMapHndl(); - while (appMap && (**appMap).refNum != appRef) - appMap = (**appMap).nextMap; - ThrowIfNil_(appMap); - - // Remove the plug-in from the top of the chain - ResourceMapHandle newTop = (**plugMap).nextMap; - ThrowIfNil_(newTop); - LMSetTopMapHndl((Handle)newTop); - - // Re-insert the plug-in below the application - (**plugMap).nextMap = (**appMap).nextMap; - (**appMap).nextMap = plugMap; - } - Catch_(inErr) - { - } - EndCatch_ -} - - - - - -void RegisterPluginsInFolder(FSSpec folder); -// Recursive registration of all plugins -void RegisterPluginsInFolder(FSSpec folder) -{ - // find all the files that are plugins - CFileIter iter(folder); - FSSpec plugFile; - FInfo finderInfo; - Boolean isFolder; - while (iter.Next(plugFile, finderInfo, isFolder)) - { - if (isFolder) - RegisterPluginsInFolder(plugFile); - else if (finderInfo.fdType == emPluginFile) - { - // - // Check the handlers we already have registered against - // the given file spec. We donÕt want to redundantly - // create handlers for the same plugin file. - // - if (CPluginHandler::CheckExistingHandlers(plugFile)) - { - Try_ - { - CPluginHandler* plug = new CPluginHandler(plugFile); - } - Catch_(inErr){} - EndCatch_ - } - } -#ifdef EDITOR - else { - unsigned char *name = &plugFile.name[0]; - int len = name[0]; - - /* This checks to see if the name starts with cp and ends in '.zip' or '.jar'. - */ - if (len >= 5) { - if ((name[1] == 'c' || name[1] == 'C') - && (name[2] == 'p' || name[2] == 'P') - && (name[len - 3] == '.') - && ((name[len - 2] == 'z' || name[len - 2] == 'Z') - && (name[len - 1] == 'i' || name[len - 1] == 'I') - && (name[len - 0] == 'p' || name[len - 0] == 'P')) - || ((name[len - 2] == 'j' || name[len - 2] == 'J') - && (name[len - 1] == 'a' || name[len - 1] == 'A') - && (name[len - 0] == 'r' || name[len - 0] == 'R'))) { - char *cFullPath = CFileMgr::PathNameFromFSSpec( plugFile, TRUE ); - ThrowIfNil_(cFullPath); - char* cUnixFullPath = CFileMgr::EncodeMacPath(cFullPath); // Frees cFullPath - ThrowIfNil_(cUnixFullPath); - (void) NET_UnEscape(cUnixFullPath); - - EDT_RegisterPlugin(cUnixFullPath); - XP_FREE(cUnixFullPath); - } - } - } -#endif // EDITOR - } - - // - // Tell Java to look in this directory for class files - // so LiveConnect-enabled plug-ins can store their classes - // with the plug-in. - // - Try_ - { - char* cFullPath = CFileMgr::PathNameFromFSSpec(folder, TRUE); - ThrowIfNil_(cFullPath); - char* cUnixFullPath = CFileMgr::EncodeMacPath(cFullPath); // Frees cFullPath - ThrowIfNil_(cUnixFullPath); - (void) NET_UnEscape(cUnixFullPath); - -#if defined(JAVA) - // Tell Java about this path name - LJ_AddToClassPath(cUnixFullPath); -#elif defined(OJI) - // What, tell the current Java plugin about this class path? -#endif - XP_FREE(cUnixFullPath); - } - Catch_(inErr) {} - EndCatch_ -} - -// -// Default handler registered below for formats FO_CACHE_AND_EMBED and -// FO_CACHE, across all types. This handler recovers the pointer to -// our CPluginView and tells it that it does not have a valid plugin -// instance. -// -NET_StreamClass* EmbedDefault( - int format_out, void* registration, URL_Struct* request, MWContext* context); -NET_StreamClass* EmbedDefault( - int /*format_out*/, void* /*registration*/, URL_Struct* request, MWContext*) -{ - if (request != NULL) - { - NPEmbeddedApp* fe_data = (NPEmbeddedApp*) request->fe_data; - if (fe_data != NULL) - { - CPluginView* plugin = (CPluginView*) fe_data->fe_data; - if (plugin != NULL) - plugin->SetBrokenPlugin(); - } - } - return NULL; -} - -/* Returns the plugin folder spec */ -OSErr FindPluginFolder(FSSpec * plugFolder, Boolean create); -OSErr FindPluginFolder(FSSpec * plugFolder, Boolean create) -{ - FSSpec netscapeSpec = CPrefs::GetFolderSpec(CPrefs::NetscapeFolder); - long netscape_dirID; - - - OSErr err; - if ( (err=CFileMgr::GetFolderID(netscapeSpec, netscape_dirID)) == noErr ) - { -#ifndef PLUGIN_FOLDER_NAME_MUST_BE_MOVED_TO_A_RESOURCE - /* - Yes! It's a bugus preprocessor symbol, but it got your attention, didn't it? - - For localization, the plugin folder name should be moved to a resource, however there is no reported - bug yet (and we're currently under change control). - - ***Move only the preferred name into a resource. Leave the old name as a constant string in the source - (since the old name will not have been localized on any users disk).*** - - In the meantime... - */ - - Str255 pluginFolderName = "\pPlug-ins"; -#else - // The preferred (localized) name of the plugins folder is in a resource... - Str255 pluginFolderName; - GetIndString(pluginFolderName, ..., ...); -#endif - - - FSSpec oldNameSpec; - Boolean isFolder, wasAliased; - - // first look for the preferences folder with the preferred name - if ( ((err=FSMakeFSSpec(netscapeSpec.vRefNum, netscape_dirID, pluginFolderName, plugFolder)) == noErr) // ...if we made the FSSpec ok - && ((err=ResolveAliasFile(plugFolder, true, &isFolder, &wasAliased)) == noErr) ) // ...and it leads to something - { - // the plugins folder already exists as "Plug-ins", nothing else to do - } - - // else, try the old name (using |oldNameSpec|, so that if not found, I can create a folder from the preferred spec created above) - else if ( ((err=FSMakeFSSpec(netscapeSpec.vRefNum, netscape_dirID, "\pPlugins", &oldNameSpec)) == noErr) // ...if we made the FSSpec ok - && ((err=ResolveAliasFile(&oldNameSpec, true, &isFolder, &wasAliased)) == noErr) ) // ...and it leads to something - { - // the plugins folder already exists as [deprecated] "Plugins", copy the spec we used to learn that to the caller - FSMakeFSSpec(oldNameSpec.vRefNum, oldNameSpec.parID, oldNameSpec.name, plugFolder); - } - - // otherwise, we may need to create it - else if ( create ) - { - long created_dirID; - err = FSpDirCreate(plugFolder, smSystemScript, &created_dirID); - } - } - - return err; -} - -// ************************************************************************************* -// -// XP interface methods -// -// ************************************************************************************* - -void FE_RegisterPlugins(); -void FE_RegisterPlugins() -{ - // - // Register a wildcard handler for "embed" types before we scan the - // plugins folder -- that way, if a "null plugin" is found that - // also registers "*"/FO_EMBED, it will be registered later than this - // handler and thus take precendence. - // - NET_RegisterContentTypeConverter("*", FO_EMBED, NULL, EmbedDefault); - - OSErr err; - FSSpec plugFolder; - - if (!IsThisKeyDown(kOptionKey)) // Skip loading plugins if option key is down - err = FindPluginFolder(&plugFolder, false); - else - err = -1; - - if (err != noErr) - { - CFrontApp::SplashProgress(GetPString(MAC_NO_PLUGIN)); - return; - } - else - { - CFrontApp::SplashProgress(GetPString(MAC_REGISTER_PLUGINS)); - RegisterPluginsInFolder(plugFolder); - } - - // - // Now that all plug-ins have been registered, look through the MIME table - // for types that are assigned to non-existant plug-ins or plug-in types, - // and change all these types to use "Unknown". - // - LArrayIterator iterator(CPrefs::sMimeTypes); - CMimeMapper* mapper; - while (iterator.Next(&mapper)) - { - if (mapper->GetLoadAction() == CMimeMapper::Plugin) // Handled by plug-in? - { - Boolean foundType = false; - char* otherPluginName = NULL; - - // Look for the desired plug-in - CStr255 mapperName = mapper->GetPluginName(); - NPReference plugin = NPRefFromStart; - char* name; - while (NPL_IteratePluginFiles(&plugin, &name, NULL, NULL)) - { - // Look for the desired type - CStr255 mapperMime = mapper->GetMimeName(); - NPReference mimetype = NPRefFromStart; - char* type; - while (NPL_IteratePluginTypes(&mimetype, plugin, &type, NULL, NULL, NULL)) - { - if (mapperMime == type) - { - if (mapperName != name) - otherPluginName = name; - else - foundType = true; - break; - } - } - - } - - if (!foundType) // No plug-in, or no type? - { - if (otherPluginName) - { - void* pdesc = GetPluginDesc(otherPluginName); - if (pdesc) - NPL_EnablePluginType((char*)mapper->GetMimeName(), pdesc, TRUE); - mapper->SetPluginName(otherPluginName); - CPrefs::SetModified(); - } - else - { - mapper->SetLatentPlugin(); // Mark the plug-in as Òdisabled because missingÓ - CPrefs::SetModified(); // The prefs have changed - } - } - } - } -} - - - -NPPluginFuncs * FE_LoadPlugin(void *plugin, NPNetscapeFuncs * funcs, struct _np_handle* handle) -{ - return ((CPluginHandler*)plugin)->LoadPlugin(funcs, handle); -} - -void FE_UnloadPlugin(void *plugin, struct _np_handle* handle) -{ - ((CPluginHandler*)plugin)->CloseCodeResource(handle); -} - -// -// This exit routine is called when an embed stream completes. -// We use that opportunity to see if something when wrong when -// creating the initial stream for the plug-in so we can -// display some helpful UI. -// -void FE_EmbedURLExit(URL_Struct* /*urls*/, int /*status*/, MWContext* /*cx*/) -{ -// bing: Don't do anything here until we figure out a -} - - -// -// This code is called by npn_status, which is called by the plug-in. -// The plug-in may have manipulated the port before calling us, so -// we have to assume that we're out of focus so we'll draw in the -// right place. We also need to save and restore the entire port -// state so the plug-in's port settings are trashed. -// -void FE_PluginProgress(MWContext* cx, const char* message) -{ - GrafPtr currentPort; - GetPort(¤tPort); - StColorPortState portState(currentPort); - portState.Save(currentPort); - StUseResFile resFile(LMGetCurApRefNum()); - - LView::OutOfFocus(nil); // Make sure FE_Progress focuses the caption - FE_Progress(cx, message); - LView::OutOfFocus(nil); // portState.Restore will screw up the focus again - - portState.Restore(); -} - - -// -// See comments in npglue.c in np_geturlinternal. -// -void FE_ResetRefreshURLTimer(MWContext* ) -{ -Assert_(false); -// if (NETSCAPEVIEW(context)) -// NETSCAPEVIEW(context)->ResetRefreshURLTimer(); -} - -// A generic way to query information. Nothing to do now. -NPError FE_PluginGetValue(MWContext *, NPEmbeddedApp *, NPNVariable , - void */*r_value*/) -{ - return NPERR_NO_ERROR; -} - -// -// Rather than having to scan an explicit list of windows each time an event -// comes in, why not use a sub-class of LWindow, and let PowerPlant do the work -// for us? -// - -#pragma mark ### CPluginWindow ### - -class CPluginWindow : public LWindow, public LPeriodical { -public: - CPluginWindow(nsIEventHandler* eventHandler, WindowRef window); - virtual ~CPluginWindow(); - - virtual void HandleClick(const EventRecord& inMacEvent, Int16 inPart); - virtual void EventMouseUp(const EventRecord &inMacEvent); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - virtual void DrawSelf(); - virtual void SpendTime(const EventRecord& inMacEvent); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - virtual void AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent); - - Boolean IsPluginCommand(CommandT inCommand); - Boolean PassPluginEvent(EventRecord& event); - -private: - nsIEventHandler* mEventHandler; - SInt16 mKind; -}; - -void FE_RegisterWindow(nsIEventHandler* handler, void* window) -{ -#if 1 - LCommander::LCommander::SetDefaultCommander(LCommander::GetTopCommander()); - CPluginWindow* pluginWindow = new CPluginWindow(handler, WindowRef(window)); - XP_ASSERT(pluginWindow != NULL); - if (pluginWindow != NULL) { - pluginWindow->Show(); - pluginWindow->Select(); - } -#else - ((CPluginView*)plugin)->RegisterWindow(window); -#endif -} - -void FE_UnregisterWindow(nsIEventHandler* handler, void* window) -{ -#if 1 - // Toss the pluginWindow itself. - LWindow* pluginWindow = LWindow::FetchWindowObject(WindowPtr(window)); - if (pluginWindow != NULL) { - // Hide the window. - pluginWindow->Hide(); - // Notify PowerPlant that the window is no longer active. - // pluginWindow->Deactivate(); - delete pluginWindow; - } -#else - ((CPluginView*)plugin)->UnregisterWindow(window); -#endif -} - -#if 0 -SInt16 FE_AllocateMenuID(void *plugin, XP_Bool isSubmenu) -{ - return ((CPluginView*)plugin)->AllocateMenuID(isSubmenu); -} -#endif - -CPluginWindow::CPluginWindow(nsIEventHandler* eventHandler, WindowRef window) -{ - mEventHandler = eventHandler; - mMacWindowP = window; - - // The following is cribbed from one of the LWindow constructors. - - // "bless" the plugin window so it will be considered to be a first-class PowerPlant window. - mKind = ::GetWindowKind(window); - ::SetWindowKind(window, PP_Window_Kind); - ::SetWRefCon(window, long(this)); - - // Set some default attributes. - SetAttribute(windAttr_CloseBox | windAttr_TitleBar | windAttr_Resizable - | windAttr_SizeBox | windAttr_Targetable | windAttr_Enabled); - - // Window Frame and Image are the same as its portRect. - short width = mMacWindowP->portRect.right - mMacWindowP->portRect.left; - short height = mMacWindowP->portRect.bottom - mMacWindowP->portRect.top; - - ResizeFrameTo(width, height, false); - ResizeImageTo(width, height, false); - - CalcRevealedRect(); - - // Initial size and location are the "user" state for zooming. - CalcPortFrameRect(mUserBounds); - PortToGlobalPoint(topLeft(mUserBounds)); - PortToGlobalPoint(botRight(mUserBounds)); - - mVisible = triState_Off; - mActive = triState_Off; - mEnabled = triState_Off; - if (HasAttribute(windAttr_Enabled)) { - mEnabled = triState_On; - } - - FocusDraw(); - ::GetForeColor(&mForeColor); - ::GetBackColor(&mBackColor); - - StartIdling(); -} - -CPluginWindow::~CPluginWindow() -{ - // prevent the LWindow destructor from clobbering the window. - if (mMacWindowP != NULL) { - WindowPtr window = mMacWindowP; - if (IsWindowVisible(window)) - HideSelf(); - - // Restore kind and refCon to original values. - ::SetWindowKind(window, mKind); - ::SetWRefCon(window, 0); - - mMacWindowP = NULL; - } -} - -void CPluginWindow::HandleClick(const EventRecord& inMacEvent, Int16 inPart) -{ - EventRecord mouseEvent = inMacEvent; - if (!PassPluginEvent(mouseEvent)) - LWindow::HandleClick(inMacEvent, inPart); -} - -void CPluginWindow::EventMouseUp(const EventRecord& inMouseUp) -{ - EventRecord mouseEvent = inMouseUp; - PassPluginEvent(mouseEvent); -} - -Boolean CPluginWindow::ObeyCommand(CommandT inCommand, void *ioParam) -{ - if (IsPluginCommand(inCommand)) { - EventRecord menuEvent; - ::OSEventAvail(0, &menuEvent); - menuEvent.what = nsPluginEventType_MenuCommandEvent; - menuEvent.message = -inCommand; // PowerPlant encodes a raw menu selection as the negation of the selection. - return PassPluginEvent(menuEvent); - } - return LWindow::ObeyCommand(inCommand, ioParam); -} - -Boolean CPluginWindow::HandleKeyPress(const EventRecord& inKeyEvent) -{ - EventRecord keyEvent = inKeyEvent; - return PassPluginEvent(keyEvent); -} - -void CPluginWindow::DrawSelf() -{ - EventRecord updateEvent; - ::OSEventAvail(0, &updateEvent); - updateEvent.what = updateEvt; - updateEvent.message = UInt32(mMacWindowP); - PassPluginEvent(updateEvent); -} - -void CPluginWindow::SpendTime(const EventRecord& inMacEvent) -{ - // Need to poll various states, because the plugin can change things like - // the window's visibility, size, etc. - - // Put the visible state in synch with the window's visibility. - mVisible = (IsWindowVisible(mMacWindowP) ? triState_On : triState_Off); - - // Make sure the window's size hasn't changed (what about location?) - short width = mMacWindowP->portRect.right - mMacWindowP->portRect.left; - short height = mMacWindowP->portRect.bottom - mMacWindowP->portRect.top; - if (mFrameSize.width != width || mFrameSize.height != height) { - ResizeFrameTo(width, height, false); - ResizeImageTo(width, height, false); - CalcRevealedRect(); - } - - EventRecord macEvent = inMacEvent; - PassPluginEvent(macEvent); - - // - // If weÕre in SpendTime because of a non-null event, send a - // null event too. Some plug-ins (e.g. Shockwave) rely on null - // events for animation, so it doesnÕt matter if weÕre giving - // them lots of time with mouseMoved or other events -- if they - // donÕt get null events, they donÕt animate fast. - // - if (macEvent.what != nullEvent) { - macEvent.what = nullEvent; - PassPluginEvent(macEvent); - } -} - -void CPluginWindow::ActivateSelf() -{ - LWindow::ActivateSelf(); - - EventRecord activateEvent; - ::OSEventAvail(0, &activateEvent); - activateEvent.what = activateEvt; - activateEvent.modifiers |= activeFlag; - activateEvent.message = UInt32(mMacWindowP); - PassPluginEvent(activateEvent); -} - - -void CPluginWindow::DeactivateSelf() -{ - LWindow::DeactivateSelf(); - - EventRecord activateEvent; - ::OSEventAvail(0, &activateEvent); - activateEvent.what = activateEvt; - activateEvent.modifiers &= ~activeFlag; - activateEvent.message = UInt32(mMacWindowP); - PassPluginEvent(activateEvent); -} - -void CPluginWindow::AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent) -{ - EventRecord cursorEvent = inMacEvent; - cursorEvent.what = nsPluginEventType_AdjustCursorEvent; - if (!PassPluginEvent(cursorEvent)) - LWindow::AdjustCursorSelf(inPortPt, inMacEvent); -} - -Boolean CPluginWindow::IsPluginCommand(CommandT inCommand) -{ -#if 1 - // Since only one plugin can have menus in the menu bar at a time, - // the test only checks to see if this plugin has any menus, and - // whether the command is synthetic and is from one of the plugin's menus. - if (thePluginManager != NULL) { - short menuID, menuItem; - if (LCommander::IsSyntheticCommand(inCommand, menuID, menuItem)) { - PRBool hasAllocated = PR_FALSE; - if (thePluginManager->HasAllocatedMenuID(mEventHandler, menuID, &hasAllocated) == NS_OK) - return hasAllocated; - } - } - return false; -#else - return mPlugin->IsPluginCommand(inCommand); -#endif -} - -Boolean CPluginWindow::PassPluginEvent(EventRecord& event) -{ -#if 1 - nsPluginEvent pluginEvent = { &event, mMacWindowP }; - PRBool eventHandled = PR_FALSE; - mEventHandler->HandleEvent(&pluginEvent, &eventHandled); - return eventHandled; -#else - return mPlugin->PassWindowEvent(event, mMacWindowP)) -#endif -} - - -// ************************************************************************************* -// -// CPluginView methods -// -// ************************************************************************************* - -#pragma mark ### CPluginView ### - -CPluginView* CPluginView::sPluginTarget = NULL; -LArray* CPluginView::sPluginList = NULL; - -// -// This static method lets the caller broadcast a mac event to -// all existing plug-ins (regardless of context). ItÕs used by -// CFrontApp::EventSuspendResume to broadcast suspend and resume -// events to plug-ins. -// -void CPluginView::BroadcastPluginEvent(const EventRecord& event) -{ - if (sPluginList != NULL) - { - EventRecord eventCopy = event; // event is const, but PassEvent isnÕt - LArrayIterator iterator(*sPluginList); - CPluginView* plugin = NULL; - while (iterator.Next(&plugin)) - (void) plugin->PassEvent(eventCopy); - } -} - -// XXX The following two methods are obsolete -- CPluginWindow now does the work. - -// This gets called for every event - a performance analysis/review would be good -Boolean CPluginView::PluginWindowEvent(const EventRecord& event) -{ - WindowPtr hitWindow; - - switch(event.what) - { - case mouseDown: - case mouseUp: - ::FindWindow(event.where, &hitWindow); - break; - - case autoKey: - case keyDown: - case keyUp: - hitWindow = ::FrontWindow(); - break; - - case activateEvt: - case updateEvt: - hitWindow = (WindowPtr) event.message; - break; - - case nullEvent: - case diskEvt: - case osEvt: - case kHighLevelEvent: - default: - return false; - } - -#if 1 - // Determine which plugin owns this window. - Boolean isActivateEvent = (event.what == activateEvt && (event.modifiers & activeFlag)); - CPluginView* owningPlugin = FindPlugin(hitWindow); - if (owningPlugin != NULL) { - EventRecord eventCopy = event; - return owningPlugin->PassWindowEvent(eventCopy, hitWindow); - } -#else - if (sPluginList != NULL) { - // iterate through each plugin instance - LArrayIterator pluginIterator(*sPluginList); - CPluginView* plugin = NULL; - while (pluginIterator.Next(&plugin)) { - if (plugin->fWindowList != NULL) { - // then iterate through each window for each instance - LArrayIterator windowIterator(*(plugin->fWindowList)); - WindowPtr window = NULL; - while (windowIterator.Next(&window)) { - if (window == hitWindow) { - EventRecord eventCopy = event; - return plugin->PassWindowEvent(eventCopy, window); - } - } - } - } - } -#endif - - // we didn't find a match - return false; -} - -// Determines which plugin owns the specified window. - -CPluginView* CPluginView::FindPlugin(WindowPtr window) -{ - // Make sure the window isn't a PowerPlant window. - LWindow* windowObj = LWindow::FetchWindowObject(window); - if (windowObj == NULL && sPluginList != NULL) { - // iterate through each plugin instance - LArrayIterator pluginIterator(*sPluginList); - CPluginView* plugin = NULL; - while (pluginIterator.Next(&plugin)) { - if (plugin->fWindowList != NULL) { - // then iterate through each window for each instance - LArrayIterator windowIterator(*(plugin->fWindowList)); - WindowPtr pluginWindow = NULL; - while (windowIterator.Next(&pluginWindow)) { - if (window == pluginWindow) - return plugin; - } - } - } - } - return NULL; -} - -void CPluginView::RegisterWindow(void* window) -{ - // Register the pluginWindow with PowerPlant. - - // Set the default commander to the application, to limit the depth of the chain of command. - // I've seen this get ridiculously deep. - LCommander::LCommander::SetDefaultCommander(LCommander::GetTopCommander()); - -#if 0 - CPluginWindow* pluginWindow = new CPluginWindow(this, WindowPtr(window)); - - if (fWindowList == NULL) - fWindowList = new LArray; - if (fWindowList != NULL) - fWindowList->InsertItemsAt(1, 0, &window); -#endif -} - -void CPluginView::UnregisterWindow(void* window) -{ - // Toss the pluginWindow itself. - LWindow* pluginWindow = LWindow::FetchWindowObject(WindowPtr(window)); - if (pluginWindow != NULL) { - // Notify PowerPlant that the window is no longer active. - pluginWindow->Deactivate(); - delete pluginWindow; - } - -#if 0 - if (fWindowList != NULL) { - Int32 index = fWindowList->FetchIndexOf(&window); - if (index > 0) - fWindowList->RemoveItemsAt(1, index); - - if (fWindowList->GetCount() == 0) { - delete fWindowList; - fWindowList = NULL; - } - } -#endif -} - - -SInt16 CPluginView::AllocateMenuID(Boolean isSubmenu) -{ - SInt16 menuID = LMenuSharingAttachment::AllocatePluginMenuID(isSubmenu); - - if (fMenuList == NULL) - fMenuList = new TArray; - if (fMenuList != NULL) - fMenuList->AddItem(menuID); - - return menuID; -} - -Boolean CPluginView::IsPluginCommand(CommandT inCommand) -{ - // Since only one plugin can have menus in the menu bar at a time, - // the test only checks to see if this plugin has any menus, and - // whether the command is synthetic and is from one of the plugin's menus. - if (fMenuList != NULL) { - short menuId, menuItem; - if (LCommander::IsSyntheticCommand(inCommand, menuId, menuItem)) { - TArray& menus = *fMenuList; - UInt32 count = menus.GetCount(); - for (UInt32 i = count; i > 0; --i) - if (menus[i] == menuId) - return true; - } - } - return false; -} - -Boolean CPluginView::PassWindowEvent(EventRecord& inEvent, WindowPtr window) -{ - Boolean eventHandled = false; - if (fApp) { - eventHandled = NPL_HandleEvent(fApp, (NPEvent*)&inEvent, (void*) window); - } - return eventHandled; -} - -CPluginView::CPluginView(LStream *inStream) : LView(inStream), LDragAndDrop(nil, this) -{ - fApp = NULL; - fOriginalView = NULL; - fBrokenPlugin = false; - fPositioned = false; - fHidden = false; - fWindowed = true; - fBrokenIcon = NULL; - fIsPrinting = false; - fWindowList = NULL; - fMenuList = NULL; - - // - // Add the new plug-in to a global list of all plug-ins. - // - if (sPluginList == NULL) - sPluginList = new LArray; - if (sPluginList != NULL) - sPluginList->InsertItemsAt(1, 0, &this); - - - // - // CanÕt call ResetDrawRect yet because it needs a port - // from our superview, but we donÕt have a superview yet! - // -} - - -CPluginView::~CPluginView() -{ - if (fBrokenIcon != NULL) - CIconList::ReturnIcon(fBrokenIcon); - - // - // This static is parallel to LCommander::sTarget, but only for plug-ins. - // The LCommander destructor takes care of resetting the LCommander::sTarget, - // and so the CPluginView destructor should take care of the special plug-in target. - // - if (CPluginView::sPluginTarget == this) - CPluginView::sPluginTarget = NULL; - - // we're assuming the plugin has already killed the windows themselves - if (fWindowList != NULL) - delete fWindowList; - - // release the menu IDs used by this plugin? - if (fMenuList != NULL) - delete fMenuList; - - // - // Remove the deleted plug-in from the global list of all plug-ins. - // - if (sPluginList != NULL) { - Int32 index = sPluginList->FetchIndexOf(&this); - if (index > 0) - sPluginList->RemoveItemsAt(1, index); - - if (sPluginList->GetCount() == 0) - { - delete sPluginList; - sPluginList = NULL; - } - } -}; - - -void CPluginView::EmbedSize(LO_EmbedStruct* embed_struct, SDimension16 hyperSize) -{ - // - // If the plug-in is hidden, set the width and height to zero and - // set a flag indicating that we are hidden. - // - if (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN) - { - embed_struct->objTag.width = 0; - embed_struct->objTag.height = 0; - fHidden = true; - Hide(); - StartIdling(); // Visible plug-ins start idling in EmbedDisplay - } - - // - // If the embed src is internal-external-plugin, the plugin is - // full-screen, and we should set up the pluginÕs real width - // for layout since it doesnÕt know how big to make it. Since a full- - // screen plugin should resize when its enclosing view (the hyperview) - // resizes, we bind the plugin view on all sides to its superview. - // - Boolean fullPage = false; - if (embed_struct->embed_src) - { - char* theURL; - PA_LOCK(theURL, char*, embed_struct->embed_src); - XP_ASSERT(theURL); - if (XP_STRCMP(theURL, "internal-external-plugin") == 0) - fullPage = true; - PA_UNLOCK(embed_struct->embed_src); - } - - if (fullPage) - { - SBooleanRect binding = {true, true, true, true}; - SetFrameBinding(binding); - - embed_struct->objTag.width = hyperSize.width; - embed_struct->objTag.height = hyperSize.height; - - // - // Remember an offset for the view to - // compensate for layout's default margins. - // - const short kLeftMargin = 8; // ¥¥¥ These should be defined in mhyper.h!!! - const short kTopMargin = 8; - fHorizontalOffset = -kLeftMargin; - fVerticalOffset = -kTopMargin; - } - else - { - fHorizontalOffset = 0; - fVerticalOffset = 0; - } - - ResizeImageTo(embed_struct->objTag.width, embed_struct->objTag.height, false); - ResizeFrameTo(embed_struct->objTag.width, embed_struct->objTag.height, false); - - // - // NOTE: The position set here is not really valid because the x and y in - // embed_struct are not valid yet (we have to wait until DisplayEmbed - // (see below) is called the first time to get the real location). - // We go ahead and position ourselves anyway just so we have a superview - // and location initially. - // - Int32 x = embed_struct->objTag.x + embed_struct->objTag.x_offset + fHorizontalOffset; - Int32 y = embed_struct->objTag.y + embed_struct->objTag.y_offset + fVerticalOffset; - PlaceInSuperImageAt(x, y, false); - - // - // Set up the NPWindow and NPPort for the first time. No one should - // have called NPL_EmbedSize before this point, or bogus values will - // get passed to the plugin! - // - ResetDrawRect(); -} - - -void CPluginView::EmbedDisplay(LO_EmbedStruct* embed_struct, Boolean isPrinting) -{ - fWindowed = (Boolean)NPL_IsEmbedWindowed(fApp); - fIsPrinting = isPrinting; - - // - // If weÕre not positioned yet, place our instance at the - // location specified by layout and make our view visible. - // - if (fPositioned == false) - { - Int32 x = embed_struct->objTag.x + embed_struct->objTag.x_offset + fHorizontalOffset; - Int32 y = embed_struct->objTag.y + embed_struct->objTag.y_offset + fVerticalOffset; - PlaceInSuperImageAt(x, y, false); - if (fWindowed) - Show(); - else if (!fBrokenPlugin) { - fHidden = true; - Hide(); - } - StartIdling(); - fPositioned = true; - - XP_ASSERT(fApp); - if (fApp != NULL) - NPL_EmbedSize(fApp); // Tell the plugin about its dimensions and location - - Refresh(); - } - - // If this is a windowed plug-in, this call indicates that we've moved or our visibility - // changed. - if (fWindowed || fBrokenPlugin) - { - Rect frameRect; - SPoint32 imagePoint; - Int32 x, y; - - if (IsVisible() && (embed_struct->objTag.ele_attrmask & LO_ELE_INVISIBLE)) - Hide(); - - CalcPortFrameRect(frameRect); - GetSuperView()->PortToLocalPoint(topLeft(frameRect)); - GetSuperView()->LocalToImagePoint(topLeft(frameRect), imagePoint); - - x = embed_struct->objTag.x + embed_struct->objTag.x_offset + fHorizontalOffset; - y = embed_struct->objTag.y + embed_struct->objTag.y_offset + fVerticalOffset; - if ((imagePoint.h != x) || (imagePoint.v != y)) - PlaceInSuperImageAt(x, y, true); - - if (!IsVisible() && !(embed_struct->objTag.ele_attrmask & LO_ELE_INVISIBLE)) - Show(); - } - // For a windowless plug-in, this is where the plug-in actually draws. - else - { - EventRecord updateEvent; - // - // Always reset the drawing info before calling the plugin to draw. - // - ResetDrawRect(); - - ::OSEventAvail(0, &updateEvent); - updateEvent.what = updateEvt; - (void) PassEvent(updateEvent); - } -} - - -void CPluginView::EmbedCreate(MWContext* context, LO_EmbedStruct* embed_struct) -{ - fEmbedStruct = embed_struct; - fApp = (NPEmbeddedApp*) embed_struct->objTag.FE_Data; - Boolean printing = (context->type == MWContextPrint); - - // - // Set the references between the view, the app, and the layout - // structure. Also set the pointer to the new instanceÕs - // window data (NPWindow), which is stored as part of our object - // (unless we are printing, in which case it already has a NPWindow). - // Then start up the stream for the plug-in (if applicable). - // If NPL_EmbedStart fails, it will delete the NPEmbeddedApp and - // associated XP data structures, so be sure to remove the - // embed_struct's reference to it. - // - if (fApp != NULL) - { - if (printing) - fOriginalView = (CPluginView*) fApp->fe_data; - fApp->fe_data = this; - embed_struct->objTag.FE_Data = fApp; - if (!printing) - fApp->wdata = GetNPWindow(); - NPError err = NPL_EmbedStart(context, embed_struct, fApp); - if (err != NPERR_NO_ERROR) - fApp = NULL; - } - - // - // Something went wrong? If we have no app, then layout can never - // tell us to delete the view (since the app is in the FE_Data of - // the layout structure), so we need to delete it here. - // - if (fApp == NULL) - { - delete this; - embed_struct->objTag.FE_Data = NULL; - } -} - - -void CPluginView::EmbedFree(MWContext* context, LO_EmbedStruct* embed_struct) -{ - // - // Set our reference to the NPEmbeddedApp to NULL now, before - // calling NPL_EmbedDelete. NPL_EmbedDelete may re-call FE code - // after deleting the NPEmbeddedApp and we donÕt want to have - // a reference to a deleted app! - // - // XXX This is no longer necessary, as this is called in _response_ - // to NPL_EmbedDelete. - NPEmbeddedApp* app = fApp; - fApp = NULL; - - // - // If our original view field was set above in EmbedCreate, the - // the NPEmbeddedApp associated with this view was associated - // only temporarily for printing, so we should switch its - // references to its view and window back to their original values. - // If there is no original view, then we must be the original - // creator of the NPEmbeddedApp, so we should delete it. - // - if (fOriginalView != NULL) - { - app->fe_data = fOriginalView; - XP_ASSERT(app->wdata == fOriginalView->GetNPWindow()); - app->wdata = fOriginalView->GetNPWindow(); - } - - ThrowIfNil_(context); -} - - - -// ¥¥ event processing - -void CPluginView::ClickSelf(const SMouseDownEvent& inMouseDown) -{ - XP_ASSERT(fWindowed); - LView::ClickSelf(inMouseDown); - - if (!fBrokenPlugin) - { - EventRecord mouseEvent = inMouseDown.macEvent; // inMouseDown is const, but PassEvent isnÕt - (void) PassEvent(mouseEvent); - LCommander::SwitchTarget(this); // Once clicked, we can get keystrokes - } -} - -void CPluginView::EventMouseUp(const EventRecord& inMouseUp) -{ - XP_ASSERT(fWindowed); - LView::EventMouseUp(inMouseUp); - - EventRecord mouseEvent = inMouseUp; // inMouseUp is const, but PassEvent isnÕt - (void) PassEvent(mouseEvent); -} - - -Boolean CPluginView::ObeyCommand(CommandT inCommand, void *ioParam) -{ - if (IsPluginCommand(inCommand)) { - // assume this is a plugin menu item, since menusharing didn't handle it. - EventRecord menuEvent; - ::OSEventAvail(0, &menuEvent); - menuEvent.what = nsPluginEventType_MenuCommandEvent; - menuEvent.message = -inCommand; // PowerPlant encodes a raw menu selection as the negation of the selection. - return PassEvent(menuEvent); - } - return LCommander::ObeyCommand(inCommand, ioParam); -} - -Boolean CPluginView::HandleKeyPress(const EventRecord& inKeyEvent) -{ - if (fWindowed) { - EventRecord keyEvent = inKeyEvent; // inKeyEvent is const, but PassEvent isnÕt - return PassEvent(keyEvent); - } - - return false; -} - -Boolean CPluginView::FocusDraw(LPane *inSubPane) -{ - Boolean revealed = LView::FocusDraw(inSubPane); - - // - // Make sure that any exposed popdown view is clipped out before drawing occurs. - // - CBrowserWindow::ClipOutPopdown(this); - - return revealed; -} - -void CPluginView::DrawSelf() -{ - XP_ASSERT(!fHidden); - - if (fPositioned == false) // Bail if layout hasnÕt positioned us yet - return; - - if (fBrokenPlugin) - DrawBroken(false); - else - { - // - // Always reset the drawing info before calling the plugin to draw. - // Although the MoveBy and ResizeFrameBy methods ensure that the - // drawing info is updated if the plugin is scrolled or its window - // is resized, the clip still needs to be set up every time before - // drawing because the area to draw will be different. - // - ResetDrawRect(); - - - if (fIsPrinting) - { - this->PrintEmbedded(); - fIsPrinting = false; - } - else - { - EventRecord updateEvent; - ::OSEventAvail(0, &updateEvent); - updateEvent.what = updateEvt; - (void) PassEvent(updateEvent); - } - } -} - - - -void CPluginView::SpendTime(const EventRecord& inMacEvent) -{ - EventRecord macEvent = inMacEvent; // inMacEvent is const, but PassEvent isnÕt - (void) PassEvent(macEvent); - - // - // If weÕre in SpendTime because of a non-null event, send a - // null event too. Some plug-ins (e.g. Shockwave) rely on null - // events for animation, so it doesnÕt matter if weÕre giving - // them lots of time with mouseMoved or other events -- if they - // donÕt get null events, they donÕt animate fast. - // - if (macEvent.what != nullEvent) - { - macEvent.what = nullEvent; - (void) PassEvent(macEvent); - } -} - - -void CPluginView::ActivateSelf() -{ - EventRecord activateEvent; - ::OSEventAvail(0, &activateEvent); - activateEvent.what = activateEvt; - activateEvent.modifiers = activeFlag; - (void) PassEvent(activateEvent); -} - - -void CPluginView::DeactivateSelf() -{ - EventRecord activateEvent; - ::OSEventAvail(0, &activateEvent); - activateEvent.what = activateEvt; - (void) PassEvent(activateEvent); -} - -// -// These two methods are called when we are targeted or -// untargeted. Since plugins want to know when they have -// the key focus, we create a new event type to pass to -// them. -// - -void CPluginView::BeTarget() -{ - XP_ASSERT(!fHidden); - CPluginView::sPluginTarget = this; // Parallel to LCommander::sTarget, except only for plug-ins - EventRecord focusEvent; - ::OSEventAvail(0, &focusEvent); - focusEvent.what = nsPluginEventType_GetFocusEvent; - Boolean handled = PassEvent(focusEvent); - if (!handled) // If the plugin doesnÕt want the focus, - SwitchTarget(GetSuperCommander()); // switch the focus back to our super -} - -void CPluginView::DontBeTarget() -{ - CPluginView::sPluginTarget = NULL; // Parallel to LCommander::sTarget, except only for plug-ins - EventRecord focusEvent; - ::OSEventAvail(0, &focusEvent); - focusEvent.what = nsPluginEventType_LoseFocusEvent; - (void) PassEvent(focusEvent); -} - - -void CPluginView::AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent) -{ - XP_ASSERT(!fHidden); - EventRecord cursorEvent = inMacEvent; - cursorEvent.what = nsPluginEventType_AdjustCursorEvent; - - Boolean handled = PassEvent(cursorEvent); - if (!handled) - LPane::AdjustCursorSelf(inPortPt, inMacEvent); -} - - - -// ¥¥ positioning - -void CPluginView::AdaptToSuperFrameSize(Int32 inSurrWidthDelta, Int32 inSurrHeightDelta, Boolean inRefresh) -{ - LView::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh); - - // - // Our superview has changed size, so we could have changed size - // (if weÕre bound to the superview) or changed clip (if we now - // overlap the edges of the superview). - // - if (fWindowed) - ResetDrawRect(); - - // - // If we are bound to our superview, we will change size as it - // changes size. Since the superview (the hyperview) is in turn - // bound to the window, we should adjust our NPWindow structure - // (done above in ResetDrawRect) and tell the plugin about the - // change (by calling NPL_EmbedSize). -bing 11/15/95 - // - if (fApp != NULL) - { - SBooleanRect frameBinding; - GetFrameBinding(frameBinding); - if (frameBinding.top && frameBinding.bottom && frameBinding.left && frameBinding.right) - NPL_EmbedSize(fApp); - } -} - -void CPluginView::MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh) -{ - LView::MoveBy(inHorizDelta, inVertDelta, inRefresh); - if (fWindowed) - ResetDrawRect(); -} - - - -// ¥¥Êdragging - -void CPluginView::AdaptToNewSurroundings() -{ - LView::AdaptToNewSurroundings(); - - // - // Set the port for dragging here, since we need - // a superview to get the port, and we don't have - // a superview until this method is called. - // - LDropArea::RemoveDropArea((LDropArea*)this, mDragWindow); - mDragWindow = GetMacPort(); - LDropArea::AddDropArea((LDropArea*)this, mDragWindow); -} - -Boolean CPluginView::DragIsAcceptable(DragReference /*inDragRef*/) -{ - // - // We claim to accept drops, so we won't get the - // Navigator drag&drop behavior over the plug-in. - // If the plug-in installs its own drag handlers, - // it will get control after we're called and can - // handle the drag as it sees fit. - // - return true; -} - -void CPluginView::HiliteDropArea(DragReference /*inDragRef*/) -{ - // DonÕt hilite: let the plug-in do it if it accepts drags. -} - -void CPluginView::UnhiliteDropArea(DragReference /*inDragRef*/) -{ - // DonÕt unhilite: let the plug-in do it if it accepts drags. -} - - - - -// ¥¥Êevents - -// Passes the event to our plugin -Boolean CPluginView::PassEvent(EventRecord& inEvent) -{ - if (fApp) - return NPL_HandleEvent(fApp, (NPEvent*)&inEvent, NULL); - else - return false; -} - - -void CPluginView::ResetDrawRect() -{ - fNPWindow.window = &fNPPort; - - if (fWindowed) { - - fNPPort.port = (CGrafPtr) GetMacPort(); - fNPWindow.x = mImageLocation.h; - fNPWindow.y = mImageLocation.v; - fNPWindow.width = mFrameSize.width; - fNPWindow.height = mFrameSize.height; - - if (mRevealedRect.left < mRevealedRect.right) // Code from FocusDraw - { // We are visible - XP_ASSERT(!fHidden); - fNPPort.portx = mPortOrigin.h; - fNPPort.porty = mPortOrigin.v; - - fNPWindow.clipRect.top = mRevealedRect.top; - fNPWindow.clipRect.left = mRevealedRect.left; - fNPWindow.clipRect.right = mRevealedRect.right; - fNPWindow.clipRect.bottom = mRevealedRect.bottom; - } - else // We are invisible - { - fNPWindow.clipRect.top = 0; - fNPWindow.clipRect.left = 0; - fNPWindow.clipRect.right = 0; - fNPWindow.clipRect.bottom = 0; - } - } - else { - Rect frame; - Point localPoint, portPoint; - SPoint32 imagePoint; - Rect clipRect; - Point portOrigin; - - // XXX This is gross. We're getting our parent and casting it down to a - // CHTMLView so that we can get element position and port information from it. - CHTMLView *parentView = (CHTMLView *)GetSuperView(); - - // Get the parent's port and port origin. Note that this will be different - // depending on whether it's onscreen or offscreen. - fNPPort.port = (CGrafPtr) parentView->GetCurrentPort(portOrigin); - - // Get the local position from the hyperview. This is a function of the - // location of the layout element, the scrolled position and the position - // of the layer containing the embed. - parentView->CalcElementPosition((LO_Element *)fEmbedStruct, frame); - - // Convert it into image coordinates - localPoint.h = frame.left - (fEmbedStruct->objTag.x + fEmbedStruct->objTag.x_offset); - localPoint.v = frame.top - (fEmbedStruct->objTag.y + fEmbedStruct->objTag.y_offset); - portPoint = localPoint; - localPoint.h -= portOrigin.h; - localPoint.v -= portOrigin.v; - parentView->LocalToImagePoint(localPoint, imagePoint); - - fNPWindow.x = imagePoint.h; - fNPWindow.y = imagePoint.v; - fNPWindow.width = frame.right - frame.left; - fNPWindow.height = frame.bottom - frame.top; - - fNPPort.portx = -localPoint.h; - fNPPort.porty = -localPoint.v; - - // The clipRect in this case is the bounding box of the clip region - // set by the compositor. Convert to port coordinates. - clipRect = (*fNPPort.port->clipRgn)->rgnBBox; - topLeft(clipRect).h -= portOrigin.h; - topLeft(clipRect).v -= portOrigin.v; - botRight(clipRect).h -= portOrigin.h; - botRight(clipRect).v -= portOrigin.v; - - fNPWindow.clipRect.top = clipRect.top; - fNPWindow.clipRect.left = clipRect.left; - fNPWindow.clipRect.right = clipRect.right; - fNPWindow.clipRect.bottom = clipRect.bottom; - - // Keep the view's position in sync with that specified by layout - parentView->LocalToPortPoint(portPoint); - if ((portPoint.h != -mPortOrigin.h) || (portPoint.v != -mPortOrigin.v)) { - MoveBy(mPortOrigin.h + portPoint.h, mPortOrigin.v + portPoint.v, false); - } - } -} - - -// -// This method is used for printing fullscreen plugins, which might -// want the opportunity to completely take over printing the page. -// We will pass them whether the user clicked on the print button -// or the Print menu (ÒprintOneÓ), a handle to the print record, -// and a boolean that they can set to true if they actually want to -// handle the print. We return this boolean to our caller (CHyperView: -// ObeyCommand) so they know whether they should print or not. -// If plugins do not implement the Print entry point at all, the -// boolean ÒpluginPrintedÓ will still be at its default value (false), -// so we will still print. -// -Boolean CPluginView::PrintFullScreen(Boolean printOne, THPrint printRecHandle) -{ - if (fApp == NULL) - return false; - - NPPrint npPrint; - npPrint.mode = NP_FULL; - npPrint.print.fullPrint.pluginPrinted = false; - npPrint.print.fullPrint.printOne = printOne; - npPrint.print.fullPrint.platformPrint = (void*) printRecHandle; - - NPL_Print(fApp, (void*) &npPrint); - - return npPrint.print.fullPrint.pluginPrinted; -} - -void CPluginView::PrintEmbedded() -{ - if (fApp == NULL) - return; - - NPPrint npPrint; - npPrint.mode = NP_EMBED; - npPrint.print.embedPrint.window = fNPWindow; - npPrint.print.embedPrint.platformPrint = (void*) fNPWindow.window; // Pass the NP_Port - - NPL_Print(fApp, (void*) &npPrint); -} - - - - -void CPluginView::SetBrokenPlugin() -{ - fBrokenPlugin = true; - fBrokenIcon = CIconList::GetIcon(326); // ¥¥¥ Need a constant - // Tell layout that we're windowed so we can display an icon - LO_SetEmbedType(fEmbedStruct, PR_TRUE); - Refresh(); // Plugin will draw broken icon now that fBrokenPlugin is set -} - - -void CPluginView::DrawBroken(Boolean hilite) -{ - // - // If the plugin is broken, we donÕt have a valid plugin instance - // to ask to draw, so we should handle drawing ourselves. - // Current behavior is to draw a box with a broken plugin icon - // in it. - // - Rect drawRect; - if (this->CalcLocalFrameRect(drawRect)) // We want a local rect since SetOrigin has been called - { - short height = drawRect.bottom - drawRect.top; - short width = drawRect.right - drawRect.left; - - if (height >= 4 && width >= 4) - { - UGraphics::SetFore(CPrefs::Anchor); - FrameRect(&drawRect); - - if (height >= 32 && width >= 32 && fBrokenIcon != NULL) - { - short centerX = (drawRect.right - drawRect.left) >> 1; - short centerY = (drawRect.bottom - drawRect.top) >> 1; - drawRect.top = centerY - 16; - drawRect.bottom = centerY + 16; - drawRect.left = centerX - 16; - drawRect.right = centerX + 16; - - ::PlotCIconHandle(&drawRect, atAbsoluteCenter, hilite ? ttSelected : ttNone, fBrokenIcon); - } - } - } -} - - -#ifdef LAYERS -Boolean CPluginView::HandleEmbedEvent(CL_Event *event) -{ - fe_EventStruct *fe_event = (fe_EventStruct *)event->fe_event; - - EventRecord macEvent; - ::OSEventAvail(0, &macEvent); - - // For windowless plugins, the last draw might have been to the offscreen port, - // but for event handling, we want the current port to be the onscreen port (so - // that mouse coordinate conversion and the like can happen correctly). - if (!fWindowed) - FocusDraw(); - - switch (event->type) { - case CL_EVENT_MOUSE_BUTTON_DOWN: - { - //SMouseDownEvent *mouseDown = (SMouseDownEvent *)fe_event->event; - - // Now pass the mouse event - //macEvent = mouseDown->macEvent; - // modified for new fe_EventStruct 1997-02-22 mjc - SMouseDownEvent mouseDown = fe_event->event.mouseDownEvent; - macEvent = mouseDown.macEvent; - } - break; - case CL_EVENT_MOUSE_BUTTON_UP: - case CL_EVENT_KEY_DOWN: - //macEvent = *(EventRecord *)fe_event->event; - macEvent = fe_event->event.macEvent; // 1997-02-22 mjc - break; - case CL_EVENT_MOUSE_MOVE: - //macEvent = *(EventRecord *)fe_event->event; - macEvent = fe_event->event.macEvent; // 1997-02-22 mjc - macEvent.what = nsPluginEventType_AdjustCursorEvent; - break; - case CL_EVENT_KEY_FOCUS_GAINED: - macEvent.what = nsPluginEventType_GetFocusEvent; - break; - case CL_EVENT_KEY_FOCUS_LOST: - macEvent.what = nsPluginEventType_LoseFocusEvent; - break; - default: - return false; - } - - return PassEvent(macEvent); -} -#endif // LAYERS diff --git a/mozilla/cmd/macfe/applevnt/mplugin.h b/mozilla/cmd/macfe/applevnt/mplugin.h deleted file mode 100644 index 7325d849165..00000000000 --- a/mozilla/cmd/macfe/applevnt/mplugin.h +++ /dev/null @@ -1,142 +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. - */ - -#pragma once - -#include "np.h" -#include "npapi.h" - -#include -#include - -#include -#include -#include -#include -#include - -class StPluginFocus; - -// -// Return the "plug-in descriptor" that we pass to XP code -// (this is really just a pointer to a CPluginHandler). -// -class CStr255; -extern void* GetPluginDesc(const CStr255& pluginName); - - -/********************************************************************************* - * CPluginView - * Embeds the plugin, and passes on the events to it - *********************************************************************************/ - -class CPluginView : public LView, // Drawing, etc - public LPeriodical, // Idling - public LCommander, // Key events - public LDragAndDrop // Dragging -{ -public: - friend class StPluginFocus; - enum { class_ID = 'plug' }; - -// ¥¥ constructors - CPluginView(LStream *inStream); - virtual ~CPluginView(); - - void EmbedCreate(MWContext* context, LO_EmbedStruct* embed_struct); - void EmbedFree(MWContext* context, LO_EmbedStruct* embed_struct); - void EmbedSize(LO_EmbedStruct* embed_struct, SDimension16 hyperSize); - void EmbedDisplay(LO_EmbedStruct* embed_struct, Boolean isPrinting); - -// ¥¥ access - NPWindow* GetNPWindow() { return &fNPWindow; } - NPEmbeddedApp* GetNPEmbeddedApp() { return fApp; } - -// ¥¥ event processing - static CPluginView* sPluginTarget; - static void BroadcastPluginEvent(const EventRecord& event); - static Boolean PluginWindowEvent(const EventRecord& event); - - virtual void ClickSelf(const SMouseDownEvent& inMouseDown); - virtual void EventMouseUp(const EventRecord &inMacEvent); - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - virtual Boolean FocusDraw(LPane *inSubPane = nil); - virtual void DrawSelf(); - virtual void SpendTime(const EventRecord& inMacEvent); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - virtual void BeTarget(); - virtual void DontBeTarget(); - virtual void AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent); - Boolean PassEvent(EventRecord& inEvent); - virtual Boolean HandleEmbedEvent(CL_Event *event); - -// ¥¥ positioning - virtual void AdaptToNewSurroundings(); - virtual void AdaptToSuperFrameSize(Int32 inSurrWidthDelta, Int32 inSurrHeightDelta, Boolean inRefresh); - virtual void MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh); - Boolean IsPositioned() const { return fPositioned; } -// ¥¥Êdragging - virtual Boolean DragIsAcceptable(DragReference inDragRef); - virtual void HiliteDropArea(DragReference inDragRef); - virtual void UnhiliteDropArea(DragReference inDragRef); - -// ¥¥ printing - Boolean PrintFullScreen(Boolean printOne, THPrint printRecHandle); - void PrintEmbedded(); - -// ¥¥ broken plugin - void SetBrokenPlugin(); - void DrawBroken(Boolean hilite); - - void SetPositioned(Boolean positioned = true) { fPositioned = positioned; } - -// ¥¥ window control - - void RegisterWindow(void* window); - void UnregisterWindow(void* window); - Boolean PassWindowEvent(EventRecord& inEvent, WindowPtr window); - - SInt16 AllocateMenuID(Boolean isSubmenu); - Boolean IsPluginCommand(CommandT inCommand); - - static CPluginView* FindPlugin(WindowPtr window); - -private: - void ResetDrawRect(); - - NPEmbeddedApp* fApp; - NPWindow fNPWindow; - NP_Port fNPPort; - CPluginView* fOriginalView; - CIconHandle fBrokenIcon; - short fHorizontalOffset; - short fVerticalOffset; - Boolean fBrokenPlugin; - Boolean fPositioned; - Boolean fHidden; - Boolean fWindowed; - LO_EmbedStruct* fEmbedStruct; - Boolean fIsPrinting; - LArray* fWindowList; - TArray* fMenuList; - - static LArray* sPluginList; -}; - diff --git a/mozilla/cmd/macfe/applevnt/mregistr.cp b/mozilla/cmd/macfe/applevnt/mregistr.cp deleted file mode 100644 index 48e7777cb21..00000000000 --- a/mozilla/cmd/macfe/applevnt/mregistr.cp +++ /dev/null @@ -1,539 +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. - */ - -// mregistr.cp -// Registry for AppleEvent notifiers -// Pretty clumsy right now, but separating this functionality out of uapp seems -// to be the right thing. -// It is just a collection of routines - -// MacNetscape -#include "mregistr.h" -#include "macutil.h" -#include "CAppleEventHandler.h" -#include "resae.h" -#include "resgui.h" -#include "ufilemgr.h" -#include "uprefd.h" -#include "CNSContext.h" - -#ifndef MOZ_MAIL_NEWS -#include "InternetConfig.h" -#endif - -// xp -#include "client.h" - -static LArray sURLEchoHandlers(sizeof(ProcessSerialNumber)); -static LArray sProtocolHandlers; - -/************************************************************************************ - * class CProtocolHelper - * Holds the information about protocol helpers, and knows how to launch them - ************************************************************************************/ - -class CProtocolHelper { -public: - char * fProtocolInfo; // String that specifies the protocol - OSType fApplSig; // Application to launch. Do not use these unless in saving/restoring - - // ¥¥ constructors - CProtocolHelper(char * protocolInfo, OSType applSig); - virtual ~CProtocolHelper(); - // ¥¥ access - Boolean AttemptLaunch(URL_Struct *url, MWContext *context); - Boolean EqualTo(char * protocolInfo, OSType applSig); - Boolean operator==(CProtocolHelper * p); - static void AddNewHelper(CProtocolHelper * helper); - -}; - -CProtocolHelper::CProtocolHelper(char * protocolInfo, OSType applSig) -{ - fProtocolInfo = protocolInfo; - fApplSig = applSig; -} - -CProtocolHelper::~CProtocolHelper() -{ - if (fProtocolInfo) - XP_FREE(fProtocolInfo); -} - -Boolean CProtocolHelper::operator==(CProtocolHelper * p) -{ - if (fProtocolInfo && p->fProtocolInfo) - return (strcmp(fProtocolInfo, p->fProtocolInfo) == 0); - return false; -} - -// This is used for the helper removal -// It returns true if we do not have the protocol info -Boolean CProtocolHelper::EqualTo(char * protocolInfo, OSType applSig) -{ - if (applSig != fApplSig) - return false; - if (protocolInfo && fProtocolInfo) - if (strcmp(protocolInfo, fProtocolInfo) == 0) - return true; - else - return false; - else - return true; - return false; -} - -// Finds the running helper application -// Tries to send a OpenURL event to the registered protocol handler -// If this does not work, sends the standard GetURL event -Boolean CProtocolHelper::AttemptLaunch(URL_Struct *url, MWContext */*context*/) -{ - if (!url->address) - return false; - if (strncasecomp(url->address, fProtocolInfo, strlen(fProtocolInfo)) != 0) - return false; - - ProcessSerialNumber psn; - FSSpec dummy; - OSErr err = FindProcessBySignature(fApplSig,'APPL',psn,&dummy); - if (err != noErr) - { - FSSpec appSpec; - err = CFileMgr::FindApplication(fApplSig, appSpec); - if (err != noErr) - return false; - - LaunchParamBlockRec launchParams; - launchParams.launchBlockID = extendedBlock; - launchParams.launchEPBLength = extendedBlockLen; - launchParams.launchFileFlags = 0; - launchParams.launchControlFlags = launchContinue + launchNoFileFlags; - launchParams.launchAppSpec = &appSpec; - launchParams.launchAppParameters = NULL; - err = LaunchApplication(&launchParams); - if (err != noErr) - return false; - err = FindProcessBySignature(fApplSig,'APPL',psn,&dummy); - if (err != noErr) - return false; - } - Try_ // Try the old Spyglass AE suite way first - { - AppleEvent event; - - err = AEUtilities::CreateAppleEvent(AE_spy_send_suite, AE_spy_openURL, event, psn); - ThrowIfOSErr_(err); - // put in the URL - StAEDescriptor urlDesc(typeChar, url->address, url->address ? strlen(url->address) : 0); - err = ::AEPutParamDesc(&event,keyDirectObject,&urlDesc.mDesc); - ThrowIfOSErr_(err); - // Send it - AppleEvent reply; - Try_ - { - err = ::AESend(&event, &reply, kAEWaitReply,kAENormalPriority,60,nil, nil); - AEDisposeDesc(&event); - err = AEUtilities::EventHasErrorReply(reply); - ThrowIfOSErr_(err); - AEDisposeDesc(&reply); - } - Catch_(inErr) - { - AEDisposeDesc(&reply); - - // Bug #86055 - // A -1 means the handler didn't want the event, not that it didn't handle it. - // In this case we should just return that the helper can't handle the protocol - // and Communicator/Navigator should handle it rather than also sending a GURL - // event to the helper app. This works around a problem under MacOS 8 where - // sending a GURL event to an app that didn't handle it could result in an infinite - // loop when the OS decided to re-direct the GURL back to us and we promptly sent - // it back to the handler that didn't handle it. - if (err == -1) - return false; - else - Throw_(inErr); - } - EndCatch_ - } - Catch_(inErr) // old Spyglass AE suite way failed, try the standard event - { - AppleEvent reply; - Try_ - { - AppleEvent event; - err = AEUtilities::CreateAppleEvent(AE_url_suite, AE_url_getURL, event, psn); - // put in the URL - StAEDescriptor urlDesc(typeChar, url->address, url->address ? strlen(url->address) : 0); - err = ::AEPutParamDesc(&event,keyDirectObject,&urlDesc.mDesc); - ThrowIfOSErr_(err); - err = ::AESend(&event, &reply, kAEWaitReply,kAENormalPriority,60,nil, nil); - AEDisposeDesc(&event); - ThrowIfOSErr_(AEUtilities::EventHasErrorReply(reply)); - AEDisposeDesc(&reply); - } - Catch_(inErr) - { - AEDisposeDesc(&reply); - return false; - } - EndCatch_ - } - EndCatch_ - return true; -} - -void CProtocolHelper::AddNewHelper(CProtocolHelper* helper) -{ - if (helper == NULL) - return; - - LArrayIterator iter(sProtocolHandlers); - CProtocolHelper * otherHelper; - while (iter.Next(&otherHelper)) // Delete duplicate registration for this protocol - if (*helper == otherHelper) - { - delete otherHelper; - sProtocolHandlers.Remove(&otherHelper); - } - sProtocolHandlers.InsertItemsAt(1,1, &helper); - NET_AddExternalURLType(helper->fProtocolInfo); - CPrefs::SetModified(); -} - -// Called from preferences, saves all the protocol handlers -void CNotifierRegistry::ReadProtocolHandlers() -{ - // Add the bolo handler - CProtocolHelper *helper = new CProtocolHelper(strdup("bolo"), 'BOLO'); - - CProtocolHelper::AddNewHelper(helper); - CPrefs::UsePreferencesResFile(); - - Handle stringListHandle = ::Get1Resource('STR#', PROT_HANDLER_PREFS_RESID); - - if (stringListHandle && *stringListHandle) - { - if (::GetHandleSize(stringListHandle) < sizeof(short)) - { - ::RemoveResource(stringListHandle); - ::DisposeHandle(stringListHandle); - return; - } - } - - CStringListRsrc stringRsrc(PROT_HANDLER_PREFS_RESID); - Int16 howMany = stringRsrc.CountStrings(); - if (howMany == 0) - return; - // Each protocol handler is represented by 2 strings - // 1 - the application sig - // 2 - the protocol string - for (int i=1; i < howMany; i=i+2) // Increment by 2. - { - CStr255 applSigStr, protocol; - stringRsrc.GetString(i, applSigStr); - if (ResError()) return; - stringRsrc.GetString(i+1, protocol); - if (ResError()) return; - - OSType appSig; - LString::PStrToFourCharCode(applSigStr, appSig); - CProtocolHelper * newHelper = new CProtocolHelper(XP_STRDUP((char*)protocol), appSig); - CProtocolHelper::AddNewHelper(newHelper); - } -} - -// Called from preferences, writes all the protocol handlers -void CNotifierRegistry::WriteProtocolHandlers() -{ - Int32 howMany = sProtocolHandlers.GetCount(); - if (howMany <= 1) - return; - - Handle stringListHandle = ::Get1Resource('STR#', PROT_HANDLER_PREFS_RESID); - - if (!stringListHandle) { - stringListHandle = ::NewHandle(0); - ::AddResource(stringListHandle, 'STR#', - PROT_HANDLER_PREFS_RESID, CStr255::sEmptyString); - } - - if (stringListHandle && *stringListHandle) - { - SInt8 flags = ::HGetState(stringListHandle); - ::HNoPurge(stringListHandle); - - CStringListRsrc stringRsrc(PROT_HANDLER_PREFS_RESID); - stringRsrc.ClearAll(); - for (int i=1; i<=howMany - 1; i++) - { - CProtocolHelper * helper = NULL; - if (sProtocolHandlers.FetchItemAt(i, &helper)) - { - CStr255 protocol(helper->fProtocolInfo); - Str255 sig; - LString::FourCharCodeToPStr(helper->fApplSig, sig); - stringRsrc.AppendString(sig); - stringRsrc.AppendString(protocol); - } - } - ::WriteResource(stringListHandle); - ::HSetState(stringListHandle, flags); - } -} - -void CNotifierRegistry::HandleAppleEvent(const AppleEvent &inAppleEvent, AppleEvent &outAEReply, - AEDesc &outResult, long inAENumber) -{ - switch(inAENumber) { - case AE_RegisterURLEcho: - HandleRegisterURLEcho(inAppleEvent, outAEReply, outResult, inAENumber); - break; - case AE_UnregisterURLEcho: - HandleUnregisterURLEcho(inAppleEvent, outAEReply, outResult, inAENumber); - break; - case AE_RegisterProtocol: - HandleRegisterProtocol(inAppleEvent, outAEReply, outResult, inAENumber); - break; - case AE_UnregisterProtocol: - HandleUnregisterProtocol(inAppleEvent, outAEReply, outResult, inAENumber); - break; - default: - ThrowOSErr_(errAEEventNotHandled); - } -} - -// Always save the PSN -void CNotifierRegistry::HandleRegisterURLEcho(const AppleEvent &inAppleEvent, AppleEvent &outAEReply, - AEDesc &/*outResult*/, long /*inAENumber*/) -{ - OSType appSignature; - ProcessSerialNumber psn; - - Size realSize; - OSType realType; - - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeApplSignature, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err == noErr) // No parameters, extract the signature from the Apple Event - psn = GetPSNBySig(appSignature); - else - psn = MoreExtractFromAEDesc::ExtractAESender(inAppleEvent); - // Each application can register only once - LArrayIterator iter(sURLEchoHandlers); - ProcessSerialNumber newPSN; - while (iter.Next(&newPSN)) // If we are already registered, returns - if ((newPSN.highLongOfPSN == psn.highLongOfPSN) && (newPSN.lowLongOfPSN == psn.lowLongOfPSN)) - ThrowOSErr_(errAECoercionFail); - sURLEchoHandlers.InsertItemsAt(1,1, &psn); - { - Boolean success = true; - StAEDescriptor replyDesc(success); - err = ::AEPutParamDesc(&outAEReply, keyAEResult, &replyDesc.mDesc); - } -} - - - -void CNotifierRegistry::HandleUnregisterURLEcho(const AppleEvent &inAppleEvent, - AppleEvent &/*outAEReply*/, AEDesc &/*outResult*/, long /*inAENumber*/) -{ - OSType appSignature; - ProcessSerialNumber psn; - - Size realSize; - OSType realType; - - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeApplSignature, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err == noErr) // No parameters, extract the signature from the Apple Event - psn = GetPSNBySig(appSignature); - else - psn = MoreExtractFromAEDesc::ExtractAESender(inAppleEvent); - LArrayIterator iter(::sURLEchoHandlers); - ProcessSerialNumber newPSN; - while (iter.Next(&newPSN)) - if ((newPSN.highLongOfPSN == psn.highLongOfPSN) && (newPSN.lowLongOfPSN == psn.lowLongOfPSN)) - sURLEchoHandlers.Remove(&newPSN); -} - -// Echoing of the URLs. For each registered application, send them the URLEcho AE -void FE_URLEcho(URL_Struct *url, int /*iStatus*/, MWContext *context) -{ - ProcessSerialNumber psn; - OSErr err; - LArrayIterator iter(sURLEchoHandlers); - while (iter.Next(&psn)) - Try_ - { - // Create the event, fill in all the arguments, and send it - AEAddressDesc target; // Target the event - err = AECreateDesc(typeProcessSerialNumber, &psn,sizeof(psn), &target); - ThrowIfOSErr_(err); - AppleEvent echoEvent; - err = ::AECreateAppleEvent(AE_spy_send_suite, AE_spy_URLecho, - &target, - kAutoGenerateReturnID, - kAnyTransactionID, - &echoEvent); - ThrowIfOSErr_(err); - AEDisposeDesc(&target); - // Add the URL - if (url->address) - { - err = ::AEPutParamPtr(&echoEvent, keyDirectObject, typeChar, url->address, strlen(url->address)); - ThrowIfOSErr_(err); - } - // Add the MIME type - if (url->content_type) - { - err = ::AEPutParamPtr(&echoEvent, AE_spy_URLecho_mime, typeChar, url->content_type, strlen(url->content_type)); - ThrowIfOSErr_(err); - } - // Add the refererer - if (url->referer) - { - err = ::AEPutParamPtr(&echoEvent, AE_spy_URLecho_referer, typeChar, url->referer, strlen(url->referer)); - ThrowIfOSErr_(err); - } - // Add the window ID - CNSContext* nsContext = ExtractNSContext(context); - ThrowIfNil_(context); - Int32 windowID = nsContext->GetContextUniqueID(); - err = ::AEPutParamPtr(&echoEvent, AE_spy_URLecho_win, typeLongInteger, &windowID, sizeof(windowID)); - ThrowIfOSErr_(err); - AppleEvent reply; - err = ::AESend(&echoEvent, &reply, kAENoReply,kAENormalPriority,0,nil, nil); - AEDisposeDesc(&echoEvent); - ThrowIfOSErr_(err); - } - Catch_(inErr){} - EndCatch_ -} - -// Registering the protocol -// The protocol is registered by application signature -void CNotifierRegistry::HandleRegisterProtocol(const AppleEvent &inAppleEvent, - AppleEvent &/*outAEReply*/, AEDesc &/*outResult*/, long /*inAENumber*/) -{ - Size realSize; - DescType realType; - OSType appSignature; - char * protocol = nil; - CProtocolHelper * volatile helper; - - Try_ - { - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeApplSignature, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err != noErr) // Signature was not passed appropriately typed, try as type - { - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeType, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err != noErr) // No signature passed, extract it from the Apple Event - { - ProcessSerialNumber psn = MoreExtractFromAEDesc::ExtractAESender(inAppleEvent); - ProcessInfoRec pir; - FSSpec dummy; - pir.processAppSpec = &dummy; - err = ::GetProcessInformation(&psn, &pir); - ThrowIfOSErr_(err); - appSignature = pir.processSignature; - } - } - // Extract the protocol - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_register_protocol_pro, protocol); - // Have app signature, and protocol, add them to the list - helper = new CProtocolHelper(protocol, appSignature); - CProtocolHelper::AddNewHelper(helper); - } - Catch_(inErr){} - EndCatch_ -} - -void CNotifierRegistry::HandleUnregisterProtocol(const AppleEvent &inAppleEvent, - AppleEvent &/*outAEReply*/, AEDesc &/*outResult*/, long /*inAENumber*/) -{ - Size realSize; - DescType realType; - OSType appSignature; - char * protocol = nil; - - Try_ - { - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeApplSignature, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err != noErr) - err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeType, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err != noErr) // No signature passed, extract it from the Apple Event - { - ProcessSerialNumber psn = MoreExtractFromAEDesc::ExtractAESender(inAppleEvent); - ProcessInfoRec pir; - FSSpec dummy; - pir.processAppSpec = &dummy; - err = ::GetProcessInformation(&psn, &pir); - ThrowIfOSErr_(err); - appSignature = pir.processSignature; - } - // Extract the protocol. Not necessary. If we only have the sig, remove all the registered protocols - Try_ - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_register_protocol_pro, protocol); - } - Catch_(inErr){} - EndCatch_ - // Delete it from the list - LArrayIterator iter(sProtocolHandlers); - CProtocolHelper * helper; - while (iter.Next(&helper)) // Delete duplicate registration for this protocol - if (helper->EqualTo(protocol, appSignature)) - { - delete helper; - sProtocolHandlers.Remove(&helper); - } - if (protocol) - NET_DelExternalURLType(protocol); - } - Catch_(inErr){} - EndCatch_ -} - - -XP_Bool FE_UseExternalProtocolModule(MWContext *context, - FO_Present_Types /*iFormatOut*/, URL_Struct *url, - Net_GetUrlExitFunc */*pExitFunc*/) -{ - -#ifndef MOZ_MAIL_NEWS - if (url->address && CInternetConfigInterface::CurrentlyUsingIC()) { - ICError err = CInternetConfigInterface::SendInternetConfigURL(url->address); - if (err == noErr) - return true; - } -#endif - - LArrayIterator iter(sProtocolHandlers); - CProtocolHelper * helper; - while (iter.Next(&helper)) - if (helper->AttemptLaunch(url, context)) - return true; - return false; -} - diff --git a/mozilla/cmd/macfe/applevnt/mregistr.h b/mozilla/cmd/macfe/applevnt/mregistr.h deleted file mode 100644 index 7d5b3161d7c..00000000000 --- a/mozilla/cmd/macfe/applevnt/mregistr.h +++ /dev/null @@ -1,57 +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. - */ - -// mregistr.h -// Registry for AppleEvent notifiers -// Pretty clumsy right now, but separating this functionality out of uapp seems -// to be the right thing. -// It is just a collection of routines - -#pragma once - -#include - -class CNotifierRegistry { -public: -// ¥¥ÊAppleEvent handling - static void HandleAppleEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - static void ReadProtocolHandlers(); // Saving to prefs interface - static void WriteProtocolHandlers(); - -private: - static void HandleRegisterProtocol(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - static void HandleUnregisterProtocol(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -// ¥¥ url echo - static void HandleRegisterURLEcho(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - static void HandleUnregisterURLEcho(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/applevnt/ulaunch.cp b/mozilla/cmd/macfe/applevnt/ulaunch.cp deleted file mode 100644 index bdbd6e11c0c..00000000000 --- a/mozilla/cmd/macfe/applevnt/ulaunch.cp +++ /dev/null @@ -1,489 +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. - */ - -// ulaunch.cp -// Launching of external applications through AppleEvents -// Created by atotic, June 14th, 1994 -// Based on Apple's LaunchWithDoc example snippet - -#include -#include -#include - -#include "BufferStream.h" - -#include "PascalString.h" - -#include "macutil.h" -#include "uprefd.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "reserr.h" -#include "ulaunch.h" - -// ¥¥ PROTOTYPES -OSErr FindAppOnVolume(OSType sig, short vRefNum, FSSpec& thefile); - -// Sends an ODOC event to creator in fndrInfo, -// with file in fileSpec -OSErr SendODOCEvent(OSType appSig, - LFileBufferStream * inFile); - -// Launches the application with the given doc -void LaunchWithDoc(FInfo& fndrInfo, - FSSpec& appSpec, - LFileBufferStream * inFile, - const FSSpec inFileSpec); - - -// Displays a launching error alert. -int LaunchError(ResIDT alertID, OSType creator, const Str63& fileName, OSErr err); - -// Creates Finder's OpenSelection event -OSErr BuildOpenSelectionEvent(FSSpec & fileSpec, AppleEvent& theEvent); - -// Sends OpenSelection to Finder -OSErr SendOpenSelectionToFinder(FSSpec & fileSpec); - -// ¥¥ Implementation - - - -// Builds an ODOC event -OSErr BuildODOCEvent(OSType applSig, - FSSpec fileSpec, - AppleEvent& theEvent) { -// Builds all the arguments for the event - AEDesc myAddress; - AEDesc docDesc; - AEDescList theList; - AliasHandle withThis; - OSErr err; - -// Anatomy of the event: -// Event class: kCoreEventClass -// Event ID: kAEOpenDocuments -// Event has target description (in the form of typeApplSignature) -// keyDirectObject is a list of aliases - - err = AECreateDesc(typeApplSignature, - (Ptr)&applSig, sizeof(applSig), - &myAddress); - if (err) return err; - - err = AECreateAppleEvent(kCoreEventClass, kAEOpenDocuments, - &myAddress, - kAutoGenerateReturnID, kAnyTransactionID, - &theEvent); - if (err) return err; - // create a list for the alaises. In this case, I only have one, but - // you still need a list - - err = AECreateList(NULL, 0, FALSE, &theList); - if (err) return err; - - /* create an alias out of the file spec */ - /* I'm not real sure why I did this, since there is a system coercion handler for */ - /* alias to FSSpec, but I'm paranoid */ - - err = NewAlias(NULL, &fileSpec, &withThis); - if (err) return err; - - HLock((Handle)withThis); - - /* now create an alias descriptor */ - err = AECreateDesc(typeAlias, (Ptr) * withThis, GetHandleSize((Handle)withThis), &docDesc); - if (err) return err; - - HUnlock((Handle)withThis); - - /* put it in the list */ - err = AEPutDesc(&theList, 0, &docDesc); - if (err) return err; - err = AEPutParamDesc(&theEvent, keyDirectObject, &theList); - err = AEDisposeDesc(&myAddress); - err = AEDisposeDesc(&docDesc); - err = AEDisposeDesc(&theList); - return err; -} - -// Sends an ODOC event to appliation -OSErr SendODOCEvent(OSType appSig, - LFileBufferStream * inFile) -{ - OSErr err; - Try_ { - AppleEvent openEvent; - FSSpec inFileSpec; - inFile->GetSpecifier(inFileSpec); - err = BuildODOCEvent(appSig, - inFileSpec, - openEvent); - ThrowIfOSErr_(err); - AppleEvent result; - err = AESend(&openEvent, &result, - kAENoReply + kAECanSwitchLayer, - kAENormalPriority, kAEDefaultTimeout, - NULL,NULL); - AEDisposeDesc(&openEvent); - // err could be memFullErr, app is out of memory - ThrowIfOSErr_(err); - } - Catch_(inErr) { - return inErr; - } EndCatch_ - return err; -} - -#define kDelete 2 -#define kSave 1 -#define kTryAgain 3 -// Displays launch error dialogs with appropriate arguments. -// Alerts used are: -// ALRT_ODOCFailed -// ALRT_AppNotFound -// ALRT_AppMemFull -// ALRT_MiscLaunchError -// Returns: kDelete, kSave, or kTryAgain -int LaunchError(ResIDT alertID, OSType creator, const Str63& fileName, OSErr err) -{ - CMimeMapper * map = CPrefs::sMimeTypes.FindCreator(creator); - ErrorManager::PrepareToInteract(); - CStr255 errorString; - ErrorManager::OSNumToStr(err, errorString); - ParamText(map->GetAppName(), fileName, errorString, "\p"); - UDesktop::Deactivate(); - int retVal = ::CautionAlert(alertID, NULL); - UDesktop::Activate(); - return retVal; -} - -// Launches an application with a given doc -OSErr StartDocInApp(FSSpec theDocument, FSSpec theApplication) -{ - FInfo fndrInfo; - OSErr err; - - HGetFInfo( theApplication.vRefNum, - theApplication.parID, - theApplication.name, - &fndrInfo); - - FSSpec applSpecTemp; - ProcessSerialNumber processSN; - err = FindProcessBySignature(fndrInfo.fdCreator, 'APPL', processSN, &applSpecTemp); - if (err == noErr) // App is running. Send 'odoc' - { - Try_ { - AppleEvent theEvent; - err = BuildODOCEvent(fndrInfo.fdCreator, theDocument, theEvent); - ThrowIfOSErr_(err); - AppleEvent result; - err = AESend(&theEvent, &result, - kAENoReply + kAEAlwaysInteract + kAECanSwitchLayer, - kAENormalPriority, kAEDefaultTimeout, - NULL,NULL); - AEDisposeDesc(&theEvent); - // err could be memFullErr, app is out of memory - ThrowIfOSErr_(err); - if (IsFrontApplication()) - SetFrontProcess(&processSN); - } - Catch_(inErr) { - return inErr; - } EndCatch_ - - return noErr; - } - - Try_ { - LaunchParamBlockRec launchThis; - AEDesc launchDesc; - AppleEvent theEvent; - - ThrowIfOSErr_(BuildODOCEvent(fndrInfo.fdCreator, theDocument, theEvent)); - ThrowIfOSErr_(AECoerceDesc(&theEvent, typeAppParameters, &launchDesc)); - - launchThis.launchAppSpec = (FSSpecPtr)&theApplication; - launchThis.launchAppParameters = (AppParametersPtr)*(launchDesc.dataHandle); - launchThis.launchBlockID = extendedBlock; - launchThis.launchEPBLength = extendedBlockLen; - launchThis.launchFileFlags = NULL; - launchThis.launchControlFlags = launchContinue + launchNoFileFlags + launchUseMinimum; - if (!IsFrontApplication()) - launchThis.launchControlFlags += launchDontSwitch; - err = LaunchApplication(&launchThis); - ThrowIfOSErr_(err); - } - Catch_(inErr) - { - } EndCatch_ - return err; -} - -// Launches the application with the given doc -void LaunchWithDoc(FInfo& fndrInfo, - FSSpec& appSpec, - LFileBufferStream * inFile, - const FSSpec inFileSpec) -{ - OSErr err = CFileMgr::FindApplication(fndrInfo.fdCreator, appSpec); - if (err) // Application not found error - { - int whatToDo = ::LaunchError(ALRT_AppNotFound, fndrInfo.fdCreator, - inFileSpec.name, err); - if (whatToDo == kSave) - CFileMgr::sFileManager.CancelRegister(inFile); // Save the file - else // kDelete - CFileMgr::sFileManager.CancelAndDelete(inFile); // Delete the file - return; - } - - Try_ { - LaunchParamBlockRec launchThis; - AEDesc launchDesc; - AppleEvent theEvent; - - ThrowIfOSErr_(BuildODOCEvent(fndrInfo.fdCreator, inFileSpec, theEvent)); - ThrowIfOSErr_(AECoerceDesc(&theEvent, typeAppParameters, &launchDesc)); - - launchThis.launchAppSpec = (FSSpecPtr)&appSpec; - launchThis.launchAppParameters = (AppParametersPtr)*(launchDesc.dataHandle); - /* launch the thing */ - launchThis.launchBlockID = extendedBlock; - launchThis.launchEPBLength = extendedBlockLen; - launchThis.launchFileFlags = NULL; - launchThis.launchControlFlags = launchContinue + launchNoFileFlags + launchUseMinimum; - if (!IsFrontApplication()) - launchThis.launchControlFlags += launchDontSwitch; - do // Launch until we succeed, or user gives up. - { - err = LaunchApplication(&launchThis); - if ((err == memFullErr) || (err == memFragErr)) - // Launch failed because of low memory - { - int whatToDo = ::LaunchError(ALRT_AppMemFull, fndrInfo.fdCreator, - inFileSpec.name, err); - switch (whatToDo) { - case kSave: - CFileMgr::sFileManager.CancelRegister(inFile); // Save the file - err = noErr; - break; - case kDelete: - CFileMgr::sFileManager.CancelAndDelete(inFile); // Save the file - err = noErr; - break; - case kTryAgain: // Loop again - break; - } - } - else // Unknown launch error - ThrowIfOSErr_(err); - } while (err != noErr); - } - Catch_(inErr) - { - int whatToDo = ::LaunchError(ALRT_AppMiscError, fndrInfo.fdCreator, - inFileSpec.name, inErr); - if (whatToDo == kSave) - CFileMgr::sFileManager.CancelRegister(inFile); // Save the file - else // kDelete - CFileMgr::sFileManager.CancelAndDelete(inFile); // Delete the file - } EndCatch_ -} - - -OSErr -CreateFinderAppleEvent( AEEventID eventID, - SInt16 returnID, - SInt32 transactionID, - AppleEvent & theEvent) -{ - OSErr err; - FSSpec finder; - ProcessSerialNumber psn; - AEDesc finderAddress; - Boolean validAddress = false; - - try - { - err = FindProcessBySignature('MACS', 'FNDR', psn, &finder); - ThrowIfOSErr_(err); - - err = ::AECreateDesc(typeProcessSerialNumber, (Ptr)&psn, sizeof(psn), &finderAddress); - ThrowIfOSErr_(err); - validAddress = true; - - err = ::AECreateAppleEvent( kAEFinderEvents, - eventID, - (const AEAddressDesc *) &finderAddress, - returnID, - transactionID, - &theEvent ); - - } - catch(long tErr) - { - if (validAddress) - ::AEDisposeDesc(&finderAddress); - } - - return err; -} - -// Builds an OpenSelection event for Finder -OSErr BuildOpenSelectionEvent(FSSpec & fileSpec, AppleEvent& theEvent) { - FSSpec dirSpec, procSpec; - FSSpecPtr theFileToOpen = nil; - CStr63 processName; - AEDesc aeDirDesc, listElem; - AEDesc fileList; - ConstStr255Param * dummy = NULL; -// Create the event - OSErr err; - Try_ { - ProcessInfoRec pir; - pir.processInfoLength = sizeof(ProcessInfoRec); - pir.processName = (StringPtr)&processName; - pir.processAppSpec = &procSpec; - // Find a Finder, and create its description as an address for an apple event - - err = CreateFinderAppleEvent(kAEOpenSelection, kAutoGenerateReturnID, kAnyTransactionID, theEvent); - ThrowIfOSErr_(err); - - // Create a description of the file, and the enclosing folder - // keyDirectObject is directory description - // - err = CFileMgr::FolderSpecFromFolderID(fileSpec.vRefNum, fileSpec.parID, dirSpec); - ThrowIfOSErr_(err); - - err = AECreateList(nil, 0, false, &fileList); - ThrowIfOSErr_(err); - - AliasHandle DirAlias, FileAlias; - NewAlias(nil, &dirSpec, &DirAlias); - HLock((Handle)DirAlias); - err = AECreateDesc(typeAlias, (Ptr)*DirAlias, GetHandleSize((Handle)DirAlias), &aeDirDesc); - ThrowIfOSErr_(err); - HUnlock((Handle)DirAlias); - DisposeHandle((Handle)DirAlias); - - err = AEPutParamDesc(&theEvent, keyDirectObject, &aeDirDesc); - ThrowIfOSErr_(err); - AEDisposeDesc(&aeDirDesc); - - NewAlias(nil, &fileSpec, &FileAlias); - HLock((Handle)FileAlias); - err = AECreateDesc(typeAlias, (Ptr)*FileAlias, GetHandleSize((Handle)FileAlias), &listElem); - ThrowIfOSErr_(err); - HUnlock((Handle)FileAlias); - err = AEPutDesc(&fileList, 0, &listElem); - ThrowIfOSErr_(err); - DisposeHandle((Handle)FileAlias); - - err = AEPutParamDesc( &theEvent, keySelection, &fileList); - ThrowIfOSErr_(err); - } - Catch_(inErr) - { - return inErr; - } EndCatch_ - return noErr; -} - -// Sends 'open selection event to Finder -OSErr SendOpenSelectionToFinder(FSSpec & fileSpec) -{ - AppleEvent event; - AppleEvent result; - OSErr err = BuildOpenSelectionEvent(fileSpec, event); - if (err) - return err; - err = AESend(&event, &result, - kAENoReply + kAEAlwaysInteract + kAECanSwitchLayer, - kAENormalPriority, kAEDefaultTimeout, - NULL,NULL); - AEDisposeDesc(&event); - return err; -} - -// A somewhat tricky way of opening a foreign document -// Algorithm: -// - if a process is not running, launch it with the document -// - if a process is running and AE aware, send it an AppleEvent -// - if a process is running and is not AE aware, send openSelection to the Finder. -void LaunchFile(LFileBufferStream * inFile) -{ - FSSpec applSpec; - FInfo fndrInfo; - -// Get file info - FSSpec inFileSpec; - inFile->GetSpecifier(inFileSpec); - - HGetFInfo(inFileSpec.vRefNum, - inFileSpec.parID, - inFileSpec.name, - &fndrInfo); - -// Find if the application is already running - ProcessSerialNumber processSN; - ProcessInfoRec infoRecToFill; - Str63 processName; - infoRecToFill.processInfoLength = sizeof(ProcessInfoRec); - infoRecToFill.processName = (StringPtr)&processName; - infoRecToFill.processAppSpec = &applSpec; - OSErr err = FindProcessBySignature(fndrInfo.fdCreator, 'APPL', processSN, &applSpec); - - if (err == noErr) // App is running. Send 'odoc' - { - err = SendODOCEvent(fndrInfo.fdCreator, inFile); - if (err == noErr) - { - if (IsFrontApplication()) - SetFrontProcess(&processSN); - } - else - { - // Application did not accept apple event for some reason (err = connectionInvalid) - // Send 'odoc' to Finder. Finder can figure out how to fake menu events when - // it tries to open the file - err = SendOpenSelectionToFinder(inFileSpec); - if (err == noErr) - { // If finder launched the application successfully, find it and bring it to front - err = FindProcessBySignature(fndrInfo.fdCreator, 'APPL', processSN, &applSpec); - if (err == noErr && IsFrontApplication()) - SetFrontProcess(&processSN); - } - else // Finder launch also failed. Notify the user - { - //Notify the user, try to handle the error - int whatToDo = LaunchError(ALRT_ODOCFailed, - fndrInfo.fdCreator, - inFileSpec.name, err); - if (whatToDo == 1) - CFileMgr::sFileManager.CancelRegister(inFile); // Save the file - else - CFileMgr::sFileManager.CancelAndDelete(inFile); // Delete the file - } - } - } - else // App is not running. Launch it with this file - LaunchWithDoc(fndrInfo, applSpec, inFile, inFileSpec); -} - diff --git a/mozilla/cmd/macfe/applevnt/ulaunch.h b/mozilla/cmd/macfe/applevnt/ulaunch.h deleted file mode 100644 index c3ab5567a14..00000000000 --- a/mozilla/cmd/macfe/applevnt/ulaunch.h +++ /dev/null @@ -1,45 +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. - */ - -// =========================================================================== -// ulaunch.h -// External application launching routines -// =========================================================================== - -#pragma once - -class LFileBufferStream; - -// Opens the file in its creator application -void LaunchFile(LFileBufferStream * inFile); - -// Launches an application with a given doc -OSErr StartDocInApp(FSSpec theDocument, FSSpec theApplication); - -// Builds an ODOC event for appliation specified by applSig, -// with file in fileSpec -OSErr BuildODOCEvent(OSType applSig, - FSSpec fileSpec, - AppleEvent& theEvent); - -OSErr -CreateFinderAppleEvent( AEEventID eventID, - SInt16 returnID, - SInt32 transactionID, - AppleEvent & theEvent); - diff --git a/mozilla/cmd/macfe/central/BookmarksFile.cp b/mozilla/cmd/macfe/central/BookmarksFile.cp deleted file mode 100644 index 4339f9c36b6..00000000000 --- a/mozilla/cmd/macfe/central/BookmarksFile.cp +++ /dev/null @@ -1,108 +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. - */ - -#include "BookmarksFile.h" -#include "resgui.h" -#include "fe_proto.h" -#include - -#include - - -// -// ReadBookmarksFile -// -// Given a file containing a single URL (probably dropped on the Finder), open it and -// read the URL so we can load it. -// -OSErr -ReadBookmarksFile ( vector & oURL, FSSpec & inSpec ) -{ - FInfo info; - OSErr err = ::FSpGetFInfo (&inSpec, &info); - if (err != noErr) - return err; - - if (info.fdType != emBookmarkFile) - return fnfErr; - - try { - LFileStream stream(inSpec); - stream.OpenDataFork(fsRdPerm); - Int32 howMuch; - - // Read in the URL, which is in the form URL\rTITLE - howMuch = stream.ReadData(&(*oURL.begin()), oURL.size()); - char* where = &(*find(oURL.begin(), oURL.end(), '\r')); - ThrowIfNil_(where); - *where = 0; - } - catch ( Uint32 inErr ) - { - return inErr; - } - - return noErr; -} - - -// -// WriteBookmarksFile -// -// Given an URL (probably dropped on the Finder), create a file and store the URL -// -OSErr WriteBookmarksFile(char * url, FSSpec & spec) -{ - if (!url) - return noErr; - LFileStream stream(spec); - try - { - stream.CreateNewDataFile(emSignature, emBookmarkFile, 0); - } - catch (OSErr inErr) - { - if (inErr != dupFNErr) - return inErr; - } - catch (...) - { - return memFullErr; - } - - try - { - // Set up the file - stream.OpenDataFork(fsRdWrPerm); - stream.SetMarker(0, streamFrom_Start); - - char lineEnding = CR; - // Write the URL - stream.WriteData((void*)url, XP_STRLEN(url) ); - stream.WriteData(&lineEnding, 1); - } - catch (OSErr err) - { - return err; - } - catch (...) - { - return memFullErr; - } - return noErr; -} diff --git a/mozilla/cmd/macfe/central/BookmarksFile.h b/mozilla/cmd/macfe/central/BookmarksFile.h deleted file mode 100644 index ad0e4178446..00000000000 --- a/mozilla/cmd/macfe/central/BookmarksFile.h +++ /dev/null @@ -1,27 +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. - */ - -#pragma once - -#include - -#include - -OSErr ReadBookmarksFile( vector & oURL, FSSpec & spec); -//OSErr WriteBookmarksFile(BM_Entry * entry, FSSpec & spec); -OSErr WriteBookmarksFile(char * url, FSSpec & spec); diff --git a/mozilla/cmd/macfe/central/BrowserClasses.cp b/mozilla/cmd/macfe/central/BrowserClasses.cp deleted file mode 100644 index a0047a7b0d4..00000000000 --- a/mozilla/cmd/macfe/central/BrowserClasses.cp +++ /dev/null @@ -1,364 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// BrowserClasses.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "BrowserClasses.h" - -// ¥¥¥ PowerPlant Classes - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include "CTextColumn.h" // Netscape's own LTextColumn - #include - -// ¥¥¥ PowerPlant Grayscale Classes - #include - -// ¥¥¥ AM wrappers classes and their AM implementations - #include - #include - #include - #include - #include - #include - #include - #include - #include - -#if 0 -// ¥¥¥ Things that will go away after appearance conversion complete - #include "CProgressBar.h" - #include "CPatternProgressBar.h" - #include "CConfigActiveScroller.h" - #include // outdated, replaced by LScrollerView - #include // outdated, replaced by LScrollerView -#endif - -// ¥¥¥ General Purpose UI Classes - #include "CBevelButton.h" - #include "CPatternButton.h" - #include "CGrayBevelView.h" - #include "CPatternBevelView.h" - #include "CPatternButtonPopup.h" - #include "CNavigationButtonPopup.h" - #include "CCloseAllAttachment.h" - #include "CColorEraseAttachment.h" - #include "CGABorderPane.h" - #include "CPatternPane.h" - - #include "CIncludeView.h" - #include "CPlaceHolderView.h" - #include "COffscreenCaption.h" - #include "CClusterView.h" - #include "CTabSwitcher.h" - #include "CPatternTabControl.h" - #include "CProgressCaption.h" - #include "CTaskBarView.h" - #include "LTableHeader.h" - #include "LTableViewHeader.h" - #include "CSimpleDividedView.h" - #include "CKeyScrollAttachment.h" - #include "CToolTipAttachment.h" - #include "CTableTooltipPane.h" - #include "CDynamicTooltips.h" - #include "CPaneEnabler.h" - #include "CStringListToolTipPane.h" - #include "CSaveProgress.h" - #include "CTargetFramer.h" - -#ifdef MOZ_MAIL_NEWS - #include "CBiffButtonAttachment.h" - #include "CSingleLineEditField.h" -#endif - -// ¥¥¥ Browser Specific UI Classes - - #include "CDragBar.h" - #include "CDragBarContainer.h" - #include "CRDFToolbarContainer.h" - #include "CRDFToolbar.h" - #include "CDragBarDockControl.h" - #include "CPatternedGrippyPane.h" - #include "CDividerGrippyPane.h" - #include "CSwatchBrokerView.h" - #include "CToolbarDragBar.h" - #include "CToolbarPatternBevelView.h" - #include "CProxyPane.h" - #include "CProxyCaption.h" - #include "PopupBox.h" - #include "CNavCenterWindow.h" - #include "CNavCenterContextMenuAtt.h" - #include "CNavCenterTitle.h" - #include "CNavCenterScroller.h" - #include "CInlineEditField.h" - - #include "CTSMEditField.h" -// #include "CSimpleTextView.h" - - #include "CDownloadProgressWindow.h" - #include "CURLEditField.h" - #include "CAutoCompleteURLEditField.h" - #include "CURLCaption.h" - #include "CHyperScroller.h" - #include "CButtonEnablerReloadStop.h" - - #include "CBrowserWindow.h" - #include "CHTMLView.h" - #include "CBrowserView.h" - - #include "CSpinningN.h" - #include "CBrowserSecurityButton.h" - #include "CMiniSecurityButton.h" - - #include "mprint.h" - #include "macgui.h" - #include "findw.h" -// #include "prefw.h" - - #include "BookmarksDialogs.h" - #include "mplugin.h" - #include "divview.h" -// #include "mattach.h" - #include "UFormElementFactory.h" - - #include "CMenuTable.h" - #include "CPrefsMediator.h" - #include "CAssortedMediators.h" - -#if defined (JAVA) - #include "mjava.h" -#endif - - #include "CEditorWindow.h" - - #include "CContextMenuAttachment.h" - - #include "CHyperTreeFlexTable.h" - #include "CRDFCoordinator.h" - #include "CHyperTreeHeader.h" - -//----------------------------------- -void RegisterAllBrowserClasses(void) -//----------------------------------- -{ - // AutoRegister classes - - RegisterClass_(CProxyPane); - RegisterClass_(CProxyCaption); - RegisterClass_(CCloseAllAttachment); - RegisterClass_(CColorEraseAttachment); - RegisterClass_(CGABorderPane); - RegisterClass_(CPatternPane); - - RegisterClass_(LSubOverlapView); - - // ¥¥¥ PowerPlant Classes - RegisterClass_(LButton); - RegisterClass_(LCaption); - RegisterClass_(LDialogBox); - RegisterClass_(LEditField); - RegisterClass_(LListBox); - RegisterClass_(LPane); - RegisterClass_(LPicture); - RegisterClass_(LPlaceHolder); - RegisterClass_(LPrintout); - RegisterClass_(LStdControl); - RegisterClass_(LStdButton); - RegisterClass_(LStdCheckBox); - RegisterClass_(LStdRadioButton); - RegisterClass_(LStdPopupMenu); - RegisterClass_(LTextEditView); - RegisterClass_(LView); - RegisterClass_(LWindow); - RegisterClass_(LRadioGroup); - RegisterClass_(LTabGroup); - -#ifdef PP_NewClasses - #include - #include - #include - - RegisterClass_(LCicnButton); - RegisterClass_(LOffscreenView); - RegisterClass_(LTextButton); -#endif - RegisterClass_(LTable); - RegisterClass_(LIconPane); - RegisterClass_(LGroupBox); - RegisterClass_(LTextColumn); - RegisterClass_(CTextColumn); // Netscape's own LTextColumn - - RegisterClass_(CGAPopupMenu); - - // ¥¥¥ PowerPlant Grayscale Classes - RegisterGALibraryClasses(); - - // ¥¥¥ PowerPlant appearance manager classes and their implementations - RegisterClass_(LProgressBar); - RegisterClassID_(LAMControlImp, LProgressBar::imp_class_ID); - RegisterClass_(LScrollBar); - RegisterClassID_(LAMTrackActionImp, LScrollBar::imp_class_ID); - RegisterClass_(LPushButton); - RegisterClassID_(LAMPushButtonImp, LPushButton::imp_class_ID); - - RegisterClass_(LScrollerView); - -#if 0 - // ¥¥¥ Things that will go away after appearance port complete - RegisterClass_(CProgressBar); - RegisterClass_(CPatternProgressBar); - RegisterClass_(CPatternProgressCaption); - RegisterClass_(CConfigActiveScroller); - RegisterClass_(LScroller); - RegisterClass_(LActiveScroller); -#endif - - // ¥¥¥ General Purpose UI Classes - RegisterClass_(CBevelButton); - RegisterClass_(CDeluxeBevelButton); - RegisterClass_(CPatternButton); - RegisterClass_(CPatternButtonPopup); - RegisterClass_(CGrayBevelView); - RegisterClass_(CPatternBevelView); - - - RegisterClass_(CIncludeView); - RegisterClass_(CPlaceHolderView); - RegisterClass_(COffscreenCaption); - RegisterClass_(CClusterView); - RegisterClass_(CPatternTabControl); - RegisterClass_(CTabSwitcher); - RegisterClass_(CKeyScrollAttachment); - RegisterClass_(CToolTipAttachment); - RegisterClass_(CDynamicTooltipPane); - RegisterClass_(CTableToolTipPane); - RegisterClass_(CTableToolTipAttachment); - RegisterClass_(CSharedToolTipAttachment); - RegisterClass_(CMenuTable); - RegisterClass_(CPaneEnabler); - RegisterClass_(CSlaveEnabler); - RegisterClass_(CTargetFramer); - -#ifdef MOZ_MAIL_NEWS - RegisterClass_(CSingleLineEditField); - RegisterClass_(CSelectFolderMenu); -//#else -// RegisterClass_(CBiffButtonAttachment); -#endif // MOZ_MAIL_NEWS - RegisterClass_(CSimpleDividedView); - RegisterClass_(CProgressCaption); - RegisterClass_(CTaskBarView); - - RegisterClass_(CToolTipPane); - RegisterClass_(CStringListToolTipPane); - - RegisterClass_(LTableHeader); - RegisterClass_(LTableViewHeader); - - RegisterClass_(CTextEdit); - RegisterClass_(CEditBroadcaster); - - RegisterClass_(CNavigationButtonPopup); - - // *** Browser Specific UI Classes - - RegisterClass_(CDragBar); - RegisterClass_(CDragBarContainer); - RegisterClass_(CDragBarDockControl); - RegisterClass_(CRDFToolbarContainer); - RegisterClass_(CBrokeredView); - RegisterClass_(CSwatchBrokerView); - RegisterClass_(CToolbarDragBar); - RegisterClass_(CToolbarPatternBevelView); - - RegisterClass_(CTSMEditField); - - RegisterClass_(CDownloadProgressWindow); - RegisterClass_(CBrowserWindow); - RegisterClass_(CHTMLView); - RegisterClass_(CURLEditField); - RegisterClass_(CAutoCompleteURLEditField); - RegisterClass_(CURLCaption); - RegisterClass_(CSaveProgress); - RegisterClass_(CHyperScroller); - RegisterClass_(CButtonEnablerReloadStop); - RegisterClass_(CBrowserView); - RegisterClass_(CAdSpaceView); - - RegisterClass_(CPatternedGrippyPane); - RegisterClass_(CDividerGrippyPane); - RegisterClass_(CSpinningN); - RegisterClass_(CBrowserSecurityButton); - RegisterClass_(CMiniSecurityButton); - - RegisterClass_(CHyperTreeFlexTable); - RegisterClass_(CPopdownFlexTable); - RegisterClass_(CDockedRDFCoordinator); - RegisterClass_(CShackRDFCoordinator); - RegisterClass_(CWindowRDFCoordinator); - RegisterClass_(CPopdownRDFCoordinator); - RegisterClass_(CHyperTreeHeader); - RegisterClass_(CNavCenterScroller); - RegisterClass_(CInlineEditField); - - RegisterClass_(CChameleonCaption); - RegisterClass_(CNavCenterCaption); - RegisterClass_(CChameleonBroadcastCaption); - - RegisterClass_(CNavCenterWindow); - RegisterClass_(CBookmarksFindDialog); - RegisterClass_(CPluginView); - RegisterClass_(LDividedView); - RegisterClass_(CTreeViewContextMenuAttachment); - RegisterClass_(CNavCenterTitle); - RegisterClass_(CNavCenterCommandStrip); - -#ifdef EDITOR - CEditorWindow::RegisterViewTypes(); -#endif // EDITOR - CFindWindow::RegisterViewTypes(); - UFormElementFactory::RegisterFormTypes(); - UHTMLPrinting::RegisterHTMLPrintClasses(); - CPrefsMediator::RegisterViewClasses(); - CPrefsDialog::RegisterViewClasses(); - UAssortedPrefMediators::RegisterViewClasses(); - - RegisterClass_(CContextMenuAttachment); -#ifdef JAVA - RegisterClass_(CJavaView); -#endif - -} // RegisterAllBrowserClasses diff --git a/mozilla/cmd/macfe/central/BrowserClasses.h b/mozilla/cmd/macfe/central/BrowserClasses.h deleted file mode 100644 index 53d91d337c0..00000000000 --- a/mozilla/cmd/macfe/central/BrowserClasses.h +++ /dev/null @@ -1,25 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// BrowserClasses.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -void RegisterAllBrowserClasses(void); \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/BufferStream.cp b/mozilla/cmd/macfe/central/BufferStream.cp deleted file mode 100644 index 737a48f1393..00000000000 --- a/mozilla/cmd/macfe/central/BufferStream.cp +++ /dev/null @@ -1,144 +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. - */ - -#include "BufferStream.h" - -#include "client.h" - -#ifdef PROFILE -#pragma profile on -#endif - -#define STREAM_BUFFER_SIZE 32000 - -LFileBufferStream::LFileBufferStream( FSSpec& inFileSpec ): LFileStream( inFileSpec ) -{ - fBuffer = NULL; - fBufferSize = 0; - fLastWritten = 0; - fUseBuffer = FALSE; - fURL = NULL; - fWriteFailed = FALSE; -} - -LFileBufferStream::~LFileBufferStream() -{ - Try_ - { - FlushBuffer( FALSE ); - } - Catch_(inErr) - { - } - EndCatch_ - if ( fURL ) - XP_FREE( fURL ); -} - -OSErr LFileBufferStream::FlushBuffer( Boolean allocateNew ) -{ - OSErr err = noErr; - - if ( !fUseBuffer ) - return err; - - if ( fBuffer && ( fLastWritten > 0 ) ) - { - HLock( fBuffer ); - Try_ - { - err = LFileStream::PutBytes( *fBuffer, fLastWritten ); - ThrowIfOSErr_(err); - HUnlock( fBuffer ); - } - Catch_(inErr) - { - HUnlock( fBuffer ); - DisposeHandle(fBuffer); - fBuffer = NULL; - fWriteFailed = TRUE; - } - EndCatch_ - fLastWritten = 0; - } - - if (fWriteFailed) - return err; - - if ( allocateNew && ( !fBuffer ) ) - { - fBuffer = ::NewHandle( STREAM_BUFFER_SIZE ); - fBufferSize = STREAM_BUFFER_SIZE; - fLastWritten = 0; - } - - if ( !allocateNew && fBuffer ) - { - DisposeHandle( fBuffer ); - fBuffer = NULL; - } - - return err; -} - -Int32 LFileBufferStream::ReadData( void* outBuffer, Int32 inByteCount ) -{ - return LFileStream::ReadData( outBuffer, inByteCount ); -} - -void LFileBufferStream::DoUseBuffer() -{ - fUseBuffer = TRUE; -} - -void LFileBufferStream::CloseDataFork() -{ - FlushBuffer( FALSE ); - LFileStream::CloseDataFork(); -} - -Int32 LFileBufferStream::WriteData( const void* inFromBuffer, Int32 inByteCount ) -{ - OSErr err = noErr; - - if ( fUseBuffer && ( fLastWritten + inByteCount ) > fBufferSize ) - err = FlushBuffer( TRUE ); - - ThrowIfOSErr_(err); - - if ( ( fBuffer ) && // If we have space, fill up the buffer - ( ( fLastWritten + inByteCount ) <= fBufferSize ) ) - { - ::BlockMoveData( inFromBuffer, &( (*fBuffer)[fLastWritten] ), inByteCount ); - fLastWritten += inByteCount; - return inByteCount; - } - // Otherwise, just do a normal write - else - { - err = LFileStream::PutBytes( inFromBuffer, inByteCount ); - ThrowIfOSErr_(err); - } - - return inByteCount; -} - - -#ifdef PROFILE -#pragma profile off -#endif diff --git a/mozilla/cmd/macfe/central/BufferStream.h b/mozilla/cmd/macfe/central/BufferStream.h deleted file mode 100644 index 8f0b52a8aaa..00000000000 --- a/mozilla/cmd/macfe/central/BufferStream.h +++ /dev/null @@ -1,54 +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 __BUFFERSTREAM__ -#define __BUFFERSTREAM__ - -#include -#include - -// Does plain buffered read/writes -// Buffering strategy: -// reading: read all you can fit in the buffer -// give it to the client in small chunks -// writing: write all you can fit in the buffer -// on overflow, flush everything, then write the rest -// for now, we only buffer writing -class LFileBufferStream: public LFileStream -{ -public: - LFileBufferStream( FSSpec& inFileSpec ); - virtual ~LFileBufferStream(); - virtual Int32 WriteData( const void *inFromBuffer, Int32 inByteCount ); - virtual Int32 ReadData( void* outToBuffer, Int32 inByteCount ); - virtual void CloseDataFork(); - void DoUseBuffer(); - void SetURL( char* url ) { fURL = url; } - char* GetURL() { return fURL; } -protected: - OSErr FlushBuffer( Boolean allocateNew ); - Boolean fUseBuffer; - Handle fBuffer; - UInt32 fBufferSize; - UInt32 fLastWritten; - Boolean fWriteFailed; - char * fURL; -}; - -#endif // __BUFFERSTREAM__ - diff --git a/mozilla/cmd/macfe/central/CAppleEventHandler.cp b/mozilla/cmd/macfe/central/CAppleEventHandler.cp deleted file mode 100644 index 5cd57a59d75..00000000000 --- a/mozilla/cmd/macfe/central/CAppleEventHandler.cp +++ /dev/null @@ -1,1976 +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. - */ - -// CAppleEventHandler.cp - -// ---- Apple Events -#include "CAppleEventHandler.h" - - -/*-------------------------------------------------------------*/ -// Includes -/*-------------------------------------------------------------*/ - -// --- just in case -#include "uapp.h" - -// --- Netscape macfe -#include "Netscape_Constants.h" -#include "earlmgr.h" -#include "findw.h" -#include "macgui.h" -#include "macutil.h" -#include "CBookmarksAttachment.h" -#include "BookmarksFile.h" -#include "mimages.h" -#include "mplugin.h" - -#if defined (JAVA) -#include "mjava.h" -#endif /* defined (JAVA) */ - -#include "mregistr.h" -#include "prefw.h" -#include "resae.h" -#include "resgui.h" -#include "uerrmgr.h" -#include "ufilemgr.h" - -// -- For getting Profile information -#include "prefapi.h" - -// --- Netscape Misc -#include "CEditorWindow.h" -#include "CBrowserWindow.h" - -// --- Just plain Misc -#include "mkutils.h" // only for FREEIF() macro. JRM 96/10/17 - -// --- Netscape NS -#include "CNSContextCallbacks.h" - -// --- Netscape Browser -#include "CBrowserContext.h" -#include "CBrowserWindow.h" - -// --- Netscape MailNews -#ifdef MOZ_MAIL_NEWS -#include "MailNewsSearch.h" -#include "MailNewsFilters.h" -#include "MailNewsAddressBook.h" -#include "MailNewsClasses.h" -#include "MailNewsgroupWindow_Defines.h" -#endif // MOZ_MAIL_NEWS -#include "BrowserClasses.h" - -// --- Mac Toolbox -#include // For the display notice event -#include -#include -#include - - - -#include "CURLDispatcher.h" -#include "xp.h" - -/*--------------------------------------------------------------*/ -// Constructor, Destructor and Dispach -/*--------------------------------------------------------------*/ - -/*---------------------------------------------------------------- - CAppleEventHandler::CAppleEventHandler - Constructor -----------------------------------------------------------------*/ -CAppleEventHandler::CAppleEventHandler() -{ - // Remember our one instance - sAppleEventHandler = this; - - // We assume not operating in kiosk mode unless told otherwise - fKioskMode = KioskOff; - -} -/*---------------------------------------------------------------- - CAppleEventHandler::~CAppleEventHandler - Destructor -----------------------------------------------------------------*/ -CAppleEventHandler::~CAppleEventHandler() -{ - // Reste to NULL, we're gone - sAppleEventHandler = NULL; -} - -/*---------------------------------------------------------------- - CAppleEventHandler::HandleAppleEvent - AppleEvent Dispach Here - In: & AppleEvent Incoming apple event - & ReplyEvent Reply event we can attach result info to - & Descriptor OUtgoing descriptor - AppleEvent ID The Apple Event ID we were called with. - Out: Event Handled by CAppleEvent -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleAppleEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber) -{ - switch (inAENumber) - { - case AE_GetURL: - case AE_OpenURL: - case AE_OpenProfileManager: - // Required Suite - case ae_OpenApp: - case ae_OpenDoc: - case ae_PrintDoc: - case ae_Quit: - break; - - default: - if (!(CFrontApp::GetApplication() && CFrontApp::GetApplication()->HasProperlyStartedUp())) - { - // Ignore all apple events handled by this handler except get url, open - // url and the required suite until we have properly started up. - return; - } - break; - } - - switch (inAENumber) { - - // ### Mac URL standard Suite - // ----------------------------------------------------------- - case AE_GetURL: // Direct object - url, cwin - HyperWindow - HandleGetURLEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - // ### Spyglass Suite - // ----------------------------------------------------------- - case AE_OpenURL: - HandleOpenURLEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_CancelProgress: - HandleCancelProgress( inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_FindURL: // located elsewhere - CFileMgr::sFileManager.HandleFindURLEvent(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_ShowFile: - HandleShowFile(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_ParseAnchor: - HandleParseAnchor(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_SpyActivate: - HandleSpyActivate(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_SpyListWindows: - HandleSpyListWindows(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_GetWindowInfo: - HandleSpyGetWindowInfo(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - case AE_RegisterWinClose: - case AE_UnregisterWinClose: - HandleWindowRegistration(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - // --- These Spyglass events are handled elswhere - case AE_RegisterViewer: - CPrefs::sMimeTypes.HandleRegisterViewerEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_UnregisterViewer: - CPrefs::sMimeTypes.HandleUnregisterViewerEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_RegisterProtocol: - case AE_UnregisterProtocol: - case AE_RegisterURLEcho: - case AE_UnregisterURLEcho: - CNotifierRegistry::HandleAppleEvent(inAppleEvent, outAEReply, outResult, inAENumber); - break; - - - // ### Netscape Experimental Suite - // ----------------------------------------------------------- - case AE_OpenBookmark: - HandleOpenBookmarksEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_ReadHelpFile: - HandleReadHelpFileEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_Go: - HandleGoEvent (inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_GetWD: // Return Working Directory - HandleGetWDEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_OpenProfileManager: - CFrontApp::sApplication->ProperStartup( NULL, FILE_TYPE_PROFILES ); - break; - - case AE_OpenAddressBook: - HandleOpenAddressBookEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_OpenComponent: - HandleOpenComponentEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_HandleCommand: - HandleCommandEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_GetActiveProfile: - HandleGetActiveProfileEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - case AE_GetProfileImportData: - HandleGetProfileImportDataEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - - // ### ???? 2014 looks like it's a core suite thing, but not defined in the aedt - // ----------------------------------------------------------- -/* case 2014: // Display has changed. Maybe in 2.0, should change the pictures - { - StAEDescriptor displayDesc; - OSErr err = AEGetParamDesc(&inAppleEvent,kAEDisplayNotice,typeWildCard,&displayDesc.mDesc); - if (err == noErr) - SysBeep(1); - } - break; -*/ - - // ### If all else fails behave like a word processor - // ----------------------------------------------------------- - default: - CFrontApp::sApplication->LDocApplication::HandleAppleEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - } -} - -/*--------------------------------------------------------------------------*/ -/* ---- Mac URL standard, supported by many apps ---- */ -/*--------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------- - CAppleEventHandler::HandleGetURLEvent Suite:URL - Dispach the URL event to the correct window and let the - window handle the event. - -GetURL: Loads the URL (optionaly to disk) - - GetURL string -- The url - [to file specification] -- file the URL should be loaded into - [inside reference] -- Window the URL should be loaded to - [from string] -- Refererer, to be sent with the HTTP request -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleGetURLEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long /*inAENumber*/) -{ - // We need to make sure - - CFrontApp::sApplication->ProperStartup( NULL, FILE_TYPE_GETURL ); - - // Get the window, and let it handle the event - StAEDescriptor keyData; - OSErr err = ::AEGetKeyDesc(&inAppleEvent, AE_www_typeWindow, typeWildCard,&keyData.mDesc); - - // TODO: handle dispatching to storage - - if (CFrontApp::GetApplication()->HasProperlyStartedUp()) - { - // A window was specified, open the url in that window - if ((err == noErr) && (keyData.mDesc.descriptorType == typeObjectSpecifier)) - { - StAEDescriptor theToken; - err = ::AEResolve(&keyData.mDesc, kAEIDoMinimum, &theToken.mDesc); - ThrowIfOSErr_(err); - LModelObject * model = CFrontApp::sApplication->GetModelFromToken(theToken.mDesc); - ThrowIfNil_(model); - - CBrowserWindow* win = dynamic_cast(model); - ThrowIfNil_(win); - - CBrowserWindow::HandleGetURLEvent(inAppleEvent, outAEReply, outResult, win); - } - // No window or file specified, we will open the url in the frontmost - // browser window or a new browser window if there are no open browser - // windows. - // Or no browser window if one is not appropriate. Good grief! jrm. - else - { - try - { - // 97-09-18 pchen -- first check to see if this is a NetHelp URL, and dispatch - // it directly - // 97/10/24 jrm -- Why can't we always dispatch directly? CURLDispatcher - // already has the logic to decide what's right! Trying this. - MoreExtractFromAEDesc::DispatchURLDirectly(inAppleEvent); - } - catch (...) - { - // Get a window - - CBrowserWindow* win = CBrowserWindow::FindAndShow(true); - ThrowIfNil_(win); - - // Let the window handle the event - - CBrowserWindow::HandleGetURLEvent(inAppleEvent, outAEReply, outResult, win); - } - } - } - else - { - CBrowserWindow::HandleGetURLEvent(inAppleEvent, outAEReply, outResult); - } -} // CAppleEventHandler::HandleGetURLEvent - -/*--------------------------------------------------------------------------*/ -/* ---- The Spygless Suite ---- */ -/*--------------------------------------------------------------------------*/ - -#define errMakeNewWindow 100 - -/*---------------------------------------------------------------- - CAppleEventHandler::HandleOpenURLEvent Suite:Spyglass - Open to a URL - In: Incoming apple event, reply event, outtgoing descriptor, eventID - - Flavors of OpenURL - #define AE_spy_openURL 'OURL' // typeChar OpenURL - AE_spy_openURL_into // typeFSS into - AE_spy_openURL_wind // typeLongInteger windowID - AE_spy_openURL_flag // typeLongInteger flags - 4 bits used. - 1 = - 2 = - 4 = - 8 = Open into editor window - AE_spy_openURL_post // typeWildCard post data - AE_spy_openURL_mime // typeChar MIME type - AE_spy_openURL_prog // typePSN Progress app - - Just like with GetURL, figure out the window, and let it handle the load - Arguments we care about: AE_spy_openURL_wind - - Out: OpenURLEvent handled -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleOpenURLEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long /*inAENumber*/) -{ - // We need to make sure - CFrontApp::sApplication->ProperStartup( NULL, FILE_TYPE_GETURL ); - - // Get the Flags to see if we want an editor - try - { - long flags; - DescType realType; - Size actualSize; - OSErr err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_flag, typeLongInteger, - &realType, &flags, sizeof(flags), &actualSize); - ThrowIfOSErr_(err); -#ifdef EDITOR - if (flags & 0x8) - { - // Get the url (in case we want an editor) - char* url = NULL; - MoreExtractFromAEDesc::GetCString(inAppleEvent, keyDirectObject, url); - ThrowIfNil_(url); - // MAJOR CRASHING BUG!!! if building Akbar 3.0 we should NOT CALL MakeEditWindow!!! - URL_Struct * request = NET_CreateURLStruct (url, NET_DONT_RELOAD); - XP_FREE (url); - ThrowIfNil_(request); - CEditorWindow::MakeEditWindow( NULL, request); - return; - } -#endif // EDITOR - } - catch(...) - { - } - - if (CFrontApp::GetApplication()->HasProperlyStartedUp()) - { - // Get the window, and let it handle the event - try - { - Int32 windowID; - Size realSize; - OSType realType; - - OSErr err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_wind, typeLongInteger, - &realType, &windowID, sizeof(windowID), &realSize); - ThrowIfOSErr_(err); - - // If 0 then create a new window, - // If FFFF set to front most window - CBrowserWindow* win = NULL; - if (windowID == 0) - { - win = CURLDispatcher::CreateNewBrowserWindow(); - } - else if (windowID == 0xFFFFFFFF) // Frontmost window - win = CBrowserWindow::FindAndShow(); - else - win = CBrowserWindow::GetWindowByID(windowID); - - ThrowIfNil_(win); - CBrowserWindow::HandleOpenURLEvent(inAppleEvent, outAEReply, outResult, win); - } - catch(...) - { - // 97-09-18 pchen -- first check to see if this is a NetHelp URL, and dispatch - // it directly - // 97/10/24 jrm -- Why can't we always dispatch directly? CURLDispatcher - // already has the logic to decide what's right! Trying this. - MoreExtractFromAEDesc::DispatchURLDirectly(inAppleEvent); - return; - } - } - else - { - CBrowserWindow::HandleOpenURLEvent(inAppleEvent, outAEReply, outResult); - } -} // CAppleEventHandler::HandleOpenURLEvent - - -/*---------------------------------------------------------------- - ShowFile - Similar to odoc, except that it takes a few extra arguments - keyDirectObject file spec - AE_spy_showFile_mime MIME type (optional) - AE_spy_showFile_win window ID (optional) - AE_spy_showFile_url url (optional) - - ShowFile: Similar to OpenDocuments, except that it specifies the parent - URL, and MIME type of the file - - ShowFile - alias -- File to open - [MIME type string] -- MIME type - [Window ID integer] -- Window to open the file in - [URL string] -- Use this as a base URL - - Result: - integer -- Window ID of the loaded window. - 0 means ShowFile failed, - FFFFFFF means that data was not appropriate type to display in the browser. -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleShowFile(const AppleEvent &inAppleEvent, - AppleEvent& /*outAEReply*/, AEDesc& /*outResult*/, long /*inAENumber*/) -{ -Assert_(false); - char * url = NULL; - char * mimeType = NULL; - CBrowserWindow * win = NULL; - FSSpec fileSpec; - Boolean hasFileSpec = FALSE; - OSErr err; - Size realSize; - OSType realType; - - // Get the file specs - err = ::AEGetKeyPtr(&inAppleEvent, keyDirectObject, typeFSS, - &realType, &fileSpec, sizeof(fileSpec), &realSize); - ThrowIfOSErr_(err); - - // Get the window - try - { - Int32 windowID; - err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_wind, typeLongInteger, - &realType, &windowID, sizeof(windowID), &realSize); - ThrowIfOSErr_(err); - win = CBrowserWindow::GetWindowByID(windowID); - ThrowIfNil_(win); - } - catch (...) - { - win = CBrowserWindow::FindAndShow(); - ThrowIfNil_(win); - } - - // Get the url - try - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_showFile_url, url); - } - catch(...) - { - } - - // Get the mime type - try - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_showFile_mime, mimeType); - } - catch(...) - { - } - - CFrontApp::sApplication->OpenLocalURL(&fileSpec, win, mimeType); -} - -/*---------------------------------------------------------------- - ParseAnchor AppleEvent - Gets the URL, the relative url, and returns the full url of the relative - - arse anchor: Resolves the relative URL - parse anchor - string -- Main URL - relative to string -- Relative URL - Result: - string -- Parsed URL -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleParseAnchor(const AppleEvent - &inAppleEvent, AppleEvent &outAEReply, AEDesc& /*outResult*/, long /*inAENumber*/) -{ - char * url = nil; - char * relative = nil; - char * parsed = nil; - MoreExtractFromAEDesc::GetCString(inAppleEvent, keyDirectObject, url); - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_parse_rel, relative); - parsed = NET_MakeAbsoluteURL(url, relative); - ThrowIfNil_(parsed); - - OSErr err = ::AEPutParamPtr(&outAEReply, keyAEResult, typeChar, parsed, strlen(parsed)); - if (parsed) - XP_FREE(parsed); -} - -/*---------------------------------------------------------------- - HandleCancelProgress - Find the context with this transaction ID, and cancel it - In: Incoming apple event, reply event, outtgoing descriptor, eventID - Out: OpenURLEvent handled - - cancel progress: - Interrupts the download of the document in the given window - - cancel progress - integer -- progress ID, obtained from the progress app - [in window integer] -- window ID of the progress to cancel -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleCancelProgress(const AppleEvent &inAppleEvent, - AppleEvent & /* outAEReply */, - AEDesc & /* outResult */, - long /* inAENumber */) -{ - // Find the window with this transaction, and let it handle the event - - try - { - Int32 transactionID; - StAEDescriptor transDesc; - Boolean hasTransactionID = FALSE; - Boolean hasWindowID = FALSE; - try - { - OSErr err = ::AEGetKeyDesc(&inAppleEvent, keyDirectObject, typeWildCard, &transDesc.mDesc); - ThrowIfOSErr_(err); - UExtractFromAEDesc::TheInt32(transDesc.mDesc, transactionID); - hasTransactionID = TRUE; - } - catch(...) - { - } - try - { - OSErr err = ::AEGetKeyDesc(&inAppleEvent, AE_spy_CancelProgress_win, typeWildCard, &transDesc.mDesc); - ThrowIfOSErr_(err); - UExtractFromAEDesc::TheInt32(transDesc.mDesc, transactionID); - hasWindowID = TRUE; - } - catch(...) - { - } - - CBrowserWindow* window; - if (!hasTransactionID && !hasWindowID) // No arguments, interrupt frontmost by default - { - window = CBrowserWindow::FindAndShow(); - if (window && window->GetWindowContext()) - NET_InterruptWindow(*(window->GetWindowContext())); - } - else - { - CMediatedWindow* theWindow; - CWindowIterator iter(WindowType_Browser); - while (iter.Next(theWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theWindow); - CNSContext* nsContext = theBrowserWindow->GetWindowContext(); - if (((nsContext->GetTransactionID() == transactionID) && hasTransactionID) - || ((nsContext->GetContextUniqueID() == transactionID) && hasWindowID)) - NET_InterruptWindow(*nsContext); - } - } - } - catch(...) - { - } -} - - -/*---------------------------------------------------------------- - webActivate: Makes Netscape the frontmost application, and selects a given - window. This event is here for suite completeness/ cross-platform - compatibility only, you should use standard AppleEvents instead. - - webActivate - integer -- window to bring to front -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleSpyActivate(const AppleEvent &inAppleEvent, AppleEvent& /*outAEReply*/, - AEDesc& /*outResult*/, long /*inAENumber*/) -{ - Size realSize; - OSType realType; - CBrowserWindow * win = NULL; - OSErr err; - - MakeFrontApplication(); - // Get the window, and select it - try - { - Int32 windowID; - - err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_wind, typeLongInteger, - &realType, &windowID, sizeof(windowID), &realSize); - ThrowIfOSErr_(err); - - win = CBrowserWindow::GetWindowByID(windowID); - if (win == nil) - Throw_(errAENoSuchObject); - UDesktop::SelectDeskWindow(win); - } - catch(...){} -} - -/*---------------------------------------------------------------- - list windows: Lists the IDs of all the hypertext windows - - list windows - Result: - list -- List of unique IDs of all the hypertext windows -----------------------------------------------------------------*/ -void -CAppleEventHandler::HandleSpyListWindows( - const AppleEvent& inAppleEvent, - AppleEvent& outAEReply, - AEDesc& outResult, - long inAENumber) -{ -#pragma unused(inAppleEvent, outResult, inAENumber) - - AEDescList windowList; - windowList.descriptorType = typeNull; - OSErr err; - - try - { - // Create a descriptor list, and add a windowID for each browser window to the list - - CMediatedWindow* theWindow = NULL; - DataIDT windowType = WindowType_Browser; - CWindowIterator iter(windowType); - - err = ::AECreateList(nil, 0, FALSE, &windowList); - ThrowIfOSErr_(err); - - while (iter.Next(theWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theWindow); - ThrowIfNil_(theBrowserWindow); - - CBrowserContext* theBrowserContext = (CBrowserContext*)theBrowserWindow->GetWindowContext(); - ThrowIfNil_(theBrowserContext); - - StAEDescriptor theIDDesc(theBrowserContext->GetContextUniqueID()); - err = ::AEPutDesc(&windowList, 0, &theIDDesc.mDesc); - ThrowIfOSErr_(err); - } - } - catch (...) - { - if (windowList.descriptorType != typeNull) - ::AEDisposeDesc(&windowList); - throw; - } - - err = ::AEPutParamDesc(&outAEReply, keyAEResult, &windowList); - ThrowIfOSErr_(err); - ::AEDisposeDesc(&windowList); -} - - -/*---------------------------------------------------------------- - Gets the window information, a list containing URL and title - ## Another redundant event that has an equivalent event already - specified by Apple - - get window info: - Returns the information about the window as a list. - Currently the list contains the window title and the URL. - ## You can get the same information using standard Apple Event GetProperty. - - get window info - integer -- window ID - Result: - list -- contains URL and title strings -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleSpyGetWindowInfo(const AppleEvent &inAppleEvent, AppleEvent &outAEReply, - AEDesc& /*outResult*/, long /*inAENumber*/) -{ - Size realSize; - OSType realType; - CBrowserWindow * win = NULL; // Window - OSErr err; - AEDescList propertyList; - propertyList.descriptorType = typeNull; - - try - { - // Get the window, and list its properties - Int32 windowID; - - err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeLongInteger, - &realType, &windowID, sizeof(windowID), &realSize); - ThrowIfOSErr_(err); - win = CBrowserWindow::GetWindowByID(windowID); - if (win == nil) - Throw_(errAENoSuchObject); - - // Create the list - err = ::AECreateList(nil, 0, FALSE, &propertyList); - ThrowIfOSErr_(err); - - // Put the URL as the first item in the list - cstring url = win->GetWindowContext()->GetCurrentURL(); - err = ::AEPutPtr(&propertyList, 1, typeChar, (char*)url, url.length()); - ThrowIfOSErr_(err); - - // Put the title as the second item in the list - CStr255 ptitle; - GetWTitle(win->GetMacPort(), ptitle); - cstring ctitle((char*)ptitle); - err = ::AEPutPtr(&propertyList, 2, typeChar, (char*)ctitle, ctitle.length()); - ThrowIfOSErr_(err); - - // Put the list as the reply - err = ::AEPutParamDesc(&outAEReply, keyAEResult, &propertyList); - ::AEDisposeDesc(&propertyList); - } - catch(...) - { - if (propertyList.descriptorType != typeNull) - ::AEDisposeDesc(&propertyList); - throw; - } -} - -/*---------------------------------------------------------------- - register window close: - Netscape will notify registered application when this window closes - - register window close - 'sign' -- Application signature for window - integer -- window ID - - [Result: boolean] -- true if successful - - unregister window close: - Undo for register window close unregister window close - - 'sign' -- Application signature for window - integer -- window ID - - [Result: boolean] -- true if successful -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleWindowRegistration(const AppleEvent &inAppleEvent, AppleEvent &outAEReply, - AEDesc &outResult, long inAENumber) -{ - Size realSize; - OSType realType; - CBrowserWindow * win = NULL; - OSErr err; - - // Get the window, and select it - Int32 windowID; - - err = ::AEGetParamPtr(&inAppleEvent, AE_spy_registerWinClose_win, typeLongInteger, - &realType, &windowID, sizeof(windowID), &realSize); - ThrowIfOSErr_(err); - - win = CBrowserWindow::GetWindowByID(windowID); - if (win == nil) - Throw_(errAENoSuchObject); - win->HandleAppleEvent(inAppleEvent, outAEReply, outResult, inAENumber); -} - - - -/*--------------------------------------------------------------------------*/ -/* ---- Experimental Netscape Suite ---- */ -/*--------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------- - Open bookmark: Reads in a bookmark file - - Open bookmark - alias -- If not available, reloads the current bookmark file -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleOpenBookmarksEvent( const AppleEvent &inAppleEvent, - AppleEvent & /*outAEReply*/, - AEDesc & /*outResult*/, - long /*inAENumber*/) -{ - FSSpec fileSpec; - Boolean hasFileSpec = FALSE; - OSErr err; - Size realSize; - OSType realType; - - char * path = NULL; - - // Get the file specs - err = ::AEGetKeyPtr(&inAppleEvent, keyDirectObject, typeFSS, - &realType, &fileSpec, sizeof(fileSpec), &realSize); - - // If none, use the default file - // I hate this glue to uapp. Will change as soon as all AE stuff - // is working. - if (err != noErr) - path = GetBookmarksPath( fileSpec, TRUE ); - else - path = GetBookmarksPath( fileSpec, FALSE ); - - ThrowIfNil_(path); - - DebugStr("\pNot implemented"); -//¥¥¥ CBookmarksContext::Initialize(); -//¥¥¥ BM_ReadBookmarksFromDisk( *CBookmarksContext::GetInstance(), path, NULL ); -} - -/*---------------------------------------------------------------- - Open AddressBook: Opens the address book - - Open AddressBook -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleOpenAddressBookEvent( - const AppleEvent &/*inAppleEvent*/, - AppleEvent & /*outAEReply*/, - AEDesc & /*outResult*/, - long /*inAENumber*/) -{ -#ifdef MOZ_MAIL_NEWS - CAddressBookManager::ShowAddressBookWindow(); -#endif // MOZ_MAIL_NEWS -} - - -/*---------------------------------------------------------------- - Open Component: Opens the component specified in the parameter - to the Apple Event. - - HandleOpenComponentEvent -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleOpenComponentEvent( - const AppleEvent &inAppleEvent, - AppleEvent & /*outAEReply*/, - AEDesc & /*outResult*/, - long /*inAENumber*/) -{ - OSType componentType; - DescType returnedType; - Size gotSize = 0; - - OSErr err = ::AEGetKeyPtr(&inAppleEvent, keyDirectObject, typeEnumerated, &returnedType, &componentType, - sizeof(OSType), &gotSize); - - if (err == noErr && gotSize == sizeof(OSType)) - { - switch (componentType) - { - case AE_www_comp_navigator: - CFrontApp::sApplication->ObeyCommand(cmd_BrowserWindow); - break; - -#ifdef MOZ_MAIL_NEWS - case AE_www_comp_inbox: - CFrontApp::sApplication->ObeyCommand(cmd_Inbox); - break; - - case AE_www_comp_collabra: - CFrontApp::sApplication->ObeyCommand(cmd_MailNewsFolderWindow); - break; -#endif // MOZ_MAIL_NEWS -#ifdef EDITOR - case AE_www_comp_composer: - CFrontApp::sApplication->ObeyCommand(cmd_NewWindowEditor); - break; -#endif // EDITOR -#if !defined(MOZ_LITE) && !defined(MOZ_MEDIUM) - case AE_www_comp_conference: - CFrontApp::sApplication->ObeyCommand(cmd_LaunchConference); - break; - - case AE_www_comp_calendar: - CFrontApp::sApplication->ObeyCommand(cmd_LaunchCalendar); - break; - - case AE_www_comp_ibmHostOnDemand: - CFrontApp::sApplication->ObeyCommand(cmd_Launch3270); - break; -#endif -#ifdef MOZ_NETCAST - case AE_www_comp_netcaster: - CFrontApp::sApplication->ObeyCommand(cmd_LaunchNetcaster); - break; -#endif // MOZ_NETCAST - default: - ; //do nothing - } - } -} - - -/*---------------------------------------------------------------- - HandleCommandEvent - - Get new mail -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleCommandEvent( - const AppleEvent & inAppleEvent, - AppleEvent & /*outAEReply*/, - AEDesc & /*outResult*/, - long /*inAENumber*/) -{ - - long commandID; - DescType returnedType; - Size gotSize = 0; - - OSErr err = ::AEGetKeyPtr(&inAppleEvent, keyDirectObject, typeEnumerated, &returnedType, - &commandID, sizeof(long), &gotSize); - - if (err == noErr && gotSize == sizeof(long)) - { -// Is this really only for mail???? -#ifdef MOZ_MAIL_NEWS - CFrontApp::sApplication->ObeyCommand(commandID); -#endif // MOZ_MAIL_NEWS - - - } -} - - -/*---------------------------------------------------------------- - Read help file: - Reads in the help file (file should be in the help file format) - ## Questions about the new help file system, ask montulli - - Read help file - alias - [with index string] -- Index to the help file. Defaults to ÔDEFAULTÕ) - [search text string] -- Optional text to search for -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleReadHelpFileEvent(const AppleEvent &inAppleEvent, - AppleEvent & /*outAEReply*/, - AEDesc & /*outResult*/, - long /*inAENumber*/) -{ - FSSpec fileSpec; - char * map_file_url = NULL; - char * help_id = NULL; - char * search_text = NULL; - OSErr err; - Size realSize; - OSType realType; - - CFrontApp::sApplication->ProperStartup(NULL, FILE_TYPE_NONE); - - try - { - // Get the file specs - err = ::AEGetKeyPtr(&inAppleEvent, keyDirectObject, typeFSS, - &realType, &fileSpec, sizeof(fileSpec), &realSize); - ThrowIfOSErr_(err); - - map_file_url = CFileMgr::GetURLFromFileSpec( fileSpec ); - ThrowIfNil_(map_file_url); - - // Get the help text - - try - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_www_ReadHelpFileID, help_id); - } - catch(...) - { - } - - // Get the search text (optional) - try - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_www_ReadHelpFileSearchText, search_text); - } - catch(...) - {} - } - catch(...) - { - throw; - } - - // Will using the bookmark context as a dummy work? - DebugStr("\pNot implemented"); -//¥¥¥ CBookmarksContext::Initialize(); -//¥¥¥ NET_GetHTMLHelpFileFromMapFile(*CBookmarksContext::GetInstance(), -// map_file_url, help_id, search_text); - - FREEIF(map_file_url); - FREEIF(help_id); - FREEIF(search_text); -} - -/*---------------------------------------------------------------- - Go: navigate a window: back, forward, again(reload), home) - Go - reference -- window - direction again/home/backward/forward -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleGoEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber) -{ - // We need to make sure - - CFrontApp::sApplication->ProperStartup( NULL, FILE_TYPE_GETURL ); - CBrowserWindow * win = NULL; - - // Get the window. If it is a Browser window then - // decode the AE and send a message. - - // The keyData.mDesc should be a ref to a browser window - // If we get it successfulle (ie the user included the "in window 1" - // then we can get a hold of the actual BrowserWindow object by using - // AEResolve and GetModelFromToken somehow - StAEDescriptor keyData; - OSErr err = ::AEGetKeyDesc(&inAppleEvent, AE_www_typeWindow, typeWildCard, &keyData.mDesc); - if ((err == noErr) && (keyData.mDesc.descriptorType == typeObjectSpecifier)) - { - StAEDescriptor theToken; - err = ::AEResolve(&keyData.mDesc, kAEIDoMinimum, &theToken.mDesc); - ThrowIfOSErr_(err); - LModelObject * model = CFrontApp::sApplication->GetModelFromToken(theToken.mDesc); - ThrowIfNil_(model); - model->HandleAppleEvent(inAppleEvent, outAEReply, outResult, inAENumber); - - // else the user did not provide an inside reference "inside window 1" - // so send back an error - }else{ - - } -} - -/*---------------------------------------------------------------- - Get workingURL: - Get the path to the running application in URL format. - This will allow a script to construct a relative URL - - Get workingURL - Result: - 'tTXT' -- Will return text of the from ÒFILE://foo/applicationnameÓ -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleGetWDEvent( - const AppleEvent & /*inAppleEvent */, - AppleEvent & outAEReply, - AEDesc & /*outResult */, - long /*inAENumber */) -{ - char *pathBlock = NULL; - Size pathLength; - OSErr err; - - // Grab the URL of the running application - pathBlock = PathURLFromProcessSignature (emSignature, 'APPL'); - - if (outAEReply.dataHandle != NULL && pathBlock != NULL) - { - pathLength = XP_STRLEN(pathBlock); - - err = AEPutParamPtr( &outAEReply, - keyDirectObject, - typeChar, - pathBlock, pathLength); - } - - if (pathBlock) - XP_FREE(pathBlock); - -} - - -/*---------------------------------------------------------------- - HandleGetActiveProfileEvent: - Get the name of the active profile from the prefs. - - Result: - 'tTXT' -- Will return text of the profile name -----------------------------------------------------------------*/ -void CAppleEventHandler::HandleGetActiveProfileEvent( - const AppleEvent & /*inAppleEvent */, - AppleEvent &outAEReply, - AEDesc & /*outResult */, - long /*inAENumber */) -{ - char profileName[255]; - int len = 255; - OSErr err = noErr; - - err = PREF_GetCharPref("profile.name", profileName, &len); - - if (err == PREF_NOERROR && outAEReply.dataHandle != nil) { - - err = AEPutParamPtr( &outAEReply, - keyDirectObject, - typeChar, - profileName, strlen(profileName)); - } -} - -//---------------------------------------------------------------------------------------- -void CAppleEventHandler::HandleGetProfileImportDataEvent( - const AppleEvent & /*inAppleEvent */, - AppleEvent &outAEReply, - AEDesc & /*outResult */, - long /*inAENumber */) -// -// Returns useful data for the external import module. -// -// Result: -// 'tTXT' -- (Though binary data - see ProfileImportData struct below) -//---------------------------------------------------------------------------------------- -{ -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#else -#error "There'll be a big bug here" -#endif - struct ProfileImportData - { - Int16 profileVRefNum; - long profileDirID; - Int16 mailFolderVRefNum; - long mailFolderDirID; - DataIDT frontWindowKind; - } data; -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - Assert_(16==sizeof(ProfileImportData)); - FSSpec spec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - data.profileVRefNum = spec.vRefNum; - data.profileDirID = spec.parID; - spec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - data.mailFolderVRefNum = spec.vRefNum; - data.mailFolderDirID = spec.parID; - CWindowIterator iter(WindowType_Any, false); - CMediatedWindow* frontWindow = nil; - data.frontWindowKind = iter.Next(frontWindow) ? frontWindow->GetWindowType() : 0; - /* err =*/ AEPutParamPtr( &outAEReply, - keyDirectObject, - typeChar, - &data, sizeof(data)); -} // CAppleEventHandler::HandleGetProfileImportDataEvent - -/*--------------------------------------------------------------------------*/ -/* ---- Apple Event Object Model support ---- */ -/*--------------------------------------------------------------------------*/ - -void CAppleEventHandler::GetSubModelByUniqueID(DescType inModelID, const AEDesc &inKeyData, AEDesc &outToken) const -{ - switch (inModelID) - { - case cWindow: // The hyperwindows have unique IDs that can be resolved - // FFFFFFFFF is the front window, 0 is a new window - Int32 windowID; - UExtractFromAEDesc::TheInt32(inKeyData, windowID); - LWindow* foundWindow = NULL; - - foundWindow = CBrowserWindow::GetWindowByID(windowID); - if (foundWindow == NULL) - ThrowOSErr_(errAENoSuchObject); - else - CFrontApp::sApplication->PutInToken(foundWindow, outToken); - break; - default: - CFrontApp::sApplication->LDocApplication::GetSubModelByUniqueID(inModelID, inKeyData, outToken); - break; - } -} - -void CAppleEventHandler::GetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc) const -{ - OSErr err; - - switch (inProperty) - { - case AE_www_typeApplicationAlert: // application that handles alerts - err = ::AECreateDesc(typeType, &ErrorManager::sAlertApp, - sizeof(ErrorManager::sAlertApp), &outPropertyDesc); - ThrowIfOSErr_(err); - break; - - case AE_www_typeKioskMode: - err = ::AECreateDesc(typeLongInteger, (const void *)fKioskMode, - sizeof(fKioskMode), &outPropertyDesc); - break; - - default: - CFrontApp::sApplication->LApplication::GetAEProperty(inProperty, inRequestedType, outPropertyDesc); - break; - } -} - -void CAppleEventHandler::SetAEProperty(DescType inProperty, - const AEDesc &inValue, - AEDesc &outPropertyDesc) -{ - - switch (inProperty) { - case AE_www_typeApplicationAlert: // application that handles alerts - try - { - OSType newSig; - UExtractFromAEDesc::TheType(inValue, newSig); - ErrorManager::sAlertApp = newSig; - } - catch(...) // In case of error, revert to self - { - ErrorManager::sAlertApp = emSignature; - } - break; - case AE_www_typeKioskMode: - try - { - Boolean menuBarModeChangeBroadcasted = false; - Int32 kMode; - UExtractFromAEDesc::TheInt32(inValue, kMode); - - if ((kMode == KioskOn) && (fKioskMode != KioskOn)) - { - fKioskMode = KioskOn; - // SetMenubar(KIOSK_MENUBAR); ¥¥¥ this is currently handled by the chrome structure, below - // BUT, they want three states for menu bars, and the field is only a boolean - - CMediatedWindow* theIterWindow = NULL; - DataIDT windowType = WindowType_Browser; - CWindowIterator theWindowIterator(windowType); - - while (theWindowIterator.Next(theIterWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theIterWindow); - if (theBrowserWindow != nil) - { - Chrome aChrome; - theBrowserWindow->GetChromeInfo(&aChrome); - aChrome.show_button_bar = 0; - aChrome.show_url_bar = 0; - aChrome.show_directory_buttons = 0; - aChrome.show_security_bar = 0; - aChrome.show_menu = 0; // ¥¥¥ this isn't designed correctly! deeje 97-03-13 - - // Make sure we only broadcast the menubar mode change once! - theBrowserWindow->SetChromeInfo(&aChrome, !menuBarModeChangeBroadcasted); - if (!menuBarModeChangeBroadcasted) - { - menuBarModeChangeBroadcasted = true; - } - } - } - } - else if ((kMode == KioskOff) && (fKioskMode != KioskOff)) - { - fKioskMode = KioskOff; - // SetMenubar(MAIN_MENUBAR); ¥¥¥ this is currently handled by the chrome structure, below - // BUT, they want three states for menu bars, and the field is only a boolean - - CMediatedWindow* theIterWindow = NULL; - DataIDT windowType = WindowType_Browser; - CWindowIterator theWindowIterator(windowType); - - while (theWindowIterator.Next(theIterWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theIterWindow); - if (theBrowserWindow != nil) - { - Chrome aChrome; - theBrowserWindow->GetChromeInfo(&aChrome); - aChrome.show_button_bar = CPrefs::GetBoolean(CPrefs::ShowToolbar); - aChrome.show_url_bar = CPrefs::GetBoolean(CPrefs::ShowURL); - aChrome.show_directory_buttons = CPrefs::GetBoolean(CPrefs::ShowDirectory); - aChrome.show_security_bar = CPrefs::GetBoolean(CPrefs::ShowToolbar) || CPrefs::GetBoolean(CPrefs::ShowURL); - aChrome.show_menu = 1; // ¥¥¥ this isn't designed correctly! deeje 97-03-13 - - // Make sure we only broadcast the menubar mode change once! - theBrowserWindow->SetChromeInfo(&aChrome, !menuBarModeChangeBroadcasted); - if (!menuBarModeChangeBroadcasted) - { - menuBarModeChangeBroadcasted = true; - } - } - } - } - - } - catch(...) - {} - break; - default: - CFrontApp::sApplication->LApplication::SetAEProperty(inProperty, inValue, outPropertyDesc); - break; - } - - -} - -/*--------------------------------------------------------------------------*/ -/* ---- Eudora (send) Mail Suite ---- */ -/*--------------------------------------------------------------------------*/ - - -/*-------------------------------------------------------------*/ -// class EudoraSuite This supports sending to Eudora -// Tools used to communicate with Eudora -// The only real use these have is if we are operating in -// Browser-only mode and the user wishes to use Eudora to -// handle mail functions. -// -/*-------------------------------------------------------------*/ - - -// -------------------------------------------------------------- -/* This makes a Null AppleEvent descriptor. - */ -// -------------------------------------------------------------- -void EudoraSuite::MakeNullDesc (AEDesc *theDesc) -{ - theDesc->descriptorType = typeNull; - theDesc->dataHandle = nil; -} - -// -------------------------------------------------------------- -/* This makes a string AppleEvent descriptor. - In: A pascal string - Pointer to an AEDesc. - - Out: AEDesc of type TEXT created and returned. */ -// -------------------------------------------------------------- -OSErr EudoraSuite::MakeStringDesc (Str255 theStr,AEDesc *theDesc) -{ - return AECreateDesc(kAETextSuite, &theStr[1], StrLength(theStr), theDesc); -} - -// -------------------------------------------------------------- -/* This stuffs the required parameters into the AppleEvent. - */ -// -------------------------------------------------------------- - - -OSErr EudoraSuite::CreateObjSpecifier (AEKeyword theClass,AEDesc theContainer, - AEKeyword theForm,AEDesc theData, Boolean /*disposeInputs*/,AEDesc *theSpec) -{ - AEDesc theRec; - OSErr err; - - err = AECreateList(nil,0,true,&theRec); - if (!err) - err = AEPutKeyPtr(&theRec,keyAEKeyForm,typeEnumeration,&theForm,sizeof(theForm)); - if (!err) - err = AEPutKeyPtr(&theRec,keyAEDesiredClass,cType,&theClass,sizeof(theClass)); - if (!err) - err = AEPutKeyDesc(&theRec,keyAEKeyData,&theData); - if (!err) - err = AEPutKeyDesc(&theRec,keyAEContainer,&theContainer); - if (!err) - err = AECoerceDesc(&theRec,cObjectSpecifier,theSpec); - AEDisposeDesc(&theRec); - return err; -} - -// -------------------------------------------------------------- -/* This creates an AEDesc for the current message. - (The current message index = 1) - - In: Pointer to AEDesc to return - Out: AEDesc constructed. */ -// -------------------------------------------------------------- - -OSErr EudoraSuite::MakeCurrentMsgSpec (AEDesc *theSpec) -{ - AEDesc theContainer,theIndex; - OSErr err; - long msgIndex = 1; - - EudoraSuite::MakeNullDesc (&theContainer); - err = AECreateDesc(cLongInteger, &msgIndex, sizeof(msgIndex), &theIndex); - if (!err) - err = EudoraSuite::CreateObjSpecifier(cEuMessage, theContainer, - formAbsolutePosition, theIndex, true, theSpec); - - AEDisposeDesc(&theContainer); - AEDisposeDesc(&theIndex); - - return err; -} - - -// -------------------------------------------------------------- -/* Send a given Apple Event. Special case for Eudora, should - be rewritten, but it works for the moment. - In: AppleEvent - Out: Event sent */ -// -------------------------------------------------------------- -OSErr EudoraSuite::SendEvent (AppleEvent *theEvent) -{ - AppleEvent theReply; - OSErr err; - - EudoraSuite::MakeNullDesc(&theReply); - err = AESend(theEvent,&theReply,kAENoReply + kAENeverInteract - + kAECanSwitchLayer+kAEDontRecord,kAENormalPriority,-1,nil,nil); - - AEDisposeDesc(&theReply); - AEDisposeDesc(theEvent); - - return err; -} - -// -------------------------------------------------------------- -/* Create an Apple Event to be sent to Eudora - In: Event Class - Event ID - Ptr to Apple Event - Out: Event constructed and returned. */ -// -------------------------------------------------------------- -OSErr EudoraSuite::MakeEvent (AEEventClass eventClass,AEEventID eventID,AppleEvent *theEvent) -{ - AEAddressDesc theTarget; - OSType theSignature; - OSErr err; - - theSignature = kEudoraSuite; - err = AECreateDesc(typeApplSignature,&theSignature,sizeof(theSignature),&theTarget); - if (!err) - err = AECreateAppleEvent(eventClass,eventID,&theTarget,0,0,theEvent); - AEDisposeDesc(&theTarget); - return err; -} - -// -------------------------------------------------------------- -/* This sets the data in a specified field. It operates on the frontmost message - in Eudora. It is the equivalent of sending the following AppleScript: - set field "fieldname" of message 0 to "data" - - Examples for setting up a complete mail message: - EudoraSuite::SendSetData("\pto",toRecipientPtr); - EudoraSuite::SendSetData("\pcc",ccRecipientPtr); - EudoraSuite::SendSetData("\pbcc",bccRecipientPtr); - EudoraSuite::SendSetData("\psubject",subjectPtr); - EudoraSuite::SendSetData("\p",bodyPtr); - - In: Field to set the data in (Subject, Address, Content, etc) - Pointer to text data. - Size of pointer (allows us to work with XP_Ptrs). - Out: Apple Event sent to Eudora, setting a given field. */ -// -------------------------------------------------------------- -OSErr EudoraSuite::SendSetData(Str31 theFieldName, Ptr thePtr, long thePtrSize) -{ - AEDesc theMsg,theName,theFieldSpec,theText; - AppleEvent theEvent; - OSErr err; - Handle theData; - - theData = NewHandle(thePtrSize); - BlockMove((Ptr)thePtr,*theData,thePtrSize); - - if (theData != nil) - { - - err = EudoraSuite::MakeCurrentMsgSpec(&theMsg); - if (!err) - err = EudoraSuite::MakeStringDesc(theFieldName,&theName); - if (!err) - err = EudoraSuite::CreateObjSpecifier(cEuField,theMsg,formName,theName,true,&theFieldSpec); - if (!err) - err = EudoraSuite::MakeEvent(kAECoreSuite,kAESetData,&theEvent); - if (!err) - err = AEPutParamDesc(&theEvent,keyAEResult,&theFieldSpec); - AEDisposeDesc(&theFieldSpec); - - theText.descriptorType = typeChar; - theText.dataHandle = theData; - if (!err) - err = AEPutParamDesc(&theEvent,keyAEData,&theText); - if (!err) - err = EudoraSuite::SendEvent(&theEvent); - - DisposeHandle(theText.dataHandle); - AEDisposeDesc(&theText); - AEDisposeDesc(&theMsg); - AEDisposeDesc(&theName); - } - DisposeHandle(theData); - return err; - -} -// -------------------------------------------------------------- -/* Everything you need to tell Eudora to construct a new message - and send it. - In: Pointer to the list of e mail addresses to send TO - Pointer to the list of e mail addresses to send CC - Pointer to the list of e mail addresses to send BCC - Pointer to the Subject text - Priority level of message. - Pointer to the contents of the mail - Pointer to an FSSpec (or null if none) for an enclosure. - Out: Apple Events sent to Eudora telling it to construct the - message and send it. */ -// -------------------------------------------------------------- - -OSErr EudoraSuite::SendMessage( - Ptr toRecipientPtr, - Ptr ccRecipientPtr, - Ptr bccRecipientPtr, - Ptr subjectPtr, - XP_HUGE_CHAR_PTR bodyPtr, - long thePriority, - FSSpec *theEnclosurePtr) -{ - AEDesc nullSpec,theName,theFolder,theMailbox,theInsertRec,theInsl,msgSpec,theEnclList; - OSType thePos,theClass; - AppleEvent theEvent; - OSErr err; - - -/* This section creates a new message and places it at the end of the out mailbox. - It is equivalent to the following AppleScript: - make message at end of mailbox "out" of mail folder "" -*/ - - - MakeNullDesc(&nullSpec); - err = MakeStringDesc("\p",&theName); - if (!err) - err = EudoraSuite::CreateObjSpecifier(cEuMailfolder,nullSpec,formName,theName,true,&theFolder); - - - if (!err) - err = MakeStringDesc("\pout",&theName); - if (!err) - err = EudoraSuite::CreateObjSpecifier(cEuMailbox,theFolder,formName,theName,true,&theMailbox); - if (!err) - err = AECreateList(nil,0,true,&theInsertRec); - if (!err) - err = AEPutKeyDesc(&theInsertRec,keyAEObject,&theMailbox); - - - thePos=kAEEnd; - if (!err) - err = AEPutKeyPtr(&theInsertRec,keyAEPosition,typeEnumeration,&thePos,sizeof(thePos)); - - if (!err) - err = AECoerceDesc(&theInsertRec,typeInsertionLoc,&theInsl); - - if (!err) - err = EudoraSuite::MakeEvent(kAECoreSuite,kAECreateElement,&theEvent); - if (!err) - err = AEPutParamDesc(&theEvent,keyAEInsertHere,&theInsl); - - AEDisposeDesc(&nullSpec); - AEDisposeDesc(&theName); - AEDisposeDesc(&theFolder); - AEDisposeDesc(&theMailbox); - AEDisposeDesc(&theInsertRec); - AEDisposeDesc(&theInsl); - - theClass=cEuMessage; - if (!err) - err = AEPutParamPtr(&theEvent,keyAEObjectClass,cType,&theClass,sizeof(theClass)); - if (!err) - err = EudoraSuite::SendEvent(&theEvent); - - -/* This section fills in various fields. - It is equivalent to the following AppleScript: - set field "to" of message 0 to "data" -*/ - - if (!err) { - if ( toRecipientPtr ) - err = SendSetData("\pto",toRecipientPtr, GetPtrSize(toRecipientPtr)); - } - - if (!err) { - if ( ccRecipientPtr ) - err = SendSetData("\pcc",ccRecipientPtr, GetPtrSize(ccRecipientPtr)); - } - if (!err) { - if ( bccRecipientPtr ) - err = SendSetData("\pbcc",bccRecipientPtr, GetPtrSize(bccRecipientPtr)); - } - - if (!err) - err = SendSetData("\psubject",subjectPtr, GetPtrSize(subjectPtr)); - if (!err) - err = SendSetData("\p",bodyPtr, XP_STRLEN(bodyPtr) ); - -/* This sets the priority of the message. See the constants defined above for the legal - values. -*/ - - err = Set_Eudora_Priority(thePriority); - - -/* This attaches a file to the Eudora message provided it is a proper FSSpec. */ - if (StrLength(theEnclosurePtr->name)>0) - { - if (!err) - err = MakeCurrentMsgSpec(&msgSpec); - if (!err) - err = EudoraSuite::MakeEvent(kEudoraSuite,kEuAttach,&theEvent); - if (!err) - err = AEPutParamDesc(&theEvent,keyAEResult,&msgSpec); - if (!err) - err = AECreateList(nil,0,false,&theEnclList); - if (!err) - err = AEPutPtr(&theEnclList,0,typeFSS,&theEnclosurePtr->name, - sizeof(theEnclosurePtr->name) ); - if (!err) - err = AEPutParamDesc(&theEvent,keyEuDocumentList,&theEnclList); - if (!err) - err = EudoraSuite::SendEvent(&theEvent); - AEDisposeDesc(&msgSpec); - AEDisposeDesc(&theEnclList); - } - - -/* This tells Eudora to queue the current message. */ - if (!err) - err = EudoraSuite::MakeCurrentMsgSpec(&msgSpec); - if (!err) - err = EudoraSuite::MakeEvent(kEudoraSuite,kEuQueue,&theEvent); - if (!err) - err = AEPutParamDesc(&theEvent,keyAEResult,&msgSpec); - AEDisposeDesc(&msgSpec); - if (!err) - err = EudoraSuite::SendEvent(&theEvent); - - return err; - -} - -// -------------------------------------------------------------- -/* Given the priority of a message, this sets the priority in the message. - This same type of procedure can be used for many of the AppleScript commands in - the form of: set of message 0 to - - */ -// -------------------------------------------------------------- - -OSErr EudoraSuite::Set_Eudora_Priority(long thePriority) -{ - AEDesc theMsg,theData,thePropSpec,thePriorityDesc; - AppleEvent theEvent; - OSErr theErr; - AEKeyword theProperty; - Handle h; - - theErr = MakeCurrentMsgSpec(&theMsg); - - theProperty = pEuPriority; - AECreateDesc(typeType,&theProperty,sizeof (theProperty),&thePriorityDesc); - - if (!theErr) - theErr = CreateObjSpecifier(typeProperty,theMsg,typeProperty,thePriorityDesc,true,&thePropSpec); - if (!theErr) - theErr = MakeEvent(kAECoreSuite,kAESetData,&theEvent); - - if (!theErr) - theErr = AEPutKeyDesc(&theEvent, keyDirectObject, &thePropSpec); - if (!theErr) - theErr = AEDisposeDesc(&thePropSpec); - - h = NewHandle (sizeof(thePriority)); - BlockMove ((Ptr)&thePriority,*h,sizeof(thePriority)); - theData.descriptorType = typeInteger; - theData.dataHandle = h; - if (!theErr) - theErr=AEPutParamDesc(&theEvent,keyAEData,&theData); - if (!theErr) - theErr = SendEvent(&theEvent); - DisposeHandle(h); - AEDisposeDesc(&theMsg); - AEDisposeDesc(&theData); - AEDisposeDesc(&thePriorityDesc); - - return theErr; - -} - - - -/*-------------------------------------------------------------*/ -// class MoreExtractFromAEDesc -// Apple event helpers -- extension of UExtractFromAEDesc.h -// All the miscelaneous AppleEvent helper routines. -/*-------------------------------------------------------------*/ - - -// -------------------------------------------------------------- -/* Given an AppleEvent, locate a string given a keyword and - return the string - In: Event to search - AEKeyword assocaated with the string - C string ptr - Out: Pointer to a newly created C string returned */ -// -------------------------------------------------------------- -void MoreExtractFromAEDesc::GetCString(const AppleEvent &inAppleEvent, - AEKeyword keyword, char * & s, Boolean inThrowIfError) -{ - StAEDescriptor desc; - OSErr err = ::AEGetParamDesc(&inAppleEvent,keyword,typeWildCard,&desc.mDesc); - - if (err) { - if (inThrowIfError) - ThrowIfOSErr_(err); - else - return; - } - TheCString(desc, s); -} - -// -------------------------------------------------------------- -/* Given an AEDesc of type typeChar, return its string. - In: AEDesc containing a string - C string ptr - Out: Pointer to a newly created C string returned */ -// -------------------------------------------------------------- -void MoreExtractFromAEDesc::TheCString(const AEDesc &inDesc, char * & outPtr) -{ - outPtr = nil; - Handle dataH; - AEDesc coerceDesc = {typeNull, nil}; - if (inDesc.descriptorType == typeChar) { - dataH = inDesc.dataHandle; // Descriptor is the type we want - - } else { // Try to coerce to the desired type - if (AECoerceDesc(&inDesc, typeChar, &coerceDesc) == noErr) { - // Coercion succeeded - dataH = coerceDesc.dataHandle; - - } else { // Coercion failed - ThrowOSErr_(errAETypeError); - } - } - - Int32 strLength = GetHandleSize(dataH); - outPtr = (char *)XP_ALLOC(strLength+1); // +1 for NULL ending - ThrowIfNil_( outPtr ); - // Terminate the string - BlockMoveData(*dataH, outPtr, strLength); - outPtr[strLength] = 0; - - if (coerceDesc.dataHandle != nil) { - AEDisposeDesc(&coerceDesc); - } -} - -// -------------------------------------------------------------- -/* Add an error string and error code to an AppleEvent. - Typically used when constructing the return event when an - error occured - In: Apple Event to append to - Error string - Error code - Out: keyErrorNum and keyErrorSting AEDescs are added to the Event. */ -// -------------------------------------------------------------- -void MoreExtractFromAEDesc::MakeErrorReturn(AppleEvent &event,const - CStr255& errorString, OSErr errorCode) -{ - StAEDescriptor errorNum(errorCode); - StAEDescriptor errorText((ConstStringPtr)errorString); - // We can ignore the errors. If error occurs, it only means that the reply is not handled - OSErr err = ::AEPutParamDesc(&event, keyErrorNumber, &errorNum.mDesc); - err = ::AEPutParamDesc(&event, keyErrorString, &errorText.mDesc); -} - -// -------------------------------------------------------------- -/* Display an error dialog if the given AppleEvent contains - a keyErrorNumber. a keyErrorString is optional and will be - displayed if present - In: Apple Event - Out: Error dialog displayed if error data present. */ -// -------------------------------------------------------------- -Boolean MoreExtractFromAEDesc::DisplayErrorReply(AppleEvent &reply) -{ - DescType realType; - Size actualSize; - OSErr errNumber; - Str255 errorString; - // First check for errors - errNumber = AEUtilities::EventHasErrorReply(reply); - if (errNumber == noErr) - return false; - - // server returned an error, so get error string - OSErr err = ::AEGetParamPtr(&reply, keyErrorString, typeChar, - &realType, &errorString[1], sizeof(errorString)-1, - &actualSize); - if (err == noErr) - { - errorString[0] = actualSize > 255 ? 255 : actualSize; - ErrorManager::ErrorNotify(errNumber, errorString); - } - else - ErrorManager::ErrorNotify(errNumber, (unsigned char *)*GetString(AE_ERR_RESID)); - return TRUE; -} - -// -------------------------------------------------------------- -/* Return the process serial number of the sending process. - In: Apple Event send by some app. - Out: ProcessSerialNumber of the sending app. */ -// -------------------------------------------------------------- -ProcessSerialNumber MoreExtractFromAEDesc::ExtractAESender(const AppleEvent &inAppleEvent) -{ - Size realSize; - DescType realType; - TargetID target; - ProcessSerialNumber psn; - - OSErr err = AEGetAttributePtr(&inAppleEvent, keyAddressAttr, typeTargetID, &realType, - &target, sizeof(target), &realSize); - ThrowIfOSErr_(err); - err = ::GetProcessSerialNumberFromPortName(&target.name,&psn); - ThrowIfOSErr_(err); - return psn; -} - -//----------------------------------- -void MoreExtractFromAEDesc::DispatchURLDirectly(const AppleEvent &inAppleEvent) -//----------------------------------- -{ - char *url = NULL; - MoreExtractFromAEDesc::GetCString(inAppleEvent, keyDirectObject, url); - ThrowIfNil_(url); - URL_Struct * request = NET_CreateURLStruct (url, NET_DONT_RELOAD); - XP_FREE (url); - ThrowIfNil_(request); - request->internal_url = TRUE; // for attachments in mailto: urls. - CURLDispatcher::DispatchURL(request, NULL); -} - - -/*-------------------------------------------------------------*/ -// class AEUtilities -// Some more simple Apple Event utility routines. -/*-------------------------------------------------------------*/ - -// -------------------------------------------------------------- -/* CreateAppleEvent - Create a new Apple Event from scratch. - In: Apple Event suite - Apple Event ID - Ptr to return Apple Event - ProcessSerialNumber of the target app to send event to. - Out:A new Apple Event is created. More data may be added to - the event simply by calling AEPutParamDesc or AEPutParamPtr */ -// -------------------------------------------------------------- - -OSErr AEUtilities::CreateAppleEvent(OSType suite, OSType id, - AppleEvent &event, ProcessSerialNumber targetPSN) -{ - AEAddressDesc progressApp; - OSErr err = ::AECreateDesc(typeProcessSerialNumber, &targetPSN, - sizeof(targetPSN), &progressApp); - if (err) - return err; - err = ::AECreateAppleEvent(suite, id, - &progressApp, - kAutoGenerateReturnID, - kAnyTransactionID, - &event); - AEDisposeDesc(&progressApp); - return err; -} - -// -------------------------------------------------------------- -/* Check to see if there is an error in the given AEvent. - We simply return an OSError equiv to the error value - in the event. If none exists (or an error took place - during access) we return 0. - In: Apple Event to test - Out:Error value returned */ -// -------------------------------------------------------------- -OSErr AEUtilities::EventHasErrorReply(AppleEvent & reply) -{ - if (reply.descriptorType == typeNull) - return noErr; - - long errNumber; - Size realSize; - DescType realType; - OSErr err = ::AEGetParamPtr(&reply, keyErrorNumber, typeLongInteger, - &realType, &errNumber, sizeof(errNumber), - &realSize); - if (err == noErr) - return errNumber; - else - return noErr; -} diff --git a/mozilla/cmd/macfe/central/CAppleEventHandler.h b/mozilla/cmd/macfe/central/CAppleEventHandler.h deleted file mode 100644 index f25fc3cdfd4..00000000000 --- a/mozilla/cmd/macfe/central/CAppleEventHandler.h +++ /dev/null @@ -1,371 +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. - */ - -// CAppleEventHandler.h - -#include "PascalString.h" -#include "xp_mem.h" - -enum KioskEnum {KioskOff = 0, KioskOn = 1}; - - -class CAppleEventHandler -{ -public: - static CAppleEventHandler* sAppleEventHandler; // One and only instance of AEvents - - // --- Standard Constructors and Destructors - - CAppleEventHandler(); - virtual ~CAppleEventHandler(); - // virtual void Initialize(); - - - // --- Top Level Apple Event Handling - - virtual void HandleAppleEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - virtual void GetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc) const; - virtual void SetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc); - - // --- AEOM support - void GetSubModelByUniqueID(DescType inModelID, - const AEDesc &inKeyData, - AEDesc &outToken) const; - - static KioskEnum GetKioskMode(){return sAppleEventHandler->fKioskMode;} - - -protected: - -private: - - KioskEnum fKioskMode; - - void HandleOpenURLEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -// spy Apple Event suite -// file/URL opening + misc - void HandleGetURLEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - - void HandleGetWDEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - - void HandleShowFile(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleParseAnchor(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -// Progress - - void HandleCancelProgress(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -// Spy window events - void HandleSpyActivate(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleSpyListWindows(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleSpyGetWindowInfo(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleWindowRegistration(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -// Netscape suite - void HandleOpenBookmarksEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleReadHelpFileEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleGoEvent( const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleOpenAddressBookEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - - void HandleOpenComponentEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - - void HandleCommandEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - - void HandleGetActiveProfileEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - - void HandleGetProfileImportDataEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -}; - - -/*-------------------------------------------------------------*/ -// class EudoraSuite -// Tools used to communicate with Eudora -// The only real use these have is if we are operating in -// Browser-only mode and the user wishes to use Eudora to -// handle mail functions. -// -/*-------------------------------------------------------------*/ - -// -------------------------------------------------------------- -/* Some Constants used by the Eudora Suite */ -// -------------------------------------------------------------- - -#define attachDouble 0 -#define attachSingle 1 -#define attachBinHex 2 -#define attachUUencode 3 - -#define EU_Norm_Priority 0 -#define EU_High_Priority 60 -#define EU_Highest_Priority 1 -#define EU_Low_Priority 160 -#define EU_Lowest_Priority 200 - -class EudoraSuite -{ -public: - - // -------------------------------------------------------------- - /* This makes a Null AppleEvent descriptor. - */ - // -------------------------------------------------------------- - static void MakeNullDesc (AEDesc *theDesc); - - // -------------------------------------------------------------- - /* This makes a string AppleEvent descriptor. - */ - // -------------------------------------------------------------- - static OSErr MakeStringDesc (Str255 theStr,AEDesc *theDesc); - - - // -------------------------------------------------------------- - /* This stuffs the required parameters into the AppleEvent. - */ - // -------------------------------------------------------------- - - - static OSErr CreateObjSpecifier (AEKeyword theClass,AEDesc theContainer, - AEKeyword theForm,AEDesc theData, Boolean disposeInputs,AEDesc *theSpec); - - // -------------------------------------------------------------- - /* This creates an AEDesc for the current message. - (The current message index = 1) - - In: Pointer to AEDesc to return - Out: AEDesc constructed. */ - // -------------------------------------------------------------- - - static OSErr MakeCurrentMsgSpec (AEDesc *theSpec); - - - // -------------------------------------------------------------- - /* Send a given Apple Event. Special case for Eudora, should - be rewritten, but it works for the moment. - In: AppleEvent - Out: Event sent */ - // -------------------------------------------------------------- - static OSErr SendEvent (AppleEvent *theEvent); - - // -------------------------------------------------------------- - /* Create an Apple Event to be sent to Eudora - In: Event Class - Event ID - Ptr to Apple Event - Out: Event constructed and returned. */ - // -------------------------------------------------------------- - static OSErr MakeEvent (AEEventClass eventClass,AEEventID eventID,AppleEvent *theEvent); - - // -------------------------------------------------------------- - /* This sets the data in a specified field. It operates on the frontmost message - in Eudora. It is the equivalent of sending the following AppleScript: - set field "fieldname" of message 0 to "data" - - Examples for setting up a complete mail message: - EudoraSuite::SendSetData("\pto",toRecipientPtr); - EudoraSuite::SendSetData("\pcc",ccRecipientPtr); - EudoraSuite::SendSetData("\pbcc",bccRecipientPtr); - EudoraSuite::SendSetData("\psubject",subjectPtr); - EudoraSuite::SendSetData("\p",bodyPtr); - - In: Field to set the data in (Subject, Address, Content, etc) - Pointer to text data. - Size of pointer (allows us to work with XP_Ptrs. - Out: Apple Event sent to Eudora, setting a given field. */ - // -------------------------------------------------------------- - static OSErr SendSetData(Str31 theFieldName, Ptr thePtr, long thePtrSize); - - // -------------------------------------------------------------- - /* Everything you need to tell Eudora to construct a new message - and send it. - In: Pointer to the list of e mail addresses to send TO - Pointer to the list of e mail addresses to send CC - Pointer to the list of e mail addresses to send BCC - Pointer to the Subject text - Priority level of message. - XP_HUGE_CHAR_PTR to the contents of the mail - Pointer to an FSSpec (or null if none) for an enclosure. - Out: Apple Events sent to Eudora telling it to construct the - message and send it. */ - // -------------------------------------------------------------- - - static OSErr SendMessage( - Ptr toRecipientPtr, - Ptr ccRecipientPtr, - Ptr bccRecipientPtr, - Ptr subjectPtr, - XP_HUGE_CHAR_PTR bodyPtr, - long thePriority, - FSSpec *theEnclosurePtr); - - static OSErr Set_Eudora_Priority(long thePriority); - -}; - - -/*-------------------------------------------------------------*/ -// class MoreExtractFromAEDesc -// Apple event helpers -- extension of UExtractFromAEDesc.h -// All the miscellaneous AppleEvent helper routines. -/*-------------------------------------------------------------*/ - -class MoreExtractFromAEDesc -{ -public: - - // -------------------------------------------------------------- - /* Given an AppleEvent, locate a string given a keyword and - return the string - In: Event to search - AEKeyword assocaated with the string - C string ptr - Out: Pointer to a newly created C string returned */ - // -------------------------------------------------------------- - static void GetCString(const AppleEvent &inAppleEvent, AEKeyword keyword, - char * & s, Boolean inThrowIfError = true); - - // -------------------------------------------------------------- - /* Given an AEDesc of type typeChar, return it's string. - In: AEDesc containing a string - C string ptr - Out: Pointer to a newly created C string returned */ - // -------------------------------------------------------------- - static void TheCString(const AEDesc &inDesc, char * & outPtr); - - // -------------------------------------------------------------- - /* Add an error string and error code to an AppleEvent. - Typically used when constructing the return event when an - error occured - In: Apple Event to append to - Error string - Error code - Out: keyErrorNum and keyErrorSting AEDescs are added to the Event. */ - // -------------------------------------------------------------- - static void MakeErrorReturn(AppleEvent &event, const CStr255& errorString, - OSErr errorCode); - - // -------------------------------------------------------------- - /* Display an error dialog if the given AppleEvent contains - a keyErrorNumber. a keyErrorString is optional and will be - displayed if present - In: Apple Event - Out: Error dialog displayed if error data present. */ - // -------------------------------------------------------------- - static Boolean DisplayErrorReply(AppleEvent &reply); - - // -------------------------------------------------------------- - /* Return the process serial number of the sending process. - In: Apple Event send by some app. - Out: ProcessSerialNumber of the sending app. */ - // -------------------------------------------------------------- - static ProcessSerialNumber ExtractAESender(const AppleEvent &inAppleEvent); - - static void DispatchURLDirectly(const AppleEvent &inAppleEvent); -}; // class MoreExtractFromAEDesc - - -/*-------------------------------------------------------------*/ -// class AEUtilities -// Some more simple Apple Event utility routines. -/*-------------------------------------------------------------*/ - -class AEUtilities -{ -public: - - // -------------------------------------------------------------- - /* CreateAppleEvent - Create a new Apple Event from scratch. - In: Apple Event suite - Apple Event ID - Ptr to return Apple Event - ProcessSerialNumber of the target app to send event to. - Out:A new Apple Event is created. More data may be added to - the event simply by calling AEPutParamDesc or AEPutParamPtr */ - // -------------------------------------------------------------- - static OSErr CreateAppleEvent(OSType suite, OSType id, - AppleEvent &event, ProcessSerialNumber targetPSN); - - // -------------------------------------------------------------- - /* Check to see if there is an error in the given AEvent. - We simply return an OSError equiv to the error value - in the event. If none exists (or an error took place - during access) we return 0. - In: Apple Event to test - Out:Error value returned */ - // -------------------------------------------------------------- - static OSErr EventHasErrorReply(AppleEvent & reply); - -}; diff --git a/mozilla/cmd/macfe/central/CBookmarksAttachment.cp b/mozilla/cmd/macfe/central/CBookmarksAttachment.cp deleted file mode 100644 index 82ae760c395..00000000000 --- a/mozilla/cmd/macfe/central/CBookmarksAttachment.cp +++ /dev/null @@ -1,401 +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. - */ - -// Handle creating and maintaining the top-level bookmarks menu. It pulls the info -// out of the RDF container the user designates as their "quickfile menu" and listens -// to the messages from RDF to update it. - -#include "CBookmarksAttachment.h" - -#include "htrdf.h" -#include "CNetscapeWindow.h" -#include "URDFUtilities.h" -#include "net.h" -#include "resgui.h" -#include "uapp.h" -#include "macutil.h" - -#include "UMenuUtils.h" - -#include -#include - - -LMenu *CBookmarksAttachment::sMenu = NULL; -Boolean CBookmarksAttachment::sInvalidMenu = true; -LArray CBookmarksAttachment::sMenusList; // this will use the default constructor - -HT_View CBookmarksAttachment::sQuickfileView = NULL; - -const uint32 PERM_BOOKMARK_ITEMS = 2; -const CommandT cmd_BookmarkHierItem = BOOKMARKS_MENU_BASE_LAST; - - -//=========================================================== -// CBookmarksAttachment -//=========================================================== -CBookmarksAttachment::CBookmarksAttachment() -{ - InitQuickfileView(); -} - - -// -// InitQuickfileView -// -// Called at startup to get a new view from the HT backend that represents the -// bookmarks menu. This can be called multiple times without problems. -// -void -CBookmarksAttachment :: InitQuickfileView ( ) -{ - if ( ! sQuickfileView ) { - HT_Notification notifyStruct = CreateNotificationStruct(); - HT_Pane quickfilePane = HT_NewQuickFilePane(notifyStruct); - - sQuickfileView = HT_GetSelectedView(quickfilePane); - } - -} // InitQuickfileView - - -void -CBookmarksAttachment :: HandleNotification( HT_Notification /* notifyStruct*/, - HT_Resource node, HT_Event event, void *token, uint32 tokenType) -{ - switch (event) { - - case HT_EVENT_NODE_ADDED: - case HT_EVENT_VIEW_REFRESH: - // only update menu if the quickfile view changes - //¥¥¥We need a way to not update on node_added events else we add items to the - //¥¥¥bookmarks menu on the order of N^2 where N is # of bookmarks. - if ( HT_GetView(node) == sQuickfileView ) { - sInvalidMenu = true; - UpdateMenu(); - } - break; - - case HT_EVENT_NODE_VPROP_CHANGED: - // optimization: only update when the name column changes - break; - - case HT_EVENT_NODE_DELETED_DATA: - case HT_EVENT_NODE_DELETED_NODATA: - // free FE data, but don't update the menu yet (HT not in good state) - break; - - } // case of which event - -} // HandleNotification - - -// Processes: -// -void CBookmarksAttachment::ExecuteSelf( MessageT inMessage, void* ioParam ) -{ - mExecuteHost = FALSE; - - switch ( inMessage ) - { - CNetscapeWindow *bookmarkableWindow = nil; - - case msg_CommandStatus: - { - SCommandStatus* status = (SCommandStatus*)ioParam; - - switch ( status->command ) - { - - default: - if (CFrontApp::GetApplication()->HasBookmarksMenu()) - { - if ( status->command >= BOOKMARKS_MENU_BASE && status->command <= BOOKMARKS_MENU_BASE_LAST ) - { - *(status->enabled) = TRUE; - *(status->usesMark) = FALSE; - return; - } - } - break; - } - } - break; - - default: - { - if (CFrontApp::GetApplication()->HasBookmarksMenu()) - { - if ( inMessage >= BOOKMARKS_MENU_BASE && inMessage <= BOOKMARKS_MENU_BASE_LAST ) - { - Uint32 index = inMessage - BOOKMARKS_MENU_BASE; - - // load the url - HT_Resource itemNode = HT_GetNthItem(sQuickfileView, index); - char* url = HT_GetNodeURL( itemNode ); - if ( !URDFUtilities::LaunchNode(itemNode) && url ) - CFrontApp::DoGetURL ( url ); - - return; - } - } - } - break; - } - mExecuteHost = TRUE; // Let application handle it -} - - -void CBookmarksAttachment::AddToBookmarks( const char* url, const CStr255& title ) -{ - HT_Resource topNode = HT_TopNode ( sQuickfileView ); - HT_AddBookmark ( const_cast(url), title ); -} - - -LMenu *CBookmarksAttachment::GetMenu() -{ - if (!sMenu) - { - sMenu = new LMenu(cBookmarksMenuID); - - if (sMenu) - { - MenuHandle macMenu = sMenu->GetMacMenuH(); - - if (macMenu) - UMenuUtils::ConvertToIconMenu(macMenu, 15312); - } - } - return sMenu; -} - -void CBookmarksAttachment::UpdateMenu() -{ - if (CFrontApp::GetApplication()->HasBookmarksMenu()) - { - if (!sInvalidMenu || !GetMenu() || !LMenuBar::GetCurrentMenuBar() ) - return; - - int i; - - // ¥ delete all the dynamically created menus - // ¥Êdelete all the hierarchical menus we have added from the menubar - for ( i = 1; i <= sMenusList.GetCount(); i++ ) - { - LMenu* m; - sMenusList.FetchItemAt( i, &m ); - if ( m ) - LMenuBar::GetCurrentMenuBar()->RemoveMenu( m ); - delete m; - } - - // ¥ delete all the menu items after the line in Bookmark menu - MenuHandle menu = sMenu->GetMacMenuH(); - if ( menu ) - { - int howMany = ::CountMItems( menu ); - for ( i = howMany; i > PERM_BOOKMARK_ITEMS; i-- ) - sMenu->RemoveItem( i ); - } - sMenusList.RemoveItemsAt( sMenusList.GetCount(), 1 ); - - // ¥ walk through the list, and let the submenus be inserted recursively - int nextMenuID = cBookmarksFirstHierMenuID; - FillMenuFromList( HT_TopNode(sQuickfileView), sMenu, nextMenuID, PERM_BOOKMARK_ITEMS, 0 ); - - sInvalidMenu = false; - } -} - -// ¥Êrecursively create submenus, given a list ptr -// returns NULL if the menu cannot be created -// it creates submenus recursively -void CBookmarksAttachment::FillMenuFromList( - HT_Resource top, - LMenu* newMenu, - int& nextMenuID, // next menu to create - int whichItem, // id of the first item to insert - int depth ) // how deep are we? -{ - // keep us from infinite recursion if the data file contains an infinite loop - if ( depth > 4 ) - return; - - if (CFrontApp::GetApplication()->HasBookmarksMenu()) - { - Try_ - { - ThrowIfNil_( newMenu ); - MenuHandle mHand = newMenu->GetMacMenuH(); - - ThrowIfNil_( mHand ); - - // ¥Êremove all the extra items if they exist - long removeThese = ::CountMItems( mHand ) - whichItem; - for ( long i = 1; i < removeThese; i++ ) - newMenu->RemoveItem( whichItem ); - - MenuHandle theMacMenu = newMenu->GetMacMenuH(); - - // Open up the container and get an iterator on its contents (we have to open it before - // we can see anything inside it). If the cursor is null, it is probably because the container - // is locked so just put up a leaf item (disabled, of course) and bail. - HT_SetOpenState ( top, PR_TRUE ); - HT_Cursor cursor = HT_NewCursor( top ); - if ( !cursor ) { - whichItem = UMenuUtils::InsertMenuItem(theMacMenu, "\pLocked", whichItem); - newMenu->SetCommand(whichItem, 0); - return; - } - - HT_Resource currNode = HT_GetNextItem(cursor); - while ( currNode ) - { - if ( HT_IsSeparator(currNode) ) - newMenu->InsertCommand( "\p-", cmd_Nothing, whichItem++ ); - else if ( ! HT_IsContainer(currNode) ) - { - // ¥ should really convert this to menu chars - CStr255 urlName( HT_GetNodeName(currNode) ); - CreateMenuString( urlName ); - - whichItem = UMenuUtils::InsertMenuItem(theMacMenu, urlName, whichItem); // returns actual insert loc - newMenu->SetCommand(whichItem, BOOKMARKS_MENU_BASE + HT_GetNodeIndex(sQuickfileView, currNode) ); - - } - else - { - CStr255 headerName( HT_GetNodeName(currNode) ); - CreateMenuString( headerName ); - - whichItem = UMenuUtils::InsertMenuItem(theMacMenu, headerName, whichItem); // returns actual insert loc - newMenu->SetCommand(whichItem, cmd_BookmarkHierItem); - - // ¥Êdo we have space to create more? - if ( nextMenuID <= cBookmarksLastHierMenuID) - { - LMenu* subMenu = (LMenuBar::GetCurrentMenuBar())->FetchMenu( nextMenuID ); - if ( !subMenu ) - { - StringHandle menuStringH = GetString( NEW_RESID ); - Assert_(menuStringH); - if (menuStringH) - { - StHandleLocker locker((Handle)menuStringH); - subMenu = new LMenu( nextMenuID, - (unsigned char *)*menuStringH ); - LMenuBar::GetCurrentMenuBar()->InstallMenu( subMenu, hierMenu ); - } - } - else - SysBeep( 1 ); - - nextMenuID++; - - // Skip the "Apple" menu or we're in deep donuts. - if (nextMenuID == MENU_Apple) - nextMenuID++; - - if ( subMenu ) - { - sMenusList.InsertItemsAt( 1, LArray::index_Last, &subMenu ); - // ¥Êmake item hierarchical - ::SetItemCmd( mHand, whichItem, hMenuCmd ); - ::SetItemMark( mHand, whichItem, subMenu->GetMenuID() ); - if ( currNode ) - FillMenuFromList( currNode, subMenu, nextMenuID, 0, depth+1 ); - } - } - } - - currNode = HT_GetNextItem ( cursor ); - - } // while - } - Catch_( inErr ) - { - } - EndCatch_ - } -} - -void CBookmarksAttachment::RemoveMenus() -{ - if (CFrontApp::GetApplication()->HasBookmarksMenu()) - { - if (sMenu) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - - if (currentMenuBar) - { - currentMenuBar->RemoveMenu(sMenu); - - for (ArrayIndexT index = 1; index <= sMenusList.GetCount(); ++index) - { - LMenu *menu; - sMenusList.FetchItemAt(index, &menu); - - if (menu) - currentMenuBar->RemoveMenu(menu); - } - } - } - } -} - -void CBookmarksAttachment::InstallMenus() -{ - if (CFrontApp::GetApplication()->HasBookmarksMenu()) - { - if (GetMenu()) - { - LMenuBar *currentMenuBar = LMenuBar::GetCurrentMenuBar(); - - if (currentMenuBar) - { - for (ArrayIndexT index = sMenusList.GetCount(); index > 0; --index) - { - LMenu *menu; - sMenusList.FetchItemAt(index, &menu); - - if (menu) - { - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - currentMenuBar->InstallMenu(menu, hierMenu); - } - } - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - currentMenuBar->InstallMenu(sMenu, InstallMenu_AtEnd); -#if 0 -// no more Guide menu. Leave this here in case mktg wants to replace it with something (pinkerton). - LMenu *directoryMenu = currentMenuBar->FetchMenu(cDirectoryMenuID); - - if (directoryMenu) - { - CFrontApp::BuildConfigurableMenu( directoryMenu->GetMacMenuH(), "menu.places.item" ); - - for (short index2 = CountMItems(directoryMenu->GetMacMenuH()); index2 > 0; --index2) - directoryMenu->SetCommand(index2, DIR_MENU_BASE + index2 - 1); - } -#endif - } - } - } -} diff --git a/mozilla/cmd/macfe/central/CBookmarksAttachment.h b/mozilla/cmd/macfe/central/CBookmarksAttachment.h deleted file mode 100644 index 375ddfac8ce..00000000000 --- a/mozilla/cmd/macfe/central/CBookmarksAttachment.h +++ /dev/null @@ -1,72 +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. - */ - -// Handle creating and maintaining the top-level bookmarks menu. It pulls the info -// out of the RDF container the user designates as their "quickfile menu" and listens -// to the messages from RDF to update it. - -#pragma once - -#ifndef CBOOKMARKSATTACHMENT_H_ -#define CBOOKMARKSATTACHMENT_H_ - -#include "CRDFNotificationHandler.h" - -#include "PascalString.h" -#include -#include -#include - - -/*********************************************************************************** - * CBookmarksAttachment - * Processes bookmark menu commands -- should be attached to application - ***********************************************************************************/ -class CBookmarksAttachment: public LAttachment, public CRDFNotificationHandler -{ -public: - // ¥¥ constructors - CBookmarksAttachment(); - // ¥¥Êevents - virtual void ExecuteSelf( MessageT inMessage, void* ioParam ); - - static void AddToBookmarks( const char* url, const CStr255& title ); - - static LMenu* GetMenu(); - static void InvalidateMenu() { sInvalidMenu = true; } - static void UpdateMenu(); - - static void RemoveMenus(); - static void InstallMenus(); - - void InitQuickfileView ( ) ; - -protected: - - static void FillMenuFromList( HT_Resource top, LMenu* newMenu, int& nextMenuID, int whichItem, int depth ); - - virtual void HandleNotification( HT_Notification notifyStruct, HT_Resource node, HT_Event event, void *token, uint32 tokenType); - - static LMenu* sMenu; - static Boolean sInvalidMenu; - static LArray sMenusList; - static HT_View sQuickfileView; // called quickfile because of HT API - -}; - -#endif diff --git a/mozilla/cmd/macfe/central/CBrowserContext.cp b/mozilla/cmd/macfe/central/CBrowserContext.cp deleted file mode 100644 index 1fd856f327a..00000000000 --- a/mozilla/cmd/macfe/central/CBrowserContext.cp +++ /dev/null @@ -1,2045 +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. - */ - -// CBrowserContext.cp - -#include "CBrowserContext.h" -#include "CNSContextCallbacks.h" -#include "CHTMLView.h" -#include "UStdDialogs.h" -#include "UFormElementFactory.h" -#include "CAutoPtrXP.h" -#include "RandomFrontEndCrap.h" // for IsSpecialBrowserWindow -#include "CURLDispatcher.h" - -#include "CFontReference.h" - -#include - -#include "earlmgr.h" -#include "uprefd.h" -#include "uapp.h" -#include "xp.h" -#include "xp_thrmo.h" -#include "shist.h" -#include "glhist.h" -#include "libimg.h" -#include "np.h" -#include "libmime.h" -#include "libi18n.h" -#include "mimages.h" -#include "ufilemgr.h" -#include "java.h" -#include "layers.h" -#include "intl_csi.h" -#include "uintl.h" - -extern "C" { - #include "httpurl.h" // for NET_getInternetKeyword -} - -// FIX ME -- write a CopyAlloc like function that takes a CString -#include "macutil.h" -#include "CAutoPtrXP.h" - -const ResIDT cJSDialogTitleStrID = 16010; -const Int16 cDialogTitleSeperatorStrIndex = 1; -const Int16 cDialogTitleStrIndex = 2; - -// utility function to build window title for JavaScript dialogs -static void AppendJSStringToHost(LStr255& ioTitle, const char* inURL) -{ - LStr255 titleSeperatorStr(cJSDialogTitleStrID, cDialogTitleSeperatorStrIndex); - LStr255 jsAppStr(cJSDialogTitleStrID, cDialogTitleStrIndex); - - if (inURL) - { - CAutoPtrXP hostname(NET_ParseURL(inURL, GET_HOST_PART)); - char *host = hostname.get(); - if (host && *host) - { - ioTitle = host; - ioTitle += titleSeperatorStr; - ioTitle += jsAppStr; - } - else - { - ioTitle = jsAppStr; - } - } - else - { - ioTitle = jsAppStr; - } - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CONSTRUCTION / DESTRUCTION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserContext::CBrowserContext() -: CNSContext(MWContextBrowser) -, mCompositor(nil) -, mImageGroupContext(nil) -, mImagesLoading(false) -, mImagesLooping(false) -, mImagesDelayed(false) -, mMochaImagesLoading(false) -, mMochaImagesLooping(false) -, mMochaImagesDelayed(false) -, mInNoMoreUsers(false) -, mCloseCallback(nil) -, mCloseCallbackArg(nil) -{ - mLoadImagesOverride = false; - mDelayImages = CPrefs::GetBoolean( CPrefs::DelayImages ); - mIsRepaginating = false; - mIsRepaginationPending = false; - -// FIX ME!!! need to add unique identifier -// fWindowID = sWindowID++; - -// XP_AddContextToList(&mContext); - SHIST_InitSession(&mContext); - - // - // Allocate a new image library context - // - CreateImageContext( &mContext ); - mImageGroupContext = mContext.img_cx; - IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserContext::CBrowserContext(MWContextType inType) -: CNSContext(inType) -, mCompositor(nil) -, mImageGroupContext(nil) -, mImagesLoading(false) -, mImagesLooping(false) -, mImagesDelayed(false) -, mMochaImagesLoading(false) -, mMochaImagesLooping(false) -, mMochaImagesDelayed(false) -, mInNoMoreUsers(false) -, mCloseCallback(nil) -, mCloseCallbackArg(nil) -{ - mLoadImagesOverride = false; - mDelayImages = CPrefs::GetBoolean( CPrefs::DelayImages ); - mIsRepaginating = false; - mIsRepaginationPending = false; - -// FIX ME!!! need to add unique identifier -// fWindowID = sWindowID++; - -// XP_AddContextToList(&mContext); - SHIST_InitSession(&mContext); - - // - // Allocate a new image library context - // - CreateImageContext( &mContext ); - mImageGroupContext = mContext.img_cx; - IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// this is a shallow copy. child contexts are not duplicated. -CBrowserContext::CBrowserContext(const CBrowserContext& inOriginal) -: CNSContext(inOriginal) -, mCompositor(nil) -, mImageGroupContext(nil) -, mImagesLoading(false) -, mImagesLooping(false) -, mImagesDelayed(false) -, mMochaImagesLoading(false) -, mMochaImagesLooping(false) -, mMochaImagesDelayed(false) -, mInNoMoreUsers(false) -, mCloseCallback(nil) -, mCloseCallbackArg(nil) -{ - mLoadImagesOverride = inOriginal.IsLoadImagesOverride(); - mDelayImages = inOriginal.IsImageLoadingDelayed(); - mIsRepaginating = inOriginal.IsRepaginating(); - mIsRepaginationPending = inOriginal.IsRepagintaitonPending(); - SetCompositor(inOriginal.mCompositor); - -// FIX ME!!! need to make sure all things inited in the default ctor are done here - - // - // Allocate a new image library context - // - CreateImageContext( &mContext ); - mImageGroupContext = mContext.img_cx; - IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserContext::~CBrowserContext() -{ - // NOTE: IL_RemoveGroupObserver and DestroyImageContext are done on our behalf - // in other places - - SetCompositor(NULL); - - // 97-06-06 mjc - remove the context from the global list in CNSContext::NoMoreUsers before calling mocha. - //XP_RemoveContextFromList(&mContext); - if (mContext.name != NULL) - { - XP_FREE(mContext.name); - mContext.name = NULL; - } - - // 98-05-27 pinkerton - call close callback - if ( mCloseCallback ) - (*mCloseCallback)(mCloseCallbackArg); -} - - -// -// SetCloseCallback -// -// Set a callback (from the chrome structure) to be called when this window/context goes -// away. -// -void -CBrowserContext :: SetCloseCallback ( void (* close_callback)(void *close_arg), void* close_arg ) -{ - mCloseCallback = close_callback; - mCloseCallbackArg = close_arg; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::NoMoreUsers(void) -{ - mInNoMoreUsers = true; - - // this object is about to be destroyed... - mIsRepaginationPending = false; // ...so, clear requests for further work. - - CNSContext::NoMoreUsers(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetCurrentView(CHTMLView* inView) -{ - if (inView != NULL) - { - } - else - { - // Cleanup??? - } - -// these are the old vars. we want to make sure they are always null - mContext.fe.view = NULL; - mContext.fe.newView = inView; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserContext* CBrowserContext::GetTopContext() -{ - CBrowserContext* theReturnContext = this; - if (theReturnContext->mContext.grid_parent != NULL) - { - CBrowserContext* theTempContext = ExtractBrowserContext(theReturnContext->mContext.grid_parent); - theReturnContext = theTempContext->GetTopContext(); - } - - return theReturnContext; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::HasColorSpace(void) const -{ - return (mContext.color_space != NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::HasGridParent(void) const -{ - return (mContext.grid_parent != NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::HasFullPagePlugin(void) const -{ - NPEmbeddedApp* theApp = mContext.pluginList; - return ((theApp != NULL) && (theApp->next == NULL) && (theApp->pagePluginType == NP_FullPage)); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetLoadImagesOverride(Boolean inOverride) -{ - mLoadImagesOverride = inOverride; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsLoadImagesOverride(void) const -{ - return mLoadImagesOverride; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetDelayImages(Boolean inDelay) -{ - mDelayImages = inDelay; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsImageLoadingDelayed(void) const -{ - return mDelayImages; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsRestrictedTarget(void) const -{ - return (mContext.restricted_target) ? true : false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetRestrictedTarget(Boolean inIsRestricted) -{ - mContext.restricted_target = inIsRestricted; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsRootDocInfoContext() -{ - // 1997-05-02 pkc -- I observe that the first context that gets called - // for doc info window has a name of cDocInfoWindowContextName and has - // NULL grid_parent && NULL grid_children fields. - // Obviously, if this ever changes, this function needs to change. - if (mContext.name != NULL) - return (IsDocInfoWindow(mContext.name) && !HasGridParent()/* && !HasGridChildren()*/); - else - return false; -} - -// 1997-05-16 pkc -- added this method to work around page source resize bug -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsViewSourceContext() -{ - if (mContext.name != NULL) - return (IsViewSourceWindow(mContext.name)); - else - return false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsSpecialBrowserContext() -{ - if (mContext.name != NULL) - return IsSpecialBrowserWindow(mContext.name); - else - return false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::SupportsPageServices() -{ - return SHIST_CurrentHandlesPageServices(*this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- LAYERS / COMPOSITOR --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::HasCompositor(void) const -{ - return (mContext.compositor != NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CL_Compositor* CBrowserContext::GetCompositor(void) const -{ - return mContext.compositor; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetCompositor(CSharableCompositor* inCompositor) -{ - mContext.compositor = inCompositor ? *inCompositor : (CL_Compositor*)nil; - if (mCompositor) - mCompositor->RemoveUser(this); - mCompositor = inCompositor; - if (mCompositor) - mCompositor->AddUser(this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -PRBool CBrowserContext::HandleLayerEvent( - CL_Layer* inLayer, - CL_Event* inEvent) -{ - PRBool result = PR_FALSE; - CHTMLView* theCurrentView = ExtractHyperView(*this); - if (theCurrentView != NULL) - result = theCurrentView->HandleLayerEvent(inLayer, inEvent); - return result; -} - -PRBool CBrowserContext::HandleEmbedEvent( - LO_EmbedStruct* inEmbed, - CL_Event* inEvent) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return PR_FALSE; - return theCurrentView->HandleEmbedEvent(inEmbed, inEvent); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- HISTORY --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::RememberHistoryPosition( - Int32 inH, - Int32 inV) -{ -#ifdef LAYERS - LO_Element* theNearestElement = LO_XYToNearestElement(&mContext, inH, inV, NULL); -#else - LO_Element* theNearestElement = LO_XYToNearestElement(&mContext, inH, inV); -#endif - - if (theNearestElement != NULL) - SHIST_SetPositionOfCurrentDoc(&mContext.hist, theNearestElement->lo_any.ele_id); -} - -History_entry* CBrowserContext::GetNextHistoryEntry(void) -{ - return SHIST_GetNext(&mContext); -} - -History_entry* CBrowserContext::GetPreviousHistoryEntry(void) -{ - return SHIST_GetPrevious(&mContext); -} - -Boolean CBrowserContext::CanGoForward(void) -{ - return SHIST_CanGoForward(&mContext); -} - -Boolean CBrowserContext::CanGoBack(void) -{ - return SHIST_CanGoBack(&mContext); -} - -Boolean CBrowserContext::HasGridChildren(void) -{ - return (mContext.grid_children != NULL); -} - -Boolean CBrowserContext::IsGridChild(void) -{ - return (mContext.is_grid_cell); -} - -Boolean CBrowserContext::IsGridCell() -{ - return (mContext.is_grid_cell); -} - -Boolean CBrowserContext::GoForwardInGrid(void) -{ - return LO_ForwardInGrid(&mContext); -} - -Boolean CBrowserContext::GoBackInGrid(void) -{ - return LO_BackInGrid(&mContext); -} - -void CBrowserContext::GoForward(void) -{ - if (!HasGridChildren() || !GoForwardInGrid()) - LoadHistoryEntry(index_GoForward); -} - -void CBrowserContext::GoBack(void) -{ - if (!HasGridChildren() || !GoBackInGrid()) - LoadHistoryEntry(index_GoBack); -} - -void CBrowserContext::GoForwardOneHost() -{ - History* history = &mContext.hist; - History_entry* currentEntry = GetCurrentHistoryEntry(); - History_entry* entry = nil; - - if (currentEntry) - { - CAutoPtrXP currentHost = NET_ParseURL(currentEntry->address, GET_HOST_PART); - - if (currentHost.get()) - { - Int32 historyIndex = 0; - Int32 currentEntryIndex = SHIST_GetIndex(history, currentEntry); - Int32 numItemsInHistory = GetHistoryListCount(); - - for (int i = currentEntryIndex + 1; i <= numItemsInHistory && !historyIndex; i++) - { - entry = SHIST_GetEntry(history, i - 1); - - if (entry) - { - CAutoPtrXP host = NET_ParseURL(entry->address, GET_HOST_PART); - - if (host.get()) - { - if (strcasecomp(currentHost.get(), host.get()) != 0) - { - historyIndex = i; - } - } - } - } - - if (!historyIndex) - { - historyIndex = numItemsInHistory; - } - - LoadHistoryEntry(historyIndex); - } - } -} - -void CBrowserContext::GoBackOneHost() -{ - History* history = &mContext.hist; - History_entry* currentEntry = GetCurrentHistoryEntry(); - History_entry* entry = nil; - - if (currentEntry) - { - CAutoPtrXP currentHost = NET_ParseURL(currentEntry->address, GET_HOST_PART); - - if (currentHost.get()) - { - Int32 historyIndex = 0; - Int32 currentEntryIndex = SHIST_GetIndex(history, currentEntry); - - for (int i = currentEntryIndex - 1; i >= 1 && !historyIndex; i--) - { - entry = SHIST_GetEntry(history, i - 1); - - if (entry) - { - CAutoPtrXP host = NET_ParseURL(entry->address, GET_HOST_PART); - - if (host.get()) - { - if (strcasecomp(currentHost.get(), host.get()) != 0) - { - historyIndex = i; - } - } - } - } - - if (!historyIndex) - { - historyIndex = 1; - } - - LoadHistoryEntry(historyIndex); - } - } -} - -// inIndex is one-based -// special case: -// -1 is go back -// 0 is go forward -// -2 is reload current -void CBrowserContext::LoadHistoryEntry(Int32 inIndex, Boolean inSuperReload) -{ - History_entry* entry = NULL; - switch (inIndex) - { - case index_GoBack: - entry = GetPreviousHistoryEntry(); - break; - case index_GoForward: - entry = GetNextHistoryEntry(); - break; - case index_Reload: - entry = GetCurrentHistoryEntry(); - break; - default: - entry = SHIST_GetObjectNum(&mContext.hist, inIndex); - } - if (entry) - { - URL_Struct* url = SHIST_CreateURLStructFromHistoryEntry(&mContext, entry); // SIGH! - if ( url ) - { - // 97-05-14 pkc -- only fiddle with url->force_reload if we're doing a reload - if (inIndex == index_Reload) - { - if(inSuperReload) - url->force_reload = NET_SUPER_RELOAD; - else - url->force_reload = NET_NORMAL_RELOAD; - } - SwitchLoadURL( url, FO_CACHE_AND_PRESENT ); - } - } -} - -void CBrowserContext::InitHistoryFromContext( CBrowserContext *parentContext) -{ - if ( parentContext ) - { - SHIST_CopySession( &mContext, parentContext->operator MWContext*() ); - Int32 curIndex = parentContext->GetIndexOfCurrentHistoryEntry(); - SHIST_SetCurrent( &mContext.hist, curIndex ); - } -} - -#pragma mark --- Image Observer --- - -Boolean CBrowserContext::IsContextLoopingRecurse() -{ - int i = 1; - MWContext *childContext; - - if (mImagesLooping) - return true; - - if (mMochaImagesLooping) - return true; - - while ((childContext = (MWContext *)XP_ListGetObjectNum(mContext.grid_children, i++)) != 0) - { - if (ExtractBrowserContext(childContext)->IsContextLoopingRecurse()) - return true; - } - - return false; -} - - // Returns true if this context or its children have any looping images. -Boolean CBrowserContext::IsContextLooping() -{ - return (IsContextLoopingRecurse()); -} - - -void -CBrowserContext::SetImagesLoading(Boolean inValue) -{ - mImagesLoading = inValue; - LCommander::SetUpdateCommandStatus(true); -} - -void -CBrowserContext::SetImagesLooping(Boolean inValue) -{ - mImagesLooping = inValue; - LCommander::SetUpdateCommandStatus(true); -} - -void -CBrowserContext::SetImagesDelayed(Boolean inValue) -{ - mImagesDelayed = inValue; - LCommander::SetUpdateCommandStatus(true); -} - -void -CBrowserContext::SetMochaImagesLoading(Boolean inValue) -{ - mMochaImagesLoading = inValue; - LCommander::SetUpdateCommandStatus(true); -} - -void -CBrowserContext::SetMochaImagesLooping(Boolean inValue) -{ - mMochaImagesLooping = inValue; - LCommander::SetUpdateCommandStatus(true); -} - -void -CBrowserContext::SetMochaImagesDelayed(Boolean inValue) -{ - mMochaImagesDelayed = inValue; - LCommander::SetUpdateCommandStatus(true); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- URL MANIPULATION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moved to CNSContext - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- REPAGINATION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::Repaginate(NET_ReloadMethod repage) -{ - History_entry* theCurrentEntry = SHIST_GetCurrent(&mContext.hist); - if ((theCurrentEntry == NULL) || (theCurrentEntry->is_binary)) - { - BroadcastMessage(msg_NSCPEmptyRepagination); - return; - } - - if (XP_IsContextBusy(&mContext)) - { - mIsRepaginationPending = true; - return; - } - - BroadcastMessage(msg_NSCPAboutToRepaginate); - - // it would be bad to reload the URL for the editor (file may not be saved!) - if (EDT_IS_EDITOR((&mContext))) - { - // Editor can relayout page without having to do NET_GetURL - BroadcastMessage(msg_NSCPEditorRepaginate); - return; - } - - URL_Struct* theURL = SHIST_CreateWysiwygURLStruct(&mContext, theCurrentEntry); - if (theURL == NULL) - return; - - theURL->force_reload = repage; - - // don't reload any images! Only from cache! - mIsRepaginationPending = false; - mIsRepaginating = true; - - NPL_SamePage(&mContext); - SwitchLoadURL(theURL, FO_CACHE_AND_PRESENT); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsRepaginating(void) const -{ - return mIsRepaginating; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserContext::IsRepagintaitonPending(void) const -{ - return mIsRepaginationPending; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- FRAME MANAGEMENT --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -MWContext* CBrowserContext::CreateGridContext( - void* inHistList, - void* inHistEntry, - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight, - char* inURLString, - char* inWindowTarget, - Int8 inScrollMode, - NET_ReloadMethod inForceReload, - Bool inNoEdge) -{ - Assert_(mContext.type != MWContextText); - - CBrowserContext* theNewContext = NULL; - - try - { - theNewContext = new CBrowserContext(*this); - StSharer theShareLock(theNewContext); - - theNewContext->mContext.is_grid_cell = true; -// theNewContext->fe.realContext = owningContext; - theNewContext->mContext.grid_parent = *this; - - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - ThrowIfNULL_(theCurrentView); - theCurrentView->CreateGridView(theNewContext, inX, inY, inWidth, inHeight, inScrollMode, inNoEdge); - - // ¥ create the new context for our view -// vcontext = newContext = context->CreateGridContext(); -// newContext->fe.view = newView; -// newContext->grid_parent = fHContext; - - if (inWindowTarget != NULL) - theNewContext->SetDescriptor(inWindowTarget); - - XP_AddContextToList(*theNewContext); - - // ¥ grid history magic - XP_List* theHistList = (XP_List*)inHistList; - History_entry* theHist = (History_entry*)inHistEntry; - if (inHistList != NULL) - { - if (theNewContext->mContext.hist.list_ptr != NULL) - XP_FREE(theNewContext->mContext.hist.list_ptr); - theNewContext->mContext.hist.list_ptr = theHistList; - } - else if (theHist != NULL) - SHIST_AddDocument(*theNewContext, theHist); - if (theHist == NULL) - { - URL_Struct* theURL = NET_CreateURLStruct(inURLString, NET_DONT_RELOAD); - theURL->force_reload = inForceReload; - - History_entry* theNewHist = SHIST_GetCurrent( &mContext.hist ); - if ((theNewHist != NULL) && (theNewHist->referer != NULL)) - theURL->referer = XP_STRDUP(theNewHist->referer); - - theNewContext->ImmediateLoadURL(theURL, FO_CACHE_AND_PRESENT); - } - else - { - URL_Struct* theURL = SHIST_CreateURLStructFromHistoryEntry(*theNewContext, theHist); - if (theURL) - theNewContext->ImmediateLoadURL(theURL, FO_CACHE_AND_PRESENT); - } - - theNewContext->AddUser(this); - BroadcastMessage(msg_NSCGridContextCreated, theNewContext); - } - catch (...) - { - - return NULL; - } - - return *theNewContext; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void* CBrowserContext::DisposeGridContext( - XP_Bool inSaveHistory) -{ - // Fix bug #76484 -- remove multiple calls to LO_DiscardDocument. It will - // get called in CNSContext::NoMoreUsers() - // LO_DiscardDocument(&mContext); - - if (!inSaveHistory) - { - // We will call this again in ~CNSContext, but it looks safe to call - // again because the first call will set mContext.hist.list_ptr to zero. - // We need to call this here because we might try to destroy form - // elements in the history, which are destroyed by a callback through - // the associated CHTMLView; but the broadcast below will destroy the - // CHTMLView. - SHIST_EndSession(&mContext); - } - - XP_List* theHistoryList = NULL; - if (inSaveHistory) - { - theHistoryList = mContext.hist.list_ptr; - mContext.hist.list_ptr = NULL; - } - - Assert_(mContext.grid_parent != NULL); - CBrowserContext* theParentContext = ExtractBrowserContext(mContext.grid_parent); - Assert_(theParentContext != NULL); - - theParentContext->DisposeGridChild(this); - - // Moved broadcast past DisposeGridChild() so that the view has the last shared reference - // on the context. Thus, the view is still valid when the context is actually disposed, - // and callback such as HideJavaAppElement will still work. - // Now that this broadcast happens after the call to DisposeGridChild(), a more - // appropriate message would be msg_NSCGridContextPostDispose. - - // First we broadcast to an client views that this grid context is about to die - // clients should clean up and remove their shared references to the context - // upon receiving this message. - BroadcastMessage(msg_NSCGridContextPreDispose, &inSaveHistory); - - return theHistoryList; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisposeGridChild( - CBrowserContext* inChildContext) -{ - Assert_(inChildContext != this); - Assert_(inChildContext != NULL); - - // 97.12.19 pchen. Fix AT&T bug #97213. If we're removing all our - // grid children, reset scroll mode of our corresponding CHTMLView. - if (CountGridChildren() == 1) - { - // removing grid children, reset scroll mode on CHTMLView - CHTMLView* theCurrentView = ExtractHyperView(*this); - if (theCurrentView != NULL) - { - theCurrentView->ResetToDefaultScrollMode(); - } - } - - inChildContext->RemoveUser(this); - BroadcastMessage(msg_NSCGridContextDisposed); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::ReloadGridFromHistory( - void* inHistEntry, - NET_ReloadMethod inReload) -{ - History_entry* theHist = (History_entry*)inHistEntry; - if (theHist == NULL) - return; - - URL_Struct* theURL = SHIST_CreateURLStructFromHistoryEntry(*this, theHist); - theURL->force_reload = inReload; - - SwitchLoadURL(theURL, FO_CACHE_AND_PRESENT); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::RestructureGridContext( - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight) -{ - Assert_(mContext.type != MWContextText); - - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->RestructureGridView(inX, inY, inWidth, inHeight); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetFullGridSize( - Int32& outWidth, - Int32& outHeight) -{ - outWidth = outHeight = 80; - if (mContext.type != MWContextText) - { - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView) - theCurrentView->GetFullGridSize(outWidth, outHeight); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int32 CBrowserContext::CountGridChildren(void) const -{ - Int32 theChildCount = 0; - if (mContext.grid_children != NULL) - theChildCount = XP_ListCount(mContext.grid_children); - - return theChildCount; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CALLBACK IMPLEMENTATION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::AllConnectionsComplete(void) -{ - mIsRepaginating = false; - - CNSContext::AllConnectionsComplete(); - - if (CWebFontReference::NeedToReload(*this)) - { - LO_InvalidateFontData(*this); - this->Repaginate(); - } - else if (mContext.requires_reflow) - { - // Okay, we've blasted over an image with no width or height, so - // now we have to pay our dues and reflow the page. - mContext.requires_reflow = PR_FALSE; - LO_RelayoutFromElement(*this, NULL); - } -} - - -void CBrowserContext :: CompleteLoad ( URL_Struct* inURL, int inStatus ) -{ - CNSContext :: CompleteLoad ( inURL, inStatus ); - - const short kKeywordLength = 50; - char keyword[kKeywordLength + 1]; - NET_getInternetKeyword(inURL, keyword, kKeywordLength); - // we are guaranteed |keyword| will at least be a 0-length string - - BroadcastMessage(msg_NSCInternetKeywordChanged, (void*)keyword); - -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::LayoutNewDocument( - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - // Check to see if theCurrentView is NULL because it's possible - // for XP code to try to lay out after we've destroyed window - if (theCurrentView != NULL) - { - theCurrentView->LayoutNewDocument(inURL, inWidth, inHeight, inMarginWidth, inMarginHeight); - - CStr31 theTitle = CFileMgr::FileNameFromURL(inURL->address); - // i18n problem- we may need to convert theTitle to UTF8 before call SHIST_CreateHistryEntry - // However, currently theTitle is only URL encoded file name which have no 8bit data. Should double check again later. - - History_entry* theNewEntry = SHIST_CreateHistoryEntry(inURL, theTitle); - SHIST_AddDocument(*this, theNewEntry); - - BroadcastMessage(msg_NSCLayoutNewDocument, inURL); - - // setup security status - if (!IsGridChild()) - { - int status = XP_GetSecurityStatus(*this); - BroadcastMessage(msg_SecurityState, (void*)status); - } - } - // 97-06-04 pkc -- clear default status string in context - ClearDefaultStatus(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetDocTitle( - char* inTitle) -{ - // 97-05-20 pkc -- don't broadcast if we're in NoMoreUsers() call chain - // only broadcast doc title changed if we're top-level context - if (!mInNoMoreUsers && !IsGridChild()) - { - if(inTitle != NULL) - { - unsigned char *converted = - INTL_ConvertLineWithoutAutoDetect( - INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(&mContext)), - ScriptToEncoding(::FontToScript(applFont)), - (unsigned char *) inTitle, - (uint32) XP_STRLEN(inTitle)); - if (converted && ((char *) converted != inTitle)) - { - inTitle = (char *) converted; - } - - StrAllocCopy(mContext.title, inTitle); - SHIST_SetTitleOfCurrentDoc(&mContext); - BroadcastMessage(msg_NSCDocTitleChanged, inTitle); - if (converted) - XP_FREE(converted); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::FinishedLayout(void) -{ - FM_SetFlushable(&mContext, true); - - if (!mInNoMoreUsers) - BroadcastMessage(msg_NSCFinishedLayout); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -int CBrowserContext::GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* inTextInfo) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return 1; - return theCurrentView->GetTextInfo(inText, inTextInfo); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -int CBrowserContext::MeasureText( - LO_TextStruct* inText, - short* outCharLocs) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return 0; - return theCurrentView->MeasureText(inText, outCharLocs); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetEmbedSize( - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod inReloadMethod) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->GetEmbedSize(inEmbedStruct, inReloadMethod); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetJavaAppSize( - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->GetJavaAppSize(inJavaAppStruct, inReloadMethod); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetFormElementInfo( - LO_FormElementStruct* inElement) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->GetFormElementInfo(inElement); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetFormElementValue( - LO_FormElementStruct* inElement, - XP_Bool inHide, - XP_Bool inSubmit) -{ - /* - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - theCurrentView->GetFormElementValue(inElement, inHide); - */ - // Check that the view is not deleted, because the form elements - // try to access panes within that view. - CHTMLView* theCurrentView = ExtractHyperView(*this); - if (theCurrentView) - UFormElementFactory::GetFormElementValue(inElement, inHide, inSubmit); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::ResetFormElement( - LO_FormElementStruct* inElement) -{ - /* - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - theCurrentView->ResetFormElement(inElement); - */ - UFormElementFactory::ResetFormElement(inElement, true, true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetFormElementToggle( - LO_FormElementStruct* inElement, - XP_Bool inToggle) -{ - /* - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - theCurrentView->SetFormElementToggle(inElement, inToggle); - */ - UFormElementFactory::SetFormElementToggle(inElement, inToggle); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::FreeEmbedElement( - LO_EmbedStruct* inEmbedStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->FreeEmbedElement(inEmbedStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::CreateEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->CreateEmbedWindow(inEmbeddedApp); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SaveEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->SaveEmbedWindow(inEmbeddedApp); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::RestoreEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->RestoreEmbedWindow(inEmbeddedApp); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DestroyEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->DestroyEmbedWindow(inEmbeddedApp); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::FreeJavaAppElement( - LJAppletData* inAppletData) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->FreeJavaAppElement(inAppletData); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::HideJavaAppElement( - LJAppletData* inAppletData) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->HideJavaAppElement(inAppletData); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::FreeEdgeElement( - LO_EdgeStruct* inEdgeStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->FreeEdgeElement(inEdgeStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::FormTextIsSubmit( - LO_FormElementStruct* inElement) -{ - /* - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - theCurrentView->FormTextIsSubmit(inElement); - */ - UFormElementFactory::FormTextIsSubmit(inElement); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplaySubtext(inLocation, inText, inStartPos, inEndPos, inNeedBG); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayText(inLocation, inText, inNeedBG); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayEmbed( - int inLocation, - LO_EmbedStruct* inEmbedStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayEmbed(inLocation, inEmbedStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayJavaApp(inLocation, inJavaAppStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayEdge( - int inLocation, - LO_EdgeStruct* inEdgeStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayEdge(inLocation, inEdgeStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayTable(inLocation, inTableStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayCell( - int inLocation, - LO_CellStruct* inCellStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayCell(inLocation, inCellStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::InvalidateEntireTableOrCell( - LO_Element* inElement) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->InvalidateEntireTableOrCell(inElement); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayAddRowOrColBorder( - XP_Rect* inRect, - XP_Bool inDoErase) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayAddRowOrColBorder(inRect, inDoErase); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplaySubDoc( - int /*inLocation*/, - LO_SubDocStruct* /*inSubdocStruct*/) -{ - // Empty NS_xxx implementation -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayLineFeed(inLocation, inLinefeedStruct, inNeedBG); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayHR(inLocation, inRuleStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayBullet( - int inLocation, - LO_BullettStruct* inBullettStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayBullet(inLocation, inBullettStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayFormElement( - int inLocation, - LO_FormElementStruct* inFormElement) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayFormElement(inLocation, inFormElement); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayBorder( - int inLocation, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayBorder(inLocation, inX, inY, inWidth, inHeight, inBW, inColor, inStyle); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ UpdateEnableStates--Editor can change enable/disable state of buttons -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::UpdateEnableStates() -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->UpdateEnableStates(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DisplayFeedback--Editor shows selection -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DisplayFeedback( - int inLocation, - LO_Element_struct *inElement) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->DisplayFeedback(inLocation, inElement); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::ClearView( - int inWhich) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->ClearView(inWhich); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetDocDimension( - int inLocation, - Int32 inWidth, - Int32 inLength) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - // Check to see if theCurrentView is NULL because it's possible - // for XP code to try to lay out after we've destroyed window - if (theCurrentView != NULL) - theCurrentView->SetDocDimension(inLocation, inWidth, inLength); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetDocPosition( - int inLocation, - Int32 inX, - Int32 inY) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - // Check to see if theCurrentView is NULL because it's possible - // for XP code to try to lay out after we've destroyed window - if (theCurrentView != NULL) - theCurrentView->SetDocPosition(inLocation, inX, inY); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetDocPosition( - int inLocation, - Int32* outX, - Int32* outY) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->GetDocPosition(inLocation, outX, outY); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetBackgroundColor( - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - theCurrentView->SetBackgroundColor(inRed, inGreen, inBlue); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->EraseBackground(inLocation, inX, inY, inWidth, inHeight, inColor); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::SetDrawable( - CL_Drawable* inDrawable) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - CDrawable *theDrawable; - - Assert_(theCurrentView != NULL); - if (theCurrentView == NULL) - return; - if (inDrawable) - theDrawable = (CDrawable *) CL_GetDrawableClientData(inDrawable); - else - theDrawable = NULL; - theCurrentView->SetCurrentDrawable(theDrawable); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetTextFrame( - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->GetTextFrame(inTextStruct, inStartPos, inEndPos, outFrame); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::GetDefaultBackgroundColor( - LO_Color* outColor) const -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->GetDefaultBackgroundColor(outColor); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::DrawJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->DrawJavaApp(inLocation, inJavaAppStruct); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::HandleClippingView( - struct LJAppletData *appletD, - int x, - int y, - int width, - int height) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->HandleClippingView(appletD, x, y, width, height); -} - -CSharableCompositor::~CSharableCompositor() -{ - if (mCompositor) - CL_DestroyCompositor(mCompositor); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::ConstructJSDialogTitle(LStr255& outTitle) -{ - if (mContext.url) - { - AppendJSStringToHost(outTitle, mContext.url); - } - else - { - History_entry* hist = GetCurrentHistoryEntry(); - if (hist) - { - AppendJSStringToHost(outTitle, hist->address); - } - else - { - AppendJSStringToHost(outTitle, NULL); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserContext::Alert( - const char* inAlertText) -{ - CStr255 pmessage( inAlertText ); - StripDoubleCRs( pmessage ); - pmessage=NET_UnEscape(pmessage); - if (mContext.bJavaScriptCalling) - { - // this is a JavaScript alert, make title string for alert - LStr255 titleStr; - ConstructJSDialogTitle(titleStr); - UStdDialogs::Alert(pmessage, eAlertTypeCaution, NULL, NULL, &titleStr); - } - else - { - UStdDialogs::Alert(pmessage, eAlertTypeCaution); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CBrowserContext::Confirm( - const char* inMessage) -{ - XP_Bool result; - CStr255 mesg(inMessage); - ConvertCRtoLF(mesg); - StripDoubleCRs(mesg); - mesg = NET_UnEscape(mesg); - if (mContext.bJavaScriptCalling) - { - // this is a JavaScript confirm, make title string for confirm - LStr255 titleStr; - ConstructJSDialogTitle(titleStr); - result = UStdDialogs::AskOkCancel(mesg, NULL, NULL, &titleStr); - } - else - { - result = UStdDialogs::AskOkCancel(mesg); - } - - (CFrontApp::GetApplication())->UpdateMenus(); - - return result; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -char* CBrowserContext::Prompt( - const char* inMessage, - const char* inDefaultText) -{ - char* result = NULL; - CStr255 mesg(inMessage), ioString(inDefaultText); - mesg = NET_UnEscape(mesg); - Boolean prompt = false; - - if (mContext.bJavaScriptCalling) - { - // this is a JavaScript prompt, make title string for prompt - LStr255 titleStr; - ConstructJSDialogTitle(titleStr); - CStr255 title(titleStr); - prompt = UStdDialogs::AskStandardTextPrompt(title, mesg, ioString); - } - else - { - prompt = UStdDialogs::AskStandardTextPrompt("", mesg, ioString); - } - - if (prompt) - { - if (ioString.Length() > 0) - { - result = (char*)XP_ALLOC(ioString.Length() + 1); - ThrowIfNULL_(result); - ::BlockMoveData(&ioString[1], result, ioString.Length()); - result[ioString.Length()] = '\0'; - } - } - - return result; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ FreeBuiltinElement -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Dispose of an embedded SHACK widget -void -CBrowserContext :: FreeBuiltinElement ( LO_BuiltinStruct* inBuiltinStruct ) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->FreeBuiltinElement(inBuiltinStruct); - -} // FreeBuiltinElement - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DisplayBuiltin -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Create and display a SHACK tree widget in HTML area -void -CBrowserContext :: DisplayBuiltin ( int inLocation, LO_BuiltinStruct* inBuiltinStruct ) -{ - CHTMLView* theCurrentView = ExtractHyperView(*this); - Assert_(theCurrentView != NULL); - if (theCurrentView != NULL) - theCurrentView->DisplayBuiltin(inLocation, inBuiltinStruct); - -} // DisplayBuiltin diff --git a/mozilla/cmd/macfe/central/CBrowserContext.h b/mozilla/cmd/macfe/central/CBrowserContext.h deleted file mode 100644 index 94da85e40c3..00000000000 --- a/mozilla/cmd/macfe/central/CBrowserContext.h +++ /dev/null @@ -1,500 +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. - */ - -// CBrowserContext.h - -#pragma once - - -#include -#include - -#include "CNSContext.h" - -#include "structs.h" -#include "ctxtfunc.h" -#include "cstring.h" - -class CHTMLView; -class CSharableCompositor; - -const MessageT msg_SecurityState = 'SECS'; // ESecurityState - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CBrowserContext : public CNSContext -{ - friend class CNSContextCallbacks; - friend class CPlainTextConversionContext; - - public: - // history navigation - // these are special indices for LoadHistoryEntry - enum { - index_Reload = -2, - index_GoBack = -1, - index_GoForward = 0 - }; - - CBrowserContext(); - CBrowserContext(MWContextType inType); - CBrowserContext(const CBrowserContext& inOriginal); - - virtual ~CBrowserContext(); - - virtual void NoMoreUsers(void); - - operator MWContext*(); - operator MWContext&(); - - virtual void SetCurrentView(CHTMLView* inView); - - virtual CBrowserContext* GetTopContext(); - - virtual Boolean HasColorSpace(void) const; - virtual Boolean HasGridParent(void) const; - virtual Boolean HasFullPagePlugin(void) const; - - virtual void SetLoadImagesOverride(Boolean inOverride); - virtual Boolean IsLoadImagesOverride(void) const; - - virtual void SetDelayImages(Boolean inDelay); - virtual Boolean IsImageLoadingDelayed(void) const; - - virtual Boolean IsRestrictedTarget(void) const; - virtual void SetRestrictedTarget(Boolean inIsRestricted); - - virtual Boolean IsRootDocInfoContext(); - virtual Boolean IsViewSourceContext(); - - virtual Boolean IsSpecialBrowserContext(); - - virtual Boolean SupportsPageServices(); - - virtual void SetCloseCallback ( void (* close_callback)(void *close_arg), void* close_arg ); - - virtual void CompleteLoad ( URL_Struct* inURL, int inStatus ) ; - -// FIX ME!!! ACCESSOR for unique ID - - // LAYERS / COMPOSITOR - - virtual Boolean HasCompositor(void) const; - - virtual CL_Compositor* GetCompositor(void) const; - - virtual void SetCompositor( - CSharableCompositor* inCompositor); - - virtual PRBool HandleLayerEvent( - CL_Layer* inLayer, - CL_Event* inEvent); - - virtual PRBool HandleEmbedEvent( - LO_EmbedStruct* inEmbed, - CL_Event* inEvent); - - - // HISTORY - virtual void RememberHistoryPosition( - Int32 inX, - Int32 inY); - - virtual void InitHistoryFromContext( CBrowserContext *parentContext); - - - // Image Observer - - virtual Boolean IsContextLooping(); - Boolean IsMochaLoadingImages() { return mMochaImagesLoading; } - - void SetImagesLoading(Boolean inValue); - void SetImagesLooping(Boolean inValue); - void SetImagesDelayed(Boolean inValue); - void SetMochaImagesLoading(Boolean inValue); - void SetMochaImagesLooping(Boolean inValue); - void SetMochaImagesDelayed(Boolean inValue); - - protected: - // we don't need to expose these - virtual History_entry* GetNextHistoryEntry(void); - virtual History_entry* GetPreviousHistoryEntry(void); - virtual Boolean IsContextLoopingRecurse(); - - public: - virtual Boolean CanGoForward(void); - virtual Boolean CanGoBack(void); - - virtual Boolean HasGridChildren(void); - virtual Boolean IsGridChild(void); - virtual Boolean IsGridCell(); - - virtual void GoForwardOneHost(); - virtual void GoBackOneHost(); - - virtual void GoForward(void); - virtual void GoBack(void); - virtual void LoadHistoryEntry( // one-based - Int32 inIndex, - Boolean inSuperReload = false); - virtual Boolean GoForwardInGrid(void); - virtual Boolean GoBackInGrid(void); - -/* - // URL MANIPULATION - virtual cstring GetCurrentURL(void); - - virtual void SwitchLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat); - - virtual void ImmediateLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat); -*/ - // REPAGINTAION - - virtual void Repaginate(NET_ReloadMethod repage = NET_RESIZE_RELOAD); - virtual Boolean IsRepaginating(void) const; - virtual Boolean IsRepagintaitonPending(void) const; - - // FRAME MANAGEMENT - - virtual MWContext* CreateGridContext( - void* inHistList, - void* inHistEntry, - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight, - char* inURLString, - char* inWindowTarget, - Int8 inScrollMode, - NET_ReloadMethod inForceReload, - Bool inNoEdge); - - virtual void* DisposeGridContext( - XP_Bool inSaveHistory); - - virtual void DisposeGridChild( - CBrowserContext* inChildContext); - - virtual void RestructureGridContext( - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight); - - virtual void GetFullGridSize( - Int32& outWidth, - Int32& outHeight); - - virtual void ReloadGridFromHistory( - void* inHistEntry, - NET_ReloadMethod inReload); - - - virtual Int32 CountGridChildren(void) const; - - // save dialog for editor--Paul will fix some time - virtual CSaveProgress* GetSaveDialog() { return fSaveDialog; }; - virtual void SetSaveDialog( CSaveProgress* theDialog ) { fSaveDialog = theDialog; }; - - // override for JavaScript foolishness - virtual void Alert( - const char* inAlertText); - - virtual XP_Bool Confirm( - const char* inMessage); - protected: - CSaveProgress* fSaveDialog; - - void ConstructJSDialogTitle(LStr255& outTitle); - - - // CALLBACK IMPLEMENTATION - -// FIX ME!!! this needs to become an apple event -// virtual MWContext* CreateNewDocWindow( -// URL_Struct* inURL); - - virtual void LayoutNewDocument( - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight); - - virtual void SetDocTitle( - char* inTitle); - - virtual void FinishedLayout(void); - - virtual int GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* inTextInfo); - - virtual int MeasureText( - LO_TextStruct* inText, - short* outCharLocs); - - virtual void GetEmbedSize( - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod inReloadMethod); - - virtual void GetJavaAppSize( - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod); - - virtual void GetFormElementInfo( - LO_FormElementStruct* inElement); - - virtual void GetFormElementValue( - LO_FormElementStruct* inElement, - XP_Bool inHide, - XP_Bool inSubmit); - - virtual void ResetFormElement( - LO_FormElementStruct* inElement); - - virtual void SetFormElementToggle( - LO_FormElementStruct* inElement, - XP_Bool inToggle); - - virtual void FreeEmbedElement( - LO_EmbedStruct* inEmbedStruct); - - virtual void CreateEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void SaveEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void RestoreEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void DestroyEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void FreeJavaAppElement( - LJAppletData* inAppletData); - - virtual void HideJavaAppElement( - LJAppletData* inAppletData); - - virtual void FreeEdgeElement( - LO_EdgeStruct* inEdgeStruct); - - virtual void FormTextIsSubmit( - LO_FormElementStruct* inElement); - - virtual void DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG); - - virtual void DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG); - - virtual void DisplayEmbed( - int inLocation, - LO_EmbedStruct* inEmbedStruct); - - virtual void DisplayJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - virtual void DisplayEdge ( - int inLocation, - LO_EdgeStruct* inEdgeStruct); - - virtual void DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct); - - virtual void DisplayCell( - int inLocation, - LO_CellStruct* inCellStruct); - - virtual void InvalidateEntireTableOrCell( - LO_Element* inElement); - - virtual void DisplayAddRowOrColBorder( - XP_Rect* inRect, - XP_Bool inDoErase); - - virtual void DisplaySubDoc( - int inLocation, - LO_SubDocStruct* inSubdocStruct); - - virtual void DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG); - - virtual void DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct); - - virtual void DisplayBullet( - int inLocation, - LO_BullettStruct* inBullettStruct); - - virtual void DisplayFormElement( - int inLocation, - LO_FormElementStruct* inFormElement); - - virtual void DisplayBorder( - int inLocation, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle); - - virtual void UpdateEnableStates(); - - virtual void DisplayFeedback( - int inLocation, - LO_Element_struct *inElement); - - virtual void ClearView( - int inWhich); - - virtual void SetDocDimension( - int inLocation, - Int32 inWidth, - Int32 inLength); - - virtual void SetDocPosition( - int inLocation, - Int32 inX, - Int32 inY); - - virtual void GetDocPosition( - int inLocation, - Int32* outX, - Int32* outY); - - virtual void SetBackgroundColor( - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue); - - virtual void AllConnectionsComplete(void); - - virtual void EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHieght, - LO_Color* inColor); - - virtual void SetDrawable( - CL_Drawable* inDrawable); - - virtual void GetTextFrame( - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame); - - virtual void GetDefaultBackgroundColor( - LO_Color* outColor) const; - - virtual void DrawJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - virtual void HandleClippingView( - struct LJAppletData *appletD, - int x, - int y, - int width, - int height); - - virtual void FreeBuiltinElement( - LO_BuiltinStruct * inBuiltinStruct) ; - virtual void DisplayBuiltin( - int inLocation, - LO_BuiltinStruct* inBuiltinStruct) ; - - virtual char* Prompt( - const char* inMessage, - const char* inDefaultText); - -#if 0 - Int32 GetTransactionID() { return fProgressID; } - Int32 GetContextUniqueID() { return fWindowID; } - // Window ID. Used to identify the context - static Int32 sWindowID; // Unique ID, incremented for each context - Int32 fWindowID; // ID of this window - - - private: -#endif - - Boolean mIsRepaginating; - Boolean mIsRepaginationPending; - - Boolean mLoadImagesOverride; - Boolean mDelayImages; - CSharableCompositor* mCompositor; - - IL_GroupContext* mImageGroupContext; - - Boolean mImagesLoading; - Boolean mImagesLooping; - Boolean mImagesDelayed; - Boolean mMochaImagesLoading; - Boolean mMochaImagesLooping; - Boolean mMochaImagesDelayed; - - Boolean mInNoMoreUsers; - - void (* mCloseCallback)(void *); // called on window close - void* mCloseCallbackArg; - -}; // class CBrowserContext - -inline CBrowserContext::operator MWContext*() - { return &mContext; }; -inline CBrowserContext::operator MWContext&() - { return mContext; }; - -inline CBrowserContext* ExtractBrowserContext(MWContext* inContext) - { return inContext ? dynamic_cast(inContext->fe.newContext) : NULL; } - -class CSharableCompositor : public LSharable -{ -public: - CSharableCompositor(CL_Compositor* c = nil) : mCompositor(c) {} - void SetCompositor(CL_Compositor* c) { mCompositor = c; } - virtual ~CSharableCompositor(); - operator CL_Compositor*() { return mCompositor; } - CL_Compositor* mCompositor; -}; // class CSharableCompositor diff --git a/mozilla/cmd/macfe/central/CBrowserDragTask.cp b/mozilla/cmd/macfe/central/CBrowserDragTask.cp deleted file mode 100644 index 7cf4c449253..00000000000 --- a/mozilla/cmd/macfe/central/CBrowserDragTask.cp +++ /dev/null @@ -1,153 +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. - */ - -// CBrowserDragTask.cp - - - -#include "CBrowserDragTask.h" - -#include "resgui.h" - -// --------------------------------------------------------------------------- -// ¥ CBrowserDragTask -// --------------------------------------------------------------------------- - -CBrowserDragTask::CBrowserDragTask( - const EventRecord& inEventRecord) - : super(inEventRecord) -{ -} - -// --------------------------------------------------------------------------- -// ¥ ~CBrowserDragTask -// --------------------------------------------------------------------------- - -CBrowserDragTask::~CBrowserDragTask() -{ -} - - -// -// AddFlavorBookmark -// -// This flavor is currently used to shuttle around url/title information, and is -// used by external applications (like DragThing) to get info about bookmarks/etc. -// The data format is plain text in the form of URLTitle. -// -// This flavor may or may not contain data. The proxy icon, for example, would want to -// include the data so that if it is dropped in the NavCenter, the NC could -// determine if the drop was allowable based on the URL. -// -void -CBrowserDragTask::AddFlavorBookmark(ItemReference inItemRef, const char* inData) -{ - OSErr theErr = ::AddDragItemFlavor( - mDragRef, - inItemRef, - emBookmarkDrag, - inData, - inData ? strlen(inData) + 1 : 0, - flavorSenderTranslated ); - ThrowIfOSErr_(theErr); -} - - -// -// AddFlavorBookmarkFile -// -// This flavor is used for creating a bookmark file in the Finder instead of a clipping when -// icons are dragged to the desktop. -// -// The data will be fulfilled in a DoSendData proc. -// -void -CBrowserDragTask::AddFlavorBookmarkFile(ItemReference inItemRef) -{ - // Promise a file of type emBookmarkFile - - PromiseHFSFlavor promise; - - promise.fileType = emBookmarkFile; - promise.fileCreator = emSignature; - promise.fdFlags = 0; - promise.promisedFlavor = emBookmarkFileDrag; - - // Promise to create a file for the emBookmark flavor, where the actual - // FSSpec is promised in the emBookmark flavor below - - OSErr theErr = ::AddDragItemFlavor( - mDragRef, - inItemRef, - flavorTypePromiseHFS, - &promise, - sizeof(PromiseHFSFlavor), - 0); - ThrowIfOSErr_(theErr); - - theErr = ::AddDragItemFlavor( - mDragRef, - inItemRef, - emBookmarkFileDrag, - nil, - 0, - flavorNotSaved | flavorSenderTranslated); - ThrowIfOSErr_(theErr); -} - - -// -// AddFlavorURL -// -// This flavor is used to communicate the current URL with other applications, such -// as text editors, etc. It is basically the 'TEXT' flavor. -// -// No data is sent with this flavor, relying on a DoDragSendData() to get it out later. -// This prevents us from running into an odd problem where the CTheadView class wants to -// interpret the data as something that it isn't. This won't happen when no data is sent. -// -void -CBrowserDragTask::AddFlavorURL(ItemReference inItemRef) -{ - // TEXT flavor (drag an URL within Netscape). Set flavorSenderTranslated - // so that the Finder *won't* try to put this in a clipping file. - // We'd rather save the file itself. - - OSErr theErr = ::AddDragItemFlavor( - mDragRef, - inItemRef, - 'TEXT', - nil, - 0, - flavorSenderTranslated); - ThrowIfOSErr_(theErr); -} - -// --------------------------------------------------------------------------- -// ¥ AddFlavors -// --------------------------------------------------------------------------- - -void -CBrowserDragTask::AddFlavors( DragReference inDragRef ) -{ -// NOTE: I'm passing |this| as the item ref because that's the way it was in the past -// and i don't want to break anything. - AddFlavorBookmark(static_cast(this)); - AddFlavorBookmarkFile(static_cast(this)); - AddFlavorURL(static_cast(this)); -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/CBrowserDragTask.h b/mozilla/cmd/macfe/central/CBrowserDragTask.h deleted file mode 100644 index 0e2aa75968d..00000000000 --- a/mozilla/cmd/macfe/central/CBrowserDragTask.h +++ /dev/null @@ -1,49 +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. - */ - -// CBrowserDragTask.h - - -#ifndef CBrowserDragTask_H -#define CBrowserDragTask_H -#pragma once - -// Includes - -#include - -// Class declaration - -class CBrowserDragTask : public LDragTask -{ -public: - typedef LDragTask super; - - CBrowserDragTask( const EventRecord& inEventRecord ); - virtual ~CBrowserDragTask(); - -protected: - void AddFlavorBookmark(ItemReference inItemRef, const char* inData = nil); - void AddFlavorBookmarkFile(ItemReference inItemRef); - void AddFlavorURL(ItemReference inItemRef); - - virtual void AddFlavors(DragReference inDragRef); -}; - - -#endif diff --git a/mozilla/cmd/macfe/central/CExpandoDivider.cp b/mozilla/cmd/macfe/central/CExpandoDivider.cp deleted file mode 100644 index 572ff1e8584..00000000000 --- a/mozilla/cmd/macfe/central/CExpandoDivider.cp +++ /dev/null @@ -1,351 +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. - */ - -#include "CExpandoDivider.h" - -#include "prtypes.h" -#include "macutil.h" -#include "CDragBarDockControl.h" - -#define kTwistieID 'Twst' -#define kCaptionID 'TwCp' - -const Int16 kTwistiePixelDifference = 3; // difference in height (collapsed minus expanded). - -//====================================== -// CExpandoListener -//====================================== - -//----------------------------------- -void CExpandoListener::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case msg_TwistieMessage: - { - Int32 value = *(Int32*)ioParam; - SetExpandState((ExpandStateT)value); - break; - } - } -} // CExpandoListener::ListenToMessage - -//====================================== -// CExpandable -//====================================== - -//----------------------------------- -CExpandable::CExpandable(CExpansionData* closedState, CExpansionData* openState) -//----------------------------------- -: mExpandState(closed_state) -{ - mStates[0] = closedState; - mStates[1] = openState; -} - -//----------------------------------- -void CExpandable::StoreCurrentDimensions() -//----------------------------------- -{ - StoreDimensions(*(mStates[GetExpandState()])); -} - -//----------------------------------- -void CExpandable::RecallCurrentDimensions() -//----------------------------------- -{ - RecallDimensions(*(mStates[GetExpandState()])); -} - -//----------------------------------- -void CExpandable::RecallOtherDimensions() -//----------------------------------- -{ - RecallDimensions(*mStates[1 - GetExpandState()]); -} - -//----------------------------------- -void CExpandable::ReadStatus(LStream* inStream) -//----------------------------------- -{ - if (!inStream) return; - *inStream >> mExpandState; - mStates[0]->ReadStatus(inStream); - mStates[1]->ReadStatus(inStream); - // Don't do anything with them here. -} // CExpandable::ReadStatus - -//----------------------------------- -void CExpandable::WriteStatus(LStream* inStream) -//----------------------------------- -{ - StoreCurrentDimensions(); - if (!inStream) return; - *inStream << mExpandState; - mStates[0]->WriteStatus(inStream); - mStates[1]->WriteStatus(inStream); -} // CExpandable::ReadStatus - -const Int16 kDefaultTopFrameHeight = 110; - // FIXME. A preference? This value shows 5 full message lines in geneva 9. - -//----------------------------------- -inline CDividerData::CDividerData() -//----------------------------------- -: mDividerPosition(kDefaultTopFrameHeight) -{ -} // CDividerData::CDividerData - -//----------------------------------- -void CDividerData::ReadStatus(LStream* inStream) -//----------------------------------- -{ - if (!inStream) return; - *inStream >> mDividerPosition; -} // CDividerData::ReadStatus - -//----------------------------------- -void CDividerData::WriteStatus(LStream* inStream) -//----------------------------------- -{ - if (!inStream) return; - *inStream << mDividerPosition; -} // CDividerData::WriteStatus - -//====================================== -// CExpandoDivider -//====================================== - -//----------------------------------- -CExpandoDivider::CExpandoDivider(LStream* inStream) -//----------------------------------- -: Inherited( inStream ) -, CExpandable(&mClosedData, &mOpenData) -{ -} // CExpandoDivider::CExpandoDivider - -//----------------------------------- -CExpandoDivider::~CExpandoDivider() -//----------------------------------- -{ -} - -//----------------------------------- -void CExpandoDivider::FinishCreateSelf() -//----------------------------------- -{ - Inherited::FinishCreateSelf(); - mTwistie = FindPaneByID(kTwistieID); - mCaption = FindPaneByID(kCaptionID); -// CExpandable::InitializeStates(); - StoreCurrentDimensions(); // get the closed state from PPOb - // Base class calls SyncFrameBinding which sets the "open" behavior. Undo this, then. - SetStickToBottom(true); - - // Record the height of the status bar, so that we can preserve it on expansion. - LWindow* window = LWindow::FetchWindowObject(GetMacPort()); - Rect windowRect; - window->CalcPortFrameRect(windowRect); // relative is fine - Rect expandoRect; - this->CalcPortFrameRect(expandoRect); - mDistanceFromWindowBottom = windowRect.bottom - expandoRect.bottom; - Assert_(mDistanceFromWindowBottom >= 0); - mDividerDistanceFromWindowBottom - = windowRect.bottom - (expandoRect.top + GetDividerPosition()); -} // CExpandoDivider::FinishCreateSelf - -//----------------------------------- -void CExpandoDivider::StoreDimensions(CExpansionData& outState) -//----------------------------------- -{ - ((CDividerData&)outState).mDividerPosition = GetDividerPosition(); -} // CExpandoDivider::StoreDimensions - -//----------------------------------- -void CExpandoDivider::RecallDimensions(const CExpansionData& inState) -//----------------------------------- -{ - SInt32 dividerPosition = GetDividerPosition(); - Int16 dividerDelta = ((CDividerData&)inState).mDividerPosition - dividerPosition; - this->ChangeDividerPosition(dividerDelta); -} // CExpandoDivider::RecallDimensions - -//----------------------------------- -void CExpandoDivider::SetStickToBottom(LPane* inPane, Boolean inStick) -//----------------------------------- -{ - SBooleanRect bindings; - inPane->GetFrameBinding(bindings); - bindings.bottom = inStick; - inPane->SetFrameBinding(bindings); -} // CExpandoDivider::SetStickToBottom - -//----------------------------------- -void CExpandoDivider::SetStickToBottom(Boolean inStick) -//----------------------------------- -{ - SetStickToBottom(mTwistie, inStick); - SetStickToBottom(mCaption, inStick); - SetStickToBottom(fFirstView, inStick); - SetStickToBottom(fSecondView, true); -} // CExpandoDivider::SetStickToBottom - -//----------------------------------- -void CExpandoDivider::ClickSelf(const SMouseDownEvent& inMouseDown) -//----------------------------------- -{ - if (GetExpandState() == open_state) Inherited::ClickSelf(inMouseDown); -} - -//----------------------------------- -void CExpandoDivider::AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent) -//----------------------------------- -{ - if (GetExpandState() == open_state) Inherited::AdjustCursorSelf(inPortPt, inMacEvent); -} - -//----------------------------------- -void CExpandoDivider::ChangeTwistiePosition(Int16 delta) -// Move the twistie and caption -//----------------------------------- -{ - mTwistie->MoveBy(0, delta, FALSE); - mCaption->MoveBy(0, delta, FALSE); -} // CExpandoDivider::ChangeTwistiePosition - -//----------------------------------- -void CExpandoDivider::ChangeDividerPosition(Int16 delta) -//----------------------------------- -{ - if (mExpandState == open_state && delta > 0) - { - // If the user drags the divider to the bottom, it should close the twistie. - Int32 dividerPos = this->GetDividerPosition(); - Int32 newPos = dividerPos + delta; - Rect secondFrame; - GetSubpaneRect(this, fSecondView, secondFrame); - if (newPos > secondFrame.bottom - 50) - { - mTwistie->SetValue(closed_state); - return; - } - } - Inherited::ChangeDividerPosition(delta); - ChangeTwistiePosition(delta); -} // CExpandoDivider::ChangeDividerPosition - -//----------------------------------- -void CExpandoDivider::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -//----------------------------------- -{ - Inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - // Unless we do this, there's no way to enforce the rule that the second pane's TOP - // sticks to the bottom when in the collapsed state. - if (mExpandState == closed_state && fFirstView && fSecondView) - { - SPoint32 loc1, loc2; - SDimension16 siz1, siz2; - fFirstView->GetFrameLocation(loc1); - fFirstView->GetFrameSize(siz1); - fSecondView->GetFrameLocation(loc2); - fSecondView->GetFrameSize(siz2); - Int32 secondViewOffset = siz1.height + loc1.v + mDivSize - loc2.v; - if (secondViewOffset) - { - fSecondView->MoveBy(0, secondViewOffset, false); - fSecondView->ResizeFrameBy(0, -secondViewOffset, false); - } - } -} // CExpandoDivider::ResizeFrameBy - -//----------------------------------- -void CExpandoDivider::SetExpandState(ExpandStateT inExpanded) -//----------------------------------- -{ -#if 0 - // We now assume that the my view's bottom is flush with the bottom of the - // second subview. - SPoint32 locMe, loc2; - SDimension16 sizMe, siz2; - GetFrameSize(sizMe); - GetFrameLocation(locMe); - fSecondView->GetFrameLocation(loc2); - fSecondView->GetFrameSize(siz2); - Assert_(loc2.v + siz2.height == locMe.v + sizMe.height); -#endif // DEBUG - - LWindow* win = LWindow::FetchWindowObject(GetMacPort()); - Rect winRect; - win->CalcPortFrameRect(winRect); // relative is fine - const Int16 statusBarHeight = this->GetCorrectDistanceFromBottom(); - const Int16 dividerDistanceFromBottom - = this->GetCorrectDividerDistanceFromBottom(); - Rect expandoRect; - this->CalcPortFrameRect(expandoRect); - - if (mExpandState != inExpanded) - StoreCurrentDimensions(); - mExpandState = inExpanded; - if (inExpanded) - { - // When expanded, topview, twistie and caption do not stick to the bottom. - mCaption->Hide(); - SetStickToBottom(false); - SyncFrameBindings(); - - - // The expanded twistie is not as high as the collapsed one, and the following - // adjustment allows us to have a narrower divider bar. - ChangeTwistiePosition(- kTwistiePixelDifference); - - // Now expand. The divider will pull the frame up. - RecallCurrentDimensions(); - - fSecondView->Show(); - } - else - { - ChangeTwistiePosition(+ kTwistiePixelDifference); - fSecondView->Hide(); - mCaption->Show(); - RecallCurrentDimensions(); - - } - // The following is a kludge to fix cases where the bottom of Message view - // can disappear under the bottom of the window, or where the divider containing - // the twistie icon can be a one-inch thick grey area just over the bottom of the window. - short vertError = (winRect.bottom - statusBarHeight) - expandoRect.bottom; - if (vertError != 0) - { - this->ResizeFrameBy(0, vertError, false); - } - if (!inExpanded) - { - vertError = (winRect.bottom - (expandoRect.top + dividerDistanceFromBottom)) - - this->GetDividerPosition(); - if (vertError != 0) - this->ChangeDividerPosition(vertError); - // When collapsed, topview, twistie and caption stick to the bottom. - SetStickToBottom(true); //¥¥¥ this line is not part of the kludge - } -} // CExpandoDivider::SetExpandedState - diff --git a/mozilla/cmd/macfe/central/CExpandoDivider.h b/mozilla/cmd/macfe/central/CExpandoDivider.h deleted file mode 100644 index 87c17a09148..00000000000 --- a/mozilla/cmd/macfe/central/CExpandoDivider.h +++ /dev/null @@ -1,136 +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. - */ - -#pragma once - -#include "divview.h" - -//----------------------------------- -class CExpansionData -// persistent data about both states of a CExpandable. -//----------------------------------- -{ -public: - virtual void ReadStatus(LStream* inStream) = 0; - virtual void WriteStatus(LStream* inStream) = 0; -}; // class CExpansionData - -enum { closed_state = false, open_state = true }; -typedef Boolean ExpandStateT; - -//====================================== -class CExpandable -//====================================== -{ -public: - virtual void ReadStatus(LStream* inStream); - virtual void WriteStatus(LStream* inStream); - ExpandStateT GetExpandState() const { return mExpandState; } - void NoteExpandState(ExpandStateT inExpanded) { mExpandState = inExpanded; } -protected: - virtual void SetExpandState(ExpandStateT inExpanded) = 0; -private: - virtual void StoreDimensions(CExpansionData& outState) = 0; - virtual void RecallDimensions(const CExpansionData& inState) = 0; -protected: - CExpandable(CExpansionData* closedState, CExpansionData* openState); - // clients that mix this class in should have two members that are - // CExpansionData, and pass the references in here. -protected: - void StoreCurrentDimensions(); - void RecallCurrentDimensions(); - void RecallOtherDimensions(); -protected: - ExpandStateT mExpandState; - CExpansionData* mStates[2]; -}; // class CExpandable - -//====================================== -class CExpandoListener : public LListener, public CExpandable -//====================================== -{ -public: - enum { msg_TwistieMessage = 'Twst' }; // Broadcast by twistie control - CExpandoListener( - CExpansionData* closedState, CExpansionData* openState) - : CExpandable(closedState, openState) {} - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - // Listen to the twistie -}; // class CExpandoListener - -//====================================== -class CDividerData : public CExpansionData -//====================================== -{ -public: - CDividerData(); - // default is set for the open state, because the closed state is in the PPOb. -// Overrides - virtual void ReadStatus(LStream* inStream); - virtual void WriteStatus(LStream* inStream); -// Data - SInt32 mDividerPosition; -}; // class CDividerData - -//====================================== -class CExpandoDivider : public LDividedView, public CExpandable -// This class acts like a divider between two panes, one above the other. -// In addition to the LDividedView behavior, it also has an "expando" twistie, that -// hides/shows the bottom pane. -//====================================== -{ -private: - typedef LDividedView Inherited; -public: - enum { class_ID = 'Expo' }; - CExpandoDivider(LStream* inStream); - virtual ~CExpandoDivider(); - -// PowerPlant overrides -protected: - virtual void FinishCreateSelf(); - virtual void ClickSelf(const SMouseDownEvent& inMouseDown); - virtual void AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent); -public: - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); -// CExpandable overrides -public: - virtual void SetExpandState(ExpandStateT inExpanded); - virtual void StoreDimensions(CExpansionData& outState); - virtual void RecallDimensions(const CExpansionData& inState); -// Special interfaces -public: - Int16 GetCorrectDistanceFromBottom() const { return mDistanceFromWindowBottom; } - Int16 GetCorrectDividerDistanceFromBottom() const - { return mDividerDistanceFromWindowBottom; } -// Down to business: -protected: - virtual void ChangeDividerPosition(Int16 delta); // also changes the twistie+caption - virtual void ChangeTwistiePosition(Int16 delta); // only changes the twistie+caption - void SetStickToBottom(LPane* inPane, Boolean inStick); - void SetStickToBottom(Boolean inStick); -// Data: -protected: - Int16 mDistanceFromWindowBottom; - Int16 mDividerDistanceFromWindowBottom; - LPane *mTwistie, *mCaption; - CDividerData mClosedData, mOpenData; -}; // class CExpandoDivider diff --git a/mozilla/cmd/macfe/central/CIconCache.cp b/mozilla/cmd/macfe/central/CIconCache.cp deleted file mode 100644 index 2c75e694176..00000000000 --- a/mozilla/cmd/macfe/central/CIconCache.cp +++ /dev/null @@ -1,331 +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. - */ - - -// -// CIconCache.cp -// Mike Pinkerton, Netscape Communications -// -// Contains the implementation of the CImageCache class which is a small cache of -// images which the FE can pull from with a low overhead. It's good for things -// such as using images for icons in the chrome. Note that this is very -// different from the XP image cache. -// -// The filename is old, owing back to the original name for this class, CIconCache -// -// To Do: -// ¥ Flush cache when it gets too full? -// - - -#include "CIconCache.h" -#include "net.h" -#include "mimages.h" -#include "proto.h" -#include "libevent.h" - - -// -// gImageCache -// -// Wrapper around our image cache global so we know it gets initialized correctly before anyone -// can call it. -// -CImageCache& gImageCache ( ) -{ - static CImageCache _gImageCache; - - return _gImageCache; - -} // gImageCache - - -#pragma mark - - - -ImageCacheData :: ImageCacheData ( const string & inURL ) - : mImage(NULL), mMask(NULL) -{ - mContext = new CIconContext ( inURL ); - if ( !mContext ) - throw bad_alloc(); -} - -ImageCacheData :: ~ImageCacheData ( ) -{ - DestroyFEPixmap ( mImage ); - DestroyFEPixmap ( mMask ); - delete mContext; -} - - -// -// CacheThese -// -// Copy whatever FE data (pixmaps, color tables, etc) we need to ensure we can still draw when -// imageLib cleans out the memory cache. Before that, however, be sure to tear down anything -// that already exists. -// -void -ImageCacheData :: CacheThese ( IL_Pixmap* inImage, IL_Pixmap* inMask ) -{ - // clean up what we allocate beforehand. - DestroyFEPixmap ( mImage ); - DestroyFEPixmap ( mMask ); - - DrawingState state; - StColorPenState::Normalize(); - PreparePixmapForDrawing ( inImage, inMask, true, &state ); - - // we use some trickery here to create the copy FE data structures for the image/mask pixmaps. - // Save the ones that are currently in use then call the callback which initially created them - // to go ahead and create new ones. Store the |client_data| fields internally (they are our - // new copies), and then put the old ones back leaving the image/mask untouched. - NS_PixMap* oldPixmap = mImage = NULL; - NS_PixMap* oldMask = mMask = NULL; - size_t imageWidth = 0, imageHeight = 0; - if ( inImage ) { - oldPixmap = static_cast(inImage->client_data); - imageWidth = inImage->header.width; - imageHeight = inImage->header.height; - } - if ( inMask ) - oldMask = static_cast(inMask->client_data); - _IMGCB_NewPixmap ( NULL, 0, *IconContext(), imageWidth, imageHeight, inImage, inMask ); - if ( inImage ) { - mImage = static_cast(inImage->client_data); - size_t imageSize = inImage->header.widthBytes * inImage->header.height; - ::BlockMoveData ( oldPixmap->image_buffer, mImage->image_buffer, imageSize ); - inImage->client_data = oldPixmap; - } - if ( inMask ) { - mMask = static_cast(inMask->client_data); - size_t maskSize = inMask->header.widthBytes * inMask->header.height; - ::BlockMoveData ( oldMask->image_buffer, mMask->image_buffer, maskSize ); - inMask->client_data = oldMask; - } - - DoneDrawingPixmap ( inImage, inMask, &state ); - -} // CacheThese - - -#pragma mark - - - -CImageCache :: CImageCache ( ) -{ - -} - - -CImageCache :: ~CImageCache ( ) -{ - //¥ need to dispose of all the images....but since this is only called at shutdown.... -} - - -// -// RequestIcon -// THROWS bad_alloc -// -// Make a request for an icon. Will start loading if not present, and the return result -// will be |kPutOnWaitingList|. If the data is already there in the cache, |kDataPresent| -// is returned. If the url being asked for is the empty string (""), return |kEmptyURL|. -// -CImageCache::ELoadResult -CImageCache :: RequestIcon ( const string & inURL, const LListener* inClient ) -{ - ELoadResult result; - - // first check to make sure URL is not "" - if ( ! inURL.length() ) - return kEmptyURL; - - ImageCacheData* data = mCache[inURL]; - if ( data ) { - if ( !data->ImageAvailable() && data->IconContext() ) { - // We're still loading. The cache is already on the notification list, so just - // add the caller. - data->AddListener ( const_cast(inClient) ); - result = kPutOnWaitingList; - } - else - result = kDataPresent; - } - else { - // not in cache yet, need to start loading this icon. Add the caller as a - // listener to the data class and add us a listener to the context. - data = new ImageCacheData(inURL); - if ( !data ) - throw bad_alloc(); - URL_Struct* urlStruct = NET_CreateURLStruct (inURL.c_str(), NET_DONT_RELOAD); - if ( !urlStruct ) - throw bad_alloc(); - - mCache[inURL] = data; - - data->IconContext()->AddListener ( this ); - data->AddListener ( const_cast(inClient) ); - data->IconContext()->SwitchLoadURL ( urlStruct, FO_PRESENT ); - - result = kPutOnWaitingList; - } - - return result; - -} // RequestIcon - - -// -// FetchImageData -// THROWS invalid_argument -// -// For images that are already loaded (RequestIcon() returned |kDataPresent|, get the data. -// -void -CImageCache :: FetchImageData ( const string & inURL, NS_PixMap** outImage, NS_PixMap** outMask ) -{ - ImageCacheData* data = mCache[inURL]; - if ( data ) { - *outImage = data->Image(); - *outMask = data->Mask(); - } - else - throw invalid_argument(inURL); - -} // FetchImageData - - -// -// DeferredDelete -// -// A mocha callback, called when mocha is done with the given context. We use this below to -// defer the deletion of an icon context. When we get here, we know imageLib is done with it -// so it is safe to delete it. -// -static void DeferredDelete ( CNSContext * context ) -{ - context->NoMoreUsers(); - -} // DeferredDelete - - -// -// ContextFinished -// -// Housecleaning. When a static image is finished, the context should go away -// but the data should remain. -// -void -CImageCache :: ContextFinished ( const MWContext* inContext ) -{ - // find the context in the cache (we don't have the url). Remember the cache - // contains CIconContext's and we are given an MWContext. Easy enough, though, - // because the MWContext contains a pointer back to the FE class in |fe.newContext| - typedef map::const_iterator CI; - CI it = mCache.begin(); - for ( ; it != mCache.end(); ++it ) { - CIconContext* currContext = (*it).second->IconContext(); - if ( currContext == inContext->fe.newContext ) - break; - } -// Assert_(it != mCache.end()); - - // null out the icon context stored w/in it. Don't delete it because it is - // still being used by imageLib??? - if ( it != mCache.end() ) { - (*it).second->IconContext()->RemoveAllListeners(); - - // We cannot delete the context now, because imageLib is still in the middle of - // using it. To get around this, we tell mocha to call us back when it is done with the - // context, which should be about the time of the next event loop. By then, all is well - // and the DeferredDelete() routine above will delete the context correctly. - XP_RemoveContextFromList ( *(*it).second->IconContext() ); - ET_RemoveWindowContext( *(*it).second->IconContext(), (ETVoidPtrFunc) DeferredDelete, (*it).second->IconContext() ); - - (*it).second->IconContextHasGoneAway(); - } -} - - - -// -// ListenerGoingAway -// -// a view might be going away before an image is finished loading. If that is -// the case, it needs to be removed from the context's listener list so we don't -// go telling dead objects their image has arrived. -// -void -CImageCache :: ListenerGoingAway ( const string & inURL, LListener* inObjectGoingAway ) -{ - ImageCacheData* data = mCache[inURL]; - if ( data && data->IconContext() ) - data->IconContext()->RemoveListener ( inObjectGoingAway ); - -} // ListenerGoingAway - - -// -// Flush -// -// clean out the cache when it gets too big. -// -void -CImageCache :: Flush() -{ - -} - - -// -// ListenToMessage -// -// Listen to messages from the icon context so we can display the image when imageLib gives us -// something to display. We have to make sure that we deep copy the FE portions of the image -// and mask so that when imagelib cleans out the memory cache, we still have the data we need -// to draw things. -// -void -CImageCache :: ListenToMessage ( MessageT inMessage, void* inData ) -{ - switch ( inMessage ) { - case CIconContext::msg_ImageReadyToDraw: - // NOTE: don't dispose |data| because it is on stack - IconImageData* data = static_cast(inData); - Assert_(data != NULL); - if ( data ) { - try { - ImageCacheData* iconData = mCache[data->url]; - if ( iconData ) { - // remember whatever we need and tell clients to draw - iconData->CacheThese ( data->image, data->mask ); - iconData->BroadcastMessage ( CIconContext::msg_ImageReadyToDraw, NULL ); - } - } - catch ( bad_alloc & ) { - //¥¥¥ couldn't allocate memory for item in cache, so don't cache it. Do we - //¥¥¥ need to tell anyone about this (unregister listeners, perhaps?) - } - } - break; - } - -} // ListenToMessage - diff --git a/mozilla/cmd/macfe/central/CIconCache.h b/mozilla/cmd/macfe/central/CIconCache.h deleted file mode 100644 index 728c12e8938..00000000000 --- a/mozilla/cmd/macfe/central/CIconCache.h +++ /dev/null @@ -1,130 +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. - */ - -// -// CIconCache.h -// Mike Pinkerton, Netscape Communications -// -// Contains the implementation of the CImageCache class which is a small cache of -// images which the FE can pull from with a low overhead. It's good for things -// such as using images for icons in the chrome. Note that this is very -// different from the XP image cache. -// -// The filename is old, owing back to the original name for this class, CIconCache -// - -#pragma once - -#include -#include -#include "CIconContext.h" -#include "il_types.h" -#include "mimages.h" - - -// -// class ImageCacheData -// -// Contains all the relevant data for an image loaded from a url (not an FE icon). The -// context controls the loading and notification of when the image has been loaded -// and keeps copies of the FE pixmap data so when imageLib cleans house, we're still ok. -// -class ImageCacheData : public LBroadcaster { -public: - ImageCacheData ( const string & inURL ) ; - ~ImageCacheData ( ) ; - - // Hold on tight to whatever we need to draw, making copies if necessary. - void CacheThese ( IL_Pixmap* inImage, IL_Pixmap* inMask ) ; - - CIconContext* IconContext ( ) const { return mContext; } ; - void IconContextHasGoneAway ( ) { mContext = NULL; } ; - - bool ImageAvailable ( ) { return mImage != NULL; } ; - - NS_PixMap* Image ( ) const { return mImage; } - NS_PixMap* Mask ( ) const { return mMask; } - -private: - - // declare these as private so no one can do them. - ImageCacheData ( const ImageCacheData & ) ; - ImageCacheData & operator= ( const ImageCacheData & ) ; - - NS_PixMap* mImage; - NS_PixMap* mMask; - - CIconContext* mContext; - -}; // struct ImageCacheData - - -// -// class CImageCache -// -// There should only be one of these in the entire application. Users make a request -// by asking the cache for a particular URL. If the URL is not loaded, a new icon context -// will be created and the caller will be placed on a list of listeners for when that -// image is ready to draw. If the image has already been loaded, the caller will either -// be placed on that listener list (for animating images) or be given the data directly -// (for static images). -// -class CImageCache : public LListener -{ -public: - enum ELoadResult { kDataPresent, kPutOnWaitingList, kEmptyURL } ; - - CImageCache ( ) ; - virtual ~CImageCache ( ) ; - - // Make a request for an icon. Will start loading if not present. If an - // empty string is passed in, this will return |kEmptyURL| and nothing - // will be loaded. - ELoadResult RequestIcon ( const string & inURL, const LListener* inClient ) ; - - // For images that are already loaded (RequestIcon() returned |kDataPresent|, - // get the data. - void FetchImageData ( const string & inURL, NS_PixMap** outImage, NS_PixMap** outMask ) ; - - // Housecleaning. When a static image is finished, the context should go away - // but the data should remain. - void ContextFinished ( const MWContext* inContext ) ; - - // a view might be going away before an image is finished loading. If that is - // the case, it needs to be removed from the context's listener list so we don't - // go telling dead objects their image has arrived. - void ListenerGoingAway ( const string & inURL, LListener* inObjectGoingAway ) ; - -private: - - // declare these private so no one can make a copy of the cache - CImageCache ( const CImageCache & ) ; - CImageCache & operator= ( const CImageCache & ) ; - - void ListenToMessage ( MessageT inMessage, void* inData ) ; - - // clean out the cache when it gets too big. - void Flush() ; - - map mCache; - -}; // class CImageCache - - -// global declaration of our icon cache -CImageCache& gImageCache ( ) ; diff --git a/mozilla/cmd/macfe/central/CIconContext.cp b/mozilla/cmd/macfe/central/CIconContext.cp deleted file mode 100644 index e52475aeed2..00000000000 --- a/mozilla/cmd/macfe/central/CIconContext.cp +++ /dev/null @@ -1,67 +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. - */ - -#include "CIconContext.h" -#include "mimages.h" - - -CIconContext :: CIconContext ( const string & inURL ) - : CNSContext ( MWContextIcon ), mURL(inURL) -{ - CreateImageContext( &mContext ); - mImageGroupContext = mContext.img_cx; - IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext); - -} - - -CIconContext :: ~CIconContext ( ) -{ - DestroyImageContext ( &mContext ); - -} - - -// -// DrawImage -// -// Let anyone who cares about this image know that we're ready for it to draw -// -void -CIconContext :: DrawImage ( IL_Pixmap* image, IL_Pixmap* mask ) -{ - IconImageData data ( image, mask, GetURL() ); - BroadcastMessage ( msg_ImageReadyToDraw, &data ); -} - - -// -// RemoveAllListeners -// -// Go through and get rid of everyone listening to us because there's no need for anyone -// to listen. -// -void -CIconContext :: RemoveAllListeners ( ) -{ - TArrayIterator iterator(mListeners); - LListener *theListener; - while (iterator.Next(theListener)) - RemoveListener(theListener); - -} // RemoveAllListeners diff --git a/mozilla/cmd/macfe/central/CIconContext.h b/mozilla/cmd/macfe/central/CIconContext.h deleted file mode 100644 index 1c79c32708d..00000000000 --- a/mozilla/cmd/macfe/central/CIconContext.h +++ /dev/null @@ -1,69 +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. - */ - -#pragma once - -#include -#include "CNSContext.h" -#include "il_types.h" - - -// -// IconImageData -// -// Used to pass around the image and the mask from the context to -// anyone who happens to be listening. -// -struct IconImageData { - IconImageData ( IL_Pixmap* inImage, IL_Pixmap* inMask, const string & inStr ) - : image(inImage), mask(inMask), url(inStr) { } ; - - const string & url; - IL_Pixmap* image; - IL_Pixmap* mask; -}; - - -// -// CIconContext -// -// A context that knows about loading and displaying images for the purposes -// of replacing icons in the FE. -// -class CIconContext : public CNSContext -{ -public: - enum { msg_ImageReadyToDraw = 'ImgD' } ; // data is IconImageData* - - CIconContext ( const string & inURL ) ; - virtual ~CIconContext ( ) ; - - virtual void DrawImage ( IL_Pixmap* image, IL_Pixmap* mask ) ; - - // access to the url this context is loading - const string & GetURL ( ) const { return mURL; } - string & GetURL ( ) { return mURL; } - - virtual void RemoveAllListeners ( ) ; - -private: - - IL_GroupContext *mImageGroupContext; - string mURL; - -}; // class CIconContext \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/CImageIconMixin.cp b/mozilla/cmd/macfe/central/CImageIconMixin.cp deleted file mode 100644 index 338cd863c0b..00000000000 --- a/mozilla/cmd/macfe/central/CImageIconMixin.cp +++ /dev/null @@ -1,199 +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. - */ - -// -// CImageIconMixin -// Mike Pinkerton, Netscape Communications -// -// When you have an object that wants to draw itself using an image (gif, jpeg, etc), -// just mix this class in and call the appropriate routines when you want to draw. -// Most importantly, this handles cleaning up when the object goes away if it has -// made a request for an image that has yet to arrive. -// - - -#include "CImageIconMixin.h" - - -CImageIconMixin :: CImageIconMixin ( const string & inURL ) - : mURL(inURL) -{ - -} - - -// -// destructor -// -// If we made a request to load an image and we have yet to display it, we get a -// message when the image is ready to draw. However, if we're going away, it would -// be bad for us to get that message at some point in the future. Make sure we -// are off the listener list for the image cache. -// -CImageIconMixin :: ~CImageIconMixin ( ) -{ - gImageCache().ListenerGoingAway ( mURL, this ); - -} - - -// -// ListenToMessage -// -// Listen for the update of image and then -// -void -CImageIconMixin :: ListenToMessage ( const MessageT inMessage, void* ioData ) -{ - if ( inMessage == CIconContext::msg_ImageReadyToDraw ) - ImageIsReady(); - -} // ListenToMessage - - -// -// DrawIcon -// -// Draw the image. Will begin loading it if the data has not yet arrived and will -// draw the standby in its place -// -void -CImageIconMixin :: DrawImage ( const Point & inTopLeft, IconTransformType inTransform, - Uint32 inWidth, Uint32 inHeight ) const -{ - try { - if ( gImageCache().RequestIcon(mURL, this) == CImageCache::kDataPresent ) { - StColorState::Normalize(); - - DrawingState state; - state.copyMode = srcCopy; - gImageCache().FetchImageData ( mURL, &state.pixmap, &state.mask ); - - LockFEPixmapBuffer ( state.pixmap ) ; - LockFEPixmapBuffer ( state.mask ); -//¥¥ do appropriate things for transform - DoDrawing ( state, inTopLeft, inTransform, inWidth, inHeight ) ; - UnlockFEPixmapBuffer ( state.mask ); - UnlockFEPixmapBuffer ( state.pixmap ) ; - } - else { - // icon not ready yet, just draw this thing.... - DrawStandby ( inTopLeft, inTransform ) ; - } - } - catch ( invalid_argument & ia ) { - DebugStr("\pData requested for something not in cache"); - DrawStandby ( inTopLeft, inTransform ) ; - } - catch ( bad_alloc & ba ) { - DebugStr("\pCould not allocate memory drawing icon"); - DrawStandby ( inTopLeft, inTransform ) ; - } - -} // DrawIcon - - -void -CImageIconMixin :: DoDrawing ( DrawingState & inState, const Point & inTopLeft, - IconTransformType inTransform, Uint32 inWidth, Uint32 inHeight ) const -{ - if ( inWidth == 0 && inHeight == 0 ) { - inWidth = inState.pixmap->pixmap.bounds.right; - inHeight = inState.pixmap->pixmap.bounds.bottom; - } - DrawScaledImage ( &inState, inTopLeft, 0, 0, inWidth, inHeight ); - -} // DoDrawing - - -// -// SetImageURL -// -// Change the url of the image to draw. We might be in the middle of loading another -// image when we get this call, so unregister ourselves. This does NOT re-request -// the new icon. -// -void -CImageIconMixin :: SetImageURL ( const string & inNewURL ) -{ - gImageCache().ListenerGoingAway ( mURL, this ); - mURL = inNewURL; - -} // SetImageURL - - -// -// GetImageDimensions -// -// If the image has been loaded, this returns true and the dimensions of the -// image in |outDimensions| -// -bool -CImageIconMixin :: GetImageDimensions ( SDimension16 & outDimensions ) -{ - bool imagePresent = false; - - try { - if ( gImageCache().RequestIcon(mURL, this) == CImageCache::kDataPresent ) { - - DrawingState state; - state.copyMode = srcCopy; - gImageCache().FetchImageData ( mURL, &state.pixmap, &state.mask ); - - outDimensions.width = state.pixmap->pixmap.bounds.right; - outDimensions.height = state.pixmap->pixmap.bounds.bottom; - - imagePresent = true; - } - } - catch ( invalid_argument & ia ) { - DebugStr("\pData requested for something not in cache"); - } - - return imagePresent; - -} // GetImageDimensions - - -#pragma mark - - - -CTiledImageMixin :: CTiledImageMixin ( const string & inURL ) - : CImageIconMixin ( inURL ) -{ -} - - -CTiledImageMixin :: ~CTiledImageMixin ( ) -{ -} - - -// -// DoDrawing -// -// Overloaded to draw a image as a tiled image for drawing backgrounds -// -void -CTiledImageMixin :: DoDrawing ( DrawingState & inState, const Point & inTopLeft, - IconTransformType inTransform, Uint32 inWidth, Uint32 inHeight ) const -{ - DrawTiledImage ( &inState, inTopLeft, 0, 0, inWidth, inHeight ); - -} // DoDrawing - diff --git a/mozilla/cmd/macfe/central/CImageIconMixin.h b/mozilla/cmd/macfe/central/CImageIconMixin.h deleted file mode 100644 index 957b37511a2..00000000000 --- a/mozilla/cmd/macfe/central/CImageIconMixin.h +++ /dev/null @@ -1,110 +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. - */ - -// -// CImageIconMixin -// Mike Pinkerton, Netscape Communications -// -// When you have an object that wants to draw itself using an image (gif, jpeg, etc), -// just mix this class in and call the appropriate routines when you want to draw. -// Most importantly, this handles cleaning up when the object goes away if it has -// made a request for an image that has yet to arrive. -// - -#pragma once - -#include - -#include "CIconCache.h" -#include "mimages.h" - - -// -// class CImageIconMixin -// -// Draw an image, most likely as an icon. -// -class CImageIconMixin : public LListener -{ -public: - - CImageIconMixin ( ) { } ; - CImageIconMixin ( const string & inURL ) ; - virtual ~CImageIconMixin ( ) ; - - // Change the url telling us which image to load. Safe to call even when an image - // load is pending, but will NOT re-request the new image. - virtual void SetImageURL ( const string & inNewURL ) ; - - // Draw the image. Will begin loading it if the data has not yet arrived and will - // draw the standby in its place. Pass zero's for width and height to use image defaults - // or the image will be scaled to what you put in. - void DrawImage ( const Point & inTopLeft, IconTransformType inTransform, - Uint32 inWidth, Uint32 inHeight ) const; - - // If the image has been loaded, this returns true and the dimensions of the - // image in |outDimensions| - bool GetImageDimensions ( SDimension16 & outDimensions ) ; - -protected: - - // catch the message that the image is ready to draw - virtual void ListenToMessage ( MessageT inMessage, void* ioPtr ) ; - - // called when the image is ready to draw. This should do something like - // refresh the view. - virtual void ImageIsReady ( ) = 0; - - // Draw a scaled image as an icon. Override to draw differently - virtual void DoDrawing ( DrawingState & inState, const Point & inTopLeft, - IconTransformType inTransform, Uint32 inWidth, - Uint32 inHeight ) const ; - - // Draw something when the real image is not yet here. - virtual void DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const = 0; - -private: - - string mURL; - -}; // class CImageIconMixin - - -// -// class CTiledImageMixin -// -// Tile an image, for use as backgrounds in chrome or tables -// -class CTiledImageMixin : public CImageIconMixin -{ -public: - - CTiledImageMixin ( ) { }; - CTiledImageMixin ( const string & inURL ) ; - virtual ~CTiledImageMixin ( ) ; - -protected: - - // Draw a image as a tiled image for drawing backgrounds. Width and Height are - // reinterpreted to mean the width and height of the area the image is being tiled - // in. - virtual void DoDrawing ( DrawingState & inState, const Point & inTopLeft, - IconTransformType inTransform, Uint32 inWidth, - Uint32 inHeight ) const ; - -}; // class CTiledImageMixin diff --git a/mozilla/cmd/macfe/central/CMochaHacks.cp b/mozilla/cmd/macfe/central/CMochaHacks.cp deleted file mode 100644 index 7766eae7ae0..00000000000 --- a/mozilla/cmd/macfe/central/CMochaHacks.cp +++ /dev/null @@ -1,336 +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. - */ - -/* - * macmocha.cp - * MacFE mocha hacks - * - */ - -#include "CMochaHacks.h" -#include "lo_ele.h" -#include "fe_proto.h" // for FE_DestroyWindow -#include "proto.h" // 1997-03-02 mjc -#include "layers.h" -#include "macutil.h" - -LO_Element* CMochaHacks::sMouseOverElement = NULL; // layout element the cursor is over -MWContext* CMochaHacks::sMouseOverElementContext = NULL; // context associated with sMouseOverElement -LO_AnchorData* CMochaHacks::sMouseOverMapArea = NULL; // AREA tag the cursor is over - -// is document-relative -void -CMochaHacks::SendOutOfElementEvent(MWContext * winContext, CL_Layer* layer, SPoint32 where) // add layer param 1997-03-02 mjc -{ - Assert_(winContext); - - try - { - if ( sMouseOverElement ) - { - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - // 97-06-21 pkc -- If we have an sMouseOverElementContext then use it - // instead of winContext - MWContext* theContext = sMouseOverElementContext ? sMouseOverElementContext : winContext; - event->type = EVENT_MOUSEOUT; - event->x = where.h; - event->y = where.v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - int32 x_offset, y_offset; - FE_GetWindowOffset(theContext, &x_offset, &y_offset); - event->screenx = event->docx + x_offset; - event->screeny = event->docy + y_offset; - event->layer_id = LO_GetIdFromLayer(theContext, layer); - ET_SendEvent( theContext, sMouseOverElement, event, NULL, NULL ); - sMouseOverElement = NULL; - sMouseOverElementContext = NULL; - } - } - - } - catch(...) - { - } -} - -void -CMochaHacks::SendOutOfMapAreaEvent(MWContext * winContext, CL_Layer* layer, SPoint32 where) // add layer param 1997-03-02 mjc -{ - Assert_(winContext); - - try - { - if ( sMouseOverMapArea ) - { - CMochaEventCallback * cb = new CMochaEventCallback; // Need it because of LO_AnchorData - cb->SendEvent( winContext, sMouseOverMapArea, EVENT_MOUSEOUT, layer, where ); - sMouseOverMapArea = NULL; - } - } - catch(...) - { - } -} - -// -// CMochaEventCallback -// -void -CMochaHacks::ResetMochaMouse() -{ - sMouseOverElement = NULL; - sMouseOverMapArea = NULL; -} - -// Returns mocha modifier bitset given mac modifiers. -uint32 -CMochaHacks::MochaModifiers(const UInt16 inModifiers) -{ - return ((inModifiers & shiftKey) ? EVENT_SHIFT_MASK : 0) | - ((inModifiers & controlKey) ? EVENT_CONTROL_MASK : 0) | - ((inModifiers & optionKey) ? EVENT_ALT_MASK : 0) | - ((inModifiers & cmdKey) ? EVENT_META_MASK : 0); -} - -// Returns mocha modifiers by reading the keyboard. -uint32 -CMochaHacks::MochaModifiersFromKeyboard(void) -{ - union - { - KeyMap asMap; - Byte asBytes[16]; - }; - - ::GetKeys(asMap); - return ((asBytes[kShiftKey >> 3] & (1 << (kShiftKey & 0x07))) ? EVENT_SHIFT_MASK : 0) | - ((asBytes[kCtlKey >> 3] & (1 << (kCtlKey & 0x07))) ? EVENT_CONTROL_MASK : 0) | - ((asBytes[kOptionKey >> 3] & (1 << (kOptionKey & 0x07))) ? EVENT_ALT_MASK : 0) | - ((asBytes[kCommandKey >> 3] & (1 << (kCommandKey & 0x07))) ? EVENT_META_MASK : 0); -} - - -// Returns true if the window is a dependent of another. -// Parameters: -// inContext: the context for this window. -Boolean -CMochaHacks::IsDependent(MWContext* inContext) -{ - return (inContext->js_parent != nil); -} - -// Add a window as a dependent of another. -// Called in FE_MakeNewWindow. -// Parameters: -// inParent: the parent context. -// inChild: the context for this window which will be made a dependent of the parent. -void -CMochaHacks::AddDependent(MWContext* inParent, MWContext* inChild) -{ - // inParent could be a grid context, but dependencies are between windows so find root context. - MWContext* theParentRoot = XP_GetNonGridContext(inParent); - if (theParentRoot != nil && inChild != nil) - { - if (theParentRoot->js_dependent_list == NULL) - theParentRoot->js_dependent_list = XP_ListNew(); - if (theParentRoot->js_dependent_list != NULL) - { - XP_ListAddObject(theParentRoot->js_dependent_list, inChild); - inChild->js_parent = theParentRoot; - } - } - -} - -// Remove dependents of the window. -// Called in destructor for window. -// Parameters: -// inContext: the context for this window. -void -CMochaHacks::RemoveDependents(MWContext* inContext) -{ - // FE_DestroyWindow makes this recursive; keep track of how many levels deep we are. - static int recursionLevel = 0; - ++recursionLevel; - if (inContext->js_dependent_list) - { - MWContext *depContext; - // destroy windows which are dependent on this window - for (int i = 1; i <= XP_ListCount(inContext->js_dependent_list); i++) - { - depContext = (MWContext *)XP_ListGetObjectNum(inContext->js_dependent_list, i); - FE_DestroyWindow(depContext); - } - XP_ListDestroy(inContext->js_dependent_list); - inContext->js_dependent_list = NULL; - } - --recursionLevel; - // remove self from parent's dependent list but only if we're the window - // at the top of the chain (don't alter lists we're iterating over). - if (recursionLevel == 0 && inContext->js_parent != nil) - { - if (XP_ListCount(inContext->js_parent->js_dependent_list) == 1) - { - // if the last element in the list, destroy the list. - XP_ListDestroy(inContext->js_parent->js_dependent_list); - inContext->js_parent->js_dependent_list = NULL; - } - else XP_ListRemoveObject(inContext->js_parent->js_dependent_list, inContext); - } -} - -// Send move event to mocha every time a window or pane is moved. -void -CMochaHacks::SendMoveEvent(MWContext* inContext, int32 inX, int32 inY) -{ - JSEvent *event; - - event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_MOVE; - event->x = inX; - event->y = inY; - } - ET_SendEvent(inContext, 0, event, 0, 0); -} - -// Send the event specified, with no callback. -void -CMochaHacks::SendEvent(MWContext* inContext, int32 inType, LO_Element* inElement) -{ - JSEvent *event; - event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = inType; - ET_SendEvent(inContext, inElement, event, 0, 0); - } -} - -// -// CMochaEventCallback -// - -#ifdef DEBUG -static int sCallbackCount = 0; -#endif - -CMochaEventCallback::CMochaEventCallback() -{ -#ifdef DEBUG - sCallbackCount++; -#endif - fDummyElement = NULL; -} - -CMochaEventCallback::~CMochaEventCallback() -{ -#ifdef DEBUG - sCallbackCount--; -#endif - if (fDummyElement != NULL) - XP_FREE( fDummyElement ); -} - -// -// Plain SendEvent -// -void -CMochaEventCallback::SendEvent(MWContext * context, LO_Element * element, int32 type, CL_Layer* layer, SPoint32 where) -{ - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = type; - event->x = where.h; - event->y = where.v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - int32 x_offset, y_offset; - FE_GetWindowOffset(context, &x_offset, &y_offset); - event->screenx = event->docx + x_offset; - event->screeny = event->docy + y_offset; - event->layer_id = LO_GetIdFromLayer(context, layer); - ET_SendEvent( context, element, event, MochaCallback, this); - // PR_Yield(); To speed up processing? - } -} - -// -// LO_AnchorData SendEvent -// -void -CMochaEventCallback::SendEvent(MWContext * context, LO_AnchorData * data, int32 type, CL_Layer* layer, SPoint32 where) -{ - // Create fake layout element - fDummyElement = XP_NEW_ZAP(LO_Element); - if (fDummyElement) - { - fDummyElement->type = LO_TEXT; - fDummyElement->lo_text.anchor_href = data; - fDummyElement->lo_text.text = data->anchor; - - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = type; - event->x = where.h; - event->y = where.v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - int32 x_offset, y_offset; - FE_GetWindowOffset(context, &x_offset, &y_offset); - event->screenx = event->docx + x_offset; - event->screeny = event->docy + y_offset; - event->layer_id = LO_GetIdFromLayer(context, layer); - ET_SendEvent( context, fDummyElement, event, MochaCallback, this); - } - } -} - -// -// EventComplete, does nothing -// -void -CMochaEventCallback::Complete(MWContext * /*context*/, LO_Element * /*element*/, - int32 /*type*/, ETEventStatus /*status*/) -{ -// EVENT_OK means we should handle the event/ -// EVENT_CANCEL, EVENT_PANIC, means mocha has cancelled the click -} - -// -// MochaCallback, called by mocha after event is processed -// -void CMochaEventCallback::MochaCallback(MWContext * context, LO_Element * element, - int32 type, void * inCallback, ETEventStatus status) -{ - CMochaEventCallback * callback = (CMochaEventCallback *) inCallback; - callback->Complete( context, element, type, status ); - delete callback; -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/CMochaHacks.h b/mozilla/cmd/macfe/central/CMochaHacks.h deleted file mode 100644 index 4d4350cf15f..00000000000 --- a/mozilla/cmd/macfe/central/CMochaHacks.h +++ /dev/null @@ -1,122 +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. - */ - -/* - * macmocha.h - * MacFE mocha hacks - * - */ - -#include "structs.h" // mjc -#include "libevent.h" - -/* - * static class that encapsulates most of the Macha hacks - */ -class CMochaHacks -{ -private: - static LO_Element* sMouseOverElement; // layout element the cursor is over - static MWContext* sMouseOverElementContext; // context associated with sMouseOverElement - static LO_AnchorData* sMouseOverMapArea; // AREA tag the cursor is over - -public: - static void SendOutOfElementEvent(MWContext * winContext, CL_Layer* layer, SPoint32 where); // add layer param 1997-03-02 mjc - static void SendOutOfMapAreaEvent(MWContext * winContext, CL_Layer* layer, SPoint32 where); // add layer param 1997-03-02 mjc - static void ResetMochaMouse(); - - static Boolean IsMouseOverElement(LO_Element* inElement) - { return inElement == sMouseOverElement; } - static Boolean IsMouseOverMapArea(LO_AnchorData* inAnchorData) - { return inAnchorData == sMouseOverMapArea; } - - static void SetMouseOverElement(LO_Element* inElement, MWContext* inElementContext = NULL) - { - sMouseOverElement = inElement; - sMouseOverElementContext = inElementContext; - } - static void RemoveReferenceToMouseOverElementContext(MWContext *context) - { - if (sMouseOverElementContext == context) - { - sMouseOverElementContext = NULL; - // It stands to reason that if the context is going away so is the element - sMouseOverElement = NULL; - // What the heck, null the map area also - sMouseOverMapArea = NULL; - } - } - static void SetMouseOverMapArea(LO_AnchorData* inAnchorData) - { sMouseOverMapArea = inAnchorData; } - - static LO_Element* GetMouseOverElement() - { return sMouseOverElement; } - static LO_AnchorData* GetMouseOverMapArea() - { return sMouseOverMapArea; } - - static uint32 MochaModifiers(const UInt16 inModifiers); - static uint32 MochaModifiersFromKeyboard(void); - - // manage windows declared as dependent in javascript - static Boolean IsDependent(MWContext* inContext); - static void AddDependent(MWContext* inParent, MWContext* inChild); - static void RemoveDependents(MWContext* inContext); - - // Whenever a window or frame moves or resizes send an event to javascript - static void SendMoveEvent(MWContext* inContext, int32 inX, int32 inY); - - static void SendEvent(MWContext* inContext, int32 inType, LO_Element* inElement = nil); - - // Send navigation events - currently not cancellable - static void SendBackEvent(MWContext* inContext) - { SendEvent(inContext, EVENT_BACK); } - - static void SendForwardEvent(MWContext* inContext) - { SendEvent(inContext, EVENT_FORWARD); } -}; - -/* - * CMochaEventCallback - * class that encapsulates sending of mocha events - * Subclasses should override EventComplete - */ - -class CMochaEventCallback { -public: - -// Constructors - CMochaEventCallback(); - virtual ~CMochaEventCallback(); - -// Mocha interface - void SendEvent(MWContext * context, LO_Element * element, int32 type, CL_Layer* layer, SPoint32 where); - void SendEvent(MWContext * context, LO_AnchorData * data, int32 type, CL_Layer* layer, SPoint32 where); - - // MochaCallback calls EventComplete. You'll be deleted after this call - virtual void Complete(MWContext * context, LO_Element * element, - int32 type, ETEventStatus status); - - static void MochaCallback(MWContext * context, LO_Element * element, - int32 type, void * inCallback, ETEventStatus status); - -private: -// Old Mocha calls used to accept either LO_Element, or LO_AnchorData -// New ones only accept LO_Element, so sometimes we need to create/dispose -// dummy layout elements. This is encapsulated in this class - LO_Element * fDummyElement; -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/CNSContext.cp b/mozilla/cmd/macfe/central/CNSContext.cp deleted file mode 100644 index e58c0e941a5..00000000000 --- a/mozilla/cmd/macfe/central/CNSContext.cp +++ /dev/null @@ -1,1364 +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. - */ - -// CNSContext.cp - - -#include "CNSContext.h" -#include "CNSContextCallbacks.h" -#include "CHTMLView.h" -#include "UStdDialogs.h" -#include "CURLEditField.h" -#include "CMochaHacks.h" - -/* #include */ - -#include "earlmgr.h" -/* #include "uprefd.h" */ -#include "xp.h" -#include "xp_thrmo.h" -#include "shist.h" -#include "glhist.h" -#include "libimg.h" -#include "np.h" -#include "libmime.h" -#include "libi18n.h" -#include "mimages.h" -#include "ufilemgr.h" -#include "java.h" -#include "layers.h" -#include "libevent.h" -#include "uerrmgr.h" -#include "resgui.h" -#include "uapp.h" // for CFrontApp::sHRes and CFrontApp::sVRes -#include "intl_csi.h" - -#if defined(SMOOTH_PROGRESS) -#include "progress.h" -#include "nsITransferListener.h" -#endif - -#include "mkhelp.h" - -// FIX ME -- write a CopyAlloc like function that takes a CString -#include "macutil.h" - -UInt32 CNSContext::sNSCWindowID = 1; // Unique ID, incremented for each context - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CONSTRUCTION / DESTRUCTION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CNSContext::CNSContext(MWContextType inType) -: mLoadRefCount(0) -, mCurrentCommand(cmd_Nothing) -{ - ::memset(&mContext, 0, sizeof(MWContext)); - - mContext.type = inType; - mContext.convertPixX = 1; - mContext.convertPixY = 1; - - // ¥¥¥ OK, here's the skinny on this preference. - // apparently, there *was* this preference for changing - // the way FTP sites are displayed, but no one can remember - // there being an actual UI for setting and changing it. - // and so, there *may* be people out there who are seeing FTP sites - // in different ways. For Dogbert, we think the right behavior is - // to show FTP sites 'fancy' always, and not carry the old value into - // the new version. - // - // ideally we'd like to remove all references to this now defunct - // preference from all the code, but that's a bit too much work for - // beta 2 and beyond, so simply setting this value to true is the short - // term solution. - // - // deeje 97-02-07 - mContext.fancyFTP = true; // CPrefs::GetBoolean(CPrefs::UseFancyFTP); - - mContext.fancyNews = CPrefs::GetBoolean(CPrefs::UseFancyNews); - - CNSContextCallbacks* theCallbacks = CNSContextCallbacks::GetContextCallbacks(); - Assert_(theCallbacks != NULL); - mContext.funcs = &(theCallbacks->GetInternalCallbacks()); - - mContext.fe.realContext = NULL; - mContext.fe.view = NULL; - mContext.fe.newContext = this; - mContext.fe.newView = NULL; - - mContext.pHelpInfo = NULL; - -// mLoadImagesOverride = false; -// mDelayImages = CPrefs::GetBoolean( CPrefs::DelayImages ); -// mIsRepaginating = false; -// mIsRepaginationPending = false; - mRequiresClone = false; - mProgress = NULL; - - // Allocate a private i18n record - mContext.INTL_CSIInfo = INTL_CSICreate(); - - // 97-09-17 pchen -- Call XP_InitializeContext function - XP_InitializeContext(&mContext); - - // FIX ME!!! need to add unique identifier - // So why doesn't it work the way it is? (cth) - fNSCWindowID = sNSCWindowID++; - - XP_AddContextToList(&mContext); -// SHIST_InitSession(&mContext); - - // 97-05-09 pkc -- initialize new MWContext field - mContext.fontScalingPercentage = 1.0; - - InitDefaultCSID(); - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(&mContext); - INTL_SetCSIDocCSID(csi, INTL_DefaultDocCharSetID(&mContext)); - INTL_SetCSIWinCSID(csi, INTL_DocToWinCharSetID(INTL_GetCSIDocCSID(csi))); - - // 97-05-12 pkc -- initialize XpixelsPerPoint and YpixelsPerPoint - mContext.XpixelsPerPoint = CFrontApp::sHRes / 72.0; - mContext.YpixelsPerPoint = CFrontApp::sVRes / 72.0; - - NET_CheckForTimeBomb(&mContext); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// this is a shallow copy. child contexts are not duplicated. -CNSContext::CNSContext(const CNSContext& inOriginal) -: mLoadRefCount(0) -{ - ::memset(&mContext, 0, sizeof(MWContext)); - - mContext.type = inOriginal.mContext.type; - mContext.convertPixX = inOriginal.mContext.convertPixX; - mContext.convertPixY = inOriginal.mContext.convertPixY; - mContext.fancyFTP = inOriginal.mContext.fancyFTP; - mContext.fancyNews = inOriginal.mContext.fancyNews; - - CNSContextCallbacks* theCallbacks = CNSContextCallbacks::GetContextCallbacks(); - Assert_(theCallbacks != NULL); - mContext.funcs = &(theCallbacks->GetInternalCallbacks()); - - mContext.fe.realContext = NULL; - mContext.fe.view = NULL; - mContext.fe.newContext = this; - mContext.fe.newView = NULL; - - mContext.pHelpInfo = NULL; - - // Allocate a private i18n record - mContext.INTL_CSIInfo = INTL_CSICreate(); - - // 97-09-17 pchen -- Call XP_InitializeContext function - XP_InitializeContext(&mContext); - -// mLoadImagesOverride = inOriginal.IsLoadImagesOverride(); -// mDelayImages = inOriginal.IsImageLoadingDelayed(); -// mIsRepaginating = inOriginal.IsRepaginating(); -// mIsRepaginationPending = inOriginal.IsRepagintaitonPending(); - - mProgress = inOriginal.mProgress; - if (mProgress != NULL) - mProgress->AddUser(this); - -#if defined(SMOOTH_PROGRESS) - mContext.progressManager = inOriginal.mContext.progressManager; - if (mContext.progressManager) - mContext.progressManager->AddRef(); -#endif - - mRequiresClone = false; -// FIX ME!!! need to make sure all things inited in the default ctor are done here - - // 97-05-14 pkc -- whoops, forgot to initialize this here. - mContext.fontScalingPercentage = inOriginal.mContext.fontScalingPercentage; - - // 97-05-12 pkc -- initialize XpixelsPerPoint and YpixelsPerPoint - mContext.XpixelsPerPoint = inOriginal.mContext.XpixelsPerPoint; - mContext.YpixelsPerPoint = inOriginal.mContext.YpixelsPerPoint; - - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(&mContext); - mDefaultCSID = inOriginal.GetDefaultCSID(); - INTL_SetCSIDocCSID(csi, inOriginal.GetDocCSID()); - INTL_SetCSIWinCSID(csi, inOriginal.GetWinCSID()); - SHIST_InitSession(&mContext); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -static void MochaDone ( CNSContext * context ) -{ - delete context; -} - -CNSContext::~CNSContext() -{ - CMochaHacks::RemoveReferenceToMouseOverElementContext(&mContext); - - // 97-06-06 mjc - remove the context from the global list in NoMoreUsers before calling mocha. - //XP_RemoveContextFromList(&mContext); - if (mContext.name != NULL) - { - XP_FREE(mContext.name); - mContext.name = NULL; - } - -#if defined(SMOOTH_PROGRESS) - PM_ReleaseProgressManager(*this); -#endif - - /* EA: Remove any help information associated with this context */ - if ((HelpInfoStruct *) mContext.pHelpInfo != NULL) { - if (((HelpInfoStruct *) mContext.pHelpInfo)->topicURL != NULL) { - XP_FREE(((HelpInfoStruct *) mContext.pHelpInfo)->topicURL); - ((HelpInfoStruct *) mContext.pHelpInfo)->topicURL = NULL; - } - - XP_FREE(mContext.pHelpInfo); - mContext.pHelpInfo = NULL; - } - - if (mContext.INTL_CSIInfo != NULL) - XP_FREE(mContext.INTL_CSIInfo); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::NoMoreUsers(void) -{ - // 97-06-13 mjc - Make sure applets are destroyed so they don't continue to post events to the mozilla event queue. - // This must be called before SHIST_EndSession, so java can find the applet context - // with which to destroy applets. Placing in the same sequence as on Windows. - LJ_DiscardEventsForContext(&mContext); - // We would rather to do this here instead of in the destruction - // sequence because this call will probably reuslt in some callbacks. - XP_InterruptContext(&mContext); - - // Do most of the work the destructor used to then call mocha to kill itself - if (mContext.defaultStatus != NULL) - XP_FREE(mContext.defaultStatus); - mContext.defaultStatus = NULL; - - LO_DiscardDocument(&mContext); - DestroyImageContext(&mContext); - SHIST_EndSession(&mContext); - - // Yikes. Before we dispose of the context, MAKE - // SURE THAT IT IS SCOURED. This uncovered a bug - // in grids... disposing of grid contexts did not - // remove their entry from the colormap associated - // with them. This never allowed the reference count - // on the colormap to go to zero. - - // dkc 1/18/96 - - FM_SetFlushable(&mContext, FALSE ); -#ifdef MOZ_MAIL_NEWS - MimeDestroyContextData(&mContext); -#endif // MOZ_MAIL_NEWS - -#if 0 // was: #ifdef LAYERS but the compositor is partly owned by CHTMLView, and so - // it's now sharable - if (mContext.compositor != NULL) - { - CL_DestroyCompositor(mContext.compositor); - mContext.compositor = NULL; - } -#endif - // 97-06-06 mjc - remove ourself from the global context list before calling mocha, - // or else mocha may try to access a partially destroyed context. - XP_RemoveContextFromList(&mContext); - // We'll do the deletion in MochaDone(), called back from here. - ET_RemoveWindowContext( &mContext, (ETVoidPtrFunc) MochaDone, this ); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ This is another useless banner that takes up space, but this one has text, at least. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::EnsureContextProgress() -{ - if (mProgress == NULL) - { - mProgress = new CContextProgress; - mProgress->AddUser(this); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CContextProgress* CNSContext::GetContextProgress(void) -{ - return mProgress; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetContextProgress(CContextProgress* inProgress) -{ - Assert_(mProgress == NULL); - mProgress = inProgress; - mProgress->AddUser(this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -cstring CNSContext::GetDescriptor(void) const -{ - cstring theName; - if (mContext.name != NULL) - theName = mContext.name; - - return theName; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetDescriptor(const char* inDescriptor) -{ - if (mContext.name != NULL) - XP_FREE(mContext.name); - - mContext.name = XP_STRDUP(inDescriptor); - ThrowIfNULL_(mContext.name); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetRequiresClone(Boolean inClone) -{ - mRequiresClone = inClone; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CNSContext::IsCloneRequired(void) const -{ - return mRequiresClone; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CContextProgress* CNSContext::GetCurrentProgressStats(void) -{ - return mProgress; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::UpdateCurrentProgressStats(void) -{ - // You shouldn't be calling this when we're not processing something - Assert_(mProgress != NULL); - BroadcastMessage(msg_NSCProgressUpdate, mProgress); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CHARACTER SET ACCESSORS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -extern Int16 DefaultDocCharSetIDFromFrontWindow(); - -void CNSContext::InitDefaultCSID(void) -{ - mDefaultCSID = DefaultDocCharSetIDFromFrontWindow(); - if(0 == mDefaultCSID ) - mDefaultCSID = INTL_DefaultDocCharSetID(0); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetDefaultCSID(Int16 inDefaultCSID) -{ - mDefaultCSID = inDefaultCSID; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CNSContext::GetDefaultCSID(void) const -{ - return mDefaultCSID; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CNSContext::GetDocCSID(void) const -{ - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo((MWContext *)&mContext); - return INTL_GetCSIDocCSID(csi); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetWinCSID(Int16 inWinCSID) -{ - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(&mContext); - INTL_SetCSIWinCSID(csi, inWinCSID); -} -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetDocCSID(Int16 inDocCSID) -{ - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(&mContext); - INTL_SetCSIDocCSID (csi, inDocCSID); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CNSContext::GetWinCSID(void) const -{ - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo((MWContext *)&mContext); - return INTL_GetCSIWinCSID(csi); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CNSContext::GetWCSIDFromDocCSID( - Int16 inDocCSID) -{ - if (inDocCSID == CS_DEFAULT) - inDocCSID = mDefaultCSID; - - return INTL_DocToWinCharSetID(inDocCSID); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- STATUS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -const char* CNSContext::GetDefaultStatus(void) const -{ - return mContext.defaultStatus; -} - -void CNSContext::ClearDefaultStatus() -{ - if (mContext.defaultStatus) - XP_FREE(mContext.defaultStatus); - mContext.defaultStatus = NULL; -} - -void CNSContext::SetStatus(const char* inStatus) -{ - Progress(inStatus); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- URL MANIPULATION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -cstring CNSContext::GetURLForReferral(void) -{ - cstring theCurrentURL; - - History_entry* theCurrentHist = SHIST_GetCurrent(&mContext.hist); - if (theCurrentHist != NULL) - { - if (theCurrentHist->origin_url != NULL) - theCurrentURL = theCurrentHist->origin_url; - else - theCurrentURL = theCurrentHist->address; - } - - return theCurrentURL; -} - -cstring CNSContext::GetCurrentURL(void) -{ - cstring theCurrentURL; - - History_entry* theCurrentHist = SHIST_GetCurrent(&mContext.hist); - if (theCurrentHist != NULL) - theCurrentURL = theCurrentHist->address; - - return theCurrentURL; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// PLEASE NOTE THAT THIS ROUTINE FREES THE URL_STRUCT!!! - -void CNSContext::SwitchLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat) -{ - // 98-09-15 (pinkerton) - // When we load a new url, the HTML can specify a target. If that target is not one of the existing - // named contexts, a new window will be created to load/display this url. In this case, it is totally - // unnecessary to call XP_InterruptContext() on the current context because we will be creating a brand - // new context for the new browser window. XP_IC() also has the side effect that it will stop animated - // gifs, etc -- it's not just unnecessary, it's just plain the wrong thing to do. - // - // So we check and see if we can find the named target in the context list. If we cannot, don't stop what - // the current context is doing because we will be opening up a new window to load it later. - MWContext* newContext = XP_FindNamedContextInList(&mContext, inURL->window_target); - if ( newContext ) { - if ((inURL->address != NULL) && XP_STRCMP(inURL->address, "about:document") != 0 /*&& XP_IsContextBusy( this->fHContext ) */) - XP_InterruptContext(&mContext); - } - - // Don't broadcast the notification that a copy of one or more messages - // will take place: just forward it to the EarlManager... If we broadcast - // it through the front-end, the Netscape icon doesn't stop spinning - // because we receive one more GetURL events than AllConnectionsComplete events. - if (XP_STRCMP(inURL->address, "mailbox:copymessages") == 0) - { - EarlManager::StartLoadURL(inURL, &mContext, inOutputFormat); - return; - } - - // This is a notification in which all clients are warned that a new URL is - // going to be loaded. Any client can nullify the load request by zeroing the ioParam. - Boolean bAllClientsHappy = true; - BroadcastMessage(msg_NSCConfirmLoadNewURL, &bAllClientsHappy); - if (!bAllClientsHappy) - { - NET_FreeURLStruct(inURL); - return; - } - - // Ok, no clients of this context objected to the load request. We will now - // notify them that a new load is about to take place. - - EnsureContextProgress(); - - // There are listeners that listen to several contexts (eg, spinning N in mail windows). - // This works by reference counting, and such listeners assume calls to - // SwitchLoadURL and AllConnectionsComplete are balanced. Each context must - // therefore ensure that they are, even if it is done artificially. - mLoadRefCount++; - - BroadcastMessage(msg_NSCStartLoadURL, inURL); - - // if we are going to named anchor, do not load from the net - Int32 theXPos, theYPos; - History_entry* theHist = SHIST_GetCurrent(&mContext.hist); - if ((theHist != NULL) && - (SHIST_GetIndex(&mContext.hist, theHist) != inURL->history_num) && // We are not reloading one page - (inURL->force_reload == 0) && - ((inOutputFormat == FO_PRESENT) || (inOutputFormat == FO_CACHE_AND_PRESENT)) && // And only if we want to display the result - (XP_FindNamedAnchor(&mContext, inURL, &theXPos, &theYPos))) - { - // ¥ no double redraw - SetDocPosition(0, theXPos, theYPos); - if (inURL->history_num == 0) - { - /* Create URL from prev history entry to preserve security, etc. */ - URL_Struct *theURLCopy = SHIST_CreateURLStructFromHistoryEntry(&mContext, theHist); - - /* Swap addresses. */ - char *temp = inURL->address; - inURL->address = theURLCopy->address; - theURLCopy->address = temp; - - /* Free old URL, and reassign. */ - NET_FreeURLStruct(inURL); - inURL = theURLCopy; - - SHIST_AddDocument(&mContext, SHIST_CreateHistoryEntry(inURL, theHist->title)); - } - else - SHIST_SetCurrent(&mContext.hist, inURL->history_num); - - GH_UpdateGlobalHistory(inURL); - NET_FreeURLStruct(inURL); - // ¥Êupdate global history for the named anchor & refresh them - XP_RefreshAnchors(); - - // Since this was not a net load, we need to signal all clients that the - // load in complete. - AllConnectionsComplete(); - } - else - { - // otherwise, go off the net - EarlManager::StartLoadURL(inURL, &mContext, inOutputFormat); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::ImmediateLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat) -{ - EnsureContextProgress(); - BroadcastMessage(msg_NSCStartLoadURL, inURL); - EarlManager::StartLoadURL(inURL, &mContext, inOutputFormat); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CALLBACK IMPLEMENTATION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -char* CNSContext::TranslateISOText( - int /* inCharset */, - char* inISOText) -{ - return inISOText; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::GraphProgressInit( - URL_Struct* /*inURL*/, - Int32 inContentLength) -{ - EnsureContextProgress(); - mProgress->mInitCount++; - - if (inContentLength <= 0) - mProgress->mUnknownCount++; - else - mProgress->mTotal += inContentLength; - - if (mProgress->mInitCount == 1) - { - mProgress->mStartTime = ::TickCount() / 60; - BroadcastMessage(msg_NSCProgressBegin, mProgress); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::GraphProgress( - URL_Struct* /*inURL*/, - Int32 inBytesReceived, - Int32 inBytesSinceLast, - Int32 inContentLength) -{ - EnsureContextProgress(); - - Uint32 theTotalBytes; - if ((mProgress->mUnknownCount > 0) || (inBytesReceived > inContentLength)) - theTotalBytes = 0; - else - theTotalBytes = mProgress->mTotal; - - mProgress->mRead += inBytesSinceLast; - - Uint32 theTime = ::TickCount() / 60; - const char* theMessage = XP_ProgressText(theTotalBytes, mProgress->mRead, mProgress->mStartTime, theTime); - - if (inContentLength > 0) - mProgress->mPercent = inBytesReceived / (double)inContentLength * 100; - else - mProgress->mPercent = -1; // this signifies and indefinite ammount - - if (theMessage != NULL) - { - mProgress->mMessage = theMessage; - BroadcastMessage(msg_NSCProgressUpdate, mProgress); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::GraphProgressDestroy( - URL_Struct* /*inURL*/, - Int32 inContentLength, - Int32 inTotalRead) -{ - Assert_(mProgress != NULL); - if (mProgress) - { - if (inContentLength <= 0 ) - mProgress->mUnknownCount--; - else - mProgress->mTotal -= inContentLength; - - mProgress->mRead -= inTotalRead; - - mProgress->mInitCount--; - if (mProgress->mInitCount == 0) - BroadcastMessage(msg_NSCProgressEnd, mProgress); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetProgressBarPercent( - Int32 inPercent) -{ - BroadcastMessage(msg_NSCProgressPercentChanged, &inPercent); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::Progress( - const char* inMessageText) -{ - // We MUST make a copy of this string, because of CStr255's finitely many buffers, - // one of which is used by the caller (NET_Progress). - char messageCopy[255]; - if ( inMessageText ) - XP_STRNCPY_SAFE(messageCopy, inMessageText, sizeof(messageCopy)); - else - messageCopy[0] = 0; - BroadcastMessage(msg_NSCProgressMessageChanged, messageCopy); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::Alert( - const char* inAlertText) -{ - CStr255 pmessage( inAlertText ); - - ConvertCRtoLF( pmessage ); // In fact, this function converts LF to CRs and - // that's what everybody is using it for. Well... - - StripDoubleCRs( pmessage ); - pmessage=NET_UnEscape(pmessage); - UStdDialogs::Alert(pmessage, eAlertTypeCaution); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::SetCallNetlibAllTheTime(void) -{ -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::ClearCallNetlibAllTheTime(void) -{ -} - -// A temporary abortion, we need this routine outside of MWContext function table -void XP_ClearCallNetlibAllTheTime(MWContext *) -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::UseFancyFTP(void) -{ - return mContext.fancyFTP; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::UseFancyNewsgroupListing(void) -{ - return CPrefs::GetBoolean(CPrefs::UseFancyNews); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -int CNSContext::FileSortMethod(void) -{ - return CPrefs::GetLong( CPrefs::FileSortMethod ); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::ShowAllNewsArticles(void) -{ - return CPrefs::GetBoolean( CPrefs::ShowAllNews ); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::Confirm( - const char* inMessage) -{ - CStr255 mesg(inMessage); - mesg = NET_UnEscape(mesg); - return UStdDialogs::AskOkCancel(mesg); -} - -PRBool XP_Confirm( MWContext * , const char * msg) -{ - CStr255 mesg(msg); - mesg = NET_UnEscape(mesg); - if ( UStdDialogs::AskOkCancel(mesg)) - return PR_TRUE; - else - return PR_FALSE; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::CheckConfirm( - const char* pConfirmMessage, - const char* pCheckMessage, - const char* pOKMessage, - const char* pCancelMessage, - XP_Bool* pChecked) -{ - CStr255 confirmMessage(pConfirmMessage), - checkMessage(pCheckMessage), - okMessage(pOKMessage), - cancelMessage(pCancelMessage); - return (UStdDialogs::CheckConfirm(confirmMessage, checkMessage, okMessage, cancelMessage, pChecked)); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::SelectDialog( - const char* pMessage, - char** pList, - int16* pCount) -{ - CStr255 message(pMessage); - return (UStdDialogs::SelectDialog(message, pList, pCount)); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -char* CNSContext::Prompt( - const char* inMessage, - const char* inDefaultText) -{ - return PromptWithCaption("", inMessage, inDefaultText); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -char* CNSContext::PromptWithCaption( - const char* inTitleBarText, - const char* inMessage, - const char* inDefaultText) -{ - char* result = NULL; - CStr255 mesg(inMessage), ioString(inDefaultText); - mesg = NET_UnEscape(mesg); - - if (UStdDialogs::AskStandardTextPrompt(inTitleBarText, mesg, ioString)) - { - if (ioString.Length() > 0) - { - result = (char*)XP_STRDUP((const char*)ioString); - } - } - - return result; -} - -char * XP_Prompt(MWContext * /* pContext */, const char *inMessage, const char * inDefaultText) -{ - char* result = NULL; - CStr255 mesg(inMessage), ioString(inDefaultText); - mesg = NET_UnEscape(mesg); - - if (UStdDialogs::AskStandardTextPrompt("", mesg, ioString)) - { - if (ioString.Length() > 0) - { - result = (char*)XP_STRDUP((const char*)ioString); - } - } - - return result; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -XP_Bool CNSContext::PromptUsernameAndPassword( - const char* inMessage, - char** outUserName, - char** outPassword) -{ - CStr255 mesg(inMessage), username, password; - if (UStdDialogs::AskForNameAndPassword(mesg, username, password)) - { - *outUserName = XP_STRDUP((const char*)username); - *outPassword = XP_STRDUP((const char*)password); - return true; - } - return false; -} - -PRBool XP_PromptUsernameAndPassword (MWContext * /* window_id */, - const char * message, - char ** outUserName, - char ** outPassword) -{ - CStr255 mesg(message), username, password; - if (UStdDialogs::AskForNameAndPassword(mesg, username, password)) - { - *outUserName = XP_STRDUP((const char*)username); - *outPassword = XP_STRDUP((const char*)password); - return PR_TRUE; - } - return PR_FALSE; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -char* CNSContext::PromptPassword( - const char* inMessage) -{ - CStr255 message(inMessage), password; - if (UStdDialogs::AskForPassword(message, password)) - return XP_STRDUP((const char*)password); - return nil; -} - -char *XP_PromptPassword(MWContext */* pContext */, const char *pMessage) -{ - CStr255 message(pMessage), password; - if (UStdDialogs::AskForPassword(message, password)) - return XP_STRDUP((const char*)password); - return nil; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::AllConnectionsComplete(void) -{ -// mIsRepaginating = false; - // For certain contexts (i.e. biff context), we don't get - // a start loading URL call, so mProgress is NULL - if (mProgress) - { - mProgress->RemoveUser(this); - mProgress = NULL; - } - -#if defined(SMOOTH_PROGRESS) - PM_ReleaseProgressManager(*this); -#endif - - XP_RefreshAnchors(); - BroadcastMessage(msg_NSCAllConnectionsComplete); - -// if (mContext.type == MWContextMail) - { - // There are listeners that listen to several contexts (eg, in mail windows). - // This works by reference counting, and such listeners assume calls to - // SwitchLoadURL and AllConnectionsComplete are balanced. Each context must - // therefore ensure that they are, even if it is done artificially. - for (mLoadRefCount--; mLoadRefCount > 0; mLoadRefCount--) - BroadcastMessage(msg_NSCAllConnectionsComplete); - // decrement the ref count on the spinning-N the same number of times - // as we incremented it. - } - mLoadRefCount = 0; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- PROGRESS STATISTICS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -CContextProgress::CContextProgress() -{ - mTotal = 0; - mRead = 0; // How many have been read - mUnknownCount = 0; // How many connections of the unknown length do we have - mPercent = 0; - mStartTime = 0; - mInitCount = 0; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- STUFF --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// SIGH!!!!! -extern int MK_OUT_OF_MEMORY; - -void CNSContext::CompleteLoad(URL_Struct* inURL, int inStatus) -{ - if ( inStatus < 0 ) - { - if ( inURL->error_msg ) - { -// FIX ME!!! If anyone ever redoes progress process apple events this code needs -// to be re-enabled -// if (HasProgressProcess()) -// { -// fDidSetProgressPercent = FALSE; -// SendMakingProgressEvent(nurl->error_msg, 0); -// } -// else - ErrorManager::PlainAlert( inURL->error_msg, NULL, NULL, NULL ); - } - Progress(""); - } - if ( inStatus == MK_OUT_OF_MEMORY ) - { - XP_InterruptContext( *this ); - ErrorManager::PlainAlert( NO_MEM_LOAD_ERR_RESID ); - } - - if (inStatus == MK_CHANGING_CONTEXT) - Progress((const char*)GetCString(DOWNLD_CONT_IN_NEW_WIND)); -} - -// Clear fe.newView inside MWContext -// This is so that we can catch XP code trying to layout in a -// window that's been destroyed. -void CNSContext::ClearMWContextViewPtr(void) -{ - mContext.fe.newView = NULL; -} - -void CNSContext::WaitWhileBusy() -{ - EventRecord stupidNullEvent = {0}; - while (XP_IsContextBusy(*this)) - { - ThrowIf_(CmdPeriod()); - TheEarlManager.SpendTime(stupidNullEvent); - } -} // CNSContext::WaitWhileBusy - - -void CNSContext::CopyListenersToContext(CNSContext* aSubContext) // used when spawning grid contexts -{ - // give this grid context all the same listeners as the parent context - // deeje 97-02-12 - CHTMLView* theRootView = ExtractHyperView(*this); - - LArrayIterator iterator(mListeners); - LListener *theListener; - while (iterator.Next(&theListener)) - { - CURLEditField* urlField = dynamic_cast(theListener); - if (urlField == NULL && theListener != theRootView) - { - aSubContext->AddListener(theListener); - } - } -} - -MWContext* CNSContext::CreateNewDocWindow(URL_Struct* inURL ) -{ - CURLDispatcher::DispatchURL(inURL, nil); - return NULL; -} - -History_entry* CNSContext::GetCurrentHistoryEntry() -{ - return SHIST_GetCurrent(&mContext.hist); -} - -Int32 CNSContext::GetHistoryListCount(void) -{ - Int32 count = 0; - XP_List* historyList = SHIST_GetList(&mContext); - if (historyList) - count = XP_ListCount(historyList); - return count; -} - -Int32 CNSContext::GetIndexOfCurrentHistoryEntry(void) -{ - Int32 index = 0; - History_entry* theCurrentHist = GetCurrentHistoryEntry(); - if (theCurrentHist != NULL) - index = SHIST_GetIndex(&mContext.hist, theCurrentHist); - return index; -} - -// inIndex is one-based -cstring* CNSContext::GetHistoryEntryTitleByIndex(Int32 inIndex) -{ - cstring* title = NULL; - History_entry* theCurrentHist = SHIST_GetObjectNum(&mContext.hist, inIndex); - if (theCurrentHist != NULL) - { - try { - title = new cstring; - *title = theCurrentHist->title; - } catch (...) { - } - } - return title; -} - -void CNSContext::GetHistoryURLByIndex(cstring& outURL, Int32 inIndex) -{ - History_entry* theEntry = SHIST_GetObjectNum(&mContext.hist, inIndex); - if (theEntry) - { - outURL = theEntry->address; - } - else - { - throw IndexOutOfRangeException(); - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- STUBS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CNSContext::LayoutNewDocument( - URL_Struct* /* inURL */, - Int32* /* inWidth */, - Int32* /* inHeight */, - Int32* /* inMarginWidth */, - Int32* /* inMarginHeight */) {} -void CNSContext::SetDocTitle(char* /* inTitle */) {} -void CNSContext::FinishedLayout(void) {} -int CNSContext::GetTextInfo( - LO_TextStruct* /* inText */, - LO_TextInfo* /* inTextInfo */) { return 1; } -int CNSContext::MeasureText( - LO_TextStruct* /* inText */, - short* /* outCharLocs */) { return 0; } -void CNSContext::GetEmbedSize( - LO_EmbedStruct* /* inEmbedStruct */, - NET_ReloadMethod /* inReloadMethod */) {} -void CNSContext::GetJavaAppSize( - LO_JavaAppStruct* /* inJavaAppStruct */, - NET_ReloadMethod /* inReloadMethod */) {} -void CNSContext::GetFormElementInfo(LO_FormElementStruct* /* inElement */) {} -void CNSContext::GetFormElementValue( - LO_FormElementStruct* /* inElement */, - XP_Bool /*inHide */, - XP_Bool /*inSubmit */) {} -void CNSContext::ResetFormElement(LO_FormElementStruct* /* inElement */) {} -void CNSContext::SetFormElementToggle( - LO_FormElementStruct* /* inElement */, - XP_Bool /* inToggle */) {} -void CNSContext::FreeEmbedElement(LO_EmbedStruct* /* inEmbedStruct */) {} -void CNSContext::CreateEmbedWindow(NPEmbeddedApp* /* inEmbeddedApp */) {} -void CNSContext::SaveEmbedWindow(NPEmbeddedApp* /* inEmbeddedApp */) {} -void CNSContext::RestoreEmbedWindow(NPEmbeddedApp* /* inEmbeddedApp */) {} -void CNSContext::DestroyEmbedWindow(NPEmbeddedApp* /* inEmbeddedApp */) {} -void CNSContext::FreeJavaAppElement(LJAppletData* /* inAppletData */) {} -void CNSContext::HideJavaAppElement(LJAppletData* /* inAppletData */) {} -void CNSContext::FreeEdgeElement(LO_EdgeStruct* /* inEdgeStruct */) {} -void CNSContext::FormTextIsSubmit(LO_FormElementStruct* /* inElement */) {} -void CNSContext::DisplaySubtext( - int /* inLocation */, - LO_TextStruct* /* inText */, - Int32 /* inStartPos */, - Int32 /* inEndPos */, - XP_Bool /* inNeedBG */) {} -void CNSContext::DisplayText( - int /* inLocation */, - LO_TextStruct* /* inText */, - XP_Bool /* inNeedBG */) {} -void CNSContext::DisplayEmbed( - int /* inLocation */, - LO_EmbedStruct* /* inEmbedStruct */) {} -void CNSContext::DisplayJavaApp( - int /* inLocation */, - LO_JavaAppStruct* /* inJavaAppStruct */) {} -void CNSContext::DisplayEdge ( - int /* inLocation */, - LO_EdgeStruct* /* inEdgeStruct */) {} -void CNSContext::DisplayTable( - int /* inLocation */, - LO_TableStruct* /* inTableStruct */) {} -void CNSContext::DisplayCell( - int /* inLocation */, - LO_CellStruct* /* inCellStruct */) {} -void CNSContext::InvalidateEntireTableOrCell( - LO_Element* /* inElement */) {} -void CNSContext::DisplayAddRowOrColBorder( - XP_Rect* /* inRect */, - XP_Bool /* inDoErase */) {} -void CNSContext::DisplaySubDoc( - int /* inLocation */, - LO_SubDocStruct* /* inSubdocStruct */) {} -void CNSContext::DisplayLineFeed( - int /* inLocation */, - LO_LinefeedStruct* /* inLinefeedStruct */, - XP_Bool /* inNeedBG */) {} -void CNSContext::DisplayHR( - int /* inLocation */, - LO_HorizRuleStruct* /* inRuleStruct */) {} -void CNSContext::DisplayBullet( - int /* inLocation */, - LO_BullettStruct* /* inBullettStruct */) {} -void CNSContext::DisplayFormElement( - int /* inLocation */, - LO_FormElementStruct* /* inFormElement */) {} -void CNSContext::DisplayBorder( - int /* inLocation */, - int /* inX */, - int /* inY */, - int /* inWidth */, - int /* inHeight */, - int /* inBW */, - LO_Color* /* inColor */, - LO_LineStyle) /* inStyle */ {} -void CNSContext::DisplayFeedback( - int /* inLocation */, - LO_Element_struct* /* inElement */) /* inStyle */ {} -void CNSContext::UpdateEnableStates() {} -void CNSContext::ClearView(int /* inWhich */) {} -void CNSContext::SetDocDimension( - int /* inLocation */, - Int32 /* inWidth */, - Int32 /* inLength */) {} -void CNSContext::SetDocPosition( - int /* inLocation */, - Int32 /* inX */, - Int32 /* inY */) {} -void CNSContext::GetDocPosition( - int /* inLocation */, - Int32* /* outX */, - Int32* /* outY */) {} -void CNSContext::BeginPreSection(void) {} -void CNSContext::EndPreSection(void) {} -void CNSContext::SetBackgroundColor( - Uint8 /* inRed */, - Uint8 /* inGreen */, - Uint8 /* inBlue */) {} -void CNSContext::EnableClicking(void) {} -void CNSContext::EraseBackground( - int /* inLocation */, - Int32 /* inX */, - Int32 /* inY */, - Uint32 /* inWidth */, - Uint32 /* inHieght */, - LO_Color* /* inColor */) {} -void CNSContext::SetDrawable(CL_Drawable* /* inDrawable */) {} -void CNSContext::GetTextFrame( - LO_TextStruct* /* inTextStruct */, - Int32 /* inStartPos */, - Int32 /* inEndPos */, - XP_Rect* /* outFrame */) {} -void CNSContext::GetDefaultBackgroundColor( - LO_Color* /* outColor */) const {} -void CNSContext::DrawJavaApp( - int /*inLocation*/, - LO_JavaAppStruct* /*inJavaAppStruct*/) {} -void CNSContext::HandleClippingView( - struct LJAppletData* /*appletD*/, - int /*x*/, - int /*y*/, - int /*width*/, - int /*height*/) {} -void CNSContext::FreeBuiltinElement( - LO_BuiltinStruct * /*inBuiltinStruct*/) {} -void CNSContext::DisplayBuiltin( - int /*inLocation*/, - LO_BuiltinStruct* /*inBuiltinStruct*/) {} - diff --git a/mozilla/cmd/macfe/central/CNSContext.h b/mozilla/cmd/macfe/central/CNSContext.h deleted file mode 100644 index bc65f7e2629..00000000000 --- a/mozilla/cmd/macfe/central/CNSContext.h +++ /dev/null @@ -1,546 +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. - */ - -// CNSContext.h - - -#pragma once - - -#include -#include - -#include "structs.h" -#include "cstring.h" - -class CHTMLView; -class CNSContext; - - -inline CNSContext* ExtractNSContext(MWContext* inContext) - { return inContext->fe.newContext; } - -inline const CNSContext* ExtractConstNSContext(const MWContext* inContext) - { return inContext->fe.newContext; } - -inline CHTMLView* ExtractHyperView(const MWContext* inContext) - { return inContext->fe.newView; } - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// This enumeration contains all of the possible broadcast messages that -// a CNSContext can give. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -enum { - // These messages notify thge clients about the layout state. - msg_NSCDocTitleChanged = 'DTCG', // cstring* theNewTitle - msg_NSCInternetKeywordChanged = 'IKEY', // char* keyword - msg_NSCLayoutNewDocument = 'LOND', // URL_Struct* theURL - msg_NSCFinishedLayout = 'FNLO', // < none > - - // These messages notify thge clients about the repagination state. - msg_NSCPEmptyRepagination = 'NLPG', // < none > - msg_NSCPAboutToRepaginate = 'ABPG', // < none > - msg_NSCPEditorRepaginate = 'EDPG', // < none > - - // These messages are key to the whole process of loading a URL. - // The start loading and all connections complete notifications are - // guaranteed to be symmetrical. - msg_NSCStartLoadURL = 'SLUB', // URL_Struct* theURL - msg_NSCConfirmLoadNewURL = 'CLNU', // Boolean* - msg_NSCAllConnectionsComplete = 'ACCP', // < none > - - // A message to all context clients that this grid context is about to die. - // Clients should clean up and remove their shared references to the context - // upon receiving this message. - msg_NSCGridContextPreDispose = 'GCPD', // Boolean* isSavingHistory - - // A message to all context clients that a child grid context has been - // created or disposed. Clients will want to know if a grid is created - // so that they can add themselves as a listener or add a shared reference - // to the new context. - msg_NSCGridContextCreated = 'GCCR', // CNSContext* new grid - msg_NSCGridContextDisposed = 'GCDP', // < none > - - // Progress notifications, like the url loading notifications are - // guaranteed to be symmetric. There will always be one begin, - // n updates, and one end notification. - msg_NSCProgressBegin = 'PGST', // CContextProgress* - msg_NSCProgressUpdate = 'PGUP', // CContextProgress* - msg_NSCProgressEnd = 'PGED', // CContextProgress* - - // These are progress messages that are not guaranteed to be sent - // between bind and end progress notifications. -// msg_NSCProgressMessageChanged = 'PGMC', // cstring* theNewMessage - msg_NSCProgressMessageChanged = 'PGMC', // const char* theNewMessage - msg_NSCProgressPercentChanged = 'PGPC' // Int32* theNewPercent -}; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// The progress of a particular url loading operation is encapsulated in the -// following object. Accessors are provided in the context to support this. -// This object is only instantiated during the actual load itself, begining -// with msg_NSCStartLoadURL notification and ending with the -// msg_NSCAllConnectionsComplete notification. At all other (inactive) times -// the accessors for this object will return NULL. See the accessor comments -// for further information. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CContextProgress : public LSharable -{ - public: - CContextProgress(); - - Int32 mTotal; // Total bytes tracked - Int32 mRead; // How many have been read - Int32 mUnknownCount; // How many connections of the unknown length do we have - Int32 mPercent; // Percent complete - Int32 mInitCount; - Uint32 mStartTime; - - cstring mAction; - cstring mMessage; - cstring mComment; -}; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CNSContext : public LBroadcaster, public LSharable -{ - friend class CNSContextCallbacks; - friend class CPlainTextConversionContext; - - public: - CNSContext(MWContextType inType); - CNSContext(const CNSContext& inOriginal); - - virtual ~CNSContext(); - - virtual void NoMoreUsers(); - - operator MWContext*(); - operator const MWContext*() const; - operator MWContext&(); - operator const MWContext&() const; - - virtual CContextProgress* GetContextProgress(); - - protected: - virtual void SetContextProgress(CContextProgress* inProgress); - public: - void EnsureContextProgress(); - - virtual cstring GetDescriptor() const; - virtual void SetDescriptor(const char* inDescriptor); - - virtual Boolean IsCloneRequired() const; - virtual void SetRequiresClone(Boolean inClone); - - virtual CContextProgress* GetCurrentProgressStats(); - virtual void UpdateCurrentProgressStats(); - - virtual void WaitWhileBusy(); - -// FIX ME!!! ACCESSOR for unique ID - - // CHARACTER SET ACCESSORS - - void InitDefaultCSID(); - virtual void SetDefaultCSID(Int16 inDefaultCSID); - virtual Int16 GetDefaultCSID() const; - virtual void SetDocCSID(Int16 inDocCSID); - virtual Int16 GetDocCSID() const; - virtual void SetWinCSID(Int16 inWinCSID); - virtual Int16 GetWinCSID() const; - virtual Int16 GetWCSIDFromDocCSID( - Int16 inDocCSID); - - - class IndexOutOfRangeException { }; - virtual History_entry* GetCurrentHistoryEntry(); - virtual Int32 GetHistoryListCount(); - virtual cstring* GetHistoryEntryTitleByIndex(Int32 inIndex); // one-based index - virtual Int32 GetIndexOfCurrentHistoryEntry(); - virtual void GetHistoryURLByIndex(cstring& outURL, Int32 inIndex); // one-based index - - // URL MANIPULATION - // 97-10-29 pchen -- Fix bug #90892, prefer origin_url in history entry to address - virtual cstring GetURLForReferral(); - - virtual cstring GetCurrentURL(); - - virtual void SwitchLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat); - - virtual void ImmediateLoadURL( - URL_Struct* inURL, - FO_Present_Types inOutputFormat); - - // Need to make Alert public because we need to be able to call it from FE_Alert - virtual void Alert( - const char* inAlertText); - - // STATUS - - virtual const char* GetDefaultStatus() const; - virtual void ClearDefaultStatus(); - virtual void SetStatus(const char* inStatus); - - // STUFF - virtual void CompleteLoad(URL_Struct* inURL, int inStatus); - virtual void ClearMWContextViewPtr(); - - virtual void CopyListenersToContext(CNSContext* aSubContext); // used when spawning grid contexts - - protected: - - - // CALLBACK IMPLEMENTATION - - virtual MWContext* CreateNewDocWindow( - URL_Struct* inURL); - - virtual void LayoutNewDocument( - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight); - - virtual void SetDocTitle( - char* inTitle); - - virtual void FinishedLayout(); - - virtual char* TranslateISOText( - int inCharset, - char* inISOText); - - virtual int GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* inTextInfo); - - virtual int MeasureText( - LO_TextStruct* inText, - short* outCharLocs); - - virtual void GetEmbedSize( - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod inReloadMethod); - - virtual void GetJavaAppSize( - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod); - - virtual void GetFormElementInfo( - LO_FormElementStruct* inElement); - - virtual void GetFormElementValue( - LO_FormElementStruct* inElement, - XP_Bool inHide, - XP_Bool inSubmit); - - virtual void ResetFormElement( - LO_FormElementStruct* inElement); - - virtual void SetFormElementToggle( - LO_FormElementStruct* inElement, - XP_Bool inToggle); - - virtual void FreeEmbedElement( - LO_EmbedStruct* inEmbedStruct); - - virtual void CreateEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void SaveEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void RestoreEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void DestroyEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void FreeJavaAppElement( - LJAppletData* inAppletData); - - virtual void HideJavaAppElement( - LJAppletData* inAppletData); - - virtual void FreeEdgeElement( - LO_EdgeStruct* inEdgeStruct); - - virtual void FormTextIsSubmit( - LO_FormElementStruct* inElement); - - virtual void DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG); - - virtual void DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG); - - virtual void DisplayEmbed( - int inLocation, - LO_EmbedStruct* inEmbedStruct); - - virtual void DisplayJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - virtual void DisplayEdge ( - int inLocation, - LO_EdgeStruct* inEdgeStruct); - - virtual void DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct); - - virtual void DisplayCell( - int inLocation, - LO_CellStruct* inCellStruct); - - virtual void InvalidateEntireTableOrCell( - LO_Element* inElement); - - virtual void DisplayAddRowOrColBorder( - XP_Rect* inRect, - XP_Bool inDoErase); - - virtual void DisplaySubDoc( - int inLocation, - LO_SubDocStruct* inSubdocStruct); - - virtual void DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG); - - virtual void DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct); - - virtual void DisplayBullet( - int inLocation, - LO_BullettStruct* inBullettStruct); - - virtual void DisplayFormElement( - int inLocation, - LO_FormElementStruct* inFormElement); - - virtual void DisplayBorder( - int inLocation, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle); - - virtual void UpdateEnableStates(); - - virtual void DisplayFeedback( - int inLocation, - LO_Element* inElement); - - virtual void ClearView( - int inWhich); - - virtual void SetDocDimension( - int inLocation, - Int32 inWidth, - Int32 inLength); - - virtual void SetDocPosition( - int inLocation, - Int32 inX, - Int32 inY); - - virtual void GetDocPosition( - int inLocation, - Int32* outX, - Int32* outY); - - virtual void BeginPreSection(); - - virtual void EndPreSection(); - - virtual void SetProgressBarPercent( - Int32 inPercent); - - virtual void SetBackgroundColor( - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue); - -public: - virtual void Progress( - const char* inMessageText); -protected: - virtual void SetCallNetlibAllTheTime(); - - virtual void ClearCallNetlibAllTheTime(); - - virtual void GraphProgressInit( - URL_Struct* inURL, - Int32 inContentLength); - - virtual void GraphProgressDestroy( - URL_Struct* inURL, - Int32 inContentLength, - Int32 inTotalRead); - - virtual void GraphProgress( - URL_Struct* inURL, - Int32 inBytesReceived, - Int32 inBytesSinceLast, - Int32 inContentLength); - - virtual XP_Bool UseFancyFTP(); - - virtual XP_Bool UseFancyNewsgroupListing(); - - virtual int FileSortMethod(); - - virtual XP_Bool ShowAllNewsArticles(); - - virtual XP_Bool Confirm( - const char* inMessage); - - virtual XP_Bool CheckConfirm( - const char* pConfirmMessage, - const char* pCheckMessage, - const char* pOKMessage, - const char* pCancelMessage, - XP_Bool* pChecked); - - virtual XP_Bool SelectDialog( - const char* pMessage, - char** pList, - int16* pCount); - - virtual char* Prompt( - const char* inMessage, - const char* inDefaultText); - - virtual char* PromptWithCaption( - const char* inCaption, - const char* inMessage, - const char* inDefaultText); - - virtual XP_Bool PromptUsernameAndPassword( - const char* inMessage, - char** outUserName, - char** outPassword); - - virtual char* PromptPassword( - const char* inMessage); - - virtual void EnableClicking(); - - virtual void AllConnectionsComplete(); - - virtual void EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHieght, - LO_Color* inColor); - - virtual void SetDrawable( - CL_Drawable* inDrawable); - - virtual void GetTextFrame( - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame); - - virtual void GetDefaultBackgroundColor( - LO_Color* outColor) const; - - virtual void DrawJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - virtual void HandleClippingView( - struct LJAppletData *appletD, - int x, - int y, - int width, - int height); - - virtual void FreeBuiltinElement( - LO_BuiltinStruct * inBuiltinStruct) ; - virtual void DisplayBuiltin( - int inLocation, - LO_BuiltinStruct* inBuiltinStruct) ; - -public: - - static UInt32 sNSCWindowID; // Unique ID, incremented for each context - UInt32 fNSCWindowID; // ID of this window - Int32 fNSCProgressID; // - - Int32 GetTransactionID() { return fNSCProgressID; } - Int32 GetContextUniqueID() { return fNSCWindowID; } - CommandT GetCurrentCommand() const { return mCurrentCommand; } - void SetCurrentCommand(CommandT inCommand) { mCurrentCommand = inCommand; } - // Window ID. Used to identify the context - - - // There are listeners that listen to several contexts (eg, in mail windows). - // This works by reference counting, and such listeners assume calls to - // SwitchLoadURL and AllConnectionsComplete are balanced. Each context must - // therefore ensure that they are, even if it is done artificially. - Int32 mLoadRefCount; - - -protected: - - - MWContext mContext; - - Int16 mDefaultCSID; - Boolean mRequiresClone; - CContextProgress* mProgress; - CommandT mCurrentCommand; // command being executed -}; - - -inline CNSContext::operator MWContext*() - { return &mContext; }; -inline CNSContext::operator const MWContext*() const - { return &mContext; }; -inline CNSContext::operator MWContext&() - { return mContext; }; -inline CNSContext::operator const MWContext&() const - { return mContext; }; - diff --git a/mozilla/cmd/macfe/central/CNSContextCallbacks.cp b/mozilla/cmd/macfe/central/CNSContextCallbacks.cp deleted file mode 100644 index 76acfb99538..00000000000 --- a/mozilla/cmd/macfe/central/CNSContextCallbacks.cp +++ /dev/null @@ -1,811 +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. - */ - -// CNSContextCallbacks.cp - - -#include "CNSContextCallbacks.h" -#include "CNSContext.h" - -CNSContextCallbacks* CNSContextCallbacks::sContextCallbacks = NULL; // singleton class - -CNSContextCallbacks::CNSContextCallbacks() -{ - #define MAKE_FE_FUNCS_PREFIX(f) CNSContextCallbacks::##f - #define MAKE_FE_FUNCS_ASSIGN mCallbacks. - #include "mk_cx_fn.h" - - Assert_(sContextCallbacks == NULL); - sContextCallbacks = this; -} - -CNSContextCallbacks::~CNSContextCallbacks() -{ - sContextCallbacks = NULL; -} - -MWContext* CNSContextCallbacks::CreateNewDocWindow( - MWContext* inContext, - URL_Struct* inURL) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - - return theNSContext->CreateNewDocWindow(inURL); -} - -void CNSContextCallbacks::LayoutNewDocument( - MWContext* inContext, - URL_Struct* inURL, - int32* inWidth, - int32* inHeight, - int32* inMarginWidth, - int32* inMarginHeight) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->LayoutNewDocument(inURL, inWidth, inHeight, inMarginWidth, inMarginHeight); -} - -void CNSContextCallbacks::SetDocTitle( - MWContext* inContext, - char* inTitle) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetDocTitle(inTitle); -} - -void CNSContextCallbacks::FinishedLayout(MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->FinishedLayout(); -} - -char* CNSContextCallbacks::TranslateISOText( - MWContext* inContext, - int inCharset, - char* inISOText) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->TranslateISOText(inCharset, inISOText); -} - -int CNSContextCallbacks::GetTextInfo( - MWContext* inContext, - LO_TextStruct* inText, - LO_TextInfo* inTextInfo) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->GetTextInfo(inText, inTextInfo); -} - -int CNSContextCallbacks::MeasureText( - MWContext* inContext, - LO_TextStruct* inText, - short* outCharLocs) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->MeasureText(inText, outCharLocs); -} - -void CNSContextCallbacks::GetEmbedSize( - MWContext* inContext, - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod inReloadMethod) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetEmbedSize(inEmbedStruct, inReloadMethod); -} - -void CNSContextCallbacks::GetJavaAppSize( - MWContext* inContext, - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetJavaAppSize(inJavaAppStruct, inReloadMethod); -} - -void CNSContextCallbacks::GetFormElementInfo( - MWContext* inContext, - LO_FormElementStruct* inElement) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetFormElementInfo(inElement); -} - -void CNSContextCallbacks::GetFormElementValue( - MWContext* inContext, - LO_FormElementStruct* inElement, - XP_Bool inHide, - XP_Bool inSubmit) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetFormElementValue(inElement, inHide, inSubmit); -} - -void CNSContextCallbacks::ResetFormElement( - MWContext* inContext, - LO_FormElementStruct* inElement) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->ResetFormElement(inElement); -} - -void CNSContextCallbacks::SetFormElementToggle( - MWContext* inContext, - LO_FormElementStruct* inElement, - XP_Bool inToggle) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetFormElementToggle(inElement, inToggle); -} - -void CNSContextCallbacks::FreeEmbedElement( - MWContext* inContext, - LO_EmbedStruct* inEmbedStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->FreeEmbedElement(inEmbedStruct); - -} - -void CNSContextCallbacks::CreateEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->CreateEmbedWindow(inEmbeddedApp); -} - -void CNSContextCallbacks::SaveEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SaveEmbedWindow(inEmbeddedApp); -} - -void CNSContextCallbacks::RestoreEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->RestoreEmbedWindow(inEmbeddedApp); -} - -void CNSContextCallbacks::DestroyEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DestroyEmbedWindow(inEmbeddedApp); -} - -void CNSContextCallbacks::FreeJavaAppElement( - MWContext* inContext, - LJAppletData* inAppletData) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->FreeJavaAppElement(inAppletData); -} - -void CNSContextCallbacks::HideJavaAppElement( - MWContext* inContext, - LJAppletData* inAppletData) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->HideJavaAppElement(inAppletData); -} - -void CNSContextCallbacks::FreeEdgeElement( - MWContext* inContext, - LO_EdgeStruct* inEdgeStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->FreeEdgeElement(inEdgeStruct); -} - -void CNSContextCallbacks::FormTextIsSubmit( - MWContext* inContext, - LO_FormElementStruct* inElement) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->FormTextIsSubmit(inElement); -} - -void CNSContextCallbacks::DisplaySubtext( - MWContext* inContext, - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplaySubtext(inLocation, inText, inStartPos, inEndPos, inNeedBG); -} - -void CNSContextCallbacks::DisplayText( - MWContext* inContext, - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayText(inLocation, inText, inNeedBG); -} - -void CNSContextCallbacks::DisplayEmbed( - MWContext* inContext, - int inLocation, - LO_EmbedStruct* inEmbedStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayEmbed(inLocation, inEmbedStruct); -} - -void CNSContextCallbacks::DisplayJavaApp( - MWContext* inContext, - int inLocation, - LO_JavaAppStruct* inJavaAppStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayJavaApp(inLocation, inJavaAppStruct); -} - -void CNSContextCallbacks::DisplayEdge( - MWContext* inContext, - int inLocation, - LO_EdgeStruct* inEdgeStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayEdge(inLocation, inEdgeStruct); -} - -void CNSContextCallbacks::DisplayTable( - MWContext* inContext, - int inLocation, - LO_TableStruct* inTableStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayTable(inLocation, inTableStruct); -} - -void CNSContextCallbacks::DisplayCell( - MWContext* inContext, - int inLocation, - LO_CellStruct* inCellStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayCell(inLocation, inCellStruct); -} - -void CNSContextCallbacks::InvalidateEntireTableOrCell( - MWContext* inContext, - LO_Element* inElement) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - if (inElement) - theNSContext->InvalidateEntireTableOrCell(inElement); -} - -void CNSContextCallbacks::DisplayAddRowOrColBorder( - MWContext* inContext, - XP_Rect* inRect, - XP_Bool inDoErase) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayAddRowOrColBorder(inRect, inDoErase); -} - -void CNSContextCallbacks::DisplaySubDoc( - MWContext* inContext, - int inLocation, - LO_SubDocStruct* inSubdocStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplaySubDoc(inLocation, inSubdocStruct); -} - -void CNSContextCallbacks::DisplayLineFeed( - MWContext* inContext, - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayLineFeed(inLocation, inLinefeedStruct, inNeedBG); -} - -void CNSContextCallbacks::DisplayHR( - MWContext* inContext, - int inLocation, - LO_HorizRuleStruct* inRuleStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayHR(inLocation, inRuleStruct); -} - -void CNSContextCallbacks::DisplayBullet( - MWContext* inContext, - int inLocation, - LO_BullettStruct* inBullettStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayBullet(inLocation, inBullettStruct); -} - -void CNSContextCallbacks::DisplayFormElement( - MWContext* inContext, - int inLocation, - LO_FormElementStruct* inFormElement) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayFormElement(inLocation, inFormElement); -} - -void CNSContextCallbacks::DisplayBorder( - MWContext* inContext, - int inLocation, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayBorder(inLocation, inX, inY, inWidth, inHeight, inBW, inColor, inStyle); -} - - -void CNSContextCallbacks::UpdateEnableStates( MWContext* inContext ) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->UpdateEnableStates(); -} - -void CNSContextCallbacks::DisplayFeedback( - MWContext* inContext, - int inLocation, - LO_Element* inElement) -{ - // bail out if non-editor context - // this function is to be used only for the editor - if ( !inContext->is_editor ) - return; - - // called even if the element is not selected - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayFeedback(inLocation, inElement); -} - -void CNSContextCallbacks::ClearView( - MWContext* inContext, - int inWhich) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->ClearView(inWhich); -} - -void CNSContextCallbacks::SetDocDimension( - MWContext* inContext, - int inLocation, - Int32 inWidth, - Int32 inLength) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetDocDimension(inLocation, inWidth, inLength); -} - -void CNSContextCallbacks::SetDocPosition( - MWContext* inContext, - int inLocation, - Int32 inX, - Int32 inY) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetDocPosition(inLocation, inX, inY); -} - -void CNSContextCallbacks::GetDocPosition( - MWContext* inContext, - int inLocation, - Int32* outX, - Int32* outY) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetDocPosition(inLocation, outX, outY); -} - -void CNSContextCallbacks::BeginPreSection( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->BeginPreSection(); -} - -void CNSContextCallbacks::EndPreSection( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->EndPreSection(); -} - -void CNSContextCallbacks::SetProgressBarPercent( - MWContext* inContext, - Int32 inPercent) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetProgressBarPercent(inPercent); -} - -void CNSContextCallbacks::SetBackgroundColor( - MWContext* inContext, - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetBackgroundColor(inRed, inGreen, inBlue); -} - -void CNSContextCallbacks::Progress( - MWContext* inContext, - const char* inMessageText) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->Progress(inMessageText); -} - -void CNSContextCallbacks::Alert( - MWContext* inContext, - const char* inAlertText) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->Alert(inAlertText); -} - -void CNSContextCallbacks::SetCallNetlibAllTheTime( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetCallNetlibAllTheTime(); -} - -void CNSContextCallbacks::ClearCallNetlibAllTheTime( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->ClearCallNetlibAllTheTime(); -} - -void CNSContextCallbacks::GraphProgressInit( - MWContext* inContext, - URL_Struct* inURL, - Int32 inContentLength) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GraphProgressInit(inURL, inContentLength); -} - -void CNSContextCallbacks::GraphProgressDestroy( - MWContext* inContext, - URL_Struct* inURL, - Int32 inContentLength, - Int32 inTotalRead) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GraphProgressDestroy(inURL, inContentLength, inTotalRead); -} - -void CNSContextCallbacks::GraphProgress( - MWContext* inContext, - URL_Struct* inURL, - Int32 inBytesReceived, - Int32 inBytesSinceLast, - Int32 inContentLength) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GraphProgress(inURL, inBytesReceived, inBytesSinceLast, inContentLength); -} - -XP_Bool CNSContextCallbacks::UseFancyFTP( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->UseFancyFTP(); -} - -XP_Bool CNSContextCallbacks::UseFancyNewsgroupListing( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->UseFancyNewsgroupListing(); -} - -int CNSContextCallbacks::FileSortMethod( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->FileSortMethod(); -} - -XP_Bool CNSContextCallbacks::ShowAllNewsArticles( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->ShowAllNewsArticles(); -} - -XP_Bool CNSContextCallbacks::Confirm( - MWContext* inContext, - const char* inMessage) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->Confirm(inMessage); -} - -XP_Bool CNSContextCallbacks::CheckConfirm( - MWContext* inContext, - const char* pConfirmMessage, - const char* pCheckMessage, - const char* pOKMessage, - const char* pCancelMessage, - XP_Bool* pChecked) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->CheckConfirm(pConfirmMessage, pCheckMessage, pOKMessage, pCancelMessage, pChecked); -} - -XP_Bool CNSContextCallbacks::SelectDialog( - MWContext* inContext, - const char* pMessage, - const char** pList, - int16* pCount) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - //return theNSContext->SelectDialog(pMessage, pList, pCount); - - // Temporary stub version until the real MacFE version is implemented - int16 i; - char *message = 0; - for (i = 0; i < *pCount; i++) - { - StrAllocCopy(message, pMessage); - StrAllocCat(message, " = "); - StrAllocCat(message, pList[i]); - if (theNSContext->Confirm(message)) - { - /* user selected this one */ - XP_FREE(message); - *pCount = i; - return TRUE; - } - } - - /* user rejected all */ - XP_FREE(message); - return FALSE; -} - -char* CNSContextCallbacks::Prompt( - MWContext* inContext, - const char* inMessage, - const char* inDefaultText) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->Prompt(inMessage, inDefaultText); -} - -char* CNSContextCallbacks::PromptWithCaption( - MWContext* inContext, - const char* inCaption, - const char* inMessage, - const char* inDefaultText) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->PromptWithCaption(inCaption, inMessage, inDefaultText); -} - -XP_Bool CNSContextCallbacks::PromptUsernameAndPassword( - MWContext* inContext, - const char* inMessage, - char** outUserName, - char** outPassword) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->PromptUsernameAndPassword(inMessage, outUserName, outPassword); -} - -char* CNSContextCallbacks::PromptPassword( - MWContext* inContext, - const char* inMessage) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->PromptPassword(inMessage); -} - -void CNSContextCallbacks::EnableClicking( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->EnableClicking(); -} - -void CNSContextCallbacks::AllConnectionsComplete( - MWContext* inContext) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - if (theNSContext) - theNSContext->AllConnectionsComplete(); -} - -void CNSContextCallbacks::EraseBackground( - MWContext* inContext, - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->EraseBackground(inLocation, inX, inY, inWidth, inHeight, inColor); -} - -void CNSContextCallbacks::SetDrawable( - MWContext* inContext, - CL_Drawable* inDrawable) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->SetDrawable(inDrawable); -} - -void CNSContextCallbacks::GetTextFrame( - MWContext* inContext, - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetTextFrame(inTextStruct, inStartPos, inEndPos, outFrame); -} - -void CNSContextCallbacks::GetDefaultBackgroundColor( - MWContext* inContext, - LO_Color* outColor) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->GetDefaultBackgroundColor(outColor); -} - -void CNSContextCallbacks::DrawJavaApp( - MWContext* inContext, - int inLocation, - LO_JavaAppStruct* inJavaAppStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DrawJavaApp(inLocation, inJavaAppStruct); -} - -void CNSContextCallbacks::HandleClippingView( - MWContext* inContext, - struct LJAppletData *appletD, - int x, - int y, - int width, - int height) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->HandleClippingView(appletD, x, y, width, height); -} - -void CNSContextCallbacks::FreeBuiltinElement( - MWContext *inContext, - LO_BuiltinStruct *inBuiltinStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->FreeBuiltinElement ( inBuiltinStruct ); -} - -void CNSContextCallbacks::DisplayBuiltin( - MWContext * inContext, - int inLocation, - LO_BuiltinStruct *inBuiltinStruct) -{ - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - theNSContext->DisplayBuiltin ( inLocation, inBuiltinStruct ); -} - diff --git a/mozilla/cmd/macfe/central/CNSContextCallbacks.h b/mozilla/cmd/macfe/central/CNSContextCallbacks.h deleted file mode 100644 index 1a8f004e4aa..00000000000 --- a/mozilla/cmd/macfe/central/CNSContextCallbacks.h +++ /dev/null @@ -1,417 +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. - */ - -// CNSContextCallbacks.h - - -#pragma once - -#include "ntypes.h" -#include "structs.h" -#include "ctxtfunc.h" - -class CNSContext; - - -class CNSContextCallbacks -{ - public: - - static CNSContextCallbacks* GetContextCallbacks(void); // singleton class accessor - - CNSContextCallbacks(); - virtual ~CNSContextCallbacks(); - - ContextFuncs& GetInternalCallbacks(void); - - protected: - - static MWContext* CreateNewDocWindow( - MWContext* inContext, - URL_Struct* inURL); - - static void LayoutNewDocument( - MWContext* inContext, - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight); - - static void SetDocTitle( - MWContext* inContext, - char* inTitle); - - static void FinishedLayout( - MWContext* inContext); - - static char* TranslateISOText( - MWContext* inContext, - int inCharset, - char* inISOText); - - static int GetTextInfo( - MWContext* inContext, - LO_TextStruct* inText, - LO_TextInfo* inTextInfo); - - static int MeasureText( - MWContext* inContext, - LO_TextStruct* inText, - short* outCharLocs); - - static void GetEmbedSize( - MWContext* inContext, - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod inReloadMethod); - - static void GetJavaAppSize( - MWContext* inContext, - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod); - - static void GetFormElementInfo( - MWContext* inContext, - LO_FormElementStruct* inElement); - - static void GetFormElementValue( - MWContext* inContext, - LO_FormElementStruct* inElement, - XP_Bool inHide, - XP_Bool inSubmit); - - static void ResetFormElement( - MWContext* inContext, - LO_FormElementStruct* inElement); - - static void SetFormElementToggle( - MWContext* inContext, - LO_FormElementStruct* inElement, - XP_Bool inToggle); - - static void FreeEmbedElement( - MWContext* inContext, - LO_EmbedStruct* inEmbedStruct); - - static void CreateEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp); - - static void SaveEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp); - - static void RestoreEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp); - - static void DestroyEmbedWindow( - MWContext* inContext, - NPEmbeddedApp* inEmbeddedApp); - - static void FreeJavaAppElement( - MWContext* inContext, - LJAppletData* inAppletData); - - static void HideJavaAppElement( - MWContext* inContext, - LJAppletData* inAppletData); - - static void FreeEdgeElement( - MWContext* inContext, - LO_EdgeStruct* inEdgeStruct); - - static void FormTextIsSubmit( - MWContext* inContext, - LO_FormElementStruct* inElement); - - static void DisplaySubtext( - MWContext* inContext, - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG); - - static void DisplayText( - MWContext* inContext, - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG); - - static void DisplayEmbed( - MWContext* inContext, - int inLocation, - LO_EmbedStruct* inEmbedStruct); - - static void DisplayJavaApp( - MWContext* inContext, - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - static void DisplayEdge ( - MWContext* inContext, - int inLocation, - LO_EdgeStruct* inEdgeStruct); - - static void DisplayTable( - MWContext* inContext, - int inLocation, - LO_TableStruct* inTableStruct); - - static void DisplayCell( - MWContext* inContext, - int inLocation, - LO_CellStruct* inCellStruct); - - static void InvalidateEntireTableOrCell( - MWContext* inContext, - LO_Element* inElement); - - static void DisplayAddRowOrColBorder( - MWContext* inContext, - XP_Rect* inRect, - XP_Bool inErase); - - static void DisplaySubDoc( - MWContext* inContext, - int inLocation, - LO_SubDocStruct* inSubdocStruct); - - static void DisplayLineFeed( - MWContext* inContext, - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG); - - static void DisplayHR( - MWContext* inContext, - int inLocation, - LO_HorizRuleStruct* inRuleStruct); - - static void DisplayBullet( - MWContext* inContext, - int inLocation, - LO_BullettStruct* inBullettStruct); - - static void DisplayFormElement( - MWContext* inContext, - int inLocation, - LO_FormElementStruct* inFormElement); - - static void DisplayBorder( - MWContext* inContext, - int inLocation, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle); - - static void UpdateEnableStates( - MWContext* inContext); - - static void DisplayFeedback( - MWContext* inContext, - int inLocation, - LO_Element* inElement); - - static void ClearView( - MWContext* inContext, - int inWhich); - - static void SetDocDimension( - MWContext* inContext, - int inLocation, - Int32 inWidth, - Int32 inLength); - - static void SetDocPosition( - MWContext* inContext, - int inLocation, - Int32 inX, - Int32 inY); - - static void GetDocPosition( - MWContext* inContext, - int inLocation, - Int32* outX, - Int32* outY); - - static void BeginPreSection( - MWContext* inContext); - - static void EndPreSection( - MWContext* inContext); - - static void SetProgressBarPercent( - MWContext* inContext, - Int32 inPercent); - - static void SetBackgroundColor( - MWContext* inContext, - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue); - - static void Progress( - MWContext* inContext, - const char* inMessageText); - - static void Alert( - MWContext* inContext, - const char* inAlertText); - - static void SetCallNetlibAllTheTime( - MWContext* inContext); - - static void ClearCallNetlibAllTheTime( - MWContext* inContext); - - static void GraphProgressInit( - MWContext* inContext, - URL_Struct* inURL, - Int32 inContentLength); - - static void GraphProgressDestroy( - MWContext* inContext, - URL_Struct* inURL, - Int32 inContentLength, - Int32 inTotalRead); - - static void GraphProgress( - MWContext* inContext, - URL_Struct* inURL, - Int32 inBytesReceived, - Int32 inBytesSinceLast, - Int32 inContentLength); - - static XP_Bool UseFancyFTP( - MWContext* inContext); - - static XP_Bool UseFancyNewsgroupListing( - MWContext* inContext); - - static int FileSortMethod( - MWContext* inContext); - - static XP_Bool ShowAllNewsArticles( - MWContext* inContext); - - static XP_Bool Confirm( - MWContext* inContext, - const char* inMessage); - - static XP_Bool CheckConfirm( - MWContext* inContext, - const char* pConfirmMessage, - const char* pCheckMessage, - const char* pOKMessage, - const char* pCancelMessage, - XP_Bool* pChecked); - - static XP_Bool SelectDialog( - MWContext* inContext, - const char* pMessage, - const char** pList, - int16* pCount); - - static char* PromptWithCaption( - MWContext* inContext, - const char* inCaption, - const char* inMessage, - const char* inDefaultText); - - static char* Prompt( - MWContext* inContext, - const char* inMessage, - const char* inDefaultText); - - static XP_Bool PromptUsernameAndPassword( - MWContext* inContext, - const char* inMessage, - char** outUserName, - char** outPassword); - - static char* PromptPassword( - MWContext* inContext, - const char* inMessage); - - static void EnableClicking( - MWContext* inContext); - - static void AllConnectionsComplete( - MWContext* inContext); - - static void EraseBackground( - MWContext* inContext, - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor); - - static void SetDrawable( - MWContext* inContext, - CL_Drawable* inDrawable); - - static void GetTextFrame( - MWContext* inContext, - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame); - - static void GetDefaultBackgroundColor( - MWContext* inContext, - LO_Color* outColor); - - static void DrawJavaApp( - MWContext* inContext, - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - static void HandleClippingView( - MWContext* inContext, - struct LJAppletData *appletD, - int x, - int y, - int width, - int height); - - // SHACK callbacks - static void FreeBuiltinElement( - MWContext *inContext, - LO_BuiltinStruct *) ; - static void DisplayBuiltin( - MWContext * inContext, - int iLocation , - LO_BuiltinStruct *builtin_struct) ; - - ContextFuncs mCallbacks; - - static CNSContextCallbacks* sContextCallbacks; // singleton class -}; - -inline _ContextFuncs& CNSContextCallbacks::GetInternalCallbacks(void) - { return mCallbacks; } -inline CNSContextCallbacks* CNSContextCallbacks::GetContextCallbacks(void) - { return sContextCallbacks; } diff --git a/mozilla/cmd/macfe/central/CPlainTextConversionContext.cp b/mozilla/cmd/macfe/central/CPlainTextConversionContext.cp deleted file mode 100644 index 3589dbd7ad8..00000000000 --- a/mozilla/cmd/macfe/central/CPlainTextConversionContext.cp +++ /dev/null @@ -1,252 +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. - */ - -// CPlainTextConversionContext.cp - - -// This might seem like a lot of work to go around the code in ns/lib/xlate/text.c, -// but doing this allows us not to have to put if (inContext == NULL) inside -// CNSContextCallbacks.cp; and by calling the TXFE_* functions from the overridden -// methods, we pickup any modifcations made for free. - -//#include - -#include "CPlainTextConversionContext.h" - -#include "xlate.h" - -//_EXTERN_C -extern "C" { - -// prototypes for text.c functions - -extern void TXFE_DisplayTable(MWContext *cx, int iLoc, LO_TableStruct *table); -extern void TXFE_DisplayLineFeed(MWContext *cx, int iLocation, LO_LinefeedStruct *line_feed, XP_Bool notused); -extern void TXFE_DisplayHR(MWContext *cx, int iLocation , LO_HorizRuleStruct *HR); -extern char *TXFE_TranslateISOText(MWContext *cx, int charset, char *ISO_Text); -extern void TXFE_DisplayBullet(MWContext *cx, int iLocation, LO_BullettStruct *bullet); -extern void TXFE_FinishedLayout(MWContext *cx); -extern void TXFE_AllConnectionsComplete(MWContext *cx); -extern void TXFE_DisplaySubtext(MWContext *cx, int iLocation, LO_TextStruct *text, - int32 start_pos, int32 end_pos, XP_Bool notused); -extern void TXFE_DisplayText(MWContext *cx, int iLocation, LO_TextStruct *text, XP_Bool needbg); -extern void TXFE_DisplaySubDoc(MWContext *cx, int iLocation, LO_SubDocStruct *subdoc_struct); -extern int TXFE_GetTextInfo(MWContext *cx, LO_TextStruct *text, LO_TextInfo *text_info); -extern void TXFE_LayoutNewDocument(MWContext *cx, URL_Struct *url, int32 *w, int32 *h, int32* mw, int32* mh); - -// These are here because the backend files are .c files, which are only -// run through the C compiler. Thus we need to create and destroy the -// CPlainTextConversionContext from a .cp file - -MWContext* CreatePlainTextConversionContext(MWContext* inUIContext); -void DisposePlainTextConversionContext(MWContext* inContext); - -} // extern "C" - -#pragma mark --- CALLBACKS --- - -MWContext* CreatePlainTextConversionContext(MWContext* inUIContext) -{ - try { - CPlainTextConversionContext* theContext = new CPlainTextConversionContext(inUIContext); - // Very slimey, but somebody needs to have an interest in the context - theContext->AddUser(theContext); - return theContext->operator MWContext*(); - } catch (...) { - return NULL; - } -} - -void DisposePlainTextConversionContext(MWContext* inContext) -{ - CPlainTextConversionContext* theContext = - dynamic_cast(ExtractNSContext(inContext)); - Assert_(theContext != NULL); - // One of these days, this call might break - theContext->RemoveUser(theContext); -} - -CPlainTextConversionContext::CPlainTextConversionContext(MWContext* inUIContext) : - CNSContext(MWContextText) -{ - mUIContext = ExtractNSContext(inUIContext); - Assert_(mUIContext != NULL); -} - -#pragma mark --- OVERRIDES --- - -void CPlainTextConversionContext::LayoutNewDocument( - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight) -{ - TXFE_LayoutNewDocument(*this, inURL, inWidth, inHeight, inMarginWidth, inMarginHeight); -} - -void CPlainTextConversionContext::DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG) -{ - TXFE_DisplaySubtext(*this, inLocation, inText, inStartPos, inEndPos, inNeedBG); -} - -void CPlainTextConversionContext::DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG) -{ - TXFE_DisplayText(*this, inLocation, inText, inNeedBG); -} - -void CPlainTextConversionContext::DisplaySubDoc( - int inLocation, - LO_SubDocStruct* inSubdocStruct) -{ - TXFE_DisplaySubDoc(*this, inLocation, inSubdocStruct); -} - -void CPlainTextConversionContext::DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct) -{ - TXFE_DisplayTable(*this, inLocation, inTableStruct); -} - -void CPlainTextConversionContext::DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG) -{ - TXFE_DisplayLineFeed(*this, inLocation, inLinefeedStruct, inNeedBG); -} - -void CPlainTextConversionContext::DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct) -{ - TXFE_DisplayHR(*this, inLocation, inRuleStruct); -} - -char* CPlainTextConversionContext::TranslateISOText( - int inCharset, - char* inISOText) -{ - return TXFE_TranslateISOText(*this, inCharset, inISOText); -} - -void CPlainTextConversionContext::DisplayBullet( - int inLocation, - LO_BullettStruct* inBulletStruct) -{ - TXFE_DisplayBullet(*this, inLocation, inBulletStruct); -} - -void CPlainTextConversionContext::FinishedLayout(void) -{ - TXFE_FinishedLayout(*this); -} - -int CPlainTextConversionContext::GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* inTextInfo) -{ - return TXFE_GetTextInfo(*this, inText, inTextInfo); -} - -int CPlainTextConversionContext::MeasureText( - LO_TextStruct* /*inText*/, - short* /*outCharLocs*/) -{ - return 0; -} - -void CPlainTextConversionContext::AllConnectionsComplete(void) -{ - if (mProgress) - { - mProgress->RemoveUser(this); - mProgress = NULL; - } - TXFE_AllConnectionsComplete(*this); - mUIContext->AllConnectionsComplete(); - CNSContext::AllConnectionsComplete(); -} - -void CPlainTextConversionContext::GraphProgressInit( - URL_Struct* inURL, - Int32 inContentLength) -{ - try { - Assert_(mUIContext != NULL); - if (mUIContext && mUIContext->GetContextProgress()) - mProgress = mUIContext->GetContextProgress(); - else - { - mProgress = new CContextProgress; - mUIContext->SetContextProgress(mProgress); - } - mProgress->AddUser(this); - } catch (...) { - mProgress = NULL; - } - mUIContext->GraphProgressInit(inURL, inContentLength); -} - -void CPlainTextConversionContext::Progress(const char* inMessageText ) -{ - Assert_(mUIContext != NULL); - mUIContext->Progress(inMessageText); -} - -void CPlainTextConversionContext::GraphProgressDestroy( - URL_Struct* inURL, - Int32 inContentLength, - Int32 inTotalRead) -{ - Assert_(mUIContext != NULL); - mUIContext->GraphProgressDestroy(inURL, inContentLength, inTotalRead); -} - -void CPlainTextConversionContext::GraphProgress( - URL_Struct* inURL, - Int32 inBytesReceived, - Int32 inBytesSinceLast, - Int32 inContentLength) -{ - Assert_(mUIContext != NULL); - mUIContext->GraphProgress(inURL, inBytesReceived, inBytesSinceLast, inContentLength); -} - -#pragma mark --- STUBS --- - -// FIX ME? Do we really wan't to override these methods? -void CPlainTextConversionContext::Alert(const char* /* inAlertText */) {} -XP_Bool CPlainTextConversionContext::Confirm(const char* /* inMessage */) { return false; } -char* CPlainTextConversionContext::Prompt( - const char* /* inMessage */, - const char* /* inDefaultText */) { return NULL; } -XP_Bool CPlainTextConversionContext::PromptUsernameAndPassword( - const char* /* inMessage */, - char** /* outUserName */, - char** /* outPassword */) { return false; } -char* CPlainTextConversionContext::PromptPassword(const char* /* inMessage */) { return NULL; } diff --git a/mozilla/cmd/macfe/central/CPlainTextConversionContext.h b/mozilla/cmd/macfe/central/CPlainTextConversionContext.h deleted file mode 100644 index 73ed23d235a..00000000000 --- a/mozilla/cmd/macfe/central/CPlainTextConversionContext.h +++ /dev/null @@ -1,133 +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. - */ - -// CPlainTextConversionContext.h - -// This is a subclass of CNSContext to handle plain text translation. -// This replaces code in ns/lib/xlate/text.c where a new text MWContext is -// created. - -#pragma once - -#include "CNSContext.h" - -class CPlainTextConversionContext : public CNSContext -{ -public: - CPlainTextConversionContext(MWContext* inUIContext); - virtual ~CPlainTextConversionContext() { } - -protected: - // Overrides of base CNSContext methods - - virtual void LayoutNewDocument( - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight); - - virtual void DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG); - - virtual void DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG); - - virtual void DisplaySubDoc( - int inLocation, - LO_SubDocStruct* inSubdocStruct); - - virtual void DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct); - - virtual void DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG); - - virtual void DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct); - - virtual char* TranslateISOText( - int inCharset, - char* inISOText); - - virtual int GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* inTextInfo); - - virtual int MeasureText( - LO_TextStruct* inText, - short* outCharLocs); - - virtual void DisplayBullet( - int inLocation, - LO_BulletStruct* inBulletStruct); - - virtual void FinishedLayout(void); - - virtual void AllConnectionsComplete(void); - - virtual void Progress( - const char* inMessageText); - - virtual void GraphProgressInit( - URL_Struct* inURL, - Int32 inContentLength); - - virtual void GraphProgressDestroy( - URL_Struct* inURL, - Int32 inContentLength, - Int32 inTotalRead); - - virtual void GraphProgress( - URL_Struct* inURL, - Int32 inBytesReceived, - Int32 inBytesSinceLast, - Int32 inContentLength); - - // Methods to stub out. - - virtual void Alert( - const char* inAlertText); - - virtual XP_Bool Confirm( - const char* inMessage); - - virtual char* Prompt( - const char* inMessage, - const char* inDefaultText); - - virtual XP_Bool PromptUsernameAndPassword( - const char* inMessage, - char** outUserName, - char** outPassword); - - virtual char* PromptPassword( - const char* inMessage); - - CNSContext* mUIContext; -}; diff --git a/mozilla/cmd/macfe/central/CProxyDragTask.cp b/mozilla/cmd/macfe/central/CProxyDragTask.cp deleted file mode 100644 index 5b0e5b4c8c3..00000000000 --- a/mozilla/cmd/macfe/central/CProxyDragTask.cp +++ /dev/null @@ -1,218 +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. - */ - -// CProxyDragTask.cp - - -#include "CProxyDragTask.h" - -#include -#include -#include -#include -#include - -#include "CProxyPane.h" -#include "StCaptureView.h" -#include "CGWorld.h" -#include "StRegionHandle.h" -#include "CEnvironment.h" - -// --------------------------------------------------------------------------- -// ¥ CProxyDragTask -// --------------------------------------------------------------------------- - -CProxyDragTask::CProxyDragTask( - LView& inProxyView, - CProxyPane& inProxyPane, - LCaption& inPageProxyCaption, - const EventRecord& inEventRecord, - CExtraFlavorAdder* inExtraFlavorAdder, - const char* inBookmarkFlavorData) - - : mProxyView(inProxyView), - mProxyPane(inProxyPane), - mPageProxyCaption(inPageProxyCaption), - mExtraFlavorAdder(inExtraFlavorAdder), - mBookmarkFlavorData(inBookmarkFlavorData), - - Inherited(inEventRecord) -{ -} - -// --------------------------------------------------------------------------- -// ¥ ~CProxyDragTask -// --------------------------------------------------------------------------- - -CProxyDragTask::~CProxyDragTask() -{ - delete mExtraFlavorAdder; -} - -// --------------------------------------------------------------------------- -// ¥ DoDrag -// --------------------------------------------------------------------------- - -OSErr -CProxyDragTask::DoDrag() -{ - MakeDragRegion(mDragRef, mDragRegion); - AddFlavors(mDragRef); - - if (UEnvironment::HasFeature(env_HasDragMgrImageSupport)) - { - try - { - DoTranslucentDrag(); - } - catch (...) - { - DoNormalDrag(); - } - } - else - { - DoNormalDrag(); - } - - return noErr; -} - -// --------------------------------------------------------------------------- -// ¥ DoNormalDrag -// --------------------------------------------------------------------------- - -void -CProxyDragTask::DoNormalDrag() -{ - ::TrackDrag(mDragRef, &mEventRecord, mDragRegion); -} - -// --------------------------------------------------------------------------- -// ¥ DoTranslucentDrag -// --------------------------------------------------------------------------- - -void -CProxyDragTask::DoTranslucentDrag() -{ - Rect theFrame; - StColorPortState theColorPortState(mProxyView.GetMacPort()); - - // Normalize the color state (to make CopyBits happy) - - StColorState::Normalize(); - - // Build a GWorld containing the page proxy icon and title - - mProxyView.FocusDraw(); - - mProxyView.CalcLocalFrameRect(theFrame); - - CGWorld theGWorld(theFrame, 0, useTempMem); - StCaptureView theCaptureView(mProxyView); - - mPageProxyCaption.Show(); - - try - { - theCaptureView.Capture(theGWorld); - - mProxyView.FocusDraw(); - - Point theOffsetPoint = topLeft(theFrame); - ::LocalToGlobal(&theOffsetPoint); - - // Set the drag image - - StRegionHandle theTrackMask; - - mProxyPane.CalcLocalFrameRect(theFrame); - ThrowIfOSErr_(::IconSuiteToRgn(theTrackMask, &theFrame, kAlignAbsoluteCenter, mProxyPane.GetIconSuiteH())); - - mPageProxyCaption.CalcLocalFrameRect(theFrame); // Use frame which bounds the actual text, not the frame bounds - theTrackMask += theFrame; - - PixMapHandle theMap = ::GetGWorldPixMap(theGWorld.GetMacGWorld()); - OSErr theErr = ::SetDragImage(mDragRef, theMap, theTrackMask, theOffsetPoint, kDragDarkerTranslucency); - ThrowIfOSErr_(theErr); - - // Track the drag - - ::TrackDrag(mDragRef, &mEventRecord, mDragRegion); - } - catch (...) - { - } - - mPageProxyCaption.Hide(); -} - -// --------------------------------------------------------------------------- -// ¥ AddFlavorURL -// --------------------------------------------------------------------------- - -void -CProxyDragTask::AddFlavors(DragReference inDragRef) -{ - // pass along any data with the bookmark flavor now so that it can be - // retreived before the drop is complete. If we pass null, no one can - // get to the data until the "drag send data" proc is called, which means - // that dropsites that need to see the data before accepting the drop - // will fail. - if ( mBookmarkFlavorData.length() ) - AddFlavorBookmark(static_cast(this), mBookmarkFlavorData.c_str()); - else - AddFlavorBookmark(static_cast(this), NULL); - AddFlavorBookmarkFile(static_cast(this)); - AddFlavorURL(static_cast(this)); - - if (mExtraFlavorAdder) - mExtraFlavorAdder->AddExtraFlavorData(inDragRef, static_cast(this)); -} - -// --------------------------------------------------------------------------- -// ¥ MakeDragRegion -// --------------------------------------------------------------------------- - -void -CProxyDragTask::MakeDragRegion( - DragReference /*inDragRef*/, - RgnHandle /*inDragRegion*/) -{ - Rect theFrame; - - // Add the page proxy icon region - - StRegionHandle theTrackMask; - - mProxyPane.CalcLocalFrameRect(theFrame); - ThrowIfOSErr_(::IconSuiteToRgn(theTrackMask, &theFrame, kAlignAbsoluteCenter, mProxyPane.GetIconSuiteH())); - theFrame = (**(RgnHandle)theTrackMask).rgnBBox; - ::LocalToGlobal(&topLeft(theFrame)); - ::LocalToGlobal(&botRight(theFrame)); - - AddRectDragItem(static_cast(&mProxyPane), theFrame); - - // Add the page proxy caption region - - mPageProxyCaption.CalcLocalFrameRect(theFrame); - ::LocalToGlobal(&topLeft(theFrame)); - ::LocalToGlobal(&botRight(theFrame)); - - AddRectDragItem(static_cast(&mPageProxyCaption), theFrame); -} diff --git a/mozilla/cmd/macfe/central/CProxyDragTask.h b/mozilla/cmd/macfe/central/CProxyDragTask.h deleted file mode 100644 index 049888a50a1..00000000000 --- a/mozilla/cmd/macfe/central/CProxyDragTask.h +++ /dev/null @@ -1,79 +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. - */ - -// CProxyDragTask.h - - -#ifndef CProxyDragTask_H -#define CProxyDragTask_H -#pragma once - -// Includes - -#include "CBrowserDragTask.h" -#include -#include "CProxyPane.h" - -// Forward declarations - -class LView; -class CProxyPane; -class LCaption; - -// Class declaration - -class CExtraFlavorAdder // to be called by AddFlavor. Allows a window to add extra flavors. -{ - public: - virtual void AddExtraFlavorData(DragReference inDragRef, ItemReference inItemRef) = 0; -}; - -class CProxyDragTask : public CBrowserDragTask -{ -public: - typedef CBrowserDragTask Inherited; - - CProxyDragTask( - LView& inProxyView, - CProxyPane& inProxyPane, - LCaption& inPageProxyCaption, - const EventRecord& inEventRecord, - CExtraFlavorAdder* inFlavorAdder = nil, - const char* inBookmarkFlavorData = nil ); - virtual ~CProxyDragTask(); - - virtual OSErr DoDrag(); - virtual void AddFlavors(DragReference inDragRef); - -protected: - virtual void DoNormalDrag(); - virtual void DoTranslucentDrag(); - - virtual void MakeDragRegion( - DragReference inDragRef, - RgnHandle inDragRegion); - - LView& mProxyView; - CProxyPane& mProxyPane; - LCaption& mPageProxyCaption; - CExtraFlavorAdder* mExtraFlavorAdder; - const string mBookmarkFlavorData; // data sent along with drag. Ok to be NULL -}; - - -#endif diff --git a/mozilla/cmd/macfe/central/CSaveProgress.cp b/mozilla/cmd/macfe/central/CSaveProgress.cp deleted file mode 100644 index d06a20b3770..00000000000 --- a/mozilla/cmd/macfe/central/CSaveProgress.cp +++ /dev/null @@ -1,125 +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. - */ - -#include "CSaveProgress.h" -#include "fe_proto.h" -#include "CBrowserContext.h" -#include "resgui.h" // needed for EDITDLG_SAVE_PROGRESS -#include "uapp.h" -#include "edt.h" -#include "PascalString.h" // CStr255 -#include "proto.h" // XP_InterruptContext -#include "macutil.h" // TrySetCursor - - -#pragma mark CSaveProgress -void CSaveProgress::FinishCreateSelf() -{ - fFilenameText = (LCaption*)this->FindPaneByID( 'flnm' ); - LDialogBox::FinishCreateSelf(); -} - - -void CSaveProgress::SetFilename(char *pFileName) -{ - if ( fFilenameText && pFileName ) - fFilenameText->SetDescriptor( CStr255(pFileName) ); -} - - -void CSaveProgress::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case msg_Cancel: - if ( fContext ) - { - TrySetCursor( watchCursor ); - -#ifdef EDITOR - if ( EDT_IS_EDITOR( fContext ) ) - EDT_SaveCancel( fContext ); - else -#endif // EDITOR - XP_InterruptContext( fContext ); - - SetCursor( &qd.arrow ); - } - break; - - default: - LDialogBox::ListenToMessage( inMessage, ioParam ); - break; - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- FTP Upload Dialog --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// FIX ME -- find way to use new CDownloadProgressWindow -// Most likely, we'll duplicate the code from downloading - - -void FE_SaveDialogCreate( MWContext *pContext, int /*iFileCount*/, ED_SaveDialogType /*saveType*/ ) -{ - try { - CSaveProgress * newWindow = (CSaveProgress*)LWindow::CreateWindow( - EDITDLG_SAVE_PROGRESS, CFrontApp::GetApplication()); - if ( newWindow == NULL ) - return; - - UReanimator::LinkListenerToControls( newWindow, newWindow, EDITDLG_SAVE_PROGRESS ); - - newWindow->SetContext( pContext ); - ExtractBrowserContext(pContext)->SetSaveDialog( newWindow ); - - newWindow->Show(); - } - - catch (...) - { - ExtractBrowserContext(pContext)->SetSaveDialog( NULL ); - } -} - -#ifdef EDITOR -void FE_SaveDialogSetFilename( MWContext *pContext, char *pFilename ) -{ - char *better = FE_URLToLocalName( pFilename ); - if ( better ) - { - if ( pContext && ExtractBrowserContext(pContext) && ExtractBrowserContext(pContext)->GetSaveDialog() ) - ExtractBrowserContext(pContext)->GetSaveDialog()->SetFilename( better ); - - XP_FREE( better ); - } -} -#endif // EDITOR - -void FE_SaveDialogDestroy( MWContext *pContext, int /*status*/, char */*pFilename*/ ) -{ - if ( pContext && ExtractBrowserContext(pContext) && ExtractBrowserContext(pContext)->GetSaveDialog() ) - { - ExtractBrowserContext(pContext)->GetSaveDialog()->ListenToMessage( cmd_Close, NULL ); - ExtractBrowserContext(pContext)->SetSaveDialog( NULL ); - } -} - diff --git a/mozilla/cmd/macfe/central/CSaveProgress.h b/mozilla/cmd/macfe/central/CSaveProgress.h deleted file mode 100644 index 0eb06c1d800..00000000000 --- a/mozilla/cmd/macfe/central/CSaveProgress.h +++ /dev/null @@ -1,40 +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. - */ - -#pragma once - -#include "CNSContext.h" - - -class CSaveProgress: public LDialogBox -{ -public: - enum { class_ID = 'EDL4' }; - - CSaveProgress( LStream* inStream ): LDialogBox( inStream ){}; - - virtual void FinishCreateSelf(); - void SetFilename( char *pFilename ); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - void SetContext( MWContext* context ) {fContext = context;} - -protected: - LCaption* fFilenameText; - MWContext* fContext; -}; - diff --git a/mozilla/cmd/macfe/central/CSecureAttachment.cp b/mozilla/cmd/macfe/central/CSecureAttachment.cp deleted file mode 100644 index c6cad00c21e..00000000000 --- a/mozilla/cmd/macfe/central/CSecureAttachment.cp +++ /dev/null @@ -1,50 +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. - */ - -// CSecureAttachment.cp - -#pragma once - -#include "CSecureAttachment.h" -#include "xp_core.h" -#include "secnav.h" -#include "secrng.h" - -CSecureAttachment::CSecureAttachment() - : LAttachment(msg_Event) -{ - mTickCounter = 0; -} - - -void CSecureAttachment::ExecuteSelf( - MessageT /* inMessage */, - void *ioParam) -{ - if (mTickCounter < 500) - { - EventRecord* theEvent = (EventRecord*)ioParam; - RNG_RandomUpdate(theEvent, sizeof(EventRecord)); - long ticks = ::TickCount(); - RNG_RandomUpdate(&ticks, sizeof(long)); - mTickCounter++; - } - else - delete this; -} - diff --git a/mozilla/cmd/macfe/central/CSecureAttachment.h b/mozilla/cmd/macfe/central/CSecureAttachment.h deleted file mode 100644 index 3e53e236c06..00000000000 --- a/mozilla/cmd/macfe/central/CSecureAttachment.h +++ /dev/null @@ -1,42 +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. - */ - -// CSecureAttachment.h - -// Initializes the random seed of the security library. Add this -// attachment to application startup. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include - -class CSecureAttachment : public LAttachment -{ - public: - CSecureAttachment(); - - protected: - - virtual void ExecuteSelf( - MessageT inMessage, - void *ioParam); - - Uint32 mTickCounter; -}; - diff --git a/mozilla/cmd/macfe/central/CTSMEditField.cp b/mozilla/cmd/macfe/central/CTSMEditField.cp deleted file mode 100644 index b099f556ff8..00000000000 --- a/mozilla/cmd/macfe/central/CTSMEditField.cp +++ /dev/null @@ -1,282 +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. - */ - -#include "CTSMEditField.h" - - -Boolean CTSMEditField::sInitialized = false; -Boolean CTSMEditField::sHasTSM = false; -TSMTEPreUpdateUPP CTSMEditField::sPreUpdateUPP = NewTSMTEPreUpdateProc( CTSMEditField::PreUpdate ); -TSMTEPostUpdateUPP CTSMEditField::sPostUpdateUPP = NewTSMTEPostUpdateProc( CTSMEditField::PostUpdate ); - - -// Default constructor - -CTSMEditField::CTSMEditField () -{ -} // CTSMEditField::CTSMEditField - -CTSMEditField::CTSMEditField( LStream* inStream ) - - : LEditField( inStream ) - - { - - if ( !sInitialized ) - Initialize(); - - OSErr result = noErr; - OSType theServiceTypes = kTSMTEInterfaceType; - - mTSMDocID = 0; - mTSMTEHandle = NULL; - - - Try_ - { - - if ( sHasTSM ) - { - - result = ::NewTSMDocument( 1, &theServiceTypes, &mTSMDocID, static_cast(&mTSMTEHandle) ); - ThrowIfOSErr_( result ); - - if ( !mTSMTEHandle && mTSMDocID ) - { - - ::DeleteTSMDocument( mTSMDocID ); - mTSMDocID = 0; - - Throw_( paramErr ); - - } - - (*mTSMTEHandle)->textH = mTextEditH; - (*mTSMTEHandle)->preUpdateProc = sPreUpdateUPP; - (*mTSMTEHandle)->postUpdateProc = sPostUpdateUPP; - (*mTSMTEHandle)->updateFlag = kTSMTEAutoScroll; - (*mTSMTEHandle)->refCon = (Int32)this; - - } - - } - - Catch_( inErr ) - { - -// Failure just means that this edit field won't support TSMTE - - } - - EndCatch_; - - } - -// -// Parameterized constructor - -CTSMEditField::CTSMEditField ( const SPaneInfo& inPaneInfo, - Str255 inString, - ResIDT inTextTraitsID, - Int16 inMaxChars, - Uint8 inAttributes, - TEKeyFilterFunc inKeyFilter, - LCommander* inSuper) - : LEditField ( inPaneInfo, - inString, - inTextTraitsID, - inMaxChars, - inAttributes, - inKeyFilter, - inSuper ) - -{ -} // CTSMEditField::CTSMEditField - - -CTSMEditField::~CTSMEditField() - { - - OSErr result = noErr; - - try - { - - if ( mTSMDocID != 0 ) - { - - ::FixTSMDocument( mTSMDocID ); - ::DeactivateTSMDocument( mTSMDocID ); // for a bug in TSM. See TE27 - - result = ::DeleteTSMDocument( mTSMDocID ); - Assert_( result == noErr ); - - mTSMDocID = 0; - - } - - } - - catch ( ... ) - { - - - } - - } - - -pascal void -CTSMEditField::PreUpdate( TEHandle inTEHandle, Int32 inRefCon ) - { - - CTSMEditField *theOwnerEditField = NULL; - - if ( inRefCon != NULL ) - { - - theOwnerEditField = reinterpret_cast( inRefCon ); - - theOwnerEditField->FocusDraw(); - - } - - } - - -pascal void -CTSMEditField::PostUpdate( - TEHandle inTEHandle, - Int32 fixLen, - Int32 inputAreaStart, - Int32 inputAreaEnd, - Int32 pinStart, - Int32 pinEnd, - Int32 inRefCon ) - { - - CTSMEditField *theOwnerEditField = NULL; - - if ( inRefCon != NULL && fixLen > 0 ) - { - - theOwnerEditField = reinterpret_cast( inRefCon ); - - // Undo of TSM input is currently not supported. - // - if (theOwnerEditField->mTypingAction != NULL) - theOwnerEditField->mTypingAction->Reset(); - - } - - } - - -void CTSMEditField::BeTarget( void ) - { - - OSErr result = noErr; - short oldScript = ::GetScriptManagerVariable(smKeyScript); - - #ifdef Debug_Signal - - OSErr err; - - // check to see if a bug in TSM will be encountered - ProcessSerialNumber psn, - csn; - err = GetCurrentProcess(&psn); - err = GetFrontProcess(&csn); - Assert_((psn.highLongOfPSN == csn.highLongOfPSN) && (psn.lowLongOfPSN == csn.lowLongOfPSN)); - #endif - - FocusDraw(); - - LEditField::BeTarget(); - - if ( mTSMDocID != NULL ) - { - - result = ::ActivateTSMDocument( mTSMDocID ); - Assert_( result == noErr ); - - } - - - if (oldScript != ::GetScriptManagerVariable(smKeyScript)) - ::KeyScript(oldScript); - } - - -void -CTSMEditField::DontBeTarget( void ) - { - - OSErr result = noErr; - - FocusDraw(); - - if ( mTSMDocID != NULL ) - { - - ::FixTSMDocument( mTSMDocID ); - - result = ::DeactivateTSMDocument( mTSMDocID ); - Assert_( result == noErr ); - - } - - LEditField::DontBeTarget(); - - } - - -void -CTSMEditField::Initialize() - { - - OSErr result = noErr; - SInt32 gestaltResponse = 0; - - Assert_( sInitialized == false ); - - if ( sInitialized == false ) - { - - sInitialized = true; - - result = ::Gestalt( gestaltTSMgrVersion, &gestaltResponse ); - - if ( (result == noErr) && (gestaltResponse >= 1) ) - { - - result = ::Gestalt( gestaltTSMTEAttr, &gestaltResponse ); - - if ( (result == noErr) && ((gestaltResponse >> gestaltTSMTEPresent) & 1) ) - { - - sHasTSM = true; - - } - - } - - } - - } - diff --git a/mozilla/cmd/macfe/central/CTSMEditField.h b/mozilla/cmd/macfe/central/CTSMEditField.h deleted file mode 100644 index 9d0679719cb..00000000000 --- a/mozilla/cmd/macfe/central/CTSMEditField.h +++ /dev/null @@ -1,79 +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. - */ - -#pragma once - - -#include -#include -#include -#include - - -class CTSMEditField : public LEditField - { - - public: - - enum - { - - class_ID = 'Tedt' - - }; - - CTSMEditField(); // ¥ Default Constructor - CTSMEditField( LStream *inStream); // ¥ Stream Constructor - CTSMEditField ( const SPaneInfo& inPaneInfo, - Str255 inString, - ResIDT inTextTraitsID, - Int16 inMaxChars, - Uint8 inAttributes, - TEKeyFilterFunc inKeyFilter, - LCommander* inSuper); - // ¥ Parameterized Constructor - virtual ~CTSMEditField(); - - static pascal void PreUpdate( TEHandle inTEHandle, - Int32 inRefCon); - static pascal void PostUpdate( - TEHandle inTEHandle, - Int32 fixLen, - Int32 inputAreaStart, - Int32 inputAreaEnd, - Int32 pinStart, - Int32 pinEnd, - Int32 inRefCon ); - Int16 GetMaxChars() const { return mMaxChars; } // Make it public. - - protected: - - virtual void BeTarget(void); - virtual void DontBeTarget(void); - - virtual void Initialize(); - - TSMDocumentID mTSMDocID; - TSMTERecHandle mTSMTEHandle; - - static Boolean sInitialized; - static Boolean sHasTSM; - static TSMTEPreUpdateUPP sPreUpdateUPP; - static TSMTEPostUpdateUPP sPostUpdateUPP; - - }; diff --git a/mozilla/cmd/macfe/central/CTargetedUpdateMenuRegistry.cp b/mozilla/cmd/macfe/central/CTargetedUpdateMenuRegistry.cp deleted file mode 100644 index 9d018bb31ce..00000000000 --- a/mozilla/cmd/macfe/central/CTargetedUpdateMenuRegistry.cp +++ /dev/null @@ -1,92 +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. - */ - -// CTargetedUpdateMenuRegistry.cp - -// -// CTargetedUpdateMenuRegistry is used in conjunction with LEventDispatchers -// which are CTargetedUpdateMenuRegistry-aware to enable a more targeted -// update of menus. -// -// One common example of this is menu items whose text should change when -// certain modifiers are held down (Close -> Close All when optionKey is -// held down, for example). -// -// Usage notes for callers of UpdateMenus: -// -// (1) Call SetCommands with a list of commands which should be updated. -// (2) Call UpdateMenus. -// -// Usage notes for implementors of UpdateMenus: -// -// (1) When looping through commands in menus, determine if the registry -// is active by calling UseRegistryToUpdateMenus. -// (2) If the registry is active, then check to see if the command is -// in the registry by calling CommandInRegistry before processing -// command status for the command. -// -// Note: For the targeted update to be useful, there should generally be -// a very small number of targeted commands. In fact, command lookup will -// slow down if there are too many commands. - -#include "CTargetedUpdateMenuRegistry.h" - -// === Static Members === - -Boolean CTargetedUpdateMenuRegistry::sUseRegistryToUpdateMenus = false; -list CTargetedUpdateMenuRegistry::sCommands; - -// --------------------------------------------------------------------------- -// ¥ SetCommands -// --------------------------------------------------------------------------- - -void -CTargetedUpdateMenuRegistry::SetCommands( - const list& inCommands) -{ - sCommands = inCommands; -} - -// --------------------------------------------------------------------------- -// ¥ UpdateMenus -// --------------------------------------------------------------------------- - -void -CTargetedUpdateMenuRegistry::UpdateMenus() -{ - if (LEventDispatcher::GetCurrentEventDispatcher()) - { - StValueChanger setUseRegistryToUpdateMenus(sUseRegistryToUpdateMenus, true); - - LEventDispatcher::GetCurrentEventDispatcher()->UpdateMenus(); - } -} - -// --------------------------------------------------------------------------- -// ¥ CommandInRegistry -// --------------------------------------------------------------------------- - -Boolean -CTargetedUpdateMenuRegistry::CommandInRegistry(CommandT inCommand) -{ - list::const_iterator theCommand = find( - sCommands.begin(), - sCommands.end(), - inCommand); - return (theCommand != sCommands.end()); -} diff --git a/mozilla/cmd/macfe/central/CTargetedUpdateMenuRegistry.h b/mozilla/cmd/macfe/central/CTargetedUpdateMenuRegistry.h deleted file mode 100644 index c82fc563aed..00000000000 --- a/mozilla/cmd/macfe/central/CTargetedUpdateMenuRegistry.h +++ /dev/null @@ -1,91 +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. - */ - -// CTargetedUpdateMenuRegistry.h - -// -// CTargetedUpdateMenuRegistry is used in conjunction with LEventDispatchers -// which are CTargetedUpdateMenuRegistry-aware to enable a more targeted -// update of menus. -// -// One common example of this is menu items whose text should change when -// certain modifiers are held down (Close -> Close All when optionKey is -// held down, for example). -// -// Usage notes for callers of UpdateMenus: -// -// (1) Call SetCommands with a list of commands which should be updated. -// (2) Call UpdateMenus. -// -// Usage notes for implementors of UpdateMenus: -// -// (1) When looping through commands in menus, determine if the registry -// is active by calling UseRegistryToUpdateMenus. -// (2) If the registry is active, then check to see if the command is -// in the registry by calling CommandInRegistry before processing -// command status for the command. -// -// Note: For the targeted update to be useful, there should generally be -// a very small number of targeted commands. In fact, command lookup will -// slow down if there are too many commands. - -#ifndef CTargetedUpdateMenuRegistry_H -#define CTargetedUpdateMenuRegistry_H -#pragma once - -// Includes - -#include -#include - -#include -#include - -// Class declaration - -class CTargetedUpdateMenuRegistry -{ -public: - - // Interface for callers of UpdateMenus - - static void SetCommands(const list& inCommands); - - static void UpdateMenus(); - - // Interface for implementors of UpdateMenus - - static Boolean CommandInRegistry(CommandT inCommand); - - static Boolean UseRegistryToUpdateMenus(); - -private: - static Boolean sUseRegistryToUpdateMenus; - static list sCommands; -}; - -// Inline methods - -inline -Boolean -CTargetedUpdateMenuRegistry::UseRegistryToUpdateMenus() -{ - return sUseRegistryToUpdateMenus; -} - -#endif \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/CURLDispatcher.cp b/mozilla/cmd/macfe/central/CURLDispatcher.cp deleted file mode 100644 index 4701ffbe5f3..00000000000 --- a/mozilla/cmd/macfe/central/CURLDispatcher.cp +++ /dev/null @@ -1,874 +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. - */ - -// CURLDispatcher.cp - - -#include "CURLDispatcher.h" -#include "CNSContext.h" -#include "CBrowserWindow.h" -#include "CDownloadProgressWindow.h" -#include "CWindowMediator.h" -#include "CBrowserContext.h" -#include "CBrowserWindow.h" -#ifdef MOZ_MAIL_NEWS -#include "CMailNewsWindow.h" -#include "CThreadWindow.h" -#include "CMessageWindow.h" -#endif -#include "URobustCreateWindow.h" -#include "uapp.h" -#include "CHTMLClickRecord.h" -#include "CAutoPtr.h" -#include "CAutoPtrXP.h" -#include "cstring.h" - -#include "xp.h" -#include "macutil.h" -#include "umimemap.h" -#include "ufilemgr.h" -#include "uprefd.h" -#include "xlate.h" -#include "msv2dsk.h" -#include "msgcom.h" -#include "uerrmgr.h" // Need for GetCString -#include "resgui.h" - -CBrowserWindow* CURLDispatcher::sLastBrowserWindowCreated = NULL; -CAutoPtr CURLDispatcher::sDispatcher; -CAutoPtr CURLDispatcher::sDispatchContext; - -// URL dispatch proc table -// URL types listed in net.h are indices into this table. -// **** NOTE: URL types in net.h start at 1 **** -const Uint32 cNumURLTypes = 39; - -static DispatchProcPtr dispatchProcs[] = -{ - CURLDispatcher::DispatchToBrowserWindow // Unknown URL type 0 -, CURLDispatcher::DispatchToBrowserWindow // FILE_TYPE_URL 1 -, CURLDispatcher::DispatchToBrowserWindow // FTP_TYPE_URL 2 -, CURLDispatcher::DispatchToBrowserWindow // GOPHER_TYPE_URL 3 -, CURLDispatcher::DispatchToBrowserWindow // HTTP_TYPE_URL 4 -, CURLDispatcher::DispatchToLibNet // MAILTO_TYPE_URL 5 -//, CURLDispatcher::DispatchToMailNewsWindow // NEWS_TYPE_URL 6 -, CURLDispatcher::DispatchMailboxURL // NEWS_TYPE_URL 6 (use mailbox code) -, NULL // RLOGIN_TYPE_URL 7 -, CURLDispatcher::DispatchToBrowserWindow // TELNET_TYPE_URL 8 -, CURLDispatcher::DispatchToBrowserWindow // TN3270_TYPE_URL 9 -, NULL // WAIS_TYPE_URL 10 -, CURLDispatcher::DispatchToBrowserWindow // ABOUT_TYPE_URL 11 -, NULL // FILE_CACHE_TYPE_URL 12 -, NULL // MEMORY_CACHE_TYPE_URL 13 -, CURLDispatcher::DispatchToBrowserWindow // SECURE_HTTP_TYPE_URL 14 -, NULL // INTERNAL_IMAGE_TYPE_URL 15 -, NULL // URN_TYPE_URL 16 -, NULL // POP3_TYPE_URL 17 -, CURLDispatcher::DispatchMailboxURL // MAILBOX_TYPE_URL 18 -, NULL // INTERNAL_NEWS_TYPE_URL 19 -, CURLDispatcher::DispatchToBrowserWindow // SECURITY_TYPE_URL 20 -, CURLDispatcher::DispatchToBrowserWindow // MOCHA_TYPE_URL 21 -, CURLDispatcher::DispatchToBrowserWindow // VIEW_SOURCE_TYPE_URL 22 -, NULL // HTML_DIALOG_HANDLER_TYPE_URL 23 -, NULL // HTML_PANEL_HANDLER_TYPE_URL 24 -, NULL // INTERNAL_SECLIB_TYPE_URL 25 -, NULL // MSG_SEARCH_TYPE_URL 26 -, CURLDispatcher::DispatchMailboxURL // IMAP_TYPE_URL 27 -, CURLDispatcher::DispatchToLibNet // LDAP_TYPE_URL 28 -, NULL // SECURE_LDAP_TYPE_URL 29 -, CURLDispatcher::DispatchToBrowserWindow // WYSIWYG_TYPE_URL 30 -, CURLDispatcher::DispatchToLibNet // ADDRESS_BOOK_TYPE_URL 31 -, NULL // CLASSID_TYPE_URL 32 -, NULL // JAVA_TYPE_URL 33 -, NULL // DATA_TYPE_URL 34 -, CURLDispatcher::DispatchToLibNet // NETHELP_TYPE_URL 35 -, NULL // NFS_TYPE_URL 36 -, CURLDispatcher::DispatchToBrowserWindow // MARIMBA_TYPE_URL 37 -, NULL // INTERNAL_CERTLDAP_TYPE_URL 38 -}; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CURLDispatcher* CURLDispatcher::GetURLDispatcher() // singleton class -{ - if (!sDispatcher.get()) - { - sDispatcher.reset(new CURLDispatcher); - } - - return sDispatcher.get(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CURLDispatcher::CURLDispatcher() - : mDelayedURLs(sizeof(CURLDispatchInfo*)) -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CURLDispatcher::~CURLDispatcher() -{ -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchToStorage( - URL_Struct* inURL, - const FSSpec& inDestSpec, - FO_Present_Types inOutputFormat, - Boolean inDelay) -{ - Assert_((inOutputFormat == FO_SAVE_AS) || (inOutputFormat == FO_SAVE_AS_TEXT)); - - if (!inDelay) - { - CURLDispatchInfo* dispatchInfo = - new CURLDispatchInfo(inURL, nil, inOutputFormat, inDelay, false, true); - dispatchInfo->SetFileSpec(inDestSpec); - if (inOutputFormat == FO_SAVE_AS) - { - DispatchToDisk(dispatchInfo); - } - else - DispatchToDiskAsText(dispatchInfo); - } - else - { - CURLDispatchInfo* theDelay = - new CURLDispatchInfo(inURL, nil, inOutputFormat, true, false, true); - theDelay->SetFileSpec(inDestSpec); - GetURLDispatcher()->PostPendingDispatch(theDelay); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchToStorage(CURLDispatchInfo* inDispatchInfo) -{ - Assert_((inDispatchInfo->GetOutputFormat() == FO_SAVE_AS) || (inDispatchInfo->GetOutputFormat() == FO_SAVE_AS_TEXT)); - - if (!inDispatchInfo->GetDelay()) - { - if (inDispatchInfo->GetOutputFormat() == FO_SAVE_AS) - DispatchToDisk(inDispatchInfo); - else - DispatchToDiskAsText(inDispatchInfo); - } - else - { - GetURLDispatcher()->PostPendingDispatch(inDispatchInfo); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::SpendTime(const EventRecord& /*inMacEvent*/) -{ - if (mDelayedURLs.GetCount() > 0) - ProcessPendingDispatch(); - else - StopIdling(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - if ((inMessage == msg_BroadcasterDied) && (mDelayedURLs.GetCount() > 0)) - UpdatePendingDispatch((CNSContext*)ioParam); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -void CURLDispatcher::DispatchToDisk(CURLDispatchInfo* inDispatchInfo) -{ - CBrowserContext* theContext = NULL; - CDownloadProgressWindow* theProgressWindow = NULL; - FSSpec& destSpec = inDispatchInfo->GetFileSpec(); - URL_Struct* inURL = inDispatchInfo->GetURLStruct(); - - CAutoPtr info(inDispatchInfo); - - Assert_(inURL != NULL); - - try - { - theContext = new CBrowserContext(MWContextSaveToDisk); - StSharer theShareLock(theContext); - - theProgressWindow = dynamic_cast(URobustCreateWindow::CreateWindow(WIND_DownloadProgress, LCommander::GetTopCommander())); - ThrowIfNULL_(theProgressWindow); - theProgressWindow->Show(); - - inURL->fe_data = StructCopy(&destSpec, sizeof(FSSpec)); - theProgressWindow->SetWindowContext(theContext); - // the window will be shown on the first progress call. - - theContext->ImmediateLoadURL(inDispatchInfo->ReleaseURLStruct(), FO_SAVE_AS); - } - catch (...) - { - delete theProgressWindow; - throw; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -extern "C" void SaveAsCompletionProc( PrintSetup* p ); - - -void CURLDispatcher::DispatchToDiskAsText(CURLDispatchInfo* inDispatchInfo) -{ - - CNSContext* theContext = NULL; - CDownloadProgressWindow* theProgressWindow = NULL; - FSSpec& destSpec = inDispatchInfo->GetFileSpec(); - URL_Struct* inURL = inDispatchInfo->GetURLStruct(); - - Assert_(inURL != NULL); - - try - { - theContext = new CNSContext(MWContextSaveToDisk); - StSharer theShareLock(theContext); - - theProgressWindow = dynamic_cast(URobustCreateWindow::CreateWindow(WIND_DownloadProgress, LCommander::GetTopCommander())); - ThrowIfNULL_(theProgressWindow); - theProgressWindow->SetWindowContext(theContext); - - CMimeMapper *theMapper = CPrefs::sMimeTypes.FindMimeType(CMimeList::HTMLViewer); - OSType creator = emSignature, docType='TEXT'; - if (theMapper != NULL && CMimeMapper::Launch == theMapper->GetLoadAction()) - { - creator = theMapper->GetAppSig(); - docType = theMapper->GetDocType(); - } - - OSErr theErr = ::FSpCreate(&destSpec, creator, docType, 0); - if ((theErr != noErr) && (theErr != dupFNErr)) - ThrowIfOSErr_(theErr); - - CFileMgr::FileSetComment(destSpec, inURL->address); - - char* thePath = CFileMgr::EncodedPathNameFromFSSpec(destSpec, TRUE); - ThrowIfNULL_(thePath); - - thePath = NET_UnEscape(thePath); - XP_File theFile = XP_FileOpen(thePath, xpURL, XP_FILE_WRITE); - XP_FREE(thePath); - ThrowIfNULL_(theFile); - - PrintSetup print; - XL_InitializeTextSetup(&print); - print.width = 76; - print.out = theFile; - print.completion = (XL_CompletionRoutine) SaveAsCompletionProc; - print.carg = (void*)(theContext); - print.filename = nil; - print.url = inURL; - inURL->fe_data = theContext; - - MWContext* textContext = (MWContext*) XL_TranslateText(*theContext, inURL, &print); - } - catch(...) - { - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::PostPendingDispatch(CURLDispatchInfo* inDispatchInfo) -{ - mDelayedURLs.InsertItemsAt(1, LArray::index_Last, &inDispatchInfo, sizeof(CURLDispatchInfo*)); - StartIdling(); - if (inDispatchInfo->GetTargetContext() != NULL) - inDispatchInfo->GetTargetContext()->AddListener(this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::UpdatePendingDispatch( - CNSContext* inForContext) -{ - Assert_(inForContext != NULL); - - CURLDispatchInfo* theInfo; - LArrayIterator theIter(mDelayedURLs, LArrayIterator::from_Start); - while (theIter.Next(&theInfo)) - { - if (theInfo->GetTargetContext() == inForContext) - mDelayedURLs.RemoveItemsAt(1, theIter.GetCurrentIndex()); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::ProcessPendingDispatch(void) -{ - if (CFrontApp::GetApplication()->HasProperlyStartedUp()) - { - CURLDispatchInfo* theInfo; - mDelayedURLs.FetchItemAt(LArray::index_First, &theInfo); - // 97-06-10 pkc -- Hack to workaround trying to dispatch URL's on image - // anchors while mocha is loading image - CBrowserContext* browserContext = - dynamic_cast(theInfo->GetTargetContext()); - if (theInfo->GetIsWaitingForMochaImageLoad() && - theInfo->GetTargetContext()) - { - if (browserContext && browserContext->IsMochaLoadingImages()) - { - // The context is loading images for mocha, don't - // perform dispatch - return; - } - } - mDelayedURLs.RemoveItemsAt(1, LArray::index_First); - - if (theInfo->GetTargetContext() != NULL) - theInfo->GetTargetContext()->RemoveListener(this); - - theInfo->ClearDelay(); - - if (theInfo->GetIsSaving()) - DispatchToStorage(theInfo); - else - { - // See if this delayed URL was for an ftp drag &drop - if (theInfo->GetURLStruct()->files_to_post) - { - // See if the user really meant to upload - if (browserContext && !browserContext->Confirm((const char*)GetCString(MAC_UPLOAD_TO_FTP))) /* l10n */ - { - // Delete the info if not - delete theInfo; - } - else - { - // Ship it! - DispatchURL(theInfo); - } - } - else - { - // Plain ordinary delayed URL - DispatchURL(theInfo); - } - } - } -} - - -// 97-05-13 pkc -// New URL dispatch mechanism. - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchURL( - const char* inURL, - CNSContext* inTargetContext, - Boolean inDelay, - Boolean inForceCreate, - ResIDT inWindowResID, - Boolean inInitiallyVisible, - FO_Present_Types inOutputFormat, - NET_ReloadMethod inReloadMethod) -{ - CURLDispatchInfo* dispatchInfo = - new CURLDispatchInfo( - inURL, - inTargetContext, - inOutputFormat, - inReloadMethod, - inDelay, - inForceCreate, - false, - inWindowResID, - inInitiallyVisible - ); - DispatchURL(dispatchInfo); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchURL( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - Boolean inDelay, - Boolean inForceCreate, - ResIDT inWindowResID, - Boolean inInitiallyVisible, - FO_Present_Types inOutputFormat, - Boolean inWaitingForMochaImageLoad) -{ - CURLDispatchInfo* dispatchInfo = - new CURLDispatchInfo( - inURLStruct, - inTargetContext, - inOutputFormat, - inDelay, - inForceCreate, - false, - inWindowResID, - inInitiallyVisible, - inWaitingForMochaImageLoad - ); - DispatchURL(dispatchInfo); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchURL(CURLDispatchInfo* inDispatchInfo) -{ - XP_ASSERT(inDispatchInfo != NULL); - - // FIX ME??? Does this go here? - sLastBrowserWindowCreated = NULL; - - // paranoia - if (inDispatchInfo) - { - if (inDispatchInfo->GetDelay()) - { - GetURLDispatcher()->PostPendingDispatch(inDispatchInfo); - } - // Check to make sure URL type index is within dispatch table bounds - else if (inDispatchInfo->GetURLType() < cNumURLTypes) - { - // Get dispatch proc from table - DispatchProcPtr dispatchProc = dispatchProcs[inDispatchInfo->GetURLType()]; - if (dispatchProc) - { - (*dispatchProc)(inDispatchInfo); - } - } - } -} - -#pragma mark -- Dispatch Procs -- - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchToLibNet(CURLDispatchInfo* inDispatchInfo) -{ - CAutoPtr info(inDispatchInfo); - // If someone passed in a context, use it. - if (inDispatchInfo->GetTargetContext()) - { - inDispatchInfo->GetTargetContext()->ImmediateLoadURL(inDispatchInfo->ReleaseURLStruct(), inDispatchInfo->GetOutputFormat()); - } - else - { - try - { - if (!sDispatchContext.get()) - { - sDispatchContext.reset(new CBrowserContext()); - } - sDispatchContext->ImmediateLoadURL(inDispatchInfo->ReleaseURLStruct(), inDispatchInfo->GetOutputFormat()); - } - catch (...) - { - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchToBrowserWindow(CURLDispatchInfo* inDispatchInfo) -{ - CAutoPtr info(inDispatchInfo); - if (!inDispatchInfo->GetDelay()) - { - if (inDispatchInfo->GetForceCreate()) - { - // Must create a new window - DispatchToNewBrowserWindow(info.release()); - } - else if (inDispatchInfo->GetTargetContext()) - { - // Use target context if passed in - // 97-09-18 pchen -- use target if it's not "_self" - // I found "_current" in npglue.c; do we need to filter that also? - if (inDispatchInfo->GetURLStruct()->window_target && - XP_STRCASECMP(inDispatchInfo->GetURLStruct()->window_target, "_self")) - { - /* The thinking here is that if the URL specifies a preferred window target, - it's not safe to use the given context. There is a known case where - this is so; it involves a link in a subframe which links to an image - and contains a "target" tag. In this case, we use the only context - always known to be safe: the one belonging to the window itself. - This is precisely correct if the tag is "target = _top". I feel - queasy guaranteeing that it's correct for other values of target - as well, but pchen thinks it will always work. So: */ - CBrowserContext *topContext; - topContext = ExtractBrowserContext(*inDispatchInfo->GetTargetContext()); - inDispatchInfo->SetTargetContext(topContext->GetTopContext()); - } - (inDispatchInfo->GetTargetContext())->SwitchLoadURL(inDispatchInfo->ReleaseURLStruct(), inDispatchInfo->GetOutputFormat()); - } - else - { - // Find topmost "regular" browser window and dispatch into that window - CWindowMediator* theMediator = CWindowMediator::GetWindowMediator(); - CBrowserWindow* theTopWindow = - dynamic_cast(theMediator->FetchTopWindow(WindowType_Browser, regularLayerType, false)); - if (theTopWindow) - { - theTopWindow->Select(); - CNSContext* theCurrentContext = theTopWindow->GetWindowContext(); - theCurrentContext->SwitchLoadURL(inDispatchInfo->ReleaseURLStruct(), inDispatchInfo->GetOutputFormat()); - } - else - { - // No "regular" browser window available, so create one - DispatchToNewBrowserWindow(info.release()); - } - } - } - else - { - GetURLDispatcher()->PostPendingDispatch(info.release()); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchMailboxURL(CURLDispatchInfo* inDispatchInfo) -{ -#ifdef MOZ_MAIL_NEWS - const char* urlAddress = inDispatchInfo->GetURL(); - - // Test to see if this is an attachment URL - if (XP_STRSTR(urlAddress, "?part=") || XP_STRSTR(urlAddress, "&part=")) - { - // This is a mail attachment, dispatch to browser window - CURLDispatcher::DispatchToBrowserWindow(inDispatchInfo); - } - else if (inDispatchInfo->GetForceCreate()) - { - CMessageWindow::OpenFromURL (urlAddress); - /* note: we can't handle an internal link (as in the clause just below), so - we don't bother trying. Just load the message and let the user ask again - once that's completed, if it's really important to go to an internal link. */ - } - else if (XP_STRCHR(urlAddress, '#')) - { - // 97-06-08 pkc -- handle internal links here - if (inDispatchInfo->GetTargetContext()) - inDispatchInfo->GetTargetContext()->SwitchLoadURL( - inDispatchInfo->ReleaseURLStruct(), - inDispatchInfo->GetOutputFormat()); - } - else - { - // Otherwise, call DispatchToMailNewsWindow - DispatchToMailNewsWindow(inDispatchInfo); - } -#endif // MOZ_MAIL_NEWS -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchToMailNewsWindow(CURLDispatchInfo* inDispatchInfo) -{ -#ifdef MOZ_MAIL_NEWS - CAutoPtr info(inDispatchInfo); - CAutoPtrXP url(XP_STRDUP(inDispatchInfo->GetURL())); - - const char* urlAddress = url.get(); - - // Otherwise, call CMessageWindow::OpenFromURL - switch (MSG_PaneTypeForURL(urlAddress)) - { - case MSG_MAILINGLISTPANE: - // ? Open a list window to allow editing of this list? - // Ask someone. Phil? Michelle? - break; - - case MSG_ADDRPANE: - // Can't happen, MSG_PaneTypeForURL doesn't return this type, - // but a future release should, and MSG_NewWindowRequired should - // then return true. - break; - - case MSG_FOLDERPANE: - CMailNewsFolderWindow::FindAndShow(true); - break; - - case MSG_THREADPANE: - CThreadWindow::OpenFromURL(urlAddress); - break; - - case MSG_MESSAGEPANE: - CMessageWindow::OpenFromURL((char*)urlAddress); - break; - - case MSG_SUBSCRIBEPANE: - // Can't happen, MSG_PaneTypeForURL doesn't return this type, - // but a future release should, and MSG_NewWindowRequired should - // then return true. - // CSubscribePane::FindAndShow(); - break; - - case MSG_ANYPANE: // this gets returned for most URLs - - case MSG_COMPOSITIONPANE: - // presumably, this is from a mailto:, and we handle this already, below. - case MSG_SEARCHPANE: - // Already handled below. - default: - break; - } -#endif // MOZ_MAIL_NEWS -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CURLDispatcher::DispatchToNewBrowserWindow(CURLDispatchInfo* inDispatchInfo) -{ - CAutoPtr info(inDispatchInfo); - CBrowserWindow* theBrowserWindow = NULL; - CNSContext* theContext = NULL; - URL_Struct* theURLStruct = inDispatchInfo->GetURLStruct(); - - XP_ASSERT(inDispatchInfo != NULL); - if (inDispatchInfo) - { - theBrowserWindow = CreateNewBrowserWindow(inDispatchInfo->GetWindowResID(), false); - if (theBrowserWindow) - { - theContext = theBrowserWindow->GetWindowContext(); - if (theURLStruct != nil) - { - if (theURLStruct->window_target && theURLStruct->window_target[0] != '_') - { - // ¥ do not assign special names - theContext->SetDescriptor(theURLStruct->window_target); - } - if (theURLStruct->window_target) - theURLStruct->window_target[0] = 0; - theContext->ImmediateLoadURL(inDispatchInfo->ReleaseURLStruct(), inDispatchInfo->GetOutputFormat()); - } - if (inDispatchInfo->GetInitiallyVisible()) theBrowserWindow->Show(); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserWindow* CURLDispatcher::CreateNewBrowserWindow( - ResIDT inWindowResID, - Boolean inInitiallyVisible) -{ - CBrowserWindow* theBrowserWindow = NULL; - CBrowserContext* theContext = NULL; - - try - { - theContext = new CBrowserContext(); - StSharer theShareLock(theContext); - - theBrowserWindow = - dynamic_cast(URobustCreateWindow::CreateWindow(inWindowResID, LCommander::GetTopCommander())); - ThrowIfNULL_(theBrowserWindow); - - theBrowserWindow->SetWindowContext(theContext); - sLastBrowserWindowCreated = theBrowserWindow; - if (inInitiallyVisible) - theBrowserWindow->Show(); - } - catch (...) - { - delete theBrowserWindow; - throw; - } - - return theBrowserWindow; -} - -#pragma mark - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CURLDispatchInfo::CURLDispatchInfo() - : mURLType(HTTP_TYPE_URL), - mURLStruct(NULL), - mTargetContext(NULL), - mOutputFormat(NET_DONT_RELOAD), - mDelayDispatch(false), - mIsSaving(false), - mForceCreate(false), - mInitiallyVisible(true), - mIsWaitingForMochaImageLoad(false), - mWindowResID(1010) -{ -} - -CURLDispatchInfo::CURLDispatchInfo( - const char* inURL, - CNSContext* inTargetContext, - FO_Present_Types inOutputFormat, - NET_ReloadMethod inReloadMethod, - Boolean inDelay, - Boolean inForceCreate, - Boolean inIsSaving, - ResIDT inWindowResID, - Boolean inInitiallyVisible) - : mTargetContext(NULL), - mOutputFormat(inOutputFormat), - mDelayDispatch(inDelay), - mForceCreate(inForceCreate), - mIsSaving(inIsSaving), - mInitiallyVisible(inInitiallyVisible), - mIsWaitingForMochaImageLoad(false), - mWindowResID(inWindowResID) -{ - mURLStruct = NET_CreateURLStruct(inURL, inReloadMethod); - if (inTargetContext) - { - cstring theReferer = inTargetContext->GetCurrentURL(); - if (theReferer.length() > 0) - mURLStruct->referer = XP_STRDUP(theReferer); - mTargetContext = inTargetContext; - } - mURLType = NET_URL_Type(inURL); -} - -CURLDispatchInfo::CURLDispatchInfo( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - FO_Present_Types inOutputFormat, - Boolean inDelay, - Boolean inForceCreate, - Boolean inIsSaving, - ResIDT inWindowResID, - Boolean inInitiallyVisible, - Boolean inWaitingForMochaImageLoad) - : mURLStruct(inURLStruct), - mTargetContext(inTargetContext), - mOutputFormat(inOutputFormat), - mDelayDispatch(inDelay), - mForceCreate(inForceCreate), - mIsSaving(inIsSaving), - mInitiallyVisible(inInitiallyVisible), - mIsWaitingForMochaImageLoad(inWaitingForMochaImageLoad), - mWindowResID(inWindowResID) -{ -#if 0 -// It's not clear that we really want to call GetURLForReferral when the passed referer is -// NIL since it breaks Smart Browsing keywords and does not actually appear to be needed to -// fix bug #90892. It's also a security hole since it causes the URL of the front window to -// be sent as the referer even if the user manually types in a URL. - if (inTargetContext && mURLStruct->referer == NULL) - { - cstring theReferer = inTargetContext->GetCurrentURL(); - if (theReferer.length() > 0) - mURLStruct->referer = XP_STRDUP(theReferer); - mTargetContext = inTargetContext; - } -#endif - - if (inURLStruct) - mURLType = NET_URL_Type(inURLStruct->address); - else - mURLType = 0; -} - -CURLDispatchInfo::~CURLDispatchInfo() -{ - if (mURLStruct) - { - NET_FreeURLStruct(mURLStruct); - } -} - -URL_Struct* CURLDispatchInfo::ReleaseURLStruct() -{ - URL_Struct* url = mURLStruct; - mURLStruct = NULL; - return url; -} - -char* CURLDispatchInfo::GetURL() -{ - if (mURLStruct) - return mURLStruct->address; - else - return NULL; -} - -void CURLDispatchInfo::SetFileSpec(const FSSpec& inFileSpec) -{ - mFileSpec = inFileSpec; -} diff --git a/mozilla/cmd/macfe/central/CURLDispatcher.h b/mozilla/cmd/macfe/central/CURLDispatcher.h deleted file mode 100644 index 85be801c891..00000000000 --- a/mozilla/cmd/macfe/central/CURLDispatcher.h +++ /dev/null @@ -1,210 +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. - */ - -// CURLDispatcher.h - - -#ifndef CURLDispatcher_H -#define CURLDispatcher_H -#pragma once - -#include -#include - -#include "structs.h" -#include "CAutoPtr.h" -#include "ntypes.h" -#include "net.h" // for FO_CACHE_AND_PRESENT - -class CNSContext; -class CBrowserContext; -class CBrowserWindow; - -class CURLDispatchInfo; - -// Dispatch function prototype - -const ResIDT BrowserWindow_ResID = 1010; - -typedef void (*DispatchProcPtr)(CURLDispatchInfo* inDispatchInfo); - -class CURLDispatcher : - public LPeriodical, - public LListener -{ - public: - - static void DispatchToStorage( - URL_Struct* inURL, - const FSSpec& inDestSpec, - FO_Present_Types inOutputFormat = FO_SAVE_AS, - Boolean inDelay = false); - - static void DispatchToStorage(CURLDispatchInfo* inDispatchInfo); - - - virtual void SpendTime(const EventRecord& inMacEvent); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - static Uint32 CountDelayedURLs() { return GetURLDispatcher()->GetCountDelayedURLs(); } - - // 97-05-13 pkc -- New URL dispatch mechanism - - static void DispatchURL( - const char* inURL, - CNSContext* inTargetContext, - Boolean inDelay = false, - Boolean inForceCreate = false, - ResIDT inWindowResID = BrowserWindow_ResID, - Boolean inInitiallyVisible = true, - FO_Present_Types inOutputFormat = FO_CACHE_AND_PRESENT, - NET_ReloadMethod inReloadMethod = NET_DONT_RELOAD); - - static void DispatchURL( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - Boolean inDelay = false, - Boolean inForceCreate = false, - ResIDT inWindowResID = BrowserWindow_ResID, - Boolean inInitiallyVisible = true, - FO_Present_Types inOutputFormat = FO_CACHE_AND_PRESENT, - Boolean inWaitingForMochaImageLoad = false); - - static void DispatchURL(CURLDispatchInfo* inDispatchInfo); - - // Dispatch procs - - static void DispatchToLibNet(CURLDispatchInfo* inDispatchInfo); - static void DispatchToBrowserWindow(CURLDispatchInfo* inDispatchInfo); - static void DispatchMailboxURL(CURLDispatchInfo* inDispatchInfo); - static void DispatchToMailNewsWindow(CURLDispatchInfo* inDispatchInfo); - - // Utility functions - - static void DispatchToNewBrowserWindow(CURLDispatchInfo* inDispatchInfo); - static CBrowserWindow* CreateNewBrowserWindow( - ResIDT inWindowResID = BrowserWindow_ResID, - Boolean inInitiallyVisible = true); - - // Return the browser window created by the last call to DispatchToView. Note that - // if the dispatch was delayed, this will be null until the pending dispatch is processed. - static CBrowserWindow* GetLastBrowserWindowCreated() { return sLastBrowserWindowCreated; } - - protected: - - static CURLDispatcher* GetURLDispatcher(); // singleton class - - static void DispatchToDisk(CURLDispatchInfo* inDispatchInfo); - - static void DispatchToDiskAsText(CURLDispatchInfo* inDispatchInfo); - - Uint32 GetCountDelayedURLs() const { return mDelayedURLs.GetCount(); } - - virtual void PostPendingDispatch(CURLDispatchInfo* inDispatchInfo); - - virtual void UpdatePendingDispatch( - CNSContext* inForContext); - - virtual void ProcessPendingDispatch(void); - - LArray mDelayedURLs; - - // reset to NULL on entry in DispatchToView(), set in DispatchToNewBrowserWindow() - static CBrowserWindow* sLastBrowserWindowCreated; - - static CAutoPtr sDispatcher; - static CAutoPtr sDispatchContext; - - -private: - friend class CAutoPtr; - friend class CAutoPtr; - - CURLDispatcher(); - virtual ~CURLDispatcher(); - -}; - -// Info needed to dispatch a URL -class CURLDispatchInfo -{ - public: - CURLDispatchInfo(); - - CURLDispatchInfo( - const char* inURL, - CNSContext* inTargetContext, - FO_Present_Types inOutputFormat, - NET_ReloadMethod inReloadMethod = NET_DONT_RELOAD, - Boolean inDelay = false /* BLECH! */, - Boolean inForceCreate = false, - Boolean inIsSaving = false, - ResIDT inWindowResID = BrowserWindow_ResID, - Boolean inInitiallyVisible = true); - - CURLDispatchInfo( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - FO_Present_Types inOutputFormat, - Boolean inDelay = false /* BLECH! */, - Boolean inForceCreate = false, - Boolean inIsSaving = false, - ResIDT inWindowResID = BrowserWindow_ResID, - Boolean inInitiallyVisible = true, - Boolean inWaitingForMochaImageLoad = false); - - virtual ~CURLDispatchInfo(); - - Int32 GetURLType() { return mURLType; } - char* GetURL(); - URL_Struct* GetURLStruct() { return mURLStruct; } - CNSContext* GetTargetContext() { return mTargetContext; } - FO_Present_Types GetOutputFormat() { return mOutputFormat; } - Boolean GetDelay() { return mDelayDispatch; } - Boolean GetIsSaving() { return mIsSaving; } - Boolean GetInitiallyVisible() { return mInitiallyVisible; } - FSSpec& GetFileSpec() { return mFileSpec; } - ResIDT GetWindowResID() { return mWindowResID; } - Boolean GetForceCreate() { return mForceCreate; } - Boolean GetIsWaitingForMochaImageLoad() - { return mIsWaitingForMochaImageLoad; } - - URL_Struct* ReleaseURLStruct(); - - void ClearDelay() { mDelayDispatch = false; } - void SetFileSpec(const FSSpec& inFileSpec); - void SetTargetContext(CNSContext* inTargetContext) - { mTargetContext = inTargetContext; } - - protected: - Int32 mURLType; - URL_Struct* mURLStruct; - CNSContext* mTargetContext; - FO_Present_Types mOutputFormat; - Boolean mDelayDispatch; - Boolean mForceCreate; - Boolean mIsSaving; - Boolean mInitiallyVisible; - Boolean mIsWaitingForMochaImageLoad; - FSSpec mFileSpec; - ResIDT mWindowResID; -}; -#endif diff --git a/mozilla/cmd/macfe/central/ExternalMail.cp b/mozilla/cmd/macfe/central/ExternalMail.cp deleted file mode 100644 index 67bad46552a..00000000000 --- a/mozilla/cmd/macfe/central/ExternalMail.cp +++ /dev/null @@ -1,184 +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. - */ - -/* - This file contains Navigator only code which supports "Send Page..." and - "mailto:" URLs using an external mail client registered with InternetConfig. -*/ - -#ifndef MOZ_MAIL_NEWS - -#include "msgcom.h" // MSG_MailDocument() -#include "xlate.h" // PrintSetup -#include "shist.h" // SHIST_GetCurrent() -#include "xpgetstr.h" // XP_GetString() -#include "CURLDispatcher.h" // CURLDispatcher::DispatchURL() -#include "CNSContext.h" // ExtractNSContext() -#include "net.h" // NET_Escape() - -extern int MK_MSG_MSG_COMPOSITION; - -#define MAX_MAIL_SIZE 300000 -extern "C" void FE_DoneMailTo(PrintSetup * print) ; -extern "C" void FE_DoneMailTo(PrintSetup * print) -{ - const char * prefix = "mailto:?body="; - const char * blankLines = "\r\n\r\n"; - - XP_ASSERT(print); - if (!print) - return; - - XP_ASSERT(print->url); - if (!print->url) - return; - - fclose(print->out); // don't need this for writing anymore. - - MWContext * context = (MWContext *) (print->carg); - if (!context) // we'll require this later - return; - - char * buffer = (char *) malloc(MAX_MAIL_SIZE); - - if (buffer) { - strcpy(buffer, print->url->address); - strcat(buffer, blankLines); - - int buflen = strlen(buffer); - - // now tack as much of the page onto the body as we have space for... - FILE * fp = fopen(print->filename, "r"); - if (fp) { - int len = fread(buffer + buflen, 1, MAX_MAIL_SIZE - buflen - (5 /* slop? */), fp); - buffer[buflen + len] = '\0'; - fclose(fp); - - char *temp = NET_Escape (buffer, URL_XALPHAS); - - XP_FREE(buffer); - buffer = temp; - - } else { - - XP_FREE(buffer); - buffer = NULL; - - } - } - - // get rid of the file and free the memory - remove(print->filename); - - char *buffer2 = NULL; - - if (buffer) { - - buffer2 = (char *) malloc(strlen(prefix) + strlen(buffer) + 1); - - if (buffer2) { - strcpy(buffer2, prefix); // start creating a "mailto:" URL - strcat(buffer2, buffer); // the message - } - } - - if (buffer2 == NULL) { // no buffer, or we don't have enough memory to use it, try to just send the URL... - if (buffer) - XP_FREE(buffer); // if we're here, we can't use the buffer anyway... - - buffer = NET_Escape (print->url->address, URL_XALPHAS); - if (buffer == NULL) - return; // not enough memory to do ANYTHING useful! - - buffer2 = (char *) malloc(strlen(prefix) + strlen(buffer) + 1); - if (buffer2 == NULL) { - XP_FREE(buffer); - return; // not enough memory to do ANYTHING useful! - } - - strcpy(buffer2, prefix); // start creating a "mailto:" URL - strcat(buffer2, buffer); // the message - } - - XP_FREE(buffer); - - // XP_FREE(print->filename); - // print->filename = NULL; - CURLDispatcher::DispatchURL(buffer2, ExtractNSContext(context)); - XP_FREE(buffer2); -} - -#ifndef MOZ_MAIL_COMPOSE -extern MSG_Pane* MSG_MailDocument(MWContext *context) -{ - if(!context) - return NULL; - - History_entry * hist_ent = SHIST_GetCurrent(&(context->hist)); - - // make sure there was a document loaded - if(!hist_ent) - return NULL; - - - //Set hist_ent to NULL if context->title is "Message Composition" - //This is a nasty way of determining if we're in here in response - //to "Mail Doc" or "New Mail Message". - //Also, if there's To: field info present(pBar->m_pszTo) then - //we know that it's a Mailto: and set hist_ent to NULL - //Without this differentiation the code always sends the contents - //of the previously mailed document even when someone chooses - //"New Mail Message" or "Mailto:" - - if(!strcmp(XP_GetString(MK_MSG_MSG_COMPOSITION), context->title)) - return NULL; - - URL_Struct * URL_s = SHIST_CreateURLStructFromHistoryEntry(context, hist_ent); - if (!URL_s) - return NULL; - - // Zero out the saved data - memset(&URL_s->savedData, 0, sizeof(URL_s->savedData)); - - PrintSetup print; - - XL_InitializeTextSetup(&print); - print.width = 68; - print.prefix = ""; - print.eol = "\r\n"; - - char * name = WH_TempName(xpTemporary, NULL); - if(!name) { - // Leak URL_s here - return(FALSE); - } - - print.out = fopen(name, "w"); - print.completion = (XL_CompletionRoutine) FE_DoneMailTo; - print.carg = context; - print.filename = name; - print.url = URL_s; - - // leave pCompose window alive until completion routine - XL_TranslateText(context, URL_s, &print); - - return NULL; -} -#endif // ! MOZ_MAIL_COMPOSE - -#endif // !MOZ_MAIL_NEWS \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/InternetConfig.cp b/mozilla/cmd/macfe/central/InternetConfig.cp deleted file mode 100644 index 603807839c0..00000000000 --- a/mozilla/cmd/macfe/central/InternetConfig.cp +++ /dev/null @@ -1,670 +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. - */ - -// InternetConfig.cp -// -// Created by Tim Craycroft, 2/9/96 -// - -#include "InternetConfig.h" - -#include -#include - -#include -#include - -#include "xp_core.h" -#include "xp_str.h" - -#include "uprefd.h" -#include "prefapi.h" // ns/modules/libpref -#include "ufilemgr.h" -#include "resgui.h" - -// -// InternetConfig class. -// -// Checks the IC seed on resume events -// -class CInternetConfig -{ - public: - - static void Connect(); - static void Disconnect(); - - static ICError GetInternetConfigString(ConstStr255Param icKey, - Str255 s, - long *port = nil); - - static ICError GetInternetConfigFileMapping( OSType fileType, - OSType creator, - ConstStr255Param fileName, - ICMapEntry *ent); - static ICError MapFileName( ConstStr255Param filename, ICMapEntry *ent ); - static ICError GetFileSpec( ConstStr255Param icKey , FSSpec & ioSpec ); - static ICError LaunchInternetConfigApplication(ConstStr255Param key); - -#ifndef MOZ_MAIL_NEWS - static ICError SendInternetConfigURL(char *address); -#endif - - static int UseICPrefCallback(const char *prefString, void *); - static void ResumeEvent(); - - static Boolean CurrentlyUsingIC(); - - static Boolean HaveICInstance(); - - private: - - CInternetConfig(); - ~CInternetConfig(); - - void SynchIf(); // iff the seed has changed - void SynchFromIC(); - ICError SynchStringFromIC( ConstStr255Param icKey, - CPrefs::PrefEnum netscapePref, - Boolean stripPort = false, - const char *xpPortPrefName = nil, - int32 defaultPort = 0); - - ICError SynchSplitStringFromIC( ConstStr255Param icKey, - char divider, - CPrefs::PrefEnum firstString, - CPrefs::PrefEnum secondString, - Boolean stripPort = false); - ICError SyncFileSpec ( ConstStr255Param icKey, CPrefs::PrefEnum netscapePref ); - ICError GetICString( ConstStr255Param icKey, - Str255 s, - int32 *port = nil); - ICError GetFSSpec( ConstStr255Param icKey , FSSpec & ioSpec ); - ICError GetICFileMapping( OSType fileType, - OSType creator, - ConstStr255Param fileName, - ICMapEntry *ent); - ICError MapICFileName( ConstStr255Param filename, ICMapEntry *ent ); - ICError LaunchICApplication(ConstStr255Param key); - -#ifndef MOZ_MAIL_NEWS - ICError SendICURL(char *address); -#endif - ICInstance fInstance; - SInt32 fSeed; - - static CInternetConfig* sInternetConfigConnection; -}; - - -void -CInternetConfigInterface::ResumeEvent() -{ - CInternetConfig::ResumeEvent(); -} - -// -// ConnectToInternetConfig -// -// Only public entrypoint to this InternetConfig module. -// -// gets the folder from CPrefs::GetFilePrototype(prefSpec(, MainFolder) -// -void -CInternetConfigInterface::ConnectToInternetConfig() -{ - // I assume that this is only called once, at startup. - const char *useICPrefName = "browser.mac.use_internet_config"; - PREF_RegisterCallback(useICPrefName, CInternetConfig::UseICPrefCallback, nil); - try - { - if (CInternetConfig::CurrentlyUsingIC()) - { - CInternetConfig::Connect(); - } - } - catch(ICError err) - { - // do something ? a dialog perhaps ? - // only if there is a real problem, not if - // IC just isn't installed. - } -} - -void -CInternetConfigInterface::DisconnectFromInternetConfig() -{ - CInternetConfig::Disconnect(); -} - -Boolean -CInternetConfigInterface::CurrentlyUsingIC(void) -{ - Boolean returnValue = TRUE; - returnValue = returnValue && CInternetConfig::CurrentlyUsingIC(); - returnValue = returnValue && CInternetConfig::HaveICInstance(); - - return returnValue; -} - -void -CInternetConfigInterface::GetInternetConfigString( ConstStr255Param icKey, - Str255 s, - long *port) -{ - if (CInternetConfig::GetInternetConfigString(icKey, s, port)) - { - s[0] = 0; - } -} - -ICError -CInternetConfigInterface::GetInternetConfigFileMapping( OSType fileType, - OSType creator, - ConstStr255Param fileName, - ICMapEntry *ent) -{ - return CInternetConfig::GetInternetConfigFileMapping(fileType, creator, - fileName, ent); -} - - -ICError CInternetConfigInterface::MapFileName( ConstStr255Param filename, ICMapEntry *ent ) -{ - return CInternetConfig::MapFileName( filename , ent ); -} -#ifndef MOZ_MAIL_NEWS -ICError -CInternetConfigInterface::SendInternetConfigURL(char *address) -{ - return CInternetConfig::SendInternetConfigURL(address); -} -#endif - -ICError -CInternetConfigInterface::LaunchInternetConfigApplication(ConstStr255Param key) -{ - return CInternetConfig::LaunchInternetConfigApplication(key); -} - -ICError CInternetConfigInterface::GetFileSpec( ConstStr255Param icKey , FSSpec & ioSpec ) -{ - return CInternetConfig::GetFileSpec( icKey, ioSpec); -} - -CInternetConfig* -CInternetConfig::sInternetConfigConnection = nil; - -Boolean -CInternetConfig::CurrentlyUsingIC() -{ - - XP_Bool result; - const char *useICPrefName = "browser.mac.use_internet_config"; - if (PREF_NOERROR != PREF_GetBoolPref(useICPrefName, &result)) - { - result = false; - } - return (Boolean)result; -} - - -// -// CInternetConfig::Connect -// -// Call once to hook up with IC. -// -void -CInternetConfig::Connect() -{ - if (!sInternetConfigConnection) - { - sInternetConfigConnection = new CInternetConfig(); - } -} - -// -// Bail -// -void -CInternetConfig::Disconnect() -{ - if (sInternetConfigConnection != nil) - { - delete sInternetConfigConnection; - sInternetConfigConnection = nil; - } -} - -Boolean -CInternetConfig::HaveICInstance(void) -{ - Boolean returnValue = FALSE; - - Connect(); - if (sInternetConfigConnection != nil) - { - returnValue = (sInternetConfigConnection->fInstance != NULL); - } - - return returnValue; -} - -// -// CInternetConfig::CInternetConfig -// -CInternetConfig::CInternetConfig(): -fInstance(NULL) -{ - ICError err; - - // Detect IC, if present - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - err = ::ICStart(&fInstance, emSignature); - //ThrowIfOSErr_(err); - if (!err) - { - try - { - - ICDirSpec prefDir[1]; - ICDirSpecArrayPtr prefDirArray; - UInt32 dirCount = 0; - - // what a wonderful api... - // - // Give IC the directory that contains the pref file we're using - // so it can look there for an IC config file. - prefDirArray = (ICDirSpecArrayPtr) &prefDir; - FSSpec prefSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - prefDir[0].vRefNum = prefSpec.vRefNum; - prefDir[0].dirID = prefSpec.parID; - dirCount = 1; - - err = ::ICFindConfigFile(fInstance, dirCount, prefDirArray); - ThrowIfOSErr_(err); - - // Remember initial seed - err = ::ICGetSeed(fInstance, &fSeed); - ThrowIfOSErr_(err); - - // Read prefs from IC - if (CurrentlyUsingIC()) - { - SynchFromIC(); - } - } - catch(ICError err) - { - // Close IC connection and pass the error along - ::ICStop(fInstance); - fInstance = NULL; - // throw(err); - // we probably out to delete "this" as well - } - } -} - -int -CInternetConfig::UseICPrefCallback(const char *, void *) -{ - if (CInternetConfig::CurrentlyUsingIC()) - { - Connect(); - sInternetConfigConnection->SynchFromIC(); - } - return 0; // You don't even want to know my opinion of this! -} - - -// -// CInternetConfig::~CInternetConfig -// -CInternetConfig::~CInternetConfig() -{ - if (fInstance != NULL) - { - ::ICStop(fInstance); // close IC connection - } -} - -// -// CInternetConfig::SynchFromIC -// -// Reads IC settings and converts them to Netscape prefs -// -void -CInternetConfig::SynchFromIC() -{ - ICError err; - - err = ::ICBegin(fInstance, icReadOnlyPerm); - ThrowIfOSErr_(err); - - // Again, this is lame. - // - // We should have a table of some sort - // - SynchStringFromIC(kICRealName, CPrefs::UserName); - SynchStringFromIC(kICEmail, CPrefs::UserEmail); - SynchStringFromIC(kICEmail, CPrefs::ReplyTo); // IC has no reply-to - SynchSplitStringFromIC(kICMailAccount, '@', CPrefs::PopID, CPrefs::PopHost, true); - SynchStringFromIC(kICSMTPHost, CPrefs::SMTPHost, true); - SynchStringFromIC(kICWWWHomePage, CPrefs::HomePage); - SynchStringFromIC(kICOrganization, CPrefs::Organization); - SynchStringFromIC(kICNNTPHost, CPrefs::NewsHost, true, "news.server_port", 119); - SyncFileSpec( kICDownloadFolder, CPrefs::DownloadFolder ); - ::ICEnd(fInstance); -} - -void -CInternetConfig::SynchIf() -{ - SInt32 seed; - - if (::ICGetSeed(fInstance, &seed)) - { - return; - } - if (seed != fSeed) - { - try - { - SynchFromIC(); - } - catch(ICError err) - { - } - fSeed = seed; - } -} - -// -// CInternetConfig::ResumeEvent -// -// -void -CInternetConfig::ResumeEvent() -{ - if (CurrentlyUsingIC()) - { - Connect(); - sInternetConfigConnection->SynchIf(); - } -} - -// -// CInternetConfig::SynchStringFromIC -// -// Set a netscape string from an IC string -ICError -CInternetConfig::SynchStringFromIC( ConstStr255Param icKey, - CPrefs::PrefEnum netscapePref, - Boolean stripPort, - const char *xpPortPrefName, - int32 defaultPort) -{ - char s[256]; - ICError err; - - int32 *portPtr = stripPort ? &defaultPort : nil; - - err = GetICString(icKey, (unsigned char*) s, portPtr); - if (err == 0) - { - p2cstr((StringPtr)s); - CPrefs::SetString(s, netscapePref); - if (xpPortPrefName) - { - PREF_SetIntPref(xpPortPrefName, defaultPort); - } - } - return err; -} - -// -// CInternetConfig::SynchSplitStringFromIC -// -// Takes a single IC string and splits it into two Netscape strings. -// Useful for machine@host.domain.com, or proxy.address:port type stuff -// -// If the divider can't be found, the entire string is put into the -// first netscape string and the second netscape string is set to '\0' -// -ICError -CInternetConfig::SynchSplitStringFromIC( ConstStr255Param icKey, - char divider, - CPrefs::PrefEnum firstString, - CPrefs::PrefEnum secondString, - Boolean stripPort) -{ - char buffer[256]; - char *s; - char *split; - ICError err; - - s = buffer; - err = GetICString(icKey, (unsigned char *) s); - if (err != 0) return err; - - p2cstr((StringPtr)s); - - split = strchr(s, divider); - if (split != NULL) - { - *split = '\0'; - if (stripPort) - { - char *colon = strchr(split+1, ':'); - if (colon) - { - *colon = '\0'; - } - } - CPrefs::SetString(split+1, secondString); - } - else - { - CPrefs::SetString('\0', secondString); - } - CPrefs::SetString(s, firstString); - - return 0; -} - -// -// CInternetConfig::GetICString -// -// Gets an IC string pref -// -ICError -CInternetConfig::GetInternetConfigString( ConstStr255Param icKey, - Str255 s, - long *port) -{ - Connect(); - return sInternetConfigConnection->GetICString(icKey, s, port); -} - -// -// CInternetConfig::GetICString -// -// Gets an IC string pref -// -ICError -CInternetConfig::GetICString( ConstStr255Param icKey, - Str255 s, - int32 *port) -{ - ICAttr attr; - long size = 256; - ICError result; - result = ::ICGetPref(fInstance, icKey, &attr, (Ptr)s, &size); - if (!result) - { - if (port) - { - char cString[256]; - BlockMoveData(&s[1], cString, s[0]); - cString[s[0]] = '\0'; - char *colon = strchr(cString, ':'); - if (colon) - { - *colon = '\0'; - s[0] = colon - cString; - ++colon; - // IC supposedly supports notations like: - // news.netscape.com:nntp - // The protocol services don't seem to work in IC (or I'm to stupid - // to make them work), so we just check for this one value ("nntp") - // because that is the only protocol for which we support port numbers. - if (!XP_STRCASECMP("nntp", colon)) - { - *port = 119; - } - else - { - // Add more protocols here if/when we suppor them. - long portFromICString; - int numargs = sscanf(colon, "%ld", &portFromICString); - if (1 == numargs) - { - if (portFromICString >= 0) // negative port numbers are not valid - { - *port = portFromICString; - } - } - // else we just use the default port - } - } - } - } - return result; -} - -#ifndef MOZ_MAIL_NEWS -ICError -CInternetConfig::SendInternetConfigURL(char *address) -{ - Connect(); - return sInternetConfigConnection->SendICURL(address); -} - -ICError -CInternetConfig::SendICURL(char *address) -{ - if (address == NULL) - return icNoURLErr; - - long selStart = 0; - long selEnd = strlen(address); - - if( CInternetConfig::HaveICInstance() ) - return ::ICLaunchURL(fInstance, "\p", address, selEnd, &selStart, &selEnd); - else - return icPrefNotFoundErr; -} -#endif - -ICError -CInternetConfig::GetInternetConfigFileMapping( OSType fileType, - OSType creator, - ConstStr255Param filename, - ICMapEntry *ent) -{ - Connect(); - return sInternetConfigConnection->GetICFileMapping(fileType, creator, filename, ent); -} - -ICError -CInternetConfig::GetICFileMapping( OSType fileType, - OSType creator, - ConstStr255Param filename, - ICMapEntry *ent) -{ - if( CInternetConfig::HaveICInstance() ) - return ::ICMapTypeCreator(fInstance, fileType, creator, filename, ent); - else - return icPrefNotFoundErr; -} - -ICError -CInternetConfig::LaunchInternetConfigApplication(ConstStr255Param key) -{ - Connect(); - return sInternetConfigConnection->LaunchICApplication(key); -} - -ICError -CInternetConfig::LaunchICApplication(ConstStr255Param key) -{ - if (CInternetConfig::HaveICInstance()) - return ::ICEditPreferences(fInstance, key); - else - return icPrefNotFoundErr; -} -ICError -CInternetConfig::MapFileName( ConstStr255Param filename, ICMapEntry *ent) -{ - Connect(); - return sInternetConfigConnection->MapICFileName(filename, ent); -} - -ICError CInternetConfig::MapICFileName( ConstStr255Param filename, ICMapEntry *ent ) -{ - if( CInternetConfig::HaveICInstance() ) - return ::ICMapFilename(fInstance, filename, ent); - else - return icPrefNotFoundErr; - -} - -ICError CInternetConfig::GetFileSpec( ConstStr255Param icKey , FSSpec & ioSpec ) -{ - Connect(); - return sInternetConfigConnection->GetFSSpec(icKey, ioSpec); -} - -ICError CInternetConfig::GetFSSpec( ConstStr255Param icKey , FSSpec & ioSpec ) -{ - ICFileSpec* spec; - - ICAttr attr; - char buffer[512]; - long size = 512; - ICError result; - - result = ::ICGetPref(fInstance, icKey, &attr, buffer, &size); - if (!result) - { - spec = (ICFileSpec *) buffer; - CFileMgr::CopyFSSpec( spec->fss, ioSpec ); - } - return result; -} - -ICError CInternetConfig::SyncFileSpec ( ConstStr255Param icKey, CPrefs::PrefEnum netscapePref ) -{ - FSSpec icSpec; - ICError result = GetFSSpec( icKey, icSpec ); - if( !result ) - { - CPrefs::SetFolderSpec( icSpec , netscapePref ); - } - return result; -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/InternetConfig.h b/mozilla/cmd/macfe/central/InternetConfig.h deleted file mode 100644 index ca0b68301ed..00000000000 --- a/mozilla/cmd/macfe/central/InternetConfig.h +++ /dev/null @@ -1,89 +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. - */ - -// -// InternetConfig.h -// -// MacFE interface to its support for Apple Internet Config -// -// Created by Tim Craycroft, 2/11/96 -// -// - -#pragma once - -#include "ICAPI.h" - -// Always call. -// -// This will determine if InternetConfig is present -// and do the right thing. -// -// Everything else is taken care of behind the scenes. -// - -// Note: -//------ -// It reads "Everything else is taken care of behind the scenes" and that's right: -// the API below is ok. That's the "everything else" which is sub optimal. -// If you need to add a method in CInternetConfigInterface, I recommend you to -// have a look at how LaunchInternetConfigApplication() and GetInternetConfigString() -// are implemented. For a single method here, you need two methods "behind the scenes". - -class CInternetConfigInterface -{ - public: - - static Boolean CurrentlyUsingIC(void); - // returns true iff IC is installed and we're listening to it - - static ICError LaunchInternetConfigApplication(ConstStr255Param key); - // Lauches the app and opens one of the config panels (if specified). - // The list of keys is in . - - static void ConnectToInternetConfig(); - // gets the folder from CPrefs::GetFilePrototype(prefSpec(, MainFolder) - - static void DisconnectFromInternetConfig(); - // yeah, like this gets called - - static void GetInternetConfigString(ConstStr255Param icKey, - Str255 s, - long *port= nil); - // If an error is encountered, s is set to "\p". - // If port is not nil, then the following assumptions are made: - // * The string is a server name that may be have a ":portnumber" - // appended to it. - // * The initial value of *port is the default port number. - // If port is not nil, then the returned string will have the ":number" - // stripped and the *port value will be the port specified by the - // user. - - static ICError GetInternetConfigFileMapping( OSType fileType, - OSType creator, - ConstStr255Param filename, - ICMapEntry *ent); - static ICError MapFileName( ConstStr255Param filename, ICMapEntry *ent ); - static ICError GetFileSpec( ConstStr255Param icKey , FSSpec & ioSpec ); -#ifndef MOZ_MAIL_NEWS - static ICError SendInternetConfigURL(char *address); -#endif - - static void ResumeEvent(); - // somebody call me when I need to check the IC seed value -}; diff --git a/mozilla/cmd/macfe/central/LTSMSupport.cp b/mozilla/cmd/macfe/central/LTSMSupport.cp deleted file mode 100644 index 7c981c3bf1c..00000000000 --- a/mozilla/cmd/macfe/central/LTSMSupport.cp +++ /dev/null @@ -1,257 +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. - */ - -#include "LTSMSupport.h" -static Boolean mHasTextServices = false; -static Boolean mHasTSMTE = false; -static ScriptCode mSysScript = smRoman; -static Boolean mTSMTEisVersion1 = false; -static TSMTEPreUpdateUPP mTSMTEPreUpdateUPP = NULL; -static TSMTEPostUpdateUPP mTSMTEPostUpdateUPP = NULL; - - -static Boolean TrapAvailable(short theTrap); -static pascal void DefaultTSMTEPreUpdateProc(TEHandle textH, long refCon); - -// --------------------------------------------------------------------------- -// Copy from InlineInputSample.c -// this TSMTEPreUpdateProc only works around a bug in TSMTE 1.0, which has -// been fixed in 1.1. For other possible uses, see technote TE 27. -// --------------------------------------------------------------------------- - -static pascal void DefaultTSMTEPreUpdateProc(TEHandle textH, long refCon) -{ - #pragma unused(refCon) - - - if (mTSMTEisVersion1) // Modified here for performance - { - ScriptCode keyboardScript; - short mode; - TextStyle theStyle; - - keyboardScript = ::GetScriptManagerVariable(smKeyScript); - mode = doFont; - if (!(::TEContinuousStyle(&mode, &theStyle, textH) && - ::FontToScript(theStyle.tsFont) == keyboardScript)) - { - theStyle.tsFont = ::GetScriptVariable(keyboardScript, smScriptAppFond); - ::TESetStyle(doFont, &theStyle, false, textH); - }; - }; -} - -// --------------------------------------------------------------------------- -// ¥ Initialization -// --------------------------------------------------------------------------- -// Default constructor -void LTSMSupport::Initialize() -{ - mSysScript = ::GetScriptManagerVariable(smSysScript); - CheckForTextServices(); - BeginTextServices(); - TSMTENewUPP(); -} -// --------------------------------------------------------------------------- -// ¥ CheckForTextServices -// Call by constructor -// From TE27 Page 4/14 -// --------------------------------------------------------------------------- -void LTSMSupport::CheckForTextServices(void) -{ - long gestaltResponse; - - if (::TrapAvailable(_Gestalt)) - { - if ((::Gestalt(gestaltTSMgrVersion, &gestaltResponse) == noErr) && - (gestaltResponse >= 1)) - { - mTSMTEisVersion1 = (gestaltResponse == gestaltTSMTE1); - mHasTextServices = true; - if (::Gestalt(gestaltTSMTEAttr, &gestaltResponse) == noErr) - mHasTSMTE = ((gestaltResponse >> gestaltTSMTEPresent) & 1); - }; - }; -} - -// --------------------------------------------------------------------------- -// ¥ TSMTENewUPP -// Modified from InlineInputSample.c -// --------------------------------------------------------------------------- -void LTSMSupport::TSMTENewUPP() -{ - if(mHasTSMTE) { - if(mTSMTEPreUpdateUPP == NULL ) - mTSMTEPreUpdateUPP = NewTSMTEPreUpdateProc(DefaultTSMTEPreUpdateProc); - } -} -// --------------------------------------------------------------------------- -// ¥ BeginTextServices -// Call by constructor -// From TE27 Page 4/14 -// --------------------------------------------------------------------------- -void LTSMSupport::BeginTextServices() -{ - if (!(mHasTSMTE && ::InitTSMAwareApplication() == noErr)) - { - // if this happens, just move on without text services - mHasTextServices = false; - mHasTSMTE = false; - }; -} -// --------------------------------------------------------------------------- -// ¥ DoQuit -// Called by DoQuit() -// From TE27 Page 4/14 -// --------------------------------------------------------------------------- -void LTSMSupport::DoQuit(Int32 /* inSaveOption */) -{ - if (mHasTextServices) - (void) ::CloseTSMAwareApplication(); -} -// --------------------------------------------------------------------------- -// ¥ IntlTSMEvent -// From TE27 Page 11/14 -// --------------------------------------------------------------------------- -Boolean -LTSMSupport::TSMEvent(const EventRecord &inMacEvent) -{ - if(mHasTextServices) - { - // make sure we have a port and it's not the Window Manager port -// if (qd.thePort != nil && ::FrontWindow() != nil) -// { -// oldFont = qd.thePort->txFont; -// keyboardScript = ::GetScriptManagerVariable(smKeyScript); -// if (::FontToScript(oldFont) != keyboardScript) -// ::TextFont(GetScriptVariable(keyboardScript, smScriptAppFond)); -// }; - return ::TSMEvent((EventRecord *)&inMacEvent); - } - else - { - return false; - } -} -// --------------------------------------------------------------------------- -// ¥ IntlTSMEvent -// From TE27 Page 11/14 -// --------------------------------------------------------------------------- -Boolean LTSMSupport::SetTSMCursor(Point mousePos) -{ - if(mHasTextServices) - return ::SetTSMCursor(mousePos); - else - return false; -} -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -Boolean LTSMSupport::HasTextServices() -{ - return mHasTextServices; -} -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -Boolean LTSMSupport::HasTSMTE() -{ - return mHasTSMTE; -} -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- - -TSMTEPreUpdateUPP LTSMSupport::GetDefaultTSMTEPreUpdateUPP() -{ - return mTSMTEPreUpdateUPP; -} -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -TSMTEPostUpdateUPP LTSMSupport::GetDefaultTSMTEPostUpdateUPP() -{ - return mTSMTEPostUpdateUPP; -} -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -void LTSMSupport::StartFontScriptLimit() -{ - //short theFontScript = ::FontScript(); - //StartFontScriptLimit(theFontScript); -} - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -void LTSMSupport::StartFontScriptLimit( ScriptCode /* scriptcode */) -{ - // We want to disable all the script except: Roman and the Font script - // 1. we have set the system script to the font script - // 2. disable all the script except Roman and System script by calling - // KeyScript(smDisablKybds); - // 3. Should we also switch input method to the font script ? - // 4. restore the system script. - //if(mSysScript != scriptcode) - //{ - // ::SetScriptManagerVariable(smSysScript, scriptcode); - //} - //if(scriptcode != ::GetScriptManagerVariable(smKeyScript)) - //{ - // ::KeyScript(scriptcode); - //} -// ::KeyScript(smKeyDisableKybds); -// ::SetScriptManagerVariable(smSysScript, mSysScript); -} -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -void LTSMSupport::EndFontScriptLimit() -{ - // Re-enable all the script - //::KeyScript(smKeyEnableKybds); - //::SetScriptManagerVariable(smSysScript, mSysScript); -} -// --------------------------------------------------------------------------- -// check to see if a given trap is implemented. We follow IM VI-3-8. -// --------------------------------------------------------------------------- -static -Boolean TrapAvailable(short theTrap) -{ - TrapType theTrapType; - short numToolboxTraps; - - if ((theTrap & 0x0800) > 0) - theTrapType = ToolTrap; - else - theTrapType = OSTrap; - - if (theTrapType == ToolTrap) - { - theTrap = theTrap & 0x07ff; - if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xaa6e, ToolTrap)) - numToolboxTraps = 0x0200; - else - numToolboxTraps = 0x0400; - if (theTrap >= numToolboxTraps) - theTrap = _Unimplemented; - }; - - return (NGetTrapAddress(theTrap, theTrapType) != NGetTrapAddress(_Unimplemented, ToolTrap)); -} diff --git a/mozilla/cmd/macfe/central/LTSMSupport.h b/mozilla/cmd/macfe/central/LTSMSupport.h deleted file mode 100644 index 9ea1968f694..00000000000 --- a/mozilla/cmd/macfe/central/LTSMSupport.h +++ /dev/null @@ -1,68 +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. - */ - -#include -#ifndef __LTSMSUPPORT__ -#define __LTSMSUPPORT__ - -#include - -// ftang: -// LTSMSupport handle the following TSM stuff: -// InitTSMAwareApplication() - in Initalize() => BeginTextServices() -// CloseTSMAwareApplication() - in DoQuit() => EndTextServices() -// TSMEvent() - in TSMEvent() -// SetTSMCursor() - in SetTSMCursor() -// -// LTSMSupport handle the following TSM stuff: -// NewTSMDocument() -// DeleteTSMDocument() -// ActiveTSMDocument() -// DeactivateTSMDocument() -// FixTSMDocument() -// -// The following TSM stuff will not be handle: -// TSMMenuSelect() : We only deal with input method. Therefore, ignore it -// See IM-Text 7-22 - -class LTSMSupport { -public: - static void Initialize(); - static void DoQuit(Int32 inSaveOption); - static Boolean TSMEvent(const EventRecord &inMacEvent); - static Boolean SetTSMCursor(Point mousePos); - - static Boolean HasTextServices(); - static Boolean HasTSMTE(); - - static TSMTEPreUpdateUPP GetDefaultTSMTEPreUpdateUPP(); - static TSMTEPostUpdateUPP GetDefaultTSMTEPostUpdateUPP(); - - static void StartFontScriptLimit(); - static void StartFontScriptLimit( ScriptCode scriptcode ); - - static void EndFontScriptLimit(); - -protected: - static void CheckForTextServices(void); - static void BeginTextServices(void); - static void TSMTENewUPP(); - -}; - -#endif diff --git a/mozilla/cmd/macfe/central/PascalString.cp b/mozilla/cmd/macfe/central/PascalString.cp deleted file mode 100644 index 30c998da9d7..00000000000 --- a/mozilla/cmd/macfe/central/PascalString.cp +++ /dev/null @@ -1,685 +0,0 @@ -//---------------------------------------------------------------------------------------- -// PascalString.cp -// Copyright © 1985-1993 by Apple Computer, Inc. All rights reserved. -//---------------------------------------------------------------------------------------- - -#include "PascalString.h" -// #include "xpassert.h" - -#ifndef __STDIO__ -#include -#endif - -#ifndef __STRING__ -#include -#endif - -#pragma segment Main - -//======================================================================================== -// CLASS CString -//======================================================================================== - - -//---------------------------------------------------------------------------------------- -// CString::InsertHelper(CString): -//---------------------------------------------------------------------------------------- - -void CString::InsertHelper(const CString& insStr, - short pos, - short maxLength) -{ - if (pos > Length() + 1) - { -#if qDebugMsg - fprintf(stderr, "###CString::InsertHelper: Insert position greater than length of CString.\n"); -#endif - if (Length() < maxLength) - pos = Length() + 1; - } - -#if qDebugMsg - if (Length() + insStr.Length() > maxLength) - fprintf(stderr, "### CString::InsertHelper: CString truncated during insert call.\n"); -#endif - - short usableLengthOfInsertString; - short endPosOfInsertString; - short usableLengthOfShiftedString; - - if (pos + insStr.Length() > maxLength) - usableLengthOfInsertString = maxLength - pos + 1; - else - usableLengthOfInsertString = insStr.Length(); - endPosOfInsertString = pos + usableLengthOfInsertString - 1; - - if ((endPosOfInsertString + 1) + (Length() - pos + 1) > maxLength) - usableLengthOfShiftedString = maxLength - endPosOfInsertString; - else - usableLengthOfShiftedString = Length() - pos + 1; - - memmove(&fStr[endPosOfInsertString + 1], &fStr[pos], usableLengthOfShiftedString); - memmove(&fStr[pos], &insStr.fStr[1], usableLengthOfInsertString); - Length() = usableLengthOfShiftedString + endPosOfInsertString; -} // CString::InsertHelper(CString) - - -//---------------------------------------------------------------------------------------- -// CString::InsertHelper(char*): -//---------------------------------------------------------------------------------------- - -void CString::InsertHelper(const char* insStr, - short pos, - short maxLength) -{ - this->InsertHelper(CStr255(insStr), pos, maxLength); -} // CString::InsertHelper(char*) - - - -//---------------------------------------------------------------------------------------- -// CString::operator char*: -//---------------------------------------------------------------------------------------- - -CString::operator char*() const -{ - static short currentCString = 0; - static char cStrings[kTempCStrings][kStr255Len+1]; - - currentCString = (currentCString + 1) % kTempCStrings; - - strncpy(cStrings[currentCString], (char *) &fStr[1], Length()); - cStrings[currentCString][Length()] = '\0'; - - return cStrings[currentCString]; -} // CString::operator char* - - -//---------------------------------------------------------------------------------------- -// CString::operator long: -//---------------------------------------------------------------------------------------- - -CString::operator long() const -{ - // The following statement looks like it should work. Right? - // - // return *((long *) &fStr[1]); - // - // Wrong, the C compiler generates a MOVE.L starting on a odd byte boundary for the - // preceding statement. This is illegal on the 68000. But its _NOT_ a bug, because - // according to the ANSI C reference manual, "A pointer to one type may be converted - // to a pointer to another type. The resulting pointer may cause an addressing - // exception if the subject pointer does not refer to an object suitably aligned in - // storage". - - long returnLong; - - memcpy(&returnLong, &fStr[1], sizeof(long)); - return returnLong; -} // CString::operator long - - -//---------------------------------------------------------------------------------------- -// CString::Pos(char*): -//---------------------------------------------------------------------------------------- - -unsigned char CString::Pos(const char* subStr, unsigned char startPos) -{ - char cStr[kStr255Len + 1]; - char* ptr; - - memcpy(cStr, &fStr[1], (size_t)Length()); - cStr[Length()] = 0; - ptr = strstr(&cStr[startPos - 1], subStr); - return ptr != NULL ? (ptr - cStr) + 1 : 0; -} // CString::Pos(char*) - - -//---------------------------------------------------------------------------------------- -// CString::Pos(CString): -//---------------------------------------------------------------------------------------- - -unsigned char CString::Pos(const CString& subStr, unsigned char startPos) -{ - char cStr[kStr255Len + 1]; - - memcpy(cStr, &subStr.fStr[1], (size_t)(subStr.Length())); - cStr[subStr.Length()] = 0; - return this->Pos(cStr, startPos); -} // CString::Pos(CString) - - -//---------------------------------------------------------------------------------------- -// CString::operator const unsigned char* -//---------------------------------------------------------------------------------------- -CString::operator const unsigned char*() const -{ - return (const unsigned char *) this; -} // CString::operator const unsigned char* - -//---------------------------------------------------------------------------------------- -// CString::Delete -//---------------------------------------------------------------------------------------- -void CString::Delete(short pos, short length) -{ - if ((pos > 0) && (length > 0) && (pos <= Length())) // should also check that pos <= kMaxLength - { - if (pos + length > Length()) - fStr[0] = pos - 1; - else - { - ::memcpy(&fStr[pos], &fStr[pos + length], Length() - (pos + length) + kLengthByte); - fStr[0] -= length; - } - } -} // CString::Delete - -//======================================================================================== -// CLASS CStr255 -//======================================================================================== - -const CStr255 CStr255::sEmptyString("\p"); - -//---------------------------------------------------------------------------------------- -// CStr255::CStr255(char*): -//---------------------------------------------------------------------------------------- - -CStr255::CStr255(const char* str) -{ - // Truncate the C CString to 255 bytes if necessary. - size_t len = str == NULL ? 0 : strlen(str); - Length() = len > kStr255Len ? kStr255Len : len; - - if (Length() > kStr255Len) - Length() = kStr255Len; - memcpy(&fStr[1], str, (size_t)Length()); -} // CStr255::CStr255(char*) - - -//---------------------------------------------------------------------------------------- -// CStr255::CStr255(long): Useful for converting OSType's into CStr255's. -//---------------------------------------------------------------------------------------- - -CStr255::CStr255(const long id) -{ - Length() = 4; - memcpy(&fStr[1], &id, (size_t)Length()); -} // CStr255::CStr255(long) - - -//---------------------------------------------------------------------------------------- -// CStr255::Copy: -//---------------------------------------------------------------------------------------- - -CStr255 CStr255::Copy(short pos, short length) -{ - CStr255 newString; - - length = length > Length() - pos + kLengthByte ? Length() - pos + kLengthByte : length; - - if (length > 0) - { - memcpy(&newString.fStr[1], &fStr[pos], (size_t)length); - newString.Length() = length; - } - else - newString = ""; - - return newString; - -} // CStr255::Copy - - -//---------------------------------------------------------------------------------------- -// CStr255::operator+: -//---------------------------------------------------------------------------------------- - -CStr255 operator+(const CString& s1, - const char* s2) -{ - CStr255 newStr; - short s2Len = s2 == NULL ? 0 : (short)(strlen((const char *) s2)); - - if (s1.Length() + s2Len > kStr255Len) - newStr.Length() = kStr255Len; - else - newStr.Length() = s1.Length() + s2Len; - - memcpy(&newStr.fStr[1], &s1.fStr[1], (size_t)(s1.Length())); - memcpy(&newStr.fStr[s1.Length() + kLengthByte], s2, newStr.Length() - s1.Length()); - - return newStr; -} // CStr255::operator+ - - -//---------------------------------------------------------------------------------------- -// CStr255::operator+(char*,CString): -//---------------------------------------------------------------------------------------- - -CStr255 operator+(const char* s1, - const CString& s2) -{ - CStr255 newStr; - short s1Len = s1 == NULL ? 0 : (short)(strlen(s1)); - - if (s1Len + s2.Length() > kStr255Len) - newStr.Length() = kStr255Len; - else - newStr.Length() = s1Len + s2.Length(); - - memcpy(&newStr.fStr[1], s1, (size_t)s1Len); - memcpy(&newStr.fStr[s1Len + kLengthByte], s2.fStr + 1, newStr.Length() - s1Len); - - return newStr; -} // CStr255::operator+(char*,CString) - - -//---------------------------------------------------------------------------------------- -// CStr255::operator+(CString,CString): -//---------------------------------------------------------------------------------------- - -CStr255 operator+(const CString& s1, - const CString& s2) -{ - CStr255 newStr; - - if (s1.Length() + s2.Length() > kStr255Len) - newStr.Length() = kStr255Len; - else - newStr.Length() = s1.Length() + s2.Length(); - - memcpy(&newStr.fStr[1], &s1.fStr[1], (size_t)(s1.Length())); - memcpy(&newStr.fStr[s1.Length() + kLengthByte], s2.fStr + 1, newStr.Length() - s1.Length()); - - return newStr; -} // CStr255::operator+(CString,CString) - - -//---------------------------------------------------------------------------------------- -// CStr255::operator +=(CString): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr255& CStr255::operator += (const CString& str) -{ - InsertHelper (str, Length() + 1, kStr255Len); - return *this; -} // CStr255::operator +=(CString) - - -//---------------------------------------------------------------------------------------- -// CStr255::operator +=(char*): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr255& CStr255::operator += (const char* str) -{ - InsertHelper (str, Length() + 1, kStr255Len); - return *this; -} // CStr255::operator +=(char*) - - -//---------------------------------------------------------------------------------------- -// CStr255::operator +=(char): Concatenate a single character -//---------------------------------------------------------------------------------------- - -CStr255& CStr255::operator += (const char ch) -{ - if (++Length() <= kStr255Len) - fStr[Length()] = ch; - else - { - --Length(); -#if qDebugMsg - fprintf(stderr, "###CStr255::operator+=: Concatenation produces CStr255 overflow.\n"); -#endif - } - - return *this; -} // CStr255::operator +=(char) - - -//---------------------------------------------------------------------------------------- -// CStr255::operator =: -//---------------------------------------------------------------------------------------- - -CStr255& CStr255::operator = (const char* str) -{ - if (str) - { - // Truncate the C CString to 255 bytes if necessary. - register size_t itsSize = strlen(str); - if (itsSize > kStr255Len) - Length() = kStr255Len; - else - Length() = (unsigned char)(itsSize); - - memcpy(&fStr[1], str, (size_t)Length()); - } - else - Length() = 0; - - return *this; -} // CStr255::operator = - - - -//======================================================================================== -// CLASS CStr63 -//======================================================================================== - - -//---------------------------------------------------------------------------------------- -// CStr63::CStr63(char*): -//---------------------------------------------------------------------------------------- - -CStr63::CStr63(const char* str) -{ - // Truncate the C CString to 63 bytes if necessary. - - Length() = str == NULL ? 0 : (unsigned char)(strlen(str)); - if (Length() > kStr63Len) - Length() = kStr63Len; - memcpy(&fStr[1], str, (size_t)Length()); -} // CStr63::CStr63(char*) - - -//---------------------------------------------------------------------------------------- -// CStr63::CStr63(long): -//---------------------------------------------------------------------------------------- - -CStr63::CStr63(const long id) -{ - Length() = 4; - memcpy(&fStr[1], &id, (size_t)Length()); -} // CStr63::CStr63(long) - - -//---------------------------------------------------------------------------------------- -// CStr63::Copy: -//---------------------------------------------------------------------------------------- - -CStr63 CStr63::Copy(short pos, short length) -{ - CStr63 newString; - - length = length > Length() - pos + kLengthByte ? Length() - pos + kLengthByte : length; - - if (length > 0) - { - memcpy(&newString.fStr[1], &fStr[pos], (size_t)length); - newString.Length() = length; - } - else - newString = ""; - - return newString; - -} // CStr63::Copy - - -//---------------------------------------------------------------------------------------- -// CStr63::operator +=(CString): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr63& CStr63::operator += (const CString& str) -{ - InsertHelper (str, Length() + 1, kStr63Len); - return *this; -} // CStr63::operator +=(CString) - - -//---------------------------------------------------------------------------------------- -// CStr63::operator +=(char*): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr63& CStr63::operator += (const char* str) -{ - InsertHelper (str, Length() + 1, kStr63Len); - return *this; -} // CStr63::operator +=(char*) - - -//---------------------------------------------------------------------------------------- -// CStr63::operator +=(char): Concatenate a single character -//---------------------------------------------------------------------------------------- - -CStr63& CStr63::operator += (const char ch) -{ - if (++Length() <= kStr63Len) - fStr[Length()] = ch; - else - { - --Length(); -#if qDebugMsg - fprintf(stderr, "###CStr63::operator+=: Concatenation produces CStr63 overflow.\n"); -#endif - } - - return *this; -} // CStr63::operator +=(char) - - - -//======================================================================================== -// CLASS CStr32 -//======================================================================================== - - -//---------------------------------------------------------------------------------------- -// CStr32::CStr32(char*): -//---------------------------------------------------------------------------------------- - -CStr32::CStr32(const char* str) -{ - // Truncate the C CString to 32 bytes if necessary. - - Length() = str == NULL ? 0 : (unsigned char)(strlen(str)); - if (Length() > kStr32Len) - Length() = kStr32Len; - memcpy(&fStr[1], str, (size_t)Length()); -} // CStr32::CStr32(char*) - - -//---------------------------------------------------------------------------------------- -// CStr32::CStr32(long): -//---------------------------------------------------------------------------------------- - -CStr32::CStr32(const long id) -{ - Length() = 4; - memcpy(&fStr[1], &id, (size_t)Length()); -} // CStr32::CStr32(long) - - -//---------------------------------------------------------------------------------------- -// CStr32::Copy: -//---------------------------------------------------------------------------------------- - -CStr32 CStr32::Copy(short pos, short length) -{ - CStr32 newString; - - length = length > Length() - pos + kLengthByte ? Length() - pos + kLengthByte : length; - - if (length > 0) - { - memcpy(&newString.fStr[1], &fStr[pos], (size_t)length); - newString.Length() = length; - } - else - newString = ""; - - return newString; - -} // CStr32::Copy - - -//---------------------------------------------------------------------------------------- -// CStr32::operator +=(CString): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr32& CStr32::operator += (const CString& str) -{ - InsertHelper (str, Length() + 1, kStr32Len); - return *this; -} // CStr32::operator +=(CString) - - -//---------------------------------------------------------------------------------------- -// CStr32::operator +=(char*): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr32& CStr32::operator += (const char* str) -{ - InsertHelper (str, Length() + 1, kStr32Len); - return *this; -} // CStr32::operator +=(char*) - - -//---------------------------------------------------------------------------------------- -// CStr32::operator +=(char): Concatenate a single character -//---------------------------------------------------------------------------------------- - -CStr32& CStr32::operator += (const char ch) -{ - if (++Length() <= kStr32Len) - fStr[Length()] = ch; - else - { - --Length(); -#if qDebugMsg - fprintf(stderr,"###CStr32::operator+=: Concatenation produces CStr32 overflow.\n"); -#endif - } - - return *this; -} // CStr32::operator +=(char) - - -//======================================================================================== -// CLASS CStr31 -//======================================================================================== - - -//---------------------------------------------------------------------------------------- -// CStr31::CStr31(char*): -//---------------------------------------------------------------------------------------- - -CStr31::CStr31(const char* str) -{ - // Truncate the C CString to 31 bytes if necessary. - - Length() = str == NULL ? 0 : (unsigned char)(strlen(str)); - if (Length() > kStr31Len) - Length() = kStr31Len; - memcpy(&fStr[1], str, (size_t)Length()); -} // CStr31::CStr31(char*) - - -//---------------------------------------------------------------------------------------- -// CStr31::CStr31(long): -//---------------------------------------------------------------------------------------- - -CStr31::CStr31(const long id) -{ - Length() = 4; - memcpy(&fStr[1], &id, (size_t)Length()); -} // CStr31::CStr31(long) - - -//---------------------------------------------------------------------------------------- -// CStr31::CStr31(char*): -//---------------------------------------------------------------------------------------- - -void -CStr31::operator =(const CString& str) -{ - Length() = str.Length(); - - if (Length() > kStr31Len) - Length() = kStr31Len; - memcpy(&fStr[1], &str.fStr[1], (size_t)Length()); -} - -void -CStr31::operator =(const unsigned char* str) -{ - Length() = str == NULL ? 0 : str[0]; - - if (Length() > kStr31Len) - Length() = kStr31Len; - memcpy(&fStr[1], str + 1, (size_t)Length()); -} - -void -CStr31::operator =(const char* str) -{ - Length() = str == NULL ? 0 : (unsigned char)(strlen(str)); - - if (Length() > kStr31Len) - Length() = kStr31Len; - memcpy(&fStr[1], str, (size_t)Length()); -} - -//---------------------------------------------------------------------------------------- -// CStr31::Copy: -//---------------------------------------------------------------------------------------- - -CStr31 CStr31::Copy(short pos, short length) -{ - CStr31 newString; - - length = length > Length() - pos + kLengthByte ? Length() - pos + kLengthByte : length; - - if (length > 0) - { - memcpy(&newString.fStr[1], &fStr[pos], (size_t)length); - newString.Length() = length; - } - else - newString = ""; - - return newString; - -} // CStr31::Copy - - -//---------------------------------------------------------------------------------------- -// CStr31::operator +=(CString): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr31& CStr31::operator += (const CString& str) -{ - InsertHelper (str, Length() + 1, kStr31Len); - return *this; -} // CStr31::operator +=(CString) - - -//---------------------------------------------------------------------------------------- -// CStr31::operator +=(char*): Concatenate a string -//---------------------------------------------------------------------------------------- - -CStr31& CStr31::operator += (const char* str) -{ - InsertHelper (str, Length() + 1, kStr31Len); - return *this; -} // CStr31::operator +=(char*) - - -//---------------------------------------------------------------------------------------- -// CStr31::operator +=(char): Concatenate a single character -//---------------------------------------------------------------------------------------- - -CStr31& CStr31::operator += (const char ch) -{ - if (++Length() <= kStr31Len) - fStr[Length()] = ch; - else - { - --Length(); -#if qDebugMsg - fprintf(stderr,"###CStr31::operator+=: Concatenation produces CStr31 overflow.\n"); -#endif - } - - return *this; -} // CStr31::operator +=(char) diff --git a/mozilla/cmd/macfe/central/PascalString.h b/mozilla/cmd/macfe/central/PascalString.h deleted file mode 100644 index 08c5b307da4..00000000000 --- a/mozilla/cmd/macfe/central/PascalString.h +++ /dev/null @@ -1,753 +0,0 @@ -//---------------------------------------------------------------------------------------- -// PascalString.h -// Copyright © 1985-1994 by Apple Computer, Inc. All rights reserved. -//---------------------------------------------------------------------------------------- - - -// ¥ Updated by Jeroen Schalk - DTS -// ¥ Use MABlockMove, not memcpy(), memmove(), strncpy(). -// ¥ Changed default constructors to initialize to empty string. -// ¥ Changed number of temporary strings from 4 to 8 -// ¥ Make operator[] and unsigned char*() inline -// ¥ Fix bugs in constructors out of const unsigned char* str -// ¥ Optimized constructors to only move required data -// ¥ General cleanup of code for readability - -#pragma once - -#ifndef __PASCALSTRING__ -#define __PASCALSTRING__ - -#ifndef __MEMORY__ -#include -#endif - -#ifndef __TYPES__ -#include -#endif - -#ifndef __TEXTUTILS__ -#include -#endif - -#ifndef __OSUTILS__ -#include -#endif - -#ifndef __STRING__ -#include -#endif - -// Forward declaration for all the CString classes. -struct CString; -struct CStr255; -struct CStr63; -struct CStr32; -struct CStr31; - -typedef const CStr255& ConstCStr255Param; -typedef const CStr63& ConstCStr63Param; -typedef const CStr32& ConstCStr32Param; -typedef const CStr31& ConstCStr31Param; - -#ifdef Length -#undef Length -#endif -// Some constants defining the length of each of the CString types. - -const short kLengthByte = 1; -const short kBaseLen = 2; -const short kStr255Len = 255; -const short kStr63Len = 63; -const short kStr32Len = 32; -const short kStr31Len = 31; - -// Number of temporary strings - -const short kTempCStrings = 8; - -//---------------------------------------------------------------------------------------- -// MABlockMove: BlockMoveData() is fastest on PowerPC, memcpy() on 68K -//---------------------------------------------------------------------------------------- - -#if powerc - #define MABlockMove(srcPtr, destPtr, byteCount) \ - ::BlockMoveData(Ptr(srcPtr), Ptr(destPtr), Size(byteCount)) -#else - #define MABlockMove(srcPtr, destPtr, byteCount) \ - ::memcpy(destPtr, srcPtr, size_t(byteCount)) -#endif - -//---------------------------------------------------------------------------------------- -// MABlockMoveOverlap: BlockMoveData() is fastest on PowerPC, memmove() on 68K -//---------------------------------------------------------------------------------------- - -#if powerc - #define MABlockMoveOverlap(srcPtr, destPtr, byteCount) \ - ::BlockMoveData(Ptr(srcPtr), Ptr(destPtr), Size(byteCount)) -#else - #define MABlockMoveOverlap(srcPtr, destPtr, byteCount) \ - ::memmove(destPtr, srcPtr, size_t(byteCount)) -#endif - -//---------------------------------------------------------------------------------------- -// CString: Superclass of all Pascal string compatible string classes. -//---------------------------------------------------------------------------------------- - -typedef struct CString *CStringPtr, **CStringHandle; - -struct CString -{ -public: - unsigned char fStr[kBaseLen]; - -protected: - CString() {} - // This is here (and protected) to stop people trying to instantiate CString. - // To do so is very bad, because it's suicide to make one of these! There are - // only 2 bytes of data! - void InsertHelper(const CString& insStr, short pos, short maxLength); - void InsertHelper(const char* insStr, short pos, short maxLength); - -public: - // Basic length method, inherited by all derived classes. Define one that returns a - // reference. Can be used as an lvalue and only can be applied to non-const Strings. - - inline unsigned char& Length() - { - return fStr[0]; - } // for non-const CString - - inline unsigned char Length() const - { - return fStr[0]; - } // for const CString - - inline Boolean IsEmpty() - { - return fStr[0] <= 0; - } // for non-const CString - - inline Boolean IsEmpty() const - { - return fStr[0] <= 0; - } // for const CString - - // Character selector operator. - - inline unsigned char& operator[](short pos) - { - return fStr[pos]; - } // for non-const CString - - inline unsigned char operator[](short pos) const - { - return fStr[pos]; - } // for const CString - - //------------------------------------------------------------------------------------ - // CAUTION: There is a subtle difference between the (char*) and (unsigned char*) - // conversion operators. The first converts a pascal-style string to a c-style - // string. The second simply converts between two types (CString and Str55) both of - // which are pascal-style strings. - - // Create a NULL terminated c-style string from a pascal-style CString. Used in - // debugging to fprintf a CString. - - operator char*() const; - - // Used to create a toolbox type Str255 from our CString. This is simply a type - // coercion! Both CString and Str255 are expected to be pascal-style strings. - - inline operator unsigned char*() - { - return (unsigned char *) this; - } // for non-const CString - - operator const unsigned char*() const; // for const CString - - //------------------------------------------------------------------------------------ - - // Return an ID represented as a CString to the actual ID (a long). - - operator long() const; - - // Relational operators that are inherited by all the derived CString types. Three of - // each so that literal C Strings can be conveniently used for one of the operators as - // well as two of the derive classes as operators. These are declared here but defined - // below all the CString classes because they use constructors for CStr255 and its class - // definition has not been encountered yet. - - friend inline Boolean operator==(const CString& s1, - const char* s2); - friend inline Boolean operator==(const char* s1, - const CString& s2); - friend inline Boolean operator==(const CString& s1, - const CString& s2); - friend inline Boolean operator!=(const CString& s1, - const char* s2); - friend inline Boolean operator!=(const char* s1, - const CString& s2); - friend inline Boolean operator!=(const CString& s1, - const CString& s2); - - friend inline Boolean operator>(const CString& s1, - const char* s2); - friend inline Boolean operator>(const char* s1, - const CString& s2); - friend inline Boolean operator>(const CString& s1, - const CString& s2); - - friend inline Boolean operator<(const CString& s1, - const char* s2); - friend inline Boolean operator<(const char* s1, - const CString& s2); - friend inline Boolean operator<(const CString& s1, - const CString& s2); - - friend inline Boolean operator>=(const CString& s1, - const char* s2); - friend inline Boolean operator>=(const char* s1, - const CString& s2); - friend inline Boolean operator>=(const CString& s1, - const CString& s2); - - friend inline Boolean operator<=(const CString& s1, - const char* s2); - friend inline Boolean operator<=(const char* s1, - const CString& s2); - friend inline Boolean operator<=(const CString& s1, - const CString& s2); - - // Concatenation operator that are inherited by all the derived CString types. Three - // of each so that literal C Strings can be conveniently used for one of the operators - // as well as using any two classes derived from CString. - - friend CStr255 operator+(const CString& s1, - const char* s2); - friend CStr255 operator+(const char* s1, - const CString& s2); - friend CStr255 operator+(const CString& s1, - const CString& s2); - - // Methods that mimic the Pascal builtin CString functions for Pos, Insert and Delete. - // Note that insert and copy is implemented in the derived classes. - - unsigned char Pos(const char* subStr, unsigned char startPos = 1); - unsigned char Pos(const CString& subStr, unsigned char startPos = 1); - void Delete(short pos, short length); - -protected: - inline long Min(const long a, const long b) const - { - return a < b ? a : b; - } -}; - - -//---------------------------------------------------------------------------------------- -// CStr255: -//---------------------------------------------------------------------------------------- - -struct CStr255 : CString -{ - friend struct CStr63; - friend struct CStr31; - -private: - unsigned char fData[kStr255Len - 1]; - -public: - static const CStr255 sEmptyString; - - CStr255(); - CStr255(const CStr255& str); - CStr255(const CStr63& str); - CStr255(const CStr32& str); - CStr255(const CStr31& str); - CStr255(const unsigned char* str); - CStr255(const char* str); - CStr255(const long id); - - // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions. - - void Insert(const CString& str, short pos); - void Insert(const char* str, short pos); - CStr255 Copy(short pos, short length); - - // Concatenation operator - - CStr255& operator +=(const CString& str); - CStr255& operator +=(const char* str); - CStr255& operator +=(const char ch); - - // Assignment operator - - CStr255& operator =(const CStr255& str); - CStr255& operator =(const CStr63& str); - CStr255& operator =(const CStr32& str); - CStr255& operator =(const CStr31& str); - CStr255& operator =(const unsigned char* str); - CStr255& operator =(const char aChar); - CStr255& operator =(const char* str); -}; - - -//---------------------------------------------------------------------------------------- -// CStr63: -//---------------------------------------------------------------------------------------- - -struct CStr63 : CString -{ - friend struct CStr255; - friend struct CStr31; - -private: - unsigned char fData[kStr63Len - 1]; - -public: - CStr63(); - CStr63(const CStr255& str); - CStr63(const CStr63& str); - CStr63(const CStr32& str); - CStr63(const CStr31& str); - CStr63(const unsigned char* str); - CStr63(const char* str); - CStr63(const long id); - - // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions. - - void Insert(const CString& str, short pos); - void Insert(const char* str, short pos); - CStr63 Copy(short pos, short length); - - // Concatenation operator - - CStr63& operator +=(const CString& str); - CStr63& operator +=(const char* str); - CStr63& operator +=(const char ch); -}; - - -//---------------------------------------------------------------------------------------- -// CStr32: -//---------------------------------------------------------------------------------------- - -struct CStr32 : CString -{ - friend struct CStr255; - friend struct CStr63; - -private: - unsigned char fData[kStr32Len - 1]; - -public: - CStr32(); - inline CStr32(unsigned char length) - { - fStr[0] = length; - } - - CStr32(const CStr255& str); - CStr32(const CStr63& str); - CStr32(const CStr32& str); - CStr32(const CStr31& str); - CStr32(const unsigned char* str); - CStr32(const char* str); - CStr32(const long id); - - // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions. - - void Insert(const CString& str, short pos); - void Insert(const char* str, short pos); - CStr32 Copy(short pos, short length); - - // Concatenation operator - - CStr32& operator +=(const CString& str); - CStr32& operator +=(const char* str); - CStr32& operator +=(const char ch); -}; - - -//---------------------------------------------------------------------------------------- -// CStr31: -//---------------------------------------------------------------------------------------- - -struct CStr31 : CString -{ - friend struct CStr255; - friend struct CStr63; - friend struct CStr32; - -private: - unsigned char fData[kStr31Len - 1]; - -public: - CStr31(); - inline CStr31(unsigned char length) - { - fStr[0] = length; - } - - CStr31(const CStr255& str); - CStr31(const CStr63& str); - CStr31(const CStr32& str); - CStr31(const CStr31& str); - CStr31(const unsigned char* str); - CStr31(const char* str); - CStr31(const long id); - - void operator =(const CString& str); - void operator =(const unsigned char* str); - void operator =(const char* str); - - // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions. - - void Insert(const CString& str, short pos); - void Insert(const char* str, short pos); - CStr31 Copy(short pos, short length); - - // Concatenation operator - - CStr31& operator +=(const CString& str); - CStr31& operator +=(const char* str); - CStr31& operator +=(const char ch); -}; - -//---------------------------------------------------------------------------------------- -// CStr255 inline function definitions -//---------------------------------------------------------------------------------------- - -inline CStr255::CStr255() -{ - fStr[0] = 0; -} - -inline CStr255::CStr255(const CStr255& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr255::CStr255(const CStr63& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr255::CStr255(const CStr32& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr255::CStr255(const CStr31& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr255::CStr255(const unsigned char* str) -{ - MABlockMove(str, fStr, str[0] + kLengthByte); -} - -inline CStr255& CStr255::operator = (const CStr255& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); - - return *this; -} - -inline CStr255& CStr255::operator = (const CStr63& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); - - return *this; -} - -inline CStr255& CStr255::operator = (const CStr32& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); - - return *this; -} - -inline CStr255& CStr255::operator = (const CStr31& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); - - return *this; -} - -inline CStr255& CStr255::operator = (const unsigned char* str) -{ - MABlockMove(str, fStr, str[0] + kLengthByte); - - return *this; -} - -inline CStr255& CStr255::operator = (const char aChar) -{ - Length() = (aChar) ? 1 : 0; - fStr[1] = aChar; - - return *this; -} - -inline void CStr255::Insert(const CString& str, short pos) -{ - this->InsertHelper(str, pos, kStr255Len); -} - -inline void CStr255::Insert(const char* str, short pos) -{ - this->InsertHelper(str, pos, kStr255Len); -} - - -//---------------------------------------------------------------------------------------- -// CStr63 inline function definitions -//---------------------------------------------------------------------------------------- - -inline CStr63::CStr63() -{ - fStr[0] = 0; -} - -inline CStr63::CStr63(const CStr255& str) -{ - // Truncate the CStr255 to 63 bytes if necessary. - - Length() = str.Length() > kStr63Len ? kStr63Len : str.Length(); - MABlockMove(&str.fStr[1], &fStr[1], Length()); -} - -inline CStr63::CStr63(const CStr63& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr63::CStr63(const CStr32& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr63::CStr63(const CStr31& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr63::CStr63(const unsigned char* str) -{ - MABlockMove(str, fStr, Min(str[0] + kLengthByte, sizeof(CStr63))); -} - -inline void CStr63::Insert(const CString& str, short pos) -{ - this->InsertHelper(str, pos, kStr63Len); -} - -inline void CStr63::Insert(const char* str, short pos) -{ - this->InsertHelper(str, pos, kStr63Len); -} - - -//---------------------------------------------------------------------------------------- -// CStr32 inline function definitions -//---------------------------------------------------------------------------------------- - -inline CStr32::CStr32() -{ - fStr[0] = 0; -} - -inline CStr32::CStr32(const CStr255& str) -{ - // Truncate the CStr255 to 32 bytes if necessary. - - Length() = str.Length() > kStr32Len ? kStr32Len : str.Length(); - MABlockMove(&str.fStr[1], &fStr[1], Length()); -} - -inline CStr32::CStr32(const CStr63& str) -{ - // Truncate the CStr63 to 32 bytes if necessary. - - Length() = str.Length() > kStr32Len ? kStr32Len : str.Length(); - MABlockMove(&str.fStr[1], &fStr[1], Length()); -} - -inline CStr32::CStr32(const CStr32& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr32::CStr32(const CStr31& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr32::CStr32(const unsigned char* str) -{ - MABlockMove(str, fStr, Min(str[0] + kLengthByte, sizeof(CStr32))); -} - -inline void CStr32::Insert(const CString& str, short pos) -{ - this->InsertHelper(str, pos, kStr32Len); -} - -inline void CStr32::Insert(const char* str, short pos) -{ - this->InsertHelper(str, pos, kStr32Len); -} - - -//---------------------------------------------------------------------------------------- -// CStr31 inline function definitions -//---------------------------------------------------------------------------------------- - -inline CStr31::CStr31() -{ - fStr[0] = 0; -} - -inline CStr31::CStr31(const CStr255& str) -{ - // Truncate the CStr255 to 31 bytes if necessary. - - Length() = str.Length() > kStr31Len ? kStr31Len : str.Length(); - MABlockMove(&str.fStr[1], &fStr[1], Length()); -} - -inline CStr31::CStr31(const CStr63& str) -{ - // Truncate the CStr63 to 31 bytes if necessary. - - Length() = str.Length() > kStr31Len ? kStr31Len : str.Length(); - MABlockMove(&str.fStr[1], &fStr[1], Length()); -} - -inline CStr31::CStr31(const CStr32& str) -{ - // Truncate the CStr32 to 31 bytes if necessary. - - Length() = str.Length() > kStr31Len ? kStr31Len : str.Length(); - MABlockMove(&str.fStr[1], &fStr[1], Length()); -} - -inline CStr31::CStr31(const CStr31& str) -{ - MABlockMove(str.fStr, fStr, str.Length() + kLengthByte); -} - -inline CStr31::CStr31(const unsigned char* str) -{ - MABlockMove(str, fStr, Min(str[0] + kLengthByte, sizeof(CStr31))); -} - -inline void CStr31::Insert(const CString& str, short pos) -{ - this->InsertHelper(str, pos, kStr31Len); -} - -inline void CStr31::Insert(const char* str, short pos) -{ - this->InsertHelper(str, pos, kStr31Len); -} - - -//---------------------------------------------------------------------------------------- -// Inline friend function definitions for relational string operators. -//---------------------------------------------------------------------------------------- - -inline Boolean operator==(const CString& s1, const char* s2) -{ - return ::RelString((ConstStr255Param)&s1, CStr255(s2), false, true) == 0; -} - -inline Boolean operator==(const char* s1, const CString& s2) -{ - return ::RelString(CStr255(s1), (ConstStr255Param)&s2, false, true) == 0; -} - -inline Boolean operator==(const CString& s1, const CString& s2) -{ - return ::RelString((ConstStr255Param)&s1, (ConstStr255Param)&s2, false, true) == 0; -} - -inline Boolean operator!=(const CString& s1, const char* s2) -{ - return ::RelString((ConstStr255Param)&s1, CStr255(s2), false, true) != 0; -} - -inline Boolean operator!=(const char* s1, const CString& s2) -{ - return ::RelString(CStr255(s1), (ConstStr255Param)&s2, false, true) != 0; -} - -inline Boolean operator!=(const CString& s1, const CString& s2) -{ - return ::RelString((ConstStr255Param)&s1, (ConstStr255Param)&s2, false, true) != 0; -} - -inline Boolean operator>(const CString& s1, const char* s2) -{ - return ::RelString((ConstStr255Param)&s1, CStr255(s2), false, true) > 0; -} - -inline Boolean operator>(const char* s1, const CString& s2) -{ - return ::RelString(CStr255(s1), (ConstStr255Param)&s2, false, true) > 0; -} - -inline Boolean operator>(const CString& s1, const CString& s2) -{ - return ::RelString((ConstStr255Param)&s1, (ConstStr255Param)&s2, false, true) > 0; -} - -inline Boolean operator<(const CString& s1, const char* s2) -{ - return ::RelString((ConstStr255Param)&s1, CStr255(s2), false, true) < 0; -} - -inline Boolean operator<(const char* s1, const CString& s2) -{ - return ::RelString(CStr255(s1), (ConstStr255Param)&s2, false, true) < 0; -} - -inline Boolean operator<(const CString& s1, const CString& s2) -{ - return ::RelString((ConstStr255Param)&s1, (ConstStr255Param)&s2, false, true) < 0; -} - -inline Boolean operator>=(const CString& s1, const char* s2) -{ - return ::RelString((ConstStr255Param)&s1, CStr255(s2), false, true) >= 0; -} - -inline Boolean operator>=(const char* s1, const CString& s2) -{ - return ::RelString(CStr255(s1), (ConstStr255Param)&s2, false, true) >= 0; -} - -inline Boolean operator>=(const CString& s1, const CString& s2) -{ - return ::RelString((ConstStr255Param)&s1, (ConstStr255Param)&s2, false, true) >= 0; -} - -inline Boolean operator<=(const CString& s1, const char* s2) -{ - return ::RelString((ConstStr255Param)&s1, CStr255(s2), false, true) <= 0; -} - -inline Boolean operator<=(const char* s1, const CString& s2) -{ - return ::RelString(CStr255(s1), (ConstStr255Param)&s2, false, true) <= 0; -} - -inline Boolean operator<=(const CString& s1, const CString& s2) -{ - return ::RelString((ConstStr255Param)&s1, (ConstStr255Param)&s2, false, true) <= 0; -} - -#endif diff --git a/mozilla/cmd/macfe/central/PopupBox.cp b/mozilla/cmd/macfe/central/PopupBox.cp deleted file mode 100644 index 454b992bd8d..00000000000 --- a/mozilla/cmd/macfe/central/PopupBox.cp +++ /dev/null @@ -1,559 +0,0 @@ -/*----------------------------------------------------------------------------- - StdPopup - Written 1994 Netscape Communications Corporation - - Portions derived from MacApp, - Copyright © 1984-1994 Apple Computer, Inc. All rights reserved. ------------------------------------------------------------------------------*/ - -// primary header -#include "PopupBox.h" -// local libraries -// cross-platform libraries -#include "xpassert.h" -#include "xp_trace.h" -// PowerPlant -#include -#include -#include -// Macintosh headers -#include -#include -#include -#include -#include -// ANSI headers -#include -#include -#include -#include "UFontSwitcher.h" -#include "UUTF8TextHandler.h" -#include "UPropFontSwitcher.h" -#include "UCustomizePopUp.h" -#include "LCustomizeMenu.h" - - -//----------------------------------------------------------------------------- -// random stuff -//----------------------------------------------------------------------------- - -#define SETMODRECT(DEST,SOURCE,TOP,LEFT,BOTTOM,RIGHT) \ - SetRect (&(DEST), (SOURCE).LEFT, (SOURCE).TOP, (SOURCE).RIGHT, (SOURCE).BOTTOM) - - -#ifndef GetMenuProc -#define GetMenuProc(menu) (*((Handle *) ((*((Ptr *) (menu))) + 0x06))) -#endif - - -//----------------------------------------------------------------------------- -// Discrete List Box -//----------------------------------------------------------------------------- -const Int16 fontNumber_Unknown = -1; - -StdPopup::StdPopup (CGAPopupMenu * target) -: LAttachment () -{ - ThrowIfNil_(fTarget = target); - fTarget->SetNeedCustomDrawFlag(NeedCustomPopup()); - mExecuteHost = false; - fMenu = nil; - fDirty = true; -} - -StdPopup::~StdPopup () -{ - if (fMenu) - DisposeMenu (fMenu); -} - -// -// definition -// - -short -StdPopup::GetCount () -{ - return 0; -} - -CStr255 -StdPopup::GetText (short item) -{ - char buffer [20]; - sprintf (buffer, "%hi", item); - return buffer; -} - -// -// interface -// - -const int tlo = 18; // offset of text from left side of widget -const int tls = 23; // offset from right side of widget to left side of triangle icon - -Point -StdPopup::CalcTargetFrame (short & baseline) -{ - SyncMenu (fTarget->GetMacMenuH()); - - Point size; - size.v = /* text */ 16 + /* border */ 3; - size.h = CalcMaxWidth (fTarget->GetMacMenuH()) + tls; - - StColorPenState saveColorPenState; - StTextState saveTextState; - saveColorPenState.Normalize(); - saveTextState.Normalize(); - - FontInfo fontInfo; - GetFontInfo (&fontInfo); - baseline = 1 + fontInfo.ascent; - size.v = fontInfo.ascent+fontInfo.descent+fontInfo.leading+ 2; - return size; -} - -void -StdPopup::DirtyMenu () -{ - fDirty = true; -} - -// -// internal -// - -short -StdPopup::CalcMaxWidth (MenuHandle aquiredMenu) -{ - if (1 || fDirty) - { - Rect menuRect; - Point hitPt = {0,0}; - short whichItem; - MenuDefUPP * menuProc = (MenuDefUPP*) (*aquiredMenu)->menuProc; - - SInt8 theState = HGetState((*aquiredMenu)->menuProc); - HLock((*aquiredMenu)->menuProc); - CallMenuDefProc (*menuProc, mSizeMsg, aquiredMenu, &menuRect, hitPt, &whichItem); - HSetState((*aquiredMenu)->menuProc, theState); - } - return (*aquiredMenu)->menuWidth; -} - -void StdPopup::DrawTruncTextBox (CStr255 text, const Rect& box) -{ -/* - Truncates the text before drawing. - Does not word wrap. -*/ - FontInfo fontInfo; - GetFontInfo (&fontInfo); - MoveTo (box.left, box.bottom - fontInfo.descent -1); - TruncString (box.right - box.left, text, truncEnd); - DrawString (text); -} - -void StdPopup::DrawWidget (MenuHandle aquiredMenu, const Rect & widgetFrame) -{ - StColorPenState saveColorPenState; - StTextState saveTextState; - saveColorPenState.Normalize(); - saveTextState.Normalize(); - - if (GetTextTraits() != fontNumber_Unknown) - UTextTraits::SetPortTextTraits(GetTextTraits()); - Rect r; - - SETMODRECT(r,widgetFrame,top+1,left+1,bottom-2,right-2); - EraseRect (&r); - - MoveTo (widgetFrame.left + 3, widgetFrame.bottom - 1); - LineTo (widgetFrame.right -1, widgetFrame.bottom - 1); - MoveTo (widgetFrame.right -1, widgetFrame.top + 3); - LineTo (widgetFrame.right -1, widgetFrame.bottom - 1); - SETMODRECT(r,widgetFrame,top,left,bottom-1,right-1); - FrameRect (&r); - - SETMODRECT(r,widgetFrame,top-1,right-tls,top-1+16,right-tls+16); - ::PlotIconID (&r, atNone, ttNone, 'cz'); - - short whichItem = fTarget->GetValue(); - CStr255 itemText; - if (whichItem) - GetMenuItemText (aquiredMenu, whichItem, itemText); - SETMODRECT(r,widgetFrame,top+1,left+tlo,bottom-1,right-tls); - DrawTruncTextBox (itemText, r); -} - -void -StdPopup::ExecuteSelf (MessageT message, void *param) -{ - fTarget->SetNeedCustomDrawFlag(NeedCustomPopup()); - switch (message) { - case msg_DrawOrPrint: { - // 97-06-07 pkc -- put back SyncMenu otherwise Javascript reflection back - // into popup menu list is broken - SyncMenu (fTarget->GetMacMenuH()); - mExecuteHost = true; - break; - } - case msg_Click: { - SMouseDownEvent* event = (SMouseDownEvent*) param; - ThrowIfNil_(event); - { - // Determine which HotSpot was clicked - Int16 theHotSpot = fTarget->FindHotSpot(event->whereLocal); - - if (theHotSpot > 0) - { - fTarget->FocusDraw(); - // Track mouse while it is down - if (fTarget->TrackHotSpot(theHotSpot, event->whereLocal, event->macEvent.modifiers)) - { - // Mouse released inside HotSpot - fTarget->HotSpotResult(theHotSpot); - } - } - - mExecuteHost = false; - } - break; - } - } -} - -void -StdPopup::SyncMenu (MenuHandle aquiredMenu) -{ - if (!fDirty) - return; - - int current = CountMItems (aquiredMenu); - int want = GetCount(); - int add = want - current; - if (0 < add) { - for (int i = 1; i <= add; i++) - AppendMenu (aquiredMenu, "\pTest"); - } - else if (add < 0) { - for (int i = 1; i <= -add; i++) - DeleteMenuItem (aquiredMenu, want + 1); - } - - for (int item = 1; item <= want; item++) - { - CStr255 itemText; - itemText = GetText( item ); - if ( itemText[ 1 ] == '-' ) - itemText = " " + itemText; - SetMenuItemText (aquiredMenu, item, itemText ); - } - if (fTarget->GetMaxValue() != want) - fTarget->SetMaxValue (want); - - (*aquiredMenu)->menuWidth += tls; - fDirty = false; -} - - -Boolean StdPopup::NeedCustomPopup() const -{ - return false; -} - -ResIDT StdPopup::GetTextTraits() const -{ - return fTarget->GetTextTraits(); -} - -/*----------------------------------------------------------------------------- - LCustomizeFontMenu ------------------------------------------------------------------------------*/ -class LCustomizeFontMenu : public LCustomizeMenu { -public: - LCustomizeFontMenu(short fontNum); - virtual void Draw (MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item); - virtual void Size (MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item); - virtual void Choose(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item); -protected: - virtual void DrawItemText( Rect& itemrect, Str255 itemtext ); - virtual void SetupFont() { ::TextFont(fFontNum); }; -private: - short fFontNum; -}; - -#pragma mark == LCustomizeFontMenu == - -LCustomizeFontMenu::LCustomizeFontMenu(short fontNum) - : LCustomizeMenu() -{ - fFontNum = fontNum; -} - -void LCustomizeFontMenu::Draw(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item) -{ - SetupFont(); - LCustomizeMenu::Draw(menu, root, rect, hitPt, item); -} -void LCustomizeFontMenu::Size(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item) -{ - SetupFont(); - LCustomizeMenu::Size(menu, root, rect, hitPt, item); -} -void LCustomizeFontMenu::Choose(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item) -{ - SetupFont(); - LCustomizeMenu::Choose(menu, root, rect, hitPt, item); -} -void LCustomizeFontMenu::DrawItemText( Rect& itemrect, Str255 itemtext ) -{ - SetupFont(); - LCustomizeMenu::DrawItemText(itemrect,itemtext); -} - -/*----------------------------------------------------------------------------- - LMultiFontTextMenu ------------------------------------------------------------------------------*/ -class LMultiFontTextMenu : public LCustomizeMenu { -public: - LMultiFontTextMenu(UMultiFontTextHandler* texthandler, UFontSwitcher* fs); -protected: - virtual void DrawItemText( Rect& itemrect, Str255 itemtext ) - { fTextHandler->DrawString(fFontSwitcher, itemtext); } - - virtual short MeasureItemText(Str255 itemtext ) - { return fTextHandler->StringWidth(fFontSwitcher, itemtext); }; -private: - UMultiFontTextHandler* fTextHandler; - UFontSwitcher* fFontSwitcher; -}; - -LMultiFontTextMenu::LMultiFontTextMenu(UMultiFontTextHandler* texthandler, UFontSwitcher* fs) - : LCustomizeMenu() -{ - fTextHandler = texthandler; - fFontSwitcher = fs; -} - -#pragma mark - - -// =========================================================================== -// ¥ CGAPopupMenu CGAPopupMenu ¥ -// =========================================================================== - -// --------------------------------------------------------------------------- -// ¥ CGAPopupMenu(LStream*) -// --------------------------------------------------------------------------- -// Construct from data in a Stream - -CGAPopupMenu::CGAPopupMenu( - LStream *inStream) - : mNeedCustomDraw(false), - - super(inStream) -{ -} - -CGAPopupMenu::~CGAPopupMenu() -{ -} -//------------------------------------------------------------------------------------- -// CGAPopupMenu::DrawPopupTitle -//------------------------------------------------------------------------------------- - -void -CGAPopupMenu::DrawPopupTitle () -{ - if(! mNeedCustomDraw) - { // hacky way, depend on mIsUTF8 to decide wheather we use the super class implementation - super::DrawPopupTitle(); - return; - } - StColorPenState theColorPenState; - StTextState theTextState; - - // ¥ Get some loal variables setup including the rect for the title - ResIDT textTID = GetTextTraitsID (); - Rect titleRect; - Str255 title; - GetCurrentItemTitle ( title ); - - // ¥ Figure out what the justification is from the text trait and - // get the port setup with the text traits - UTextTraits::SetPortTextTraits ( textTID ); - - // ¥ Setup the title justification which is always left justified - Int16 titleJust = teFlushLeft; - - // ¥ Calculate the title rect - CalcTitleRect ( titleRect ); - - // ¥ Setup the text color which by default is black - RGBColor textColor; - ::GetForeColor ( &textColor ); - - // ¥ Get the current item's title - Str255 currentItemTitle; - GetCurrentItemTitle ( currentItemTitle ); - - // ¥ Loop over any devices we might be spanning and handle the drawing - // appropriately for each devices screen depth - StDeviceLoop theLoop ( titleRect ); - Int16 depth; - while ( theLoop.NextDepth ( depth )) - { - if ( depth < 4 ) // ¥ BLACK & WHITE - { - // ¥ If the control is dimmed then we use the grayishTextOr - // transfer mode to draw the text - if ( !IsEnabled ()) - { - ::RGBForeColor ( &UGAColorRamp::GetBlackColor () ); - ::TextMode ( grayishTextOr ); - } - else if ( IsEnabled () && IsHilited () ) - { - // ¥ When we are hilited we simply draw the title in white - ::RGBForeColor ( &UGAColorRamp::GetWhiteColor () ); - } - - // ¥ Now get the actual title drawn with all the appropriate settings - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - - FontInfo info; - th->GetFontInfo(fs, &info); - ::MoveTo(titleRect.left, - (titleRect.top + titleRect.bottom + info.ascent - info.descent ) / 2); - th->DrawString(fs, currentItemTitle); - } - else // ¥ COLOR - { - // ¥ If control is selected we always draw the text in the title - // hilite color, if requested - if ( IsHilited ()) - ::RGBForeColor ( &UGAColorRamp::GetWhiteColor() ); - - // ¥ If the box is dimmed then we have to do our own version of the - // grayishTextOr as it does not appear to work correctly across - // multiple devices - if ( !IsEnabled () || !IsActive ()) - { - textColor = UGraphicsUtilities::Lighten ( &textColor ); - ::TextMode ( srcOr ); - ::RGBForeColor ( &textColor ); - } - - // ¥ Now get the actual title drawn with all the appropriate settings - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - - FontInfo info; - th->GetFontInfo(fs, &info); - ::MoveTo(titleRect.left, - (titleRect.top + titleRect.bottom + info.ascent - info.descent) / 2); - th->DrawString(fs, currentItemTitle); - } - } - -} // CGAPopupMenu::DrawPopupTitle -//------------------------------------------------------------------------------------- -// -// This method is used to calculate the title rect for the currently selected item in -// the popup, this title is drawn inside the popup -const Int16 gsPopup_RightInset = 24; // Used to position the title rect -const Int16 gsPopup_TitleInset = 8; // Apple specification -void -CGAPopupMenu::CalcTitleRect ( Rect &outRect ) -{ - if(! mNeedCustomDraw) - { // hacky way, depend on mIsUTF8 to decide wheather we use the super class implementation - super::CalcTitleRect(outRect); - return; - } - StTextState theTextState; - StColorPenState thePenState; - Int16 bevelWidth = 2; - - // ¥ Get some loal variables setup including the rect for the title - ResIDT textTID = GetTextTraitsID (); - - // ¥ Get the port setup with the text traits - UTextTraits::SetPortTextTraits ( textTID ); - - // ¥ Figure out the height of the text for the selected font - FontInfo fInfo; - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - th->GetFontInfo(fs, &fInfo); - - Int16 textHeight = fInfo.ascent + fInfo.descent; - Int16 textBaseline = fInfo.ascent; - - // ¥ Get the local inset frame rectangle - CalcLocalPopupFrameRect ( outRect ); - ::InsetRect ( &outRect, 0, bevelWidth ); - outRect.right -= gsPopup_RightInset; - outRect.left += gsPopup_TitleInset; - - // ¥ Adjust the title rect to match the height of the font - outRect.top += (( UGraphicsUtilities::RectHeight ( outRect ) - textBaseline) / 2) - 2; - outRect.bottom = outRect.top + textHeight; - -} // CGAPopupMenu::CalcTitleRect -//===================================================================================== -// ¥¥ POPUP MENU HANDLING -//------------------------------------------------------------------------------------- -// CGAPopupMenu::HandlePopupMenuSelect -//------------------------------------------------------------------------------------- - -void -CGAPopupMenu::HandlePopupMenuSelect ( Point inPopupLoc, - Int16 inCurrentItem, - Int16 &outMenuID, - Int16 &outMenuItem ) -{ - MenuHandle menuH = GetMacMenuH (); - ThrowIfNil_ ( menuH ); - if ( menuH ) - { - // BUG#69583: Make sure we *do* use the system font so that the current - // item will be checked properly as in Akbar. So we don't do the LMSetSysFont - // stuff that LGAPopup does. - - // ¥ Handle the actual insertion into the hierarchical menubar - ::InsertMenu ( menuH, hierMenu ); - - FocusDraw (); - - // ¥ Before we display the menu we need to make sure that we have the - // current item marked in the menu. NOTE: we do NOT use the current - // item that has been passed in here as that always has a value of one - // in the case of a pulldown menu - SetupCurrentMenuItem ( menuH, GetValue () ); - - // ¥ Then we call PopupMenuSelect and wait for it to return - - Int32 result; - - // hacky way, depend on mIsUTF8 to decide which implementation to use - if (!mNeedCustomDraw) - { - result = ::PopUpMenuSelect(menuH, inPopupLoc.v, inPopupLoc.h, inCurrentItem ); - } - else - { - LMultiFontTextMenu utf8menu(UUTF8TextHandler::Instance(), UPropFontSwitcher::Instance()); - result = UCustomizePopUp::PopUpMenuSelect(menuH, &utf8menu, inPopupLoc.v, inPopupLoc.h, inCurrentItem); - } - - // ¥ Then we extract the values from the returned result - // these are then passed back out to the caller - outMenuID = HiWord ( result ); - outMenuItem = LoWord ( result ); - - // ¥ Finally get the menu removed - ::DeleteMenu ( GetPopupMenuResID ()); - } -} // CGAPopupMenu::HandlePopupMenuSelect diff --git a/mozilla/cmd/macfe/central/PopupBox.h b/mozilla/cmd/macfe/central/PopupBox.h deleted file mode 100644 index 16969ef6e05..00000000000 --- a/mozilla/cmd/macfe/central/PopupBox.h +++ /dev/null @@ -1,125 +0,0 @@ -/*----------------------------------------------------------------------------- - StdPopup - Written 1994 Netscape Communications Corporation - - Portions derived from MacApp, - Copyright © 1984-1994 Apple Computer, Inc. All rights reserved. ------------------------------------------------------------------------------*/ - -#pragma once -#ifndef _DISCRETE_LIST_BOX_ -#define _DISCRETE_LIST_BOX_ - -/*----------------------------------------------------------------------------- - StdPopup - We need non-text menu items, so we will use a custom menu definition - procedure. - We need to have a dynamic number of menus, so we will use PopupMenuSelect. - - static Handle sMenuProc - In order to use a custom procedure, we need to dispatch from a handle. - This handle is constant and therefore can be global. - - static StdPopup * sMenuObject - We can't figure out which object called PopupMenuSelect, so we will set - this global right before calling it. We will never get a menu callback - except from within PopupMenuSelect. - - Handle fDefaultMenuProc - This is the normal definition procedure for the menu. We'll use it to - handle most operations; only overriding drawing. - - MenuHandle fMenu - We only need a menu widget when we're calling PopupMenuSelect; we could - actually just have 1 of them and reuse it amongst any number of objects, or - give each item its own widget. - -// short item = 0; -// DoMenuProc (mSizeMsg, m, gZeroRect, gZeroPt, item); ------------------------------------------------------------------------------*/ -#include -#include -#include -#include "PascalString.h" - -class LP_Glypher; - -#define dlbPopupMenuID 'cz' - -class CGAPopupMenu; - -// StdPopup - -class StdPopup: public LAttachment { -public: - StdPopup (CGAPopupMenu* target); - ~StdPopup (); - // definition - virtual short GetCount ()=0; - virtual CStr255 GetText (short item)=0; - // interface - Point CalcTargetFrame (short & baseline); - void DirtyMenu (); - - ResIDT GetTextTraits() const; - ResIDT SetTextTraits(ResIDT inTextTraits); -protected: - MenuHandle GetMacMenuH(); - - virtual Boolean NeedCustomPopup() const; - - virtual void SyncMenu (MenuHandle aquiredMenu); - virtual short CalcMaxWidth (MenuHandle aquiredMenu); - void DrawWidget (MenuHandle aquiredMenu, const Rect & widgetFrame); - virtual void ExecuteSelf (MessageT message, void *param); - - // do ScriptCode Menu Trick on IM:MacTbxEss Page3-46 - // Give subclass a chance to do it. - virtual void SetMenuItemText(MenuHandle aquiredMenu, int item, CStr255& itemText) - { ::SetMenuItemText(aquiredMenu, item, itemText); } ; - // Let us have a chance to override PopUpMenuSelect - virtual long PopUpMenuSelect(MenuHandle aquiredMenu, short top, short left, short popUpItem) - { return ::PopUpMenuSelect( aquiredMenu, top, left, popUpItem); }; - virtual void DrawTruncTextBox (CStr255 text, const Rect& box); - - friend class TempUseMenu; - CGAPopupMenu* fTarget; - MenuHandle fMenu; // this is used if we're doing the UTF8 stuff -private: - Boolean fDirty; -}; - - -class CGAPopupMenu : public LGAPopup { -friend class StdPopup; -public: - enum { class_ID = 'Gatt' }; - typedef LGAPopup super; - - CGAPopupMenu(LStream* inStream); - virtual ~CGAPopupMenu(); - - void SetTextTraits(ResIDT inTextTraitsID) { mTextTraitsID = inTextTraitsID; } - ResIDT GetTextTraits() const { return mTextTraitsID; } - - void SetNeedCustomDrawFlag(Boolean needCustomDraw) { mNeedCustomDraw = needCustomDraw; } -// For UTF8 - //----<< ¥ DRAWING ¥ >>------------------------------------------------------------ - - virtual void DrawPopupTitle (); - virtual void CalcTitleRect ( Rect &outRect ); // ¥ OVERRIDE -protected: - //----<< ¥ POPUP MENU HANDLING ¥ >>------------------------------------------------ - - virtual void HandlePopupMenuSelect ( Point inPopupLoc, - Int16 inCurrentItem, - Int16 &outMenuID, - Int16 &outMenuItem ); - - -private: - Boolean mNeedCustomDraw; -}; - -#endif /* _DISCRETE_LIST_BOX_ */ - diff --git a/mozilla/cmd/macfe/central/RandomFrontEndCrap.cp b/mozilla/cmd/macfe/central/RandomFrontEndCrap.cp deleted file mode 100644 index 1eb1032c979..00000000000 --- a/mozilla/cmd/macfe/central/RandomFrontEndCrap.cp +++ /dev/null @@ -1,1497 +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. - */ - -// RandomFrontEndCrap.cp - -/* #include "fe_proto.h" */ -#include "RandomFrontEndCrap.h" -/* #include "CNSContext.h" */ -#include "CBrowserContext.h" -#include "nppg.h" -/* #include "libimg.h" */ -#include "libi18n.h" -/* #include "uprefd.h" */ -/* #include "mimages.h" */ -#include "earlmgr.h" -#include "UStdDialogs.h" -#include "macutil.h" -/* #include "CHTMLView.h" */ -#include "CHyperScroller.h" // for FE_QueryChrome -#include "resgui.h" // for 'neverAgain' -#include "ufilemgr.h" -#include "prefwutil.h" // for CFilePicker -#include "mime.h" // for FE_UsersOrganization proto -#include "msgcom.h" // for FE_GetTempFileFor proto -#include "StBlockingDialogHandler.h" - - // stuff added by deeje for the chromeless window hack -/* #include "CWindowMediator.h" */ -/* #include "CURLDispatcher.h" */ -#include "CBrowserWindow.h" -#ifdef MOZ_MAIL_NEWS -/* #include "CMessageWindow.h" */ -#include "CThreadWindow.h" -#endif - -#include "CMochaHacks.h" // for managing dependent windows in javascript - 1997-02-22 mjc -#include "findw.h" // to set up find with CFindWindow statics -1997-02-27 mjc - -#include "uapp.h" /* for GetApplication - EA */ -#include "VerReg.h" /* for Netcaster installed checks - EA*/ -#include "xpgetstr.h" /* for Netcaster error message - EA */ -#include "uerrmgr.h" /* for Netcaster error message - EA */ -#include "libmocha.h" /* Netcaster checks if mocha is enabled */ -#include "java.h" /* Netcaster checks if java is enabled. */ - -/* #include "uprefd.h" */ -#include "InternetConfig.h" -GDHandle DeviceForWindow(LWindow* inWindow); - -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" /* preferred mechanism for Netcaster error message - EA */ -#undef WANT_ENUM_STRING_IDS - -NSPR_BEGIN_EXTERN_C -MWContext * FE_GetRDFContext(); -NSPR_END_EXTERN_C - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CONTEXT CALLBACKS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// This is called when there's a chance that the state of the -// Stop button (and corresponding menu item) has changed. -// The FE should use XP_IsContextStoppable to determine the -// new state. - -void FE_UpdateStopState( MWContext* ) -{ -// FIX ME!!! we should broadcast from the context -// NETSCAPECONTEXT(context)->UpdateStopState(); - // this had an empty NetscapeContext implementation. - // CHyperWin had an implementation that adjusted the buttons -} - -// FE_ScrollDocTo needed for javascript window.scrollTo() function - mjc 1/30/97 -void FE_ScrollDocTo(MWContext *inContext, int /*inLocation*/, Int32 inX, Int32 inY) -{ - CHTMLView* theHTMLView = ExtractHyperView(inContext); - if (theHTMLView != nil) theHTMLView->SetDocPosition(0, inX, inY, true); -} - -// FE_ScrollDocBy needed for javascript window.scrollBy() function - mjc 1/30/97 -void FE_ScrollDocBy(MWContext *inContext, int /*inLocation*/, Int32 inX, Int32 inY) -{ - CHTMLView* theHTMLView = ExtractHyperView(inContext); - if (theHTMLView != nil) - { - SPoint32 theScrollPosition; - theHTMLView->GetScrollPosition(theScrollPosition); - if (theHTMLView != nil) theHTMLView->SetDocPosition(0, theScrollPosition.h + inX, theScrollPosition.v + inY, true); - } -} - -PRBool FE_HandleLayerEvent( - MWContext* inContext, - CL_Layer* inLayer, - CL_Event* inEvent) -{ - PRBool result = PR_FALSE; - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - if (theBrowserContext != NULL) - result = theBrowserContext->HandleLayerEvent(inLayer, inEvent); - return result; -} - -PRBool FE_HandleEmbedEvent( - MWContext* inContext, - LO_EmbedStruct* inEmbed, - CL_Event* inEvent) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - Assert_(theBrowserContext != NULL); - return theBrowserContext->HandleEmbedEvent(inEmbed, inEvent); -} - -MWContext* FE_MakeGridWindow( - MWContext* inParentContext, - void* inHistList, - void* inHistEntry, - int32 inX, - int32 inY, - int32 inWidth, - int32 inHeight, - char* inURLString, - char* inWindowTarget, - int8 inScrollMode, - NET_ReloadMethod inForceReload, - Bool inNoEdge) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inParentContext); - Assert_(theBrowserContext != NULL); - return theBrowserContext->CreateGridContext(inHistList, inHistEntry, inX, inY, inWidth, inHeight, inURLString, - inWindowTarget, inScrollMode, inForceReload, inNoEdge); -} - -void* FE_FreeGridWindow( - MWContext* inContext, - XP_Bool inSaveHistory) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - Assert_(theBrowserContext != NULL); - return theBrowserContext->DisposeGridContext(inSaveHistory); -} - -void FE_RestructureGridWindow( - MWContext* inContext, - int32 inX, - int32 inY, - int32 inWidth, - int32 inHeight) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - Assert_(theBrowserContext != NULL); - theBrowserContext->RestructureGridContext(inX, inY, inWidth, inHeight); -} - -void FE_GetFullWindowSize( - MWContext* inContext, - int32* outWidth, - int32* outHeight) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - Assert_(theBrowserContext != NULL); - theBrowserContext->GetFullGridSize(*outWidth, *outHeight); -} - -void FE_GetEdgeMinSize(MWContext */*context*/, int32 *size) -{ - *size = 5; -} - - -void FE_LoadGridCellFromHistory( - MWContext* inContext, - void* inHistEntry, - NET_ReloadMethod inReload) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - Assert_(theBrowserContext != NULL); - theBrowserContext->ReloadGridFromHistory(inHistEntry, inReload); -} - - - - -void FE_SetRefreshURLTimer( - MWContext* context, - URL_Struct* URL_s) -{ - if (ExtractHyperView(context)) - ExtractHyperView(context)->SetTimerURL(URL_s); -} - -void FE_ShowScrollBars(MWContext *context, XP_Bool show) -{ -//Assert_(false); - if (show) - ExtractHyperView(context)->SetScrollMode(LO_SCROLL_YES); - else - ExtractHyperView(context)->SetScrollMode(LO_SCROLL_NO); -} - -int FE_GetURL( MWContext* context, URL_Struct* url ) -{ - CNSContext* theContext = ExtractNSContext(context); - Assert_(theContext != NULL); -#if defined(MOZ_MAIL_NEWS) || defined (MOZ_LDAP) - // 97-06-04 pkc -- check to see if we have correct context - char *address = NET_URLStruct_Address(url); - // 97-06-09 pkc -- for some reason, "search-libmsg:" isn't caught by - // MSG_RequiresBrowserWindow - if (strcasecomp(address, "search-libmsg:") && - strncasecomp(address, "ldap:", 5) && - MSG_RequiresBrowserWindow(address)) - { - CBrowserContext* browserContext = ExtractBrowserContext(context); - if (context->type != MWContextBrowser || !browserContext) - { - // We have a URL that requires a browser window, but we don't have a - // browser context. Dispatch URL to new window -// CURLDispatcher::GetURLDispatcher()->DispatchToView(NULL, url, FO_CACHE_AND_PRESENT, true); - CURLDispatcher::DispatchURL(url, NULL, false, true); - return 0; - } - else - { - theContext->SwitchLoadURL(url, FO_CACHE_AND_PRESENT); - return 0; - } - } - else -#endif // MOZ_MAIL_NEWS || MOZ_LDAP - { - if (theContext) - { - theContext->SwitchLoadURL(url, FO_CACHE_AND_PRESENT); - return 0; - } - } - return -1; -} - -MWContext* -FE_MakeBlankWindow( MWContext* /*old_context*/, URL_Struct*, char* /*window_name*/ ) -{ -Assert_(false); - return NULL; -} - -void FE_SetWindowLoading(MWContext *, URL_Struct *, - Net_GetUrlExitFunc **exit_func) -{ -// We should probably to the corresponding thing in the new world -// NETSCAPECONTEXT(context)->StartSpinIcon(url, FALSE); - // This is safe for now... - *exit_func = EarlManager::DispatchFinishLoadURL; -} - - - - - - - - -MWContext* FE_MakeNewWindow(MWContext* old_context, - URL_Struct* url, - char* window_name, - Chrome* chrome) -{ - - // I have no idea what I'm doing, so bear with me - // 1997-01-07 deeje - - MWContext* theContext = nil; - - try - { - ResIDT whichLayout = CBrowserWindow::res_ID; - CBrowserContext* theBrowserContext = nil; - MWContext* theTargetContext = XP_FindNamedContextInList(old_context, window_name); - if (theTargetContext != nil) - { - theBrowserContext = ExtractBrowserContext(theTargetContext); - } - - Boolean isDocInfoWindow = IsDocInfoWindow(window_name); - - short docInfoWindowWidth = qd.screenBits.bounds.right - 100; - const short maxDocInfoWindowWidth = 600; - - if (docInfoWindowWidth > maxDocInfoWindowWidth) - docInfoWindowWidth = maxDocInfoWindowWidth; - - short docInfoWindowHeight = qd.screenBits.bounds.bottom - 200; - const short maxDocInfoWindowHeight = 900; - - if (docInfoWindowHeight > maxDocInfoWindowHeight) - docInfoWindowHeight = maxDocInfoWindowHeight; - - // mjc select layout based on chrome. Relevant fields are titlebar, topmost, and z-lock. - if (chrome != nil) - { - const ResIDT floatingHelpWindowResID = 1015; - - if (chrome->type == MWContextDialog) - { - if (isDocInfoWindow) - { -// chrome->topmost = true; - chrome->location_is_chrome = true; - chrome->w_hint = docInfoWindowWidth; - chrome->h_hint = docInfoWindowHeight; -// whichLayout = floatingHelpWindowResID; - } -// else if (chrome->allow_resize && chrome->allow_close) - if (chrome->allow_resize && chrome->allow_close) - { - whichLayout = CBrowserWindow::res_ID; // DOH! it can be a MWContextDialog and still have non-dialog window bits! - } - else - { - whichLayout = CBrowserWindow::dialog_res_ID; - } - } - else if ( chrome->type == MWContextHTMLHelp ) - whichLayout = floatingHelpWindowResID; - else if (chrome->hide_title_bar == true) - whichLayout = CBrowserWindow::titlebarless_res_ID; // titlebar-less browser window - else if (chrome->topmost == true && chrome->hide_title_bar == false) // removed z-lock == true test - 2/11/97 mjc - whichLayout = CBrowserWindow::floating_res_ID; - else if (chrome->allow_resize) - whichLayout = CBrowserWindow::res_ID; - else // If not explicitly resizable make sure window is created wo Zoom widget (Bug #s 86787, 96213) - whichLayout = CBrowserWindow::nozoom_res_ID; - } - - // ¥¥¥ also, there are places in the code (ie CURLDispatcher) which check the res_ID of a window - // to determine a course of action. So far, most of the code assumes only two ID values, - // which is obviously not true anymore. This needs to be addressed as well. deeje 1997-01-16 - - // A browser window now has a family of res ids. URLs are dispatched to windows by - // finding the window corresponding to the context passed in. The type of window searched - // for (browser or editor), depends on the res id passed in. There is no mapping of res ids - // to type, and there should be. This works as is because the DispatchToView defaults the - // res id to CBrowserWindow::res_id, so all the variations map to the browser window type. - // 1997-02-28 mjc - - // make the window - CURLDispatcher::DispatchURL(url, theBrowserContext, false, true, whichLayout, false); - - CBrowserWindow* theWindow = CURLDispatcher::GetLastBrowserWindowCreated(); - - if (theWindow != nil) - { - theBrowserContext = (CBrowserContext*)theWindow->GetWindowContext(); - theContext = *theBrowserContext; - if ((theContext != nil) && (window_name != nil)) - { - theContext->name = XP_STRDUP(window_name); - // 97-05-08 pkc -- set restricted target flag for "special" browser windows, - // e.g. view source and doc info windows - if (IsSpecialBrowserWindow(window_name)) - theBrowserContext->SetRestrictedTarget(true); - } - if (chrome != nil) - { - theWindow->SetCanSaveStatus(false); - if (chrome->dependent) - CMochaHacks::AddDependent(old_context, theContext); - if (chrome->hide_title_bar) theWindow->ClearAttribute(windAttr_TitleBar); // work around Constructor bug which sets this by default for non-standard windows - if (chrome->restricted_target) theBrowserContext->SetRestrictedTarget(true); - theWindow->SetChromeInfo(chrome, false, true); - } - if (isDocInfoWindow) - { - Point globalTopLeft = - { - qd.screenBits.bounds.bottom - docInfoWindowHeight - 50, - qd.screenBits.bounds.right - docInfoWindowWidth - 50 - }; - - CSaveWindowStatus::MoveWindowTo(theWindow, globalTopLeft); - } - /* jpm changes: get Shift_JIS & MacRoman 8bit to display correctly in security dialogs */ - if ((chrome != nil) && (theContext != nil)) - { - // pinkerton - 98-05-27 - // save the close callback so that we can run it when the context goes away. Make sure - // we are setting this on the _new_ context, not the old one. - theBrowserContext->SetCloseCallback ( chrome->close_callback, chrome->close_arg ); - - if (chrome->type == MWContextDialog) - { - CNSContext* theNSContext = ExtractNSContext(theContext); - Assert_(theNSContext != NULL); - if (isDocInfoWindow) - { - /* Doc Info gets the user-selectable default encoding */ - theNSContext->SetDefaultCSID(INTL_DefaultWinCharSetID(NULL)); - } else { - if (!IsViewSourceWindow(window_name)) - { - /* all other HTML dialogs get the localised clients default encoding */ - theNSContext->SetDefaultCSID(INTL_CharSetNameToID(INTL_ResourceCharSet())); - } - } - /* what about View Source? It inherits the encoding of the page being viewed */ - } - } - /* jpm end changes */ - theWindow->Show(); - } - } - catch(...) - { - } - - return theContext; -} - - - -void FE_UpdateChrome(MWContext *inContext, Chrome *inChrome) -{ - CBrowserContext* brContext = ExtractBrowserContext(inContext); - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(brContext); - - if (theWindow != nil) - { - theWindow->SetChromeInfo(inChrome); - - if ( inChrome ) { - // 98-05-27 pinkerton - // Set the callback info so we do the right thing when the window goes away - brContext->SetCloseCallback ( inChrome->close_callback, inChrome->close_arg ); - } - } -} - -void FE_QueryChrome(MWContext *inContext, Chrome *inChrome) -{ - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(ExtractBrowserContext(inContext)); - - if (theWindow != nil) - { - theWindow->GetChromeInfo(inChrome); - } - /* special case for inner width and height which are frame inner width and height if we - * are handed a frame, and window inner width and height if we are handed a window. - */ - if (inContext->grid_parent != NULL) - { - CHTMLView* theView = ExtractHyperView(inContext); - if (theView) - { - CHyperScroller* theScroller = dynamic_cast(theView->GetSuperView()); - SDimension16 theInnerSize; - if (theScroller) theScroller->GetFrameSize(theInnerSize); - else theView->GetFrameSize(theInnerSize); - inChrome->w_hint = theInnerSize.width; - inChrome->h_hint = theInnerSize.height; - } - } - -} - - - - - - -void FE_DestroyWindow( MWContext* context ) -{ - LView* view = ExtractHyperView(context); - if (view) - { - while( view != NULL ) - { - view = view->GetSuperView(); - if (view) - { - LWindow* window = dynamic_cast(view); - if (window) - { - window->ObeyCommand(cmd_Close, NULL); - break; - } - } - } - } -} - -void FE_Message(MWContext* context, const char* msg) -{ - if (context && context->type == MWContextBiff) - return; - - CStr255 pmessage( msg ); - StripDoubleCRs( pmessage ); - - LCommander* inSuper = LCommander::GetTopCommander(); - StBlockingDialogHandler theHandler( WIND_MessageDialog, inSuper); - LWindow* theDialog = theHandler.GetDialog(); - - // set the message - LCaption* theCaption = (LCaption*)theDialog->FindPaneByID( PaneID_AlertCaption ); - Assert_( theCaption != NULL ); - theCaption->SetDescriptor( pmessage ); - - if (UStdDialogs::TryToInteract()) - { - theDialog->Show(); - MessageT theMessage = msg_Nothing; - while(theMessage == msg_Nothing) - theMessage = theHandler.DoDialog(); - } -} - -void FE_Alert( MWContext* context, const char* msg ) -{ - if ( context ) - { - if (context->type == MWContextBiff) - return; - CNSContext* theContext = ExtractNSContext(context); - Assert_(theContext != NULL); - if (theContext) - theContext->Alert(msg); - } - else - { - CStr255 pmessage( msg ); - StripDoubleCRs( pmessage ); - UStdDialogs::Alert(pmessage, eAlertTypeCaution); - } -} - -char* FE_URLToLocalName( char *inURL ) -{ - if( inURL == NULL ) - return NULL; - - char * url = XP_STRDUP( inURL ); // Get our own copy - if ( url == NULL ) - return NULL; - - // chop off everything after the first '?' - char *end = XP_STRCHR(url, '?'); - if ( end ) - *end = '\0'; - - // chop off everything after the first '#' - end = XP_STRCHR( url, '#' ); - if ( end ) - *end = '\0'; - - // Keep only what is to the right of the last slash - char *front = XP_STRRCHR(url, '/'); - if ( front ) - strcpy( url, front + 1 ); // (or the whole string if there is no slash) - - if ( XP_STRLEN( url ) == 0 ) - { // Is this really neccesary? - XP_FREE(url); - url = NULL; - } - - return( url ); -} - - -#define SECURITY_ALERT_RESID 1999 -Bool FE_SecurityDialog( MWContext* /*context*/, int message, XP_Bool *retpref ) -{ - short result; - - result = CautionAlert( SECURITY_ALERT_RESID + message, NULL ); - - if ( ( result == neverAgain ) && ( retpref != NULL ) ) - { - *retpref = FALSE; - result = ok; - } - else if ( message == SD_INSECURE_POST_FROM_SECURE_DOC ) - { - if ( result == 1 ) - result = cancel; - else if ( result == 2 ) - result = ok; - } - - if ( result == cancel ) - return FALSE; - else - return TRUE; -} - -int32 FE_GetContextID( MWContext* window_id ) -{ - return (int) window_id; -} - -const char* FE_UsersMailAddress() -{ - return CPrefs::GetCharPtr( CPrefs::UserEmail ); -} - -const char* FE_UsersFullName() -{ - return CPrefs::GetCharPtr( CPrefs::UserName ); -} - -const char* FE_UsersSignature(void) -{ - static char* signature = NULL; - XP_File file; - - if (!CPrefs::GetBoolean(CPrefs::UseSigFile)) - return NULL; - - if ( signature ) - XP_FREE( signature ); - if ( CPrefs::GetBoolean( CPrefs::UseInternetConfig ) ) - { - Str255 sigString; - memset( sigString, '\0', 256 ); - CInternetConfigInterface::GetInternetConfigString( kICSignature, sigString); - signature = XP_STRDUP( (char*) sigString ); - } - else - { - file = XP_FileOpen( CStr255::sEmptyString, xpSignature, XP_FILE_READ ); - - if ( file ) - { - char buf[ 1024 ]; - char* s = buf; - - int left = sizeof( buf ) - 2; - int size; - *s = 0; - - while ( ((size = XP_FileRead( s, left, file ) )!=0) && left > 0 ) - { - left -= size; - s += size; - } - - *s = 0; - - /* take off all trailing whitespace */ - s--; - while ( s >= buf && isspace (*s) ) - *s-- = 0; - /* terminate with a single newline. */ - s++; - *s++ = '\r'; - *s++ = 0; - XP_FileClose( file ); - if ( !strcmp( buf, "\r" ) ) - signature = NULL; - else - signature = strdup( buf ); - } - else - signature = NULL; - } - return signature; -} - -void FE_FileType(char * path, - Bool * useDefault, - char ** fileType, - char ** encoding) -{ - FSSpec spec; - if ((path == NULL) || (fileType == NULL) || (encoding == NULL)) - return; - - *useDefault = TRUE; - *fileType = NULL; - *encoding = NULL; - - char *pathPart = NET_ParseURL( path, GET_PATH_PART); - if (pathPart == NULL) - return; - - OSErr err = CFileMgr::FSSpecFromLocalUnixPath(pathPart, &spec); // Skip file:// - XP_FREE(pathPart); - - CMimeMapper * mapper = CPrefs::sMimeTypes.FindMimeType(spec); - if (mapper != NULL) - { - *useDefault = FALSE; - *fileType = XP_STRDUP(mapper->GetMimeName()); - } - else - { - FInfo fndrInfo; - OSErr err = FSpGetFInfo( &spec, &fndrInfo ); - if ( (err != noErr) || (fndrInfo.fdType == 'TEXT') ) - *fileType = XP_STRDUP(APPLICATION_OCTET_STREAM); - else - { - // Time to call IC to see if it knows anything - ICMapEntry ICMapper; - - ICError error = 0; - CStr255 fileName( spec.name ); - error = CInternetConfigInterface::GetInternetConfigFileMapping( - fndrInfo.fdType, fndrInfo.fdCreator, fileName , &ICMapper ); - if( error != icPrefNotFoundErr && StrLength(ICMapper.MIME_type) ) - { - *useDefault = FALSE; - CStr255 mimeName( ICMapper.MIME_type ); - *fileType = XP_STRDUP( mimeName ); - } - else - { - // That failed try using the creator type - mapper = CPrefs::sMimeTypes.FindCreator(fndrInfo.fdCreator); - if( mapper) - { - *useDefault = FALSE; - *fileType = XP_STRDUP(mapper->GetMimeName()); - } - else - { - // don't have a mime mapper - *fileType = XP_STRDUP(APPLICATION_OCTET_STREAM); - } - } - } - } -} - -const char* -FE_UsersOrganization( void ) -{ - return CPrefs::GetCharPtr( CPrefs::Organization ); -} - -char* FE_GetTempFileFor( MWContext* /*cx*/, const char* filename, - XP_FileType ftype, XP_FileType* rettype ) -{ - *rettype = ftype; // Required, if the stuff is to work! - char * s = WH_TempName(ftype, filename); - return s; -} - -/* The semantics of this routine are badly broken */ -/* We'll mimic Window's implementation for sanity */ -int FE_PromptForFileName( MWContext* context, - const char* prompt_string, - const char* default_path, - XP_Bool file_must_exist_p, - XP_Bool directories_allowed_p, - ReadFileNameCallbackFunction fn, // This function will free the file name - void* closure ) -{ - StandardFileReply reply; - XP_MEMSET(&reply, 0, sizeof(StandardFileReply)); - OSErr err = -1; - CFilePicker::PickEnum pickType; - - if ( file_must_exist_p ) - { - if ( directories_allowed_p ) - pickType = CFilePicker::Folders; - else - pickType = CFilePicker::AnyFile; - - if ( default_path ) - err = CFileMgr::FSSpecFromLocalUnixPath( default_path, &reply.sfFile ); - - if ( CFilePicker::DoCustomGetFile( reply, pickType, err == noErr ) ) - goto copy; - else - return -1; - } - else - { - if ( !directories_allowed_p ) - { - CStr255 prompt; - CStr31 filename; - - if ( default_path ) - { - filename = CFileMgr::FileNameFromURL( default_path ); - err = CFileMgr::FSSpecFromLocalUnixPath( default_path, &reply.sfFile ); - LString::CopyPStr( filename, reply.sfFile.name, 31 ); - } - - prompt = prompt_string; - if ( CFilePicker::DoCustomPutFile( reply, prompt, err == noErr ) ) - goto copy; - else - return -1; - } - else /* Directories , they are asking for a new folder, we give 'em existing for window's compatibility */ - { - pickType = CFilePicker::Folders; - if ( default_path ) - err = CFileMgr::FSSpecFromLocalUnixPath( default_path, &reply.sfFile ); - - if ( CFilePicker::DoCustomGetFile( reply, pickType, err == noErr ) ) - goto copy; - else - return -1; - } - } - -copy: - FSSpec smReply; - char* path; - - smReply = reply.sfFile; - path = CFileMgr::EncodedPathNameFromFSSpec( smReply, TRUE ); - if ( fn ) - (*fn) ( context, path, closure ); - return noErr; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- JAVASCRIPT --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void FE_BackCommand (MWContext *inContext) -{ - CBrowserContext* theContext = ExtractBrowserContext(inContext); - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(theContext); - - if (theWindow != nil && theContext->CanGoBack()) - theWindow->ObeyCommand(cmd_GoBack); -} - -void FE_ForwardCommand (MWContext *inContext) -{ - CBrowserContext* theContext = ExtractBrowserContext(inContext); - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(theContext); - - if (theWindow != nil && theContext->CanGoForward()) - theWindow->ObeyCommand(cmd_GoForward); -} - -void FE_HomeCommand (MWContext *inContext) -{ - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(ExtractBrowserContext(inContext)); - - if (theWindow != nil) - { - theWindow->ObeyCommand(cmd_Home); // we can always go home - } -} - -void FE_PrintCommand (MWContext *inContext) -{ - CHTMLView* theHTMLView = ExtractHyperView(inContext); - - if (theHTMLView != nil) - { - Boolean outEnabled; - Boolean outUsesMark; - Char16 outMark; - Str255 outName; - // can we print? - theHTMLView->FindCommandStatus(cmd_Print, outEnabled, outUsesMark, outMark, outName); - if (outEnabled) - theHTMLView->ObeyCommand(cmd_Print, NULL); - } -} - -// Searches for a string in the html view. -// ALERT: inWrap disabled because it is always false in backend - 1997-03-06 mjc -XP_Bool FE_FindCommand( - MWContext *inContext, char* inSearchString, - XP_Bool inCaseSensitive, XP_Bool inBackward, XP_Bool /*inWrap*/) -{ - CHTMLView* theView = ExtractHyperView(inContext); - if (theView != nil) - { - Boolean outEnabled; - Boolean outUsesMark; - Char16 outMark; - Str255 outName; - // can we find? - theView->FindCommandStatus(cmd_Find, outEnabled, outUsesMark, outMark, outName); - if (outEnabled) - { - if (inSearchString != NULL) - { - if (strlen(inSearchString) == 0) return FALSE; - // use CFindWindow statics to setup and do the find without creating a window - // save and restore settings - Boolean saveCaseSensitive = CFindWindow::sCaseless; - Boolean saveBackward = CFindWindow::sBackward; - //Boolean saveWrap = CFindWindow::sWrap; - CFindWindow::sLastSearch = inSearchString; - CFindWindow::sCaseless = !inCaseSensitive; - CFindWindow::sBackward = inBackward; - //CFindWindow::sWrap = inWrap; - Boolean result = theView->DoFind(); - CFindWindow::sCaseless = saveCaseSensitive; - CFindWindow::sBackward = saveBackward; - //CFindWindow::sWrap = saveWrap; - return result; - } - else - { - CFindWindow::DoFind(theView); // create a find window - return FALSE; - } - } - } - return FALSE; -} - -// Returns in global coordinates the offset of the html view from the screen origin. -// The vertical component of the screen origin for javascript on the mac is the -// bottom of the menubar. -void FE_GetWindowOffset (MWContext *inContext, int32 *sx, int32 *sy) -{ - CHTMLView* theView = ExtractHyperView(inContext); - if (theView != nil) - { - Point htmlOrigin = { 0, 0}; - theView->LocalToPortPoint(htmlOrigin); - theView->PortToGlobalPoint(htmlOrigin); - htmlOrigin.v -= ::GetMBarHeight(); - *sx = htmlOrigin.h; - *sy = htmlOrigin.v; - } -} - -// Returns the device which contains the largest portion of -// the window's rectangle, or the main device if inWindow is null. -GDHandle DeviceForWindow(LWindow* inWindow) -{ - GDHandle dominantDevice = nil; - - if (inWindow != nil) - { - Rect windowFrame; - - inWindow->CalcPortFrameRect( windowFrame ); - windowFrame = PortToGlobalRect( inWindow, windowFrame ); - - dominantDevice = UWindows::FindDominantDevice(windowFrame); - } - else dominantDevice = ::GetMainDevice(); - - return ((dominantDevice == nil) ? ::GetMainDevice() : dominantDevice); -} - -// Returns the screen size for the screen which contains the largest -// portion of the rectangle. If the context does not correspond to a browser window, -// returns the values for the main screen. -void FE_GetScreenSize (MWContext *inContext, int32 *sx, int32 *sy) -{ - GDHandle device; - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(ExtractBrowserContext(inContext)); - - device = DeviceForWindow(theWindow); - - *sx = (**device).gdRect.right; - *sy = (**device).gdRect.bottom; -} - -// Returns the top, left, width, and height of the available screen area, that is, -// on the Mac, the screen area minus the menubar. The screen which contains the -// largest portion of the window's rectangle is chosen, or the main screen if the -// context does not correspond to a browser window. -void FE_GetAvailScreenRect (MWContext *inContext, int32 *sx, int32 *sy, - int32 *left, int32 *top) -{ - GDHandle device; - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(ExtractBrowserContext(inContext)); - - device = DeviceForWindow(theWindow); - - *sx = (**device).gdRect.right; - *sy = (**device).gdRect.bottom - ::GetMBarHeight(); - // left and top represent the origin in terms of window positioning so will always be 0, 0 on mac - *left = 0; /* (**device).gdRect.left; */ - *top = 0; /* (**device).gdRect.top + ::GetMBarHeight(); */ -} - -// Returns the pixel and color depth for the screen which contains the largest -// portion of the rectangle. If the context does not correspond to a browser window, -// returns the values for the main screen. -void FE_GetPixelAndColorDepth (MWContext *inContext, int32 *pixelDepth, - int32 *colorDepth) -{ - GDHandle device; - CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(ExtractBrowserContext(inContext)); - - device = DeviceForWindow(theWindow); - - *pixelDepth = (**(**device).gdPMap).pixelSize; - *colorDepth = (**(**device).gdPMap).pixelSize; // ALERT: implement me! -} - - -// This function returns a context suitable for throwing up a dialog -// at init time. This dialog must be an FE_PromptPassword. If other dialogs -// are needed, we need to check all the FE's to make sure that their returned -// context can handle them. (rjr). -MWContext *FE_GetInitContext(void) { - static CNSContext *rootContext = NULL; - - if (!rootContext) { - rootContext = new CNSContext(MWContextDialog); - if (rootContext) { - // don't leave this context lieing around the XP list. - XP_RemoveContextFromList((MWContext *)*rootContext); - } - } - if (!rootContext) return NULL; - return (MWContext *)*rootContext; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- PREFS CRAP --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// This class only works for now with the old prefs (CPrefs::SubscribeToPrefChanges / -// CPrefs::UnsubscribeToPrefChanges). It can be extended for the new style prefs -// (PREF_RegisterCallback / PREF_UnregisterCallback) - -class PrefsChangeListener : public LListener -{ -public: - PrefsChangeListener(CPrefs::PrefEnum inID); - virtual ~PrefsChangeListener(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - virtual Boolean PrefHasChanged(); -protected: - CPrefs::PrefEnum mID; - Boolean mPrefHasChanged; -}; - -PrefsChangeListener::PrefsChangeListener(CPrefs::PrefEnum inID) -{ - mID = inID; - mPrefHasChanged = true; // default to true: must load pref the first time - CPrefs::SubscribeToPrefChanges(this); -} - -PrefsChangeListener::~PrefsChangeListener() -{ - CPrefs::UnsubscribeToPrefChanges(this); -} - -void PrefsChangeListener::ListenToMessage(MessageT inMessage, void *ioParam) -{ - if (inMessage == CPrefs::msg_PrefsChanged) - { - if (*(CPrefs::PrefEnum *)ioParam == mID) - mPrefHasChanged = true; - } -} - -Boolean PrefsChangeListener::PrefHasChanged() -{ - Boolean value = mPrefHasChanged; - mPrefHasChanged = false; - return(value); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- INTERNATIONAL CALLBACKS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void INTL_Relayout(MWContext* inContext) -{ - CBrowserContext* theBrowserContext = ExtractBrowserContext(inContext); - - // this can be called when quoting HTML on a plain text email; then we - // have a CPlainTextConverterContext, not a CBrowserContext - if (theBrowserContext != NULL) - theBrowserContext->Repaginate(); -} - -static Int16 DefaultDocCharSetIDFromContext(MWContext* inContext); -static Int16 DefaultDocCharSetIDFromPref(); -Int16 DefaultDocCharSetIDFromFrontWindow(); - -static Int16 DefaultDocCharSetIDFromContext(MWContext* inContext) -{ - Assert_(inContext != NULL); - CNSContext* theNSContext = ExtractNSContext(inContext); - Assert_(theNSContext != NULL); - return theNSContext->GetDefaultCSID(); -} - -static PrefsChangeListener * gCharSetIDPrefsListener = nil; - -static Int16 DefaultDocCharSetIDFromPref() -{ - static Int16 prefDefaultID; - - if (gCharSetIDPrefsListener == nil) - gCharSetIDPrefsListener = new PrefsChangeListener(CPrefs::DefaultCharSetID); - - if (gCharSetIDPrefsListener->PrefHasChanged()) - { - prefDefaultID = CPrefs::GetLong(CPrefs::DefaultCharSetID); - if(0 == prefDefaultID) // to fix John McMullen's old preference problem (bug 63052) - prefDefaultID = CS_LATIN1; - } - if (INTL_CanAutoSelect(prefDefaultID)) - prefDefaultID |= CS_AUTO; - return prefDefaultID; -} - -Int16 DefaultDocCharSetIDFromFrontWindow() -{ - CWindowIterator iter(WindowType_Any); - CMediatedWindow* window; - Int16 csid = 0; - for (iter.Next(window); window; iter.Next(window)) - { - csid = window->DefaultCSIDForNewWindow(); - if(0 != csid) - return csid; - } - return 0; -} - -int16 INTL_DefaultDocCharSetID(MWContext* inContext) -{ - if (inContext != NULL) - return DefaultDocCharSetIDFromContext(inContext); - return DefaultDocCharSetIDFromPref(); -} - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- IMAGE LIB STUFF--- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -void FE_ShiftImage( - MWContext* , - LO_ImageStruct* ) -{ -} - - - - - - - - - - - - - - - - - - - - - - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- HELP STUFF --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -MWContext *FE_GetNetHelpContext() -{ -#if 0 // no more NetHelp! - - MWContext *pActiveContext = NULL; - CNSContext *pWindowContext = NULL; - CWindowIterator *iter; - CMediatedWindow *window; - - iter = new CWindowIterator(WindowType_Browser); - iter->Next(window); - - if (window) { - CBrowserWindow *result; - - result = dynamic_cast(window); - pWindowContext = result->GetWindowContext(); - } else { - delete iter; - - iter = new CWindowIterator(WindowType_MailNews); - iter->Next(window); - -#ifdef MOZ_MAIL_NEWS - if (window) { - CMailNewsWindow *result; - - result = dynamic_cast(window); - pWindowContext = result->GetWindowContext(); - } -#endif // MOZ_MAIL_NEWS - } - - if (pWindowContext) { - pActiveContext = (MWContext *) pWindowContext; - } - - if (!pActiveContext) { - - /* Borrow a cheat from the AppleEvents code that did this. The comment there was: - "Will using the bookmark context as a dummy work?" - */ - DebugStr("\pNot Implemented"); -//¥¥¥ CBookmarksContext::Initialize(); -//¥¥¥ pActiveContext = (MWContext *) ((CNSContext *) CBookmarksContext::GetInstance()); - } - - return pActiveContext; -#endif - return NULL; -} - - -// -// ShowHelp -// -// Displays the NetHelp window, given the appropriate help topic. -// - -void -ShowHelp ( const char* inHelpTopic ) -{ - const char * const netHelpPrefix = "nethelp:netscape/"; - char *fullURL = (char *)XP_ALLOC(strlen(inHelpTopic) + - strlen(netHelpPrefix) + 1); - if (fullURL) - { - strcpy(fullURL, netHelpPrefix); - strcat(fullURL, inHelpTopic); - CFrontApp::DoGetURL(fullURL); - XP_FREE(fullURL); - } -} // DoHelp - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- NETCASTER STUFF --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -/* Check if Netcaster is in the registry, and if a specific component is there - * (the user may have deleted the files) - */ -XP_Bool FE_IsNetcasterInstalled() -{ - XP_Bool bInstalled = ((VR_InRegistry("Netcaster") == REGERR_OK) && (VR_ValidateComponent("Netcaster/tab.htm") == REGERR_OK)); - VR_Close(); - return bInstalled; -} - -/* Runs Netcaster by finding an html component and opening it in a - * new browser window, or bringing the window to the front if Netcaster - * is already launched. - */ -void FE_RunNetcaster(MWContext *) -{ -#if 0 - CFrontApp *theApp = CFrontApp::GetApplication(); - MWContext *pNetcasterContext = NULL; - char *contextName = "Netcaster_SelectorTab"; - - // The Mac function ignores the pContext parameter - - if (theApp != NULL) { - pNetcasterContext = theApp->GetNetcasterContext(); - if (pNetcasterContext != NULL) { - // we've already launched. Just bring it to front. - FE_RaiseWindow(pNetcasterContext); - } else { - // we haven't launched yet. Do that now. - - Chrome netcasterChrome; - URL_Struct* URL_s; - REGERR regErr; - char netcasterPath[1024]; - - // get the native path to the component. - regErr = VR_GetPath("Netcaster/tab.htm", 1024, netcasterPath); - VR_Close(); - - if (regErr == REGERR_OK) { - - FSSpec netcasterFile; - char *netcasterURL; - // translate the native path to a local file URL. - CFileMgr::FSSpecFromPathname(netcasterPath, &netcasterFile); - netcasterURL = CFileMgr::GetURLFromFileSpec(netcasterFile); - - if (netcasterURL != NULL) - { - // javascript and java must be enabled for Netcaster to run. - if (!LM_GetMochaEnabled() || !LJ_GetJavaEnabled()) - { - char *errString = XP_GetString(XP_ALERT_NETCASTER_NO_JS); - - ErrorManager::PlainAlert(errString, "", "", ""); - XP_FREE(netcasterURL); - return; - } - memset(&netcasterChrome, 0, sizeof(Chrome)); - - netcasterChrome.w_hint = 22; - netcasterChrome.h_hint = 59; - netcasterChrome.l_hint = -300; - netcasterChrome.t_hint = 0; - netcasterChrome.topmost = TRUE; - netcasterChrome.z_lock = TRUE; - netcasterChrome.location_is_chrome = TRUE; - netcasterChrome.disable_commands = TRUE; - netcasterChrome.hide_title_bar = TRUE; - netcasterChrome.restricted_target = TRUE; - netcasterChrome.allow_close = TRUE; - - URL_s = NET_CreateURLStruct(netcasterURL, NET_DONT_RELOAD); - - pNetcasterContext = FE_MakeNewWindow(NULL, - URL_s, - contextName, - &netcasterChrome); - - theApp->SetNetcasterContext(pNetcasterContext); - XP_FREE(netcasterURL); - } - } else { - char *errString = XP_GetString(XP_ALERT_CANT_RUN_NETCASTER); - - ErrorManager::PlainAlert(errString, "", "", ""); - } - } - } else { - XP_ASSERT(0); - } -#endif -} - -MWContext * FE_IsNetcasterRunning(void) -{ - return NULL; - -#if 0 - CFrontApp *theApp = CFrontApp::GetApplication(); - - if (theApp != NULL) - return theApp->GetNetcasterContext(); - else return NULL; -#endif -} - -MWContext * FE_GetRDFContext() -{ - try - { - if (!CFrontApp::sRDFContext.get()) - { - CFrontApp::sRDFContext.reset(new CNSContext(MWContextRDFSlave)); - } - return *CFrontApp::sRDFContext.get(); - } - catch (...) - { - return NULL; - } -} - -// stub this for now -void FE_SetPasswordEnabled( MWContext*, PRBool ) -{ -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- SPURIOUS CRAP --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -char reconnectHack[] = "internal-external-reconnect"; -char mailNewsReconnect[] = "internal-external-reconnect:"; - -const char* cDocInfoWindowContextName = "%DocInfoWindow"; -const char* cViewSourceWindowContextName1 = "%ViewSourceWindow"; -const char* cViewSourceWindowContextName2 = "view-source"; -const size_t cViewSourceWindowString1Length = 17; -const size_t cViewSourceWindowString2Length = 11; - -Boolean IsMailToLink( const char* url ) -{ - if ( !XP_STRNCMP( url, "mailto", 6 ) ) - return TRUE; - return FALSE; -} - -Boolean IsInternalImage( const char* url ) -{ - if ( !XP_STRNCMP( url, reconnectHack, XP_STRLEN( reconnectHack ) ) ) - return TRUE; - return FALSE; -} - -Boolean IsMailNewsReconnect( const char* url ) -{ - if ( !XP_STRNCMP( url, mailNewsReconnect, XP_STRLEN( mailNewsReconnect ) ) ) - return TRUE; - return FALSE; -} - -Boolean IsInternalTypeLink( const char* url ) -{ - if ( !XP_STRNCMP( url, "internal-", 9 ) ) - return TRUE; - return FALSE; -} - -Boolean IsDocInfoWindow(const char* inName) -{ - if (inName) - return (XP_STRCMP(inName, cDocInfoWindowContextName) == 0); - else - return false; -} - -Boolean IsViewSourceWindow(const char* inName) -{ - Boolean result = false; - if (inName && (XP_STRLEN(inName) >= cViewSourceWindowString2Length)) - { - result = (XP_STRNCMP(inName, - cViewSourceWindowContextName1, - cViewSourceWindowString1Length) == 0); - if (!result) - { - result = (XP_STRCASECMP(inName, cViewSourceWindowContextName2) == 0); - } - } - return result; -} - -Boolean IsSpecialBrowserWindow(const char* inName) -{ - Boolean result = false; - if (inName) - { - if (IsDocInfoWindow(inName)) - result = true; - if (IsViewSourceWindow(inName)) - result = true; - if (XP_STRCMP(inName, XP_GetString(XP_SECURITY_ADVISOR_TITLE_STRING)) == 0) - result = true; - } - return result; -} diff --git a/mozilla/cmd/macfe/central/RandomFrontEndCrap.h b/mozilla/cmd/macfe/central/RandomFrontEndCrap.h deleted file mode 100644 index ba1329e9f1d..00000000000 --- a/mozilla/cmd/macfe/central/RandomFrontEndCrap.h +++ /dev/null @@ -1,34 +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. - */ - -// RandomFrontEndCrap.h - -#pragma once - -extern char reconnectHack[]; -extern char mailNewsReconnect[]; - - -Boolean IsInternalImage(const char* url); -Boolean IsMailToLink(const char* url); -Boolean IsMailNewsReconnect(const char* url); -Boolean IsInternalTypeLink(const char* url); - -Boolean IsDocInfoWindow(const char* inName); -Boolean IsViewSourceWindow(const char* inName); -Boolean IsSpecialBrowserWindow(const char* inName); diff --git a/mozilla/cmd/macfe/central/StBlockingDialogHandler.cp b/mozilla/cmd/macfe/central/StBlockingDialogHandler.cp deleted file mode 100644 index c27255abd51..00000000000 --- a/mozilla/cmd/macfe/central/StBlockingDialogHandler.cp +++ /dev/null @@ -1,85 +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. - */ - -// StBlockingDialogHandler.cp - -#include "StBlockingDialogHandler.h" - -#include - -StBlockingDialogHandler::StBlockingDialogHandler( - ResIDT inDialogResID, - LCommander* inSuper) - : StDialogHandler(inDialogResID, inSuper) -{ - // disable the Help menu while a dialog is in front - // (to prevent loading of Help URLs) - - MenuHandle balloonMenuH = NULL; - HMGetHelpMenuHandle( &balloonMenuH ); - if (balloonMenuH) - DisableItem(balloonMenuH, 0); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -StBlockingDialogHandler::~StBlockingDialogHandler() -{ - MenuHandle balloonMenuH = NULL; - HMGetHelpMenuHandle( &balloonMenuH ); - if (balloonMenuH) - EnableItem(balloonMenuH, 0); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean StBlockingDialogHandler::ExecuteAttachments( - MessageT inMessage, - void *ioParam) -{ - Boolean executeHost = true; - - // Execute the Attachments for the EventDispatcher that was - // in control before this one took over - -// if (mSaveDispatcher != nil) { -// executeHost = mSaveDispatcher->ExecuteAttachments(inMessage, ioParam); -// } - - // Inherited function will execute Attachments for this object - - return (executeHost && LAttachable::ExecuteAttachments(inMessage, ioParam)); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Override to prevent About menu item from being enabled. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void -StBlockingDialogHandler::FindCommandStatus( - CommandT /* inCommand */, - Boolean &outEnabled, - Boolean& /* outUsesMark */, - Char16& /* outMark */, - Str255 /* outName */) -{ - outEnabled = false; -} diff --git a/mozilla/cmd/macfe/central/StBlockingDialogHandler.h b/mozilla/cmd/macfe/central/StBlockingDialogHandler.h deleted file mode 100644 index 2b60efb49f6..00000000000 --- a/mozilla/cmd/macfe/central/StBlockingDialogHandler.h +++ /dev/null @@ -1,41 +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. - */ - -// StBlockingDialogHandler.h - -#pragma once - -#include - -class StBlockingDialogHandler : public StDialogHandler -{ - public: - StBlockingDialogHandler( - ResIDT inDialogResID, - LCommander* inSuper); - - virtual ~StBlockingDialogHandler(); - - virtual Boolean ExecuteAttachments( - MessageT inMessage, - void *ioParam); - - virtual void FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName); -}; diff --git a/mozilla/cmd/macfe/central/TSMProxy.cp b/mozilla/cmd/macfe/central/TSMProxy.cp deleted file mode 100644 index dd79f72ba7c..00000000000 --- a/mozilla/cmd/macfe/central/TSMProxy.cp +++ /dev/null @@ -1,709 +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. - */ - -#include "TSMProxy.h" -#include "proto.h" -#include "edt.h" -#include "uintl.h" -#include "intl_csi.h" -#include "xp_trace.h" - - - - -HoldUpdatesProxy::HoldUpdatesProxy(CEditView &inTextView) : - mTextView(inTextView) -{ - mTextView.SetHoldUpdates(this); - mStartY = 0; - mHeight = 0; -} - -HoldUpdatesProxy::~HoldUpdatesProxy() -{ - mTextView.SetHoldUpdates(nil); - mTextView.DocumentChanged(mStartY, mHeight); -} - -void HoldUpdatesProxy::DocumentChanged( int32 iStartY, int32 iHeight ) -{ - if (mHeight == 0) { // there is no range already - // just set to the new range - mStartY = iStartY; - mHeight = iHeight; - - } else if (mHeight == -1) { // the current range already extends to the bottom - // should the top be moved up? - if (iStartY < mStartY) - mStartY = iStartY; - - } else if (iHeight == -1) { // the new range extendes all the way to the bottom - // should the top be moved up? - mHeight = iHeight; - if (iStartY < mStartY) - mStartY = iStartY; - - } else { - - if (iStartY < mStartY) { - // use the new top - if (iStartY + iHeight > mStartY + mHeight) { - // and the new height - mStartY = iStartY; - mHeight = iHeight; - - } else { - // but the old height - mHeight += mStartY - iStartY; - mStartY = iStartY; - - } - - } else { - // use the old top - if (iStartY + iHeight > mStartY + mHeight) { - // but use the new height - mHeight = iStartY + iHeight - mStartY; - - } - - } - } -} - - -AEEventHandlerUPP HTMLInlineTSMProxy::sAEHandler = NewAEEventHandlerProc( AEHandlerTSM ); -// HTMLInlineTSMProxy *HTMLInlineTSMProxy::sCurrentProxy = NULL; - - -#if _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ -void HTMLInlineTSMProxy::PasteFromPtr(const Ptr thedata, int32 len, short hiliteStyle, INTL_Encoding_ID datacsid) -{ - if (len < 1) - return; - - EDT_CharacterData *pData = EDT_NewCharacterData(); - if (pData) { - pData->mask = TF_INLINEINPUT | TF_INLINEINPUTTHICK | TF_INLINEINPUTDOTTED; - - switch (hiliteStyle) { - case kCaretPosition: - pData->values = TF_INLINEINPUT | TF_INLINEINPUTTHICK; // this is just a guess actually: FIX ME!! - break; - - case kRawText: - pData->values = 0; - break; - - case kSelectedRawText: - pData->values = TF_INLINEINPUT | TF_INLINEINPUTTHICK | TF_INLINEINPUTDOTTED; - break; - - default: - XP_ASSERT(false); - case kConvertedText: - pData->values = TF_INLINEINPUT; - break; - - case kSelectedConvertedText: - pData->values = TF_INLINEINPUT | TF_INLINEINPUTTHICK; - break; - } - - EDT_SetCharacterData( mContext ,pData ); - EDT_FreeCharacterData(pData); - } - - // HACK HACK HACK - // ok, so everyone has been really helpful and all but I'm going to put this in as a hack - // rather than try to do it "right": unicodeString will either be "thedata" or the result - // if we need to do unicode conversion. We'll free this below if the pointer address has changed - char *unicodeString = thedata; - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(mContext); - int16 win_csid = INTL_GetCSIWinCSID(csi); - XP_ASSERT( CS_UTF7 != win_csid ); - if(( (win_csid == CS_UTF8) ) && - ( win_csid != datacsid )) - - { - unicodeString = (char *)INTL_ConvertLineWithoutAutoDetect( datacsid, win_csid, (unsigned char *)thedata, len ); - len = strlen(unicodeString); - - } - - if (len < 16) { // can we use a small static buffer? - - char smallbuffer[16]; - XP_MEMCPY(smallbuffer, unicodeString, len); - smallbuffer[len] = '\0'; - EDT_InsertText(mContext, smallbuffer); - - } else { - - char *verytemp = (char *) XP_ALLOC(len + 1); - if (verytemp) { - XP_MEMCPY(verytemp, unicodeString, len); - verytemp[len] = '\0'; - EDT_InsertText(mContext, verytemp); - XP_FREE(verytemp); - } - - } - - // see hack alert above - if ( unicodeString != thedata ) - XP_FREEIF(unicodeString); - -} -#endif _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ - -HTMLInlineTSMProxy::HTMLInlineTSMProxy( CEditView &inTextView ) - - : mTextView( inTextView ) - - { - - mTSMDocID = 0; - - OSType supportedType = kTextService; - OSErr err = ::NewTSMDocument( 1, &supportedType, &mTSMDocID, (long)(void *)this ); - ThrowIfOSErr_(err); - mInputHoleActive = false; - mDocActive = false; - - } - - -HTMLInlineTSMProxy::~HTMLInlineTSMProxy() - { - - if ( mDocActive ) - Deactivate(); // for a bug in TSM. See TE27 - - OSErr err = noErr; - - if ( mTSMDocID ) - err = ::DeleteTSMDocument(mTSMDocID); - - mTSMDocID = 0; - // Assert_(err == noErr); - - } - - -void -HTMLInlineTSMProxy::Activate( void ) - { - - OSErr err = noErr; - - Assert_( mDocActive == false ); - - InstallTSMHandlers(); - -// sCurrentProxy = this; - - #ifdef Debug_Signal - // check to see if a bug in TSM will be encountered - ProcessSerialNumber psn, - csn; - err = GetCurrentProcess(&psn); -// ThrowIfOSErr_(err); - err = GetFrontProcess(&csn); -// ThrowIfOSErr_(err); - Assert_((psn.highLongOfPSN == csn.highLongOfPSN) && (psn.lowLongOfPSN == csn.lowLongOfPSN)); - #endif - - if ( mTSMDocID ) - err = ::ActivateTSMDocument( mTSMDocID ); - else - err = ::UseInputWindow(NULL, true); -// ThrowIfOSErr_(err); - - if ( err == noErr ) - mDocActive = true; - - } - - -void -HTMLInlineTSMProxy::Deactivate( void ) - { - - OSErr err = noErr; - - Assert_( mDocActive ); - - RemoveTSMHandlers(); - -// sCurrentProxy = NULL; - - err = ::DeactivateTSMDocument( mTSMDocID ); - - if (err != tsmDocNotActiveErr) // this just seems to happen too much -- it is okay if it happens - { - - Assert_( err == noErr ); - - } - - mDocActive = false; - - } - - -void -HTMLInlineTSMProxy::FlushInput( void ) - { - - OSErr err = noErr; - - Assert_( mTSMDocID != 0 ); - - if ( mTSMDocID != 0 ) - { - - err = ::FixTSMDocument( mTSMDocID ); - - } - - } - - -void -HTMLInlineTSMProxy::InstallTSMHandlers( void ) - { - - OSErr err = noErr; - - err = ::AEInstallEventHandler(kTextServiceClass, kUpdateActiveInputArea, sAEHandler, kUpdateActiveInputArea, false); - ThrowIfOSErr_(err); - err = ::AEInstallEventHandler(kTextServiceClass, kPos2Offset, sAEHandler, kPos2Offset, false); - ThrowIfOSErr_(err); - err = ::AEInstallEventHandler(kTextServiceClass, kOffset2Pos, sAEHandler, kOffset2Pos, false); - ThrowIfOSErr_(err); - - } - - -void -HTMLInlineTSMProxy::RemoveTSMHandlers( void ) - { - - OSErr err = noErr; - - err = ::AERemoveEventHandler(kTextServiceClass, kUpdateActiveInputArea, sAEHandler, false); - ThrowIfOSErr_(err); - err = ::AERemoveEventHandler(kTextServiceClass, kPos2Offset, sAEHandler, false); - ThrowIfOSErr_(err); - err = ::AERemoveEventHandler(kTextServiceClass, kOffset2Pos, sAEHandler, false); - ThrowIfOSErr_(err); - - } - - -pascal OSErr -HTMLInlineTSMProxy::AEHandlerTSM( const AppleEvent *inAppleEvent, AppleEvent *outReply, Int32 inRefCon ) - { - // XP_Trace("begin HTMLInlineTSMProxy::AEHandlerTSM\n"); - OSErr err = noErr; - - THz oldZone = ::LMGetTheZone(), // Apple bug #115424? - appZone = ::LMGetApplZone(); - ::LMSetTheZone(appZone); - -#if _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ - try - { - - Assert_( sCurrentProxy != NULL ); - - StHandleLocker lock(inAppleEvent->dataHandle); - AESubDesc appleEvent; - AEDescToSubDesc(inAppleEvent, &appleEvent); - - AESubDesc keySubDesc; - AEGetKeySubDesc( &appleEvent, keyAETSMDocumentRefcon, &keySubDesc ); - long len; - Int32 *tsmdocrefcon = (Int32*)AEGetSubDescData( &keySubDesc, &len ); - ThrowIf_(NULL == tsmdocrefcon); - - // XP_Trace("try to get keyAETSMDocumentRefcon\n"); - - HTMLInlineTSMProxy *proxy = (HTMLInlineTSMProxy *)(*tsmdocrefcon); - - AEStream replyStream; - err = AEStream_Open( &replyStream); - - err = AEStream_OpenRecord( &replyStream, typeAERecord ); - - if ( proxy != NULL ) - { - - switch( inRefCon ) - { - - case kUpdateActiveInputArea: - - // XP_Trace("kUpdateActiveInputArea\n"); - - proxy->AEUpdate(appleEvent); - - - break; - - case kPos2Offset: - XP_Trace("kPos2Offset\n"); - - proxy->AEPos2Offset(appleEvent, replyStream); - - break; - - case kOffset2Pos: - XP_Trace("kOffset2Pos\n"); - - proxy->AEOffset2Pos(appleEvent, replyStream); - - break; - - default: - XP_Trace("AppleEvent %c%c%c%c \n", (char)(inRefCon >> 24), (char)((inRefCon >> 16) & 0xff), (char)((inRefCon >> 8) & 0xff), (char)(inRefCon & 0xff) ); - Assert_(0); - break; - } - - } - // XP_Trace("AEStream_CloseRecord\n"); - - err = AEStream_CloseRecord( &replyStream ); - - // Transfer reply parameters to the real reply (hopefully MacOS 8 will have a way around this) - // ie, can simply say: - // - // replyStream.Close(outReply); - // - StAEDescriptor reply; - // XP_Trace("AEStream_Close\n"); - - err = AEStream_Close( &replyStream, reply ); - AESubDesc replySD; - AEDescToSubDesc(reply, &replySD); - AEKeyword key; - - int32 upperBound = AECountSubDescItems( &replySD ); - for (long i = 1; i <= upperBound; i++) { - StAEDescriptor parm; - AESubDesc nthSubDesc; - err = AEGetNthSubDesc( &replySD, i, &key, &nthSubDesc ); - err = AESubDescToDesc( &nthSubDesc, typeWildCard, &parm.mDesc ); -// replySD.NthItem(i, &key).ToDesc(&parm.mDesc); - err = ::AEPutParamDesc(outReply, key, &parm.mDesc); - ThrowIfOSErr_(err); - } - - } - - catch ( ExceptionCode inErr ) - { - - err = inErr; - - } - - catch ( ... ) - { - - err = paramErr; - - } -#endif _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ - - ::LMSetTheZone(oldZone); // Apple bug #115424? - // XP_Trace ("end HTMLInlineTSMProxy::AEHandlerTSM\n"); - - return err; - - } - - -#if _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ -void HTMLInlineTSMProxy::AEUpdate( - const AESubDesc &inAppleEvent ) -{ - OSErr err; - CEditView::OutOfFocus(&mTextView); - - HoldUpdatesProxy stopUpdatesProxy(mTextView); - - // if we don't already have an input hole, remember where we are - if (!mInputHoleActive) { - mInputHoleActive = true; - mInputHoleStart = EDT_GetInsertPointOffset(mContext); - mInputHoleLen = 0; - } - - - AESubDesc keySubDesc; - long textlen; - long dummylen; - - // Get keyAETheData - err = AEGetKeySubDesc( &inAppleEvent, keyAETheData, &keySubDesc ); - ThrowIfOSErr_(err); - Ptr thedata = (char *) AEGetSubDescData( &keySubDesc, &textlen ); - - // Get keyAEFixLength - err = AEGetKeySubDesc( &inAppleEvent, keyAEFixLength, &keySubDesc ); - ThrowIfOSErr_(err); - Int32 fixLength = *(Int32 *) AEGetSubDescData( &keySubDesc, &dummylen ); - if (fixLength < 0) // special signal to fix it all!! - fixLength = textlen; - - // Get keyAEScriptTag - err = AEGetKeySubDesc( &inAppleEvent, keyAETSMScriptTag, &keySubDesc ); - ThrowIfOSErr_(err); - ScriptLanguageRecord *sl = (ScriptLanguageRecord *) AEGetSubDescData( &keySubDesc, &dummylen ); - INTL_Encoding_ID datacsid = ScriptToEncoding( sl->fScript ); - - - // Currently do not depend on it. - - // Get [optional] keyAEUpdateRange - - // Currently do not depend on it. - - - // Get [optional] keyAEPinRange - - // Currently do not depend on it. - - - // Get [optional] keyAEClauseOffsets - - // Currently do not depend on it. - - - - mTextView.EraseCaret(); - mTextView.HideCaret(true); - - // if we do already have an input hole, select all the text and delete so that we start fresh - if (mInputHoleLen) { - - EDT_CharacterData *temp = EDT_GetCharacterData( mContext ); - - EDT_SetInsertPointToOffset(mContext, mInputHoleStart, mInputHoleLen); - EDT_DeletePreviousChar(mContext); - - if (temp) { - if (textlen) // if len == 0, then don't bother setting the character data because there is nothing left! - EDT_SetCharacterData( mContext, temp ); - EDT_FreeCharacterData( temp ); - } - } - - // we will handle this special case because it makes the algorithm easier to understand. - // the input hole is going away because we are going to fix everything... - if (fixLength == textlen) - { - PasteFromPtr(thedata, fixLength, kRawText, datacsid); - mInputHoleActive = false; - CEditView::OutOfFocus(&mTextView); - mTextView.HideCaret(false); - return; - } - - // we have already selected the old data, now paste in anything that needs to be fixed - if (fixLength) { - PasteFromPtr(thedata, fixLength, kRawText, datacsid); - mInputHoleStart = EDT_GetInsertPointOffset(mContext); // a new starting point for our input hole - } - - // Get [optional] keyAEHiliteRange - err = AEGetKeySubDesc( &inAppleEvent, keyAEHiliteRange, &keySubDesc ); - XP_ASSERT( keySubDesc != NULL && err == noErr ); - - if ( err == noErr) { -// if (inAppleEvent.KeyExists(keyAEHiliteRange)) { -// AESubDesc hiliteSD( hiliteRangeSubDesc, typeTextRangeArray ); -// TextRangeArrayPtr p = (TextRangeArrayPtr)hiliteSD.GetDataPtr(); - TextRangeArrayPtr p = (TextRangeArrayPtr)AEGetSubDescData( &keySubDesc, &dummylen ); - for (Int32 i = 0; i < p->fNumOfRanges; i++) { - - TextRange record; - // we don't care about any extra information which is supposed to be encoded in the sign of any of these numbers - record.fStart = abs(p->fRange[i].fStart); - record.fEnd = abs(p->fRange[i].fEnd); - record.fHiliteStyle = abs(p->fRange[i].fHiliteStyle); - - PasteFromPtr(thedata + fixLength + record.fStart, record.fEnd - record.fStart, record.fHiliteStyle, datacsid); - } - } - - mInputHoleLen = EDT_GetInsertPointOffset(mContext) - mInputHoleStart; // a new length for our input hole - - - // output - mTextView.HideCaret(false); - CEditView::OutOfFocus(&mTextView); -} - -// so which is it? -#define keyAELeadingEdge keyAELeftSide - -void HTMLInlineTSMProxy::AEPos2Offset( - const AESubDesc &inAppleEvent, - AEStream &inStream) const -{ - // input - Point* pWhere; - Point where; - Boolean dragging; - long len; - OSErr err; - - AESubDesc subdesc; - err = AEGetKeySubDesc( &inAppleEvent, keyAECurrentPoint, &subdesc ); - pWhere = (Point *)AEGetSubDescData( &subdesc, &len ); - where.h = pWhere->h; - where.v = pWhere->v; -// inAppleEvent.KeyedItem(keyAECurrentPoint).ToPtr(typeQDPoint, &where, sizeof(where)); - - - err = AEGetKeySubDesc( &inAppleEvent, keyAEDragging, &subdesc ); - if ( AEGetSubDescType( &subdesc ) != typeNull ) - dragging = *(Boolean *)AEGetSubDescData( &subdesc, &len ); - else - dragging = false; - -// AESubDesc sd = inAppleEvent.KeyedItem(keyAEDragging); -// if (sd.GetType() != typeNull) // keyAEdragging is optional -// dragging = sd.ToBoolean(); - - // process - CEditView::OutOfFocus(&mTextView); - mTextView.FocusDraw(); // for GlobalToLocal - ::GlobalToLocal(&where); - CEditView::OutOfFocus(&mTextView); - SPoint32 where32; - mTextView.LocalToImagePoint(where, where32); - - LO_HitResult result; - LO_Hit(mContext, where32.h, where32.v, false, &result, nil); - - if (result.type != LO_HIT_ELEMENT || -// result.lo_hitElement.region != LO_HIT_ELEMENT_REGION_MIDDLE || - result.lo_hitElement.position.element->type != LO_TEXT) { - - err = AEStream_WriteKey( &inStream, keyAEOffset ); -// inStream.WriteKey(keyAEOffset); - Int32 offset = -1; - - err = AEStream_WriteDesc( &inStream, typeLongInteger, &offset, sizeof(offset) ); -// inStream.WriteDesc(typeLongInteger, &offset, sizeof(offset)); - - err = AEStream_WriteKey( &inStream, keyAERegionClass ); -// inStream.WriteKey(keyAERegionClass); - short aShort = kTSMOutsideOfBody; - err = AEStream_WriteDesc( &inStream, typeShortInteger, &aShort, sizeof(aShort) ); -// inStream.WriteDesc(typeShortInteger, &aShort, sizeof(aShort)); - - return; - } - - ED_BufferOffset newPosition = EDT_LayoutElementToOffset( mContext, result.lo_hitElement.position.element, result.lo_hitElement.position.position); - -/* - ED_BufferOffset saveSelStart, saveSelEnd; - EDT_GetSelectionOffsets(mContext, &saveSelStart, &saveSelEnd); // remember position - - EDT_PositionCaret(mContext, where32.h, where32.v ); - ED_BufferOffset newPosition = EDT_GetInsertPointOffset(mContext); - - EDT_SetInsertPointToOffset(mContext, saveSelStart, saveSelEnd - saveSelStart); // restore position -*/ - - // restrict to the active range if you are dragging - if (dragging) { - if (newPosition < mInputHoleStart) newPosition = mInputHoleStart; - if (newPosition > mInputHoleStart + mInputHoleLen) newPosition = mInputHoleStart + mInputHoleLen; - } - - // output - err = AEStream_WriteKey( &inStream, keyAEOffset ); -// inStream.WriteKey(keyAEOffset); - Int32 offset = newPosition; - offset -= mInputHoleStart; - err = AEStream_WriteDesc( &inStream, typeLongInteger, &offset, sizeof(offset) ); -// inStream.WriteDesc(typeLongInteger, &offset, sizeof(offset)); - - err = AEStream_WriteKey( &inStream, keyAERegionClass ); -// inStream.WriteKey(keyAERegionClass); - short aShort = kTSMOutsideOfBody; - - SDimension32 sizeImage; - SDimension16 sizeFrame; - mTextView.GetImageSize(sizeImage); - mTextView.GetFrameSize(sizeFrame); - - if ((0 <= where32.h) && (where32.h < sizeFrame.width) && (0 <= where32.v) && (where.v < sizeImage.height)) - { - if (offset >= 0 && offset <= mInputHoleLen) - aShort = kTSMInsideOfActiveInputArea; - else - aShort = kTSMInsideOfBody; - } - - err = AEStream_WriteDesc( &inStream, typeShortInteger, &aShort, sizeof(aShort) ); -// inStream.WriteDesc(typeShortInteger, &aShort, sizeof(aShort)); -} - - -void HTMLInlineTSMProxy::AEOffset2Pos( - const AESubDesc &inAppleEvent, - AEStream &inStream) const -{ - OSErr err; - // input - AESubDesc subdesc; - err = AEGetKeySubDesc( &inAppleEvent, keyAEOffset, &subdesc ); - long len; - Int32 offset = *(Int32 *)AEGetSubDescData( &subdesc, &len ); - offset += mInputHoleStart; - - LO_Element * element; - int32 caretPos; - EDT_OffsetToLayoutElement(mContext, offset, &element, &caretPos); - - SPoint32 where32; - int32 veryTemp; - GetCaretPosition( mContext, element, caretPos, &where32.h, &veryTemp, &where32.v ); - - Point where; - mTextView.ImageToLocalPoint(where32, where); - CEditView::OutOfFocus(&mTextView); - mTextView.FocusDraw(); // for LocalToGlobal - ::LocalToGlobal(&where); - - // output - err = AEStream_WriteKey( &inStream, keyAEPoint ); - err = AEStream_WriteDesc( &inStream, typeQDPoint, &where, sizeof(where) ); -// inStream.WriteKey(keyAEPoint); -// inStream.WriteDesc(typeQDPoint, &where, sizeof(where)); -} -#endif _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ diff --git a/mozilla/cmd/macfe/central/TSMProxy.h b/mozilla/cmd/macfe/central/TSMProxy.h deleted file mode 100644 index fd4dfe0ef47..00000000000 --- a/mozilla/cmd/macfe/central/TSMProxy.h +++ /dev/null @@ -1,92 +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. - */ - -#include "CEditView.h" -#define _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ 1 -#include -#include -#include "libi18n.h" - - -class HoldUpdatesProxy - { - - public: - - HoldUpdatesProxy( CEditView &inTextView ); - ~HoldUpdatesProxy(); - - void DocumentChanged( int32 iStartY, int32 iHeight ); - - protected: - - CEditView &mTextView; - int32 mStartY; - int32 mHeight; - - }; - - -class HTMLInlineTSMProxy //: public VTSMProxy - { - // friend class WTSMManager; - - public: - HTMLInlineTSMProxy( CEditView &inTextView ); - ~HTMLInlineTSMProxy(); - - void SetContext( MWContext *inContext ) - { - mContext = inContext; - }; - - virtual void Activate(void); - virtual void Deactivate(void); - virtual void FlushInput(void); - virtual void InstallTSMHandlers(void); - virtual void RemoveTSMHandlers(void); - - static - pascal OSErr AEHandlerTSM( const AppleEvent *inAppleEvent, AppleEvent *outReply, Int32 inRefCon ); - - protected: -#if _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ - virtual void AEUpdate( const AESubDesc &inAppleEvent ); - - virtual void AEPos2Offset( const AESubDesc &inAppleEvent, AEStream &inStream ) const; - - virtual void AEOffset2Pos( const AESubDesc &inAppleEvent, AEStream &inStream ) const; - - void PasteFromPtr( const Ptr thedata, int32 len, short hiliteStyle , INTL_Encoding_ID datacsid ); -#endif _HAVE_FIXES_FOR_REPLACING_AEGIZMOS_ - - int mInputHoleActive; - ED_BufferOffset mInputHoleStart; // since we have this... - int32 mInputHoleLen; // and this. - - CEditView &mTextView; - MWContext *mContext; - TSMDocumentID mTSMDocID; - - Boolean mDocActive; - - static AEEventHandlerUPP sAEHandler; - // static HTMLInlineTSMProxy *sCurrentProxy; - - }; - diff --git a/mozilla/cmd/macfe/central/UFormElementFactory.cp b/mozilla/cmd/macfe/central/UFormElementFactory.cp deleted file mode 100644 index 0f9c62cdeb0..00000000000 --- a/mozilla/cmd/macfe/central/UFormElementFactory.cp +++ /dev/null @@ -1,2168 +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. - */ - -// UFormElementFactory.cp - -#include "UFormElementFactory.h" - -// PowerPlant -#include -#include -#include -#include -//#include -//#include -//#include - -// MacFE -#include "CHTMLView.h" -#include "CBrowserContext.h" -#include "CEditorWindow.h" -#include "CURLDispatcher.h" -#include "resgui.h" -#include "uprefd.h" -#include "mforms.h" -#include -#include "CHyperScroller.h" -#include "macgui.h" -#include "macutil.h" -#include "ufilemgr.h" -#include "uintl.h" -#include "CAutoPtr.h" - -// Backend -#include "ntypes.h" -#include "lo_ele.h" // for struct def'n -#include "xlate.h" -#include "fe_proto.h" -#include "prefapi.h" -#include "edt.h" -#ifdef MOZ_ENDER_MIME -#include "mhtmlstm.h" -#endif /*MOZ_ENDER_MIME*/ - -// macros -#define FEDATAPANE ((FormFEData *)formElem->element_data->ele_minimal.FE_Data)->fPane -#define FEDATAHOST ((FormFEData *)formElem->element_data->ele_minimal.FE_Data)->fHost -// These defines add extra spacing to the controls. -// The spacing is needed because the layout puts them too close otherwise -#define buttonTopExtra 1 -#define buttomLeftExtra 1 -#define buttonRightExtra 1 -#define buttonBottomExtra 1 - -#define textTopExtra 1 -#define textLeftExtra 1 -#define textRightExtra 1 -#define textBottomExtra 1 - -void FE_FreeFormElement( - MWContext* /* inContext */, - LO_FormElementData * inFormData) -{ - UFormElementFactory::FreeFormElement(inFormData); -} - - -// prototypes -static Boolean HasFormWidget(LO_FormElementStruct *formElem); - -// utilities -inline FormFEData *GetFEData(LO_FormElementStruct *formElem) { return ((FormFEData *)formElem->element_data->ele_minimal.FE_Data); } -inline LPane *GetFEDataPane( LO_FormElementStruct *formElem) { return FEDATAPANE; } - -// Sets the value of FE_Data structure in form element -// Returns true if form is being created from scratch -// or if we are printing. The return value is used to -// determine whether the form element should be initialized -// to default values, or from the layout data. If printing, -// we want the latter -static Boolean InitFE_Data( - MWContext *context, - LO_FormElementStruct* formElem, - LPane* pane, - LFormElement *host, - LCommander *commander) -{ - if (!formElem->element_data) - return false; - FormFEData *feData; - Boolean noFEData = ( formElem->element_data->ele_minimal.FE_Data == NULL ); - - if ( noFEData ) - { - FormFEData* feData = new FormFEData; - ThrowIfNil_( feData ); - formElem->element_data->ele_minimal.FE_Data = feData; - } - - feData = (FormFEData *)formElem->element_data->ele_minimal.FE_Data; - feData->fPane = pane; - feData->fHost = host; - feData->fCommander = commander; - - Assert_(host); - if (host) - host->SetFEData(feData); - - if (context->type == MWContextPrint) - return false; // force the form elements to use data from layout - - return noFEData; -} - -static Boolean HasFormWidget( - LO_FormElementStruct *formElem) -{ - return ((formElem->element_data->ele_minimal.FE_Data != NULL) && - (FEDATAPANE != NULL)); -} - -/****************************************************************************** - * CWhiteScroller - * White background instead of gray 'wscr' - ******************************************************************************/ -class CWhiteScroller: public LScrollerView -{ -public: - //friend class CHyperView; // this class no longer exists - - enum { class_ID = 'wscr' }; - - CWhiteScroller( LStream* inStream ); - virtual Boolean FocusDraw(LPane* inSubPane = nil); - virtual void DrawSelf(); -}; - -CWhiteScroller::CWhiteScroller(LStream *inStream) - : LScrollerView(inStream) -{ -} - -// The only real routine. Sets background to white -Boolean CWhiteScroller::FocusDraw(LPane* /*inSubPane*/) -{ - if (LScrollerView::FocusDraw()) - { - UGraphics::SetBack(CPrefs::White); - return TRUE; - } - else - { - return FALSE; - } -} - -void CWhiteScroller::DrawSelf() -{ - Rect frame; - if (CalcLocalFrameRect(frame) && IsVisible() && - mUpdateRgnH && ((*mUpdateRgnH)->rgnBBox.top != (*mUpdateRgnH)->rgnBBox.bottom)) // Only erase on update - ::EraseRect(&frame); - -// if ((mVerticalBar && mVerticalBar->IsVisible()) || (mHorizontalBar && mHorizontalBar->IsVisible())) -// ::EraseRect(&frame); - - LScrollerView::DrawSelf(); -} - -/********************************************************************* - * StModifyPPob - * Modifying PPob for dynamic change of the text resource ID when loading - * Constructor modifies the resource by sticking a resID at the appropriate - * offset. - * Destructor restores it. - * Offsets are generated by looking them up in Resourcerer - *********************************************************************/ -class StModifyPPob { - Int16 fResID; - Int16 fOffset; - Int16 fOldTextR; -public: - StModifyPPob(Int16 resID, // Resource of the PPob to be modified - Int16 offset, // Offset into the resource - Int16 csid, // Charset of the current doc - Boolean button); // Which TxtR are we looking for (TRUE = button, FALSE = text) - ~StModifyPPob(); -}; - -StModifyPPob::StModifyPPob(Int16 resID, Int16 offset, Int16 csid, Boolean button) -{ - fResID = resID; - fOffset = offset; - - Int16 newTextR; - if (button) - newTextR = CPrefs::GetButtonFontTextResIDs(csid); - else - newTextR = CPrefs::GetTextFieldTextResIDs(csid); - - Handle r = ::GetResource('PPob', fResID); - ThrowIfNil_(r); - HNoPurge(r); - // Modify the resource - StHandleLocker lock(r); - Int16 * myPointer = (Int16*)(*r + fOffset); - fOldTextR = *myPointer; - *myPointer = newTextR; -} - -StModifyPPob::~StModifyPPob() -{ - Handle r = ::GetResource('PPob', fResID); - StHandleLocker lock(r); - Int16 * myPointer = (Int16*)(*r + fOffset);; - *myPointer = fOldTextR; - HPurge(r); -} - -void UFormElementFactory::RegisterFormTypes() -{ - RegisterClass_( CFormButton); - RegisterClass_( CGAFormPushButton); - RegisterClass_( CFormList); - RegisterClass_( CFormLittleText); - RegisterClass_( CFormBigText); - RegisterClass_( CFormHTMLArea); - RegisterClass_( CNonPrintingView); - RegisterClass_( CFormRadio); - RegisterClass_( CGAFormRadio); - RegisterClass_( CFormCheckbox); - RegisterClass_( CGAFormCheckbox); - RegisterClass_( CFormFile); - RegisterClass_( CFormFileEditField); - RegisterClass_( CWhiteScroller); -} - -// -// Figures out what kind of form element we're dealing with and dispatches *that* -// -void UFormElementFactory::MakeFormElem( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - LO_FormElementStruct* formElem) -{ - if (!formElem->element_data) - return; - Try_ { - Int32 width; - Int32 height; - Int32 baseline; - - switch ( formElem->element_data->type ) - { - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: - MakeTextFormElem(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - case FORM_TYPE_READONLY: - MakeReadOnlyFormElem(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - - case FORM_TYPE_TEXTAREA: - MakeTextArea(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - -#ifdef ENDER - case FORM_TYPE_HTMLAREA: - MakeHTMLArea(inHTMLView, inNSContext, width, height, baseline, formElem); - break; -#endif /*ENDER*/ - - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: - MakeToggle(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_OBJECT: - width = height = baseline = 0; - break; - - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - MakeButton(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - - case FORM_TYPE_FILE: - MakeFilePicker(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - - case FORM_TYPE_SELECT_ONE: - MakePopup(inHTMLView, inNSContext, width, height, baseline,formElem); - break; - - case FORM_TYPE_SELECT_MULT: - MakeList(inHTMLView, inNSContext, width, height, baseline, formElem); - break; - - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - default: - Assert_(FALSE); - break; - }; - - formElem->width = width; - formElem->height = height; - formElem->baseline = baseline; - } - Catch_(inErr) - { - Assert_(FALSE); - } - EndCatch_ -} - -// Creates a simple edit text field -// textData->size is the number of characters -// textData->max_size is the maximum number of characters -// textData->default_text is the default text -LPane* UFormElementFactory::MakeTextFormElem( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, Int32 &height, Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - CFormLittleText * editField; - if (!HasFormWidget(formElem)) - { - // If we did not have a control, create one - lo_FormElementTextData * textData = (lo_FormElementTextData *) formElem->element_data; - LCommander::SetDefaultCommander(inHTMLView); // For tabbing - LPane::SetDefaultView(inHTMLView); - switch (textData->type) { - case FORM_TYPE_TEXT: - case FORM_TYPE_ISINDEX: - { - StModifyPPob modifier(formTextField, 0x3F, inNSContext->GetWinCSID(), false); - editField = (CFormLittleText *)UReanimator::ReadObjects('PPob', formTextField); - } - break; - case FORM_TYPE_PASSWORD: - editField = (CFormLittleText *)UReanimator::ReadObjects('PPob', formPasswordField); - break; - default: - Throw_(0); - } - ThrowIfNil_(editField); - - editField->InitFormElement(*inNSContext, formElem); - - editField->FinishCreate(); - editField->AddListener(inHTMLView); - if (textData->max_size < 0) - textData->max_size = 32000; - editField->SetMaxChars(textData->max_size); - editField->SetVisibleChars(textData->size); - editField->SetLayoutForm(formElem); - // Should allow undo - LUndoer* theUndoer = new LUndoer; - editField->AddAttachment(theUndoer); - - // Reset the value - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext,formElem,editField,editField, editField)); - - // Secure fields are disabled - } - else - { - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - editField = (CFormLittleText *)FEDATAPANE; - if (!editField) - return NULL; - editField->SetLayoutForm(formElem); // CWhiteEdit field only (never uses it...) - editField->SetLayoutElement(formElem); // mocha mix-in needs to know too... - } - -// Figure out dimensions - SDimension16 size; - editField->GetFrameSize(size); - width = size.width + textLeftExtra + textRightExtra; - height = size.height + textTopExtra + textBottomExtra;; - TEHandle textH = editField->GetMacTEH(); - baseline = (*textH)->fontAscent + 2 + textTopExtra; - return editField; -} - -// Very similar to MakeTextFormElem, for now -LPane * UFormElementFactory::MakeReadOnlyFormElem( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - CFormLittleText * editField; - if (!HasFormWidget(formElem)) - { - // If we did not have a control, create one - lo_FormElementMinimalData * readData = (lo_FormElementMinimalData *) formElem->element_data; - LCommander::SetDefaultCommander(inHTMLView); // For tabbing - LPane::SetDefaultView(inHTMLView); - StModifyPPob modifier(formTextField, 0x3F, inNSContext->GetWinCSID(), false); - editField = (CFormLittleText *)UReanimator::ReadObjects('PPob', formTextField); - ThrowIfNil_(editField); - - editField->InitFormElement(*inNSContext, formElem); - editField->FinishCreate(); - editField->SetLayoutForm(formElem); - editField->Disable(); - - // Reset the value - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem,editField,editField, editField)); - char * newText; - PA_LOCK(newText, char* , readData->value); - editField->SetDescriptor(CStr255(newText)); - editField->SetVisibleChars(newText ? XP_STRLEN(newText) : 10); - PA_UNLOCK(readData->value); - - } - else - { - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - - editField = (CFormLittleText *)FEDATAPANE; - if (!editField) - return NULL; - editField->SetLayoutForm(formElem); - editField->SetLayoutElement(formElem); - } - - - -// Figure out dimensions - SDimension16 size; - editField->GetFrameSize(size); - width = size.width + textLeftExtra + textRightExtra; - height = size.height + textTopExtra + textBottomExtra;; - TEHandle textH = editField->GetMacTEH(); - baseline = (*textH)->fontAscent + 2 + textTopExtra; - return editField; -} - -#define BigTextLeftIndent 5 // same constants are in the forms.r -#define BigTextRightIndent 1 -#define BigTextTopIndent 1 -#define BigTextBottomIndent 1 -// Creates a text area -// textAreaData->default_text; -// textAreaData->rows; -// textAreaData->cols; -LPane* UFormElementFactory::MakeTextArea( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - LView * theView = NULL; - CFormBigText * theTextView = NULL; - FontInfo fontInfo; - if (!HasFormWidget(formElem)) // If there is no form, create it - { - lo_FormElementTextareaData * textAreaData = (lo_FormElementTextareaData *) formElem->element_data; - - // Create the view - LCommander::SetDefaultCommander(inHTMLView); - LView::SetDefaultView(inHTMLView); - - // since I can't find an API to switch the word wrap property after the element - // has been initialized, we need to create two separate PPob's. Read in the - // appropriate one depending on if the text area requires wrapping or not. - ResIDT elementToRead = 0; - switch(textAreaData->auto_wrap) { - case TEXTAREA_WRAP_SOFT: - case TEXTAREA_WRAP_HARD: - elementToRead = formBigText; - break; - - case TEXTAREA_WRAP_OFF: - elementToRead = formBigTextScroll; - break; - - } // case of wrap property - - theView = (LView *)UReanimator::ReadObjects('PPob', elementToRead); - ThrowIfNil_(theView); - theView->FinishCreate(); - theView->PutInside(inHTMLView); - - theTextView = (CFormBigText*)theView->FindPaneByID(formBigTextID); - Assert_(theTextView != NULL); - - LModelObject* theSuper = inHTMLView->GetFormElemBaseModel(); - theTextView->InitFormElement(*inNSContext, formElem); - - // Add the undoer for text actions. This will be on a per-text field basis - // Let WASTE handle undo - // LUndoer* theUndoer = new LUndoer; - // theTextView->AddAttachment(theUndoer); - - // Resize to proper size - theTextView->FocusDraw(); -// UTextTraits::SetPortTextTraits( theTextView->GetTextTraits() ); - - // Always use generic application font for form sizing measurements - short wantedWidth; - short wantedHeight; - do - { - StTextState textState; - ::TextFont(applFont); - ::TextSize(12); - ::TextFace(0); - ::GetFontInfo(&fontInfo); - wantedWidth = textAreaData->cols * ::CharWidth('M') + 8; // M is better than space - wantedHeight = textAreaData->rows * (fontInfo.ascent + fontInfo.descent + fontInfo.leading) + 8; - } while (0); - - - // make the image big so there is something to scroll, if necessary.... - if ( textAreaData->auto_wrap == TEXTAREA_WRAP_OFF ) - theTextView->ResizeImageTo(2000, 0, false); - - theView->ResizeFrameTo(wantedWidth + 16 + BigTextLeftIndent + BigTextRightIndent, - wantedHeight + 16 + BigTextTopIndent + BigTextBottomIndent, - FALSE); - - // Set the default values. - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem, theView, theTextView, theTextView)); - - theView->Show(); - } - else - { - theView = (LView*)FEDATAPANE; - if (!theView) - return NULL; - theTextView = (CFormBigText*)theView->FindPaneByID(formBigTextID); - theTextView->FocusDraw(); - - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - theTextView->SetLayoutElement(formElem); - ::GetFontInfo(&fontInfo); - } - - SDimension16 size; - theView->GetFrameSize(size); - width = size.width + textLeftExtra + textRightExtra;; - height = size.height + textTopExtra + textBottomExtra;; - baseline = fontInfo.ascent + 2; - - return theView; -} - -// Creates an HTML area -// htmlAreaData->default_text; -// htmlAreaData->rows; -// htmlAreaData->cols; -LPane* UFormElementFactory::MakeHTMLArea( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - LView *theView = NULL; - CFormHTMLArea *theHTMLAreaView = NULL; - FontInfo fontInfo; - if (!HasFormWidget(formElem)) // If there is no form, create it - { - lo_FormElementTextareaData * htmlAreaData = (lo_FormElementTextareaData *) formElem->element_data; - - // Create the view - LCommander::SetDefaultCommander(inHTMLView); - LView::SetDefaultView(inHTMLView); - - theView = (LView *)UReanimator::ReadObjects('PPob', formHTMLArea); - ThrowIfNil_(theView); - theView->FinishCreate(); - theView->PutInside(inHTMLView); - - theHTMLAreaView = (CFormHTMLArea*)theView->FindPaneByID(formHTMLAreaID); - ThrowIfNil_(theHTMLAreaView); - - URL_Struct* url = 0; - url = NET_CreateURLStruct ("about:editfilenew", NET_NORMAL_RELOAD ); - - CBrowserContext *nscontext = new CBrowserContext(); - ThrowIfNil_(nscontext); - theHTMLAreaView->SetContext(nscontext); - - MWContext *context = *nscontext; - context->is_editor = true; - - CURLDispatcher::DispatchURL( url, nscontext, false, false, CEditorWindow::res_ID ); - - LModelObject* theSuper = inHTMLView->GetFormElemBaseModel(); - theHTMLAreaView->InitFormElement(*inNSContext, formElem); - - // Resize to proper size - theHTMLAreaView->FocusDraw(); - - // Always use generic application font for form sizing measurements - short wantedWidth; - short wantedHeight; - do - { - StTextState textState; - ::TextFont(applFont); - ::TextSize(12); - ::TextFace(0); - ::GetFontInfo(&fontInfo); - wantedWidth = htmlAreaData->cols * ::CharWidth('M') + 8; - wantedHeight = htmlAreaData->rows * (fontInfo.ascent + fontInfo.descent + fontInfo.leading) + 8; - } while (0); - - theView->ResizeFrameTo(wantedWidth + 16 + BigTextLeftIndent + BigTextRightIndent, - wantedHeight + 16 + BigTextTopIndent + BigTextBottomIndent, - FALSE); - - // Set the default values. - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem, theView, theHTMLAreaView, theHTMLAreaView)); - EDT_SetEmbeddedEditorData(context, (void*)htmlAreaData); - - theView->Show(); - } - else - { - theView = (LView*)FEDATAPANE; - if (!theView) - return NULL; - theHTMLAreaView = (CFormHTMLArea*)theView->FindPaneByID(formHTMLAreaID); - theHTMLAreaView->FocusDraw(); - - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - theHTMLAreaView->SetLayoutElement(formElem); - } - - SDimension16 size; - theView->GetFrameSize(size); - width = size.width + textLeftExtra + textRightExtra;; - height = size.height + textTopExtra + textBottomExtra;; - baseline = fontInfo.ascent + 2; - - return theView; -} - -// Creates a button -// buttonData->name; is buttons name -// Buttons store the form element as the refCon, so that they can broadcast -// to the window. -LPane* UFormElementFactory::MakeButton( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - LControl* theControl = nil; - LPane* thePane = nil; - LFormElement* theHost = nil; - lo_FormElementMinimalData * buttonData= (lo_FormElementMinimalData *)formElem->element_data; - FontInfo info; - - if (!HasFormWidget(formElem)) - { - // FIX ME? - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(inHTMLView->GetMacPort())); - LPane::SetDefaultView(inHTMLView); - switch (buttonData->type) { - case FORM_TYPE_SUBMIT: - { - XP_Bool useGrayscaleFormControls; - int prefResult = PREF_GetBoolPref("browser.mac.use_grayscale_form_controls", &useGrayscaleFormControls); - - if (prefResult == PREF_NOERROR && useGrayscaleFormControls) - { - StModifyPPob modifier(formGASubmitButton, 0x46, inNSContext->GetWinCSID(), TRUE); - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formGASubmitButton)); - } - else - { - StModifyPPob modifier(formSubmitButton, 0x46, inNSContext->GetWinCSID(), TRUE); - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formSubmitButton)); - } - } - break; - case FORM_TYPE_RESET: - { - XP_Bool useGrayscaleFormControls; - int prefResult = PREF_GetBoolPref("browser.mac.use_grayscale_form_controls", &useGrayscaleFormControls); - - if (prefResult == PREF_NOERROR && useGrayscaleFormControls) - { - StModifyPPob modifier(formGAResetButton, 0x46, inNSContext->GetWinCSID(), TRUE); - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formGAResetButton)); - } - else - { - StModifyPPob modifier(formResetButton, 0x46, inNSContext->GetWinCSID(), TRUE); - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formResetButton)); - } - } - break; - case FORM_TYPE_BUTTON: - { - XP_Bool useGrayscaleFormControls; - int prefResult = PREF_GetBoolPref("browser.mac.use_grayscale_form_controls", &useGrayscaleFormControls); - - if (prefResult == PREF_NOERROR && useGrayscaleFormControls) - { - StModifyPPob modifier(formGAPlainButton, 0x46, inNSContext->GetWinCSID(), TRUE); - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formGAPlainButton)); - } - else - { - StModifyPPob modifier(formPlainButton, 0x46, inNSContext->GetWinCSID(), TRUE); - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formPlainButton)); - } - } - break; - default: - Throw_(0); - } - - ThrowIfNil_(theHost = dynamic_cast(thePane)); - ThrowIfNil_(theControl = dynamic_cast(thePane)); - - thePane->FinishCreate(); - theHost->InitFormElement(*inNSContext, formElem); - - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem,thePane,theHost, NULL)); - // Set up buttons as broadcasters. Store the LO_FormElementStruct * in refCon - theControl->AddListener(inHTMLView); - } - else - { - thePane = FEDATAPANE; - ThrowIfNil_(theHost = dynamic_cast(thePane)); - ThrowIfNil_(theControl = dynamic_cast(thePane)); - - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - theHost->SetLayoutElement(formElem); - } - - thePane->SetUserCon((long)formElem); // Always do this - - char * name; - PA_LOCK(name, char*, buttonData->value); - CStr255 pName(name); - thePane->SetDescriptor(pName); - PA_UNLOCK(buttonData->value); - ::GetFontInfo(&info); - -// Get width/height/baseline - SDimension16 size; - thePane->GetFrameSize(size); - width = size.width + buttomLeftExtra + buttonRightExtra; - height = size.height + buttonTopExtra + buttonBottomExtra; - baseline = info.ascent + 2 + buttonTopExtra; - return thePane; -} - -LPane* UFormElementFactory::MakeFilePicker( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - CFormFile * filePicker = NULL; - lo_FormElementTextData * pickerData= (lo_FormElementTextData *)formElem->element_data; - - if (!HasFormWidget(formElem)) - { - // FIX ME? - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(inHTMLView->GetMacPort())); - LPane::SetDefaultView(inHTMLView); - filePicker = (CFormFile *)UReanimator::ReadObjects('PPob', formFilePicker); - ThrowIfNil_(filePicker); - - filePicker->InitFormElement(*inNSContext, formElem); - - filePicker->FinishCreate(); - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem,filePicker,filePicker, filePicker->fEditField)); - } - else - { - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - filePicker = (CFormFile *)FEDATAPANE; - if (!filePicker) - return NULL; - filePicker->SetLayoutElement(formElem); - } - - -/* - char * name; - PA_LOCK(name, char*, pickerData->default_text); - CStr255 pName(name); - filePicker->SetDescriptor(pName); - PA_UNLOCK(pickerData->default_text); - ::GetFontInfo(&info); -*/ - -// Get width/height/baseline - filePicker->GetFontInfo(width, height, baseline); - width = width + buttomLeftExtra + buttonRightExtra; - height = height + buttonTopExtra + buttonBottomExtra; - return filePicker; -} - -// Creates buttons/checkboxes -// Boolean toggleData->default_toggle is default on/off -LPane* UFormElementFactory::MakeToggle( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - - LControl* toggle = nil; - LPane* thePane; - LFormElement *host; - lo_FormElementToggleData * toggleData = (lo_FormElementToggleData *)formElem->element_data; - if (!HasFormWidget(formElem)) - { - // FIX ME? - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(inHTMLView->GetMacPort())); - LPane::SetDefaultView(inHTMLView); - switch (toggleData->type) - { - case FORM_TYPE_RADIO: - { - XP_Bool useGrayscaleFormControls; - int prefResult = PREF_GetBoolPref("browser.mac.use_grayscale_form_controls", &useGrayscaleFormControls); - - if (prefResult == PREF_NOERROR && useGrayscaleFormControls) - { - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formGARadio)); - } - else - { - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formRadio)); - } - } - break; - case FORM_TYPE_CHECKBOX: - { - XP_Bool useGrayscaleFormControls; - int prefResult = PREF_GetBoolPref("browser.mac.use_grayscale_form_controls", &useGrayscaleFormControls); - - if (prefResult == PREF_NOERROR && useGrayscaleFormControls) - { - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formGACheckbox)); - } - else - { - ThrowIfNil_(thePane = (LPane *)UReanimator::ReadObjects('PPob', formCheckbox)); - } - } - break; - default: - Throw_(0); - } - - ThrowIfNil_(host = dynamic_cast(thePane)); - ThrowIfNil_(toggle = dynamic_cast(thePane)); - - host->InitFormElement(*inNSContext, formElem); - - thePane->FinishCreate(); - thePane->Enable(); - - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem,toggle, host, NULL)); - - // Set up toggles as broadcasters. Store the LO_FormElementStruct * in refCon -// toggle->AddListener(this); - - } - else - { - LFormElement* formWidget; - - lo_FormElementToggleData* toggleData = (lo_FormElementToggleData *)formElem->element_data; - toggle = dynamic_cast(FEDATAPANE); - if (!toggle) - return NULL; - - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - if (toggleData->type == FORM_TYPE_RADIO) // fun with C++ casting - { - formWidget = dynamic_cast(toggle); - ThrowIfNil_(formWidget); - } - else if (toggleData->type == FORM_TYPE_CHECKBOX) - { - formWidget = dynamic_cast(toggle); - ThrowIfNil_(formWidget); - } - else - { - Assert_(false); - } - - formWidget->SetLayoutElement(formElem); - } - - toggle->SetUserCon((long)formElem); - - short extra; // extra space to be left after the control - switch (toggleData->type) { - case FORM_TYPE_RADIO: - extra = 3; - break; - case FORM_TYPE_CHECKBOX: - extra = 5; - break; - } -// width/height/baseline - SDimension16 size; - toggle->GetFrameSize(size); - width = size.width + extra; - height = size.height; - baseline = size.height - 2; - return toggle; -} - -LPane* UFormElementFactory::MakePopup ( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - if (!HasFormWidget(formElem)) - { - lo_FormElementSelectData * selections = (lo_FormElementSelectData *)formElem->element_data; - // Create the popup - LCommander::SetDefaultCommander(inHTMLView); - LPane::SetDefaultView(inHTMLView); - - LPane* thePane = (LPane*)(UReanimator::ReadObjects ('PPob', formGAPopup)); - - CGAPopupMenu* popupCtrl = dynamic_cast(thePane); - ThrowIfNil_(popupCtrl); - - popupCtrl->SetTextTraits(CPrefs::GetButtonFontTextResIDs(inNSContext->GetWinCSID())); - - popupCtrl->FinishCreate(); - - // pointer from host widget to layout - popupCtrl->SetUserCon ((Int32)selections); - // tell popup what data to display - FormsPopup * popupText = new FormsPopup (popupCtrl, selections); - ThrowIfNil_(popupText); - - popupText->InitFormElement(*inNSContext, formElem); - - popupCtrl->AddAttachment (popupText); - // reset values - - ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem,popupCtrl,popupText, NULL)); // Reset the selection -#if 1 /* POPUP MENU VERTICAL POSITION FIX */ - FontInfo fontInfo; - GetFontInfo (&fontInfo); -#endif - // Resize the popup to max width - short widgetBaseline; - Point popupSize = popupText->CalcTargetFrame (widgetBaseline); - popupCtrl->ResizeFrameTo (popupSize.h, popupSize.v, false); - width = popupSize.h; - height = popupSize.v + 1; // add 1 for "leading" between lines in forms -#if 1 /* POPUP MENU VERTICAL POSITION FIX */ - baseline = fontInfo.ascent + 1; -#else - baseline = widgetBaseline; -#endif - - popupCtrl->Show(); - popupCtrl->Enable(); - - return popupCtrl; - } - else - { - LPane* widget = dynamic_cast(FEDATAPANE); - FormsPopup* popupText = dynamic_cast(FEDATAHOST); - SDimension16 size; - - ThrowIfNil_(widget); - ThrowIfNil_(popupText); - -#if 1 /* POPUP MENU VERTICAL POSITION FIX */ - FontInfo fontInfo; - GetFontInfo (&fontInfo); -#endif - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - if (popupText != NULL) - popupText->SetLayoutElement(formElem); - - if (widget != NULL) - widget->GetFrameSize(size); - width = size.width; - height = size.height + 1; // add 1 for "leading" between lines in forms -#if 1 /* POPUP MENU VERTICAL POSITION FIX */ - baseline = fontInfo.ascent + 1; -#else - baseline = 2; // ERROR. Does not get the proper baseline -#endif - return widget; - } -} - -LPane* UFormElementFactory::MakeList( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem) -{ - if (!formElem->element_data) - return nil; - CFormList * myList = NULL; // (CFormList*)FEDATAPANE; - if (!HasFormWidget(formElem)) - { - lo_FormElementSelectData* selectData = (lo_FormElementSelectData *)formElem->element_data; - // Create the form - LCommander::SetDefaultCommander( inHTMLView ); - LPane::SetDefaultView( inHTMLView ); - StModifyPPob modifier( formScrollingList, 0x3C, inNSContext->GetWinCSID(), false ); - myList = (CFormList *)UReanimator::ReadObjects( 'PPob', formScrollingList ); - ThrowIfNil_( myList ); - - myList->InitFormElement( *inNSContext, formElem ); - myList->FinishCreate(); - - // Initialize the list items from the form data - myList->SetSelectMultiple( selectData->multiple ); - myList->SyncRows( selectData->option_cnt ); - - ResetFormElement( formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem, myList, myList, myList)); // Reset the selection - myList->ShrinkToFit( selectData->size ); - } - else - { - myList = (CFormList*)FEDATAPANE; - if (!myList) - return NULL; - myList->FocusDraw(); - - // - // We've already created a widget for the - // form element, but layout has gone and - // reallocated the form element, so we must - // update our reference to it. - // - myList->SetLayoutElement(formElem); - } - - FontInfo info; - SDimension16 size; - - ::GetFontInfo( &info ); - myList->GetFrameSize( size ); - - // +6 to account for the focus ring - width = size.width + 6; - height = size.height + 6; - - baseline = info.ascent; - return myList; -} - -// FreeFormElement is called when eric finally wants to free the FE form data -void UFormElementFactory::FreeFormElement( - LO_FormElementData *formElem) -{ - XP_TRACE(("FreeFormElement, data %d \n", (Int32)formElem->ele_minimal.FE_Data)); - switch (formElem->type) { - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: // Sets the original text - case FORM_TYPE_FILE: - if (formElem->ele_text.current_text) - PA_FREE(formElem->ele_text.current_text); - formElem->ele_text.current_text = NULL; - FormFEData * FEData = (FormFEData *)formElem->ele_text.FE_Data; - if (FEData) - { // don't forget to null out pointer to FEData in fHost - if (FEData->fHost) - FEData->fHost->SetFEData(NULL); - delete FEData; - } - formElem->ele_text.FE_Data = NULL; - break; - case FORM_TYPE_TEXTAREA: -#ifdef ENDER - case FORM_TYPE_HTMLAREA: -#endif /*ENDER*/ - if (formElem->ele_textarea.current_text) // Free up the old memory - PA_FREE(formElem->ele_textarea.current_text); - formElem->ele_textarea.current_text = NULL; - FEData = (FormFEData *)formElem->ele_textarea.FE_Data; - if (FEData) - { // don't forget to null out pointer to FEData in fHost - if (FEData->fHost) - FEData->fHost->SetFEData(NULL); - delete FEData; - } - formElem->ele_textarea.FE_Data = NULL; - break; - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: - FEData = (FormFEData *)formElem->ele_toggle.FE_Data; - if (FEData) - { // don't forget to null out pointer to FEData in fHost - if (FEData->fHost) - FEData->fHost->SetFEData(NULL); - delete FEData; - } - formElem->ele_toggle.FE_Data = NULL; - break; - case FORM_TYPE_SELECT_ONE: - case FORM_TYPE_SELECT_MULT: - FEData = (FormFEData *)formElem->ele_select.FE_Data; - if ( FEData ) - { // don't forget to null out pointer to FEData in fHost - if (FEData->fHost) - FEData->fHost->SetFEData(NULL); - delete FEData; - } - formElem->ele_select.FE_Data = NULL; - break; - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - case FORM_TYPE_READONLY: - FEData = (FormFEData *)formElem->ele_minimal.FE_Data; - if (FEData) - { // don't forget to null out pointer to FEData in fHost - if (FEData->fHost) - FEData->fHost->SetFEData(NULL); - delete FEData; - } - formElem->ele_minimal.FE_Data = NULL; - break; - case FORM_TYPE_HIDDEN: - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_OBJECT: - // no FE_Data for these guys - break; - }; -} - -/*----------------------------------------------------------------------------- - Forms. - lo_ele.h - - Just like in other web clients, size is the size in characters the field should be, - max_size is the maximum length in characters that can be entered. - default_text is the text the user wants to have appear in the textfield - on creation and reset. - - The layout needs the front end to fill in the width and height fields in the - LO_FormElementStruct. It also needs the baseline field filled in. - This may be difficult to impossible on some front ends. baseline is - the y position from 0 to (height - 1) that should line up with regular text on - the same line as this form element. If necessary, just punt to - baseline = (height - 1). ------------------------------------------------------------------------------*/ - -// Took out XP_TRACEFORM call, so why use this function? - -void UFormElementFactory::DisplayFormElement( - CNSContext* inNSContext, - LO_FormElementStruct* formElem ) -{ - Rect oldElementFrame, newElementFrame; - Int32 extraX, extraY; - LPane *pane; - - pane = 0; - - Try_ // Because stupid LNTextEdit does a throw when you resize it too large - { - // ¥ the x,y passed to us originally may have been adjusted by layout - // so we have to update the widget. We don't actually need to draw it. - // It should only be adjusted once I think. - if ( !XP_CheckElementSpan( *inNSContext, - formElem->y + formElem->y_offset, formElem->height ) ) - return; - - if (!formElem->element_data) - return; // jrm 97/03/21 - - switch ( formElem->element_data->type ) - { - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - case FORM_TYPE_FILE: - if (GetFEData (formElem)) { - pane = GetFEDataPane(formElem); - extraX = buttomLeftExtra; // [sic] - extraY = buttonTopExtra; - } - break; - - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: - case FORM_TYPE_READONLY: - case FORM_TYPE_TEXTAREA: -#ifdef ENDER - case FORM_TYPE_HTMLAREA: -#endif /*ENDER*/ - if (GetFEData (formElem)) { - pane = GetFEDataPane(formElem); - extraX = textLeftExtra; - extraY = textTopExtra; - } - break; - - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: - case FORM_TYPE_SELECT_ONE: - case FORM_TYPE_SELECT_MULT: - if (GetFEData (formElem)) { - pane = GetFEDataPane(formElem); - extraX = 0; - extraY = 0; - } - break; - - case FORM_TYPE_OBJECT: - break; - - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - default: - Assert_(FALSE); - break; - } - - if (pane) { - if (pane->IsVisible() && formElem->ele_attrmask & LO_ELE_INVISIBLE) { - pane->Hide(); - } - pane->CalcPortFrameRect (oldElementFrame); - pane->PlaceInSuperImageAt (formElem->x + formElem->x_offset + extraX, - formElem->y + formElem->y_offset + extraY, TRUE); - pane->CalcPortFrameRect (newElementFrame); - // if the element had to be moved, invalidate a slightly larger area than its current frame - // (see notes below) - if (oldElementFrame.top != newElementFrame.top || oldElementFrame.left != newElementFrame.left) { - newElementFrame.left--; - newElementFrame.top--; - newElementFrame.right++; - newElementFrame.bottom++; - pane->InvalPortRect (&newElementFrame); - } - if (!pane->IsVisible() && !(formElem->ele_attrmask & LO_ELE_INVISIBLE)) { - pane->Show(); - pane->Enable(); - } - pane->Draw(nil); - } - } - Catch_(inErr) - {} - EndCatch_ - - /* Why we invalidate a slightly larger rectangle than that occupied by the form element - pane itself: when generating a page from HTML, the compositor creates a unique layer - for each form element. This layer is strictly rectangular and slightly larger than - the form element pane, and is used as a mask to punch out a hole in its background. - If the new form element happens to be located in a table cell using a background - color different from that used by the document, the element will have a frame - of the document background color around it after the document has been created. - That frame is temporary; it is erased when the document is redrawn, because on - subsequent draw operations, the element frame is no longer used to punch a hole - in the cell background. The cell background is rendered in the same pass as the - document background, before PowerPlant panes (already created form elements) are - drawn. Invalidating a slightly larger framerect when the form element pane - is first moved onto the document forces the important part of that redraw to happen - immediately, erasing the inappropriately colored frame around the pane. - */ -} - -void UFormElementFactory::ResetFormElement( - LO_FormElementStruct *formElem, - Boolean redraw, - Boolean fromDefaults) -{ - ResetFormElementData(formElem, redraw, fromDefaults, true); -} - -void UFormElementFactory::SetFormElementToggle( - LO_FormElementStruct* formElem, - Boolean value ) -{ -#ifdef DEBUG - if ( !formElem->element_data || formElem->element_data->type != FORM_TYPE_RADIO ) - XP_ABORT(("no form radio")); -#endif - - if ( !GetFEData( formElem ) ) - return; - LStdControl* control = (LStdControl*)FEDATAPANE; - if (!control) - return; - -// control->SetValue( value ); -// control->Refresh(); - - // MGY: In order to eliminate flickering, I changed the unenlightened call - // to Refresh above to be a little more enlightened. TODO: find out why - // it's here at all and remove it if no one can give a satifactory reason. - // Before removing it, test both GA and non-GA toggles on a variety of backgfounds - // to verify that it indeed did not perform any useful service. - -#if 0 - Int32 oldValue = control->GetValue(); - if (value != oldValue) - { - control->SetValue(value); - control->Refresh(); - } -#endif - - // MGY: Do it this way instead - - control->SetValue(value); -} - -void UFormElementFactory::FormTextIsSubmit( - LO_FormElementStruct * formElem) -{ - if ( !GetFEData( formElem ) ) - return; - if (!formElem->element_data) - return; - lo_FormElementTextData * textData = (lo_FormElementTextData *) formElem->element_data; - CFormLittleText* editField = (CFormLittleText*)FEDATAPANE; - if (editField) - editField->SetBroadcast(TRUE); -} -// -// We should move this to some utility class -// -// To Do: Figure out is this ok for -// TEXTAREA_WRAP_OFF, TEXTAREA_WRAP_SOFT and TEXTAREA_WRAP_HARD -// -static char* ConvertDataInTextEnginToUTF8(CWASTEEdit* engine) -{ - Handle h = engine->GetTextHandle(); - Int32 offset, theTextSize = engine->GetTextLength(); - ScriptCode script; - INTL_Encoding_ID encoding; - WERunInfo runInfo; - Int32 gatherSize = theTextSize * 3 + 1; - char* utf8gather = (char*)XP_ALLOC(gatherSize); - - if(utf8gather) { - StHandleLocker lock(h); - *utf8gather = '\0'; // null terminated the beginning - - for (offset = 0; offset < theTextSize; ) { - engine->GetRunInfo(offset, &runInfo); - script = FontToScript(runInfo.runStyle.tsFont); - encoding = ScriptToEncoding(script); - - Int32 runLength = runInfo.runEnd - runInfo.runStart; - char * utftemp = (char*)INTL_ConvertLineWithoutAutoDetect (encoding, CS_UTF8, - (unsigned char *)((*h) + offset), runLength); - if(utftemp) { - XP_STRCAT(utf8gather, utftemp); - XP_FREE(utftemp); - } - offset += runLength; - } - - Int32 reallocatedLen = strlen(utf8gather) + 1; - if(reallocatedLen < (gatherSize - 8)) - { - // Let's try to allocate a smalle buffer and return that instead if possible - if(char* reallocated = (char*)XP_ALLOC(reallocatedLen)) - { - XP_STRCPY(reallocated,utf8gather); - XP_FREE(utf8gather); - return reallocated; - } - } - return utf8gather; // otherwise, just return the one we allocated. - } - - return ""; -} - - -void UFormElementFactory::GetFormElementValue( - LO_FormElementStruct *formElem, - Boolean hide, - Boolean submit) -{ - if (!formElem->element_data) - return; - Try_ - { - switch (formElem->element_data->type) - { - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: // Sets the original text - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementTextData* textData = (lo_FormElementTextData*)formElem->element_data; - if (textData->current_text) - PA_FREE(textData->current_text); - textData->current_text = NULL; - - LEditField * editField = (LEditField*)FEDATAPANE; - if (!editField) - return; - CStr255 text; - editField->GetDescriptor(text); - textData->current_text = PA_ALLOC(text.Length() +1); - char * textPtr; - PA_LOCK(textPtr, char*, textData->current_text); - BlockMoveData(&(text[1]), textPtr, text.Length()); - textPtr[text.Length()] = 0; - PA_UNLOCK(textData->current_text); - } - break; - - case FORM_TYPE_TEXTAREA: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementTextareaData * textAreaData = (lo_FormElementTextareaData *) formElem->element_data; - if (textAreaData->current_text) // Free up the old memory - PA_FREE(textAreaData->current_text); - textAreaData->current_text = NULL; - // find the views - LView * scroller = (LView*)FEDATAPANE; - if (!scroller) - return; - CSimpleTextView* textEdit = (CSimpleTextView*)scroller->FindPaneByID(formBigTextID); - // Copy the text over - Handle h = NULL; - Boolean disposeHandle; // Depending if we are making a copy of the text handle - if(CS_UTF8 == formElem->text_attr->charset) - { - disposeHandle = FALSE; - textAreaData->current_text = - (PA_Block) ConvertDataInTextEnginToUTF8(dynamic_cast(textEdit)); - - } else { - Int32 theTextSize; - switch(textAreaData->auto_wrap) - { - case TEXTAREA_WRAP_OFF: - case TEXTAREA_WRAP_SOFT: - { - disposeHandle = FALSE; - h = textEdit->GetTextHandle(); - theTextSize = textEdit->GetTextLength(); - } - break; - case TEXTAREA_WRAP_HARD: - { - - disposeHandle = TRUE; - h = TextHandleToHardLineBreaks( *textEdit ); - theTextSize = ::GetHandleSize(h); - - } - break; - } - - ThrowIfNULL_(h); - - // note that in the hard wrapped case we're adding an extra null byte - // on the end. this wont hurt. - char* newTextPtr = (char*)XP_ALLOC(theTextSize + 1); - ::BlockMoveData(*h, newTextPtr, theTextSize); - newTextPtr[theTextSize] = 0; - - textAreaData->current_text = (PA_Block)newTextPtr; - } - - if (disposeHandle) - DisposeHandle(h); - } - break; - -#ifdef ENDER - case FORM_TYPE_HTMLAREA: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementTextareaData * htmlAreaData = (lo_FormElementTextareaData *) formElem->element_data; - if (htmlAreaData->current_text) // Free up the old memory - PA_FREE(htmlAreaData->current_text); - htmlAreaData->current_text = NULL; - // find the views - LView * scroller = (LView*)FEDATAPANE; - if (!scroller) - return; - CFormHTMLArea* htmlEdit = (CFormHTMLArea*)scroller->FindPaneByID(formHTMLAreaID); - Assert_(htmlEdit != NULL); - // Copy the text over - char* t_oldbuffer = 0; - MWContext *t_context = *(((CHTMLView*)htmlEdit)->GetContext()); - -#ifdef MOZ_ENDER_MIME - lo_FormElementHtmlareaData *t_htmldata = (lo_FormElementHtmlareaData*)htmlAreaData; - if(t_htmldata->mime_bits) - { - XP_FREE(t_htmldata->mime_bits); - t_htmldata->mime_bits = NULL; - } -#endif /*MOZ_ENDER_MIME*/ - EDT_SaveToBuffer(t_context, (XP_HUGE_CHAR_PTR*) &t_oldbuffer); - if (!submit) - { - htmlAreaData->current_text = (PA_Block)t_oldbuffer; - } -#ifdef MOZ_ENDER_MIME - else - { - char *pRootPartName = NULL; - //fs will be deleted in the UrlExitRoutine called from the ::Complete function. - MSG_MimeRelatedStreamSaver *fs = new MSG_MimeRelatedStreamSaver(NULL, t_context, NULL, - FALSE, MSG_DeliverNow, - NULL, 0, - NULL, - NULL, - &pRootPartName,(char **)&t_htmldata->mime_bits); - EDT_SaveFileTo(t_context, - ED_FINISHED_MAIL_SEND, - pRootPartName,fs, TRUE, TRUE); - // Spin here until temp file saving is finished - while( t_context->edit_saving_url ) - { - FEU_StayingAlive(); - } - if (t_oldbuffer) - { - EDT_SetDefaultMimeHTML( t_context, t_oldbuffer ); - XP_FREE(t_oldbuffer); - } - - } -#endif /*MOZ_ENDER_MIME*/ - } - break; -#endif /*ENDER*/ - - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: // Sets the original check state - if ( !GetFEData( formElem ) ) - return; - lo_FormElementToggleData * toggleData = (lo_FormElementToggleData*)formElem->element_data; - LStdControl * toggle = (LStdControl *)FEDATAPANE; - if (toggle) - toggleData->toggled = toggle->GetValue(); - break; - case FORM_TYPE_FILE: - lo_FormElementTextData * pickData = (lo_FormElementTextData*)formElem->element_data; - CFormFile * formFile = (CFormFile *)FEDATAPANE; - FSSpec spec; - if (formFile && formFile->GetFileSpec(spec)) - { - char * fileURL = CFileMgr::EncodedPathNameFromFSSpec( spec, TRUE ); - if (fileURL) - { - PA_Block newValueBlock = PA_ALLOC(XP_STRLEN(fileURL) + 1); - char * value; - PA_LOCK(value, char*, newValueBlock); - ::BlockMoveData(fileURL, value, XP_STRLEN(fileURL) + 1); - PA_UNLOCK(newValueBlock); - pickData->current_text = newValueBlock; - XP_FREE(fileURL); - } - else - pickData->current_text = NULL; - } - else - pickData->current_text = NULL; - break; - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - case FORM_TYPE_READONLY: - break; - case FORM_TYPE_SELECT_ONE: - { // Resets the selects - if ( !GetFEData( formElem ) ) - return; - lo_FormElementSelectData_struct* selections = &formElem->element_data->ele_select; - LButton* widget = (LButton*)FEDATAPANE; - int value = widget ? widget->GetValue() : 0; - lo_FormElementOptionData_struct* options = (lo_FormElementOptionData_struct*)selections->options; - for ( int i = 0; i < selections->option_cnt; i++ ) - options[ i ].selected = FALSE; - if ( value ) - options[ value - 1].selected = TRUE; - } - break; - case FORM_TYPE_SELECT_MULT: - { - lo_FormElementSelectData* selectData = (lo_FormElementSelectData *)formElem->element_data; - CFormList* myList = (CFormList*)FEDATAPANE; - if (!myList) - return; - lo_FormElementOptionData* mother = (lo_FormElementOptionData*)selectData->options; - for ( int i = 0 ; i < selectData->option_cnt; i++ ) - mother[ i ].selected = myList->IsSelected( i ); - } - break; - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - case FORM_TYPE_OBJECT: - break; - } - } - Catch_(inErr){} - EndCatch_ - if (hide) - HideFormElement(formElem); -} - -void UFormElementFactory::HideFormElement( - LO_FormElementStruct* formElem) -{ - if (!formElem->element_data) - return; - switch ( formElem->element_data->type ) - { - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: - case FORM_TYPE_TEXTAREA: -#ifdef ENDER - case FORM_TYPE_HTMLAREA: -#endif /*ENDER*/ - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - case FORM_TYPE_SELECT_ONE: - case FORM_TYPE_SELECT_MULT: - case FORM_TYPE_FILE: - case FORM_TYPE_READONLY: - - LFormElement* host = FEDATAHOST; - - // Schedule the form element to be destroyed. - // We don't do it immediately because we may - // be in the middle of a JavaScript which could - // then return to some PowerPlant code which - // still needs access to the form element widget - // - // Read the comments for MarkForDeath for more details - // - if (host != NULL) { - host->MarkForDeath(); - } - - FEDATAPANE = NULL; - FEDATAHOST = NULL; - break; - - - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - // no value to set or reset - break; - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - case FORM_TYPE_OBJECT: - break; - } -} -static void ValidateTextByCharset(int csid, char* text) -{ - if(text && (csid & MULTIBYTE)) - { - int pos; - int lastIdx = 0; - int boundary = strlen(text); - for(pos = 0 ; pos < boundary ; pos += (INTL_IsLeadByte(csid, text[pos])+1)) - lastIdx = pos; - if(pos != boundary) - text[lastIdx] = '\0'; - } -} - - -static void PutUnicodeIntoTextEngine( CWASTEEdit* engine, INTL_Unicode* unicode, Int32 len) -{ - INTL_CompoundStr* cs = INTL_CompoundStrFromUnicode(unicode, len); - UFontSwitcher* fs= UFixedFontSwitcher::Instance(); - if(cs) - { - // Clear the text before insertining text runs. - engine->SelectAll(); - engine->Delete(); - - INTL_Encoding_ID encoding; - unsigned char* outtext; - INTL_CompoundStrIterator iter; - for(iter = INTL_CompoundStrFirstStr((INTL_CompoundStrIterator)cs, &encoding , &outtext); - iter != NULL; - iter = INTL_CompoundStrNextStr(iter, &encoding, &outtext)) - { - if((outtext) && (*outtext)) - { - Int32 theTextSize = engine->GetTextLength(); - // Set the Text - engine->SetSelection(LONG_MAX, LONG_MAX); - engine->InsertPtr((char*)outtext, XP_STRLEN((char*)outtext), NULL, NULL); - - CCharSet charset; // Don't move this line since the fontname is point to it. - unsigned char* fontname; - switch(encoding) - { - case CS_SYMBOL: - fontname = (unsigned char*)"\pSymbol"; - break; - case CS_DINGBATS: - fontname = (unsigned char*)"\pZapf Dingbats"; - break; - default: - Boolean gotFont = CPrefs::GetFont(encoding, &charset); - Assert_(gotFont); - fontname = &charset.fPropFont[0];//fFixedFont[0]; - break; - } - - TextStyle inTextStyle; - GetFNum(fontname, &inTextStyle.tsFont); - engine->SetSelection(theTextSize, LONG_MAX); - engine->SetStyle(weDoFont, &inTextStyle); - } - } - INTL_CompoundStrDestroy(cs); - } -} - - -static void PutUTF8IntoTextEngine( CWASTEEdit* engine, char* text, Int32 len) -{ - if(len >0) - { - uint32 ubuflen = len+1; - uint32 ucs2len; - INTL_Unicode* ucs2buf = NULL; - ucs2buf = new INTL_Unicode[ubuflen]; - if(ucs2buf && (0 != (ucs2len = UUTF8TextHandler::Instance()->UTF8ToUCS2((unsigned char*) text, len, ucs2buf, ubuflen) ))) - PutUnicodeIntoTextEngine(engine, ucs2buf, ucs2len); - else - Assert_(FALSE); - - if(ucs2buf) - delete ucs2buf; - } -} - - -static void ChangeTextTraitsForSingleScript( CWASTEEdit* engine, unsigned short csid) -{ - TextTraitsH theTextTraits = UTextTraits::LoadTextTraits(CPrefs::GetTextFieldTextResIDs(csid)); - TextStyle ts; - - if (theTextTraits != NULL) { - ts.tsFont = (*theTextTraits)->fontNumber; - ts.tsSize = (*theTextTraits)->size; - ts.tsFace = (*theTextTraits)->style; - ts.tsColor = (*theTextTraits)->color; - - engine->SetStyle(weDoAll, &ts); - } -} - - -static void SetupTextInTextEngine( CWASTEEdit* engine, int16 csid, char* text, int32 len) -{ - if(CS_UTF8 == csid) - { - PutUTF8IntoTextEngine( engine, text, len ); - } else { - ChangeTextTraitsForSingleScript(engine, csid ); - if (text != NULL) - engine->InsertPtr( text, len, NULL, NULL, true ); - else - { - engine->SelectAll(); - engine->Delete(); - } - } -} - - -void UFormElementFactory::ResetFormElementData( - LO_FormElementStruct *formElem, - Boolean redraw, - Boolean fromDefaults, - Boolean reflect) -{ - if (!formElem->element_data) - return; - switch (formElem->element_data->type) - { - case FORM_TYPE_TEXT: // Set the text - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementTextData* textData = & formElem->element_data->ele_text; - LEditField * editField = (LEditField *)FEDATAPANE; - if (!editField) - return; - char* newText = NULL; - if ( fromDefaults ) - { - if ( textData->default_text ) // Eric might be passing us NULL - { - newText = (char*)textData->default_text; - editField->SetDescriptor( CStr255( newText ) ); - } - else - editField->SetDescriptor( "\p" ); - } - else - { - newText = (char*)textData->current_text; - editField->SetDescriptor( CStr255( newText ) ); - } - if ( redraw ) - { - editField->Refresh(); - editField->UpdatePort(); - } - } - break; - - case FORM_TYPE_TEXTAREA: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementTextareaData* textAreaData = (lo_FormElementTextareaData*) formElem->element_data; - LView* scroller = (LView*)FEDATAPANE; - if (!scroller) - return; - CSimpleTextView* textEdit = (CSimpleTextView*)scroller->FindPaneByID(formBigTextID); - CWASTEEdit* engine = dynamic_cast(textEdit); - char* default_text; - if ( fromDefaults ) - { - if ( textAreaData->default_text ) - { - default_text = (char*)textAreaData->default_text; - ValidateTextByCharset(formElem->text_attr->charset, default_text); - Try_ - { - SetupTextInTextEngine(engine, formElem->text_attr->charset, default_text, XP_STRLEN((char*)default_text)); - } - Catch_( inErr ) - { - } - EndCatch_ - } - else // No default value - { - Try_ - { - SetupTextInTextEngine(engine, formElem->text_attr->charset, NULL, 0); - } - Catch_( inErr ) - { - } - } - } - else - { - default_text = (char*)textAreaData->current_text; - ValidateTextByCharset(formElem->text_attr->charset, default_text); - Try_ - { - Int32 length = XP_STRLEN((char*)default_text); - // Don't want last linefeed - if ( length && default_text[ length -1 ] == '\r') - length --; // Strip off the last lf - - - if( length ) - SetupTextInTextEngine(engine, formElem->text_attr->charset, default_text, length); - } - Catch_( inErr ) - { - } - } - if ( redraw ) - textEdit->Refresh(); - } - break; - -#ifdef ENDER - case FORM_TYPE_HTMLAREA: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementTextareaData* htmlAreaData = (lo_FormElementTextareaData*) formElem->element_data; - LView* scroller = (LView*)FEDATAPANE; - if (!scroller) - return; - CFormHTMLArea* htmlEdit = (CFormHTMLArea*)scroller->FindPaneByID(formHTMLAreaID); - if (!htmlEdit) - return; - MWContext *pContext = *(((CHTMLView*)htmlEdit)->GetContext()); - if ( fromDefaults ) - { - EDT_SetDefaultHTML( pContext,(char*)(htmlAreaData->default_text) ); - } - else - { - EDT_SetDefaultHTML( pContext, (char*)(htmlAreaData->current_text) ); - } - if ( redraw ) - htmlEdit->Refresh(); - } - break; -#endif /*ENDER*/ - - case FORM_TYPE_RADIO: // Set the toggle to on or off - case FORM_TYPE_CHECKBOX: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementToggleData* toggleData = (lo_FormElementToggleData*)formElem->element_data; - LStdControl* toggle = (LStdControl*)FEDATAPANE; - if (!toggle) - return; - if ( fromDefaults ) - { - if ( toggle->GetValue() == toggleData->default_toggle ) // Do not change unless we have to - break; - toggle->SetValue( toggleData->default_toggle ); - } - else // use the stored value - { - if ( toggle->GetValue() == toggleData->toggled ) - break; - toggle->SetValue( toggleData->toggled ); - } - if ( redraw ) - toggle->Refresh(); - } - break; - - case FORM_TYPE_FILE: - { - lo_FormElementTextData * pickData = (lo_FormElementTextData*)formElem->element_data; - CFormFile * formFile = (CFormFile *)FEDATAPANE; - if (!formFile) - return; - formFile->SetVisibleChars(pickData->size); - if (fromDefaults) - ; // Do nothing - else - { - char * default_text; - FSSpec spec; - OSErr err; - PA_LOCK(default_text, char*, pickData->current_text); - if (default_text) - err = CFileMgr::FSSpecFromLocalUnixPath(default_text, &spec); - else - err = fnfErr; - PA_UNLOCK(pickData->current_text); - if (err == noErr) - formFile->SetFileSpec(spec); - } - if (redraw) - formFile->Refresh(); - } - break; - - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - // no value to set or reset - break; - - case FORM_TYPE_SELECT_ONE: - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementSelectData* selectData = (lo_FormElementSelectData*)formElem->element_data; - int offset = CalcCurrentSelected( selectData, fromDefaults ); - - LButton* widget = (LButton*)FEDATAPANE; - FormsPopup* popup = (FormsPopup*)FEDATAHOST; - - if (popup) - popup->DirtyMenu(); - if (!widget) - return; - widget->SetValue( offset + 1 ); - if ( redraw ) - widget->Refresh(); - } - break; - - case FORM_TYPE_SELECT_MULT: // Select/unselect the cells - { - if ( !GetFEData( formElem ) ) - return; - lo_FormElementOptionData* mother; - lo_FormElementSelectData* selectData = (lo_FormElementSelectData *)formElem->element_data; - CFormList* myList = (CFormList*)FEDATAPANE; - - if (!myList) - return; - myList->SelectNone(); - myList->FocusDraw(); - - ::LSetDrawingMode( FALSE, myList->GetMacListH() ); - - mother = (lo_FormElementOptionData*)selectData->options; - myList->SyncRows( selectData->option_cnt ); - for ( int i = 0; i < selectData->option_cnt; i++ ) - { - char* itemName = NULL; - Boolean select; - - itemName = (char*)mother[ i ].text_value; - myList->AddItem( itemName, i ); - - if ( fromDefaults ) - select = mother[ i ].def_selected; - else - select = mother[ i ].selected; - - if (select) - myList->SetSelect( i, select ); - } - - ::LSetDrawingMode( TRUE, myList->GetMacListH() ); - // ¥Êthis forces an update of the scrollbar, if there is - // one - ::LUpdate( NULL, myList->GetMacListH() ); - myList->ShrinkToFit( selectData->size ); - Cell selection = { myList->GetValue(), 0 }; // cells are v, h - myList->MakeCellVisible ( selection ); - if ( redraw ) - myList->Refresh(); - } - break; - - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - case FORM_TYPE_OBJECT: - break; - } - - -// immediately reflect our state - if (reflect) - FEDATAHOST->ReflectData(); -} diff --git a/mozilla/cmd/macfe/central/UFormElementFactory.h b/mozilla/cmd/macfe/central/UFormElementFactory.h deleted file mode 100644 index 6d8754eb736..00000000000 --- a/mozilla/cmd/macfe/central/UFormElementFactory.h +++ /dev/null @@ -1,158 +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. - */ - -// UFormElementFactory.h - -#pragma once - -// PowerPlant -#include - -// Backend -#include "ntypes.h" // for LO_* struct typedefs -#include "libi18n.h" - -class CHTMLView; -class CNSContext; - -class UFormElementFactory -{ -public: -// Form Class Registration - static void RegisterFormTypes(); - -// Form Element Creation - static void MakeFormElem( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - LO_FormElementStruct* formElem - ); - - - - static LPane* MakeTextFormElem( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeReadOnlyFormElem( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeTextArea( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeHTMLArea( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeButton( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeFilePicker( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeToggle( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakePopup ( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - static LPane* MakeList( - CHTMLView* inHTMLView, - CNSContext* inNSContext, - Int32 &width, - Int32 &height, - Int32& baseline, - LO_FormElementStruct *formElem - ); - -// Form Element Destruction - static void FreeFormElement( - LO_FormElementData *formElem - ); - -// Utility Routines - - static void DisplayFormElement( - CNSContext* inNSContext, - LO_FormElementStruct* formElem - ); - static void ResetFormElement( - LO_FormElementStruct *formElem, - Boolean redraw, - Boolean fromDefaults - ); - static void SetFormElementToggle( - LO_FormElementStruct* formElem, - Boolean value - ); - static void FormTextIsSubmit( - LO_FormElementStruct * formElem - ); - static void GetFormElementValue( - LO_FormElementStruct *formElem, - Boolean hide, - Boolean submit - ); - static void HideFormElement( - LO_FormElementStruct* formElem - ); - static void ResetFormElementData( - LO_FormElementStruct *formElem, - Boolean redraw, - Boolean fromDefaults, - Boolean reflect - ); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/ULocationIndependence.cp b/mozilla/cmd/macfe/central/ULocationIndependence.cp deleted file mode 100644 index 8244a0bd624..00000000000 --- a/mozilla/cmd/macfe/central/ULocationIndependence.cp +++ /dev/null @@ -1,239 +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. - */ - -// ULocationIndependence.cp - MacFE specific location independence code - -#ifdef MOZ_LOC_INDEP - -#include "CLocationIndependenceMediator.h" -#include "prefapi.h" - -#include -#include - -CLocationIndependenceMediator::CLocationIndependenceMediator(LStream*) -: CPrefsMediator(class_ID) -{ -} - -CLocationIndependenceMediator::~CLocationIndependenceMediator() -{ -} - -void CLocationIndependenceMediator::LoadPrefs() -{ - LGARadioButton * ldapRadio = (LGARadioButton *)FindPaneByID('ldap'); - LGARadioButton * httpRadio = (LGARadioButton *)FindPaneByID('http'); - ThrowIfNil_(ldapRadio); - ThrowIfNil_(httpRadio); - -#define PREF_STRING_LEN 255 - int prefStringLen; - char prefString[PREF_STRING_LEN]; - prefStringLen = PREF_STRING_LEN; - ldapRadio->SetValue(1); - if ( PREF_GetCharPref("li.protocol", prefString, &prefStringLen) == 0 ) - if (XP_STRCMP(prefString, "http") == 0) - httpRadio->SetValue(1); -} - -void CLocationIndependenceMediator::WritePrefs() -{ - LGARadioButton * ldapRadio = (LGARadioButton *)FindPaneByID('ldap'); - if ( ldapRadio->GetValue() > 0 ) - PREF_SetCharPref("li.protocol", "ldap"); - else - PREF_SetCharPref("li.protocol", "http"); - -} -#endif // MOZ_LOC_INDEP - - - -#ifdef MOZ_LI /* MOZ_LI specific code */ -//#include "pprthred.h" -#include "plevent.h" -#include -#include "li_public.h" - -// CLICommander -// Location independence commands -class CLICommander : public LCommander, public LEventDispatcher { - enum EQuitState { - eWaitingForUploadAll, - eUploadAllStarted, - eUploadAllComplete - }; - -public: - int fVerifyLoginCount; - int fNumOfCriticalFiles; - EQuitState fState; - -// Constructors - CLICommander(LCommander * inSuper); - virtual ~CLICommander() {}; - -// Startup logic - static void GetCriticalClosure(void * closure, LIStatus result); - void GetCriticalFiles(); - void VerifyLogin(); - -// Quit logic - virtual Boolean AttemptQuit(long inSaveOption); -private: - static void VerifyLoginCallback(void * closure, LIStatus result); - static void uploadAllClosure( void * closure, LIStatus result); - - void UploadAllComplete(LIStatus status); - - // Does a busy wait, while processing events - void WaitOnInt(int * boolean); -}; - - -CLICommander::CLICommander(LCommander * inSuper) - : LCommander(inSuper) -{ - fState = eWaitingForUploadAll; - -/* - LIFile * file1 = new LIFile ("/Speedy/coreprofile/file1", "FirstFile", "Test file 1"); - LIFile * file2 = new LIFile ("/Speedy/coreprofile/file2", "SecondFile", "Test file 2"); - LIFile * file3 = new LIFile ("/Speedy/coreprofile/file3", "ThirdFile", "Test file 3"); - fGroup = new LIClientGroup(); - fGroup->addFile( file1, NULL, NULL, NULL, NULL); - fGroup->addFile( file2, NULL, NULL, NULL, NULL); - fGroup->addFile( file3, NULL, NULL, NULL, NULL); -*/ -} - -extern PREventQueue *mozilla_event_queue; - -void CLICommander::GetCriticalFiles() -{ - fNumOfCriticalFiles = 0; - LI_StartGettingCriticalFiles( &fNumOfCriticalFiles ); - WaitOnInt(&fNumOfCriticalFiles); -} - -void CLICommander::VerifyLoginCallback(void * closure, LIStatus result) -{ - CLICommander * commander = (CLICommander*) closure; - commander->fVerifyLoginCount = 0; -} - -void CLICommander::VerifyLogin() -{ - fVerifyLoginCount = 1; - LIMediator::verifyLogin(VerifyLoginCallback, this); - WaitOnInt(&fVerifyLoginCount); -} - -void CLICommander::WaitOnInt(int * waitInt) -{ - EventRecord macEvent; - - while (*waitInt > 0) - { - if (IsOnDuty()) { - ::OSEventAvail(0, &macEvent); - AdjustCursor(macEvent); - } - - SetUpdateCommandStatus(false); - - Boolean gotEvent = ::WaitNextEvent(everyEvent, &macEvent, - 1, mMouseRgnH); - - // Let Attachments process the event. Continue with normal - // event dispatching unless suppressed by an Attachment. - - if (LEventDispatcher::ExecuteAttachments(msg_Event, &macEvent)) { - if (gotEvent) { - DispatchEvent(macEvent); - } else { - UseIdleTime(macEvent); - } - } - - // Repeaters get time after every event - LPeriodical::DevoteTimeToRepeaters(macEvent); - - // Update status of menu items - if (IsOnDuty() && GetUpdateCommandStatus()) { - UpdateMenus(); - } - // This pumps the mocha thread - PL_ProcessPendingEvents(mozilla_event_queue); - } - // We need to give time to idlers once again because: - // HTML conflict dialogs are being destroyed on a timer by libsec - // CreateStartupEnvironment() will not display any new windows if any HTML windows are visible - // => Must let timers run to destroy HTML dialogs before we proceed - macEvent.when = ::TickCount(); - LPeriodical::DevoteTimeToIdlers(macEvent); -} - - -void CLICommander::uploadAllClosure( void * closure, LIStatus status) -{ - CLICommander * c = (CLICommander*) closure; - c->UploadAllComplete(status); -} - -void CLICommander::UploadAllComplete(LIStatus status) -{ - fState = eUploadAllComplete; - LI_Shutdown(); - (CFrontApp::GetApplication())->DoQuit(); -} - -Boolean CLICommander::AttemptQuit(long inSaveOption) -{ - switch (fState) - { - case eWaitingForUploadAll: - LIMediator::uploadAll(uploadAllClosure, this); - break; - - case eUploadAllStarted: - return false; - break; - - case eUploadAllComplete: - return true; // We can quit now - } - return false; -} - -#endif //MOZ_LI - -#ifdef MOZ_LOC_INDEP -#include "uapp.h" - -// InitializeLocationIndependence -// Busy wait until all the Critical Files have been downloaded -void CFrontApp::InitializeLocationIndependence() -{ -// LI_Startup(); -// CLICommander * newCommander = new CLICommander(this); -// newCommander->VerifyLogin(); -// newCommander->GetCriticalFiles(); -} -#endif //MOZ_LOC_INDEP diff --git a/mozilla/cmd/macfe/central/UMenuUtils.cp b/mozilla/cmd/macfe/central/UMenuUtils.cp deleted file mode 100644 index 6c127fc7a14..00000000000 --- a/mozilla/cmd/macfe/central/UMenuUtils.cp +++ /dev/null @@ -1,218 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// UMenuUtils.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include -#include - -#include - -#include "UMenuUtils.h" -#include "cstring.h" - -#include "net.h" // for NET_UnEscape - -#ifndef __WINDOWS__ -#include -#endif - -#ifndef __LOWMEM__ -#include -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Uint8 UMenuUtils::sEnabledDummy[] = "\px"; -Uint8 UMenuUtils::sDisabledDummy[] = "\p(x"; -Uint8 UMenuUtils::sDisabledSep[] = "\p(-"; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void UMenuUtils::PurgeMenuItems(MenuHandle inMenu, Int16 inAfter) -{ - Int16 theItemCount = ::CountMItems(inMenu) - inAfter; - while (theItemCount > 0) - { - ::DeleteMenuItem(inMenu, inAfter + 1); - theItemCount--; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 UMenuUtils::InsertMenuItem( - MenuHandle inMenu, - ConstStringPtr inText, - Int16 inAfter, - Boolean inEnabled) -{ - Int16 theItemIndex; - Int16 theItemCount; - - if (inAfter == 0) - theItemIndex = 1; - else - { - theItemCount = ::CountMItems(inMenu); - if (inAfter >= theItemCount) - theItemIndex = theItemCount + 1; - else - theItemIndex = inAfter + 1; - } - - if (inEnabled) - ::InsertMenuItem(inMenu, sEnabledDummy, inAfter); - else - ::InsertMenuItem(inMenu, sDisabledDummy, inAfter); - - ::SetMenuItemText(inMenu, theItemIndex, inText); - - return theItemIndex; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 UMenuUtils::AppendMenuItem( - MenuHandle inMenu, - ConstStringPtr inText, - Boolean inEnabled) -{ - Int16 theItemIndex = ::CountMItems(inMenu) + 1; - if (inEnabled) - ::AppendMenu(inMenu, sEnabledDummy); - else - ::AppendMenu(inMenu, sDisabledDummy); - - ::SetMenuItemText(inMenu, theItemIndex, inText); - - return theItemIndex; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void UMenuUtils::AppendSeparator(MenuHandle inMenu) -{ - ::AppendMenu(inMenu, sDisabledSep); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int32 UMenuUtils::PopupWithTraits( - MenuHandle inMenu, - Point inGlobalWhere, - Int16 inTopItem, - ResIDT inTraitsID) -{ - TextTraitsH theTraits = UTextTraits::LoadTextTraits(inTraitsID); - - CGrafPtr theWindowMgrPort; - ::GetCWMgrPort(&theWindowMgrPort); - - Int16 saveFontFam = LMGetSysFontFam(); - Int16 saveFont = theWindowMgrPort->txFont; - Int16 saveSize = theWindowMgrPort->txSize; - Int16 saveFace = theWindowMgrPort->txFace; - - theWindowMgrPort->txFont = (*theTraits)->fontNumber; - theWindowMgrPort->txSize = (*theTraits)->size; - theWindowMgrPort->txFace = (*theTraits)->style; - LMSetSysFontFam((*theTraits)->fontNumber); - - Int32 theResult = ::PopUpMenuSelect(inMenu, inGlobalWhere.v, inGlobalWhere.h, inTopItem); - - theWindowMgrPort->txFont = saveFont; - theWindowMgrPort->txSize = saveSize; - theWindowMgrPort->txFace = saveFace; - LMSetSysFontFam(saveFontFam); - - return theResult; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// This is a copy of CreateMenuString that takes a char* - -void UMenuUtils::AdjustStringForMenuTitle(cstring& inString) -{ - // NET_UnEscape returns a char* which, for now, is - // just the string passed in - NET_UnEscape(inString); - if ( LString::CStringLength(inString) > 50 ) // Cut it down to reasonable size - { - inString[50] = '\0'; // truncate inString - inString += "..."; - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ= -UInt16 UMenuUtils::GetMenuBarWidth() -{ - GDHandle menuBarDevice; - Rect screenRect; - - menuBarDevice = GetMainDevice(); - screenRect = (**menuBarDevice).gdRect; - - return screenRect.right - screenRect.left; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void UMenuUtils::ConvertToIconMenu( - MenuHandle inMenu, - ResIDT inIconResID) -{ - Handle iconSuite; - - if (GetMenuBarWidth() >= 640) return; - - if (GetIconSuite(&iconSuite, inIconResID, kSelectorAllSmallData) == noErr) - { - // Set the menu title to exactly 5 characters in length. - SetMenuItemText(inMenu, 0, "\p12345"); - - char *menuData = *(char **)inMenu + sizeof(MenuInfo) - sizeof(Str255); - - // Set the first byte of the title equal to 1 to indicate it's "iconized." - *(menuData + 1) = 1; - - // Store the icon suite handle in the remaining 4 bytes of the title. - *(Handle *)(menuData + 2) = iconSuite; - } -} diff --git a/mozilla/cmd/macfe/central/UMenuUtils.h b/mozilla/cmd/macfe/central/UMenuUtils.h deleted file mode 100644 index f0baf8197e5..00000000000 --- a/mozilla/cmd/macfe/central/UMenuUtils.h +++ /dev/null @@ -1,67 +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. - */ - -// UMenuUtils.h - -#pragma once - -#include - -#ifndef __MENUS__ -#include -#endif - -class cstring; - -class UMenuUtils -{ - public: - - static void PurgeMenuItems(MenuHandle inMenu, Int16 inAfter = 0); - - static Int16 InsertMenuItem( - MenuHandle inMenu, - ConstStringPtr inText, - Int16 inAfter, - Boolean inEnabled = true); - - static Int16 AppendMenuItem( - MenuHandle inMenu, - ConstStringPtr inText, - Boolean inEnabled = true); - - static void AppendSeparator(MenuHandle inMenu); - - static Int32 PopupWithTraits( - MenuHandle inMenu, - Point inGlobalWhere, - Int16 inTopItem = 1, - ResIDT inTraitsID = 0); - - static void AdjustStringForMenuTitle(cstring& inString); - - static void ConvertToIconMenu(MenuHandle inMenu, ResIDT inIconResID); - - static UInt16 GetMenuBarWidth(); - - protected: - static Uint8 sEnabledDummy[]; - static Uint8 sDisabledDummy[]; - static Uint8 sDisabledSep[]; -}; - diff --git a/mozilla/cmd/macfe/central/asyncCursors.c b/mozilla/cmd/macfe/central/asyncCursors.c deleted file mode 100644 index b474ca85cda..00000000000 --- a/mozilla/cmd/macfe/central/asyncCursors.c +++ /dev/null @@ -1,191 +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. - */ - -#include "client.h" -#include "java.h" - -#if defined(XP_MAC) - -#include "asyncCursors.h" - -/* private prototypes, so that this compiles without warnings. */ -static OSErr initAsyncCursors(); -static void spinCursor(acurHandle cursorsH); -#if defined(powerc) || defined(__powerc) -static void asyncCursorTask(VBLTaskWithA5Ptr theTaskPtr); -#else -static void asyncCursorTask(VBLTaskWithA5Ptr theTaskPtr:__A0); -#endif - - - Boolean taskInstalled = FALSE; - acurHandle cursorsH = NULL; - VBLTaskWithA5Ptr cursorTask = NULL; - - - -OSErr -initAsyncCursors() -{ - CursHandle *workPtr; - OSErr err = noErr; - short cursorCount; - - if (cursorsH == NULL) { // only initialize once - cursorsH = (acurHandle)GetResource('acur', ACUR_RESID); - if (cursorsH != NULL) { - HNoPurge((Handle)cursorsH); - HUnlock((Handle)cursorsH); - HLockHi((Handle)cursorsH); - DetachResource((Handle)cursorsH); - cursorCount=(**cursorsH).numCursors; - (**cursorsH).index=0; - workPtr=(**cursorsH).cursors; - while(cursorCount--) { - *workPtr = (CursHandle)GetResource('CURS',*(short *)workPtr); - if (*workPtr != NULL) { - HNoPurge((Handle)*workPtr); - HUnlock((Handle)*workPtr); - HLockHi((Handle)*workPtr); - DetachResource((Handle)*workPtr); - } - ++workPtr; - } - } - else { - err = (err=ResError()) ? err:resNotFound; - } - } - return(err); -} - - - -void -spinCursor(acurHandle cursorsH) -{ - short nextIndex,theIndex; - - if (cursorsH != NULL) { - theIndex = (**cursorsH).index; - nextIndex = theIndex + 1; - if (nextIndex >= (**cursorsH).numCursors) { - nextIndex = 0; - } - (**cursorsH).index = nextIndex; - if ((**cursorsH).cursors[theIndex]) { - SetCursor(*(**cursorsH).cursors[theIndex]); - } - } -} - - - -#if defined(powerc) || defined(__powerc) - -void -asyncCursorTask(VBLTaskWithA5Ptr theTaskPtr) - -#else - -void -asyncCursorTask(VBLTaskWithA5Ptr theTaskPtr:__A0) -#endif - -{ -#if defined(powerc) || defined(__powerc) -#else - long oldA5; -#endif - if (LMGetCrsrBusy() == 0) { - -#if defined(powerc) || defined(__powerc) -#else - oldA5 = SetA5(theTaskPtr->theA5); -#endif - spinCursor(theTaskPtr->cursorsH); - theTaskPtr->theTask.vblCount = SPIN_CYCLE; - if (--cursorTask->numSpins <= 0) { // max spin time expired, stop spinning - (void)VRemove((QElemPtr)cursorTask); - taskInstalled = FALSE; - } - -#if defined(powerc) || defined(__powerc) -#else - (void)SetA5(oldA5); -#endif - - } -} - - - -void -startAsyncCursors() -{ - if (initAsyncCursors() != noErr) return; -// if (LJ_GetJavaStatus() != LJJavaStatus_Enabled) return; // java enabled but not running? - - if (cursorTask == NULL) { - cursorTask = (VBLTaskWithA5Ptr)NewPtrClear(sizeof(VBLTaskWithA5)); - if (cursorTask != NULL) { - cursorTask->theTask.qType = vType; - cursorTask->theTask.vblAddr = (void *)NewVBLProc(asyncCursorTask); - cursorTask->theTask.vblCount = SPIN_CYCLE; - cursorTask->theTask.vblPhase = 0; - cursorTask->theA5 = (long)LMGetCurrentA5(); - cursorTask->cursorsH = cursorsH; - cursorTask->numSpins = MAX_NUM_SPINS; - - if (VInstall((QElemPtr)cursorTask) == noErr) { - taskInstalled = TRUE; - } - else { - taskInstalled = FALSE; - if (cursorTask->theTask.vblAddr) { - DisposeRoutineDescriptor(cursorTask->theTask.vblAddr); - } - DisposePtr((Ptr)cursorTask); - cursorTask = NULL; - } - } - } -} - - - -void -stopAsyncCursors() -{ - if (cursorTask) { - if (taskInstalled == TRUE) { - (void)VRemove((QElemPtr)cursorTask); - taskInstalled = FALSE; - } - if (cursorTask->theTask.vblAddr) { - DisposeRoutineDescriptor(cursorTask->theTask.vblAddr); - } - DisposePtr((Ptr)cursorTask); - cursorTask = NULL; - InitCursor(); - } -} - - - -#endif diff --git a/mozilla/cmd/macfe/central/asyncCursors.h b/mozilla/cmd/macfe/central/asyncCursors.h deleted file mode 100644 index 34e2506ab83..00000000000 --- a/mozilla/cmd/macfe/central/asyncCursors.h +++ /dev/null @@ -1,69 +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. - */ - -#include -#include -#include -#include -#include -#include -#include - - -#define ACUR_RESID 128 -#define SPIN_CYCLE 8L // spin every 8/60ths of a second -#define MAX_NUM_SPINS (8L*120L) // after two minutes, stop spinning - - -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#endif - - -typedef struct { - short numCursors; - short index; - CursHandle cursors[1]; -} **acurHandle; - - -typedef struct { - VBLTask theTask; - long theA5; - acurHandle cursorsH; - long numSpins; -} VBLTaskWithA5, *VBLTaskWithA5Ptr; - - -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - - -// prototypes - -#if defined(__cplusplus) -extern "C" { -#endif - - void startAsyncCursors(); - void stopAsyncCursors(); - -#if defined(__cplusplus) -} // extern "C" -#endif diff --git a/mozilla/cmd/macfe/central/divview.cp b/mozilla/cmd/macfe/central/divview.cp deleted file mode 100644 index 3319fd97693..00000000000 --- a/mozilla/cmd/macfe/central/divview.cp +++ /dev/null @@ -1,836 +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. - */ - -#include "divview.h" -#include "CDividerGrippyPane.h" - -#include "resgui.h" -#include "macutil.h" -#include "macgui.h" -#include "CBevelView.h" - -#include - - -//----------------------------------- -LDividedView::LDividedView( LStream* inStream ) -//----------------------------------- -: LView( inStream ) -, mFirstPane(nil) -, mSecondPane(nil) -, mFeatureFlags(eNoFeatures) -, mDividerPosBeforeCollapsing(100) -{ - sSettingUp = true; - - *inStream >> mFirstSubviewID >> mSecondSubviewID; - - *inStream >> mDivSize; - *inStream >> mFirstIndent; - if ( mFirstIndent > mDivSize ) - mFirstIndent = mDivSize; - *inStream >> mSecondIndent; - if ( mSecondIndent > mDivSize ) - mSecondIndent = mDivSize; - *inStream >> mMinFirstSize; - *inStream >> mMinSecondSize; - *inStream >> mSlidesHorizontally; -} - -Boolean LDividedView::sSettingUp; - -//---------------------------------------------------------------------------------------- -LDividedView::~LDividedView() -//----------------------------------- -{ -} - -//----------------------------------- -void LDividedView::FinishCreateSelf() -//----------------------------------- -{ - LView::FinishCreateSelf(); - - mFirstPane = FindPaneByID( mFirstSubviewID ); - mSecondPane = FindPaneByID( mSecondSubviewID ); - LPane* zapPane = GetZapButton(); - LBroadcaster* zapButton = dynamic_cast(zapPane); - if (zapButton) - { - zapButton->AddListener(this); - // Turn off any bindings. We do this ourselves - SBooleanRect zapFrameBinding; - zapPane->GetFrameBinding(zapFrameBinding); - // NOTE THE FOLLOWING CONVENTION: THE TOP AND BOTTOM BINDINGS ARE USED - // TO SET THE FEATURE FLAGS. THEN WE TURN OFF THE POWERPLANT BINDINGS. - // This is because the entire button has to be moved, not just the - // bottom or top edge of it. So we take over this different type of - // binding ourselves. - // By the way, we cannot call SetFeatureFlags here, because we don't - // want the side-effect of positioning the zap button - we haven't - // calculated the offset yet! - if (zapFrameBinding.top) - SetFeatureFlagBits(eBindZapButtonTopOrLeft); - else if (zapFrameBinding.bottom) - SetFeatureFlagBits(eBindZapButtonBottomOrRight); - zapFrameBinding.left - = zapFrameBinding.top - = zapFrameBinding.left - = zapFrameBinding.bottom - = zapFrameBinding.right - = false; - zapPane->SetFrameBinding(zapFrameBinding); - OrientZapButtonTriangles(); - } - SyncFrameBindings(); - if (!IsFirstPaneCollapsed() && !IsSecondPaneCollapsed()) - mDividerPosBeforeCollapsing = GetDividerPosition(); - sSettingUp = false; -} // LDividedView::FinishCreateSelf - -//---------------------------------------------------------------------------------------- -LPane* LDividedView::GetZapButton() -//----------------------------------- -{ - return FindPaneByID('Zap!'); -} - -//---------------------------------------------------------------------------------------- -void LDividedView::DoZapAction() -// If one pane is collapsed, restore it to the saved position. -// Otherwise, zap it as specified by the feature flags. -//---------------------------------------------------------------------------------------- -{ - if ((mFeatureFlags & eZapClosesFirst) && (mFeatureFlags & eZapClosesSecond)) - { - Assert_(false); // you shouldn't have set both! - UnsetFeatureFlags(eZapClosesFirst); - } - Int16 delta; - if (IsFirstPaneCollapsed()) - delta = 1; // at left, restore to center. - else if (IsSecondPaneCollapsed()) - delta = -1; // at right, restore to center - else if (mFeatureFlags & eZapClosesFirst) - delta = - 16000; // collapse left - else if (mFeatureFlags & eZapClosesSecond) - { - delta = 16000; // collapse second - } - FeatureFlags savedFlags = mFeatureFlags; - try - { - SetFeatureFlagBits(eCollapseBothWaysByDragging); - ChangeDividerPosition(delta); - } - catch(...) - { - } - mFeatureFlags = savedFlags; -} // LDividedView::DoZapAction - -//---------------------------------------------------------------------------------------- -void LDividedView::ListenToMessage(MessageT inMessage, void* /*ioParam*/) -//----------------------------------- -{ - if (inMessage == 'Zap!') - DoZapAction(); -} // LDividedView::ListenToMessage - -//---------------------------------------------------------------------------------------- -void LDividedView::OnlySetFeatureFlags(FeatureFlags inFlags) -//---------------------------------------------------------------------------------------- -{ - // Since this is a public function, we don't allow it to change private bits (eg, - // the binding bits). - Assert_(inFlags == (inFlags & ~ePrivateMask)); - mFeatureFlags = (FeatureFlags)(mFeatureFlags | (inFlags & ~ePrivateMask)); - OrientZapButtonTriangles(); -} // LDividedView::OnlySetFeatureFlags - -//---------------------------------------------------------------------------------------- -void LDividedView::SyncFrameBindings() -//---------------------------------------------------------------------------------------- -{ - SBooleanRect firstBindings; - SBooleanRect secondBindings; - - firstBindings.top = firstBindings.bottom = - firstBindings.left = firstBindings.right = true; - secondBindings.top = secondBindings.bottom = - secondBindings.left = secondBindings.right = true; - - if ( mSlidesHorizontally ) - { - if (IsSecondPaneCollapsed()) - secondBindings.left = false; - else - firstBindings.right = false; - } - else - { - if (IsSecondPaneCollapsed()) - secondBindings.top = false; - else - firstBindings.bottom = false; - } - - mFirstPane->SetFrameBinding( firstBindings ); - mSecondPane->SetFrameBinding( secondBindings ); -} // LDividedView::SyncFrameBindings - -//---------------------------------------------------------------------------------------- -void LDividedView::SetZapFrame( - SInt16 inZapWidth, - SInt16 inDividerPosition, // relative to divided view's frame - SInt16 inDividerLength, - SInt16& ioZapLength, - SInt32& ioZapOffsetLateral, // relative to divided view's frame - SInt32& ioZapOffsetLongitudinal) // relative to divided view's frame - -// This routine is here to combine two cases : horizontal and vertical sliding. -// The cases are identical except for having to interchange "h" and "v", "width" and -// "height". The solution is to provide this routine in "latitude"/"longitude" -// coordinates. -// -// The Zap button is long and thin. "Lateral" means orthogonal to its long dimension, -// and "longitudinal" means parallel to its long dimension. -// -// Other blocks of code in this class could share code in a similar way. -//---------------------------------------------------------------------------------------- -{ - const SInt16 kPreferredZapSize = 150; - const UInt16 zapIndent = inZapWidth; - const UInt16 zapMaxSize = inDividerLength * 2 / 3; - ioZapLength = kPreferredZapSize; - if (ioZapLength > zapMaxSize) - ioZapLength = zapMaxSize; - ioZapOffsetLateral = inDividerPosition; - if (mFeatureFlags & eBindZapButtonTopOrLeft) - ioZapOffsetLongitudinal = zapIndent; - else if (mFeatureFlags & eBindZapButtonBottomOrRight) - ioZapOffsetLongitudinal = inDividerLength - ioZapLength - zapIndent; - else - ioZapOffsetLongitudinal = (inDividerLength >> 1) - (ioZapLength >> 1); -} // LDividedView::SetZapFrame - -//---------------------------------------------------------------------------------------- -void LDividedView::PositionZapButton() -//---------------------------------------------------------------------------------------- -{ - LPane* zapButton = GetZapButton(); - if (!zapButton || !mFirstPane || !FocusDraw()) - return; - - SDimension16 zapFrameSize; - zapButton->GetFrameSize(zapFrameSize); - - SDimension16 firstFrameSize; - mFirstPane->GetFrameSize(firstFrameSize); - - SPoint32 zapFrameLocation; - - if (mSlidesHorizontally) - { - SetZapFrame( - zapFrameSize.width, - firstFrameSize.width + mFirstIndent, - mFrameSize.height, - zapFrameSize.height, - zapFrameLocation.h, - zapFrameLocation.v); - } - else - { - SetZapFrame( - zapFrameSize.height, - firstFrameSize.height + mFirstIndent, - mFrameSize.width, - zapFrameSize.width, - zapFrameLocation.v, - zapFrameLocation.h); - } - zapButton->ResizeFrameTo(zapFrameSize.width, zapFrameSize.height, false); - zapButton->PlaceInSuperFrameAt(zapFrameLocation.h, zapFrameLocation.v, false); -} // LDividedView::PositionZapButton - -//---------------------------------------------------------------------------------------- -void LDividedView::SetSubPanes( - LPane* inFirstPane, - LPane* inSecondPane, - Int32 inDividerPos, - Boolean inRefresh) -// After a rearrangement of the hierarchy, change the two subviews and reposition them. -//---------------------------------------------------------------------------------------- -{ - mFirstPane = inFirstPane; - mSecondPane = inSecondPane; - - mFirstPane->PutInside(this); - mSecondPane->PutInside(this); - - Int32 secondFrameOffset = inDividerPos + mDivSize; - Int32 firstFrameSize = inDividerPos - mFirstIndent; - - StValueChanger setterUp(sSettingUp, true); - if ( mSlidesHorizontally ) - { - mFirstPane->ResizeFrameTo( firstFrameSize, - mFrameSize.height - (mFirstIndent * 2 ), - false ); - mSecondPane->ResizeFrameTo( mFrameSize.width - (secondFrameOffset + mSecondIndent), - mFrameSize.height - (mSecondIndent * 2), - false ); - - mFirstPane->PlaceInSuperFrameAt( mFirstIndent, mFirstIndent, false ); - mSecondPane->PlaceInSuperFrameAt(secondFrameOffset, - mSecondIndent, - false ); - } - else - { - mFirstPane->ResizeFrameTo( mFrameSize.width - ( mFirstIndent * 2 ), - firstFrameSize, - false ); - mSecondPane->ResizeFrameTo( mFrameSize.width - ( mSecondIndent * 2 ), - mFrameSize.height - (secondFrameOffset + mSecondIndent), - false ); - - mFirstPane->PlaceInSuperFrameAt( mFirstIndent, mFirstIndent, false ); - mSecondPane->PlaceInSuperFrameAt(mSecondIndent, - secondFrameOffset, - false ); - } - PositionZapButton(); - SyncFrameBindings(); - BroadcastMessage( msg_DividerChangedPosition, this ); - CBevelView::SubPanesChanged(this, inRefresh); -} // LDividedView::SetSubPanes - -//---------------------------------------------------------------------------------------- -void LDividedView::PositionViews( Boolean willBeHoriz ) -{ - if ( mSlidesHorizontally == willBeHoriz ) - return; - - FocusDraw(); - - mSlidesHorizontally = willBeHoriz; - SDimension16 firstFrameSize; - mFirstPane->GetFrameSize( firstFrameSize ); - if ( !mSlidesHorizontally ) // ie, it did BEFORE - { - Int16 subpaneSize = ( mFrameSize.height - mDivSize ) / 2; - - mFirstPane->ResizeFrameTo( mFrameSize.width - ( mFirstIndent * 2 ), - subpaneSize - mFirstIndent, - FALSE ); - mSecondPane->ResizeFrameTo( mFrameSize.width - ( mSecondIndent * 2 ), - subpaneSize - mSecondIndent, - FALSE ); - - mFirstPane->PlaceInSuperFrameAt( - mFirstIndent, mFirstIndent, false ); - mSecondPane->PlaceInSuperFrameAt(mSecondIndent, - firstFrameSize.height + mFirstIndent + mDivSize, - false ); - } - else - { - Int16 subpaneSize = ( mFrameSize.width - mDivSize ) / 2; - - mFirstPane->ResizeFrameTo( subpaneSize - mFirstIndent, - mFrameSize.height - ( mFirstIndent * 2 ), - FALSE ); - mSecondPane->ResizeFrameTo( subpaneSize - mSecondIndent, - mFrameSize.height - ( mSecondIndent * 2), - FALSE ); - - mFirstPane->PlaceInSuperFrameAt( mFirstIndent, mFirstIndent, false ); - mSecondPane->PlaceInSuperFrameAt( - firstFrameSize.width + mFirstIndent + mDivSize, - mSecondIndent, - false ); - } - PositionZapButton(); - SyncFrameBindings(); - BroadcastMessage( msg_DividerChangedPosition, this ); - CBevelView::SubPanesChanged(this, true); - Refresh(); -} // LDividedView::PositionViews - -//---------------------------------------------------------------------------------------- -void LDividedView::SetSlidesHorizontally( Boolean isHoriz ) -// ¥Êset whether we are vertical or horizontal -//---------------------------------------------------------------------------------------- -{ - if ( mSlidesHorizontally != isHoriz ) - PositionViews( isHoriz ); -} // LDividedView::SetSlidesHorizontally - -//---------------------------------------------------------------------------------------- -Int32 LDividedView::GetDividerPosition() const -//---------------------------------------------------------------------------------------- -{ - Rect firstFrame; - - GetSubpaneRect( (LView*)this, mFirstPane, firstFrame ); - if ( GetSlidesHorizontally() ) - return firstFrame.right; - else - return firstFrame.bottom; -} // LDividedView::GetDividerPosition - -//---------------------------------------------------------------------------------------- -void LDividedView::CalcRectBetweenPanes( Rect& invRect ) -//---------------------------------------------------------------------------------------- -{ - Rect firstFrame; - Rect secondFrame; - - GetSubpaneRect( this, mFirstPane, firstFrame ); - GetSubpaneRect( this, mSecondPane, secondFrame ); - - CalcLocalFrameRect( invRect ); - - if ( mSlidesHorizontally ) - { - invRect.left = firstFrame.right; - invRect.right = secondFrame.left; - } - else - { - invRect.top = firstFrame.bottom; - invRect.bottom = secondFrame.top; - } -} - -//---------------------------------------------------------------------------------------- -void LDividedView::CalcDividerRect( Rect& outRect ) -//---------------------------------------------------------------------------------------- -{ - Rect firstFrame; - Rect secondFrame; - - GetSubpaneRect( this, mFirstPane, firstFrame ); - GetSubpaneRect( this, mSecondPane, secondFrame ); - - CalcLocalFrameRect( outRect ); - - if ( mSlidesHorizontally ) - { - Int16 mid = ( firstFrame.right + secondFrame.left ) / 2; - outRect.left = mid - 1; - outRect.right = mid + 1; - outRect.top = ( firstFrame.top < secondFrame.top ) ? firstFrame.top : secondFrame.top; - outRect.bottom = ( firstFrame.bottom > secondFrame.bottom ) ? firstFrame.bottom : secondFrame.bottom; - } - else - { - Int16 mid = ( firstFrame.bottom + secondFrame.top ) / 2; - outRect.top = mid - 1; - outRect.bottom = mid + 1; - outRect.left = ( firstFrame.left < secondFrame.left ) ? firstFrame.left : secondFrame.left; - outRect.right = ( firstFrame.right > secondFrame.right ) ? firstFrame.right : secondFrame.right; - } -} - -//---------------------------------------------------------------------------------------- -void LDividedView::CalcLimitRect( Rect& lRect ) -// ¥ this is somewhat hackish, but this routine calculates the limit rect -// for dragging -- the hackish part is that it looks at its subviews -// pane IDs to see if they begin with a 'D' and if so, assumes they -// are also LDividedViews, and then does limiting based on that -// Well, I fixed this by using dynamic_cast - jrm 97/10/17 -//---------------------------------------------------------------------------------------- -{ - CalcLocalFrameRect( lRect ); - - LDividedView* other = dynamic_cast(mFirstPane); - if (other) - { - if ( other->GetSlidesHorizontally() == mSlidesHorizontally ) - { - Point local; - local.h = local.v = 0; - if ( other->GetSlidesHorizontally() ) - local.h = other->GetDividerPosition(); - else - local.v = other->GetDividerPosition(); - - other->LocalToPortPoint( local ); - PortToLocalPoint( local ); - - if ( mSlidesHorizontally ) - lRect.left = local.h; - else - lRect.top = local.v; - } - } - - other = dynamic_cast(mSecondPane); - if (other) - { - if ( other->GetSlidesHorizontally() == mSlidesHorizontally ) - { - Point local; - local.h = local.v = 0; - if ( other->GetSlidesHorizontally() ) - local.h = other->GetDividerPosition(); - else - local.v = other->GetDividerPosition(); - - other->LocalToPortPoint( local ); - PortToLocalPoint( local ); - - if ( mSlidesHorizontally ) - lRect.right = local.h; - else - lRect.bottom = local.v; - } - } - - if ( mSlidesHorizontally ) - { - if (!(mFeatureFlags & eCollapseFirstByDragging)) - lRect.left += mMinFirstSize; - if (!(mFeatureFlags & eCollapseSecondByDragging)) - lRect.right -= mMinSecondSize; - } - else - { - if (!(mFeatureFlags & eCollapseFirstByDragging)) - lRect.top += mMinFirstSize; - if (!(mFeatureFlags & eCollapseSecondByDragging)) - lRect.bottom -= mMinSecondSize; - } -} - -//---------------------------------------------------------------------------------------- -void LDividedView::CalcSlopRect( Rect& sRect ) -//---------------------------------------------------------------------------------------- -{ - LWindow* myWin; - - myWin = LWindow::FetchWindowObject( GetMacPort() ); - if ( myWin ) - { - myWin->CalcPortFrameRect( sRect ); - sRect = PortToLocalRect( this, sRect ); - } - else - CalcLocalFrameRect( sRect ); - // If we're allowed to drag/collapse, allow a drag beyond the frame - if ((mFeatureFlags & eCollapseFirstByDragging)) - if (mSlidesHorizontally) - sRect.left -= 100; - else - sRect.top -= 100; - else if ((mFeatureFlags & eCollapseSecondByDragging)) - if (mSlidesHorizontally) - sRect.right += 100; - else - sRect.bottom += 100; -} - -//---------------------------------------------------------------------------------------- -void LDividedView::ClickSelf( const SMouseDownEvent& inMouseDown ) -//---------------------------------------------------------------------------------------- -{ - Rect frame; - - CalcRectBetweenPanes( frame ); - if ( PtInRect( inMouseDown.whereLocal, &frame ) ) - { - FocusDraw(); - if (GetClickCount() > 1) - { - // we don't necessarily want users double-clicking to close the pane. - // If it makes sense, we can turn this back on. -// ListenToMessage('Zap!', this); - return; - } - - // if either pane is closed and dragging to open is turned off, - // bail before we get to the dragging code. - if ( (IsFirstPaneCollapsed() || IsSecondPaneCollapsed()) && !CanExpandByDragging() ) - return; - - StRegion myRgn; - CalcDividerRect( frame ); - ::RectRgn( myRgn, &frame ); - - Rect lRect, sRect; - CalcLimitRect( lRect ); - CalcSlopRect( sRect ); - - long result = ::DragGrayRgn( myRgn, inMouseDown.whereLocal, &lRect, &sRect, - mSlidesHorizontally ? hAxisOnly : vAxisOnly, nil ); - - Int16 delta = mSlidesHorizontally ? LoWord( result ) : HiWord( result ); - - if (result == kOutsideSlop || delta == 0) - return; - - ChangeDividerPosition( delta ); - } -} - -#define SAVE_VERSION 28 - -//---------------------------------------------------------------------------------------- -void LDividedView::SavePlace( LStream* inStream ) -//---------------------------------------------------------------------------------------- -{ - WriteVersionTag( inStream, SAVE_VERSION ); - - *inStream << mSlidesHorizontally; - Int32 divPos = GetDividerPosition(); - *inStream << divPos; - *inStream << mDividerPosBeforeCollapsing; -} - -//---------------------------------------------------------------------------------------- -void LDividedView::RestorePlace( LStream* inStream ) -//---------------------------------------------------------------------------------------- -{ - if ( !ReadVersionTag( inStream, SAVE_VERSION ) ) - throw (OSErr)rcDBWrongVersion; - - Boolean isSlidingHoriz; - *inStream >> isSlidingHoriz; - - Int32 shouldBeHere; - *inStream >> shouldBeHere; - - *inStream >> mDividerPosBeforeCollapsing; - - PositionViews( isSlidingHoriz ); - - Int32 divPos = GetDividerPosition(); - if (shouldBeHere != divPos) - ChangeDividerPosition( shouldBeHere - divPos ); -} // LDividedView::RestorePlace - -//---------------------------------------------------------------------------------------- -void LDividedView::PlaySound(ResIDT id) -//---------------------------------------------------------------------------------------- -{ - // Play the swishing sound, if available - SndListHandle soundH = - (SndListHandle)::GetResource('snd ', id); - if (soundH) - { - ::DetachResource((Handle)soundH); - ::SndPlay(nil, soundH, false); - ::DisposeHandle((Handle)soundH); - } -} - -//---------------------------------------------------------------------------------------- -Boolean LDividedView::PreferSounds() -//---------------------------------------------------------------------------------------- -{ - return false; // no sounds! no sounds! -} - -//---------------------------------------------------------------------------------------- -void LDividedView::ChangeDividerPosition( Int16 delta ) -// ¥ move the divider, resize the top/left pane, and -// move the bottom/right one -//---------------------------------------------------------------------------------------- -{ - Int32 dividerPos = GetDividerPosition(); - Int16 newPos = dividerPos + delta; - Int16 frameBound // drag beyond which causes slam - = mSlidesHorizontally ? mFrameSize.width : mFrameSize.height; - - Boolean showFirst = false; - Boolean showSecond = false; - if (newPos > frameBound - mMinSecondSize) - { - if ((mFeatureFlags & eCollapseSecondByDragging)) - { - if (IsSecondPaneCollapsed() && delta <= 0) - { - // Uncollapse from right - if (mDividerPosBeforeCollapsing >= frameBound) - mDividerPosBeforeCollapsing = frameBound / 2; - delta = mDividerPosBeforeCollapsing - dividerPos; - showSecond = true; - } - else - { - // Collapse to right - delta = frameBound - mDivSize - dividerPos; - mSecondPane->Hide(); - if (dividerPos == 0) // user dragged from one extreme to the other - showFirst = true; - else - mDividerPosBeforeCollapsing = dividerPos; - if (IsVisible() && PreferSounds()) - PlayClosingSound(); - } - } - else - return; - } - else if (newPos < mMinFirstSize) - { - if ((mFeatureFlags & eCollapseFirstByDragging)) - { - if (IsFirstPaneCollapsed() && delta >= 0) - { - // Uncollapse from left - if (mDividerPosBeforeCollapsing >= frameBound) - mDividerPosBeforeCollapsing = frameBound / 2; - delta = mDividerPosBeforeCollapsing - dividerPos; - showFirst = true; - } - else - { - // Collapse to left - delta = - dividerPos; - mFirstPane->Hide(); - if (dividerPos == frameBound - mDivSize) - showSecond = true; // user dragged from one extreme to the other - else - mDividerPosBeforeCollapsing = dividerPos; - if (IsVisible() && PreferSounds()) - PlayClosingSound(); - } - } - else - return; - } - else if (IsSecondPaneCollapsed() && delta <= 0) - showSecond = true; - else if (IsFirstPaneCollapsed() && delta >= 0) - showFirst = true; - - if (mSlidesHorizontally) - { - mFirstPane->ResizeFrameBy( delta, 0, false ); - mSecondPane->MoveBy( delta, 0, false ); - mSecondPane->ResizeFrameBy( -delta, 0, false ); - } - else - { - mFirstPane->ResizeFrameBy( 0, delta, false ); - mSecondPane->MoveBy( 0, delta, false ); - mSecondPane->ResizeFrameBy( 0, -delta, false ); - } - SyncFrameBindings(); - - BroadcastMessage( msg_DividerChangedPosition, this ); - - if (showFirst) - mFirstPane->Show(); - if (showSecond) - mSecondPane->Show(); - CBevelView::SubPanesChanged(this, false); - if ((showFirst || showSecond) && IsVisible() && PreferSounds()) - PlayOpeningSound(); - - PositionZapButton(); - OrientZapButtonTriangles(); - Refresh(); -} // LDividedView::ChangeDividerPosition - -enum -{ - kTriangleRight = 10000 -, kTriangleDown -, kTriangleLeft -, kTriangleUp -}; - -//---------------------------------------------------------------------------------------- -void LDividedView::OrientZapButtonTriangles() -//---------------------------------------------------------------------------------------- -{ - // no grippies for mozilla??? not yet at least, maybe for HTML area. -#if 0 - CDividerGrippyPane* zapper = dynamic_cast(GetZapButton()); - if (!zapper) - return; - if (IsFirstPaneCollapsed() - || ((mFeatureFlags & eZapClosesSecond) && !IsSecondPaneCollapsed())) - zapper->SetTriangleIconID(mSlidesHorizontally ? kTriangleRight : kTriangleDown); - else if (IsSecondPaneCollapsed() - || ((mFeatureFlags & eZapClosesFirst) && !IsFirstPaneCollapsed())) - zapper->SetTriangleIconID(mSlidesHorizontally ? kTriangleLeft : kTriangleUp); -#endif -} // LDividedView::OrientZapButtonTriangles - -//---------------------------------------------------------------------------------------- -void LDividedView::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -//---------------------------------------------------------------------------------------- -{ - LView::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - if (sSettingUp) - return; - - if (mFirstPane - && GetDividerPosition() > (mSlidesHorizontally ? - mFrameSize.width : mFrameSize.height) - mDivSize) - { - // Bug #309526. The divider is bound to the left/top. If the second pane is - // hidden, then it is bound to the right/bottom also. But if the second pane - // is showing, and the window is sized too small by dragging the grow box, - // then the divider can be out of view (not quite correct)! The real problem - // with this is that the scrollbar can be clipped. - // So if after the resize this situation obtains, make the following call. - // ChangeDividerPosition will notice that the divider is offscreen, - // and it will zap the second frame closed, so now the divider will stick to - // the edge. - ChangeDividerPosition(1); - } - else - { - PositionZapButton(); - CBevelView::SubPanesChanged(this, inRefresh); - } -} - -//---------------------------------------------------------------------------------------- -void LDividedView::AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ) -//---------------------------------------------------------------------------------------- -{ - Rect frame; - - CalcRectBetweenPanes( frame ); - PortToLocalPoint( inPortPt ); - if ( PtInRect( inPortPt, &frame ) ) - { - // if either pane is closed and dragging to open is turned off, - // bail before we get to cursor switching code - if ( (IsFirstPaneCollapsed() || IsSecondPaneCollapsed()) && !CanExpandByDragging() ) - return; - - if ( mSlidesHorizontally ) - ::SetCursor( *(::GetCursor( curs_HoriDrag ) ) ); - else - ::SetCursor( *(::GetCursor( curs_VertDrag ) ) ); - } - else - LView::AdjustCursorSelf(inPortPt, inMacEvent); -} diff --git a/mozilla/cmd/macfe/central/divview.h b/mozilla/cmd/macfe/central/divview.h deleted file mode 100644 index 383da3becf0..00000000000 --- a/mozilla/cmd/macfe/central/divview.h +++ /dev/null @@ -1,185 +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. - */ - -#pragma once - -#include -#include -#include - - -const Int32 kOutsideSlop = 0x80008000; -const MessageT msg_DividerChangedPosition = 'divc'; - -class LDividedView : - public LView, - public LBroadcaster, // broadcasts msg_DividerChangedPosition - public LListener // Listens to Zap button (if any) -{ -public: - enum {class_ID = 'DIVV'}; - enum FeatureFlags - { - eNoFeatures = 0 - , eCollapseFirstByDragging = (1<<0) - , eCollapseSecondByDragging = (1<<1) - , eZapClosesFirst = (1<<2) - , eZapClosesSecond = (1<<3) - , eBindZapButtonBottomOrRight = (1<<4) // if neither of these.... - , eBindZapButtonTopOrLeft = (1<<5) // ... then we center it. - , eNoOpenByDragging = (1<<6) - // Handy combinations - , eCollapseBothWaysByDragging = - (eCollapseFirstByDragging|eCollapseSecondByDragging) - , eCollapseBothZapFirst = - (eCollapseBothWaysByDragging|eZapClosesFirst) - , eCollapseBothZapSecond = - (eCollapseBothWaysByDragging|eZapClosesSecond) - , eOnlyFirstIsCollapsible = - (eZapClosesFirst|eCollapseFirstByDragging) - , eOnlySecondIsCollapsible = - (eZapClosesSecond|eCollapseSecondByDragging) - // The bindings are set using the PP binding - // fields in the PP constructor resource: - , eBindingMask = - (eBindZapButtonBottomOrRight|eBindZapButtonTopOrLeft) - // Bits in this mask are not changeable through the public - // SetFeatureFlags calls: - , ePrivateMask = - (eBindingMask) - }; - LDividedView( LStream* inStream ); - virtual ~LDividedView(); - - virtual void FinishCreateSelf(); - - void SetSlidesHorizontally( Boolean isHoriz ); - Boolean GetSlidesHorizontally() const { return mSlidesHorizontally; }; - UInt16 GetDividerSize() const { return mDivSize; } - void DoZapAction(); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - virtual void ClickSelf( const SMouseDownEvent& inMouseDown ); - - virtual void AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ); - virtual void ChangeDividerPosition( Int16 delta ); - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); - - virtual void SavePlace( LStream* inStream ); - virtual void RestorePlace( LStream* inStream ); - - // These reposition things as necessary. But the bindings are private. - void OnlySetFeatureFlags(FeatureFlags inFlags); // adjusts positions etc. - void SetFeatureFlags(FeatureFlags inFlags) // adjusts positions etc. - { OnlySetFeatureFlags((FeatureFlags)(mFeatureFlags | inFlags)); } - void UnsetFeatureFlags(FeatureFlags inFlags) - { OnlySetFeatureFlags((FeatureFlags)(mFeatureFlags & ~inFlags)); } - - Boolean IsSecondPaneCollapsed() const - { return GetDividerPosition() >= (mSlidesHorizontally ? - mFrameSize.width : mFrameSize.height) - mDivSize; } - Boolean IsFirstPaneCollapsed() const - { return GetDividerPosition() <= 0; } - void SetSubPanes( - LPane* inFirstPane, - LPane* inSecondPane, - Int32 inDividerPos, - Boolean inRefresh); - void GetSubPanes( - LPane*& outFirstPane, - LPane*& outSecondPane) const - { outFirstPane = mFirstPane; outSecondPane = mSecondPane; } - Int32 GetDividerPosition() const; - // WARNING: this does not access a stored value, it is - // calculated by looking at the first subpane's current size. - // It doesn't work too well if the first subpane is nil, or - // if the first subpane has not yet been installed. - - - static Boolean PreferSounds(); - static void PlayClosingSound() { PlaySound(128); } - static void PlayOpeningSound() { PlaySound(129); } - static void PlaySound(ResIDT id); - -protected: - - LPane* GetZapButton(); - void PositionZapButton(); - void OrientZapButtonTriangles(); - void SetZapFrame( - SInt16 inZapWidth, - SInt16 inDividerPosition, // rel. to div view's frame - SInt16 inDividerLength, - SInt16& ioZapLength, - SInt32& ioZapOffsetLateral, // rel. to div view's frame - SInt32& ioZapOffsetLongitudinal); // rel. to div view's frame - - // These two have no side-effects, and work on all bits. - void SetFeatureFlagBits(FeatureFlags inFlags) // no other effects - { mFeatureFlags = (FeatureFlags)(mFeatureFlags | inFlags); } - void UnsetFeatureFlagBits(FeatureFlags inFlags) // no other effects - { mFeatureFlags = (FeatureFlags)(mFeatureFlags & (~inFlags)); } - - // ¥Êthe area representing the divider rect (only when dragging) - void CalcDividerRect( Rect& outRect ); - - void SyncFrameBindings(); - - // ¥ lays out the subpanes (after reanimating, changing horiz./vert.) - void PositionViews( Boolean willBeHoriz ); - - // ¥Êthe following two routines are called just prior to - // dragging - void CalcLimitRect( Rect& lRect ); - void CalcSlopRect( Rect& sRect ); - - // ¥Êthis routine is called to invalidate the rectangle between - // the two panes (which is larger than divider rect) when - // the divider is moved - void CalcRectBetweenPanes( Rect& rect ); - - // ¥ check if we're allowed to pull out a collapsed pane by dragging - virtual bool CanExpandByDragging ( ) const { return !(mFeatureFlags & eNoOpenByDragging); }; - -// Data -protected: - - PaneIDT mFirstSubviewID; // pane ID of the top or left pane - PaneIDT mSecondSubviewID; // pane ID of the bottom or right pane - - UInt16 mDivSize; // Width of the divider - Int16 mMinFirstSize; // mimimum size of top (or left) pane - Int16 mMinSecondSize; // minimum size of bottom (or right) pane - - FeatureFlags mFeatureFlags; - Int16 mDividerPosBeforeCollapsing; - - Int16 mFirstIndent; - Int16 mSecondIndent; - - Boolean mSlidesHorizontally;// top/bottom or left/right configuration? - - LPane* mFirstPane; // top or left view - LPane* mSecondPane; // bottom or right view - - static Boolean sSettingUp; -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/earlmgr.cp b/mozilla/cmd/macfe/central/earlmgr.cp deleted file mode 100644 index c67a906d824..00000000000 --- a/mozilla/cmd/macfe/central/earlmgr.cp +++ /dev/null @@ -1,329 +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. - */ - -// earlmgr.cp, Mac front end - -#include "earlmgr.h" - // macfe -#include "ufilemgr.h" -#include "ulaunch.h" -#include "uprefd.h" -#include "uerrmgr.h" -#include "BufferStream.h" -#include "uapp.h" -#include "CNSContext.h" - // Network - // Netscape -#include "secrng.h" - // utilities -#include "PascalString.h" - -#if defined(SMOOTH_PROGRESS) -#include "progress.h" -#endif - -#ifdef JAVA -extern "C" { -#include "nsn.h" -} -#endif - -#include "resgui.h" - -#include "prthread.h" -PR_BEGIN_EXTERN_C -PR_EXTERN(PRThread*) PR_GetPrimaryThread(void); -PR_END_EXTERN_C - -/*----------------------------------------------------------------------------- - Earl Manager ------------------------------------------------------------------------------*/ - -EarlManager TheEarlManager; - -int EarlManagerNetTicklerCallback(void); - -// -// Construction -// - -EarlManager::EarlManager () -{ - fInterruptContext = NULL; -#ifdef JAVA - nsn_InstallTickleHookProc(&EarlManagerNetTicklerCallback); -#endif -} - -// -// ¥¥ URL loading interface -// - -void EarlManager::DoCancelLoad (MWContext *context) -{ - // Cancels all loads for a given window - NET_InterruptWindow (context); -} - -int EarlManager::StartLoadURL (URL_Struct * request, MWContext *context, - FO_Present_Types output_format) -{ -#if defined(SMOOTH_PROGRESS) - PM_EnsureProgressManager(context); -#endif - if (request->referer && (strlen(request->referer) == 0)) - { - XP_FREE(request->referer); - request->referer = NULL; - } - int err = NET_GetURL (request, output_format, context, DispatchFinishLoadURL); - return err; -} - -void EarlManager::SpendTime( const EventRecord& /*inMacEvent*/) -{ - // Make sure that we only call NET_ProcessNet at an - // appropriate time, and make sure that our priority is - // low so that other java threads an run. - - PR_SetThreadPriority(PR_CurrentThread(), PR_PRIORITY_LOW); - - unsigned char dst; - RNG_GenerateGlobalRandomBytes(&dst, 1); - NET_PollSockets(); - if ( fInterruptContext ) - { - NET_InterruptWindow( fInterruptContext ); - fInterruptContext = NULL; - } -} - -void EarlManager::InterruptThis(MWContext * context) -{ - fInterruptContext = context; -} - -void EarlManager::FinishLoadURL(URL_Struct * request, int status, MWContext *context) -{ - CNSContext* nsContext = ExtractNSContext(context); - if (nsContext) - nsContext->CompleteLoad(request, status); - if (status != MK_CHANGING_CONTEXT) - NET_FreeURLStruct (request); -} - -void EarlManager::DispatchFinishLoadURL (URL_Struct *request, int status, MWContext *context) -{ - // let the front end know the NetGetUrl is complete. This should go - // into NetLib at some point! LAM - - TheEarlManager.FinishLoadURL (request, status, context); -} - - - - -/*------------------------------------------------------------------------------ - FE Misc functions - - Launching of telnet/tn3270 sessions - ------------------------------------------------------------------------------*/ -// ¥¥ Prototypes - -LFileBufferStream * CreateTelnetFile(char * hostname, char * port, char * username); -LFileBufferStream * CreateTn3270File(char * hostname, char * port, char * username); - -// ¥¥ Implementation - -LFileBufferStream * CreateTelnetFile(char * hostname, char * port, char * username) -{ - FSSpec fileSpec; - - // Figure out the mime extensions - CMimeMapper * mime = CPrefs::sMimeTypes.FindMimeType(CMimeList::Telnet); - if (mime == NULL) - return NULL; - - // Create the file - LFileBufferStream * file = NULL; - CFileMgr::UniqueFileSpec( CPrefs::GetTempFilePrototype(), - CStr31(::GetCString(NETSCAPE_TELNET)), fileSpec); - - Try_ { // Not dealing with duplicates yet - file = new LFileBufferStream(fileSpec); - file->CreateNewDataFile(mime->GetAppSig(), mime->GetDocType(), 0); - file->OpenDataFork(fsRdWrPerm); - } - Catch_(inErr) - { - return NULL; - } EndCatch_ - -// Write the arguments out - - WriteCString (file, ::GetCString(NETSCAPE_TELNET_NAME_ARG)); // name="user@hostname" - if (username != NULL) - { - WriteCString (file, username); - WriteChar (file, '@'); - // ErrorManager::PlainAlert(Login as???? - } - WriteCString (file, hostname); - WriteCString (file, "\"\r"); - WriteCString (file, ::GetCString(NETSCAPE_TELNET_HOST_ARG)); // host = "hostname" - WriteCString (file, hostname); - WriteCString (file, "\"\r"); - WriteCString (file, ::GetCString(NETSCAPE_TELNET_PORT_ARG)); // port = "port" - if (port != NULL) - WriteCString (file, port); - else - WriteCString (file, "23\r"); - file->CloseDataFork(); - return file; -} - -LFileBufferStream * CreateTn3270File(char * hostname, char * /*port*/, char * /*username*/) -{ - FSSpec fileSpec; - -// Figure out the mime extensions - CMimeMapper * mime = CPrefs::sMimeTypes.FindMimeType(CMimeList::Tn3270); - if (mime == NULL) - return NULL; - -// Create the file - LFileBufferStream * file = NULL; - CFileMgr::UniqueFileSpec( CPrefs::GetTempFilePrototype(), - CStr31(::GetCString(NETSCAPE_TN3270)), fileSpec); - - Try_ { // Not dealing with duplicates yet - file = new LFileBufferStream (fileSpec); - file->CreateNewDataFile(mime->GetAppSig(), mime->GetDocType(), 0); - file->OpenDataFork(fsRdWrPerm); - } - Catch_(inErr) - { - return NULL; - } EndCatch_ - -// Write the arguments out -// I really do not know what the format of the file is, so I am just guessing here - WriteCString (file, "0 8 80 20 40 10 80 0 "); // part 1 - WriteCString (file, hostname); - // part 2 of indecipherable file format - WriteCString (file, " 2 1 15 1 1 1 23 0 1 ffff ffff ffff fc00 f37d 52f ffff 7a5d 9f8e 0 c42f eaff 1f21 b793 1431 dd6b 8c2 6a2 4eba 6aea dd6b 0 0 0 2a00 2a00 2a00 24 12 0 1 0 0 4eba 6aea dd6b 1 1 0 default 1 English_(U.S.) 12 80 24 80 System_Alert_Sound 2 19f 142 1 74747874 0"); // part2 - file->CloseDataFork(); - return file; -} - -void FE_ConnectToRemoteHost(MWContext * ctxt, int url_type, char * -hostname, char * port, char * username) -{ - LFileBufferStream * telnetFile = NULL; - switch (url_type) { - case FE_RLOGIN_URL_TYPE: - case FE_TELNET_URL_TYPE: - FE_Progress(ctxt, (char *)GetCString( LAUNCH_TELNET_RESID )); - telnetFile = CreateTelnetFile(hostname, port, username); - break; - case FE_TN3270_URL_TYPE: - FE_Progress(ctxt, (char *)GetCString( LAUNCH_TN3720_RESID )); - telnetFile = CreateTn3270File(hostname, port, username); - } - if (telnetFile != NULL) - { - LaunchFile(telnetFile); - CFileMgr::sFileManager.RegisterFile(telnetFile); // Register file for deletion - } - else - ErrorManager::PlainAlert(TELNET_ERR_RESID); -} - -/*------------------=---------------------------------------------------------- - Utilities ---------------------=--------------------------------------------------------*/ - -CStr255 gSaveAsPrompt; - -OSErr GUI_AskForFileSpec (StandardFileReply & reply); -OSErr GUI_AskForFileSpec (StandardFileReply & reply) -{ - ErrorManager::PrepareToInteract(); - - UDesktop::Deactivate(); - if (gSaveAsPrompt.Length() == 0) - gSaveAsPrompt = (const char*)GetCString( SAVE_AS_RESID ); - StandardPutFile (gSaveAsPrompt, reply.sfFile.name, &reply); - UDesktop::Activate(); - - if (!reply.sfGood) - return userCanceledErr; - return noErr; -} - -int EarlManagerNetTicklerCallback(void) -{ - // We need to tickle the network and the UI if we - // are stuck in java networking code. - - if (PR_CurrentThread() == PR_GetPrimaryThread()) { - (CFrontApp::GetApplication())->ProcessNextEvent(); - return false; - } - - else { - return true; - } -} - -// FE Select routines -void FE_SetReadSelect (MWContext * /* context */, int sd) -{ -} - -void FE_ClearReadSelect (MWContext */* context */, int sd) -{ -} - -void FE_SetConnectSelect (MWContext */* context */, int sd) -{ -} - -void FE_ClearConnectSelect(MWContext */* context */, int sd) -{ -} - - -void FE_SetFileReadSelect (MWContext */* context */, int fd) -{ -} - - -void FE_ClearFileReadSelect (MWContext */* context */, int fd) -{ -} - -int FE_StartAsyncDNSLookup (MWContext */* context */, char * host_port, void ** hoststruct_ptr_ptr, int sock) -{ - return MK_WAITING_FOR_LOOKUP; -} - - -#ifdef PROFILE -#pragma profile off -#endif - diff --git a/mozilla/cmd/macfe/central/earlmgr.h b/mozilla/cmd/macfe/central/earlmgr.h deleted file mode 100644 index 14910d0014c..00000000000 --- a/mozilla/cmd/macfe/central/earlmgr.h +++ /dev/null @@ -1,74 +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. - */ - -// earlmgr.h, Mac front end - -#ifndef _EarlMgr_ -#define _EarlMgr_ -#pragma once - - // client -class CMimeMapper; - // project -#include "xp_core.h" -#include "ntypes.h" -#include "client.h" - // utilities -struct CStr255; - // libraries -class LFileStream; - // system - -/***************************************************************************** - * EarlManager - * Dispatcher of the load commands - ******************************************************************************/ - -class EarlManager: public LPeriodical { -public: - EarlManager (); - - // ¥¥ URL loading interface - - // StartLoadURL tells network library to start loading the URL - static int StartLoadURL (URL_Struct * request, MWContext *context, - FO_Present_Types output_format); - - // Cancels all loads for a given context - static void DoCancelLoad (MWContext *context); - - // Called by netlib when URL loading is done. This routine is passed to NET_LoadURL - static void DispatchFinishLoadURL (URL_Struct *url, int status, MWContext *context); - - // ¥¥ Event handling - // Instead of calling NET_InterruptWindow at unsafe time (possible reentrancy) - // call this function. It will interrupt the window after netlib returns - void InterruptThis(MWContext * context); - void SpendTime (const EventRecord &inMacEvent); - void SpendYieldedTime(); -private: - void FinishLoadURL (URL_Struct *url, int status, MWContext *context); - MWContext * fInterruptContext; // Just used by InterruptThis -}; - -extern EarlManager TheEarlManager; - - -#endif // _EarlMgr_ - - diff --git a/mozilla/cmd/macfe/central/errmgr.cp b/mozilla/cmd/macfe/central/errmgr.cp deleted file mode 100644 index 595c39f2ba8..00000000000 --- a/mozilla/cmd/macfe/central/errmgr.cp +++ /dev/null @@ -1,552 +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. - */ - -// errmgr.cp, Mac front end ErrorManager - -// Editorial comments: -// -// Viewing some of this code may make you scream in panic -// Don't try this at home -// Use only under medical supervision - -#include "uerrmgr.h" - -#include -#include "uapp.h" -#include "PascalString.h" -#include "xpassert.h" -#include "macutil.h" -#include "resgui.h" -#include "xp_error.h" -#include "UTextBox.h" -#include "resdef.h" -#include "macfeprefs.h" -// Apple -#include -#include -#include -#include - -#include - -#include "libi18n.h" - -static void InitializeStrings(); // Need proto to use before declaration - -OSType ErrorManager::sAlertApp = emSignature; - -// Converts an OSErr to appropriate string. -// Just prints the number for now, might do something more -// useful in the future -void ErrorManager::OSNumToStr(OSErr err, CStr255 &outString) -{ - NumToString((long)err, outString); -} - -// PrepareToInteract makes sure that this is the frontmost application. -// If Netscape is not in the foreground, it blinks the small icon in -// the menu bar until the user brings us to front -void ErrorManager::PrepareToInteract() -{ - TryToInteract(10000000); -} - -// TryToInteract tries to bring Netscape to foreground (like PrepareToInteract) -// If user does not bring Netscape to foreground in 900 seconds, -// it returns FALSE; -Boolean ErrorManager::TryToInteract(long wait) -{ - ProcessSerialNumber netscapeProcess, frontProcess; - OSErr err = ::GetCurrentProcess(&netscapeProcess); - Boolean inFront = IsFrontApplication(); - if (!inFront) - { - unsigned long start, currentTime; - ::GetDateTime(&start); - currentTime = start; - NMRec nmRec; - Handle iconSuite; - err = ::GetIconSuite (&iconSuite, 128,svAllSmallData); - nmRec.qLink = 0; - nmRec.qType = nmType; - nmRec.nmMark = true; - nmRec.nmIcon = iconSuite; - nmRec.nmStr = NULL; - nmRec.nmSound = (Handle)-1; - nmRec.nmResp = NULL; - err = ::NMInstall(&nmRec); // Remove the call automatically - if (err == noErr) - { - while (!inFront && ((currentTime - start) < wait)) - { - EventRecord event; - ::WaitNextEvent(0, &event, 30, NULL); - ::GetFrontProcess(&frontProcess); - ::GetDateTime(¤tTime); - ::SameProcess(&frontProcess, &netscapeProcess, &inFront); - } - ::NMRemove(&nmRec); - } -#if defined(DEBUG) && defined(ALEKS) - XP_Abort(); -#endif - UDesktop::Resume(); // Because the resume event gets eaten up by dialog box -// Now, process any update events, so that our windows get refreshed properly - EventRecord event; - while (::WaitNextEvent(updateEvt, &event, 1, NULL)) - (CFrontApp::GetApplication())->DispatchEvent(event); - } - return inFront; -} - -// Class that resizes the alert dialog - -// Resizes -void ShrinkToFitAlertDialog(cstring & temp); -void ShrinkToFitAlertDialog(cstring & temp) -{ - Handle ditl = ::GetResource('DITL', ALRT_PlainAlert); - StHandleLocker lock(ditl); - Handle alrt = ::GetResource('ALRT', ALRT_PlainAlert); - StHandleLocker lock2(alrt); - -// ¥¥¥ WARNING ¥¥¥ -// You need to consider the PAD byte after each string -#define IncludePadByte(a) (((a) & 1) ? ((a) +1) : (a)) - - // This ugliness happens because my pointer arithmetic was messed up otherwise - UInt32 tmp = (UInt32)*ditl; - Rect * okRect = (Rect*)(tmp + 0x6); - // Offset + length of the OK string - Rect * editRect = (Rect*)(tmp + 0x14 + IncludePadByte(*(uint8*)(tmp + 0xF))); - StTextState textState; - TextFont(0); - TextSize(12); - short height = UTextBox::TextBoxDialogHeight((char*)temp, temp.length(), editRect, - teForceLeft, 0); - if (height < 50) // Need to make place for the icon - height = 50; - editRect->bottom = editRect->top + height; - okRect->top = editRect->bottom + 8; - okRect->bottom = okRect->top + 20; -// Get the window resource -// Strange thing here: after ALRT is called for the first time, -// altrRect gets altered. Its top/left are strange (>30000) -// So I reset them, and everything seems to work -// I bet that the toolbox guys are storing alert state in these - Rect * alrtRect = (Rect*)*alrt; - alrtRect->top = 100; - alrtRect->bottom = alrtRect->top+ okRect->bottom + 8; - alrtRect->left = 185; - alrtRect->right = 577; -} - -void ShrinkToFitYorNDialog(cstring & temp); -void ShrinkToFitYorNDialog(cstring & temp) -{ - Handle ditl = ::GetResource('DITL', ALRT_YorNAlert); - StHandleLocker lock(ditl); - Handle alrt = ::GetResource('ALRT', ALRT_YorNAlert); - StHandleLocker lock2(alrt); - // This ugliness happens because my pointer arithmetic was messed up otherwise - UInt32 base = (UInt32)*ditl; - -// ¥¥¥ WARNING ¥¥¥ -// You need to consider the PAD byte after each string - - Rect * yesRect = (Rect*)(base + 0x6); - UInt8 * yesLen = (UInt8 *)(base + 0xF); - - Rect * noRect = (Rect*)(base + 0x14 + IncludePadByte(*yesLen)); - UInt8 * noLen = (UInt8 *)(base + 0x1D + IncludePadByte(*yesLen)); - Rect * editRect = (Rect*)(base + 0x22 + IncludePadByte(*yesLen) + IncludePadByte(*noLen)); - StTextState textState; - TextFont(0); - TextSize(12); - short height = UTextBox::TextBoxDialogHeight((char*)temp, temp.length(), editRect, - teForceLeft, 0); - if (height < 50) // Need to make place for the icon - height = 50; - editRect->bottom = editRect->top + height; - yesRect->top = editRect->bottom + 8; - yesRect->bottom = yesRect->top + 20; - noRect->top = editRect->bottom + 8; - noRect->bottom = noRect->top + 20; -// Get the window resource -// Strange thing here: after ALRT is called for the first time, -// altrRect gets altered. Its top/left are strange (>30000) -// So I reset them, and everything seems to work -// I bet that the toolbox guys are storing alert state in these - Rect * alrtRect = (Rect*)*alrt; - alrtRect->top = 185; - alrtRect->bottom = alrtRect->top+ yesRect->bottom + 8; - alrtRect->left = 185; - alrtRect->right = 590; -} - - // Displays a vanilla alert. All strings inside the alert are - // supplied by caller -void ErrorManager::PlainAlert(const CStr255& s1, const char * s2, const char * s3, const char * s4) -{ - if (sAlertApp != emSignature) - return; - if (!TryToInteract(900)) // If we time out, go away - return; - CStr255 S1(s1); - CStr255 S2(s2); - CStr255 S3(s3); - CStr255 S4(s4); - ConvertCRtoLF(S1); - ConvertCRtoLF(S2); - ConvertCRtoLF(S3); - ConvertCRtoLF(S4); - ParamText(S1, S2, S3, S4); - cstring temp; - temp += s1; - temp += s2; - temp += s3; - temp += s4; - ShrinkToFitAlertDialog(temp); - UDesktop::Deactivate(); - ::CautionAlert(ALRT_PlainAlert, NULL); - UDesktop::Activate(); -} - -void ErrorManager::PlainAlert( short resID ) -{ - InitializeStrings(); - - if (sAlertApp != emSignature) - return; - - CStr255 cstr[ 4 ]; - StringHandle strings[ 4 ]; - - if ( !TryToInteract(900)) - return; - - for ( short i = 0; i <= 3; i++ ) - { - strings[ i ] = GetString( resID + i ); - if ( strings[ i ] ) - cstr[ i ] = **( (CStr255**)strings[ i ] ); - } - - ParamText( cstr[ 0 ], cstr[ 1 ], cstr[ 2 ], cstr[ 3 ] ); - cstring temp; - temp += cstr[ 0 ]; - temp += cstr[ 1 ]; - temp += cstr[ 2 ]; - temp += cstr[ 3 ]; - ShrinkToFitAlertDialog(temp); // Size the dalog - UDesktop::Deactivate(); - ::CautionAlert( ALRT_PlainAlert, NULL ); - UDesktop::Activate(); -} - -// Displays a yes or no alert. All strings inside the alert are -// supplied by caller -Boolean ErrorManager::PlainConfirm(const char * s1, const char * s2, const char * s3, const char * s4) -{ - if (sAlertApp != emSignature) - return FALSE; - - if (!TryToInteract(900)) // If we time out, go away - return false; - CStr255 S1(s1); - CStr255 S2(s2); - CStr255 S3(s3); - CStr255 S4(s4); - ConvertCRtoLF(S1); - ConvertCRtoLF(S2); - ConvertCRtoLF(S3); - ConvertCRtoLF(S4); - - // pkc (6/6/96) Hack to stuff s1 into CStr255's if it's the - // only string passed in. - if( S1.Length() < strlen(s1) && s2 == NULL ) - { - int storedLength = S1.Length(); - S2 += (s1 + storedLength); - ConvertCRtoLF(S2); - storedLength += S2.Length(); - if( storedLength < strlen(s1) ) - { - S3 += (s1 + storedLength); - ConvertCRtoLF(S3); - storedLength += S3.Length(); - if( storedLength < strlen(s1) ) - { - S4 += (s1 + storedLength); - ConvertCRtoLF(S4); - } - } - } - - cstring temp; - temp += s1; - temp += s2; - temp += s3; - temp += s4; - ParamText(S1, S2, S3, S4); - ShrinkToFitYorNDialog(temp); - UDesktop::Deactivate(); - int confirm = ::CautionAlert(ALRT_YorNAlert, NULL); - UDesktop::Activate(); - return (confirm == 1); -} - -void ErrorManager::ErrorNotify(OSErr err, const CStr255& message) -{ - if (sAlertApp != emSignature) - return; - CStr255 errNum; - - OSNumToStr(err, errNum); - PlainAlert(message, errNum); -} - -//---------------------------------------------------------------------------------------- -static void XPStringsNotFoundAlert() -//---------------------------------------------------------------------------------------- -{ - Str255 stringsFileName; - - GetIndString(stringsFileName, 14000, 2); // From Bootstrap.rsrc. - ParamText(stringsFileName, NULL, NULL, NULL); - Alert (14003, NULL); - ExitToShell(); -} - -char * XP_GetBuiltinString(long i); - -//---------------------------------------------------------------------------------------- -char * XP_GetString( int xpStringID ) -//---------------------------------------------------------------------------------------- -{ - /* - // Add the offset (the one added by the perl script) but leave it as 32 bits, so - // we can check the range. - int32 resID = xpStringID + RES_OFFSET; - // Check for wraparound. If this happens, some xp person has started to use some - // range of values that we can't handle. See also my comment at the top of - // allxpstr.h - jrm 98/04/01. - if (resID < 128 || resID > SHRT_MAX ) - { - XPStringsNotFoundAlert(); - } - // BEWARE! This calls CString::operator char*() const, - // which uses a stack of 8 static strings into which the - // C string is copied, and you are returned a pointer to - // one of these buffers. This result is volatile; 8 more - // calls of this operator will overwrite the string pointed - // to by the char* returned. - // You should call XP_STRDUP or otherwise store the string if you - // want it to persist - return GetCString(resID); - */ - - static char buf[128]; - static char strclass[128]; - char *ret; - char *type; - //XrmValue value; - - /* - (void) PR_snprintf(buf, sizeof (buf), - "%s.strings.%d", fe_progclass, xpStringID + RES_OFFSET); - (void) PR_snprintf(strclass, sizeof (strclass), - "%s.Strings.Number", fe_progclass); - if (fe_display && ((database = XtDatabase(fe_display))) && - XrmGetResource(database, buf, strclass, &type, &value)) - { - return value.addr; - } - - if ((ret = mcom_cmd_xfe_xfe_err_h_strings (i + RES_OFFSET))) - { - return ret; - } - */ - return XP_GetBuiltinString((long)xpStringID); - -} - -extern "C" char * mcom_include_merrors_i_strings (long); -extern "C" char * mcom_include_secerr_i_strings (long); -extern "C" char * mcom_include_sec_dialog_strings(long); -extern "C" char * mcom_include_sslerr_i_strings (long); -extern "C" char * mcom_include_xp_error_i_strings(long); -extern "C" char * mcom_include_xp_msg_i_strings (long); - -char * XP_GetBuiltinString(long i); -//---------------------------------------------------------------------------------------- -char * -XP_GetBuiltinString(long i) -//---------------------------------------------------------------------------------------- -{ - static char buf[128]; - char *ret; - - i += RES_OFFSET; - if - ( - ((ret = (mcom_include_merrors_i_strings (i)) )) || - ((ret = (mcom_include_secerr_i_strings (i)) )) || - ((ret = (mcom_include_sec_dialog_strings(i)) )) || - ((ret = (mcom_include_sslerr_i_strings (i)) )) || - ((ret = (mcom_include_xp_error_i_strings(i)) )) || - ((ret = (mcom_include_xp_msg_i_strings (i)) )) - ) - { - return ret; - } - (void) sprintf(buf, "XP_GetBuiltinString: %d not found", i); - - return buf; -} - -//----------------------------------- -static void InitializeStrings() -//----------------------------------- -{ - /* - static Boolean initialized = false; - if (initialized) - return; - - initialized = true; - - // Locate and load all the XP string resources - // in the "Netscape Resources" file - // inside the "Essential Files" folder. - - FSSpec stringsFolderSpec; - - if (FindGutsFolder(&stringsFolderSpec) != noErr) - XPStringsNotFoundAlert(); - - CInfoPBRec pb; - - pb.dirInfo.ioNamePtr = stringsFolderSpec.name; - pb.dirInfo.ioVRefNum = stringsFolderSpec.vRefNum; - pb.dirInfo.ioFDirIndex = 0; - pb.dirInfo.ioDrDirID = stringsFolderSpec.parID; - - if (PBGetCatInfoSync(&pb) != noErr) - XPStringsNotFoundAlert(); - - Str255 stringFileName; - GetIndString(stringFileName, 14000, 2); - - FSSpec stringsFileSpec; - if (FSMakeFSSpec(pb.dirInfo.ioVRefNum, pb.dirInfo.ioDrDirID, - stringFileName, &stringsFileSpec) != noErr) - XPStringsNotFoundAlert(); - - short currentFileRefNum = CurResFile(); - short stringsFileRefNum = FSpOpenResFile(&stringsFileSpec, fsCurPerm); - - if (ResError() != noErr) - XPStringsNotFoundAlert(); - - MoveResourceMapBelowApp(); - - UseResFile(currentFileRefNum); - */ -} // InitializeStrings - -void MoveResourceMapBelowApp() -{ -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=mac68k -#else -#error "There'll probably be a bug here." -#endif - - // Partial definition of "private" Resource Manager structure. - struct ResourceMap - { - char header[16]; - ResourceMap **next; - short fileRefNum; - }; - -#if PRAGMA_ALIGN_SUPPORTED -#pragma options align=reset -#endif - - short applicationRefNum = LMGetCurApRefNum(); - ResourceMap **stringsFileMap = (ResourceMap **)LMGetTopMapHndl(); - - // Find the application's resource map. - for (ResourceMap **map = stringsFileMap; map; map = (*map)->next) - { - if ((*map)->fileRefNum == applicationRefNum) - { - // Move the strings file below the application - // in the current resource chain. - // (Kids, don't do this at home!) - ResourceMap **top = (*stringsFileMap)->next; - LMSetTopMapHndl((Handle)top); - LMSetCurMap((*top)->fileRefNum); - (*stringsFileMap)->next = (*map)->next; - (*map)->next = stringsFileMap; - break; - } - } -} - -//----------------------------------- -char* GetCString( short resID ) -//----------------------------------- -{ - CStr255 pstring = GetPString(resID); - return (char*)pstring; // BEWARE! This calls CString::operator char*() const, - // which uses a stack of 8 static strings into which the - // C string is copied, and you are returned a pointer to - // one of these buffers. This result is volatile; 8 more - // calls of this operator will overwrite the strings pointed - // to by the char* returned. -} // GetCString - -//----------------------------------- -CStr255 GetPString( ResIDT resID ) -//----------------------------------- -{ - InitializeStrings(); - StringHandle sh = GetString( resID ); - if (sh && *sh) - { - //StHandleLocker aLock((Handle)sh); // (probably) not necessary, hence removed - CStr255 fullResult(*sh); - return fullResult; - } - - CStr255 emptyResult; // initialized to empty by constructor. - return emptyResult; // This copies the string to the caller's string. -} // GetPString - -char * INTL_ResourceCharSet(void) -{ - char *cbuf; - cbuf = (char *)GetCString(CHARSET_RESID); - if (cbuf[0] == '\0') - return "x-mac-roman"; - return cbuf; -} diff --git a/mozilla/cmd/macfe/central/macfeprefs.h b/mozilla/cmd/macfe/central/macfeprefs.h deleted file mode 100644 index 4704347623d..00000000000 --- a/mozilla/cmd/macfe/central/macfeprefs.h +++ /dev/null @@ -1,28 +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. - */ - -#include -#include "prtypes.h" - -NSPR_BEGIN_EXTERN_C - -extern OSErr FindGutsFolder(FSSpec* outSpec); -extern OSErr FindNetscapeFolder(FSSpec* outSpec); -extern OSErr FindJavaDownloadsFolder(FSSpec *outSpec); - -NSPR_END_EXTERN_C diff --git a/mozilla/cmd/macfe/central/mactime.c b/mozilla/cmd/macfe/central/mactime.c deleted file mode 100755 index 3a3f34eee8a..00000000000 --- a/mozilla/cmd/macfe/central/mactime.c +++ /dev/null @@ -1,181 +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. - */ - -#include -#include "xp_mcom.h" - -/* Note that the ordering of the '#include "xp_mcom.h"' and the '#undef ctime' is - important. xp_mcom.h defines ctime as Macctime. Macctime calls ctime. The result - was endless recursion. -km */ - -#ifdef mktime -#undef mktime -#undef ctime -#undef localtime -__extern_c /* declarations */ -time_t mktime(struct tm *); -char *ctime(const time_t *); -struct tm *localtime(const time_t *); -__end_extern_c -#endif - - -// Because serial port and SLIP conflict with ReadXPram calls, -// we cache the call here so we don't hang on calling ReadLocation() -void MyReadLocation(MachineLocation * loc); - -long GMTDelta(); -Boolean DaylightSaving(); -time_t GetTimeMac(); -time_t Mactime(time_t *timer); -time_t Macmktime (struct tm *timeptr); -char * Macctime(const time_t * t); -struct tm *Macgmtime (const time_t *clock); - - -void MyReadLocation(MachineLocation * loc) -{ - static MachineLocation storedLoc; // InsideMac, OSUtilities, page 4-20 - static Boolean didReadLocation = FALSE; - if (!didReadLocation) - { - ReadLocation(&storedLoc); - didReadLocation = TRUE; - } - *loc = storedLoc; -} - -Boolean DaylightSaving() -{ - MachineLocation loc; - unsigned char dlsDelta; - MyReadLocation(&loc); - dlsDelta = loc.u.dlsDelta; - return (dlsDelta != 0); -} - - -// We need to do this, because we wrap localtime as a macro in -#ifdef localtime -#undef localtime -#endif - -// current local time = GMTDelta() + GMT -// GMT = local time - GMTDelta() -long GMTDelta() -{ - MachineLocation loc; - long gmtDelta; - - MyReadLocation(&loc); - gmtDelta = loc.u.gmtDelta & 0x00FFFFFF; - if ((gmtDelta & 0x00800000) != 0) - gmtDelta |= 0xFF000000; - return gmtDelta; -} - - -// This routine simulates stdclib time(), time in seconds since 1.1.1970 -// The time is in GMT -time_t GetTimeMac() -{ - unsigned long maclocal; - // Get Mac local time - GetDateTime(&maclocal); - // Get Mac GMT - maclocal -= GMTDelta(); - // return unix GMT - return (maclocal - UNIXMINUSMACTIME); -} - -// Returns the GMT times -time_t Mactime(time_t *timer) -{ - time_t t = GetTimeMac(); - if (timer != NULL) - *timer = t; - return t; -} - -time_t Macmktime (struct tm *timeptr) -{ - time_t theTime; - - // ¥¥¥ HACK to work around the bug in mktime - int negativeDiff = 0; - if (timeptr->tm_sec < 0) - { - negativeDiff += timeptr->tm_sec; - timeptr->tm_sec = 0; - } - if (timeptr->tm_min < 0) - { - negativeDiff += timeptr->tm_min*60; - timeptr->tm_min = 0; - } - if (timeptr->tm_hour < 0) - { - negativeDiff += timeptr->tm_hour*60*60; - timeptr->tm_hour = 0; - } - if (timeptr->tm_mday < 0) - { - negativeDiff += timeptr->tm_mday*60*60*24; - timeptr->tm_mday = 0; - } - - // local/Mac - theTime = mktime(timeptr); - // mktime does not care what the daylightsavings flag is - timeptr->tm_isdst = 0;//DaylightSavings(); - theTime += negativeDiff; - - // GMT/Mac - theTime -= GMTDelta(); - // unix/GMT - return theTime - UNIXMINUSMACTIME; -} - -// -char * Macctime(const time_t * t) -{ - // GMT Mac - time_t macTime = *t + UNIXMINUSMACTIME; - // local Mac - macTime += GMTDelta(); - - return ctime(&macTime); -} - -struct tm *Maclocaltime(const time_t * t) -{ - // GMT Mac - time_t macLocal = *t + UNIXMINUSMACTIME; - // local Mac - macLocal += GMTDelta(); - return localtime(&macLocal); -} - -// -> unix GMT -struct tm *Macgmtime (const time_t *clock) -{ - // GMT Mac - time_t macGMT = *clock + UNIXMINUSMACTIME; - return localtime(&macGMT); -} - diff --git a/mozilla/cmd/macfe/central/mattach.cp b/mozilla/cmd/macfe/central/mattach.cp deleted file mode 100644 index edd46c4308f..00000000000 --- a/mozilla/cmd/macfe/central/mattach.cp +++ /dev/null @@ -1,987 +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. - */ - -#include "mattach.h" - -// PowerPlant -#include - -// macfe -#include "ufilemgr.h" -#include "macutil.h" -#include "miconutils.h" -#include "resgui.h" -#include "uapp.h" -#include "msgcom.h" -#include "uerrmgr.h" -#include "ufilemgr.h" -#include "uprefd.h" -#include "CBrowserWindow.h" -#include "CBrowserContext.h" -#include "UModalDialogs.h" -#include "LGAEditField.h" -// For TEXT_PLAIN -#include "net.h" - - -#define msg_SelectionChanged 'sele' - - -CMailAttachment::CMailAttachment() -: fDesiredType(nil) -, fRealType(nil) -, fRealName(nil) -, fDescription(nil) -, fAttachmentIcon(nil) -, fSelected(false) -, fFileType('TEXT') -, fFileCreator('????') -{ - fURL = nil; -} - -CMailAttachment::CMailAttachment(const FSSpec & spec) -: fDesiredType(nil) -, fRealType(nil) -, fSelected(false) -, fRealName(nil) -, fDescription(nil) -, fAttachmentIcon(nil) // init in case we throw -, fFileType('TEXT') -, fFileCreator('????') -{ - // aliases have already been resolved by now - FInfo finderInfo; - - OSErr err = ::FSpGetFInfo( &spec, &finderInfo); - ThrowIfOSErr_(err); - - fFileType = finderInfo.fdType; - fFileCreator = finderInfo.fdCreator; - - fURL = CFileMgr::GetURLFromFileSpec(spec); - - fAttachmentIcon = new CAttachmentIcon(fFileCreator, fFileType, CAttachmentIcon::kIconSizeSmall); - - ComposeDescription(); -} - -CMailAttachment::CMailAttachment(const char * url, const char * mimeType, const char * realType, const char * realName) -: fDescription(nil) -{ - fURL = (char *)url; - fDesiredType = (char *)mimeType; - fRealType = (char *)realType; - fRealName = (char *)realName; - fSelected = FALSE; - - // ¥¥¥ FIX ME: LAME - fFileType = 'TEXT'; - fFileCreator = 'MOSS'; - - // can't we get some data from the url? - - fAttachmentIcon = new CAttachmentIcon(fRealType, CAttachmentIcon::kIconSizeSmall); -} - -CMailAttachment::CMailAttachment(const MSG_AttachmentData * attachmentData) -{ - //memset(this, 0, sizeof(CMailAttachment)); - fURL = attachmentData->url ? XP_STRDUP(attachmentData->url) : nil; - fDesiredType = attachmentData->desired_type ? XP_STRDUP(attachmentData->desired_type) : nil; - fRealType = attachmentData->real_type ? XP_STRDUP(attachmentData->real_type) : nil; - fRealName = attachmentData->real_name ? XP_STRDUP(attachmentData->real_name) : nil; - - fDescription = attachmentData->description ? XP_STRDUP(attachmentData->description) : nil; - - // let's try really hard to get correct type/creator data - if (attachmentData->x_mac_creator && attachmentData->x_mac_type) - { - // creator and type are 8-byte hex representations... - sscanf(attachmentData->x_mac_creator, "%X", &fFileCreator); - sscanf(attachmentData->x_mac_type, "%X", &fFileType); - - fAttachmentIcon = new CAttachmentIcon(fFileCreator, fFileType, CAttachmentIcon::kIconSizeSmall); - } - else if (fRealType != NULL) - { - // find a MIME mapper for this - CMimeMapper *thisMapper = CPrefs::sMimeTypes.FindMimeType( fRealType ); - - if (thisMapper) - { - fFileType = thisMapper->GetDocType(); - fFileCreator = thisMapper->GetAppSig(); - - fAttachmentIcon = new CAttachmentIcon(fFileCreator, fFileType, CAttachmentIcon::kIconSizeSmall); - } - else - { - fFileType = 'TEXT'; - fFileCreator = '????'; - - fAttachmentIcon = new CAttachmentIcon(fRealType, CAttachmentIcon::kIconSizeSmall); - } - } - else - { - fAttachmentIcon = new CAttachmentIcon(fRealType, CAttachmentIcon::kIconSizeSmall); - } - -} - - -// copy constructor -CMailAttachment::CMailAttachment( const CMailAttachment& inOriginal ) -{ - fURL = inOriginal.fURL ? XP_STRDUP(inOriginal.fURL) : nil; - fDesiredType = inOriginal.fDesiredType ? XP_STRDUP(inOriginal.fDesiredType) : nil; - fFileType = inOriginal.fFileType; - fFileCreator = inOriginal.fFileCreator; - - // copy the icon with its copy constructor, which duplicates the suite handle - fAttachmentIcon = new CAttachmentIcon( *inOriginal.fAttachmentIcon); -} - - -void CMailAttachment::FreeMembers() -{ - if (fURL) XP_FREE(fURL); fURL = nil; - if (fDesiredType) XP_FREE(fDesiredType); fDesiredType = nil; - if (fRealType) XP_FREE(fRealType); fRealType = nil; - if (fRealName) XP_FREE(fRealName); fRealName = nil; - if (fDescription) XP_FREE(fDescription); fDescription = nil; - - delete fAttachmentIcon; - fAttachmentIcon = NULL; -} - -CStr255 CMailAttachment::UrlText() -{ - CStr255 text; - if ( fURL && NET_IsLocalFileURL(fURL) ) - { - cstring tmp = CFileMgr::FileNameFromURL ( fURL ); - NET_UnEscape(tmp); - text = tmp; - } - else - { - text = fURL; // Default - if (fURL) // Messages get special cased - if ((XP_STRNCASECMP(fURL, "snews:",6) == 0) || - (XP_STRNCASECMP(fURL, "news:",5) == 0)) - text = GetPString(ATTACH_NEWS_MESSAGE); - else if (XP_STRNCASECMP(fURL, "mailbox:",8) == 0) - text = GetPString(ATTACH_MAIL_MESSAGE); - } - return text; -} - - -void -CMailAttachment::ComposeDescription() -{ - if (fFileCreator == '????' || fDescription != nil) - return; - - OSErr err = noErr; - Str255 appName = "\pUnknown"; - char *suffix; - UInt32 suffixLen; - UInt32 descriptionLen; - - Try_ - { - /* This code would fail if an intermediate volume (e.g. floppy) had no DT database - for (short vRefNum = -1; ; vRefNum --) - { - pb.ioVRefNum = vRefNum; - pb.ioNamePtr = nil; - err = ::PBDTGetPath(&pb); // sets dt ref num in pb - if (err != noErr) - break; - - pb.ioCompletion = nil; - pb.ioNamePtr = appName; - pb.ioIndex = 0; - pb.ioFileCreator= fFileCreator; - err = ::PBDTGetAPPLSync(&pb); - if (err == noErr) - break; - } - ThrowIfOSErr_(err); - */ - FSSpec appSpec = {0}; - - err = CFileMgr::FindApplication(fFileCreator, appSpec); - if (err != noErr) - *(CStr63 *)&appName = appSpec.name; - - suffix = (fFileType == 'APPL') ? nil : suffix = GetCString(DOCUMENT_SUFFIX); - suffixLen = (suffix != nil) ? strlen(suffix) + 1 : 0; // + 1 for space and - - // + 1 for terminator, space is taken care of in suffixLen - descriptionLen = appName[0] + 1; - if (suffix != nil) descriptionLen += suffixLen; - - fDescription = (char *) XP_ALLOC(descriptionLen); - ThrowIfNULL_(fDescription); - - if (suffix != nil) - { - p2cstr(appName); - sprintf(fDescription, "%s %s", (char *) appName, suffix); - } - else - { - ::BlockMoveData(&appName[1], fDescription, appName[0]); - fDescription[appName[0]] = '\0'; - } - } - Catch_(errNum) - { - XP_FREEIF(fDescription); - fDescription = nil; - } - EndCatch_ -} - - -#pragma mark - - -// -// class CAttachmentList -// - -CAttachmentList::CAttachmentList() : LArray(sizeof(CMailAttachment)) -{ -} - -CAttachmentList::~CAttachmentList() -{ - CMailAttachment attach; - LArrayIterator iter(*this); - while (iter.Next(&attach)) - attach.FreeMembers(); -} - -// Clones the list, and its elements -CAttachmentList * CAttachmentList::Clone(CAttachmentList * cloneList) -{ - CAttachmentList * newList = new CAttachmentList; - ThrowIfNil_(newList); - if (cloneList != NULL) // Duplicate all the members of a list - { - LArrayIterator iter(*cloneList); - - CMailAttachment attach; - - while (iter.Next(&attach)) - { - CMailAttachment newAttach(attach); // copy constructor - - newList->InsertItemsAt(1, 10000, &newAttach); - } - } - return newList; -} - -void CAttachmentList::RemoveItemsAt(Uint32 inCount, Int32 inAtIndex) -{ - CMailAttachment attach; - for (int i =0; iSelectItem( dummy, cell, refresh ); -} - -void CAttachmentView::SetAttachList(CAttachmentList * list) -{ - mAttachList = list; - SyncDisplay(mAttachList ? mAttachList->GetCount() : 0); - - // Select the first item in the list - if (mAttachList != nil) - SelectItem(1, TRUE); // tj -} - -Boolean CAttachmentView::GetSelectedAttachment(CMailAttachment &attach) -{ - UInt32 cell = FirstSelectedCell(); - if (cell > 0) - { - mAttachList->FetchItemAt(cell, &attach); - return TRUE; - } - else - return false; -} - - -void CAttachmentView::AddMailAttachment(CMailAttachment * attach, Boolean refresh) -{ - XP_ASSERT( mAttachList); - - // Insert after the first selected cell, - // if none, the end of the list - UInt32 cell = FirstSelectedCell(); - if (cell == 0) - cell = mAttachList->GetCount() + 1; - else - cell++; - - mAttachList->InsertItemsAt(1, cell, attach); - SelectItem( cell, TRUE ); - if (refresh) - Refresh(); - SyncDisplay(mAttachList->GetCount()); - - if (mNotifyAttachmentChanges) - BroadcastMessage(msg_AttachmentsAdded, this); -} - -void CAttachmentView::ModifyMailAttachment(Int32 cell, CMailAttachment * attach, Boolean refresh) -{ - CMailAttachment dummy; - if (cell == SELECTED_CELL) - cell = FirstSelectedCell(); - - XP_ASSERT(mAttachList->FetchItemAt(cell, &attach)); - - mAttachList->AssignItemsAt(1, cell, &attach); - if (refresh) - Refresh(); -} - -void CAttachmentView::SetMimeType(char * type) -{ - Boolean needRefresh = false; - LArrayIterator iter(*mAttachList); - CMailAttachment attach; - - for (int i=1; i<= mAttachList->GetCount(); i++) - { - if (mAttachList->FetchItemAt(i, &attach)) - { - if ( attach.fSelected ) - { - if (attach.fDesiredType != nil) - XP_FREE(attach.fDesiredType); - - if (type) - attach.fDesiredType = XP_STRDUP(type); - else - attach.fDesiredType = nil; - - mAttachList->AssignItemsAt(1, i, &attach); - - needRefresh = true; - } - } - } - - if (needRefresh) - Refresh(); -} - -void CAttachmentView::AddFile(const FSSpec& spec) -{ - if (CmdPeriod()) // If we drop the whole HD, allow bailout - return; - - // resolve if alias - FSSpec theFileSpec = spec; - Boolean wasFolder, wasAliased; - - OSErr err = ::ResolveAliasFile( &theFileSpec, true, &wasFolder, &wasAliased); - ThrowIfOSErr_(err); - - if (CFileMgr::IsFolder(theFileSpec)) - { - FSSpec newSpec; - FInfo dummy; - Boolean dummy2; - CFileIter iter(theFileSpec); - while (iter.Next(newSpec, dummy, dummy2)) - AddFile(newSpec); - } - else - { - CMailAttachment attach(theFileSpec); - AddMailAttachment(&attach, false); - } - Refresh(); -} - -void CAttachmentView::DeleteSelection(Boolean refresh) -{ - CMailAttachment attach; - LArrayIterator iter(*mAttachList); - Boolean needRefresh = false; - Int32 itemToSelect = 0; - - while (iter.Next(&attach)) - { - if (attach.fSelected) - { - needRefresh = TRUE; - itemToSelect = mAttachList->FetchIndexOf(&attach); - mAttachList->Remove(&attach); - } - } - if (itemToSelect != 0) - SelectItem(itemToSelect, TRUE); - if (refresh && needRefresh) - Refresh(); - if (needRefresh) - BroadcastMessage(msg_SelectionChanged, nil); - if (needRefresh) - SyncDisplay(mAttachList->GetCount()); - - - if (mNotifyAttachmentChanges) - BroadcastMessage(msg_AttachmentsRemoved, this); -} - -Boolean CAttachmentView::SyncDisplay( UInt32 visCells ) -{ - return LFinderView::ResizeTo( fCellHeight * visCells, mImageSize.width ); -} - -void CAttachmentView::DrawCellColumn( UInt32 cell, UInt16 /*column*/ ) -{ - CStr255 text; - TruncCode trunc; - Style textStyle; - - if (mAttachList) - { - CMailAttachment thisAttachment; - - if (mAttachList->FetchItemAt(cell, &thisAttachment)) - { - Rect theRect; - - CellText( cell, text ); - - // ¥ plot icon - GetIconRect( cell, theRect ); - ::OffsetRect(&theRect, 2, 2); - - IconTransformType iconTransform = (IsCellSelected( cell ) && mActive == triState_On) ? kTransformSelected : kTransformNone; - thisAttachment.fAttachmentIcon->PlotIcon(theRect, atHorizontalCenter | atVerticalCenter,iconTransform ); - - //DrawIcon( thisAttachment.fAttachmentIcon.GetSuiteHandle(), IsCellSelected( cell ) && ( mActive == triState_On ), theRect ); - - // ¥ plot text - textStyle = CellTextStyle( cell ); - ::TextFace( textStyle ); - - GetTextRect( cell, theRect ); - ::OffsetRect(&theRect, 2, 2); - - trunc = ColumnTruncationStyle( 0 ); - DrawText( CellTextStyle( cell ) , text, theRect, trunc ); - } - } -} - - -Boolean CAttachmentView::IsCellSelected( Int32 cell ) -{ -// XP_ASSERT( mAttachList); - if (mAttachList) - { - CMailAttachment attach; - if (mAttachList->FetchItemAt(cell, &attach)) - return attach.fSelected; - else - return false; - } - else - return false; -} - -void CAttachmentView::CellText( Int32 cell, CStr255& text ) -{ -// XP_ASSERT( mAttachList); - if (mAttachList) - { - CMailAttachment attach; - if (mAttachList->FetchItemAt(cell, &attach)) - text = attach.UrlText(); - else - #ifdef DEBUG - text = "What's up"; - #else - text = CStr255::sEmptyString; - #endif - } -} - -void CAttachmentView::GetTextRect( UInt32 cell, Rect& where ) -{ - where.top = ( ( cell - 1 ) * fCellHeight ) + - mPortOrigin.v + mImageLocation.v; - where.bottom = where.top + fCellHeight; - where.left = ( this->CellIndentLevel( cell ) * LEVEL_OFFSET ) + - mPortOrigin.h + mImageLocation.h + ICON_WIDTH; - - CStr255 text; - - CellText(cell, text); - where.right = where.left + StringWidth(text) + 4; - // where.right = where.left + mImageSize.width; -} - -void CAttachmentView::GetIconRect( UInt32 cell, Rect& where ) -{ - where.top = ( ( cell - 1 ) * fCellHeight ) + mPortOrigin.v + mImageLocation.v; - where.bottom = where.top + ICON_HEIGHT; - where.left = ( this->CellIndentLevel( cell ) * LEVEL_OFFSET ) + - + mPortOrigin.h + mImageLocation.h; - where.right = where.left + ICON_WIDTH; -} - -void CAttachmentView::GetWiglyRect( UInt32 /*cell*/, Rect& rect ) -{ - rect.top = rect.bottom = rect.left = rect.right = 0; -} - -void CAttachmentView::SelectItem( const EventRecord& event, UInt32 cell, Boolean refresh ) -{ - Boolean shift = ( event.modifiers & shiftKey ) != 0; - - if ( !shift ) - ClearSelection(); - - CMailAttachment attach; - if (mAttachList->FetchItemAt(cell, &attach)) - { - if ( !shift ) - attach.fSelected = TRUE; - else - attach.fSelected = !attach.fSelected; - - if (attach.fSelected) - mSelectedItemCount++; - else - mSelectedItemCount--; - - mAttachList->AssignItemsAt(1, cell, &attach); - } - - BroadcastMessage(msg_SelectionChanged, nil); - - if (refresh) - Refresh(); -} - -void CAttachmentView::ClearSelection() -{ -// XP_ASSERT(mAttachList); - if (mAttachList) - { - CMailAttachment attach; - int i=1; - while (mAttachList->FetchItemAt(i, &attach)) - { - if (attach.fSelected) - { - attach.fSelected = false; - mAttachList->AssignItemsAt(1, i, &attach); - - RefreshCells(i, i, false); - } - - i++; - } - - } - mSelectedItemCount = 0; -} - -UInt32 CAttachmentView::GetVisibleCount() -{ -// XP_ASSERT(mAttachList != nil); - if (mAttachList) - return mAttachList->GetCount(); - else - return 0; -} - -UInt32 CAttachmentView::FirstSelectedCell() -{ - CMailAttachment attach; - if (!mAttachList) - return 0; - - LArrayIterator iter(*mAttachList); - int i = 0; - while (iter.Next(&attach)) - { - i++; - if (attach.fSelected) - return i; - } - return 0; -} - -Boolean CAttachmentView::HandleKeyPress( const EventRecord& inEvent ) -{ - Char16 key = inEvent.message; - Char16 character = key & charCodeMask; - switch ( character ) - { - case char_Backspace: - case char_FwdDelete: - DeleteSelection(); - return TRUE; - default: - return LFinderView::HandleKeyPress( inEvent ); - } - return false; -} - -Boolean CAttachmentView::ItemIsAcceptable( DragReference inDragRef, - ItemReference inItemRef ) -{ - FlavorFlags flavorFlags; - - if (::GetFlavorFlags( inDragRef, inItemRef, flavorTypeHFS, &flavorFlags) == noErr) - return true; - - - return (::GetFlavorFlags(inDragRef, inItemRef, 'TEXT', &flavorFlags) == noErr); -} - -void -CAttachmentView::DoDragReceive(DragReference inDragRef) -{ - Boolean saveFlag; - Boolean success = false; // so we don't broadcast if it fails - saveFlag = mNotifyAttachmentChanges; - mNotifyAttachmentChanges = false; - Try_ - { - // Put this in a try block, because this is called - // from the Finder! So it fixes bug with nasty hang attaching certain files. - LFinderView::DoDragReceive(inDragRef); - success = true; - } - Catch_(err) - { - } - EndCatch_ - mNotifyAttachmentChanges = saveFlag; - - if (success & saveFlag) - BroadcastMessage(msg_AttachmentsAdded, this); -} - - -void CAttachmentView::ReceiveDragItem( DragReference inDragRef, - DragAttributes /*flags*/, - ItemReference inItemRef, - Rect& /*itemBounds*/) -{ - OSErr err; - HFSFlavor itemFile = {0}; - Size itemSize = sizeof(itemFile); - - ClearSelection(); - - // Get the HFS data - err = ::GetFlavorData( inDragRef, inItemRef, flavorTypeHFS, &itemFile, &itemSize, 0); - if (err == noErr) - AddFile(itemFile.fileSpec); - else if (err == badDragFlavorErr ) - { - err = GetHFSFlavorFromPromise (inDragRef, inItemRef, &itemFile, true); - if( err == noErr ) - AddFile( itemFile.fileSpec ); - else - { - char *url = nil; - itemSize = 0; - - err = GetFlavorDataSize(inDragRef, inItemRef, 'TEXT', &itemSize); - if (err == noErr) - { - char *title; - - url = (char *) XP_ALLOC(itemSize+1); ThrowIfNil_(url); - err = ::GetFlavorData( inDragRef, inItemRef, 'TEXT', url, &itemSize, 0); - url[itemSize] = '\0'; - - if (err == noErr) - { - title = strchr(url, '\r'); - if (title != nil) - *title = '\0'; - - CMailAttachment attach(url, nil, nil, nil); - AddMailAttachment(&attach, false); - } - } - } - // Back to PP - ThrowIfOSErr_(err); - } -} - -void CAttachmentView::TakeOffDuty() -{ - if (mAttachList != nil) - LFinderView::TakeOffDuty(); -} - -void CAttachmentView::InsideDropArea( DragReference /*inDragRef*/ ) -{ - // don't do the Finder insert highlighting -} - - -void CAttachmentView::ListenToMessage(MessageT inMessage, void* ioParam) -{ - switch(inMessage) - { - case msg_AttachFile: - StandardFileReply myReply; - SFTypeList dummy; - Point myPoint; - ::SetPt(&myPoint,-1,-1); // Center window - UDesktop::Deactivate(); // Always bracket this - CustomGetFile ( nil, -1, dummy, &myReply, kSFAttachFile, myPoint, - nil, nil, nil, nil, nil); - UDesktop::Activate(); - if (myReply.sfGood) - AddFile(myReply.sfFile); - break; - - case msg_AttachWeb: - AddWebPageWithUI((unsigned char *)ioParam); - break; - - case msg_RemoveAttach: - DeleteSelection(); - break; - - default: - break; - } -} - -void CAttachmentView::AddWebPageWithUI(unsigned char *defaultText) -{ - // Put up dialog - StDialogHandler handler(10616, nil); - // Select the "URL" edit field - LWindow* dialog = handler.GetDialog(); - LGAEditField *urlfield = (LGAEditField*)dialog->FindPaneByID('edit'); - SignalIf_(!urlfield); - if (!urlfield) - return; - urlfield->SetDescriptor(defaultText); - urlfield->SelectAll(); - dialog->SetLatentSub(urlfield); - // Run the dialog - MessageT message; - - do { - message = handler.DoDialog(); - } while (message != msg_OK && message != msg_Cancel); - - // Use the result. - if (message == msg_OK) - { - CStr255 result; - char* url=nil; - urlfield->GetDescriptor(result); - if (result.Length() > 0) - { - url = (char*)XP_ALLOC(result.Length() + 1); - ThrowIfNULL_(result); - ::BlockMoveData(&result[1], url, result.Length()); - url[result.Length()] = '\0'; - } - CMailAttachment attach(url, nil, nil, nil); - AddMailAttachment(&attach, false); - } -}; - -void CAttachmentView::HiliteDropArea(DragReference inDragRef) -{ - Rect dropRect; - - mPane->CalcLocalFrameRect(dropRect); - //::InsetRect(&dropRect, -1, -1); - - RgnHandle dropRgn = ::NewRgn(); - ::RectRgn(dropRgn, &dropRect); - ::ShowDragHilite(inDragRef, dropRgn, true); - ::DisposeRgn(dropRgn); -} - - -Boolean -CAttachmentView::ProcessCommand(CommandT inCommand, void *ioParam) -{ - if (inCommand == msg_TabSelect) - return (GetVisibleCount() > 0); - else - return LFinderView::ProcessCommand(inCommand, ioParam); -} - - -void -CAttachmentView::BeTarget() -{ - if ( FirstSelectedCell() == 0) - { - if ( this->GetVisibleCount() > 0 ) - this->SelectItem( 1, TRUE ); - } -} - -void -CAttachmentView::AddDropAreaToWindow(LWindow* inWindow) -{ - if (!mCurrentlyAddedToDropList) - LDropArea::AddDropArea(this, inWindow->GetMacPort()); - mCurrentlyAddedToDropList = true; -} - -void -CAttachmentView::RemoveDropAreaFromWindow(LWindow* inWindow) -{ - if (mCurrentlyAddedToDropList) - LDropArea::RemoveDropArea(this, inWindow->GetMacPort()); - mCurrentlyAddedToDropList = false; -} diff --git a/mozilla/cmd/macfe/central/mattach.h b/mozilla/cmd/macfe/central/mattach.h deleted file mode 100644 index 763257fd39d..00000000000 --- a/mozilla/cmd/macfe/central/mattach.h +++ /dev/null @@ -1,160 +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. - */ - -#pragma once - -#include "mfinder.h" -#include "LArray.h" - -class CMailWindow; -class LWindow; -class CAttachmentIcon; -struct MSG_AttachmentData; - -/* CMailAttachment - * holds all the information about a single attachment - * list of these is kept inside a mail window - * Has to mirror MSG_AttachmentData struct in mime.h - */ -struct CMailAttachment -{ - char *fURL; - char *fDesiredType; - char *fRealType; /* The type of the URL if known, otherwise NULL */ - char *fRealName; /* Real name of the file */ - char *fDescription; - CAttachmentIcon *fAttachmentIcon; - Boolean fSelected; - OSType fFileType; - OSType fFileCreator; - - CMailAttachment(); - CMailAttachment( const CMailAttachment& inOriginal ); //copy constructor - CMailAttachment(const char * url, const char * mimeType = NULL, const char * realType = NULL, const char * realName = NULL); - CMailAttachment(const FSSpec & spec); - CMailAttachment(const MSG_AttachmentData * attachmentData); - - void FreeMembers(); - CStr255 UrlText(); - void ComposeDescription(); -}; - -/************************************************************************** - * class CAttachmentList - * holds a list of CMailAttachments - * When you delete a CMailAttachments item, it disposes of things that it - * points to. - * knows how to clone itself - **************************************************************************/ -class CAttachmentList : public LArray { -public: - -// constructors - CAttachmentList(); - virtual ~CAttachmentList(); - static CAttachmentList * Clone(CAttachmentList * cloneList); - -// LArray overrides - virtual void RemoveItemsAt(Uint32 inCount, Int32 inAtIndex); - -// ¥¥Êaccess - MSG_AttachmentData* NewXPAttachmentList(); // Creates an attachment list - void DeleteXPAttachmentList(MSG_AttachmentData* list); // Deletes the XP list - void InitializeFromXPAttachmentList(const MSG_AttachmentData* list); -}; - -/* ************************************************************************ - * CAttachmentView - * displays a list of attachments - * By default, our list is fully destroyed on termination - **************************************************************************/ -#define attachWindID 8002 -#define SELECTED_CELL -1 - -#define kSFAttachFile 146 -const MessageT msg_AttachFile = 'Atch'; -const MessageT msg_AttachWeb = 'AtWb'; -const MessageT msg_RemoveAttach = 'RmAt'; - -class CAttachmentView : public LFinderView, public LBroadcaster, public LListener { -public: - enum { class_ID = 'AtVw', msg_AttachmentsAdded = 'AttA', msg_AttachmentsRemoved = 'AttR' }; - -// ¥¥ constructors - CAttachmentView( LStream * inStream); - - virtual void FinishCreateSelf(); - -// ¥¥ access - void SetAttachList(CAttachmentList * list); - CAttachmentList * GetAttachList() {return mAttachList;} - Boolean GetSelectedAttachment(CMailAttachment &attach); - void AddMailAttachment(CMailAttachment * attach, Boolean refresh = true); - void ModifyMailAttachment(Int32 cell, // SELECTED_CELL for current selection - CMailAttachment * attach, - Boolean refresh); - void SetMimeType(char * type); - void AddWebPageWithUI(unsigned char *defaultText); - void AddFile(const FSSpec& spec); - void DeleteSelection(Boolean refresh = TRUE); - -// ¥¥ Finder view overrides - virtual void DrawCellColumn( UInt32 cell, UInt16 column ); - virtual Boolean SyncDisplay( UInt32 visCells ); - virtual Boolean IsCellSelected( Int32 cell ); - virtual ResIDT CellIcon( Int32 /* cell */ ) { return 133; } - virtual void CellText( Int32 cell, CStr255& text ); - virtual void GetTextRect( UInt32 cell, Rect& where ); - virtual void GetIconRect( UInt32 cell, Rect& where ); - virtual void GetWiglyRect( UInt32 cell, Rect& rect ); - virtual void SelectItem( const EventRecord& event, UInt32 cell, Boolean refresh ); - virtual void ClearSelection(); - virtual UInt32 GetVisibleCount(); - virtual UInt32 FirstSelectedCell(); - -// ¥¥ PP overrides - virtual Boolean HandleKeyPress( const EventRecord& inEvent ); - virtual Boolean ProcessCommand(CommandT inCommand, void *ioParam); - virtual void BeTarget(); - virtual void TakeOffDuty(); - virtual void ListenToMessage(MessageT inMessage, void* ioParam); -// ¥¥ drag'n'drop - virtual void InsideDropArea( DragReference inDragRef ); - virtual void HiliteDropArea(DragReference inDragRef); - - virtual Boolean ItemIsAcceptable(DragReference inDragRef, ItemReference inItemRef); - virtual void DoDragReceive(DragReference inDragRef); - virtual void ReceiveDragItem( DragReference inDragRef, - DragAttributes flags, - ItemReference inItemRef, - Rect& itemBounds); - // utility functions for new compose window because attach view - // is inside a tab switcher - void AddDropAreaToWindow(LWindow* inWindow); - void RemoveDropAreaFromWindow(LWindow* inWindow); - - inline UInt32 CountSelectedItems() { return mSelectedItemCount; } - -protected: - void SelectItem( UInt32 cell, Boolean refresh ); - - CAttachmentList * mAttachList; - UInt32 mSelectedItemCount; - Boolean mNotifyAttachmentChanges; - Boolean mCurrentlyAddedToDropList; -}; diff --git a/mozilla/cmd/macfe/central/mfinder.cp b/mozilla/cmd/macfe/central/mfinder.cp deleted file mode 100644 index e9f2546d465..00000000000 --- a/mozilla/cmd/macfe/central/mfinder.cp +++ /dev/null @@ -1,2068 +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. - */ - -#include "mfinder.h" -#include "macutil.h" -#include "miconutils.h" -#include "macgui.h" -#include "resgui.h" - -#include "UStdBevels.h" - -const Int32 kOutsideSlop = 0x80008000; - -extern void HiliteRect( const Rect& r ); - -// pkc (6/14/96) Set sTruncChar to 0 initially -static unsigned char sTruncChar = 0; - -LFinderHeader::LFinderHeader( LStream* inStream ): - LView( inStream ) -{ - fTextTraits = 130; - fFinder = NULL; -} - -void LFinderHeader::DrawColumn( UInt16 column ) -{ - CStr255 text; - Rect columnRect; - Style style; - - if ( fFinder ) - { - UGraphics::SetFore( CPrefs::Black ); - - ::PmBackColor(eStdGray86); - ::PenPat( &qd.black ); - - fFinder->GetColumnTitle( column, text ); - fFinder->GetColumnRect( 1, column, columnRect ); - columnRect.top = 0; - columnRect.bottom = mFrameSize.height; - if ( ( columnRect.right - columnRect.left ) > 2 ) - { - ::EraseRect( &columnRect ); - Rect tmp; - - tmp.top = columnRect.top; - tmp.right = columnRect.right - 2; - tmp.left = columnRect.left + 2; - tmp.bottom = columnRect.bottom; - - if ( text[ 1 ] == '#' ) - { - Int32 resID; - Handle iconSuite; - - myStringToNum( text, &resID ); - iconSuite = CIconList::GetIconSuite( resID ); - if ( iconSuite ) - { - tmp.right = tmp.left + 16; - if ( columnRect.right - columnRect.left > 16 ) - fFinder->DrawIcon( iconSuite, FALSE, tmp ); - } - } - else - { - style = fFinder->ColumnTextStyle( column ); - fFinder->DrawText( style, text, tmp, smTruncEnd, fTextTraits, tmp.bottom - 2 ); - } - FrameButton( columnRect, FALSE ); - } - } -} - -void LFinderHeader::DrawSelf() -{ - UInt16 columns; - - if ( !fFinder ) - return; - - columns = fFinder->GetNumberOfColumns(); - - UTextTraits::SetPortTextTraits( fTextTraits ); - - for ( UInt16 i = 0; i < columns; i++ ) - DrawColumn( i ); -} - -void LFinderHeader::ClickSelf( const SMouseDownEvent& where ) -{ - Int16 column; - - column = fFinder->InResizableColumnBar( where.whereLocal ); - - if ( column != NO_COLUMN ) - fFinder->TrackResizeColumn( where, 1, column ); - else - { - column = fFinder->InColumn( where.whereLocal ); - if ( column != NO_COLUMN ) - this->TrackReorderColumns( where, column ); - } -} - -void LFinderHeader::TrackReorderColumns( const SMouseDownEvent& where, - UInt16 column ) -{ - Point whereP; - Rect columnRect; - Rect viewRect; - RgnHandle myRgn; - Int16 delta; - Int32 result; - Int16 endColumn; - - if ( !this->FocusDraw() ) - return; - - whereP = where.whereLocal; - fFinder->GetColumnRect( 1, column, columnRect ); - this->CalcLocalFrameRect( viewRect ); - - if ( LDragAndDrop::DragAndDropIsPresent() && - ::WaitMouseMoved( where.macEvent.where ) ) - { - columnRect.top = viewRect.top++; - columnRect.bottom = viewRect.bottom--; - myRgn = ::NewRgn(); - ::RectRgn( myRgn, &columnRect ); - - result = ::DragGrayRgn( myRgn, whereP, - &viewRect, &viewRect, hAxisOnly, NULL ); - - ::DisposeRgn( myRgn ); - - delta = LoWord( result ); - if ( ( result == kOutsideSlop ) || ( delta == 0 ) ) - return; - - whereP.h += delta; - endColumn = fFinder->InColumn( whereP ); - if ( endColumn != NO_COLUMN && endColumn != column ) - fFinder->SwapColumns( endColumn, column ); - } - else - fFinder->SortByColumnNumber( column, (where.macEvent.modifiers & optionKey) != 0 ); -} - -void LFinderHeader::AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ) -{ - Int16 i; - - PortToLocalPoint( inPortPt ); - i = fFinder->InResizableColumnBar( inPortPt ); - - if ( i != NO_COLUMN ) - ::SetCursor( *(::GetCursor( curs_HoriDrag ) ) ); - else - LView::AdjustCursorSelf( inPortPt, inMacEvent ); -} - - - - -LFinderView::LFinderView( LStream* inStream ): - LView( inStream ), - LDragAndDrop( GetMacPort(), this ) -{ - fTextTraits = 130; - for ( long i = 0; i < NUM_COLUMNS; i++ ) - { - fColumnOffsets[ i ] = 0; - fColumnIDs[ i ] = 0; - } - - fNumberColumns = 1; - fClipImage = FALSE; - fAllowsRectSelection = TRUE; - fAllowsKeyNavigation = TRUE; - fHighlightRow = TRUE; - fHeader = NULL; - fForeColor.red = fForeColor.green = fForeColor.blue = 0x0000;// black - fBackColor.red = fBackColor.green = fBackColor.blue = 0xFFFF;// white - this->CaculateFontRect(); -} - -void LFinderView::CaculateFontRect() -{ - FontInfo fontInfo; - UInt16 fontHeight; - - SafeGetFontInfo( fTextTraits, fontInfo); - fontHeight = fontInfo.ascent + fontInfo.descent + fontInfo.leading; - fCellHeight = fontHeight < 16 ? 16 : fontHeight; - fBaseline = fCellHeight - fontInfo.descent + fontInfo.leading; -} - -void LFinderView::FinishCreateSelf() -{ - LView::FinishCreateSelf(); - - LFinderHeader* header = NULL; - char id[ 4 ]; - PaneIDT paneID; - - *((PaneIDT*)id) = mPaneID; - id[ 0 ] = 'H'; - paneID = *((PaneIDT*)id); - header = (LFinderHeader*)mSuperView->FindPaneByID( paneID ); - if ( header ) - header->SetFinderView( this ); - fHeader = header; -} - -void LFinderView::ResizeFrameBy( Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh ) -{ - LView::ResizeFrameBy( inWidthDelta, inHeightDelta, inRefresh ); - if ( fClipImage ) - { - SDimension16 frameSize; - - this->GetFrameSize( frameSize ); - this->ResizeImageTo( frameSize.width, mImageSize.height, inRefresh ); - } -} - -// ¥¥ activate/deactivate feedback -void LFinderView::ActivateSelf() -{ - LView::ActivateSelf(); - RefreshSelectedCells(); -} - -void LFinderView::DeactivateSelf() -{ - LView::DeactivateSelf(); - RefreshSelectedCells(); -} - -void LFinderView::RefreshSelectedCells() -{ - UInt32 topCell; - UInt32 bottomCell; - - GetVisibleCells( topCell, bottomCell ); - if ( topCell == NO_CELL ) - return; - - for ( UInt32 cell = topCell; cell <= bottomCell; cell++ ) - { - if ( this->IsCellSelected( cell ) ) // For each selected cell, add the outline to the region - RefreshCells( cell, cell, FALSE ); - } -} - -Boolean LFinderView::ObeyCommand( CommandT inCommand, void* ioParam ) -{ - switch ( inCommand ) - { - case msg_TabSelect: - if ( !IsEnabled() ) - return FALSE; - else - return TRUE; - break; - } - return LCommander::ObeyCommand( inCommand, ioParam ); -} - -// ¥¥ drawing/events -Boolean LFinderView::HandleKeyPress( const EventRecord& inEvent ) -{ - Char16 key = inEvent.message; - Char16 character = key & charCodeMask; - - if ( fAllowsKeyNavigation ) - { - switch ( character ) - { - case char_UpArrow: this->KeyUp( inEvent ); return TRUE; - case char_DownArrow: this->KeyDown( inEvent ); return TRUE; - case char_Home: this->KeyHome( inEvent ); return TRUE; - case char_End: this->KeyEnd( inEvent ); return TRUE; - case char_PageUp: this->KeyPageUp( inEvent ); return TRUE; - case char_PageDown: this->KeyPageDown( inEvent ); return TRUE; - case char_Return: - case char_Enter: this->KeyEnter( inEvent ); return TRUE; - } - } - return LCommander::HandleKeyPress( inEvent ); -} - -void LFinderView::KeyUp( const EventRecord& event ) -{ - UInt32 cell; - - cell = this->FirstSelectedCell(); - - if ( cell > 1 ) - this->SelectItem( event, cell - 1, TRUE ); -} - -void LFinderView::KeyDown( const EventRecord& event ) -{ - UInt32 cell; - - cell = this->FirstSelectedCell(); - - if ( cell < this->GetVisibleCount() ) - this->SelectItem( event, cell + 1, TRUE ); -} - -void LFinderView::KeyEnter( const EventRecord& event ) -{ - UInt32 cell; - - cell = this->FirstSelectedCell(); - - if ( cell > 0 ) - this->DoDoubleClick( cell, event ); -} - -void LFinderView::KeyHome( const EventRecord& event ) -{ - if ( this->GetVisibleCount() > 0 ) - this->SelectItem( event, 1, TRUE ); -} - -void LFinderView::KeyEnd( const EventRecord& event ) -{ - if ( this->GetVisibleCount() > 0 ) - this->SelectItem( event, this->GetVisibleCount(), TRUE ); -} - -void LFinderView::KeyPageUp( const EventRecord& /*event*/ ) -{ -} - -void LFinderView::KeyPageDown( const EventRecord& /*event*/ ) -{ -} - -Boolean LFinderView::ColumnText( UInt32 /*cell*/, UInt16 /*column*/, CStr255& text ) -{ - text = CStr255::sEmptyString; - - return FALSE; -} - -// Figure out what cells have been exposed, and draw them -void LFinderView::DrawSelf() -{ - RgnHandle localUpdateRgnH; - Rect updateRect; - UInt32 topCell; - UInt32 bottomCell; - SPoint32 tl; - SPoint32 br; - - localUpdateRgnH = GetLocalUpdateRgn(); - updateRect = (**localUpdateRgnH).rgnBBox; - DisposeRgn( localUpdateRgnH ); - - this->LocalToImagePoint( topLeft( updateRect ), tl ); - this->LocalToImagePoint( botRight( updateRect ), br ); - - topCell = FetchCellAt( tl ); - bottomCell = FetchCellAt( br ); - - ::EraseRect(&updateRect); - if ( topCell == NO_CELL ) - return; - - if ( bottomCell >= topCell ) - { - UTextTraits::SetPortTextTraits( fTextTraits ); - for ( UInt32 i = topCell; i <= bottomCell; i++ ) - DrawCellAt( i ); - } -} - -void LFinderView::RefreshCells( Int32 first, Int32 last, Boolean rightAway ) -{ - if ( rightAway && FocusDraw() && IsVisible() ) - { - UTextTraits::SetPortTextTraits( fTextTraits ); - - if ( first < 1 ) - first = 1; - - if ( last > this->GetVisibleCount() ) - last = this->GetVisibleCount(); - - for ( Int32 i = first; i <= last; i++ ) - DrawCellAt( i ); - } - else if ( FocusDraw() & IsVisible()) - { - Rect refresh; - - Rect r1; - this->GetCellRect( first, r1 ); - - refresh.top = r1.top; - refresh.left = 0; - refresh.right = r1.right; - - if ( last == LAST_CELL ) - { - SPoint32 bigImageSize; - Point imageSize; - - bigImageSize.v = mImageSize.height; - bigImageSize.h = mImageSize.width; - - this->ImageToLocalPoint( bigImageSize, imageSize ); - refresh.bottom = imageSize.v; - refresh.right = imageSize.h; - } - else - { - Rect r2; - this->GetCellRect( last, r2 ); - refresh.bottom = r2.bottom; - } - - ::InvalRect( &refresh ); - } -} - -void LFinderView::RemoveColumn( UInt16 column ) -{ - Int16 count; - UInt16 width; - - if ( column >= ( fNumberColumns - 1 ) ) - width = mImageSize.width - fColumnOffsets[ column ]; - else - width = fColumnOffsets[ column + 1 ] - fColumnOffsets[ column ]; - - for ( count = column; count < ( fNumberColumns - 1 ); count++ ) - { - fColumnIDs[ count ] = fColumnIDs[ count + 1 ]; - fColumnOffsets[ count ] = fColumnOffsets[ count + 1 ] - width; - } - - fColumnIDs[ fNumberColumns - 1 ] = 0; - fColumnOffsets[ fNumberColumns - 1 ] = 0; - - fNumberColumns--; -} - -void LFinderView::RefreshHeader() -{ - if ( fHeader ) - fHeader->Refresh(); -} - -void LFinderView::InsertColumn( UInt16 before, UInt16 columnID, UInt16 width ) -{ - Int16 count; - - for ( count = fNumberColumns; count > before; count-- ) - { - fColumnIDs[ count ] = fColumnIDs[ count - 1 ]; - fColumnOffsets[ count ] = fColumnOffsets[ count - 1 ] + width; - } - - fColumnIDs[ before ] = columnID; - - if ( before == fNumberColumns ) - fColumnOffsets[ before ] = fColumnOffsets[ before - 1 ] + width; - - fNumberColumns++; -} - -void LFinderView::SwapColumns( UInt16 columnA, UInt16 columnB ) -{ - if ( columnA != columnB ) - { - Int16 width; - Int16 columnID; - - columnID = fColumnIDs[ columnB ]; - if ( columnB >= ( fNumberColumns - 1 ) ) - width = mImageSize.width - fColumnOffsets[ columnB ]; - else - width = fColumnOffsets[ columnB + 1 ] - fColumnOffsets[ columnB ]; - - this->RemoveColumn( columnB ); - this->InsertColumn( columnA, columnID, width ); - this->Refresh(); - if ( fHeader ) - fHeader->Refresh(); - } -} - -#define SAVE_VERSION 25 -void LFinderView::SavePlace( LStream* inStream ) -{ - WriteVersionTag( inStream, SAVE_VERSION ); - inStream->WriteData( &fNumberColumns, sizeof( fNumberColumns ) ); - - for ( Int16 i = 0; i < fNumberColumns; i++ ) - { - inStream->WriteData( &fColumnOffsets[ i ], sizeof( fColumnOffsets[ 0 ] ) ); - inStream->WriteData( &fColumnIDs[ i ], sizeof( fColumnIDs[ 0 ] ) ); - } -} - -void LFinderView::RestorePlace( LStream* inStream ) -{ - Int16 numColumns; - Int16 columnOffset; - Int16 columnID; - - if ( !ReadVersionTag( inStream, SAVE_VERSION ) ) - return; - - inStream->ReadData( &numColumns, sizeof( fNumberColumns ) ); - - XP_ASSERT( numColumns < NUM_COLUMNS ); - - if ( numColumns < 1 || numColumns > NUM_COLUMNS ) - return; - - for ( Int16 i = 0; i < numColumns; i++ ) - { - inStream->ReadData( &columnOffset, sizeof( fColumnOffsets[ 0 ] ) ); - inStream->ReadData( &columnID, sizeof( fColumnIDs[ 0 ] ) ); - - fColumnOffsets[ i ] = columnOffset; - fColumnIDs[ i ] = columnID; - } -} - -Boolean LFinderView::DispatchClick( const SMouseDownEvent& where, UInt32 cell, Int16 column ) -{ - Boolean handled = FALSE; - - switch ( column ) - { - case HIER_COLUMN: - { - Rect rect; - - if ( cell == NO_CELL && fAllowsRectSelection ) - this->TrackSpace( where, cell ); - else - { - this->GetTextRect( cell, rect ); - if ( ::PtInRect( where.whereLocal, &rect ) ) - this->TrackCell( where, cell ); - else - { - this->GetIconRect( cell, rect ); - if ( ::PtInRect( where.whereLocal, &rect ) ) - this->TrackCell( where, cell ); - else - { - this->GetWiglyRect( cell, rect ); - if ( this->CanDrawHierarchy( cell ) && - this->IsCellHeader( cell ) && - ::PtInRect( where.whereLocal, &rect ) ) - { - this->TrackWigly( where, cell ); - } - else - { - if ( fAllowsRectSelection ) - this->TrackSpace( where, cell ); - } - } - } - } - handled = TRUE; - } - break; - - case NO_COLUMN: - { - if ( fAllowsRectSelection ) - this->TrackSpace( where, cell ); - else if ( cell != NO_CELL ) - this->SelectItem( where.macEvent, cell, TRUE ); - handled = TRUE; - } - break; - - default: - break; - } - return handled; -} - -void LFinderView::SortByColumnNumber( UInt16 /*column*/, Boolean /*switchOrder*/ ) -{ -} - -// Complex -- click on wigly, just track this click -void LFinderView::ClickSelf( const SMouseDownEvent& where ) -{ - SPoint32 whereImage; - Int16 column; - Boolean inBar; - UInt32 cell; - - LocalToImagePoint( where.whereLocal, whereImage ); - - cell = this->FetchCellAt( whereImage ); - column = this->GetClickKind( where, cell, inBar ); - - if ( inBar ) - { - this->TrackResizeColumn( where, cell, column ); - } - else - { - if ( this->DispatchClick( where, cell, column ) && GetClickCount() < 2 ) - { - // We only switch the target if it's not a double-click. Otherwise, - // the double-click dispatch may have caused a target change and - // we would not want to undo that. - this->SwitchTarget( this ); - } - } -} - -void LFinderView::DoResizeColumn( Int16 column, Int16 delta, Boolean inRefresh ) -{ - for ( long i = column + 1; i < fNumberColumns; i++ ) - fColumnOffsets[ i ] += delta; - - if ( inRefresh && fHeader ) - { - if ( fHeader ) - fHeader->Refresh(); - this->Refresh(); - } -} - -void LFinderView::TrackResizeColumn( const SMouseDownEvent& where, UInt32 cell, Int16 column ) -{ - Rect columnRect; - Rect viewRect; - RgnHandle myRgn; - Int16 delta; - Int32 result; - - if ( !this->FocusDraw() ) - return; - - this->GetColumnRect( cell, column, columnRect ); - this->CalcLocalFrameRect( viewRect ); - - columnRect.left = columnRect.right - 1; - columnRect.right = columnRect.right + 1; - if ( fHeader ) - { - SDimension16 size; - fHeader->GetFrameSize( size ); - columnRect.top -= size.height; - viewRect.top -= size.height; - } - columnRect.top = viewRect.top--; - columnRect.bottom = viewRect.bottom++; - myRgn = ::NewRgn(); - ::RectRgn( myRgn, &columnRect ); - - viewRect.left = fColumnOffsets[ column ]; - if ( viewRect.left < 1 ) - viewRect.left = 1; - viewRect.right -= 1; - - result = ::DragGrayRgn( myRgn, where.whereLocal, - &viewRect, &viewRect, hAxisOnly, NULL ); - - ::DisposeRgn( myRgn ); - - delta = LoWord( result ); - if ( ( result == kOutsideSlop ) || ( delta == 0 ) ) - return; - - this->DoResizeColumn( column, delta, TRUE ); -} - -UInt32 LFinderView::FetchCellAt( SPoint32& imagePt ) -{ - UInt32 cell = NO_CELL; - - cell = ( imagePt.v / fCellHeight ) + 1; - if ( this->GetVisibleCount() < cell ) - cell = this->GetVisibleCount(); - return cell; -} - -void LFinderView::GetVisibleCells( UInt32& top, UInt32& bottom ) -{ - SPoint32 loc; - - loc.v = mFrameLocation.v - mImageLocation.v; - loc.h = mFrameLocation.h - mImageLocation.h; - - top = this->FetchCellAt( loc ); - - loc.v += ( mFrameSize.height - 1 ); - loc.h += ( mFrameSize.width - 1 ); - - bottom = this->FetchCellAt( loc ); -} - -void LFinderView::RevealCell( UInt32 cell ) -{ - XP_ASSERT( cell ); - - if ( this->FocusDraw() ) - { - SPoint32 pt; - Point localPt; - Rect frame; - - pt.h = 0; - pt.v = ( cell - 1 ) * fCellHeight; - this->CalcLocalFrameRect( frame ); - this->ImageToLocalPoint( pt, localPt ); - - if ( localPt.v < frame.top ) - this->ScrollImageTo( 0, pt.v, TRUE ); - - if ( ( localPt.v + fCellHeight ) > ( frame.bottom - 1 ) ) - this->ScrollImageTo( 0, ( pt.v + fCellHeight ) - mFrameSize.height + 1, TRUE ); - } -} - -void LFinderView::GetColumnTitle( UInt16 column, CStr255& title ) -{ - ::GetIndString( title, mUserCon, fColumnIDs[ column ] + 1 ); -} - -void LFinderView::SetForeColor( const RGBColor& fore ) -{ - fForeColor = fore; -} - -void LFinderView::SetBackColor( const RGBColor& back ) -{ - fBackColor = back; -} - -Boolean LFinderView::FocusDraw(LPane* /*inSubPane*/) -{ - Boolean focus; - - focus = LView::FocusDraw(); - if ( focus ) - { - UGraphics::SetIfBkColor( fBackColor ); - UGraphics::SetIfColor( fForeColor ); - } - - return focus; -} - -Boolean LFinderView::TrackHeader( const SMouseDownEvent& /*where*/, UInt16 clickWhere ) -{ - Boolean hilited = FALSE; - Rect whichRect; - - if ( !this->FocusDraw() ) - return FALSE; - - this->GetColumnRect( 1, clickWhere, whichRect ); - whichRect.top = 1; - whichRect.bottom = fCellHeight - 2; - - while ( ::Button() ) - { - SystemTask(); - FocusDraw(); - - Point mouse; - ::GetMouse( &mouse ); - // ¥Êidling - // ¥ user feedback - if ( PtInRect( mouse, &whichRect ) ) - { - if ( !hilited ) - { - hilited = TRUE; - HiliteRect( whichRect ); - } - } - else - { - if ( hilited ) - { - hilited = FALSE; - HiliteRect( whichRect ); - } - } - } - - return hilited; -} - - -void LFinderView::DrawCellAt( UInt32 cell ) -{ - Rect cellRect; - - this->GetCellRect( cell, cellRect ); - - FocusDraw(); - ::EraseRect( &cellRect ); - - // ¥Êdo not draw if we are not visible - // conversion of local to image coordinates (see LocalToImagePoint) - if ( !ImageRectIntersectsFrame( cellRect.left - mImageLocation.h - mPortOrigin.h, - cellRect.top - mImageLocation.v - mPortOrigin.v, - cellRect.right - mImageLocation.h - mPortOrigin.h, - cellRect.bottom - mImageLocation.v - mPortOrigin.v ) ) - return; - - for ( long i = 0; i < fNumberColumns; i++ ) - this->DrawCellColumn( cell, i ); - - this->HighlightCell( cell ); -} - -void LFinderView::PutOnDuty(LCommander* inNewTarget) -{ - LCommander::PutOnDuty(inNewTarget); - RefreshSelectedCells(); -} - -void LFinderView::TakeOffDuty() -{ - LCommander::TakeOffDuty(); - RefreshSelectedCells(); -} - -void LFinderView::GetWiglyRect( UInt32 cell, Rect& where ) -{ - where.bottom = ( cell * fCellHeight ) + mPortOrigin.v + mImageLocation.v + 1; - where.top = where.bottom - ICON_HEIGHT; - where.left = WIGLY_LEFT_OFFSET + mPortOrigin.h + mImageLocation.h; - where.right = where.left + ICON_WIDTH; -} - -void LFinderView::GetIconRect( UInt32 cell, Rect& where ) -{ - where.top = ( ( cell - 1 ) * fCellHeight ) + mPortOrigin.v + mImageLocation.v; - where.bottom = where.top + ICON_HEIGHT; - where.left = ( this->CellIndentLevel( cell ) * LEVEL_OFFSET ) + - WIGLY_LEFT_OFFSET + ICON_WIDTH + - mPortOrigin.h + mImageLocation.h; - where.right = where.left + ICON_WIDTH; -} - -void LFinderView::GetTextRect( UInt32 cell, Rect& where ) -{ - where.top = ( ( cell - 1 ) * fCellHeight ) + - mPortOrigin.v + mImageLocation.v; - where.bottom = where.top + fCellHeight; - where.left = ( this->CellIndentLevel( cell ) * LEVEL_OFFSET ) + - mPortOrigin.h + mImageLocation.h + - WIGLY_LEFT_OFFSET + (2 * ICON_WIDTH); - - CStr255 text; - this->CellText( cell, text ); - long width = ::StringWidth( text ); - if ( width ) - where.right = where.left + width + 2; - else - where.right = where.left; -} - -void LFinderView::DrawIcon( Handle iconSuite, Boolean selected, const Rect& where ) -{ - OSErr err; - - if ( !iconSuite ) - return; - - if ( !selected ) - err = ::PlotIconSuite( &where, atHorizontalCenter | atVerticalCenter, - ttNone, iconSuite ); - else - err = ::PlotIconSuite( &where, atHorizontalCenter | atVerticalCenter, - ttSelected, iconSuite ); -} - -void LFinderView::DrawText( const Style& style, const CStr255& text, const Rect& where, - const TruncCode& trunc ) -{ - DrawText(style, text, where, trunc, fTextTraits, fBaseline ); -} - -void LFinderView::DrawText( const Style& style, const CStr255& text, const Rect& where, - const TruncCode& trunc, ResIDT inTextTraits, Int16 baseline ) -{ - UTextTraits::SetPortTextTraits( inTextTraits ); - - CStr255 texta = text; - - ::TextFace( style ); - ::MoveTo( where.left + 2, where.top + baseline - 2 ); - - if ( where.right >= ( where.left + 2 ) ) - { - SInt16 width; - - width = where.right - where.left - 2; - - if ( trunc != CUSTOM_MIDDLE_TRUNCATION ) - ::TruncString( width, texta, trunc ); - else - MiddleTruncationThatWorks( texta, width ); - - ::DrawString( texta ); - } -} - -Boolean LFinderView::CanDrawHierarchy( UInt32 /*cell*/ ) -{ - return TRUE; -} - -void LFinderView::DrawHierarchy( UInt32 cell ) -{ - Handle iconSuite = NULL; - Rect where; - CStr255 text; - TruncCode trunc; - Style textStyle; - - this->CellText( cell, text ); - - // ¥Êplot the wigly - if ( this->IsCellHeader( cell ) ) - { - this->GetWiglyRect( cell, where ); - - if ( this->IsHeaderFolded( cell ) ) - iconSuite = CIconList::GetIconSuite( WIGLY_CLOSED_ICON ); - else - iconSuite = CIconList::GetIconSuite( WIGLY_OPEN_ICON ); - this->DrawIcon( iconSuite, FALSE, where ); - } - - // ¥ plot icon - if ( this->CellIcon( cell ) != 0 ) - { - this->GetIconRect( cell, where ); - - iconSuite = CIconList::GetIconSuite( this->CellIcon( cell ) ); - this->DrawIcon( iconSuite, - ( this->IsCellSelected( cell ) && ( mActive == triState_On ) ), - where ); - } - - // ¥ plot text - textStyle = CellTextStyle( cell ); - ::TextFace( textStyle ); - - this->GetTextRect( cell, where ); - trunc = this->ColumnTruncationStyle( 0 ); - this->DrawText( this->CellTextStyle( cell ) , text, where, trunc ); -} - -void LFinderView::DrawCellColumn( UInt32 /*cell*/, UInt16 /*column*/ ) -{ -} - -void LFinderView::HighlightCell( UInt32 cell ) -{ - Rect where; - - if ( fHighlightRow ) - this->GetCellRect( cell, where ); - else - { - this->GetTextRect( cell, where ); - where.top += 2; - where.bottom -= 2; - } - - // ¥Êdo the highlighting - if ( this->IsCellSelected( cell ) ) - { - if ( mActive == triState_On && this->IsOnDuty() ) - { - LMSetHiliteMode( 0 ); - ::InvertRect( &where ); - } - else - { - RGBColor hiliteColor; - - ::PenPat( &qd.black ); - LMGetHiliteRGB( &hiliteColor ); /* don't put two ':' in front of this line */ - UGraphics::SetIfColor( hiliteColor ); - ::FrameRect( &where ); - } - } -} - -Int16 LFinderView::InResizableColumnBar( const Point where ) -{ - long inColumnBar = NO_COLUMN; - Int16 h = where.h; - - for ( long i = 0; i < ( fNumberColumns - 1 ); i++ ) - { - Int16 offset; - - offset = fColumnOffsets[ i + 1 ]; - - if ( ( h > ( offset - 2 ) ) && ( h < ( offset + 2 ) ) ) - { - inColumnBar = i; - break; - } - } - - return inColumnBar; -} - -Int16 LFinderView::InColumn( const Point point ) -{ - for ( long i = 0; i < fNumberColumns; i++ ) - { - Rect tmp; - this->GetColumnRect( 1, i, tmp ); - if ( point.h >= tmp.left && point.h < tmp.right ) - return i; - } - return NO_COLUMN; -} - -// the coordinates returned are in Local coordinates -Int16 LFinderView::GetClickKind( const SMouseDownEvent& where, UInt32 /*cell*/, - Boolean& inBar ) -{ - Int16 i; - - i = this->InResizableColumnBar( where.whereLocal ); - - if ( i != NO_COLUMN ) - { - inBar = TRUE; - return i; - } - - inBar = FALSE; - i = this->InColumn( where.whereLocal ); - return i; -} - -void LFinderView::GetCellRect( UInt32 cell, Rect& r ) -{ - Int32 localV; - Int32 localH; - - localV = mPortOrigin.v + mImageLocation.v; - localH = mPortOrigin.h + mImageLocation.h; - - // ¥ enclosing rectangle - r.bottom = cell * fCellHeight + localV; - r.top = r.bottom - fCellHeight; - r.left = localH; - r.right = mImageSize.width + localH; -} - - -void LFinderView::GetColumnRect( UInt32 cell, UInt16 column, Rect& r ) -{ - Int32 localV; - Int32 localH; - - localV = mPortOrigin.v + mImageLocation.v; - localH = mPortOrigin.h + mImageLocation.h; - - r.bottom = cell * fCellHeight + localV; - r.top = r.bottom - fCellHeight; - r.left = fColumnOffsets[ column ] + localH; - if ( column >= ( fNumberColumns - 1 ) ) - r.right = mImageSize.width + localH; - else - r.right = fColumnOffsets[ column + 1 ] + localH; - - if ( r.right < r.left ) - r.right = mImageSize.width + localH; -} - - -// ¥Êtracks movement inside little finder triangle -void LFinderView::TrackWigly( const SMouseDownEvent& where, UInt32 cell ) -{ - Boolean hilited = FALSE; - Point mouse; - Rect r; - Handle iconSuite = NULL; - - this->GetWiglyRect( cell, r ); - - if ( this->IsHeaderFolded( cell ) ) - iconSuite = CIconList::GetIconSuite( WIGLY_CLOSED_ICON ); - else - iconSuite = CIconList::GetIconSuite( WIGLY_OPEN_ICON ); - - while ( ::Button() ) - { - // ¥Êidling - SystemTask(); - FocusDraw(); - - ::GetMouse( &mouse ); - // ¥ user feedback - if ( PtInRect( mouse, &r ) ) - { - if ( !hilited ) - { - hilited = TRUE; - this->DrawIcon( iconSuite, TRUE, r ); - } - } - else - { - if ( hilited ) - { - hilited = FALSE; - this->DrawIcon( iconSuite, FALSE, r ); - } - } - } - - FocusDraw(); - - if ( hilited ) - { - iconSuite = CIconList::GetIconSuite( WIGLY_INBETWEEN_ICON ); - if ( this->IsHeaderFolded( cell ) ) // Open to closed transition - { - iconSuite = CIconList::GetIconSuite( WIGLY_OPEN_ICON ); - - // ¥ need to erase the rect, because icons draw masked - ::EraseRect( &r ); - this->DrawIcon( iconSuite, FALSE, r ); - - this->FoldHeader( cell, FALSE, TRUE, (where.macEvent.modifiers & optionKey) != 0 ); - } - else - { - iconSuite = CIconList::GetIconSuite( WIGLY_CLOSED_ICON ); - - // ¥ need to erase the rect, because icons draw masked - ::EraseRect( &r ); - this->DrawIcon( iconSuite, FALSE, r ); - - this->FoldHeader( cell, TRUE, TRUE, (where.macEvent.modifiers & optionKey) != 0 ); - } - } -} - -Boolean LFinderView::TrackMark( UInt16 track, const SMouseDownEvent& /*where*/, UInt32 cell, - UInt16 drawIconID, UInt16 notDrawIconID ) -{ - Boolean hilited = FALSE; - Rect whichRect; - Handle drawIcon = NULL; - Handle notDrawIcon = NULL; - Boolean selected = FALSE; - RGBColor backColor; - - if ( !this->FocusDraw() ) - return FALSE; - - this->GetColumnRect( cell, track, whichRect ); - - drawIcon = CIconList::GetIconSuite( drawIconID ); - notDrawIcon = CIconList::GetIconSuite( notDrawIconID ); - - if ( !drawIcon || !notDrawIcon ) - return FALSE; - - whichRect.left += 2; - whichRect.right = whichRect.left + ICON_WIDTH; - whichRect.bottom = whichRect.top + ICON_HEIGHT; - - selected = this->IsCellSelected( cell ); - if ( selected ) - LMGetHiliteRGB( &backColor ); - else - backColor = CPrefs::GetColor( CPrefs::White ); - - while ( ::Button() ) - { - // ¥Êidling - SystemTask(); - FocusDraw(); - - Point mouse; - ::GetMouse( &mouse ); - // ¥ user feedback - if ( PtInRect( mouse, &whichRect ) ) - { - if ( !hilited ) - { - hilited = TRUE; - ::RGBBackColor( &backColor ); - ::EraseRect( &whichRect ); - this->DrawIcon( drawIcon, FALSE, whichRect ); - } - } - else - { - if ( hilited ) - { - hilited = FALSE; - ::RGBBackColor( &backColor ); - ::EraseRect( &whichRect ); - this->DrawIcon( notDrawIcon, FALSE, whichRect ); - } - } - } - - return hilited; -} - -void LFinderView::TrackCell( const SMouseDownEvent &where, UInt32 cell ) -{ - if ( !this->FocusDraw() ) - return; - - if ( GetClickCount() < 2 ) - { - this->SelectItem( where.macEvent, cell, TRUE ); - - // ¥Êtricky: select the cell right away - if ( this->IsCellSelected( cell ) && - LDragAndDrop::DragAndDropIsPresent() && - ::WaitMouseMoved( where.macEvent.where ) ) - { - // ¥ reset the drag location - fDragTarget.where = DRAG_NONE; - this->MakeDragTask( where ); - } - } - else - this->DoDoubleClick( cell, where.macEvent ); -} - -void LFinderView::DoDoubleClick( UInt32 cell, const EventRecord &/*event*/) -{ - if ( this->IsCellHeader( cell ) ) - { - Boolean folded = this->IsHeaderFolded( cell ); - this->FoldHeader( cell, !folded, TRUE, FALSE ); - RefreshCells( cell, cell, FALSE ); - } -} - -void LFinderView::TrackSpace( const SMouseDownEvent& where, UInt32 /*cell*/ ) -{ - Boolean extend; - Rect antsRect; - Rect oldAntsRect; - Point start; - Point end; - Point current; - SPoint32 tmpPt; - EventRecord tmp; - - UInt32 topCell; - UInt32 botCell; - - extend = ( where.macEvent.modifiers & shiftKey ) != 0; - - if ( !extend ) - this->ClearSelection(); - - start = where.whereLocal; - end = start; - RectFromTwoPoints( start, end, antsRect ); - - tmp = where.macEvent; - tmp.modifiers |= shiftKey; - - // ¥ draw ants - DrawAntsRect( antsRect, patXor ); - while ( ::Button() ) - { - // ¥Êidling - SystemTask(); - FocusDraw(); - - // ¥Êants always drawn when entering the loop. erase on exit - ::GetMouse( ¤t ); - if ( ( current.v != end.v ) || ( current.h != end.h ) ) - { - FocusDraw(); - // ¥Êerase the ants - DrawAntsRect( antsRect, patXor ); - AutoScrollImage( current ); - - end = current; - oldAntsRect = antsRect; - RectFromTwoPoints( start, end, antsRect); - - this->LocalToImagePoint( topLeft( oldAntsRect ), tmpPt ); - topCell = this->FetchCellAt( tmpPt ); - this->LocalToImagePoint( botRight( oldAntsRect ), tmpPt ); - botCell = this->FetchCellAt( tmpPt ); - - this->LocalToImagePoint( topLeft( antsRect ), tmpPt ); - topCell = MIN( topCell, this->FetchCellAt( tmpPt ) ); - this->LocalToImagePoint( botRight( antsRect ), tmpPt ); - botCell = MAX( botCell, this->FetchCellAt( tmpPt ) ); - - for ( UInt32 i = topCell; i <= botCell; i++ ) - { - if ( SectCellRect( i, oldAntsRect ) != SectCellRect( i, antsRect ) ) - this->SelectItem( tmp, i, TRUE ); - } - FocusDraw(); - // ¥Êdraw ants - DrawAntsRect( antsRect, patXor ); - } - } - // ¥ draw ants - DrawAntsRect( antsRect, patXor ); -} - -// ¥Êdoes the icon, or the text of the cell sect this rect? -Boolean LFinderView::SectCellRect( UInt32 cell, Rect r ) -{ - Rect iconRect; - Rect textRect; - Rect dummy; - - this->GetIconRect( cell, iconRect ); - this->GetTextRect( cell, textRect ); - - return ( ::SectRect( &iconRect, &r, &dummy ) || - ::SectRect( &textRect, &r, &dummy ) ); -} - -void LFinderView::LocalToGlobalRect( Rect& r ) -{ - Point p1; - Point p2; - - p1.h = r.left; p1.v = r.top; - p2.h = r.right; p2.v = r.bottom; - - LocalToPortPoint( p1 ); - LocalToPortPoint( p2 ); - PortToGlobalPoint( p1 ); - PortToGlobalPoint( p2 ); - - r.left = p1.h; - r.top = p1.v; - r.right = p2.h; - r.bottom = p2.v; -} - - -// User feedback on dragging -void LFinderView::InsideDropArea( DragReference /*inDragRef*/ ) -{ - Point mouse; - SPoint32 imageMouse; - DropLocation newDropLoc; - Rect enclosingRect; - UInt32 cell; - Boolean nearTop; - Boolean nearBottom; - - if ( !this->FocusDraw() ) - return; - - // ¥ find out where the mouse is - ::GetMouse( &mouse ); - - this->LocalToImagePoint( mouse, imageMouse ); - - // ¥Êget information about the cell - cell = this->FetchCellAt( imageMouse ); - if ( cell > 0 && cell <= this->GetVisibleCount() ) - { - newDropLoc.cell = cell; - this->GetCellRect( newDropLoc.cell, enclosingRect ); - nearTop = imageMouse.v < ( ( cell - 1 ) * fCellHeight + 2 ); - nearBottom = imageMouse.v > ( cell * fCellHeight + 2 ); - - // ¥ cannot drag onto a selected cell? - if ( this->IsCellSelected( newDropLoc.cell ) ) - newDropLoc.where = DRAG_NONE; - else if ( this->IsCellHeader( newDropLoc.cell ) ) // Header - { - if ( nearTop ) // Near the top of the header - { - newDropLoc.cell -= 1; - newDropLoc.where = DRAG_AFTER; - } - else if ( nearBottom ) // Near the bottom of the header - { - newDropLoc.where = DRAG_AFTER; - } - else // Over the icon - newDropLoc.where = DRAG_INSIDE; - } - else // We are over a cell, the boundary is the half of the cell - if (imageMouse.v < ((cell * fCellHeight) - (fCellHeight / 2))) - { - newDropLoc.cell -= 1; - newDropLoc.where = DRAG_AFTER; - } - else - newDropLoc.where = DRAG_AFTER; - - if ( ( newDropLoc.cell == fDragTarget.cell ) && - ( newDropLoc.where == fDragTarget.where ) ) - return; - - HighlightDropLocation( FALSE ); - fDragTarget = newDropLoc; - HighlightDropLocation( TRUE ); - } - XP_TRACE(("cell: %d, where: %d\n", fDragTarget.cell, fDragTarget.where )); -} - -void LFinderView::LeaveDropArea( DragReference inDragRef ) -{ - LDragAndDrop::LeaveDropArea( inDragRef ); - HighlightDropLocation( FALSE ); - - fDragTarget.cell = 0; - fDragTarget.where = DRAG_NONE; - - - Point mouse; - Rect frame; - - FocusDraw(); - ::GetMouse(&mouse); - CalcLocalFrameRect(frame); - - // yippee - fDragLeaveDirection.top = fDragLeaveDirection.left = - fDragLeaveDirection.bottom = fDragLeaveDirection.right = false; - - - // Remember which way the cursor left us, because those are the only directions - // we'll allow autoscrolling until we are reentered. - - if ( ! (fDragLeaveDirection.left = (mouse.h < frame.left))) - fDragLeaveDirection.right = (mouse.h > frame.right); - - if ( ! (fDragLeaveDirection.top = (mouse.v < frame.top))) - fDragLeaveDirection.bottom = (mouse.v > frame.bottom); - -} - -// TRUE to show highlight, FALSE to hide -void LFinderView::HighlightDropLocation( Boolean show ) -{ - Rect textRect; - Rect iconRect; - Handle iconSuite; - - if ( !this->FocusDraw() ) - return; - - if ( fDragTarget.where == DRAG_NONE ) - return; - - if ( this->IsCellSelected( fDragTarget.cell ) && show ) - return; - - this->GetTextRect( fDragTarget.cell, textRect ); - this->GetIconRect( fDragTarget.cell, iconRect ); - - switch ( fDragTarget.where ) - { - case DRAG_NONE: - break; - - case DRAG_INSIDE: - iconSuite = CIconList::GetIconSuite( this->CellIcon( fDragTarget.cell ) ); - this->DrawIcon( iconSuite, show, iconRect ); - break; - - case DRAG_AFTER: - ::PenMode( patXor ); - ::PenPat( &qd.black ); - ::PenSize( 1, 2 ); - MoveTo( textRect.left + 1, textRect.bottom - 1 ); - LineTo( textRect.right - 1, textRect.bottom - 1 ); - ::PenSize( 1, 1 ); - break; - } -} - - -void LFinderView::AddFlavors( DragReference /*inDragRef*/ ) -{ -} - -// For each visible selected cell, add it to the drag rgn -void LFinderView::MakeDragRegion( DragReference /*inDragRef*/, RgnHandle dragRegion ) -{ - UInt32 topCell; - UInt32 bottomCell; - - GetVisibleCells( topCell, bottomCell ); - - StRegion tempOutRgn; - StRegion tempInRgn; - - for ( UInt32 cell = topCell; cell <= bottomCell; cell++ ) - { - // ¥ for each selected cell, add the outline to the region - if ( this->IsCellSelected( cell ) ) - { - Rect iconRect; - Rect textRect; - - this->GetIconRect( cell, iconRect ); - this->GetTextRect( cell, textRect ); - - InsetRect( &textRect, 1, 2 ); - - // ¥ must translate local rect into global one - LocalToGlobalRect( textRect ); - LocalToGlobalRect( iconRect ); - - // ¥ add two rects - RectRgn( tempOutRgn, &iconRect ); - RectRgn( tempInRgn, &iconRect ); - InsetRgn( tempInRgn, 1, 1 ); - - DiffRgn( tempOutRgn, tempInRgn, tempInRgn ); - UnionRgn( tempInRgn, dragRegion, dragRegion ); - - RectRgn( tempOutRgn, &textRect ); // text - RectRgn( tempInRgn, &textRect ); - - InsetRgn( tempInRgn, 1, 1 ); - DiffRgn( tempOutRgn, tempInRgn, tempInRgn ); - UnionRgn( tempInRgn, dragRegion, dragRegion ); - } - } -} - -Boolean LFinderView::ResizeTo( UInt32 newHeight, UInt32 newWidth ) -{ - if ( newHeight != mImageSize.height || newWidth != mImageSize.width ) - { - ResizeImageTo( newWidth, newHeight, TRUE ); - Rect extraRect; - extraRect.bottom = mFrameSize.height; - extraRect.right = mFrameSize.width; - - if ( ( newHeight < mFrameSize.height ) && FocusDraw() ) - { - extraRect.top = newHeight; - extraRect.left = 0; - ::EraseRect( &extraRect ); - ::InvalRect( &extraRect ); - } - - if ( ( newWidth < mFrameSize.width ) && FocusDraw() ) - { - extraRect.top = 0; - extraRect.left = newWidth; - ::EraseRect( &extraRect ); - ::InvalRect( &extraRect ); - } - return TRUE; - } - else - return FALSE; -} - -void LFinderView::AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ) -{ - Int16 i; - PortToLocalPoint( inPortPt ); - i = this->InResizableColumnBar( inPortPt ); - - if ( i != NO_COLUMN ) - ::SetCursor( *(::GetCursor( curs_HoriDrag ) ) ); - else - LView::AdjustCursorSelf( inPortPt, inMacEvent ); -} - -/******************************************************************************* - * LDragFinderView - * Generic dragger for the Finder view - *******************************************************************************/ -LDragFinderTask::LDragFinderTask( const EventRecord& inEventRecord, LFinderView* view): - LDragTask( inEventRecord ) -{ - fView = view; - - fTrackerProc = NewDragTrackingHandlerProc(LDragFinderTask::ScrollingTracker); - - XP_ASSERT(fTrackerProc != NULL); - - if (fTrackerProc != NULL) - (void) ::InstallTrackingHandler(fTrackerProc, fView->GetMacPort(), fView); -} - -LDragFinderTask::~LDragFinderTask() -{ - if (fTrackerProc != NULL) - { - (void) ::RemoveTrackingHandler(fTrackerProc, fView->GetMacPort()); - DisposeRoutineDescriptor(fTrackerProc); - } -} - - -void LDragFinderTask::MakeDragRegion( DragReference inDragRef, RgnHandle inDragRegion ) -{ - if ( fView ) - fView->MakeDragRegion( inDragRef, inDragRegion ); -} - -void LDragFinderTask::AddFlavors( DragReference inDragRef ) -{ - if ( fView ) - fView->AddFlavors( inDragRef ); -} - - - -pascal OSErr -LDragFinderTask::ScrollingTracker( DragTrackingMessage message, - WindowPtr /*theWindow*/, - void * handlerRefCon, - DragReference theDragRef ) -{ - LFinderView * view = (LFinderView *) handlerRefCon; - - if (message == kDragTrackingInWindow) - view->DragScroll(theDragRef); - - return noErr; -} - - - - - -void -MiddleTruncationThatWorks( StringPtr s, - SInt16 availableSpace ) -{ -#if 1 - - if (availableSpace > 40) - { - ::TruncString( availableSpace, s, truncMiddle ); - } - else - { - // OK, we're trying to ship 4.0 (like yesterday) but this middle truncation stuff - // just doesn't work for international and local versions (problem with ellipsis - // and problem with multi-byte characters) - // Due to these problems and other problems that haven't yet been discovered in 4.0, - // we decided to not allow any middle truncation (allows truncEnd) - - ::TruncString( availableSpace, s, truncEnd ); - } -#else - Boolean alreadyFit; - SInt16 ellipsisWidth, width, halfSpace; - UInt32 index, measureBytes; - UInt8 length; - unsigned char ellipsis; - Handle ellipsisHandle = NULL; - - // - // "Fast" case - // - if ( ::StringWidth(s) <= availableSpace) - return; - - // - // Get to know the ellipsis - // - // pkc (6/14/96) Hack for localization; use ellipsis character - // loaded from resource. - if( sTruncChar == 0 ) - { - ellipsisHandle = ::GetResource('elps', 1000); - if( ellipsisHandle ) - { - // set sTruncChar and release resource - sTruncChar = **ellipsisHandle; - ::ReleaseResource(ellipsisHandle); - } - else - { - // What should we do if we can't load the resource? - // For now, set to roman ellipsis because I'm lazy. - sTruncChar = 'É'; - } - } - ellipsis = sTruncChar; - ellipsisWidth = ::CharWidth(ellipsis); - if (ellipsisWidth > availableSpace) - { - s[0] = 0; // cheezy bailout - return; - } - - if (ellipsisWidth == availableSpace) - { - s[0] = 1; - s[1] = ellipsis; - return; - } - - - // - // Find block of text that takes up half of the available space - // on the left. (minus half the ellipsis) - // - - halfSpace = ((availableSpace >> 1) - (ellipsisWidth >> 1)); - index = halfSpace/8 + 1; // just a beginning guess - - alreadyFit = false; - - do - { - width = ::TextWidth((char*)s, 1, index); - - // Too wide ?, go narrow - if (width > halfSpace) - { - index--; - - // If we fit with the step back, bail - if (alreadyFit) - break; - } - else - - // Do we fit ? try wider - if (width < halfSpace) - { - index++; - alreadyFit = true; // we'll try adding one more char, - // but if it fails, just bounce back - // to this case - } - else - break; - - if (index == 0) - break; // no room for any text on the left - - XP_ASSERT(index <= s[0]); - - } while (true); - - - // jam in the ellipsis - s[index+1] = ellipsis; - length = index+1; - - // - // if index is 0, we have no room for anything - // but the ellipsis, so bail - // - if (index == 0) - { - s[0] = 1; - return; - } - - // - // Now find text to fit to the right of the ellipsis - // - - halfSpace = availableSpace - (width + ellipsisWidth); - index = s[0] - (halfSpace/8); // another guess to begin - measureBytes = (s[0] - index) + 1; - alreadyFit = false; - - do - { - width = ::TextWidth((char*)s, index, measureBytes); - - // If we're too wide, take a step back. - if (width > halfSpace) - { - index++; - measureBytes--; - - // - // if we already know that we fit - // with the step back, get out - // - - if (alreadyFit) - break; - } - - // If we're too narrow, go wider - else if (width < halfSpace) - { - index--; - measureBytes++; - alreadyFit = true; // we'll try adding one more char, - // but if it fails, just bounce back - // to this case - } - else - break; - - - if (index > s[0]) - { - measureBytes = 0; // no room for any text on the right - break; - } - - XP_ASSERT(index > 0); - - } while (true); - - - if (measureBytes != 0) - { - // - // shift the right half of the text down to meet the ellipsis - // - ::BlockMoveData( &s[index], &s[length+1], measureBytes); - - length += measureBytes; - } - - s[0] = length; - - XP_ASSERT( ::StringWidth(s) <= availableSpace ); -#endif -} - -void MiddleTruncationThatWorks(char *s, Int16 &ioLength, Int16 availableSpace) -{ -#if 1 - if (availableSpace > 40) - { - ::TruncText( availableSpace, s, &ioLength, truncMiddle ); - } - else - { - // OK, we're trying to ship 4.0 (like yesterday) but this middle truncation stuff - // just doesn't work for international and local versions (problem with ellipsis - // and problem with multi-byte characters) - // Due to these problems and other problems that haven't yet been discovered in 4.0, - // we decided to not allow any middle truncation (allows truncEnd) - - ::TruncText( availableSpace, s, &ioLength, truncEnd ); - } -#else - Boolean alreadyFit; - SInt16 ellipsisWidth, width, halfSpace; - UInt32 index, measureBytes; - Int16 length = outLength; - unsigned char ellipsis; - Handle ellipsisHandle = NULL; - - // - // "Fast" case - // - if ( ::TextWidth(s, 0, length) <= availableSpace) - return; - - // - // Get to know the ellipsis - // - // pkc (6/14/96) Hack for localization; use ellipsis character - // loaded from resource. - if( sTruncChar == 0 ) - { - ellipsisHandle = ::GetResource('elps', 1000); - if( ellipsisHandle ) - { - // set sTruncChar and release resource - sTruncChar = **ellipsisHandle; - ::ReleaseResource(ellipsisHandle); - } - else - { - // What should we do if we can't load the resource? - // For now, set to roman ellipsis because I'm lazy. - sTruncChar = 'É'; - } - } - ellipsis = sTruncChar; - ellipsisWidth = ::CharWidth(ellipsis); - if (ellipsisWidth > availableSpace) - { - outLength = 0; // cheezy bailout - return; - } - - if (ellipsisWidth == availableSpace) - { - outLength = 1; - s[0] = ellipsis; - return; - } - - - // - // Find block of text that takes up half of the available space - // on the left. (minus half the ellipsis) - // - - halfSpace = ((availableSpace >> 1) - (ellipsisWidth >> 1)); - index = halfSpace/8 + 1; // just a beginning guess - - alreadyFit = false; - - do - { - width = ::TextWidth(s, 0, index + 1); - - // Too wide ?, go narrow - if (width > halfSpace) - { - index--; - - // If we fit with the step back, bail - if (alreadyFit) - break; - } - else - - // Do we fit ? try wider - if (width < halfSpace) - { - index++; - alreadyFit = true; // we'll try adding one more char, - // but if it fails, just bounce back - // to this case - } - else - break; - - if (index == -1) - break; // no room for any text on the left - - XP_ASSERT(index < outLength); - - } while (true); - - - // jam in the ellipsis - s[index+1] = ellipsis; - length = index+1; - - // - // if index is 0, we have no room for anything - // but the ellipsis, so bail - // - if (index == -1) - { - outLength = 1; - return; - } - - // - // Now find text to fit to the right of the ellipsis - // - halfSpace = availableSpace - (width + ellipsisWidth); - index = outLength - (halfSpace/8); // another guess to begin - measureBytes = outLength - index + 1; - alreadyFit = false; - - do - { - width = ::TextWidth(s, index, measureBytes); - - // If we're too wide, take a step back. - if (width > halfSpace) - { - index++; - measureBytes--; - - // - // if we already know that we fit - // with the step back, get out - // - - if (alreadyFit) - break; - } - - // If we're too narrow, go wider - else if (width < halfSpace) - { - index--; - measureBytes++; - alreadyFit = true; // we'll try adding one more char, - // but if it fails, just bounce back - // to this case - } - else - break; - - - if (index > outLength) - { - measureBytes = 0; // no room for any text on the right - break; - } - - XP_ASSERT(index > 0); - - } while (true); - - - if (measureBytes != 0) - { - // - // shift the right half of the text down to meet the ellipsis - // - ::BlockMoveData( &s[index], &s[length+1], measureBytes); - - length += measureBytes; - } - - outLength = length; - - XP_ASSERT( ::TextWidth(s, 0, outLength) <= availableSpace ); -#endif -} - - - - diff --git a/mozilla/cmd/macfe/central/mfinder.h b/mozilla/cmd/macfe/central/mfinder.h deleted file mode 100644 index fc265d78942..00000000000 --- a/mozilla/cmd/macfe/central/mfinder.h +++ /dev/null @@ -1,295 +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. - */ - -// mfinder.h - -#pragma once -#include "PascalString.h" -#include "prtypes.h" - -#define WIGLY_LEFT_OFFSET 0 -#define ICON_WIDTH 16 -#define ICON_HEIGHT 16 -#define LEVEL_OFFSET 10 - -#define NO_COLUMN -1 -#define HEADER_ROW -2 - -#define NO_CELL 0 -#define LAST_CELL 0xFFFF - -#define HIER_COLUMN 0 - -#define WIGLY_CLOSED_ICON 3060 -#define WIGLY_OPEN_ICON 3061 -#define WIGLY_INBETWEEN_ICON 3062 -#define FOLDER_ICON 3064 - -#define SETFLAG( x, f ) ((x)|=(f)) -#define CLEARFLAG( x, f ) ((x)&=~(f)) - -#define NUM_COLUMNS 10 - -#define DRAG_NONE 0 -#define DRAG_INSIDE 1 -#define DRAG_AFTER 2 -#define DRAG_BEFORE 3 - - -// Gets around horrible bug in Apple's ::TruncText call -// that manifests itself in certain cases if you try to -// truncate in the middle -#define CUSTOM_MIDDLE_TRUNCATION 666 -void MiddleTruncationThatWorks(char *s, Int16 &ioLength, Int16 availableSpace); -void MiddleTruncationThatWorks(StringPtr s, SInt16 availableSpace); - -class LFinderView; - -typedef Point Cell; - -#include -#include -#include - -class LFinderHeader: public LView -{ -public: - enum { class_ID = 'FNHD' }; - - LFinderHeader(); - LFinderHeader( LStream* inStream ); - - virtual void SetFinderView( LFinderView* finder ) { fFinder = finder; } - - virtual void DrawSelf(); - virtual void ClickSelf( const SMouseDownEvent& where ); - virtual void AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ); - - virtual void DrawColumn( UInt16 column ); - virtual void TrackReorderColumns( const SMouseDownEvent& where, UInt16 column ); -protected: - LFinderView* fFinder; - ResIDT fTextTraits; -}; - -class LFinderView: public LView, - public LDragAndDrop, - public LCommander -{ -public: - friend class LFinderHeader; - - enum { class_ID = 'FDTA' }; - - LFinderView( LStream* inStream ); - virtual void FinishCreateSelf(); - - virtual void CaculateFontRect(); - - virtual Boolean IsCellSelected( Int32 /* cell */ ) { return FALSE; } - virtual UInt32 CellIndentLevel( Int32 /* cell */ ) { return 0; } - virtual ResIDT CellIcon( Int32 /* cell */ ) { return 0; } - virtual Boolean IsCellHeader( Int32 /* cell */ ) { return FALSE; } - virtual Boolean IsHeaderFolded( Int32 /* cell */ ) { return FALSE; } - virtual void CellText( Int32 /* cell */, CStr255& text ) - { text = CStr255::sEmptyString; } - virtual Style CellTextStyle( Int32 /* cell */ ) { return normal; } - virtual Style ColumnTextStyle( UInt16 /* column */ ) { return normal; } - virtual TruncCode ColumnTruncationStyle( UInt16 /* column */ ) { return smTruncEnd; } - - // ¥¥Êoverride - virtual void* GetCellData( UInt32 /* cell */ ) { return NULL; } - - virtual Boolean SyncDisplay( UInt32 /* visCells */ ) { return FALSE; } // Resize the view to the number of bookmarks - virtual void SelectItem( const EventRecord& /* rec */, UInt32 /* cell */, Boolean /* refresh */ ) { } - virtual void FoldHeader( UInt32 /* cell */, Boolean /* fold */, Boolean /* refresh */, Boolean /* foldAll */ ) { } - virtual void DoDoubleClick( UInt32 cell, const EventRecord &event ); - virtual void ClearSelection() { } - virtual UInt32 GetVisibleCount() { return 0; } - virtual UInt32 FirstSelectedCell() { return 0; } - virtual void GetCellRect( UInt32 cell, Rect& rect ); - virtual void GetColumnRect( UInt32 cell, UInt16 columnID, Rect& r ); - virtual void RevealCell( UInt32 cell ); - virtual UInt16 GetNumberOfColumns() { return fNumberColumns; } - virtual void GetColumnTitle( UInt16 column, CStr255& title ); - - virtual UInt16 GetColumnHeight() { return fCellHeight; } - - virtual void RefreshCells( Int32 first, Int32 last, - Boolean rightAway ); // Using refresh, or right away? - - virtual void SwapColumns( UInt16 columnA, UInt16 columnB ); - virtual void SortByColumnNumber( UInt16 column, Boolean switchOrder ); - - virtual Int16 InResizableColumnBar( const Point where ); - virtual Int16 InColumn( const Point where ); - virtual void TrackResizeColumn( const SMouseDownEvent& where, UInt32 cell, Int16 column ); - - // ¥¥ PowerPlant overrides - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - virtual void DrawSelf(); - virtual Boolean FocusDraw(LPane* inSubPane = nil); - virtual Boolean HandleKeyPress( const EventRecord& inEvent ); - virtual Boolean ObeyCommand( CommandT inCommand, void* ioParam ); - virtual void ClickSelf( const SMouseDownEvent& where ); - virtual void ResizeFrameBy( Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh ); - virtual void PutOnDuty(LCommander* inNewTarget); - virtual void TakeOffDuty(); - - // ¥¥Êdrag & drop - virtual void AddFlavors( DragReference inDragRef ); - virtual void MakeDragRegion( DragReference inDragRef, RgnHandle dragRegion ); - - virtual void InsideDropArea( DragReference inDragRef ); - virtual void LeaveDropArea( DragReference inDragRef ); - virtual void DoDragSendData( FlavorType /* flavor */, ItemReference /* itemRef */, DragReference /* dragRef */ ) { } - virtual Boolean ItemIsAcceptable( DragReference /* inDragRef */, ItemReference /* inItemRef */ ) { return FALSE; } - virtual void ReceiveDragItem( DragReference /* inDragRef */, DragAttributes /* inDragAttrs */, - ItemReference /* inItemRef */, Rect& /* inItemBounds */ ) { } - - virtual void HiliteDropArea( DragReference /* inDragRef */ ) { } - - - void SetForeColor( const RGBColor& fore ); - void SetBackColor( const RGBColor& back ); - - virtual void DrawIcon( Handle iconSuite, - Boolean selected, - const Rect& where ); - - virtual void DrawText( const Style& style, - const CStr255& text, - const Rect& where, - const TruncCode& trunc ); - - virtual void SavePlace( LStream* inStream ); - virtual void RestorePlace( LStream* inStream ); - - virtual void RefreshHeader(); - - virtual void DragScroll(DragReference /* theDragRef */) { } - -protected: - struct DropLocation - { - UInt32 cell; - UInt32 where; - }; - - // ¥¥ cell drawing - // override - virtual UInt32 FetchCellAt( SPoint32& imagePt ); // Cell at this coordinate - - virtual void KeyUp( const EventRecord& event ); - virtual void KeyDown( const EventRecord& event ); - virtual void KeyEnter( const EventRecord& event ); - virtual void KeyHome( const EventRecord& event ); - virtual void KeyEnd( const EventRecord& event ); - virtual void KeyPageUp( const EventRecord& event ); - virtual void KeyPageDown( const EventRecord& event ); - - virtual void RefreshSelectedCells(); - - // ¥¥ access - virtual void GetVisibleCells( UInt32& top, UInt32& bottom ); // Get visible cells - virtual void DrawCellAt( UInt32 cell ); // Draw the cell - virtual void DrawCellColumn( UInt32 cell, UInt16 column ); - - virtual Int16 GetClickKind( const SMouseDownEvent& where, UInt32 cell, - Boolean& inBar ); // Where did we click? - virtual void DoResizeColumn( Int16 column, Int16 delta, Boolean inRefresh ); - virtual Boolean DispatchClick( const SMouseDownEvent& where, UInt32 cell, Int16 column ); - - virtual Boolean TrackHeader( const SMouseDownEvent& where, UInt16 column ); - - void LocalToGlobalRect( Rect& r ); - Boolean SectCellRect( UInt32 cell, Rect r ); // Does cell intersect this local rect? - - virtual void HighlightDropLocation( Boolean show ); // TRUE to show highlight, FALSE to hide - virtual void MakeDragTask( const SMouseDownEvent & /* where */ ) { } - - virtual Boolean ResizeTo( UInt32 newHeight, UInt32 newWidth ); - - virtual void DrawHierarchy( UInt32 cell ); - virtual Boolean CanDrawHierarchy( UInt32 cell ); - - virtual void TrackWigly( const SMouseDownEvent& where, UInt32 cell ); - virtual void TrackCell( const SMouseDownEvent& where, UInt32 cell ); - virtual void TrackSpace( const SMouseDownEvent& where, UInt32 cell ); - virtual Boolean TrackMark( UInt16 columnID, const SMouseDownEvent& where, UInt32 cell, - UInt16 drawIconID, UInt16 notDrawIconID ); - - virtual void GetWiglyRect( UInt32 cell, Rect& rect ); - virtual void GetIconRect( UInt32 cell, Rect& rect ); - virtual void GetTextRect( UInt32 cell, Rect& rect ); - virtual void HighlightCell( UInt32 cell ); - - virtual Boolean ColumnText( UInt32 cell, UInt16 column, CStr255& text ); - - virtual void AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ); - - virtual void RemoveColumn( UInt16 column ); - virtual void InsertColumn( UInt16 before, UInt16 columnID, UInt16 width ); - - virtual void DrawText( const Style& style, - const CStr255& text, - const Rect& where, - const TruncCode& trunc, - ResIDT inTextTraits, - Int16 baseline ); - - Boolean fClipImage; - Boolean fAllowsRectSelection; - Boolean fAllowsKeyNavigation; - Boolean fHighlightRow; - - UInt16 fCellHeight; - UInt16 fBaseline; - ResIDT fTextTraits; // Font - RGBColor fForeColor; - RGBColor fBackColor; - - Int16 fNumberColumns; - Int16 fColumnOffsets[ NUM_COLUMNS ]; - Int16 fColumnIDs[ NUM_COLUMNS ]; - LFinderHeader* fHeader; - - DropLocation fDragTarget; - SBooleanRect fDragLeaveDirection; -}; - -class LDragFinderTask: public LDragTask -{ -public: - LDragFinderTask( const EventRecord& inEventRecord, LFinderView* view ); - virtual ~LDragFinderTask(); - - virtual void AddFlavors( DragReference inDragRef ); - virtual void MakeDragRegion( DragReference inDragRef, RgnHandle inDragRegion ); - -protected: - - static pascal OSErr ScrollingTracker( DragTrackingMessage message, - WindowPtr theWindow, - void * handlerRefCon, - DragReference theDragRef ); - - DragTrackingHandlerUPP fTrackerProc; - LFinderView* fView; -}; diff --git a/mozilla/cmd/macfe/central/mforms.cp b/mozilla/cmd/macfe/central/mforms.cp deleted file mode 100644 index 8b2c283f067..00000000000 --- a/mozilla/cmd/macfe/central/mforms.cp +++ /dev/null @@ -1,3840 +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. - */ - -// mforms.cp - contains all the form widgets. - -// macfe -#include "Netscape_Constants.h" -#include "mforms.h" -#include "uprefd.h" -#include "macgui.h" -#include "macutil.h" -#include "resgui.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "xpassert.h" -#include "UFormElementFactory.h" -#include "CBrowserContext.h" -#include "CBrowserWindow.h" -#include "CHTMLView.h" -#include "CWindowMediator.h" -#include "uintl.h" - -// xp -#include "proto.h" -#include "lo_ele.h" -#include "xlate.h" -#include "shist.h" -#include "libevent.h" -#include "layers.h" // mjc -#include "prefapi.h" -#include "intl_csi.h" -#include "edt.h" - -// PP -//#include -//#include -//#include -#include -#include -#include -#include - -#include "CSimpleTextView.h" -#include "CFormattingToolBar.h" - -#include "UUnicodeTextHandler.h" -#include "UUTF8TextHandler.h" -#include "UFixedFontSwitcher.h" -#include "UPropFontSwitcher.h" -#include "UFontSwitcher.h" -#include "CMochaHacks.h" -#include -#include - -// macros -#define FEDATAPANE ((FormFEData *)formElem->element_data->ele_minimal.FE_Data)->fPane -#define FEDATAHOST ((FormFEData *)formElem->element_data->ele_minimal.FE_Data)->fHost -#define FEDATACOMMANDER ((FormFEData *)formElem->element_data->ele_minimal.FE_Data)->fCommander - -// debugging -//#define DEBUG_FORMS -#ifdef DEBUG_FORMS -void TraceForm(char * what, LO_FormElementStruct *formElem); -void TraceForm(char * what, LO_FormElementStruct *formElem) -{ - XP_TRACE(("Routine: %s, formEle %d, type %d, FE_Data %d \n", - what, (Int32)formElem, (Int32)formElem->type, - (Int32)formElem->element_data->ele_minimal.FE_Data)); -} -#define XP_TRACEFORM(ROUTINE, FORM) TraceForm(ROUTINE, FORM) -#else -#define XP_TRACEFORM(ROUTINE, FORM) -#endif - -inline FormFEData *GetFEData(LO_FormElementStruct *formElem) { return ((FormFEData *)formElem->element_data->ele_minimal.FE_Data); } -inline LPane *GetFEDataPane( LO_FormElementStruct *formElem) { return FEDATAPANE; } -inline void SetFEDataPane(LO_FormElementStruct *formElem, LPane *p) { FEDATAPANE = p; } - -static void FocusFormElementTimer( LO_FormElementStruct * formElement ); -static void BlurFormElementTimer( LO_FormElementStruct * formElement ); - -static void MochaFocusCallback(MWContext * pContext, LO_Element * lo_element, int32 lType, void * whatever, ETEventStatus status); -static void MochaChangedCallback(MWContext * pContext, LO_Element * lo_element, int32 lType, void * whatever, ETEventStatus status); - -static void MochaClick( MWContext* context, LO_Element* ele, CMochaEventCallback * cb ); -static void MochaMouseUp( MWContext* context, LO_Element* ele, CMochaEventCallback * cb ); -//static void MochaKeyPress( MWContext* context, LO_Element* ele, CMochaEventCallback * cb, EventRecord inKeyEvent ); - -void FE_RaiseWindow(MWContext* inContext); -void FE_LowerWindow( MWContext* inContext); - -// Drawing setup -// Sets up the colors for drawing forms -StSetupFormDrawing::StSetupFormDrawing( LPane* formElement ) -{ - fForm = formElement; - - UGraphics::SetWindowColor( fForm->GetMacPort(), wTextColor, CPrefs::GetColor( CPrefs::Black ) ); - UGraphics::SetWindowColor( fForm->GetMacPort(), wContentColor, CPrefs::GetColor( CPrefs::White ) ); -} - -StSetupFormDrawing::~StSetupFormDrawing() -{ -// FIX ME! Why do we do this? - CHTMLView* view = (CHTMLView*)fForm->GetSuperView(); - - UGraphics::SetWindowColor( fForm->GetMacPort(), wTextColor, CPrefs::GetColor( CPrefs::Black ) ); - if (view) - UGraphics::SetWindowColor( fForm->GetMacPort(), wContentColor, view->GetBackgroundColor() ); -} - -/*----------------------------------------------------------------------------- - FormFEData - -----------------------------------------------------------------------------*/ -FormFEData::FormFEData() -{ - fPane = NULL; - fHost = NULL; -} - -FormFEData::~FormFEData() -{ - // Schedule the form element to be - // destroyed at idle time - if (fHost != NULL) - { - fHost->MarkForDeath(); - fHost->SetFEData(NULL); - - } - - fPane = NULL; - fHost = NULL; - fCommander = NULL; -} - - - - -#pragma mark == FormsPopup == - -/*----------------------------------------------------------------------------- - Forms Popup - Displays a FORM_TYPE_SELECT_ONE structure ------------------------------------------------------------------------------*/ - -FormsPopup::FormsPopup (CGAPopupMenu * target, lo_FormElementSelectData_struct * selections) -: StdPopup (target), LFormElement() -{ - fSelections = selections; - fFocusState = FocusState_None; - fSavedFocus = nil; - fOldValue = -1; - target->SetMaxValue(selections->option_cnt); - SetReflectOnChange(true); -} - -short -FormsPopup::GetCount () -{ - return fSelections->option_cnt; -} - -CStr255 -FormsPopup::GetText (short item) -{ - lo_FormElementOptionData *options = nil; - PA_LOCK (options, lo_FormElementOptionData*, fSelections->options); - CStr255 text; - PA_LOCK (text, char*, options[item-1].text_value); - PA_UNLOCK (options[item-1].text_value); - PA_UNLOCK (fSelections->options); - - if (text == "") - text = " "; - return text; -} - - -/* - FormsPopup::ExecuteSelf - - 2 important things here when we're handling a click... - - 1) if the value of the popup changes, we call MochaChanged - 2) popups have onFocus and onBlur handlers in Javascript, so - we fake giving the popup focus, even though they really - don't get focus on Macs. So we give it focus real quick, - then take it away after the click is handled. Yippee. - -*/ -void -FormsPopup::ExecuteSelf(MessageT inMessage, - void* ioParam ) -{ - fTarget->SetNeedCustomDrawFlag(NeedCustomPopup()); - // we're only interested in clicks - if (inMessage == msg_Click) - { - fOldValue = fTarget->GetValue(); - mExecuteHost = true; - // Temporarily give focus to the popup in Javascript land - if (this != sTargetedFormElement) - { - // If we aren't targeted form element, set sTargetedFormElement - // to popup menu and blur currently targeted form element - if (sTargetedFormElement != NULL) { - fSavedFocus = sTargetedFormElement; - sTargetedFormElement->MochaFocus(false); - } - // 97-06-14 pkc -- set fFocusState to execute correct code on callback - fFocusState = FocusState_FirstCall; - // focus popup menu - MochaFocus(true); - } - else { - // 97-06-14 pkc -- set fFocusState to execute correct code on callback - fFocusState = FocusState_FirstCall; - // focus popup menu - MochaFocus(true); - } - } - else { - StdPopup::ExecuteSelf(inMessage, ioParam); - } -} -// -// do ScriptCode Menu Trick on IM:MacTbxEss Page3-46 -// -// Good for most encoding except -// Greek, Turkish, and UTF8 -// -void -FormsPopup::SetMenuItemText(MenuHandle aquiredMenu, int item, CStr255& itemText) -{ - StdPopup::SetMenuItemText( aquiredMenu, item, itemText); - if (! NeedDrawTextInOurOwn()) - { - // do ScriptCode Menu Trick on IM:MacTbxEss Page3-46 - CCharSet charset; - if(CPrefs::GetFont(GetWinCSID(), &charset)) - { - ::SetItemCmd (aquiredMenu, item, 0x1c ); - ::SetItemIcon (aquiredMenu, item, charset.fFallbackFontScriptID ); - } - } -} -// -// Decide wheather we use override SetMenuItemText or PopUpMenuSelect -// -Boolean FormsPopup::NeedDrawTextInOurOwn() const -{ - return (fContext && - (GetWinCSID() == CS_UTF8)); -} -void FormsPopup::DrawTruncTextBox (CStr255 text, const Rect& box) -{ - if(GetWinCSID() == CS_UTF8) - { - /* - Truncates the text before drawing. - Does not word wrap. - */ - FontInfo fontInfo; - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - - th->GetFontInfo (fs, &fontInfo); - MoveTo (box.left, box.bottom - fontInfo.descent -1); - // ¥¥¥ÊFix me - // UTF8 vresion does not truncate for now. - // TruncString (box.right - box.left, text, truncEnd); - - th->DrawString (fs, text); - } - else - { - StdPopup::DrawTruncTextBox(text, box); - } -} - -Boolean FormsPopup::NeedCustomPopup() const -{ - XP_Bool useGrayscaleFormControls = false; - int prefResult = PREF_GetBoolPref("browser.mac.use_grayscale_form_controls", &useGrayscaleFormControls); - - return (prefResult != PREF_NOERROR || !useGrayscaleFormControls || NeedDrawTextInOurOwn()); -} - -// 97-06-14 pkc -- state machine callback hack to handle onFocus correctly -void FormsPopup::PostMochaFocusCallback() -{ - if (fFocusState == FocusState_FirstCall) { - // - // Call through to handle the click, and let - // Javascript know if the value changed - // - Assert_(fTarget != NULL); - - if (fOldValue != fTarget->GetValue()) { - fFocusState = FocusState_SecondCall; - MochaChanged(); - } - else { - // Restore original focus state - // First, blur popup menu - // 97-06-14 pkc -- set fFocusState to execute correct code on callback - fFocusState = FocusState_ThirdCall; - MochaFocus(false, false); - // 97-06-20 pkc -- set sTargetedFormElement to NULL becuase popup menus - // aren't really targeted - sTargetedFormElement = NULL; - } - } - else if (fFocusState == FocusState_SecondCall) { - // Restore original focus state - // First, blur popup menu - // 97-06-14 pkc -- set fFocusState to execute correct code on callback - fFocusState = FocusState_ThirdCall; - MochaFocus(false, false); - // 97-06-20 pkc -- set sTargetedFormElement to NULL becuase popup menus - // aren't really targeted - sTargetedFormElement = NULL; - } - else if (fFocusState == FocusState_ThirdCall) { - // Restore original focus state - // Now focus previously focused element if there was one - if (fSavedFocus != NULL) { - fSavedFocus->MochaFocus(true); - fSavedFocus = NULL; - } - } -} - -#pragma mark == LFormElement == - -int16 LFormElement::GetWinCSID() const -{ - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(fContext); - - return INTL_GetCSIWinCSID(csi); -} - -#pragma mark == CWhiteEditField == - -CWhiteEditField::CWhiteEditField(LStream *inStream) - : CTSMEditField(inStream), LFormElement() -{ -} - -// Draws background to white -void -CWhiteEditField::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - ::InsetRect(&frame, 1,1); - ::EraseRect(&frame); - - CTSMEditField::DrawSelf(); - - ::InsetRect(&frame, -1,-1); - UGraphics::FrameRectSubtle(frame, true); -} - - -void -CWhiteEditField::BeTarget() -{ - CTSMEditField::BeTarget(); - MochaFocus(true); -} - -void -CWhiteEditField::DontBeTarget() -{ - - MochaFocus(false); // this must go first because - // it might indirectly set us to be the target again, - // which would be wrong. - - CTSMEditField::DontBeTarget(); -} - -void -CWhiteEditField::UserChangedText() -{ - CTSMEditField::UserChangedText(); - MochaChanged(); -} - -void -CWhiteEditField::ClickSelf( const SMouseDownEvent& event) -{ - SInt16 oldSelStart, oldSelEnd; - - oldSelStart = (**mTextEditH).selStart; - oldSelEnd = (**mTextEditH).selEnd; - - CTSMEditField::ClickSelf(event); - - if (oldSelStart != (**mTextEditH).selStart || - oldSelEnd != (**mTextEditH).selEnd) - { - MochaSelect(); - } -} - -Boolean -CWhiteEditField::HandleKeyPress(const EventRecord& inKeyEvent) -{ - if (keyUp == inKeyEvent.what) return true; // ignore key ups for now - else return CTSMEditField::HandleKeyPress(inKeyEvent); -} - - -#pragma mark == CFormLittleText == - -//--------------------------------------------------------------------------- -// class CFormLittleText -//--------------------------------------------------------------------------- - -CFormLittleText::CFormLittleText(LStream *inStream) : CWhiteEditField(inStream) -{ - fDoBroadcast = FALSE; - fLOForm = NULL; -#ifdef LAYERS - // add an attachment which will intercept key events and dispatch them to layers - CLayerKeyPressDispatchAttachment* led = new CLayerKeyPressDispatchAttachment; - AddAttachment(led); -#endif -} - -void CFormLittleText::BroadcastValueMessage() -{ - BroadcastMessage(msg_SubmitText, (void*) this); -} - -void CFormLittleText::SetVisibleChars(Int16 visChars) -{ - FocusDraw(); - UTextTraits::SetPortTextTraits(mTextTraitsID); - FontInfo fInfo; - ::GetFontInfo(&fInfo); - - ResizeFrameTo(::CharWidth('a') * visChars + 6, fInfo.ascent + fInfo.descent+ fInfo.leading + 4, FALSE); -} - -// Key events are intercepted by an attachment, routed through layers and return -// to the front end (through FE_HandleLayerEvent) if javascript lets us have the event. -// CHTMLView::HandleKeyPressLayer calls this. -Boolean CFormLittleText::HandleKeyPress(const EventRecord& inKeyEvent) -{ - Boolean handled = false; - if (keyUp == inKeyEvent.what) return true; // ignore key ups for now - - char c = inKeyEvent.message & charCodeMask; - - if (fDoBroadcast && ((c == char_Enter) || (c == char_Return))) - { - BroadcastValueMessage(); - handled = true; - } - else - { - handled = CWhiteEditField::HandleKeyPress(inKeyEvent); - } - return handled; -} - -void CFormLittleText::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - if ( inCommand == cmd_Cut || inCommand == cmd_Copy ) - { - lo_FormElementTextData* textData; - if ( fLOForm ) - { - textData = (lo_FormElementTextData*)fLOForm->element_data; - if ( textData && textData->type == FORM_TYPE_PASSWORD ) - { - outEnabled = FALSE; - return; - } - } - } - CWhiteEditField::FindCommandStatus( inCommand, outEnabled, outUsesMark, outMark, outName ); -} - -void CFormLittleText::BeTarget() -{ -// FIX ME! -// ((CHyperView*)mSuperView)->ShowView(this); - CHTMLView* theHTMLView = dynamic_cast(GetSuperView()); - if (theHTMLView) - theHTMLView->ShowView(*this); - - CWhiteEditField::BeTarget(); -} -StringPtr CFormLittleText::GetDescriptor( - Str255 outDescriptor) const -{ - if(fContext && (CS_UTF8 == GetWinCSID())) - { - Str255 nonUTF8Str; - StringPtr nonUTF8text; - nonUTF8text = CWhiteEditField::GetDescriptor(nonUTF8Str); - int16 font_csid = ScriptToEncoding(FontToScript((**UTextTraits::LoadTextTraits(mTextTraitsID)).fontNumber)); - char* utf8text = (char*) INTL_ConvertLineWithoutAutoDetect(font_csid, CS_UTF8, nonUTF8text+ 1, nonUTF8text[0] ); - if(utf8text) - { - int len = XP_STRLEN(utf8text); - if(len > 254) - len = 254; - outDescriptor[0] = len; - XP_MEMCPY((outDescriptor + 1), utf8text, len ); - XP_FREE(utf8text); - return outDescriptor; - } - else - { - outDescriptor[0] = 0; // somehow we cannot get Descriptor - return outDescriptor; - } - } else { - return CWhiteEditField::GetDescriptor(outDescriptor); - } -} -void CFormLittleText::SetDescriptor( - ConstStr255Param inDescriptor) -{ - if(fContext && (CS_UTF8 == GetWinCSID())) - { - // Find out the font csid - int16 font_csid = ScriptToEncoding(FontToScript((**UTextTraits::LoadTextTraits(mTextTraitsID)).fontNumber)); - // Convert the UTF8 text into non-UTF8 text - char* nonUTF8text = (char*) INTL_ConvertLineWithoutAutoDetect(CS_UTF8, font_csid, (unsigned char*)inDescriptor+ 1, inDescriptor[0] ); - if(nonUTF8text) - { - int len = XP_STRLEN(nonUTF8text); - if(len > 254) len = 254; - Str255 nonUTF8Str; - nonUTF8Str[0] = len; - XP_MEMCPY((nonUTF8Str + 1), nonUTF8text, len ); - XP_FREE(nonUTF8text); - CWhiteEditField::SetDescriptor(nonUTF8Str); - } - else - { - CWhiteEditField::SetDescriptor("\p"); // Somehow we failed. set it to null string - } - } else { - CWhiteEditField::SetDescriptor(inDescriptor); - } -} - -#pragma mark == CFormBigText == - -//--------------------------------------------------------------------------- -// class CFormBigText -//--------------------------------------------------------------------------- - -CFormBigText::CFormBigText(LStream *inStream) - : CSimpleTextView(inStream), - LFormElement() -{ - -#ifdef LAYERS - // add an attachment which will intercept key events and dispatch them to layers - CLayerKeyPressDispatchAttachment* led = new CLayerKeyPressDispatchAttachment; - AddAttachment(led); -#endif -} - -CFormBigText::~CFormBigText() -{ - PostAction(NULL); -} - -void CFormBigText::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - ::InsetRect(&frame, 1,1); - ::EraseRect(&frame); - - CSimpleTextView::DrawSelf(); -} - -Boolean CFormBigText::ObeyCommand(CommandT inCommand, void* ioParam) -{ - Boolean cmdHandled = true; - - switch (inCommand) - { - case msg_TabSelect: - if (!IsEnabled()) - { - cmdHandled = false; - break; - } - inCommand = cmd_SelectAll; - // fall through to default ... - - default: - cmdHandled = CSimpleTextView::ObeyCommand(inCommand, ioParam); - break; - } - return cmdHandled; -} - -Boolean CFormBigText::FocusDraw(LPane* /*inSubPane*/) -{ -// CSimpleTextView::SetMultiScript(fContext && (GetWinCSID() == CS_UTF8)); - if (CSimpleTextView::FocusDraw()) - { - UGraphics::SetBack(CPrefs::White); - return TRUE; - } - else - return FALSE; -} - -void CFormBigText::BeTarget() -{ -// Show scrollbar inside the hyperview -// FIX ME! -// ((CHyperView*)(mSuperView->GetSuperView()))->ShowView(mSuperView); -#if 0 // Disable auto scrolling. This auto scrolling breaks click selection since the mouse location isn't updated - // - if (GetSuperView()) - { - CHTMLView* theHTMLView = dynamic_cast(GetSuperView()->GetSuperView()); - if (theHTMLView) - theHTMLView->ShowView(*GetSuperView()); - } -#endif // 0 - CSimpleTextView::BeTarget(); - MochaFocus(true); -// CSimpleTextView::SetMultiScript(fContext && (GetWinCSID() == CS_UTF8)); -} - - - - -void -CFormBigText::DontBeTarget() -{ - MochaFocus(false); - CSimpleTextView::DontBeTarget(); -} - - -void CFormBigText::ClickSelf(const SMouseDownEvent& event) // to call MochaSelect -{ - - SInt32 selStart = 0; - SInt32 selEnd = 0; - -// GetSelection( &selStart, &selEnd ); -// SInt32 theOldRange = selEnd - selStart; - - CSimpleTextView::ClickSelf(event); - -// GetSelection( &selStart, &selEnd ); -// SInt32 theNewRange = selEnd - selStart; - -// if (theOldRange != theNewRange) -// MochaSelect(); - - } - -// The textengine sends us a message when the text changes -/* -void CFormBigText::ListenToMessage(MessageT inMessage, void *ioParam) // to call MochaChanged -{ -// if (inMessage == msg_CumulativeRangeChanged) -// MochaChanged(); - -// CSimpleTextView::ListenToMessage(inMessage, ioParam); -} -*/ - - -// VText's text engine used to broadcast stuff if something changed. WASTE -// does not do this, however there is a UserChangedText method in the CWASTEEdit -// class that is called when the text is changed. I hope this will suffice... - - -void -CFormBigText::UserChangedText() - { - - MochaChanged(); - - } - - -// Key events are intercepted by an attachment, routed through layers and return -// to the front end (through FE_HandleLayerEvent) if javascript lets us have the event. -// CHTMLView::HandleKeyPressLayer calls this. -Boolean CFormBigText::HandleKeyPress(const EventRecord& inKeyEvent) -{ - Boolean handled = false; - char c = inKeyEvent.message & charCodeMask; - - if (keyUp == inKeyEvent.what) handled = true; // ignore key ups for now - else handled = CSimpleTextView::HandleKeyPress(inKeyEvent); - return handled; -} - -#pragma mark == CFormHTMLArea == - -//--------------------------------------------------------------------------- -// class CFormHTMLArea -//--------------------------------------------------------------------------- - -CFormHTMLArea::CFormHTMLArea(LStream *inStream) - : CEditView(inStream), - LFormElement() -{ - -} - -CFormHTMLArea::~CFormHTMLArea() -{ -} - -void CFormHTMLArea::FinishCreateSelf() -{ - mParagraphToolbarPopup = 0; - mSizeToolbarPopup = 0; - mAlignToolbarPopup = 0; - mFontToolbarPopup = 0; - mColorPopup = 0; - - CHTMLView::FinishCreateSelf(); -} - -void CFormHTMLArea::FindCommandStatus( CommandT inCommand, Boolean& outEnabled, - Boolean& outUsesMark, Char16& outMark, Str255 outName ) -{ - outUsesMark = false; - outEnabled = false; - - // We don't want composer to control all the commands it would if it were - // not inside a form, so short circuit these and hand them off to the - // browser - switch ( inCommand ) - { - case cmd_AddToBookmarks: - case cmd_Print: - case cmd_ViewSource: - case cmd_Publish: - case cmd_Refresh: - case cmd_Reload: - case cmd_EditSource: - case cmd_BrowseDocument: - case cmd_Save: - case cmd_SaveAs: - case cmd_DocumentInfo: - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - default: - CEditView::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } -} - -Boolean CFormHTMLArea::ObeyCommand( CommandT inCommand, void *ioParam ) -{ - // We don't want composer to control all the commands it would if it were - // not inside a form, so short circuit these and hand them off to the - // browser - switch ( inCommand ) - { - case cmd_AddToBookmarks: - case cmd_Print: - case cmd_ViewSource: - case cmd_Publish: - case cmd_Refresh: - case cmd_Reload: - case cmd_EditSource: - case cmd_BrowseDocument: - case cmd_Save: - case cmd_SaveAs: - case cmd_DocumentInfo: - return LCommander::ObeyCommand (inCommand, ioParam); - break; - default: - return CEditView::ObeyCommand (inCommand, ioParam); - } -} - -void CFormHTMLArea::BeTarget() -{ - if (!mParagraphToolbarPopup) - { - // lazy initialization of pointers to toolbar controls - LView *view = GetSuperView(); // parent - view = view->GetSuperView(); // grandparent - view = view->GetSuperView(); // greatgrandparent - Assert_(view); - - // implicit assumption that formatting controls are somewhere in the greatgrandparent view. - // if we switch around the formatting interface for htmlareas this code may need - // to be updated. - mParagraphToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Paragraph_Hierarchical_Menu ); - mSizeToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Font_Size_Hierarchical_Menu ); - mAlignToolbarPopup = (CPatternButtonPopup *)view->FindPaneByID( cmd_Align_Hierarchical_Menu ); - mFontToolbarPopup = (CFontMenuPopup *)view->FindPaneByID( 'Font' ); - mColorPopup = (CColorPopup *)view->FindPaneByID( 'Colr' ); - - // Also, tell the toolbar about us. - CHTMLAreaToolBar *toolbar = (CHTMLAreaToolBar *)view->FindPaneByID( 'ftfv' ); - Assert_(toolbar); - toolbar->SetEditView(this); - - } - MochaFocus(true); - CEditView::BeTarget(); -} - -void CFormHTMLArea::DontBeTarget() -{ - MWContext* context = *GetNSContext(); - if (context) - { - if (EDT_DirtyFlag(context)) - { - MochaChanged(); - EDT_SetDirtyFlag( context, false ); - } - } - // Must call MochaChanged() BEFORE MochaFocus(false), because MochaChanged - // merely lights a bit - MochaFocus() is what sees that and actually sends the - // CHANGE event to javascript. - MochaFocus(false); - CEditView::DontBeTarget(); -} - -#pragma mark == CNonPrintingView == - -//--------------------------------------------------------------------------- -// class CNonPrintingView -//--------------------------------------------------------------------------- - -// An experiment with putting forms in a non-printing view - -CNonPrintingView::CNonPrintingView(LStream * inStream) : LView(inStream) -{ -} - -CNonPrintingView::~CNonPrintingView() -{ -} - -void -CNonPrintingView::PrintPanel( - const PanelSpec &inPanel, - RgnHandle inSuperPrintRgnH) -{ -} - - -void -CNonPrintingView::SuperPrintPanel( - const PanelSpec &inSuperPanel, - RgnHandle inSuperPrintRgnH) -{ -} - - -#pragma mark == CFormList == - -//--------------------------------------------------------------------------- -// class CFormList -//--------------------------------------------------------------------------- - -// We use the CallerLDEF approach from the March 1995 Develop article "An Object-Oriented -// Approach to Hierarchical Lists." The author of the article is Jan Bruyndonckx. - -CFormList::CFormList(LStream * inStream) : LListBox(inStream), LFormElement() -{ - fLongestItem = 36; - ::LAddColumn(1, 0, mMacListH); - SetReflectOnChange(true); - - (*mMacListH)->refCon = (long) callerLDEFUPP ; // put address of callback in refCon - (*mMacListH)->userHandle = (Handle) this ; // keep a pointer to ourself - -} - -CFormList::~CFormList() -{ - Rect theNullRect = { 0, 0, 0, 0 }; - - ControlHandle& theScrollBar = (*mMacListH)->vScroll; - if (theScrollBar != NULL) - (*theScrollBar)->contrlRect = theNullRect; - - theScrollBar = (*mMacListH)->hScroll; - if (theScrollBar != NULL) - (*theScrollBar)->contrlRect = theNullRect; - - // we're not necessarily destroyed because our - // superview is, so we need to explicitly kill - // the focus box. - if (mFocusBox != NULL) - delete mFocusBox; -} - -ListDefUPP CFormList::callerLDEFUPP = NewListDefProc (LDefProc) ; // create UPP for LDEF callback - -// ¥¥ Misc - -void CFormList::SetSelectMultiple(Boolean multipleSel) -{ - if (multipleSel) - (*mMacListH)->selFlags = lUseSense; - else - (*mMacListH)->selFlags = lOnlyOne; -} - -// Add an item to the list. Figure out its length so we can shrinkToFit -void CFormList::AddItem( const cstring& itemName, SInt16 rowNum ) -{ - Point aCell; - - aCell.h = 0; - aCell.v = rowNum; - ::LSetCell( itemName.data(), itemName.length(), aCell, mMacListH ); - long newLength; - if(GetWinCSID() == CS_UTF8) - { - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - newLength = th->TextWidth(fs, (char*)itemName.data(), (int)itemName.length()); - } else { - newLength = ::TextWidth( itemName.data(), 0, itemName.length()); - } - newLength += 26; - if ( newLength > fLongestItem ) - fLongestItem = newLength; -} - - -void CFormList::SetTextTraits() -{ - UTextTraits::SetPortTextTraits(mTextTraitsID); -} - -void CFormList::SyncRows( UInt16 nRows ) -{ - if ( (**mMacListH).dataBounds.bottom > nRows ) - ::LDelRow( (**mMacListH).dataBounds.bottom - nRows, nRows, mMacListH ); - else - ::LAddRow( nRows - (**mMacListH).dataBounds.bottom, (**mMacListH).dataBounds.bottom, mMacListH ); -} - - -void -CFormList::BeTarget() -{ - LListBox::BeTarget(); - MochaFocus(true); -} - - -void -CFormList::DontBeTarget() -{ - LListBox::DontBeTarget(); - MochaFocus(false); -} - - -// Selecting items -void CFormList::SetSelect(int item, Boolean selected) -{ - FocusDraw(); - Point aCell; - SetPt(&aCell, 0, item); - ::LSetSelect(selected,aCell,mMacListH); -} - -void CFormList::SelectNone() -{ - Cell c; - SInt16 total = (*mMacListH)->dataBounds.bottom; - - c.h = 0; - - FocusDraw(); - - ::LSetDrawingMode(false, mMacListH); - // Just a friendly reminder, List Mangler cell - // coords are zero based. - for (c.v = 0; c.v < total; c.v++) - ::LSetSelect(false, c, mMacListH); - - ::LSetDrawingMode(true, mMacListH); - - Refresh(); -} - - -/* -void -CFormList::Reset( lo_FormElementSelectData * selectData - Boolean resetSelection, - Boolean resetOptions ) -{ - lo_FormElementOptionData * mother; - - PA_LOCK(mother, lo_FormElementOptionData *, selectData->options); - for (int i=0; ioption_cnt; i++) - { - char * itemName = NULL; - Boolean select; - - PA_LOCK(itemName, char*, mother[i].text_value); - myList->AddItem (itemName, 0); - PA_UNLOCK(mother[i].text_value); - - if (fromDefaults) - select = mother[i].def_selected; - else - select = mother[i].selected; - - if (select) - SetSelect(i, select); - } -} -*/ - -// Are they selected -Boolean CFormList::IsSelected(int item) -{ - Point theCell; - SetPt(&theCell, 0, item); - return (::LGetSelect(FALSE,&theCell,mMacListH)); -} - - -// Resizes the list to the width of the longest item, and visRows -void CFormList::ShrinkToFit( Int32 visRows ) -{ - // We need to adjust the height for CS_UTF8 - if(GetWinCSID() == CS_UTF8) - { - FontInfo info; - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - th->GetFontInfo(fs, &info ); - (*mMacListH)->cellSize.v = info.ascent + info.descent + info.leading; - } - ResizeFrameTo(fLongestItem, visRows * (*mMacListH)->cellSize.v+2, FALSE); // Must get a scroller in there - // We need to resize our cell to fill the whole list - Rect displayRect; - CalcLocalFrameRect(displayRect); - ::InsetRect(&displayRect, 1, 1); - displayRect.right -= 15; // To account for the scrollbar - (**mMacListH).cellSize.h = displayRect.right - displayRect.left; - -} - -// Sets background to white -Boolean CFormList::FocusDraw(LPane* /*inSubPane*/) -{ - if (LListBox::FocusDraw()) - { - UGraphics::SetBack(CPrefs::White); - return TRUE; - } - else - { - return FALSE; - } -} - -extern Boolean gIsPrinting; - - -// white background -void CFormList::DrawSelf() -{ - Rect frame; - - CalcLocalFrameRect(frame); - ::EraseRect(&frame); - LListBox::DrawSelf(); -} - -void CFormList::MakeSelection( LArray& list ) -{ - Cell look = { 0, 0 }; - - while ( ::LGetSelect( TRUE, &look, mMacListH ) ) - { - list.InsertItemsAt( 1, 1, &look ); - ::LNextCell( TRUE, TRUE, &look, mMacListH ); - } -} - -Boolean CFormList::CheckSelection( LArray& list ) -{ - Cell look = { 0, 0 }; - Cell tmp; - - while ( ::LGetSelect( TRUE, &look, mMacListH ) ) - { - if ( !list.FetchItemAt( 1, &tmp ) ) - return TRUE; - if ( tmp.v != look.v || tmp.h != tmp.h ) - return TRUE; - list.RemoveItemsAt( 1, 1 ); - ::LNextCell( TRUE, TRUE, &look, mMacListH ); - } - if ( list.GetCount() > 0 ) - return TRUE; - return FALSE; -} - - -Boolean -CFormList::HandleKeyPress(const EventRecord &inKeyEvent) -{ - char c = inKeyEvent.message & charCodeMask; - - if (keyUp == inKeyEvent.what) return true; // ignore key ups for now - - Boolean result = LListBox::HandleKeyPress(inKeyEvent); - - // there's no easy way to know if the selection changed - // because multiple items can be selected. - // - // We could basically copy LListBox into here and - // recongnize the selection to be changing. - // - // For now, however, we'll slime it and assume that - // the selection changes. - - MochaChanged(); - - return result; -} - -void CFormList::ClickSelf( const SMouseDownEvent& event ) -{ - StTempFormBlur formBlur; - - LArray list( sizeof( Cell ) ); - Boolean single; - Cell selCell; - Boolean changed; - - single = ( (**mMacListH).selFlags & lOnlyOne ) != 0; - - if ( !single ) - this->MakeSelection( list ); - else - this->GetLastSelectedCell( selCell ); - - LListBox::ClickSelf( event ); - - if ( !single ) - changed = this->CheckSelection( list ); - else - { - Cell tmp; - this->GetLastSelectedCell( tmp ); - if ( tmp.h != selCell.h || tmp.v != selCell.v ) - changed = TRUE; - else - changed = FALSE; - } - - if ( changed ) - { - // Same deal as HandleKeyPress... - MochaChanged(); - } -} - - - -//---------------------------------------------------------------------------- - -void CFormList::DrawElement (const short lMessage, - const Boolean lSelect, - const Rect *lRect, - const void *lElement, - const short lDataLen) - -// Member function for responding to LDEF calls. -// Calls DrawElementSelf to draw a list element. - -{ - switch (lMessage) { - - case lDrawMsg : - ::EraseRect (lRect) ; - if (lDataLen == 0) - break ; - - DrawElementSelf (lRect, lElement, lDataLen) ; - - if (!lSelect) - break ; - - case lHiliteMsg : - if (fContext->type != MWContextPrint) - { - LMSetHiliteMode( 0 ); - ::InvertRect (lRect); - } - else - { - Rect cellRect = *lRect; - cellRect.bottom ++; - ::FrameRect(&cellRect); // InvertRect does not seem to work when printing - } - break; - } -} - -//---------------------------------------------------------------------------- - -void CFormList::DrawElementSelf (const Rect *lRect, - const void *lElement, - const short lDataLen) - -// Draw contents of a single list element on the screen. -// Default version just draws text; override for other types of data. - -{ - if(fContext && (GetWinCSID() == CS_UTF8)) - { - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - FontInfo fi; - th->GetFontInfo(fs, &fi); - ::MoveTo (lRect->left+2, lRect->bottom - fi.descent) ; - th->DrawText(fs, (char*) lElement, (int)lDataLen); - } - else - { - FontInfo fi; - GetFontInfo(&fi); - ::MoveTo (lRect->left+2, lRect->bottom - fi.descent) ; - ::DrawText (lElement, 0, lDataLen) ; - } -} - -// --------------------------------------------------------------------------- -// ¥ ActivateSelf -// --------------------------------------------------------------------------- - -void CFormList::ActivateSelf() -{ - // 97-06-07 pkc -- Only call ActivateSelf when we're visible because layout/layers - // puts us in a strange spot originally. When the form element is shown, then it's - // coordinates reflect its true position. - if (IsVisible()) - LListBox::ActivateSelf(); -} - - -// --------------------------------------------------------------------------- -// ¥ DeactivateSelf -// --------------------------------------------------------------------------- - -void CFormList::DeactivateSelf() -{ - // 97-06-07 pkc -- Only call DectivateSelf when we're visible because layout/layers - // puts us in a strange spot originally. When the form element is shown, then it's - // coordinates reflect its true position. - if (IsVisible()) - LListBox::DeactivateSelf(); -} - -//---------------------------------------------------------------------------- -// 'self' matches the previously saved 'this'. - -pascal void LDefProc (short lMessage, - Boolean lSelect, - Rect *lRect, - Cell /*lCell*/, - unsigned short lDataOffset, - unsigned short lDataLen, - ListHandle lHandle) - -// Custom list definition function procedure for CCustomListBox. -// Called by the LDEF stub; returns control back to class method -// DrawElement to do the actual drawing. - -{ - // ignore init and dispose messages - if ((lMessage == lInitMsg) || - (lMessage == lCloseMsg)) - return ; - - // restore the application's A5, so that we can access global - // variables. - long savedA5 = ::SetCurrentA5() ; - - // get the pointer back to 'this'. As the function is no method, - // and 'this' is a keyword, use 'self' instead. - CFormList *self = (CFormList*) (*lHandle)->userHandle ; - - Handle h = (*self->mMacListH)->cells ; - char saveState = ::HGetState (h) ; - ::HLock (h) ; - - void *lElement = (void*) (*h + lDataOffset) ; - self->DrawElement (lMessage, lSelect, lRect, lElement, lDataLen) ; - - ::HSetState (h, saveState) ; - ::SetA5 (savedA5) ; -} - -//---------------------------------------------------------------------------- - - - -#pragma mark == CFormButton == - -//--------------------------------------------------------------------------- -// class CFormButton -//--------------------------------------------------------------------------- - -CFormButton::CFormButton(LStream * inStream) : LStdButton(inStream) -{ - SetReflectOnChange(true); -#ifdef LAYERS - // add an attachment which will intercept clicks and dispatch them to layers - CLayerClickDispatchAttachment* led = new CLayerClickDispatchAttachment; - AddAttachment(led); -#endif -} - -// ¥¥ Misc - -void CFormButton::SetDescriptor(ConstStr255Param inDescriptor) -{ - LStdButton::SetDescriptor(inDescriptor); - if (FocusDraw()) { - UTextTraits::SetPortTextTraits(mTextTraitsID); // Set the right fontage - // Resize to text width - Int32 width; - if(fContext && (GetWinCSID() == CS_UTF8)) - { - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - width = th->StringWidth(fs , (unsigned char*)inDescriptor); - } - else - { - width = StringWidth(inDescriptor); - } - ResizeFrameTo(width + 16, mFrameSize.height, FALSE); - } -} - -void CFormButton::BroadcastValueMessage() -{ - if (mValueMessage != cmd_Nothing) { - Int32 value = mValue; - BroadcastMessage(mValueMessage, (void*) this); - } -} - -// This gets the mouse up and sends it to javascript in the event that -// a mouse down is cancelled; hot spot tracking normally eats the mouse up -// so this won't be called otherwise. We won't get the mouse up if it occurred -// outside the pane. -void CFormButton::EventMouseUp(const EventRecord& /*inEvent*/) -{ - CMochaHacks::SendEvent(fContext, EVENT_MOUSEUP, fLayoutElement); -} - -void CFormButton::ClickSelfLayer(const SMouseDownEvent &inMouseDown) -{ - LStdButton::ClickSelf(inMouseDown); -} - -/* - * CFormButtonHotSpotResultMochaCallback - * callback for HotSpotResult - * crappy inline implementation, because the whole callback thing is crappy - */ -class CFormButtonHotSpotResultMochaCallback : public CMochaEventCallback -{ -public: - CFormButtonHotSpotResultMochaCallback( CFormButton * button, Int16 inHotSpot, int32 inEventType) - : fButton(button), fHotSpot(inHotSpot), fEventType(inEventType) {} - - virtual void Complete(MWContext * context, - LO_Element * element, int32 /*type*/, ETEventStatus status) - { - if (status == EVENT_OK) - { - if (fEventType == EVENT_MOUSEUP) - MochaClick(context, element, new CFormButtonHotSpotResultMochaCallback(fButton, fHotSpot, EVENT_CLICK)); - } - if (fEventType == EVENT_CLICK) - { - // if event wasn't ok, set message to one that won't be sent, so button - // will unhighlight but perform no action. - MessageT saveMsg = fButton->GetValueMessage(); - if (status != EVENT_OK) fButton->SetValueMessage(msg_AnyMessage); - try - { - fButton->HotSpotResultCallback( fHotSpot ); - } - catch (...) {} - if (status != EVENT_OK) fButton->SetValueMessage(saveMsg); - } - } - -private: - int32 fEventType; // the javascript event type, defined in libevent.h - Int16 fHotSpot; - CFormButton * fButton; -}; - -void -CFormButton::HotSpotResultCallback(Int16 inHotSpot) -{ - if (!IsMarkedForDeath()) - { - LStdButton::HotSpotResult( inHotSpot ); - } -} - -// This will actually get processed through the callback (see above method ) -// Sends a mouse up to javascript, and if javascript lets us process the event, the callback sends -// a click to javascript. -void -CFormButton::HotSpotResult(Int16 inHotSpot) -{ - MWContext* myContext = fContext; - LO_Element* myEle = fLayoutElement; - - MochaMouseUp(fContext, fLayoutElement, new CFormButtonHotSpotResultMochaCallback(this, inHotSpot, EVENT_MOUSEUP)); -} - -// -// Addition function for UTF8 -// -void -CFormButton::HotSpotAction( - Int16 inHotSpot, - Boolean inCurrInside, - Boolean inPrevInside) -{ - if(fContext && (GetWinCSID() == CS_UTF8)) - { - if (inCurrInside != inPrevInside) { - FocusDraw(); - Rect frame; - CalcLocalFrameRect(frame); - short weight = (frame.bottom-frame.top) / 2; - StColorPenState::Normalize(); - ::InvertRoundRect(&frame,weight,weight); - } - } - else - { - LStdButton::HotSpotAction(inHotSpot, inCurrInside, inPrevInside); - } -} - -Boolean -CFormButton::TrackHotSpot( - Int16 inHotSpot, - Point inPoint, - Int16 inModifiers) -{ - if(fContext && (GetWinCSID() == CS_UTF8)) - { - // For the initial mouse down, the - // mouse is currently inside the HotSpot - // when it was previously outside - Boolean currInside = true; - Boolean prevInside = false; - HotSpotAction(inHotSpot, currInside, prevInside); - - // Track the mouse while it is down - Point currPt = inPoint; - while (StillDown()) { - GetMouse(&currPt); // Must keep track if mouse moves from - prevInside = currInside; // In-to-Out or Out-To-In - currInside = PointInHotSpot(currPt, inHotSpot); - HotSpotAction(inHotSpot, currInside, prevInside); - } - - EventRecord macEvent; // Get location from MouseUp event - if (GetOSEvent(mUpMask, &macEvent)) { - currPt = macEvent.where; - GlobalToLocal(&currPt); - } - - this->DrawSelf(); - // Check if MouseUp occurred in HotSpot - return PointInHotSpot(currPt, inHotSpot); - } - else - { - return LStdButton::TrackHotSpot(inHotSpot, inPoint, inModifiers); - } -} - -void -CFormButton::DrawTitle() -{ - Rect frame; - CalcLocalFrameRect(frame); - Str255 outText; - this->GetDescriptor(outText); - if(!IsEnabled()) - { - RGBColor color = { 0, 0, 0 }; - ::RGBForeColor(&color); - ::TextMode(grayishTextOr); - } - - // ¥¥¥ To Be Test - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - - FontInfo info; - th->GetFontInfo(fs, &info); - ::MoveTo((frame.right + frame.left - - th->StringWidth(fs ,outText) ) / 2, - (frame.top + frame.bottom + info.ascent ) / 2); - th->DrawString(fs, outText); -} -void -CFormButton::DrawSelf() -{ - if(fContext && (GetWinCSID() == CS_UTF8)) - { - // Do whatever a control shoul do. - Rect frame; - CalcLocalFrameRect(frame); - short weight = (frame.bottom-frame.top) / 2; - StColorPenState::Normalize(); - ::FillRoundRect(&frame,weight,weight, &UQDGlobals::GetQDGlobals()->white); - ::FrameRoundRect(&frame,weight,weight); - DrawTitle(); - } - else - { - LStdButton::DrawSelf(); - } -} - -#pragma mark == CGAFormPushButton == - -//--------------------------------------------------------------------------- -// class CGAFormPushButton -//--------------------------------------------------------------------------- - -CGAFormPushButton::CGAFormPushButton(LStream * inStream) : LGAPushButton(inStream) -{ - SetReflectOnChange(true); -#ifdef LAYERS - // add an attachment which will intercept clicks and dispatch them to layers - AddAttachment(new CLayerClickDispatchAttachment); -#endif -} - -// ¥¥ Misc - -void CGAFormPushButton::SetDescriptor(ConstStr255Param inDescriptor) -{ - super::SetDescriptor(inDescriptor); - if (FocusDraw()) - { - UTextTraits::SetPortTextTraits(mTextTraitsID); // Set the right fontage - // Resize to text width - Int32 width; - - if(fContext && (GetWinCSID() == CS_UTF8)) - { - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - width = th->StringWidth(fs , (unsigned char*)inDescriptor); - } - else - { - width = StringWidth(inDescriptor); - } - ResizeFrameTo(width + 16, mFrameSize.height, FALSE); - } -} - -void CGAFormPushButton::BroadcastValueMessage() -{ - if (mValueMessage != cmd_Nothing) { - Int32 value = mValue; - BroadcastMessage(mValueMessage, (void*) this); - } -} - -// This gets the mouse up and sends it to javascript in the event that -// a mouse down is cancelled; hot spot tracking normally eats the mouse up -// so this won't be called otherwise. We won't get the mouse up if it occurred -// outside the pane. -void CGAFormPushButton::EventMouseUp(const EventRecord& /*inEvent*/) -{ - CMochaHacks::SendEvent(fContext, EVENT_MOUSEUP, fLayoutElement); -} - -void CGAFormPushButton::ClickSelfLayer(const SMouseDownEvent &inMouseDown) -{ - super::ClickSelf(inMouseDown); -} - -/* - * CGAFormPushButtonHotSpotResultMochaCallback - * callback for HotSpotResult - * crappy inline implementation, because the whole callback thing is crappy - */ -class CGAFormPushButtonHotSpotResultMochaCallback : public CMochaEventCallback -{ -public: - CGAFormPushButtonHotSpotResultMochaCallback( CGAFormPushButton * button, Int16 inHotSpot, int32 inEventType) - : fButton(button), fHotSpot(inHotSpot), fEventType(inEventType) {} - - virtual void Complete(MWContext * context, - LO_Element * element, int32 /*type*/, ETEventStatus status) - { - if (status == EVENT_OK) - { - if (fEventType == EVENT_MOUSEUP) - MochaClick(context, element, new CGAFormPushButtonHotSpotResultMochaCallback(fButton, fHotSpot, EVENT_CLICK)); - } - if (fEventType == EVENT_CLICK) - { - // if event wasn't ok, set message to one that won't be sent, so button - // will unhighlight but perform no action. - MessageT saveMsg = fButton->GetValueMessage(); - if (status != EVENT_OK) fButton->SetValueMessage(msg_AnyMessage); - try - { - fButton->HotSpotResultCallback( fHotSpot ); - } - catch (...) {} - if (status != EVENT_OK) fButton->SetValueMessage(saveMsg); - } - } - -private: - int32 fEventType; // the javascript event type, defined in libevent.h - Int16 fHotSpot; - CGAFormPushButton * fButton; -}; - -void -CGAFormPushButton::HotSpotResultCallback(Int16 inHotSpot) -{ - if (!IsMarkedForDeath()) - { - super::HotSpotResult( inHotSpot ); - } -} - -// This will actually get processed through the callback (see above method ) -// Sends a mouse up to javascript, and if javascript lets us process the event, the callback sends -// a click to javascript. -void -CGAFormPushButton::HotSpotResult(Int16 inHotSpot) -{ - MWContext* myContext = fContext; - LO_Element* myEle = fLayoutElement; - - MochaMouseUp(fContext, fLayoutElement, new CGAFormPushButtonHotSpotResultMochaCallback(this, inHotSpot, EVENT_MOUSEUP)); -} - -void -CGAFormPushButton::DrawButtonTitle ( Int16 inDepth ) -{ - if(! (fContext && (GetWinCSID() == CS_UTF8))) - { - super::DrawButtonTitle(inDepth); - return; - } - - StColorPenState theColorPenState; - StColorPenState::Normalize (); - StTextState theTextState; - RGBColor textColor; - - // ¥ Get some loal variables setup including the rect for the title - ResIDT textTID = GetTextTraitsID (); - Rect titleRect; - - // ¥ Get the port setup with the text traits - UTextTraits::SetPortTextTraits ( textTID ); - - // ¥ Save off a reference to the fore color used to draw the title - ::GetForeColor ( &textColor ); - - // ¥ We always want to have the title be centered - Int16 titleJust = teCenter; - - // ¥ Calculate the title rect - CalcTitleRect ( titleRect ); - - // ¥ Get the title - Str255 controlTitle; - GetDescriptor ( controlTitle ); - - // ¥ Handle drawing based on the current depth of the device - if ( inDepth < 4 ) - { - // ¥ If the control is dimmed then we use the grayishTextOr - // transfer mode to draw the text - if ( !IsEnabled ()) - { - ::RGBForeColor ( &UGAColorRamp::GetBlackColor () ); - ::TextMode ( grayishTextOr ); - } - else if ( IsEnabled () && IsHilited () ) - { - // ¥ When we are hilited we simply draw the title in white - ::RGBForeColor ( &UGAColorRamp::GetWhiteColor () ); - } - - // ¥ Now get the actual title drawn with all the appropriate settings - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - - FontInfo info; - th->GetFontInfo(fs, &info); - ::MoveTo((titleRect.right + titleRect.left - - th->StringWidth(fs ,controlTitle) ) / 2, - (titleRect.top + titleRect.bottom + info.ascent - info.descent) / 2); - th->DrawString(fs, controlTitle); - - } - else if ( inDepth >= 4 ) - { - // ¥ If control is selected we always draw the text in the title - // hilite color, if requested - if ( IsHilited ()) - ::RGBForeColor ( &UGAColorRamp::GetWhiteColor() ); - - // ¥ If the control is dimmed then we have to do our own version of the - // grayishTextOr as it does not appear to work correctly across - // multiple devices - if ( !IsEnabled () || !IsActive ()) - { - textColor = UGraphicsUtilities::Lighten ( &textColor ); - ::TextMode ( srcOr ); - ::RGBForeColor ( &textColor ); - } - - // ¥ Now get the actual title drawn with all the appropriate settings - - UMultiFontTextHandler *th = UUTF8TextHandler::Instance(); - UFontSwitcher *fs = UPropFontSwitcher::Instance(); - - FontInfo info; - th->GetFontInfo(fs, &info); - ::MoveTo((titleRect.right + titleRect.left - - th->StringWidth(fs ,controlTitle) ) / 2, - (titleRect.top + titleRect.bottom + info.ascent - info.descent) / 2); - th->DrawString(fs, controlTitle); - } - -} // CGAFormPushButton::DrawButtonTitle - -#pragma mark == CFormRadio == - -//--------------------------------------------------------------------------- -// class CFormRadio -//--------------------------------------------------------------------------- -RgnHandle CFormRadio::sRadioRgn = NULL; -CFormRadio::CFormRadio(LStream * inStream) : LStdRadioButton(inStream), LFormElement(), CLayerClickCallbackMixin() -{ - SetReflectOnChange(true); -#ifdef LAYERS - // add an attachment which will intercept clicks and dispatch them to layers - CLayerClickDispatchAttachment* led = new CLayerClickDispatchAttachment; - AddAttachment(led); -#endif -} - -void CFormRadio::SetupClip() -{ - if (sRadioRgn == NULL) // Allocate the clip region - { - sRadioRgn = ::NewRgn(); - Rect r; - r.top = r.left = 0; - r.bottom = r.right = 12; - OpenRgn(); - ::FrameOval(&r); - ::CloseRgn(sRadioRgn); - } - ::OffsetRgn(sRadioRgn, // Position the clip region. Offset was calculated by trial and error - (*mMacControlH)->contrlRect.left -(*sRadioRgn)->rgnBBox.left + 2, - (*mMacControlH)->contrlRect.top -(*sRadioRgn)->rgnBBox.top); -} - -void CFormRadio::DrawSelf() -{ - SetupClip(); - StSetupFormDrawing colorEnv(this); - - StClipRgnState theClip; - theClip.ClipToIntersectionRgn(sRadioRgn); - - LStdRadioButton::DrawSelf(); -} - - -void CFormRadio::ClickSelfLayer(const SMouseDownEvent &inMouseDown) -{ - LStdRadioButton::ClickSelf(inMouseDown); -} - -Boolean CFormRadio::TrackHotSpot(Int16 inHotSpot,Point inPoint, Int16 inModifiers) -{ - SetupClip(); - StSetupFormDrawing colorEnv(this); - - StClipRgnState theClip; - theClip.ClipToIntersectionRgn(sRadioRgn); - - return LStdRadioButton::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - -void CFormRadio::SetValue(Int32 inValue) -{ - SetupClip(); - StSetupFormDrawing colorEnv(this); - - StClipRgnState theClip; - theClip.ClipToIntersectionRgn(sRadioRgn); - - LStdRadioButton::SetValue(inValue); -} - -/* - * CFormRadioHotSpotResultMochaCallback - * callback for HotSpotResult - * crappy inline implementation, because the whole callback thing is crappy - */ -class CFormRadioHotSpotResultMochaCallback : public CMochaEventCallback -{ -public: - CFormRadioHotSpotResultMochaCallback( CFormRadio * radio, - Int16 inHotSpot, - LO_FormElementStruct* oldRadio, - Int16 savedValue, - int32 inEventType) - : fRadio(radio), - fHotSpot(inHotSpot), - fOldRadio(oldRadio), - fSavedValue(savedValue), - fEventType(inEventType) - {} - - void Complete(MWContext * context, - LO_Element * element, int32 /*type*/, ETEventStatus status) - { - if (status == EVENT_CANCEL) - { - if (fEventType == EVENT_CLICK) - fRadio->HotSpotResultCallback( fHotSpot , fOldRadio, fSavedValue, context); - } else if (status == EVENT_OK) - { - if (fEventType == EVENT_MOUSEUP) - MochaClick(context, - element, - new CFormRadioHotSpotResultMochaCallback(fRadio, fHotSpot, fOldRadio, fSavedValue, EVENT_CLICK)); - } - } - -private: - int32 fEventType; - Int16 fHotSpot; // No clue what these arguments mean, I am just saving - CFormRadio * fRadio; // them for the calllback - LO_FormElementStruct* fOldRadio; - Int16 fSavedValue; -}; - - -void -CFormRadio::HotSpotResultCallback(Int16 /*inHotSpot*/, - LO_FormElementStruct* oldRadio, - Int16 savedValue, - MWContext * context) -{ - if (!IsMarkedForDeath()) - { - SetValue(savedValue); - ReflectData(); - - if (oldRadio != NULL) - { - LO_FormRadioSet(context, oldRadio); - - LControl* control = dynamic_cast(GetFEDataPane(oldRadio)); - ThrowIfNil_(control); - - control->SetValue(true); - control->Refresh(); - } - } -} - -void -CFormRadio::HotSpotResult(Int16 inHotSpot) -{ - MWContext* myContext = fContext; - LO_Element* myEle = fLayoutElement; - Int16 savedValue = GetValue(); - - LO_FormElementStruct* oldRadio = NULL; - - // Change the value, call JavaScript, if it cancels - // the click, then change the value back. - LStdRadioButton::HotSpotResult( inHotSpot ); - ReflectData(); - oldRadio = LO_FormRadioSet(myContext, (LO_FormElementStruct*) myEle); - - // Adding another callback loop to do a mouse up for xp consistency. - // Cancelling the mouse up will have no effect on the state - // of the radio element after the mouse down, but will prevent a click from being sent. - MochaMouseUp( myContext, myEle, new CFormRadioHotSpotResultMochaCallback( this, inHotSpot, oldRadio, savedValue, EVENT_MOUSEUP)); -} - -// This gets the mouse up and sends it to javascript in the event that -// a mouse down is cancelled; hot spot tracking normally eats the mouse up -// so this won't be called otherwise. We won't get the mouse up if it occurred -// outside the pane. -void CFormRadio::EventMouseUp(const EventRecord& /*inEvent*/) -{ - CMochaHacks::SendEvent(fContext, EVENT_MOUSEUP, fLayoutElement); -} - -#pragma mark == CGAFormRadio == - -// --------------------------------------------------------------------------- -// ¥ CGAFormRadio -// --------------------------------------------------------------------------- - -CGAFormRadio::CGAFormRadio( - LStream* inStream) - : super(inStream) -{ - SetReflectOnChange(true); -#ifdef LAYERS - // add an attachment which will intercept clicks and dispatch them to layers - AddAttachment(new CLayerClickDispatchAttachment); -#endif -} - -// --------------------------------------------------------------------------- -// ¥ DrawSelf -// --------------------------------------------------------------------------- - -void -CGAFormRadio::DrawSelf() -{ - StSetupFormDrawing colorEnv(this); - - super::DrawSelf(); -} - -// --------------------------------------------------------------------------- -// ¥ ClickSelfLayer -// --------------------------------------------------------------------------- - -void -CGAFormRadio::ClickSelfLayer( - const SMouseDownEvent& inMouseDown) -{ - super::ClickSelf(inMouseDown); -} - -// --------------------------------------------------------------------------- -// ¥ TrackHotSpot -// --------------------------------------------------------------------------- - -Boolean -CGAFormRadio::TrackHotSpot( - Int16 inHotSpot, - Point inPoint, - Int16 inModifiers) -{ - StSetupFormDrawing colorEnv(this); - - return super::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - -// --------------------------------------------------------------------------- -// ¥ SetValue -// --------------------------------------------------------------------------- - -void -CGAFormRadio::SetValue( - Int32 inValue) -{ - StSetupFormDrawing colorEnv(this); - - super::SetValue(inValue); -} - -/* - * CGAFormRadioHotSpotResultMochaCallback - * callback for HotSpotResult - * crappy inline implementation, because the whole callback thing is crappy - */ -class CGAFormRadioHotSpotResultMochaCallback : public CMochaEventCallback -{ -public: - CGAFormRadioHotSpotResultMochaCallback( CGAFormRadio * radio, - Int16 inHotSpot, - LO_FormElementStruct* oldRadio, - Int16 savedValue, - int32 inEventType) - : fRadio(radio), - fHotSpot(inHotSpot), - fOldRadio(oldRadio), - fSavedValue(savedValue), - fEventType(inEventType) - {} - - void Complete(MWContext * context, - LO_Element * element, int32 /*type*/, ETEventStatus status) - { - if (status == EVENT_CANCEL) - { - if (fEventType == EVENT_CLICK) - fRadio->HotSpotResultCallback( fHotSpot , fOldRadio, fSavedValue, context); - } else if (status == EVENT_OK) - { - if (fEventType == EVENT_MOUSEUP) - MochaClick(context, - element, - new CGAFormRadioHotSpotResultMochaCallback(fRadio, fHotSpot, fOldRadio, fSavedValue, EVENT_CLICK)); - } - } - -private: - int32 fEventType; - Int16 fHotSpot; // No clue what these arguments mean, I am just saving - CGAFormRadio* fRadio; // them for the calllback - LO_FormElementStruct* fOldRadio; - Int16 fSavedValue; -}; - -// --------------------------------------------------------------------------- -// ¥ HotSpotResultCallback -// --------------------------------------------------------------------------- - -void -CGAFormRadio::HotSpotResultCallback( - Int16 /*inHotSpot*/, - LO_FormElementStruct* oldRadio, - Int16 savedValue, - MWContext* context) -{ - if (!IsMarkedForDeath()) - { - SetValue(savedValue); - ReflectData(); - - if (oldRadio != NULL) - { - LO_FormRadioSet(context, oldRadio); - - LControl* control = dynamic_cast(GetFEDataPane(oldRadio)); - ThrowIfNil_(control); - - control->SetValue(true); - control->Refresh(); - } - } -} - -// --------------------------------------------------------------------------- -// ¥ HotSpotResult -// --------------------------------------------------------------------------- - -void -CGAFormRadio::HotSpotResult( - Int16 inHotSpot) -{ - MWContext* myContext = fContext; - LO_Element* myEle = fLayoutElement; - Int16 savedValue = GetValue(); - - LO_FormElementStruct* oldRadio = NULL; - - // Change the value, call JavaScript, if it cancels - // the click, then change the value back. - super::HotSpotResult( inHotSpot ); - ReflectData(); - oldRadio = LO_FormRadioSet(myContext, (LO_FormElementStruct*) myEle); - - // Adding another callback loop to do a mouse up for xp consistency. - // Cancelling the mouse up will have no effect on the state - // of the radio element after the mouse down, but will prevent a click from being sent. - MochaMouseUp( myContext, myEle, new CGAFormRadioHotSpotResultMochaCallback(this, inHotSpot, oldRadio, savedValue, EVENT_MOUSEUP)); -} - -// --------------------------------------------------------------------------- -// ¥ EventMouseUp -// --------------------------------------------------------------------------- - -// This gets the mouse up and sends it to javascript in the event that -// a mouse down is cancelled; hot spot tracking normally eats the mouse up -// so this won't be called otherwise. We won't get the mouse up if it occurred -// outside the pane. -void -CGAFormRadio::EventMouseUp(const EventRecord& /*inEvent*/) -{ - CMochaHacks::SendEvent(fContext, EVENT_MOUSEUP, fLayoutElement); -} - -#pragma mark == CFormCheckbox == - -//--------------------------------------------------------------------------- -// class CFormCheckbox -//--------------------------------------------------------------------------- -RgnHandle CFormCheckbox::sCheckboxRgn = NULL; -CFormCheckbox::CFormCheckbox(LStream * inStream) : LStdCheckBox(inStream), CLayerClickCallbackMixin() { - SetReflectOnChange(true); -#ifdef LAYERS - // add an attachment which will intercept clicks and dispatch them to layers - CLayerClickDispatchAttachment* led = new CLayerClickDispatchAttachment; - AddAttachment(led); -#endif -} - -void CFormCheckbox::SetupClip() -{ - if (sCheckboxRgn == NULL) // Allocate the clip region - { - sCheckboxRgn = ::NewRgn(); - Rect r; - r.top = r.left = 0; - r.bottom = r.right = 12; - OpenRgn(); - ::FrameRect(&r); - ::CloseRgn(sCheckboxRgn); - } - ::OffsetRgn(sCheckboxRgn, // Position the clip region - (*mMacControlH)->contrlRect.left -(*sCheckboxRgn)->rgnBBox.left+2, - (*mMacControlH)->contrlRect.top -(*sCheckboxRgn)->rgnBBox.top); -} - - -void CFormCheckbox::DrawSelf() -{ - SetupClip(); - StSetupFormDrawing colorEnv(this); - - StClipRgnState theClip; - theClip.ClipToIntersectionRgn(sCheckboxRgn); - - LStdCheckBox::DrawSelf(); -} - - -void CFormCheckbox::ClickSelfLayer(const SMouseDownEvent &inMouseDown) -{ - LStdCheckBox::ClickSelf(inMouseDown); -} - - -Boolean CFormCheckbox::TrackHotSpot(Int16 inHotSpot,Point inPoint, Int16 inModifiers) -{ - SetupClip(); - StSetupFormDrawing colorEnv(this); - - StClipRgnState theClip; - theClip.ClipToIntersectionRgn(sCheckboxRgn); - - return LStdCheckBox::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - -void CFormCheckbox::SetValue(Int32 inValue) -{ - SetupClip(); - StSetupFormDrawing colorEnv(this); - - StClipRgnState theClip; - theClip.ClipToIntersectionRgn(sCheckboxRgn); - - LStdCheckBox::SetValue(inValue); -} - -/* - * CFormCheckboxHotSpotResultMochaCallback - * callback for HotSpotResult - * crappy inline implementation, because the whole callback thing is crappy - */ -class CFormCheckboxHotSpotResultMochaCallback : public CMochaEventCallback -{ -public: - CFormCheckboxHotSpotResultMochaCallback( CFormCheckbox* checkBox, - Int16 inHotSpot, - Int16 inSavedValue, - int32 inEventType ) - : fCheckbox(checkBox), fHotSpot(inHotSpot), fSavedValue(inSavedValue), fEventType(inEventType) - {} - - virtual void Complete(MWContext * context, - LO_Element * element, int32 /*type*/, ETEventStatus status) - { - // call HotSpotResultCallback if mocha wants us to cancel action - if (status == EVENT_CANCEL) - { - if (fEventType == EVENT_CLICK) - fCheckbox->HotSpotResultCallback( fHotSpot, fSavedValue ); - } else if (status == EVENT_OK) - { - if (fEventType == EVENT_MOUSEUP) - MochaClick(context, element, new CFormCheckboxHotSpotResultMochaCallback(fCheckbox, fHotSpot, fSavedValue, EVENT_CLICK)); - } - } - -private: - int32 fEventType; - Int16 fHotSpot; // No clue what these arguments mean, I am just saving - CFormCheckbox * fCheckbox; // them for the calllback - Int16 fSavedValue; -}; - - -void -CFormCheckbox::HotSpotResultCallback( Int16 /*inHotSpot*/, Int16 savedValue ) -{ - // Reset to the old value - if (!IsMarkedForDeath()) - { - SetValue(savedValue); - ReflectData(); - } -} - -void CFormCheckbox::HotSpotResult(Int16 inHotSpot) -{ - MWContext* myContext = fContext; - LO_Element* myEle = fLayoutElement; - - Int16 savedValue = GetValue(); - - // Change the value, call JavaScript, if it cancels - // the click, then change the value back. - - LStdCheckBox::HotSpotResult(inHotSpot); - ReflectData(); - - // - // Call the JavaScript onClick handler, - // which may cancel the click - // - - // Adding another callback loop to do a mouse up for xp consistency. - // Cancelling the mouse up will have no effect on the state - // of the checkbox after the mouse down, but will prevent a click from being sent. - MochaMouseUp( myContext, myEle, new CFormCheckboxHotSpotResultMochaCallback( this, inHotSpot, savedValue, EVENT_MOUSEUP)); -} - -// This gets the mouse up and sends it to javascript in the event that -// a mouse down is cancelled; hot spot tracking normally eats the mouse up -// so this won't be called otherwise. We won't get the mouse up if it occurred -// outside the pane. -void CFormCheckbox::EventMouseUp(const EventRecord& /*inEvent*/) -{ - CMochaHacks::SendEvent(fContext, EVENT_MOUSEUP, fLayoutElement); -} - -#pragma mark == CGAFormCheckbox == - -// --------------------------------------------------------------------------- -// ¥ CGAFormCheckbox -// --------------------------------------------------------------------------- - -CGAFormCheckbox::CGAFormCheckbox( - LStream* inStream) - : super(inStream) -{ - SetReflectOnChange(true); -#ifdef LAYERS - // add an attachment which will intercept clicks and dispatch them to layers - AddAttachment(new CLayerClickDispatchAttachment); -#endif -} - -// --------------------------------------------------------------------------- -// ¥ DrawSelf -// --------------------------------------------------------------------------- - -void -CGAFormCheckbox::DrawSelf() -{ - StSetupFormDrawing colorEnv(this); - - super::DrawSelf(); -} - -// --------------------------------------------------------------------------- -// ¥ ClickSelfLayer -// --------------------------------------------------------------------------- - -void -CGAFormCheckbox::ClickSelfLayer( - const SMouseDownEvent& inMouseDown) -{ - super::ClickSelf(inMouseDown); -} - -// --------------------------------------------------------------------------- -// ¥ TrackHotSpot -// --------------------------------------------------------------------------- - -Boolean -CGAFormCheckbox::TrackHotSpot( - Int16 inHotSpot, - Point inPoint, - Int16 inModifiers) -{ - StSetupFormDrawing colorEnv(this); - - return super::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - -// --------------------------------------------------------------------------- -// ¥ SetValue -// --------------------------------------------------------------------------- - -void -CGAFormCheckbox::SetValue( - Int32 inValue) -{ - StSetupFormDrawing colorEnv(this); - - super::SetValue(inValue); -} - -/* - * CGAFormCheckboxHotSpotResultMochaCallback - * callback for HotSpotResult - * crappy inline implementation, because the whole callback thing is crappy - */ -class CGAFormCheckboxHotSpotResultMochaCallback : public CMochaEventCallback -{ -public: - CGAFormCheckboxHotSpotResultMochaCallback( CGAFormCheckbox* checkBox, - Int16 inHotSpot, - Int16 inSavedValue, - int32 inEventType ) - : fCheckbox(checkBox), fHotSpot(inHotSpot), fSavedValue(inSavedValue), fEventType(inEventType) - {} - - virtual void Complete(MWContext * context, - LO_Element * element, int32 /*type*/, ETEventStatus status) - { - // call HotSpotResultCallback if mocha wants us to cancel action - if (status == EVENT_CANCEL) - { - if (fEventType == EVENT_CLICK) - fCheckbox->HotSpotResultCallback( fHotSpot, fSavedValue ); - } else if (status == EVENT_OK) - { - if (fEventType == EVENT_MOUSEUP) - MochaClick(context, element, new CGAFormCheckboxHotSpotResultMochaCallback(fCheckbox, fHotSpot, fSavedValue, EVENT_CLICK)); - } - } - -private: - int32 fEventType; - Int16 fHotSpot; // No clue what these arguments mean, I am just saving - CGAFormCheckbox* fCheckbox; // them for the calllback - Int16 fSavedValue; -}; - -// --------------------------------------------------------------------------- -// ¥ HotSpotResultCallback -// --------------------------------------------------------------------------- - -void -CGAFormCheckbox::HotSpotResultCallback( - Int16 inHotSpot, - Int16 savedValue) -{ -#pragma unused(inHotSpot) - - // Reset to the old value - if (!IsMarkedForDeath()) - { - SetValue(savedValue); - ReflectData(); - } -} - -// --------------------------------------------------------------------------- -// ¥ HotSpotResult -// --------------------------------------------------------------------------- - -void -CGAFormCheckbox::HotSpotResult( - Int16 inHotSpot) -{ - MWContext* myContext = fContext; - LO_Element* myEle = fLayoutElement; - - Int16 savedValue = GetValue(); - - // Change the value, call JavaScript, if it cancels - // the click, then change the value back. - - super::HotSpotResult(inHotSpot); - ReflectData(); - - // - // Call the JavaScript onClick handler, - // which may cancel the click - // - - // Adding another callback loop to do a mouse up for xp consistency. - // Cancelling the mouse up will have no effect on the state - // of the checkbox after the mouse down, but will prevent a click from being sent. - MochaMouseUp( myContext, myEle, new CGAFormCheckboxHotSpotResultMochaCallback( this, inHotSpot, savedValue, EVENT_MOUSEUP)); -} - -// --------------------------------------------------------------------------- -// ¥ EventMouseUp -// --------------------------------------------------------------------------- - -// This gets the mouse up and sends it to javascript in the event that -// a mouse down is cancelled; hot spot tracking normally eats the mouse up -// so this won't be called otherwise. We won't get the mouse up if it occurred -// outside the pane. -void -CGAFormCheckbox::EventMouseUp(const EventRecord& /*inEvent*/) -{ - CMochaHacks::SendEvent(fContext, EVENT_MOUSEUP, fLayoutElement); -} - -#pragma mark == CFormFile == - -// -// class CFormFile -// - -CFormFile::CFormFile(LStream * inStream) : LView(inStream), LFormElement() -{ - fHasFile = FALSE; - - SetReflectOnChange(true); -} - -void CFormFile::FinishCreateSelf() -{ - fEditField = (CFormFileEditField *)FindPaneByID(CFormFileEditField::class_ID); - fButton = (LStdButton*)FindPaneByID('ffib'); - ThrowIfNil_(fButton); - ThrowIfNil_(fEditField); - fButton->AddListener(this); -} - -void CFormFile::SetVisibleChars(Int16 numOfChars) -{ -// Resize the edit field to the proper number of characters. - FocusDraw(); // Algorithm copied from CFormLittleText::SetVisibleChars - UTextTraits::SetPortTextTraits(fEditField->mTextTraitsID); - FontInfo fInfo; - ::GetFontInfo(&fInfo); - fEditField->ResizeFrameTo(::CharWidth('a') * numOfChars + 6, fInfo.ascent + fInfo.descent+ fInfo.leading + 4, FALSE); -// Move the button so that it does not overlap - SPoint32 location; - SDimension16 size; - fEditField->GetFrameLocation(location); - fEditField->GetFrameSize(size); - fButton->PlaceInSuperFrameAt(location.h+size.width + 2 - mFrameLocation.h, 0, FALSE); -// Resize ourselves - fButton->GetFrameLocation(location); - fButton->GetFrameSize(size); - ResizeFrameTo(location.h+size.width + 2, size.height, FALSE); -// Reset ourselves - fHasFile = FALSE; - fEditField->SetDescriptor(CStr255::sEmptyString); -} - -void CFormFile::GetFontInfo(Int32& width, Int32& height, Int32& baseline) -{ - FocusDraw(); // Algorithm copied from CFormLittleText::SetVisibleChars - UTextTraits::SetPortTextTraits(fEditField->mTextTraitsID); - FontInfo fInfo; - ::GetFontInfo(&fInfo); - SPoint32 location; - fEditField->GetFrameLocation(location); - width = mFrameSize.width; - height = mFrameSize.height; - baseline = fInfo.ascent+3 + location.v - mFrameLocation.v; // Looking for the baseline of the text field -} - -Boolean CFormFile::GetFileSpec(FSSpec & spec) -{ - if (!fHasFile) - return FALSE; - else - { - spec = fSpec; - return TRUE; - } -} - -void CFormFile::SetFileSpec(FSSpec & spec) -{ - fSpec = spec; - fHasFile = TRUE; - fEditField->FocusDraw(); - fEditField->SetDescriptor(fSpec.name); // Make sure that all text is selected - ::TESetSelect(0, 32767, fEditField->mTextEditH); - - - MochaChanged(); -} - -void CFormFile::ListenToMessage(MessageT inMessage, void */*ioParam*/) -{ - switch (inMessage) { - case 2001: - { - StandardFileReply myReply; - SFTypeList myTypes; - UDesktop::Deactivate(); // Always bracket this - StandardGetFile(NULL, -1, myTypes, &myReply); - UDesktop::Activate(); - if (myReply.sfGood) - { -// Fortezza and MacBinary form submission uploads need to be able to select a file -// that just has a resource fork so we can't reject these files any more -// if (!CFileMgr::FileHasDataFork(myReply.sfFile)) -// ErrorManager::PlainAlert(SUBMIT_FILE_WITH_DATA_FK); -// else - SetFileSpec(myReply.sfFile); - } - } - break; - case 2002: // User has deleted the text - fHasFile = FALSE; - MochaChanged(); - default: - break; - } -} - -#pragma mark == CFormFileEditField == - -// -// CFormFileEditField -// - -CFormFileEditField::CFormFileEditField(LStream * inStream) : LEditField (inStream) -{ - mKeyFilter = UKeyFilters::AlphaNumericField; -} - -void CFormFileEditField::ClickSelf(const SMouseDownEvent &/*inMouseDown*/) -{ - SwitchTarget(this); - ::TESetSelect(0, 32767, mTextEditH); -} - - -void -CFormFileEditField::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - ::InsetRect(&frame, 1,1); - ::EraseRect(&frame); - - LEditField::DrawSelf(); - - ::InsetRect(&frame, -1,-1); - UGraphics::FrameRectSubtle(frame, true); -} - - -void CFormFileEditField::FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - switch (inCommand) { - - case cmd_Cut: // Cut, Copy, and Clear enabled - case cmd_Copy: // if something is selected - case cmd_Clear: - outEnabled = ((**mTextEditH).selStart != (**mTextEditH).selEnd); - break; - - case cmd_Paste: { - outEnabled = FALSE; - break; - } - - case cmd_SelectAll: // Check if any characters are present - outEnabled = (**mTextEditH).teLength > 0; - break; - - default: - LCommander::FindCommandStatus(inCommand, outEnabled, - outUsesMark, outMark, outName); - break; - } -} - -// Copied from LEditField::HandleKeyPress. -// Filter everything byt delete -Boolean CFormFileEditField::HandleKeyPress(const EventRecord& inKeyEvent) -{ - Boolean keyHandled = true; - EKeyStatus theKeyStatus = keyStatus_Input; - Int16 theKey = inKeyEvent.message & charCodeMask; - - if (inKeyEvent.modifiers & cmdKey) { // Always pass up when the command - theKeyStatus = keyStatus_PassUp; // key is down - - } else if (mKeyFilter != nil) { - Char16 charCode = inKeyEvent.message & charCodeMask; - theKeyStatus = (*mKeyFilter)(mTextEditH, inKeyEvent.message, charCode, inKeyEvent.modifiers); - } - switch(theKeyStatus) - { - case keyStatus_TEDelete: - return LEditField::HandleKeyPress(inKeyEvent); - default: - return LCommander::HandleKeyPress(inKeyEvent); // Bypass the edit field - } - return FALSE; -} - -void CFormFileEditField::UserChangedText() -{ - ((CFormFile *)mSuperView)->ListenToMessage(2002, NULL); -} - - - -static LArray* gDeadFormElementsList = NULL; -static void* gKillFormElementsTimer = 0; // timer ID - -static void -KillFormElementsTimer( void */*ignore*/ ) -{ - Assert_(gDeadFormElementsList != NULL); - - LArrayIterator iterator(*gDeadFormElementsList); - LPane* pane; - - while (iterator.Next(&pane)) { - delete pane; - } - - gDeadFormElementsList->RemoveItemsAt( - gDeadFormElementsList->GetCount(), - LArray::index_First); - - gKillFormElementsTimer = 0; -} - - -// Switch focus to an input element - -void -FE_FocusInputElement( MWContext * context, - LO_Element * element) -{ - - Assert_(context != NULL); - - // If element is NULL, we are to give focus to - // the window itself, bringing it to front if - // necessary... - // - if (element == NULL) - { - FE_RaiseWindow(context); - } - else - { - LO_FormElementStruct * formElem; - LFormElement * toFocus; - FormFEData * feData; - - Assert_(element->type == LO_FORM_ELE); - - - formElem = (LO_FormElementStruct *) element; - feData = GetFEData(formElem); - if ( feData == NULL) { - return; - } - - // Can't call SwitchTarget, because the Mocha script calling - // this callback may have been invoked by a target switch - // that is in progress, but not complete. - // - // So we set a timer to do it for us... - - - toFocus = feData->fHost; - - if (toFocus != NULL) - { - // limitation of 1 timer per form element - if (toFocus->fTimer != 0) - FE_ClearTimeout(toFocus->fTimer); - - toFocus->fTimer = FE_SetTimeout((TimeoutCallbackFunction)FocusFormElementTimer, (void*)formElem, 0); - } - - // toFocus = (LCommander *) GetFEDataPane(formElement); - // Assert_(toFocus != NULL); - // LCommander::SwitchTarget(toFocus); - - } -} - -// Take focus away from a input element and give it -// to its commander -void -FE_BlurInputElement( MWContext * context, - LO_Element * element) -{ - // If element is NULL, we blur focus from the window, - // but only if the window contains the current target, - // as denoted by the result of IsOnDuty() - // - // When we blur focus, we send focus to nothing... - // - if (element == NULL) - { - FE_LowerWindow(context); - } - else - { - LO_FormElementStruct * formElem; - LFormElement * unFocus; - FormFEData * feData; - - Assert_(context != NULL && element != NULL); - Assert_(element->type == LO_FORM_ELE); - - formElem = (LO_FormElementStruct *) element; - feData = GetFEData(formElem); - if (feData == NULL) { - return; - } - - unFocus = feData->fHost; - - // Can't call SwitchTarget, because the Mocha script calling - // this callback may have been invoked by a target switch - // that is in progress, but not complete. - // - // So we set a timer to do it for us... - - if (unFocus != NULL) - { - // limitation of 1 timer per form element - if (unFocus->fTimer != 0) - FE_ClearTimeout(unFocus->fTimer); - - unFocus->fTimer = FE_SetTimeout((TimeoutCallbackFunction)BlurFormElementTimer, (void*)formElem, 0); - } - - /* if (LCommander::GetTarget() == unFocus) - LCommander::SwitchTarget(unFocus->GetSuperCommander()); - else - Assert_(false); - */ - } -} - - -// -// Timer callback to switch the target -// to a given form element -// -static void -FocusFormElementTimer( LO_FormElementStruct * formElem ) -{ - Assert_(formElem != NULL); - Assert_(GetFEData(formElem) != NULL); - - if ( !GetFEData( formElem ) ) - return; - - // Having no element_data would be a BAD THING - if (!formElem->element_data) - return; - - LCommander * commander = FEDATACOMMANDER; - LFormElement * element = FEDATAHOST; - - element->fTimer = 0; - - if (commander != NULL) - LCommander::SwitchTarget(commander); -} - -// -// Timer callback to take focus from -// a form element. -// -static void -BlurFormElementTimer( LO_FormElementStruct * formElem ) -{ - Assert_(formElem != NULL); - Assert_(GetFEData(formElem) != NULL); - - if ( !GetFEData( formElem ) ) - return; - - // Having no element_data would be a BAD THING - if (!formElem->element_data) - return; - - LCommander * commander = FEDATACOMMANDER; - LFormElement * element = FEDATAHOST; - - element->fTimer = 0; - - if (commander != NULL) - { - - if (LCommander::GetTarget() == commander) - LCommander::SwitchTarget(commander->GetSuperCommander()); - else - Assert_(false); - } -} - - -// -// "Select" the data in an input element. -// For now this only applies to text fields -// -void -FE_SelectInputElement( MWContext * window, - LO_Element * element) -{ - LO_FormElementStruct * formElement; - - Assert_(window != NULL && element != NULL); - Assert_(element->type == LO_FORM_ELE); - - formElement = (LO_FormElementStruct *) element; - - switch (formElement->element_data->type) - { - // LEditFields - just call SelectAll - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: - case FORM_TYPE_READONLY: - { - if ( !GetFEData( formElement ) ) - return; - if ( !GetFEDataPane( formElement ) ) - return; - LEditField *editField = (LEditField *) GetFEDataPane(formElement); - editField->SelectAll(); - break; - } - - // Text engine - select all - case FORM_TYPE_TEXTAREA: - if ( !GetFEData( formElement ) ) - return; - if ( !GetFEDataPane( formElement ) ) - return; - - LPane *scroller = GetFEDataPane(formElement); - CSimpleTextView *textEdit = (CSimpleTextView*) scroller->FindPaneByID(formBigTextID); Assert_(textEdit != NULL); - textEdit->SelectAll(); - - break; - -#ifdef ENDER - // embedded composer - select all - case FORM_TYPE_HTMLAREA: - if ( !GetFEData( formElement ) ) - return; - if ( !GetFEDataPane( formElement ) ) - return; - - LPane *scroller2 = GetFEDataPane(formElement); - CFormHTMLArea *htmlEdit = (CFormHTMLArea*) scroller2->FindPaneByID(formHTMLAreaID); Assert_(htmlEdit != NULL); - EDT_SelectAll(((LFormElement*)htmlEdit)->GetContext()); - break; -#endif /*ENDER*/ - -/* These are not selectable - - case FORM_TYPE_FILE: - case FORM_TYPE_SELECT_ONE: - case FORM_TYPE_SELECT_MULT: - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - case FORM_TYPE_OBJECT: -*/ - default: break; - } -} - - -// -// Notification that a input element's data has changed. -// Grab the data from XP using ResetFormElement and -// then redraw... -// -void -FE_ChangeInputElement( MWContext * window, - LO_Element * element) -{ - LO_FormElementStruct * formElement; - - Assert_(window != NULL && element != NULL); - Assert_(element->type == LO_FORM_ELE); - - Try_ - { - LO_LockLayout(); // prevent race condition with mocha thread - // reflect back from Layout - formElement = (LO_FormElementStruct *) element; - UFormElementFactory::ResetFormElementData(formElement, true, false, false); - // pkc -- If we're setting a radio button, call LO_FormRadioSet - // to turn off other radio buttons. - // WHY AREN'T WE USING LRadioGroup?!?!?!?!?!?!?!?!?!?!?!?!?!?!? - if ( formElement->element_data->type == FORM_TYPE_RADIO && - ((lo_FormElementToggleData *)(formElement->element_data))->toggled ) - LO_FormRadioSet(window, formElement); - } - Catch_(inErr) - { - LO_UnlockLayout(); - Throw_(inErr); - } - EndCatch_ - LO_UnlockLayout(); -} - - -// -// Initiate a form submission through a given input element -// -void -FE_SubmitInputElement( MWContext * window, - LO_Element * element) -{ - LO_FormElementStruct * formElement; - URL_Struct * url; - LO_FormSubmitData * submitData; - History_entry * currentHistoryPosition; - - Assert_(window != NULL && element != NULL); - - // I get an element->type of LO_IMAGE when going to VeriSign - Assert_(element->type == LO_FORM_ELE || element->type == LO_IMAGE); - - formElement = (LO_FormElementStruct *) element; - - // - // Call the LO module to figure out the form's context - // - submitData = LO_SubmitForm(window, formElement); - if (submitData == NULL) - return; - -#ifdef SingleSignon - // Check for a password submission and remember the data if so - SI_RememberSignonData(window, submitData); -#endif - - url = NET_CreateURLStruct((char *)submitData->action, NET_DONT_RELOAD); - currentHistoryPosition = SHIST_GetCurrent( &window->hist ); - - if (currentHistoryPosition && currentHistoryPosition->address) - url->referer = XP_STRDUP(currentHistoryPosition->address); - - CBrowserContext* theNSContext = ExtractBrowserContext(window); - if ( theNSContext && url ) - { - NET_AddLOSubmitDataToURLStruct(submitData, url); - if (submitData->window_target) - { - CBrowserContext* tempContext = ExtractBrowserContext(XP_FindNamedContextInList(window, (char *)submitData->window_target)); - - if (tempContext) - { - submitData->window_target = NULL; - url->window_target = NULL; // don't let window_target get resolved later - theNSContext = tempContext; - } - } - - theNSContext->SwitchLoadURL(url, FO_CACHE_AND_PRESENT); - } - - LO_FreeSubmitData(submitData); -} - - -// -// Simulate a "hot-spot" click on an input element. -// Applies only to buttons. -// -void -FE_ClickInputElement( MWContext * window, - LO_Element * element) -{ - - LO_FormElementStruct * formElement; - - Assert_(window != NULL && element != NULL); - Assert_(element->type == LO_FORM_ELE); - - formElement = (LO_FormElementStruct *) element; - switch (formElement->element_data->type) - { - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - if ( !GetFEData( formElement ) ) - return; - if ( !GetFEDataPane( formElement ) ) - return; - - LControl *control = (LControl *) GetFEDataPane(formElement); - control->SimulateHotSpotClick(0); - break; - -/* These are not programmatically "clickable" - - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - case FORM_TYPE_ISINDEX: - case FORM_TYPE_TEXTAREA: - case FORM_TYPE_HTMLAREA: - case FORM_TYPE_FILE: - case FORM_TYPE_SELECT_ONE: - case FORM_TYPE_SELECT_MULT: - case FORM_TYPE_RADIO: - case FORM_TYPE_CHECKBOX: - case FORM_TYPE_HIDDEN: - case FORM_TYPE_KEYGEN: - case FORM_TYPE_IMAGE: - case FORM_TYPE_JOT: - case FORM_TYPE_OBJECT: -*/ - default: break; - } -} - -void MochaFocusCallback( MWContext * /* pContext */, - LO_Element * /* lo_element */, - int32 /* lType */, - void * whatever, - ETEventStatus status ) -{ - if (status == EVENT_OK && whatever) - { - LFormElement* element = reinterpret_cast(whatever); - element->ClearInFocusCallAlready(); - // 97-06-14 pkc -- call virtual callback method - element->PostMochaFocusCallback(); - } -} - - -void -LFormElement::MochaFocus( Boolean doFocus, - Boolean switchTarget) -{ - // Don't do anything if we're really dead - if (IsMarkedForDeath()) - return; - - // ick ick ick ick ick - // - // Here's the deal... - // PowerPlant doesn't change sTarget before - // calling it's DontBeTarget method, so if that - // method does something to change the target, - // you recurse. - // - if (fInFocusCallAlready && doFocus == fPreviousFocus) - { - fPreviousFocus = doFocus; - return; - } - else - { - fPreviousFocus = doFocus; - } - - if (!XP_IsContextInList(fContext)) - return; - - fInFocusCallAlready = true; - - if (doFocus) - { - if (switchTarget) - sTargetedFormElement = this; - - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_FOCUS; - event->layer_id = fLayoutElement->lo_form.layer_id; - ET_SendEvent( fContext, fLayoutElement, event, MochaFocusCallback, this ); - } - } - else - { - if (switchTarget) - sTargetedFormElement = NULL; - - if (fMochaChanged) - { - // fReflectOnChange denotes when LM_SendOnChange should be called. - // If it is true, the call is made immediately when the data changes. - // If false, the call is made here, when focus is lost. - // - // The only reason for this flag is that some form elements are not - // focusable and therefore must immediately reflect state changes. - - if (!fReflectOnChange) - ReflectData(); - - fMochaChanged = false; // important to do this first to avoid recursion - - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_CHANGE; - event->layer_id = fLayoutElement->lo_form.layer_id; - ET_SendEvent( fContext, fLayoutElement, event, MochaFocusCallback, this ); - } - } - - // Don't do anything if the onChange handler killed this form element - if (!IsMarkedForDeath()) - { - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_BLUR; - event->layer_id = fLayoutElement->lo_form.layer_id; - ET_SendEvent( fContext, fLayoutElement, event, MochaFocusCallback, this ); - } - } - } - -// 97-06-03 pkc -- this is now set top false in MochaFocusCallback -// fInFocusCallAlready = false; - } - - -#pragma global_optimizer off - -StTempFormBlur::StTempFormBlur() -{ - fSavedFocus = LFormElement::GetTargetedElement(); - - if ( fSavedFocus ) - { - // 97.08.18 pchen -- fix bug #79140 - // If fSavedFocus is an LCommander, call SwitchTarget on it's - // supercommander to "unfocus" form element. - LCommander* commander = dynamic_cast(fSavedFocus); - if (commander) - { - LCommander* super = commander->GetSuperCommander(); - if (super) - { - LCommander::SwitchTarget(super); - fSavedFocus = NULL; - } - } - else - fSavedFocus->MochaFocus(false, false); - } -} - - -StTempFormBlur::~StTempFormBlur() -{ - if ( fSavedFocus ) - fSavedFocus->MochaFocus(true, false); - - fSavedFocus = NULL; -} - - -LFormElement* LFormElement::sTargetedFormElement = NULL; - - -void -LFormElement:: MochaSelect() -{ - // don't do anything if we're dead - if (IsMarkedForDeath()) return; - - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_SELECT; - event->layer_id = fLayoutElement->lo_form.layer_id; - ET_SendEvent( fContext, fLayoutElement, event, NULL, NULL ); - } -} - -void MochaChangedCallback( MWContext * /* pContext */, - LO_Element * /* lo_element */, - int32 /* lType */, - void * whatever, - ETEventStatus status ) -{ - if (status == EVENT_OK && whatever) - { - LFormElement* element = reinterpret_cast(whatever); - // 97-06-14 pkc -- call PostMochaFocusCallback to handle FormsPopup special case - element->PostMochaFocusCallback(); - } -} - -Boolean HasKeyEventCapture(MWContext* context); - -// Returns whether the context or any of its parents is capturing key events. -Boolean HasKeyEventCapture(MWContext* context) -{ - MWContext *mwcx; - uint32 mask = EVENT_KEYDOWN | EVENT_KEYUP | EVENT_KEYPRESS; - - if (context->event_bit & mask) return true; - - if (context->is_grid_cell) - { - mwcx = context; - while (mwcx->grid_parent != NULL) - { - mwcx = mwcx->grid_parent; - if (mwcx->event_bit & mask) return true; - } - } - return false; -} - -void -LFormElement::MochaChanged() -{ - // don't do anything if we're dead OR we don't have a fLayoutElement which - // can be the case when we are creating a text area and the text engine sends - // a message that the newly created area has changed before we get a chance to - // assign it a fLayoutElement - if (IsMarkedForDeath() || fLayoutElement == NULL) - return; - - // - // If fReflectOnChange is false, - // we will reflect the data when the - // element loses focus. - // - // If true, we must reflect it now - // - if (fReflectOnChange) - { - fMochaChanged = false; - ReflectData(); - - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_CHANGE; - event->layer_id = fLayoutElement->lo_form.layer_id; -// ET_SendEvent( fContext, fLayoutElement, event, NULL, NULL ); - // 97-06-14 pkc -- Use MochaChangedCallback to handle FormsPopup special case - ET_SendEvent( fContext, fLayoutElement, event, MochaChangedCallback, this ); - } - } - else - { - // if the form element is a text entry form and there is a key event handler for - // any containing context or for the form, reflect the data. - LO_FormElementData* data = fLayoutElement->lo_form.element_data; - if (data != NULL && - (data->type == FORM_TYPE_TEXTAREA || -#ifdef ENDER - data->type == FORM_TYPE_HTMLAREA || -#endif /*ENDER*/ - data->type == FORM_TYPE_TEXT || - data->type == FORM_TYPE_PASSWORD) && - (fLayoutElement->lo_form.event_handler_present || HasKeyEventCapture(fContext))) - { - ReflectData(); - } - fMochaChanged = true; - } -} - - -void -LFormElement::MochaSubmit() -{ - // don't do anything if we're dead - if (IsMarkedForDeath()) return; - - StTempFormBlur tempBlur; - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_SUBMIT; - event->layer_id = fLayoutElement->lo_form.layer_id; - ET_SendEvent( fContext, fLayoutElement, event, NULL, NULL ); - } -} - -void -MochaClick( MWContext* context, LO_Element* ele, CMochaEventCallback * cb ) -{ - StTempFormBlur tempBlur; - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - LO_FormElementStruct* form = (LO_FormElementStruct *)ele; - CHTMLView* view = dynamic_cast(GetFEDataPane(form)->GetSuperView()); - ThrowIfNil_(view); - SPoint32 formPos = {CL_GetLayerXOrigin(form->layer), CL_GetLayerYOrigin(form->layer)}; - Point screenPt; - view->ImageToAvailScreenPoint(formPos, screenPt); - event->type = EVENT_CLICK; - event->which = 1; - event->x = CL_GetLayerXOffset(form->layer); - event->y = CL_GetLayerYOffset(form->layer); - event->docx = CL_GetLayerXOrigin(form->layer); - event->docy = CL_GetLayerYOrigin(form->layer); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - event->layer_id = form->layer_id; - event->modifiers = CMochaHacks::MochaModifiersFromKeyboard(); - ET_SendEvent( context, ele, event, CMochaEventCallback::MochaCallback, cb); - } - //cb->SendEvent(context, ele, EVENT_CLICK); -} - -// EventMouseUp -void -MochaMouseUp( MWContext* context, LO_Element* ele, CMochaEventCallback * cb ) -{ - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - LO_FormElementStruct* form = (LO_FormElementStruct *)ele; - CHTMLView* view = dynamic_cast(GetFEDataPane(form)->GetSuperView()); - ThrowIfNil_(view); - SPoint32 formPos = {CL_GetLayerXOrigin(form->layer), CL_GetLayerYOrigin(form->layer)}; - Point screenPt; - view->ImageToAvailScreenPoint(formPos, screenPt); - event->type = EVENT_MOUSEUP; - event->which = 1; - event->x = CL_GetLayerXOffset(form->layer); - event->y = CL_GetLayerYOffset(form->layer); - event->docx = CL_GetLayerXOrigin(form->layer); - event->docy = CL_GetLayerYOrigin(form->layer); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - event->layer_id = form->layer_id; - event->modifiers = CMochaHacks::MochaModifiersFromKeyboard(); - ET_SendEvent( context, ele, event, CMochaEventCallback::MochaCallback, cb); - } - //cb->SendEvent(context, ele, EVENT_MOUSEUP); -} - -#pragma global_optimizer on - - -void -LFormElement::ReflectData() // reflect to XP data structures -{ - if (!XP_IsContextInList(fContext)) - return; - - UFormElementFactory::GetFormElementValue(&(fLayoutElement->lo_form), false, false); -} - - -LFormElement::LFormElement() -{ - fTimer = 0; - fLayoutElement = NULL; - fContext = NULL; - fPane = NULL; - fMochaChanged = false; - fReflectOnChange = false; - fInFocusCallAlready = false; - fMarkedForDeath = false; - fPreviousFocus = false; -} - -void -LFormElement::InitFormElement(MWContext * context, LO_FormElementStruct *lo_element) -{ - fContext = context; - fLayoutElement = (LO_Element *) lo_element; -} - -/* - LFormElement::MarkForDeath() - - Adds the form element's pane to the list of form elements to be destroyed - at idle time. This is necessary because JavaScript invoked from a widget - class may clear the document, killing the widget in the process, but the - widget may do more processing after the call to JavaScript returns, so - we can't realyl kill it until sometime later, like idle time. -*/ -void -LFormElement::MarkForDeath() -{ - fMarkedForDeath = true; - - // Hide the element's pane, and add it to death row - if (fPane != NULL) - { - fPane->Hide(); - - if (gDeadFormElementsList == NULL) - { - gDeadFormElementsList = new LArray; - if (gDeadFormElementsList == NULL) return; // leak me - } - - gDeadFormElementsList->InsertItemsAt(1, LArray::index_First, &fPane); - - // set a timer to kill the elements in the list - if (gKillFormElementsTimer == 0) { - gKillFormElementsTimer = FE_SetTimeout(KillFormElementsTimer, 0, 0); - } - } -} - - -/* - LFormElement::~LFormElement() - - If this form element is the targeted form element, clear that field. - - If this form element has been marked for death earlier, it removes - itself (actually its pane) from the gDeadFormElementsList. - - The key thing to remember with the mark for death is that it is - actually the element's pane that gets kiled. If the LPane and LFormElement - are different objects, the pane is responsible for killing the form element, - which then takes the pane out of the dead list (it's all very sick). -*/ -LFormElement::~LFormElement() -{ - if (this == sTargetedFormElement) - sTargetedFormElement = NULL; - - if (fTimer != 0) - { - FE_ClearTimeout(fTimer); - fTimer = 0; - } - - if (fMarkedForDeath) - gDeadFormElementsList->Remove(&fPane); - - // Since all of our form element pane classes mixin this class, - // we should set fPane and fHost in fFEData to NULL - if (fFEData) - { - if (fFEData->fPane == fPane) - fFEData->fPane = NULL; - - if (fFEData->fHost == this) - fFEData->fHost = NULL; - } -} - - - - -/* - FE_RaiseWindow - - Moves window belonging to inContext to the front - of its layer within the window list. - - pkc (2/13/97) -- if there is no window associated with - context, then we need to highlight frame. -*/ -void FE_RaiseWindow(MWContext* inContext) -{ - CBrowserContext* theNSContext = ExtractBrowserContext(inContext); - Assert_(theNSContext != NULL); - - CBrowserWindow* theTargetWindow = NULL; - CMediatedWindow* theIterWindow = NULL; - CWindowIterator theWindowIterator(WindowType_Browser); - while (theWindowIterator.Next(theIterWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theIterWindow); - if (theBrowserWindow->GetWindowContext() == theNSContext) - { - theTargetWindow = theBrowserWindow; - break; - } - } - - if (theTargetWindow != NULL) - theTargetWindow->Select(); - else if (theNSContext->IsGridChild()) - { - // context associated with a frame, call SwitchTarget on - // CHTMLView in context to focus frame - CHTMLView* theView = ExtractHyperView(inContext); - if (theView) - LCommander::SwitchTarget(theView); - } -} - - -/* - FE_LowerWindow - - Moves window belonging to inContext to the back - of its layer within the window list. -*/ -void -FE_LowerWindow( MWContext* inContext) -{ - CBrowserContext* theNSContext = ExtractBrowserContext(inContext); - Assert_(theNSContext != NULL); - - // window.blur() in a frame context should blur the window. - CBrowserWindow* theTargetWindow = CBrowserWindow::WindowForContext(theNSContext); - - if (theTargetWindow != NULL) - { - if (theTargetWindow->IsZLocked()) return; - // context is associated with a window - LWindow* theBehind = NULL; - if (theTargetWindow->HasAttribute(windAttr_Floating)) - theBehind = UDesktop::FetchBottomFloater(); - else if (theTargetWindow->HasAttribute(windAttr_Modal)) - theBehind = UDesktop::FetchBottomModal(); - else theBehind = CWindowMediator::GetWindowMediator()->FetchBottomWindow(false); - - if (theBehind != theTargetWindow) - { - if (UDesktop::FetchTopRegular() == theTargetWindow) - theTargetWindow->Deactivate(); - ::SendBehind(theTargetWindow->GetMacPort(), (theBehind != NULL) ? theBehind->GetMacPort() : NULL); - // The following hack is based on UDesktop::Resume() and fixes a case where the - // window just sent to the back would be activated, when there is a floating - // window present. - LWindow* theTopWindow = UDesktop::FetchTopRegular(); - if (theTopWindow != NULL) - { - theTopWindow->Activate(); - LMSetCurActivate(nil); // Suppress any Activate event - } - } - } -} - -// A word about events... - -// We send a mouse down event to javascript via layers before any click processing -// can occur. If layers/javascript lets us have the event, it arrives back at the -// front end and we resume click processing where it left off. The usual powerplant -// tracking mechanisms go into action, and when the mouse button is released, -// we send a mouse up event to javascript which takes a similar path. Only when -// the mouse up event comes back to us do we fire a click event. - -// The reason why we use this model is to have some degree of platform consistency -// for event handling in a script: -// A script should be able to cancel mouse down and not get a click (but still -// get a mouse up. Alternatively, a script should be able to cancel mouse up and -// not get a click. The mac differs slightly from windows in that if you cancel a -// mouse down in the button, and the mouse up occurs outside the button, you won't -// get a mouse up. - -// This can be summarized in the following diagram, where x means an event that -// was sent but cancelled, s means an event that was sent, and - means an event -// that was never sent. - -// Mac event order -> -// down up click -// x s* - * if inside element -// -// s x - -// -// Win -// -// x s - -// -// s x - - -// Events may be synthesized in the backend; synthesizing a mouse down event -// on the mac will immediately trigger a mouse up event if the mouse is already -// up. It's not easy to rearchitect the front end so that we can leave a widget -// in a clicked state and explicitly release it later, because much of the -// powerplant control code for tracking the mouse is done modally. - -// In an ideal xp world we would have total control over event sequencing, and -// be able to synthesize any events that a user could generate. The front ends -// haven't been architected this way so we have to compromise. - -// NOTE: this behavior has been implemented for buttons, radio buttons, and -// checkboxes. Radio buttons and checkboxes send mouse up events which can be -// cancelled, but cancelling them just leaves the form element in the same state -// and prevents a click from being sent. The reason why we need to send a mouse -// up event for these toggle items is for xp consistency. - -// 1997-03-06 mjc - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CLayerClickDispatchAttachment -// Dispatches mouse down events to layers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CLayerClickDispatchAttachment::CLayerClickDispatchAttachment() - : LAttachment(msg_Click, false) -{ -} - -void CLayerClickDispatchAttachment::ExecuteSelf( - MessageT inMessage, - void* ioParam) -{ - Assert_(inMessage == msg_Click); - mOwningControl = dynamic_cast(GetOwnerHost()); - Assert_(mOwningControl != NULL); - - MouseDown(*(SMouseDownEvent*)ioParam); -} - -// Dispatches a mouse down to layers. The event comes back to the front end through -// FE_HandleLayerEvent if javascript lets us have it. -void -CLayerClickDispatchAttachment::MouseDown(const SMouseDownEvent& inMouseDown) -{ - // get the compositor from the form element which is in the usercon of the control - - LO_FormElementStruct* formElem = (LO_FormElementStruct*) mOwningControl->GetUserCon(); - - CL_Compositor* compositor = CL_GetLayerCompositor(formElem->layer); - - // ALERT: ignore mouse down if part of a multi-click. We don't need to handle multi - // clicks on a form element. - if (mOwningControl->GetClickCount() > 1) return; - - if (compositor != NULL) - { - CL_Event event; - fe_EventStruct fe_event; - - //SPoint32 firstP; - //Point where = inMouseDown.wherePort; - //mOwningControl->GetSuperView()->PortToLocalPoint(where); - //mOwningControl->GetSuperView()->LocalToImagePoint(where, firstP); - - fe_event.event.mouseDownEvent = inMouseDown; - event.type = CL_EVENT_MOUSE_BUTTON_DOWN; - event.fe_event = (void *)&fe_event; - event.fe_event_size = sizeof(fe_EventStruct); - //event.x = firstP.h; - //event.y = firstP.v; - // Set the event coordinates to the button layer origin even though we have the - // actual click coordinates, to be consistent with coordinates sent for mouse up - // and click events on form buttons, when we don't have the click coordinates. - event.x = CL_GetLayerXOrigin(formElem->layer); - event.y = CL_GetLayerYOrigin(formElem->layer); - event.which = 1; // which button is down (0 = none, 1 onwards starts from the left) - event.modifiers = CMochaHacks::MochaModifiers(inMouseDown.macEvent.modifiers); - event.data = 1; // number of clicks - - CL_DispatchEvent(compositor, &event); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CLayerKeyPressDispatchAttachment -// Dispatches key events to layers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CLayerKeyPressDispatchAttachment::CLayerKeyPressDispatchAttachment() - : LAttachment(msg_KeyPress, false) -{ -} - -void CLayerKeyPressDispatchAttachment::ExecuteSelf( - MessageT inMessage, - void* ioParam) -{ - Assert_(inMessage == msg_KeyPress); - mOwner = dynamic_cast(GetOwnerHost()); - Assert_(mOwner != NULL); - - KeyPress(*(EventRecord*)ioParam); -} - -// Dispatches a key event over a form. The event comes back to the front end through -// FE_HandleLayerEvent if javascript lets us have it. -void -CLayerKeyPressDispatchAttachment::KeyPress(const EventRecord& inKeyEvent) -{ - Boolean executeHost = true; - LO_FormElementStruct* formElem = (LO_FormElementStruct*)mOwner->GetLayoutElement(); - Assert_(formElem != NULL); - - // To determine if we need to dispatch the key event to layers or not, check - // the context and its parents to see if they have handlers for any key events, - // and check if the form element has a key handler. - - if (formElem->event_handler_present || - HasKeyEventCapture(mOwner->GetContext())) - { - // In order to determine which element gets the key event when the event comes back to - // the front end, the form's parent layer gets key focus, and we pass in the layer - // coordinates (i.e. image coordinates). Layers hands to the FE the parent layer and - // an event whose x,y are now the coordinates of the element relative to that layer. - // - // The layers are organized in a tree: - // - // |---- _BACKGROUND - // | - // _DOCUMENT--|---- _BODY ------- _CONTENT - // | - // |---- LAYER1 ----|----_BACKGROUND - // | - // |----_CONTENT - // | - // |----FORM ELEMENT #1 LAYER (cutout) - - CL_Compositor* compositor = CL_GetLayerCompositor(formElem->layer); - CL_GrabKeyEvents(compositor, CL_GetLayerParent(formElem->layer)); - - if (compositor != NULL && - !CL_IsKeyEventGrabber(compositor, NULL)) - { - CL_Event event; - fe_EventStruct fe_event; - - Char16 theChar = inKeyEvent.message & charCodeMask; - - event.data = 0; - switch (inKeyEvent.what) - { - case keyDown: - event.type = CL_EVENT_KEY_DOWN; - break; - case autoKey: - event.type = CL_EVENT_KEY_DOWN; - event.data = 1; // repeating - break; - case keyUp: - event.type = CL_EVENT_KEY_UP; - break; - } - fe_event.event.macEvent = inKeyEvent; - event.fe_event = (void *)&fe_event; - event.fe_event_size = sizeof(fe_EventStruct); - // event x, y must be form location in document coordinates. - event.x = CL_GetLayerXOrigin(formElem->layer); - event.y = CL_GetLayerYOrigin(formElem->layer); - event.which = theChar; - event.modifiers = CMochaHacks::MochaModifiers(inKeyEvent.modifiers); - - CL_DispatchEvent(compositor, &event); - executeHost = false; - } - } - else - { - if (inKeyEvent.what != keyUp) - { - CHTMLView::SetLastFormKeyPressDispatchTime(inKeyEvent.when); - executeHost = true; - } - } - mExecuteHost = executeHost; -} diff --git a/mozilla/cmd/macfe/central/mforms.h b/mozilla/cmd/macfe/central/mforms.h deleted file mode 100644 index b2ce321bdab..00000000000 --- a/mozilla/cmd/macfe/central/mforms.h +++ /dev/null @@ -1,728 +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. - */ - -// mforms.h - Defines form views - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include // mjc - -#include "CSimpleTextView.h" // For CFormBigText -//#include "VEditField.h" -#include "CTSMEditField.h" -#include "CEditView.h" // for CFormHTMLArea - -#include "CKeyUpReceiver.h" // mixin for forms that need to receive key up events - -#include "PascalString.h" -#include "cstring.h" -#include "PopupBox.h" - -#include "libmocha.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CLayerClickDispatchAttachment -// -// Attached to a form view to intercept the click and dispatch to layers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CLayerClickDispatchAttachment : public LAttachment -{ - public: - CLayerClickDispatchAttachment(); - - protected: - - virtual void ExecuteSelf( - MessageT inMessage, - void* ioParam); - - virtual void MouseDown(const SMouseDownEvent &inMouseDown); - - LControl* mOwningControl; -}; - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CLayerClickCallbackMixin -// -// Abstract class which a form view must implement if it has a CLayerClickDispatchAttachment. -// ClickSelfLayer is called from the html view when it receives a layer event which -// is targeted at a form. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -class CLayerClickCallbackMixin -{ - public: - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown) = 0; -}; - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CLayerKeyPressDispatchAttachment -// -// Attached to a form view to intercept the keypress and dispatch to layers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class LFormElement; - -class CLayerKeyPressDispatchAttachment : public LAttachment -{ - public: - CLayerKeyPressDispatchAttachment(); - - protected: - - virtual void ExecuteSelf( - MessageT inMessage, - void* ioParam); - - virtual void KeyPress(const EventRecord& inKeyEvent); - - LFormElement* mOwner; -}; - -class StSetupFormDrawing -{ -private: - LPane * fForm; // We assume that form's superview is CHyperView - RGBColor fFore; // Old foreground - RGBColor fBack; // Old background -public: - StSetupFormDrawing(LPane * formElement); - ~StSetupFormDrawing(); -}; - -class LFormElement; - -/***************************************************************************** - * FE_Data structure in LO_FormElementStruct - *****************************************************************************/ -struct FormFEData { - LPane * fPane; - LFormElement * fHost; - LCommander * fCommander; - - FormFEData(); - ~FormFEData(); -}; - - - -class LFormElement -{ -public: - LFormElement(); - virtual ~LFormElement(); - virtual void InitFormElement(MWContext * context, LO_FormElementStruct *lo_element); - - // Set to true for non-focusable elements so that their state changes - // are appropriately reflected - // - void SetReflectOnChange(Boolean reflect) { fReflectOnChange = reflect; } - - void SetLayoutElement(LO_FormElementStruct *lo_element) { fLayoutElement = (LO_Element *) lo_element; } - LO_Element* GetLayoutElement() { return fLayoutElement; } // mjc - MWContext* GetContext() { return fContext; } - int16 GetWinCSID() const; - - virtual void ReflectData(); // reflect to XP data structures - - virtual void MochaFocus(Boolean doFocus, Boolean switchTarget=true); - // 97-06-14 pkc -- virtual callback called from mocha focus callback - virtual void PostMochaFocusCallback() {} - - virtual void MochaSelect(); - virtual void MochaChanged(); - virtual void MochaSubmit(); - virtual void SetFEData( FormFEData * data ) { fFEData = data; if (data) fPane = data->fPane; } - - void MarkForDeath(); - inline Boolean IsMarkedForDeath() { return fMarkedForDeath; } - - void ClearInFocusCallAlready() { fInFocusCallAlready = false; } - - static inline LFormElement* GetTargetedElement() { return sTargetedFormElement; } - - void* fTimer; - -protected: - LPane *fPane; // the pane that represents this element - LO_Element *fLayoutElement; - FormFEData *fFEData; // Same thing pointed to by FEDATAPANE - // We need a private copy because we might need to access - // it after fLayoutElement has been freed - MWContext *fContext; - - unsigned fMochaChanged : 1; - unsigned fReflectOnChange : 1; // for elements that don't focus - unsigned fInFocusCallAlready : 1; - unsigned fMarkedForDeath : 1; - - Boolean fPreviousFocus; - static LFormElement *sTargetedFormElement; -}; - - -// This is a stack based class that tells the currently focused form element -// that it has lost focus and then restores focus to it when destructed. -// -// This is needed because an action may invoke a mocha script that relies -// on the current value of a focussed form field. But form field values -// aren't reflected until focus is lost. So we fake up losing focus. -// -// For example, the user changes a text field, and clicks on a button -// that invokes a script that uses the field's value. Because the field -// doesn't lose focus when the button is clicked, the value the script -// sees could be wrong. So when clicking on the button, we must fake -// the loss of focus for the text field. -// -// We do this rather than just reflect the focussed element's value directly -// because other platforms actually transfer focus in these cases. -// -class StTempFormBlur -{ -public: - StTempFormBlur(); - ~StTempFormBlur(); - -private: - - LFormElement* fSavedFocus; -}; - - - -/***************************************************************************** - * class CWhiteEditField - * Draws on a white background - *****************************************************************************/ -class CWhiteEditField : public CTSMEditField, public LFormElement { -public: - CWhiteEditField(LStream *inStream); - - virtual void UserChangedText(); // to call MochaChanged - - - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - -protected: - virtual void BeTarget(); // to call MochaFocus - virtual void DontBeTarget(); // to call MochaFocus - // Draws background to white - void DrawSelf(); - virtual void ClickSelf(const SMouseDownEvent& event); // to call MochaSelect - -}; - -/***************************************************************************** - * class CFormLittleText - * EditField that broadcasts msg_SubmitText when return is pressed inside it. - * As with all forms, ioParam of the broadcast is 'this' - * Does not broadcast by default, must call SetBroadcast (just like layout interface) - *****************************************************************************/ -class CFormLittleText: public CWhiteEditField, public LBroadcaster, public CKeyUpReceiver -{ -public: - enum { class_ID = 'ftxt' }; - - CFormLittleText( LStream* inStream ); - - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - // ¥¥ Form interface - void SetBroadcast( Boolean doBroadcast ) { fDoBroadcast = doBroadcast; } - void SetLayoutForm( LO_FormElementStruct* form ) { fLOForm = form; } - LO_FormElementStruct* GetLayoutForm() { return fLOForm; } - - // Sets the number of visible characters, resizes accordingly - void SetVisibleChars( Int16 visChars ); - // Broadcast 'this' - virtual void BroadcastValueMessage(); - // Broadcast msg_EditSubmit on return - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - virtual StringPtr GetDescriptor( - Str255 outDescriptor) const; - virtual void SetDescriptor( - ConstStr255Param inDescriptor); -protected: - virtual void BeTarget(); - - LO_FormElementStruct* fLOForm; // Layout form* - Boolean fDoBroadcast; // True if we should broadcast -}; - -/***************************************************************************** - * class CFormBigText - * Large edit text field. Draws full white background; - *****************************************************************************/ - -class CFormBigText : public CSimpleTextView, public LFormElement, public CKeyUpReceiver { -public: - enum { class_ID = 'fbtx' }; - -// ¥¥ Constructors/destructors - CFormBigText(LStream *inStream); - - virtual ~CFormBigText(); - -// ¥¥ Misc - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam); - - virtual Boolean FocusDraw(LPane* inSubPane = nil); - - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - // we hook into the text engine as an attachment so that we know when the text changes -// virtual void ListenToMessage(MessageT inMessage, void *ioParam); // to call MochaChanged - - virtual void UserChangedText(); // to call MochaChanged - - virtual void ClickSelf(const SMouseDownEvent& event); // to call MochaSelect - virtual void DontBeTarget(); // MochaFocus - - //virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - -protected: - virtual void BeTarget(); - void DrawSelf();// Draws background to white -}; - -/***************************************************************************** - * class CFormHTMLArea - * Large edit html field. - *****************************************************************************/ - -class CFormHTMLArea : public CEditView, public LFormElement { -public: - enum { class_ID = 'fhtm' }; - -// ¥¥ Constructors/destructors - CFormHTMLArea(LStream *inStream); - virtual ~CFormHTMLArea(); - - void FinishCreateSelf(); - -// ¥¥ Misc - virtual void FindCommandStatus( CommandT inCommand, Boolean& outEnabled, - Boolean& outUsesMark, Char16& outMark, Str255 outName ); - - virtual Boolean ObeyCommand( CommandT inCommand, void *ioParam ); - virtual void BeTarget(); - virtual void DontBeTarget(); -}; - -//--------------------------------------------------------------------------- -// class CNonPrintingView -//--------------------------------------------------------------------------- - -// An experiment with putting forms in a non-printing view - -class CNonPrintingView : public LView -{ - public: - enum { class_ID = 'npvw' }; - - CNonPrintingView(LStream * inStream); - ~CNonPrintingView(); - - virtual void PrintPanel( const PanelSpec &inPanel, RgnHandle inSuperPrintRgnH); - virtual void SuperPrintPanel( const PanelSpec &inSuperPanel, RgnHandle inSuperPrintRgnH); -}; - - - -/***************************************************************************** - * class CFormList - * List used in forms. - * A wrapper around very bare PPlant's LListBox - * Has functions for simple element addition, and resizing - ****************************************************************************/ -class CFormList : public LListBox, public LFormElement { - Int32 fLongestItem; // String length of the longest item -public: - enum { class_ID = 'flst' }; - -// ¥¥ Constructors/destructors - - CFormList(LStream * inStream); - ~CFormList(); - -// ¥¥ Forms interface - void SetSelectMultiple(Boolean multipleSel); - - // Add an item to the list - must call AddRow first - void AddItem (const cstring& itemName, SInt16 inRow); - - // Add rows - void SyncRows( UInt16 nRows ); - - void SetTextTraits(); - - // Selecting items - void SetSelect(int item, Boolean selected); - void SelectNone(); - - // Are they selected - Boolean IsSelected(int item); - // Resizes the list to the width of the longest item, and visRows - void ShrinkToFit(Int32 visRows); -// ¥¥ drawing, making sure that background is white - virtual Boolean FocusDraw(LPane* inSubPane = nil); // Sets background to white - - - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - virtual void ClickSelf(const SMouseDownEvent& event); - -protected: - virtual void BeTarget(); // MochaFocus - virtual void DontBeTarget(); // MochaFocus - virtual void DrawSelf(); - void MakeSelection( LArray& list ); - Boolean CheckSelection( LArray& list ); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - -protected: // Added from CCustomListBox (Developer 21) - virtual void DrawElement (const short lMessage, const Boolean lSelect, const Rect *lRect, - const void *lElement, const short lDataLen) ; - virtual void DrawElementSelf (const Rect *lRect, const void *lElement, const short lDataLen) ; - -private: // Added from CCustomListBox (Developer 21) - friend pascal void LDefProc (short lMessage, Boolean lSelect, Rect *lRect, - Cell lCell, unsigned short lDataOffset, unsigned short lDataLen, ListHandle lHandle) ; - - static ListDefUPP callerLDEFUPP ; - - enum { - callerLDEFResID = 1100 - } ; -}; - -/***************************************************************************** - * class CFormButton - * Button used in forms. - * Broadcasts itself (this) instead of value when pressed. - * Also resizes itself to fit the width of the title - ****************************************************************************/ - -class CFormButton : public LStdButton, public LFormElement, public CLayerClickCallbackMixin { - -public: - enum { class_ID = 'fbut' }; - -// ¥¥ Constructors/destructors - - CFormButton(LStream * inStream); - -// ¥¥ Misc - // After the name is set, resizes the control to fit around it - virtual void SetDescriptor(ConstStr255Param inDescriptor); - // Broadcasts 'this' as an ioParam. - virtual void BroadcastValueMessage(); - -// Mocha hot spot handling - virtual void EventMouseUp(const EventRecord& inEvent); - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown); // mjc - virtual void HotSpotResult(Int16 inHotSpot); - void HotSpotResultCallback(Int16 inHotSpot); - -protected: - virtual void DrawSelf(); - virtual void DrawTitle(); - virtual void HotSpotAction(Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside); - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - -}; - -/***************************************************************************** - * class CGAFormPushButton - * Button used in forms. - * Broadcasts itself (this) instead of value when pressed. - * Also resizes itself to fit the width of the title - ****************************************************************************/ - -class CGAFormPushButton : public LGAPushButton, public LFormElement, public CLayerClickCallbackMixin - { -private: - typedef LGAPushButton super; - -public: - enum { class_ID = 'Gfpb' }; - -// ¥¥ Constructors/destructors - - CGAFormPushButton(LStream * inStream); - -// ¥¥ Misc - // After the name is set, resizes the control to fit around it - virtual void SetDescriptor(ConstStr255Param inDescriptor); - // Broadcasts 'this' as an ioParam. - virtual void BroadcastValueMessage(); - -// Mocha hot spot handling - virtual void EventMouseUp(const EventRecord& inEvent); - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown); // mjc - virtual void HotSpotResult(Int16 inHotSpot); - void HotSpotResultCallback(Int16 inHotSpot); - -protected: - virtual void DrawButtonTitle( Int16 inDepth ); - -}; - -/***************************************************************************** - * class FormsGlypher - * Popup Glypher used in forms. - * Displays a FORM_TYPE_SELECT_ONE structure - ****************************************************************************/ - -struct lo_FormElementSelectData_struct; -class FormsPopup: public StdPopup, public LFormElement { -public: - - // 97-06-15 pkc -- different states for reflecting focus to mocha - enum EFocusState{ - FocusState_None = 0, - FocusState_FirstCall, - FocusState_SecondCall, - FocusState_ThirdCall, - FocusState_FourthCall, - FocusState_FifthCall - }; - FormsPopup (CGAPopupMenu * target, lo_FormElementSelectData_struct * selections); - // interface - short GetCount (); - CStr255 GetText (short item); - virtual void ExecuteSelf (MessageT message, void *param); - - virtual void PostMochaFocusCallback(); - -protected: - // do ScriptCode Menu Trick on IM:MacTbxEss Page3-46 - virtual void SetMenuItemText(MenuHandle aquiredMenu, int item, CStr255& itemText); - virtual void DrawTruncTextBox (CStr255 text, const Rect& box); - virtual Boolean NeedCustomPopup() const; -private: - virtual Boolean NeedDrawTextInOurOwn() const; -private: - lo_FormElementSelectData_struct * fSelections; - EFocusState fFocusState; - LFormElement* fSavedFocus; - SInt32 fOldValue; -}; - -/***************************************************************************** - * class CFormRadio - * Radio buttons used in forms. Have white background - ****************************************************************************/ -class CFormRadio: public LStdRadioButton, public LFormElement, public CLayerClickCallbackMixin { - static RgnHandle sRadioRgn; - void SetupClip(); -public: - enum { class_ID = 'frad' }; - -// ¥¥ Constructors/destructors - - CFormRadio(LStream * inStream); - -// ¥¥ Setting up the drawing environment - virtual Boolean TrackHotSpot(Int16 inHotSpot,Point inPoint, Int16 inModifiers); - virtual void SetValue(Int32 inValue); - -// Mocha - virtual void EventMouseUp(const EventRecord& inEvent); - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown); // mjc - virtual void HotSpotResult(Int16 inHotSpot); - void HotSpotResultCallback(Int16 inHotSpot, - LO_FormElementStruct* oldRadio, - Int16 savedValue, - MWContext * context); - -protected: - virtual void DrawSelf(); -}; - -/***************************************************************************** - * class CGAFormRadio - * Radio buttons used in forms. Have white background - ****************************************************************************/ -class CGAFormRadio: public LGARadioButton, public LFormElement, public CLayerClickCallbackMixin -{ -private: - typedef LGARadioButton super; - -public: - enum { class_ID = 'Gfrb' }; - - CGAFormRadio(LStream* inStream); - - virtual Boolean TrackHotSpot( - Int16 inHotSpot, - Point inPoint, - Int16 inModifiers); - virtual void SetValue(Int32 inValue); - -// Mocha - virtual void EventMouseUp(const EventRecord& inEvent); - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown); // mjc - virtual void HotSpotResult(Int16 inHotSpot); - void HotSpotResultCallback(Int16 inHotSpot, - LO_FormElementStruct* oldRadio, - Int16 savedValue, - MWContext * context); - -protected: - virtual void DrawSelf(); -}; - -/***************************************************************************** - * class CFormCheckbox - * Checkboxes used in forms. Have white background. - * Very much like CFormRadio - ****************************************************************************/ -class CFormCheckbox: public LStdCheckBox, public LFormElement, public CLayerClickCallbackMixin { - static RgnHandle sCheckboxRgn; - void SetupClip(); -public: - enum { class_ID = 'fchk' }; - -// ¥¥ Constructors/destructors - - CFormCheckbox(LStream * inStream); - -// ¥¥ Setting up the drawing environment - virtual Boolean TrackHotSpot(Int16 inHotSpot,Point inPoint, Int16 inModifiers); - virtual void SetValue(Int32 inValue); - - virtual void EventMouseUp(const EventRecord& inEvent); - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown); // mjc - virtual void HotSpotResult(Int16 inHotSpot); - void HotSpotResultCallback( Int16 inHotSpot, Int16 savedValue ); - -protected: - virtual void DrawSelf(); -}; - -/***************************************************************************** - * class CGAFormCheckbox - * Checkboxes used in forms. Have white background. - * Very much like CFormRadio - ****************************************************************************/ -class CGAFormCheckbox: public LGACheckbox, public LFormElement, public CLayerClickCallbackMixin -{ -private: - typedef LGACheckbox super; - -public: - enum { class_ID = 'Gfcb' }; - - CGAFormCheckbox(LStream* inStream); - - virtual Boolean TrackHotSpot( - Int16 inHotSpot, - Point inPoint, - Int16 inModifiers); - virtual void SetValue(Int32 inValue); - -// Mocha - virtual void EventMouseUp(const EventRecord& inEvent); - virtual void ClickSelfLayer(const SMouseDownEvent &inMouseDown); // mjc - virtual void HotSpotResult(Int16 inHotSpot); - void HotSpotResultCallback( Int16 inHotSpot, Int16 savedValue ); - -protected: - virtual void DrawSelf(); -}; - -/***************************************************************************** - * class CFormFile - * File upload buttons used in forms - * This element has all the smarts. It knows how to: - * Resize - * Select files - ****************************************************************************/ -class CFormFileEditField; -class CFormFile : public LView , public LListener, public LFormElement { -public: - enum { class_ID = 'ffil' }; - -// ¥¥ Constructors/destructors - - CFormFile(LStream * inStream); - virtual void FinishCreateSelf(); - void SetVisibleChars(Int16 numOfChars); - void GetFontInfo(Int32& width, Int32& height, Int32& baseline); -// ¥¥ Access - Boolean GetFileSpec(FSSpec & spec); - void SetFileSpec(FSSpec & spec); - -// ¥¥ÊMisc - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - CFormFileEditField * fEditField; - -private: - - FSSpec fSpec; // Our file specs - Boolean fHasFile; - LStdButton * fButton; -}; - -/***************************************************************************** - * CFormFileEditField - * Text field of the file upload widget. - * according to the specs it needs to be non-editable, only action you - * can do inside it is cut/delete key. - * On a click, it is always highlited - ****************************************************************************/ -class CFormFileEditField : public LEditField { -public: - enum { class_ID = 'ffie' }; - friend class CFormFile; -// ¥¥ Constructors/destructors - - CFormFileEditField(LStream * inStream); - -// ¥¥ÊMisc -- overrides so that you can only click and delete - virtual void SpendTime(const EventRecord &/*inMacEvent*/) {}; // Don't blink cursor - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - virtual void FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual void UserChangedText(); - -protected: - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - virtual void DrawSelf(); -}; - diff --git a/mozilla/cmd/macfe/central/mimages.cp b/mozilla/cmd/macfe/central/mimages.cp deleted file mode 100644 index 15470a1bc48..00000000000 --- a/mozilla/cmd/macfe/central/mimages.cp +++ /dev/null @@ -1,2262 +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. - */ - -#define JMC_INIT_IMGCB_ID - - // Netscape -// #include "mdmacmem.h" -#include "client.h" -#include "xp_mcom.h" -#include "merrors.h" -#include "xpassert.h" -#include "mimages.h" -#include "miconutils.h" -#include "il_util.h" -#include "il_icons.h" -#include "CBrowserContext.h" -#include "CBrowserWindow.h" // for CBrowserWindow::ClipOutPopdown() -#include "CIconContext.h" -#include "CHTMLView.h" -#include "RandomFrontEndCrap.h" -#include -#include "UTextBox.h" -#include "uerrmgr.h" -#include "resgui.h" -#include "CIconCache.h" -#include "MacMemAllocator.h" -#include "xlate.h" - -#ifdef PROFILE -#pragma profile on -#endif - - -#define TRACK_IMAGE_CACHE_SIZE 0 - -#pragma mark --- TYPES --- - -/* - * We store color spaces for the following bit depths: - * 1, 2, 4, 8, 2gray, 4gray, 8gray, 16, 32. - * Grayscale spaces are lower than colour spaces so that we can do a numerical compare - * on indices. - */ - -enum ColorSpaceIndex { - kFirstColorSpace = 0, - kOneBit = 0, - kEightBitGray, - kEightBitColor, - kSixteenBit, - kThirtytwoBit, - kNumColorSpaces -}; - -enum DefaultColors { - kDefaultBGColorRed = 192, - kDefaultBGColorGreen = 192, - kDefaultBGColorBlue = 192 -}; - - -typedef struct PictureGWorldState { - GWorldPtr gworld; - RGBColor transparentColor; - Int32 transparentIndex; - CTabHandle ctab; - Int32 imageHeight; - Int32 bandHeight; - NS_PixMap * image; - NS_PixMap * mask; -} PictureGWorldState; - -/* BRAIN DAMAGE: This scary thing came from the old code */ -#define IL_ICON_OFFSET 300 - -/* - * Internal function prototypes - */ - -static OSErr AllocatePixMap ( IL_Pixmap * il_pixmap, jint width, jint height, - NS_PixMap * fe_pixmap, CTabHandle ctab ); - -static ColorSpaceIndex GetNextBestColorSpaceIndex ( ColorSpaceIndex index ); -static ColorSpaceIndex ConvertColorSpaceToIndex ( IL_ColorSpace * color_space ); -static ColorSpaceIndex ConvertDepthToColorSpaceIndex ( Int32 depth, Boolean grayScale ); -static IL_ColorSpace * GetColorSpace ( MWContext * context, ColorSpaceIndex space_index, CTabHandle * color_table ); -static CTabHandle ConvertColorSpaceToColorTable ( IL_ColorSpace * color_space ); -static void SetColorSpaceTransparentColor ( IL_ColorSpace * color_space, Uint8 red, Uint8 green, Uint8 blue ); - -static OSErr CreatePictureGWorld ( IL_Pixmap * image, IL_Pixmap * mask, PictureGWorldState * state ); -static void TeardownPictureGWorld ( PictureGWorldState * state ); -static void CopyPicture ( PictureGWorldState * state ); -static void CreateUniqueTransparentColor ( IL_Pixmap * image, PictureGWorldState * state ); -static Boolean FindColorInCTable ( CTabHandle ctab, Uint32 skipIndex, RGBColor * rgb ); - -static void LockPixmapBuffer ( IL_Pixmap * pixmap ); -static void UnlockPixmapBuffer ( IL_Pixmap * pixmap ); - -static CIconHandle GetIconHandle ( jint iconID ); -static IL_GroupContext * CreateImageGroupContext ( MWContext * context ); - - -/* - * Globals - */ - -IL_ColorSpace * gColorSpaces[ kNumColorSpaces ] = { NULL, NULL, NULL, NULL, NULL }; -CTabHandle gColorTables[ kNumColorSpaces ] = { NULL, NULL, NULL, NULL, NULL }; -CTabHandle gOneBitTable = NULL; - -#if TRACK_IMAGE_CACHE_SIZE -static Uint32 gCacheSize = 0; -static Uint32 gMaxCacheSize = 0; -#endif - -#pragma mark --- IMAGE LIB CALLBACKS --- - -/* - * Callback procs for the ImageLib - */ - -JMC_PUBLIC_API(void*) -_IMGCB_getBackwardCompatibleInterface(struct IMGCB* /*self*/, const JMCInterfaceID* /*iid*/, - JMCException* */*exception*/) -{ - return NULL; -} - -JMC_PUBLIC_API(void) -_IMGCB_init(struct IMGCB* /*self*/, JMCException* */*exception*/) -{ - -} - -JMC_PUBLIC_API(void) -_IMGCB_NewPixmap(struct IMGCB* /*self*/, jint /*op*/, void* a, jint width, jint height, IL_Pixmap* pixmap, - IL_Pixmap* mask) -{ - MWContext * context = (MWContext *) a; - NS_PixMap * fe_pixmap; - NS_PixMap * fe_mask; - OSErr err; - ColorSpaceIndex space_index; - ColorSpaceIndex image_index; - CTabHandle ctab; - IL_ColorSpace * color_space; - FreeMemoryStats freeMemory; - Uint32 freeTempMemory; - - XP_ASSERT(pixmap != NULL); - - ctab = NULL; - - /* BRAIN DAMAGE - for now let the image lib do any scaling */ - pixmap->header.width = width; - pixmap->header.height = height; - - fe_pixmap = XP_NEW(NS_PixMap); - XP_ASSERT(fe_pixmap != NULL); - if ( fe_pixmap != NULL ) - { - fe_pixmap->lock_count = 0; - fe_pixmap->image_buffer = 0L; - fe_pixmap->buffer_handle = 0L; - fe_pixmap->tiled = false; - - color_space = pixmap->header.color_space; - - /* - * if this pixmap's color space is of lower resolution than our current - * screen depth, then use the images, otherwise use the screen depth. - */ - - space_index = ConvertDepthToColorSpaceIndex( 0, false ); - - if ( color_space != NULL ) - { - image_index = ConvertColorSpaceToIndex ( color_space ); - - if ( image_index < space_index ) - { - /* - * This image appears to be at a lower colour depth, but it may have a - * unique color table, so we may want to allocate it at a deeper depth. - * So, if we're getting short on memory, decrease the depth, otherwise - * use the default depth. - * - * We don't really base this on the size of the image as we ideally want to - * start decreasing the size of images, before we run out of memory (which - * other parts of the browser may not handle as well). - */ - memtotal ( 1024, &freeMemory ); - freeTempMemory = TempFreeMem(); - - if (( freeMemory.totalFreeBytes < 0x10000 ) || ( freeTempMemory < 0x40000 )) - { - space_index = image_index; - } - } - - /* we don't want this color space anymore */ - IL_ReleaseColorSpace ( color_space ); - pixmap->header.color_space = NULL; - color_space = NULL; - } - - /* - * Try to allocate the pixmap at the ideal colour depth. If we can't, then keep - * downgrading the colour resolution until we can. - */ - do - { - color_space = GetColorSpace ( context, space_index, &ctab ); - - if ( color_space != NULL && ctab != NULL ) - { - pixmap->header.color_space = color_space; - err = AllocatePixMap ( pixmap, width, height, fe_pixmap, ctab ); - if ( err == noErr ) - { - break; - } - } - - space_index = GetNextBestColorSpaceIndex ( space_index ); - } - while ( space_index < kNumColorSpaces ); - - if ( err == noErr ) - { - /* add a ref to this color space */ - IL_AddRefToColorSpace ( color_space ); - XP_ASSERT(pixmap->header.color_space != NULL); - } - else - { - pixmap->header.color_space = NULL; - XP_DELETE(fe_pixmap); - fe_pixmap = NULL; - } - } - - pixmap->client_data = fe_pixmap; - - if ( mask != NULL ) - { - /* BRAIN DAMAGE - for now let the image lib do any scaling */ - mask->header.width = width; - mask->header.height = height; - - fe_mask = XP_NEW(NS_PixMap); - XP_ASSERT(fe_mask != NULL); - if ( fe_mask != NULL ) - { - fe_mask->lock_count = 0; - fe_mask->image_buffer = NULL; - fe_mask->buffer_handle = NULL; - fe_mask->tiled = false; - - err = AllocatePixMap ( mask, width, height, fe_mask, gOneBitTable ); - if ( err == noErr ) - { - mask->client_data = fe_mask; - } - else - { - XP_DELETE(fe_mask); - } - } - } - - /* - * If the image has a transparent color, make sure to update it from the current context - */ - if ( pixmap->header.transparent_pixel != NULL ) - { - *pixmap->header.transparent_pixel = *context->transparent_pixel; - } - - XP_ASSERT(pixmap->header.color_space->pixmap_depth != 0 ); -} - -JMC_PUBLIC_API(void) -_IMGCB_UpdatePixmap(struct IMGCB* /*self*/, jint /*op*/, void* /*a*/, IL_Pixmap* /*pixmap*/, jint /*x_offset*/, - jint /*y_offset*/, jint /*width*/, jint /*height*/) -{ -} - -JMC_PUBLIC_API(void) -_IMGCB_ControlPixmapBits(struct IMGCB* /*self*/, jint /*op*/, void* a, IL_Pixmap* pixmap, IL_PixmapControl message) -{ - MWContext * context = (MWContext *) a; - NS_PixMap * fe_pixmap = NULL; - - XP_ASSERT(pixmap != NULL); - - fe_pixmap = (NS_PixMap *) pixmap->client_data; - XP_ASSERT(fe_pixmap != NULL); - - if ( fe_pixmap != NULL ) - { - switch ( message ) - { - case IL_LOCK_BITS: - LockPixmapBuffer ( pixmap ); - break; - - case IL_UNLOCK_BITS: - UnlockPixmapBuffer ( pixmap ); - break; - - case IL_RELEASE_BITS: - // the image is totally done loading, so tell the cache that the context associated - // with this image will go away and we know we can just give out the bits to anyone - // that asks in the future. - if ( context->type == MWContextIcon ) - gImageCache().ContextFinished ( context ); - break; - } - } -} - -JMC_PUBLIC_API(void) -_IMGCB_DestroyPixmap(struct IMGCB* /*self*/, jint /*op*/, void* a, IL_Pixmap* pixmap) -{ - MWContext * context = (MWContext *) a; - NS_PixMap * fe_pixmap = NULL; - - XP_ASSERT(pixmap != NULL); - fe_pixmap = (NS_PixMap *) pixmap->client_data; - - if ( fe_pixmap != NULL ) - { -#if TRACK_IMAGE_CACHE_SIZE - gCacheSize -= pixmap->header.widthBytes * pixmap->header.height; -#endif - DestroyFEPixmap ( fe_pixmap ); - } -} - - -// -// _IMGCB_DisplayPixmap -// -// Called from imagelib when the image is ready to draw any portion (one frame of an animation, parital -// progressive decoding, etc). Also called from the compositor to re-blit an already loaded image when -// scrolling or refreshing the view. -// -// We hook into this as well for drawing gifs/jpegs in the FE for icons because when we get this -// call, we know that the image has been loaded and is ready to display. -// -JMC_PUBLIC_API(void) -_IMGCB_DisplayPixmap(struct IMGCB* /*self*/, jint /*op*/, void* inContext, IL_Pixmap* image, IL_Pixmap* mask, - jint x, jint y, jint x_offset, jint y_offset, jint width, jint height, jint req_w, - jint req_h) -{ - MWContext * context = static_cast(inContext); - NS_PixMap * fe_pixmap; - NS_PixMap * fe_mask; - SPoint32 topLeftImage; - StColorState saveColorState; - Point topLeft; - int32 x_origin; - int32 y_origin; - Boolean canCopyMask; - OSErr err; - DrawingState state; - - // This routine was written assuming that we are drawing into a CHTMLView (why else would you be - // drawing gifs?) However, we also want to hook in here so we know when images we want to draw in the - // chrome have loaded and are ready to display. If the context type is right (an image context), - // let it handle the work and return. - if ( context->type == MWContextIcon ) { - CIconContext* iconContext = dynamic_cast(ExtractNSContext(context)); - if ( iconContext ) - iconContext->DrawImage(image, mask); - return; - } - - // - // We're not given an image context so we draw like normal into an HTML view. - // - CHTMLView* theHTMLView = ExtractHyperView(context); - if ( image != NULL && theHTMLView && theHTMLView->FocusDraw()) - { - StColorPenState::Normalize(); - - theHTMLView->GetLayerOrigin ( &x_origin, &y_origin ); - - /* - * Can we use copymask for transparency? QuickDraw can't save Masks to Pictures nor - * can we print them. - */ - canCopyMask = ( context->type != MWContextPrint ) && ( qd.thePort->picSave == NULL ); - - fe_pixmap = (NS_PixMap *) image->client_data; - fe_mask = mask != NULL ? (NS_PixMap *) mask->client_data : NULL; - - if ( fe_pixmap != NULL ) - { - // pinkerton - // we need a way to prevent images in the HTML area from drawing over the - // popdown treeView if it is visible. Clip it out. - StClipRgnState savedClip; - CBrowserWindow::ClipOutPopdown(theHTMLView); - - topLeftImage.h = x + x_offset + x_origin; - topLeftImage.v = y + y_offset + y_origin; - - theHTMLView->ImageToLocalPoint( topLeftImage, topLeft ); - - err = PreparePixmapForDrawing ( image, mask, canCopyMask, &state ); - if ( err == noErr ) - { - if ( fe_pixmap->tiled != false ) - { - DrawTiledImage ( &state, topLeft, x_offset, y_offset, width, height ); - } - else - { - DrawScaledImage ( &state, topLeft, x_offset, y_offset, width, height ); - } - - DoneDrawingPixmap ( image, mask, &state ); - } - } - } -} - -JMC_PUBLIC_API(void) -_IMGCB_DisplayIcon(struct IMGCB* /*self*/, jint /*op*/, void* a, jint x, jint y, jint icon_number) -{ - MWContext * context = (MWContext *) a; - Rect icon_dest; - CIconHandle ic; - PixMap * pixmap; - int32 x_origin; - int32 y_origin; - SPoint32 topLeftImage; - Point topLeft; - - CHTMLView* theHTMLView = ExtractHyperView(context); - if (theHTMLView == NULL) - return; - - ic = GetIconHandle ( icon_number ); - if ( ic != NULL ) - { - pixmap = &(*ic)->iconPMap; - - // Convert from layer-relative coordinates to local coordinates - theHTMLView->GetLayerOrigin ( &x_origin, &y_origin ); - topLeftImage.h = x + x_origin; - topLeftImage.v = y + y_origin; - theHTMLView->ImageToLocalPoint( topLeftImage, topLeft ); - - icon_dest.left = topLeft.h; - icon_dest.top = topLeft.v; - icon_dest.right = icon_dest.left + ( pixmap->bounds.right - pixmap->bounds.left ); - icon_dest.bottom = icon_dest.top + ( pixmap->bounds.bottom - pixmap->bounds.top ); - - ::PlotCIconHandle( &icon_dest, atAbsoluteCenter, ttNone, ic ); - CIconList::ReturnIcon ( ic ); - } -} - -JMC_PUBLIC_API(void) -_IMGCB_GetIconDimensions(struct IMGCB* /*self*/, jint /*op*/, void* a, int* width, int* height, jint icon_number) -{ - MWContext * context = (MWContext *) a; - CIconHandle ic; - PixMap * pixmap; - - ic = GetIconHandle ( icon_number ); - if ( ic == NULL ) - { - *width = 16; - *height = 16; - } - else - { - pixmap = &(*ic)->iconPMap; - *width = pixmap->bounds.right - pixmap->bounds.left; - *height = pixmap->bounds.bottom - pixmap->bounds.top; - - CIconList::ReturnIcon ( ic ); - } -} - -#pragma mark --- PUBLIC FUNCTIONS --- - -EClickKind FindImagePart ( - MWContext * context, - LO_ImageStruct * image, - SPoint32 * where, - cstring * url, - cstring * target, - LO_AnchorData * & anchor ) -{ - SPoint32 local_point; - EClickKind click; - int iconWidth; - int iconHeight; - - click = eNone; - - /* - * Convert the document coordinate to an image local coordinate - */ - local_point.h = where->h - ( image->x + image->x_offset + image->border_width ); - local_point.v = where->v - ( image->y + image->y_offset + image->border_width ); - - if (image->anchor_href) - { - PA_LOCK(*url, char*, (char*)image->anchor_href->anchor); - PA_UNLOCK(loImage->anchor_href->anchor ); - PA_LOCK(*target, char*, (char*)image->anchor_href->target); - PA_UNLOCK(loImage->anchor_href->target ); - } - - if ( image->image_attr->attrmask & LO_ATTR_ISFORM ) - { - char s[100]; - - // ¥ form image - click = eImageForm; - char * printString = GetCString(IMAGE_SUBMIT_FORM); - sprintf (s, (char*)printString, local_point.h, local_point.v); // "Submit form:%d,%d" - *url = s; - } - else if ( image->image_attr->usemap_name != NULL ) - { - // ¥ client-side image maps - anchor = LO_MapXYToAreaAnchor( context, image, local_point.h, local_point.v ); - if ( anchor ) - { - PA_LOCK( *url, char*, (char*)anchor->anchor ); - PA_UNLOCK( anchor->anchor ); - PA_LOCK( *target, char*, (char*)anchor->target ); - PA_UNLOCK( anchor->target ); - click = eImageAnchor; - } - else - click = eNone; - } - else if ( (image->image_attr->attrmask & LO_ATTR_ISMAP) && image->anchor_href ) - { - // ¥ÊISMAP - click = eImageIsmap; - char s[50]; - url->truncAt( '?' ); - url->truncAt( '#' ); - sprintf( s, "?%d,%d", local_point.h, local_point.v ); - *url += s; - } - else if ( IsImageComplete ( image ) == FALSE ) - { - // Did we click in an icon or an alt text? - // BRAIN DAMAGE -#ifdef OLD_IMAGE_LIB - // ¥ delayed image - if (((IconProxy*)imageProxy)->ClickInIcon(mImageWhere.h, mImageWhere.v)) - theKind = eImageIcon; - else if ( ((IconProxy*)imageProxy)->ClickInAltText(mImageWhere.h, mImageWhere.v) && loImage->anchor_href) - theKind = eImageAltText; - else - theKind = eNone; - -#endif - /* is the image an icon? */ - if ( image->is_icon ) - { - IL_GetIconDimensions ( context->img_cx, image->icon_number, &iconWidth, &iconHeight ); - - /* - * If the image has no anchor or the click is inside the icon, mark the click as being - * the icon - */ - if ( ( ( local_point.h < iconWidth ) && ( local_point.v < iconHeight ) ) - || ( image->anchor_href == NULL ) ) - { - click = eImageIcon; - } - else - { - click = eImageAltText; - } - } - } - else - { - // ¥ plain image with an anchor - if ( image->anchor_href ) - { - click = eImageAnchor; - } - } - - return click; -} - -BOOL IsImageComplete ( - LO_ImageStruct * image ) -{ - return ((image->image_status == IL_IMAGE_COMPLETE) || - (image->image_status == IL_FRAME_COMPLETE)); -} - -// a hack to get the URL of the image -// if the image is using that reconnect hack, we get the URL of the document -// instead of the URL of the image -cstring GetURLFromImageElement( - CBrowserContext * inOwningContext, - LO_ImageStruct * inElement) -{ - cstring retString; - cstring urlString = (char*)inElement->image_url; - - // ¥Êhandle anything starting with "internal-" - if (IsInternalTypeLink(urlString)) - { - // ¥ handle special mail & news reconnects for internal decoded images - // that start "internal-external-reconnect:" followed by the original - // URL - if (IsMailNewsReconnect(urlString)) - retString = &urlString[XP_STRLEN(reconnectHack) + 1]; - // ¥ handle "internal-external-reconnect" case when we don't have an - // associated anchor_href - else if (!inElement->anchor_href && IsInternalImage(urlString)) - { - retString = inOwningContext->GetCurrentURL(); - } - else - // ¥ jwz's hack upon a hack! - // That is, if there is both an image and an anchor, and the address of - // the image is internal-external-reconnect, use the anchor for the image, - // and pretend there was no anchor. - - // A side effect of the way I did this is that internal-external-reconnect - // images which have HREF (mail and news articles) are clickable links to - // themselves; we could special case this, but it doesn't hurt anything, - // and could even be mistaken for intentional, so who cares ( JWZ wrote - // that origially and I don't think it applies to the actual logic here - tgm ). - { - retString = (char*)inElement->anchor_href->anchor; - } - } - else - retString = urlString; - - return retString; -} - -PicHandle ConvertImageElementToPICT( - LO_ImageStruct * inElement) -{ - PicHandle pic; - OpenCPicParams picParams; - IL_Pixmap * image; - IL_Pixmap * mask; - DrawingState state; - OSErr err; - NS_PixMap * fe_pixmap; - Rect dstRect; - PictureGWorldState picState; - GrafPtr oldPort; - CGrafPort cport; - - err = noErr; - - /* - * We render into our own port so that we don't need to play with other origin/port setting - * fun - */ - GetPort ( &oldPort ); - OpenCPort ( &cport ); - - if ( QDError() != noErr ) - return NULL; - - SetPort ( (GrafPtr) &cport ); - - SetRect ( &picParams.srcRect, 0, 0, inElement->width, inElement->height ); - picParams.hRes = 72L << 16; - picParams.vRes = 72L << 16; - picParams.version = 0; - picParams.reserved1 = 0; - picParams.reserved2 = 0; - - image = IL_GetImagePixmap ( inElement->image_req ); - mask = IL_GetMaskPixmap ( inElement->image_req ); - - if ( image == NULL ) - { - return NULL; - } - - pic = OpenCPicture ( &picParams ); - if ( pic != NULL ) - { - /* if we have no mask, then we're just dandy */ - if ( mask == NULL ) - { - err = PreparePixmapForDrawing ( image, mask, false, &state ); - if ( err == noErr ) - { - fe_pixmap = state.pixmap; - SetRect ( &dstRect, 0, 0, inElement->width, inElement->height ); - - CopyBits ( (BitMap *) &fe_pixmap->pixmap, &qd.thePort->portBits, - &fe_pixmap->pixmap.bounds, &dstRect, srcCopy, NULL ); - - DoneDrawingPixmap ( image, mask, &state ); - } - } - else - { - /* - * We have transparency, so we suck. What we basically do is allocate an offscreen, - * render a unique color into the background, copymask the image over it and then - * copy that image into a picture. - * - * This particularly sucks for grayscale images as we need to make sure that our - * transparent color is unique. - * - * Thus, for indexed images, we create a color table that contains our reserved - * entry as a reserved index. We then CopyBits the original image onto it. Then, - * we set our reserved entry to a magic value and do a final CopyBits with transparent - * mode into the picture. - */ - - err = CreatePictureGWorld ( image, mask, &picState ); - if ( err == noErr ) - { - LockPixmapBuffer ( image ); - LockPixmapBuffer ( mask ); - - CopyPicture ( &picState ); - - UnlockPixmapBuffer ( image ); - UnlockPixmapBuffer ( mask ); - - TeardownPictureGWorld ( &picState ); - } - } - - ClosePicture(); - } - - SetPort ( oldPort ); - CloseCPort ( &cport ); - - /* - * If we got an error, don't return a bad picture - */ - if ( err != noErr ) - { - KillPicture ( pic ); - pic = NULL; - } - - return pic; -} - -void CreateImageContext ( - MWContext * context ) -{ - IL_DisplayData data; - ColorSpaceIndex space_index; - - /* - * Create a new image context. - */ - context->img_cx = CreateImageGroupContext ( context ); - Assert_(context->img_cx != NULL); - - if ( context->img_cx != NULL ) - { - /* - * Set the context's color space to be our best one - */ - space_index = ConvertDepthToColorSpaceIndex( 0, false ); - context->color_space = GetColorSpace ( context, space_index, NULL ); - PR_ASSERT(context->color_space != NULL); - - if ( context->type == MWContextPrint ) - { - data.display_type = IL_Printer; - } - else - { - data.display_type = IL_Console; - } - - data.color_space = context->color_space; - data.progressive_display = CPrefs::GetBoolean(CPrefs::DisplayWhileLoading) ? - PR_TRUE : PR_FALSE; - data.dither_mode = IL_Auto; - - IL_SetDisplayMode ( context->img_cx, - IL_PROGRESSIVE_DISPLAY | IL_DITHER_MODE | IL_COLOR_SPACE | IL_DISPLAY_TYPE, &data ); - } - - /* - * Get a standard one bit table for masks - */ - if ( gOneBitTable == NULL ) - { - gOneBitTable = GetCTable ( 1 ); - } - - /* - * Set the default background color - */ - SetImageContextBackgroundColor ( context, kDefaultBGColorRed, kDefaultBGColorGreen, kDefaultBGColorBlue ); -} - -void DestroyImageContext ( - MWContext * context ) -{ - if ( context->color_space != NULL ) - { - context->color_space = NULL; - } - - if ( context->img_cx != NULL ) - { - IL_DestroyGroupContext ( context->img_cx ); - context->img_cx = NULL; - } -} - -void SetImageContextBackgroundColor ( - MWContext * context, - Uint8 red, - Uint8 green, - Uint8 blue) -{ - IL_ColorSpace * color_space; - IL_IRGB * trans_pixel; - Uint8 count; - - color_space = context->color_space; - trans_pixel = context->transparent_pixel; - - if ( trans_pixel == NULL ) - { - trans_pixel = context->transparent_pixel = XP_NEW_ZAP(IL_IRGB); - if ( trans_pixel == NULL ) - return; - } - - /* Set the color of the transparent pixel. */ - trans_pixel->red = red; - trans_pixel->green = green; - trans_pixel->blue = blue; - if ( color_space->type == NI_PseudoColor ) - { - trans_pixel->index = color_space->cmap.num_colors - 1; - } - - /* - * For PseudoColor color spaces, we must also update our color map with this - * new color. Our transparent/background color is always at the end of the color map. - */ - XP_ASSERT(color_space); - SetColorSpaceTransparentColor ( color_space, red, green, blue ); - - /* - * Now set the transparent color for any other cached spaces - */ - for ( count = 0; count < kNumColorSpaces; ++count ) - { - if ( gColorSpaces[ count ] != NULL ) - { - SetColorSpaceTransparentColor ( gColorSpaces[ count ], red, green, blue ); - } - } -} - -GDHandle GetDeepestDevice ( - void ) -{ - GDHandle deepest = GetMainDevice(); - short depth = GetDepth (deepest); - - for (GDHandle current = GetDeviceList(); current; current = GetNextDevice (current)) { - if (UDrawingUtils::IsActiveScreenDevice (current)) { - short curDepth = GetDepth (current); - if (depth < curDepth) { - depth = curDepth; - deepest = current; - } - } - } - - return deepest; -} - -Boolean VerifyDisplayContextColorSpace ( - MWContext * context ) -{ - ColorSpaceIndex screen_index; - ColorSpaceIndex current_index; - IL_ColorSpace * color_space; - IL_DisplayData data; - Boolean mustReload; - uint32 cacheSize; - - mustReload = false; - - /* - * Make sure that the current display color space matches the context's color space - */ - screen_index = ConvertDepthToColorSpaceIndex ( 0, false ); - current_index = ConvertColorSpaceToIndex ( context->color_space ); - if ( screen_index != current_index ) - { - /* the color space of the screen has changed, update our display context */ - color_space = GetColorSpace ( context, screen_index, NULL ); - if ( color_space != NULL ) - { - context->color_space = color_space; - - data.color_space = color_space; - IL_SetDisplayMode ( context->img_cx, IL_COLOR_SPACE, &data ); - - SetColorSpaceTransparentColor ( color_space, context->transparent_pixel->red, - context->transparent_pixel->green, context->transparent_pixel->blue ); - - /* if this new space is deeper than the old, we should reload */ - mustReload = screen_index > current_index; - - /* and if we do need to reload, we should flush the image cache as well */ - /* it's up to our caller to decide if they want to reload the current page */ - if ( mustReload ) - { - /* the only way to do this is to set the cache to 0 size and then restore it */ - cacheSize = IL_GetCacheSize(); - IL_SetCacheSize ( 0 ); - IL_SetCacheSize ( cacheSize ); - } - } - } - - return mustReload; -} - - -void DrawScaledImage ( DrawingState * state, Point topLeft, jint x_offset, - jint y_offset, jint width, jint height ) -{ - Rect srcRect; - Rect * maskRectPtr; - Rect dstRect; - PixMap * maskPtr; - NS_PixMap * fe_pixmap; - NS_PixMap * fe_mask; - - fe_pixmap = state->pixmap; - fe_mask = state->mask; - - if ( fe_mask != NULL ) - { - maskPtr = &fe_mask->pixmap; - maskRectPtr = &maskPtr->bounds; - } - else - { - maskPtr = NULL; - maskRectPtr = NULL; - } - - srcRect.left = x_offset; - srcRect.top = y_offset; - srcRect.right = x_offset + width; - srcRect.bottom = y_offset + height; - - /* - * Clip src Rect to the image. - */ - if ( fe_pixmap->pixmap.bounds.right < srcRect.right ) - { - srcRect.right = fe_pixmap->pixmap.bounds.right; - } - if ( fe_pixmap->pixmap.bounds.bottom < srcRect.bottom ) - { - srcRect.bottom = fe_pixmap->pixmap.bounds.bottom; - } - - SetRect ( &dstRect, topLeft.h, topLeft.v, topLeft.h + width, topLeft.v + height ); - - if ( maskPtr == NULL ) - { - CopyBits ( (BitMap *) &fe_pixmap->pixmap, &qd.thePort->portBits, &srcRect, - &dstRect, state->copyMode, NULL ); - } - else - { - CopyMask ( (BitMap *) &fe_pixmap->pixmap, (BitMap *) maskPtr, &qd.thePort->portBits, - &srcRect, maskRectPtr, &dstRect ); - } -} - -void DrawTiledImage ( DrawingState * state, Point topLeft, jint x_offset, - jint y_offset, jint width, jint height ) -{ - - Rect srcRect; - Rect * maskRectPtr; - Rect dstRect; - PixMap * maskPtr; - int32 right_clip; - int32 bottom_clip; - int32 left; - int32 top; - int32 img_width; - int32 img_height; - int32 tile_width; - int32 tile_height; - int32 src_x_offset; - int32 src_y_offset; - NS_PixMap * fe_pixmap; - NS_PixMap * fe_mask; - - fe_pixmap = state->pixmap; - fe_mask = state->mask; - - if ( fe_mask != NULL ) - { - maskPtr = &fe_mask->pixmap; - maskRectPtr = &srcRect; - } - else - { - maskPtr = NULL; - maskRectPtr = NULL; - } - - img_width = fe_pixmap->pixmap.bounds.right - fe_pixmap->pixmap.bounds.left; - img_height = fe_pixmap->pixmap.bounds.bottom - fe_pixmap->pixmap.bounds.top; - - right_clip = topLeft.h + width; - bottom_clip = topLeft.v + height; - - /* the first row may be shorter */ - tile_height = img_height - ( y_offset % img_height ); - - /* - * Walk through all the tiles in dst space - */ - - top = topLeft.v; - src_y_offset = y_offset % img_height; - - while ( top < bottom_clip ) - { - left = topLeft.h; - tile_width = img_width - ( x_offset % img_width ); - src_x_offset = x_offset % img_width; - - while ( left < right_clip ) - { - dstRect.left = left; - dstRect.top = top; - dstRect.right = left + tile_width; - dstRect.bottom = top + tile_height; - - srcRect.left = src_x_offset; - srcRect.top = src_y_offset; - srcRect.right = src_x_offset + tile_width; - srcRect.bottom = src_y_offset + tile_height; - - if ( maskPtr == NULL ) - { - CopyBits ( (BitMap *) &fe_pixmap->pixmap, &qd.thePort->portBits, &srcRect, - &dstRect, state->copyMode, NULL ); - } - else - { - CopyMask ( (BitMap *) &fe_pixmap->pixmap, (BitMap *) maskPtr, &qd.thePort->portBits, - &srcRect, maskRectPtr, &dstRect ); - } - - /* - * Bump to the next column and be sure to clip if it's the last one - */ - left += tile_width; - tile_width = img_width; - if ( left + tile_width > right_clip ) - { - tile_width = right_clip - left; - } - src_x_offset = 0; - } - - /* - * Bump to the next row and be sure to clip if it's the last one - */ - top += tile_height; - tile_height = img_height; - if ( top + tile_height > bottom_clip ) - { - tile_height = bottom_clip - top; - } - src_y_offset = 0; - } -} - -OSErr PreparePixmapForDrawing ( IL_Pixmap * image, IL_Pixmap * mask, Boolean canCopyMask, - DrawingState * state ) -{ - RGBColor rgb; - long index; - NI_IRGB * transparent_pixel; - IL_ColorSpace * color_space; - CTabHandle ctab; - - state->copyMode = srcCopy; - state->pixmap = (NS_PixMap *) image->client_data; - state->mask = NULL; - - if ( state->pixmap == NULL ) - { - return -1; - } - - color_space = image->header.color_space; - XP_ASSERT(color_space); - - if ( mask != NULL ) - { - state->mask = (NS_PixMap *) mask->client_data; - } - - /* - * If we can't copymask and we have a transparent colour, then we need to use QuickDraw's - * transparent mode and set the OpColor - */ - transparent_pixel = image->header.transparent_pixel; - - if ( transparent_pixel != NULL ) - { - /* Extract the transparent color for this pixmap */ - rgb.red = (uint16) transparent_pixel->red | ( (uint16) transparent_pixel->red << 8 ); - rgb.green = (uint16) transparent_pixel->green | ( (uint16) transparent_pixel->green << 8 ); - rgb.blue = (uint16) transparent_pixel->blue | ( (uint16) transparent_pixel->blue << 8 ); - - /* if we have an indexed color space, then update the bg color. Grayscale color */ - /* spaces assume the color's been mapped to the closest default gray */ - if (color_space->type == NI_PseudoColor) - { - index = color_space->cmap.num_colors - 1; - - ctab = state->pixmap->pixmap.pmTable; - (*ctab)->ctTable[ index ].rgb = rgb; - } - - /* - * now, if we have a mask, but we can't copymask, then set our transfer mode - * to be transparent. We may have problems if the background color matches a - * color in the image, but that's life for now... - */ - if ( mask != NULL && !canCopyMask ) - { - /* don't use the mask anymore */ - state->mask = NULL; - - state->copyMode = transparent; - RGBBackColor ( &rgb ); - } - } - - LockPixmapBuffer ( image ); - if ( state->mask != NULL ) - { - LockPixmapBuffer ( mask ); - } - - return noErr; -} - -void DoneDrawingPixmap ( IL_Pixmap * image, IL_Pixmap * mask, DrawingState * state ) -{ - UnlockPixmapBuffer ( image ); - if ( state->mask != NULL ) - { - UnlockPixmapBuffer ( mask ); - } -} - - -/* - * LockFEPixmapBuffer - * - * Locks the FE bits of the image - */ -void LockFEPixmapBuffer ( NS_PixMap* fe_pixmap ) -{ - if ( fe_pixmap != NULL ) - { - if ( fe_pixmap->lock_count == 0 ) - { - if ( fe_pixmap->buffer_handle != NULL ) - { - HLock ( fe_pixmap->buffer_handle ); - fe_pixmap->pixmap.baseAddr = *fe_pixmap->buffer_handle; - } - else - { - fe_pixmap->pixmap.baseAddr = (char *) fe_pixmap->image_buffer; - } - - } - - fe_pixmap->lock_count++; - } -} - - -/* - * UnlockFEPixmapBuffer - * - * Unlocks the FE bits of the image - */ -void UnlockFEPixmapBuffer ( NS_PixMap* fe_pixmap ) -{ - if ( fe_pixmap != NULL ) - { - if ( --fe_pixmap->lock_count == 0 ) - { - if ( fe_pixmap->buffer_handle != NULL ) - { - HUnlock ( fe_pixmap->buffer_handle ); - } - - fe_pixmap->pixmap.baseAddr = (Ptr) 0xFF5E0001; - } - } -} - - -/* - * DestroyFEPixmap - * - * Tear down the NS_PixMap - */ -void DestroyFEPixmap ( NS_PixMap* fe_pixmap ) -{ - if ( !fe_pixmap ) - return; - - if ( fe_pixmap->buffer_handle != NULL ) - DisposeHandle ( fe_pixmap->buffer_handle ); - if ( fe_pixmap->image_buffer != NULL ) - free ( fe_pixmap->image_buffer ); - XP_DELETE ( fe_pixmap ); -} - - -#pragma mark --- PRIVATE FUNCTIONS --- - - -/* - * Private Utilities - */ - -static IL_GroupContext * CreateImageGroupContext ( MWContext * context ) -{ - IL_GroupContext * img_cx; - IMGCB * img_cb; - JMCException * exc; - - exc = NULL; - - img_cb = IMGCBFactory_Create( &exc ); - if (exc) - { - /* XXXM12N Should really return exception */ - JMC_DELETE_EXCEPTION( &exc ); - return 0L; - } - - /* - * Create an Image Group Context. IL_NewGroupContext augments the - * reference count for the JMC callback interface. The opaque - * argument to IL_NewGroupContext is the Front End's display - * context, which will be passed back to all the Image Library's - * FE callbacks. - */ - img_cx = IL_NewGroupContext( (void*) context, (IMGCBIF *)img_cb); - - return img_cx; -} - -static OSErr AllocatePixMap ( IL_Pixmap * il_pixmap, jint width, jint height, - NS_PixMap * fe_pixmap, CTabHandle ctab ) -{ - UInt32 rowbytes; - Uint32 pixmap_depth; - OSErr err; - IL_ColorSpace * color_space; - PixMap * pixmap; - Uint32 buffer_size; - - err = noErr; - pixmap = &fe_pixmap->pixmap; - - /* - * Sanity checks - */ - if ( il_pixmap == NULL || fe_pixmap == NULL || ctab == NULL ) - { - return -1; - } - - /* - * Are we tiling this image? - */ - if ( il_pixmap->header.width == width && il_pixmap->header.height == height ) - { - /* yup */ - fe_pixmap->tiled = true; - } - else - { - /* nope, so use the dimensions of the src image as CopyBits can scale */ - fe_pixmap->tiled = false; - width = il_pixmap->header.width; - height = il_pixmap->header.height; - } - - /* - * Allocate the actual mac pixmap buffer - */ - - color_space = il_pixmap->header.color_space; - pixmap_depth = color_space->pixmap_depth; - - pixmap->bounds.top = 0; - pixmap->bounds.left = 0; - pixmap->bounds.right = width; - pixmap->bounds.bottom = height; - pixmap->pmVersion = 0; - pixmap->packType = 0; - pixmap->packSize = 0; - pixmap->hRes = 72L << 16; - pixmap->vRes = 72L << 16; - pixmap->pixelSize = pixmap_depth; - pixmap->planeBytes = 0; - pixmap->pmReserved = 0; - - if ( pixmap_depth <= 8 ) - { - /* set our pixel type to indexed */ - pixmap->pixelType = 0; - pixmap->cmpCount = 1; - pixmap->cmpSize = pixmap_depth; - } - else - { - /* set our pixel type to direct color. we need to be sure to do this */ - /* to prevent nasty crashes when saving to pictures/printing */ - pixmap->pixelType = 0x10; - pixmap->cmpCount = 3; - pixmap->cmpSize = pixmap_depth == 16 ? 5 : 8; - } - - pixmap->pmTable = ctab; - - rowbytes = width * pixmap_depth; - rowbytes = (( rowbytes + 31 ) >> 5) << 2; - - /* - * Sanity check rowBytes to make sure it's not over the QuickDraw limit - * This will cause the calling code to downgrade the bit depth until we can allocate - * the image, or just fail if it's too big overall - */ - if ( rowbytes > 0x3FFF ) - { - return -1; - } - - il_pixmap->header.widthBytes = rowbytes; - - pixmap->rowBytes = rowbytes | 0x8000; - - /* - * Allocate the buffer. If the image is really large, we just allocate out of temp - * memory directly as it won't force the allocator to allocate a big tem mem chunk - * which might be filled with other blocks that will force it to hang around for a - * long time. - * - * I will probably change the large block allocator to always use temp memory for - * huge blocks as it will simplify this code and fragment the large block heap less. - */ - buffer_size = rowbytes * height; - if ( buffer_size > 63 * 1024L ) - { - fe_pixmap->buffer_handle = TempNewHandle ( buffer_size, &err ); - - /* - * If this fails, then go ahead and try malloc... - */ - if ( fe_pixmap->buffer_handle == NULL ) - { - fe_pixmap->image_buffer = malloc ( buffer_size ); - if ( fe_pixmap->image_buffer == NULL ) - { - err = memFullErr; - } - else - { - err = noErr; - } - } - } - else - { - fe_pixmap->image_buffer = malloc ( buffer_size ); - if ( fe_pixmap->image_buffer == NULL ) - { - err = memFullErr; - } - } - - pixmap->baseAddr = (Ptr) 0xFF5E0001; - il_pixmap->bits = (Ptr) 0xFF5E0001; - -#if TRACK_IMAGE_CACHE_SIZE - if ( err == noErr ) - { - gCacheSize += buffer_size; - if ( gCacheSize > gMaxCacheSize ) - gMaxCacheSize = gCacheSize; - } -#endif - - return err; -} - -static ColorSpaceIndex GetNextBestColorSpaceIndex ( ColorSpaceIndex index ) -{ - switch ( index ) - { - default: index = kNumColorSpaces; break; - case kOneBit: index = kNumColorSpaces; break; - case kEightBitColor: index = kOneBit; break; - case kSixteenBit: index = kEightBitColor; break; - case kThirtytwoBit: index = kSixteenBit; break; - } - - return index; -} - -static ColorSpaceIndex ConvertColorSpaceToIndex ( IL_ColorSpace * color_space ) -{ - ColorSpaceIndex index; - - index = kEightBitColor; - - switch ( color_space->type ) - { - case NI_TrueColor: - if ( color_space->pixmap_depth > 16 ) - { - index = kThirtytwoBit; - } - else - { - index = kSixteenBit; - } - - break; - - case NI_PseudoColor: - switch ( color_space->pixmap_depth ) - { - case 1: index = kOneBit; break; - case 2: index = kEightBitColor; break; - case 4: index = kEightBitColor; break; - case 8: index = kEightBitColor; break; - } - - break; - - case NI_GreyScale: - switch ( color_space->pixmap_depth ) - { - case 1: index = kOneBit; break; - case 2: index = kEightBitGray; break; - case 4: index = kEightBitGray; break; - case 8: index = kEightBitGray; break; - } - - break; - } - - return index; -} - -static ColorSpaceIndex ConvertDepthToColorSpaceIndex ( Int32 depth, Boolean grayscale ) -{ - ColorSpaceIndex index; - GDHandle gd; - - /* - * We default image depth to the depth of the deepest screen. - */ - if ( depth == 0 ) - { - gd = GetDeepestDevice(); - depth = GetDepth ( gd ); - - /* check that magic bit to see if it's a grayscale device */ - grayscale = ( (*gd)->gdFlags & ( 1 << gdDevType ) ) == 0; - } - - /* - * If we're looking at allocating a direct pixmap, and the user's machine - * is low on temp memory, then downgrade to 8 bit - */ - if ( ( depth >= 16 ) && ( TempFreeMem() < ( 2048L * 1024L )) ) - { - depth = 8; - } - - if ( grayscale ) - { - switch ( depth ) - { - case 1: index = kOneBit; break; - case 2: index = kEightBitGray; break; - case 4: index = kEightBitGray; break; - case 8: index = kEightBitGray; break; - case 16: index = kSixteenBit; break; - case 32: index = kThirtytwoBit; break; - default: index = kEightBitColor; break; - } - } - else - { - switch ( depth ) - { - case 1: index = kOneBit; break; - case 2: index = kEightBitColor; break; - case 4: index = kEightBitColor; break; - case 8: index = kEightBitColor; break; - case 16: index = kSixteenBit; break; - case 32: index = kThirtytwoBit; break; - default: index = kEightBitColor; break; - } - } - - return index; -} - -static IL_ColorSpace * AllocateColorSpace ( MWContext * context, ColorSpaceIndex space_index ) -{ - IL_RGBBits rgb; - Int32 depth; - Boolean grayscale; - IL_ColorMap * color_map; - IL_ColorSpace * color_space; - Int32 index; - Uint8 * index_map; - Int32 num_colors; - IL_IRGB transparent_color; - - color_space = NULL; - - /* convert the space index back to depth/grayscale */ - switch ( space_index ) - { - default: return NULL; - case kOneBit: depth = 1; grayscale = true; break; - case kEightBitGray: depth = 8; grayscale = true; break; - case kEightBitColor: depth = 8; grayscale = false; break; - case kSixteenBit: depth = 16; grayscale = false; break; - case kThirtytwoBit: depth = 32; grayscale = false; break; - } - - if ( depth == 16 ) - { - /* - * Create a 16 bit color space - */ - rgb.red_bits = 5; - rgb.red_shift = 10; - rgb.green_bits = 5; - rgb.green_shift = 5; - rgb.blue_bits = 5; - rgb.blue_shift = 0; - - color_space = IL_CreateTrueColorSpace ( &rgb, 16 ); - } - else - if ( depth == 32 ) - { - /* - * Create a 32 bit color space - */ - rgb.red_bits = 8; - rgb.red_shift = 16; - rgb.green_bits = 8; - rgb.green_shift = 8; - rgb.blue_bits = 8; - rgb.blue_shift = 0; - - color_space = IL_CreateTrueColorSpace ( &rgb, 32 ); - } - else - if ( grayscale ) - { - /* - * Create an indexed grayscale space. - */ - color_space = IL_CreateGreyScaleColorSpace ( depth, depth ); - } - else - { - /* - * Create an indexed color space. - */ - - /* - * First create a color map with a reserved color for the transparent color. - * When we first create a context, we won't yet have a transparent color, so - * then we just set it to the default background color - */ - if ( context->transparent_pixel != NULL ) - { - transparent_color.red = context->transparent_pixel->red; - transparent_color.green = context->transparent_pixel->green; - transparent_color.blue = context->transparent_pixel->blue; - } - else - { - transparent_color.red = kDefaultBGColorRed; - transparent_color.green = kDefaultBGColorGreen; - transparent_color.blue = kDefaultBGColorBlue; - } - - transparent_color.index = 0; - - color_map = IL_NewCubeColorMap ( NULL, 0, 1 << depth ); - - /* Allocate the index map for this color map */ - if ( color_map != NULL ) - { - IL_AddColorToColorMap ( color_map, &transparent_color ); - - num_colors = ( 1 << depth ); - - index_map = (Uint8 *) XP_ALLOC ( sizeof(uint8) * num_colors ); - if ( index_map != NULL ) - { - for ( index = num_colors - 1; index >= 0; --index ) - { - index_map[ index ] = index; - } - - color_map->index = index_map; - } - else - { - IL_DestroyColorMap ( color_map ); - color_map = NULL; - } - } - - /* Now build a color space around it */ - if ( color_map != NULL ) - { - color_space = IL_CreatePseudoColorSpace ( color_map, depth, depth ); - if ( color_space == NULL ) - { - IL_DestroyColorMap ( color_map ); - color_map = NULL; - } - } - } - - return color_space; -} - -static IL_ColorSpace * GetColorSpace ( MWContext * context, ColorSpaceIndex space_index, CTabHandle * color_table ) -{ - IL_ColorSpace * color_space; - CTabHandle ctable; - - /* bounds check */ - if ( space_index >= kNumColorSpaces ) - { - return NULL; - } - - ctable = NULL; - if ( color_table != NULL ) - { - *color_table = NULL; - } - - color_space = gColorSpaces[ space_index ]; - - /* - * Do we need to allocate a space? - */ - if ( color_space == NULL ) - { - color_space = AllocateColorSpace ( context, space_index ); - - /* - * Allocate a mac color table for this color space - */ - if ( color_space != NULL ) - { - ctable = ConvertColorSpaceToColorTable ( color_space ); - if ( ctable == NULL ) - { - IL_ReleaseColorSpace ( color_space ); - color_space = NULL; - } - } - - /* - * Add a reference to this color space so we're sure no one ever deletes it - * out from under us (we keep them cached for the life of the browser). - */ - IL_AddRefToColorSpace ( color_space ); - - gColorSpaces[ space_index ] = color_space; - gColorTables [ space_index ] = ctable; - } - - if ( color_space != NULL ) - { - ctable = gColorTables [ space_index ]; - } - - if ( color_table != NULL ) - { - *color_table = ctable; - } - - return color_space; -} - -static CTabHandle ConvertColorSpaceToColorTable ( IL_ColorSpace * color_space ) -{ - CTabHandle ctab; - ColorSpec * cspecs; - uint32 ctab_entries; - uint32 count; - NI_RGB * map_colors; - - ctab = NULL; - if ( color_space->pixmap_depth <= 8 ) - { - ctab_entries = color_space->cmap.num_colors; - } - else - { - ctab_entries = 1; - } - - ctab = (CTabHandle) NewHandleClear ( sizeof(ColorTable) + - sizeof(ColorSpec) * (ctab_entries - 1) ); - if ( ctab != NULL ) - { - (*ctab)->ctSeed = GetCTSeed(); - (*ctab)->ctSize = ctab_entries - 1; - - /* - * Grab the color from the color map. If we're direct, then don't bother. - */ - if ( color_space->pixmap_depth <= 8 ) - { - cspecs = &(*ctab)->ctTable[ 0 ]; - - if ( color_space->type == NI_GreyScale ) - { - Uint16 color; - Uint16 color_inc; - - color_inc = 256 / ( 1 << color_space->pixmap_depth ); - color_inc |= color_inc << 8; - - color = 0; - for ( count = 0; count < ctab_entries; ++count ) - { - cspecs->value = count; - cspecs->rgb.red = color; - cspecs->rgb.green = color; - cspecs->rgb.blue = color; - - cspecs++; - color += color_inc; - } - } - else - { - map_colors = &color_space->cmap.map[ 0 ]; - - for ( count = 0; count < ctab_entries; ++count ) - { - cspecs->value = count; - cspecs->rgb.red = ((uint16) map_colors->red << 8 ) | (uint16) map_colors->red; - cspecs->rgb.green = ((uint16) map_colors->green << 8 ) | (uint16) map_colors->green; - cspecs->rgb.blue = ((uint16) map_colors->blue << 8 ) | (uint16) map_colors->blue; - - cspecs++; - map_colors++; - } - } - } - } - - return ctab; -} - -static void SetColorSpaceTransparentColor ( IL_ColorSpace * color_space, Uint8 red, Uint8 green, Uint8 blue ) -{ - if ( color_space->type == NI_PseudoColor ) - { - IL_RGB *map; - - /* - * The last color in the color map is always our transparent color - */ - map = &color_space->cmap.map[ color_space->cmap.num_colors - 1 ]; - map->red = red; - map->green = green; - map->blue = blue; - } -} - -static OSErr CreatePictureGWorld ( IL_Pixmap * image, IL_Pixmap * mask, PictureGWorldState * state ) -{ - OSErr err; - CTabHandle ctab; - NI_IRGB * transparent_pixel; - IL_ColorSpace * color_space; - CGrafPtr savePort; - GDHandle saveGD; - Boolean remapTransparentIndex; - - remapTransparentIndex = false; - - state->image = (NS_PixMap *) image->client_data; - - if ( mask != NULL ) - { - state->mask = (NS_PixMap *) mask->client_data; - - color_space = image->header.color_space; - XP_ASSERT(color_space); - - transparent_pixel = image->header.transparent_pixel; - XP_ASSERT(transparent_pixel); - - /* get our own expended copy of the background/transparent color */ - state->transparentColor.red = (uint16) transparent_pixel->red | ( (uint16) transparent_pixel->red << 8 ); - state->transparentColor.green = (uint16) transparent_pixel->green | ( (uint16) transparent_pixel->green << 8 ); - state->transparentColor.blue = (uint16) transparent_pixel->blue | ( (uint16) transparent_pixel->blue << 8 ); - - /* - * If the image has an indexed color color_space, then we know it has a unique - * transparent color. So, we can use it's color table for the copybits - */ - if ( image->header.color_space->type == NI_PseudoColor ) - { - ctab = state->image->pixmap.pmTable; - err = HandToHand ( (Handle *) &ctab ); - if ( err != noErr ) - return err; - - /* make sure the background entry contains the correct color */ - state->transparentIndex = color_space->cmap.num_colors - 1; - (*ctab)->ctTable[ state->transparentIndex ].rgb = state->transparentColor; - remapTransparentIndex = true; - } - else - /* - * If the image has a grayscale space, we're in a world of hurt. We need to steal - * an index to use for the transparent color - */ - if ( image->header.color_space->type == NI_GreyScale ) - { - ctab = state->image->pixmap.pmTable; - err = HandToHand ( (Handle *) &ctab ); - if ( err != noErr ) - return err; - - /* use the default transparent color, but find it's true index */ - state->transparentIndex = -1; - remapTransparentIndex = true; - } - else - /* - * The image has a true color space. Hopefully, the transparent color is unique to the - * image. If not, (ie the site's bg color is the same as a valid color in the image), we'll - * have more be transparent than should be. There's not a whole lot we can do about this - */ - { - ctab = NULL; - } - - state->ctab = ctab; - - /* - * Make sure that our transparent color is unique. We can choose any color we want as it - * won't actually be displayed. - */ - CreateUniqueTransparentColor ( image, state ); - - err = NewGWorld ( &state->gworld, image->header.color_space->pixmap_depth, - &state->image->pixmap.bounds, ctab, NULL, useTempMem ); - - /* - * If we have an indexed image, then find out where the transparent color maps to - * so that we can remove it - */ - if ( err == noErr && remapTransparentIndex ) - { - GetGWorld ( &savePort, &saveGD ); - SetGWorld ( state->gworld, NULL ); - - /* where does our transparent color really map to? */ - state->transparentIndex = Color2Index ( &state->transparentColor ); - - /* Remove this from the inverse table */ - ReserveEntry ( state->transparentIndex, true ); - - /* - * get the real RGB color this maps to (should always be the same for PseudoColor but - * could be different for grayscape where we may not have a unique color). - */ - Index2Color ( state->transparentIndex, &state->transparentColor ); - - SetGWorld ( savePort, saveGD ); - } - else - { - state->transparentIndex = -1; - } - } - else - { - state->mask = NULL; - - } - - return err; -} - -static void TeardownPictureGWorld ( PictureGWorldState * state ) -{ - if ( state->gworld != NULL ) - { - DisposeGWorld ( state->gworld ); - } - - if ( state->ctab != NULL ) - { - DisposeCTable ( state->ctab ); - } -} - -static void CreateUniqueTransparentColor ( IL_Pixmap * image, PictureGWorldState * state ) -{ - RGBColor rgb; - Boolean foundColor; - - if ( state->ctab == NULL ) - return; - - /* - * We have no idea which colors are actually used in the image (unless we want to actually - * go over each pixel). - * - * For direct pixels and grayscale images, we just use the transparent color that came along - * with the page. On color images, we actually try to find a unique color - */ - -#define INV_TAB_RES 4 -#define INV_TAB_MAX ((Uint16)~((0x8000 >> (INV_TAB_RES-1)) - 1)) -#define INV_TAB_MASK(c) ((c) & INV_TAB_MAX) -#define INV_TAB_INC (0x8000 >> (INV_TAB_RES-1)) - - if ( image->header.color_space->type == NI_PseudoColor ) - { - /* - * We assume QD will use it's default 4bit inverse table, so try and find a unique color - * within that space. - * First look for our default transparent color. Most of the time it should be unique. - */ - - if ( FindColorInCTable ( state->ctab, state->transparentIndex, &state->transparentColor )) - { - foundColor = false; - - /* we found that color, so run through all the colors in the hope of finding something unique */ - for ( rgb.red = 0; (Uint16)rgb.red <= INV_TAB_MAX; rgb.red += INV_TAB_INC ) - { - for ( rgb.green = 0; (Uint16)rgb.green <= INV_TAB_MAX; rgb.green += INV_TAB_INC ) - { - for ( rgb.blue = 0; (Uint16)rgb.blue <= INV_TAB_MAX; rgb.blue += INV_TAB_INC ) - { - if ( FindColorInCTable ( state->ctab, state->transparentIndex, &rgb ) == false ) - { - foundColor = true; - goto foundit; - } - } - } - } - -foundit: - /* if we found a color, then use it */ - if ( foundColor ) - { - state->transparentColor = rgb; - (*state->ctab)->ctTable[ state->transparentIndex ].rgb = rgb; - } - } - } -} - -static Boolean FindColorInCTable ( CTabHandle ctab, Uint32 skipIndex, RGBColor * rgb ) -{ - Boolean colorIsUsed; - Uint32 count; - UInt32 num_entries; - ColorSpec * cspecs; - - cspecs = (*ctab)->ctTable; - num_entries = (*ctab)->ctSize; - colorIsUsed = false; - - /* run through the color table and try to find this color */ - for ( count = 0; count < num_entries; ++count ) - { - /* don't bother checking the current transparent color */ - if ( count != skipIndex ) - { - /* make sure the color is unique within the resolution of the inverse table */ - if ( INV_TAB_MASK(cspecs[count].rgb.red) == INV_TAB_MASK(rgb->red) && - INV_TAB_MASK(cspecs[count].rgb.green) == INV_TAB_MASK(rgb->green) && - INV_TAB_MASK(cspecs[count].rgb.blue) == INV_TAB_MASK(rgb->blue) ) - { - colorIsUsed = true; - break; - } - } - } - - return colorIsUsed; -} - -static void CopyPicture ( PictureGWorldState * state ) -{ - CGrafPtr savePort; - GDHandle saveGD; - PixMapHandle pm; - SInt8 hState; - - GetGWorld ( &savePort, &saveGD ); - pm = GetGWorldPixMap ( state->gworld ); - hState = HGetState ( (Handle) pm ); - - LockPixels ( pm ); - - SetGWorld ( state->gworld, NULL ); - - /* copy our image into the gworld */ - CopyBits ( (BitMap *) &state->image->pixmap, (BitMap *) *pm, &state->image->pixmap.bounds, - &state->image->pixmap.bounds, srcCopy, NULL ); - - /* make our transparent index writeable again */ - if ( state->transparentIndex != -1 ) - { - ReserveEntry ( state->transparentIndex, false ); - - /* make sure the value field in the color table for the transparent entry is correct */ - (*(*pm)->pmTable)->ctTable[ state->transparentIndex ].value = state->transparentIndex; - } - - /* fill the masked area with this color */ - RGBForeColor ( &state->transparentColor ); - - CopyBits ( (BitMap *) &state->mask->pixmap, (BitMap *) *pm, &state->mask->pixmap.bounds, - &state->image->pixmap.bounds, notSrcOr, NULL ); - - SetGWorld ( savePort, saveGD ); - - /* now actually copy the picture data, making the transparent color transparent */ - ForeColor ( blackColor ); - RGBBackColor ( &state->transparentColor ); - - CopyBits ( (BitMap *) *pm, &qd.thePort->portBits, &(*pm)->bounds, &(*pm)->bounds, transparent, NULL ); - - UnlockPixels ( pm ); - HSetState ( (Handle) pm, hState ); -} - - -static void LockPixmapBuffer ( IL_Pixmap * pixmap ) -{ - NS_PixMap * fe_pixmap; - - fe_pixmap = (NS_PixMap *) pixmap->client_data; - LockFEPixmapBuffer ( fe_pixmap ); - pixmap->bits = fe_pixmap->pixmap.baseAddr; // bits now point to something normal -} - - -static void UnlockPixmapBuffer ( IL_Pixmap * pixmap ) -{ - NS_PixMap * fe_pixmap; - - fe_pixmap = (NS_PixMap *) pixmap->client_data; - UnlockFEPixmapBuffer ( fe_pixmap ); - pixmap->bits = fe_pixmap->pixmap.baseAddr; // bits set to garbage -} - - - -static CIconHandle GetIconHandle ( jint iconID ) -{ - CIconHandle ic; - - if ( iconID == IL_IMAGE_EMBED ) - { - iconID = IL_IMAGE_BAD_DATA; - } - - iconID += IL_ICON_OFFSET; - - ic = CIconList::GetIcon( iconID ); - if ( !ic ) - { - if (iconID >= IL_GOPHER_FIRST) - iconID = IL_GOPHER_FIRST-1; - else if (iconID >= IL_NEWS_FIRST) - iconID = IL_NEWS_FIRST-1; - else - iconID = IL_IMAGE_FIRST-1; - iconID = iconID + IL_ICON_OFFSET; - ic = CIconList::GetIcon(iconID); - } - - return ic; -} - -void -ImageGroupObserver(XP_Observable /*observable*/, - XP_ObservableMsg message, - void* /*message_data*/, - void* closure) -{ - MWContext* theContext = static_cast(closure); - Assert_(theContext); - if (!theContext) - return; - - CBrowserContext* theBrowserContext = dynamic_cast(theContext->fe.newContext); - Assert_(theContext); - if (!theBrowserContext) - return; - - switch(message) - { - case IL_STARTED_LOADING: - theBrowserContext->SetImagesLoading(true); - break; - - case IL_ABORTED_LOADING: - theBrowserContext->SetImagesDelayed(true); - break; - - case IL_FINISHED_LOADING: - theBrowserContext->SetImagesLoading(false); - break; - - case IL_STARTED_LOOPING: - theBrowserContext->SetImagesLooping(true); - break; - - case IL_FINISHED_LOOPING: - theBrowserContext->SetImagesLooping(false); - break; - - default: - break; - } -} - -void -FE_MochaImageGroupObserver(XP_Observable /*observable*/, - XP_ObservableMsg message, - void *message_data, - void */*closure*/) -{ - IL_GroupMessageData *data = (IL_GroupMessageData *)message_data; - MWContext *theContext = (MWContext *)data->display_context; - - // If we are passed a NULL display context, the MWContext has been - // destroyed. - if (!theContext) - return; - - CBrowserContext* theBrowserContext = dynamic_cast(theContext->fe.newContext); - if (!theBrowserContext) - return; - - switch(message) - { - case IL_STARTED_LOADING: - theBrowserContext->SetMochaImagesLoading(true); - break; - - case IL_ABORTED_LOADING: - theBrowserContext->SetMochaImagesDelayed(true); - break; - - case IL_FINISHED_LOADING: - theBrowserContext->SetMochaImagesLoading(false); - break; - - case IL_STARTED_LOOPING: - theBrowserContext->SetMochaImagesLooping(true); - break; - - case IL_FINISHED_LOOPING: - theBrowserContext->SetMochaImagesLooping(false); - break; - - default: - break; - } -} - -#ifdef PROFILE -#pragma profile off -#endif - diff --git a/mozilla/cmd/macfe/central/mimages.h b/mozilla/cmd/macfe/central/mimages.h deleted file mode 100644 index dfbcb4d4f04..00000000000 --- a/mozilla/cmd/macfe/central/mimages.h +++ /dev/null @@ -1,138 +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. - */ - -#pragma once - -#include "ntypes.h" -#include "structs.h" -#include "cstring.h" -#include "Netscape_Constants.h" -#include "libimg.h" - -class CBrowserContext; - - -/* - * Our internal Pixmap structure. - */ -typedef struct NS_PixMap -{ - PixMap pixmap; - Handle buffer_handle; - void * image_buffer; - int32 lock_count; - Boolean tiled; -} NS_PixMap; - -typedef struct DrawingState -{ - short copyMode; - NS_PixMap * pixmap; - NS_PixMap * mask; -} DrawingState; - - -XP_BEGIN_PROTOS - -void ImageGroupObserver(XP_Observable observable, - XP_ObservableMsg message, - void* message_data, - void* closure); - -/* - * Macros that are here for historic reasons - */ -#define TRUNC_TO_MAX(LVALUE,MAX) ((LVALUE > MAX)? (LVALUE = MAX): LVALUE) -#define TRUNC_TO_MIN(LVALUE,MAX) ((LVALUE > MAX)? (LVALUE = MAX): LVALUE) - - -/* - * High Level FE Palette Management - */ -void CreateImageContext ( - MWContext * context ); - -void DestroyImageContext ( - MWContext * context ); - -void SetImageContextBackgroundColor ( - MWContext * context, - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue); - -GDHandle GetDeepestDevice ( - void ); - -Boolean VerifyDisplayContextColorSpace ( - MWContext * context ); - - -/* - * High level FE functions for image management. - */ -EClickKind FindImagePart ( - MWContext * context, - LO_ImageStruct * image, - SPoint32 * where, - cstring * url, - cstring * target, - LO_AnchorData * & anchor ); - -BOOL IsImageComplete ( - LO_ImageStruct * image ); - -PicHandle ConvertImageElementToPICT( - LO_ImageStruct * inElement); - -cstring GetURLFromImageElement( - CBrowserContext * inOwningContext, - LO_ImageStruct * inElement); - - -/* - * These used to be private, but need to be public so we can start using more images and - * fewer icons (for things like toolbars, Aurora, etc.) - */ - - /* width and height are the width/height of the destination rectangle. The image - * will be scaled to fit withing that rect. */ -void DrawScaledImage ( DrawingState * state, Point topLeft, jint x_offset, - jint y_offset, jint width, jint height ); - /* width and height are the width/height of the area into which you want to tile - * the image and have nothing to do with the size of the image itself */ -void DrawTiledImage ( DrawingState * state, Point topLeft, jint x_offset, - jint y_offset, jint width, jint height ); - -OSErr PreparePixmapForDrawing ( IL_Pixmap * image, IL_Pixmap * mask, Boolean canCopyMask, - DrawingState * state ); -void DoneDrawingPixmap ( IL_Pixmap * image, IL_Pixmap * mask, DrawingState * state ); - -void LockFEPixmapBuffer ( NS_PixMap* inPixmap ) ; -void UnlockFEPixmapBuffer ( NS_PixMap* inPixmap ) ; - -void DestroyFEPixmap ( NS_PixMap* fe_pixmap ) ; - -/* - * Inline Utilities - */ -inline short GetDepth (GDHandle h) { - return (* (*h)->gdPMap)->pixelSize; -} - -XP_END_PROTOS diff --git a/mozilla/cmd/macfe/central/mintl.cp b/mozilla/cmd/macfe/central/mintl.cp deleted file mode 100644 index 5b6df229f48..00000000000 --- a/mozilla/cmd/macfe/central/mintl.cp +++ /dev/null @@ -1,741 +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. - */ - -#include "uprefd.h" -// macfe -#include "macutil.h" // ConstrainTo -#include "resgui.h" // FENC_RESTYPE, CSIDLIST_RESTYPE, cmd2csid_tbl_ResID -// Netscape -#ifndef _XP_H_ -#include "xp_mcom.h" -#endif -#include "libi18n.h" // INTL_SetUnicodeCSIDList -#include "xpassert.h" -/* Testing Code */ -#include "csid.h" // CS_MAC_ROMAN, CS_AUTO, CS_DEFAULT -#include "intlpriv.h" // prototypes for FE_GetSingleByteTable and FE_FreeSingleByteTable -#include "PascalString.h" -#include "prefapi.h" - -/****************************************************************************************** - * INTERNATIONAL STUFF - * Better off in another file? - ******************************************************************************************/ - -static const char* Pref_PropFont = ".prop_font"; -static const char* Pref_PropSize = ".prop_size"; -static const char* Pref_FixedFont = ".fixed_font"; -static const char* Pref_FixedSize = ".fixed_size"; - -LArray* CPrefs::fCharSetFonts = NULL; -CCharSet CPrefs::fDefaultFont; - -static int FontChanged(const char * prefname, void * stuff); -static void InitCheckScriptFont(Handle hndl); - -static void ReadCharacterEncodingsHandle(Handle hndl, Boolean usePrevious) -{ - unsigned short numberEncodings; - ThrowIfResError_(); - ::DetachResource( hndl ); - ThrowIfResError_(); - - LHandleStream stream( hndl ); - - stream.ReadData( &numberEncodings, sizeof( unsigned short) ); - XP_ASSERT(numberEncodings>0); - for(int i=0;ifEncodingName, propFont, fixedFont, propSize, fixedSize, - csFont->fCSID , csFont->fFallbackFontScriptID, csFont->fTxtrButtonResID, - csFont->fTxtrTextFieldResID ); -} - -extern int16 cntxt_lastSize; - -Boolean CPrefs::SetFont( const CStr255& EncodingName, - const CStr255& PropFont, - const CStr255& FixedFont, - unsigned short PropFontSize, - unsigned short FixedFontSize, - unsigned short CSID, - unsigned short FallbackFontScriptID, - unsigned short TxtrButtonResID, - unsigned short TxtrTextFieldResID ) -{ - CCharSet csFont; - Boolean changed = FALSE; - long realFixedSize; - long realPropSize; - short index; - CStr255 systemFont; - - ::GetFontName( 0, systemFont ); - if ( CPrefs::GetFont( CSID, &csFont ) ) - index = fCharSetFonts->FetchIndexOf( &csFont ); - else - { - csFont.fEncodingName = EncodingName; - csFont.fCSID = CSID; - csFont.fFallbackFontScriptID = FallbackFontScriptID; - csFont.fTxtrButtonResID = TxtrButtonResID; - csFont.fTxtrTextFieldResID = TxtrTextFieldResID; - - if ( CSID == CS_MAC_ROMAN ) - fCharSetFonts->InsertItemsAt( 1, LArray::index_First, &csFont ); - else - fCharSetFonts->InsertItemsAt( 1, LArray::index_Last, &csFont ); - index = fCharSetFonts->FetchIndexOf( &csFont ); - changed = TRUE; - } - if ( index != LArray::index_Bad ) - { - realFixedSize = FixedFontSize; - realPropSize = PropFontSize; - - ConstrainTo( FONT_SIZE_MIN, FONT_SIZE_MAX, realFixedSize ); - ConstrainTo( FONT_SIZE_MIN, FONT_SIZE_MAX, realPropSize ); - - if ( changed || - PropFont != csFont.fPropFont || realPropSize != csFont.fPropFontSize || - FixedFont != csFont.fFixedFont || realFixedSize != csFont.fFixedFontSize ) - { - - csFont.fPropFont = PropFont; - csFont.fPropFontSize = realPropSize; - csFont.fFixedFont = FixedFont; - csFont.fFixedFontSize = realFixedSize; - - ::GetFNum( PropFont, (short*)&csFont.fPropFontNum ); - if(csFont.fPropFontNum == 0 && !EqualString( PropFont, systemFont, FALSE, FALSE ) ) - { - - // Do not have that font. Try to us smScriptAppFondSize from Script Manager - long AppFondSize; - unsigned short AppFond; - CStr255 tryFontName; - - AppFondSize = ::GetScriptVariable(FallbackFontScriptID, smScriptAppFondSize); - AppFond = (AppFondSize >> 16); - ::GetFontName(AppFond, tryFontName); - if(tryFontName[0] != 0) // The AppFond exist - { - csFont.fPropFontNum = AppFond; - csFont.fPropFont = tryFontName; - } - } - ::GetFNum( FixedFont, (short*)&csFont.fFixedFontNum ); - if(csFont.fFixedFontNum == 0 && !EqualString( FixedFont, systemFont, FALSE, FALSE ) ) - { - // Do not have that font. Try to us smScriptAppFondSize from Script Manager - long SmallFondSize; - unsigned short SmallFond; - CStr255 tryFontName; - SmallFondSize = ::GetScriptVariable(FallbackFontScriptID,smScriptSmallFondSize); - SmallFond = (SmallFondSize >> 16); - ::GetFontName(SmallFond, tryFontName); - if(tryFontName[0] != 0) // The SmallFond exist. - { - csFont.fFixedFontNum = SmallFond; - csFont.fFixedFont = tryFontName; - } - } - - fCharSetFonts->AssignItemsAt( 1, index, &csFont ); - - changed = TRUE; - if((csFont.fTxtrButtonResID!=0) || (csFont.fTxtrTextFieldResID!=0)) - { - // Mapping of char set to textTraits resources - // Txtr resources need to be locked and held in memory - Int16 buttonFont, textField; - buttonFont = csFont.fTxtrButtonResID; - textField = csFont.fTxtrTextFieldResID; - - UseApplicationResFile(); - - TextTraitsH buttonH = (TextTraitsH) ::GetResource( 'Txtr', buttonFont ); - TextTraitsH textH = (TextTraitsH) ::GetResource( 'Txtr', textField ); - if (buttonH && textH ) - { - if (!*buttonH) - ::LoadResource((Handle)buttonH); - - if (*buttonH) - ::HNoPurge( (Handle)buttonH ); - - if (!*textH) - ::LoadResource((Handle)textH); - - if (*textH) - ::HNoPurge( (Handle)textH ); - - if (*buttonH && *textH ) - { - short size = ::GetHandleSize((Handle)buttonH); - ::SetHandleSize((Handle)textH, sizeof(TextTraitsRecord)); // Because resources are compressed - (**textH).fontNumber = -1;//fontNumber_Unknown in UTextTraits - StHandleLocker lock((Handle)textH); - LString::CopyPStr(csFont.fFixedFont, (StringPtr)&(**textH).fontName, 255); - (**textH).size = realFixedSize; - (**buttonH).fontNumber = -1; // fontNumber_Unknown - ::SetHandleSize((Handle)buttonH, sizeof(TextTraitsRecord)); // Because resources are compressed - StHandleLocker lock2((Handle)buttonH); - LString::CopyPStr(csFont.fPropFont, (StringPtr)&(**buttonH).fontName, 255); - } - } - #ifdef DEBUG -// else -// XP_ASSERT(FALSE); - #endif - } - } - } - - if (changed) - SetModified(); - return changed; -} - - - - -Boolean CPrefs::GetFont( UInt16 win_csid, CCharSet* font ) -{ - CCharSet csFont; - LArrayIterator iter( *fCharSetFonts ); - win_csid &= ~CS_AUTO; - while ( iter.Next( &csFont ) ) - { - if ( (csFont.fCSID & ~CS_AUTO) == win_csid ) - { - *font = csFont; - return TRUE; - } - } - font = &fDefaultFont; - return FALSE; -} - -Boolean CPrefs::GetFontAtIndex( unsigned long index, CCharSet* font ) -{ - XP_ASSERT( index <= fCharSetFonts->GetCount() ); - - return ( fCharSetFonts->FetchItemAt( index, font ) ); -} -Int16 CPrefs::GetButtonFontTextResIDs(unsigned short csid) -{ - CCharSet csFont; - GetFont(csid, &csFont ); - return csFont.fTxtrButtonResID; -} -Int16 CPrefs::GetTextFieldTextResIDs(unsigned short csid) -{ - CCharSet csFont; - GetFont(csid, &csFont ); - return csFont.fTxtrTextFieldResID; -} - -short CPrefs::GetProportionalFont(unsigned short csid) -{ - CCharSet csFont; - GetFont(csid, &csFont ); - return csFont.fPropFontNum; -} -short CPrefs::GetFixFont(unsigned short csid) -{ - CCharSet csFont; - GetFont(csid, &csFont ); - return csFont.fFixedFontNum; -} - - -// pkc 1/23/97 -// PowerPC alignment is on by default, so we need -// to set 68k alignment for these structs -#pragma options align=mac68k - -struct CsidPair { - int16 win_csid; - int16 doc_csid; - int32 cmdNum; -}; - -struct CsidTable -{ - int16 itemcount; - CsidPair pair[1]; -}; - -#pragma options align=reset -// - -int16 CPrefs::CmdNumToWinCsid( int32 cmdNum) -{ - // Get resource from application - Handle hndl = ::GetResource( 'Csid', cmd2csid_tbl_ResID); - // Note: ::GetResource calls _LoadResource internally. You don't - // have to call LoadResource again, it's a waste of space and time. - ThrowIfResError_(); - if (hndl != NULL) - { - // lock in on the stack. - StHandleLocker lock((Handle) hndl ); - // cast it into our internal data struct - CsidTable** cthndl = (CsidTable**)hndl; - // search it. - int16 itemcount = (**cthndl).itemcount; - CsidPair* item = &(**cthndl).pair[0]; - for (int16 i = 0; i < itemcount; i++, item++) - { - if (cmdNum == item->cmdNum) - return item->win_csid; - } - } - return CS_DEFAULT; -} - -int16 CPrefs::CmdNumToDocCsid(int32 cmdNum) -{ - // Get resource from application - Handle hndl = ::GetResource( 'Csid', cmd2csid_tbl_ResID); - // Note: ::GetResource calls _LoadResource internally. You don't - // have to call LoadResource again, it's a waste of space and time. - ThrowIfResError_(); - if (hndl != NULL) - { - // lock in on the stack. - StHandleLocker lock((Handle) hndl ); - // cast it into our internal data struct - CsidTable** cthndl = (CsidTable**)hndl; - // search it. - int16 itemcount = (**cthndl).itemcount; - CsidPair* item = &(**cthndl).pair[0]; - for (int16 i = 0; i < itemcount; i++, item++) - { - if (cmdNum == item->cmdNum) - return item->doc_csid; - } - } - return CS_DEFAULT; -} - -int32 CPrefs::WinCsidToCmdNum( int16 csid) -{ - // Get resource from application - Handle hndl = ::GetResource( 'Csid', cmd2csid_tbl_ResID); - // Note: ::GetResource calls _LoadResource internally. You don't - // have to call LoadResource again, it's a waste of space and time. - ThrowIfResError_(); - if(hndl != NULL) - { - // lock in on the stack - StHandleLocker lock((Handle) hndl ); - // cast it into our internal data struct - CsidTable** cthndl = (CsidTable**)hndl; - // search it. - int16 itemcount = (**cthndl).itemcount; - CsidPair* item = &(**cthndl).pair[0]; - for (int16 i = 0; i < itemcount; i++, item++) - { - if (csid == item->win_csid) - return item->cmdNum; - } - } - return cmd_Nothing; -} - -enum { - kScriptIsNotEnabled = 0, - kScriptIsEnabled, - kScriptHasFont -}; - -static Boolean CheckNamedFont(ConstStr255Param name) -{ - short family; - ::GetFNum(name, &family); - return family != 0; -} -ScriptCode CPrefs::CsidToScript(int16 csid) -{ - switch(csid) - { - case CS_DINGBATS: - XP_ASSERT(TRUE); - return -1; - case CS_SYMBOL: - XP_ASSERT(TRUE); - return -1; - default: - CCharSet font; - if(CPrefs::GetFont(csid,&font )) - return font.fFallbackFontScriptID; - else - { - XP_ASSERT(TRUE); - return -1; - } - } -} -static void InitCheckScriptFont(Handle hndl) -{ - int scriptstatus[64]; - ScriptCode script; - for(script = 0 ; script < 64 ; script++) - { - if((::GetScriptVariable(script, smScriptEnabled) & 0x00FF) == 0) - scriptstatus[script] = kScriptIsNotEnabled; - else - scriptstatus[script] = kScriptIsEnabled; - } - - int numOfFond = CountResources('FOND'); - ThrowIfResError_(); - for(short i=0; i < numOfFond; i++) - { - ScriptCode fontscript; - short resid; - ResType type; - Str255 name; - Handle handle = GetIndResource('FOND', i+1); - GetResInfo(handle, &resid, &type, name); - ThrowIfResError_(); - fontscript = FontToScript(resid); - if(scriptstatus[fontscript] == kScriptIsEnabled) - scriptstatus[fontscript] = kScriptHasFont; - } - unsigned short numOfCsid; - ::DetachResource( hndl ); - ThrowIfResError_(); - - LHandleStream stream( hndl ); - - stream.ReadData( &numOfCsid, sizeof( unsigned short) ); - XP_ASSERT(numOfCsid > 0); - uint16 realNum = 0; - int16 *reallist = new int16[numOfCsid]; - ThrowIfNil_( reallist ); - for(int i=0;iFetchIndexOf( &refcount ); - if (refcount.count == 0) - { - // If the refcount is positive, the handle is guaranteed loaded and locked. - // Otherwise, we must do these things. - ::LoadResource(refcount.cvthdl); - ::HLock(refcount.cvthdl); - } - refcount.count++; - fXlatList->AssignItemsAt( 1, index, &refcount ); - return refcount.cvthdl; - } - } - // we cannot find the refcount for this xlat. So, lets - // get the table from resource and insert one. - Handle tableHandle; - tableHandle = ::GetResource('xlat',inid); // also loads! - ThrowIfResError_(); - ThrowIfNil_(tableHandle); - - ::HLock(tableHandle); - ThrowIfMemError_(); - - refcount.id = inid; - refcount.count = 1; - refcount.cvthdl = tableHandle; - fXlatList->InsertItemsAt( 1, LArray::index_First, &refcount ); - return tableHandle; -} - -int32 xlateRefCountList::Dec(char **cvthdl) -{ - RefCount refcount; - LArrayIterator iter( *fXlatList ); - while ( iter.Next( &refcount ) ) - { - if( (refcount.cvthdl) == cvthdl ) - { - short index = fXlatList->FetchIndexOf( &refcount ); - if (refcount.count > 0) - { - refcount.count--; - fXlatList->AssignItemsAt( 1, index, &refcount ); - - if (refcount.count == 0) - { - ::HUnlock((Handle) refcount.cvthdl); - ThrowIfMemError_(); - // ::HPurge((Handle) refcount.cvthdl); Unnecessary, resources are purgeable. - } - } - return refcount.count; - } - } -// XP_ASSERT(FALSE); -// Don't assert: we may receive an old copy of sLastTableHandle - return 0; -} - -static char ** sLastTableHandle = nil; -static int32 sLastTableID = -1; - -char ** -FE_GetSingleByteTable(int16 /*from_csid*/, int16 /*to_csid*/, int32 resourceid) -{ - char ** tableHandle; - - if(fXlatList == NULL) - xlateRefCountList::init(); - - // if we need the same table, return the previous copy - if (resourceid == sLastTableID && sLastTableHandle != nil) - { - return sLastTableHandle; - } - - // otherwise load the new table... - tableHandle = xlateRefCountList::Inc(resourceid); - - // ...and make a copy of it - if (sLastTableHandle != nil) - ::DisposeHandle(sLastTableHandle); - sLastTableHandle = tableHandle; - if (::HandToHand(&sLastTableHandle) == noErr) - sLastTableID = resourceid; - else - sLastTableHandle = nil; - - return tableHandle; -} - -void FE_FreeSingleByteTable(char **cvthdl) -{ - if(fXlatList == NULL) - xlateRefCountList::init(); - - if (cvthdl != sLastTableHandle) - (void)xlateRefCountList::Dec(cvthdl); // safe to Dec more than we Inc'ed -} - - - - - - diff --git a/mozilla/cmd/macfe/central/mprint.cp b/mozilla/cmd/macfe/central/mprint.cp deleted file mode 100644 index 293dbd0f41b..00000000000 --- a/mozilla/cmd/macfe/central/mprint.cp +++ /dev/null @@ -1,1664 +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. - */ - -#include "mprint.h" - -#include "CHTMLView.h" -#include "CBrowserContext.h" -#include "CHyperScroller.h" -#include "UGraphicGizmos.h" - -#include "LListener.h" -#include "LPrintout.h" -#include "PascalString.h" -#include "LCaption.h" - -#include "MoreMixedMode.h" - - -#define NONE_FORM 1 -#define PAGE_NUMBER_FORM 2 -#define DATE_FORM 3 -#define LOCATION_FORM 4 -#define TITLE_FORM 5 - -#include "macutil.h" -#include "earlmgr.h" -#include "resgui.h" -#include "macgui.h" // for UGraphics -#include "uerrmgr.h" -#include "shist.h" -#include "libi18n.h" -#include "xlate.h" -#include "np.h" -#include -#include "mimages.h" -#include "mplugin.h" - -// ***** BEGIN HACK ***** (Bug #83149) -#if defined (JAVA) -#include "MJava.h" -#endif -// ***** END HACK ***** - -#pragma mark --- CPrintHTMLView --- - -//====================================== -class CPrintHTMLView : public CHTMLView -//====================================== -{ - private: - typedef CHTMLView Inherited; - public: - - enum { class_ID = 'PtHt' }; - enum printMode { - epmBlockDisplay, - epmLayout, - epmDisplay - }; - CPrintHTMLView(LStream* inStream); - virtual ~CPrintHTMLView(); - void CopyCharacteristicsFrom(const CHTMLView* inHTMLView); - - virtual void CountPanels(Uint32 &outHorizPanels, Uint32 &outVertPanels); - virtual Boolean ScrollToPanel (const PanelSpec &inPanel); - - void SetPrintMode (printMode inMode) - { mPrintMode = inMode; } - void InitializeCapture (void); - void CalculatePageBreaks (void); - - CL_Compositor* GetCompositor (void) - { return mCompositor->mCompositor; } - - // overrides - - virtual void AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh); - - protected: - virtual void FinishCreateSelf(void); - virtual void InstallBackgroundColor(); - // Sets mBackgroundColor. Called from ClearBackground(). - // The base class implementation uses the text background - // preference, but derived classes can override this. - // Here we do nothing, because the background color is set - // in CopyCharacteristicsFrom(). - virtual void GetFullGridSize( - Int32& outWidth, - Int32& outHeight); - void CapturePosition (LO_Element *inElement); - virtual void ResetBackgroundColor() const; - // Calls RGBBackColor(mBackgroundColor). Printview overrides. - virtual void DrawFrameFocus(); - virtual void DrawBackground( - const Rect& inArea, - LO_ImageStruct* inBackdrop = nil); - virtual void EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor); - - Boolean BelongsOnPage (LO_Element *inElement); - inline Boolean BelongsOnPage (LO_TextStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - inline Boolean BelongsOnPage (LO_LinefeedStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - inline Boolean BelongsOnPage (LO_HorizRuleStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - inline Boolean BelongsOnPage (LO_BullettStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - inline Boolean BelongsOnPage (LO_EmbedStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - inline Boolean BelongsOnPage (LO_TableStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - inline Boolean BelongsOnPage (LO_CellStruct *inElement) - { return BelongsOnPage ((LO_Element *) inElement); } - Boolean BelongsOnPage (LO_FormElementStruct *inElement); - - virtual void DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG); - - virtual void DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG); - - virtual void DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG); - - virtual void DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct); - - virtual void DisplayBullet( - int inLocation, - LO_BullettStruct* inBulletStruct); - - virtual void DisplayEmbed( - int inLocation, - LO_EmbedStruct* inEmbedStruct); - - virtual void DisplayFormElement( - int inLocation, - LO_FormElementStruct* inFormElement); - - virtual void DisplayEdge( - int inLocation, - LO_EdgeStruct* inEdgeStruct); - - virtual void DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct); - - virtual void DisplayCell( - int inLocation, - LO_CellStruct* inCellStruct); - - virtual void CreateGridView( - CBrowserContext* inGridContext, - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight, - Int8 inScrollMode, - Bool inNoEdge); - - printMode mPrintMode; - LArray mElementRects; - LArray mVPanelRects; -}; // class CPrintHTMLView - -//----------------------------------- -CPrintHTMLView::CPrintHTMLView(LStream* inStream) - : mElementRects(sizeof(XP_Rect)), - mVPanelRects(sizeof(XP_Rect)), - - Inherited(inStream) -//----------------------------------- -{ - SetPrintMode (epmDisplay); - SetScrollMode(LO_SCROLL_NO, false); -} - -//----------------------------------- -CPrintHTMLView::~CPrintHTMLView() -//----------------------------------- -{ -} - -// Override method to skip code in CHTMLView so that we don't call Repaginate() which -// will destroy CPrintHTMLView early in printing process. -//----------------------------------- -void CPrintHTMLView::AdaptToSuperFrameSize( -//----------------------------------- - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh) -{ - LView::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh); -} - -//----------------------------------- -void CPrintHTMLView::CopyCharacteristicsFrom(const CHTMLView* inHTMLView) -//----------------------------------- -{ - if (CPrefs::GetBoolean(CPrefs::PrintBackground)) - { - // Transfer the back color from the view we're printing to the print view. - // This is necessary because, e.g., message views and browser views have - // different default background colors. - LO_Color bc = UGraphics::MakeLOColor(inHTMLView->GetBackgroundColor()); - SetBackgroundColor(bc.red, bc.green, bc.blue); - } -} - -//----------------------------------- -// our version works much like the inherited version (LView's), except we take into -// account an HTML page's variable height. -void CPrintHTMLView::CountPanels( -//----------------------------------- - Uint32 &outHorizPanels, - Uint32 &outVertPanels) -{ - SDimension32 imageSize; - GetImageSize(imageSize); - - SDimension16 frameSize; - GetFrameSize(frameSize); - - outHorizPanels = 1; - if (frameSize.width > 0 && imageSize.width > 0) - outHorizPanels = ((imageSize.width - 1) / frameSize.width) + 1; - - outVertPanels = mVPanelRects.GetCount(); -} - -//----------------------------------- -Boolean CPrintHTMLView::ScrollToPanel (const PanelSpec &inPanel) { -//----------------------------------- - - Boolean panelInImage; - SDimension16 frameSize; - GetFrameSize(frameSize); - - Uint32 horizPanelCount; - Uint32 vertPanelCount; - CountPanels(horizPanelCount, vertPanelCount); - - // rely on horizPanelCount, but use mVPanelRects for vertical displacement - // the simple horizontal calculation is sufficient, since we don't mess with - // horizontal displacement. But since we munge page heights, that's more complicated. - - panelInImage = false; - if (inPanel.horizIndex <= horizPanelCount && inPanel.vertIndex <= vertPanelCount) { - Int32 horizPos = frameSize.width * (inPanel.horizIndex - 1); - Int32 vertPos; - int32 pageHeight; - XP_Rect panelVRect; - - panelInImage = mVPanelRects.FetchItemAt (inPanel.vertIndex, &panelVRect); - vertPos = panelVRect.top; - pageHeight = panelVRect.bottom - panelVRect.top; - if (panelInImage) { - ScrollImageTo (horizPos, vertPos, false); - - // now make XP_CheckElementSpan work for this page - PrintInfo *pageInfo = ((MWContext *) *mContext)->prInfo; - pageInfo->page_topy = vertPos; - pageInfo->page_break = vertPos + pageHeight; - pageInfo->page_height = pageHeight; - pageInfo->page_width = frameSize.width; - - if (mCompositor) - CL_ResizeCompositorWindow (*mCompositor, frameSize.width, pageHeight); - } - } - - return panelInImage; -} - -//----------------------------------- -void CPrintHTMLView::InitializeCapture (void) -//----------------------------------- -{ - mElementRects.RemoveItemsAt (mElementRects.GetCount(), LArray::index_First); - mVPanelRects.RemoveItemsAt (mVPanelRects.GetCount(), LArray::index_First); -} - -//----------------------------------- -void CPrintHTMLView::CalculatePageBreaks (void) -//----------------------------------- -{ - Boolean breakBigElements; // a large element straddles the boundary; break it - Rect pageArea; - short pageHeight; - XP_Rect vPanelRect, // page rect - elementRect; // element rectangle - int32 pageMajorLimit, // refuse to truncate the page past this point - pageMinorLimit; // secondary page truncation limit - ArrayIndexT element; // index into list of element rectangles - - CalcPortFrameRect (pageArea); - - pageHeight = pageArea.bottom - pageArea.top; - - vPanelRect.left = pageArea.left; - vPanelRect.right = pageArea.right; - vPanelRect.top = 0; - vPanelRect.bottom = pageHeight; - - do { - pageMajorLimit = vPanelRect.bottom - pageHeight / 2; - pageMinorLimit = vPanelRect.bottom - pageHeight / 32; - element = LArray::index_First; - breakBigElements = false; - while (mElementRects.FetchItemAt (element, &elementRect)) { - element++; - // if it spans the page boundary, it's trouble: - if (elementRect.top < vPanelRect.bottom && elementRect.bottom > vPanelRect.bottom) - // if it's bigger than a whole page, don't even consider it - if (elementRect.bottom - elementRect.top < pageHeight) { - // if we've decided to break on a big element, consider only small elements - if (breakBigElements && elementRect.top < pageMinorLimit) - continue; - // bump up page bottom. if it's been bumped too far, reset and punt - vPanelRect.bottom = elementRect.top; - element = LArray::index_First; - if (vPanelRect.bottom < pageMajorLimit) { - vPanelRect.bottom = vPanelRect.top + pageHeight; - breakBigElements = true; - } - } - } - - // remove all elements occurring on this page - element = LArray::index_First; - while (mElementRects.FetchItemAt (element, &elementRect)) - if (elementRect.top < vPanelRect.bottom) - mElementRects.RemoveItemsAt (1, element); - else - element++; - - // store page rect and prepare for next page - mVPanelRects.InsertItemsAt (1, LArray::index_Last, &vPanelRect); - vPanelRect.top = vPanelRect.bottom + 1; - vPanelRect.bottom = vPanelRect.top + pageHeight; - } while (mElementRects.GetCount() > 0); -} - -//----------------------------------- -void CPrintHTMLView::FinishCreateSelf(void) -//----------------------------------- -{ - /* Printing contexts want to be drawn back-to-front, only, and all in one pass, - rather than on a delayed call-back system. The inherited method creates - a compositor; we modify it. Note that while a CHTMLView's mCompositor - is intended to be a _shared_ object, it appears that this one is used only - while printing, so it seems safe to make printing-specific changes to it. - */ - Inherited::FinishCreateSelf(); - CL_SetCompositorDrawingMethod (*mCompositor, CL_DRAWING_METHOD_BACK_TO_FRONT_ONLY); - CL_SetCompositorFrameRate (*mCompositor, 0); -} - -//----------------------------------- -void CPrintHTMLView::InstallBackgroundColor() -// Overridden to use a white background -//----------------------------------- -{ - if (!CPrefs::GetBoolean(CPrefs::PrintBackground)) - memset(&mBackgroundColor, 0xFF, sizeof(mBackgroundColor)); // white - // Else do nothing: use the background color that we copied from the view - // we're printing. -} -//----------------------------------- -void CPrintHTMLView::ResetBackgroundColor() const -//----------------------------------- -{ - // do nothing. -} - -//----------------------------------- -void CPrintHTMLView::GetFullGridSize( - Int32& outWidth, - Int32& outHeight) -//----------------------------------- -{ - // We never have scrollers, but is this right? I'm fairly clueless... - // The base class gets the size from mScroller which, of course, is null - // for a print view... - SDimension16 theContainerSize; - this->GetFrameSize(theContainerSize); - outWidth = theContainerSize.width; - outHeight = theContainerSize.height; -} // CPrintHTMLView::GetFullGridSize - -//----------------------------------- -void CPrintHTMLView::CapturePosition (LO_Element *inElement) { -//----------------------------------- - - XP_Rect rect; - - CalcAbsoluteElementPosition (inElement, rect); - - try { - mElementRects.InsertItemsAt (1, LArray::index_Last, &rect); - } catch (...) { - // there's really no one to report this error to. if we're this out of memory, - // something else is going to fail worse than this. failure to add this rect - // to the list will only cause pagination to happen at inopportune positions. - } -} - -//----------------------------------- -// does an object with the given top and height want to be rendered on the current page? -Boolean -CPrintHTMLView::BelongsOnPage (LO_Element *inElement) { -//----------------------------------- - - Rect frame; - return CalcElementPosition (inElement, frame); -} - -//----------------------------------- -// does an object with the given top and height want to be rendered on the current page? -Boolean -CPrintHTMLView::BelongsOnPage (LO_FormElementStruct *inElement) { -//----------------------------------- - - Rect frame; - Boolean rtnVal; -#ifdef LAYERS - // hack! HACK! HAAAACK! - /* The element position calculation takes layer positions into account. - That's normally good, except for form elements, which are implemented as PowerPlant - subpanes. That's normally good, except that the compositor sticks each form element - subpane into a layer of its own. No doubt the compositor thinks that's good, and - normally we don't have a problem with that. But here, it results in the calculated - position of the frame being multiplied by two (since the layer's position is added - to the element's position). Here's where we temporarily convince our superclass - that the current layer is at (0,0): - */ - // note: if this ever gives you problems, you can probably replace it with simply - // "return true" and let clipping decide who to display. - CDrawable *drawable = mCurrentDrawable; - SPoint32 origin = mLayerOrigin; - mCurrentDrawable = NULL; - mLayerOrigin.h = 0; - mLayerOrigin.v = 0; -#endif - rtnVal = CalcElementPosition ((LO_Element *) inElement, frame); -#ifdef LAYERS - mCurrentDrawable = drawable; - mLayerOrigin = origin; -#endif - return rtnVal; -} - - -//----------------------------------- -void CPrintHTMLView::DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG) -//----------------------------------- -{ - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - // do it all in DisplayText. the assumption here is that DisplaySubtext - // will be called more often, but DisplayText will be called for each line - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inText)) - Inherited::DisplaySubtext(inLocation, inText, inStartPos, inEndPos, inNeedBG); - } -} // CPrintHTMLView::DisplaySubtext - -//----------------------------------- -void CPrintHTMLView::DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inText); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inText)) - Inherited::DisplayText (inLocation, inText, inNeedBG); - } -} - -//----------------------------------- -void CPrintHTMLView::DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inLinefeedStruct); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inLinefeedStruct)) - Inherited::DisplayLineFeed(inLocation, inLinefeedStruct, inNeedBG); - } -} - - -//----------------------------------- -void CPrintHTMLView::DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct) -//----------------------------------- -{ - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inRuleStruct); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inRuleStruct)) - Inherited::DisplayHR (inLocation, inRuleStruct); - } -} // CPrintHTMLView::DisplayHR - -//----------------------------------- -void CPrintHTMLView::DisplayBullet( - int inLocation, - LO_BullettStruct* inBulletStruct) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inBulletStruct); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inBulletStruct)) - Inherited::DisplayBullet (inLocation, inBulletStruct); - } -} // CPrintHTMLView::DisplayBullet - -//----------------------------------- -void CPrintHTMLView::DisplayEmbed( - int /*inLocation*/, - LO_EmbedStruct* inEmbedStruct) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inEmbedStruct); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inEmbedStruct)) - { - NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbedStruct->objTag.FE_Data; - CPluginView* view = (CPluginView*) app->fe_data; - view->EmbedDisplay(inEmbedStruct, true); - } - } -} - -//----------------------------------- -void CPrintHTMLView::DisplayFormElement( - int inLocation, - LO_FormElementStruct* inFormElement) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inFormElement); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inFormElement)) - Inherited::DisplayFormElement(inLocation, inFormElement); - } -} - -//----------------------------------- -void CPrintHTMLView::DisplayEdge( - int /*inLocation*/, - LO_EdgeStruct* /*inEdgeStruct*/) -//----------------------------------- -{ - // Do nothing for printing. -} - -//----------------------------------- -void CPrintHTMLView::DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inTableStruct); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inTableStruct)) - Inherited::DisplayTable(inLocation, inTableStruct); - } -} // CPrintHTMLView::DisplayTable - -//----------------------------------- -void CPrintHTMLView::DisplayCell( - int inLocation, - LO_CellStruct* inCellStruct) { -//----------------------------------- - - switch (mPrintMode) { - case epmBlockDisplay: - break; - case epmLayout: - CapturePosition ((LO_Element *) inCellStruct); - break; - case epmDisplay: - if (FocusDraw() && BelongsOnPage (inCellStruct)) - Inherited::DisplayCell (inLocation, inCellStruct); - } -} // CPrintHTMLView::DisplayCell - -//----------------------------------- -void CPrintHTMLView::DrawFrameFocus() -//----------------------------------- -{ - // Do nothing for printing. -} // CPrintHTMLView::DrawFrameFocus - -//----------------------------------- -void CPrintHTMLView::DrawBackground( - const Rect& inArea, - LO_ImageStruct* inBackdrop) -//----------------------------------- -{ - // ¥ default white background for printing (also black text) - if (!CPrefs::GetBoolean(CPrefs::PrintBackground)) - return; - Inherited::DrawBackground(inArea, inBackdrop); -} // CPrintHTMLView::DrawBackground - -//----------------------------------- -void CPrintHTMLView::EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor) -//----------------------------------- -{ - if (inColor != nil && !CPrefs::GetBoolean(CPrefs::PrintBackground)) - return; - Inherited::EraseBackground(inLocation, inX, inY, inWidth, inHeight, inColor); -} // CPrintHTMLView::EraseBackground - - -//----------------------------------- -void CPrintHTMLView::CreateGridView( - CBrowserContext* inGridContext, - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight, - Int8 inScrollMode, - Bool inNoEdge) -//----------------------------------- -{ - - CHyperScroller* theContainer = NULL; - - try - { - SetScrollMode(LO_SCROLL_NO, false); - mShowFocus = false; - - FocusDraw(); - LCommander::SetDefaultCommander( this ); - LPane::SetDefaultView( this ); - - theContainer = (CHyperScroller*)UReanimator::ReadObjects('PPob', 1002); - ThrowIfNULL_(theContainer); - theContainer->FinishCreate(); - - CPrintHTMLView* theNewView = (CPrintHTMLView*)theContainer->FindPaneByID(2005); - ThrowIfNULL_(theNewView); - - // ¥ position it - theNewView->mNoBorder = inNoEdge; - theNewView->SetSuperHTMLView(this); - - Rect theOwningFrame; - CalcLocalFrameRect(theOwningFrame); - - Rect theNewFrame; - CropFrameToContainer(inX, inY, inWidth, inHeight, theNewFrame); - - CHyperScroller* theSuperScroller = mScroller; - if (!theNewView->mNoBorder) - { - // for each side that intersects the container, - // expand the container out one - if (inX == 0) - if (theSuperScroller) - theSuperScroller->ExpandLeft(); - - if (inY == 0) - if (theSuperScroller) - theSuperScroller->ExpandTop(); - - if (theNewFrame.right == theOwningFrame.right) - if (theSuperScroller) - theSuperScroller->ExpandRight(); - - if (theNewFrame.bottom == theOwningFrame.bottom) - if (theSuperScroller) - theSuperScroller->ExpandBottom(); - - if (theSuperScroller) - theSuperScroller->AdjustHyperViewBounds(); - } - else - { - theContainer->ExpandLeft(); - theContainer->ExpandTop(); - theContainer->ExpandRight(); - theContainer->ExpandBottom(); - theContainer->AdjustHyperViewBounds(); - } - - CropFrameToContainer(inX, inY, inWidth, inHeight, theNewFrame); - - theContainer->PlaceInSuperFrameAt(theNewFrame.left, theNewFrame.top, false); - theContainer->ResizeFrameTo(RectWidth(theNewFrame), RectHeight(theNewFrame), false); - - if (theSuperScroller) - theSuperScroller->AdjustHyperViewBounds(); - theContainer->AdjustHyperViewBounds(); - - theNewView->SetScrollMode(inScrollMode); - theNewView->mShowFocus = true; - - // ¥ so that we call scroller's activate, and it actually enables the scrollbars -// theContainer->ActivateSelf(); -// FIX ME!!! this used to be the line above. I hope this still works - theContainer->Activate(); - - if (theSuperScroller) - theSuperScroller->Refresh(); - - theNewView->SetContext(inGridContext); - mHasGridCells = true; - - // give the grid context the same listeners as the root context - mContext->CopyListenersToContext(inGridContext); - } - catch (...) - { - delete theContainer; - throw; - } - -} // CPrintHTMLView::CreateGridView - -#pragma mark --- CPrintContext --- -//====================================== -class CPrintContext : public CBrowserContext -//====================================== -{ - public: - CPrintContext(); - operator MWContext*() { return &mContext; } - operator MWContext&() { return mContext; } -}; // class CPrintContext - -//----------------------------------- -CPrintContext::CPrintContext() -: CBrowserContext(MWContextPrint) -//----------------------------------- -{ - mContext.fancyFTP = false; - mContext.fancyNews = false; - - mContext.convertPixX = 1; - mContext.convertPixY = 1; - mContext.fe.view = nil; -// mContext.fe.realContext = this; - mContext.is_grid_cell = false; - - IL_DisplayData data; - data.dither_mode = IL_ClosestColor; - IL_SetDisplayMode(mContext.img_cx, IL_DITHER_MODE, &data); -} - -#pragma mark --- CCustomPageSetup --- - -#define NUM_POPUPS 6 -#define NUM_CONTROLS 7 -#define BACKGROUND_CHECKBOX 6 // member of fControls[] which is treated specially - -//====================================== -class CCustomPageSetup -//====================================== -{ -public: - static void InitCustomPageSetup(); - static void OpenPageSetup( THPrint hPrint ); - - static pascal TPPrDlg CustomStyleDialogInit( THPrint hPrint ); - PROCDECL( static, CustomStyleDialogInit ) - - static long GetControlValue( long i ); -protected: - struct ControlStruct - { - ControlHandle handle; - CPrefs::PrefEnum prefEnum; - }; - - static pascal void CustomStyleItems( DialogPtr xdialogPtr, short itemNo ); - PROCDECL( static, CustomStyleItems ) - - static TPPrDlg sPageSetupDialog; // pointer to style dialog - static PItemUPP sItemProc; // we need to store the old itemProc here - static long sFirstItem; // save our first item here - - static ControlStruct fControls[ NUM_CONTROLS ]; -}; // class CCustomPageSetup - -TPPrDlg CCustomPageSetup::sPageSetupDialog = nil;// pointer to style dialog -PItemUPP CCustomPageSetup::sItemProc = nil; // we need to store the old itemProc here -long CCustomPageSetup::sFirstItem = nil; // save our first item here -CCustomPageSetup::ControlStruct CCustomPageSetup::fControls[ NUM_CONTROLS ]; - -//----------------------------------- -void CCustomPageSetup::InitCustomPageSetup() -//----------------------------------- -{ - fControls[ 0 ].prefEnum = CPrefs::TopLeftHeader; - fControls[ 1 ].prefEnum = CPrefs::TopMidHeader; - fControls[ 2 ].prefEnum = CPrefs::TopRightHeader; - fControls[ 3 ].prefEnum = CPrefs::BottomLeftFooter; - fControls[ 4 ].prefEnum = CPrefs::BottomMidFooter; - fControls[ 5 ].prefEnum = CPrefs::BottomRightFooter; - fControls[ BACKGROUND_CHECKBOX ].prefEnum = CPrefs::PrintBackground; -} - -//----------------------------------- -void CCustomPageSetup::OpenPageSetup( THPrint hp ) -//----------------------------------- -{ - sPageSetupDialog = ::PrStlInit( hp ); - - if ( PrError() == noErr ) - { - if ( ::PrDlgMain( hp, (PDlgInitUPP) &PROCPTR( CCustomPageSetup::CustomStyleDialogInit ) ) ) - ; - } -} - -//----------------------------------- -long CCustomPageSetup::GetControlValue( long i ) -//----------------------------------- -{ - if (i == BACKGROUND_CHECKBOX) - return CPrefs::GetBoolean (fControls[BACKGROUND_CHECKBOX].prefEnum); - return CPrefs::GetLong (fControls[i].prefEnum); -} - -//----------------------------------- -pascal void CCustomPageSetup::CustomStyleItems( DialogPtr xdialogPtr, short itemNo ) -//----------------------------------- -{ - TPPrDlg dialogPtr = (TPPrDlg)xdialogPtr; - long value = 0; - short myItem = itemNo - sFirstItem; // "localize" current item No - if ( myItem >= 0 ) // if localized item > 0, it's one of ours - { - if ( fControls[ myItem ].handle ) - { - value = ::GetControlValue( fControls[ myItem ].handle ); - if ( myItem == BACKGROUND_CHECKBOX ) - { - value = !value; - ::SetControlValue( fControls[ myItem ].handle, value ); - CPrefs::SetBoolean( value, fControls[ myItem ].prefEnum ); - } - else - CPrefs::SetLong( value, fControls[ myItem ].prefEnum ); - } - } - else - CallPItemProc( sItemProc, (DialogPtr)dialogPtr, itemNo ); -} - - -PROCEDURE( CCustomPageSetup::CustomStyleItems, uppPItemProcInfo ) - -//----------------------------------- -pascal TPPrDlg CCustomPageSetup::CustomStyleDialogInit( THPrint /*hPrint*/ ) -// this routine appends items to the standard style dialog and sets up the -// user fields of the printing dialog record TPRDlg -// This routine will be called by PrDlgMain -//----------------------------------- -{ - short itemType = 0; // needed for GetDialogItem/SetDItem call - Handle itemH = nil; - Rect itemBox; - Handle ditlList; - - // ¥Êappend the items from the resource - ditlList = GetResource( 'DITL', 256 ); - sFirstItem = CountDITL( (DialogPtr)sPageSetupDialog ) + 1; - AppendDITL( (DialogPtr)sPageSetupDialog, ditlList, appendDITLBottom ); - ReleaseResource( ditlList ); - - // ¥Êinit all the control values - for ( long i = 0; i < NUM_CONTROLS; i++ ) - { - ::GetDialogItem( (DialogPtr) sPageSetupDialog, sFirstItem + i, &itemType, &itemH, &itemBox ); - fControls[ i ].handle = (ControlHandle)itemH; - ::SetControlValue( (ControlHandle)itemH, GetControlValue(i) ); - } - - // ¥ patch in our item handler - // sItemProc is the original item proc, - // pItemProc becomes our custom item proc - sItemProc = sPageSetupDialog->pItemProc; - sPageSetupDialog->pItemProc = &PROCPTR( CCustomPageSetup::CustomStyleItems ); - - // ¥ÊPrDlgMain expects a pointer to the modified dialog to be returnedÉ - return sPageSetupDialog; -} // CCustomPageSetup::CustomStyleDialogInit -PROCEDURE( CCustomPageSetup::CustomStyleDialogInit, uppPDlgInitProcInfo ) - -//====================================== -#pragma mark --- CPrintHeaderCaption --- -//====================================== - -//====================================== -class CPrintHeaderCaption: public LCaption -//====================================== -{ -public: - enum { class_ID = 'HPPE' }; - - CPrintHeaderCaption( LStream* inStream ); - virtual void PrintPanelSelf( const PanelSpec& inPanel ); - - static void CreateString( long type, CStr255& string, const PanelSpec& inPanel ); - static void SetPrintContext( MWContext* cntx ) - { - sContext = cntx; - } - static void SetTemporaryFile( Boolean b ) { sIsTemporaryFile = b; } -protected: - static MWContext* sContext; - static Boolean sIsTemporaryFile; -}; // class CPrintHeaderCaption - -MWContext* CPrintHeaderCaption::sContext = nil; -Boolean CPrintHeaderCaption::sIsTemporaryFile = false; - -//----------------------------------- -CPrintHeaderCaption::CPrintHeaderCaption( LStream* inStream ): LCaption( inStream ) -//----------------------------------- -{ -} - -//----------------------------------- -void CPrintHeaderCaption::CreateString( long form, CStr255& string, const PanelSpec& panel ) -//----------------------------------- -{ - switch ( form ) - { - case PAGE_NUMBER_FORM: - { - char buffer[ 30 ]; - CStr255 format = GetPString( PG_NUM_FORM_RESID ); - PR_snprintf( buffer, 30, format, panel.pageNumber ); - string = buffer; - } - break; - - case DATE_FORM: - GetDateTimeString( string ); - break; - - case LOCATION_FORM: - if ( sContext && !sIsTemporaryFile ) - { - History_entry* current; - current = SHIST_GetCurrent( &sContext->hist ); - if ( current && current->address ) - { - char *urlPath = NULL; - // if the URL starts with ftp or http then we'll make an attempt to remove password - if ( (XP_STRNCMP(current->address, "ftp", 3) == 0 || XP_STRNCMP(current->address, "http", 4) == 0 ) - && NET_ParseUploadURL( current->address, &urlPath, NULL, NULL ) ) - { - string = urlPath; - if ( urlPath ) - XP_FREE( urlPath ); - } - else // unknown URL; use it as is - string = current->address; - } - } - break; - - case TITLE_FORM: - if ( sContext && !sIsTemporaryFile ) - { - History_entry* current; - current = SHIST_GetCurrent( &sContext->hist ); - if ( current ) - string = current->title; - } - break; - } -} - -//----------------------------------- -void CPrintHeaderCaption::PrintPanelSelf( const PanelSpec& inPanel ) -//----------------------------------- -{ - long value = CCustomPageSetup::GetControlValue( mUserCon ); - CStr255 string; - CPrintHeaderCaption::CreateString( value, string, inPanel ); - - unsigned short win_csid = INTL_DefaultWinCharSetID(sContext); - if (value == TITLE_FORM && - ((INTL_CharSetNameToID(INTL_ResourceCharSet()) & ~CS_AUTO ) - != (win_csid & ~CS_AUTO))) - { - // Save the origional font name and number - TextTraitsH origTT = UTextTraits::LoadTextTraits(this->GetTextTraitsID()); - Int16 origFontNumber = (*origTT)->fontNumber; - Str255 origFontName; - ::BlockMoveData(origFontName, (*origTT)->fontName, (*origTT)->fontName[0]+1); - - // SetHandleSize- the handle is compressed. - ::SetHandleSize((Handle)origTT, sizeof(TextTraitsRecord)); - StHandleLocker lock((Handle) origTT ); - - // Set the Font name and number in the TextTraits to the one in buttonF - TextTraitsH csidTT - = UTextTraits::LoadTextTraits(CPrefs::GetButtonFontTextResIDs(win_csid)); - - (*origTT)->fontNumber = (*csidTT)->fontNumber; - ::BlockMoveData((*origTT)->fontName, (*csidTT)->fontName, (*csidTT)->fontName[0]+1); - - // Do the usual job - this->SetDescriptor(string); - this->DrawSelf(); - - // Restore the font name, number to the origional TextTraits - (*origTT)->fontNumber = origFontNumber; - ::BlockMoveData((*origTT)->fontName, origFontName, origFontName[0]+1); - } - else - { - this->SetDescriptor( string ); - this->DrawSelf(); - } -} // CPrintHeaderCaption::PrintPanelSelf - -//====================================== -#pragma mark --- CHTMLPrintout --- -//====================================== - -//====================================== -class CHTMLPrintout - : public LPrintout - , public LListener -//====================================== -{ -public: - enum { class_ID = 'HPPT' }; - typedef LPrintout super; - - CHTMLPrintout( LStream* inStream ); - virtual ~CHTMLPrintout(); - - virtual void FinishCreateSelf(); - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - virtual void DoProgress( const char* message, int level ); - static void BeginPrint( THPrint hp, CHTMLView* view ); - static CHTMLPrintout* Get() { return sHTMLPrintout; } - CPrintHTMLView* GetPrintHTMLView() const { return mPrintHTMLView; } - void LoadPageForPrint(URL_Struct* url, - MWContext *printcontext, MWContext *viewContext); - void StashPrintRecord(THPrint inPrintRecordH); - Boolean PrintFinished(void) - { return mPrinted && LMGetTicks() >= mFinishedTime; } - -protected: - - void Paginate (void); - void CapturePositions (void); - - static CHTMLPrintout* sHTMLPrintout; - - CPrintHTMLView* mPrintHTMLView; - CPrintContext* mContext; - Boolean mFinishedLayout, - mConnectionsCompleted, - mPrinted; - SInt32 mFinishedTime; -}; // class CHTMLPrintout - -CHTMLPrintout* CHTMLPrintout::sHTMLPrintout = nil; - -extern void BuildAWindowPalette( MWContext* context, WindowPtr window ); - -// ***** BEGIN HACK ***** (Bug #83149) -#if defined (JAVA) -static Boolean gAllowJavaAWTDrawingCalled_HACK = false; -static Boolean gCHTMLPrintoutContructed_HACK = false; - -// Do the wrong thing and declare this here instead of in a header file -extern "C" Boolean FE_AllowJavaAWTDrawing_HACK(); - -// Disable all Java AWT drawing while the FE is printing -// (This is actually called from LMacGraphics::BeginDrawing -// in ns:sun-java:awt:macos:LMacGraphics.cp) - -Boolean FE_AllowJavaAWTDrawing_HACK() -{ - if (gCHTMLPrintoutContructed_HACK) - { - gAllowJavaAWTDrawingCalled_HACK = true; - return false; - } - return true; -} -#endif //JAVA -// ***** END HACK ***** - -//----------------------------------- -CHTMLPrintout::CHTMLPrintout( LStream* inStream ) -//----------------------------------- -: LPrintout( inStream ) -, mContext(nil) -, mPrintHTMLView(nil) -, mPrinted(false) -{ - sHTMLPrintout = this; - - // ***** BEGIN HACK ***** (Bug #83149) -#if defined (JAVA) - gCHTMLPrintoutContructed_HACK = true; -#endif //JAVA - // ***** END HACK ***** -} - -// ***** BEGIN HACK ***** (Bug #83149) -#if defined (JAVA) -static void RefreshJavaSubPanes(LArray& subPanes) -{ - LArrayIterator itererator(subPanes, LArrayIterator::from_Start); - LPane* pane = NULL; - - while (itererator.Next(&pane)) - { - if (pane->GetPaneID() == CJavaView::class_ID) - pane->Refresh(); - else - { - LView *view = dynamic_cast(pane); - - if (view) - RefreshJavaSubPanes(view->GetSubPanes()); - } - } -} -#endif //JAVA -// ***** END HACK ***** - -//----------------------------------- -CHTMLPrintout::~CHTMLPrintout() -//----------------------------------- -{ - if ( XP_IsContextBusy( *mContext ) ) - NET_InterruptWindow( *mContext ); - XP_CleanupPrintInfo(*mContext); - DestroyImageContext( *mContext ); - mContext->RemoveListener(this); - mContext->RemoveUser(this); - sHTMLPrintout = nil; - - // ***** BEGIN HACK ***** (Bug #83149) -#if defined (JAVA) - gCHTMLPrintoutContructed_HACK = false; - - if (gAllowJavaAWTDrawingCalled_HACK) - { - gAllowJavaAWTDrawingCalled_HACK = false; - - // Update all the Java panes in all PowerPlant windows - for ( WindowPtr macWindow = (WindowPtr)LMGetWindowList(); - macWindow; - macWindow = (WindowPtr)((WindowPeek)macWindow)->nextWindow) - { - if (((WindowPeek)macWindow)->visible) - { - LWindow *ppWindow = LWindow::FetchWindowObject(macWindow); - - if (ppWindow) - RefreshJavaSubPanes(ppWindow->GetSubPanes()); - } - } - } -#endif //JAVA - // ***** END HACK ***** -} - -//----------------------------------- -void CHTMLPrintout::FinishCreateSelf() -//----------------------------------- -{ - LPrintout::FinishCreateSelf(); - mContext = new CPrintContext(); - ThrowIfNil_(mContext); - mContext->AddUser(this); - mContext->AddListener(this); // listen for msg_NSCAllConnectionsComplete - - CreateImageContext( *mContext ); - - mPrintHTMLView = (CPrintHTMLView*)FindPaneByID('PtHt'); - mPrintHTMLView->SetContext(mContext); -} - -// editor callback -void EditorPrintingCallback( char *completeURL, void *data ) -{ - Try_ - { - URL_Struct* url = NET_CreateURLStruct( completeURL, NET_DONT_RELOAD ); - ThrowIfNil_(url); - - CPrintHeaderCaption::SetTemporaryFile( true ); - CHTMLPrintout::Get()->LoadPageForPrint( url, (MWContext *)data, (MWContext *)data ); - } - Catch_( err ) - { - Throw_( err ); - } - EndCatch_ - -} - - -//----------------------------------- -void CHTMLPrintout::StashPrintRecord (THPrint inPrintRecordH) -//----------------------------------- -{ - -/* StashPrintRecord is based on LPrintout::SetPrintRecord. You might think we'd override - that method, but it isn't virtual. So we changed the name to make it obvious that - it's a different function, then just called it ourself after LPrintout is finished - calling its version. - I don't understand why the LPrintout version of this method is supposed to work. - It sizes the LPrintout to match the size of the paper, rather than the page. The - comments in that method mumble something about the coordinate system working out - better that way. You can work around this by building into the PPob describing - the LPrintout an offset which accounts for the unprintable margin, but that works - only as long as the size of the printer margins is about the size built into the PPob. - This breaks down terribly if you print at reduced size, which effectively increases - the size of the printer margins. - So I've changed the PPob to completely fill its parent view, and here I effectively - change PowerPlant to use the page size. As far as I can tell, this works in all - cases. -*/ - - // do what LPrintout::SetPrintRecord does, but size ourselves to the page, - // rather than the paper - UPrintingMgr::ValidatePrintRecord(inPrintRecordH); - mPrintRecordH = inPrintRecordH; - - Rect pageRect = (**inPrintRecordH).prInfo.rPage; - - ResizeFrameTo(pageRect.right - pageRect.left, - pageRect.bottom - pageRect.top, false); - ResizeImageTo(pageRect.right - pageRect.left, - pageRect.bottom - pageRect.top, false); - PlaceInSuperImageAt(pageRect.left, pageRect.top, false); -} - -//----------------------------------- -void CHTMLPrintout::LoadPageForPrint(URL_Struct* url, MWContext *printcontext, MWContext *viewContext) -//----------------------------------- -{ - // SHIST_CreateURLStructFromHistoryEntry copies pointers but not - // the saved data structures, so we must zero them out to prevent - // double-deletions. An alternative that would preserve saved data - // for clients that find it useful (e.g. forms, embeds) would be to - // deep copy the saved data objects. - XP_MEMSET( &url->savedData, 0, sizeof( SHIST_SavedData ) ); - - NPL_PreparePrint( viewContext, &( url->savedData ) ); - if ( printcontext->prSetup ) - printcontext->prSetup->url = url; - url->position_tag = 0; - if ( url->address ) - XP_STRTOK( url->address, "#" ); - - CPrintHeaderCaption::SetPrintContext( viewContext ); - EarlManager::StartLoadURL( url, printcontext, FO_PRESENT ); - OutOfFocus( nil ); -} - - -//----------------------------------- -void CHTMLPrintout::Paginate (void) { -//----------------------------------- - - mPrintHTMLView->InitializeCapture(); - CapturePositions(); - mPrintHTMLView->CalculatePageBreaks(); - mPrintHTMLView->SetPrintMode (CPrintHTMLView::epmDisplay); -} - -//----------------------------------- -void CHTMLPrintout::CapturePositions (void) { -//----------------------------------- - - Rect pageArea; - short pageWidth, - pageHeight; - CL_Compositor *compositor = mPrintHTMLView->GetCompositor(); - - mPrintHTMLView->CalcPortFrameRect (pageArea); - pageHeight = pageArea.bottom - pageArea.top; - pageWidth = pageArea.right - pageArea.left; - - // For capturing, we want all the elements in a document to display. - // Since we can't size the compositor window to be the size of the - // document (the compositor window must have coordinates that fit into - // a 16-bit coordinate space), we take snapshots. In other words, - // we make the compositor window the size of the physical page and - // keep scrolling down till capture the entire document. - - if (compositor) { - XP_Rect drawingRect; - SDimension32 documentSize; - int pass; - int32 captureScrollOffset; - - // The compositor window is the size of the page (minus margins) - CL_ResizeCompositorWindow (compositor, pageWidth, pageHeight); - - drawingRect.left = 0; - drawingRect.top = 0; - drawingRect.right = pageWidth; - drawingRect.bottom = pageHeight; - - // We display all the elements twice. This is to deal with the - // fact that certain elements (images, embeds and applets for - // instance) are always displayed in a compositor pass after - // the containing HTML content. We only capture during the - // second pass. - mPrintHTMLView->SetPrintMode (CPrintHTMLView::epmBlockDisplay); - mPrintHTMLView->GetImageSize (documentSize); - for (pass = 0; pass < 2; pass++) { - // Till we've covered the entire document, we keep scrolling - // down and taking snapshots - for (captureScrollOffset = 0; - captureScrollOffset <= documentSize.height; - captureScrollOffset += pageHeight) { - - CL_ScrollCompositorWindow (compositor, 0, captureScrollOffset); - CL_RefreshWindowRect (compositor, &drawingRect); - } - mPrintHTMLView->SetPrintMode (CPrintHTMLView::epmLayout); - } - - CL_ScrollCompositorWindow (compositor, 0, 0); - } else { - mPrintHTMLView->SetPrintMode (CPrintHTMLView::epmLayout); - LO_RefreshArea (*mContext, 0, 0, 0x7FFFFFFF, 0x7FFFFFFF); - } -} // end CapturePositions - - -//----------------------------------- -void CHTMLPrintout::DoProgress( const char* /*message*/, int /*level*/ ) -//----------------------------------- -{ -} - -#ifdef PRE_JRM -MWContext* CHTMLPrintout::CreateGridContext() -{ - MWContext* newContext = mContext->CreateGridContext(); - newContext->type = MWContextPrint; - return newContext; -} -#endif - -//----------------------------------- -void CHTMLPrintout::BeginPrint(THPrint hp, CHTMLView* inViewToPrint) -//----------------------------------- -{ - if (!hp) - return; - if (!sHTMLPrintout) - sHTMLPrintout = (CHTMLPrintout*)LPrintout::CreatePrintout(1001); - ThrowIfNil_(sHTMLPrintout); - CPrintHTMLView* printHTMLView = sHTMLPrintout->GetPrintHTMLView(); - ThrowIfNil_(printHTMLView); - - // ¥ set the printout (unlike PP, we have our own SAVED print record ) - sHTMLPrintout->StashPrintRecord(hp); - - // ¥ setup psfe's structs for measurements - - // - // Keep a reference in the print context to the list of plugin instances - // in the on-screen context. This information is used in mplugin.cp when - // printing plugins to avoid creating new instantiations of all the plugins. - // - ((MWContext*)sHTMLPrintout->mContext)->pEmbeddedApp - = ((MWContext*)inViewToPrint->GetContext())->pluginList; - - // ¥Êset the encoding type -#ifdef PRE_JRM - sHTMLPrintout->fContext.fe.realContext->default_csid - = inViewToPrint->fHContext->fe.realContext->default_csid; -#endif - - XP_InitializePrintInfo((MWContext*)*(sHTMLPrintout->mContext)); - - sHTMLPrintout->mFinishedLayout = false; - sHTMLPrintout->mConnectionsCompleted = false; - sHTMLPrintout->mPrinted = false; - - // ¥ it's very important that mainLedge actually be enabled and - // not latent, otherwise controls that are printed do not - // behave properly - printHTMLView->SetPrintMode (CPrintHTMLView::epmBlockDisplay); - printHTMLView->Enable(); - printHTMLView->CopyCharacteristicsFrom(inViewToPrint); - - // ¥ go print - Try_ - { - URL_Struct *url; - Boolean doSuppressURL = false; - url = inViewToPrint->GetURLForPrinting( doSuppressURL, *(sHTMLPrintout->mContext) ); - if ( url ) - { - CPrintHeaderCaption::SetTemporaryFile( doSuppressURL ); - sHTMLPrintout->LoadPageForPrint( url, ((MWContext*)*(sHTMLPrintout->mContext)), (MWContext*)*inViewToPrint->GetContext()); - } - } - Catch_( err ) - { - Throw_( err ); - } - EndCatch_ -} // CHTMLPrintout::BeginPrint - -//----------------------------------- -void CHTMLPrintout::ListenToMessage( - MessageT inMessage, - void* /*ioParam*/) -//----------------------------------- -{ - CHTMLView *htmlView = ExtractHyperView (*mContext); - - switch (inMessage) { - case msg_NSCFinishedLayout: -// htmlView->NoteFinishedLayout(); (seems likely, but protected) - mFinishedLayout = true; - break; - case msg_NSCAllConnectionsComplete: - // for frames, don't do print stuff until all contexts are done -// htmlView->NoteAllConnectionsComplete(); - mConnectionsCompleted = !XP_IsContextBusy((MWContext*)*mContext); - break; - } - // the check for mPrinted is necessary; JavaScript will call FinishedLayout twice - if (mConnectionsCompleted && mFinishedLayout && !mPrinted) { - // lay out for printing - Paginate(); - DoPrintJob(); - -#if GENERATING68K - // ***** HACK ***** Fixed weird crash where 68K printer code - // spammed us with an invalid port -- a vivid example of why - // one should not have an invalid port. - WindowPtr front = FrontWindow(); - if (front) - SetPort(front); - else { - CGrafPtr windowMgrPort; - GetCWMgrPort(&windowMgrPort); - SetPort((GrafPtr)windowMgrPort); - } -#endif - - mPrinted = true; - } - mFinishedTime = LMGetTicks() + 600; // wait 10 seconds for Java to finish -} // CHTMLPrintout::ListenToMessage - -//====================================== -#pragma mark --- CPrintingCleanupTimer --- -//====================================== -/* CPrintingCleanupTimer gives periodic attention to sHTMLPrintout, waiting for it - to finish printing. When sMTMLPrintout claims it's finished, we delete it. - This is a (small) change in architecture: originally, sHTMLPrintout deleted itself - as soon as it was finished printing. I hacked in this timer thing to support - printing pages with JavaScript. - There's no good way to tell whether JavaScript has finished laying out a page. - Notably, a page containing JavaScript seems to always get two "finished layout" - messages. Before this timer thing was installed, the first such message caused - the page to be printed and deleted. The second such message brought the machine - down. Now we wait to delete the object until it stops getting messages from - layout. We define "stopped getting messages" as "haven't seen one in ten seconds." - This sucks, and will cause your machine to crash if a big delay happens for some - reason, but I'm led to believe JavaScript itself must be full of such things, - and can't come up with a better plan today. -*/ - -//----------------------------------- -// class definition -class CPrintingCleanupTimer : public LPeriodical { - -public: - CPrintingCleanupTimer(); - virtual void SpendTime(const EventRecord &inMacEvent); - static void QueueCleanup(void); - -private: - static CPrintingCleanupTimer sTheTimer; -}; - -//----------------------------------- -CPrintingCleanupTimer::CPrintingCleanupTimer() -// constructor: like the base class, but don't start repeating until told to -//----------------------------------- -{ - // when we're initialized at app load time, don't yet start asking for time - StopRepeating(); -} - -//----------------------------------- -void CPrintingCleanupTimer::QueueCleanup(void) -// public access to turn on the timer; call when an sHTMLPrintout has been allocated -//----------------------------------- -{ - sTheTimer.StartRepeating(); -} - -//----------------------------------- -void CPrintingCleanupTimer::SpendTime(const EventRecord &) -// internal workings of the timer: wait until sHTMLPrintout says it's finished, -// then delete it and shut yourself down -//----------------------------------- -{ - CHTMLPrintout *activePrintout = CHTMLPrintout::Get(); - - if (activePrintout && activePrintout->PrintFinished()) { - delete activePrintout; // which sets sHTMLPrintout to 0 */ - StopRepeating(); - } -} - -//----------------------------------- -CPrintingCleanupTimer CPrintingCleanupTimer::sTheTimer; - -//====================================== -#pragma mark --- UHTMLPrinting --- -//====================================== - -//----------------------------------- -void UHTMLPrinting::RegisterHTMLPrintClasses() -//----------------------------------- -{ -//#define REGISTER_(letter,root) \ -// RegisterClass_(letter##root::class_ID, \ -// (ClassCreatorFunc)letter##root::Create##root##Stream); - -#define REGISTER_(letter,root) RegisterClass_(letter##root); - -#define REGISTERC(root) REGISTER_(C,root) -#define REGISTERL(root) REGISTER_(L,root) - REGISTERC(HTMLPrintout) // 97/01/24 jrm - REGISTERC(PrintHTMLView) // 97/01/24 jrm - REGISTERC(PrintHeaderCaption) // 97/01/24 jrm -} // UHTMLPrinting::RegisterHTMLPrintClasses - -//----------------------------------- -void UHTMLPrinting::InitCustomPageSetup() -//----------------------------------- -{ - CCustomPageSetup::InitCustomPageSetup(); -} - -//----------------------------------- -void UHTMLPrinting::OpenPageSetup( THPrint hPrint ) -//----------------------------------- -{ - CCustomPageSetup::OpenPageSetup(hPrint); -} - -//----------------------------------- -void UHTMLPrinting::BeginPrint( THPrint hPrint, CHTMLView* inView ) -//----------------------------------- -{ - CPrintingCleanupTimer::QueueCleanup(); - CHTMLPrintout::BeginPrint(hPrint, inView); -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/central/mprint.h b/mozilla/cmd/macfe/central/mprint.h deleted file mode 100644 index f7575b41d1e..00000000000 --- a/mozilla/cmd/macfe/central/mprint.h +++ /dev/null @@ -1,36 +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. - */ - -#pragma once - -class CHTMLView; -typedef struct TPrint **THPrint; - -//====================================== -class UHTMLPrinting -//====================================== -{ -public: - static void RegisterHTMLPrintClasses(); - static void InitCustomPageSetup(); - static void OpenPageSetup( THPrint hPrint ); - static void BeginPrint( THPrint hp, CHTMLView* view ); -}; // class UHTMLPrinting - - -void EditorPrintingCallback( char *completeURL, void *data ); diff --git a/mozilla/cmd/macfe/central/msv2dsk.cp b/mozilla/cmd/macfe/central/msv2dsk.cp deleted file mode 100644 index 982a5fc4da7..00000000000 --- a/mozilla/cmd/macfe/central/msv2dsk.cp +++ /dev/null @@ -1,1038 +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. - */ - -// Macintosh front-end - -#include "msv2dsk.h" - -#include "earlmgr.h" -#include "macutil.h" -#include "uerrmgr.h" -#include "uprefd.h" -#include "ufilemgr.h" -#include "ulaunch.h" -#include "macutil.h" -#include "resgui.h" -#include "prefwutil.h" -#include "uapp.h" -#include "resae.h" - -#include "CNSContext.h" -#include "CDownloadProgressWindow.h" - - // Netscape -#include "merrors.h" -#include "xp_thrmo.h" -#include "mkutils.h" -#include "glhist.h" -#include "xlate.h" -#include "prefapi.h" - -#include "BufferStream.h" -#include "PascalString.h" - - // system -#include -#include "merrors.h" -#include "InternetConfig.h" - - -static Boolean GetMacFileTypesFromMimeHeader( const URL_Struct * fRequest, - OSType * fileCreator, - OSType * fileType ); - -static OSType TextToOSType( const char* text); - - - -extern int MK_DISK_FULL; - - - -extern CMimeMapper * CreateUnknownMimeTypeMapper (URL_Struct * request); -extern void GUI_PostAlertNoReply (const CStr255 & message); -extern OSErr GUI_AskForFileSpec (StandardFileReply & reply); - -/*------------------=---------------------------------------------------------- - External function so everyone can start a progress load without having - to include the full .h file ---------------------=--------------------------------------------------------*/ - -extern "C" void SaveAsCompletionProc( PrintSetup* p ); -extern "C" void SaveAsCompletionProc( PrintSetup* p ) -{ - XP_FileClose (p->out); - CNSContext* theContext = (CNSContext*)p->url->fe_data; - -// FIX ME!!! need to put this back in -// if (theContext != NULL) -// theContext->AllConnectionsComplete(); - - -} - -extern int MK_OUT_OF_MEMORY; - -int PROGRESS_GetUrl( - URL_Struct *, - int /*format_out*/, - const FSSpec * /*destination*/, - Boolean /*delayed*/) -{ -Assert_(false); // NO LONGER VALID -return 0; -} - - -/*----------------------------------------------------------------------------- - When we decide to do something with an url (such as save it to disk, print - it, mail it, etc), we sometimes have extra data which specializes the - action. Save-to-disk is the best example: a destination file. We need a - place to put it all. - - We have been putting this data in the context. This is a mistake because - the context is not specific to any particular url action, and multiple - requests will cause a race condition. - - The url struct is where it belongs, since this object is created at that - time (making it like MacApp's Command class). It has an fe_data field, - but we need to put *lots* of data there. Argh. - - Things go to disk when we launch an external viewer (click -> download in - normal context) or explicitly request a download (SAVE_AS, SAVE_TO_DISK, - VIEW_SOURCE, and Drag&Drop). - FO_PRESENT auto-launch external viewer (by normal click). - VIEW_SOURCE auto-launch with view source application - SAVE_TO_DISK prompt for location and save to disk - SAVE_AS prompt for location and save to disk - INTERNAL_IMAGE display internally. - Drag&Drop Variant of SAVE_TO_DISK - SAVE_ALL Save page & images. Like SAVE_AS. ------------------------------------------------------------------------------*/ - -class DownloadFilePipe: public Pipe -{ -public: - DownloadFilePipe ( - CNSContext* progressContext, - URL_Struct* request); - ~DownloadFilePipe (); - OSErr Open (); - int Write (const char *buffer, int len); - void Complete (); - void Abort (int reason); - - OSErr GetFileSpec (); - inline Boolean TranslateLinefeeds (); - Boolean LaunchWhenDone (); - CNSContext* mContext; - -protected: - URL_Struct * fRequest; - NET_StreamClass * fInput; -// fFile logic gets complicated. There are two questions: -// - where to create the file -// - when should the file object be deleted -// - when should the file be deleted -// The answers depend upon the stream: -// case FO_PRESENT: -// ask mapper for the registered viewer file spec. -// if we get these specs, registered viewer will handle the physical file deletion -// we need to delete the fFile object -// else, do the same as -// case FO_VIEW_SOURCE: -// register with the app, do not delete fFile yourself -// case FO_SAVE_AS: -// do not register, delete file object - - - LFileBufferStream * fFile; - Boolean fDeleteOnDestroy; // Should we delete the file object? - int fIntention; - CMimeMapper * fHandler; - Boolean fHasDestination; - FSSpec fDestination; - - OSErr GetSilentFileSpec(); - OSErr GetUserFileSpec(); - - friend NET_StreamClass * NewFilePipe (int format_out, void *registration, URL_Struct * request, MWContext *context); -}; - -static LArray DownloadList; // Keeps track of all downloads, so that we can see if we are interrupting any - -Boolean HasDownloads(MWContext * context) -{ - DownloadFilePipe * pipe; - LArrayIterator iter(DownloadList); - while (iter.Next(&pipe)) - { - MWContext* theContext = *(pipe->mContext); - if (theContext == context) - return true; - - } - return false; -} - -//-------------------------------------------------------------------------------- -// DownloadFilePipe -//-------------------------------------------------------------------------------- - -DownloadFilePipe::DownloadFilePipe ( - CNSContext* progressContext, - URL_Struct* request) -{ - mContext = progressContext; - mContext->AddUser(this); - - fRequest = request; - fInput = nil; - fFile = nil; - fIntention = -1; - - fHandler = nil; - fHasDestination = false; - fDeleteOnDestroy = true; - DownloadList.InsertItemsAt(1,1,&this); -} - - -DownloadFilePipe::~DownloadFilePipe () -{ - mContext->RemoveUser(this); - - if (fFile && fDeleteOnDestroy) - { - CFileMgr::sFileManager.CancelRegister(fFile); - delete fFile; - } - Int32 where = DownloadList.FetchIndexOf(&this); - DownloadList.RemoveItemsAt(1,where); -} - -OSErr DownloadFilePipe::GetSilentFileSpec() -{ - OSErr err; - //CStr31 defaultName = CFileMgr::FileNameFromURL( fRequest->address ); - CStr31 defaultName; - if( fRequest->content_name ) - { - char* fileName = XP_STRDUP ( fRequest->content_name ); - if ( fileName ) - SwapSlashColon( fileName ); - defaultName = fileName; - XP_FREEIF( fileName ); - } - else - defaultName = CFileMgr::FileNameFromURL( fRequest->address ) ; - - - FSSpec defaultFolder; - - defaultFolder = CPrefs::GetFilePrototype( CPrefs::DownloadFolder ); - err = CFileMgr::UniqueFileSpec( defaultFolder, defaultName, fDestination ); - if ( err ) - return err; - fDeleteOnDestroy = FALSE; - fHasDestination = TRUE; - return noErr; -} - -// Get specs from the user -OSErr DownloadFilePipe::GetUserFileSpec() -{ - OSErr err; - CStr31 defaultName; - if( fRequest->content_name ) - defaultName = fRequest->content_name; - else - defaultName = CFileMgr::FileNameFromURL( fRequest->address ) ; - - StandardFileReply reply; - - (CStr63&)reply.sfFile.name = defaultName; - err = GUI_AskForFileSpec( reply ); - - if ( err ) - return err; - - fDestination = reply.sfFile; - fHasDestination = TRUE; - fDeleteOnDestroy = TRUE; // do not delete automatically - - return noErr; -} - -// Obtain the location of where the stream should be downloaded to -OSErr DownloadFilePipe::GetFileSpec () -{ - OSErr err = noErr; - if (fHasDestination) - fDeleteOnDestroy = true; - else - { -// case FO_PRESENT: -// ask mapper for the registered viewer file spec. -// if we get these specs, registered viewer will handle the physical file deletion -// we need to delete the fFile object -// else, do the same as -// case FO_VIEW_SOURCE: -// register with the app, do not delete fFile yourself -// case FO_SAVE_AS: -// we should have the spec already, die otherwise - - switch (fIntention) { - case FO_PRESENT: - - - if (fHandler) - { - // See if the helper app is already running and - // has registered with us at runtime. If so, - // give it a chance to tell us where to put the file. - // - err = fHandler->GetFileSpec(fRequest, fDestination); - - // tj, with mourey and timm: - // - // This wasn't guarded by fHandler but we're sure it should be. - // We should only delete on destroy if the helper app has registered - // with us at runtime and tells us where to save the file. Otherwise, - // we need to prompt for the file name/location. - // - // This never used to be a problem because fHandler was never NULL. - // Now with support for mac type/creator from the mime header, fHandler - // may be NULL. - - if (err == noErr) - { - fDeleteOnDestroy = true; - break; - } - } - - if (LaunchWhenDone()) - err = GetSilentFileSpec(); - else - err = GetUserFileSpec(); - - break; - case FO_SAVE_AS: - err = GetUserFileSpec(); - break; - case FO_VIEW_SOURCE: - err = GetSilentFileSpec(); - break; - default: - Assert_(false); - } - } - if (err == noErr) // No error in creating the spec, make the stream - { - try - { - fFile = new LFileBufferStream (fDestination); - } - catch (OSErr err) - { - return err; - } - - fFile->DoUseBuffer(); - if (fRequest && fRequest->address) - fFile->SetURL(XP_STRDUP(fRequest->address)); - - if (fDeleteOnDestroy == false) // If we are not taking care of the file, file manager is - CFileMgr::sFileManager.RegisterFile(fFile); - } - return err; -} - -inline Boolean DownloadFilePipe::TranslateLinefeeds () -{ - return (fIntention == FO_VIEW_SOURCE); -} - -Boolean DownloadFilePipe::LaunchWhenDone () -{ -/* - For view source we always want to launch the viewer. - For saving HTML, don't launch it, just save. - For drag&drop, we want to launch Stuffit (for FTP convenience) but not - a text viewer, so text/html->false, the rest according to mime mapper -*/ - if (fIntention == FO_VIEW_SOURCE) - return true; - if (fIntention == FO_SAVE_AS) - return false; - if (strcmp(fRequest->content_type, "text/html") == 0) // LAM need entry for text/html! - return false; - - if (fHandler != NULL) - return fHandler->GetLoadAction() == CMimeMapper::Launch; - else - return false; -} - - -OSErr DownloadFilePipe::Open () -{ -/* - If this is a drag&drop or SAVE_AS then we already have a filespec. - If the helper application is set to "launch" then we automatically - choose a filespec. Otherwise we have to ask. -*/ - OSErr err; - cstring appName = "\0"; // app that can open the attachment - CMimeMapper * mapper = nil; // mime-type -> mac-type mapper - OSType fileType = 0; // mac file type of the attachment - OSType fileCreator = 0; // mac creator type of the attachment - - - // - // Figure out the appropriate file type and creator - // - - if (fIntention == FO_VIEW_SOURCE || strcmp(fRequest->content_type,"text/html") == 0) - mapper = CPrefs::sMimeTypes.FindMimeType (CMimeList::HTMLViewer); - - if (mapper == NULL) - { - // - // If we have content of application/octet-stream, look for the mac file type - // and creator in the URL struct (from the mime header). - // - // If we find valid mac file type/creator data, or if the content_type - // isn't octet-stream, then we attempt content_type -> mime-type mapping - // - // MIME content types are case insensitive - if ( (XP_STRCASECMP(fRequest->content_type, APPLICATION_OCTET_STREAM) != 0) || - !GetMacFileTypesFromMimeHeader(fRequest, &fileCreator, &fileType) ) - { - mapper = CPrefs::sMimeTypes.FindMimeType (fRequest->content_type); - - if (mapper && mapper->GetLoadAction() == CMimeMapper::Unknown) - { - // - // If they specified "Unknown" in the prefs, then we have an existing - // mapper that tells us this fact. To know how to handle the stream - // this time, we need to ask them what to do and create a new mapper. - // - mapper = CreateUnknownMimeTypeMapper (fRequest); - if (!mapper) - return userCanceledErr; - } - else if (mapper == NULL) - { - if (!GetMacFileTypesFromMimeHeader(fRequest, &fileCreator, &fileType)) - { - // TRY IC - - // Time to call IC to see if it knows anything - ICMapEntry ICMapper; - - ICError error = 0; - CStr255 saveName; - if( fRequest->content_name ) - { - char* fileName = XP_STRDUP ( fRequest->content_name ); - if ( fileName ) - SwapSlashColon( fileName ); - saveName = fileName; - XP_FREEIF( fileName ); - } - else - saveName = CFileMgr::FileNameFromURL( fRequest->address ) ; - - error = CInternetConfigInterface::MapFileName( saveName , &ICMapper ); - - if( error != icPrefNotFoundErr && StrLength(ICMapper.MIME_type) ) - { - fileCreator = ICMapper.file_creator; - fileType = ICMapper.file_type; - } - else - { - if (fIntention != FO_SAVE_AS) - { - mapper = CreateUnknownMimeTypeMapper (fRequest); - if (!mapper) - return userCanceledErr; - } - else - { - fileType = 'TEXT'; - fileCreator = emSignature; - } - } - } - } - } - } - - // - // If fHandler is NULL, then fileType and fileCreator have been set - // from the mime header via GetMacFileTypesFromMimeHeader. - // - // When fHandler is NULL, appName will be empty because we're not - // doing anything further to match the file to its application - // - fHandler = mapper; - if (fHandler != NULL) - { - fileCreator = fHandler->GetAppSig(); - fileType = fHandler->GetDocType(); - appName = fHandler->GetAppName(); - - OSType headerCreator, headerType; - - // if the file creator is the same as the one suggested by the mime mapper - // use the macheader to determine file type. - if( GetMacFileTypesFromMimeHeader(fRequest, &headerCreator, &headerType) ) - { - if( headerCreator == fileCreator ) - { - fileType = headerType; - } - } - } - - // Additional little hack to make sure if we've got a text/html type file and we're supposed - // to view it internally we set it to our creator code - if (strcmp(fRequest->content_type,"text/html") == 0 && - mapper->GetLoadAction() == CMimeMapper::Internal) - { - fileType = 'TEXT'; - fileCreator = emSignature; - } - - Assert_(fileCreator != (OSType) 0 && fileType != (OSType) 0); - - - // - // Figure out the appropriate file type and creator - // - - err = GetFileSpec (); - if (err) - return err; - // Make a file object, file stream, and stream buffer. - Try_ - { - // Open an existing file before creating because for drag&drop we will have - // created a Bookmark file as a placeholder. For all other cases, we have - // a unique filespec. - fFile->OpenDataFork (fsRdWrPerm); - err = CFileMgr::SetFileTypeCreator(fileCreator, fileType, &fDestination); - ThrowIfOSErr_ (err); - } - Catch_ (openErr) - { - if (openErr == fnfErr) { - fFile->CreateNewDataFile (fileCreator, fileType, smSystemScript); - fFile->OpenDataFork (fsRdWrPerm); - } - else - Throw_ (openErr); - } - EndCatch_ - - if (fFile && fRequest && fRequest->address) - { - FSSpec macSpec; - fFile->GetSpecifier(macSpec); - CFileMgr::FileSetComment (macSpec, CStr255(fRequest->address)); - } - CStr255 message; - StringHandle messageHdl = ::GetString(SAVE_QUOTE_RESID); - - if(messageHdl && *messageHdl) { - ::HLock((Handle) messageHdl); - CopyString((unsigned char *) message, (const unsigned char *) *messageHdl); - ::HUnlock((Handle) messageHdl); - } - message += CStr255(fDestination.name); - message += "\""; - - CContextProgress* theProgress = mContext->GetCurrentProgressStats(); - Assert_(theProgress != NULL); - StSharer theShareLock(theProgress); - - theProgress->mAction = message; - - if (LaunchWhenDone()) { - - messageHdl = ::GetString(WILL_OPEN_WITH_RESID); - if(messageHdl && *messageHdl) { - ::HLock((Handle) messageHdl); - CopyString((unsigned char *) message, (const unsigned char *) *messageHdl); - ::HUnlock((Handle) messageHdl); - } - message += appName; - message += GetCString(WILL_OPEN_TERM_RESID); - } - else { - message = ""; - messageHdl = ::GetString(SAVE_AS_A_RESID); - if(messageHdl && *messageHdl) { - ::HLock((Handle) messageHdl); - CopyString((unsigned char *) message, (const unsigned char *) *messageHdl); - ::HUnlock((Handle) messageHdl); - } - message += appName; - message += GetCString(FILE_RESID); - } - - theProgress->mComment = message; - mContext->UpdateCurrentProgressStats(); - - if( fRequest->server_can_do_byteranges || fRequest->server_can_do_restart ) - fRequest->must_cache = TRUE; - - return noErr; -} - -int -DownloadFilePipe::Write (const char *buffer, int len) -{ - int written = 0; - Try_ - { - if (TranslateLinefeeds()) { - for (int i = 0; i < len; i++) { - char c = buffer[i]; - if (c == LF) - c = CR; - fFile->WriteData (&c, 1); - } - written = len; - } - else - written = fFile->WriteData (buffer, len); - } - Catch_ (writeErr) - { - CStr255 message = (const char*) GetCString(COULD_NOT_SAVE_RESID); - message += CStr63(fDestination.name); - if (writeErr == dskFulErr) - message += CStr255((const char*)GetCString(DISK_FULL_RESID)); - else - message += CStr255((const char*)GetCString(DISK_ERR_RESID)); - ErrorManager::PlainAlert(message); - return MK_DISK_FULL; - } - EndCatch_ - - return written; -} - -// Close the file -// Launch the helper application if necessary -void DownloadFilePipe::Complete () -{ - if (fRequest) - GH_UpdateGlobalHistory(fRequest); - if (fFile) - Try_ - { - fFile->CloseDataFork(); - CFileMgr::UpdateFinderDisplay(fDestination); - } - Catch_(inErr){} - EndCatch_ - - NET_RemoveURLFromCache(fRequest); - NET_RemoveDiskCacheObjects(0); - - Try_ - { - if (LaunchWhenDone() && fHandler && fFile) - -// fHandler->LaunchFile(fFile, fRequest, fCppContext->GetContextUniqueID()); -// FIX ME!!! we need to implement the unique ID stuff in the CNSContext - fHandler->LaunchFile(fFile, fRequest, 69); - } - Catch_(inErr){} - EndCatch_ -} - -void DownloadFilePipe::Abort (int /*reason*/) -{ - if (fFile) - { - Try_ - { - fFile->CloseDataFork(); - } - Catch_(inErr) - {} - EndCatch_ - FSSpec fileSpec; - fFile->GetSpecifier (fileSpec); - FSpDelete (&fileSpec); - } - fDeleteOnDestroy = true; -} - -/*----------------------------------------------------------------------------- - C++ URL Streams - - Streams are responsible for reading data in to memory/disk - They will also get "hinting" information and be responsible for - ultimately deciding where to direct the data. - - display_converter and Pipe::Handle* are called from C code. They cannot - pass any exceptions up. ------------------------------------------------------------------------------*/ - -int Pipe::HandleProcess (NET_StreamClass *stream, const char *buffer, int32 buffLen) -{ - void *streamData=stream->data_object; - volatile int result = -1; - Try_ { - Pipe *self = (Pipe*) streamData; - result = self->Write (buffer, buffLen); - } - Catch_ (err) { - XP_TRACE(("*** Caught an error (%i) in Pipe::HandleProcess", err)); - result = -1; - } - EndCatch_ - return result; -} - -void Pipe::HandleComplete (NET_StreamClass *stream) -{ - void *streamData=stream->data_object; - Try_ { - Pipe *self = (Pipe*) streamData; - self->Complete (); - delete self; - } - Catch_ (err) { - XP_TRACE(("*** Caught an error (%i) in Pipe::HandleComplete but can't return it", err)); - } - EndCatch_ -} - -void Pipe::HandleAbort (NET_StreamClass *stream, int reason) -{ - void *streamData=stream->data_object; - Try_ { - XP_TRACE(("*** HandleAbort %i", reason)); - Pipe *self = (Pipe*) streamData; - self->Abort (reason); - delete self; - } - Catch_ (err) { - XP_TRACE(("*** Caught an error (%i) in Pipe::HandleAbort but can't return it", err)); - } - EndCatch_ -} - -unsigned int Pipe::HandleWriteReady (NET_StreamClass * /*stream*/) -{ - return 32765; -} - -// -// -// - -OSErr -Pipe::Open () -{ - return noErr; -} - -int -Pipe::Write (const char */*buffer*/, int buffLen) -{ - return buffLen; -} - -void -Pipe::Complete () -{ -} - -void -Pipe::Abort (int /*reason*/) -{ -} - -// -// api -// - -NET_StreamClass * -Pipe::MakeStreamObject (char * name, MWContext * context) -{ - NET_StreamClass * stream = NET_NewStream ( - name, - Pipe::HandleProcess, - Pipe::HandleComplete, - Pipe::HandleAbort, - Pipe::HandleWriteReady, - this, - context); - return stream; -} - -// -// Construction & Stuff -// - -Pipe::Pipe () -{ -} - -Pipe::~Pipe () -{ -} - - -CMimeMapper * CreateUnknownMimeTypeMapper(URL_Struct * request); -// After receiving the request for unknown mime type, this routine is called -// to create a mapper for an unknown MIME type -CMimeMapper* CreateUnknownMimeTypeMapper( URL_Struct* request ) -{ - CStr255 fileName; - CStr255 content_type; - CStr31 newName; - int result; - CMimeMapper* mapper = NULL; - - if (!ErrorManager::TryToInteract(900)) - return NULL; - // Notify the user with nice names - newName = CFileMgr::FileNameFromURL( request->address ); - fileName = newName; - content_type = request->content_type; - - ::ParamText( newName, content_type, CStr255::sEmptyString, CStr255::sEmptyString ); - - UDesktop::Deactivate(); - result = ::CautionAlert( ALRT_UnknownMimeType, NULL ); - UDesktop::Activate(); - - // What does user want? - switch ( result ) - { - case ALRT_UnknownMimeType_Cancel: - return NULL; - case ALRT_UnknownMimeType_Save: - mapper = CPrefs::CreateDefaultUnknownMapper( request->content_type, TRUE ); - mapper->SetLoadAction( CMimeMapper::Save ); - return mapper; - case ALRT_UnknownMimeType_PickApp: - StandardFileReply reply; - CFilePicker::DoCustomGetFile( reply, CFilePicker::Applications, FALSE ); - if ( reply.sfGood ) - mapper = CPrefs::CreateDefaultAppMapper( reply.sfFile, request->content_type, TRUE ); - return mapper; - case ALRT_UnknownMimeType_MoreInfo: - { - char* string; - if (PREF_CopyConfigString("internal_url.more_info_plugin.url", &string) != PREF_NOERROR) - return NULL; - - cstring url; - url = (const char*) string; // cstringÕs operator= expects unsigned char* to be a P string, so we have to cast - url += "?"; - url += request->content_type; - - AppleEvent getURLEvent; - UAppleEventsMgr::MakeAppleEvent( AE_url_suite, AE_url_getURL, getURLEvent ); - - OSErr err = ::AEPutParamPtr( &getURLEvent, keyDirectObject, typeChar, url.data(), strlen(url.data()) ); - - if ( err == noErr ) - err = ::AEPutParamPtr( &getURLEvent, AE_url_getURLname, typeChar, url.data(), strlen(url.data()) ); - - if ( err == noErr ) - UAppleEventsMgr::SendAppleEvent (getURLEvent ); - - return NULL; - } - default: - return NULL; - } - return NULL; -} - -NET_StreamClass * NewFilePipe ( - int format_out, - void * /*registration*/, - URL_Struct * request, - MWContext* context) -{ - CNSContext* theContext = ExtractNSContext(context); - Assert_(theContext != NULL); - - GH_UpdateGlobalHistory(request); - - // 97-06-15 pkc -- We really should make a function to determine if a URL is a - // mail attachment instead of duplicating this code. - const char* urlAddress = request ? request->address : nil; - Boolean isMailMessage = false; - if (urlAddress) - { - // check to see if this is a mail or news messages - if (!strncasecomp (urlAddress, "mailbox:", 8) || !strncasecomp (urlAddress, "news:", 5) - || !strncasecomp (urlAddress, "IMAP:", 5) ) - { - { - // this is a mail message - isMailMessage = true; - } - } - } - - // 97-06-15 pkc -- The bug is that when you close the browser - // window for the mail message, the MimeObject* in the context is freed. That pointer is also - // referenced somewhere else and used by libnet. Whoops. So, since we're trying to ship, don't - // spawn a seperate progress context for mail messages. - // 97-08-15 sdagley - Removing check for theContext->IsCloneRequired() as it won't be set to true - // in frames which is the cause of bug #75288. The alternative fix is to change the CNSContext constructors - // to initialize mRequiresClone to true instead of the current default of false. - if (/*theContext->IsCloneRequired() &&*/ !isMailMessage) - { - CNSContext* theProgressContext = NULL; - CDownloadProgressWindow* theProgressWindow = NULL; - try - { - theProgressContext = new CNSContext(*theContext); - StSharer theShareLock(theProgressContext); - - // 97-06-12 pkc -- Move call to NET_SetNewContext here so that if it fails - // (which can happen if mocha calls us) we still use context - if(NET_SetNewContext(request, *theProgressContext, EarlManager::DispatchFinishLoadURL) == 0) - theContext = theProgressContext; - - theProgressWindow = dynamic_cast(LWindow::CreateWindow(WIND_DownloadProgress, LCommander::GetTopCommander())); - ThrowIfNULL_(theProgressWindow); - theProgressWindow->Show(); - -// theProgressWindow->SetWindowContext(theProgressContext); - theProgressWindow->SetWindowContext(theContext); - // the window will be shown upon progress initialization - - } - catch(...) - { - delete theProgressWindow; - return NULL; - } - } - - DownloadFilePipe* thePipe = NULL; - NET_StreamClass* theStream = NULL; - - try - { - // 97-06-05 pkc -- if theContext doesn't have ContextProgress, make one now - if (!theContext->GetContextProgress()) - theContext->EnsureContextProgress(); - thePipe = new DownloadFilePipe(theContext, request); - - thePipe->fIntention = CLEAR_CACHE_BIT(format_out); - if (request->fe_data) - { - thePipe->fDestination = *(FSSpec*)request->fe_data; - thePipe->fHasDestination = true; - XP_FREE(request->fe_data); - } - - OSErr theErr = thePipe->Open(); - ThrowIfOSErr_(theErr); - - theStream = thePipe->MakeStreamObject("Download File", *theContext); - thePipe->fInput = theStream; - } - catch (...) - { - if (thePipe != NULL) - thePipe->Abort (-1); - delete thePipe; - - XP_DELETE(theStream); - theStream = NULL; - } - - return theStream; -} - - -// -// Snarf the mac file type and creator out of the mime header. -// -// Returns true if valid data is found, false if not. -// -static Boolean -GetMacFileTypesFromMimeHeader( const URL_Struct * fRequest, - OSType * fileCreator, - OSType * fileType ) -{ - *fileCreator = 0; - *fileType = 0; - - Assert_(fRequest != NULL); - - if ( fRequest->x_mac_creator == NULL || - fRequest->x_mac_type == NULL ) - { - return false; - } - - *fileCreator = TextToOSType(fRequest->x_mac_creator); - *fileType = TextToOSType(fRequest->x_mac_type); - - return (*fileCreator != 0 && *fileType != 0); -} - - -static OSType -TextToOSType( const char* text) -{ - OSType result = 0; - UInt32 len; - - // - // If the text is 4-characters long, we treat it - // as a raw OSType. - // - // If it is 8-characters, it is hex-encoded. - // - // If it's not 4 or 8, we return 0; - // - - len = strlen(text); - - if (len == 4) - result = * ((OSType *) text); - else - if (len == 8) - sscanf(text, "%lx", &result); - - return result; -} - - - - diff --git a/mozilla/cmd/macfe/central/msv2dsk.h b/mozilla/cmd/macfe/central/msv2dsk.h deleted file mode 100644 index ab30f27aa44..00000000000 --- a/mozilla/cmd/macfe/central/msv2dsk.h +++ /dev/null @@ -1,159 +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. - */ - -#pragma once -/*============================================================================= - Save-To-Disk Context - - We create a context for saving items to disk and display a - small status window for progress. -=============================================================================*/ -#include "client.h" - -// class NetscapeContext; -class CNSContext; - -class CMimeMapper; -class LFileStream; -struct CStr255; - -int PROGRESS_GetUrl (URL_Struct * request, - int format_out, - const FSSpec * destination, - Boolean delayed = FALSE); - -// Are there any load-to-disk downloads happening for this context -// Call this before loading the URL if you do not want to interrupt the download -Boolean HasDownloads(MWContext * context); - -/*----------------------------------------------------------------------------- - Pipes - These are a set of classes for implementing converters which write - data to disk. ------------------------------------------------------------------------------*/ - -class Pipe { -public: - Pipe (); - virtual ~Pipe (); - - // base stream functions - virtual OSErr Open (); - virtual int Write (const char *buffer, int len); - virtual void Complete (); - virtual void Abort (int reason); - - // utilities - NET_StreamClass * MakeStreamObject (char * name, MWContext * context); - -private: - // dispatch functions to our stream (for "C" NetLib) - static int HandleProcess (NET_StreamClass *stream, const char *buffer, - int32 buffLen); - static void HandleComplete (NET_StreamClass *stream); - static void HandleAbort (NET_StreamClass *stream, int reason); - static unsigned int HandleWriteReady(NET_StreamClass *stream); -}; - -extern NET_StreamClass * -NewFilePipe (int format_out, void *registration, URL_Struct * request, MWContext *context); - - -// NewExternal is the stream that handles FO_PRESENT of the types -// that are not displayed internally -static NET_StreamClass *NewExternalPipe (int format_out, - void *registration, - URL_Struct *url, - MWContext *context); - -// NewExternal is the stream that handles FO_VIEW_SOURCE streams -// Fires up an application tied to Source mime type -static NET_StreamClass *NewSourcePipe (int format_out, - void *registration, - URL_Struct *url, - MWContext *context); - -// NewLoadToDiskPipe writes incoming data to disk -static NET_StreamClass *NewLoadToDiskPipe (int format_out, - void *registration, - URL_Struct *url, - MWContext *context); - -NET_StreamClass *NewSaveAsPipe (int format_out, - void *registration, - URL_Struct *request, - MWContext *context); - -class PlainFilePipe: public Pipe -{ - public: - PlainFilePipe(); - PlainFilePipe( - OSType creator, - OSType fileType, - URL_Struct* url, - CNSContext* inContext = NULL); - - PlainFilePipe( - OSType creator, - OSType fileType, - FSSpec& writeTo, - CNSContext* inContext = NULL); - - virtual ~PlainFilePipe(); -// ¥¥ stream interface - OSErr Open (); - int Write (const char *buffer, int buffLen); - void Complete (); - void Abort (int reason); -// ¥¥ misc - void SetTranslateLF(Boolean doTranslate); // Should we do linefeed translation -protected: - LFileStream * fFile; // It will be deleted by CFileMgr - Boolean fDeleteFileObj; // Should we delete the file object? -// Disk flushing routines - int fBytesWritten; // We have an interactivity problem with - // hard drives and Mac's disk cache. If system file cache is large, flushing of - // the large file buffer can result in a hang, and cause TCP connection to drop - // So, we flush the file every 32K. Should make flush async one day - CNSContext* mContext; - Int32 fTotalBytes; - Int32 fTotalWritten; - Boolean fTranslateLF; // For ViewSource, we want to translate the LF to CR. FALSE by default -}; - -/*************************************************************************************** - * MapperFilePipe - * file is specified by the mime mapper - ***************************************************************************************/ -class MapperFilePipe: public PlainFilePipe -{ - public: - MapperFilePipe( - URL_Struct* url, - CMimeMapper* mapper, - CNSContext* inContext = NULL); - - ~MapperFilePipe (); - static FSSpec MakeSpec (CStr255& filename); - void Complete (); - - private: - CMimeMapper * fMapper; // Mapper for this file -}; - diff --git a/mozilla/cmd/macfe/central/prefw.cp b/mozilla/cmd/macfe/central/prefw.cp deleted file mode 100644 index 0778f5b5e0c..00000000000 --- a/mozilla/cmd/macfe/central/prefw.cp +++ /dev/null @@ -1,93 +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. - */ - -// prefw.cp -// Preferences dialog box -// Contains all the views/commands for the preferences dialog box -// Created by atotic, July 30th, 1994 - -#include "prefw.h" - -#include "InternetConfig.h" -#include "CPrefsDialog.h" - -//----------------------------------- -void FE_EditPreference( PREF_Enum which ) -//----------------------------------- -{ - if (CInternetConfigInterface::CurrentlyUsingIC()) - { - switch ( which ) - { - case PREF_EmailAddress: - CInternetConfigInterface::LaunchInternetConfigApplication(kICEmail); - break; - #ifdef MOZ_MAIL_NEWS - case PREF_Pop3ID: - CInternetConfigInterface::LaunchInternetConfigApplication(kICMailAccount); - break; - case PREF_SMTPHost: - CInternetConfigInterface::LaunchInternetConfigApplication(kICSMTPHost); - break; - case PREF_PopHost: - CInternetConfigInterface::LaunchInternetConfigApplication(kICMailAccount); - break; - case PREF_NewsHost: - CInternetConfigInterface::LaunchInternetConfigApplication(kICNNTPHost); - break; - #endif // MOZ_MAIL_NEWS - default: - XP_ASSERT(FALSE); - } - } - else - { - switch ( which ) - { - case PREF_EmailAddress: - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandMailNews, - PrefPaneID::eMailNews_Identity, - CPrefsDialog::eEmailAddress); - break; - #ifdef MOZ_MAIL_NEWS - case PREF_Pop3ID: - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandMailNews, - PrefPaneID::eMailNews_MailServer, - CPrefsDialog::ePOPUserID); - break; - case PREF_SMTPHost: - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandMailNews, - PrefPaneID::eMailNews_MailServer, - CPrefsDialog::eSMTPHost); - break; - case PREF_PopHost: - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandMailNews, - PrefPaneID::eMailNews_MailServer, - CPrefsDialog::ePOPHost); - break; - case PREF_NewsHost: - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandMailNews, - PrefPaneID::eMailNews_NewsServer, - CPrefsDialog::eNewsHost); - break; - #endif // MOZ_MAIL_NEWS - default: - XP_ASSERT(FALSE); - } - } -} diff --git a/mozilla/cmd/macfe/central/prefw.h b/mozilla/cmd/macfe/central/prefw.h deleted file mode 100644 index 9195e8039bf..00000000000 --- a/mozilla/cmd/macfe/central/prefw.h +++ /dev/null @@ -1,23 +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. - */ - -#pragma once - -#include "fe_proto.h" - -void FE_EditPreference( PREF_Enum which ); diff --git a/mozilla/cmd/macfe/central/prefwutil.cp b/mozilla/cmd/macfe/central/prefwutil.cp deleted file mode 100644 index 630c75211c0..00000000000 --- a/mozilla/cmd/macfe/central/prefwutil.cp +++ /dev/null @@ -1,1572 +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. - */ - -#include "prefwutil.h" - -#include "resgui.h" -#include "uprefd.h" -#include "macutil.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "xp_mem.h" -#include "macgui.h" -#include "COffscreenCaption.h" - -Boolean CFilePicker::sResult = FALSE; -Boolean CFilePicker::sUseDefault = FALSE; // Use default directory -CStr255 CFilePicker::sPrevName; - -CFilePicker::CFilePicker( LStream* inStream ): LView( inStream ) -{ - // WARNING: if you add any streamable data here (because you're making a new custom - // Cppb in constructor) you will clobber CPrefFilePicker, which inherits from - // this class. So beware! - fCurrentValue.vRefNum = 0; - fCurrentValue.parID = 0; - fCurrentValue.name[ 0 ] = 0; - fSet = FALSE; - fBrowseButton = NULL; - fPathName = NULL; - fPickTypes = Applications; -} - -void CFilePicker::FinishCreateSelf() -{ - ThrowIfNil_(fBrowseButton = dynamic_cast(FindPaneByID(kBrowseButton))); - ThrowIfNil_(fPathName = dynamic_cast(FindPaneByID(kPathNameCaption))); - - fBrowseButton->SetValueMessage(msg_Browse); - fBrowseButton->AddListener(this); -} - -void CFilePicker::SetFSSpec( const FSSpec& fileSpec, Boolean touchSetFlag ) -{ - if (touchSetFlag) - fSet = TRUE; - fCurrentValue = fileSpec; - - SetCaptionForPath( fPathName, fileSpec ); - BroadcastMessage( msg_FolderChanged, this ); -} - -void CFilePicker::ListenToMessage( MessageT inMessage, void* /*ioParam*/ ) -{ - StandardFileReply reply; - FSSpec currentValue; - - currentValue = GetFSSpec(); - reply.sfFile = currentValue; - - if ( inMessage == msg_Browse ) - { - switch ( fPickTypes ) - { - case MailFiles: - reply.sfFile = CPrefs::GetFilePrototype( CPrefs::MailFolder ); - case AnyFile: - case Folders: - case TextFiles: - case ImageFiles: - case Applications: - { - // ¥ pose the dialog and get the users new choice - if ( CFilePicker::DoCustomGetFile( reply, fPickTypes, TRUE ) ) - SetFSSpec( reply.sfFile ); - } - break; - } - } -} - -void CFilePicker::SetCaptionForPath( LCaption* captionToSet, const FSSpec& folderSpec ) -{ - CStr255 pathName = FSSpecToPathName( folderSpec ); - SetCaptionDescriptor( captionToSet, pathName, smTruncMiddle ); -} - -CStr255 CFilePicker::FSSpecToPathName( const FSSpec& spec ) -{ - char* pPathName = CFileMgr::PathNameFromFSSpec( spec, true ); - if ( pPathName == NULL && fPickTypes == Applications ) - { - CStr255 badName(spec.name); - ErrorManager::PlainAlert - ( (char *)GetCString(BAD_APP_LOCATION_RESID), badName, - (char *)GetCString(REBUILD_DESKTOP_RESID), NULL ); - return badName; - } - CStr255 cPathName(pPathName); - XP_FREE( pPathName ); - return cPathName; -} - -void CFilePicker::SetButtonTitle( Handle buttonHdl, CStr255& name, const Rect& buttonRect ) -{ - short result; // - short width; // - - sPrevName = name; - - CStr255 finalString(::GetCString(SELECT_RESID)); - - width = ( buttonRect.right - buttonRect.left ) - - ( StringWidth( finalString ) + 2 * CharWidth( 'Ê' ) ); - - result = ::TruncString( width, name, smTruncMiddle ); - - finalString += name; - SetControlTitle( (ControlHandle)(buttonHdl), finalString ); - ValidRect( &buttonRect ); -} - -#define kIsFolderFlag 0x10 // flag indicating the file is a directory. -#define kInvisibleFlag 0x4000 // flag indicating that the file is invisible. - -#define kGetDirButton 10 -#define kDefaultButton 12 - -PROCEDURE( CFilePicker::OnlyFoldersFileFilter, uppFileFilterYDProcInfo ) -pascal Boolean CFilePicker::OnlyFoldersFileFilter( CInfoPBPtr pBlock, void* /*data*/ ) -{ - Boolean isFolder; - Boolean isInvisible; - Boolean dontShow; - - isFolder = ((pBlock->hFileInfo).ioFlAttrib) & kIsFolderFlag; - isInvisible = ((pBlock->dirInfo).ioDrUsrWds.frFlags) & kInvisibleFlag; - dontShow = !isFolder || isInvisible; - - return dontShow; -} - -PROCEDURE( CFilePicker::IsMailFileFilter, uppFileFilterYDProcInfo ) -pascal Boolean CFilePicker::IsMailFileFilter( CInfoPBPtr pBlock, void* /*data*/ ) -{ - Boolean isEudora; - Boolean isMine; - Boolean dontShow; - - isMine = ( pBlock->hFileInfo).ioFlFndrInfo.fdCreator == emSignature; - isEudora = ( pBlock->hFileInfo).ioFlFndrInfo.fdCreator == 'CSOm'; - dontShow = !isMine && !isEudora; - - return dontShow; -} - -PROCEDURE( CFilePicker::SetCurrDirHook, uppDlgHookYDProcInfo ) -pascal short CFilePicker::SetCurrDirHook( short item, DialogPtr /*dialog*/, void* /*data*/ ) -{ - if ( item == sfHookFirstCall ) - return sfHookChangeSelection; - return item; -} - -PROCEDURE( CFilePicker::DirectoryHook, uppDlgHookYDProcInfo ) -pascal short CFilePicker::DirectoryHook( short item, DialogPtr dialog, void* data ) -{ - short type; // menu item selected - Handle handle; // needed for GetDialogItem - Rect rect; // needed for GetDialogItem - - CStr255 tempName = sPrevName; - CStr255 name; - - CInfoPBRec pb; - StandardFileReply* sfrPtr; - OSErr err; - short returnVal; - - // ¥ default, except in special cases below - returnVal = item; - - // ¥ this function is only for main dialog box - if ( GetWRefCon((WindowPtr)dialog ) != sfMainDialogRefCon ) - return returnVal; - - DirInfo* dipb = (DirInfo*)&pb; - // ¥ get sfrPtr from 3rd parameter to hook function - sfrPtr = (StandardFileReply*)((PickClosure*)data)->reply; - - GetDialogItem( dialog, kGetDirButton, &type, &handle, &rect ); - - if ( item == sfHookFirstCall ) - { - // ¥ determine current folder name and set title of Select button - dipb->ioCompletion = NULL; - dipb->ioNamePtr = (StringPtr)&tempName; - dipb->ioVRefNum = sfrPtr->sfFile.vRefNum; - dipb->ioDrDirID = sfrPtr->sfFile.parID; - dipb->ioFDirIndex = - 1; - err = PBGetCatInfoSync(&pb); - name = tempName; - CFilePicker::SetButtonTitle( handle, name, rect ); - - return sfHookChangeSelection; - } - else - { - // ¥ track name of folder that can be selected - // (also allow selection of folder aliases) - if ( ( sfrPtr->sfIsFolder) || ( sfrPtr->sfIsVolume) || - ((sfrPtr->sfFlags & kIsAlias) && (sfrPtr->sfType == kContainerFolderAliasType)) ) - name = sfrPtr->sfFile.name; - else - { - dipb->ioCompletion = NULL; - dipb->ioNamePtr = (StringPtr)&tempName; - dipb->ioVRefNum = sfrPtr->sfFile.vRefNum; - dipb->ioFDirIndex = -1; - dipb->ioDrDirID = sfrPtr->sfFile.parID; - err = PBGetCatInfoSync(&pb); - name = tempName; - } - - // ¥ change directory name in button title as needed - if ( name != sPrevName ) - CFilePicker::SetButtonTitle( handle, name, rect ); - - switch ( item ) - { - // ¥ force return by faking a cancel - case kGetDirButton: - sResult = TRUE; - returnVal = sfItemCancelButton; - break; - - // ¥ use default directory - case kDefaultButton: - sUseDefault = TRUE; - returnVal = sfItemCancelButton; - break; - - // ¥ flag no directory was selected - case sfItemCancelButton: - sResult = FALSE; - break; - - default: - break; - } - } - return returnVal; -} - -Boolean CFilePicker::DoCustomGetFile( StandardFileReply& reply, - CFilePicker::PickEnum pickTypes, Boolean isInited ) -{ - Point loc = { -1, -1 }; - OSErr gesErr; - long gesResponse; - FileFilterYDUPP filter = NULL; - DlgHookYDUPP dialogHook; - short dlogID = 0; - OSType types[ 4 ]; - OSType* typeP; - short typeCount = -1; - Boolean* resultP = &reply.sfGood; - Boolean wantPreview = FALSE; - PickClosure closure; - - reply.sfIsVolume = 0; - reply.sfIsFolder = 0; - reply.sfFlags = 0; - reply.sfScript = smSystemScript; - reply.sfGood = FALSE; - closure.reply = &reply; - closure.inited = isInited; - typeP = types; - - if ( isInited ) - dialogHook = &PROCPTR( SetCurrDirHook ); - else - dialogHook = NULL; - - // ¥Êinitialize name of previous selection - sPrevName = reply.sfFile.name; - - StPrepareForDialog preparer; - gesErr = Gestalt( gestaltStandardFileAttr, &gesResponse ); - if ( gesResponse & ( 1L << gestaltStandardFile58 ) ) - { - switch ( pickTypes ) - { - case Folders: - { - filter = &PROCPTR( OnlyFoldersFileFilter ); - dlogID = DLOG_GETFOLDER; - dialogHook = &PROCPTR( DirectoryHook ); - resultP = &sResult; - typeP = NULL; - } - break; - - case AnyFile: - { - typeP = NULL; - } - break; - - case MailFiles: - { - filter = &PROCPTR( IsMailFileFilter ); - types[ 0 ] = 'TEXT'; - typeCount = 1; - } - break; - - case TextFiles: - { - types[ 0 ] = 'TEXT'; - typeCount = 1; - } - break; - - case ImageFiles: - { - types[ 0 ] = 'GIFf'; - types[ 1 ] = 'TEXT'; - types[ 2 ] = 'JPEG'; - typeCount = 3; - wantPreview = TRUE; - } - break; - - case Applications: - { - types[0] = 'APPL'; - types[1] = 'adrp'; // Application aliases - typeCount = 2; - } - break; - } - } - - if ( wantPreview && UEnvironment::HasGestaltAttribute( gestaltQuickTime, 0xFFFF ) ) - ::CustomGetFilePreview( filter, typeCount, typeP, &reply, dlogID, loc, dialogHook, - NULL, NULL, NULL, &closure ); - else - ::CustomGetFile( filter, typeCount, typeP, &reply, dlogID, loc, dialogHook, - NULL, NULL, NULL, &closure ); - - // follow any folder aliases that may be returned - if (*resultP && pickTypes == Folders) { - Boolean b1, b2; - ThrowIfOSErr_( ResolveAliasFile(&reply.sfFile, true, &b1, &b2) ); - } - - return *resultP; -} - -Boolean CFilePicker::DoCustomPutFile( StandardFileReply& reply, - const CStr255& prompt, Boolean inited ) -{ - Point loc = { -1, -1 }; - CStr255 filename = CStr255::sEmptyString; - DlgHookYDUPP dialogHook = NULL; - - if ( inited ) - { - filename = reply.sfFile.name; - dialogHook = &PROCPTR( SetCurrDirHook ); - } - - CustomPutFile( (ConstStr255Param)prompt, - (ConstStr255Param)filename, - &reply, - 0, - loc, - dialogHook, - NULL, - NULL, - NULL, - NULL ); - - return reply.sfGood; -} - -// =========================================================================== -// COtherSizeDialog -// =========================================================================== - -const ResIDT edit_SizeField = 1504; - -COtherSizeDialog::COtherSizeDialog( LStream* inStream ): LDialogBox( inStream ) -{ -} - -void COtherSizeDialog::FinishCreateSelf() -{ - LDialogBox::FinishCreateSelf(); - - mSizeField = (LEditField*)FindPaneByID( edit_SizeField ); - - // Set the edit field to go on duty whenever - // this dialog box goes on duty. - - fRef = NULL; - SetLatentSub( mSizeField ); -} - -void COtherSizeDialog::SetValue( Int32 inFontSize ) -{ - if ( inFontSize > 128 ) - inFontSize = 128; - - mSizeField->SetValue( inFontSize ); - mSizeField->SelectAll(); -} - -Int32 COtherSizeDialog::GetValue() const -{ - Int32 size; - - size = mSizeField->GetValue(); - if ( size > 128 ) - size = 128; - - return size; -} - -void COtherSizeDialog::SetReference( LControl* which ) -{ - fRef = which; -} - -// --------------------------------------------------------------------------- -// ¥ ListenToMessage -// --------------------------------------------------------------------------- -// This member function illustrates an alternate method for this dialog box -// to communicate with its invoker when the user clicks the defualt (OK) button. -// Usually, when the user clicks the default button, LDialogBox::ListenToMessage() -// calls the supercommander's ObeyCommand() function passing it the value message -// of the default button and a pointer to the dialog box object in the ioParam -// parameter. This method also passes the value message of the default button, -// but rather than sending a pointer to the dialog in ioParam, it sends the -// new point size. -// -// The advantage of using the alternate method is that the client that invokes -// the dialog doesn't have to call any of the dialog class's member functions -// to get its value and is not responsible for closing the dialog box. The -// disadvantage is that you have to pass all the information back through -// ObeyCommand()'s single ioParam parameter. - -void COtherSizeDialog::ListenToMessage(MessageT inMessage, void *ioParam) -{ - Int32 newFontSize; - - switch ( inMessage ) - { - case msg_ChangeFontSize: - // This is the command number associated with this dialog's - // OK button. It's also used as a command number to send - // to the dialog's supercommander which is presumably - // the commander that created and invoked the dialog. - - newFontSize = mSizeField->GetValue(); - - // Note that we use the second parameter of ObeyCommand() to - // specify the new font size. When the menu mechanism invokes - // ObeyCommand(), the second parameter is always nil. - - BroadcastMessage( msg_ChangeFontSize, this ); - - // Since we want the OK button to close the dialog box as - // well as change the font size, we change the message to close - // and let the flow fall through to the default case. - - inMessage = cmd_Close; - - // FALLTHROUGH INTENTIONAL - // to get the base class to close the dialog box - - default: - LDialogBox::ListenToMessage(inMessage, ioParam); - break; - } -} - - -LArrowGroup::LArrowGroup( LStream* inStream ): LView( inStream ) -{ - fSize = NULL; - fArrows = NULL; - fValue = 0L; - fMinValue = 0L; - fMaxValue = 99999999L; - fStringID = MEGA_RESID; - this->BuildControls(); -} - -void LArrowGroup::SetStringID(ResIDT stringID) -{ - fStringID = stringID; -} - -void LArrowGroup::ListenToMessage( MessageT message, void* ioParam ) -{ - if ( message == msg_ArrowsHit ) - { - Int16 whichHalf = *(Int16*)ioParam; - - if ( whichHalf == mTopHalf ) - SetValue( fValue + 1 ); - else - SetValue( fValue - 1 ); - } -} - -void LArrowGroup::SetValue( Int32 value ) -{ - if ( value < fMinValue ) - value = fMinValue; - else if ( value > fMaxValue ) - value = fMaxValue; - - CStr255 string; - NumToString( value, string ); - string += CStr255(*GetString(fStringID)); - fSize->SetDescriptor( string ); - fValue = value; -} - -void LArrowGroup::SetMaxValue( Int32 newMax ) -{ - if ( fValue > newMax ) - SetValue( newMax ); - fMaxValue = newMax; -} - -void LArrowGroup::SetMinValue( Int32 newMin ) -{ - if ( fValue < newMin ) - SetValue( newMin ); - fMinValue = newMin; -} - - -void LArrowGroup::BuildControls() -{ - SPaneInfo paneInfo; - - paneInfo.paneID = 'Actl'; - paneInfo.width = 15; - paneInfo.height = 25; - paneInfo.visible = TRUE; - paneInfo.enabled = TRUE; - paneInfo.left = mFrameSize.width - 16; - paneInfo.top = 0; - paneInfo.userCon = 0; - paneInfo.superView = this; - - fArrows = new LArrowControl( paneInfo, msg_ArrowsHit ); - ThrowIfNil_(fArrows); - fArrows->AddListener( this ); - - paneInfo.paneID = 'capt'; - paneInfo.width = mFrameSize.width - 16; - paneInfo.height = 12; - paneInfo.left = 0; - paneInfo.top = 5; - - fSize = new COffscreenCaption(paneInfo, "\p", 10000); -} - -CColorButton::CColorButton( LStream *inStream ): LButton( inStream ) -{ - fInside = FALSE; - mNormalID = 0; - mPushedID = 1; -} - -void CColorButton::DrawGraphic( ResIDT inGraphicID ) -{ - Rect frame; - - CalcLocalFrameRect( frame ); - UGraphics::SetFore( CPrefs::Black ); - if ( IsEnabled() ) - { - if ( inGraphicID == mPushedID ) - { - ::PenSize( 2, 2 ); - ::PenPat( &qd.black ); - ::FrameRect( &frame ); - } - else - { - ::PenSize( 1, 1 ); - ::PenPat( &qd.black ); - ::FrameRect( &frame ); - UGraphics::SetFore( CPrefs::White ); - ::InsetRect( &frame, 1, 1 ); - ::FrameRect( &frame ); - UGraphics::SetFore( CPrefs::Black ); - } - } - else - { - ::PenSize( 1, 1 ); - ::PenPat( &qd.gray ); - ::FrameRect( &frame ); - ::PenPat( &qd.black ); - - } - - RGBForeColor( &fColor ); - - if ( inGraphicID == mPushedID ) - ::InsetRect( &frame, 3, 3 ); - else - ::InsetRect( &frame, 2, 2 ); - - ::FillRect( &frame, &( UQDGlobals::GetQDGlobals()->black ) ); - UGraphics::SetFore( CPrefs::Black ); -} - -void CColorButton::HotSpotResult( short inHotSpot ) -{ - Point where; - where.h = where.v = 0; - RGBColor outColor; - - if ( ::GetColor(where, (unsigned char *)*GetString(PICK_COLOR_RESID), - &fColor,&outColor) ) - { - if ( !UGraphics::EqualColor(fColor, outColor) ) - { - fColor = outColor; - BroadcastValueMessage(); - } - } - - // ¥ turn off the black border - HotSpotAction( inHotSpot, FALSE, TRUE ); - -} - -FileIconsLister::FileIconsLister (CGAPopupMenu * target) -: StdPopup (target) -{ - fIcons = nil; -} - -FileIconsLister::~FileIconsLister() -{ // Debugging purposes only -} - -void -FileIconsLister::SetIconList (CApplicationIconInfo * icons) -{ - fIcons = icons; -} - -short -FileIconsLister::GetCount() -{ - if (fIcons == NULL) - return 0; - else - return fIcons->GetFileTypeArraySize(); -} - -CStr255 -FileIconsLister::GetText (short item) -{ - CFileType * fileType; - fIcons->fDocumentIcons->FetchItemAt (item, &fileType); - return fileType->fIconSig; -} - -// ¥¥ Constructors/destructors - -CMimeTable::CMimeTable(LStream *inStream) : LTable(inStream) -{ - fContainer = NULL; - fNetscapeIcon = NULL; - fPluginIcon = NULL; -} - -void CMimeTable::FinishCreateSelf() -{ - SetCellDataSize(sizeof(PrefCellInfo)); - - for (TableIndexT i = 1; i <= CPrefs::sMimeTypes.GetCount(); i++) // Insert a row for each mime type - { - CMimeMapper * mime; - CPrefs::sMimeTypes.FetchItemAt(i, &mime); - ThrowIfNil_(mime); - if (!mime->IsTemporary()) - { - CMimeMapper * duplicate = new CMimeMapper(*mime); - PrefCellInfo cellInfo; - InsertRows(1, i, &cellInfo); - BindCellToApplication(i, duplicate); - } - } - - // Cache a handle to the Navigator application icon - CApplicationIconInfo* netscapeInfo = fApplList.GetAppInfo(emSignature); - ThrowIfNil_(netscapeInfo); - ThrowIfNil_(netscapeInfo->fDocumentIcons); - fNetscapeIcon = netscapeInfo->fApplicationIcon; - - // Cache a handle to the standard plug-in icon - LArrayIterator iterator(*(netscapeInfo->fDocumentIcons)); - CFileType* fileInfo; - while (iterator.Next(&fileInfo)) - { - if (fileInfo->fIconSig == emPluginFile) - { - fPluginIcon = fileInfo->fIcon; - break; - } - } - - LTable::FinishCreateSelf(); - - // Set latent subcommander of supercommander of supercommander, which is the - // view that contains the scroller of this table, to table -// if( GetSuperCommander()->GetSuperCommander() ) -// (GetSuperCommander()->GetSuperCommander())->SetLatentSub(this); - LCommander::SwitchTarget(this); -} - -CApplicationIconInfo* CMimeTable::GetAppInfo(CMimeMapper* mapper) -{ - return fApplList.GetAppInfo(mapper->GetAppSig(), mapper); -} - - -// Sets cell data to values of the mapper -void CMimeTable::BindCellToApplication(TableIndexT row, CMimeMapper* mapper) -{ - CApplicationIconInfo* appInfo = GetAppInfo(mapper); - - // Now figure out the extensions from the netlib - PrefCellInfo cellInfo(mapper, appInfo); - TableCellT cell; - cell.row = row; - cell.col = 1; - SetCellData(cell, &cellInfo); -} - - -void CMimeTable::DrawSelf() -{ - RgnHandle localUpdateRgnH = GetLocalUpdateRgn(); - Rect updateRect = (**localUpdateRgnH).rgnBBox; - DisposeRgn(localUpdateRgnH); - - { - StColorState saveTheColor; - RGBColor white = { 0xFFFF, 0xFFFF, 0xFFFF}; - RGBBackColor(&white); - EraseRect(&updateRect); - } - - LTable::DrawSelf(); -} - - -void CMimeTable::HiliteCell(const TableCellT &inCell) -{ - StColorState saveTheColor; - RGBColor white = { 0xFFFF, 0xFFFF, 0xFFFF}; - RGBBackColor(&white); - - LTable::HiliteCell(inCell); -} - - -void CMimeTable::UnhiliteCell(const TableCellT &inCell) -{ - StColorState saveTheColor; - RGBColor white = { 0xFFFF, 0xFFFF, 0xFFFF}; - RGBBackColor(&white); - - LTable::UnhiliteCell(inCell); -} - - - -#define offsetTable 7 -#define offsetTextTop 15 -#define offsetMimeType (offsetTable + 0) -#define offsetIcon (offsetTable + 166) -#define offsetHandler (offsetIcon + 24) -#define widthMimeType (offsetIcon - offsetMimeType - 5) - -void CMimeTable::DrawCell(const TableCellT &inCell) -{ - Rect cellFrame; - - if (FetchLocalCellFrame(inCell, cellFrame)) - { - ::PenPat( &(UQDGlobals::GetQDGlobals()->gray) ); - ::MoveTo(cellFrame.left, cellFrame.bottom-1); - ::LineTo(cellFrame.right, cellFrame.bottom-1); - ::PenPat( &(UQDGlobals::GetQDGlobals()->black) ); - - PrefCellInfo cellInfo; - GetCellData(inCell, &cellInfo); - UTextTraits::SetPortTextTraits(10000); // HACK - - // Draw mime type - CStr255 description = cellInfo.fMapper->GetDescription(); - if (description.IsEmpty()) - description = cellInfo.fMapper->GetMimeName(); - short result = ::TruncString(widthMimeType, description, smTruncMiddle); - ::MoveTo(offsetMimeType, cellFrame.top+offsetTextTop); - ::DrawString(description); - - // Draw the icon - CMimeMapper::LoadAction loadAction = cellInfo.fMapper->GetLoadAction(); - if (loadAction == CMimeMapper::Launch || loadAction == CMimeMapper::Plugin || loadAction == CMimeMapper::Internal) - { - Rect r; - r.left = offsetIcon; - r.top = cellFrame.top + 2; - r.right = r.left + 16; - r.bottom = r.top + 16; - - Handle iconHandle; - if (loadAction == CMimeMapper::Plugin) - iconHandle = fPluginIcon; - else if (loadAction == CMimeMapper::Internal) - iconHandle = fNetscapeIcon; - else - iconHandle = cellInfo.fIconInfo->fApplicationIcon; - XP_ASSERT(iconHandle); - - if (iconHandle) - { - if (loadAction == CMimeMapper::Launch && !(cellInfo.fIconInfo->fApplicationFound)) - ::PlotIconSuite(&r, atHorizontalCenter, ttDisabled, iconHandle); - else - ::PlotIconSuite(&r, atHorizontalCenter, ttNone, iconHandle); - } - } - - // Draw the handler name - ::MoveTo(offsetHandler, cellFrame.top+offsetTextTop); - switch (loadAction) - { - case CMimeMapper::Save: - ::DrawString(*GetString(SAVE_RESID)); - break; - case CMimeMapper::Unknown: - ::DrawString(*GetString(UNKNOWN_RESID)); - break; - case CMimeMapper::Internal: - ::DrawString(*GetString(INTERNAL_RESID)); - break; - case CMimeMapper::Launch: - ::DrawString(cellInfo.fMapper->GetAppName()); - break; - case CMimeMapper::Plugin: - ::DrawString(cellInfo.fMapper->GetPluginName()); - break; - } - } -} - - -// Returns PrefCellInfo for the given cell -void CMimeTable::GetCellInfo(PrefCellInfo& cellInfo, int row) -{ - TableCellT cell; - cell.row = row; - cell.col = 1; - GetCellData(cell, &cellInfo); -} - -void CMimeTable::FreeMappers() -{ - TableCellT cell; - cell.col = 1; - PrefCellInfo cellInfo; - for (int i=1; i<= mRows; i++) - { - cell.row = i; - GetCellData(cell, &cellInfo); - delete cellInfo.fMapper; - } -} - - -// -// Scroll the view as little as possible to move the specified cell -// entirely within the frame. Currently we only handle scrolling -// up or down a single line (when the selection moves because of -// and arrow key press). -// -void CMimeTable::ScrollCellIntoFrame(const TableCellT& inCell) -{ - // Compute bounds of specified cell in image coordinates - Int32 cellLeft = 0; - Int32 cellRight = 1; - Int32 cellBottom = inCell.row * mRowHeight - 2; - Int32 cellTop = cellBottom - mRowHeight + 2; - - if (ImagePointIsInFrame(cellLeft, cellTop) && - ImagePointIsInFrame(cellRight, cellBottom)) - { - return; // Cell is already within Frame - } - else - { - if (cellTop + mImageLocation.v < mFrameLocation.v) - ScrollImageTo(cellLeft, cellTop, true); // Scroll up - else - ScrollPinnedImageBy(0, mRowHeight, true); // Scroll down - } -} - -Boolean CMimeTable::HandleKeyPress(const EventRecord &inKeyEvent) -{ - Char16 theChar = inKeyEvent.message & charCodeMask; - Boolean handled = false; - - TableIndexT tableRows; - TableIndexT tableCols; - TableCellT currentCell; - GetSelectedCell(currentCell); - GetTableSize(tableRows, tableCols); - - switch (theChar) - { - case char_UpArrow: - currentCell.row--; - if (currentCell.row >= 1) - SelectCell(currentCell); - handled = true; - break; - - case char_DownArrow: - currentCell.row++; - if (currentCell.row <= tableRows) - SelectCell(currentCell); - handled = true; - break; - - case char_PageUp: - case char_PageDown: - case char_Home: - case char_End: - default: - handled = LCommander::HandleKeyPress(inKeyEvent); - } - - return handled; -} - - - -/************************************************************************************ - Preferences MimeMapping window - ************************************************************************************/ -// utility callback function for getting icons -pascal Handle MyIconGetter( ResType theType, Ptr yourDataPtr ); - -// function that creates an item cache that we want -OSErr CreateCache(Handle & cache, short resID); - -static IconGetterUPP MyIconGetterUPP = NULL; - -pascal Handle MyIconGetter( ResType theType, Ptr yourDataPtr ) -{ - Handle res, resCopy; - - resCopy = res = ::Get1Resource( theType, (short)yourDataPtr ); - - ::HandToHand( &resCopy ); - ::ReleaseResource( res ); - return resCopy; -} - - -OSErr CreateCache( Handle& cache, short resID ) -{ - if ( MyIconGetterUPP == NULL ) - MyIconGetterUPP = NewIconGetterProc( MyIconGetter ); - - OSErr err = MakeIconCache( &cache, MyIconGetterUPP, (Ptr)resID ); - - if ( err ) - return err; - - Rect r; - r.top = r.left = 0; - r.bottom = r.right = 16; - - err = LoadIconCache( &r, atHorizontalCenter, ttNone, cache ); - return err; -} - - -Handle CFileType::sDefaultDocIcon = NULL; - -CFileType::CFileType( OSType iconSig ) -{ - InitializeDefaults(); - fIconSig = iconSig; - fIcon = sDefaultDocIcon; -} - -CFileType::~CFileType() -{ - if ( fIcon && ( fIcon != sDefaultDocIcon ) ) - ::DisposeIconSuite( fIcon, TRUE ); -} - -// Initializes default values -void CFileType::InitializeDefaults() -{ - if ( sDefaultDocIcon == NULL ) - { - StUseResFile resFile(kSystemResFile); - ::CreateCache( sDefaultDocIcon, genericDocumentIconResource ); - } - ThrowIfNil_( sDefaultDocIcon ); -} - -// Clear the default values -void CFileType::ClearDefaults() -{ - if ( sDefaultDocIcon ) - ::DisposeIconSuite( sDefaultDocIcon, TRUE ); - sDefaultDocIcon = NULL; -} - -// ¥¥ globals -Handle CApplicationIconInfo::sDefaultAppIcon = NULL; -LArray * CApplicationIconInfo::sDocumentIcons = NULL; -Boolean CApplicationIconInfo::sHandlesAE = TRUE; - -// Call me when application has not been found. Assigns default values -CApplicationIconInfo::CApplicationIconInfo( OSType appSig ) -{ - InitializeDefaults(); - - fAppSig = appSig; - fApplicationIcon = sDefaultAppIcon; - fDocumentIcons = sDocumentIcons; - fHandlesAE = sHandlesAE; - fApplicationFound = FALSE; -} - -// Call me when app was found -CApplicationIconInfo::CApplicationIconInfo( - OSType appSig, - Handle appIcon, - LArray* documentIcons, - Boolean handlesAE) -{ - InitializeDefaults(); - - fAppSig = appSig; - fApplicationIcon = appIcon; - fDocumentIcons = documentIcons; - fHandlesAE = handlesAE; - fApplicationFound = TRUE; -} - -CApplicationIconInfo::~CApplicationIconInfo() -{ - if ( fDocumentIcons == sDocumentIcons ) - return; // Do not delete our defaults - for ( Int32 i = 1; i <= fDocumentIcons->GetCount(); i++ ) - { - CFileType* f; - fDocumentIcons->FetchItemAt( i, &f ); - delete f; - } - - delete fDocumentIcons; - - if ( fApplicationIcon != sDefaultAppIcon ) - ::DisposeIconSuite( fApplicationIcon, TRUE ); -} - -// ¥¥ access - -// Gets file type by the index -CFileType* CApplicationIconInfo::GetFileType( int index ) -{ - CFileType* f; - if (index > fDocumentIcons->GetCount() ) -#ifdef DEBUG - XP_ABORT(); -#else - return NULL; -#endif - fDocumentIcons->FetchItemAt( index, &f ); - return f; -} - -// Gets number of file types -int CApplicationIconInfo::GetFileTypeArraySize() -{ - return fDocumentIcons->GetCount(); -} - -// ¥¥ misc - -void CApplicationIconInfo::InitializeDefaults() -{ - if (sDocumentIcons != NULL) - return; - - // Create a default document icon list, size 1, generic icon of type 'TEXT' - sDocumentIcons = new LArray; - ThrowIfNil_( sDocumentIcons ); - - CFileType* newType = new CFileType( 'TEXT' ); - ThrowIfNil_( newType ); - - sDocumentIcons->InsertItemsAt( 1, LArray::index_Last, &newType ); - - // Get the default application icon - StUseResFile resFile(kSystemResFile); - ::CreateCache( sDefaultAppIcon, genericApplicationIconResource ); - ThrowIfNil_( sDefaultAppIcon ); -} - -void CApplicationIconInfo::ClearDefaults() -{ - if ( sDocumentIcons == NULL ) - return; // Nothing allocated, nothing deleted - for ( Int32 i = 1; i <= sDocumentIcons->GetCount(); i++ ) - { - CFileType* f; - sDocumentIcons->FetchItemAt( i, &f ); - delete f; - } - - delete sDocumentIcons; - sDocumentIcons = NULL; - - if ( sDefaultAppIcon ) - DisposeIconSuite( sDefaultAppIcon, TRUE ); - sDefaultAppIcon = NULL; - - CFileType::ClearDefaults(); -} - - - -CApplicationList::CApplicationList() : LArray() -{ - CApplicationIconInfo::InitializeDefaults(); -} - -CApplicationList::~CApplicationList() -{ - for (Int32 i = 1; i <= mItemCount; i++) - { - CApplicationIconInfo * f; - FetchItemAt(i, &f); - delete f; - } - CApplicationIconInfo::ClearDefaults(); -} - - -CApplicationIconInfo* CApplicationList::GetAppInfo(OSType appSig, CMimeMapper* mapper) -{ - // Try to find the application that matches the sig: - for ( Int32 i = 1; i <= mItemCount; i++ ) - { - CApplicationIconInfo* f; - FetchItemAt( i, &f ); - if ( f->fAppSig == appSig) - return f; - } - - // Could not find an application, must create a new entry - return CreateNewEntry(appSig, mapper); -} - - -// Creates application icon info for an app with a given signature -// If app is not found, defaults are created -CApplicationIconInfo* CApplicationList::CreateNewEntry(OSType appSig, CMimeMapper* mapper) -{ - FSSpec appSpec; - CApplicationIconInfo* appInfo = NULL; - - OSErr err = CFileMgr::FindApplication(appSig, appSpec ); - - if ( err != noErr ) - { - // Application not found, create defaults - appInfo = new CApplicationIconInfo(appSig); - } - else - { - if (mapper) - mapper->SetAppName( appSpec.name ); - appInfo = AppInfoFromFileSpec(appSig, appSpec); - } - - InsertItemsAt(1, LArray::index_Last, &appInfo); - return appInfo; -} - -// Horrendous bundle parsing routine. -// Its parses the bundle, gets all the document icons, and an application icon -// Failure can occur in many places. Unhandled failures result in a creation of -// the 'generic' applicatiohe resource -CApplicationIconInfo* CApplicationList::AppInfoFromFileSpec( OSType appSig, FSSpec appSpec ) -{ - CApplicationIconInfo* newInfo = NULL; - short refNum; - Handle bundle = NULL; - OSErr err; - Handle appIcon = NULL; - Boolean handlesAE = TRUE; - - LArray* documentIcons = NULL; - BNDLIds* iconOffset; - BNDLIds* frefOffset; - short numOfIcons; - short numOfFrefs; // Really number-1, just like in the resource - BNDLIds frefBNDL; - Handle iconFamily; - OSType iconType; - Handle frefRes = NULL; - - Try_ - { - documentIcons = new LArray(); - ThrowIfNil_( documentIcons ); - - SetResLoad( FALSE ); - refNum = ::FSpOpenResFile( &appSpec,fsRdPerm ); - err = ResError(); - SetResLoad( TRUE ); - ThrowIfOSErr_( err ); - - // BNDL - bundle = ::Get1IndResource( 'BNDL' , 1 ); - ThrowIfNil_( bundle ); - HLock( bundle ); - HNoPurge( bundle ); - // Get the signature - ::BlockMoveData( *bundle, &appSig, 4 ); - - GetResourcePointers( bundle, iconOffset, frefOffset, numOfIcons, numOfFrefs ); - - // We have the offsets for FREF and ICN# resources - // Not every FREF has a matching icon, so we read in all - // the FREFs and try to find the matching icon for each - for ( int i = 0; i <= numOfFrefs; i++ ) - { - // Algorithm: - // Get the FREF resource specified in BNDL - // Find the ICN# resource from BNDL with same local ID - // Get the icon specified in ICN# resource. - // If getting of the icon fails in any case, use the default icon - frefBNDL = frefOffset[i]; - iconFamily = NULL; - iconType = 'DUMB'; - frefRes = ::Get1Resource( 'FREF', frefBNDL.resID ); - if ( frefRes == NULL ) // Ignore the record if FREF resource is not found - continue; - ::BlockMoveData( *frefRes, &iconType, 4 ); - ::ReleaseResource( frefRes ); - - if ( ( iconType == 'fold' ) || // folders are not files - ( iconType == '****' ) || // any file will default to text later - ( iconType == 'pref' ) || // prefs are also ignored - ( iconType == 'PREF' ) ) - continue; - - for ( int j = 0; j <= numOfIcons; j++ ) - { - BNDLIds iconBndl = iconOffset[j]; - if ( iconBndl.localID == frefBNDL.localID ) - { - err = ::CreateCache( iconFamily, iconBndl.resID ); - if (err) - iconFamily = NULL; - break; - } - } - - if ( iconType == 'APPL' ) - { - // Special handling of the application icon - if ( iconFamily == NULL ) - appIcon = CApplicationIconInfo::sDefaultAppIcon; - else - appIcon = iconFamily; - } - else - { // Document icons - CFileType* newType = NULL; - if ( iconFamily == NULL ) - newType = new CFileType( iconType ); - else - newType = new CFileType( iconType, iconFamily ); - - documentIcons->InsertItemsAt( 1, LArray::index_Last, &newType ); - } - } // Done parsing all the file types - - HUnlock( bundle ); - HPurge( bundle ); - ReleaseResource( bundle ); - // Figure out if the application handles AppleEvents - Handle sizeRes = ::Get1Resource( 'SIZE', -1 ); - if ( sizeRes == NULL ) - handlesAE = FALSE; - else - { - char aeChar; - aeChar = (*sizeRes)[1]; - handlesAE = aeChar & 2; - } - - // Error handling: no file types - if ( documentIcons->GetCount() == 0 ) // No icons were read, add 1 dummy one - { - CFileType* newType = new CFileType( 'TEXT' ); - documentIcons->InsertItemsAt( 1, LArray::index_Last, &newType ); - } - // Error handling: no application icon - if ( appIcon == NULL ) - appIcon = CApplicationIconInfo::sDefaultAppIcon; - newInfo = new CApplicationIconInfo( appSig, appIcon, documentIcons, handlesAE ); - } - Catch_(inErr) - { - newInfo = new CApplicationIconInfo( appSig ); - } - EndCatch_ - - CloseResFile( refNum ); - err = ResError(); - ThrowIfNil_( newInfo ); - return newInfo; -} - -void CApplicationList::GetResourcePointers( - Handle bundle, - BNDLIds* &iconOffset, - BNDLIds* &frefOffset, - short& numOfIcons, - short& numOfFrefs) -{ - OSType resType; - Ptr bundlePtr = NULL; - - bundlePtr = *bundle; - - ::BlockMoveData( bundlePtr + 8, &resType, 4 ); // Get the first resource type - if ( resType == 'ICN#' ) - { - ::BlockMoveData( bundlePtr + 12, &numOfIcons, 2 ); - iconOffset = (BNDLIds*)( bundlePtr + 14 ); - //::BlockMove( (Ptr)iconOffset + ( numOfIcons + 1) * sizeof( BNDLIds ), &resType, 4 ); // Just checkin' - ::BlockMoveData( (Ptr)iconOffset + (numOfIcons + 1) * sizeof( BNDLIds ) + 4, &numOfFrefs, 2 ); - frefOffset = (BNDLIds*)( (Ptr)iconOffset + 6 + ( numOfIcons + 1 ) * sizeof( BNDLIds ) ); - } - else // FREF - { - ::BlockMoveData( bundlePtr + 12, &numOfFrefs, 2 ); - frefOffset = (BNDLIds*) (bundlePtr + 14 ); - //::BlockMove( (Ptr)frefOffset + ( numOfFrefs + 1 ) * sizeof( BNDLIds ), &resType, 4 ); // Just checkin' - ::BlockMoveData( (Ptr)frefOffset + ( numOfFrefs + 1 ) * sizeof( BNDLIds ) + 4, &numOfIcons, 2 ); - iconOffset = (BNDLIds*)( (Ptr)frefOffset + 6 + (numOfFrefs + 1) * sizeof(BNDLIds) ); - } -} - -PrefCellInfo::PrefCellInfo(CMimeMapper * mapper, CApplicationIconInfo * iconInfo) -{ - fMapper = mapper; - fIconInfo = iconInfo; -} - -PrefCellInfo::PrefCellInfo() -{ - fMapper = NULL; - fIconInfo = NULL; -} - - -Boolean -LFocusEditField::HandleKeyPress( - const EventRecord &inKeyEvent) -{ - Boolean keyHandled = true; - LControl *keyButton = nil; - - switch (inKeyEvent.message & charCodeMask) { - - case char_Enter: - case char_Return: - BroadcastMessage(mReturnMessage, this); - return true; - default: - return LEditField::HandleKeyPress(inKeyEvent); - } -} - -LFocusEditField::LFocusEditField( - const LFocusEditField &inOriginal) - : LEditField(inOriginal), - LBroadcaster(inOriginal) -{ - mFocusBox = nil; - if (inOriginal.mFocusBox != nil) { - mFocusBox = new LFocusBox(*(inOriginal.mFocusBox)); - } -} - -LFocusEditField::LFocusEditField( - LStream *inStream) - : LEditField(inStream) -{ - mFocusBox = new LFocusBox; - mFocusBox->Hide(); - mFocusBox->AttachPane(this); -} -LFocusEditField::~LFocusEditField() -{ - -} -void -LFocusEditField::BeTarget() -{ - if(mFocusBox != nil) { - mFocusBox->Show(); - } - LEditField::BeTarget(); -} -void -LFocusEditField::DontBeTarget() -{ - if(mFocusBox != nil) { - mFocusBox->Hide(); - } - LEditField::DontBeTarget(); -} -LFocusBox* -LFocusEditField::GetFocusBox() -{ - return mFocusBox; -} - -/******************************************************************** - -OneClickLListBox implementation. - -Derived from LListBox. Overrides ClickSelf so that it sends a -message when it has only been clicked once, not twice. - -********************************************************************/ -OneClickLListBox::OneClickLListBox( LStream* inStream ): LListBox( inStream ) -{ - mSingleClickMessage = msg_Nothing; -} - - -void OneClickLListBox::ClickSelf(const SMouseDownEvent &inMouseDown) -{ - if(SwitchTarget(this)) - { - FocusDraw(); - if (::LClick(inMouseDown.whereLocal, inMouseDown.macEvent.modifiers, mMacListH)) - { - BroadcastMessage(mDoubleClickMessage, this); - } else { - BroadcastMessage(mSingleClickMessage, this); - } - } -} - -Boolean OneRowLListBox::HandleKeyPress(const EventRecord &inKeyEvent) -{ - if(OneClickLListBox::HandleKeyPress(inKeyEvent)) - { - Char16 theKey = inKeyEvent.message & charCodeMask; - // based on LListBox::HandleKeyPress--only broadcast when our class handled it - // (window might close--deleting us--before we broadcast) - if ( UKeyFilters::IsNavigationKey(theKey) || - ( UKeyFilters::IsPrintingChar(theKey) && ! (inKeyEvent.modifiers & cmdKey) ) ) - { - BroadcastMessage(mSingleClickMessage, this); - } - return true; - } - else - return false; -} - - -int16 OneRowLListBox::GetRows() -{ - return ((**mMacListH).dataBounds.bottom); -} - -OneRowLListBox::OneRowLListBox( LStream* inStream ): OneClickLListBox( inStream ) -{ - FocusDraw(); - if((*mMacListH)->dataBounds.right == 0) - ::LAddColumn(1 , 0, mMacListH); - (*mMacListH)->selFlags |= lOnlyOne; -} - -void OneRowLListBox::AddRow(int32 rowNum, char* data, int16 datalen) -{ - if(SwitchTarget(this)) - { - FocusDraw(); - Cell theCell; - theCell.h = 0; - rowNum = ::LAddRow(1 , rowNum, mMacListH); - theCell.v = rowNum; - ::LSetCell(data,datalen ,theCell, mMacListH); - } -} -void OneRowLListBox::GetCell(int32 rowNum, char* data, int16* datalen) -{ - FocusDraw(); - Cell theCell; - theCell.h = 0; - theCell.v = rowNum; - ::LGetCell(data,datalen ,theCell, mMacListH); -} -void OneRowLListBox::SetCell(int32 rowNum, char* data, int16 datalen) -{ - if(SwitchTarget(this)) - { - FocusDraw(); - Cell theCell; - theCell.h = 0; - theCell.v = rowNum; - ::LSetCell(data,datalen ,theCell, mMacListH); - } -} - -void OneRowLListBox::RemoveRow(int32 rowNum) -{ - FocusDraw(); - ::LDelRow(1 , rowNum, mMacListH); -} diff --git a/mozilla/cmd/macfe/central/prefwutil.h b/mozilla/cmd/macfe/central/prefwutil.h deleted file mode 100644 index 68c535e2a6c..00000000000 --- a/mozilla/cmd/macfe/central/prefwutil.h +++ /dev/null @@ -1,427 +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. - */ - -// prefwutils.h -// Various utilities used by preference window -// They are apart from Prefw, so that our file size is manageable - -#pragma once - -#include "MoreMixedMode.h" - -#include -#include - -class CValidEditField; -class LArrowControl; -class CApplicationIconInfo; -class CPrefHelpersContain; -class CMimeMapper; -class CStr255; - -/******************************************************************************** - * Classes - ********************************************************************************/ - -//====================================== -class CFilePicker -//====================================== - : public LView - , public LListener - , public LBroadcaster -{ -public: - enum { class_ID = 'fpck' }; // illegal, needs one UC char.- jrm - - enum PickEnum { Folders = 0, Applications, TextFiles, - ImageFiles, MailFiles, AnyFile }; - - CFilePicker( LStream* inStream ); - - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - - void SetFSSpec( const FSSpec& fileSpec, Boolean touchSetFlag = true ); - const FSSpec& GetFSSpec() const { return fCurrentValue; } - - void SetPickType( CFilePicker::PickEnum pickTypes ) { fPickTypes = pickTypes; } - void SetCaptionForPath( LCaption* captionToSet, const FSSpec& folderSpec ); - CStr255 FSSpecToPathName( const FSSpec& spec ); - - Boolean WasSet() const { return fSet; } - - - static Boolean DoCustomGetFile( StandardFileReply& spec, - CFilePicker::PickEnum fileType, - Boolean inited ); - static Boolean DoCustomPutFile( StandardFileReply& spec, - const CStr255& prompt, - Boolean inited ); -protected: - struct PickClosure - { - StandardFileReply* reply; - Boolean inited; - }; - - enum EPaneIDs { - kPathNameCaption = 1, - kBrowseButton = 2 - }; - - virtual void FinishCreateSelf(); - - static pascal short SetCurrDirHook( short item, DialogPtr dialog, void* data ); - PROCDECL( static, SetCurrDirHook ) - static pascal short DirectoryHook( short item, DialogPtr dialog, void* data ); - PROCDECL( static, DirectoryHook ) - - static pascal Boolean OnlyFoldersFileFilter( CInfoPBPtr pBlock, void* data ); - static pascal Boolean IsMailFileFilter( CInfoPBPtr pBlock, void* data ); - PROCDECL( static, OnlyFoldersFileFilter ) - PROCDECL( static, IsMailFileFilter ) - - static void SetButtonTitle( Handle buttonHdl, CStr255& name, const Rect& buttonRect ); - - static CStr255 sPrevName; - static Boolean sResult; - static Boolean sUseDefault; - - FSSpec fCurrentValue; - LControl* fBrowseButton; - LCaption* fPathName; - Boolean fSet; - PickEnum fPickTypes; -}; // class CFilePicker - -// COtherSizeDialog.cp <- double-click + Command-D to see class implementation -// -// This is a PowerPlant dialog box to handle the OtherÉ command in the Size -// menu. - -class LEditField; - -class COtherSizeDialog: public LDialogBox, public LBroadcaster -{ -public: - enum { class_ID = 'OFnt' }; - COtherSizeDialog( LStream* inStream ); - - - virtual void SetValue( Int32 inFontSize ); - virtual Int32 GetValue() const; - - void SetReference( LControl* which ); - - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - - LControl* fRef; -protected: - virtual void FinishCreateSelf(); - LEditField* mSizeField; -}; - -class LArrowGroup: public LView, public LListener -{ -public: - enum { msg_ArrowsHit = 700 } ; - - LArrowGroup( LStream* inStream ); - - void ListenToMessage( MessageT message, void* ioParam ); - - void SetValue( Int32 value ); - Int32 GetValue() const { return fValue; } - - void SetMaxValue( Int32 value ); - void SetMinValue( Int32 value ); - void SetStringID(ResIDT stringID); -protected: - void BuildControls(); - - Int32 fValue; - Int32 fMinValue; - Int32 fMaxValue; - ResIDT fStringID; - LCaption* fSize; - LArrowControl* fArrows; -}; - -/***************************************************************************** - * class CColorButton - * Just a button that pops up a color wheel when pressed - *****************************************************************************/ - -class CColorButton: public LButton -{ -public: - enum { class_ID = 'pcol' }; - // ¥¥ constructors - CColorButton( LStream* inStream ); - - // ¥¥ colors - void SetColor( const RGBColor& color ) { fColor = color; } - RGBColor GetColor() { return fColor; } - - // ¥¥ control overrides - virtual void HotSpotResult( short inHotSpot ); - virtual void DrawGraphic( ResIDT inGraphicID ); -protected: - RGBColor fColor; - Boolean fInside; -}; - -//----------------------------------------------------------------------------- -#include "PopupBox.h" -class FileIconsLister: public StdPopup { -public: - FileIconsLister (CGAPopupMenu * target); - virtual ~FileIconsLister(); - CStr255 GetText (short item); - void SetIconList(CApplicationIconInfo *); - short GetCount(); -private: - CApplicationIconInfo * fIcons; -}; - -/***************************************************************************** - * class PrefCellInfo - * All the information needed to draw a cell. This is what the table stores - *****************************************************************************/ -class PrefCellInfo -{ -public: - PrefCellInfo(); - PrefCellInfo(CMimeMapper* mapper, CApplicationIconInfo* iconInfo); - - CMimeMapper* fMapper; // The mapper from the preference MIME list - CApplicationIconInfo* fIconInfo; // Information about icon to draw -}; - -//----------------------------------------------------------------------------------- -// CApplicationList -// Application list is a list that contains information about -//----------------------------------------------------------------------------------- -struct BNDLIds -{ // Utility structure for bundle parsing - Int16 localID; - Int16 resID; -}; - -class CApplicationList : public LArray -{ -public: - // ¥¥ constructors - CApplicationList(); - virtual ~CApplicationList(); - - // ¥¥ access - // Gets information specified by the mapper - CApplicationIconInfo* GetAppInfo(OSType appSig, CMimeMapper* mapper = NULL); - -private: - // Creates application icon info for an app with a given signature - CApplicationIconInfo* CreateNewEntry(OSType appSig, CMimeMapper* mapper = NULL); - // Creates application icon info for an app with given specs - CApplicationIconInfo* AppInfoFromFileSpec(OSType appSig, FSSpec appSpec); - void GetResourcePointers(Handle bundle, - BNDLIds* &iconOffset, BNDLIds * &frefOffset, - short& numOfIcons, short & numOfFrefs); -}; - - -/***************************************************************************** - * class CMimeTable - * A container view that contains all the CMimeInfo views. Here we are - * faking a list view. This view expands so that it contains all of its - * subviews. - *****************************************************************************/ - -#define msg_LaunchRadio 300 // Launch option changed -#define msg_BrowseApp 301 // Pick a new application -#define msg_FileTypePopup 302 // New file type picked -//msg_EditField // User typed in a field -#define msg_NewMimeType 303 // New Mime type -#define msg_NewMimeTypeOK 305 // Sent by newMimeType dialog window -//#define msg_ClearCell 306 -#define msg_EditMimeType 307 // Edit Mime type -#define msg_DeleteMimeType 308 // Delete Mime type -#define msg_PluginPopup 309 // Pick a plug-in - -class CMimeTable : public LTable, public LCommander -{ -public: - // ¥¥ Constructors/destructors/access - - CMimeTable(LStream *inStream); - void FinishCreateSelf(); - void BindCellToApplication(TableIndexT row, CMimeMapper * mapper); - CApplicationIconInfo* GetAppInfo(CMimeMapper* mapper); - - // ¥¥ access - void SetContainer( CPrefHelpersContain* container) { fContainer = container; } - void GetCellInfo(PrefCellInfo& cellInfo, int row); - void FreeMappers(); - - // ¥¥ Cell selection - virtual void DrawCell( const TableCellT& inCell ); - - // Drawing - virtual void DrawSelf(); - virtual void HiliteCell(const TableCellT &inCell); - virtual void UnhiliteCell(const TableCellT &inCell); - void ScrollCellIntoFrame(const TableCellT& inCell); - - // Events - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - -protected: - CApplicationList fApplList; // List of application and their icons - CPrefHelpersContain* fContainer; // Containing view - Handle fNetscapeIcon; // Icon for Netscape - Handle fPluginIcon; // Icon for plug-ins -}; - -//----------------------------------------------------------------------------------- -// CFileType holds information about a single file type -//----------------------------------------------------------------------------------- -class CFileType -{ -public: - CFileType( OSType iconSig ); - CFileType( OSType iconSig, Handle icon ) {fIcon = icon; fIconSig = iconSig;} - ~CFileType(); - - static void ClearDefaults(); // Does class globals memory cleanup - static void InitializeDefaults(); // Initializes default values - - static Handle sDefaultDocIcon; - - Handle fIcon; // Really an icon suite - OSType fIconSig; -}; - -//----------------------------------------------------------------------------------- -// CApplicationIconInfo -// holds all icon information about an application -//----------------------------------------------------------------------------------- -class CApplicationIconInfo -{ -public: - // ¥¥Êconstructors/destructors - // Call me when application has not been found - CApplicationIconInfo( OSType appSig ); - // Call me when app was found - CApplicationIconInfo( OSType appSig, Handle appIcon, - LArray* documentIcons, Boolean handlesAE ); - - ~CApplicationIconInfo(); - // ¥¥ access - CFileType* GetFileType( int i ); // Gets file type by the index - int GetFileTypeArraySize(); // Gets number of file types - // ¥¥ misc - static void InitializeDefaults(); // Initializes default values - static void ClearDefaults(); // Does class globals memory cleanup - - static Handle sDefaultAppIcon; // Defaults, in case that application is not found - Handle fApplicationIcon; // Handle of application icons (iconSuite) - LArray* fDocumentIcons; // List of CFileType objects - Boolean fHandlesAE; // Does it handle apple events - OSType fAppSig; // Signature of the application - Boolean fApplicationFound; // Was application found on my disk? - -private: - static LArray* sDocumentIcons; // ditto - static Boolean sHandlesAE; // ditto - -}; - -/***************************************************************************** - * Class LFocusEditField - * ---------------------- - * Just like an LListBox, except that it will send messages on - * a single click. Used in the Document Encoding Dialog Box. - *****************************************************************************/ - -class LFocusEditField : public LEditField , public LBroadcaster{ -public: - enum { class_ID = 'Fedi' }; - - LFocusEditField( - const LFocusEditField &inOriginal); - LFocusEditField( - LStream *inStream); - virtual ~LFocusEditField(); - LFocusBox* GetFocusBox(); - - Int16 GetReturnMessage() { return mReturnMessage; } - virtual void SetReturnMessage(Int16 inMessage) - { mReturnMessage = inMessage;} - virtual Boolean HandleKeyPress( const EventRecord &inKeyEvent); - - private: - Int16 mReturnMessage; - -protected: - LFocusBox *mFocusBox; - - virtual void BeTarget(); - virtual void DontBeTarget(); - -}; - -/***************************************************************************** - * Class OneClickLListBox - * ---------------------- - * Just like an LListBox, except that it will send messages on - * a single click. Used in the Document Encoding Dialog Box. - *****************************************************************************/ - - class OneClickLListBox : public LListBox -{ - - public: - OneClickLListBox(LStream * inStream); - - Int16 GetSingleClickMessage() { return mSingleClickMessage; } - virtual void SetSingleClickMessage(Int16 inMessage) - { mSingleClickMessage = inMessage;} - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - - protected: - Int16 mSingleClickMessage; - -}; - -/***************************************************************************** - * Class OneRowLListBox - *****************************************************************************/ -class OneRowLListBox : public OneClickLListBox -{ - - public: - enum { class_ID = 'ocLB' }; - OneRowLListBox(LStream * inStream); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - virtual Int16 GetRows(); - virtual void AddRow(Int32 rowNum, char* data, Int16 datalen); - virtual void RemoveRow(Int32 rowNum); - virtual void GetCell(Int32 rowNum, char* data, Int16* datalen); - virtual void SetCell(Int32 rowNum, char* data, Int16 datalen); -}; diff --git a/mozilla/cmd/macfe/central/profile.cp b/mozilla/cmd/macfe/central/profile.cp deleted file mode 100644 index edb8e2c2ed0..00000000000 --- a/mozilla/cmd/macfe/central/profile.cp +++ /dev/null @@ -1,2072 +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. - */ - -#include "profile.h" -#include "client.h" -#include "UStdDialogs.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "uapp.h" -#include "uprefd.h" -#include "prefwutil.h" -#include "macutil.h" -#include "prefapi.h" -#include "msgcom.h" -#include "resgui.h" -#include "UDeferredTask.h" -#include "xp_file_mac.h" -#include "DirectoryCopy.h" -#include -#include -#include - -// for multi-user profile support in PE -#include "MUC.h" -#include -#include - -#define updateWizardDialog 9800 - -#define profilePEPane 9801 -#define profileIntroPane 9802 -#define userNamePane 9803 -#define profileNamePane 9804 -#define profileFolderPane 9805 -#define profileIconsPane 9806 -#define profileDonePane 9807 - -#define profileSelectDialog 9900 -#define profileManagerDialog 9901 - -// NOTE: Magic name must be kept in sync with ns/modules/libreg/src/reg.h -#define MAGIC_PROFILE_NAME "User1" - -const char* kProfileNamePref = "profile.name"; - -/***************************************************************************** - * The resource format for storing profile metadata (i.e., username and - * email) in the profile database so it can be easily searched. In order - * to allow an arbitrary amount of metadata, the resource is divided into - * a header section, which counts the number of metadata items and the length - * to each, and a data section, which simply consists of the data in packed - * format. The offset to each set of data is the sum of the first offset - * plus all of the lengths. Strings are null terminated for convenience. - * All of this is stored in the profile database in a 'DATA' resource - * which corresponds to the id of the profile in use. - ****************************************************************************/ - -/* The version of the metadata for Nav 4.0 */ - -typedef struct { - short int count; - short int firstOffset; - long int nameLength; - long int emailLength; - /* New data element lengths would go here, along with a corresponding - change in the count and firstOffset items */ - /* Data follows here */ -} ProfileDataHeader; - -MODULE_PRIVATE int PR_CALLBACK ProfilePrefChangedFunc(const char *pref, void *data); - -CFragConnectionID CUserProfile::mConfigPluginID; - -class LWhiteListBox: public LListBox -{ -private: - typedef LListBox Inherited; - - -public: - enum { class_ID = 'Lwht' }; - - LWhiteListBox( LStream* inStream ); - - virtual Boolean FocusDraw(LPane* inSubPane = nil); - virtual void DrawSelf(); -}; - -LWhiteListBox::LWhiteListBox( LStream* inStream ): LListBox( inStream ) -{ -} - -Boolean LWhiteListBox::FocusDraw(LPane* /*inSubPane*/) -{ - const RGBColor rgbWhite = { 0xFFFF, 0xFFFF, 0xFFFF }; - - if ( Inherited::FocusDraw() ) - { - ::RGBBackColor( &rgbWhite ); - return TRUE; - } - return FALSE; -} - -void LWhiteListBox::DrawSelf() -{ - Rect frame; - - this->CalcLocalFrameRect( frame ); - ::EraseRect( &frame ); - LListBox::DrawSelf(); -} - -MODULE_PRIVATE int PR_CALLBACK ProfilePrefChangedFunc(const char *pref, void * /* data */) -{ - FSSpec profileSpec = CPrefs::GetFilePrototype(CPrefs::UsersFolder); - GetIndString(profileSpec.name, 300, userProfiles); - - CUserProfileDB profile(profileSpec); - - if ((!XP_STRCASECMP(pref,"mail.identity.username")) || - (!XP_STRCASECMP(pref,"mail.identity.useremail"))) - { - profile.SetProfileData( CUserProfile::sCurrentProfileID ); - } - else if (!XP_STRCMP(pref, kProfileNamePref)) - { - char profileName[255]; - int len = 255; - if ( PREF_GetCharPref(kProfileNamePref, profileName, &len) == PREF_NOERROR ) - { - profile.SetProfileName( CUserProfile::sCurrentProfileID, (CStr255) profileName ); - } - } - - return 0; -} - -class CProfilePaneMonitor : public LListener -{ - public: - CProfilePaneMonitor(CDialogWizardHandler*); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - private: - CDialogWizardHandler* fWizard; - Boolean fCopiedName; -}; - -/***************************************************************************** - * class CUserProfile - * - * Dialog handlers & wizards for multi-user profile support. - * - *****************************************************************************/ - -short CUserProfile::sCurrentProfileID = CUserProfile::kInvalidProfileID; -Boolean CUserProfile::mHasConfigPlugin = FALSE; -Boolean CUserProfile::mPluginLoaded = FALSE; - -void CUserProfile::InitUserProfiles() -{ - mHasConfigPlugin = ( LoadConfigPlugin() != NULL ); - if ( mHasConfigPlugin ) - CloseConfigPlugin(); -} - -// Attempts to open "User Profiles" and put up a selection dialog. -// Returns the location of the user's selected Prefs folder. -ProfileErr -CUserProfile::GetUserProfile( const FSSpec& usersFolder, FSSpec& profileFolder, - Boolean showDialog, short fileType ) -{ - ProfileErr result = eOK; - Boolean done = true; - Boolean wantsProfileManager = showDialog; - FSSpec profileSpec; - short numProfiles = 1; - CStr31 profileName; - - // ¥ÊprofileSpec here is "User Profiles" - profileSpec.vRefNum = usersFolder.vRefNum; - profileSpec.parID = usersFolder.parID; - GetIndString( profileSpec.name, 300, userProfiles ); - - // ¥ÊI have no idea why this is so convoluted - - if ( !CFileMgr::FileExists( profileSpec ) ) - return eNeedUpgrade; - - if ( DeleteMagicProfile( profileSpec ) ) - return eNeedUpgrade; - - CUserProfileDB profileDB( profileSpec ); - do - { - Try_ - { - short newUserID = 0; - short lastUserID = profileDB.GetLastProfileID(); - - // ¥Êonly put up dialog if there's more than one user - if ( showDialog || profileDB.CountProfiles() > 1 ) - { - // HACK ALERT!!!!! - // If we're being asked to open a doc or get a URL just skip the dialog - // and use the last profile that was selected - if ( (fileType == FILE_TYPE_ODOC) || (fileType == FILE_TYPE_GETURL) ) - { - newUserID = lastUserID; - if ( profileDB.GetProfileAlias( newUserID, profileFolder ) ) - result = eOK; - else - result = eUnknownError; - - } - else - // END HACK ALERT!!!!! - result = HandleProfileDialog( - profileSpec, - profileDB, - profileFolder, - newUserID, - lastUserID, - wantsProfileManager ); - - if ( result >= 0 && lastUserID != newUserID ) - profileDB.SetLastProfileID( newUserID ); - - if ( result >= eOK ) - PREF_RegisterCallback("mail.identity",ProfilePrefChangedFunc, NULL); - done = true; - } - else - { - newUserID = lastUserID; - Try_ - { - if ( profileDB.GetProfileAlias( lastUserID, profileFolder ) ) - result = eOK; - else - result = eUnknownError; - } - Catch_ ( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kReadError ); - ErrorManager::ErrorNotify( inErr, errStr ); - } - - if ( result < eOK ) - { - // ¥ if we failed to load the profile, loop back to the - // beginning and force Profile Manager to appear - done = false; - showDialog = wantsProfileManager = true; - } - else - { - long err; - err = SendMessageToPlugin( kAutoSelectDialConfig, &profileFolder ); - if ( err == errProfileNotFound ) - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - - PREF_RegisterCallback( "mail.identity",ProfilePrefChangedFunc, NULL ); - } - } - - // ¥ save the previous user ID back to profile db - if ( result >= eOK ) - { - if ( sCurrentProfileID != kTemporaryProfileID ) - sCurrentProfileID = newUserID; - numProfiles = profileDB.CountProfiles(); - } - } - Catch_ ( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kReadError ); - ErrorManager::ErrorNotify( inErr, errStr ); - result = eUnknownError; - } - } - while ( !done ); - - if (result != eUserCancelled) { - // ¥Êreflect path & name into xp preferences - if ( (sCurrentProfileID != kInvalidProfileID) - && sCurrentProfileID != kTemporaryProfileID ) - { - profileDB.GetProfileName( sCurrentProfileID, profileName ); - ReflectToPreferences(profileName, profileFolder, numProfiles); - } - } - return result; -} - -static void PrefToEditField(const char * prefName, LGAEditField * field); -static void EditFieldToPref(LGAEditField * field, const char * prefName); - -#define PREF_STRING_LEN 255 -void PrefToEditField(const char * prefName, LGAEditField * field) -{ - int prefStringLen; - char prefString[PREF_STRING_LEN]; - prefStringLen = PREF_STRING_LEN; - if ( PREF_GetCharPref(prefName, prefString, &prefStringLen) == 0 ) - { - c2pstr(prefString); - field->SetDescriptor((unsigned char *)prefString); - } -} - -void EditFieldToPref(LGAEditField * field, const char * prefName) -{ - Str255 s; - field->GetDescriptor(s); - p2cstr(s); - PREF_SetCharPref(prefName, (char*)s); -} - -// Displays the additional data login dialog. Throws are taken care of by -// the caller -void -CUserProfile::DoNetExtendedProfileDialog(LCommander * super) -{ - StDialogHandler theHandler(9911, super); - LWindow *theDialog = theHandler.GetDialog(); - - LGAEditField *ldapAddressField = (LGAEditField*)theDialog->FindPaneByID('addr'); - LGAEditField *searchBaseField = (LGAEditField*)theDialog->FindPaneByID('sbas'); - LGAEditField *httpAddressField = (LGAEditField*)theDialog->FindPaneByID('hurl'); - LGARadioButton * ldapRadio = (LGARadioButton *)theDialog->FindPaneByID('ldap'); - LGARadioButton * httpRadio = (LGARadioButton *)theDialog->FindPaneByID('http'); - - ThrowIfNil_(ldapAddressField); - ThrowIfNil_(searchBaseField); - ThrowIfNil_(httpAddressField); - ThrowIfNil_(ldapRadio); - ThrowIfNil_(httpRadio); - -// Initialize the dialog from the preferences - PrefToEditField("li.server.ldap.url", ldapAddressField ); - PrefToEditField("li.server.ldap.userbase", searchBaseField ); - PrefToEditField("li.server.http.baseURL", httpAddressField); -#define PREF_LEN 10; - int prefStringLen; - char prefString[PREF_STRING_LEN]; - prefStringLen = PREF_STRING_LEN; - if ( PREF_GetCharPref("li.protocol", prefString, &prefStringLen) == 0 ) - if (XP_STRCMP(prefString, "http") == 0) - httpRadio->SetValue(1); - else - ldapRadio->SetValue(1); -// Do the dialog - httpAddressField->SelectAll(); - theDialog->SetLatentSub(httpAddressField); - theDialog->Show(); - - while (true) - { - MessageT hitMessage = theHandler.DoDialog(); - if ( hitMessage == msg_Cancel ) - break; - else if ( hitMessage == msg_OK ) - { - - LStr255 httpAddress; - httpAddressField->GetDescriptor(httpAddress); - if ( httpAddress.Length() > 2 ) - { - if (!httpAddress.BeginsWith(LStr255("http://"))) - httpAddress.Insert(LStr255("http://"), 0); - } - EditFieldToPref(ldapAddressField, "li.server.ldap.url"); - EditFieldToPref(searchBaseField, "li.server.ldap.userbase"); - EditFieldToPref(httpAddressField, "li.server.http.baseURL"); - - if ( ldapRadio->GetValue() > 0 ) - PREF_SetCharPref("li.protocol", "ldap"); - else - PREF_SetCharPref("li.protocol", "http"); - - break; - } - } -} - -// Displays the modal login dialog -ProfileErr -CUserProfile::DoNetProfileDialog() -{ - ProfileErr perr = eOK; - try - { - StDialogHandler theHandler(9910, CFrontApp::GetApplication()); - LWindow *theDialog = theHandler.GetDialog(); - - LGAEditField *usernameField = (LGAEditField*)theDialog->FindPaneByID('user'); - LGAEditField *passwordField = (LGAEditField*)theDialog->FindPaneByID('pass'); - - ThrowIfNil_(usernameField); - ThrowIfNil_(passwordField); - - PrefToEditField( "li.login.name", usernameField); - PrefToEditField( "li.login.password", passwordField); - - usernameField->SelectAll(); - theDialog->SetLatentSub(usernameField); - theDialog->Show(); - - while (true) - { - MessageT hitMessage = theHandler.DoDialog(); - - if (hitMessage == msg_Cancel) - { - perr = eUserCancelled; - break; - } - else if (hitMessage == msg_OK) - { - EditFieldToPref( usernameField, "li.login.name"); - EditFieldToPref( passwordField, "li.login.password"); - - PREF_SetBoolPref("li.enabled", true); - perr = eOK; - break; - } - else if (hitMessage == 'adva') // Advanced button - { - DoNetExtendedProfileDialog(theDialog); - } - } - } - catch (ExceptionCode err) - { - XP_ASSERT(false); - perr = eUnknownError; - } - - return perr; -} - -// Creates a network profile folder -// The folder is located inside the users folder -ProfileErr -CUserProfile::CreateNetProfile( FSSpec usersFolder, FSSpec& profileFolderSpec ) -{ - ProfileErr perr; - perr = DoNetProfileDialog(); - - if (perr == eOK) - { - try - { - CStr255 profileFolderName("Temporary Profile"); - OSErr err; - - // Create the folder spec of the profile directory - profileFolderSpec = usersFolder; - LString::CopyPStr(profileFolderName, profileFolderSpec.name, sizeof(profileFolderSpec.name)); - - // If the folder already exists, delete it - err = CFileMgr::DeleteFolder( profileFolderSpec ); - XP_ASSERT((err == noErr) || (err == fnfErr)); - - // Create the folder - short dummy; - long dummy2; - err = CFileMgr::CreateFolderInFolder(usersFolder.vRefNum, usersFolder.parID, profileFolderName, - &dummy, &dummy2); - ThrowIfOSErr_(err); - ReflectToPreferences( CStr255("Network Profile"), profileFolderSpec); - } - catch (ExceptionCode err) - { - XP_ASSERT(false); - return eUnknownError; - } - } - - return perr; -} - -// ¥Êlaunches upgrade wizard for users who have not run 4.0 before -// creates an initial profile folder and User Profiles file. -// if oldNetscapeF is non-null, it points to the user's 3.0 -// Netscape Ä folder and the profile "folder" is an alias to it -ProfileErr -CUserProfile::HandleUpgrade( FSSpec& profileFolder, const FSSpec* oldNetscapeF ) -{ - ProfileErr result = eOK; - CStr31 profileName; - - do - { - Try_ - { - FSSpec profileSpec = CPrefs::GetFilePrototype( CPrefs::UsersFolder ); - - if ( mHasConfigPlugin && !oldNetscapeF ) - { - profileFolder.vRefNum = profileSpec.vRefNum; - profileFolder.parID = profileSpec.parID; - profileName = MAGIC_PROFILE_NAME; - LString::CopyPStr( profileName, profileFolder.name, 32 ); - - CreateDefaultProfileFolder( profileFolder ); - result = eRunAccountSetup; - } - else - { - UpgradeEnum upgrading = (oldNetscapeF == nil) ? eNewInstall : eExistingPrefs; - result = NewUserProfile( profileSpec, profileFolder, profileName, - upgrading, oldNetscapeF ); - } - if ( result == eUserCancelled ) - return eUserCancelled; - - if ( profileName.Length() == 0 ) - GetIndString( profileName, kProfileStrings, kDefaultName ); - - // ¥Êcreate Profiles file and add the alias - GetIndString( profileSpec.name, 300, userProfiles ); - CUserProfileDB profileDB( profileSpec, true ); - - profileDB.AddNewProfile( 0, profileName, profileFolder ); - sCurrentProfileID = 0; - } - Catch_( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kCreateError ); - ErrorManager::ErrorNotify( inErr, errStr ); - result = eUnknownError; - // ¥Êloop through wizard again if error - // don't loop 5/14/97 tgm - //done = false; - } - } - while ( 0 /*!done*/); - - ReflectToPreferences(profileName, profileFolder); - - return result; -} - -// ¥ puts up user-selection dialog and returns selected user ID -ProfileErr CUserProfile::HandleProfileDialog( - FSSpec& profileSpec, - CUserProfileDB& profileDB, - FSSpec& profileFolder, - short& newUserID, - short lastUserID, - Boolean wantsProfileManager ) -{ - int dialogID = wantsProfileManager ? - profileManagerDialog : profileSelectDialog; - Boolean success = false; - LListBox* listBox; - LGAPushButton* okButton; - LPane* newButton; - LPane* deleteButton; - LPane* renameButton; - LPane* optionsButton; - LPane* remoteButton; - - ProfileErr result = eOK; - - RegisterClass_( LWhiteListBox); - - StBlockingDialogHandler dialog( dialogID, CFrontApp::GetApplication() ); - - listBox = (LListBox*)dialog.GetDialog()->FindPaneByID( 'user' ); - ThrowIfNil_( listBox ); - ListHandle listHand = listBox->GetMacListH(); - (**listHand).selFlags = lOnlyOne + lNoNilHilite; // only one selection - - LAddColumn( 1, 0, listHand ); - PopulateListBox( listHand, profileDB, lastUserID ); - Cell cell; - if( listBox->GetLastSelectedCell( cell ) ) - listBox->MakeCellVisible(cell); - listBox->AddListener( &dialog ); - listBox->SwitchTarget( listBox ); - - okButton = (LGAPushButton*)dialog.GetDialog()->FindPaneByID( 'ok ' ); - deleteButton = dialog.GetDialog()->FindPaneByID( 2 ); - renameButton = dialog.GetDialog()->FindPaneByID( 3 ); - newButton = dialog.GetDialog()->FindPaneByID( 1 ); - optionsButton = dialog.GetDialog()->FindPaneByID( 'Ebut' ); - remoteButton = dialog.GetDialog()->FindPaneByID( 'remo' ); - - if ( remoteButton ) - { - XP_Bool daBool = FALSE;; - PREF_GetBoolPref("li.ui.enabled", &daBool); - if (!daBool) - { - remoteButton->Hide(); - listBox->ResizeFrameBy(0, 24, true); - } - } - if ( wantsProfileManager ) - ThrowIfNil_( okButton && deleteButton && renameButton && newButton ); - else - ThrowIfNil_( okButton ); - - if ( !mHasConfigPlugin ) - { - if ( optionsButton ) - optionsButton->Hide(); - } - else - { - if ( !wantsProfileManager ) - SendMessageToPlugin( kInitListener, (LDialogBox*)dialog.GetDialog() ); - } - - short tempUserID = -1; - - /* keep track of the amount of time we've been idly showing this dialog */ - long startTime = TickCount(); - long elapsedTime = 0; - long secsLeft = 30; //we actually get this from a resource in the User Profiles file if it exists. - Boolean keepCounting = (!wantsProfileManager); /* only countdown in simple profile picker. not manager*/ - const ResIDT autoStartResID = 9999; - - // Check to see if our secret keep coounting resource exists - StUseResFile resFile( profileDB.GetFile()->GetResourceForkRefNum() ); - StringHandle numSecsStringH = (StringHandle) ::Get1Resource('TEXT', autoStartResID); - if (keepCounting && numSecsStringH) - { - char buffer[4]; - buffer[sizeof(buffer)-1] = 0; - - memcpy( (unsigned char *)buffer, (unsigned char *)*numSecsStringH, min(GetHandleSize((Handle)numSecsStringH),(long)sizeof(buffer)-1)); - secsLeft = atoi(buffer); - if (secsLeft <= 0 || secsLeft > 300) - keepCounting = false; - } - else - keepCounting = false; - - (dialog.GetDialog())->Show(); - - while ( !success ) - { - //Ê¥ catch any errors inside dialog loop - Try_ - { - Cell cell; - - MessageT hit = dialog.DoDialog(); - - // default to selecting the last selected profile if enough time has elapsed - if (keepCounting && (secsLeft <= 0)) - { - okButton->SimulateHotSpotClick(1); - hit = cmd_SelectProfile; - } - else if (keepCounting) - { - // update secsLeft - elapsedTime = TickCount() - startTime; - if (elapsedTime >= 60) - { - secsLeft--; - startTime = TickCount(); - } - } - else if (secsLeft >= 0) - secsLeft = -1; - - if (listBox->GetLastSelectedCell( cell ) ) - { - newUserID = cell.v; - okButton->Enable(); - if (wantsProfileManager) { - renameButton->Enable(); - if ( profileDB.CountProfiles() > 1 ) - // ¥Êdon't allow deleting last profile - deleteButton->Enable(); - else - deleteButton->Disable(); - } - if ( optionsButton ) - optionsButton->Enable(); - } - else - { - newUserID = -1; - okButton->Disable(); - if (wantsProfileManager) { - renameButton->Disable(); - deleteButton->Disable(); - } - if ( optionsButton ) - optionsButton->Disable(); - } - - if ( newUserID != tempUserID ) - { - if (tempUserID > -1) - keepCounting = false; - if ( newUserID != -1 && mHasConfigPlugin ) - { - if ( profileDB.GetProfileAlias( newUserID, profileFolder, false ) ) - SendMessageToPlugin( kNewProfileSelect, &profileFolder ); - else - SendMessageToPlugin( kClearProfileSelect, NULL ); - } - tempUserID = newUserID; - } - - switch ( hit ) - { - case cmd_SelectProfile: - success = profileDB.GetProfileAlias( newUserID, profileFolder ); - if ( success ) - { - long err; - err = SendMessageToPlugin( kSelectDialConfig, &profileFolder ); - if ( err == errProfileNotFound ) - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - } - keepCounting = false; - - break; - - case cmd_NewProfile: - CStr31 profileName; - result = NewUserProfile( profileSpec, profileFolder, profileName ); - - if ( result == eUserCancelled ) - { - result = eOK; - } - else - { - newUserID = profileDB.CountProfiles(); - profileDB.AddNewProfile( newUserID, profileName, profileFolder ); - - // redraw the profile list box - LDelRow(0, 0, listHand); - PopulateListBox(listHand, profileDB, newUserID); - listBox->Refresh(); - success = true; - - // ¥Êwe ran the Profile Wizard and now we should - // open the Edit Settings dialog for the associated - // dial configuration - if ( result == eRunMUC ) - { - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - result = eOK; - } - - // ¥ we ran the Profile Wizard, but we don't want to - // associate a dialing configuration, so write out - // an empty "Configuration" file by calling - // the plugin - else if ( result == eSkipMUC ) - { - SendMessageToPlugin( kAutoSelectDialConfig, &profileFolder ); - result = eOK; - } - } - keepCounting = false; - break; - - case cmd_RenameProfile: - RenameProfile( newUserID, profileDB, cell, listHand ); - keepCounting = false; - break; - - case cmd_DeleteProfile: - DeleteProfile( newUserID, profileDB, listHand ); - listBox->Refresh(); - keepCounting = false; - break; - - case cmd_QuitProfile: - keepCounting = false; - return eUserCancelled; - break; - - case cmd_EditDialSettings: - if ( profileDB.GetProfileAlias( newUserID, profileFolder ) ) - { - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - tempUserID = -1; - } - keepCounting = false; - break; - case cmd_RemoteProfile: - { - result = DoNetProfileDialog(); - if ( result == eOK ) - result = CreateNetProfile( profileSpec, profileFolder); - - if ( result != eUserCancelled ) - { - newUserID = lastUserID; - success = true; - } - else - result = eOK; - } - break; - } - } - Catch_ ( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kReadError ); - ErrorManager::ErrorNotify( inErr, errStr ); - } - } - - return result; -} - -Boolean CUserProfile::DeleteMagicProfile( FSSpec& inSpec ) -{ - short nextID = 0; - CStr31 profileName; - FSSpec profileSpec; - char* fullURL; - Boolean found = FALSE; - - profileSpec.vRefNum = inSpec.vRefNum; - profileSpec.parID = inSpec.parID; - profileName = MAGIC_PROFILE_NAME; - LString::CopyPStr( profileName, profileSpec.name, 32 ); - - CUserProfileDB db( inSpec ); - - while ( db.GetProfileName( nextID++, profileName ) ) - { - if ( profileName == MAGIC_PROFILE_NAME ) - { - db.DeleteProfile( --nextID ); - if ( db.GetLastProfileID() == nextID ) - db.SetLastProfileID( 0 ); - found = TRUE; - break; - } - } - - fullURL = CFileMgr::EncodedPathNameFromFSSpec( profileSpec, TRUE ); - if ( fullURL && found ) - { - XP_RemoveDirectoryRecursive( fullURL, xpURL ); - XP_FREE( fullURL ); - } - if ( found ) - return TRUE; - return FALSE; -} - -void CUserProfile::PopulateListBox(ListHandle& listHand, CUserProfileDB& profileDB, short defaultID) -{ - LSetDrawingMode(false, listHand); - - short nextID = 0; - Cell cell; - CStr31 str; - Boolean gotOne = profileDB.GetProfileName(nextID, str); - while (gotOne) { - LAddRow(1, nextID, listHand); - SetPt(&cell, 0, nextID); - LSetCell(&str.fStr[1], str.fStr[0], cell, listHand); - gotOne = profileDB.GetProfileName(++nextID, str); - } - // ¥Êselect last user or first cell & scroll to it - SetPt(&cell, 0, defaultID); - LSetSelect(true, cell, listHand); - LAutoScroll(listHand); - LSetDrawingMode(true, listHand); -} - -// Ensure the requested new profile folder does not exist; -// if it does, append a number to make a unique name. -void CUserProfile::GetUniqueFolderName(FSSpec& folder) -{ - if (CFileMgr::FileExists(folder)) { - int nextIndex = 2; - CStr31 requestedName = folder.name; - if (requestedName.Length() > 28) - requestedName.Length() = 28; - CStr31 uniqueName; - do { - uniqueName = requestedName; - char suffix[3]; - sprintf(suffix, "-%d", nextIndex++); - uniqueName += suffix; - LString::CopyPStr(uniqueName, folder.name, 32); - } - while (CFileMgr::FileExists(folder)); - } -} - - -// Make one desktop icon -static const kIconNameStringsListID = 9800; - -static OSErr MakeOneDesktopIcon(const CStr31 &profileName, short templateNameIndex, short iconNameIndex) -{ - OSErr err = noErr; - FSSpec shortcutSpec = CPrefs::GetFilePrototype(CPrefs::RequiredGutsFolder); - FSSpec desktopFolderSpec; - FSSpec desktopIconSpec; - short vRefNum; - long folderID; - - GetIndString(shortcutSpec.name, kIconNameStringsListID, templateNameIndex); - - //find the source file - if (!CFileMgr::FileExists(shortcutSpec) || CFileMgr::IsFolder(shortcutSpec)) - ThrowIfOSErr_(fnfErr); - - //check the destination - err = ::FindFolder(kOnSystemDisk, kDesktopFolderType, true, - &vRefNum, &folderID); - ThrowIfOSErr_(err); - - err = CFileMgr::FolderSpecFromFolderID(vRefNum, folderID, desktopFolderSpec); - ThrowIfOSErr_(err); - - desktopIconSpec.parID = folderID; - desktopIconSpec.vRefNum = vRefNum; - GetIndString(desktopIconSpec.name, kIconNameStringsListID, iconNameIndex); - - //Append the profile name. We know that it does not contain colons - CStr63 iconName(desktopIconSpec.name); - - iconName += profileName; - - //Truncate the iconName if necessary to 31 chars - if (iconName.Length() > 30) { - iconName[0] = 30; - iconName[30] = 'É'; - } - - LString::CopyPStr(iconName, desktopIconSpec.name, 31); - - //If there is already an icon with the same name, append the profile name - long nextIndex = 1; - - while (CFileMgr::FileExists(desktopIconSpec)) - { - CStr63 uniqueName(iconName); - char suffix[5]; - short len; - - sprintf(suffix, "-%d", nextIndex++); - - len = 30 - strlen(suffix); - //Truncate the uniqueName if necessary - if (uniqueName.Length() > len) { - uniqueName[0] = len; - uniqueName[len] = 'É'; - } - - uniqueName += suffix; - - LString::CopyPStr(uniqueName, desktopIconSpec.name, 31); - } - - //phew. now we have a unique name to copy to - err = CFileMgr::CopyFile(shortcutSpec, desktopFolderSpec, desktopIconSpec.name); - ThrowIfOSErr_(err); - - //make sure the custom icon bit is set - err = CFileMgr::SetFileFinderFlag(desktopIconSpec, kHasCustomIcon, TRUE); - ThrowIfOSErr_(err); - - //And now copy the profile name into the data fork - if (! CFileMgr::FileExists(desktopIconSpec)) //if it does not, we're in trouble - ThrowIfOSErr_(fnfErr); - - LFile scriptFile(desktopIconSpec); - - scriptFile.OpenDataFork(fsRdWrPerm); - scriptFile.WriteDataFork((const char*)profileName, profileName.Length()); - scriptFile.CloseDataFork(); - - return err; -} - - - -// Make the desktop icons for the selected profile. -// They are acually applescripts copied from the essential files -// folder, with a property modified for this profile. - -OSErr CUserProfile::MakeDesktopIcons( - const CStr31 &profileName, - const Boolean wantsNavigator, - const Boolean wantsInbox ) -{ - OSErr err = noErr; - - enum { kNavShortcutName = 1, kInboxShortcutName, - kNavDesktopName, kInboxDesktopName}; //in profile.cnst - - if (wantsNavigator) - err = MakeOneDesktopIcon(profileName, kNavShortcutName, kNavDesktopName); - - if (wantsInbox) - err = MakeOneDesktopIcon(profileName, kInboxShortcutName, kInboxDesktopName); - - return err; -} - - -// ¥ prompts for a new user profile -ProfileErr CUserProfile::NewUserProfile( - const FSSpec& profileSpec, - FSSpec& profileFolder, - CStr31& profileName, - UpgradeEnum upgrading, - const FSSpec* oldNetscapeF ) -{ - Boolean userChoseFolder = false; - ProfileErr result = eOK; - - profileFolder.vRefNum = profileSpec.vRefNum; - profileFolder.parID = profileSpec.parID; - - result = NewProfileWizard( upgrading, profileName, profileSpec, - profileFolder, userChoseFolder ); - - if ( result == eUserCancelled ) - return eUserCancelled; - - // ¥ If the user chose a folder, see if it contains an existing - // Preferences file. If so, this folder becomes the new profile - // folder; otherwise, create a new folder inside it. - if ( userChoseFolder ) { - long parentID; - ThrowIfOSErr_( CFileMgr::GetFolderID(profileFolder, parentID) ); - - FSSpec prefFile; - prefFile.vRefNum = profileFolder.vRefNum; - prefFile.parID = parentID; - ::GetIndString( prefFile.name, 300, prefFileName ); - if (! CFileMgr::FileExists(prefFile)) { - // want to create a new folder inside the selected one - userChoseFolder = false; - profileFolder.parID = parentID; - } - } - - // ¥Êcreate a folder and return it - if ( !userChoseFolder ) - { - LString::CopyPStr( profileName, profileFolder.name, 32 ); - GetUniqueFolderName(profileFolder); - - if ( oldNetscapeF ) - { - // ¥Êspecial case: point profile to existing 3.0 Netscape Ä - CFileMgr::MakeAliasFile( profileFolder, *oldNetscapeF ); - - profileFolder = *oldNetscapeF; - } - else - { - CreateDefaultProfileFolder(profileFolder); - } - } - - if (CFrontApp::GetApplication()->HasImportModule()) - { - CDeferredCommand* task = new CDeferredCommand( - CFrontApp::GetApplication(), - cmd_LaunchImportModule, nil); - CDeferredTaskManager::Post(task, nil); - } - return result; -} - -ProfileErr CUserProfile::NewProfileWizard( - UpgradeEnum upgrading, - CStr31 &profileName, - const FSSpec &profileFolder, - FSSpec &newProfileFolder, - Boolean &userChoseFolder ) -{ - // ¥ if we're upgrading 3.0 prefs, we don't allow the user to change - // the profile folder; just display & disable the default folder. - // Otherwise, the callback fills in the user name as the profile - // folder and lets the user edit it. (--this needs work) - LArray paneList( sizeof( PaneIDT ) ); - - -#ifdef CAN_MAKE_DESKTOP_ICONS_FOR_PROFILE - PaneIDT normalPaneList[] = { profileIntroPane, userNamePane, profileNamePane, - profileFolderPane, profileIconsPane, profileDonePane, 0 }; - PaneIDT mucPaneList[] = { profileIntroPane, profilePEPane, userNamePane, profileNamePane, - profileFolderPane, profileIconsPane, profileDonePane, 0 }; -#else - PaneIDT normalPaneList[] = { profileIntroPane, userNamePane, profileNamePane, - profileFolderPane, profileDonePane, 0 }; - PaneIDT mucPaneList[] = { profileIntroPane, profilePEPane, userNamePane, profileNamePane, - profileFolderPane, profileDonePane, 0 }; -#endif - - PaneIDT* tmpP; - - if ( !mHasConfigPlugin ) - tmpP = normalPaneList; - else - tmpP = mucPaneList; - - while ( *tmpP != 0 ) - paneList.InsertItemsAt( 1, LArray::index_Last, tmpP++ ); - - CDialogWizardHandler wizard( updateWizardDialog, paneList ); - - LListener* listener = new CProfilePaneMonitor( &wizard ); - wizard.AddListener( listener ); - - LWindow* window = wizard.GetDialog(); - if ( upgrading == eExistingPrefs ) - { - wizard.SetEditText( 'name', CPrefs::GetString( CPrefs::UserName ) ); - wizard.SetEditText( 'mail', CPrefs::GetString( CPrefs::UserEmail ) ); - } - if ( upgrading != eNoUpgrade ) - { - LStdControl* cancel = (LStdControl*)window->FindPaneByID( 'cncl' ); - if (cancel) - { - CStr31 label; - GetIndString( label, kProfileStrings, kQuitLabel ); - cancel->SetDescriptor( label ); - } - } - - // ¥ hide "detected previous Navigator version" text if appropriate - if ( upgrading != eExistingPrefs || CPrefs::sPrefFileVersion != 3 ) - { - LPane* upgradeText = window->FindPaneByID( 40 ); - if ( upgradeText ) - upgradeText->Hide(); - upgradeText = window->FindPaneByID( 41 ); - if ( upgradeText ) - upgradeText->Hide(); - } - - FSSpec tempFolder; - tempFolder.vRefNum = profileFolder.vRefNum; - tempFolder.parID = profileFolder.parID; - LString::CopyPStr( "\p", tempFolder.name, 32 ); - - CFilePicker* picker = (CFilePicker*)window->FindPaneByID( 'fold' ); - ThrowIfNil_( picker ); - picker->SetPickType( CFilePicker::Folders ); - picker->SetFSSpec( tempFolder, false ); - // ¥ don't allow different folder when upgrading - if ( upgrading == eExistingPrefs ) { - LPane* chooseBtn = picker->FindPaneByID(2); - LPane* chooseText = window->FindPaneByID(31); - if (chooseBtn && chooseText) { - chooseBtn->Hide(); - chooseText->Hide(); - } - } - - // show the profile wizard - if ( wizard.DoWizard() == false ) - { - // ¥Êuser cancelled - delete listener; - return eUserCancelled; - } - - // copy user name & email to prefs; return profile name - CStr255 userName; - wizard.GetEditText( 'name', userName ); - CPrefs::SetString( userName, CPrefs::UserName ); - CStr255 emailAddr; - wizard.GetEditText( 'mail', emailAddr ); - CPrefs::SetString( emailAddr, CPrefs::UserEmail ); - - wizard.GetEditText( 'pnam', profileName ); - StripColons(profileName); - -#ifdef CAN_MAKE_DESKTOP_ICONS_FOR_PROFILE - // make the desktop icons - OSErr err = MakeDesktopIcons(profileName, wizard.GetCheckboxValue('navb'), wizard.GetCheckboxValue('inbb')); - ThrowIfOSErr_(err); //should we do this? -#endif // CAN_MAKE_DESKTOP_ICONS_FOR_PROFILE - - if ( picker->WasSet() ) - { - userChoseFolder = true; - CFileMgr::CopyFSSpec( picker->GetFSSpec(), newProfileFolder ); - } - - delete listener; - - if ( mHasConfigPlugin ) - { - LControl* radioNew = (LControl*)window->FindPaneByID( 'Rnew' ); - LControl* radioExs = (LControl*)window->FindPaneByID( 'Rexs' ); - - if ( ( radioNew && radioNew->GetValue() ) || upgrading != eNoUpgrade ) - return eRunAccountSetup; - else if ( radioExs && radioExs->GetValue() /* ( upgrading != eNoUpgrade ) */) - return eRunMUC; - return eSkipMUC; - } - - return eOK; -} - -void CUserProfile::RenameProfile(short selectedID, CUserProfileDB& profileDB, - Cell& cell, ListHandle& listHand) -{ - CStr31 newName; - if (profileDB.GetProfileName(selectedID, newName) == false) - return; - - CStr255 prompt; - GetIndString(prompt, kProfileStrings, kRenamePrompt); - - Boolean ok = UStdDialogs::AskStandardTextPrompt(nil, prompt, newName, - NULL, NULL, kStr31Len); - - if (ok && newName.Length() > 0) { - LSetCell(&newName.fStr[1], newName.Length(), cell, listHand); - - profileDB.SetProfileName(selectedID, newName); - } -} - -void CUserProfile::DeleteProfile(short selectedID, CUserProfileDB& profileDB, ListHandle& listHand) -{ - CStr255 prompt; - GetIndString(prompt, kProfileStrings, kDeletePrompt); - if (ErrorManager::PlainConfirm(prompt)) - { - profileDB.DeleteProfile(selectedID); - - if (--selectedID < 0) - selectedID = 0; - - // redraw the profile list box - LDelRow(0, 0, listHand); - - PopulateListBox(listHand, profileDB, selectedID); - } -} - -// ¥ Reflects profile name & path into xp preferences for querying by PE; -// also registers a callback so changing the name renames the profile. -// if we don't know how many profiles we have, pass -1 and the numprofiles -// pref will not be set (nasty hack: see CPrefs::InitPrefsFolder()) -void -CUserProfile::ReflectToPreferences(const CStr31& profileName, - const FSSpec& profileFolder, short numProfiles) -{ - char* folderPath = CFileMgr::EncodedPathNameFromFSSpec( profileFolder, true ); - if ( folderPath ) - { - PREF_SetDefaultCharPref( "profile.directory", folderPath ); - free( folderPath ); - } - - PREF_SetDefaultCharPref( "profile.name", profileName ); - -#ifdef MOZ_MAIL_NEWS - MSG_WriteNewProfileAge(); -#endif // MOZ_MAIL_NEWS - - if (numProfiles > -1) - PREF_SetDefaultIntPref( "profile.numprofiles", numProfiles ); - - PREF_RegisterCallback( "profile.name", ProfilePrefChangedFunc, NULL ); -} - -// ¥ If a Defaults folder exists in Essential Files, copy it into -// Netscape Users and rename it to the selected profile name. -// Otherwise, or in case of a copying error, create a new folder. -void CUserProfile::CreateDefaultProfileFolder(const FSSpec& profileFolder) -{ - OSErr err = noErr; - Boolean needToCreate = true; - - FSSpec usersFolder; - CFileMgr::FolderSpecFromFolderID(profileFolder.vRefNum, - profileFolder.parID, usersFolder); - - FSSpec templateFolder = CPrefs::GetFilePrototype(CPrefs::RequiredGutsFolder); - GetIndString( templateFolder.name, 300, profileTemplateDir ); - - if (CFileMgr::FileExists(templateFolder)) - { - err = FSpDirectoryCopy( &templateFolder, &usersFolder, - nil, 0, true, nil ); - - if (err == noErr) { - needToCreate = false; - - err = HRename(profileFolder.vRefNum, profileFolder.parID, - templateFolder.name, profileFolder.name); - } - } - - if (needToCreate) { - short newRefNum; - long newParID; - err = CFileMgr::CreateFolderInFolder( - profileFolder.vRefNum, profileFolder.parID, - profileFolder.name, &newRefNum, &newParID ); - } - - ThrowIfOSErr_( err ); -} - -// ¥Êfind the network configuration plugin and return a function ptr. -// to it's only entry point if possible -void* CUserProfile::LoadConfigPlugin() -{ - // BULLSHIT ALERT: Get out if I can't call GetSharedLibrary. - // Future: do the right thing for 68K. See bug#56245 - long sSysArchitecture = 0; - if ( (Gestalt(gestaltSysArchitecture, &sSysArchitecture) != noErr) - || (sSysArchitecture != gestaltPowerPC) ) - { - // Can't determine what we _do_ have, or we determined that it's _not_ PPC... - return NULL; - } - - Ptr main; - Str255 errName; - PE_PluginFuncType pluginFunc; - - OSErr err = ::GetSharedLibrary( "\pMUP", kPowerPCCFragArch, kFindCFrag, &mConfigPluginID, - &main, errName ); - if ( err != noErr ) - { - err = ::GetSharedLibrary( "\pMUP", kPowerPCCFragArch, kLoadCFrag, &mConfigPluginID, - &main, errName ); - } - if ( err == noErr ) - { - CFragSymbolClass dontCare; - mPluginLoaded = TRUE; - err = ::FindSymbol( mConfigPluginID, "\pPE_PluginFunc", (Ptr*)&pluginFunc, &dontCare ); - } - - if ( err == noErr ) - return pluginFunc; - return NULL; -} - -// ¥Êclose the connection to the configuration plugin -OSErr CUserProfile::CloseConfigPlugin() -{ -// if ( mPluginLoaded ) -// return CloseConnection( &mConfigPluginID ); - return noErr; -} - -long CUserProfile::SendMessageToPlugin( long selector, void* pb ) -{ - OSErr err; - PE_PluginFuncType pluginFunc; - - if ( !mHasConfigPlugin ) - return -1; - - pluginFunc = (PE_PluginFuncType)LoadConfigPlugin(); - if ( pluginFunc ) - { - union { - char buffer[ 1024 ]; - MUCInfo mucInfo; - } tmp; - - // ¥Êcall the stub to have it switch all the local machine - // stuff to use this user's configuration - err = (*pluginFunc)( selector, pb, tmp.buffer ); - CloseConfigPlugin(); - -// if ( err == noErr && selector == kGetDialConfig ) -// { -// cstring descString; -// PrettyPrintConfiguration( mucInfo, descString ); -// inCaption->SetDescriptor( (CStr255)(char*)descString ); -// } - return noErr; - } - return noErr; -} - -/***************************************************************************** -*/ -CUserProfileDB::CUserProfileDB( FSSpec& spec, Boolean createIt ): fFile( spec ) -{ - if ( createIt ) - { - Try_ - { - fFile.CreateNewFile( emSignature, 'PRFL' ); // ?? file type? - } - Catch_( inErr ) - { - if ( inErr == dupFNErr ) - ; - else - Throw_( inErr ); - } - } - fFile.OpenResourceFork( fsRdWrPerm ); -} - -short CUserProfileDB::CountProfiles() -{ - return ::Count1Resources('STR '); -} - -short CUserProfileDB::GetNextProfileID() -{ - short nextUserID = CountProfiles(); - - return nextUserID; -} - -short CUserProfileDB::GetProfileIDByUsername(const CString& username) -{ - int id = kFirstProfileID, returnID = -1; - Handle hProfileData = GetDBResource('DATA', id); - ProfileDataHeader *pHeader; - char *profileUser; - - while (hProfileData && (returnID == -1)) { - HLock(hProfileData); - pHeader = (ProfileDataHeader *) *hProfileData; - - profileUser = ((char *) pHeader) + pHeader->firstOffset; - - if (username == profileUser) { - returnID = id - kFirstProfileID; - } - - HUnlock(hProfileData); - - hProfileData = GetDBResource('DATA', ++id); - - } - - return returnID; -} - -short CUserProfileDB::GetProfileIDByEmail(const CString& emailAddr) -{ - int id = kFirstProfileID, returnID = -1; - Handle hProfileData = GetDBResource('DATA', id); - ProfileDataHeader *pHeader; - char *profileEmail; - - while (hProfileData && (returnID == -1)) { - HLock(hProfileData); - pHeader = (ProfileDataHeader *) *hProfileData; - - profileEmail = ((char *) pHeader) + pHeader->firstOffset - + pHeader->nameLength; - - if (emailAddr == profileEmail) { - returnID = id - kFirstProfileID; - } - - HUnlock(hProfileData); - - hProfileData = GetDBResource('DATA', ++id); - - } - - return returnID; -} - -short CUserProfileDB::GetLastProfileID() -{ - short lastUserID = kFirstProfileID; - short nextUserID = kFirstProfileID + GetNextProfileID(); - - // ID of the previous user is stored as a resource - Handle lastUser = GetDBResource('user', kFirstProfileID); - if (lastUser) { - lastUserID = **(short **) lastUser; - if (lastUserID >= nextUserID) - lastUserID = kFirstProfileID; - ::ReleaseResource(lastUser); - } - - return lastUserID - kFirstProfileID; -} - -void CUserProfileDB::SetLastProfileID(short newUserID) -{ - newUserID += kFirstProfileID; - Handle lastUser = GetDBResource('user', kFirstProfileID); - if (!lastUser) { - PtrToHand(&newUserID, &lastUser, sizeof(short)); - ::AddResource(lastUser, 'user', kFirstProfileID, nil); - } - else { - BlockMove(&newUserID, *lastUser, sizeof(short)); - ::ChangedResource(lastUser); - ::ReleaseResource(lastUser); - } -} - -void CUserProfileDB::AddNewProfile(short id, const CStr31& profileName, const FSSpec& profileFolder) -{ - id += kFirstProfileID; - // create new STR, alis, and DATA resources - StringHandle nameHand; - PtrToHand(profileName, &(Handle) nameHand, profileName.Length() + 1); - AddResource((Handle) nameHand, 'STR ', id, nil); - - AliasHandle alias; - OSErr err = NewAlias( nil, &profileFolder, &alias ); - if (err == noErr) { - AddResource((Handle) alias, 'alis', id, profileFolder.name); - } - - SetProfileData(id - kFirstProfileID); -} - -Boolean CUserProfileDB::GetProfileName(short id, CStr31& name) -{ - // -- use Get1Resource instead of GetString to avoid grabbing - // spurious strings from other programs (e.g. Kaleidoscope) - StringHandle strHand = (StringHandle) GetDBResource('STR ', id + kFirstProfileID); - if (strHand == nil) - return false; - - HLock((Handle) strHand); - int len = *strHand[0] + 1; - if (len > 32) len = 32; - BlockMove(*strHand, name.fStr, len); - name.Length() = len - 1; - HUnlock((Handle) strHand); - - ReleaseResource((Handle) strHand); - return true; -} - -void CUserProfileDB::SetProfileName(short id, const CStr31& name) -{ - StringHandle strHand = (StringHandle) GetDBResource('STR ', id + kFirstProfileID); - if (strHand) { - SetString(strHand, name); - ChangedResource((Handle) strHand); - ReleaseResource((Handle) strHand); - } -} - -void CUserProfileDB::SetProfileData(short id) -{ - Handle hProfileData; - ProfileDataHeader profileHeader; - short int dataLength; - long int dataOffset; - CStr255 userName; - CStr255 emailName; - XP_Bool addResource = false; - - id += kFirstProfileID; // In order to allow this method to be called from - // outside the class, we have to allow the value in to - // be a "raw" profile number (i.e., as returned by - // GetLastProfile); - - emailName = CPrefs::GetString(CPrefs::UserEmail); - userName = CPrefs::GetString(CPrefs::UserName); - - profileHeader.count = 2; - profileHeader.firstOffset = sizeof(ProfileDataHeader); - - /* (the +1 is for the null terminator for each string) */ - profileHeader.nameLength = userName.Length() + 1; - profileHeader.emailLength = emailName.Length() + 1; - - /* First, compute the length of the resource */ - dataLength = sizeof(ProfileDataHeader) + profileHeader.nameLength + profileHeader.emailLength; - - /* See if we're replacing or adding */ - hProfileData = GetDBResource('DATA', id); - - if (hProfileData) { - SetHandleSize(hProfileData, dataLength); - if (MemError() == noErr) { - XP_MEMSET(*hProfileData, '\0', dataLength); - } else { - ReleaseResource(hProfileData); - hProfileData = nil; - } - } else { - hProfileData = NewHandleClear(dataLength); - addResource = true; - } - - if (hProfileData) { - dataOffset = 0; - - HLock((Handle) hProfileData); - - BlockMove(&profileHeader, *hProfileData, sizeof(ProfileDataHeader)); - - dataOffset = sizeof(ProfileDataHeader); - BlockMove(&(userName.fStr[1]), ((unsigned char *) *hProfileData) + dataOffset, - profileHeader.nameLength-1); - - dataOffset += profileHeader.nameLength; - BlockMove(&(emailName.fStr[1]), ((unsigned char *) *hProfileData) + dataOffset, - profileHeader.emailLength-1); - - HUnlock((Handle) hProfileData); - - if (addResource) { - ::AddResource(hProfileData, 'DATA', id, nil); - } else { - ::ChangedResource(hProfileData); - ::ReleaseResource(hProfileData); - } - } -} - -Boolean CUserProfileDB::GetProfileAlias(short id, FSSpec& profileFolder, Boolean allowUserInteraction ) -{ - Boolean success = true; - AliasHandle a; - a = (AliasHandle) GetDBResource('alis', id + kFirstProfileID); - ThrowIfNil_(a); - - Boolean changed; - OSErr err; - - if ( allowUserInteraction ) - { - err = ResolveAlias( NULL, a, &profileFolder, &changed ); - - // If the alias couldn't be resolved, give the user - // a chance to locate the profile folder - if (err < 0) { - success = false; - CStr255 errStr; - CStr31 profileName; - GetIndString(errStr, CUserProfile::kProfileStrings, CUserProfile::kBadAliasError); - GetProfileName(id, profileName); - StringParamText(errStr, profileName); - - if (ErrorManager::PlainConfirm(errStr)) - { - StandardFileReply reply; - reply.sfFile = CPrefs::GetFilePrototype(CPrefs::UsersFolder); - if ( CFilePicker::DoCustomGetFile(reply, CFilePicker::Folders, true) ) - { - CFileMgr::CopyFSSpec(reply.sfFile, profileFolder); - Boolean changed; - err = UpdateAlias(nil, &reply.sfFile, a, &changed); - ThrowIfOSErr_(err); - ChangedResource((Handle) a); - success = true; - } - } - } - } - else - { - short aliasCount = 1; - - err = MatchAlias( NULL, kARMMountVol | kARMNoUI | kARMMultVols | kARMSearch | kARMSearchMore, - a, &aliasCount, &profileFolder, &changed, NULL, NULL ); - if ( err < 0 ) - success = false; - } - - ReleaseResource((Handle) a); - - return success; -} - -// This will change the value of selectedID if it becomes out of bounds -void CUserProfileDB::DeleteProfile(short selectedID) -{ - selectedID += kFirstProfileID; - // delete profile resources and move the subsequent - // resources down to fill the space - Handle toDelete = GetDBResource('STR ', selectedID); - if (toDelete) - RemoveResource(toDelete); - toDelete = GetDBResource('alis', selectedID); - if (toDelete) - RemoveResource(toDelete); - - toDelete = GetDBResource('DATA', selectedID); - if (toDelete) - RemoveResource(toDelete); - - int id = selectedID + 1; - Handle next = GetDBResource('STR ', id); - while (next) { - ::SetResInfo(next, id - 1, nil); - - next = GetDBResource('DATA', id); - if (next) { - ::SetResInfo(next, id - 1, nil); - ReleaseResource(next); - } - - next = GetDBResource('alis', id); - if (next) { - ::SetResInfo(next, id - 1, nil); - ReleaseResource(next); - } - // don't need to release strings because Populate uses them - next = GetDBResource('STR ', ++id); - } -} - -Handle CUserProfileDB::GetDBResource(ResType theType, short theID) -{ - StUseResFile resFile( fFile.GetResourceForkRefNum() ); - - return ::Get1Resource(theType, theID); -} - - -/***************************************************************************** -*/ -const int cmd_NextPane = 8000; -const int cmd_PrevPane = 8001; - -CProfilePaneMonitor::CProfilePaneMonitor( CDialogWizardHandler* wizard ) -{ - fWizard = wizard; - fCopiedName = false; -} - -// !! This needs some work. -void CProfilePaneMonitor::ListenToMessage( MessageT inMessage, void* /* ioParam */) -{ - PaneIDT nameField; - Boolean onNameField = false; - LView* window; - - window = fWizard->GetDialog(); - - LStdControl* next = (LStdControl*)window->FindPaneByID( 'ok ' ); - LStdControl* back = (LStdControl*)window->FindPaneByID( 'back' ); - CStr255 buttonTitle; - - if (fWizard->CurrentPane() == userNamePane) { - nameField = 'name'; - onNameField = true; - } - else if (fWizard->CurrentPane() == profileNamePane) { - nameField = 'pnam'; - onNameField = true; - } - - if ( next && ( inMessage == cmd_NextPane || inMessage == cmd_PrevPane ) ) - { - if ( fWizard->CurrentPaneNumber() == fWizard->TotalPanes() ) - { - LControl* radioNew = (LControl*)window->FindPaneByID( 'Rnew' ); - LControl* radioExs = (LControl*)window->FindPaneByID( 'Rexs' ); - LPane* vnorm = (LView*)window->FindPaneByID('Vnor'); - LPane* vexs = (LView*)window->FindPaneByID('Vexs'); - LPane* vnew = (LView*)window->FindPaneByID('Vnew'); - - vnorm->Hide(); - vexs->Hide(); - vnew->Hide(); - if ( radioExs && radioExs->GetValue() ) - { - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kCreateProfileLabel ); - vexs->Show(); - } - else if ( radioNew && radioNew->GetValue() ) - { - //GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kDoneLabel ); - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kRunASLabel ); - vnew->Show(); - } - else - { - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kDoneLabel ); - vnorm->Show(); - } - next->SetDescriptor( buttonTitle ); - } - else - { - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kNextLabel ); - next->SetDescriptor( buttonTitle ); - } - } - - if ( back && ( inMessage == cmd_NextPane || inMessage == cmd_PrevPane ) ) - { - if ( fWizard->CurrentPaneNumber() == LArray::index_First ) - back->Disable(); - else - back->Enable(); - } - - - // copy profile name to folder name, unless the user has changed - // the path or we're creating the default profile - if ( inMessage == cmd_NextPane && fWizard->CurrentPane() == profileFolderPane ) - { - CStr31 profileName; - fWizard->GetEditText('pnam', profileName); - StripColons(profileName); - CFilePicker* picker = (CFilePicker*) fWizard->GetDialog()->FindPaneByID('fold'); - if (picker && !picker->WasSet()) { - FSSpec folder = picker->GetFSSpec(); - LString::CopyPStr(profileName, folder.name, 32); - - CUserProfile::GetUniqueFolderName(folder); - picker->SetFSSpec(folder, false); - } - } - // copy user name to profile name (only do this once) - else if ( inMessage == cmd_NextPane && fWizard->CurrentPane() == profileNamePane - && !fCopiedName) - { - CStr31 profileName; - fWizard->GetEditText('name', profileName); - StripColons(profileName); - if (profileName.Length() > kStr31Len) - profileName.Length() = kStr31Len; - fWizard->SetEditText('pnam', profileName); - fCopiedName = true; - } - - // select Name field - if (onNameField && (inMessage == cmd_NextPane || inMessage == cmd_PrevPane)) { - LEditField* field = (LEditField*) fWizard->GetDialog()->FindPaneByID(nameField); - if (field) { - field->SwitchTarget(field); - field->SelectAll(); - } - } - - // disable Next button if user hasn't entered name - if (onNameField) - { - CStr255 text; - fWizard->GetEditText( nameField, text ); - if ( text.Length() == 0 ) - fWizard->DisableNextButton(); - else - fWizard->EnableNextButton(); - } - else - fWizard->EnableNextButton(); -} - -/***************************************************************************** -*/ - -CDialogWizardHandler::CDialogWizardHandler( ResIDT dlogID, LArray& paneList ): - fDialog( dlogID, CFrontApp::GetApplication() ), fPaneList( paneList ) -{ - ArrayIndexT index; - PaneIDT paneID; - LView* pane; - - index = LArray::index_First; - - fCurrentPane = LArray::index_First; - fListener = nil; - - LWindow* window = fDialog.GetDialog(); - ThrowIfNil_( window ); - - for ( index = LArray::index_First; index <= fPaneList.GetCount(); index++ ) - { - fPaneList.FetchItemAt( index, &paneID ); - LView::SetDefaultView( window ); - if ( GetResource( 'PPob', paneID ) == nil ) - break; - pane = (LView*)UReanimator::ReadObjects( 'PPob', paneID ); - if ( pane ) - { - if ( index != LArray::index_First ) - pane->Hide(); - pane->Enable(); - pane->FinishCreate(); - } - } -} - -PaneIDT CDialogWizardHandler::CurrentPane() -{ - PaneIDT paneID; - fPaneList.FetchItemAt( fCurrentPane, &paneID ); - return paneID; -} - -ArrayIndexT CDialogWizardHandler::CurrentPaneNumber() -{ - return fCurrentPane; -} - -ArrayIndexT CDialogWizardHandler::TotalPanes() -{ - return fPaneList.GetCount(); -} - -void CDialogWizardHandler::AddListener(LListener* st) -{ - fListener = st; -} - -Boolean CDialogWizardHandler::DoWizard() -{ - Boolean cancelled = false; - LWindow* window = fDialog.GetDialog(); - ShowPane( fCurrentPane, window ); - - Boolean done = false; - while ( !done ) - { - MessageT hit = fDialog.DoDialog(); - - switch ( hit ) - { - case cmd_NextPane: - done = ShowPane( fCurrentPane + 1, window ); - break; - - case cmd_PrevPane: - done = ShowPane( fCurrentPane - 1, window ); - break; - - case msg_Cancel: - cancelled = done = true; - break; - } - if ( !done && fListener ) - fListener->ListenToMessage( hit, nil ); - } - return !cancelled; -} - -Boolean CDialogWizardHandler::ShowPane( ArrayIndexT paneNum, LWindow* window ) -{ - PaneIDT paneID; - - if ( paneNum < LArray::index_First ) - return false; - - if ( paneNum != fCurrentPane ) - { - fPaneList.FetchItemAt( fCurrentPane, &paneID ); - LPane* pane = window->FindPaneByID( paneID ); - if ( pane ) - pane->Hide(); - } - - fCurrentPane = paneNum; - if ( paneNum > fPaneList.GetCount() ) - return true; - fPaneList.FetchItemAt( paneNum, &paneID ); - LPane* pane = window->FindPaneByID( paneID ); - if ( pane ) - pane->Show(); - - return false; -} - -void CDialogWizardHandler::EnableNextButton() -{ - LWindow* window = fDialog.GetDialog(); - if ( window ) - { - LStdControl* next = (LStdControl*)window->FindPaneByID( 'ok ' ); - if ( next ) - next->Enable(); - } -} - -void CDialogWizardHandler::DisableNextButton() -{ - LWindow* window = fDialog.GetDialog(); - if ( window ) - { - LStdControl* next = (LStdControl*)window->FindPaneByID( 'ok ' ); - if ( next ) - next->Disable(); - } -} - -LWindow* CDialogWizardHandler::GetDialog() -{ - return fDialog.GetDialog(); -} - -void CDialogWizardHandler::SetEditText(PaneIDT paneID, const CString& text) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LEditField* field = (LEditField*) window->FindPaneByID(paneID); - if (field) { - field->SetDescriptor(text); - } - } -} - -void CDialogWizardHandler::GetEditText(PaneIDT paneID, CString& text) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LEditField* field = (LEditField*) window->FindPaneByID(paneID); - if (field) { - field->GetDescriptor(text); - } - } -} - -void CDialogWizardHandler::SetCheckboxValue(PaneIDT paneID, const Boolean value) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LControl* checkbox = (LControl*) window->FindPaneByID(paneID); - if (checkbox) { - checkbox->SetValue((Int32)value); - } - } -} - -Boolean CDialogWizardHandler::GetCheckboxValue(PaneIDT paneID) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LControl* checkbox = (LControl*) window->FindPaneByID(paneID); - if (checkbox) { - return (Boolean)checkbox->GetValue(); - } - } - - return -1; -} - diff --git a/mozilla/cmd/macfe/central/profile.h b/mozilla/cmd/macfe/central/profile.h deleted file mode 100644 index 96a5c98894a..00000000000 --- a/mozilla/cmd/macfe/central/profile.h +++ /dev/null @@ -1,231 +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. - */ - -#pragma once - -#include -#include "PascalString.h" -#include "StBlockingDialogHandler.h" - -const MessageT cmd_SelectProfile = 4000; -const MessageT cmd_NewProfile = 4001; -const MessageT cmd_DeleteProfile = 4002; -const MessageT cmd_RenameProfile = 4003; -const MessageT cmd_QuitProfile = 4004; -const MessageT cmd_EditDialSettings = 4010; -const MessageT cmd_LocationPopup = 4011; -const MessageT cmd_RemoteProfile = 4012; - -enum ProfileErr { - eUserCancelled = -2, - eUnknownError = -1, - eNeedUpgrade = 0, - eOK = 1, - eRunAccountSetup = 2, - eRunMUC = 3, - eSkipMUC = 4 -}; - - -/***************************************************************************** - * class CUserProfileDB - * - * Wrapper for multi-user profile database file. - * - *****************************************************************************/ -class CUserProfileDB -{ - -public: - - CUserProfileDB(FSSpec& spec, Boolean createIt = false); - - short CountProfiles(); - short GetNextProfileID(); - - short GetProfileIDByUsername(const CString& userName); - short GetProfileIDByEmail(const CString& emailAddr); - - short GetLastProfileID(); - void SetLastProfileID(short newUserID); - - void AddNewProfile(short id, const CStr31& profileName, - const FSSpec& profileFolder); - - Boolean GetProfileName(short id, CStr31& name); - void SetProfileName(short id, const CStr31& name); - - void SetProfileData(short id); - - Boolean GetProfileAlias(short id, FSSpec& profileFolder, Boolean allowUserInteraction = true); - void DeleteProfile(short selectedID); - - LFile * GetFile() {return &fFile;} - - -private: - LFile fFile; - Handle GetDBResource(ResType theType, short theID); - - enum { kFirstProfileID = 128 }; - -}; - - -/***************************************************************************** - * class CDialogWizardHandler - * - * A generic dialog wizard handler. - * - *****************************************************************************/ -class CDialogWizardHandler -{ -public: - CDialogWizardHandler( ResIDT dlogID, LArray& paneList ); - void AddListener(LListener* st); - - Boolean DoWizard(); - LWindow* GetDialog(); - - void GetEditText( PaneIDT paneID, CString& text ); - void SetEditText( PaneIDT paneID, const CString& text ); - - void SetCheckboxValue(PaneIDT paneID, const Boolean value); - Boolean GetCheckboxValue(PaneIDT paneID); - - PaneIDT CurrentPane(); - ArrayIndexT CurrentPaneNumber(); - ArrayIndexT TotalPanes(); - void EnableNextButton(); - void DisableNextButton(); - -protected: - Boolean ShowPane( ArrayIndexT paneNum, LWindow* window ); - - StBlockingDialogHandler fDialog; - LArray fPaneList; - ArrayIndexT fCurrentPane; - LListener* fListener; -}; - -/***************************************************************************** - * class CUserProfile - * - * Launches wizards and file operations for multi-user profile support. - * - *****************************************************************************/ -class CUserProfile -{ - -public: - static void InitUserProfiles(); - - // Opens the User Profiles registry and puts up a profile-selection - // dialog if there is more than one profile (or showDialog is true). - // Returns kNeedUpgrade if User Profiles does not exist (i.e. we need - // to call HandleUpgrade); else returns path of selected profile. - - static ProfileErr GetUserProfile( const FSSpec& usersFolder, - FSSpec& profileFolder, Boolean showDialog, short fileType ); - - // Creates a new network profile in the user's folder - static ProfileErr CreateNetProfile( FSSpec usersFolder, FSSpec& profileFolder ); - -private: - static ProfileErr DoNetProfileDialog(); - static void DoNetExtendedProfileDialog(LCommander * super); - -public: - // Launches upgrade wizard for users who have not run 4.0 before. - // Creates an initial profile folder and User Profiles file. - // If oldNetscapeF is non-null, it points to the user's 3.0 - // Netscape Ä folder and the profile "folder" is an alias to it. - // Returns error code if user cancelled; else returns profile path. - - static ProfileErr HandleUpgrade( FSSpec& profileFolder, - const FSSpec* oldNetscapeF = nil ); - - // Creates a unique profile folder name if necessary - static void GetUniqueFolderName(FSSpec& folder); - - static short sCurrentProfileID; - - enum { kRenamePrompt = 1, - kDeletePrompt, - kReadError, - kCreateError, - kDefaultName, - kBadAliasError, - kQuitLabel, - kDoneLabel, - kNextLabel, - kConfigFileError, - kInvalidConfigFile, - kRunASLabel, - kCreateProfileLabel, - kConfigurationFileName }; - enum { kProfileStrings = 900 }; - -private: - static ProfileErr HandleProfileDialog( FSSpec& profileSpec, CUserProfileDB& profileDB, - FSSpec& profileFolder, short& newUserID, short lastUserID, - Boolean wantsProfileManager ); - static void PopulateListBox( ListHandle& listHand, CUserProfileDB& profileDB, - short defaultID ); - - enum UpgradeEnum { eNoUpgrade, // an additional profile is being created - eExistingPrefs, // first profile, existing Netscape Prefs file - eNewInstall }; // first profile, fresh install - - static ProfileErr NewUserProfile( const FSSpec& profileSpec, FSSpec& profileFolder, - CStr31& profileName, UpgradeEnum upgrading = eNoUpgrade, - const FSSpec* oldNetscapeF = nil ); - static ProfileErr NewProfileWizard( UpgradeEnum upgrading, CStr31& profileName, - const FSSpec& profileFolder, FSSpec& newProfileFolder, - Boolean& userChoseFolder ); - - static void RenameProfile( short selectedID, CUserProfileDB& profileDB, - Cell& cell, ListHandle& listHand ); - static void DeleteProfile( short selectedID, CUserProfileDB& profileDB, - ListHandle& listHand ); - - static void ReflectToPreferences(const CStr31& profileName, - const FSSpec& profileFolder, short numProfiles = 1); - static void CreateDefaultProfileFolder(const FSSpec& profileFolder); - - static OSErr MakeDesktopIcons(const CStr31& profileName, - const Boolean wantsNavigator, const Boolean wantsInbox); - - enum { kInvalidProfileID = -1, - kTemporaryProfileID = -2 }; - -protected: - // ¥ÊinPrefsFolder is the FSSpec of the users Preferences - // folderÉ we read a file directly below that - static long SendMessageToPlugin( long inMessage, void* pb = NULL ); - - static void* LoadConfigPlugin(); // really returns PE_PluginFuncType - static OSErr CloseConfigPlugin(); - - static Boolean DeleteMagicProfile( FSSpec& inSpec ); - - static CFragConnectionID mConfigPluginID; - static Boolean mHasConfigPlugin; - static Boolean mPluginLoaded; -}; - diff --git a/mozilla/cmd/macfe/central/uapp.cp b/mozilla/cmd/macfe/central/uapp.cp deleted file mode 100644 index cda9d895c10..00000000000 --- a/mozilla/cmd/macfe/central/uapp.cp +++ /dev/null @@ -1,4621 +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. - */ - -/* Portions copyright Metrowerks Corporation. */ - - -// A a temporary solution, some lines have been out-commented -// with the tag //¥¥¥ REVISIT NOVA MERGE ¥¥¥ -// - -// =========================================================================== -// UApp.cp -// main and CFrontApp's methods -// Created by atotic, June 6th, 1994 -// =========================================================================== - -//#define DONT_DO_MOZILLA_PROFILE -//#define PROFILE_UPDATE_MENUS - -#ifdef MOZ_FULLCIRCLE - #include "fullsoft.h" -#endif - -#include "uapp.h" - -#include "CAppleEventHandler.h" -//#include "shist.h" - -#include -#include -#include - - // macfe -//#include "NavigationServicesSupport.h" -#include "earlmgr.h" -#include "macutil.h" -#include "macgui.h" // HyperStyle -#include "CBookmarksAttachment.h" -#include "CToolsAttachment.h" -#include "CFontMenuAttachment.h" -#include "CRecentEditMenuAttachment.h" -#include "BookmarksFile.h" -#include "mprint.h" -#include "mimages.h" -#include "mplugin.h" -#include "prpriv.h" -#include "URDFUtilities.h" // for LaunchURL -#include "CAutoPtrXP.h" - -#if defined (JAVA) -#include "mjava.h" -#endif - -#if defined (OJI) -#include "jvmmgr.h" -#endif - -#include "mregistr.h" -#include "resae.h" -#include "resgui.h" -#include "uerrmgr.h" -#include "ufilemgr.h" -#include "msv2dsk.h" -#include "mversion.h" -#include "xp_trace.h" -#include "CTargetedUpdateMenuRegistry.h" -#include "UDesktop.h" -#include "CNavCenterWindow.h" -#include "UDeferredTask.h" -#include "URobustCreateWindow.h" -#include "URDFUtilities.h" -#ifdef MOZ_MAIL_NEWS -#include "CMessageFolder.h" -#include "UNewFolderDialog.h" -#endif - -#include "LMenuSharing.h" -#define MENU_SHARING_FIRST 40 - -#include "CEnvironment.h" - -#include "CWindowMenu.h" -#include "CHistoryMenu.h" -#include "CNSMenuBarManager.h" -#ifdef MOZ_MAIL_NEWS -#include "CThreadWindow.h" -#include "CMailProgressWindow.h" -#include "UMailFolderMenus.h" -#endif - -#include "UTearOffPalette.h" -#include "CPaneEnabler.h" -#include "CApplicationEventAttachment.h" -#include "CCloseAllAttachment.h" - -#include "CNSContextCallbacks.h" -#include "CBrowserContext.h" - -#include "prgc.h" -#include "java.h" - -#include "secrng.h" -#include "secnav.h" -#include "mkutils.h" // only for FREEIF() macro. JRM 96/10/17 - -#include "CEditorWindow.h" -#include "CEditView.h" -#include "meditdlg.h" - -#ifdef MOZ_MAIL_NEWS -#include "MailNewsSearch.h" -#include "MailNewsFilters.h" -#include "MailNewsAddressBook.h" - -#include "CCheckMailContext.h" -#endif // MOZ_MAIL_NEWS - -#include "StBlockingDialogHandler.h" -#include "CSecureAttachment.h" -//#include "VTSMProxy.h" - -#include "LTSMSupport.h" - -#include "CMouseDispatcher.h" -#include "CSuspenderResumer.h" - -#if defined(MOZ_MAIL_COMPOSE) || defined(MOZ_MAIL_NEWS) -#include "MailNewsClasses.h" -#include "msgcom.h" -#include "MailNewsgroupWindow_Defines.h" -#endif - -#include "BrowserClasses.h" - -//#include "CBrowserView.h" // need for CFrontApp::EventKeyUp() 1997-02-24 mjc -#include "CKeyUpReceiver.h" // need in CFrontApp::EventKeyUp() - -#include "CToolbarModeManager.h" -#include "CMozillaToolbarPrefsProxy.h" -#include "CSharedPatternWorld.h" - -#include "InternetConfig.h" -#include "il_strm.h" /* Image Library stream converters. */ -#include "CMochaHacks.h" - -PRThread* mozilla_thread; - -PREventQueue *mozilla_event_queue = NULL; - -#if defined (JAVA) -#include "MFramePeer.h" -#endif - -#include "CLibMsgPeriodical.h" - - // Netscape -#ifndef GLHIST_H -#include "glhist.h" -#endif - -#include "edtplug.h" - -#include "m_cvstrm.h" -#include "prefapi.h" -#include "NSReg.h" -#ifdef MOZ_SMARTUPDATE -#include "softupdt.h" -#endif -#include - -#include "privacy.h" - -//#define BUILD_NSL_SUPPORT 1 // Are we using Apple's NSL support code? -#ifdef BUILD_NSL_SUPPORT -#define kNSLGetURLRequestStringID 800 -#include "NSLStandardURL.h" -#endif - -// HERE ONLY UNTIL NAV SERVICES CODE MERGED INTO TIP -Boolean SimpleOpenDlog ( short numTypes, const OSType typeList[], FSSpec* outFSSpec ) ; - - -CAutoPtr CFrontApp::sRDFContext; - - - -// Now we modify the frequency with which we call WaitNextEvent to try -// to minimize the time we spend in this expensive function. The strategy -// is two-fold: -// 1. If we are in the foreground, and there are no pending user -// events (determined with OSEventAvail), then only call WNE every -// kWNETicksInterval (4) ticks. -// Note that OSEvent avail only knows about the Operating System -// event queue, which contains these events: -// mouseDown, mouseUp, keyDown, keyUp, autoKey, diskEvent -// -// If we are in the background, we are nice to front apps and -// call WNE every time. -// -// 2. We also adjust the sleep time (the value passed to WNE to determine -// how long it is before the Event Manager returns control to us). -// This is done on EventSuspend and EventResume. We set the sleep time -// to 0 in the foreground, and 4 in the background. - -#define DAVIDM_SPEED2 // Comment out to remove this WNE wrapper code -//====================================================================================== -// PROFILE -//====================================================================================== - -//#define PROFILE_LOCALLY 1 -#if defined(PROFILE) || defined (PROFILE_LOCALLY) -#include - - // Define this if you want to start profiling when the Caps Lock - // key is pressed. Usually that's what you want: press Caps Lock, - // start the command you want to profile, release Caps Lock when - // the command is done. It works for all the major commands: - // display a page, send a mail, save an attachment, etc... -#define PROFILE_ON_CAPSLOCK - - // Define this if you want to let the profiler run while you're - // spending time in other apps. Usually you don't. -//#define PROFILE_WAITNEXTEVENT - - - // Legacy stuff: profiles CFrontApp::UpdateMenus(). - // Don't use other profile methods at the same time. -//#define PROFILE_UPDATE_MENUS - - -//--------------------------------------------- -// Paste these in the file you want to profile -// The code to be profiled must be in a project -// with "Emit profiler calls" turned on. -// -// Example: -// ProfileStart() -// ... -// ProfileSuspend() -// ... -// ProfileResume() -// ... -// ProfileStop() -// -// If you want to start the profile when Caps Lock -// is pressed, you can use: -// -// if (IsThisKeyDown(0x39)) // caps lock -// ProfileStart() -// -//--------------------------------------------- -extern void ProfileStart(); -extern void ProfileStop(); -extern void ProfileSuspend(); -extern void ProfileResume(); -extern Boolean ProfileInProgress(); -//--------------------------------------------- - -static Boolean sProfileInProgress = false; -void ProfileStart() -{ - if (! sProfileInProgress) - { - sProfileInProgress = true; - if (ProfilerInit(collectDetailed, microsecondsTimeBase, 2000, 100)) - return; - ProfilerSetStatus(true); - } -} - -void ProfileStop() -{ - if (sProfileInProgress) - { - ProfilerDump("\pMozilla Profile"); - ProfilerTerm(); - sProfileInProgress = false; - } -} - -void ProfileSuspend() -{ - if (sProfileInProgress) - ProfilerSetStatus(false); -} - -void ProfileResume() -{ - if (sProfileInProgress) - ProfilerSetStatus(true); -} - -Boolean ProfileInProgress() -{ - return sProfileInProgress; -} - -#endif // PROFILE -//====================================================================================== - -#ifdef FORTEZZA -#include "ssl.h" -#endif - -#include - -#include "CPrefsDialog.h" -#include "UProcessUtils.h" // for LaunchApplication - -#ifdef MOZ_OFFLINE -#include "UOffline.h" -#endif - -#define LICENSE_REVISION 7 - -extern NET_StreamClass *IL_NewStream(int, void *, URL_Struct *, MWContext *); -extern void TrySetCursor( int whichCursor ); - -list CFrontApp::sCommandsToUpdateBeforeSelectingMenu; - -CFrontApp* CFrontApp::sApplication = NULL; -CAppleEventHandler* CAppleEventHandler::sAppleEventHandler = NULL; -short CFrontApp::sHelpMenuOrigLength = 4; -short CFrontApp::sHelpMenuItemCount = 0; -double CFrontApp::sHRes = 1.0; -double CFrontApp::sVRes = 1.0; -static PA_InitData parser_initdata; - -static void InitDebugging(); -static void ConfirmWeWillRun(); -static Boolean NetscapeIsRunning(ProcessSerialNumber& psn); -static Boolean LicenseHasExpired(); -static void CheckForOtherNetscapes(); -static void AssertAppearanceLib(); - -static const OSType kConferenceAppSig = 'Ncq¹'; -static const OSType kCalendarAppSig = 'NScl'; -static const OSType kImportAppSig = 'NSi2'; -static const OSType kAOLInstantMessengerSig = 'Oscr'; - -#ifdef EDITOR -static void OpenEditURL(const char* url){ - if ( url != NULL ) { - URL_Struct * request = NET_CreateURLStruct ( url, NET_NORMAL_RELOAD ); - if ( request ) - CEditorWindow::MakeEditWindow( NULL, request ); - } -} -#endif // EDITOR - -//====================================== -class LTimerCallback: public LPeriodical -// class that keeps track of xp timeout callbacks -//====================================== -{ -public: - LTimerCallback( TimeoutCallbackFunction func, void* closure, uint32 msecs ); - void SpendTime( const EventRecord& inMacEvent ); - - static LArray* sTimerList; - -protected: - UInt32 fFireTime; - TimeoutCallbackFunction fFireFunc; - void* fClosure; -}; - -LArray* LTimerCallback::sTimerList = NULL; - -//----------------------------------- -LTimerCallback::LTimerCallback( TimeoutCallbackFunction func, void* closure, uint32 msecs ) -: LPeriodical() -//----------------------------------- -{ - UInt32 ticks = ::TickCount(); - - // ¥Êcalculate the fire time in ticks from now - fFireTime = ticks + ceil(((double)msecs / 100.0) * 6.0); - fFireFunc = func; - fClosure = closure; - this->StartIdling(); -} - -//----------------------------------- -void LTimerCallback::SpendTime( const EventRecord& inMacEvent ) -//----------------------------------- -{ - UInt32 ticks = inMacEvent.when; - - if ( ticks >= fFireTime ) - { - // 97-06-18 pkc -- Remove this from sTimerList first because when we call - // fFireFunc could possibly cause a call to FE_ClearTimeout on this - // remove from timer list before deleting - LTimerCallback::sTimerList->Remove(&this); - - // let's just say that the fFireFunc gives time to repeaters... - // We don't want this one going off again before it is deleted! - fFireTime = LONG_MAX; - - if ( fFireFunc ) - (*fFireFunc)( fClosure ); - delete this; - } -} - -//----------------------------------- -void* FE_SetTimeout( TimeoutCallbackFunction func, void* closure, uint32 msecs ) -// this function should register a function that will -// be called after the specified interval of time has -// elapsed. This function should return an id -// that can be passed to FE_ClearTimer to cancel -// the timer request. -// -// func: The function to be invoked upon expiration of -// the timer interval -// closure: Data to be passed as the only argument to "func" -// msecs: The number of milli-seconds in the interval -//----------------------------------- -{ - Try_ - { - LTimerCallback* t = new LTimerCallback( func, closure, msecs ); - // insert timer callback into list - try { - if (!LTimerCallback::sTimerList) - LTimerCallback::sTimerList = new LArray(sizeof(LTimerCallback*)); - LTimerCallback::sTimerList->InsertItemsAt(1, LArray::index_Last, &t); - } catch (...) { - } - return t; - } - Catch_( inErr ) - { - return NULL; - } - EndCatch_ -} - -//----------------------------------- -void FE_ClearTimeout( void* timer_id ) -// This function cancels a timer that has previously been set. -// Callers should not pass in NULL or a timer_id that has already expired. -//----------------------------------- -{ - XP_ASSERT( timer_id ); - - LTimerCallback* timer = (LTimerCallback*)timer_id; - if (LTimerCallback::sTimerList) - { - if (LTimerCallback::sTimerList->FetchIndexOf(&timer) > LArray::index_Bad) - { - // this LTimerCallback is in timer list - // remove from timer list before deleting - LTimerCallback::sTimerList->Remove(&timer); - delete timer; - } - } -} - -#pragma mark - - -#if 0 -void Assert68020() -{ - long response = 0; - OSErr err = ::Gestalt (gestaltQuickdrawVersion, &response); - if (err || response == gestaltOriginalQD) { - ::Alert (14000, NULL); - ::ExitToShell (); - } -} - -void AssertSystem7() -{ - long response = 0; - OSErr err = ::Gestalt (gestaltSystemVersion, &response); - if (err || response < 0x700) { - ::Alert (14001, NULL); - ::ExitToShell (); - } -} -#endif - -static void AssertAppearanceLib ( ) -{ - if ( ! UEnvironment::HasFeature(env_HasAppearance) ) { - ::InitCursor(); - ::Alert (14004, NULL); - ::ExitToShell (); - } -} - -static void RequiredGutsNotFoundAlert() -{ - Str255 gutsFolderName; - - GetIndString(gutsFolderName, 14000, 1); - ParamText(gutsFolderName, NULL, NULL, NULL); - Alert (14002, NULL); - ExitToShell(); -} - -static void AssertRequiredGuts() -{ - // Initialize the "CPrefs::NetscapeFolder" and "CPrefs::RequiredGutsFolder" - // static variables early for use by the XP strings code in "errmgr.cp." - - short vRefNum; - long dirID; - - if (HGetVol(NULL, &vRefNum, &dirID) != noErr) - ExitToShell(); - - FSSpec netscapeFolderSpec; - - if (CFileMgr::FolderSpecFromFolderID(vRefNum, dirID, netscapeFolderSpec) != noErr) - RequiredGutsNotFoundAlert(); - - try - { - CPrefs::Initialize(); - } - catch (...) - { - RequiredGutsNotFoundAlert(); - } - CPrefs::SetFolderSpec(netscapeFolderSpec, CPrefs::NetscapeFolder); - - FSSpec gutsFolderSpec; - - // Build a partial path to the guts folder starting from a folder we know (the Netscape folder) - Str255 partialPath; - - { - // Get the name of the guts folder - Str255 gutsFolderName; - GetIndString(gutsFolderName, 14000, 1); - - // partialPath = ":" + netscapeFolderSpec.name + ":" + gutsFolderName; - // ( this may _look_ cumbersome, but it's really the most space and time efficient way to catentate 4 pstrings ) - int dest=0; - partialPath[++dest] = ':'; - for ( int src=0; srcaddress ) ) - type = MWContextMail; - else if ( MSG_RequiresNewsWindow( url->address ) ) - type = MWContextNews; - else if (MSG_RequiresBrowserWindow(url->address)) - type = MWContextBrowser; - else - return FALSE; - return TRUE; - } - return FALSE; -} -#endif // MOZ_MAIL_NEWS - -extern "C" { -void InitializeASLM(); -void CleanupASLM(); -} - -#pragma mark - - -//====================================== -class CResumeEventAttachment : public LAttachment -// This silly class fixes a weird bug where the app doesnÕt -// get resume events after being sent a getURL AppleEvent. -// This attachment will run whenever we get an event, so -// we can check to see if the event is not a resume event, -// target is nil (meaning we havenÕt received a resume -// event yet), and weÕre in the foreground (meaning we got -// switched in without getting the event). If all those -// are true, we can resume ourselves so we wonÕt crash -// because target is nil. -//====================================== -{ - public: - CResumeEventAttachment(CFrontApp* app) : LAttachment(msg_Event), fApp(app) {} - protected: - virtual void ExecuteSelf(MessageT inMessage, void* ioParam); - private: - CFrontApp* fApp; -}; - -//----------------------------------- -void CResumeEventAttachment::ExecuteSelf(MessageT inMessage, void* ioParam) -//----------------------------------- -{ - EventRecord* event = (EventRecord*) ioParam; - - // - // Do quick tests first to see if we should - // go ahead and check if weÕre in the foreground. - // - if (inMessage == msg_Event && event->what != osEvt && LCommander::GetTarget() == nil) - { - ProcessSerialNumber frontProcess; - ProcessSerialNumber currentProcess; - GetFrontProcess(&frontProcess); - GetCurrentProcess(¤tProcess); - Boolean result = false; - SameProcess(&frontProcess, ¤tProcess, &result); - if (result) - { - // - // WeÕre in the foreground, so synthesize - // a resume event and process it. - // - EventRecord resumeEvent; - memset(&resumeEvent, 0, sizeof(EventRecord)); - resumeEvent.what = osEvt; - resumeEvent.message = suspendResumeMessage << 24; - resumeEvent.message |= resumeFlag; - fApp->DispatchEvent(resumeEvent); - } - } -} - -#pragma mark - - -//====================================== -class CSplashScreen : public LWindow -//====================================== -{ - public: - enum { class_ID = 'Spls' }; - - CSplashScreen(LStream* inStream); - virtual ~CSplashScreen(); - - virtual void SetDescriptor(ConstStringPtr inDescriptor); - - protected: - - virtual void FinishCreateSelf(void); - - LCaption* mStatusCaption; - CResPicture* mBackPicture; - LFile* mPictureResourceFile; -}; - -#pragma mark - - -//====================================== -// CLASS CFrontApp -//====================================== - -//----------------------------------- -CFrontApp::CFrontApp() -//----------------------------------- -: fCurrentMbar(cBrowserMenubar) -, fWantedMbar(fCurrentMbar) -, fStartupAborted(false) -, fProperStartup(false) -, mSplashScreen(NULL) -#ifdef MOZ_MAIL_NEWS -, mLibMsgPeriodical(NULL) -#endif // MOZ_MAIL_NEWS -, mConferenceApplicationExists(false) -, mJavaEnabled(false) -, mHasBookmarksMenu(false) -, mHasFrontierMenuSharing(false) -, mMouseRgnH( NewRgn() ) - // Performance - // We really should be adjusting this dynamically -{ - // Set environment features - CEnvironment::SetAllFeatures(); - - // Static data members - - sApplication = this; - - // Add CApplicationEventAttachment - - AddAttachment(new CApplicationEventAttachment); - - // Add CCloseAllAttachment - - AddAttachment(new CCloseAllAttachment(CLOSE_WINDOW, CLOSE_ALL_WINDOWS)); - - // Inherited data members - mSleepTime = 1; - - // Indicate we don't want to be able to quit yet - fSafeToQuit = false; - fUserWantsToQuit = false; - - // Toolbox - qd.randSeed = TickCount(); // Toolbox - - AddAttachment(new LClipboard()); - AddAttachment(new CSecureAttachment); - AddAttachment(new CResumeEventAttachment(this)); - -#ifdef MOZ_MAIL_NEWS - // create CLibMsgPeriodical - mLibMsgPeriodical = new CLibMsgPeriodical; - mLibMsgPeriodical->StartIdling(); -#endif // MOZ_MAIL_NEWS - - // - // Initial inline support (TSM) - // - LTSMSupport::Initialize(); - - UHTMLPrinting::InitCustomPageSetup(); - -#ifdef MOZ_SMARTUPDATE - SU_Startup(); -#endif - NR_StartupRegistry(); - - // ¥ PowerPlant initialization - UScreenPort::Initialize(); - -#if defined(MOZ_MAIL_NEWS) || defined(MOZ_MAIL_COMPOSE) - RegisterAllMailNewsClasses(); -#endif // MOZ_MAIL_NEWS - RegisterAllBrowserClasses(); - - ShowSplashScreen(); - - InitUTearOffPalette(this); - CTearOffManager::GetDefaultManager()->AddListener(this); - - TheEarlManager.StartRepeating(); - -// WTSMManager::Initialize(); -// AddAttachment(new VTSMDoEvent(msg_Event)); - - HyperStyle::InitHyperStyle(); - - // ¥ parser - parser_initdata.output_func = LO_ProcessTag; - - // ¥Êparsers - // mime parsers - NET_RegisterMIMEDecoders(); - - // external objects go to disk - NET_RegisterContentTypeConverter ("*", FO_PRESENT, nil, NewFilePipe); - NET_RegisterContentTypeConverter ("*", FO_SAVE_AS, nil, NewFilePipe); - - FSSpec spec; - mImportModuleExists = CFileMgr::FindApplication(kImportAppSig, spec) == noErr; - mAOLMessengerExists = CFileMgr::FindApplication(kAOLInstantMessengerSig, spec) == noErr; - // Record whether the conference application exists. We do this once here - // instead of lots 'o times in FindCommandStatus so searching for an app - // doesn't slow us to a crawl (especially when searchin on network volumes). - // One drawback of course, is that when the app is installed or removed, - // the menu won't be enabled or disabled until the user quits and restarts - // the app. This behavior is different than the pref panel for controlling - // whether conference launches on startup or not (but that occurence of - // FindApplication isn't called many times/sec either). - mConferenceApplicationExists = (CFileMgr::FindApplication(kConferenceAppSig, spec) == noErr); -} - -//----------------------------------- -CFrontApp::~CFrontApp() -//----------------------------------- -{ - // Save the current visibility information - if ( CPrefs::GetLong( CPrefs::StartupAsWhat ) == STARTUP_VISIBLE) - { - long winRecord = 0; - - CMediatedWindow* theWindow; - CWindowIterator iter(WindowType_Any); - while (iter.Next(theWindow)) - { - switch(theWindow->GetWindowType()) - { -#if 0 - case WindowType_MailNews: - winRecord |= (MAIL_STARTUP_ID | NEWS_STARTUP_ID); - break; - case WindowType_Address: - winRecord |= ADDRESS_STARTUP_ID; - break; -#endif - case WindowType_Browser: - winRecord |= BROWSER_STARTUP_ID; - break; - case WindowType_NavCenter: - winRecord |= NAVCENTER_STARTUP_ID; - break; - default: - break; - } - } - - if (winRecord != 0) - CPrefs::SetLong(winRecord, CPrefs::StartupBitfield); - } - - - { - // This really comes from ~LCommander. This gets - // executed after our destructor, and deletes all the windows - // We need windows to be deleted before we are done, - // because window destruction callbacks reference the app! - // DO NOT DO THIS (IT CAUSES UNNECESSARY DEBUG BREAKS): SetTarget(this); - - // tj, 5/1/96 - // - // We must close the windows explicitly, so that each window - // can interrupt its context (XP_InterruptContext) while the - // window is still completely alive - // - - // Hmmmmm ... better be a hair more careful about traversing that window list. - // DDM 21-JUN-96 - - WindowRef macWindow = LMGetWindowList(); - - while (macWindow) - { - LWindow *ppWindow = LWindow::FetchWindowObject(macWindow); - - if (ppWindow) - { - ppWindow->DoClose(); - - // Start over at the beginning of the list. - // This is possibly slow but definitely safe, i.e. we're not using - // a block of memory that's been deleted. - macWindow = LMGetWindowList(); - } - else - // Skip to the next window in the list. - macWindow = GetNextWindow(macWindow); - } - - // Delete all SubCommanders - LArrayIterator iterator(mSubCommanders); - LCommander *theSub; - while (iterator.Next(&theSub)) - delete theSub; - } - - HyperStyle::FinishHyperStyle(); - - LTSMSupport::DoQuit( 0 ); - -// WTSMManager::Quit(); - -// UpdateMenus(); - TrySetCursor( watchCursor ); - // XP_Saves - GH_SaveGlobalHistory(); - GH_FreeGlobalHistory(); -#ifdef MOZ_MAIL_NEWS - NET_SaveNewsrcFileMappings(); - CAddressBookManager::CloseAddressBookManager(); - CCheckMailContext::Release(this); -#endif // MOZ_MAIL_NEWS - - //----- - // We just closed all the windows but we now have to wait for the callbacks - // in order to really delete the different contexts. That's because - // CNSContext::NoMoreUsers() calls ET_RemoveWindowContext() which posts - // an event which calls MochaDone() asynchronously and deletes the context.. - // - // NOTE: CCheckMailContext::Release() also posts an event in order to delete - // its context. So make sure that PR_ProcessPendingEvents() is always - // executed after window->DoClose(), CCheckMailContext::Release() or any - // other destructor function which deletes a context. A symptom of not - // deleting the context is that newsgroups which have been unsubscribed - // in the Message Center reappear when launching the application again. - PR_ProcessPendingEvents(mozilla_event_queue); - //----- - - if (!fStartupAborted) - { - extern const char* CacheFilePrefix; - NET_CleanupCacheDirectory( "", CacheFilePrefix ); - NET_ShutdownNetLib(); - } - - if (!fStartupAborted) - CPrefs::DoWrite(); - -#ifdef MOZ_MAIL_NEWS - delete mLibMsgPeriodical; -#endif // MOZ_MAIL_NEWS - - SetCursor( &qd.arrow ); - - // remove anything we left in the Temporary Items:nscomm40 folder - CFileMgr::DeleteCommTemporaryItems(); - - NR_ShutdownRegistry(); -#ifdef MOZ_SMARTUPDATE - SU_Shutdown(); -#endif // MOZ_SMARTUPDATE - - ET_FinishMocha(); - - LJ_ShutdownJava(); - - // shutdown plugins - NPL_Shutdown(); - - DisposeRgn(mMouseRgnH); - - // Un-init RDF - URDFUtilities::ShutdownRDF(); - - sApplication = NULL; -} // CFrontApp::~CFrontApp() - -//----------------------------------- -void CFrontApp::Initialize() -//----------------------------------- -{ - // this will always succeed since we require AppearanceLib. - ::RegisterAppearanceClient(); - - // Insert commands to update before seleting menu into list - - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Redo); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Close); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Undo); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Cut); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Copy); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Paste); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_Clear); - sCommandsToUpdateBeforeSelectingMenu.push_front(cmd_SelectAll); - - new CNSContextCallbacks; - LDocApplication::Initialize(); - - CMouseDispatcher* md = new CMouseDispatcher; - AddAttachment(md); - - // 97-09-11 pchen -- setup prefs proxy for CToolbarModeManager so that knows - // how to get Communicator toolbar style pref - CMozillaToolbarPrefsProxy* prefsProxy = new CMozillaToolbarPrefsProxy(); - CToolbarModeManager::SetPrefsProxy(prefsProxy); - - // Register callback function when browser.chrome.toolbar_style - // pref changes - PREF_RegisterCallback("browser.chrome.toolbar_style", - CToolbarModeManager::BroadcastToolbarModeChange, - (void*)NULL); - // 97-05-12 pkc -- setup sHRes and sVRes data members - CGrafPtr wMgrPort; - GetCWMgrPort(&wMgrPort); - sHRes = (**wMgrPort->portPixMap).hRes / 0x00010000; // convert from Fixed to floating point - sVRes = (**wMgrPort->portPixMap).vRes / 0x00010000; // convert from Fixed to floating point - - // 97-08-23 pchen -- register us as listener to LGrowZone - LGrowZone::GetGrowZone()->AddListener(this); - -} // CFrontApp::Initialize() - -void CFrontApp::RegisterMimeType(CMimeMapper * mapper) -{ - CMimeMapper::LoadAction loadAction = mapper->GetLoadAction(); - CStr255 mimeName = mapper->GetMimeName(); - CStr255 pluginName = mapper->GetPluginName(); - void* pdesc = nil; - if (pluginName.Length() > 0) - pdesc = GetPluginDesc(pluginName); - - switch (loadAction) - { - case CMimeMapper::Internal: - // Disable the previous plug-in, if any - if (pdesc) - NPL_EnablePluginType(mimeName, pdesc, false); -#ifdef OLD_IMAGE_LIB - if (mimeName == IMAGE_GIF || mimeName == IMAGE_JPG || mimeName == IMAGE_XBM || mimeName == IMAGE_PNG) - NET_RegisterContentTypeConverter(mimeName, FO_PRESENT, nil, IL_ViewStream); -#endif -#ifdef MOZ_MAIL_NEWS // BinHex decoder is in mail/news code, right? - else if (mimeName == APPLICATION_BINHEX) - NET_RegisterContentTypeConverter(APPLICATION_BINHEX, FO_PRESENT, nil, fe_MakeBinHexDecodeStream); -#endif // MOZ_MAIL_NEWS - break; - - case CMimeMapper::Plugin: - // - // pdesc can be nil when reading prefs on startup -- that's OK, - // the plug-in code in mplugin.cp will take care of registration. - // bing: Alternatively, we could call NPL_EnablePluginType(true) - // here and set up the new description and extensions below. - // - if (pdesc) - NPL_RegisterPluginType(mimeName, mapper->GetExtensions(), mapper->GetDescription(), nil, pdesc, true); - return; // XP code will take care of the cdata - -#ifdef ANTHRAX - case CMimeMapper::Applet: - - NPL_RegisterAppletType(mimeName, mapper->GetAppletName()); - break; -#endif - default: - // Disable the previous plug-in, if any - if (pdesc) - NPL_EnablePluginType(mimeName, pdesc, false); - // - // NewFilePipe will look at the mapper list and - // decide whether it should launch an app or save. - // - NET_RegisterContentTypeConverter(mimeName, FO_PRESENT, nil, NewFilePipe); - break; - } - - CStr255 extensions = mapper->GetExtensions(); - CStr255 mimetype = mapper->GetMimeName(); - NET_cdataCommit(mimetype, extensions); - - // Special case for View Source - // montulli knows why is this - if (mimetype == HTML_VIEWER_APPLICATION_MIME_TYPE) { - if (loadAction == CMimeMapper::Internal) { - NET_RegisterContentTypeConverter (TEXT_HTML, FO_VIEW_SOURCE, NULL, INTL_ConvCharCode); - NET_RegisterContentTypeConverter (INTERNAL_PARSER, FO_VIEW_SOURCE,TEXT_HTML, net_ColorHTMLStream); - NET_RegisterContentTypeConverter ("*", FO_VIEW_SOURCE, TEXT_PLAIN, net_ColorHTMLStream); - NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_VIEW_SOURCE, NULL, INTL_ConvCharCode); // added by ftang. copy from libnet #ifdef UNIX - NET_RegisterContentTypeConverter (MESSAGE_NEWS, FO_VIEW_SOURCE, NULL, INTL_ConvCharCode); // added by ftang. copy from libnet #ifdef UNIX - } - else // Pipe to disk for launching - { - NET_RegisterContentTypeConverter (INTERNAL_PARSER, FO_VIEW_SOURCE, nil, NewFilePipe); - NET_RegisterContentTypeConverter (TEXT_HTML, FO_VIEW_SOURCE, nil, NewFilePipe); - NET_RegisterContentTypeConverter ("*", FO_VIEW_SOURCE, nil, NewFilePipe); - } - } - - // We need to add the description, too, which unfortunately requires - // looking the cinfo up AGAIN and setting the desc field... - char* description = (char*) mapper->GetDescription(); - XP_ASSERT(description); - if (description) - { - NET_cdataStruct temp; - NET_cdataStruct* cdata; - char* mimetype = (char*) mimeName; - - XP_BZERO(&temp, sizeof(temp)); - temp.ci.type = mimetype; - cdata = NET_cdataExist(&temp); - XP_ASSERT(cdata); - if (cdata) - StrAllocCopy(cdata->ci.desc, description); - } -} - - -// NetLib Internals! -extern char * XP_AppName; -extern char * XP_AppVersion; -extern char * XP_AppCodeName; -extern char * XP_AppLanguage; -extern char * XP_AppPlatform; - -// Creates a path suitable for use by XP_FILE_OPEN, and xpHotlist file spec - -char* GetBookmarksPath( FSSpec& spec, Boolean useDefault ) -{ - if ( useDefault ) - { - spec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - ::GetIndString( spec.name, 300, bookmarkFile ); - } - char* newPath = CFileMgr::GetURLFromFileSpec( spec ); - if ( newPath ) - ::BlockMoveData( newPath + 7, newPath, strlen( newPath )-6 ); - // Hack, gets rid of the file:/// - return newPath; -} - -void CFrontApp::InitBookmarks() -{ - CBookmarksAttachment *attachment = new CBookmarksAttachment; - AddAttachment( attachment ); // Bookmark commands - - UpdateMenus(); -} - - -// static -int CFrontApp::SetBooleanWithPref(const char *prefName, void *boolPtr) -{ - XP_Bool currentValue = *(Boolean *)boolPtr; - PREF_GetBoolPref(prefName, ¤tValue); - *(Boolean *)boolPtr = currentValue; - return 0; -} - -// This is called right after startup for us to do our initialization. If -// the user wants to open/print a document then this will be the file -// spec. Otherwise it's nil (normal startup) -void CFrontApp::ProperStartup( FSSpec* file, short fileType ) -{ - LFile* prefsFile = NULL; - Boolean gotPrefsFile = false; - static Boolean properStartup = FALSE; - - if ( fStartupAborted ) - return; - - if ( properStartup ) - { - if ( fileType == FILE_TYPE_ODOC - || fileType == FILE_TYPE_GETURL - || fileType == FILE_TYPE_LDIF) - DoOpenDoc( file, fileType ); - - // Cannot open the Profile Manager while app is running - if ( (fileType == FILE_TYPE_PROFILES ) - || (fileType == STARTUP_TYPE_NETPROFILE) ) - ErrorManager::PlainAlert(ERROR_OPEN_PROFILE_MANAGER); - - return; - } - - properStartup = TRUE; - - // Initialize all the modules, - // Read generic prefs (which will LoadState all the modules) - // Then start the modules and managers - - NET_InitFileFormatTypes(NULL, NULL); // Needs to be initialized before prefs are read in. - SECNAV_InitConfigObject(); // ditto - - CPrefs::PrefErr abortStartup = CPrefs::eOK; - SplashProgress( GetPString(MAC_PROGRESS_PREFS)); - - if ((fileType == FILE_TYPE_PREFS) && file) { - gotPrefsFile = true; - prefsFile = new LFile(*file); - } - - // Once we get to this point it's safe to quit - fSafeToQuit = true; - -#ifdef DEBUG - // hack to show the profile manager stuff when a modifier key is down - KeyMap theKeys; - GetKeys(theKeys); - - if (theKeys[1] & 0x00008000) // is the command key down - { - prefsFile = NULL; - fileType = FILE_TYPE_PROFILES; - } -#endif - - abortStartup = CPrefs::DoRead( prefsFile, fileType ); - - if (( abortStartup == CPrefs::eAbort ) || fUserWantsToQuit) - { - fStartupAborted = true; - DoQuit(); - return; - } - -#ifdef MOZ_FULLCIRCLE - // Full Circle initialization must happen once the current - // profile is known, such that the prefs calls work. - XP_Bool fullcircle_enable = TRUE; - PREF_GetBoolPref("general.fullcircle_enable", &fullcircle_enable); - if ( fullcircle_enable ) - { - FCInitialize(); - } -#endif - - if ( fileType == FILE_TYPE_ASW && file ) - abortStartup = CPrefs::eRunAccountSetup; - - XP_Bool startupFlag; - mHasFrontierMenuSharing = (!(PREF_GetBoolPref("browser.mac.no_menu_sharing", &startupFlag) == PREF_NOERROR && startupFlag)); - mHasBookmarksMenu = (!(PREF_GetBoolPref("browser.mac.no_bookmarks_menu", &startupFlag) == PREF_NOERROR && startupFlag)); - -#ifndef MOZ_MAIL_NEWS -#ifdef SERVER_ON_RESTART_HACK // not needed in Nova. - // Do this after we read prefs: - { - // Check to see what mail.server_type is and what mail.server_type_on_restart is. - // Must be careful because our auto admin tool may have created a "Big Brother" - // preference file that locks mail.server_type. If this is the case we must - // discard whatever mail.server_type_on_restart is. If the admin hasn't - // locked this preference then we use mail.server_type_on_restart (this is what - // gets set in the preference dialog). - int32 mailServerType, mailServerTypeOnRestart; - PREF_GetIntPref("mail.server_type" , &mailServerType); - PREF_GetIntPref("mail.server_type_on_restart" , &mailServerTypeOnRestart); - - // The default value of the latter is -1, of the former, 0 (POP3). - // Neither of these should NEVER be set to -1 after we run the first time. - if (-1 == mailServerTypeOnRestart) - mailServerTypeOnRestart = mailServerType; - else - mailServerType = mailServerTypeOnRestart; - // Write the adjusted values back to the prefs database. - if (!PREF_PrefIsLocked("mail.server_type")) - PREF_SetIntPref("mail.server_type" , mailServerType); - PREF_SetIntPref("mail.server_type_on_restart" , mailServerTypeOnRestart); - } -#endif -#endif // MOZ_MAIL_NEWS - - // Set the state of network.online to match offline.startup_mode - Int32 startupNetworkState; - enum {kOnlineState, kOfflineState, kAskUserForState}; - PREF_GetIntPref("offline.startup_mode" , &startupNetworkState); - switch (startupNetworkState) - { - case kOnlineState: - PREF_SetBoolPref("network.online" , true); - break; - - case kOfflineState: - PREF_SetBoolPref("network.online" , false); - break; - - case kAskUserForState: - { - XP_Bool onlineLastTime; - PREF_GetBoolPref("network.online" , &onlineLastTime); - XP_Bool locked = PREF_PrefIsLocked("offline.startup_mode"); - - enum - { - eAskMeDialog = 12009, - eWorkOnline, - eWorkOffline, - eSetPref - }; - - StDialogHandler handler(eAskMeDialog, nil); - LWindow *dialog = handler.GetDialog(); - LGARadioButton *onRButton = - (LGARadioButton *)dialog->FindPaneByID(eWorkOnline); - XP_ASSERT(onRButton); - LGARadioButton *offRButton = - (LGARadioButton *)dialog->FindPaneByID(eWorkOffline); - XP_ASSERT(offRButton); - if (onlineLastTime) - { - onRButton->SetValue(true); - } - else - { - offRButton->SetValue(true); - } - LGACheckbox *setPrefBox = - (LGACheckbox *)dialog->FindPaneByID(eSetPref); - XP_ASSERT(setPrefBox); - if (locked) - { - setPrefBox->Disable(); - } - // Run the dialog - MessageT message = msg_Nothing; - do - { - message = handler.DoDialog(); - } while (msg_OK != message); - XP_Bool goOnline = onRButton->GetValue(); - if (setPrefBox->GetValue()) - { - int32 newPrefValue = goOnline ? - kOnlineState: - kOfflineState; - PREF_SetIntPref("offline.startup_mode", newPrefValue); - } - if (goOnline) - { - PREF_SetBoolPref("network.online" , true); - } - else - { - PREF_SetBoolPref("network.online" , false); - } - } - break; - } - -#if defined (OJI) - // beard: On the Mac, there's no interface for this yet, so we want to turn it on. - PREF_SetBoolPref("security.enable_java", TRUE); -#endif - - SetBooleanWithPref("security.enable_java", &mJavaEnabled); - PREF_RegisterCallback("security.enable_java", - SetBooleanWithPref, - (void*)&mJavaEnabled); - - // Set CSharedPatternWorld::sUseUtilityPattern from pref - XP_Bool useUtilityPattern; - int prefResult = PREF_GetBoolPref("browser.mac.use_utility_pattern", &useUtilityPattern); - if (prefResult == PREF_NOERROR && useUtilityPattern) - { - // Just for grins, check to see if utility pattern exists - PixPatHandle thePattern = NULL; - thePattern = ::GetPixPat(cUtilityPatternResID); - if (thePattern) - { - CSharedPatternWorld::sUseUtilityPattern = true; - ::DisposePixPat(thePattern); - } - } - - - // NETLIB wait until we've read prefs to determine what to set up - CStr255 tmp; - - // It is a good idea to allocate enough space for strings. - // Before today, we were not doing so. This was evil... - // So, XP_ALLOC now takes tmp.Length() + 1 as an argument - // instead of XP_ALLOC. - // dkc 1/25/96 - - ::GetIndString( tmp, ID_STRINGS, APPNAME_STRING_INDEX ); - XP_AppName = (char*)XP_ALLOC( tmp.Length() + 1); - sprintf( XP_AppName, tmp ); - - ::GetIndString( tmp, ID_STRINGS, APPLANGUAGE_STRING_INDEX ); - XP_AppLanguage = (char*)XP_ALLOC( tmp.Length() + 1); - sprintf( XP_AppLanguage, tmp ); - - ::GetIndString( tmp, ID_STRINGS, APPVERSION_STRING_INDEX ); - // Admin Kit: support optional user-agent suffix - { - char* suffix; - if ( PREF_CopyConfigString("user_agent", &suffix) == PREF_NOERROR ) - { - tmp = tmp + "C-" + suffix; - XP_FREE(suffix); - } - } - - CStr255 tmp2; -#ifdef powerc - ::GetIndString( tmp2, ID_STRINGS, USERAGENT_PPC_STRING_INDEX ); -#else - ::GetIndString( tmp2, ID_STRINGS, USERAGENT_68K_STRING_INDEX ); -#endif - tmp = tmp + " "; - tmp = tmp + tmp2; - - char* securityText = "X"; - - XP_AppVersion = (char*)XP_ALLOC( tmp.Length() + strlen( securityText ) + 1); - sprintf( XP_AppVersion, tmp, securityText ); - - ::GetIndString( tmp2, ID_STRINGS, APPCODENAME_STRING_INDEX ); - XP_AppCodeName = (char*)XP_ALLOC( tmp2.Length() + 1); - sprintf( XP_AppCodeName, tmp2 ); - -#ifdef powerc - XP_AppPlatform = "MacPPC"; -#else - XP_AppPlatform = "Mac68k"; -#endif - - SplashProgress( GetPString(MAC_PROGRESS_NET) ); - - NET_InitNetLib (CPrefs::GetLong( CPrefs::BufferSize ), CPrefs::GetLong( CPrefs::Connections ) ); - - SECNAV_EarlyInit(); - NET_ChangeMaxNumberOfConnections(50); - RNG_SystemInfoForRNG(); - - // 1998.01.12 pchen and 1998.02.23 rjc - // RDF now uses NetLib. Netlib initializes history. RDF reimplements - // history. Looks like History initialization has been changed to work - // correctly. Also, GH_InitGlobalHistory() can be safely called twice. - URDFUtilities::StartupRDF(); - - // Load the .jsc startup file, if necessary (autoadmin added 2/11/98 arshad) -//¥¥¥ REVISIT NOVA MERGE ¥¥¥ NET_DownloadAutoAdminCfgFile(); - - // Install Help and Directory menus - InstallMenus(); // arshad - taken from line 1317, moved here for autoadmin to update menus (re: bug 88421) - - // 1998-03-17 pchen -- Moved this code here to fix Communicator menu - // Polaris: remove Calendar/3270 items if they're not installed - // (?? maybe these are always available for Polaris (autoadmin lib) - // so users get helpful error messages if they try them..?) - if (CWindowMenu::sWindowMenu) - { - FSSpec fspec; - -#if 0 - if ( CFileMgr::FindApplication(kCalendarAppSig, fspec) != noErr ) - (CWindowMenu::sWindowMenu)->RemoveCommand(cmd_LaunchCalendar); - if ( ! FE_IsNetcasterInstalled() ) - (CWindowMenu::sWindowMenu)->RemoveCommand(cmd_LaunchNetcaster); - if ( ! Find3270Applet(fspec) ) - (CWindowMenu::sWindowMenu)->RemoveCommand(cmd_Launch3270); -#endif - - if ( CFileMgr::FindApplication(kAOLInstantMessengerSig, fspec) != noErr ) - (CWindowMenu::sWindowMenu)->RemoveCommand(cmd_LaunchAOLInstantMessenger); - - } - - SECNAV_Init(); - SECNAV_RunInitialSecConfig(); // call after SECNAV_Init() - - // Must not call SECNAV_SecurityVersion before SECNAV_Init(). - securityText = SECNAV_SecurityVersion( PR_FALSE ); - XP_FREE(XP_AppVersion); - XP_AppVersion = (char*)XP_ALLOC( tmp.Length() + strlen( securityText ) + 1); - sprintf( XP_AppVersion, tmp, securityText ); - -#ifdef MOZ_MAIL_NEWS - NET_ReadNewsrcFileMappings(); -#endif - - SplashProgress( GetPString(MAC_PROGRESS_BOOKMARK)); - InitBookmarks(); - - // Create the NSPR event queue - - mozilla_event_queue = PR_CreateEventQueue("Mozilla Event Queue", mozilla_thread); - - NPL_Init(); // plugins - LM_InitMocha(); // mocha, mocha, mocha - - // The tools menus must be created after the plugins are read in. - -#ifdef EDITOR - CToolsAttachment *attachment = new CToolsAttachment; - if ( attachment ) - AddAttachment( attachment ); // Tools menu - CFontMenuAttachment *fontattachment = new CFontMenuAttachment; - if ( fontattachment ) - AddAttachment( fontattachment ); // Font menu - CRecentEditMenuAttachment *recentattachment = new CRecentEditMenuAttachment; - if ( recentattachment ) - AddAttachment( recentattachment ); -#endif // EDITOR - UpdateMenus(); - -#if defined (JAVA) - // Initialize the java runtime, start the MToolkit thread running - // to keep the network alive. For now, we have to temporarily - // enable java to make sure that the runtime bootstraps itself - // minimally. - // dkc 3-18-96 - - this->SplashProgress( GetPString(MAC_PROGRESS_JAVAINIT)); - - LJ_SetJavaEnabled((PRBool)CPrefs::GetBoolean(CPrefs::EnableJava)); -#endif /* defined (JAVA) */ - -#if defined(EDITOR) && defined(MOZ_JAVA) - EDTPLUG_RegisterEditURLCallback(&OpenEditURL); -#endif // EDITOR && MOZ_JAVA - - DestroySplashScreen(); - if ( abortStartup == CPrefs::eRunAccountSetup ) - file = NULL; - - Boolean agreedToLicense = AgreedToLicense( file, fileType ); - - if ( abortStartup == CPrefs::eRunAccountSetup ) - LaunchAccountSetup(); - -#ifdef MOZ_MAIL_NEWS - // This is for Biff notification. - // It should come after menus and after prefs are read in and probably - // after the online/offline determination is made. - CCheckMailContext::Initialize(this); // we are the owner/user -#endif // MOZ_MAIL_NEWS -#ifdef MOZ_LOC_INDEP - InitializeLocationIndependence(); -#endif -#ifdef MOZ_MAIL_NEWS - SplashProgress( GetPString(MAC_PROGRESS_ADDRESS) ); - CAddressBookManager::OpenAddressBookManager(); -#endif // MOZ_MAIL_NEWS - NET_FinishInitNetLib(); // This was commented out - anyone know why? - if (agreedToLicense) - CreateStartupEnvironment(! gotPrefsFile); - - fProperStartup = true; -} // CFrontApp::ProperStartup - - -Boolean CFrontApp::AgreedToLicense( FSSpec* fileSpec, short fileType ) -{ - // ML License clicker moved to installer so just open - DoOpenDoc( fileSpec, fileType ); - - return true; -} - - - -// Called when application starts up without any documents -// Reads in the default preferences doc, and then creates a default browser window -void CFrontApp::StartUp() -{ - ProperStartup( NULL, FILE_TYPE_PREFS ); -// CMailNewsFolderWindow::FindAndShow(true); -} - - -pascal void colorPopupMDEFProc(short message, MenuHandle theMenu, - Rect *menuRect, Point hitPt, short *whichItem); - -// openStartupWindows is only false if we started comm from a desktop icon -// and don't want the prefs-specified components to open up -void CFrontApp::CreateStartupEnvironment(Boolean openStartupWindows) -{ -#ifdef EDITOR - // Composer's color picker MDEF - Handle stubMDEFH; - MenuDefUPP colorMdefUPP; - - // load/lock (but DON'T detach) MDEF stub and set it to call appropriate routine - if ( (stubMDEFH = Get1Resource( 'MDEF', 20000 )) != NULL) - { - HNoPurge((Handle)stubMDEFH); - HUnlock((Handle)stubMDEFH); - MoveHHi((Handle)stubMDEFH); - HLock((Handle)stubMDEFH); - if ( (colorMdefUPP = NewMenuDefProc(colorPopupMDEFProc)) != NULL) - { - *(ProcPtr *)(*stubMDEFH + 6L) = (ProcPtr)colorMdefUPP; - } - } -#endif - - XP_Bool startupFlag; - - // handle new startup preferences - CommandT command = cmd_Nothing; - // check to see if we need to bring up a new browser window at startup - if (PREF_GetBoolPref("general.startup.browser", &startupFlag) == PREF_NOERROR) - { - if (startupFlag) - { - // Only create a new browser window if the startupFlag indicates - // that we should and there are no delayed URLs (which could happen - // if a 'GURL' or 'OURL' event is handled while the profile dialog - // or license dialog is waiting to be dismissed) and there are no - // open browser windows (which could happen if an 'odoc' event - // was processed prior to CreateStartupEnvironment being called). - // These guards will ensure that we don't open any unnecessary blank - // browser windows at startup. - - CMediatedWindow* window = CWindowMediator::GetWindowMediator()->FetchTopWindow( - WindowType_Browser, - regularLayerType, - true); - UInt32 howMany = CURLDispatcher::CountDelayedURLs(); - if (openStartupWindows && !window && !CURLDispatcher::CountDelayedURLs()) - MakeNewDocument(); - } - } - -#if 0 - if (PREF_GetBoolPref("general.startup.netcaster", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_LaunchNetcaster, NULL); - } -#endif - - startupFlag = false; - if (HasFrontierMenuSharing()) - { - AddAttachment(new LMenuSharingAttachment( msg_AnyMessage, TRUE, MENU_SHARING_FIRST ) ); // Menu Sharing - } - -#ifdef MOZ_MAIL_NEWS - // check to see if we need to bring up mail window at startup - if (PREF_GetBoolPref("general.startup.mail", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_Inbox, NULL); - } - // check to see if we need to bring up news window at startup - if (PREF_GetBoolPref("general.startup.news", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_NewsGroups, NULL); - } -#endif // MOZ_MAIL_NEWS -#ifdef EDITOR - // check to see if we need to bring up an editor window at startup - if (PREF_GetBoolPref("general.startup.editor", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_NewWindowEditor, NULL); - } -#endif -#if !defined(MOZ_LITE) && !defined(MOZ_MEDIUM) - // check to see if we need to launch conference at startup - if (PREF_GetBoolPref("general.startup.conference", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_LaunchConference, NULL); - } - // check to see if we need to launch calendar at startup - if (PREF_GetBoolPref("general.startup.calendar", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_LaunchCalendar, NULL); - } - - // check to see if we need to launch AOL Instant Messenger at startup - if (PREF_GetBoolPref("general.startup.AIM", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_LaunchAOLInstantMessenger, NULL); - } -#endif // !MOZ_LITE && !MOZ_MEDIUM -#ifdef MOZ_TASKBAR - if (PREF_GetBoolPref("taskbar.mac.is_open", &startupFlag) == PREF_NOERROR) - { - if (openStartupWindows && startupFlag) - ObeyCommand(cmd_ToggleTaskBar, NULL); - } -#endif // MOZ_TASKBAR -} - -// OpenDocument asserts that there is a preference document read in, -// because we cannot do any document operations before preferences are -// initialized. Pref documents are read automatically in assertion -// Hyper document is read in here -void CFrontApp::OpenDocument( FSSpec* inFileSpec ) -{ - FInfo fndrInfo; - short fileType; - - OSErr err = ::FSpGetFInfo( inFileSpec, &fndrInfo ); - //what to do on error? - - // ¥Êhow silly is this? - if ( emPrefsType == fndrInfo.fdType ) - fileType = FILE_TYPE_PREFS; - else if ( emProfileType == fndrInfo.fdType ) - fileType = FILE_TYPE_PROFILES; - else if ( 'ASWl' == fndrInfo.fdType ) - fileType = FILE_TYPE_ASW; - else if ( emLDIFType == fndrInfo.fdType) - fileType = FILE_TYPE_LDIF; - else if (emNetprofileType == fndrInfo.fdType) - fileType = STARTUP_TYPE_NETPROFILE; - else - fileType = FILE_TYPE_ODOC; - - ProperStartup( inFileSpec, fileType ); -} - -void CFrontApp::DoOpenDoc( FSSpec* inFileSpec, short fileType ) -{ - switch ( fileType ) - { - case FILE_TYPE_ODOC: - if ( inFileSpec ) - OpenLocalURL(inFileSpec ); - break; - case FILE_TYPE_LDIF: -#ifdef MOZ_MAIL_NEWS - if (inFileSpec) - CAddressBookManager::ImportLDIF(*inFileSpec); - break; -#endif // MOZ_MAIL_NEWS - case FILE_TYPE_PREFS: - case FILE_TYPE_PROFILES: - break; - case FILE_TYPE_GETURL: - case FILE_TYPE_NONE: - break; - } -} - -// Opens up a bookmark file -void CFrontApp::OpenBookmarksFile( FSSpec* inFileSpec, CBrowserWindow * /*win*/, Boolean /*delayed*/) -{ - Try_ - { - const int kBufferLen = 500; - vector url (kBufferLen); - OSErr err = ReadBookmarksFile(url, *inFileSpec); - ThrowIfOSErr_(err); - - URL_Struct * request = NET_CreateURLStruct( &(*url.begin()), NET_DONT_RELOAD ); - CURLDispatcher::DispatchURL(request, NULL); - } - Catch_(inErr) - {} - EndCatch_ -} - - -// Opens a local file. If it is a bookmark, load the URL stored in it -void CFrontApp::OpenLocalURL( FSSpec* inFileSpec , - CBrowserWindow * win, - char * mime_type, - Boolean delayed) -{ - if (inFileSpec == NULL) - return; - Boolean dummy, dummy2; - -// Resolve the aliases - OSErr err = ::ResolveAliasFile(inFileSpec,TRUE,&dummy,&dummy2); - -// If we are a bookmark file, open a bookmark - FInfo info; - err = ::FSpGetFInfo (inFileSpec, &info); - if ((info.fdType == emBookmarkFile) && (mime_type == NULL)) - { - OpenBookmarksFile( inFileSpec, win, delayed); - return; - } - -// If we are a help file, open a help document - if ((info.fdType == emHelpType) && (mime_type == NULL)) - { - char * help_id = NULL; - char * map_file_url = CFileMgr::GetURLFromFileSpec(*inFileSpec); - - DebugStr("\pNot implemented"); -//¥¥¥ NET_GetHTMLHelpFileFromMapFile(*CBookmarksContext::GetInstance(), // Will this work? -//¥¥¥ map_file_url, help_id, NULL); - FREEIF( help_id ); - FREEIF( map_file_url ); - return; - } - - -#ifdef MOZ_MAIL_NEWS -// If we are mailbox file at the root of the local mail hierarchy, we can assume that it's an -// imported mailbox created by the import module. Then just update the folder tree (the new mailbox -// will appear in the folder hierarchy). - FSSpec mailFolderSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - if (mailFolderSpec.vRefNum == inFileSpec->vRefNum - && mailFolderSpec.parID == inFileSpec->parID) - { - Assert_(false); - //MSG_UpdateFolderTree(); not checked in yet by phil. - return; - } -#endif //MOZ_MAIL_NEWS - -// Open it by loading the URL into specified window - - char* localURL; - if (win == NULL) - win = CBrowserWindow::FindAndPrepareEmpty(true); - if (win != NULL) - { - localURL = CFileMgr::GetURLFromFileSpec(*inFileSpec); - URL_Struct * request = NET_CreateURLStruct (localURL, NET_DONT_RELOAD); - if (localURL) - XP_FREE(localURL); - ThrowIfNil_(request); - request->content_type = mime_type; -// if (delayed) -// win->StartLatentLoading(request); -// else -// win->StartLoadingURL (request, FO_CACHE_AND_PRESENT); - // FIX ME!!! Hook up latent loading!!! - CBrowserContext* theContext = (CBrowserContext*)win->GetWindowContext(); - theContext->SwitchLoadURL(request, FO_CACHE_AND_PRESENT); - } -} - -void CFrontApp::PrintDocument(FSSpec* inFileSpec) -{ - ProperStartup( inFileSpec, FILE_TYPE_ODOC ); - PrintDocument( inFileSpec ); -} - - -// -// MakeMenuBar -// -// Overidden to make an appearance-savvy menu bar. -// -void -CFrontApp::MakeMenuBar() -{ - if ( UEnvironment::HasFeature( env_HasAppearance ) ) - new LAppearanceMBAR(MBAR_Initial); - else - new LMenuBar(MBAR_Initial); - LMenuBar::GetCurrentMenuBar()->SetModifierKeys ( cmdKey | shiftKey ); -} - - -// --------------------------------------------------------------------------- -// ¥ ClickMenuBar -// --------------------------------------------------------------------------- -// Respond to a mouse click in the menu bar. -// -// Also, we do a targeted update of menus before calling MenuSelect - -void -CFrontApp::ClickMenuBar( - const EventRecord& inMacEvent) -{ - StUnhiliteMenu unhiliter; // Destructor unhilites menu title - Int32 menuChoice; - - CTargetedUpdateMenuRegistry::SetCommands(sCommandsToUpdateBeforeSelectingMenu); - CTargetedUpdateMenuRegistry::UpdateMenus(); - - CommandT menuCmd = LMenuBar::GetCurrentMenuBar()-> - MenuCommandSelection(inMacEvent, menuChoice); - - if (menuCmd != cmd_Nothing) { - SignalIf_(LCommander::GetTarget() == nil); - LCommander::SetUpdateCommandStatus(true); - LCommander::GetTarget()->ProcessCommand(menuCmd, &menuChoice); - } -} - -// --------------------------------------------------------------------------- -// ¥ UpdateMenus -// --------------------------------------------------------------------------- -// Update the status of all menu items -// -// General Strategy: -// (1) Designate every Menu as "unused". -// (2) Iterate through all menu commands, asking the Target chain for -// the status of each one. Enable/Disable, mark, and adjust the -// name of each menu accordingly. Enabling any item in a Menu -// designates that Menu as "used". -// (3) Iterate through each menu, asking for the status of a special -// synthetic command that indicates the entire menu. At this time, -// Commanders can perform operations that affect the menu as a whole. -// Menus that are desinated "used" are enabled; "unused" ones -// are disabled. -// -// Changes from LEventDispatcher::UpdateMenus(): -// -// - We maintain a list of commands to update and a bool to indicate -// whether to update just those commands or all commands. This is -// useful for targeting specific commands to update without having -// to pay the price for updating hundreds of commands. The registry -// of commands is maintained separately from CFrontApp. The general -// pattern is that the client which calls UpdateMenus will stuff -// it's commands in the registry and then call UpdateMenus. -// -// One limitation of this targeted updating is that it is possible -// that a menu which should be disabled because there are no enabled -// items might still be enabled. However, given that the typical -// -// - We call UpdateMenusSelf() to get some more work done. -// -// - We cache some stuff during UpdateMenus - -void -CFrontApp::UpdateMenus() -{ -#ifdef PROFILE_UPDATE_MENUS - StProfileSection profileThis("\pprofile", 1000, 100); -#endif - - // UDesktop::StUseFrontWindowIsModalCache theFrontWindowIsModalCache; - -#ifdef EDITOR - CAutoPtr stCharCache; - - CEditView *editViewCommander = dynamic_cast(LCommander::GetTarget()); - if ( editViewCommander ) - stCharCache.reset(new CEditView::StUseCharFormattingCache(*editViewCommander)); -#endif - - LMenuBar *theMenuBar = LMenuBar::GetCurrentMenuBar(); - Int16 menuItem; - MenuHandle macMenuH = nil; - LMenu *theMenu; - CommandT theCommand; - Boolean isEnabled; - Boolean usesMark; - Char16 mark; - Str255 itemName; - LCommander *theTarget = LCommander::GetTarget(); - - theMenu = nil; // Designate each menu as "unused" - while (theMenuBar->FindNextMenu(theMenu)) { - theMenu->SetUsed(false); - } - - // Loop thru each menu item that has an - // associated command - while (theMenuBar->FindNextCommand(menuItem, macMenuH, - theMenu, theCommand)) { - - // Don't change menu item state for - // special commands (all negative - // values except cmd_UseMenuItem) - // or for commands which are not - // in the registry when we are - // supposed to only update commands - // which are in the registry. - if ((theCommand > 0 || theCommand == cmd_UseMenuItem) && - (!CTargetedUpdateMenuRegistry::UseRegistryToUpdateMenus() || - CTargetedUpdateMenuRegistry::CommandInRegistry(theCommand))) - { - - // For commands that depend on the menu - // item, get synthetic command number - if (theCommand == cmd_UseMenuItem) { - theCommand = theMenu->SyntheticCommandFromIndex(menuItem); - } - - // Ask Target if command is enabled, - // if the menu item should be marked, - // and if the name should be changed - isEnabled = false; - usesMark = false; - itemName[0] = 0; - - if (theTarget != nil) { - theTarget->ProcessCommandStatus(theCommand, isEnabled, - usesMark, mark, itemName); - } - - // Adjust the state of each menu item as needed. - // Also designate as "used" the Menu containing an - // enabled item. - - if (isEnabled) { - ::EnableItem(macMenuH, menuItem); - theMenu->SetUsed(true); - } else { - ::DisableItem(macMenuH, menuItem); - } - - if (usesMark) { - ::SetItemMark(macMenuH, menuItem, mark); - } - - if (itemName[0] > 0) { - ::SetMenuItemText(macMenuH, menuItem, itemName); - } - - } else if (theCommand < 0 || CTargetedUpdateMenuRegistry::UseRegistryToUpdateMenus()) { - // Don't change state of items with - // negative command numbers or - // when the registry is in use. - if (theMenu->ItemIsEnabled(menuItem)) { - theMenu->SetUsed(true); - } - - } else { // Item has command number 0 - ::DisableItem(macMenuH, menuItem); - } - - } - - if (theTarget != nil) { - // Loop thru each menu - theMenu = nil; - while (theMenuBar->FindNextMenu(theMenu)) { - - // The "command" for an entire Menu is the synthetic command - // number for item zero (negative number that has the Menu ID - // in the high word and 0 in the low word. - - theCommand = theMenu->SyntheticCommandFromIndex(0); - - // The Target chain now has the opportunity to do something - // to the Menu as a whole, as a call for this special - // synthetic command is made only once for each menu. - // For example, a text handling Commander could put a check - // mark next to the current font in a Fonts menu. - // - // The isEnabled parameter [outEnabled as an argument to - // FindCommandStatus()] should be set to true to enable - // a menu that does not contain commands that have - // already been explicitly enabled. For example, a Fonts - // menu typically has no associated commands (the menu - // items all use synthetic commands), so a Commander - // must set outEnabled to true when asked the status - // of the synthetic command corresponding the Fonts menu. - // - // The mark information is ignored, as is the itemName. - // It would be possible to use the itemName to facilitate - // dynamic changing of menu titles. However, this is bad - // interface design which we don't want to encourage. - - isEnabled = false; - - theTarget->ProcessCommandStatus(theCommand, isEnabled, - usesMark, mark, itemName); - - // Menu is "used" if it contains commands that were - // explicity enabled in the loop above, or if this - // last call passes back "true" for isEnabled. - - if (isEnabled) { - theMenu->SetUsed(true); - } - - // Enable all "used" Menus and disable "unused" ones - // To avoid unnecessary redraws, we invalidate the menu - // bar only if a Menu's enableFlags changes (which means - // that its state has changed). - - macMenuH = theMenu->GetMacMenuH(); - Uint32 originalFlags = (**macMenuH).enableFlags; - - if (theMenu->IsUsed()) { - ::EnableItem(macMenuH, 0); - } else { - if (!CTargetedUpdateMenuRegistry::UseRegistryToUpdateMenus()) - { - // When we are using the registry, it is OK to enable - // menus that are now used, but it is inappropriate - // to disable menus, since we did not update the command - // status of all menu items and therefore we do not have - // enough information to disable the whole menu, - - ::DisableItem(macMenuH, 0); - } - } - - if (originalFlags != (**macMenuH).enableFlags) { - ::InvalMenuBar(); - } - } - } - - UpdateMenusSelf(); -} - -void CFrontApp::UpdateMenusSelf() -{ - if (CWindowMenu::sWindowMenu) - (CWindowMenu::sWindowMenu)->Update(); - if (CHistoryMenu::sHistoryMenu) - (CHistoryMenu::sHistoryMenu)->Update(); - - CBookmarksAttachment::UpdateMenu(); - -#ifdef EDITOR - CToolsAttachment::UpdateMenu(); - CRecentEditMenuAttachment::UpdateMenu(); -#endif // EDITOR - - UpdateHierarchicalMenus(); - - CPaneEnabler::UpdatePanes(); -#ifdef MOZ_MAIL_NEWS - CMailFolderMixin::UpdateMailFolderMixinsNow(); -#endif // MOZ_MAIL_NEWS - -} - -void CFrontApp::UpdateHierarchicalMenus() -// This is called after LEventDispatcher::UpdateMenus(), and enables parent -// items of any used submenu. -{ - if (!LCommander::GetTarget()) - return; - Int16 menuItem; - MenuHandle macMenuH = nil; - LMenu *theMenu; - CommandT theCommand; - LMenuBar *theMenuBar = LMenuBar::GetCurrentMenuBar(); - while (theMenuBar->FindNextCommand(menuItem, macMenuH, - theMenu, theCommand)) - { - short menuChar; - ::GetItemCmd(macMenuH, menuItem, &menuChar); - if (menuChar != hMenuCmd) - continue; - // We have an item item with the "hierarchical" flag. - - // If we have a hierarchal menu that HAS a command number (ie CommandFromIndex - // returns something greater than zero) then we're going to trust that it - // has been properly enabled already. If we don't give the root menu item the - // benefit of the doubt then we could end up accidentally enabling it if it has - // more than 31 items in its sub menu - if (theMenu->CommandFromIndex(menuItem) < 0) { - - // Find the child menu, see if LEventDispatcher::UpdateMenus() has - // marked it as "used", and if so, make sure we enable this item - short childMenuID; - ::GetItemMark(macMenuH, menuItem, &childMenuID); - LMenu* childMenu = theMenuBar->FetchMenu(childMenuID); - if (childMenu && childMenu->IsUsed()) - { - ::EnableItem(macMenuH, menuItem); - theMenu->SetUsed(true); - } - } - } - // Now make sure entire menus get enabled. - while (theMenuBar->FindNextMenu(theMenu)) - { - macMenuH = theMenu->GetMacMenuH(); - Uint32 originalFlags = (**macMenuH).enableFlags; - if (theMenu->IsUsed()) - ::EnableItem(macMenuH, 0); - else - ::DisableItem(macMenuH, 0); - if (originalFlags != (**macMenuH).enableFlags) - ::InvalMenuBar(); - } -} // CFrontApp::UpdateHierarchicalMenus - - -/* - App::::MakeNewDocument - Called by PowerPlant when a user chooses "New" - Returns a window (which is also a model object) in this case. Will change. - Is recordable. -*/ -LModelObject* CFrontApp::MakeNewDocument() -{ - - try - { - enum - { - kBlankPage, - kHomePage, - kLastPage - }; - int32 prefValue = kHomePage; - int prefResult = PREF_GetIntPref("browser.startup.page", &prefValue); - if (prefResult != PREF_NOERROR) - { - prefValue = kHomePage; - } - URL_Struct* theURL; - - switch (prefValue) - { - case kBlankPage: - theURL = nil; - break; - case kLastPage: - char urlBuffer[1024]; - if (GH_GetMRUPage(urlBuffer, 1024)) - { - theURL = NET_CreateURLStruct(urlBuffer, NET_DONT_RELOAD); - } - else - { - theURL = nil; - //theURL = NET_CreateURLStruct(urlBuffer, NET_DONT_RELOAD); - } - break; - case kHomePage: - default: - { - CStr255 url = CPrefs::GetString(CPrefs::HomePage); - if (url.Length() > 0) - theURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - else - theURL = nil; - } - break; - } - - CURLDispatcher::DispatchURL(theURL, NULL, false, true); - } - catch (...) - { - - - } - - return NULL; -} - - -// -// ChooseDocument -// -// Picks a document, and opens it in a window (uses existing window if one is open). This -// takes advantage of the new NavigationServices stuff if it is available. -// -void CFrontApp::ChooseDocument() -{ - static const OSType myTypes[] = { 'TEXT', 'JPEG', 'GIFf'}; - - UDesktop::Deactivate(); // Always bracket this - - FSSpec fileSpec; - Boolean fileSelected = SimpleOpenDlog ( 3, myTypes, &fileSpec ); - - if ( fileSelected ) - OpenDocument(&fileSpec); - - UDesktop::Activate(); - -} // ChooseDocument - - -CFrontApp* CFrontApp::GetApplication() -{ - return sApplication; -} - -// ¥¥ commands - -void CFrontApp::ProcessCommandStatus(CommandT inCommand,Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName) -{ - if (GetState() == programState_Quitting) - // If we are quitting, all commands are disabled - { - outEnabled = FALSE; - return; - } - else - LApplication::ProcessCommandStatus(inCommand,outEnabled, outUsesMark,outMark, outName); -} - -//----------------------------------- -void CFrontApp::FindCommandStatus( CommandT command, Boolean& enabled, - Boolean& usesMark, Char16& mark, Str255 outName ) -//----------------------------------- -{ - // Allow only close and quit if memory is low. - if (Memory_MemoryIsLow()) - { - if (command != cmd_Quit) // cmd_Close and cmd_CloseAll will also be avail., from elsewhere. - enabled = FALSE; - else - LDocApplication::FindCommandStatus (command, enabled, usesMark, mark, outName); - return; - } - // Do not enable menus behind modal dialogs - if (IsFrontWindowModal()) // Only enable quit when front window is modal - { - if (command != cmd_Quit) - enabled = FALSE; - else - LDocApplication::FindCommandStatus (command, enabled, usesMark, mark, outName); - return; - } - usesMark = FALSE; - switch ( command ) - { - case cmd_GoForward: - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - LString::CopyPStr(::GetPString(MENU_FORWARD_ONE_HOST), outName); - } - else - { - LString::CopyPStr(::GetPString(MENU_FORWARD), outName); - } - break; - case cmd_GoBack: - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - LString::CopyPStr(::GetPString(MENU_BACK_ONE_HOST), outName); - } - else - { - LString::CopyPStr(::GetPString(MENU_BACK), outName); - } - break; - - case cmd_ShowJavaConsole: -#if defined (JAVA) - usesMark = true; - mark = LJ_IsConsoleShowing() ? 0x12 : 0; - enabled = mJavaEnabled; -#endif /* defined (JAVA) */ - -#if defined (OJI) - usesMark = true; - mark = JVM_IsConsoleVisible() ? 0x12 : 0; - enabled = mJavaEnabled; -#endif /* defined (OJI) */ - break; - -#ifdef EDITOR -// case cmd_New_Document_Heirarchical_Menu: - case cmd_NewWindowEditor: - case cmd_NewWindowEditorIFF: - case cmd_New_Document_Template: - case cmd_New_Document_Wizard: - case cmd_OpenFileEditor: - case cmd_EditEditor: -#endif // EDITOR -#ifdef MOZ_MAIL_NEWS - case cmd_MailNewsFolderWindow: - case cmd_NewsGroups: - // case cmd_GetNewMail: - case cmd_Inbox: - case cmd_MailNewsSearch: - case cmd_MailFilters: - case cmd_SearchAddresses: - case cmd_AddressBookWindow: - case cmd_NewFolder: -#endif // MOZ_MAIL_NEWS -#if defined(MOZ_MAIL_COMPOSE) || defined(MOZ_MAIL_NEWS) - case cmd_NewMailMessage: -#endif // MOZ_MAIL_COMPOSE -#ifdef EDITOR - case cmd_OpenURLEditor: -#endif // EDITOR - case cmd_BrowserWindow: - case cmd_Preferences: - case 19896: /*cmd_NetToggle*/ - case cmd_OpenURL: -// case cmd_EditGeneral: - case cmd_EditNetwork: - case cmd_EditSecurity: -// old mail/news stuff -// case cmd_MailWindow: -// case cmd_NewsWindow: -// case cmd_MailTo: - case cmd_CoBrandLogo: - case cmd_AboutPlugins: - -#if 0 - case cmd_LaunchCalendar: - case cmd_Launch3270: - case cmd_LaunchNetcaster: - case cmd_LaunchConference: - enabled = mConferenceApplicationExists; - break; -#endif - -#ifdef FORTEZZA - case cmd_FortezzaCard: - case cmd_FortezzaChange: - case cmd_FortezzaView: - case cmd_FortezzaInfo: - case cmd_FortezzaLogout: -#endif // FORTEZZA - enabled = TRUE; - break; - - - case cmd_BookmarksWindow: - case cmd_HistoryWindow: - case cmd_PrivDisplayCookies: - case cmd_PrivDisplaySignons: - case cmd_PrivAboutPrivacy: - enabled = !Memory_MemoryIsLow(); - break; - - case cmd_PrivAnonMode: - usesMark = true; - mark = PRVCY_IsAnonymous() ? 0x12 : 0; - enabled = TRUE; - break; - - case cmd_LaunchImportModule: - enabled = mImportModuleExists; - break; - - case cmd_New: - case cmd_Open: - enabled = !Memory_MemoryIsLow(); - break; -#ifdef MOZ_TASKBAR - case cmd_ToggleTaskBar: - enabled = TRUE; - CTaskBarListener::GetToggleTaskBarWindowMenuItemName(outName); - break; -#endif // MOZ_TASKBAR -#ifdef MOZ_OFFLINE - // Online/Offline mode - case cmd_ToggleOffline: - case cmd_SynchronizeForOffline: - enabled = TRUE; - UOffline::FindOfflineCommandStatus(command, enabled, outName); - break; -#endif // MOZ_OFFLINE - default: - ResIDT menuID; - Int16 menuItem; - if (IsSyntheticCommand(command, menuID, menuItem) && menuID == cWindowMenuID) - // --ML 4.0b2 Disable all Window menu items without a command number - // (i.e. Conference, Calendar, IBM, History) - enabled = FALSE; -// the code below was used ifndef MAILNEWS -// else if ((command > cmd_WINDOW_MENU_BASE) && (command < cmd_WINDOW_MENU_BASE_LAST)) -// enabled = TRUE; - else - LDocApplication::FindCommandStatus (command, enabled, usesMark, mark, outName); - } -} // CFrontApp::FindCommandStatus - -extern void NET_ToggleTrace(); - -//----------------------------------- -Boolean CFrontApp::ObeyCommand(CommandT inCommand, void* ioParam) -//----------------------------------- -{ - Boolean bCommandHandled = true; - - switch ( inCommand ) - { - case cmd_BrowserWindow: - /* - URL_Struct* theURL = NULL; - CURLDispatcher* theDispatcher = CURLDispatcher::GetURLDispatcher(); - Assert_(theDispatcher != NULL); - theDispatcher->DispatchToView(NULL, theURL, FO_CACHE_AND_PRESENT); - */ - // this code is stolen from the editor button, below! Thanks Kathy! - // get the front window so we know if an browser window is already in the front - CMediatedWindow *wp, *browserwin; - CWindowIterator iterAny(WindowType_Any); - iterAny.Next(wp); - CWindowIterator iter(WindowType_Browser); - iter.Next(browserwin); - if (browserwin && (wp == browserwin)) - { - // count the number of windows; stuff current browser window into browserwin - // put the window we want to be frontmost into wp (reuse) - // spec says to cycle through all windows of our type so we bring the - // backmost-window to the front and push the others down in the stack - int numWindows = 1; - while (iter.Next(wp)) - { - numWindows++; - browserwin = wp; - } - - if (numWindows == 1) - browserwin = NULL; // set to NULL so we create new window below - } - - // if no browser in front window bring the frontmost browser window to front - // if browser is in front select the window determined above and we're done! - if (browserwin) - { - browserwin->Show(); - browserwin->Select(); - break; - } - else // let's make a new one - { - MakeNewDocument(); - } - break; - case 19896: /*cmd_NetToggle*/ - NET_ToggleTrace(); - break; - case cmd_ShowJavaConsole: -#if defined (JAVA) - { - if (LJ_IsConsoleShowing()) - LJ_HideConsole(); - else - LJ_ShowConsole(); - } -#endif /* defined (JAVA) */ - -#if defined (OJI) - JVM_ToggleConsole(); -#endif /* defined (OJI) */ - break; - - case cmd_HistoryWindow: - { - CNavCenterWindow* navCenter = dynamic_cast(URobustCreateWindow::CreateWindow(CNavCenterWindow::res_ID, this)); - RDF_Resource top = RDF_GetResource(NULL, "NC:History", false); - navCenter->BuildHTPane ( top ); - navCenter->Show(); - } - break; - - case cmd_BookmarksWindow: - { - CNavCenterWindow* navCenter = dynamic_cast(URobustCreateWindow::CreateWindow(CNavCenterWindow::res_ID, this)); - RDF_Resource top = RDF_GetResource(NULL, "NC:Bookmarks", false); - navCenter->BuildHTPane ( top ); - navCenter->Show(); - } - break; - - case cmd_PrivAnonMode: - { - PRVCY_ToggleAnonymous(); - SetUpdateCommandStatus(true); - break; - } - - case cmd_PrivDisplayCookies: - { - NET_DisplayCookieInfoAsHTML(nil); - break; - } - - case cmd_PrivDisplaySignons: - { - SI_DisplaySignonInfoAsHTML(nil); - break; - } - - case cmd_PrivAboutPrivacy: - { - DoGetURL(PRVCY_TutorialURL()); - break; - } - - case cmd_NCOpenNewWindow: - { - HT_Resource node = reinterpret_cast(ioParam); - if ( node ) { - CNavCenterWindow* navCenter = dynamic_cast(URobustCreateWindow::CreateWindow(CNavCenterWindow::res_ID, this)); - navCenter->BuildHTPane ( node ); - navCenter->Show(); - } - } - break; - -#if defined(MOZ_MAIL_COMPOSE) || defined(MOZ_MAIL_NEWS) - case cmd_NewMailMessage: - MSG_MailDocument(NULL); - break; -#endif // MOZ_MAIL_COMPOSE || MOZ_MAIL_NEWS - - case cmd_OpenURL: - DoOpenURLDialog(); - break; - -#ifdef EDITOR - - case cmd_OpenURLEditor: - DoOpenURLDialogInEditor(); - break; - - case cmd_New_Document_Template: - { - CStr255 urlString = CPrefs::GetString(CPrefs::EditorNewDocTemplateLocation); - if ( urlString != CStr255::sEmptyString ) - { - URL_Struct* theURL = NET_CreateURLStruct(urlString, NET_DONT_RELOAD); - if (theURL) - CURLDispatcher::DispatchURL(theURL, NULL, false, true); - } - } - break; - - case cmd_New_Document_Wizard: - char* url; - if (PREF_CopyConfigString("internal_url.page_from_wizard.url", &url) == PREF_NOERROR) - { - URL_Struct* theURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - if (theURL) - CURLDispatcher::DispatchURL(theURL, NULL, false, true); - } - break; - - case cmd_NewWindowEditorIFF: - { - // get the front window so we know if an editor window is already in the front - CMediatedWindow *wp, *editwin; - CWindowIterator iterAny(WindowType_Any); - iterAny.Next(wp); - - CWindowIterator iter(WindowType_Editor); - iter.Next(editwin); - - if ( editwin && ( wp == editwin ) ) - { - // count the number of windows; stuff current editor window into editwin - // put the window we want to be frontmost into wp (reuse) - // spec says to cycle through all windows of our type so we bring the - // backmost-window to the front and push the others down in the stack - int numWindows = 1; - while ( iter.Next(wp) ) - { - numWindows++; - editwin = wp; - } - - if ( numWindows == 1 ) - editwin = NULL; // set to NULL so we create new window below - } - - // if no editor in front window bring the frontmost editor window to front - // if editor is in front select the window determined above and we're done! - if ( editwin ) - { - editwin->Show(); - editwin->Select(); - break; - } - // else continue below - } - case cmd_NewWindowEditor: - CEditorWindow::MakeEditWindow( NULL, NULL ); - break; - - case cmd_OpenFileEditor: - { - -// StandardFileReply myReply; - - static const OSType myTypes[] = { 'TEXT'}; - - UDesktop::Deactivate(); // Always bracket this - - FSSpec fileSpec; - Boolean fileSelected = SimpleOpenDlog ( 1, myTypes, &fileSpec ); - - UDesktop::Activate(); - - if (!fileSelected) return TRUE; // we handled it... we just didn't do anything! - - char* localURL = CFileMgr::GetURLFromFileSpec(fileSpec); - if (localURL == NULL) return TRUE; - - NET_cinfo *cinfo = NET_cinfo_find_type (localURL); - if (cinfo && cinfo->type && (!strcasecomp (cinfo->type, TEXT_HTML) - || !strcasecomp (cinfo->type, UNKNOWN_CONTENT_TYPE) - || !strcasecomp (cinfo->type, TEXT_PLAIN))) - { - URL_Struct * request = NET_CreateURLStruct ( localURL, NET_NORMAL_RELOAD ); - if ( request ) - CEditorWindow::MakeEditWindow( NULL, request ); - } - else - { - ErrorManager::PlainAlert( NOT_HTML ); - } - - XP_FREE(localURL); - } - break; - - case cmd_EditEditor: - CPrefsDialog::EditPrefs( CPrefsDialog::eExpandEditor, - PrefPaneID::eEditor_Main, CPrefsDialog::eIgnore); - break; - -#endif - - case cmd_Preferences: - CPrefsDialog::EditPrefs(); - break; - -#ifdef MOZ_MAIL_NEWS - case cmd_NewsGroups: - case cmd_MailNewsFolderWindow: - { - CMailNewsFolderWindow::FindAndShow(true, inCommand); - break; - } - case cmd_GetNewMail: - // If it came here, we must assume there are no mail/news windows. - // So open the inbox First. - CThreadWindow* tw = CThreadWindow::ShowInbox(cmd_GetNewMail); - break; - case cmd_Inbox: - CThreadWindow::ShowInbox(cmd_Nothing); - break; - case cmd_MailTo: - { - MSG_Mail(NULL); // Crashes now, libmsg error - } - break; -#endif // MOZ_MAIL_NEWS - - case cmd_AboutPlugins: - DoGetURL( "about:plugins" ); - break; - -#if 0 - case cmd_LaunchConference: - LaunchExternalApp(kConferenceAppSig, CONFERENCE_APP_NAME); - break; - // --ML Polaris - case cmd_LaunchCalendar: - LaunchExternalApp(kCalendarAppSig, CALENDAR_APP_NAME); - break; - case cmd_Launch3270: - Launch3270Applet(); - break; - case cmd_LaunchNetcaster: - LaunchNetcaster(); - break; -#endif - - case cmd_LaunchImportModule: - LaunchExternalApp(kImportAppSig, IMPORT_APP_NAME); - break; - - case cmd_LaunchAOLInstantMessenger: - LaunchExternalApp(kAOLInstantMessengerSig, AIM_APP_NAME); - break; - -#ifdef FORTEZZA - case cmd_FortezzaCard: - SSL_FortezzaMenu(NULL,SSL_FORTEZZA_CARD_SELECT); - break; - case cmd_FortezzaChange: - // er, excuse me, mr fortezza, but CHyperWin::Show() might return NULL.... - CHyperWin* win = GetFrontHyperWin(); - if (win) - SSL_FortezzaMenu(win->fHyperView->GetContext(),SSL_FORTEZZA_CHANGE_PERSONALITY); - break; - case cmd_FortezzaView: - CHyperWin* win = GetFrontHyperWin(); - if (win) - SSL_FortezzaMenu(win->fHyperView->GetContext(),SSL_FORTEZZA_VIEW_PERSONALITY); - break; - case cmd_FortezzaInfo: - SSL_FortezzaMenu(NULL,SSL_FORTEZZA_CARD_INFO); - break; - case cmd_FortezzaLogout: - /* sBookMarkContext */ - SSL_FortezzaMenu(NULL,SSL_FORTEZZA_LOGOUT); - break; -#endif - -#ifdef MOZ_MAIL_NEWS - // This really shouldn't be here, but since the mail/news windows are not up yet, - // it's here for testing - case cmd_MailNewsSearch: - CSearchWindowManager::ShowSearchWindow(); - break; - case cmd_MailFilters: - CFiltersWindowManager::ShowFiltersWindow(); - break; - case cmd_AddressBookWindow: - CAddressBookManager::ShowAddressBookWindow(); - break; - case cmd_NewFolder: - { - CMessageFolder folder(nil); - UFolderDialogs::ConductNewFolderDialog(folder); - break; - } - // case cmd_SearchAddresses: - // CSearchWindowManager::ShowSearchAddressesWindow(); - // break; -#endif // MOZ_MAIL_NEWS -#ifdef MOZ_TASKBAR - case cmd_ToggleTaskBar: - CTaskBarListener::ToggleTaskBarWindow(); - break; -#endif // MOZ_TASKBAR -#ifdef MOZ_OFFLINE - // Online/Offline mode - case cmd_ToggleOffline: - UOffline::ObeyToggleOfflineCommand(); - break; - - case cmd_SynchronizeForOffline: - UOffline::ObeySynchronizeCommand(); - break; -#endif // MOZ_OFFLINE - default: - { - // Spinning icon - if ( inCommand == LOGO_BUTTON || inCommand == cmd_CoBrandLogo ) - DoOpenLogoURL( inCommand ); - - else if (!CWindowMenu::ObeyWindowCommand(inCommand)) - { - ResIDT menuID = ( HiWord( -inCommand ) ); - Int16 itemNum = ( LoWord( -inCommand ) ); - if ( menuID == kHMHelpMenuID ) - { - itemNum -= sHelpMenuOrigLength; - DoHelpMenuItem( itemNum ); - } - else - bCommandHandled = LDocApplication::ObeyCommand(inCommand, ioParam); - } - break; - } - } // switch - return bCommandHandled; -} // CFrontApp::ObeyCommand - - -//----------------------------------- -void CFrontApp::DoOpenDirectoryURL( CommandT menuCommand ) -//----------------------------------- -{ -#if 0 - CStr255 urlString; - Boolean isMenuCommand = (menuCommand >= DIR_MENU_BASE); - short stringID = isMenuCommand ? DIR_MENU_BASE : DIR_BUTTON_BASE; - - char* url; - if ( PREF_CopyIndexConfigString( - isMenuCommand ? "menu.places.item" : "toolbar.places.item", - menuCommand - stringID, "url", &url) == PREF_NOERROR ) - { - DoGetURL(url); - XP_FREE(url); - } -#endif -} - -void CFrontApp::DoOpenLogoURL( CommandT menuCommand ) -{ - // Admin Kit: Handle co-brand button - char* url; - if ( menuCommand == LOGO_BUTTON && - PREF_CopyConfigString("toolbar.logo.url", &url) == PREF_NOERROR ) - { - DoGetURL(url); - XP_FREE(url); - } - else - { - StringHandle handle = GetString( LOGO_BUTTON_URL_RESID ); - CStr255 urlString = *((unsigned char**)handle); - if ( urlString != CStr255::sEmptyString ) - DoGetURL( (unsigned char*)urlString ); - } -} - -void CFrontApp::DoWindowsMenu(CommandT inCommand) -{ - Int32 index = inCommand - cmd_WINDOW_MENU_BASE; - LWindow * win; - if (fWindowsMenu.FetchItemAt(index, &win)) - win->Select(); -} - -// DoGetURL loads the given url into the frontmost window, or new one if there is no frontmost -// Provides a bottleneck for UI generated requests to load a URL -void CFrontApp::DoGetURL( const cstring & url, const char* inReferrer, const char* inTarget ) -{ - // Check for kiosk mode and bail if it's set so that the user can't manually - // go to a different URL. Note that this does NOT prevent dispatching to a different - // URL from the content. - if (CAppleEventHandler::GetKioskMode() == KioskOn) - return; - - if (CFrontApp::GetApplication()->HasProperlyStartedUp()) { - // HT may want a crack at this URL for handling ftp/aft/etc. If it doesn't want it, - // do the normal dispatch. It's ok to call this again after calling - // URDFUtilities::LaunchNode(). Both are quick. (pinkerton) - if ( !URDFUtilities::LaunchURL(url) ) { - URL_Struct* theURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - if (theURL) { - if ( inTarget ) - theURL->window_target = strdup(inTarget); - if ( inReferrer ) - theURL->referer = strdup(inReferrer); - CURLDispatcher::DispatchURL(theURL, NULL); - } - } - } -} - -//----------------------------------------------------------------------------- -// Chenge of address -// AppleEvents has moved to CAppleEventHandler.cp -// C Hull -//----------------------------------------------------------------------------- - -/*------------------------------------------------ -AppleEvent Dispach Here - In: & AppleEvent/ Evenc coming in - & ReplyEvent/ Reply event back to sender - & Descriptor/ Not sure why this was extracted, but OK. - AppleEvent/ ID The event - Out: Event Handled by the sAppleEvents entity -------------------------------------------------*/ -void CFrontApp::HandleAppleEvent( - const AppleEvent& inAppleEvent, - AppleEvent& outAEReply, - AEDesc& outResult, - long inAENumber) -{ - XP_TRACE(("Handling event %d", inAENumber)); - Try_ - { - if ( CAppleEventHandler::sAppleEventHandler == NULL ) - new CAppleEventHandler; - - ThrowIfNil_(CAppleEventHandler::sAppleEventHandler); - - CAppleEventHandler::sAppleEventHandler->HandleAppleEvent(inAppleEvent, - outAEReply, - outResult, - inAENumber); - - } - Catch_( inErr ) - {} - EndCatch_ -} - - - - -void CFrontApp::GetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc) const -{ - try - { - if (CAppleEventHandler::sAppleEventHandler == NULL) - new CAppleEventHandler; - ThrowIfNil_(CAppleEventHandler::sAppleEventHandler); - - CAppleEventHandler::sAppleEventHandler->GetAEProperty(inProperty, - inRequestedType, - outPropertyDesc); - } - catch(...) - {} -} - - - - - - -void CFrontApp::SetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc) -{ - try - { - if (CAppleEventHandler::sAppleEventHandler == NULL) - new CAppleEventHandler; - ThrowIfNil_(CAppleEventHandler::sAppleEventHandler); - - CAppleEventHandler::sAppleEventHandler->SetAEProperty(inProperty, - inRequestedType, - outPropertyDesc); - } - catch(...) - {} -} - - - - - - -//----------------------------------------------------------------------------- -// Printing -//----------------------------------------------------------------------------- - -//----------------------------------- -void CFrontApp::SetupPage() -//----------------------------------- -{ - THPrint hPrintRec; - Boolean havePrinter; - - hPrintRec = CPrefs::GetPrintRecord(); - - havePrinter = hPrintRec != 0; - - if (havePrinter) - { - UPrintingMgr::ValidatePrintRecord( hPrintRec ); - if ( UPrintingMgr::OpenPrinter() ) - { - UDesktop::Deactivate(); - UHTMLPrinting::OpenPageSetup( hPrintRec ); - UDesktop::Activate(); - - UPrintingMgr::ClosePrinter(); - } else - havePrinter = false; - } - if ( !havePrinter ) - FE_Alert( NULL, GetPString ( NO_PRINTER_RESID ) ); -} // CFrontApp::SetupPage - - -//----------------------------------------------------------------------------- -// Menubar management -//----------------------------------------------------------------------------- -void CFrontApp::SetMenubar( ResIDT mbar, Boolean inUpdateNow ) -{ - fWantedMbar = mbar; - - if (inUpdateNow) { - UpdateMenus(); - } -} - -void CFrontApp::InstallMenus() -{ - // Menu creation must go here, because until now, the menu bar has not - // been created. (see LApplication::Run()) - CHistoryMenu* historyMenu = new CHistoryMenu(cHistoryMenuID); - CWindowMenu* windowMenu = new CWindowMenu(cWindowMenuID); - // create CNSMenuBarManager - new CNSMenuBarManager(CWindowMediator::GetWindowMediator()); - LMenuBar::GetCurrentMenuBar()->InstallMenu(historyMenu, InstallMenu_AtEnd); - CBookmarksAttachment::InstallMenus(); - LMenuBar::GetCurrentMenuBar()->InstallMenu(windowMenu, InstallMenu_AtEnd); - CWindowMediator::GetWindowMediator()->AddListener(windowMenu); - - // Admin Kit friendly Help and Places menus: labels and URLs are - // initialized in config.js and may be overridden by config file. - MenuHandle balloonMenuH; - HMGetHelpMenuHandle( &balloonMenuH ); - if ( balloonMenuH ) - { - sHelpMenuOrigLength = CountMItems(balloonMenuH); - - sHelpMenuItemCount = BuildConfigurableMenu( balloonMenuH, - "menu.help.item", HELP_URLS_MENU_STRINGS ); - } - - /* NOTE: Places menu is installed in CBookmarksAttachment::InstallMenus(), - which calls back to BuildConfigurableMenu. */ -} - -int CFrontApp::BuildConfigurableMenu(MenuHandle menu, const char* xp_name, short stringsID) -{ - CStr255 entry; - short i; - - // Append configurable items first - for (i = 1; i <= 25; i++) { - char* label; - if ( PREF_CopyIndexConfigString(xp_name, i - 1, "label", &label) == PREF_NOERROR ) - { - entry = label; - XP_FREE(label); - - if (entry.IsEmpty()) // blank entry marks end of menu - break; - - StripChar(entry, '&'); // strip ampersands from label - - AppendMenu(menu, entry); - } - else - break; - } - - // Then append fixed items, if any (i.e. About Netscape) - if (stringsID > 0) { - CStringListRsrc menuStrings( stringsID ); - for (short j = 1; j < menuStrings.CountStrings() + 1; j++) { - menuStrings.GetString( j, entry ); - AppendMenu(menu, entry); - } - } - - return i - 1; -} - -void CFrontApp::DoHelpMenuItem( short itemNum ) -{ - // use configurable URL if defined, else use built-in URL - char* url; - if ( itemNum <= sHelpMenuItemCount && PREF_CopyIndexConfigString("menu.help.item", - itemNum - 1, "url", &url) == PREF_NOERROR ) - { - DoGetURL( url ); - XP_FREE(url); - } - else { - CStr255 urlString; - - GetIndString( urlString, HELP_URLS_RESID, itemNum - sHelpMenuItemCount ); - - if ( urlString != CStr255::sEmptyString ) - DoGetURL( (unsigned char*)urlString ); - } -} - - -//----------------------------------- -void CFrontApp::EventKeyDown( const EventRecord& inMacEvent ) -// ¥ we override this to patch Mercutio in -//----------------------------------- -{ - CommandT keyCommand = cmd_Nothing; - Int32 menuChoice = 0; - // Remap function keys. Is there a better way? jrm 97/04/03 - switch ((inMacEvent.message & keyCodeMask) >> 8) - { - case vkey_F1: - keyCommand = cmd_Undo; - break; - case vkey_F2: - keyCommand = cmd_Cut; - break; - case vkey_F3: - keyCommand = cmd_Copy; - break; - case vkey_F4: - keyCommand = cmd_Paste; - break; - default: - // Modal dialogs might have OK/cancel buttons, and handle their own keys. - // So only convert to command when front window is not modal - if ((inMacEvent.modifiers & cmdKey) && (inMacEvent.message & charCodeMask) == '.') - { - if (!IsFrontWindowModal()) - keyCommand = cmd_Stop; - } - // Check if the keystroke is a Menu Equivalent - else if (LMenuBar::GetCurrentMenuBar()->CouldBeKeyCommand(inMacEvent)) - { - CTargetedUpdateMenuRegistry::SetCommands(CFrontApp::GetCommandsToUpdateBeforeSelectingMenu()); - CTargetedUpdateMenuRegistry::UpdateMenus(); - - // MacOS8 can do the weird key combos for us w/out Mercutio. - SInt32 unused; - LAppearanceMBAR* bar = dynamic_cast(LMenuBar::GetCurrentMenuBar()); - if ( bar ) - keyCommand = bar->FindKeyCommand ( inMacEvent, unused ); - -#if 0 - menuChoice = MDEF_MenuKey( - inMacEvent.message, - inMacEvent.modifiers, ::GetMenu( 666 ) ); - - // If menuChoice is 0, then a modifer key may have been held down that - // didn't map to a known command-key equivalent (e.g. cmd-opt-n). - // In this case, we will try again with just the cmdKey. Recall that - // this is what the Finder does (with cmd-n for New Folder, for instance). - // It makes especially good sense when you think about the fact that since - // the command and option keys are close, users sometimes accidently hit both. - // Without this "fix", cmd_Nothing would be returned. - if (menuChoice == 0) - { - EventModifiers modifiers = cmdKey; - - menuChoice = MDEF_MenuKey(inMacEvent.message, modifiers, ::GetMenu( 666 )); - } - - if ( HiWord( menuChoice ) != 0 ) - keyCommand = LMenuBar::GetCurrentMenuBar()->FindCommand( - HiWord(menuChoice), - LoWord(menuChoice)); -#endif - } - } - SignalIf_(LCommander::GetTarget() == nil); - - // Don't allow quit events if it isn't safe to quit but remember the request - if ((keyCommand == cmd_Quit) && !fSafeToQuit) - { - keyCommand = cmd_Nothing; - fUserWantsToQuit = true; - } - if (keyCommand != cmd_Nothing) - { - LCommander::SetUpdateCommandStatus( true ); - LCommander::GetTarget()->ProcessCommand(keyCommand, &menuChoice); - ::HiliteMenu( 0 ); - } - else - LCommander::GetTarget()->ProcessKeyPress(inMacEvent); -} // CFrontApp::EventKeyDown - -//----------------------------------------------------------------------------- -// About Box & Splash Screen -//----------------------------------------------------------------------------- - - -void CFrontApp::ShowAboutBox() -{ - DoGetURL( "about:" ); -} - -void* FE_AboutData( const char* which, char** data_ret, int32* length_ret, -char** content_type_ret ) -{ - char* ss = NULL; // security string, of course - Handle data = NULL; - - try { - // Nuke the ismap portion so we can hide the url - const char* ismap = strrchr( (char*)which, '?' ); - CStr255 dataName = which ? which : ""; - if ( ismap ) - { - ismap++; - for ( int i = 1; i <= dataName.Length(); i++ ) - if (dataName[i] == '?') - { - dataName[0] = i - 1; - break; - } - } - Boolean doSprintf = FALSE; - - /* - about: 128 text of about box, includes logo - about:logo 129 picture for about box - about:plugins 130 list of installed plug-ins - about:authors 131 text for authors box - about:authors? 132 text for team box - about:teamlogo 133 picture for team box - about:mailintro 134 - about:rsalogo 135 picture for rsa logo - about:mozilla 136 mozilla easter egg - about:hype 137 hype sound - about:license 2890 license text - */ - if ( dataName == "" ) - { - data = ::GetResource( 'TEXT', ABOUT_ABOUTPAGE_TEXT ); - *content_type_ret = TEXT_MDL; - doSprintf = true; - } - else if ( dataName == "logo" ) - { - data = ::GetResource ( 'Tang', ABOUT_BIGLOGO_TANG ); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "plugins" ) - { - data = ::GetResource ( 'TEXT', ABOUT_PLUGINS_TEXT ); - *content_type_ret = TEXT_MDL; - } - else if ( dataName == "authors" ) - { - data = ::GetResource ( 'TEXT', ABOUT_AUTHORS_TEXT ); - *content_type_ret = TEXT_MDL; - } - else if ( dataName == "mailintro" ) - { - data = ::GetResource( 'TEXT', ABOUT_MAIL_TEXT ); - *content_type_ret = TEXT_MDL; - } - else if ( dataName == "rsalogo" ) - { - data = ::GetResource ('Tang', ABOUT_RSALOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "javalogo" ) - { - data = ::GetResource ('Tang', ABOUT_JAVALOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - else if (dataName == "qtlogo") - { - data = ::GetResource ('Tang', ABOUT_QTLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "insologo") - { - data = ::GetResource ('Tang', ABOUT_INSOLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - else if (dataName == "litronic") - { - data = ::GetResource ('Tang', ABOUT_LITRONIC_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "mclogo") - { - data = ::GetResource ('Tang', ABOUT_MCLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "mmlogo") - { - data = ::GetResource ('Tang', ABOUT_MMLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "ncclogo") - { - data = ::GetResource ('Tang', ABOUT_NCCLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "odilogo") - { - data = ::GetResource ('Tang', ABOUT_ODILOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "symlogo") - { - data = ::GetResource ('Tang', ABOUT_SYMLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "tdlogo") - { - data = ::GetResource ('Tang', ABOUT_TDLOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "visilogo") - { - data = ::GetResource ('Tang', ABOUT_VISILOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "visilogo") - { - data = ::GetResource ('Tang', ABOUT_VISILOGO_TANG); - *content_type_ret = IMAGE_GIF; - } - - else if (dataName == "coslogo") - { - data = ::GetResource ('Tang', ABOUT_COSLOGO_TANG); - *content_type_ret = IMAGE_JPG; - } - - - -#ifdef FORTEZZA - else if (dataName == "litronic") - { - data = ::GetResource ('Tang', ABOUT_LITRONIC_TANG); - *content_type_ret = IMAGE_GIF; - } -#endif - else if (dataName == "mozilla") - { - data = ::GetResource ( 'TEXT', ABOUT_MOZILLA_TEXT ); - *content_type_ret = TEXT_MDL; - } - else if (dataName == "hype") - { - data = ::GetResource ( 'Tang', ABOUT_HYPE_TANG ); - *content_type_ret = AUDIO_BASIC; - } - else if ( dataName == "license" ) - { - data = ::GetResource ('TEXT', ABOUT_LICENSE); - *content_type_ret = TEXT_PLAIN; - } - else if ( dataName == "custom" ) // optional resource added by EKit - { - data = ::GetResource ( 'TEXT', ABOUT_CUSTOM_TEXT ); - *content_type_ret = TEXT_PLAIN; - } - #ifdef EDITOR - else if ( dataName == "editfilenew" ) - { - data = ::GetResource ( 'TEXT', ABOUT_NEW_DOCUMENT ); - *content_type_ret = TEXT_HTML; - } - #endif - else if ( dataName == "flamer" ) - { - data = ::GetResource ('Tang', ABOUT_MOZILLA_FLAME); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "history.gif" ) // NavCenter GIFs - { - data = ::GetResource ('Tang', ABOUT_HISTORYGIF_TANG); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "personal.gif" ) - { - data = ::GetResource ('Tang', ABOUT_PERSONALGIF_TANG); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "search.gif" ) - { - data = ::GetResource ('Tang', ABOUT_SEARCHGIF_TANG); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "sitemap.gif" ) - { - data = ::GetResource ('Tang', ABOUT_SITEMAPGIF_TANG); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "file.gif" ) - { - data = ::GetResource ('Tang', ABOUT_FILESGIF_TANG); - *content_type_ret = IMAGE_GIF; - } - else if ( dataName == "guide.gif" ) - { - data = ::GetResource ('Tang', ABOUT_GUIDEGIF_TANG); - *content_type_ret = IMAGE_GIF; - } - else - { - data = ::GetResource ('TEXT', ABOUT_BLANK_TEXT); - *content_type_ret = TEXT_MDL; - } - - // prepare the arguments and return - if ( data ) - { - UInt32 dataSize; - - ::DetachResource( data ); - ::HNoPurge( data ); - ::MoveHHi( data ); - - dataSize = GetHandleSize(data); - - if ( doSprintf ) - { - // Security stuff ( 3 strings -> 1 ). |s1| and |s2| may be NULL if we are running with - // Mozilla (no security). PR_smprintf() won't die unless |s0| is null, so we check for that. - char* s0 = (char *)GetCString(SECURITY_LEVEL_RESID ); - char* s1 = SECNAV_SecurityVersion( PR_TRUE ); - char* s2 = SECNAV_SSLCapabilities(); - ThrowIfNil_(s0); - CAutoPtrXP secStr = PR_smprintf( s0, s1, s2 ); - ThrowIfNil_(secStr.get()); - - // Version - CStr255 vers; - ::GetIndString( vers, ID_STRINGS, APPVERSION_STRING_INDEX ); - - - // Assure that data terminates with nul by appending the NULL string - { - dataSize += 1; - SetHandleSize( data, dataSize); - OSErr err = MemError(); - ThrowIfOSErr_(err); - (*data)[dataSize-1] = '\0'; - } - - // Create the final string - ::HLock(data); - CAutoPtrXP finalStr = PR_smprintf((char*)*data, (char*)vers, (char*)vers, (char*)secStr.get()); - ::HUnlock(data); - - ThrowIfNil_(finalStr.get()); - - // Make handle out of final string - - dataSize = strlen(finalStr.get()) + 1; - Handle finalHandle = ::NewHandle( dataSize ); - ThrowIfNil_(finalHandle); - ::BlockMoveData( finalStr.get(), *finalHandle, dataSize ); - // Exchange - ::DisposeHandle(data); - data = finalHandle; - } - - *data_ret = *data; - *length_ret = dataSize; - } - else - { - XP_ASSERT(0); - *data_ret = NULL; - *length_ret = 0; - *content_type_ret = NULL; - } - } - catch(...) - { - Assert_(false); - if (data != NULL) - { - ::DisposeHandle(data); - data = NULL; - } - - if (ss != NULL) - XP_FREE(ss); - - *data_ret = NULL; - *length_ret = 0; - *content_type_ret = NULL; - } - - if (data) - ::HLock(data); - - return data; -} - -void FE_FreeAboutData( void* data, const char* /*which*/ ) -{ - if ( !data ) - return; - Handle h = (Handle)data; - DisposeHandle( h ); -} - - -// =========================================================================== -// ¥ Main Program -// =========================================================================== - -XP_BEGIN_PROTOS -OSErr InitLibraryManager(size_t poolsize, int zoneType, int memType); -void CleanupLibraryManager(void); -XP_END_PROTOS - -extern void Memory_DoneWithMemory(); -extern UInt8 MemoryCacheFlusher(size_t size); -extern void PreAllocationHook(void); - -const Size cSystemHeapFudgeFactor = 96 * 1024; - -void main( void ) -{ - SetDebugThrow_(debugAction_Nothing); -#ifdef DEBUG - //SetDebugSignal_(debugAction_SourceDebugger); // SysBreak broken in MetroNub 1.3.2 - SetDebugSignal_(debugAction_LowLevelDebugger); -#else - SetDebugSignal_(debugAction_Nothing); -#endif - CFrontApp* app = NULL; - - // System Heap check hack - Handle sysHandle = ::NewHandleSys(cSystemHeapFudgeFactor); - if (sysHandle) - ::DisposeHandle(sysHandle); - Size maxBlockSize = ::FreeMemSys(); - if (maxBlockSize < cSystemHeapFudgeFactor) - ::ExitToShell(); - - // Initialize the tracing package if we're debugging -#ifdef DEBUG - XP_TraceInit(); -#endif - - // pkc -- instantiate main thread object. As side effect, NSPR will create new - // subheap if this is the first allocation call, ie, if no static initializers - // did an allocation. - - //----------------------------------- - // NOTE: SetApplLimit and MaxApplZone are called from NSPR! - // in MacintoshInitializeMemory() - //----------------------------------- - - // ¥Êinitialize QuickDraw - UQDGlobals::InitializeToolbox( &qd ); - - // Preference library needs to be initialized at this point because - // the msglib thread constructor is making a prefapi call - PREF_Init(NULL); - -#if __MC68K__ - { - // Bug #58086: this hack locks the "Enable Java" preference `off' and - // must be removed when Java works for 68K. - static const char* inline_javascript_text ="lockPref(\"security.enable_java\", false)"; - PREF_EvaluateJSBuffer(inline_javascript_text, strlen(inline_javascript_text)); - } -#else - -#if !defined (OJI) - // ¥ double check to make sure we have Java installed - DisableJavaIfNotAvailable(); -#endif - -#endif - - // NSPR/MOCHA Initialization - - mozilla_thread = PR_CurrentThread(); - PR_SetThreadGCAble(); - - // ¥ initialize the memory manager - // it's important that this is done VERY early - Memory_InitializeMemory(); - - // ¥Êinit environment and do sanity checking. Will exitToShell if conditions not met. - ConfirmWeWillRun(); - - RNG_RNGInit(); // This needs to be called before the main loop - ProcessSerialNumber psn; - if (NetscapeIsRunning(psn)) - { - ErrorManager::PlainAlert(NO_TWO_NETSCAPES_RESID); - SetFrontProcess(&psn); - } - else - { -#if defined(PROFILE) || defined (PROFILE_LOCALLY) -#ifndef DONT_DO_MOZILLA_PROFILE - StartProfiling(); -#endif -#endif - - // NET_ToggleTrace(); - - app = new CFrontApp; -#if defined(QAP_BUILD) - QAP_AssistHook (kQAPAppToForeground, 0, NULL, 0, 0); -#endif - app->Run(); - -#if defined(QAP_BUILD) - QAP_AssistHook (kQAPAppToBackground, 0, NULL, 0, 0); -#endif - - delete app; -#if defined(PROFILE) || defined (PROFILE_LOCALLY) -#ifndef DONT_DO_MOZILLA_PROFILE - StopProfiling(); -#endif -#endif - } - - Memory_DoneWithMemory(); - - // do this at the very end, god knows who's fetching prefs during cleanup - PREF_Cleanup(); -} - -static void InitDebugging() -{ - // ¥Êdebugging Setup -} - -static void ConfirmWeWillRun() -{ - UEnvironment::InitEnvironment(); - - AssertAppearanceLib(); // make sure AppearanceLib is installed - AssertRequiredGuts(); -} - -//----------------------------------- -static Boolean NetscapeIsRunning(ProcessSerialNumber& psn) -// True if other versions of Netscape are running -//----------------------------------- -{ - OSErr err; - ProcessInfoRec info; - ProcessSerialNumber myPsn; - ::GetCurrentProcess(&myPsn); - - psn.highLongOfPSN = 0; - psn.lowLongOfPSN = kNoProcess; - do - { - err = GetNextProcess(&psn); - if( err == noErr ) - { - - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = NULL; - info.processAppSpec = NULL; - - err= GetProcessInformation(&psn, &info); - } - if ((err == noErr) && - ((psn.highLongOfPSN != myPsn.highLongOfPSN) || (psn.lowLongOfPSN != myPsn.lowLongOfPSN)) && - (info.processSignature == emSignature || info.processSignature == 'MOSM')) - return TRUE; - } while (err == noErr); - return FALSE; -} - -//----------------------------------- -Boolean CFrontApp::AttemptQuitSelf(long /*inSaveOption*/) -//----------------------------------- -{ -#ifdef MOZ_OFFLINE - XP_Bool value; - PREF_GetBoolPref("offline.prompt_synch_on_exit", &value); - if (value) - { - // Put up dialog - StDialogHandler aHandler(20004, NULL); - LWindow* dialog = aHandler.GetDialog(); - - // Get the window title to use later in the progress dialog. - Str255 windowTitle; - dialog->GetDescriptor(windowTitle); - - // Run the dialog - MessageT message; - do - { - message = aHandler.DoDialog(); - - } while ((message != 'Yes ') && (message != 'No ') && (message != msg_Cancel)); - - // Use the result - if (message == 'Yes ') - UOffline::ObeySynchronizeCommand(UOffline::syncModal); - - if (message == msg_Cancel) - return false; - } -#endif // MOZ_OFFLINE - return true; -} - -//----------------------------------- -void CFrontApp::DoQuit( - Int32 inSaveOption) -//----------------------------------- -{ - LDocApplication::DoQuit(inSaveOption); - - if (mState == programState_Quitting) - CDeferredTaskManager::DoQuit(inSaveOption); -// if (mState == programState_Quitting) -// LTSMSupport::DoQuit(inSaveOption); -} - -//----------------------------------- -void CFrontApp::DispatchEvent( - const EventRecord& inMacEvent) -// From IM-Text 7-22 -//----------------------------------- -{ - - try - { - try - { - if(! LTSMSupport::TSMEvent(inMacEvent)) - LDocApplication::DispatchEvent(inMacEvent); - } - catch (int err) // some people do throw-em! Also "throw memFullErr" will come here. - { - throw (OSErr)err; - } - } - // Here we catch anything thrown from anywhere. (OSErr and ExceptionCode). - // STR# 7098 is reserved for just this purpose. See ns/cmd/macfe/restext/macfe.r - // These alerts all use ALRT_ErrorOccurred. See ns/cmd/macfe/rsrc/MacDialogs.rsrc. - // The value of ALRT_ErrorOccurred is in reserr.h - // The alert says - // "Your last command could not be completed because " - // "(Error code )" - catch (OSErr err) - { - DisplayErrorDialog ( err ); - } - catch (ExceptionCode err) - { - DisplayExceptionCodeDialog ( err ); - } -} -// --------------------------------------------------------------------------- -// ¥ AdjustCursor -// From IM-Text 7-22 -// --------------------------------------------------------------------------- -void CFrontApp::AdjustCursor( const EventRecord& inMacEvent ) -{ -#if defined (JAVA) - if ( UsingCustomAWTFrameCursor() ) - return; -#endif /* defined (JAVA) */ - // Find out where the mouse is - WindowPtr macWindowP; - Point globalMouse = inMacEvent.where; - Int16 thePart = ::FindWindow( globalMouse, &macWindowP ); - - Boolean useArrow = TRUE; // Assume cursor will be the Arrow - LWindow* theWindow = NULL; - - if ( macWindowP ) - { // Mouse is inside a Window - theWindow = LWindow::FetchWindowObject( macWindowP ); - } - if (( theWindow ) && - (theWindow->IsActive() || theWindow->HasAttribute(windAttr_GetSelectClick)) && // adjust inactive window if one click away - mjc - theWindow->IsEnabled() ) - { - // Mouse is inside an active and enabled - // PowerPlant Window. Let the Window - // adjust the cursor shape. - - // Get mouse location in Port coords - Point portMouse = globalMouse; - theWindow->GlobalToPortPoint( portMouse ); - - theWindow->AdjustCursor( portMouse, inMacEvent ); - useArrow = FALSE; - } - if ( useArrow ) - { - // Window didn't set the cursor - // Default cursor is the arrow - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - } - - // - // Rather than trying to calculate an accurate mouse region, - // we define a region that contains just the one pixel where - // the mouse is located. This is quick, and handles the common - // case where this application is in the foreground but the user - // isn't doing anything. However, any mouse movement will generate - // a mouse-moved event. - // - ::SetRectRgn( mMouseRgnH, globalMouse.h, globalMouse.v, - globalMouse.h + 1, globalMouse.v + 1 ); -} - - - -void -CFrontApp::EventSuspend (const EventRecord &inMacEvent) -{ - CSuspenderResumer::Suspend(); -#ifdef MOZ_MAIL_NEWS - CCheckMailContext::SuspendResume(); // Stop all current notification of mail -#endif // MOZ_MAIL_NEWS - CPluginView::BroadcastPluginEvent(inMacEvent); // Tell plug-ins about the suspend - LDocApplication::EventSuspend(inMacEvent); // Do the suspend - -#if defined(QAP_BUILD) - QAP_AssistHook (kQAPAppToBackground, 0, NULL, 0, 0); -#endif - -#ifdef DAVIDM_SPEED2 - SetSleepTime(4); // be more friendly in the background -#endif - -} - -void -CFrontApp::EventResume(const EventRecord &inMacEvent) -{ - CSuspenderResumer::Resume(); - LDocApplication::EventResume(inMacEvent); // Do the resume - CPluginView::BroadcastPluginEvent(inMacEvent); // Tell plug-ins about the resume -#ifdef MOZ_MAIL_NEWS - CCheckMailContext::SuspendResume(); // Reset mail notification -#endif // MOZ_MAIL_NEWS - CInternetConfigInterface::ResumeEvent(); // check is InternetConfig changed - -#if defined(QAP_BUILD) - QAP_AssistHook (kQAPAppToForeground, 0, NULL, 0, 0); -#endif - -#ifdef DAVIDM_SPEED2 - SetSleepTime(1); // let's go faster -#endif -} - - -void -CFrontApp::EventKeyUp(const EventRecord &inMacEvent) -{ - // - // Pass key ups down to the target if itÕs a plug-in. The static variable - // sPluginTarget is maintained by CPluginViews when they become or are no - // longer the target. (We know calling ProcessKeyPress for a key up is OK - // because CPluginView overrides it.) - // - CPluginView* pluginTarget = CPluginView::sPluginTarget; - if (pluginTarget != NULL && pluginTarget == sTarget) - pluginTarget->ProcessKeyPress(inMacEvent); - else - { - /* if it's a CKeyUpReceiver, send the key up. We used to send keyups to - * targets if a browser view was on duty, which had two disadvantages: it required - * any potential targets in a browser view to handle a key up, and sometimes - * the commander chain would be incorrect so key ups were sent to a target in a - * view that was not on duty. - */ - if (dynamic_cast(sTarget)) - sTarget->ProcessKeyPress(inMacEvent); - /* - // Pass key ups down to the target if it has a super commander which is - // a browser view. Key up events must be sent to mocha. 1997-02-24 mjc - if (CBrowserView::sOnDutyBrowserView != NULL) - sTarget->ProcessKeyPress(inMacEvent); - */ - } -} - - -// A C interface to ProcessNextEvent, which needs to be called when waiting for -// the .jsc file to load at startup -extern "C" { -void FEU_StayingAlive(); -} - - -void FEU_StayingAlive() -{ - CFrontApp::GetApplication()->ProcessNextEvent(); -} - -void -CFrontApp::ProcessNextEvent() -{ -#ifdef PROFILE -#ifdef PROFILE_ON_CAPSLOCK - if (IsThisKeyDown(0x39)) // caps lock - ProfileStart(); - else - ProfileStop(); -#endif // PROFILE_ON_CAPSLOCK -#endif // PROFILE - -#ifdef DAVIDM_SPEED2 - static UInt32 sNextWNETicks = 0; - const UInt32 kWNETicksInterval = 4; -#endif - - try - { - // Handle all pending NSPR events - PR_ProcessPendingEvents(mozilla_event_queue); - } - catch (OSErr err) - { - DisplayErrorDialog ( err ); - } - catch (ExceptionCode err) - { - DisplayExceptionCodeDialog ( err ); - } - - // The block surrounded by *** ... from LApplication::ProcessNextEvent() *** - // is identical to LApplication::ProcessNextEvent with one exception: - // the EventRecord is declared static in order to persist across calls - // to ProcessNextEvent to prevent dangling references to the event - // recorded by CApplicationEventAttachment (read the usage notes for - // CApplicationEventAttachment). - - // *** Begin block from LApplication::ProcessNextEvent() *** - - static EventRecord macEvent; - Boolean haveUserEvent = true; // so we call WNE every time in the background - - // When on duty (application is in the foreground), adjust the - // cursor shape before waiting for the next event. Except for the - // very first time, this is the same as adjusting the cursor - // after every event. - - if (IsOnDuty()) { - - // Plug-ins and Java need key up events, which are masked by default - // (the event mask lomem is set to everyEvent - keyUp). To ensure - // that itÕs always set to mask out nothing, reset it here every time - // before we call WaitNextEvent. - // - - SetEventMask(everyEvent); - - // Calling OSEventAvail with a zero event mask will always - // pass back a null event. However, it fills the EventRecord - // with the information we need to set the cursor shape-- - // the mouse location in global coordinates and the state - // of the modifier keys. - - haveUserEvent = ::OSEventAvail(everyEvent, &macEvent); - AdjustCursor(macEvent); - } - -#ifdef DAVIDM_SPEED2 - - Boolean doWNE = haveUserEvent || ::LMGetTicks() > sNextWNETicks || NET_PollSockets(); - - SetUpdateCommandStatus(false); - - if ( doWNE ) - { -#endif // DAVIDM_SPEED2 - - // Retrieve the next event. Context switch could happen here. - -#ifdef PROFILE -#ifndef PROFILE_WAITNEXTEVENT - ProfileSuspend(); -#endif // PROFILE_WAITNEXTEVENT -#endif // PROFILE - - Boolean gotEvent = ::WaitNextEvent(everyEvent, &macEvent, mSleepTime, mMouseRgnH); - -#ifdef PROFILE -#ifndef PROFILE_WAITNEXTEVENT - ProfileResume(); -#endif // PROFILE_WAITNEXTEVENT -#endif // PROFILE - - // Let Attachments process the event. Continue with normal - // event dispatching unless suppressed by an Attachment. - - if (LAttachable::ExecuteAttachments(msg_Event, &macEvent)) { - if (gotEvent) { - DispatchEvent(macEvent); - } else { - UseIdleTime(macEvent); - } - } - -#ifdef DAVIDM_SPEED2 - sNextWNETicks = ::LMGetTicks() + kWNETicksInterval; - } -#endif // DAVIDM_SPEED2 - - LPeriodical::DevoteTimeToRepeaters(macEvent); - - // Update status of menu items - if (IsOnDuty() && GetUpdateCommandStatus()) { - UpdateMenus(); - } - - // *** End block from LApplication::ProcessNextEvent() *** -} - - -void CFrontApp::DoOpenURLDialog(void) -{ -#ifdef BUILD_NSL_SUPPORT - if ( NSLStandardLibraryPresent() ) // if the NSL dialog shared lib is available use it! - { - char* returnedURL = NULL; - Str255 serviceList; - - ::GetIndString( serviceList, kNSLGetURLRequestStringID, 1 ); - p2cstr( serviceList ); - - if ( NSLStandardGetURL( NULL, (char*)serviceList, true, &returnedURL ) ) - { - // ok the user clicked ok and has returned a url. Use it and dispose... - DoGetURL(returnedURL); - ::DisposePtr(returnedURL); - } - } - else // otherwise just do what we used to and make the user type it in - { -#endif - StBlockingDialogHandler theHandler(liLoadItemWind, this); - LWindow* theDialog = theHandler.GetDialog(); - LEditField* theEdit = (LEditField*)theDialog->FindPaneByID('edit'); - Assert_(theEdit != NULL); - theDialog->SetLatentSub(theEdit); - theDialog->Show(); - - MessageT theMessage = msg_Nothing; - while ((theMessage != msg_Cancel) && (theMessage != msg_OK)) - theMessage = theHandler.DoDialog(); - - if (theMessage == msg_OK) - { - cstring curl; - CStr255 purl; - theEdit->GetDescriptor(purl); - CleanUpLocationString (purl); - curl = (unsigned char*)purl; - DoGetURL(curl); - } -#ifdef BUILD_NSL_SUPPORT - } -#endif -} - - -#ifdef EDITOR -void CFrontApp::DoOpenURLDialogInEditor(void) -{ - StBlockingDialogHandler theHandler(liLoadItemWind, this); - LWindow* theDialog = theHandler.GetDialog(); - LEditField* theEdit = (LEditField*)theDialog->FindPaneByID('edit'); - Assert_(theEdit != NULL); - theDialog->SetLatentSub(theEdit); - theDialog->Show(); - - MessageT theMessage = msg_Nothing; - while ((theMessage != msg_Cancel) && (theMessage != msg_OK)) - theMessage = theHandler.DoDialog(); - - if (theMessage == msg_OK) - { - cstring curl; - CStr255 purl; - // we really should try to do better parsing here - theEdit->GetDescriptor( purl ); - CleanUpLocationString( purl ); - curl = (unsigned char*)purl; - - URL_Struct* theURL = NET_CreateURLStruct( curl, NET_DONT_RELOAD ); - if ( theURL ) - CEditorWindow::MakeEditWindow( NULL, theURL ); - } -} -#endif // EDITOR - - -void CFrontApp::ShowSplashScreen() -{ - // Register the splash screen first so that we can show it. - RegisterClass_(CSplashScreen); - RegisterClass_(CResPicture); - - mSplashScreen = (CSplashScreen*)LWindow::CreateWindow(2891, this); - mSplashScreen->Show(); - mSplashScreen->UpdatePort(); -} - -void CFrontApp::DestroySplashScreen() -{ - delete mSplashScreen; - mSplashScreen = NULL; -} - -void CFrontApp::SplashProgress(CStr255 inMessage) -{ - if (sApplication->mSplashScreen != NULL) - sApplication->mSplashScreen->SetDescriptor(inMessage); -} - -//----------------------------------- -void CFrontApp::ListenToMessage(MessageT inMessage, void * ioParam) -//----------------------------------- -{ - switch (inMessage) - { -#ifdef MOZ_MAIL_NEWS - case cmd_GetNewMail: - case cmd_NewsGroups: - case cmd_MailNewsFolderWindow: -#endif // MOZ_MAIL_NEWS -#ifdef EDITOR - case cmd_NewWindowEditorIFF: -// case cmd_NewMailMessage: -#endif // EDITOR -#ifdef MOZ_MAIL_NEWS - case cmd_ToggleOffline: -#endif // MOZ_MAIL_NEWS - case cmd_BrowserWindow: - ObeyCommand(inMessage); - break; - case msg_GrowZone: - MemoryIsLow(); - // 1998.01.12 pchen -- replicate fix for bug #85275 - // We don't know how much memory was freed, so just set bytes freed to 0 - *((Int32 *)ioParam) = 0; - break; - default: - break; - } -} - -void CFrontApp::LaunchExternalApp(OSType inAppSig, ResIDT inAppNameStringResourceID) -{ - Assert_(inAppNameStringResourceID); - - FSSpec appSpec; - OSErr err = CFileMgr::FindApplication(inAppSig, appSpec); - CStr255 theAppName(::GetCString(inAppNameStringResourceID)); - CStr255 theMessage; - - if (err == noErr) - { - ProcessSerialNumber psn; - err = UProcessUtils::LaunchApplication( - appSpec, launchContinue + launchNoFileFlags, psn); - } - - switch (err) - { - case noErr: - break; - - case memFullErr: - case memFragErr: - theMessage = ::GetCString(MEMORY_ERROR_LAUNCH); - ::StringParamText(theMessage, theAppName); - ErrorManager::PlainAlert(theMessage); - break; - - case fnfErr: - theMessage = ::GetCString(FNF_ERROR_LAUNCH); - ::StringParamText(theMessage, theAppName); - ErrorManager::PlainAlert(theMessage); - break; - - default: - theMessage = ::GetCString(MISC_ERROR_LAUNCH); - ::StringParamText(theMessage, theAppName); - ErrorManager::PlainAlert(theMessage); - break; - } -} - -#if MOZ_3270_APPLET - -// Tries to find local file 3270/HE3270EN.HTM -Boolean CFrontApp::Find3270Applet(FSSpec& tn3270File) -{ - Boolean found = false; - FSSpec appFolder = CPrefs::GetFilePrototype( CPrefs::NetscapeFolder ); - - CStr255 folderName; - ::GetIndString( folderName, 300, ibm3270Folder ); - - if ( CFileMgr::FindWFolderInFolder(appFolder.vRefNum, appFolder.parID, - folderName, &tn3270File.vRefNum, &tn3270File.parID) == noErr ) - { - ::GetIndString( tn3270File.name, 300, ibm3270File ); - - found = CFileMgr::FileExists(tn3270File); - } - return found; -} - -void CFrontApp::Launch3270Applet() -{ - Boolean ok = false; - FSSpec tn3270File; - if ( Find3270Applet(tn3270File) ) - { - char* url = CFileMgr::GetURLFromFileSpec(tn3270File); - if (url) { - // Opens the URL in a new window (copied from DoGetURL) - // !! winfe opens a window with no toolbars, if we care. - URL_Struct* theURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - if (FE_MakeNewWindow(NULL, theURL, NULL, NULL) != NULL) - ok = true; - free(url); - } - } - if (!ok) { - ErrorManager::PlainAlert(ERROR_LAUNCH_IBM3270); - } -} -#endif /* MOZ_3270_APPLET */ - -FSSpec CFrontApp::CreateAccountSetupSpec() -{ - FSSpec asw; - - asw = CPrefs::GetFilePrototype( CPrefs::NetscapeFolder ); - ::GetIndString( asw.name, 300, aswName ); - return asw; -} - -Boolean CFrontApp::LaunchAccountSetup() -{ - FSSpec tmp = CreateAccountSetupSpec(); - - LFile aswFile( tmp ); - Handle alias; - OSErr err; - FSSpec startAswFile; - Boolean wasChanged; - -#ifdef DEBUG - try - { -#endif - - aswFile.OpenResourceFork( fsRdPerm ); - -#ifdef DEBUG - } - catch ( ... ) - { - StandardFileReply reply; - AliasHandle alias; - SFTypeList types; - - UDesktop::Deactivate(); - ::StandardGetFile( NULL, -1, types, &reply ); - UDesktop::Activate(); - - if ( reply.sfGood ) - { - LFile startFile( reply.sfFile ); - - aswFile.CreateNewFile( emSignature, 'ASWl', smSystemScript ); - aswFile.OpenResourceFork( fsWrPerm ); - alias = startFile.MakeAlias(); - if ( alias ) - AddResource( (Handle)alias, 'alis', 1, reply.sfFile.name ); - aswFile.CloseResourceFork(); - aswFile.OpenResourceFork( fsRdPerm ); - } - } - -#endif DEBUG - - alias = ::Get1Resource( 'alis', 1 ); - if ( !alias ) - return FALSE; - - err = ::ResolveAlias( NULL, (AliasHandle)alias, &startAswFile, &wasChanged ); - if ( err == noErr ) - { - CFrontApp::GetApplication()->SendAEOpenDoc( startAswFile ); - return TRUE; - } - return FALSE; -} - -#if 0 -static void launchNetcasterCallback(void* closure); - -static void launchNetcasterCallback(void* /*closure*/) -{ - FE_RunNetcaster(NULL); -} - -// Launch Netcaster on a timeout to avoid interfering with other components because -// it is slow to start up. -void CFrontApp::LaunchNetcaster() -{ - FE_SetTimeout(launchNetcasterCallback, NULL, 0); -} - -// We keep track of the Netcaster context in the app so we can assure ourselves -// that only one Netcaster context will be open at any given time. These calls -// are used by FE_RunNetcaster to either launch Netcaster (if the netcaster context -// is NULL) or to activate its window (if not). The alternative would have been -// to use named contexts; the disadvantage is that the Netcaster window could be -// spoofed, and that we would have a performance hit whenever the Netcaster object -// were referenced (such as from JS). - EA - -//----------------------------------- -MWContext *CFrontApp::GetNetcasterContext() -//----------------------------------- -{ - return mNetcasterContext; -} - -//----------------------------------- -void CFrontApp::SetNetcasterContext(MWContext *context) -//----------------------------------- -{ - mNetcasterContext = context; -} -#endif - -// 97-08-23 pchen -- This method should be called when we're "low on memory." -// For now, we just call LJ_ShutdownJava(). -//----------------------------------- -void CFrontApp::MemoryIsLow() -//----------------------------------- -{ -#if defined (JAVA) - // Call LJ_ShutdownJava() if Java is running - if (LJ_GetJavaStatus() == LJJavaStatus_Running) - LJ_ShutdownJava(); -#endif /* defined (JAVA) */ -} - - -#pragma mark - - -//====================================== -// class CSplashScreen -//====================================== - -extern Boolean pref_FindAutoAdminLib(FSSpec& spec); - -CSplashScreen::CSplashScreen(LStream* inStream) - : LWindow(inStream) -{ - mStatusCaption = NULL; - mPictureResourceFile = NULL; -} - -CSplashScreen::~CSplashScreen() -{ - ResIDT thePicID = mBackPicture->GetPictureID(); - - // this returns the picture that has already been loaded by the picture pane - PicHandle thePicHandle = ::GetPicture(thePicID); - if (thePicHandle != NULL) - ::ReleaseResource((Handle)thePicHandle); - - if (mPictureResourceFile) { - mPictureResourceFile->CloseResourceFork(); - delete mPictureResourceFile; - } -} - -void CSplashScreen::SetDescriptor(ConstStringPtr inDescriptor) -{ - mStatusCaption->SetDescriptor(inDescriptor); - // we're relying on the fact that the splash window has erase on - // update set so that the old caption gets erased in the window's - // background color (which we're assuming to be black) - mStatusCaption->UpdatePort(); -} - -void CSplashScreen::FinishCreateSelf(void) -{ - LWindow::FinishCreateSelf(); - - mStatusCaption = (LCaption*)FindPaneByID(1); - Assert_(mStatusCaption != NULL); - - mBackPicture = (CResPicture*)FindPaneByID(2); - Assert_(mBackPicture != NULL); - - // choose the b/w or color splash screen - ResIDT thePicID = (GetDepth(GetDeepestDevice()) == 1) ? 129 : 128; - - // If AutoAdminLib is installed, then load the Communicator Pro - // splash screen from the library's resource fork. - // Otherwise, picture comes from app resource. - try { - FSSpec autoAdminLib; - if ( pref_FindAutoAdminLib(autoAdminLib) ) { - mPictureResourceFile = new LFile(autoAdminLib); - mPictureResourceFile->OpenResourceFork(fsRdPerm); - - mBackPicture->SetResFileID( mPictureResourceFile->GetResourceForkRefNum() ); - } - } - catch (...) { - } - - mBackPicture->SetPictureID(thePicID); -} - - -// -// THIS IS HERE ONLY AS A PLACEHOLDER UNTIL I PUT THE NAV-SERVICES CODE INTO THE SOURCE TREE.... -// DO NOT RELY ON THIS IMPLEMENTATION OR EVEN THAT THIS ROUTINE USES THE SF PACKAGE -// -Boolean SimpleOpenDlog ( short numTypes, const OSType typeList[], FSSpec* outFSSpec ) -{ - Boolean fileSelected = false; - StandardFileReply myReply; - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - ::StandardGetFile(NULL, numTypes, typeList, &myReply); - else - ::StandardGetFile(NULL, -1, NULL, &myReply); - fileSelected = myReply.sfGood; - *outFSSpec = myReply.sfFile; - - return fileSelected; - -} // SimpleOpenDialog diff --git a/mozilla/cmd/macfe/central/uapp.h b/mozilla/cmd/macfe/central/uapp.h deleted file mode 100644 index 5f7eb30ef12..00000000000 --- a/mozilla/cmd/macfe/central/uapp.h +++ /dev/null @@ -1,311 +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. - */ - -#pragma once -// =========================================================================== -// UApp.h -// main application module -// =========================================================================== - -#include -#include -#include -#include -#include "CTaskBarListener.h" -#include "CURLDispatcher.h" - -#include - -#ifndef _NetscapeTypes_ -#include "ntypes.h" -#endif - -#include "cstring.h" - -#include "structs.h" - -class CStr255; -class EarlManager; -class LDialogBox; -class CMimeMapper; -class StDialogHandler; -class CBrowseWin; -class CCheckMailContext; -class CSplashScreen; -class CStr255; -class CMailNewsWindow; -class CBrowserWindow; -class CLICommander; - -/***************************************************************************** - * CFrontApp - * the application class. It takes care of managing the documents. Only one - * preference document can be open at any time, and no documents can be opened - * before we read in the preferences. - * The application uses windows in place of documents. We could have discarded - * documents completely, but this would affect AppleEvent recording (I think). - * - * Window is created blank, without the home page. After the window is created, - * window's function DoOpenURL should be called to open its first document. - *****************************************************************************/ - - -// --------------------------------------------------------------------------- -// For the moment CAppleEventHandler requires a small bit of knowledge -// about uapp.cp. All shared info goes here til the separation can -// be completed. - -#define FILE_TYPE_PREFS 1 -#define FILE_TYPE_ODOC 2 -#define FILE_TYPE_GETURL 3 -#define FILE_TYPE_NONE 4 -#define FILE_TYPE_PROFILES 5 -#define FILE_TYPE_ASW 6 -#define FILE_TYPE_LDIF 7 -#define STARTUP_TYPE_NETPROFILE 8 - -char* GetBookmarksPath( FSSpec& spec, Boolean useDefault ); - -// ----- End stuff required by CAppleEvent.cp - - -//---------------------------------------------------------------------------------------- -class CFrontApp : public LDocApplication, public CTaskBarListener -//---------------------------------------------------------------------------------------- -{ -public: - static CFrontApp* sApplication; // One and only instance of the application - // ¥¥ Constructors/destructors - CFrontApp(); - virtual ~CFrontApp(); - virtual void Initialize(); - // for changing notification - virtual void EventSuspend(const EventRecord &inMacEvent); - virtual void EventResume(const EventRecord &inMacEvent); - - // ¥ patches in Mercutio - virtual void EventKeyDown( const EventRecord& inMacEvent ); - - // so plug-ins can get key ups (which are ignored by default) - virtual void EventKeyUp(const EventRecord &inMacEvent); - virtual void ProcessNextEvent(); - - Boolean HasProperlyStartedUp() const { return fProperStartup; } - - // Delayed startup. Called with launched open/print file (if any). - void ProperStartup( FSSpec* fileSpec, short fileType ); - - // Startup w/o any documents - virtual void StartUp(); // Creates a home page document on startup - void CreateStartupEnvironment( Boolean openStartupWindows ); // Opens the proper window - // ¥¥ documents/windows - // Startup w/ a document or - virtual void OpenDocument(FSSpec *inFileSpec); - virtual void PrintDocument(FSSpec *inFileSpec); - virtual void ChooseDocument(); - - // Opens a hypertext document - virtual LModelObject* MakeNewDocument(); - - // ¥¥ Global static routines. Could not think of better place to put them - - // Registers types with netlib - static void RegisterMimeType(CMimeMapper * mapper); - - // returns application object. - - static CFrontApp* GetApplication(); - - // ¥¥ Cached preference values (requires application restart to notice new values) - - Boolean HasBookmarksMenu() const { return mHasBookmarksMenu; } - Boolean HasFrontierMenuSharing() const { return mHasFrontierMenuSharing; } - Boolean HasImportModule() const { return mImportModuleExists; } - Boolean HasAOLInstantMessenger() const { return mAOLMessengerExists; } - // ¥¥ÊMenubar management - - static const list& - GetCommandsToUpdateBeforeSelectingMenu() { - return sCommandsToUpdateBeforeSelectingMenu; - } - - virtual void MakeMenuBar(); - virtual void ClickMenuBar(const EventRecord& inMacEvent); - virtual void SetMenubar( ResIDT mbar, Boolean inUpdateNow = false ); // If appleMenu is 0, do not rebuild it - virtual void UpdateMenus(); - void UpdateHierarchicalMenus(); - - static void InstallMenus(); - static int BuildConfigurableMenu(MenuHandle, const char* xp_name, short stringsID = 0); - Boolean HandleSyntheticCommand( CommandT inCommand ); - static void DoHelpMenuItem( short itemNum ); - - // ¥¥ Command handling - static void DoGetURL (const cstring& url, const char* inReferrer=NULL, const char* inTarget = NULL); - // loads the given url into the frontmost window, or new one if there - // is no frontmost - static void DoOpenDirectoryURL( CommandT menuCommand ); - static void DoOpenLogoURL( CommandT menuCommand ); - void OpenLocalURL( FSSpec* inFileSpec, - CBrowserWindow * win = NULL, - char * mime_type = NULL, - Boolean delayed = FALSE); // use delayed argument if you are using drag'n'drop to avoid errors due to dialogs popping us - void OpenBookmarksFile( FSSpec* inFileSpec, CBrowserWindow * win, Boolean delayed); - void DoOpenDoc( FSSpec* initDoc, short fileType ); - - // ¥¥ Taskbar support - virtual void ListenToMessage (MessageT inMessage, void *ioParam); - - virtual void ShowAboutBox(); - - //=== begin: add for TSMSupport - - virtual Boolean AttemptQuitSelf(Int32 inSaveOption = kAEAsk); - virtual void DoQuit(Int32 inSaveOption = kAEAsk); - virtual void DispatchEvent(const EventRecord &inMacEvent); - - // splash screen - static void SplashProgress(CStr255 inMessage); - - // ¥¥ÊCommand and menus setup - virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam = nil); - virtual void FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName); - virtual void ProcessCommandStatus(CommandT inCommand, - Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName); - - - - // ¥¥ AE handling - virtual void HandleAppleEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - virtual void GetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc) const; - virtual void SetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc); - - virtual void SetupPage(); - - // spy Apple Event suite - - static CMailNewsWindow* GetMailNewsWindow(); - -#if 0 - // EA - Netcaster support - void LaunchNetcaster(void); - MWContext* GetNetcasterContext(void); - void SetNetcasterContext(MWContext *); -#endif - - // 97-05-12 pkc -- dpi support for MWContext - static double sHRes; - static double sVRes; - - static CAutoPtr sRDFContext; - -// DW FIX i made these non-static, and protected instead of public -protected: - void InitBookmarks(); -#ifdef MOZ_LOC_INDEP - void InitializeLocationIndependence(); -#endif - virtual void UpdateMenusSelf(); - - - virtual void AdjustCursor (const EventRecord &inMacEvent); - //=== end: add for TSMSupport - - void ShowSplashScreen(void); - void DestroySplashScreen(void); - - CSplashScreen* mSplashScreen; - - Boolean AgreedToLicense( FSSpec* callbackWith, short fileType ); - - void MemoryIsLow(); - - void DoWindowsMenu(CommandT inCommand); // Execute windows menu command - - - void DoOpenURLDialog(void); -#ifdef EDITOR - void DoOpenURLDialogInEditor(void); -#endif - - void InsertItemIntoWindowsMenu(CStr255& title, - int currItem, LWindow * win, short iconID=0); // Utility function to add an item into windows menu - - void LaunchExternalApp(OSType inAppSig, ResIDT inAppNameStringResourceID); - -#ifdef IBM_HOST_ON_DEMAND - Boolean Find3270Applet(FSSpec& tn3270File); - void Launch3270Applet(); -#endif - - Boolean LaunchAccountSetup(); - - - ResIDT fCurrentMbar; // Currently active menu bar - ResIDT fWantedMbar; - - LArray fWindowsMenu; // LWindow * of windows in the window menu. - static short sHelpMenuOrigLength; - static short sHelpMenuItemCount; - - Boolean fStartupAborted; - Boolean fSafeToQuit; - Boolean fUserWantsToQuit; - Boolean fProperStartup; - - LPeriodical* mLibMsgPeriodical; - - Boolean mConferenceApplicationExists; - Boolean mImportModuleExists; - Boolean mAOLMessengerExists; - Boolean mJavaEnabled; - - Boolean mHasBookmarksMenu; - Boolean mHasFrontierMenuSharing; - - static list sCommandsToUpdateBeforeSelectingMenu; - -public: - static int SetBooleanWithPref(const char *prefName, void *boolPtr); - // boolPtr is really a (boolean *) - -protected: - FSSpec CreateAccountSetupSpec(); - RgnHandle mMouseRgnH; -}; - -#ifdef PROFILE -void StartProfiling(); -void StopProfiling(); -#endif - -#ifdef MOZ_MAIL_NEWS -// TRUE if url *must* be loaded in this context type -Boolean URLRequiresContextType( const URL_Struct* url , MWContextType &type); -#endif - diff --git a/mozilla/cmd/macfe/central/uerrmgr.h b/mozilla/cmd/macfe/central/uerrmgr.h deleted file mode 100644 index cac5340badd..00000000000 --- a/mozilla/cmd/macfe/central/uerrmgr.h +++ /dev/null @@ -1,98 +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. - */ - -/****************************************************************************** - * uerrmgr.h, Mac front end - * - * Created 6/18/94 by atotic - * - * Definiton of ErrorManager, a utility class that handles display of error - * messages. - *****************************************************************************/ - -#pragma once -#include -struct CStr255; -/*---------------------------------------------------------------------------- - class ErrorManager - Utility class, no instances are created - - Function: - Error manager provides utility routines for displaying - dialog boxes: - - PrepareToInteract -- makes sure that Netscape is frontmost application - - Implementation: - - All plain alerts (simple text + buttons) use standard Toolbox - alert routines. - If we are in the background, notification manager is used - to notify the user to bring application to front. - No instances of ErrorManager should be created. - -----------------------------------------------------------------------------*/ -#include "reserr.h" - -// STILL UNDER CONSTRUCTION. FUNCTIONS WILL BE DEFINED AS NEEDED. -class ErrorManager { -public: - static void OSNumToStr(OSErr err, CStr255 &outString); - - // Call this before displaying any dialogs. It makes sure that the - // application is in the foreground. The routine will not - // return until application is in the foreground - static void PrepareToInteract(); - - // Just like PrepareToInteract, except that it returns FALSE - // if application has not been brought to foreground within wait seconds - static Boolean TryToInteract(long wait); - - // Displays a vanilla alert. All strings inside the alert are - // supplied by caller - static void PlainAlert (const CStr255& s1, - const char * s2 = NULL, - const char * s3 = NULL, - const char * s4 = NULL); - - // Displays the alert specified by resID - static void PlainAlert( short resID ); - - // Yes or No box. All strings supplied by the caller - static Boolean PlainConfirm(const char * s1, - const char * s2 = NULL, - const char * s3 = NULL, - const char * s4 = NULL); - // Prints a string "message :err" - static void ErrorNotify(OSErr err, const CStr255& message); - static OSType sAlertApp; // Application that handles our alerts -}; - - -// BEWARE! XP_GetString and GetCString call CString::operator char*() const, -// which uses a stack of 8 static strings into which the -// C string is copied, and you are returned a pointer to -// one of these buffers. This result is volatile; 8 more -// calls of this operator will overwrite the string pointed -// to by the char* returned. -// You should call XP_STRDUP or otherwise store the string if you -// want it to persist - -extern "C" char * XP_GetString( int resID ); -extern "C" char * GetCString( short resID ); -CStr255 GetPString( ResIDT id ); -void MoveResourceMapBelowApp(); - diff --git a/mozilla/cmd/macfe/central/ufilemgr.cp b/mozilla/cmd/macfe/central/ufilemgr.cp deleted file mode 100644 index eb783b83e0e..00000000000 --- a/mozilla/cmd/macfe/central/ufilemgr.cp +++ /dev/null @@ -1,1210 +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. - */ - -// =========================================================================== -// ufilemgr.cp -// Created by atotic, June 15th, 1994 -// File utility routines for: -// Creating a temporary file name -// Bookkeeping of the temporary files -// =========================================================================== - -// Front End -#include "ufilemgr.h" -#include "uprefd.h" -#include "BufferStream.h" -#include "uerrmgr.h" -#include "macutil.h" -#include "resgui.h" -#include "ulaunch.h" -#include "libmime.h" -#include "uerrmgr.h" -#include "FullPath.h" -#include "FileCopy.h" //in MoreFiles - -#include "AERegistry.h" -#include "Processes.h" -#include "LArrayIterator.h" -#include "UMemoryMgr.h" - -// XP -#ifndef _XP_H_ -#include "xp.h" -#endif - -#include "PascalString.h" - -// MacOS -#include -#include -#include -#include -//#include - -#define MAX_FILENAME_LEN 31 -#define MAX_ALT_DIGIT_LEN 5 -#define MAX_ALT_NAME_LEN (MAX_FILENAME_LEN - (MAX_ALT_DIGIT_LEN + 1) ) - -/***************************************************************************** - * class CFileMgr - *****************************************************************************/ - -CFileMgr CFileMgr::sFileManager; // The manager -unsigned int CFileMgr::sMungeNum = 1; - -extern "C" OSErr FSSpecFromPathname_CWrapper(char * path, FSSpec * outSpec); - -// ¥¥ constructors/destructors - -// Tries to delete all the files. -// It will not be able to delete all the files, since users might have -// moved them, deleted them, etc. -CFileMgr::~CFileMgr() -{ - Boolean allDeleted = TRUE; - LFile * aFile; - for (int i =1; i <= fFiles.GetCount(); i++) // Loop through - { - fFiles.FetchItemAt(i, &aFile); - Try_ { - FSSpec fileSpec; - aFile->GetSpecifier(fileSpec); - FSpDelete(&fileSpec); - delete aFile; - } - Catch_(inErr) { - allDeleted = FALSE; - } EndCatch_ - } - fFiles.RemoveItemsAt(fFiles.GetCount(), 1); -} - -// ¥¥ file management interface - -// Register a file -void CFileMgr::RegisterFile(LFileBufferStream * inFile) -{ - fFiles.InsertItemsAt(1, LArray::index_Last, &inFile); -} - -// Cancel file registration. Just deletes it from the queue -void CFileMgr::CancelRegister(LFileBufferStream * inFile) -{ - fFiles.Remove(&inFile); -} - -// Cancels registration, and deletes the file from disk, and its file object -void CFileMgr::CancelAndDelete(LFileBufferStream * inFile) -{ - fFiles.Remove(&inFile); // Remove it from the queue - - FSSpec fileSpec; - inFile->GetSpecifier(fileSpec); - OSErr err = FSpDelete(&fileSpec); // Delete disk file - delete inFile; // Delete the object -} - -// FindURL occurs when we have launched an external file -void CFileMgr::HandleFindURLEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &/*outResult*/, - long /*inAENumber*/) -{ - FSSpec lookingFor; - Size actualSize; - DescType realType; - - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, - typeFSS, &realType, - &lookingFor, - sizeof(lookingFor), &actualSize); - ThrowIfOSErr_(err); - // Have the file spec, now look for the same one - LFileBufferStream *file; - LArrayIterator iter(fFiles); - while (iter.Next(&file)) - { - FSSpec macSpec; - file->GetSpecifier(macSpec); - if ((macSpec.vRefNum == lookingFor.vRefNum) && - (macSpec.parID == lookingFor.parID) && - (CStr32(macSpec.name) == CStr32(lookingFor.name))) - { - char * url = file->GetURL(); - if (url) - { - err = ::AEPutParamPtr(&outAEReply, keyAEResult, typeChar, url, strlen(url)); - return; - } - else - Throw_(errAEDescNotFound); - } - } - Throw_(errAEDescNotFound); -} - -/* - Turning an URL into a filename - Returns a file name that works on a Mac - - Requirements: - Length < 32 characters - No colons - Name should look similar to URL (which is closer to the URN than the anchor) - - Input: - URLs match this expression: : - Top can be a / - Paths end with a / - Crud begins with a # or ? - Host ends with a : - - Method: - Start at the end of the paths - after last / - Or at the end of the hostname - after first : - Go until a # or ? - - Notes: - This does not guarantee that the filename will work. We may still need to - munge it later (if for example such a filename already existed) -*/ - -CStr31 CFileMgr::FileNameFromURL( const char* url ) -{ - CStr255 newName; - Byte size = 0; - - if ( !url ) - return CStr31(::GetCString(FILE_NAME_NONE)); - - const char* urlString = url; - - // ¥ get the starting point - const char* nameStart = strrchr( urlString, '/' ); - - // ¥Êfilename starts *after* the colon - if ( nameStart && ( strlen( nameStart ) > 1) ) - nameStart++; - - // ¥ no colon, must be simple path, go after the hostname - else - { - nameStart = strchr( urlString, ':' ); - // ¥Êfilename starts *after* the colon - if ( nameStart ) - nameStart++; - // ¥Êno host, assume it's a simple local URL - else - nameStart = urlString; - } - - // ¥Êcopy it until we hit the crud (# or ?) or max out - size = 0; - while ( size < MAX_FILENAME_LEN ) - { - // 0 indexed - char current = nameStart[ size ]; - if ( current == '#' || current == '?' || !current ) - break; - // ¥Êtake out any : characters as well - if ( current == ':' ) - current = '¥'; - - size++; - - newName[ size ] = current; - newName.Length() = size; - } - - // If size was 0 then we have a problem. Make a temp filename. - // A reasonable convention would be to have names like "Untitled 1", "Untitled 2", etc - // since we really don't have any other information. We'll leave off the number - // here and let the arbitrator add it on later. We don't have an english file kind - // either, which the arbitrator might have, so this could get folded in later (just - // have a "Untitled" hack in here now) - if ( size == 0 ) - newName = (char*)GetCString( UNTITLED_RESID ); - return newName; -} - -// Creates a FSSpec of a file that does not exist, given the template -OSErr CFileMgr::UniqueFileSpec(const FSSpec& inSpec, const CStr31& genericName, - FSSpec & outSpec) -{ - CStr255 goodName = genericName; - OSErr err; - - err = FSMakeFSSpec( inSpec.vRefNum, inSpec.parID, goodName, &outSpec ); - if (err == fnfErr) - return noErr; - if (err) - return err; - - // If the filename exists (noErr) then we have a problem! - - // Argh. We can do this: filename.gif-2 - // Or this: #2 filename.gif - // One messes with the extension (which some people care about) and the other - // with the "proper" name. - -#define USE_RANDOM 0 -#if USE_RANDOM - long index = 0; -#else - static short index = 1; -#endif - CStr31 indexStr; - Boolean done = FALSE; - CStr255 altName; - - do { - index++; // start with "Picture 2" after "Picture" exists - if ( index > 999 ) // something's very wrong - return ioErr; - altName = goodName; - if ( altName.Length() > MAX_ALT_NAME_LEN ) - altName.Length() = MAX_ALT_NAME_LEN; -#if USE_RANDOM - long randomNum = abs(::Random())*9999/32767; - NumToString( randomNum, indexStr ); -#else - NumToString( index, indexStr ); -#endif - altName += "-"; - altName += indexStr; - err = FSMakeFSSpec( inSpec.vRefNum, inSpec.parID, altName, &outSpec ); - if ( err == fnfErr ) - return noErr; - } while ( err == noErr ); - return noErr; -} - -/* - Turning an URL into a fileSpec of a new file. - A file spec for non-existent file is created. - - Requirements: - ¥ Preserve filename as much as possible, including extension, if any (even though - this doesn't quite make sense on the Mac). - ¥ Make the new filename look "nice". Provide as much information as possible to the - user (they might want to keep the file) and don't use random numbers or the date. - Well, the date might be OK. Something like "Picture 1", "Picture 2" might do, - or "#2 madonna.gif". - - Method: - For file name generation see FileNameFromURL - If file with default name already exists, munge the name by appending - it a number. -*/ - -OSErr CFileMgr::NewFileSpecFromURLStruct (const char * location, - const FSSpec& inSpec, - FSSpec &outSpec) -{ - CStr31 goodName = FileNameFromURL(location); - return UniqueFileSpec( inSpec, goodName, outSpec ); -} - - -/* - FL_SetComment -*/ - -void CFileMgr::FileSetComment (const FSSpec& file, const CStr255& comment) -{ - // Set GetInfo box in Finder to the URL. Not really necessary, but a neat hack - Boolean hasDesktop; - FSSpec tempSpec = CPrefs::GetFolderSpec(CPrefs::DownloadFolder); - OSErr err = VolHasDesktopDB(tempSpec.vRefNum, hasDesktop); - if (err || !hasDesktop) - return; - DTPBRec pb; - pb.ioCompletion = NULL; - pb.ioVRefNum = tempSpec.vRefNum; - pb.ioNamePtr = NULL; - err = PBDTGetPath(&pb); - if (err) - return; - short refNum = pb.ioDTRefNum; - pb.ioNamePtr = (StringPtr)&file.name; // A pointer to a file or directory name. - char *ccomment = comment; - pb.ioDTBuffer = ccomment; - pb.ioDTReqCount = strlen(ccomment); - pb.ioDirID = file.parID; // The parent directory of the file or directory. - err = ::PBDTSetCommentSync(&pb); -} - -/* - FL_VolumeHasDesktopDB -*/ - -OSErr CFileMgr::VolHasDesktopDB(short vRefNum, Boolean& hasDesktop) -{ - HParamBlockRec pb; - GetVolParmsInfoBuffer info; - - pb.ioParam.ioCompletion = NULL; - pb.ioParam.ioVRefNum = vRefNum; - pb.ioParam.ioNamePtr = NULL; - pb.ioParam.ioBuffer = (Ptr) & info; - pb.ioParam.ioReqCount = sizeof(GetVolParmsInfoBuffer); - - OSErr err = ::PBHGetVolParmsSync(&pb); - - hasDesktop = (err == noErr) && ((info.vMAttrib & (1L << bHasDesktopMgr)) != 0); - - return err; - -} // VolHasDesktopDB - -// From MacApp -// Get the vRefNum of an indexed on-line volume -OSErr CFileMgr::GetIndVolume(short index, - short& vRefNum) -{ - ParamBlockRec pb; - OSErr err; - - pb.volumeParam.ioCompletion = NULL; - pb.volumeParam.ioNamePtr = NULL; - pb.volumeParam.ioVolIndex = index; - - err = PBGetVInfoSync(&pb); - - vRefNum = pb.volumeParam.ioVRefNum; - return err; -} // GetIndVolume - -// Copied from MacApp -// Get the vRefNum of the system (boot) volume -OSErr CFileMgr::GetSysVolume(short& vRefNum) -{ - OSErr theErr; - long dir; - theErr = FindFolder(kOnSystemDisk, kSystemFolderType, false, &vRefNum, &dir); - return theErr; -} - -// Finds a folder inside a folder. -// The folder must be writeable -// Signals error if folder cannot be found -// Success: returns noErr and the location of the found folder in foundRefNum, foundDirID -// Failure: returns PBGetCatInfo error, and undefined foundRefNum, foundDirID -OSErr CFileMgr::FindWFolderInFolder(short refNum, // Directory/folder to be searched - long dirID, - const CStr255& folderName, // Name of the folder to search for - short * outRefNum,// Location of the found folder - long * outDirID) -{ - CInfoPBRec cipb; - DirInfo *dipb=(DirInfo *)&cipb; // Typecast to what we need - OSErr err; - - dipb->ioNamePtr = (unsigned char *) &folderName; - dipb->ioFDirIndex = 0; - dipb->ioVRefNum = refNum; - dipb->ioDrDirID = dirID; - - err = PBGetCatInfoSync(&cipb); - - if (err != noErr) - return err; - - if ( ( dipb->ioFlAttrib & 0x0010 ) )// && !(cipb.ioACUser && 2)) // Is it a directory and writable? - { - *outRefNum = dipb->ioVRefNum; - *outDirID = dipb->ioDrDirID; - return noErr; - } - - return fnfErr; -} // FindWFolderInFolder - -// Creates a folder named 'folderName' inside a folder. -// The errors returned are same as PBDirCreate -OSErr CFileMgr::CreateFolderInFolder(short refNum, // Parent directory/volume - long dirID, - const CStr255 &folderName, // Name of the new folder - short * outRefNum, // Volume of the created folder - long * outDirID) // -{ - HFileParam hpb; - - hpb.ioVRefNum = refNum; - hpb.ioDirID = dirID; - hpb.ioNamePtr = (StringPtr)&folderName; - OSErr err = PBDirCreateSync((HParmBlkPtr)&hpb); - if (err == noErr) { - *outRefNum = hpb.ioVRefNum; - *outDirID = hpb.ioDirID; - } else { - *outRefNum = 0; - *outDirID = 0; - } - return err; -} - -// Creates a folder spec from folder id; -OSErr CFileMgr::FolderSpecFromFolderID(short vRefNum, long dirID, FSSpec& folderSpec) -{ - folderSpec.vRefNum = 0; // Initialize them to 0 - folderSpec.parID = 0; - CInfoPBRec cinfo; - DirInfo *dipb=(DirInfo *)&cinfo; - dipb->ioNamePtr = (StringPtr)&folderSpec.name; - dipb->ioVRefNum = vRefNum; - dipb->ioFDirIndex = -1; - dipb->ioDrDirID = dirID; - OSErr err = PBGetCatInfoSync(&cinfo); - - if (err == noErr) - { - folderSpec.vRefNum = dipb->ioVRefNum; - folderSpec.parID = dipb->ioDrParID; - } - return err; -} - -//----------------------------------- -char* CFileMgr::PathNameFromFSSpec( const FSSpec& inSpec, Boolean wantLeafName ) -// Returns a full pathname to the given file -// Returned value is allocated with XP_ALLOC, and must be freed with XP_FREE -// This is taken from FSpGetFullPath in MoreFiles, except that we need to tolerate -// fnfErr. -//----------------------------------- -{ - char* result = nil; - FSSpec tempSpec; - OSErr err = noErr; - - short fullPathLength = 0; - Handle fullPath = NULL; - - /* Make a copy of the input FSSpec that can be modified */ - BlockMoveData(&inSpec, &tempSpec, sizeof(FSSpec)); - - if ( tempSpec.parID == fsRtParID ) - { - /* The object is a volume */ - - /* Add a colon to make it a full pathname */ - ++tempSpec.name[0]; - tempSpec.name[tempSpec.name[0]] = ':'; - - /* We're done */ - err = PtrToHand(&tempSpec.name[1], &fullPath, tempSpec.name[0]); - } - else - { - /* The object isn't a volume */ - - CInfoPBRec pb = { 0 }; - CStr63 dummyFileName("\pGrippy Lives!"); - - /* Is the object a file or a directory? */ - pb.dirInfo.ioNamePtr = (! tempSpec.name[0] ) ? (StringPtr)dummyFileName : tempSpec.name; - pb.dirInfo.ioVRefNum = tempSpec.vRefNum; - pb.dirInfo.ioDrDirID = tempSpec.parID; - pb.dirInfo.ioFDirIndex = 0; - err = PBGetCatInfoSync(&pb); - if ( err == noErr || err == fnfErr) - { - // if the object is a directory, append a colon so full pathname ends with colon - // Beware of the "illegal spec" case that Netscape uses (empty name string). In - // this case, we don't want the colon. - if ( err == noErr && tempSpec.name[0] && (pb.hFileInfo.ioFlAttrib & ioDirMask) != 0 ) - { - ++tempSpec.name[0]; - tempSpec.name[tempSpec.name[0]] = ':'; - } - - /* Put the object name in first */ - err = PtrToHand(&tempSpec.name[1], &fullPath, tempSpec.name[0]); - if ( err == noErr ) - { - /* Get the ancestor directory names */ - pb.dirInfo.ioNamePtr = tempSpec.name; - pb.dirInfo.ioVRefNum = tempSpec.vRefNum; - pb.dirInfo.ioDrParID = tempSpec.parID; - do /* loop until we have an error or find the root directory */ - { - pb.dirInfo.ioFDirIndex = -1; - pb.dirInfo.ioDrDirID = pb.dirInfo.ioDrParID; - err = PBGetCatInfoSync(&pb); - if ( err == noErr ) - { - /* Append colon to directory name */ - ++tempSpec.name[0]; - tempSpec.name[tempSpec.name[0]] = ':'; - - /* Add directory name to beginning of fullPath */ - (void) Munger(fullPath, 0, NULL, 0, &tempSpec.name[1], tempSpec.name[0]); - err = MemError(); - } - } while ( err == noErr && pb.dirInfo.ioDrDirID != fsRtDirID ); - } - } - } - if ( err != noErr && err != fnfErr) - goto Clean; - - fullPathLength = GetHandleSize(fullPath); - err = noErr; - int allocSize = 1 + fullPathLength; - // We only want the leaf name if it's the root directory or wantLeafName is true. - if (inSpec.parID != fsRtParID && !wantLeafName) - allocSize -= inSpec.name[0]; - result = (char*)XP_ALLOC(allocSize); - if (!result) - goto Clean; - memcpy(result, *fullPath, allocSize - 1); - result[ allocSize - 1 ] = 0; -Clean: - if (fullPath) - DisposeHandle(fullPath); - Assert_(result); // OOPS! very bad. - return result; -} // CFileMgr::PathNameFromFSSpec - -// PathNameFromFSSpec + hex encoding -// pass this in to netlib when specifying filesToPost, etch -char* CFileMgr::EncodedPathNameFromFSSpec( const FSSpec& inSpec, Boolean wantLeafName ) -{ - char* path = CFileMgr::PathNameFromFSSpec( inSpec, wantLeafName ); - path = CFileMgr::EncodeMacPath( path ); - return path; -} - -// GetElement is a routine used by FSSpecFromPathname, routine adopted from ParseFullPathName.c on dev disk -// I am not sure how does it work. -static Boolean GetElement(StringPtr Result,char * PathNamePtr,short ElementNumber); -static Boolean GetElement(StringPtr Result,char *PathNamePtr,short ElementNumber) -{ - char *eStart, *eEnd; - - eStart = eEnd = PathNamePtr; - while (ElementNumber) { // Search for the element - if (*eEnd == ':' || !(*eEnd)) { // if we see colon or a null , we're at the end of element - --ElementNumber; // one down, n-1 to go - if (ElementNumber == 1) // are we at the second to last element?? - eStart = eEnd + 1; // mark it. - } - if (!(*eEnd)) break; - ++eEnd; // always increment - } - - if (ElementNumber || (eEnd - eStart > 32) || (eEnd - eStart == 0)) // If n > 0 or the element is too big or there is no element - return false; // then croak. - - Result[0] = (char)(eEnd - eStart); // Move the substring into the Result - BlockMove ((Ptr) eStart, (Ptr) (Result + 1),Result[0]); - return true; -} - -//----------------------------------- -OSErr CFileMgr::FSSpecFromPathname(const char* inPathNamePtr, FSSpec* outSpec) -// FSSpecFromPathname reverses PathNameFromFSSpec. -// It returns a FSSpec given a c string which is a mac pathname. -//----------------------------------- -{ - // Simplify this routine to use FSMakeFSSpec if length < 255. Otherwise use the MoreFiles - // routine FSpLocationFromFullPath, which allocates memory, to handle longer pathnames. - if (strlen(inPathNamePtr) < 255) - return ::FSMakeFSSpec(0, 0, CStr255(inPathNamePtr), outSpec); - return FSpLocationFromFullPath(strlen(inPathNamePtr), inPathNamePtr, outSpec); -} // CFileMgr::FSSpecFromPathname - -// Changes the creator/file -OSErr CFileMgr::SetFileTypeCreator(OSType creator, OSType type, const FSSpec * fileSpec) -{ - FInfo info; - OSErr err = ::FSpGetFInfo (fileSpec, &info); - if (err != noErr) - return err; - info.fdCreator = creator; - info.fdType = type; - err = ::FSpSetFInfo (fileSpec, &info); - return err; -} - -// Set or clear a Finder flag -OSErr CFileMgr::SetFileFinderFlag(const FSSpec& fileSpec, Uint16 flagMask, Uint8 value) -{ - FInfo info; - OSErr err = ::FSpGetFInfo (&fileSpec, &info); - if (err != noErr) - return err; - - if (value) //set the bit - info.fdFlags |= flagMask; - else //clear the bit - info.fdFlags &= ~flagMask; - - err = ::FSpSetFInfo (&fileSpec, &info); - return err; -} - - -//----------------------------------- -Boolean CFileMgr::IsFolder(const FSSpec& spec) -//----------------------------------- -{ - CStr31 name = spec.name; - CInfoPBRec pb; - DirInfo *dipb=(DirInfo *)&pb; - pb.hFileInfo.ioNamePtr = name; - pb.hFileInfo.ioVRefNum = spec.vRefNum; - pb.hFileInfo.ioDirID = spec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - OSErr err = PBGetCatInfoSync(&pb); - if (err != noErr) - return FALSE; - if (dipb->ioFlAttrib & 0x10) - return TRUE; - // else - return FALSE; -} - -//----------------------------------- -OSErr CFileMgr::FindAppOnVolume(OSType sig, - short vRefNum, - FSSpec& thefile) -// Copied from MacApp. It did not have any docs in MacApp eithere -// Ask vol's desktop db for application -//----------------------------------- -{ - DTPBRec pb; - OSErr err; - - pb.ioCompletion = NULL; - pb.ioVRefNum = vRefNum; - pb.ioNamePtr = NULL; - if ((err = PBDTGetPath(&pb)) != noErr) - return err; // Puts DT refnum into pb.ioDTRefNum - short refNum = pb.ioDTRefNum; - - pb.ioCompletion = NULL; - pb.ioDTRefNum = refNum; - pb.ioIndex = 0; - pb.ioFileCreator = sig; - pb.ioNamePtr = (StringPtr) thefile.name; - err = PBDTGetAPPLSync(&pb); // Find it! - - if( err == fnfErr ) - err = afpItemNotFound; // Bug in PBDTGetAPPL - if( err ) - return err; // Returns afpItemNotFound if app wasn't found. - - thefile.vRefNum = vRefNum; - thefile.parID = pb.ioAPPLParID; - return err; -} - -//----------------------------------- -OSErr CFileMgr::FindApplication(OSType sig, FSSpec& file) -// Finds application info given a file, based on file's creator -// Copied almost exactly from LaunchBySignature volume search -//----------------------------------- -{ - short sysVRefNum; - - OSErr err = CFileMgr::GetSysVolume(sysVRefNum); - if (err) - return err; // Find boot volume - - short vRefNum = sysVRefNum; // Start search with boot volume - short index = 0; - do { - if (index == 0 || vRefNum != sysVRefNum) { - Boolean hasDesktopDB; - err = CFileMgr::VolHasDesktopDB(vRefNum, hasDesktopDB); - if (err) - return err; - if (hasDesktopDB) { - // If volume has a desktop DB, - err = FindAppOnVolume(sig, vRefNum, file); // ask it to find app - if (err == noErr) - return err; -// else if (err != afpItemNotFound) on broken file systems, the error returned might be spurious -// return err; - } - } - err = CFileMgr::GetIndVolume(++index, vRefNum); // Else go to next volume - } while (err != nsvErr); // Keep going until we run out of vols - if( err==nsvErr || err==afpItemNotFound ) - err= fnfErr; // File not found on any volume - return err; -} - -//----------------------------------- -void SwapSlashColon(char * s) -// Swaps ':' with '/' -//----------------------------------- -{ - while ( *s != 0) - { - if (*s == '/') - *s++ = ':'; - else if (*s == ':') - *s++ = '/'; - else - *s++; - } -} - -//----------------------------------- -char* CFileMgr::EncodeMacPath( char* inPath, Boolean prependSlash ) -// Transforms Macintosh style path into Unix one -// Method: Swap ':' and '/', hex escape the result -//----------------------------------- -{ - if (inPath == NULL) - return NULL; - int pathSize = XP_STRLEN(inPath); - - // XP code sometimes chokes if there's a final slash in the unix path. - // Since correct mac paths to folders and volumes will end in ':', strip this - // first. - char* c = inPath + pathSize - 1; - if (*c == ':') - { - *c = 0; - pathSize--; - } - - char * newPath = NULL; - char * finalPath = NULL; - - if (prependSlash) - { - newPath = (char*) XP_ALLOC(pathSize + 2); - newPath[0] = ':'; // It will be converted to '/' - XP_MEMCPY(&newPath[1], inPath, pathSize + 1); - } - else - newPath = XP_STRDUP(inPath); - - if (newPath) - { - SwapSlashColon( newPath ); - finalPath = NET_Escape(newPath, URL_PATH); - XP_FREE(newPath); - } - - XP_FREE( inPath ); - return finalPath; -} // CFileMgr::EncodeMacPath - -//----------------------------------- -char * CFileMgr::GetURLFromFileSpec(const FSSpec& inSpec) -//----------------------------------- -/* GetURLFromFileSpec generates a local file URL given a file spec. - Requirements: - Unix-style file name (':' is replaced with '/') - url looks like file:/// - is mac path, where all reserved characters (= | ; | / | # | ? | space) - have been escaped. (except :). - ':' is then changed to '/' for compatibility with UNIX style file names. - - Input: - Valid FSSpec - - Method: - Generate a full path name - Notes: - This does not guarantee that the filename will work. We may still need to - munge it later (if for example such a filename already existed) -*/ -{ - char * path = PathNameFromFSSpec( inSpec, TRUE ); - char * unixPath = EncodeMacPath(path); - char * finalPath = (char*)XP_ALLOC(strlen(unixPath) + 8 + 1); // file:///0 - if ( finalPath == NULL ) - return NULL; - finalPath[0] = 0; - if ( unixPath == NULL ) - return NULL; - strcat(finalPath, "file://"); - strcat(finalPath, unixPath); - XP_FREE(unixPath); - return finalPath; -} - -//----------------------------------- -char* CFileMgr::MacPathFromUnixPath(const char* unixPath) -//----------------------------------- -{ - // Relying on the fact that the unix path is always longer than the mac path: - size_t len = XP_STRLEN(unixPath); - char* result = (char*)XP_ALLOC(len + 2); // ... but allow for the initial colon in a partial name - if (result) - { - char* dst = result; - const char* src = unixPath; - if (*src == '/') // ¥ full path - src++; - else if (strchr(src, '/')) // ¥ partial path, and not just a leaf name - *dst++ = ':'; - XP_STRCPY(dst, src); - NET_UnEscape(dst); // Hex Decode - SwapSlashColon(dst); - } - return result; -} // CFileMgr::MacPathFromUnixPath - -//----------------------------------- -OSErr CFileMgr::FSSpecFromLocalUnixPath( - const char * unixPath, - FSSpec * inOutSpec, - Boolean resolveAlias) -// File spec from URL. Reverses GetURLFromFileSpec -// Its input is only the part of the URL -// JRM 97/01/08 changed this so that if it's a partial path (doesn't start with '/'), -// then it is combined with inOutSpec's vRefNum and parID to form a new spec. -//----------------------------------- -{ - if (unixPath == NULL) - return badFidErr; - char* macPath = MacPathFromUnixPath(unixPath); - if (!macPath) - return memFullErr; - - OSErr err = noErr; - if (*unixPath == '/' /*full path*/) - err = FSSpecFromPathname(macPath, inOutSpec); - else - err = ::FSMakeFSSpec(inOutSpec->vRefNum, inOutSpec->parID, CStr255(macPath), inOutSpec); - if (err == fnfErr) - err = noErr; - Boolean dummy, dummy2; - if (err == noErr && resolveAlias) // Added - err = ::ResolveAliasFile(inOutSpec,TRUE,&dummy,&dummy2); - XP_FREE(macPath); - Assert_(err==noErr||err==fnfErr||err==dirNFErr||err==nsvErr); - return err; -} // CFileMgr::FSSpecFromLocalUnixPath - -Boolean CFileMgr::FileExists( const FSSpec& fsSpec ) -{ - FSSpec temp; - OSErr err; - - err = FSMakeFSSpec( fsSpec.vRefNum, fsSpec.parID, fsSpec.name, &temp ); - - return ( err == noErr ); -} - -Boolean CFileMgr::FileHasDataFork(const FSSpec& fsSpec ) -{ - CStr31 name = fsSpec.name; - CInfoPBRec pb; - pb.hFileInfo.ioNamePtr = name; - pb.hFileInfo.ioVRefNum = fsSpec.vRefNum; - pb.hFileInfo.ioDirID = fsSpec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - OSErr err = PBGetCatInfoSync(&pb); - if (err != noErr) - return FALSE; - else if (pb.hFileInfo.ioFlLgLen <= 0) - return FALSE; - else - return TRUE; -} -// Does the file have resource fork? -Boolean CFileMgr::FileHasResourceFork(const FSSpec& fsSpec ) -{ - CStr31 name = fsSpec.name; - CInfoPBRec pb; - pb.hFileInfo.ioNamePtr = name; - pb.hFileInfo.ioVRefNum = fsSpec.vRefNum; - pb.hFileInfo.ioDirID = fsSpec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - OSErr err = PBGetCatInfoSync(&pb); - if (err != noErr) - return FALSE; - else if (pb.hFileInfo.ioFlRLgLen <= 0) - return FALSE; - else - return TRUE; - -} - -void CFileMgr::CopyFSSpec(const FSSpec & srcSpec, FSSpec & destSpec) -{ - destSpec.vRefNum = srcSpec.vRefNum; - destSpec.parID = srcSpec.parID; - *(CStr31*)&destSpec.name = srcSpec.name; -} - - -// delete any items we may have left in the "Temporary Items" folder. -void CFileMgr::DeleteCommTemporaryItems() -{ - FSSpec commFolderSpec = {0}; // prototype filespec *within* the temp items folder - long tempItemsDirID; - short vRefNum; - OSErr err; - - err = ::FindFolder(kOnSystemDisk, kTemporaryFolderType, kDontCreateFolder, - &vRefNum, &tempItemsDirID); - if (err != noErr) return; //no temp items folder; do nothing - - if ( (noErr == ::FSMakeFSSpec(vRefNum, tempItemsDirID, "\pnscomm40", &commFolderSpec) ) && IsFolder(commFolderSpec) ) - { - // blow it away. This is recursive. - err = DeleteFolder(commFolderSpec); - } - - Assert_(err == noErr); -} - -OSErr CFileMgr::GetFolderID(FSSpec& folderSpec, long& dirID) -{ - CInfoPBRec pb; - pb.hFileInfo.ioNamePtr = folderSpec.name; - pb.hFileInfo.ioVRefNum = folderSpec.vRefNum; - pb.hFileInfo.ioDirID = folderSpec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - OSErr err = PBGetCatInfoSync(&pb); - if (err == noErr) - dirID = pb.dirInfo.ioDrDirID; - return err; -} - -OSErr CFileMgr::DeleteFolder(const FSSpec& folderSpec) -{ - CFileIter iter(folderSpec); - FSSpec nextFile; - FInfo finderInfo; - Boolean isFolder; - OSErr err = noErr; - OSErr storedErr = noErr; - - if (FileExists(folderSpec) == false) - return noErr; -// Delete all the items in the folder - while ( iter.Next(nextFile, finderInfo, isFolder) ) - { - if (isFolder) - err = DeleteFolder(nextFile); - else - err = ::FSpDelete(&nextFile); - if (err != noErr) - storedErr = err; - } -// Delete the folder - err = FSpDelete(&folderSpec); - if (err != noErr) - storedErr = err; - return storedErr; -} - -CFileIter::CFileIter(const FSSpec &folderSpec) -{ - fDir = folderSpec; - fIndex = 0; - - CInfoPBRec pb; - pb.hFileInfo.ioNamePtr = (unsigned char*)folderSpec.name; // cast avoids warning - pb.hFileInfo.ioVRefNum = folderSpec.vRefNum; - pb.hFileInfo.ioDirID = folderSpec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - OSErr err = PBGetCatInfoSync(&pb); - if (err == noErr) - { - fIndex = pb.dirInfo.ioDrNmFls; - fDir.parID = pb.dirInfo.ioDrDirID; - } -} - -Boolean CFileIter::Next(FSSpec &nextFile, FInfo& finderInfo, Boolean& folder) -{ -tryagain: - if (fIndex <= 0) - return FALSE; - - CInfoPBRec cipb; - DirInfo *dipb=(DirInfo *)&cipb; - dipb->ioCompletion = NULL; - dipb->ioFDirIndex = fIndex--; - dipb->ioVRefNum = fDir.vRefNum; - dipb->ioDrDirID = fDir.parID; - dipb->ioNamePtr = (StringPtr)&nextFile.name; - OSErr err = PBGetCatInfoSync (&cipb); - if (err != noErr) - goto tryagain; // Go backwards, skip the directories - if ((dipb->ioFlAttrib & 0x10) != 0) - folder = TRUE; - else - folder = FALSE; - nextFile.vRefNum = fDir.vRefNum; - nextFile.parID = fDir.parID; - Boolean dummy,wasAliased; - err = ::ResolveAliasFile(&nextFile,TRUE,&dummy,&wasAliased); - if ((err == noErr) && wasAliased) - { // Need to get info again - CInfoPBRec pb; - - pb.hFileInfo.ioNamePtr = (StringPtr)&nextFile.name; - pb.hFileInfo.ioVRefNum = nextFile.vRefNum; - pb.hFileInfo.ioDirID = nextFile.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - err = PBGetCatInfoSync(&pb); - finderInfo = pb.hFileInfo.ioFlFndrInfo; - if ((pb.hFileInfo.ioFlAttrib & 0x10) != 0) - folder = TRUE; - else - folder = FALSE; - } - else - finderInfo = cipb.hFileInfo.ioFlFndrInfo; - return TRUE; -} - - -OSErr CFileMgr::UpdateFinderDisplay(const FSSpec& inSpec) -{ - AliasHandle theAlias = NULL; - OSErr theErr = noErr; - - try - { - theErr = ::NewAlias(NULL, &inSpec, &theAlias); - ThrowIfOSErr_(theErr); - - FSSpec theFinderSpec; - ProcessSerialNumber theFinderPSN; - theErr = FindProcessBySignature('MACS', 'FNDR', theFinderPSN, &theFinderSpec); - ThrowIfOSErr_(theErr); - - StHandleLocker theAliasLocker((Handle)theAlias); - //LAEStream theEventStream('fndr', 'fupd', typeProcessSerialNumber, &theFinderPSN, sizeof( ProcessSerialNumber )); - //theEventStream.WriteKeyDesc(keyDirectObject, typeAlias, *theAlias, ::GetHandleSize((Handle)theAlias)); - //AppleEvent theEvent; - //theEventStream.Close(&theEvent); - //UAppleEventsMgr::SendAppleEvent(theEvent); - } - catch(...) - { - if (theAlias != NULL) - ::DisposeHandle((Handle)theAlias); - } - - return theErr; -} - -void CFileMgr::MakeAliasFile(const FSSpec& aliasSpec, const FSSpec& target) -{ - AliasHandle alias; - OSErr err = NewAlias( nil, &target, &alias ); - ThrowIfOSErr_(err); - - LFile aliasFile(aliasSpec); - aliasFile.CreateNewFile('MACS', kContainerFolderAliasType); - aliasFile.OpenResourceFork(fsRdWrPerm); - - AddResource((Handle) alias, 'alis', 0, nil); - - FInfo info; - err = ::FSpGetFInfo(&aliasSpec, &info); - ThrowIfOSErr_(err); - - info.fdFlags |= kIsAlias; - err = ::FSpSetFInfo(&aliasSpec, &info); - ThrowIfOSErr_(err); -} - -OSErr CFileMgr::CopyFile(const FSSpec& srcSpec, const FSSpec &dstDirSpec, const CStr255 ©Name) -{ - - return FSpFileCopy(&srcSpec, &dstDirSpec, (StringPtr)©Name, nil, 0, true); - -} - - -//----------------------------------------------------------------------------- -// More Utilities -//----------------------------------------------------------------------------- - -void WriteCString (LStream * s, const char * c) -{ - s->WriteData (c, strlen(c)); -} - -void -WriteChar (LStream * s, char c) -{ - s->WriteData (&c, 1); -} - -// -// fe_FileNameFromContext -// -// Suggest a name for this document based on its title or it's URL content type. If there -// are colons, be sure to swa[ them with / -// - -void fe_FileNameFromContext( MWContext* context, const char* url, CStr31& defaultName ) -{ -#ifdef MOZ_MAIL_NEWS - char* urlString; - - urlString = MimeGuessURLContentName( context, url ); - if ( urlString ) - { - SwapSlashColon( urlString ); - defaultName = urlString; - XP_FREE( urlString ); - } - else -#endif // MOZ_MAIL_NEWS - { - // If we have a context title and it's not an ftp URL - if (context && context->title && context->title[0] && - strncasecomp(url, "ftp://", 6)) - { - defaultName = context->title; - } - else - { - defaultName = CFileMgr::FileNameFromURL( url ); - } - } - - // now make sure the resulting name doesn't have any colons. - char buffer[50]; - short nextInsertPos = 0; - for ( short loop = 1; loop <= defaultName.Length(); loop++ ) - { - char currChar = defaultName[loop]; - if ( currChar != ':' ) - { - buffer[nextInsertPos] = currChar; - nextInsertPos++; - } - } // for each character - buffer[nextInsertPos] = NULL; // null terminate the new name - defaultName = buffer; // make the string w/out colons the default - -} // fe_FileNameFromContext - -OSErr FSSpecFromPathname_CWrapper(char * path, FSSpec * outSpec) -{ - return (CFileMgr::FSSpecFromPathname(path, outSpec)); -} diff --git a/mozilla/cmd/macfe/central/ufilemgr.h b/mozilla/cmd/macfe/central/ufilemgr.h deleted file mode 100644 index 9b2b3af5451..00000000000 --- a/mozilla/cmd/macfe/central/ufilemgr.h +++ /dev/null @@ -1,191 +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. - */ - -#pragma once -// =========================================================================== -// ufilemgr.h -// File manager utility routines. -// File manager class that takes care of temporary file management -// Created by atotic, June 15th, 1994 -// =========================================================================== - -#include -#include -#include "PascalString.h" - -class LFile; -struct CStr255; -class cstring; -typedef struct URL_Struct_ URL_Struct; -class LFileBufferStream; -typedef struct MWContext_ MWContext; - -struct AEDesc; -typedef AEDesc AEDescList; -typedef AEDescList AERecord; -typedef AERecord AppleEvent; - -void SwapSlashColon(char * s); -/***************************************************************************** - * class CFileMgr - * does general file routines. It provides many file utility functions, (as static) - * and keeps track of temporary files (throught sFileManager). - * It deletes temporary files as necessary. (disk overflow, on quit). - * To register a temporary file, call RegisterFile - * If registered file is deleted, call CancelRegister - * All registered files are deleted when application quits. - * Only one instance of the manager is created. (sFileManager global) - * THIS CLASS IS GETTING UNMANAGEABLE. SPLIT IT - *****************************************************************************/ -class CFileMgr; - -class CFileMgr { - LArray fFiles; // Registered files -public: - static CFileMgr sFileManager; // The manager - static unsigned int sMungeNum; // Number used to automatically generate a unique file name -// ¥¥ constructors/destructors - virtual ~CFileMgr(); - -// ¥¥ file management interface - - void RegisterFile(LFileBufferStream * inFile); // Register a file - void CancelRegister(LFileBufferStream * inFile ); // Cancel file registration. - void CancelAndDelete(LFileBufferStream * inFile ); // Cancels registration, and deletes the file. - - void HandleFindURLEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); -// ¥¥ utility functions, all static -// ¥¥ MacOS - // Generates file spec for a file that does not exist (not created yet) - // Used to create a new unique temporary files - static OSErr UniqueFileSpec(const FSSpec& inSpec, const CStr31& genericName, - FSSpec & outSpec); - // File spec for non-existent file. Name is based on URL - static OSErr NewFileSpecFromURLStruct (const char * location, - const FSSpec& inSpec, - FSSpec &outSpec); - // Does a volume have a desktop database - static OSErr VolHasDesktopDB (short vRefNum, Boolean& hasDesktop); - // Set file comment - static void FileSetComment (const FSSpec& file, const CStr255& comment); - // Get system volume - static OSErr GetSysVolume(short& vRefNum); - // Get volume by number (used for iteration, returns nsvErr when there are no more volumes) - static OSErr GetIndVolume(short index, short& vRefNum); - // Finds a writable folder inside a folder - static OSErr FindWFolderInFolder(short refNum, // Directory/folder to be searched - long dirID, - const CStr255 &folderName, // Name of the folder to search for - short * outRefNum,// Location of the found folder - long * outDirID); - // Creates a folder inside a folder - static OSErr CreateFolderInFolder(short refNum, // Parent directory/volume - long dirID, - const CStr255 &folderName, // Name of the new folder - short * outRefNum, // Location of the created folder - long * outDirID); - // Creates a folder spec from folder id; - static OSErr FolderSpecFromFolderID(short vRefNum, long dirID, FSSpec& folderSpec); - // Returns a full pathname to the given file - static char * PathNameFromFSSpec(const FSSpec& inSpec, Boolean wantLeafName ); - // PathNameFromFSSpec + hex encoding - static char * EncodedPathNameFromFSSpec(const FSSpec& inSpec, Boolean wantLeafName ); - // Returns file spec from full pathname - static OSErr FSSpecFromPathname(const char * PathNamePtr, FSSpec* outSpec); - // Changes the creator/file - static OSErr SetFileTypeCreator(OSType creator, OSType type, const FSSpec * fileSpec); - // Set or clear a finder flag for the file (e.g. custom icon bit) - static OSErr SetFileFinderFlag(const FSSpec& fileSpec, Uint16 flagMask, Uint8 value); - // Is this FSSpec a folder? - static Boolean IsFolder(const FSSpec& spec); - // delete any files we left behind in the Temporary Items folder - static void DeleteCommTemporaryItems(); - // Force the Finder to refresh a window - static OSErr UpdateFinderDisplay(const FSSpec& spec); - // Creates an alias file with a given name/location pointing to the specified target - static void MakeAliasFile(const FSSpec& aliasSpec, const FSSpec& target); - // Copy a file - static OSErr CopyFile(const FSSpec& srcSpec, const FSSpec &dstDirSpec, const CStr255 ©Name); - -// ¥¥ Application searching - - // Finds an application given a its sig. Returns err if app is not found - // Copied almost exactly from LaunchBySignature volume search in MacApp - static OSErr FindApplication(OSType sig, FSSpec& file); - // Finds app on given volume - static OSErr FindAppOnVolume(OSType sig, short vRefNum, FSSpec& thefile); - -// ¥¥ÊWWW utilities - // Given a URL, it returns a 'reasonable' file name - static CStr31 FileNameFromURL (const char * url); - // Returns a URL corresponding to the file spec. (See code for more info) - static char * GetURLFromFileSpec(const FSSpec &inSpec); - // Encodes the Macintosh full path with hex escapes - static char * EncodeMacPath(char * path, Boolean prependSlash = true); - // Decodes the Macintosh full path from one encoded with EncodeMacPath - static char * DecodeMacPath(char * path); - // File spec from URL. Reverses GetURLFromFileSpec - static OSErr FSSpecFromLocalUnixPath(const char * url, FSSpec * outSpec, Boolean resolveAlias = true); - // Convert a unix path into a mac one. Called by FSSpecFromLocalUnixPath(). - static char* MacPathFromUnixPath(const char* unixPath); - -// Misc file utilities - - // Does the file exist? - static Boolean FileExists( const FSSpec& fsSpec ); - // Does the file have data fork? - static Boolean FileHasDataFork(const FSSpec& fsSpec ); - // Does the file have resource fork? - static Boolean FileHasResourceFork(const FSSpec& fsSpec ); - // Just does an FSSpec copy, because we cannot do assignments with them - static void CopyFSSpec(const FSSpec & srcSpec, FSSpec & destSpec); - // Given a folder FSSpec, returns a folder ID - static OSErr GetFolderID(FSSpec& folderSpec, long& dirID); - // Recursively, deletes a folder - // if noErr, deletion was successful - // otherwise, returns the last encountered error when deleting - static OSErr DeleteFolder(const FSSpec& folderSpec); -}; - -// Iterates through all the files inside the folder. -// Does not deal with deletions during iteration -class CFileIter { -public: - CFileIter(const FSSpec &folderSpec); - ~CFileIter(){}; - Boolean Next(FSSpec &nextFile); - Boolean Next(FSSpec &nextFile, FInfo& finderInfo, Boolean& folder); -private: - FSSpec fDir; - short fIndex; // Index for looping -}; - -//----------------------------------------------------------------------------- -// More Utilities -//----------------------------------------------------------------------------- - -void -WriteCString (LStream * s, const char * c); - -void -WriteChar (LStream * s, char c); - -void fe_FileNameFromContext( MWContext* context, const char* url, CStr31& defaultName ); diff --git a/mozilla/cmd/macfe/central/umimemap.cp b/mozilla/cmd/macfe/central/umimemap.cp deleted file mode 100644 index 662dd07e7dc..00000000000 --- a/mozilla/cmd/macfe/central/umimemap.cp +++ /dev/null @@ -1,1173 +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. - */ - -// umimemap.cp -// CMimeMapper class and CMimeList -// Created by atotic, June 6th, 1994 -// =========================================================================== - -// Front End -#include "umimemap.h" -#include "macutil.h" -#include "resae.h" -#include "uapp.h" -#include "CAppleEventHandler.h" -#include "ulaunch.h" -#include "ufilemgr.h" -#include "uprefd.h" -#include "resgui.h" -#include "BufferStream.h" - -// Netscape -#include "client.h" -#include "net.h" -// stdc -#include - -#include "uerrmgr.h" -#include "prefapi.h" - -//---------------------------------------------------------------------- -// class CMimeMapper -//---------------------------------------------------------------------- - - // ¥¥ Constructors/destructors - -// Initialize all the variables to defaults -// Every initializer calls it -void CMimeMapper::InitMapper() -{ - fTemporary = false; // This is only a temporary mapper - fRegisteredViewer = false; // This is a registered viewer, use all the special codes - fTempAppSig = '????'; // Application - fTempFileType = '????'; // File signature - fFromOldPrefs = false; // Was this mapper from pre-plugin prefs? - fLatentPlugin = false; // Was the plug-in disabled because itÕs missing? - fLoadAction = CMimeMapper::Unknown; - fBasePref = nil; // Corresponding XP pref branch name - fIsLocked = false; // was this locked by Mission Control (disables edit and delete) - fNumChildrenFound = 0; - fFileFlags = 0; -} - - -Boolean -CMimeMapper::NetscapeCanHandle(const CStr255& mimeType) -{ - return ((mimeType == IMAGE_GIF) || - (mimeType == IMAGE_JPG) || - (mimeType == IMAGE_XBM) || - (mimeType == IMAGE_PNG) || - (mimeType == APPLICATION_BINHEX) || - (mimeType == HTML_VIEWER_APPLICATION_MIME_TYPE) || - (mimeType == APPLICATION_PRE_ENCRYPTED) || - (mimeType == TEXT_PLAIN)); -} - - -// ¥¥ XP Prefs -// -// CMimeMapper is technically now redundant because all the information -// it contains is also reflected in xp prefs. Keeping duplicate -// structures is not ideal but it's minimal-impact. -// -// The xp pref routines are: -// - CreateMapperFor: creates a mapper corresponding to a specific -// xp mime pref (e.g. mime.image_gif) -// - ReadMimePref: converts an xp pref to a mapper (called from -// CreateMapperFor, and when xp prefs are updated by auto-config). -// - WriteMimePref: converts a mapper to its xp pref representation -// (called when initializing 3.0-format preferences, after editing -// a mime type from its pref UI, and when registering plug-ins). - -static const char* Pref_MimeType = ".mimetype"; -static const char* Pref_AppName = ".mac_appname"; -static const char* Pref_AppSig = ".mac_appsig"; -static const char* Pref_FileType = ".mac_filetype"; -static const char* Pref_Extension = ".extension"; -static const char* Pref_PluginName = ".mac_plugin_name"; -static const char* Pref_Description = ".description"; -static const char* Pref_LoadAction = ".load_action"; -static const char* Pref_LatentPlugin = ".latent_plug_in"; -static const char* Pref_FileFlags = ".file_flags"; - -#ifdef ANTHRAX -static const char* Pref_AppletName = ".applet"; -#endif - -// CreateMapperFor converts an xp pref name into a mimetype mapper. -// Finds an existing mapper or creates a new one, and -// populates its fields from user pref values. -CMimeMapper* CMimeMapper::CreateMapperFor( const char* basepref, Boolean newPrefFormat ) -{ - CMimeMapper* mapper = CPrefs::sMimeTypes.FindBasePref(basepref); - - if (mapper) { - mapper->ReadMimePrefs(); - return NULL; // already exists; caller doesn't use it. - } - else { - mapper = new CMimeMapper(basepref); - // FromOldPrefs triggers plug-ins to install themselves as preferred viewers - mapper->fFromOldPrefs = !newPrefFormat; - - // Throw out this mime mapper if we didn't find any useful info about it in prefs - if (mapper->GetNumChildrenFound() <= 0) - { - delete mapper; - return NULL; - } - else - return mapper; - } -} - -// CreateMapperForRes converts a 3.0-format mime resource -// into both a mimetype mapper and xp prefs. -CMimeMapper* CMimeMapper::CreateMapperForRes(Handle res) -{ - SInt8 flags = ::HGetState(res); - ::HNoPurge(res); - - CMimeMapper* mapper = new CMimeMapper( res ); - ::HSetState(res, flags); - - if (mapper->fMimeType == HTML_VIEWER_APPLICATION_MIME_TYPE) { - mapper->SetLoadAction(CPrefs::sViewSourceInline ? Internal : Launch); - } - - mapper->WriteMimePrefs(false); // convert to xp format - - mapper->SetDefaultDescription(); - - return mapper; -} - - -// Constructor to build mapper from xp prefs -CMimeMapper::CMimeMapper( const char* basepref ) -{ - InitMapper(); - - fBasePref = XP_STRDUP(basepref); - if (strlen(fBasePref) > 200) - fBasePref[200] = '\0'; - ReadMimePrefs(); - - SetDefaultDescription(); -} - -// Copies an xp mimetype pref into the mapper -void CMimeMapper::ReadMimePrefs() -{ - int err; - int size = 256, - actualSize; - char value[256]; - - fAppSig = 0; - - fNumChildrenFound = 0; // keep track of how many mapper prefs we successfully read in from prefs file - - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_AppSig), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - - // values stored as binary (Base64) will always be longer than 4 bytes - // so if the string is 4 bytes long (or shorter), it's a straight character string - actualSize = strlen(value); - if (actualSize <= sizeof(OSType)) - ::BlockMoveData(value, (Ptr) &fAppSig, actualSize ); - else - { - err = PREF_GetBinaryPref ( CPrefs::Concat( fBasePref, Pref_AppSig ), value, &size); - if (PREF_NOERROR == err) - ::BlockMoveData( value, (Ptr) &fAppSig, sizeof(OSType) ); - } - } - - fFileType = 0; - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_FileType), value, &size ); - if (PREF_NOERROR == err) - { - // see notes above for fAppSig - fNumChildrenFound++; - - actualSize = strlen(value); - if (actualSize <= sizeof(OSType)) - ::BlockMoveData( value, (Ptr) &fFileType, actualSize ); - else - { - err = PREF_GetBinaryPref ( CPrefs::Concat( fBasePref, Pref_FileType ), value, &size); - if (PREF_NOERROR == err) - ::BlockMoveData( value, (Ptr) &fFileType, sizeof(OSType) ); - } - } - -#ifdef ANTHRAX - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_AppletName), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fAppletName = value; - } -#endif - - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_AppName), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fAppName = value; - } - - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_MimeType), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - - fMimeType = value; - - if (PREF_PrefIsLocked(CPrefs::Concat(fBasePref,Pref_MimeType))) //for mission control - this is a convienient place to check this - fIsLocked = true; - } - - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_Extension), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fExtensions = value; - } - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_PluginName), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fPluginName = value; - } - - err = PREF_GetCharPref( CPrefs::Concat(fBasePref, Pref_Description), value, &size ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fDescription = value; - } - int32 intvalue; - err = PREF_GetIntPref( CPrefs::Concat(fBasePref, Pref_LoadAction), &intvalue ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fLoadAction = (LoadAction) intvalue; - } - err = PREF_GetIntPref( CPrefs::Concat(fBasePref, Pref_FileFlags), &intvalue ); - if (PREF_NOERROR == err) - { - fFileFlags = intvalue; - } - - XP_Bool boolvalue; - err = PREF_GetBoolPref( CPrefs::Concat(fBasePref, Pref_LatentPlugin), &boolvalue ); - if (PREF_NOERROR == err) - { - fNumChildrenFound++; - fLatentPlugin = (Boolean) boolvalue; - } - -} - -// -- For 3.0 format compatability -- -// Initializes off a resource handle of one of the mime types. -// See pref.r for resource definition -// The memory layout of the resource is very important. -#define NAME_LENGTH_OFFSET 9 -CMimeMapper::CMimeMapper( Handle resRecord ) -{ - ThrowIfNil_(resRecord); - Size size = ::GetHandleSize(resRecord); - InitMapper(); - - char temp[256]; - Ptr resPtr = *resRecord; - Byte lengthByte = 0; - long offset = 0; - - ThrowIf_(size < 9); - ::BlockMoveData( resPtr, (Ptr)&fAppSig, 4 ); - ::BlockMoveData( resPtr + 4, (Ptr)&fFileType, 4 ); - uint32 loadAction = *((unsigned char*) (resPtr + 8)); - fLoadAction = (LoadAction) loadAction; - - offset = NAME_LENGTH_OFFSET; - ThrowIf_(offset > size); - // ¥ read the application name - lengthByte = resPtr[ offset ]; - ThrowIf_(lengthByte > 255); - ::BlockMoveData( &resPtr[ offset + 1 ], (Ptr)temp, lengthByte ); - - temp[ lengthByte ] = 0; - - fAppName = temp; - - // ¥ read in the MIME type - offset += ( lengthByte + 1 ); - ThrowIf_(offset > size); - lengthByte = resPtr[ offset ]; - ::BlockMoveData( &resPtr[ offset + 1 ], temp, lengthByte ); - - temp[ lengthByte ] = 0; - - fMimeType = temp; - - // ¥ read in the extensions string - offset += ( lengthByte + 1 ); - ThrowIf_(offset > size); - lengthByte = resPtr[ offset ]; - ThrowIf_(lengthByte > 255); - ::BlockMove ( &resPtr[ offset + 1 ], temp, lengthByte ); - - temp[ lengthByte ] = 0; - - fExtensions = temp; - - // ¥ read in the plug-in name string - // Since the plug-in name doesn't exist in 2.0-vintage prefs resources, make - // sure to check that there is still data left in the handle before proceeding. - offset += ( lengthByte + 1 ); - if (offset < size) - { - lengthByte = resPtr[ offset ]; - ThrowIf_(lengthByte > 255); - ::BlockMove ( &resPtr[ offset + 1 ], temp, lengthByte ); - temp[ lengthByte ] = 0; - fPluginName = temp; - - // Now read the description string (it too could be non-existant) - offset += ( lengthByte + 1 ); - if (offset < size) - { - lengthByte = resPtr[ offset ]; - ThrowIf_(lengthByte > 255); - ::BlockMove ( &resPtr[ offset + 1 ], temp, lengthByte ); - temp[ lengthByte ] = 0; - fDescription = temp; - - // Last, read the "latent plug-in" flag (if it exists) - offset += ( lengthByte + 1 ); - if (offset < size) - { - Boolean latentPlugin = *((unsigned char*) (resPtr + offset)); - XP_ASSERT(latentPlugin == 0 || latentPlugin == 1); - fLatentPlugin = latentPlugin; - } - } - } - else - { - fPluginName = ""; - fFromOldPrefs = true; // No plug-in info in these prefs - } -} - -// -// For old prefs that don't have a description stored in the handle, -// look up the default description in netlib, defaulting to just the -// MIME type itself if it can't be found. This description will then -// get written out to the prefs so it can be edited and saved by the user. -// -void CMimeMapper::SetDefaultDescription() -{ - if (fMimeType == HTML_VIEWER_APPLICATION_MIME_TYPE) - return; - - if (fNumChildrenFound <= 0 && fMimeType == CStr255::sEmptyString) // this means the pref did not even come with a mime type, so we ignore it. - return; - - CStr255 description; - char* mimetype = (char*) fMimeType; - NET_cdataStruct* cdata = NULL; - XP_List* list_ptr = cinfo_MasterListPointer(); - while ((cdata = (NET_cdataStruct*) XP_ListNextObject(list_ptr)) != NULL) - if (strcasecomp(mimetype, cdata->ci.type) == 0) - break; - - if (cdata && cdata->ci.desc) - description = cdata->ci.desc; - else - description = fMimeType; - - if (fDescription == CStr255::sEmptyString) { - fDescription = description; - CPrefs::SetModified(); - } - - PREF_SetDefaultCharPref( CPrefs::Concat(fBasePref, Pref_Description), description ); -} - - -// Duplicate -CMimeMapper::CMimeMapper( const CMimeMapper& clone ) -{ - InitMapper(); - fMimeType = clone.fMimeType; - fAppName = clone.fAppName; - fAppSig = clone.fAppSig; - fFileType = clone.fFileType; - fLoadAction = clone.fLoadAction; - fExtensions = clone.fExtensions; - - fTemporary = clone.fTemporary; - fRegisteredViewer = clone.fRegisteredViewer; - fTempAppSig = clone.fTempAppSig; // Application - fTempFileType = clone.fTempFileType; // File signature - - fPluginName = clone.fPluginName; - fFromOldPrefs = clone.fFromOldPrefs; - fDescription = clone.fDescription; - fLatentPlugin = clone.fLatentPlugin; - fFileFlags = clone.fFileFlags; - fBasePref = clone.fBasePref ? XP_STRDUP(clone.fBasePref) : nil; - - fIsLocked = clone.fIsLocked; - - fNumChildrenFound = clone.fNumChildrenFound; - -#ifdef ANTHRAX - fAppletName = clone.fAppletName; -#endif -} - -// Copies values from the mapper to xp user pref tree. -void CMimeMapper::WriteMimePrefs( Boolean ) -{ - if (fBasePref == nil) { - // Convert mime type to a pref-name string with - // non-alpha chars replaced with underscores - char typecopy[256]; - strcpy(typecopy, "mime."); - int start = strlen(typecopy); - strncat(typecopy, (char*) fMimeType, 200); - for (int i = start; i < strlen(typecopy); i++) - if (!isalnum(typecopy[i])) - typecopy[i] = '_'; - - // Mimetype may be blank, so pick an arbitrary name - if (fMimeType.Length() == 0) - strcat(typecopy, "unknown_type_999"); - - fBasePref = XP_STRDUP(typecopy); - } - - char appsig[sizeof(OSType)+1], filetype[sizeof(OSType)+1]; - appsig[sizeof(OSType)] = '\0'; - ::BlockMoveData( (Ptr) &fAppSig, appsig, sizeof(OSType) ); - filetype[sizeof(OSType)] = '\0'; - ::BlockMoveData( (Ptr) &fFileType, filetype, sizeof(OSType) ); - - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_Extension), fExtensions ); - fNumChildrenFound++; // since we are creating children prefs, we should keep this record updated - if (fDescription.Length() > 0) - { - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_Description), fDescription ); - fNumChildrenFound++; - } - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_MimeType), fMimeType ); - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_AppName), fAppName ); - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_PluginName), fPluginName ); -#ifdef ANTHRAX - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_AppletName), fAppletName ); - ++fNumChildrenFound; -#endif - fNumChildrenFound += 3; - // store appsig and filetype as 4-byte character strings, if possible. - // otherwise, store as binary. - if (PrintableChars( &appsig, sizeof(OSType))) - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_AppSig), appsig ); - else - PREF_SetBinaryPref( CPrefs::Concat(fBasePref, Pref_AppSig), appsig, sizeof(OSType)); - if (PrintableChars( &filetype, sizeof(OSType))) - PREF_SetCharPref( CPrefs::Concat(fBasePref, Pref_FileType), filetype ); - else - PREF_SetBinaryPref( CPrefs::Concat(fBasePref, Pref_FileType), filetype, sizeof(OSType)); - PREF_SetIntPref( CPrefs::Concat(fBasePref, Pref_LoadAction), fLoadAction ); - PREF_SetBoolPref( CPrefs::Concat(fBasePref, Pref_LatentPlugin), (XP_Bool) fLatentPlugin ); - PREF_SetIntPref ( CPrefs::Concat(fBasePref, Pref_FileFlags ), fFileFlags ); - fNumChildrenFound += 4; -} - -CMimeMapper::CMimeMapper( - LoadAction loadAction, - const CStr255& mimeType, - const CStr255& appName, - const CStr255& extensions, - OSType appSignature, - OSType fileType ) -{ - fLoadAction = loadAction; - fMimeType = mimeType; - fAppName = appName; - fAppSig = appSignature; - fFileType = fileType; - fExtensions = extensions; - - fTemporary = false; - fRegisteredViewer = false; - fPluginName = ""; - fDescription = ""; - fLatentPlugin = false; - fBasePref = nil; -#ifdef ANTHRAX - fAppletName = ""; -#endif -} - -// Disposes of all allocated structures -CMimeMapper::~CMimeMapper() -{ - if (fBasePref) - free (fBasePref); -} - -CMimeMapper & CMimeMapper::operator= (const CMimeMapper& mapper) -{ - fMimeType = mapper.fMimeType; - fAppName = mapper.fAppName; - fAppSig = mapper.fAppSig; - fFileType = mapper.fFileType; - fLoadAction = mapper.fLoadAction; - fPluginName = mapper.fPluginName; - fFromOldPrefs = mapper.fFromOldPrefs; - fDescription = mapper.fDescription; - fLatentPlugin = mapper.fLatentPlugin; - fFileFlags = mapper.fFileFlags; -#ifdef ANTHRAX - fAppletName = mapper.fAppletName; -#endif - return *this; -} - -#ifdef ANTHRAX -void CMimeMapper::SetAppletName(const CStr255& newAppletName) -{ - fAppletName = newAppletName; -} -#endif /* ANTHRAX */ - -void CMimeMapper::SetAppName(const CStr255& newName) -{ - fAppName = newName; -} - -void CMimeMapper::SetMimeType(const CStr255& newType) -{ - fMimeType = newType; -} - -void CMimeMapper::SetAppSig(OSType newSig) -{ - fAppSig = newSig; -} - -void CMimeMapper::SetAppSig(FSSpec& appSpec) -{ - FInfo finderInfo; - OSErr err = FSpGetFInfo(&appSpec, &finderInfo ); - ThrowIfOSErr_(err); - fAppSig = finderInfo.fdCreator; -} - -void CMimeMapper::SetExtensions(const CStr255& newExtensions) -{ - fExtensions = newExtensions; - SyncNetlib(); -} - -void CMimeMapper::SetDocType(OSType newType) -{ - fFileType = newType; -} - -void CMimeMapper::SetLoadAction(LoadAction newAction) -{ - // - // If the user explicitly changed the load action, - // cancel the latent plug-in setting so their choice - // is maintained persistently. - // - fLatentPlugin = false; - - // - // If the user explicitly changed the load action, - // cancel the registration of an external viewer. - // - fRegisteredViewer = false; - - fLoadAction = newAction; - SyncNetlib(); -} - -void CMimeMapper::SetLatentPlugin() -{ - fLatentPlugin = true; - fLoadAction = CMimeMapper::Unknown; -} - - -void CMimeMapper::RegisterViewer(OSType tempAppSig, OSType tempFileType) -{ - fTempAppSig = tempAppSig; // Application - fTempFileType = tempFileType; // File signature - fRegisteredViewer = TRUE; - CFrontApp::RegisterMimeType(this); -} - -void CMimeMapper::UnregisterViewer() -{ - fRegisteredViewer = FALSE; - CFrontApp::RegisterMimeType(this); -} - -// Typical Spy apple event creation routine. -// It creates the event, with two arguments, URL and the MIME type. -// URL type is stored as attribute urlAttribute, MIME type as AE_spy_viewDocFile_mime -OSErr CMimeMapper::MakeSpyEvent(AppleEvent & event, - URL_Struct * request, - AEEventID id, - AEKeyword urlAttribute) -{ - OSErr err; - Try_ - { - AEAddressDesc targetApp; - - // Specify the application, and create the event - { - err = ::AECreateDesc(typeApplSignature, &fTempAppSig, - sizeof(fTempAppSig), &targetApp); - ThrowIfOSErr_(err); - OSErr err = ::AECreateAppleEvent(AE_spy_send_suite, id, - &targetApp, - kAutoGenerateReturnID, - kAnyTransactionID, - &event); - ::AEDisposeDesc(&targetApp); - } - // URL - { - AEDesc urlDesc; - err = ::AECreateDesc(typeChar, request->address, strlen(request->address), &urlDesc); - ThrowIfOSErr_(err); - - err = ::AEPutParamDesc(&event, urlAttribute, &urlDesc); - ThrowIfOSErr_(err); - ::AEDisposeDesc(&urlDesc); - } - // MIME type - if (request->content_type) - { - AEDesc mimeDesc; - err = ::AECreateDesc(typeChar, request->content_type, strlen(request->content_type), &mimeDesc); - ThrowIfOSErr_(err); - err = ::AEPutParamDesc(&event, AE_spy_queryViewer_mime, &mimeDesc); - ::AEDisposeDesc(&mimeDesc); - } - } - Catch_(inErr) - { return inErr; - } - EndCatch_ - return noErr; -} - -/* Returns whether the contents of inBuffer are all visible, printable characters. - Actually, that's a misnomer ... it returns whether the contents are printable - on a Macintosh, which we define to be "not control characters." This is intended - for determining whether a binary buffer can be stored as a text string, or needs - to be encoded. */ -Boolean CMimeMapper::PrintableChars(const void *inBuffer, Int32 inLength) -{ - unsigned char *buffer = (unsigned char *) inBuffer, - *bufferEnd = buffer + inLength; - - while (buffer < bufferEnd) - { - if (*buffer <= 0x20) - break; - buffer++; - } - return buffer == bufferEnd; -} - -// if we have a registered viewer, query it for a file spec -OSErr CMimeMapper::GetFileSpec(URL_Struct * request, - FSSpec & destination) -{ - OSErr err = noErr; - if (!fRegisteredViewer) - return fnfErr; - else - Try_ - { - AppleEvent queryViewerEvent; - - err = MakeSpyEvent(queryViewerEvent, request,AE_spy_queryViewer, - keyDirectObject); // URL is the direct object - // Send the event - AppleEvent reply; - err = ::AESend(&queryViewerEvent,&reply,kAEWaitReply,kAEHighPriority,600,nil, nil); - ThrowIfOSErr_(err); - // Handle the reply. We want to get out the transaction ID - { - DescType realType; - Size actualSize; - if (!MoreExtractFromAEDesc::DisplayErrorReply(reply)) - { - err = ::AEGetParamPtr(&reply, keyAEResult, typeFSS, - &realType, &destination, sizeof(destination), - &actualSize); - ThrowIfOSErr_(err); - } - else - Throw_(fnfErr); - ::AEDisposeDesc(&reply); - } - } - Catch_(inErr) - { - return inErr; - } EndCatch_ - return noErr; -} - -// If we have a registered viewer, use ViewDocFile -// if anything fails, or we have no viewer, use ordinary launch sequence -OSErr CMimeMapper::LaunchFile(LFileBufferStream * inFile, URL_Struct * request, Int32 windowID) -{ - OSErr err; - if (fRegisteredViewer) - { - Try_ - { - AppleEvent viewDocEvent; - // AppleEvent(fileSpec, URL, MIME, windowID) - // Create the event, with MIME and URL arguments - err = MakeSpyEvent(viewDocEvent, request,AE_spy_viewDocFile, - AE_spy_viewDocFile_url); // URL is the direct object - ThrowIfOSErr_(err); - // Make the file spec - FSSpec fileSpec; - inFile->GetSpecifier(fileSpec); - err = ::AEPutParamPtr(&viewDocEvent,keyDirectObject,typeFSS,&fileSpec,sizeof(fileSpec)); - ThrowIfOSErr_(err); - // URL - if (request->address) - { - err = ::AEPutParamPtr(&viewDocEvent,AE_spy_viewDocFile_url, typeChar, request->address,strlen(request->address)); - ThrowIfOSErr_(err); - } - // MIME type - { - StAEDescriptor mimeDesc((StringPtr)fMimeType); - err = ::AEPutParamDesc(&viewDocEvent,AE_spy_viewDocFile_mime,&mimeDesc.mDesc); - ThrowIfOSErr_(err); - } - // WindowID - { - StAEDescriptor windowDesc(windowID); - err = ::AEPutParamDesc(&viewDocEvent,AE_spy_viewDocFile_wind, &windowDesc.mDesc); - ThrowIfOSErr_(err); - } - // Send the event - AppleEvent reply; - err = ::AESend(&viewDocEvent,&reply,kAEWaitReply,kAEHighPriority,60,nil, nil); - if (err != errAETimeout) - ThrowIfOSErr_(err); - // If we got an error code back, launch as usual - if (reply.descriptorType != typeNull) - { - DescType realType; - Size actualSize; - long errNumber; - err = ::AEGetParamPtr(&reply, keyErrorNumber, typeLongInteger, - &realType, &errNumber, sizeof(errNumber), - &actualSize); - if ((err == noErr) && (errNumber != noErr)) - Throw_(errNumber); - } - } - Catch_(inErr) - { - // Launch through ViewDoc failed, use our original creator and launch as usual - FSSpec fileSpec; - inFile->GetSpecifier(fileSpec); - err = CFileMgr::SetFileTypeCreator(fAppSig, fFileType, &fileSpec); - ::LaunchFile(inFile); - } - EndCatch_ - } - else - ::LaunchFile(inFile); - return noErr; -} - - -void CMimeMapper::SyncNetlib() -{ - CFrontApp::RegisterMimeType(this); -} - -//---------------------------------------------------------------------- -// class CMimeList -//---------------------------------------------------------------------- - - // ¥¥ Constructors/destructors - -CMimeList::CMimeList() : LArray() -{ -} - -CMimeList::~CMimeList() -{ -} - - // ¥¥ÊUtility functions -// Overrode this on the assumption that every time you add a MIME mapper -// to this list, you want to sync up the netlib -ArrayIndexT CMimeList::InsertItemsAt( - Uint32 inCount, - ArrayIndexT inAtIndex, - const void *inItem, - Uint32 inItemSize) - -{ - ArrayIndexT result = LArray::InsertItemsAt(inCount,inAtIndex,inItem, inItemSize); - CMimeMapper ** mapperPtr = (CMimeMapper **)inItem; - (*mapperPtr)->SyncNetlib(); - return result; -} - -// Deletes all the items in the list -void CMimeList::DeleteAll(Boolean) -{ - CMimeMapper* oldMap; - for ( short i = 1; i <= mItemCount; i++ ) - { - FetchItemAt( i, &oldMap ); - delete oldMap; - } - RemoveItemsAt( mItemCount,1); -} - -// Finds a CMimeMapper with a given XP pref branch name. -CMimeMapper* CMimeList::FindBasePref( const char* basepref ) -{ - CMimeMapper* foundMap = NULL; - for ( Int32 i = mItemCount; i >= 1; i-- ) - { - CMimeMapper* oldMap; - FetchItemAt( i, &oldMap ); - if ( oldMap->GetBasePref() != NULL && - XP_STRCMP(oldMap->GetBasePref(), basepref) == 0 ) - { - foundMap = oldMap; - break; - } - } - return foundMap; -} - - -// Finds a CMimeMapper with a given mimeType. NULL if none -// Search is linear. Might want to make it faster -CMimeMapper* CMimeList::FindMimeType( char* mimeType ) -{ - if ( mimeType == NULL ) - return NULL; - - CMimeMapper* foundMap = NULL; - for ( Int32 i = 1; i <= mItemCount; i++ ) - { - CMimeMapper* oldMap; - FetchItemAt( i, &oldMap ); - // MIME types are defined to be case insensitive - if ( XP_STRCASECMP (oldMap->GetMimeName(), mimeType) == 0 ) - { - foundMap = oldMap; - break; - } - } - return foundMap; -} - -// Find a "built-in" mime type, which were separate in 3.0 -// but are integrated into the 4.0 mimetype list. -CMimeMapper* CMimeList::FindMimeType(BuiltIn mimeBuiltin) -{ - char* mimetype = nil; - switch (mimeBuiltin) { - case HTMLViewer: - mimetype = HTML_VIEWER_APPLICATION_MIME_TYPE; - break; - case Telnet: - mimetype = TELNET_APPLICATION_MIME_TYPE; - break; - case Tn3270: - mimetype = TN3270_VIEWER_APPLICATION_MIME_TYPE; - break; - } - return FindMimeType(mimetype); -} - - -// FindMimeType finds a Mime mapper that -// matches this file's type and creator -// Algorithm is inexact -// TEXT files are not typed because netlib figures out the -// HTML files, and hqx ones have the extension -// Look for exact match. -// If not found, look for inexact one - -// I don't like the above algorithm. There is no way of telling what type of match occured. In -// cases other than exact or FileType match the results are unsatisfactory. -// New behavoir is to return NULL and let the caller call CMimeList::FindCreatorFindCreator if -// needed. Provides a way to hand off to IC if needed. -CMimeMapper* CMimeList::FindMimeType(const FSSpec& inFileSpec) -{ - FInfo fndrInfo; - - OSErr err = FSpGetFInfo( &inFileSpec, &fndrInfo ); - if ((err != noErr) || (fndrInfo.fdType == 'TEXT')) - return NULL; - - CMimeMapper* fileTypeMatch = NULL; - - // Find the cinfo (which gives us the MIME type) for this file name - NET_cinfo* cinfo = NET_cinfo_find_type((CStr255)inFileSpec.name); - - for (Int32 i = 1; i <= mItemCount; i++) - { - CMimeMapper* map; - FetchItemAt(i, &map); - - // - // If this MIME type is configured for a plug-in, see if it matches - // the MIME type of the file (based on the file extension -> MIME - // type mapping). If not, try for an exact or partial match based - // on type and/or creator. bing: If we decide to support Mac file - // types for plug-ins, we should check the file type here. - // -#ifdef ANTHRAX - if(map->GetLoadAction() == CMimeMapper::Plugin || - map->GetLoadAction() == CMimeMapper::Applet) -#else - if (map->GetLoadAction() == CMimeMapper::Plugin) -#endif /* ANTHRAX */ - { - if (cinfo && (map->GetMimeName() == cinfo->type)) - return map; - } - else if ((map->GetAppSig() == fndrInfo.fdCreator) && - (map->GetDocType() == fndrInfo.fdType) && - !(map->GetFileFlags() &ICmap_not_outgoing_mask) ) - return map; - else - { - #if 0 - if (map->GetAppSig() == fndrInfo.fdCreator) - creatorMatch = map; - #endif - if (map->GetDocType() == fndrInfo.fdType && !(map->GetFileFlags() &ICmap_not_outgoing_mask) ) - fileTypeMatch = map; - } - } - - return fileTypeMatch; -} - - -// FindCreator finds a CMimeMapper whose application signature -// matches appSig -CMimeMapper* CMimeList::FindCreator(OSType appSig) -{ - CMimeMapper * foundMap = NULL; - for (Int32 i = 1; i <= mItemCount; i++) - { - CMimeMapper* oldMap; - FetchItemAt(i, &oldMap); - if (oldMap->GetAppSig() == appSig) - { - foundMap = oldMap; - break; - } - } - return foundMap; -} - -// ------------------------- Apple Event handling ------------------------------- - -// HandleRegisterViewerEvent -// registers a viewer. -// If the MIME type does not exist, we create one on the fly -void CMimeList::HandleRegisterViewerEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &/*outResult*/, - long /*inAENumber*/) -{ - OSType appSign; // app signature - OSType fileType = 'TEXT'; // file type to be created - char * mimeType = NULL; // MIME type - OSType realType; - Size realSize; - CMimeMapper * mapper; - OSErr err; - Try_ { - { // Get the application signature. Required - err = ::AEGetParamPtr(&inAppleEvent,keyDirectObject,typeApplSignature, - &realType, &appSign, sizeof(appSign), &realSize); - ThrowIfOSErr_(err); - } - { // Get the MIME type. Required - AEDesc mimeDesc; - err = ::AEGetParamDesc(&inAppleEvent,AE_spy_registerViewer_mime,typeWildCard,&mimeDesc); - ThrowIfOSErr_(err); - MoreExtractFromAEDesc::TheCString(mimeDesc, mimeType); - ::AEDisposeDesc(&mimeDesc); - if (mimeType == nil) - ThrowOSErr_(errAEWrongDataType); - } - - mapper = FindMimeType(mimeType); - if (mapper) - fileType = mapper->GetDocType(); - { // Get the file type. If none is specified, it defaults to already registered type, or 'TEXT' - AEDesc fileTypeDesc; - err = ::AEGetParamDesc(&inAppleEvent,AE_spy_registerViewer_ftyp,typeWildCard,&fileTypeDesc); - if (err == noErr) - { - Try_ { - UExtractFromAEDesc::TheType(fileTypeDesc, fileType); - } Catch_(inErr) - {} EndCatch_ - } - ::AEDisposeDesc(&fileTypeDesc); - } - // We have all the arguments, set up the new mapper if necessary - if (mapper == NULL) - { - mapper = new CMimeMapper(CMimeMapper::Launch, - mimeType, - "-", // I10L - this string is never seen by a user - CStr255::sEmptyString, - appSign, - fileType); - ThrowIfNil_(mapper); - mapper->SetTemporary(TRUE); - InsertItemsAt( 1, LArray::index_Last, &mapper); - } - - // If the type is being handled by a plug-in, donÕt let the AE override - Boolean result = false; -#ifdef ANTHRAX // is this addition for anthrax correct? - amusil - if (mapper->GetLoadAction() != CMimeMapper::Plugin && - mapper->GetLoadAction() != CMimeMapper::Applet) -#else - if (mapper->GetLoadAction() != CMimeMapper::Plugin) -#endif /* ANTHRAX */ - { - mapper->RegisterViewer(appSign, fileType); - result = true; - } - - // Reply success - // Create the reply, it will automatically be stuck into the outgoing AE by PP - { - StAEDescriptor booleanDesc(result); - err = ::AEPutKeyDesc(&outAEReply,keyAEResult,&booleanDesc.mDesc); /* IM VI chap. 6 pg 91 */ - } - } - Catch_(inErr) - { - MoreExtractFromAEDesc::MakeErrorReturn(outAEReply, - (unsigned char *)GetCString(REG_EVENT_ERR_RESID) , inErr); - } EndCatch_ - // Dispose - if (mimeType) XP_FREE(mimeType); -} - -void CMimeList::HandleUnregisterViewerEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &/*outResult*/, - long /*inAENumber*/) -{ - OSType appSign; // app signature - OSType fileType = 'TEXT'; // file type to be created - char* mimeType = NULL; // MIME type - - CMimeMapper * mapper = NULL; - OSErr err; - Try_ - { - { // Get the application signature. Required - AEDesc appSignDesc; - err = ::AEGetParamDesc(&inAppleEvent,keyDirectObject,typeWildCard,&appSignDesc); - ThrowIfOSErr_(err); - UExtractFromAEDesc::TheType(appSignDesc, appSign); - ::AEDisposeDesc(&appSignDesc); - } - { // Get the MIME type. Required - AEDesc mimeDesc; - err = ::AEGetParamDesc(&inAppleEvent,AE_spy_unregisterViewer_mime,typeWildCard,&mimeDesc); - ThrowIfOSErr_(err); - MoreExtractFromAEDesc::TheCString(mimeDesc, mimeType); - ::AEDisposeDesc(&mimeDesc); - if (mimeType == nil) - ThrowOSErr_(errAEWrongDataType); - } - - mapper = FindMimeType(mimeType); - - if (mapper == NULL || mapper->IsViewerRegistered() == false) - { - // - // If the type isnÕt found, or wasnÕt registered - // to an external viewer, return an error. - // - MoreExtractFromAEDesc::MakeErrorReturn(outAEReply, - (unsigned char *)GetCString(APP_NOT_REG_RESID), errAEDescNotFound); - } - else - { - // - // Otherwise unregister the viewer and remove the - // temporary mapper if necessary. - // - mapper->UnregisterViewer(); - if (mapper->IsTemporary()) - { - Remove(&mapper); - delete mapper; - } - } - } - Catch_(inErr) - { - MoreExtractFromAEDesc::MakeErrorReturn(outAEReply, - (unsigned char *)GetCString(UNREG_EVENT_ERR_RESID), inErr); - } - EndCatch_ - if (mimeType) XP_FREE(mimeType); -} - diff --git a/mozilla/cmd/macfe/central/umimemap.h b/mozilla/cmd/macfe/central/umimemap.h deleted file mode 100644 index 2c52a0d6cf6..00000000000 --- a/mozilla/cmd/macfe/central/umimemap.h +++ /dev/null @@ -1,216 +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. - */ - -#pragma once -// =========================================================================== -// umimemap.h -// MIME to Mac application/filetype mappings -// Created by atotic, June 13th, 1994 -// =========================================================================== - -#include -#include "AppleEvents.h" -#include "PascalString.h" -#include "ICKeys.h" // Needed for fileflags - -#define ANTHRAX - -class LFileBufferStream; -class CPrefs; - -typedef struct URL_Struct_ URL_Struct; - -/***************************************************************************** - * class CMimeMapper - * Maps a mime type to record describing what external application to use - * with this mime type, and how to launch it. - * Mappings are stored in a preference file, as resources of type MIME - *****************************************************************************/ - -class CMimeMapper { -public: - // All these must be non-zero because of a presumed bug in back end -#ifdef ANTHRAX - enum LoadAction { Save = 0, Launch = 1, Internal = 2, Unknown = 3, Plugin = 4, Applet = 5}; -#else - enum LoadAction { Save = 0, Launch = 1, Internal = 2, Unknown = 3, Plugin = 4}; -#endif - - // ¥¥ Constructors/destructors - void InitMapper(); - CMimeMapper(Handle resRecord); // Takes in a resource of type 'MIME' - CMimeMapper(const CMimeMapper& clone); // Duplicate - CMimeMapper(LoadAction loadAction, const CStr255& mimeType, - const CStr255& appName, const CStr255& extensions, - OSType appSignature, OSType fileType ); - ~CMimeMapper(); - - static Boolean NetscapeCanHandle( const CStr255& mimeType); - - // ¥¥ÊXP prefs - CMimeMapper( const char* basepref ); - static CMimeMapper* CreateMapperFor(const char* basepref, Boolean newPrefFormat = true); - static CMimeMapper* CreateMapperForRes(Handle res); - - void ReadMimePrefs(); - void WriteMimePrefs(Boolean isDefault = false); - - - // ¥¥ Access - - // Set functions are used by app setup box -#ifdef ANTHRAX - void SetAppletName(const CStr255& newAppletName); -#endif - void SetAppName(const CStr255& newName); - void SetMimeType(const CStr255& newType); - void SetExtensions(const CStr255& newExtensions); - void SetPluginName(const CStr255& newName) { fPluginName = newName; } - void SetDescription(const CStr255& newDesc) { fDescription = newDesc; } - void SetAppSig(OSType newSig); - void SetAppSig(FSSpec& appSpec); // Set the signature, given the file spec. Will THROW on error - void SetDocType(OSType newType); - void SetLoadAction(LoadAction newAction); - void SetLatentPlugin(); - void SetDefaultDescription(); - void SetFileFlags( Int32 inFlags ) { fFileFlags = inFlags; } - // External viewers - void SetTemporary(Boolean isTemporary) {fTemporary = isTemporary;} - void RegisterViewer(OSType tempAppSig, OSType tempFileType); - void UnregisterViewer(); - Boolean IsViewerRegistered() const { return fRegisteredViewer; } - - // Get functions -#ifdef ANTHRAX - CStr255 GetAppletName() {return fAppletName;} -#endif - CStr255 GetAppName() {return fAppName;}; - CStr255 GetMimeName() {return fMimeType;}; - CStr255 GetExtensions() {return fExtensions;}; - CStr255 GetPluginName() { return fPluginName; } - CStr255 GetDescription() { return fDescription; } - OSType GetAppSig() {return fRegisteredViewer ? fTempAppSig : fAppSig;}; - OSType GetDocType() {return fRegisteredViewer ? fTempFileType :fFileType;}; - LoadAction GetLoadAction() {return fRegisteredViewer ? Launch : fLoadAction;}; - Boolean IsTemporary() {return fTemporary;} - Boolean FromOldPrefs() { return fFromOldPrefs; } - Boolean LatentPlugin() { return fLatentPlugin; } - char* GetBasePref() { return fBasePref; } - Boolean IsLocked() { return fIsLocked; } - Int32 GetFileFlags(){ return fFileFlags; } - Uint8 GetNumChildrenFound() { return fNumChildrenFound; } - - // ¥¥Êoperators - CMimeMapper & operator = (const CMimeMapper& mapper); - - // ¥¥Êutility - // Get the spec for this MIME mapper - OSErr GetFileSpec(URL_Struct * request, - FSSpec & destination); - OSErr LaunchFile(LFileBufferStream * fFile, // File to launch - URL_Struct * request, // URL associated with the file - Int32 windowID); // ID of the parent window - void SyncNetlib(); -private: - OSErr MakeSpyEvent(AppleEvent & event, - URL_Struct * request, - AEEventID id, - AEKeyword urlAttribute); - - Boolean PrintableChars(const void *inBuffer, Int32 inLength); - - // Basic mapper information - CStr255 fMimeType; // MIME type - CStr255 fAppName; // Application's name - CStr255 fExtensions; // Extensions for this file type - OSType fAppSig; // Application signature - OSType fFileType; // Mac file type - LoadAction fLoadAction; // What to do after launch - - UInt8 fNumChildrenFound; // How much of the mapper information we actually found from children mime prefs - use to throw out useless data - - // Information about the registered viewers - Boolean fTemporary; // This is only a temporary mapper - Boolean fRegisteredViewer; // This is a registered viewer, use all the special codes - OSType fTempAppSig; // Application - OSType fTempFileType; // File signature - CStr255 fPluginName; // Plug-in's name - CStr255 fDescription; // Description of the type - Boolean fFromOldPrefs; // Was this mapper from pre-plugin prefs? - Boolean fLatentPlugin; // Was the plug-in disabled only because itÕs missing? - char* fBasePref; // Corresponding XP pref branch name - Int32 fFileFlags; // IC style FileFlags - Boolean fIsLocked; // If the mimetype pref is locked (for Mission Control functionality) - -#ifdef ANTHRAX - CStr255 fAppletName; -#endif -}; - - - -/***************************************************************************** - * class CMimeList - * Holds a list of CMimeMappers. Has utility functions for mime list manipulation - * Also handles registration of special viewers - *****************************************************************************/ - -class CMimeList : public LArray { -friend class CPrefs; -public: - enum BuiltIn { HTMLViewer = 0, Telnet = 1, Tn3270 = 2, Last}; - - // ¥¥ Constructors/destructors - CMimeList(); - virtual ~CMimeList(); - - // Overrode this on the assumption that every time you add a MIME mapper - // to this list, you want to sync up the netlib - virtual ArrayIndexT InsertItemsAt( - Uint32 inCount, - ArrayIndexT inAtIndex, - const void *inItem, - Uint32 inItemSize = 0); - - // ¥¥ÊUtility functions - // Deletes all the items in the list. Can also delete static MIME mappers - void DeleteAll(Boolean unused = false); - - // Returns mimemapper with given mime type - // NULL if none - CMimeMapper* FindMimeType( char* mimeType ); - CMimeMapper* FindMimeType( BuiltIn mimeBuiltin ); - CMimeMapper* FindMimeType( const FSSpec& file ); - - // Returns mimemapper with given application signature - CMimeMapper* FindCreator( OSType appSig ); // NULL if none - - // Returns mimemapper with given XP pref branch name - CMimeMapper* FindBasePref( const char* basepref ); - - // ¥¥ Apple event handling - void HandleRegisterViewerEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - void HandleUnregisterViewerEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber); - -}; diff --git a/mozilla/cmd/macfe/central/uprefd.cp b/mozilla/cmd/macfe/central/uprefd.cp deleted file mode 100644 index fcb4a277c4b..00000000000 --- a/mozilla/cmd/macfe/central/uprefd.cp +++ /dev/null @@ -1,2786 +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. - */ - -#include "uprefd.h" - -// macfe -#include "ufilemgr.h" // CFileMgr -#include "macutil.h" // CStringListRsrc -#include "resgui.h" // res_Strings1, res_Strings2, res_StringsBoolean -#include "mregistr.h" // CNotifierRegistry -#include "uerrmgr.h" // ErrorManager -#include "uapp.h" // FILE_TYPE_PROFILES, STARTUP_TYPE_NETPROFILE -#include "macfeprefs.h" // prototypes for FindGutsFolder, FindNetscapeFolder, FindJavaDownloadsFolder -#include "CToolTipAttachment.h" -#include "InternetConfig.h" // CInternetConfigInterface -#include "CSpinningN.h" -#include "profile.h" // kProfileStrings - -#include - -// Netscape -#include "glhist.h" // GH_SetGlobalHistoryTimeout -#include "net.h" // PROXY_STYLE_AUTOMATIC -#include "ntypes.h" -#include "shistele.h" -#include "proto.h" -#ifndef _XP_H_ -//#include "xp_mcom.h" -#endif -#include "msgcom.h" // MSG_NormalSize, MSG_PlainFont -#include "mime.h" // MIME_ConformToStandard -#include "fe_proto.h" // prototype for FE_GetNetHelpDir -#include "java.h" // LJ_SetJavaEnabled - -#include "prefapi.h" // ns/modules/libpref - -/********************************************************************************* - * DOGBERT XP PREFERENCES / MULTI-USER PROFILES - * - * New preference file format: XP text file parsed by JavaScript via libpref - * (includes all user strings, bools, ints, and colors). - * Some prefs (see below) are still written in old resource format. - * Both old and new prefs are read & written to the existing Netscape Prefs file. - * - * Primary changes to this file: - * - added GetUserProfile() and InitPrefsFolder() to prompt user for desired - * profile (if necessary) and use that to point to base Preferences folder. - * - changed order of PrefEnum entries and added XP prefName strings. - * - ReadPreference, if it detects new format, only needs to call - * PostProcessPrefChange for each pref to propagate the new value. - * Calls to back-end will GO AWAY as modules fetch their own pref values. - * - ReadPreference otherwise reads old-format file. - * - WritePreference always writes new format. - * - CPrefs Get/Setters use libpref calls. - * - removed CPrefs storage of strings, bools, ints, and colors. - * - file/folder aliases accessed as libpref binary types but still stored - * in CPrefs via sFileIDs. - * - * Some prefs are not yet supported in XP format. - * - font encodings - * - window/pane positions - * - protocol handlers, etc. - * We at least should support the first in XP format for use by Admin Kit. - *********************************************************************************/ - -const Int16 refNum_Undefined = -1; // Really defined in LFile.cp - -static LBroadcaster * gPrefBroadcaster = NULL; - -//=============================================================================== -// Resource definitions -// definitions of type and resource location of all preferences -//=============================================================================== - -#define NOTSAVED 'NONE' -#define STRINGLIST 'STR#' -#define ALIASREC 'ALIS' -#define PRINTRECORD 'PrRc' -#define REVISION 'PRev' -#define WINDOWREC 'WPSt' // Starts off with a rect, followed by variable data for each window - -#define REVISION_RES_ID 10000 -// Resource IDs of all resources used in prefs -// are defined in resgui.h - -enum PrefType { - eStringType, - eBooleanType, - eFileSpecType, - eLongType, - eColorType, - ePrintRecordType, - eNoType -}; - -struct PrefLoc { - CPrefs::PrefEnum prefID; // What's my id - OSType resType; // What kind of resource are we reading - PrefType prefType; // How should we store this pref natively - short resID; // Resource ID - short refCon; // For STRINGLIST this is the index into the resource - // For ALIASREC, 1 to pop up alert when not found, 0 no alert - char* prefName; // XP pref name -}; - -// This array defines what kind of preference each PrefEnum is, -// and where it is stored. - -static PrefLoc prefLoc[] = -{ -// Folders -- need to be before anything else, because we do not have the accumulator - { CPrefs::DownloadFolder, ALIASREC, eFileSpecType, 129, 1, - "browser.download_directory"}, - { CPrefs::NetscapeFolder, NOTSAVED, eFileSpecType, 0, 1}, - { CPrefs::MainFolder, NOTSAVED, eFileSpecType, 0, 1}, - { CPrefs::UsersFolder, NOTSAVED, eFileSpecType, 0, 1}, - { CPrefs::DiskCacheFolder, ALIASREC, eFileSpecType, 133, 1, - "browser.cache.directory"}, - { CPrefs::SignatureFile, ALIASREC, eFileSpecType, 134, 1, - "mail.signature_file"}, - { CPrefs::GIFBackdropFile, ALIASREC, eFileSpecType, 135, 1 }, - { CPrefs::MailFolder, ALIASREC, eFileSpecType, 136, 1, - "mail.directory"}, - { CPrefs::NewsFolder, NOTSAVED, eFileSpecType, 0, 1 }, - { CPrefs::SecurityFolder, NOTSAVED, eFileSpecType, 0, 1 }, - { CPrefs::MailCCFile, ALIASREC, eFileSpecType, 137, 1, - "mail.default_fcc"}, - { CPrefs::NewsCCFile, ALIASREC, eFileSpecType, 138, 1, - "news.default_fcc"}, - { CPrefs::HTMLEditor, ALIASREC, eFileSpecType, 139, 1, - "editor.html_editor"}, - { CPrefs::ImageEditor, ALIASREC, eFileSpecType, 140, 1, - "editor.image_editor"}, - { CPrefs::RequiredGutsFolder, NOTSAVED, eFileSpecType, 0, 1}, - -// TJ & ROB - { CPrefs::SARCacheFolder, NOTSAVED, eFileSpecType, 0, 0}, -// EA - { CPrefs::NetHelpFolder, NOTSAVED, eFileSpecType, 0, 0}, - -// Strings - { CPrefs::HomePage, STRINGLIST, eStringType, res_Strings1, 1, - "browser.startup.homepage" }, - { CPrefs::NewsHost, STRINGLIST, eStringType, res_Strings1, 2, - "network.hosts.nntp_server" }, - { CPrefs::FTPProxy, STRINGLIST, eStringType, res_Strings1, 3, - "network.proxy.ftp" }, - { CPrefs::GopherProxy, STRINGLIST, eStringType, res_Strings1, 4, - "network.proxy.gopher" }, - { CPrefs::HTTPProxy, STRINGLIST, eStringType, res_Strings1, 5, - "network.proxy.http" }, - { /*unused*/CPrefs::NewsProxy, STRINGLIST, eStringType, res_Strings1, 6 }, - { CPrefs::WAISProxy, STRINGLIST, eStringType, res_Strings1, 7, - "network.proxy.wais" }, - { CPrefs::FTPProxyPort, STRINGLIST, eStringType, res_Strings1, 8, - "network.proxy.ftp_port" }, - { CPrefs::GopherProxyPort, STRINGLIST, eStringType, res_Strings1, 9, - "network.proxy.gopher_port" }, - { CPrefs::HTTPProxyPort, STRINGLIST, eStringType, res_Strings1, 10, - "network.proxy.http_port" }, - { /*unused*/CPrefs::NewsProxyPort, STRINGLIST, eStringType, res_Strings1, 11 }, - { CPrefs::WAISProxyPort, STRINGLIST, eStringType, res_Strings1, 12, - "network.proxy.wais_port" }, - { CPrefs::NoProxies, STRINGLIST, eStringType, res_Strings1, 13, - "network.proxy.no_proxies_on" }, - { CPrefs::UserName, STRINGLIST, eStringType, res_Strings1, 14, - "mail.identity.username" }, - { CPrefs::UserEmail, STRINGLIST, eStringType, res_Strings1, 15, - "mail.identity.useremail" }, - { CPrefs::SMTPHost, STRINGLIST, eStringType, res_Strings1, 16, - "network.hosts.smtp_server" }, - { CPrefs::SOCKSHost, STRINGLIST, eStringType, res_Strings2, 1, - "network.hosts.socks_server" }, - { CPrefs::SOCKSPort, STRINGLIST, eStringType, res_Strings2, 2, - "network.hosts.socks_serverport" }, - { CPrefs::Organization, STRINGLIST, eStringType, res_Strings2, 3, - "mail.identity.organization" }, - { CPrefs::SSLProxy, STRINGLIST, eStringType, res_Strings2, 4, - "network.proxy.ssl" }, - { CPrefs::SSLProxyPort, STRINGLIST, eStringType, res_Strings2, 5, - "network.proxy.ssl_port" }, - { CPrefs::PopHost, STRINGLIST, eStringType, res_Strings2, 6, - "network.hosts.pop_server" }, - { CPrefs::AcceptLanguage, STRINGLIST, eStringType, res_Strings2, 7, - "intl.accept_languages" }, - { CPrefs::DefaultMailCC, STRINGLIST, eStringType, res_Strings2, 8, - "mail.default_cc" }, - { CPrefs::DefaultNewsCC, STRINGLIST, eStringType, res_Strings2, 9, - "news.default_cc" }, - { CPrefs::ReplyTo, STRINGLIST, eStringType, res_Strings2, 10, - "mail.identity.reply_to" }, - { CPrefs::PopID, STRINGLIST, eStringType, res_Strings2, 11, - "mail.pop_name" }, - { CPrefs::AutoProxyURL, STRINGLIST, eStringType, res_Strings2, 12, - "network.proxy.autoconfig_url" }, - { CPrefs::MailPassword, STRINGLIST, eStringType, res_Strings2, 13, - "mail.pop_password" }, - { CPrefs::Ciphers, STRINGLIST, eStringType, res_Strings2, 14, - "security.ciphers" }, - { CPrefs::EditorAuthor, STRINGLIST, eStringType, res_Strings2, 15, - "editor.author" }, - { CPrefs::EditorNewDocTemplateLocation, STRINGLIST, eStringType, res_Strings2, 16, - "editor.template_location" }, - { CPrefs::EditorBackgroundImage, STRINGLIST, eStringType, res_Strings2, 17, - "editor.background_image" }, - { CPrefs::PublishLocation, STRINGLIST, eStringType, res_Strings2, 18, - "editor.publish_location" }, - { CPrefs::PublishBrowseLocation, STRINGLIST, eStringType, res_Strings2, 19, - "editor.publish_browse_location" }, - { CPrefs::PublishHistory0, STRINGLIST, eStringType, res_Strings2, 20, - "editor.publish_history_0" }, - { CPrefs::PublishHistory1, STRINGLIST, eStringType, res_Strings2, 21, - "editor.publish_history_1" }, - { CPrefs::PublishHistory2, STRINGLIST, eStringType, res_Strings2, 22, - "editor.publish_history_2" }, - { CPrefs::PublishHistory3, STRINGLIST, eStringType, res_Strings2, 23, - "editor.publish_history_3" }, - { CPrefs::PublishHistory4, STRINGLIST, eStringType, res_Strings2, 24, - "editor.publish_history_4" }, - { CPrefs::PublishHistory5, STRINGLIST, eStringType, res_Strings2, 25, - "editor.publish_history_5" }, - { CPrefs::PublishHistory6, STRINGLIST, eStringType, res_Strings2, 26, - "editor.publish_history_6" }, - { CPrefs::PublishHistory7, STRINGLIST, eStringType, res_Strings2, 27, - "editor.publish_history_7" }, - { CPrefs::PublishHistory8, STRINGLIST, eStringType, res_Strings2, 28, - "editor.publish_history_8" }, - { CPrefs::PublishHistory9, STRINGLIST, eStringType, res_Strings2, 29, - "editor.publish_history_9" }, - { CPrefs::DefaultPersonalCertificate, STRINGLIST, eStringType, res_Strings2, 30, - "security.default_personal_cert" }, -// Booleans - { CPrefs::DelayImages, STRINGLIST, eBooleanType, res_StringsBoolean, 1, - "browser.delay_images"}, - { CPrefs::AnchorUnderline, STRINGLIST, eBooleanType, res_StringsBoolean, 2, - "browser.underline_anchors"}, - { CPrefs::ShowAllNews, STRINGLIST, eBooleanType, res_StringsBoolean, 3}, - { CPrefs::UseFancyFTP, STRINGLIST, eBooleanType, res_StringsBoolean, 4}, - { CPrefs::UseFancyNews, STRINGLIST, eBooleanType, res_StringsBoolean, 5, - "news.fancy_listing" }, - { CPrefs::ShowToolbar, STRINGLIST, eBooleanType, res_StringsBoolean, 6, - "browser.chrome.show_toolbar"}, - { CPrefs::ShowStatus, STRINGLIST, eBooleanType, res_StringsBoolean, 7, - "browser.chrome.show_status_bar"}, - { CPrefs::ShowURL, STRINGLIST, eBooleanType, res_StringsBoolean, 8, - "browser.chrome.show_url_bar"}, - { CPrefs::LoadHomePage, STRINGLIST, eBooleanType, res_StringsBoolean, 9, - "browser.startup.autoload_homepage" }, - { CPrefs::ExpireNever, STRINGLIST, eBooleanType, res_StringsBoolean, 10, - "browser.never_expire"}, - { CPrefs::DisplayWhileLoading, STRINGLIST, eBooleanType, res_StringsBoolean,11, - "browser.display_while_loading"}, - { CPrefs::CustomLinkColors, STRINGLIST, eBooleanType, res_StringsBoolean, 12, - "browser.custom_link_color"}, - { CPrefs::ShowDirectory, STRINGLIST, eBooleanType, res_StringsBoolean, 13, - "browser.chrome.show_directory_buttons" }, - { CPrefs::AgreedToLicense, STRINGLIST, eBooleanType, res_StringsBoolean, 14, - "browser.startup.agreed_to_licence" }, - { CPrefs::EnteringSecure, STRINGLIST, eBooleanType, res_StringsBoolean, 15, - "security.warn_entering_secure"}, - { CPrefs::LeavingSecure, STRINGLIST, eBooleanType, res_StringsBoolean, 16, - "security.warn_leaving_secure"}, - { CPrefs::ViewingMixed, STRINGLIST, eBooleanType, res_StringsBoolean, 17, - "security.warn_viewing_mixed"}, - { CPrefs::SubmittingInsecure, STRINGLIST, eBooleanType, res_StringsBoolean, 18, - "security.warn_submit_insecure"}, - { CPrefs::ShowSecurity, STRINGLIST, eBooleanType, res_StringsBoolean, 19, - "browser.chrome.show_security_bar"}, - { CPrefs::CustomVisitedColors,STRINGLIST, eBooleanType, res_StringsBoolean, 20, - "browser.custom_visited_color"}, - { CPrefs::CustomTextColors, STRINGLIST, eBooleanType, res_StringsBoolean, 21, - "browser.custom_text_color"}, - { CPrefs::UseDocumentColors, STRINGLIST, eBooleanType, res_StringsBoolean, 22, - "browser.use_document_colors"}, - { CPrefs::AutoDetectEncoding, STRINGLIST, eBooleanType, res_StringsBoolean, 23, - "intl.auto_detect_encoding"}, - { CPrefs::UseSigFile, STRINGLIST, eBooleanType, res_StringsBoolean, 24, - "mail.use_signature_file"}, - { CPrefs::StrictlyMIME, STRINGLIST, eBooleanType, res_StringsBoolean, 25, - "mail.strictly_mime" }, - { CPrefs::UseUtilityBackground, STRINGLIST, eBooleanType, res_StringsBoolean, 26, - "browser.mac.use_utility_pattern"}, - { CPrefs::MailUseFixedWidthFont, STRINGLIST, eBooleanType, res_StringsBoolean, 27, - "mail.fixed_width_messages"}, - { CPrefs::UseMailFCC, STRINGLIST, eBooleanType, res_StringsBoolean, 28, - "mail.use_fcc"}, - { CPrefs::UseNewsFCC, STRINGLIST, eBooleanType, res_StringsBoolean, 29, - "news.use_fcc"}, - { CPrefs::LimitMessageSize, STRINGLIST, eBooleanType, res_StringsBoolean, 30, - "mail.limit_message_size"}, - { CPrefs::LeaveMailOnServer, STRINGLIST, eBooleanType, res_StringsBoolean, 31, - "mail.leave_on_server" }, - { CPrefs::MailCCSelf, STRINGLIST, eBooleanType, res_StringsBoolean, 32, - "mail.cc_self"}, - { CPrefs::NewsCCSelf, STRINGLIST, eBooleanType, res_StringsBoolean, 33, - "news.cc_self"}, - { CPrefs::BiffOn, STRINGLIST, eBooleanType, res_StringsBoolean, 34, - "mail.check_new_mail"}, - { CPrefs::UseMozPassword, STRINGLIST, eBooleanType, res_StringsBoolean, 35}, - { CPrefs::ThreadMail, STRINGLIST, eBooleanType, res_StringsBoolean, 36, - "mail.thread_mail"}, - { CPrefs::ThreadNews, STRINGLIST, eBooleanType, res_StringsBoolean, 37, - "news.thread_news"}, - { CPrefs::UseInlineViewSource,STRINGLIST, eBooleanType, res_StringsBoolean, 38 }, - { CPrefs::AutoQuoteOnReply, STRINGLIST, eBooleanType, res_StringsBoolean, 39, - "mail.auto_quote"}, - { CPrefs::RememberMailPassword, STRINGLIST, eBooleanType, res_StringsBoolean, 40, - "mail.remember_password"}, - { CPrefs::DefaultMailDelivery, STRINGLIST, eBooleanType, res_StringsBoolean, 41, - "mail.deliver_immediately"}, - { CPrefs::EnableJavascript, STRINGLIST, eBooleanType, res_StringsBoolean, 42, - "javascript.enabled" }, - { CPrefs::ShowToolTips, STRINGLIST, eBooleanType, res_StringsBoolean, 43, - "browser.mac.show_tool_tips"}, - { CPrefs::UseInternetConfig, STRINGLIST, eBooleanType, res_StringsBoolean, 44, - "browser.mac.use_internet_config"}, - { CPrefs::EnableJava, STRINGLIST, eBooleanType, res_StringsBoolean, 45, - "security.enable_java" }, - { CPrefs::AcceptCookies, STRINGLIST, eBooleanType, res_StringsBoolean, 46, - "network.cookie.warnAboutCookies" }, - { CPrefs::UseEmailAsPassword, STRINGLIST, eBooleanType, res_StringsBoolean, 47, - "security.email_as_ftp_password" }, - { CPrefs::SubmitFormsByEmail, STRINGLIST, eBooleanType, res_StringsBoolean, 48, - "security.submit_email_forms" }, - { CPrefs::AllowSSLDiskCaching, STRINGLIST, eBooleanType, res_StringsBoolean, 49, - "browser.cache.disk_cache_ssl" }, - { CPrefs::EnableSSLv2, STRINGLIST, eBooleanType, res_StringsBoolean, 50, - "security.enable_ssl2" }, - { CPrefs::EnableSSLv3, STRINGLIST, eBooleanType, res_StringsBoolean, 51, - "security.enable_ssl3" }, - { CPrefs::EnableActiveScrolling, STRINGLIST, eBooleanType, res_StringsBoolean, 52, - "browser.mac.active_scrolling" }, -#ifdef FORTEZZA - { CPrefs::FortezzaTimeoutOn, STRINGLIST, eBooleanType, res_StringsBoolean, 0 }, -#endif -#ifdef EDITOR - { CPrefs::EditorUseCustomColors, STRINGLIST, eBooleanType, res_StringsBoolean, 53, - "editor.use_custom_colors" }, - { CPrefs::EditorUseBackgroundImage, STRINGLIST, eBooleanType, res_StringsBoolean, 54, - "editor.use_background_image" }, - { CPrefs::PublishMaintainLinks, STRINGLIST, eBooleanType, res_StringsBoolean, 55, - "editor.publish_keep_links" }, - { CPrefs::PublishKeepImages, STRINGLIST, eBooleanType, res_StringsBoolean, 56, - "editor.publish_keep_images" }, - { CPrefs::ShowCopyright, STRINGLIST, eBooleanType, res_StringsBoolean, 57, - "editor.show_copyright" }, - { CPrefs::ShowFileEditToolbar, STRINGLIST, eBooleanType, res_StringsBoolean, 58 }, - { CPrefs::ShowCharacterToolbar, STRINGLIST, eBooleanType, res_StringsBoolean, 59, - "editor.show_character_toolbar" }, - { CPrefs::ShowParagraphToolbar, STRINGLIST, eBooleanType, res_StringsBoolean, 60, - "editor.show_paragraph_toolbar" }, -#endif EDITOR - // WARNING: If you add stuff here, the custom.r file (in projector for Browser and MailNews) must match! -// Longs - { CPrefs::DiskCacheSize, STRINGLIST, eLongType, res_StringsLong, 1, - "browser.cache.disk_cache_size"}, - { CPrefs::FileSortMethod, STRINGLIST, eLongType, res_StringsLong, 2, - "network.file_sort_method"}, - { CPrefs::ToolbarStyle, STRINGLIST, eLongType, res_StringsLong, 3, - "browser.chrome.toolbar_style"}, - { CPrefs::DaysTilExpire, STRINGLIST, eLongType, res_StringsLong, 4, - "browser.link_expiration"}, - { CPrefs::Connections, STRINGLIST, eLongType, res_StringsLong, 5, - "network.max_connections"}, - { CPrefs::BufferSize, STRINGLIST, eLongType, res_StringsLong, 6, - "network.tcpbufsize"}, - { /*unused*/CPrefs::PrintFlags, STRINGLIST, eLongType, res_StringsLong, 7}, - { CPrefs::NewsArticlesMax, STRINGLIST, eLongType, res_StringsLong, 8, - "news.max_articles"}, - { CPrefs::CheckDocuments, STRINGLIST, eLongType, res_StringsLong, 9, - "browser.cache.check_doc_frequency"}, - { CPrefs::DefaultCharSetID, STRINGLIST, eLongType, res_StringsLong, 10, - "intl.character_set"}, - { CPrefs::DefaultFontEncoding,STRINGLIST, eLongType, res_StringsLong, 11, - "intl.font_encoding"}, - { CPrefs::BackgroundColors, STRINGLIST, eLongType, res_StringsLong, 12, - "browser.background_option" }, - { CPrefs::LicenseVersion, STRINGLIST, eLongType, res_StringsLong, 13, - "browser.startup.license_version"}, - { CPrefs::MessageFontStyle, STRINGLIST, eLongType, res_StringsLong, 14, - "mail.quoted_style"}, - { CPrefs::MessageFontSize, STRINGLIST, eLongType, res_StringsLong, 15, - "mail.quoted_size"}, - { CPrefs::MaxMessageSize, STRINGLIST, eLongType, res_StringsLong, 16, - "mail.max_size" }, - { CPrefs::TopLeftHeader, STRINGLIST, eLongType, res_StringsLong, 17, - "browser.mac.print_header_topleft" }, - { CPrefs::TopMidHeader, STRINGLIST, eLongType, res_StringsLong, 31, - "browser.mac.print_header_topmid" }, - { CPrefs::TopRightHeader, STRINGLIST, eLongType, res_StringsLong, 18, - "browser.mac.print_header_topright" }, - { CPrefs::BottomLeftFooter, STRINGLIST, eLongType, res_StringsLong, 19, - "browser.mac.print_header_botleft" }, - { CPrefs::BottomMidFooter, STRINGLIST, eLongType, res_StringsLong, 20, - "browser.mac.print_header_botmid" }, - { CPrefs::BottomRightFooter, STRINGLIST, eLongType, res_StringsLong, 21, - "browser.mac.print_header_botright" }, - { CPrefs::PrintBackground, STRINGLIST, eLongType, res_StringsLong, 22, - "browser.mac.print_background" }, - { CPrefs::ProxyConfig, STRINGLIST, eLongType, res_StringsLong, 23, - "network.proxy.type" }, - { CPrefs::StartupAsWhat, STRINGLIST, eLongType, res_StringsLong, 24, - "browser.startup.default_window"}, - { CPrefs::StartupBitfield, STRINGLIST, eLongType, res_StringsLong, 25, - "browser.mac.startup_bitfield"}, - { CPrefs::BiffTimeout, STRINGLIST, eLongType, res_StringsLong, 26, - "mail.check_time"}, - { CPrefs::AskMozPassword, STRINGLIST, eLongType, res_StringsLong, 27, - "security.ask_for_password"}, - { CPrefs::AskMozPassFrequency,STRINGLIST, eLongType, res_StringsLong, 28, - "security.password_lifetime"}, - { CPrefs::SortMailBy, STRINGLIST, eLongType, res_StringsLong, 29, - "mail.sort_by"}, - { CPrefs::SortNewsBy, STRINGLIST, eLongType, res_StringsLong, 30, - "news.sort_by"}, - { CPrefs::NewsPaneConfig, STRINGLIST, eLongType, res_StringsLong, 32, - "news.pane_config"}, - { CPrefs::MailPaneConfig, STRINGLIST, eLongType, res_StringsLong, 33, - "mail.pane_config"}, - { CPrefs::MailHeaderDisplay, STRINGLIST, eLongType, res_StringsLong, 34, - "mail.show_headers"}, - { CPrefs::NewsHeaderDisplay, STRINGLIST, eLongType, res_StringsLong, 35, - "news.show_headers"}, - { CPrefs::AutoSaveTimeDelay, STRINGLIST, eLongType, res_StringsLong, 36, - "editor.auto_save_delay"}, -#ifdef FORTEZZA - { CPrefs::FortezzaTimeout, STRINGLIST, eLongType, res_StringsLong, 37, - "security.fortezza_lifetime" }, -#endif - -// Colors - { CPrefs::Black, NOTSAVED, eColorType, 0, 1}, - { CPrefs::White, NOTSAVED, eColorType, 0, 1}, - { CPrefs::Blue, NOTSAVED, eColorType, 0, 1}, - { CPrefs::Magenta, NOTSAVED, eColorType, 0, 1}, - { CPrefs::WindowBkgnd, NOTSAVED, eColorType, 0, 1}, // --was res_StringsColor, 1 - { CPrefs::Anchor, STRINGLIST, eColorType, res_StringsColor, 2, - "browser.anchor_color"}, - { CPrefs::Visited, STRINGLIST, eColorType, res_StringsColor, 3, - "browser.visited_color"}, - { CPrefs::TextFore, STRINGLIST, eColorType, res_StringsColor, 4, - "browser.foreground_color"}, - { CPrefs::TextBkgnd, STRINGLIST, eColorType, res_StringsColor, 5, - "browser.background_color"}, - { CPrefs::EditorText, STRINGLIST, eColorType, res_StringsColor, 6, - "editor.text_color"}, - { CPrefs::EditorLink, STRINGLIST, eColorType, res_StringsColor, 7, - "editor.link_color"}, - { CPrefs::EditorActiveLink, STRINGLIST, eColorType, res_StringsColor, 8, - "editor.active_link_color"}, - { CPrefs::EditorFollowedLink, STRINGLIST, eColorType, res_StringsColor, 9, - "editor.followed_link_color"}, - { CPrefs::EditorBackground, STRINGLIST, eColorType, res_StringsColor, 10, - "editor.background_color"}, - { CPrefs::Citation, STRINGLIST, eColorType, res_StringsColor, 11, - "mail.citation_color"}, -// Print record - { CPrefs::PrintRecord, PRINTRECORD, ePrintRecordType, res_PrintRecord, 0 }, -// Terminator - { CPrefs::LastPref, NOTSAVED, eNoType, 0, 0} -}; - -// -// Class variables -// -RGBColor * CPrefs::sColors = NULL; -CFolderSpec ** CPrefs::sFileIDs = NULL; -THPrint CPrefs::sPrintRec = NULL; -CMimeList CPrefs::sMimeTypes; -char * CPrefs::sCachePath = NULL; - -FSSpec CPrefs::sTemporaryFolder; -Boolean CPrefs::sRealTemporaryFolder = false; -Boolean CPrefs::sViewSourceInline = true; -// 0 = no user preference file -// 3 = preferences in resource fork -// 4 = preferences in data fork -short CPrefs::sPrefFileVersion = 3; - -// -// Static variables -// - -// Preference file related -static LFile * sPrefFile = NULL; -static short sPrefFileResID = refNum_Undefined; -static short sAppFileResID = refNum_Undefined; -static Boolean sReading = FALSE; // Are we reading the prefs right now? -static Boolean sDirty = FALSE; -static Boolean sDirtyOnRead = FALSE; // Used to signal saving of preferences - // if we need to touch them while reading -// -// Utility routines -// -static UInt32 CountPrefsOfType(PrefType type); -static LFile* GetFileForPreferences(); -/*static*/ Boolean FindDefaultPreferencesFolder( FSSpec& prefFolder, short folderNameID, - Boolean createIt, Boolean resolveIt = true ); -static OSErr AssertPrefsFileOpen(Int16 privileges); -static LO_Color MakeLOColor( const RGBColor& rgbColor ); -static OSErr AssurePreferencesSubfolder(pref_Strings whichFolder, FSSpec & folderSpec); - -// Counts how many preferences of particular type do we have -UInt32 CountPrefsOfType(PrefType type) -{ - UInt32 howMany = 0; - int i = 0; - while(prefLoc[i].prefType != eNoType) - if (prefLoc[i++].prefType == type) - howMany++; - return howMany; -} - -// FindDefaultPreferencesFolder searches the disk for a preferences folder. -// If it does not find one, it tries to create it. -// It returns false upon complete failure (could not find or create) -// Folder lookup sequence: Preferences, Home directory, Desktop -// Algorithm: -// Look for a folder in folder lookup sequence. -// If not found try to create it in the same sequence. -Boolean FindDefaultPreferencesFolder( FSSpec& prefFolder, short folderNameID, - Boolean createIt, Boolean resolveIt ) -{ - short prefRefNum, deskRefNum; - long prefDirID, deskDirID; - FSSpec netscapeFolder = CPrefs::GetFilePrototype(CPrefs::NetscapeFolder); - - OSErr err = FindFolder( kOnSystemDisk, kPreferencesFolderType, kCreateFolder, &prefRefNum, &prefDirID );// Get Pref directory - OSErr err2 = FindFolder( kOnSystemDisk, kDesktopFolderType, kCreateFolder, &deskRefNum, &deskDirID ); - - // ¥ check for presence of MCC folderÉ - Boolean foundFolder = FALSE; - CStr255 folderName; - GetIndString( folderName, 300, folderNameID ); - LString::CopyPStr( folderName, prefFolder.name, 32 ); - - // ¥ in the Preferences folder - if ( !foundFolder && ( err == noErr ) && - ( CFileMgr::FindWFolderInFolder( prefRefNum, prefDirID, - folderName, - &prefFolder.vRefNum, &prefFolder.parID) == noErr ) ) - foundFolder = TRUE; - - // ¥Êin the applications folder - if ( !foundFolder && - ( CFileMgr::FindWFolderInFolder( netscapeFolder.vRefNum, netscapeFolder.parID, - folderName, - &prefFolder.vRefNum, &prefFolder.parID) == noErr ) ) - foundFolder = TRUE; - - // ¥Êand on the desktop - if ( ( !foundFolder ) && ( err2 == noErr ) && - ( CFileMgr::FindWFolderInFolder( deskRefNum, deskDirID, - folderName, - &prefFolder.vRefNum, &prefFolder.parID) == noErr ) ) - foundFolder = TRUE; - - // ¥Êcreate a folder if one does not exist. Go in Folder lookup sequence - if ( !foundFolder && createIt ) - { - // ¥ get the name of the folder out of resources - CStr255 folderName; - GetIndString( folderName, 300, folderNameID ); - OSErr createError; - - // ¥Êtry the Preferences folder - createError = CFileMgr::CreateFolderInFolder( prefRefNum, prefDirID, - folderName, &prefFolder.vRefNum, &prefFolder.parID); - - if ( createError == noErr ) - foundFolder = TRUE; - else - { - // ¥Êtry the application's folder - createError = CFileMgr::CreateFolderInFolder( netscapeFolder.vRefNum, netscapeFolder.parID, - folderName, &prefFolder.vRefNum, &prefFolder.parID); - if ( createError == noErr ) - foundFolder = TRUE; - else - { - // ¥ try the Desktop - createError = CFileMgr::CreateFolderInFolder(deskRefNum, deskDirID, - folderName, &prefFolder.vRefNum, &prefFolder.parID); - if ( createError == noErr ) - foundFolder = TRUE; - else - foundFolder = FALSE; - } - } - } - - if (foundFolder && resolveIt) - CFileMgr::FolderSpecFromFolderID(prefFolder.vRefNum, prefFolder.parID, prefFolder); - - return foundFolder; -} - -inline Boolean CPrefs::IsNewPrefFormat(short id) -{ - return prefLoc[id].prefName != nil; -} - -// Returns LFile for the preferences -// File might not exist -LFile* GetFileForPreferences() -{ - FSSpec prefFileSpec; - - // ¥Êget the default preferences file name from the application rsrc fork - ::GetIndString( prefFileSpec.name, 300, prefFileName ); - - if ( prefFileSpec.name[0] > 31 ) - prefFileSpec.name[0] = 31; - - FSSpec folderSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - prefFileSpec.vRefNum = folderSpec.vRefNum; - prefFileSpec.parID = folderSpec.parID; - - CPrefs::sPrefFileVersion = CFileMgr::FileExists(prefFileSpec) ? 3 : 0; - - // ¥ return a fully specified LFile - return new LFile( prefFileSpec ); -} - -// Creates the file if it does not exist -static OSErr AssertPrefsFileOpen(Int16 privileges) -{ - Try_ - { - ThrowIfNil_(sPrefFile); - Try_ - { - sPrefFile->OpenResourceFork(privileges); - } - Catch_(inErr) - { - // Create the resource fork if it doesn't exist - if (inErr == fnfErr || inErr == eofErr) { - sPrefFile->CreateNewFile(emSignature, emPrefsType); - - sPrefFile->OpenResourceFork(privileges); - } - - // Non-fatal error. We are trying to open prefs twice in a row - else if (!((inErr == opWrErr) && - (sPrefFile->GetResourceForkRefNum() != refNum_Undefined))) - Throw_(inErr); - } - EndCatch_ - sPrefFileResID = sPrefFile->GetResourceForkRefNum(); - } - Catch_(inErr) - { - return inErr; - } - EndCatch_ - return noErr; -} - -static void ClosePrefsFile() -{ - Try_ - { - if (sPrefFile) - { - if (sPrefFile->GetResourceForkRefNum() != refNum_Undefined) - sPrefFile->CloseResourceFork(); - if (sPrefFile->GetDataForkRefNum() != refNum_Undefined) - sPrefFile->CloseDataFork(); - } - } - Catch_(inErr) - { - Assert_(FALSE); - } - EndCatch_ - sPrefFileResID = refNum_Undefined; - - // - // Now that the prefs are closed, make sure weÕre - // not using some random file (like a plug-in). - // - CPrefs::UseApplicationResFile(); -} - - -#define NON_EXISTENT_NAME "\pNONEXISTENTsj8432903849" - -// ¥ Makes sure that the folder with a given spec exists inside preferences. -// if it is not found, it creates one. -static OSErr AssurePreferencesSubfolder(pref_Strings whichFolder, FSSpec & folderSpec) -{ - FSSpec mainSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - // Find a folder. Create one if necessary - ::GetIndString( folderSpec.name, 300, whichFolder ); - OSErr err = noErr; - if ( CFileMgr::FindWFolderInFolder(mainSpec.vRefNum, mainSpec.parID, - folderSpec.name, - &folderSpec.vRefNum, &folderSpec.parID) != noErr ) - // Not found, must create it - err = CFileMgr::CreateFolderInFolder( mainSpec.vRefNum, mainSpec.parID, - folderSpec.name, - &folderSpec.vRefNum, &folderSpec.parID ); - if ( err != noErr ) // Also try application folder for lab settings - { - mainSpec = CPrefs::GetFilePrototype( CPrefs::NetscapeFolder ); - err = CFileMgr::FindWFolderInFolder( mainSpec.vRefNum, mainSpec.parID, - folderSpec.name, - &folderSpec.vRefNum, &folderSpec.parID ); - if ( err != noErr ) - err = CFileMgr::CreateFolderInFolder( mainSpec.vRefNum, mainSpec.parID, - folderSpec.name, - &folderSpec.vRefNum, &folderSpec.parID ); - } - err = CFileMgr::FolderSpecFromFolderID( folderSpec.vRefNum, folderSpec.parID, folderSpec ); - return err; -} - -static CStr255 BuildProxyString(CStr255 host, CStr255 port) -{ - CStr255 ret = host; - if ((host.Length() > 0) && (port.Length() > 0)) - { - ret += ":"; - ret += port; - } - return ret; -} - -static LO_Color MakeLOColor( const RGBColor& rgbColor ) -{ - LO_Color temp; - temp.red = rgbColor.red >> 8; - temp.green = rgbColor.green >> 8; - temp.blue = rgbColor.blue >> 8; - return temp; -} - -// Returns TRUE if resource existed -// If it does not exist, creates a resource of 0 length -static Boolean AssertResourceExist(ResType type, short id) -{ - Handle r = ::Get1Resource(type, id); - if (r == NULL) - { - Handle h = ::NewHandle(0); - ThrowIfNil_(h); - ::AddResource(h, type, id, CStr255::sEmptyString); - ThrowIfResError_(); - - SInt8 flags = ::HGetState(h); - ::HNoPurge(h); - - ::SetResAttrs(h, ::GetResAttrs(h) | resPurgeable); // Pref resources are purgeable - if (type == STRINGLIST) - { - CStringListRsrc stringList(id); - stringList.ClearAll(); - } - ::HSetState(h, flags); - - return FALSE; - } - else - return TRUE; -} - -/***************************************************************************** - * struct CFolderSpec - * Contains specs for the folder and a prototype spec for the file to be - * created inside this folder - *****************************************************************************/ - -CFolderSpec::CFolderSpec() -{ - fFolder.vRefNum = fFolder.parID = refNum_Undefined; - fFilePrototype.vRefNum = fFilePrototype.parID = refNum_Undefined; -} - -// Sets the specs for this folder. Must figure out the prototype file specs too -OSErr CFolderSpec::SetFolderSpec(FSSpec newSpec, int folderID) - /* - This routine is called for two different sorts of folders, those whose locations are saved in - the preferences, and those that are not. For the former, |newSpec| is constructed from the saved - location. For the latter, it is uninitialized. - */ -{ - FSSpec debugSpec; - OSErr settingError; - settingError = FSMakeFSSpec( newSpec.vRefNum, newSpec.parID, newSpec.name, &debugSpec); - - if ( settingError != noErr ) - { - sDirtyOnRead = TRUE; - Try_ - { - switch ( (CPrefs::PrefEnum)folderID ) - { - case CPrefs::DownloadFolder: - ThrowIfOSErr_( FindFolder( kOnSystemDisk, kDesktopFolderType, - kCreateFolder, &newSpec.vRefNum, &newSpec.parID )); - ThrowIfOSErr_( CFileMgr::FolderSpecFromFolderID(newSpec.vRefNum, newSpec.parID, newSpec)); - break; - case CPrefs::NewsFolder: - { -#ifdef MOZ_MAIL_NEWS - OSErr err = AssurePreferencesSubfolder(newsFolderName, newSpec); -#else - OSErr err = fnfErr; // Brutal hard coded err for a world without mail/news -#endif //MOZ_MAIL_NEWS - if ( err != noErr ) - { - fFolder.vRefNum = fFolder.parID = fFilePrototype.vRefNum = fFilePrototype.parID = 0; - return err; - } - } - break; - case CPrefs::SecurityFolder: - { - OSErr err = AssurePreferencesSubfolder(securityFolderName, newSpec); - if ( err != noErr ) - { - fFolder.vRefNum = fFolder.parID = fFilePrototype.vRefNum = fFilePrototype.parID = 0; - return err; - } - } - break; - case CPrefs::DiskCacheFolder: - // Caching folder. By default it is inside the main folder. - { - OSErr err = AssurePreferencesSubfolder(cacheFolderName, newSpec); - if ( err != noErr ) - { - fFolder.vRefNum = fFolder.parID = fFilePrototype.vRefNum = fFilePrototype.parID = 0; - return err; - } - } - break; - - case CPrefs::SARCacheFolder: - // Archive Cache folder. By default it is inside the main folder. - { - OSErr err = AssurePreferencesSubfolder(sarCacheFolderName, newSpec); - if ( err != noErr ) - { - fFolder.vRefNum = fFolder.parID = fFilePrototype.vRefNum = fFilePrototype.parID = 0; - return err; - } - } - break; - - case CPrefs::MailFolder: - { -#ifdef MOZ_MAIL_NEWS - OSErr err = AssurePreferencesSubfolder(mailFolderName, newSpec); -#else - OSErr err = fnfErr; // Brutal hard coded err for a world without mail/news -#endif //MOZ_MAIL_NEWS - if ( err != noErr ) - { - fFolder.vRefNum = fFolder.parID = fFilePrototype.vRefNum = fFilePrototype.parID = 0; - return err; - } - } - break; - case CPrefs::NetHelpFolder: - { - /* - [scc:] Essentially this same code appears in uapp.cp for resolving the "Essential Files" folder. - It should be broken out into a separate static member function of |CFileMgr| a la FindWFolderInFolder. - */ - FSSpec netscapeFolderSpec = CPrefs::GetFolderSpec(CPrefs::NetscapeFolder); - // Build a partial path to the guts folder starting from a folder we know (the Netscape folder) - Str255 partialPath; - - { - // Get the name of the guts folder - Str255 helpFolderName; - GetIndString(helpFolderName, 300, nethelpFolderName); - - // partialPath = ":" + netscapeFolderSpec.name + ":" + gutsFolderName; - // ( this may _look_ cumbersome, but it's really the most space and time efficient way to catentate 4 pstrings ) - int dest=0; - partialPath[++dest] = ':'; - for ( int src=0; srcioNamePtr = (StringPtr)&fFilePrototype.name; - dipb->ioVRefNum = fFolder.vRefNum; - dipb->ioFDirIndex = 0; - dipb->ioDrDirID = fFolder.parID; - OSErr err = PBGetCatInfoSync(&cinfo); - fFilePrototype.name[0] = 0; // there are places where a path is made from the raw prototype! - if (err == noErr) - { - fFilePrototype.vRefNum = dipb->ioVRefNum; - fFilePrototype.parID = dipb->ioDrDirID; - } - else - { - fFilePrototype.vRefNum = 0; - fFilePrototype.parID = 0; - } - return settingError; -} - -Boolean CFolderSpec::Exists() -{ - CStr63 name; - CStr63 doesntExist( NON_EXISTENT_NAME ); - - name = fFolder.name; - - return ( name != doesntExist ); -} - -//---------------------------------------------------------------------------------------- -void CPrefs::Initialize() -// Initialize all statics -// This must be called before any other preference routines. -// OK, so would somebody please add a comment as to why this can't be done in the -// constructor? -//---------------------------------------------------------------------------------------- -{ - UInt32 howMany = CountPrefsOfType(eFileSpecType); - sFileIDs = (CFolderSpec **)XP_CALLOC(1, howMany * sizeof(CFolderSpec *)); - ThrowIfNil_( sFileIDs ); - for (int i=0; iGetSpecifier(prefSpec); - char* prefFile = CFileMgr::PathNameFromFSSpec(prefSpec, true); - - // Note: we call PREF_Init(NULL) in main() in uapp.cp; - // the call below does not re-initialize but loads the user prefs file. - if ( PREF_Init(prefFile) == JS_TRUE ) { - sPrefFileVersion = 4; - } - XP_FREE(prefFile); - - // Read optional profile.cfg (per-profile configuration) file - FSSpec profileConfig; - profileConfig.vRefNum = prefSpec.vRefNum; - profileConfig.parID = prefSpec.parID; - LString::CopyPStr("\pprofile.cfg", profileConfig.name, 32); - if (CFileMgr::FileExists(profileConfig)) { - PREF_ReadLockFile( CFileMgr::PathNameFromFSSpec(profileConfig, true) ); - } - - // Read the lock/config file, looking in both the - // Users folder and the Essential Files folder - Boolean lockLoaded = false; - lockSpec = CPrefs::GetFilePrototype(CPrefs::RequiredGutsFolder); - GetIndString(lockSpec.name, 300, configFile); - - if (!CFileMgr::FileExists(lockSpec)) { - lockSpec = CPrefs::GetFilePrototype(CPrefs::UsersFolder); - GetIndString(lockSpec.name, 300, configFile); - } - if (CFileMgr::FileExists(lockSpec)) - { - char* lockFile = CFileMgr::PathNameFromFSSpec(lockSpec, true); - - if (lockFile) { - int lockErr = PREF_ReadLockFile(lockFile); - lockLoaded = (lockErr == PREF_NOERROR); - XP_FREE(lockFile); - - if (lockErr == PREF_BAD_LOCKFILE) { - CStr255 errStr; - GetIndString(errStr, CUserProfile::kProfileStrings, CUserProfile::kInvalidConfigFile); - ErrorManager::PlainAlert(errStr); - return eAbort; - } - } - } - - // The presence of a 'Lock' application resource means - // we should abort if the lock file failed to load - if ( !lockLoaded && ::GetResource('Lock', 128) != nil ) - { - CStr255 errStr; - GetIndString(errStr, CUserProfile::kProfileStrings, CUserProfile::kConfigFileError); - ErrorManager::PlainAlert(errStr); - return eAbort; - } - - OpenAnimationFile(lockSpec, profileConfig); - - ReadAllPreferences(); - - { // Connect to Internet Config, passing path of current - // profile directory. This allows each profile to - // contain its own IC Preferences file. - - // We do not want a stupid break to source debugger every time - StValueChanger okayToFail(UDebugging::gDebugThrow, debugAction_Nothing); - CInternetConfigInterface::ConnectToInternetConfig(/*&prefSpec*/); - } - - RegisterPrefCallbacks(); - - // ¥Êhandle the upgrade path that involves us telling the user - // that we're creating "Netscape Users", etc. - // (I don't know why this is handled here) - if ( result == eNeedUpgrade ) - { - FSSpec prefsFolder; - FSSpec oldPrefsFolder; - ProfileErr profResult; - - oldPrefsFolder = CPrefs::GetFolderSpec( CPrefs::MainFolder ); - profResult = CUserProfile::HandleUpgrade( prefsFolder, &oldPrefsFolder ); - if ( profResult == eOK || profResult == eRunAccountSetup ) - { - // ¥ user OK'ed it, so we set the prefs folder to point to the new - // place now - CPrefs::SetFolderSpec( prefsFolder, CPrefs::MainFolder ); - } - else - // ¥ user chose to Quit - return eAbort; - if ( profResult == eRunAccountSetup ) - result = eRunAccountSetup; - } - - // --EKit: Prevent failover if config is locked on auto-proxy - if ( IsLocked(ProxyConfig) && GetLong(ProxyConfig) == PROXY_STYLE_AUTOMATIC ) { - NET_SetNoProxyFailover(); - } - - return result; -} - -void CPrefs::DoWrite() -{ - if (sPrefFile == NULL) - sPrefFile = GetFileForPreferences(); - if (sPrefFile == NULL) - return; - if (!sDirty) - return; - WriteAllPreferences(); -} - -// Reads in all the preferences -void CPrefs::ReadAllPreferences() -{ - sReading = TRUE; - try - { - sDirtyOnRead = FALSE; - AssertPrefsFileOpen(fsRdPerm); - - int i = FIRSTPREF; - while(prefLoc[i].prefID != LastPref) - ReadPreference((PrefEnum)i++); - ReadMimeTypes(); - - ReadCharacterEncodings(); - - CNotifierRegistry::ReadProtocolHandlers(); - sDirty = sDirtyOnRead; - // Needs to be done after all prefs have been read - NET_SelectProxyStyle( (NET_ProxyStyle) GetLong( ProxyConfig) ); - } - catch(...) - { - ClosePrefsFile(); - sReading = FALSE; - throw; - } - sReading = FALSE; - ClosePrefsFile(); -} - -void CPrefs::WriteAllPreferences() -{ - Try_ - { - ThrowIfOSErr_(AssertPrefsFileOpen(fsRdWrPerm)); - - // --xp prefs - FSSpec prefSpec; - sPrefFile->GetSpecifier(prefSpec); - char* prefFile = CFileMgr::PathNameFromFSSpec(prefSpec, true); - - int err = PREF_SavePrefFileAs(prefFile); - ThrowIfOSErr_(err); - - // -- WritePreference now skips all prefs except for print record - WritePreference( CPrefs::PrintRecord ); - - CNotifierRegistry::WriteProtocolHandlers(); - AssertResourceExist(REVISION, REVISION_RES_ID); - Handle res = ::Get1Resource( REVISION, REVISION_RES_ID ); - if (res && *res) - { - SInt8 flags = ::HGetState(res); - ::HNoPurge(res); - if ((::GetHandleSize(res) < sizeof(long)) || (*(long *)*res != PREF_REVISION_NUMBER)) - { - ::SetHandleSize(res, sizeof(long)); - ThrowIfMemError_(); - *(long *)*res = PREF_REVISION_NUMBER; - ::ChangedResource(res); - ::WriteResource(res); - } - ::HSetState(res, flags); - } - - } - Catch_(inErr) - { - ClosePrefsFile(); - ErrorManager::PlainAlert( mPREFS_CANNOT_WRITE ); - ErrorManager::ErrorNotify(inErr, GetPString(THE_ERROR_WAS)); - } - EndCatch_ - ClosePrefsFile(); -} - -// Gets the right resource -// First tries the pref file resource fork, -// On fail, try the application resource fork -// If they both fail, throw -void CPrefs::ReadPreference(short index) -{ - switch(prefLoc[index].resType) { - case NOTSAVED: - InitializeUnsavedPref(index); - break; - case STRINGLIST: - { - CStr255 s; - - if ( sPrefFileVersion != 3 && IsNewPrefFormat(index) ) - { - // --xp prefs temp: Do this to send init prefs values to - // the right modules-- - // to be REPLACED by modules initing own prefs via callbacks - PostInitializePref(prefLoc[index].prefID, true); - - return; - } - - // Otherwise, read from old-format Prefs file - if (UsePreferencesResFile()) - { - Handle stringListHandle = ::Get1Resource(STRINGLIST, prefLoc[index].resID); - - if (stringListHandle && *stringListHandle) - { - if (::GetHandleSize(stringListHandle) >= sizeof(short)) - { - CStringListRsrc stringList(prefLoc[index].resID); - - if (stringList.CountStrings() >= prefLoc[index].refCon && - prefLoc[index].refCon > 0) // We are OK, we have a string - { - stringList.GetString(prefLoc[index].refCon, s); - goto postprocessstring; - } - } - else - { - ::RemoveResource(stringListHandle); - ::DisposeHandle(stringListHandle); - } - } - } - // drop through - sDirtyOnRead = TRUE; - - postprocessstring: - switch (prefLoc[index].prefType) { - case eStringType: - // Convert 3.0 ports from strings to ints - switch (prefLoc[index].prefID) { - case FTPProxyPort: - case GopherProxyPort: - case HTTPProxyPort: - case WAISProxyPort: - case SSLProxyPort: - case SOCKSPort: - Int32 value; - if (sscanf(s, "%ld", &value) == 1) - SetLong(value, prefLoc[index].prefID); - break; - - default: - SetString(s, prefLoc[index].prefID); - } - break; - case eBooleanType: - Boolean bvalue; - if (strcasecomp(s, "FALSE") == 0) - bvalue = false; - else if (strcasecomp(s, "TRUE") == 0) - bvalue = true; - else - break; - switch (prefLoc[index].prefID) { - case EnableJava: - case EnableJavascript: - bvalue = ! bvalue; - break; - case UseInlineViewSource: - sViewSourceInline = bvalue; - break; - } - SetBoolean(bvalue, prefLoc[index].prefID); - break; - case eLongType: - Int32 value; - if (sscanf(s, "%ld", &value) != 1) - break; - - // Magic conversions of 3.0 prefs to 4.0 units - if (prefLoc[index].prefID == PrintBackground) - SetBoolean (value != 0, PrintBackground); // was a long, now a boolean - else { - switch (prefLoc[index].prefID) { - case DiskCacheSize: - value = value / DISK_CACHE_SCALE; // was in bytes, now in K - break; - case BufferSize: - value = value * BUFFER_SCALE; // was in K, now in bytes - break; -#ifdef MOZ_MAILNEWS - case MailHeaderDisplay: - switch (value) { // see msgprefs.cpp - case SHOW_ALL_HEADERS: - value = 2; - break; - case SHOW_SOME_HEADERS: - value = 1; - break; - case SHOW_MICRO_HEADERS: - value = 0; - break; - } - break; -#endif - } - SetLong(value, prefLoc[index].prefID); - } - break; - case eColorType: - long r,g,b; - RGBColor c; - if (sscanf(s, "%ld %ld %ld", &r, &g, &b) != 3) - break; - c.red = r; - c.green = g; - c.blue = b; - - // Conversion from 3.0 colors. Use default color if - // the corresponding "use custom" box wasn't checked. - switch (prefLoc[index].prefID) { - case TextBkgnd: - if (GetLong(BackgroundColors) != CUSTOM_BACKGROUND) - c = GetColor(WindowBkgnd); - break; - case TextFore: - if (!GetBoolean(CustomTextColors)) - c = GetColor(Black); - break; - case Anchor: - if (!GetBoolean(CustomLinkColors)) - c = GetColor(Blue); - break; - case Visited: - if (!GetBoolean(CustomVisitedColors)) - c = GetColor(Magenta); - break; - } - - SetColor(c, prefLoc[index].prefID); - break; - default: - Assert_(FALSE);; - } - } - break; - case ALIASREC: - { - // Read old alias pref from resource - FSSpec folder; - folder.vRefNum = folder.parID = refNum_Undefined; - LString::CopyPStr(NON_EXISTENT_NAME, folder.name, 32); - AliasHandle a = NULL; - Boolean gotAlias = false; - Boolean fromResource = false; - - // XP prefs: Read alias as binary type - if ( sPrefFileVersion != 3 && IsNewPrefFormat(index) ) - { - int size; - void* alias; - if (PREF_CopyBinaryPref( prefLoc[index].prefName, &alias, &size ) == 0) - { - PtrToHand(alias, &(Handle) a, size); - XP_FREE(alias); - } - } - else if (UsePreferencesResFile()) - { - a = (AliasHandle)::Get1Resource( ALIASREC, prefLoc[index].resID ); - fromResource = true; - } - - if (a && *a) { - Boolean changed; - SInt8 flags = ::HGetState((Handle) a); - ::HNoPurge((Handle )a); - OSErr err = ::ResolveAlias( NULL, a, &folder, &changed ); - gotAlias = (err == noErr); - if (!gotAlias) - folder.vRefNum = folder.parID = refNum_Undefined; - ::HSetState((Handle) a, flags); - - if (fromResource) { - if (gotAlias) { - // 3.0 format alias: convert to an xp preference - ::HLock((Handle) a); - PREF_SetBinaryPref( prefLoc[index].prefName, (void*) *a, - GetHandleSize((Handle) a) ); - ::HUnlock((Handle) a); - } - } - else { - ::DisposeHandle((Handle) a); - } - } - - SetFolderSpec(folder, prefLoc[index].prefID); - - // If there is no user preference value for the alias, or the alias - // is invalid, then SetFolderSpec fills in the default location. - // We need to reflect it into a default xp pref: - if (!gotAlias) { - folder = GetFolderSpec(prefLoc[index].prefID); - AliasHandle aliasH; - OSErr err = NewAlias(nil, &folder, &aliasH); - if (err == noErr) { - Size bytes = GetHandleSize((Handle) aliasH); - HLock((Handle) aliasH); - PREF_SetDefaultBinaryPref( prefLoc[index].prefName, *aliasH, bytes ); - DisposeHandle((Handle) aliasH); - } - } - } - break; - case PRINTRECORD: - { - if (UsePreferencesResFile()) - { - Handle printHandle = ::Get1Resource( PRINTRECORD, prefLoc[index].resID); - if ( printHandle ) - { - if ( !*printHandle ) - ::LoadResource( printHandle ); - if ( *printHandle && (::GetHandleSize(printHandle) >= sizeof(TPrint))) - { - ::HNoPurge( printHandle ); - ::DetachResource( printHandle ); - sPrintRec = (THPrint)printHandle; - } - } - } - if (sPrintRec == NULL) - Try_ { - sPrintRec = UPrintingMgr::GetDefaultPrintRecord(); - } - Catch_(inErr) { - } - EndCatch_ - } - break; - default: - Assert_(FALSE);; - } -} - -// Writes the resource -// Make sure that we are only saving into pref file resource fork, -void CPrefs::WritePreference(short index) -{ - ThrowIf_(!UsePreferencesResFile()); - switch(prefLoc[index].resType) { - case ALIASREC: - { - // --ML ?? this comment: - // Do not save TemporaryFolder special case. Do not save it if - // it points to the temp directory - } - break; - case PRINTRECORD: - { - if (sPrintRec) - { - AssertResourceExist(PRINTRECORD, prefLoc[index].resID); - Handle printHandle = ::Get1Resource( PRINTRECORD, prefLoc[index].resID ); - ThrowIfNil_(printHandle); - ThrowIfNil_(*printHandle); - SInt8 flags = ::HGetState(printHandle); - ::HNoPurge(printHandle); - StHandleLocker lock((Handle)sPrintRec); - ThrowIfOSErr_(::PtrToXHand(*sPrintRec, printHandle, sizeof(TPrint))); - ::ChangedResource( printHandle ); - ::WriteResource(printHandle); - ::HSetState(printHandle, flags); - } - } - break; - default: - break; - } -} - -// NOTE: the caller of this method is responsible for disposing of the -// returned window data handle - -Handle CPrefs::ReadWindowData( short resID ) -{ - Handle theWindowData = NULL; - try { - AssertPrefsFileOpen( fsRdPerm ); - if (UsePreferencesResFile()) { - theWindowData = ::Get1Resource(WINDOWREC, resID); - if (theWindowData) { - ::HNoPurge(theWindowData); - ::DetachResource(theWindowData); - ThrowIfResError_(); - } - } - } - catch (...) { - if (theWindowData != NULL) - ::ReleaseResource(theWindowData); - - theWindowData = NULL; - } - - ClosePrefsFile(); - return theWindowData; -} - -void CPrefs::WriteWindowData( Handle data, short resID ) -{ - try - { - ThrowIfOSErr_(AssertPrefsFileOpen(fsRdWrPerm)); - UsePreferencesResFile(); - AssertResourceExist( WINDOWREC, resID ); - - Handle resHandle = ::Get1Resource( WINDOWREC, resID ); - ThrowIfNil_( resHandle ); - ThrowIfNil_( *resHandle ); - SInt8 flags = ::HGetState(resHandle); - ::HNoPurge(resHandle); - - long size; - size = ::GetHandleSize( data ); - - ::SetHandleSize( resHandle, size ); - ThrowIfMemError_(); - - ::BlockMoveData( *data, *resHandle, size ); - ::ChangedResource(resHandle); - ::WriteResource(resHandle); - ::HSetState(resHandle, flags); - } - catch (...) - { - - } - - ClosePrefsFile(); -} - -Boolean CPrefs::UsePreferencesResFile() -{ - if (sPrefFileResID != refNum_Undefined) - { - ::UseResFile(sPrefFileResID); - return TRUE; - } - return FALSE; -} - -Boolean CPrefs::UseApplicationResFile() -{ - ::UseResFile(LMGetCurApRefNum()); - return TRUE; -} - -// Find the Preference folder -- Three cases: -// 1. User launched a specific prefs file. Its parent is the prefs folder. -// 2. Single profile found. Prefs folder is the default. -// 3. Multiple profiles. Prompt user for prefs folder. -CPrefs::PrefErr CPrefs::InitPrefsFolder(short fileType) -{ - PrefErr result = eOK; - Boolean showProfiles = false; - FSSpec prefsFolder, prefSpec; - - CUserProfile::InitUserProfiles(); - - // A "profile" fileType means the Profile Manager was launched, - // so always show the profile selection dialog. - if (fileType == FILE_TYPE_PROFILES) - showProfiles = true; - - // Actually for the time being we always want the Profile Manager to appear so just set - // showProfiles to true. Fix things when we get the external app to invoke the Profile - // Manager back into the public source tree. - showProfiles = true; - - FSSpec usersFolder; - Boolean foundPrefs = FindDefaultPreferencesFolder(usersFolder, usersFolderName, true); - if (!foundPrefs) { - ErrorManager::PlainAlert(mPREFS_CANNOT_CREATE_PREFS_FOLDER); - return eAbort; - } - - CPrefs::SetFolderSpec( usersFolder, CPrefs::UsersFolder ); - - if ( sPrefFile ) - { - sPrefFile->GetSpecifier( prefSpec ); - ThrowIfOSErr_( CFileMgr::FolderSpecFromFolderID( - prefSpec.vRefNum, prefSpec.parID, prefsFolder ) ); - } - else - - { - ProfileErr err; - - usersFolder = CPrefs::GetFilePrototype( CPrefs::UsersFolder ); - if ( fileType != STARTUP_TYPE_NETPROFILE) - // ¥Êhandle user profile here - err = CUserProfile::GetUserProfile( usersFolder, prefsFolder, showProfiles, fileType ); - else - err = CUserProfile::CreateNetProfile(usersFolder, prefsFolder); - - // ¥ first time through we get the "eNeedUpgrade" error - if ( err == eNeedUpgrade ) - { - result = eNeedUpgrade; - - // ¥Êpoint to the old 3.0 Netscape Ä folder - // (but don't create it if it doesn't exist). - if ( !FindDefaultPreferencesFolder( prefsFolder, prefFolderName, false ) ) - { - // ¥ no Netscape Ä, so do the upgrade right now - // !! if returns error then need to Quit... - sPrefFileVersion = 0; - err = CUserProfile::HandleUpgrade( prefsFolder ); - - if ( err == eOK ) - result = eOK; - else if ( err == eRunAccountSetup ) - result = eRunAccountSetup; // ¥Êare we having fun yet? - else - result = eAbort; - } - } - else if ( err == eRunAccountSetup ) - result = eRunAccountSetup; - else if ( (err == eUserCancelled) || (err == eUnknownError) ) - result = eAbort; - } - - CPrefs::SetFolderSpec( prefsFolder, CPrefs::MainFolder ); - return result; -} - -/* - FindRequiredGutsFolder - - Algorithm (given definitons of usersFolder, mainFolder, netscapeFolder) - inLaunchWithPrefs is true if user double clicked on a preferences folder. - - if inLaunchWithPrefs - try to find in the mainFolder (parent of folder user clicked on) - try to find in the netscapeFolder (where app is) - try to find in the usersFolder (where the user prefs directories are) - - if !inLaunchWithPrefs - try to find in the app folder - try to find in the Netscape Ä folder (ie prefs) -*/ - -Boolean CPrefs::FindRequiredGutsFolder(Boolean inLaunchWithPrefs) -{ - FSSpec usersFolder; // always the "Netscape Users" in the preferences folder - FSSpec mainFolder; // if inLaunchWithPrefs, parent of prefs folder, otherwise "Netscape Ä" - FSSpec netscapeFolder; // the folder containing the app - FSSpec gutsFolder; - OSErr tempErr; - - ::GetIndString( gutsFolder.name, 300, prefRequiredGutsName ); - - // really get directory IDs for these folders (not parIDs) - netscapeFolder = GetFilePrototype(NetscapeFolder); - usersFolder = GetFilePrototype(UsersFolder); - mainFolder = GetFilePrototype(MainFolder); - - // see note below, but basically we are using parID of the gutsFolder - // and of the parent foldres to mean the IDs of the folders - if (inLaunchWithPrefs) - { - tempErr = CFileMgr::FindWFolderInFolder(mainFolder.vRefNum, mainFolder.parID, gutsFolder.name ,&gutsFolder.vRefNum, &gutsFolder.parID); - if (noErr != tempErr) - { - tempErr = CFileMgr::FindWFolderInFolder(netscapeFolder.vRefNum, netscapeFolder.parID, gutsFolder.name ,&gutsFolder.vRefNum, &gutsFolder.parID); - if (noErr != tempErr) - { - tempErr = CFileMgr::FindWFolderInFolder(usersFolder.vRefNum, usersFolder.parID, gutsFolder.name ,&gutsFolder.vRefNum, &gutsFolder.parID); - } - } - } - else - { - tempErr = CFileMgr::FindWFolderInFolder(netscapeFolder.vRefNum, netscapeFolder.parID, gutsFolder.name ,&gutsFolder.vRefNum, &gutsFolder.parID); - if (noErr != tempErr) - { - tempErr = CFileMgr::FindWFolderInFolder(mainFolder.vRefNum, mainFolder.parID, gutsFolder.name ,&gutsFolder.vRefNum, &gutsFolder.parID); - } - } - - // return false in case of error - if (noErr == tempErr) - { - FSSpec toSet; - - // so what we really got from FindWFolderInFolder is the directory ID - // (a shorthand reference to a specification). Now lets convert it - // into a proper specification for a folder - CFileMgr::FolderSpecFromFolderID(gutsFolder.vRefNum, gutsFolder.parID, toSet); - - SetFolderSpec(toSet, CPrefs::RequiredGutsFolder); - return (true); - } - else - { - return (false); - } -} - - -// All preferences designated "NOTSAVED" are initialized here -void CPrefs::InitializeUnsavedPref(short index) -{ - switch(prefLoc[index].prefID) { - case NetscapeFolder: - break; // Initialized automatically on startup - case MainFolder: - case UsersFolder: - case RequiredGutsFolder: - break; // Moved to InitPrefsFolder - case NewsFolder: - case SecurityFolder: - case SARCacheFolder: - case NetHelpFolder: - FSSpec folder; - folder.vRefNum = folder.parID = refNum_Undefined; - SetFolderSpec(folder, prefLoc[index].prefID); - break; - case WindowBkgnd: - RGBColor c; - c.red = c.green = c.blue = 0xC0C0; - SetColor(c, prefLoc[index].prefID); - break; - case Black: - c.red = c.green = c.blue = 0; - SetColor(c, prefLoc[index].prefID); - break; - case White: - c.red = c.green = c.blue = 0xFFFF; - SetColor(c, prefLoc[index].prefID); - break; - case Blue: - c.red = c.green = 0; - c.blue = 0xFFFF; - SetColor(c, prefLoc[index].prefID); - break; - case Magenta: - c.red = 0x5500; - c.green = 0x1A00; - c.blue = 0x8B00; - SetColor(c, prefLoc[index].prefID); - break; - default: - Assert_(FALSE);; // Unsaved prefs need to be initialized statically - } -} - -void CPrefs::SetModified() -{ - sDirty = TRUE; -} - -// Strings -Boolean CPrefs::SetString(const char* newString, PrefEnum id) -{ - Boolean changed = TRUE; - - if ( IsNewPrefFormat(id) ) - { - changed = PREF_SetCharPref( prefLoc[id].prefName, newString ); - } - - PostInitializePref(id, changed); - return changed; -} - -// Booleans -Boolean CPrefs::SetBoolean(Boolean b, PrefEnum id) -{ - Boolean changed = FALSE; - - if ( IsNewPrefFormat(id) ) - { - changed = PREF_SetBoolPref( prefLoc[id].prefName, b ); - } - PostInitializePref(id, changed); - return changed; -} - -// Longs -Boolean CPrefs::SetLong(Int32 value, PrefEnum id) -{ - Boolean changed = FALSE; - switch(id) // Constrain the values - { - case Connections: - ConstrainTo( CONNECTIONS_MIN, CONNECTIONS_MAX, value ); - break; - case BufferSize: - ConstrainTo( BUFFER_MIN, BUFFER_MAX, value ); - break; - case DiskCacheSize: - unsigned long maxSize; - FSSpec diskCacheSpec; - diskCacheSpec = GetFolderSpec(DiskCacheFolder ); - maxSize = GetFreeSpaceInBytes( diskCacheSpec.vRefNum ) / DISK_CACHE_SCALE; - ConstrainTo( DISK_CACHE_MIN, maxSize, value ); - break; - case DaysTilExpire: - if (value!= -1) - ConstrainTo( EXPIRE_MIN, EXPIRE_MAX, value ); - break; - case PrintFlags: - ConstrainTo( PRINT_CROPPED, PRINT_RESIZED, value ); - break; - case NewsArticlesMax: - ConstrainTo( NEWS_ARTICLES_MIN, NEWS_ARTICLES_MAX, value ); - break; - case CheckDocuments: - ConstrainTo( (long)CU_CHECK_PER_SESSION, (long)CU_NEVER_CHECK,value ); - break; - case BackgroundColors: - break; - case MessageFontStyle: - ConstrainTo(MSG_PlainFont, MSG_BoldItalicFont, value); - break; - case MessageFontSize: - ConstrainTo(MSG_NormalSize, MSG_Smaller, value); - break; - case ProxyConfig: - ConstrainTo(PROXY_STYLE_MANUAL, PROXY_STYLE_NONE, value); - break; - case StartupAsWhat: - ConstrainTo(STARTUP_BROWSER, STARTUP_VISIBLE, value); - break; - case BiffTimeout: - ConstrainTo(1, 1200, value); - break; - case AskMozPassword: - ConstrainTo(-1, 1, value); // See secnav.h, SECNAV_SetPasswordPrefs - break; -#ifdef MOZ_MAILNEWS - case SortMailBy: - case SortNewsBy: - ConstrainTo(MAIL_SORT_BY_DATE, MAIL_SORT_BY_SENDER, value); // See secnav.h, SECNAV_SetPasswordPrefs - break; -#endif - default: - break; - } - if ( IsNewPrefFormat(id) ) - { - changed = PREF_SetIntPref( prefLoc[id].prefName, value ); - } - PostInitializePref(id, changed); - return changed; -} - -// RGB color -Boolean CPrefs::SetColor(const RGBColor& newColor, PrefEnum id) -{ - Boolean changed = FALSE; - - if ( IsNewPrefFormat(id) ) - { - changed = PREF_SetColorPref( prefLoc[id].prefName, - newColor.red >> 8, newColor.green >> 8, newColor.blue >> 8 ); - } - else { - if ((sColors[id - FIRSTCOLOR].red != newColor.red) || - (sColors[id - FIRSTCOLOR].green != newColor.green) || - (sColors[id - FIRSTCOLOR].blue != newColor.blue)) - changed = TRUE; - sColors[id - FIRSTCOLOR] = newColor; - } - PostInitializePref(id, changed); - return changed; -} - -extern const char* CacheFilePrefix; -Boolean CPrefs::SetFolderSpec( const FSSpec& newSpec , PrefEnum id ) -{ - Boolean changed; - - FSSpec oldSpec = sFileIDs[id - FIRSTFOLDER]->GetFolderSpec(); - CStr63 oldName( oldSpec.name ); - CStr63 newName( newSpec.name ); - changed = !( oldSpec.vRefNum == newSpec.vRefNum ) && - ( oldSpec.parID == newSpec.parID ) && - ( newName == oldName ); - if (changed) - if ((id == DiskCacheFolder) && !sReading) - { - NET_SetDiskCacheSize( 0 ); // A hack to clean up the old cache directory - NET_CleanupCacheDirectory( "", CacheFilePrefix ); - NET_SetDiskCacheSize( CPrefs::DiskCacheSize ); - } - sFileIDs[id - FIRSTFOLDER]->SetFolderSpec(newSpec, id); - PostInitializePref(id, changed); - - return changed; -} - -// Called from mdmac.c to find the Java component folder -OSErr FindGutsFolder(FSSpec* outSpec) -{ - *outSpec = CPrefs::GetFolderSpec(CPrefs::RequiredGutsFolder); - - return noErr; -} - -// Called from mdmac.c to find the Java component folder -OSErr FindNetscapeFolder(FSSpec* outSpec) -{ - *outSpec = CPrefs::GetFolderSpec(CPrefs::NetscapeFolder); - - return noErr; -} - -// Called from mdmac.c to find the Java component folder -OSErr FindJavaDownloadsFolder(FSSpec* outSpec) -{ - *outSpec = CPrefs::GetFilePrototype(CPrefs::NetscapeFolder); - CStr255 downName; - ::GetIndString( downName, 14000, 5 ); -#ifdef DEBUG - if (downName.Length() < 4 ) - XP_ASSERT(false); // Someone blew away our string -#endif - LString::CopyPStr( downName, outSpec->name, 32 ); - return noErr; -} - -// Called from mkhelp.c to get the standard location of the NetHelp folder as a URL -char * FE_GetNetHelpDir() -{ - FSSpec nethelpFolder = CPrefs::GetFolderSpec(CPrefs::NetHelpFolder); - - return CFileMgr::GetURLFromFileSpec(nethelpFolder); -} - -Boolean CPrefs::GetBoolean(PrefEnum id) -{ - if ( IsNewPrefFormat(id) ) { - XP_Bool value; - PREF_GetBoolPref( prefLoc[id].prefName, &value ); - return value; - } - else return false; -} - -Int32 CPrefs::GetLong(PrefEnum id) -{ - if ( IsNewPrefFormat(id) ) { - int32 value; - PREF_GetIntPref( prefLoc[id].prefName, &value ); - return (Int32) value; - } - else return 0; -} - -char * CPrefs::GetStaticString() -{ - static char cStrings[kStaticStrCount][kStaticStrLen]; - static short currentCString = 0; - - currentCString = (currentCString + 1) % kStaticStrCount; - char* strbuffer = cStrings[currentCString]; - - return (strbuffer); -} - -CStr255 CPrefs::GetString(PrefEnum id) -{ - // --xp prefs Note: - // Be aware of performance impact here. For some frequently - // accessed prefs, we might want to cache value locally - // (e.g. HomePage is queried every time menu/toolbar is updated). - if ( IsNewPrefFormat(id) ) { - int len = kStaticStrLen; - char * value = GetStaticString(); - - // special case to handle "one-time homepage". If a homepage - // override is requested and the user hasn't seen it yet, - // load the override page instead. - if (id == HomePage) { - XP_Bool override = false; - PREF_GetBoolPref("browser.startup.homepage_override", &override); - if (override) { - char* url = NULL; - PREF_CopyConfigString("startup.homepage_override_url", &url); - PREF_SetBoolPref("browser.startup.homepage_override", false); - if (url && *url) { - strncpy(value, url, len); - XP_FREE(url); - return value; - } - } - } - - PREF_GetCharPref( prefLoc[id].prefName, value, &len ); - return value; - } - else return CStr255::sEmptyString; -} - -char* CPrefs::GetCharPtr( PrefEnum id ) -{ - if ( IsNewPrefFormat(id) ) - { - char* strbuffer = GetStaticString(); - int len = kStaticStrLen; - PREF_GetCharPref( prefLoc[id].prefName, strbuffer, &len ); - return strbuffer; - } - else return CStr255::sEmptyString; -} - -// --ML no longer inline -const RGBColor& CPrefs::GetColor( PrefEnum id ) -{ - if ( IsNewPrefFormat(id) ) - { - uint8 r, g, b; - PREF_GetColorPref( prefLoc[id].prefName, &r, &g, &b ); - static RGBColor color; - color.red = r << 8; - color.green = g << 8; - color.blue = b << 8; - return color; - } - - return sColors[ id - FIRSTCOLOR ]; -} - -FSSpec CPrefs::GetFolderSpec( PrefEnum id ) -{ - Assert_(sFileIDs[id - FIRSTFILESPEC]); - if (sFileIDs[id - FIRSTFILESPEC] == NULL) - { - FSSpec dummy; - dummy.vRefNum = dummy.parID = 0; - return dummy; - } - else - return sFileIDs[id - FIRSTFILESPEC]->GetFolderSpec(); -} - -FSSpec CPrefs::GetFilePrototype(PrefEnum id) -{ -// Assert_((id >= FIRSTFILESPEC) && (id <= LastFolder)); - Assert_(sFileIDs[id - FIRSTFILESPEC]); - if (sFileIDs[id - FIRSTFILESPEC] == NULL) - { - FSSpec dummy; - dummy.vRefNum = dummy.parID = 0; - return dummy; - } - else - return sFileIDs[id - FIRSTFILESPEC]->GetFilePrototype(); -} - -char * CPrefs::GetCachePath() -{ - if (sCachePath == NULL) - { - FSSpec cacheFolder = GetFilePrototype( DiskCacheFolder ); - sCachePath = CFileMgr::PathNameFromFSSpec(cacheFolder, FALSE); - } - return sCachePath; -} - -THPrint CPrefs::GetPrintRecord() -{ - - /* If we have already loaded a print record, whatever its origin, use that. - If not, create the default one. Note that the standard "get our print record" - code already loads the default one, if necessary. Checking again right here - is useful only for dynamically detecting when a printer has recently been - chosen on a machine for which no printer has ever before been chosen. - (It was a bug; don't hunt me down for this one.) - */ - - if (!sPrintRec) - try { - sPrintRec = UPrintingMgr::GetDefaultPrintRecord(); - } catch(...) { - } - return sPrintRec; -} - -// --Admin Kit support. Animation file must live in Essential Files -// or the user's profile folder. -void CPrefs::OpenAnimationFile(FSSpec& preferredAnim, FSSpec& secondaryAnim) -{ - char* animFileName; - if ( PREF_CopyConfigString("mac_animation_file", &animFileName) == PREF_NOERROR ) - { - Try_ { - LFile* animFile = nil; - LString::CopyPStr( (CStr32) animFileName, preferredAnim.name, 32 ); - if (CFileMgr::FileExists(preferredAnim)) { - animFile = new LFile(preferredAnim); - } else { - LString::CopyPStr( (CStr32) animFileName, secondaryAnim.name, 32 ); - if (CFileMgr::FileExists(secondaryAnim)) { - animFile = new LFile(secondaryAnim); - } - } - XP_FREE(animFileName); - if (animFile) { - animFile->OpenResourceFork(fsRdPerm); - CSpinningN::AnimResFile() = animFile->GetResourceForkRefNum(); - - MoveResourceMapBelowApp(); - } - } - Catch_(inErr) - { // file not found or something. Just ignore it. - } - } -} - -Boolean CPrefs::HasCoBrand() -{ - // Show co-brand if using a custom animation file - // (No longer true: or logo URL is changed.) - return ( CSpinningN::AnimResFile() != refNum_Undefined ); - /* || ( PREF_CopyConfigString("toolbar.logo.url", nil) == PREF_NOERROR );*/ -} - -Boolean CPrefs::IsLocked(PrefEnum id) -{ - if ( IsNewPrefFormat(id) ) { - return (Boolean) PREF_PrefIsLocked( prefLoc[id].prefName ); - } - else { - return false; - } -} - -char* CPrefs::Concat(const char* base, const char* suffix) -{ - const size_t kBufLength = 256; - static char buf[kBufLength]; - size_t blen = strlen(base); - size_t slen = strlen(suffix); - Assert_(blen+slen < kBufLength); - memcpy(buf, base, blen); - memcpy(&buf[blen], suffix, slen); - buf[blen + slen] = '\0'; - return buf; -} - -#ifdef MOZ_MAIL_NEWS -//---------------------------------------------------------------------------------------- -static void HandlePOPPassword() -// I moved some common code here. It's static because I don't want to change the header -// just for this function, which is entirely of local interest. It's called from two -// cases in PostInitializePref below. - 98/02/23 jrm -//---------------------------------------------------------------------------------------- -{ - if ( CPrefs::GetBoolean( CPrefs::RememberMailPassword )) - NET_SetPopPassword( CPrefs::GetCharPtr( CPrefs::MailPassword) ); - else - NET_SetPopPassword(NULL); -} -#endif - -//---------------------------------------------------------------------------------------- -void CPrefs::PostInitializePref(PrefEnum id, Boolean changed) -//---------------------------------------------------------------------------------------- -{ - if (changed && !sReading) - { - sDirty = TRUE; - if (gPrefBroadcaster != NULL) - gPrefBroadcaster->BroadcastMessage(msg_PrefsChanged, &id); - } - - switch(id) { -// Booleans - case ThreadMail: - case ThreadNews: - case ShowToolbar: - case DelayImages: - case ShowStatus: - case ShowURL: - case DisplayWhileLoading: - break; - case MailUseFixedWidthFont: - break; - case LeaveMailOnServer: - break; - - case MailCCSelf: - break; - - case NewsCCSelf: - break; - case UseFancyNews: - case ShowAllNews: - break; - case AnchorUnderline: - case UseFancyFTP: - case LoadHomePage: - case ExpireNever: - case CustomLinkColors: - case ShowDirectory: - case AgreedToLicense: - case EnteringSecure: - case LeavingSecure: - case ViewingMixed: - case SubmittingInsecure: - case ShowSecurity: - case CustomVisitedColors: - case CustomTextColors: - - case DefaultMailDelivery: - case EnableActiveScrolling: -#ifdef EDITOR - case EditorUseCustomColors: - case EditorUseBackgroundImage: - case PublishMaintainLinks: - case PublishKeepImages: - case ShowCopyright: - case ShowFileEditToolbar: - case ShowCharacterToolbar: - case ShowParagraphToolbar: -#endif - break; - - case UseDocumentColors: - LO_SetUserOverride(!GetBoolean(id)); - break; - case UseSigFile: - break; - case AutoDetectEncoding: - case StrictlyMIME: -#ifdef MOZ_MAIL_NEWS - MIME_ConformToStandard(GetBoolean(id)); -#endif // MOZ_MAIL_NEWS - break; - case UseUtilityBackground: - break; - case UseInlineViewSource: - break; - - case ShowToolTips: - CToolTipAttachment::Enable(GetBoolean(ShowToolTips)); - break; - - case UseInternetConfig: - break; - - case EnableJava: -#if defined (JAVA) - LJ_SetJavaEnabled( (PRBool)CPrefs::GetBoolean( CPrefs::EnableJava ) ); -#endif /* defined (JAVA) */ - break; -// Longs - case LicenseVersion: - case TopLeftHeader: - case TopMidHeader: - case TopRightHeader: - case BottomLeftFooter: - case BottomMidFooter: - case BottomRightFooter: - case PrintBackground: - case StartupAsWhat: - case StartupBitfield: - case SortMailBy: - case SortNewsBy: - case NewsPaneConfig: - case MailPaneConfig: - case Ciphers: - case MailHeaderDisplay: - case NewsHeaderDisplay: - case AutoSaveTimeDelay: - // NOPs - break; - case DaysTilExpire: - if (GetLong(id) != -1) - GH_SetGlobalHistoryTimeout( SECONDS_PER_DAY * GetLong(id) ); - else - GH_SetGlobalHistoryTimeout( -1 ); - break; - case Connections: - NET_ChangeMaxNumberOfConnectionsPerContext(GetLong(id)); - break; - case BufferSize: - NET_ChangeSocketBufferSize( GetLong(id) ); - break; - case PrintFlags: - case NewsArticlesMax: -#ifdef MOZ_MAIL_NEWS - NET_SetNumberOfNewsArticlesInListing(GetLong(id)); -#endif - break; - case CheckDocuments: - NET_SetCacheUseMethod( (CacheUseEnum)GetLong(id) ); - break; - case FileSortMethod: - case ToolbarStyle: - case DefaultCharSetID: - case DefaultFontEncoding: - break; - case BackgroundColors: - LO_Color loColor; - loColor = MakeLOColor(GetColor(TextBkgnd )); - LO_SetDefaultColor( LO_COLOR_BG, loColor.red, loColor.green, loColor.blue); - break; - case MessageFontStyle: - case MessageFontSize: - break; -// Strings - case AcceptLanguage: - break; - case HomePage: - break; - case NewsHost: -#ifdef MOZ_MAIL_NEWS - NET_SetNewsHost( GetCharPtr(id) ); -#endif - break; - case UserName: - break; - case UserEmail: - break; - case SMTPHost: -#if defined(MOZ_MAIL_COMPOSE) || defined(MOZ_MAIL_NEWS) - NET_SetMailRelayHost( GetCharPtr(id)); -#endif // MOZ_MAIL_COMPOSE || MOZ_MAIL_NEWS - break; - case SOCKSHost: - case SOCKSPort: - CStr31 numstr; - ::NumToString(GetLong(SOCKSPort), numstr); - NET_SetSocksHost(BuildProxyString(GetString(SOCKSHost), numstr)); - break; - case Organization: - // Should we reset mail window here too? - break; - case PopHost: -#ifdef MOZ_MAIL_NEWS - HandlePOPPassword(); -#endif - break; - - case DefaultMailCC: - break; - case DefaultNewsCC: - break; - case ReplyTo: - break; - case PopID: -#ifdef MOZ_MAIL_NEWS - NET_SetPopUsername(GetCharPtr(PopID)); -#endif - break; - - case AcceptCookies: - break; - case UseEmailAsPassword: - NET_SendEmailAddressAsFTPPassword( CPrefs::GetBoolean( CPrefs::UseEmailAsPassword ) ); - break; - case SubmitFormsByEmail: - NET_WarnOnMailtoPost( CPrefs::GetBoolean( CPrefs::SubmitFormsByEmail ) ? PR_TRUE : PR_FALSE ); - break; - case DefaultPersonalCertificate: - break; -// Folders - case DownloadFolder: - case NetscapeFolder: - case MainFolder: - case SignatureFile: - case HTMLEditor: - case ImageEditor: - break; - case DiskCacheFolder: - if (sCachePath) - free(sCachePath); - sCachePath = NULL; - break; - case GIFBackdropFile: - break; - case MailFolder: - break; - case NewsFolder: - break; - case SecurityFolder: - break; -// Colors - case TextFore: - loColor = MakeLOColor(GetColor(TextFore )); - LO_SetDefaultColor( LO_COLOR_FG , loColor.red, loColor.green, loColor.blue); - break; - case TextBkgnd: - loColor = MakeLOColor(GetColor(TextBkgnd )); - LO_SetDefaultColor( LO_COLOR_BG, loColor.red, loColor.green, loColor.blue); - break; - case Anchor: - loColor = MakeLOColor(GetColor(Anchor )); - LO_SetDefaultColor( LO_COLOR_LINK, loColor.red, loColor.green, loColor.blue); - break; - case Visited: - loColor = MakeLOColor(GetColor(Visited )); - LO_SetDefaultColor( LO_COLOR_VLINK, loColor.red, loColor.green, loColor.blue); - break; - case WindowBkgnd: - case EditorText: - case EditorLink: - case EditorActiveLink: - case EditorFollowedLink: - case EditorBackground: - break; -// Print record - case PrintRecord: - break; - case LimitMessageSize: - case MaxMessageSize: - break; - case UseMozPassword: - case AskMozPassword: - case AskMozPassFrequency: - break; -#ifdef FORTEZZA - case FortezzaTimeoutOn: - case FortezzaTimeout: - if (!GetBoolean(FortezzaTimeoutOn)) - FortezzaSetTimeout(0); - else { - int timeout = GetLong(FortezzaTimeout); - - if (timeout <= 0) timeout = 1; - FortezzaSetTimeout(timeout); - } - break; -#endif - - - case BiffOn: - case BiffTimeout: - case AutoQuoteOnReply: - break; - case MailPassword: -#ifdef MOZ_MAIL_NEWS - NET_SetPopPassword( GetCharPtr( MailPassword) ); -#endif - break; - case RememberMailPassword: -#ifdef MOZ_MAIL_NEWS - HandlePOPPassword(); -#endif - break; - default: -// Assert_(FALSE); - break; - } -} - - -void CPrefs::Read1MimeTypes() -{ - // If the Prefs file is 3.0-format read it first - CMimeMapper* newMap; - if ( sPrefFileVersion == 3 && sReading && UsePreferencesResFile() ) - { - #define DYNAMIC_MIME_RES_TYPE 'MIME' - #define STATIC_MIME_RES_TYPE 'SMIM' - short howMany = ::Count1Resources( DYNAMIC_MIME_RES_TYPE ); - - // ¥ handle the case of "first launch" so that we can read all - // of the MIME types out of the application's resource fork - // (and then write them out to prefs when we quit, so that - // next time we launch, they'll be in prefs) - short i; - Handle res; - for ( i = 0; i < howMany; i++ ) - { - res = ::Get1Resource( DYNAMIC_MIME_RES_TYPE, MIME_PREFS_FIRST_RESID + i ); - if ( res && *res ) { - newMap = CMimeMapper::CreateMapperForRes(res); - sMimeTypes.InsertItemsAt( 1, LArray::index_Last, &newMap ); - } - } - howMany = ::Count1Resources( STATIC_MIME_RES_TYPE ); - for ( i = 0; i < howMany; i++ ) - { - res = ::GetResource( STATIC_MIME_RES_TYPE, i + 1 ); - if ( res && *res ) { - newMap = CMimeMapper::CreateMapperForRes(res); - sMimeTypes.InsertItemsAt( 1, LArray::index_Last, &newMap ); - } - } - } - - // Always read xp mime default & user prefs - char* children; - if ( PREF_CreateChildList("mime", &children) == 0 ) - { - int index = 0; - while (char* child = PREF_NextChild(children, &index)) { - newMap = CMimeMapper::CreateMapperFor(child, sPrefFileVersion == 4); - if (newMap) - sMimeTypes.InsertItemsAt( 1, LArray::index_Last, &newMap ); - } - XP_FREE(children); - } -} - -// Try reading in from the preferences file -// If it does not work, use the app file -void CPrefs::ReadMimeTypes() -{ - Try_ - { - Read1MimeTypes(); - } - Catch_(inErr) - { - } - EndCatch_ -} - -// Creates a mapper for an unknown type, and adds it to the list. Returns NULL on failure -CMimeMapper* CPrefs::CreateDefaultUnknownMapper(const CStr255& mimeType, Boolean doInsert) -{ - CStr255 appName; - ::GetIndString( appName, 300, unknownAppName ); - CMimeMapper * newMapper = new CMimeMapper(CMimeMapper::Unknown, - mimeType, - appName, - CStr255::sEmptyString, - '????', - 'TEXT'); - if (newMapper != NULL && doInsert) - { - sMimeTypes.InsertItemsAt( 1, LArray::index_Last, &newMapper); - sDirty = TRUE; - newMapper->WriteMimePrefs(); - } - - return newMapper; -} - -// Like CreateDefaultUnknownMapper, except that it uses the application SIG -CMimeMapper* CPrefs::CreateDefaultAppMapper(FSSpec &fileSpec,const char * mimeType, Boolean doInsert) -{ - FInfo finderInfo; - OSErr err = FSpGetFInfo(&fileSpec, &finderInfo ); - CMimeMapper * newMapper = new CMimeMapper(CMimeMapper::Launch, - CStr255(mimeType), - CStr255(fileSpec.name), - CStr255::sEmptyString, - finderInfo.fdCreator, // Signature - 'TEXT'); // File type - if (newMapper != NULL && doInsert) - { - sMimeTypes.InsertItemsAt( 1, LArray::index_Last, &newMapper); - sDirty = TRUE; - newMapper->WriteMimePrefs(); - } - return newMapper; -} - -void CPrefs::SubscribeToPrefChanges( LListener *listener ) -{ - if (gPrefBroadcaster == NULL) - gPrefBroadcaster = new LBroadcaster; - - if (gPrefBroadcaster != NULL) - gPrefBroadcaster->AddListener(listener); -} - - -void -CPrefs::UnsubscribeToPrefChanges( LListener *listener ) -{ - if (gPrefBroadcaster != NULL) - gPrefBroadcaster->RemoveListener(listener); -} - -void FE_RememberPopPassword(MWContext*, const char * password) -{ -#ifdef MOZ_MAIL_NEWS - // if we aren't supposed to remember clear anything in the registry - XP_Bool prefBool; - XP_Bool passwordProtectLocalCache; - PREF_GetBoolPref("mail.remember_password",&prefBool); - PREF_GetBoolPref("mail.password_protect_local_cache", &passwordProtectLocalCache); - - if (prefBool || passwordProtectLocalCache) - PREF_SetCharPref("mail.pop_password",(char *)password); - else - PREF_SetCharPref("mail.pop_password",""); -#else - CPrefs::SetString( password, CPrefs::MailPassword ); -#endif // MOZ_MAIL_NEWS -} diff --git a/mozilla/cmd/macfe/central/uprefd.h b/mozilla/cmd/macfe/central/uprefd.h deleted file mode 100644 index 1c61a8b4975..00000000000 --- a/mozilla/cmd/macfe/central/uprefd.h +++ /dev/null @@ -1,555 +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. - */ - -#pragma once - -#include -#include -#include - -#include "umimemap.h" -#include "prtypes.h" -// Constraints -#define SECONDS_PER_DAY 86400L -#define CONNECTIONS_MIN 1L -#define CONNECTIONS_MAX 4L -#define BUFFER_SCALE 1024 -#define BUFFER_MIN 1L * BUFFER_SCALE -#define BUFFER_MAX 32L * BUFFER_SCALE -#define DISK_CACHE_MIN 0L -#define DISK_CACHE_SCALE 1024L -#define FONT_SIZE_MIN 6L -#define FONT_SIZE_MAX 128L -#define EXPIRE_MIN 1L -#define EXPIRE_MAX 365L -#define NEWS_ARTICLES_MIN 10L -#define NEWS_ARTICLES_MAX 3500L - -#define NO_SIGNATURE_FILE 0L - -/***************************************************************************** - * class CFolderSpec - * Contains specs for the folder and a prototype spec for the file to be - * created inside this folder - * All the setting of the specs should be done through access routines.\ - * Has the smarts to default to the proper folder if setting fails. - *****************************************************************************/ -struct CFolderSpec -{ -public: - CFolderSpec(); - // ¥ sets the specs for this folder - OSErr SetFolderSpec(FSSpec newSpec, int folderID); - - // ¥ gets the specs of the folder - FSSpec GetFolderSpec() {return fFolder;} - - // ¥ gets a prototype for the file inside this folder - FSSpec GetFilePrototype() {return fFilePrototype;} - - Boolean Exists(); -private: - FSSpec fFolder; // Specs of the folder (vol, parent, + folder name) - FSSpec fFilePrototype; // Prototype specs for the file to be created inside this folder -}; - -// ¥ CCharSet is a struct for saving the font and size information associated -// with a character set encoding - -struct CCharSet -{ -public: - CStr31 fEncodingName; - CStr31 fPropFont; - CStr31 fFixedFont; - unsigned short fPropFontSize; - unsigned short fFixedFontSize; - unsigned short fCSID; - unsigned short fFallbackFontScriptID; - unsigned short fTxtrButtonResID; - unsigned short fTxtrTextFieldResID; - unsigned short fPropFontNum; - unsigned short fFixedFontNum; -}; -typedef struct CChrarSet CChrarSet; -struct CCharSetInRsrc -{ -public: - CStr31 fEncodingName; - CStr31 fPropFont; - CStr31 fFixedFont; - unsigned short fPropFontSize; - unsigned short fFixedFontSize; - unsigned short fCSID; - unsigned short fFallbackFontScriptID; - unsigned short fTxtrButtonResID; - unsigned short fTxtrTextFieldResID; -}; -typedef struct CChrarSetInRsrc CChrarSetInRsrc; - -/********************************************************************************* - * DOGBERT XP PREFERENCES / MULTI-USER PROFILES - * - * New preference file format: XP text file parsed by JavaScript via libpref - * (includes all user strings, bools, ints, and colors). - * Some prefs (see below) are still written in old resource format. - * Both old and new prefs are read & written to the existing Netscape Prefs file. - * - * Primary changes to this file: - * - added GetUserProfile() and InitPrefsFolder() to prompt user for desired - * profile (if necessary) and use that to point to base Preferences folder. - * - changed order of PrefEnum entries and added XP prefName strings. - * - ReadPreference, if it detects new format, only needs to call - * PostProcessPrefChange for each pref to propagate the new value. - * Calls to back-end will GO AWAY as modules fetch their own pref values. - * - ReadPreference otherwise reads old-format file. - * - WritePreference always writes new format. - * - CPrefs Get/Setters use libpref calls. - * - removed CPrefs storage of strings, bools, ints, and colors. - * - file/folder aliases accessed as libpref binary types but still stored - * in CPrefs via sFileIDs. - * - * Some prefs are not yet supported in XP format. - * - mime types - * - font encodings - * - window/pane positions - * - protocol handlers, etc. - * I have the first 3 partly prototyped. We at least need to support the first - * two in XP format for use by Admin Kit. - *********************************************************************************/ - -/********************************************************************************* - * class CPrefs - * Static class that does all preferences related tasks - * - reading/writing from a file - * - initialization - * - prefs variable access - *********************************************************************************/ -#define PREF_REVISION_NUMBER 11 -class CPrefs { -public: - - enum { msg_PrefsChanged = 'PrCh' }; - - enum PrefEnum { -/***************************************************************************** - * The law of enumeration - * - Each preference kind must be contiguous - * This is so that we can use offsets to return the right value in GetBoolean/GetString... - * - Every preference whose enum is defined must have its resource locations defined - * - NEW: The entries below MUST be in the same order as the PrefLoc struct - - *****************************************************************************/ -// Folders/Files - DownloadFolder, // Where do we store downloads - NetscapeFolder, // Where the application is - MainFolder, // Current user's preferences folder (Netscape Ä or Users:) - UsersFolder, // Netscape Users folder (contains User Profiles) - DiskCacheFolder, // Disk cache files (inside Mozilla Ä) - SignatureFile, // users signature file - GIFBackdropFile, // file to use as the backdrop - MailFolder, // Mail folder - NewsFolder, // News folder - SecurityFolder, // Security folder - MailCCFile, // FCC for mail - NewsCCFile, // Fcc for news - HTMLEditor, // application to use to edit raw HTML (used in EDITOR) - ImageEditor, // application to use to edit images (used in EDITOR) - RequiredGutsFolder, // folder containing the required items for - SARCacheFolder, // Constellation Location-Independent Cache Directory TJ & ROB - NetHelpFolder, // Folder for NetHelp documents EA -// Strings - HomePage, // Home page. strlen of 0 means do not load anything - NewsHost, // News host - FTPProxy, // Proxies - GopherProxy, - HTTPProxy, - NewsProxy, - WAISProxy, - FTPProxyPort, - GopherProxyPort, - HTTPProxyPort, - NewsProxyPort, - WAISProxyPort, - NoProxies, - UserName, - UserEmail, - SMTPHost, - SOCKSHost, - SOCKSPort, - Organization, - SSLProxy, - SSLProxyPort, - PopHost, - AcceptLanguage, // string for HTTP AcceptLange header - DefaultMailCC, - DefaultNewsCC, - ReplyTo, - PopID, - AutoProxyURL, // URL for autoconfiguring proxy - MailPassword, // Mail password, encrypted - Ciphers, // ciphers that we know about - EditorAuthor, // Who should the author be for new editor documents (used in EDITOR) - EditorNewDocTemplateLocation, // When you create a new document from a template, where is the template (used in EDITOR) - EditorBackgroundImage, // what is the url for the background image for new editor documents (used in EDITOR) - PublishLocation, // location for one button publish (used in EDITOR) - PublishBrowseLocation, // location to test browse documents published with one button publish (used in EDITOR) - PublishHistory0, - PublishHistory1, - PublishHistory2, - PublishHistory3, - PublishHistory4, - PublishHistory5, - PublishHistory6, - PublishHistory7, - PublishHistory8, - PublishHistory9, - DefaultPersonalCertificate, -// Booleans - DelayImages, // Auto load of images - AnchorUnderline, // Underline of anchors - ShowAllNews, // Show all news articles. NETLIB - UseFancyFTP, // Fancy FTP. NETLIB - UseFancyNews, // Fancy NNTP. NETLIB - ShowToolbar, // Toolbar visible in main window? - ShowStatus, // Status visible in main window - ShowURL, // URL visible in main window - LoadHomePage, // Should we load home page for new - ExpireNever, // Do Links expire? - DisplayWhileLoading, - CustomLinkColors, // do we want custom colors for links - ShowDirectory, - AgreedToLicense, // has the user agreed to the license - EnteringSecure, - LeavingSecure, - ViewingMixed, - SubmittingInsecure, - ShowSecurity, - CustomVisitedColors, // custom unfollowed link colors? - CustomTextColors, // custom text colors? - UseDocumentColors, // use the document or user colors - AutoDetectEncoding, // auto detect the document encodings - UseSigFile, // should we use the signature file - StrictlyMIME, // should we always be MIME/quoted printable - UseUtilityBackground, // should we use utility background instead of stupid gray - MailUseFixedWidthFont, // Should mail messages be displayed with fixed width fonts? - UseMailFCC, // Should we Fcc for mail? - UseNewsFCC, // Should we Fcc for news? - LimitMessageSize, // Should we limit message size? - LeaveMailOnServer, // Leave mail on server? - MailCCSelf, // CC self on mail - NewsCCSelf, // CC self on news - BiffOn, // Check for mail - UseMozPassword, // Should we be using the password for Netscape - ThreadMail, // Thread mail? - ThreadNews, // Thread news? - UseInlineViewSource, // Should we use Lou's view source window? - AutoQuoteOnReply, - RememberMailPassword, // Remember mail password? - DefaultMailDelivery, - EnableJavascript, // Whether or not we allow JavaScript to execute - ShowToolTips, - UseInternetConfig, - EnableJava, // Whether or not we allow Java to execute - AcceptCookies, - UseEmailAsPassword, - SubmitFormsByEmail, - AllowSSLDiskCaching, - EnableSSLv2, - EnableSSLv3, - EnableActiveScrolling, // Dynamically update during thumb tracking -#ifdef FORTEZZA - FortezzaTimeoutOn, // Should fortezza time out -#endif -#ifdef EDITOR - EditorUseCustomColors, // Should new editor documents be set up to use custom colors (used in EDITOR) - EditorUseBackgroundImage, // Should new editor documents be set up to use a background image (used in EDITOR) - PublishMaintainLinks, // Maintain links when publishing a document (used in EDITOR) - PublishKeepImages, // Keep images with document when publishing it (used in EDITOR) - ShowCopyright, // Should we should the Copyright notice next time we "steal" something off the web (used in EDITOR) - ShowFileEditToolbar, // editor window toolbar - ShowCharacterToolbar, // editor window toolbar - ShowParagraphToolbar, // editor window toolbar -#endif // EDITOR -// Longs - DiskCacheSize, // Size of disk cache - FileSortMethod, // Method of sorting files. NETLIB - ToolbarStyle, // Toolbar display style - DaysTilExpire, // # days before links expire - Connections, // number of simultaneous connections to server - BufferSize, // size in K of network socket buffers - PrintFlags, // printing prefs - NewsArticlesMax, // maximum number of news articles to show - CheckDocuments, // when to check the network for document - DefaultCharSetID, // default character set ID - DefaultFontEncoding, - BackgroundColors, // background color mode - LicenseVersion, // License version # - MessageFontStyle, // Equivalent to enum MSG_FONT in msgcom.h - MessageFontSize, // Equivalent to enum MSG_CITATION_SIZE in msgcom.h - MaxMessageSize, // Maximum message size for fetching - TopLeftHeader, // Top Left header for printing - TopMidHeader, // Top Mid header for printing - TopRightHeader, // Top Right header for printing - BottomLeftFooter, // Bottom Left footer for printing - BottomMidFooter, // Bottom Mid footer for printing - BottomRightFooter, // Bottom Right footer for printing - PrintBackground, - ProxyConfig, // Status of proxy configuration enum NET_ProxyStyle - StartupAsWhat, // Mail/News/Browser/Visible - StartupBitfield, // What do we want to start up as if visible is set. Contains a bit set for every window we want. See BROWSER_WIN_ID in resgui.h - BiffTimeout, // Check mail how often - AskMozPassword, // Should we ask for the password (tri-value) - AskMozPassFrequency, // The frequency - SortMailBy, // How do we sort mail. See SORT_BY defines in resgui.h - SortNewsBy, // How do we sort news - NewsPaneConfig, // News window pane configuration - MailPaneConfig, // Mail window pane configuration - MailHeaderDisplay, - NewsHeaderDisplay, - AutoSaveTimeDelay, -#ifdef FORTEZZA - FortezzaTimeout, // When fortezza should time out -#endif -// Colors - Black, - White, - Blue, - Magenta, - WindowBkgnd, - Anchor, - Visited, - TextFore, - TextBkgnd, - EditorText, // used to create new documents(used in EDITOR) - EditorLink, // used to create new documents(used in EDITOR) - EditorActiveLink, // used to create new documents (used in EDITOR) - EditorFollowedLink, // used to create new documents (used in EDITOR) - EditorBackground, // used to create new documents (used in EDITOR) - Citation, -// Print record - PrintRecord, - -// Termination - LastPref -}; - - -#define FIRSTPREF DownloadFolder - -#define FIRSTCOLOR Black -#define FIRSTFOLDER DownloadFolder -#define FIRSTLONG DiskCacheSize -#define FIRSTBOOLEAN DelayImages -#define FIRSTSTRING HomePage -#define FIRSTFILESPEC DownloadFolder - -// ¥¥ Initialization, Reading Writing - static void Initialize(); - enum PrefErr { eAbort = -1, - eNeedUpgrade, - eOK, - eRunAccountSetup // ¥Êthis is totally scwewy - }; - - - static PrefErr DoRead(LFile * file, short fileType); - static void DoWrite(); - - static void SubscribeToPrefChanges( LListener *listener ); - static void UnsubscribeToPrefChanges( LListener *listener); - -private: - static void ReadAllPreferences(); - static void ReadPreference(short index); - static void InitializeUnsavedPref(short index); - - static void WriteAllPreferences(); - static void WritePreference(short index); - - static PrefErr InitPrefsFolder(short fileType); - static Boolean FindRequiredGutsFolder(Boolean inLaunchWithPrefs); - static void OpenAnimationFile(FSSpec&, FSSpec&); - static void RegisterPrefCallbacks(); - static int FSSpecPrefCallback(const char *prefString, void *enumValue); - static int ColorPrefCallback(const char *prefString, void *); - -// ¥¥ÊUtility routines - -public: - // Put pref res file on top of resource chain. Does not open it - static Boolean UsePreferencesResFile(); - // Put application res file on top - static Boolean UseApplicationResFile(); - -// ¥¥ Access - -public: - static Boolean GetBoolean(PrefEnum id); - static Int32 GetLong(PrefEnum id); - static CStr255 GetString(PrefEnum id); - static char* GetCharPtr( PrefEnum id ); - static const RGBColor& GetColor( PrefEnum id ); // --ML de-inlined - - static THPrint GetPrintRecord(); - static FSSpec GetFolderSpec( PrefEnum id ); - static FSSpec GetFilePrototype(PrefEnum id); - static char * GetCachePath(); - -// Reading/writing of data associated with a window - static Handle ReadWindowData( short resID ); - static void WriteWindowData( Handle data, short resID ); - - -// ¥¥ Setting of preferences - static void SetModified(); - static Boolean SetBoolean( Boolean value, PrefEnum id); - static Boolean SetLong( Int32 value, PrefEnum id); - static Boolean SetString( const char* newString, PrefEnum id); - static Boolean SetColor( const RGBColor& newColor, PrefEnum id); - static Boolean SetFolderSpec( const FSSpec& folderSpec, PrefEnum id); - - static Boolean HasCoBrand(); - static Boolean IsLocked( PrefEnum id ); - - static FSSpec GetTempFilePrototype(); // vRefNum and parID for a file in 'Temporary Items - - static Boolean IsNewPrefFormat(short id); - static char* Concat(const char* base, const char* suffix); - -private: - enum { kStaticStrCount = 8, - kStaticStrLen = 256 - }; - static char* GetStaticString(); - static void PostInitializePref(PrefEnum id, Boolean changed); -private: - static RGBColor * sColors; - static CFolderSpec ** sFileIDs; - static THPrint sPrintRec; - static char * sCachePath; - - static FSSpec sTemporaryFolder; - static Boolean sRealTemporaryFolder; // did FindFolder work ? - -// ¥¥ MIME mappers - // ¥ create a default MIME mapper for a given MIME type. doInsert inserts it into master - // MIME type list -private: - static void ReadMimeTypes(); - static void Read1MimeTypes(); - -public: - static CMimeMapper* CreateDefaultUnknownMapper( const CStr255& mimeType, Boolean doInsert ); - - // ¥ like CreateDefaultUnknownMapper, except that it uses the application SIG - static CMimeMapper* CreateDefaultAppMapper( FSSpec& fileSpec, // application file - const char* mimeType, // mime type - Boolean doInsert ); - // MIME types - created dynamically - static CMimeList sMimeTypes; // List of CMimeMappers. CMimeList holds routines to manipulate them - static short sPrefFileVersion; - static Boolean sViewSourceInline; - -// ¥¥ Font encoding stuff - - static void ReadCharacterEncodings(); - static void ReadXPFont(int16 csid, CCharSet* csFont); - static Boolean GetFont( UInt16 csid, CCharSet* font ); - static Boolean GetFontAtIndex( unsigned long index, CCharSet* font ); - static int16 CmdNumToWinCsid( int32 cmdNum); - static int16 CmdNumToDocCsid( int32 cmdNum); - static int32 WinCsidToCmdNum( int16 csid); - - static Boolean SetFont(const CStr255& EncodingName,const CStr255& PropFont,const CStr255& FixedFont, - unsigned short PropFontSize, unsigned short FixedFontSize, unsigned short CSID, unsigned short FallbackFontScriptID, - unsigned short TxtrButtonResID, unsigned short TxtrTextFieldResID); - static Int16 GetButtonFontTextResIDs(unsigned short csid); - static Int16 GetTextFieldTextResIDs(unsigned short csid); - static LArray* GetCharSets() { return fCharSetFonts; } - static short GetProportionalFont(unsigned short csid); - static short GetFixFont(unsigned short csid); - static ScriptCode CsidToScript(int16 csid); - - static LArray* fCustomLangList; - static LArray* fPreferLangList; - - static LArray* fCharSetFonts; - static CCharSet fDefaultFont; -}; - -Boolean GetCharacterSet( LArray* fontSets, const CStr255& encodingName, CCharSet* font ); -/***************************************************************************** - * GLOBALS - *****************************************************************************/ - -// ¥¥ File name constants. See custom.r for these strings, STR# 300 -enum pref_Strings { prefFolderName = 1 - , prefFileName = 2 - , globHistoryName = 3 - , cacheFolderName = 4 - , cacheLog = 5 - , newsrc = 6 - , bookmarkFile = 7 - , mimeTypes = 8 - , magicCookie = 9 - , socksConfig = 10 - , allNewsgroups = 11 - , newsFileMap = 12 - , certDB = 13 - , certDBNameIDX = 14 - , mailFolderName = 15 - , newsFolderName = 16 - , securityFolderName = 17 - , mailBoxExt = 18 - , mailFilterFile = 19 - , mailPopState = 20 - , proxyConfig = 21 - , keyDb = 22 - , xoverCache = 23 - , addressBookFile = 24 - , mailCCfile = 25 - , newsCCfile = 26 - , extCacheFile = 27 - , subdirExt = 28 - , newsHostDatabase = 29 - , configFile = 30 - , userProfiles = 31 - , mailFilterLog = 32 - , theRegistry = 33 - , prefRequiredGutsName = 34 - , sarCacheFolderName = 35 - , sarCacheIndex = 36 - , ibm3270Folder = 37 - , ibm3270File = 38 - , htmlAddressBook = 39 - , vCardExt = 40 - , ldifExt1 = 41 - , ldifExt2 = 42 - , secModuleDb = 43 - , usersFolderName = 44 - , unknownAppName = 45 - , aswName = 46 - , nethelpFolderName = 47 - , mailFolderCache = 48 - , profileTemplateDir = 49 - , cryptoPolicy = 50 - , signedAppletDb = 51 - , cookiePermissions = 52 - , singleSignons = 53 - , jsConfig = 54 //autoadmin - }; diff --git a/mozilla/cmd/macfe/central/userprofile.cp b/mozilla/cmd/macfe/central/userprofile.cp deleted file mode 100644 index 5bc19224cc0..00000000000 --- a/mozilla/cmd/macfe/central/userprofile.cp +++ /dev/null @@ -1,2018 +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. - */ - -#include "userprofile.h" -#include "client.h" -#include "UStdDialogs.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "uapp.h" -#include "uprefd.h" -#include "prefwutil.h" -#include "macutil.h" -#include "prefapi.h" -#include "resgui.h" -#include "xp_file_mac.h" -#include "DirectoryCopy.h" - -// for multi-user profile support in PE -#include "MUC.h" -#include -#include -#include - - -#define updateWizardDialog 9800 - -#define profilePEPane 9801 -#define profileIntroPane 9802 -#define userNamePane 9803 -#define profileNamePane 9804 -#define profileFolderPane 9805 -#define profileIconsPane 9806 -#define profileDonePane 9807 - -#define profileSelectDialog 9900 -#define profileManagerDialog 9901 - -// NOTE: Magic name must be kept in sync with ns/modules/libreg/src/reg.h -#define MAGIC_PROFILE_NAME "User1" - -const char* kProfileNamePref = "profile.name"; - -/***************************************************************************** - * The resource format for storing profile metadata (i.e., username and - * email) in the profile database so it can be easily searched. In order - * to allow an arbitrary amount of metadata, the resource is divided into - * a header section, which counts the number of metadata items and the length - * to each, and a data section, which simply consists of the data in packed - * format. The offset to each set of data is the sum of the first offset - * plus all of the lengths. Strings are null terminated for convenience. - * All of this is stored in the profile database in a 'DATA' resource - * which corresponds to the id of the profile in use. - ****************************************************************************/ - -/* The version of the metadata for Nav 4.0 */ - -typedef struct { - short int count; - short int firstOffset; - long int nameLength; - long int emailLength; - /* New data element lengths would go here, along with a corresponding - change in the count and firstOffset items */ - /* Data follows here */ -} ProfileDataHeader; - -MODULE_PRIVATE int PR_CALLBACK ProfilePrefChangedFunc(const char *pref, void *data); - -CFragConnectionID CUserProfile::mConfigPluginID; - -class LWhiteListBox: public LListBox -{ -#if !defined(__MWERKS__) || (__MWERKS__ >= 0x2000) - typedef LListBox inherited; -#endif - -public: - enum { class_ID = 'Lwht' }; - - LWhiteListBox( LStream* inStream ); - - virtual Boolean FocusDraw(LPane* inSubPane = nil); - virtual void DrawSelf(); -}; - -LWhiteListBox::LWhiteListBox( LStream* inStream ): LListBox( inStream ) -{ -} - -Boolean LWhiteListBox::FocusDraw(LPane* /*inSubPane*/) -{ - const RGBColor rgbWhite = { 0xFFFF, 0xFFFF, 0xFFFF }; - - if ( inherited::FocusDraw() ) - { - ::RGBBackColor( &rgbWhite ); - return TRUE; - } - return FALSE; -} - -void LWhiteListBox::DrawSelf() -{ - Rect frame; - - this->CalcLocalFrameRect( frame ); - ::EraseRect( &frame ); - LListBox::DrawSelf(); -} - -MODULE_PRIVATE int PR_CALLBACK ProfilePrefChangedFunc(const char *pref, void * /* data */) -{ - FSSpec profileSpec = CPrefs::GetFilePrototype(CPrefs::UsersFolder); - GetIndString(profileSpec.name, 300, userProfiles); - - CUserProfileDB profile(profileSpec); - - if ((!XP_STRCASECMP(pref,"mail.identity.username")) || - (!XP_STRCASECMP(pref,"mail.identity.useremail"))) - { - profile.SetProfileData( CUserProfile::sCurrentProfileID ); - } - else if (!XP_STRCMP(pref, kProfileNamePref)) - { - char profileName[255]; - int len = 255; - if ( PREF_GetCharPref(kProfileNamePref, profileName, &len) == PREF_NOERROR ) - { - profile.SetProfileName( CUserProfile::sCurrentProfileID, (CStr255) profileName ); - } - } - - return 0; -} - -class CProfilePaneMonitor : public LListener -{ - public: - CProfilePaneMonitor(CDialogWizardHandler*); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - private: - CDialogWizardHandler* fWizard; - Boolean fCopiedName; -}; - -/***************************************************************************** - * class CUserProfile - * - * Dialog handlers & wizards for multi-user profile support. - * - *****************************************************************************/ - -short CUserProfile::sCurrentProfileID = CUserProfile::kInvalidProfileID; -Boolean CUserProfile::mHasConfigPlugin = FALSE; -Boolean CUserProfile::mPluginLoaded = FALSE; - -void CUserProfile::InitUserProfiles() -{ - mHasConfigPlugin = ( LoadConfigPlugin() != NULL ); - if ( mHasConfigPlugin ) - CloseConfigPlugin(); -} - -// Attempts to open "User Profiles" and put up a selection dialog. -// Returns the location of the user's selected Prefs folder. -ProfileErr -CUserProfile::GetUserProfile( const FSSpec& usersFolder, FSSpec& profileFolder, - Boolean showDialog, short fileType ) -{ - ProfileErr result = eOK; - Boolean done = true; - Boolean wantsProfileManager = showDialog; - FSSpec profileSpec; - short numProfiles = 1; - CStr31 profileName; - - // ¥ÊprofileSpec here is "User Profiles" - profileSpec.vRefNum = usersFolder.vRefNum; - profileSpec.parID = usersFolder.parID; - GetIndString( profileSpec.name, 300, userProfiles ); - - // ¥ÊI have no idea why this is so convoluted - - if ( !CFileMgr::FileExists( profileSpec ) ) - return eNeedUpgrade; - - if ( DeleteMagicProfile( profileSpec ) ) - return eNeedUpgrade; - - CUserProfileDB profileDB( profileSpec ); - do - { - Try_ - { - short newUserID = 0; - short lastUserID = profileDB.GetLastProfileID(); - - // ¥Êonly put up dialog if there's more than one user - if ( showDialog || profileDB.CountProfiles() > 1 ) - { - // HACK ALERT!!!!! - // If we're being asked to open a doc or get a URL just skip the dialog - // and use the last profile that was selected - if ( (fileType == FILE_TYPE_ODOC) || (fileType == FILE_TYPE_GETURL) ) - { - newUserID = lastUserID; - if ( profileDB.GetProfileAlias( newUserID, profileFolder ) ) - result = eOK; - else - result = eUnknownError; - - } - else - // END HACK ALERT!!!!! - result = HandleProfileDialog( - profileSpec, - profileDB, - profileFolder, - newUserID, - lastUserID, - wantsProfileManager ); - - if ( result >= 0 && lastUserID != newUserID ) - profileDB.SetLastProfileID( newUserID ); - - if ( result >= eOK ) - PREF_RegisterCallback("mail.identity",ProfilePrefChangedFunc, NULL); - done = true; - } - else - { - newUserID = lastUserID; - Try_ - { - if ( profileDB.GetProfileAlias( lastUserID, profileFolder ) ) - result = eOK; - else - result = eUnknownError; - } - Catch_ ( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kReadError ); - ErrorManager::ErrorNotify( inErr, errStr ); - } - - if ( result < eOK ) - { - // ¥ if we failed to load the profile, loop back to the - // beginning and force Profile Manager to appear - done = false; - showDialog = wantsProfileManager = true; - } - else - { - long err; - err = SendMessageToPlugin( kAutoSelectDialConfig, &profileFolder ); - if ( err == errProfileNotFound ) - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - - PREF_RegisterCallback( "mail.identity",ProfilePrefChangedFunc, NULL ); - } - } - - // ¥ save the previous user ID back to profile db - if ( result >= eOK ) - { - sCurrentProfileID = newUserID; - numProfiles = profileDB.CountProfiles(); - } - } - Catch_ ( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kReadError ); - ErrorManager::ErrorNotify( inErr, errStr ); - result = eUnknownError; - } - } - while ( !done ); - - if (result != eUserCancelled) { - // ¥Êreflect path & name into xp preferences - if (sCurrentProfileID != kInvalidProfileID) - profileDB.GetProfileName( sCurrentProfileID, profileName ); - ReflectToPreferences(profileName, profileFolder, numProfiles); - } - return result; -} - -static void PrefToEditField(const char * prefName, LEditField * field); -static void EditFieldToPref(LEditField * field, const char * prefName); - -const Uint32 PREF_STRING_LEN = 255; -void PrefToEditField(const char * prefName, LEditField * field) -{ - int prefStringLen; - char prefString[PREF_STRING_LEN]; - prefStringLen = PREF_STRING_LEN; - if ( PREF_GetCharPref(prefName, prefString, &prefStringLen) == 0 ) - { - c2pstr(prefString); - field->SetDescriptor((unsigned char *)prefString); - } -} - -void EditFieldToPref(LEditField * field, const char * prefName) -{ - Str255 s; - field->GetDescriptor(s); - p2cstr(s); - PREF_SetCharPref(prefName, (char*)s); -} - -// Displays the additional data login dialog. Throws are taken care of by -// the caller -void -CUserProfile::DoNetExtendedProfileDialog(LCommander * super) -{ - StDialogHandler theHandler(9911, super); - LWindow *theDialog = theHandler.GetDialog(); - - LEditField *ldapAddressField = dynamic_cast(theDialog->FindPaneByID('addr')); - LEditField *searchBaseField = dynamic_cast(theDialog->FindPaneByID('sbas')); - LEditField *httpAddressField = dynamic_cast(theDialog->FindPaneByID('hurl')); - LControl * ldapRadio = dynamic_cast(theDialog->FindPaneByID('ldap')); - LControl * httpRadio = dynamic_cast(theDialog->FindPaneByID('http')); - - ThrowIfNil_(ldapAddressField); - ThrowIfNil_(searchBaseField); - ThrowIfNil_(httpAddressField); - ThrowIfNil_(ldapRadio); - ThrowIfNil_(httpRadio); - -// Initialize the dialog from the preferences -// PrefToEditField("li.server.ldap.serverName", ldapAddressField ); -// PrefToEditField("li.server.ldap.searchBase", searchBaseField ); -// PrefToEditField("li.server.http.baseURL", httpAddressField); - ldapRadio->SetValue(1); - int prefStringLen; - char prefString[PREF_STRING_LEN]; - prefStringLen = PREF_STRING_LEN; - if ( PREF_GetCharPref("li.protocol", prefString, &prefStringLen) == 0 ) - if (XP_STRCMP(prefString, "http") == 0) - httpRadio->SetValue(1); - -// Do the dialog - httpAddressField->SelectAll(); - theDialog->SetLatentSub(httpAddressField); - theDialog->Show(); - - while (true) - { - MessageT hitMessage = theHandler.DoDialog(); - if ( hitMessage == msg_Cancel ) - break; - else if ( hitMessage == msg_OK ) - { - - LStr255 httpAddress; - httpAddressField->GetDescriptor(httpAddress); - if ( httpAddress.Length() > 2 ) - { - if (!httpAddress.BeginsWith(LStr255("http://"))) - httpAddress.Insert(LStr255("http://"), 0); - } - EditFieldToPref(ldapAddressField, "li.server.ldap.serverName"); - EditFieldToPref(searchBaseField, "li.server.ldap.searchBase"); - EditFieldToPref(httpAddressField, "li.server.http.baseURL"); - - if ( ldapRadio->GetValue() > 0 ) - PREF_SetCharPref("li.protocol", "ldap"); - else - PREF_SetCharPref("li.protocol", "http"); - - break; - } - } -} - -// Displays the modal login dialog -ProfileErr -CUserProfile::DoNetProfileDialog() -{ - ProfileErr perr = eOK; - try - { - StDialogHandler theHandler(9910, CFrontApp::GetApplication()); - LWindow *theDialog = theHandler.GetDialog(); - - LEditField *usernameField = dynamic_cast(theDialog->FindPaneByID('user')); - LEditField *passwordField = dynamic_cast(theDialog->FindPaneByID('pass')); - - ThrowIfNil_(usernameField); - ThrowIfNil_(passwordField); - - usernameField->SelectAll(); - theDialog->SetLatentSub(usernameField); - theDialog->Show(); - - while (true) - { - MessageT hitMessage = theHandler.DoDialog(); - - if (hitMessage == msg_Cancel) - { - perr = eUserCancelled; - break; - } - else if (hitMessage == msg_OK) - { - EditFieldToPref( usernameField, "li.login.name"); - EditFieldToPref( passwordField, "li.login.password"); - - PREF_SetBoolPref("li.enabled", true); - perr = eOK; - break; - } - else if (hitMessage == 'adva') // Advanced button - { - DoNetExtendedProfileDialog(theDialog); - } - } - } - catch (ExceptionCode err) - { - XP_ASSERT(false); - perr = eUnknownError; - } - - return perr; -} - -// Creates a network profile folder -// The folder is located inside the users folder -ProfileErr -CUserProfile::CreateNetProfile( FSSpec usersFolder, FSSpec& profileFolderSpec ) -{ - ProfileErr perr; - perr = DoNetProfileDialog(); - - if (perr == eOK) - { - try - { - CStr255 profileFolderName("Temporary Profile"); - OSErr err; - - // Create the folder spec of the profile directory - profileFolderSpec = usersFolder; - LString::CopyPStr(profileFolderName, profileFolderSpec.name, sizeof(profileFolderSpec.name)); - - // If the folder already exists, delete it - err = CFileMgr::DeleteFolder( profileFolderSpec ); - XP_ASSERT((err == noErr) || (err == fnfErr)); - - // Create the folder - short dummy; - long dummy2; - err = CFileMgr::CreateFolderInFolder(usersFolder.vRefNum, usersFolder.parID, profileFolderName, - &dummy, &dummy2); - ThrowIfOSErr_(err); - ReflectToPreferences( CStr255("Network Profile"), profileFolderSpec); - } - catch (ExceptionCode err) - { - XP_ASSERT(false); - return eUnknownError; - } - } - - return perr; -} - -// ¥Êlaunches upgrade wizard for users who have not run 4.0 before -// creates an initial profile folder and User Profiles file. -// if oldNetscapeF is non-null, it points to the user's 3.0 -// Netscape Ä folder and the profile "folder" is an alias to it -ProfileErr -CUserProfile::HandleUpgrade( FSSpec& profileFolder, const FSSpec* oldNetscapeF ) -{ - ProfileErr result = eOK; - CStr31 profileName; - - do - { - Try_ - { - FSSpec profileSpec = CPrefs::GetFilePrototype( CPrefs::UsersFolder ); - - if ( mHasConfigPlugin && !oldNetscapeF ) - { - profileFolder.vRefNum = profileSpec.vRefNum; - profileFolder.parID = profileSpec.parID; - profileName = MAGIC_PROFILE_NAME; - LString::CopyPStr( profileName, profileFolder.name, 32 ); - - CreateDefaultProfileFolder( profileFolder ); - result = eRunAccountSetup; - } - else - { - UpgradeEnum upgrading = (oldNetscapeF == nil) ? eNewInstall : eExistingPrefs; - result = NewUserProfile( profileSpec, profileFolder, profileName, - upgrading, oldNetscapeF ); - } - if ( result == eUserCancelled ) - return eUserCancelled; - - if ( profileName.Length() == 0 ) - GetIndString( profileName, kProfileStrings, kDefaultName ); - - // ¥Êcreate Profiles file and add the alias - GetIndString( profileSpec.name, 300, userProfiles ); - CUserProfileDB profileDB( profileSpec, true ); - - profileDB.AddNewProfile( 0, profileName, profileFolder ); - sCurrentProfileID = 0; - } - Catch_( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kCreateError ); - ErrorManager::ErrorNotify( inErr, errStr ); - result = eUnknownError; - // ¥Êloop through wizard again if error - // don't loop 5/14/97 tgm - //done = false; - } - } - while ( 0 /*!done*/); - - ReflectToPreferences(profileName, profileFolder); - - return result; -} - -// ¥ puts up user-selection dialog and returns selected user ID -ProfileErr CUserProfile::HandleProfileDialog( - FSSpec& profileSpec, - CUserProfileDB& profileDB, - FSSpec& profileFolder, - short& newUserID, - short lastUserID, - Boolean wantsProfileManager ) -{ - int dialogID = wantsProfileManager ? - profileManagerDialog : profileSelectDialog; - Boolean success = false; - LListBox* listBox; - LPushButton* okButton; - LPane* newButton; - LPane* deleteButton; - LPane* renameButton; - LPane* optionsButton; - - ProfileErr result = eOK; - - RegisterClass_( LWhiteListBox); - - StBlockingDialogHandler dialog( dialogID, CFrontApp::GetApplication() ); - - listBox = (LListBox*)dialog.GetDialog()->FindPaneByID( 'user' ); - ThrowIfNil_( listBox ); - ListHandle listHand = listBox->GetMacListH(); - (**listHand).selFlags = lOnlyOne + lNoNilHilite; // only one selection - - LAddColumn( 1, 0, listHand ); - PopulateListBox( listHand, profileDB, lastUserID ); - - listBox->AddListener( &dialog ); - listBox->SwitchTarget( listBox ); - - okButton = dynamic_cast(dialog.GetDialog()->FindPaneByID( 'ok ' )); - deleteButton = dialog.GetDialog()->FindPaneByID( 2 ); - renameButton = dialog.GetDialog()->FindPaneByID( 3 ); - newButton = dialog.GetDialog()->FindPaneByID( 1 ); - optionsButton = dialog.GetDialog()->FindPaneByID( 'Ebut' ); - - if ( wantsProfileManager ) - ThrowIfNil_( okButton && deleteButton && renameButton && newButton ); - else - ThrowIfNil_( okButton ); - - if ( !mHasConfigPlugin ) - { - if ( optionsButton ) - optionsButton->Hide(); - } - else - { - if ( !wantsProfileManager ) - SendMessageToPlugin( kInitListener, (LDialogBox*)dialog.GetDialog() ); - } - - short tempUserID = -1; - - /* keep track of the amount of time we've been idly showing this dialog */ - long startTime = TickCount(); - long elapsedTime = 0; - long secsLeft = 20; //we can also get this from a resource in the User Profiles file if it exists. - Boolean keepCounting = true; // (!wantsProfileManager); /* only countdown in simple profile picker. not manager*/ - const ResIDT autoStartResID = 9999; - - // Check to see if our secret keep counting resource exists - if not, use default secsLeft - StUseResFile resFile( profileDB.GetFile()->GetResourceForkRefNum() ); - StringHandle numSecsStringH = (StringHandle) ::Get1Resource('TEXT', autoStartResID); - if (keepCounting && numSecsStringH) - { - char buffer[4]; - buffer[sizeof(buffer)-1] = 0; - - memcpy( (unsigned char *)buffer, (unsigned char *)*numSecsStringH, min(GetHandleSize((Handle)numSecsStringH),(long)sizeof(buffer)-1)); - secsLeft = atoi(buffer); - if (secsLeft <= 0) - keepCounting = false; - } - - - while ( !success ) - { - //Ê¥ catch any errors inside dialog loop - Try_ - { - Cell cell; - - MessageT hit = dialog.DoDialog(); - - // default to selecting the last selected profile if enough time has elapsed - if (keepCounting && (secsLeft <= 0)) - { - okButton->SimulateHotSpotClick(1); - hit = cmd_SelectProfile; - } - else if (keepCounting) - { - // update secsLeft - elapsedTime = TickCount() - startTime; - if (elapsedTime >= 60) - { - secsLeft--; - startTime = TickCount(); - } - } - else if (secsLeft >= 0) - secsLeft = -1; - - if (listBox->GetLastSelectedCell( cell ) ) - { - newUserID = cell.v; - okButton->Enable(); - if (wantsProfileManager) { - renameButton->Enable(); - if ( profileDB.CountProfiles() > 1 ) - // ¥Êdon't allow deleting last profile - deleteButton->Enable(); - else - deleteButton->Disable(); - } - if ( optionsButton ) - optionsButton->Enable(); - } - else - { - newUserID = -1; - okButton->Disable(); - if (wantsProfileManager) { - renameButton->Disable(); - deleteButton->Disable(); - } - if ( optionsButton ) - optionsButton->Disable(); - } - - if ( newUserID != tempUserID ) - { - if (tempUserID > -1) - keepCounting = false; - if ( newUserID != -1 && mHasConfigPlugin ) - { - if ( profileDB.GetProfileAlias( newUserID, profileFolder, false ) ) - SendMessageToPlugin( kNewProfileSelect, &profileFolder ); - else - SendMessageToPlugin( kClearProfileSelect, NULL ); - } - tempUserID = newUserID; - } - - switch ( hit ) - { - case cmd_SelectProfile: - success = profileDB.GetProfileAlias( newUserID, profileFolder ); - if ( success ) - { - long err; - err = SendMessageToPlugin( kSelectDialConfig, &profileFolder ); - if ( err == errProfileNotFound ) - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - } - keepCounting = false; - - break; - - case cmd_NewProfile: - CStr31 profileName; - result = NewUserProfile( profileSpec, profileFolder, profileName ); - - if ( result == eUserCancelled ) - { - result = eOK; - } - else - { - newUserID = profileDB.CountProfiles(); - profileDB.AddNewProfile( newUserID, profileName, profileFolder ); - - // redraw the profile list box - LDelRow(0, 0, listHand); - PopulateListBox(listHand, profileDB, newUserID); - listBox->Refresh(); - success = true; - - // ¥Êwe ran the Profile Wizard and now we should - // open the Edit Settings dialog for the associated - // dial configuration - if ( result == eRunMUC ) - { - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - result = eOK; - } - - // ¥ we ran the Profile Wizard, but we don't want to - // associate a dialing configuration, so write out - // an empty "Configuration" file by calling - // the plugin - else if ( result == eSkipMUC ) - { - SendMessageToPlugin( kAutoSelectDialConfig, &profileFolder ); - result = eOK; - } - } - keepCounting = false; - break; - - case cmd_RenameProfile: - RenameProfile( newUserID, profileDB, cell, listHand ); - keepCounting = false; - break; - - case cmd_DeleteProfile: - DeleteProfile( newUserID, profileDB, listHand ); - listBox->Refresh(); - keepCounting = false; - break; - - case cmd_QuitProfile: - keepCounting = false; - return eUserCancelled; - break; - - case cmd_EditDialSettings: - if ( profileDB.GetProfileAlias( newUserID, profileFolder ) ) - { - SendMessageToPlugin( kEditDialConfig, &profileFolder ); - tempUserID = -1; - } - keepCounting = false; - break; - } - } - Catch_ ( inErr ) - { - CStr255 errStr; - GetIndString( errStr, kProfileStrings, kReadError ); - ErrorManager::ErrorNotify( inErr, errStr ); - } - } - - return result; -} - -Boolean CUserProfile::DeleteMagicProfile( FSSpec& inSpec ) -{ - short nextID = 0; - CStr31 profileName; - FSSpec profileSpec; - char* fullURL; - Boolean found = FALSE; - - profileSpec.vRefNum = inSpec.vRefNum; - profileSpec.parID = inSpec.parID; - profileName = MAGIC_PROFILE_NAME; - LString::CopyPStr( profileName, profileSpec.name, 32 ); - - CUserProfileDB db( inSpec ); - - while ( db.GetProfileName( nextID++, profileName ) ) - { - if ( profileName == MAGIC_PROFILE_NAME ) - { - db.DeleteProfile( --nextID ); - if ( db.GetLastProfileID() == nextID ) - db.SetLastProfileID( 0 ); - found = TRUE; - break; - } - } - - fullURL = CFileMgr::EncodedPathNameFromFSSpec( profileSpec, TRUE ); - if ( fullURL && found ) - { - XP_RemoveDirectoryRecursive( fullURL, xpURL ); - XP_FREE( fullURL ); - } - if ( found ) - return TRUE; - return FALSE; -} - -void CUserProfile::PopulateListBox(ListHandle& listHand, CUserProfileDB& profileDB, short defaultID) -{ - LSetDrawingMode(false, listHand); - - short nextID = 0; - Cell cell; - CStr31 str; - Boolean gotOne = profileDB.GetProfileName(nextID, str); - while (gotOne) { - LAddRow(1, nextID, listHand); - SetPt(&cell, 0, nextID); - LSetCell(&str.fStr[1], str.fStr[0], cell, listHand); - gotOne = profileDB.GetProfileName(++nextID, str); - } - // ¥Êselect last user or first cell & scroll to it - SetPt(&cell, 0, defaultID); - LSetSelect(true, cell, listHand); - LAutoScroll(listHand); - LSetDrawingMode(true, listHand); -} - -// Ensure the requested new profile folder does not exist; -// if it does, append a number to make a unique name. -void CUserProfile::GetUniqueFolderName(FSSpec& folder) -{ - if (CFileMgr::FileExists(folder)) { - int nextIndex = 2; - CStr31 requestedName = folder.name; - if (requestedName.Length() > 28) - requestedName.Length() = 28; - CStr31 uniqueName; - do { - uniqueName = requestedName; - char suffix[3]; - sprintf(suffix, "-%d", nextIndex++); - uniqueName += suffix; - LString::CopyPStr(uniqueName, folder.name, 32); - } - while (CFileMgr::FileExists(folder)); - } -} - - -// Make one desktop icon -static const kIconNameStringsListID = 9800; - -static OSErr MakeOneDesktopIcon(const CStr31 &profileName, short templateNameIndex, short iconNameIndex) -{ - OSErr err = noErr; - FSSpec shortcutSpec = CPrefs::GetFilePrototype(CPrefs::RequiredGutsFolder); - FSSpec desktopFolderSpec; - FSSpec desktopIconSpec; - short vRefNum; - long folderID; - - GetIndString(shortcutSpec.name, kIconNameStringsListID, templateNameIndex); - - //find the source file - if (!CFileMgr::FileExists(shortcutSpec) || CFileMgr::IsFolder(shortcutSpec)) - ThrowIfOSErr_(fnfErr); - - //check the destination - err = ::FindFolder(kOnSystemDisk, kDesktopFolderType, true, - &vRefNum, &folderID); - ThrowIfOSErr_(err); - - err = CFileMgr::FolderSpecFromFolderID(vRefNum, folderID, desktopFolderSpec); - ThrowIfOSErr_(err); - - desktopIconSpec.parID = folderID; - desktopIconSpec.vRefNum = vRefNum; - GetIndString(desktopIconSpec.name, kIconNameStringsListID, iconNameIndex); - - //Append the profile name. We know that it does not contain colons - CStr63 iconName(desktopIconSpec.name); - - iconName += profileName; - - //Truncate the iconName if necessary to 31 chars - if (iconName.Length() > 30) { - iconName[0] = 30; - iconName[30] = 'É'; - } - - LString::CopyPStr(iconName, desktopIconSpec.name, 31); - - //If there is already an icon with the same name, append the profile name - long nextIndex = 1; - - while (CFileMgr::FileExists(desktopIconSpec)) - { - CStr63 uniqueName(iconName); - char suffix[5]; - short len; - - sprintf(suffix, "-%d", nextIndex++); - - len = 30 - strlen(suffix); - //Truncate the uniqueName if necessary - if (uniqueName.Length() > len) { - uniqueName[0] = len; - uniqueName[len] = 'É'; - } - - uniqueName += suffix; - - LString::CopyPStr(uniqueName, desktopIconSpec.name, 31); - } - - //phew. now we have a unique name to copy to - err = CFileMgr::CopyFile(shortcutSpec, desktopFolderSpec, desktopIconSpec.name); - ThrowIfOSErr_(err); - - //make sure the custom icon bit is set - err = CFileMgr::SetFileFinderFlag(desktopIconSpec, kHasCustomIcon, TRUE); - ThrowIfOSErr_(err); - - //And now copy the profile name into the data fork - if (! CFileMgr::FileExists(desktopIconSpec)) //if it does not, we're in trouble - ThrowIfOSErr_(fnfErr); - - LFile scriptFile(desktopIconSpec); - - scriptFile.OpenDataFork(fsRdWrPerm); - scriptFile.WriteDataFork((const char*)profileName, profileName.Length()); - scriptFile.CloseDataFork(); - - return err; -} - - - -// Make the desktop icons for the selected profile. -// They are acually applescripts copied from the essential files -// folder, with a property modified for this profile. - -OSErr CUserProfile::MakeDesktopIcons( - const CStr31 &profileName, - const Boolean wantsNavigator, - const Boolean wantsInbox ) -{ - OSErr err = noErr; - - enum { kNavShortcutName = 1, kInboxShortcutName, - kNavDesktopName, kInboxDesktopName}; //in profile.cnst - - if (wantsNavigator) - err = MakeOneDesktopIcon(profileName, kNavShortcutName, kNavDesktopName); - - if (wantsInbox) - err = MakeOneDesktopIcon(profileName, kInboxShortcutName, kInboxDesktopName); - - return err; -} - - -// ¥ prompts for a new user profile -ProfileErr CUserProfile::NewUserProfile( - const FSSpec& profileSpec, - FSSpec& profileFolder, - CStr31& profileName, - UpgradeEnum upgrading, - const FSSpec* oldNetscapeF ) -{ - Boolean userChoseFolder = false; - ProfileErr result = eOK; - - profileFolder.vRefNum = profileSpec.vRefNum; - profileFolder.parID = profileSpec.parID; - - result = NewProfileWizard( upgrading, profileName, profileSpec, - profileFolder, userChoseFolder ); - - if ( result == eUserCancelled ) - return eUserCancelled; - - // ¥ If the user chose a folder, see if it contains an existing - // Preferences file. If so, this folder becomes the new profile - // folder; otherwise, create a new folder inside it. - if ( userChoseFolder ) { - long parentID; - ThrowIfOSErr_( CFileMgr::GetFolderID(profileFolder, parentID) ); - - FSSpec prefFile; - prefFile.vRefNum = profileFolder.vRefNum; - prefFile.parID = parentID; - ::GetIndString( prefFile.name, 300, prefFileName ); - if (! CFileMgr::FileExists(prefFile)) { - // want to create a new folder inside the selected one - userChoseFolder = false; - profileFolder.parID = parentID; - } - } - - // ¥Êcreate a folder and return it - if ( !userChoseFolder ) - { - LString::CopyPStr( profileName, profileFolder.name, 32 ); - GetUniqueFolderName(profileFolder); - - if ( oldNetscapeF ) - { - // ¥Êspecial case: point profile to existing 3.0 Netscape Ä - CFileMgr::MakeAliasFile( profileFolder, *oldNetscapeF ); - - profileFolder = *oldNetscapeF; - } - else - { - CreateDefaultProfileFolder(profileFolder); - } - } - - return result; -} - -ProfileErr CUserProfile::NewProfileWizard( - UpgradeEnum upgrading, - CStr31 &profileName, - const FSSpec &profileFolder, - FSSpec &newProfileFolder, - Boolean &userChoseFolder ) -{ - // ¥ if we're upgrading 3.0 prefs, we don't allow the user to change - // the profile folder; just display & disable the default folder. - // Otherwise, the callback fills in the user name as the profile - // folder and lets the user edit it. (--this needs work) - LArray paneList( sizeof( PaneIDT ) ); - - -#ifdef CAN_MAKE_DESKTOP_ICONS_FOR_PROFILE - PaneIDT normalPaneList[] = { profileIntroPane, userNamePane, profileNamePane, - profileFolderPane, profileIconsPane, profileDonePane, 0 }; - PaneIDT mucPaneList[] = { profileIntroPane, profilePEPane, userNamePane, profileNamePane, - profileFolderPane, profileIconsPane, profileDonePane, 0 }; -#else - PaneIDT normalPaneList[] = { profileIntroPane, userNamePane, profileNamePane, - profileFolderPane, profileDonePane, 0 }; - PaneIDT mucPaneList[] = { profileIntroPane, profilePEPane, userNamePane, profileNamePane, - profileFolderPane, profileDonePane, 0 }; -#endif - - PaneIDT* tmpP; - - if ( !mHasConfigPlugin ) - tmpP = normalPaneList; - else - tmpP = mucPaneList; - - while ( *tmpP != 0 ) - paneList.InsertItemsAt( 1, LArray::index_Last, tmpP++ ); - - CDialogWizardHandler wizard( updateWizardDialog, paneList ); - - LListener* listener = new CProfilePaneMonitor( &wizard ); - wizard.AddListener( listener ); - - LWindow* window = wizard.GetDialog(); - if ( upgrading == eExistingPrefs ) - { - wizard.SetEditText( 'name', CPrefs::GetString( CPrefs::UserName ) ); - wizard.SetEditText( 'mail', CPrefs::GetString( CPrefs::UserEmail ) ); - } - if ( upgrading != eNoUpgrade ) - { - LStdControl* cancel = (LStdControl*)window->FindPaneByID( 'cncl' ); - if (cancel) - { - CStr31 label; - GetIndString( label, kProfileStrings, kQuitLabel ); - cancel->SetDescriptor( label ); - } - } - - // ¥ hide "detected previous Navigator version" text if appropriate - if ( upgrading != eExistingPrefs || CPrefs::sPrefFileVersion != 3 ) - { - LPane* upgradeText = window->FindPaneByID( 40 ); - if ( upgradeText ) - upgradeText->Hide(); - upgradeText = window->FindPaneByID( 41 ); - if ( upgradeText ) - upgradeText->Hide(); - } - - FSSpec tempFolder; - tempFolder.vRefNum = profileFolder.vRefNum; - tempFolder.parID = profileFolder.parID; - LString::CopyPStr( "\p", tempFolder.name, 32 ); - - CFilePicker* picker = (CFilePicker*)window->FindPaneByID( 'fold' ); - ThrowIfNil_( picker ); - picker->SetPickType( CFilePicker::Folders ); - picker->SetFSSpec( tempFolder, false ); - // ¥ don't allow different folder when upgrading - if ( upgrading == eExistingPrefs ) { - LPane* chooseBtn = picker->FindPaneByID(2); - LPane* chooseText = window->FindPaneByID(31); - if (chooseBtn && chooseText) { - chooseBtn->Hide(); - chooseText->Hide(); - } - } - - // show the profile wizard - if ( wizard.DoWizard() == false ) - { - // ¥Êuser cancelled - delete listener; - return eUserCancelled; - } - - // copy user name & email to prefs; return profile name - CStr255 userName; - wizard.GetEditText( 'name', userName ); - CPrefs::SetString( userName, CPrefs::UserName ); - CStr255 emailAddr; - wizard.GetEditText( 'mail', emailAddr ); - CPrefs::SetString( emailAddr, CPrefs::UserEmail ); - - wizard.GetEditText( 'pnam', profileName ); - StripColons(profileName); - -#ifdef CAN_MAKE_DESKTOP_ICONS_FOR_PROFILE - // make the desktop icons - OSErr err = MakeDesktopIcons(profileName, wizard.GetCheckboxValue('navb'), wizard.GetCheckboxValue('inbb')); - ThrowIfOSErr_(err); //should we do this? -#endif // CAN_MAKE_DESKTOP_ICONS_FOR_PROFILE - - if ( picker->WasSet() ) - { - userChoseFolder = true; - CFileMgr::CopyFSSpec( picker->GetFSSpec(), newProfileFolder ); - } - - delete listener; - - if ( mHasConfigPlugin ) - { - LControl* radioNew = (LControl*)window->FindPaneByID( 'Rnew' ); - LControl* radioExs = (LControl*)window->FindPaneByID( 'Rexs' ); - - if ( ( radioNew && radioNew->GetValue() ) || upgrading != eNoUpgrade ) - return eRunAccountSetup; - else if ( radioExs && radioExs->GetValue() /* ( upgrading != eNoUpgrade ) */) - return eRunMUC; - return eSkipMUC; - } - - return eOK; -} - -void CUserProfile::RenameProfile(short selectedID, CUserProfileDB& profileDB, - Cell& cell, ListHandle& listHand) -{ - CStr31 newName; - if (profileDB.GetProfileName(selectedID, newName) == false) - return; - - CStr255 prompt; - GetIndString(prompt, kProfileStrings, kRenamePrompt); - - Boolean ok = UStdDialogs::AskStandardTextPrompt(nil, prompt, newName, - NULL, NULL, kStr31Len); - - if (ok && newName.Length() > 0) { - LSetCell(&newName.fStr[1], newName.Length(), cell, listHand); - - profileDB.SetProfileName(selectedID, newName); - } -} - -void CUserProfile::DeleteProfile(short selectedID, CUserProfileDB& profileDB, ListHandle& listHand) -{ - CStr255 prompt; - GetIndString(prompt, kProfileStrings, kDeletePrompt); - if (ErrorManager::PlainConfirm(prompt)) - { - profileDB.DeleteProfile(selectedID); - - if (--selectedID < 0) - selectedID = 0; - - // redraw the profile list box - LDelRow(0, 0, listHand); - - PopulateListBox(listHand, profileDB, selectedID); - } -} - -// ¥ Reflects profile name & path into xp preferences for querying by PE; -// also registers a callback so changing the name renames the profile. -// if we don't know how many profiles we have, pass -1 and the numprofiles -// pref will not be set (nasty hack: see CPrefs::InitPrefsFolder()) -void -CUserProfile::ReflectToPreferences(const CStr31& profileName, - const FSSpec& profileFolder, short numProfiles) -{ - char* folderPath = CFileMgr::EncodedPathNameFromFSSpec( profileFolder, true ); - if ( folderPath ) - { - PREF_SetDefaultCharPref( "profile.directory", folderPath ); - free( folderPath ); - } - - PREF_SetDefaultCharPref( "profile.name", profileName ); - - if (numProfiles > -1) - PREF_SetDefaultIntPref( "profile.numprofiles", numProfiles ); - - PREF_RegisterCallback( "profile.name", ProfilePrefChangedFunc, NULL ); -} - -// ¥ If a Defaults folder exists in Essential Files, copy it into -// Netscape Users and rename it to the selected profile name. -// Otherwise, or in case of a copying error, create a new folder. -void CUserProfile::CreateDefaultProfileFolder(const FSSpec& profileFolder) -{ - OSErr err = noErr; - Boolean needToCreate = true; - - FSSpec usersFolder; - CFileMgr::FolderSpecFromFolderID(profileFolder.vRefNum, - profileFolder.parID, usersFolder); - - FSSpec templateFolder = CPrefs::GetFilePrototype(CPrefs::RequiredGutsFolder); - GetIndString( templateFolder.name, 300, profileTemplateDir ); - - if (CFileMgr::FileExists(templateFolder)) - { - err = FSpDirectoryCopy( &templateFolder, &usersFolder, - nil, 0, true, nil ); - - if (err == noErr) { - needToCreate = false; - - err = HRename(profileFolder.vRefNum, profileFolder.parID, - templateFolder.name, profileFolder.name); - } - } - - if (needToCreate) { - short newRefNum; - long newParID; - err = CFileMgr::CreateFolderInFolder( - profileFolder.vRefNum, profileFolder.parID, - profileFolder.name, &newRefNum, &newParID ); - } - - ThrowIfOSErr_( err ); -} - -// ¥Êfind the network configuration plugin and return a function ptr. -// to it's only entry point if possible -void* CUserProfile::LoadConfigPlugin() -{ - // BULLSHIT ALERT: Get out if I can't call GetSharedLibrary. - // Future: do the right thing for 68K. See bug#56245 - long sSysArchitecture = 0; - if ( (Gestalt(gestaltSysArchitecture, &sSysArchitecture) != noErr) - || (sSysArchitecture != gestaltPowerPC) ) - { - // Can't determine what we _do_ have, or we determined that it's _not_ PPC... - return NULL; - } - - Ptr main; - Str255 errName; - PE_PluginFuncType pluginFunc; - - OSErr err = ::GetSharedLibrary( "\pMUP", kPowerPCCFragArch, kFindCFrag, &mConfigPluginID, - &main, errName ); - if ( err != noErr ) - { - err = ::GetSharedLibrary( "\pMUP", kPowerPCCFragArch, kLoadCFrag, &mConfigPluginID, - &main, errName ); - } - if ( err == noErr ) - { - CFragSymbolClass dontCare; - mPluginLoaded = TRUE; - err = ::FindSymbol( mConfigPluginID, "\pPE_PluginFunc", (Ptr*)&pluginFunc, &dontCare ); - } - - if ( err == noErr ) - return pluginFunc; - return NULL; -} - -// ¥Êclose the connection to the configuration plugin -OSErr CUserProfile::CloseConfigPlugin() -{ -// if ( mPluginLoaded ) -// return CloseConnection( &mConfigPluginID ); - return noErr; -} - -long CUserProfile::SendMessageToPlugin( long selector, void* pb ) -{ - OSErr err; - PE_PluginFuncType pluginFunc; - - if ( !mHasConfigPlugin ) - return -1; - - pluginFunc = (PE_PluginFuncType)LoadConfigPlugin(); - if ( pluginFunc ) - { - union { - char buffer[ 1024 ]; - MUCInfo mucInfo; - } tmp; - - // ¥Êcall the stub to have it switch all the local machine - // stuff to use this user's configuration - err = (*pluginFunc)( selector, pb, tmp.buffer ); - CloseConfigPlugin(); - -// if ( err == noErr && selector == kGetDialConfig ) -// { -// cstring descString; -// PrettyPrintConfiguration( mucInfo, descString ); -// inCaption->SetDescriptor( (CStr255)(char*)descString ); -// } - return noErr; - } - return noErr; -} - -/***************************************************************************** -*/ -CUserProfileDB::CUserProfileDB( FSSpec& spec, Boolean createIt ): fFile( spec ) -{ - if ( createIt ) - { - Try_ - { - fFile.CreateNewFile( emSignature, 'PRFL' ); // ?? file type? - } - Catch_( inErr ) - { - if ( inErr == dupFNErr ) - ; - else - Throw_( inErr ); - } - } - fFile.OpenResourceFork( fsRdWrPerm ); -} - -short CUserProfileDB::CountProfiles() -{ - return ::Count1Resources('STR '); -} - -short CUserProfileDB::GetNextProfileID() -{ - short nextUserID = CountProfiles(); - - return nextUserID; -} - -short CUserProfileDB::GetProfileIDByUsername(const CString& username) -{ - int id = kFirstProfileID, returnID = -1; - Handle hProfileData = GetDBResource('DATA', id); - ProfileDataHeader *pHeader; - char *profileUser; - - while (hProfileData && (returnID == -1)) { - HLock(hProfileData); - pHeader = (ProfileDataHeader *) *hProfileData; - - profileUser = ((char *) pHeader) + pHeader->firstOffset; - - if (username == profileUser) { - returnID = id - kFirstProfileID; - } - - HUnlock(hProfileData); - - hProfileData = GetDBResource('DATA', ++id); - - } - - return returnID; -} - -short CUserProfileDB::GetProfileIDByEmail(const CString& emailAddr) -{ - int id = kFirstProfileID, returnID = -1; - Handle hProfileData = GetDBResource('DATA', id); - ProfileDataHeader *pHeader; - char *profileEmail; - - while (hProfileData && (returnID == -1)) { - HLock(hProfileData); - pHeader = (ProfileDataHeader *) *hProfileData; - - profileEmail = ((char *) pHeader) + pHeader->firstOffset - + pHeader->nameLength; - - if (emailAddr == profileEmail) { - returnID = id - kFirstProfileID; - } - - HUnlock(hProfileData); - - hProfileData = GetDBResource('DATA', ++id); - - } - - return returnID; -} - -short CUserProfileDB::GetLastProfileID() -{ - short lastUserID = kFirstProfileID; - short nextUserID = kFirstProfileID + GetNextProfileID(); - - // ID of the previous user is stored as a resource - Handle lastUser = GetDBResource('user', kFirstProfileID); - if (lastUser) { - lastUserID = **(short **) lastUser; - if (lastUserID >= nextUserID) - lastUserID = kFirstProfileID; - ::ReleaseResource(lastUser); - } - - return lastUserID - kFirstProfileID; -} - -void CUserProfileDB::SetLastProfileID(short newUserID) -{ - newUserID += kFirstProfileID; - Handle lastUser = GetDBResource('user', kFirstProfileID); - if (!lastUser) { - PtrToHand(&newUserID, &lastUser, sizeof(short)); - ::AddResource(lastUser, 'user', kFirstProfileID, nil); - } - else { - BlockMove(&newUserID, *lastUser, sizeof(short)); - ::ChangedResource(lastUser); - ::ReleaseResource(lastUser); - } -} - -void CUserProfileDB::AddNewProfile(short id, const CStr31& profileName, const FSSpec& profileFolder) -{ - id += kFirstProfileID; - // create new STR, alis, and DATA resources - StringHandle nameHand; - PtrToHand(profileName, &(Handle) nameHand, profileName.Length() + 1); - AddResource((Handle) nameHand, 'STR ', id, nil); - - AliasHandle alias; - OSErr err = NewAlias( nil, &profileFolder, &alias ); - if (err == noErr) { - AddResource((Handle) alias, 'alis', id, profileFolder.name); - } - - SetProfileData(id - kFirstProfileID); -} - -Boolean CUserProfileDB::GetProfileName(short id, CStr31& name) -{ - // -- use Get1Resource instead of GetString to avoid grabbing - // spurious strings from other programs (e.g. Kaleidoscope) - StringHandle strHand = (StringHandle) GetDBResource('STR ', id + kFirstProfileID); - if (strHand == nil) - return false; - - HLock((Handle) strHand); - int len = *strHand[0] + 1; - if (len > 32) len = 32; - BlockMove(*strHand, name.fStr, len); - name.Length() = len - 1; - HUnlock((Handle) strHand); - - ReleaseResource((Handle) strHand); - return true; -} - -void CUserProfileDB::SetProfileName(short id, const CStr31& name) -{ - StringHandle strHand = (StringHandle) GetDBResource('STR ', id + kFirstProfileID); - if (strHand) { - SetString(strHand, name); - ChangedResource((Handle) strHand); - ReleaseResource((Handle) strHand); - } -} - -void CUserProfileDB::SetProfileData(short id) -{ - Handle hProfileData; - ProfileDataHeader profileHeader; - short int dataLength; - long int dataOffset; - CStr255 userName; - CStr255 emailName; - XP_Bool addResource = false; - - id += kFirstProfileID; // In order to allow this method to be called from - // outside the class, we have to allow the value in to - // be a "raw" profile number (i.e., as returned by - // GetLastProfile); - - emailName = CPrefs::GetString(CPrefs::UserEmail); - userName = CPrefs::GetString(CPrefs::UserName); - - profileHeader.count = 2; - profileHeader.firstOffset = sizeof(ProfileDataHeader); - - /* (the +1 is for the null terminator for each string) */ - profileHeader.nameLength = userName.Length() + 1; - profileHeader.emailLength = emailName.Length() + 1; - - /* First, compute the length of the resource */ - dataLength = sizeof(ProfileDataHeader) + profileHeader.nameLength + profileHeader.emailLength; - - /* See if we're replacing or adding */ - hProfileData = GetDBResource('DATA', id); - - if (hProfileData) { - SetHandleSize(hProfileData, dataLength); - if (MemError() == noErr) { - XP_MEMSET(*hProfileData, '\0', dataLength); - } else { - ReleaseResource(hProfileData); - hProfileData = nil; - } - } else { - hProfileData = NewHandleClear(dataLength); - addResource = true; - } - - if (hProfileData) { - dataOffset = 0; - - HLock((Handle) hProfileData); - - BlockMove(&profileHeader, *hProfileData, sizeof(ProfileDataHeader)); - - dataOffset = sizeof(ProfileDataHeader); - BlockMove(&(userName.fStr[1]), ((unsigned char *) *hProfileData) + dataOffset, - profileHeader.nameLength-1); - - dataOffset += profileHeader.nameLength; - BlockMove(&(emailName.fStr[1]), ((unsigned char *) *hProfileData) + dataOffset, - profileHeader.emailLength-1); - - HUnlock((Handle) hProfileData); - - if (addResource) { - ::AddResource(hProfileData, 'DATA', id, nil); - } else { - ::ChangedResource(hProfileData); - ::ReleaseResource(hProfileData); - } - } -} - -Boolean CUserProfileDB::GetProfileAlias(short id, FSSpec& profileFolder, Boolean allowUserInteraction ) -{ - Boolean success = true; - AliasHandle a; - a = (AliasHandle) GetDBResource('alis', id + kFirstProfileID); - ThrowIfNil_(a); - - Boolean changed; - OSErr err; - - if ( allowUserInteraction ) - { - err = ResolveAlias( NULL, a, &profileFolder, &changed ); - - // If the alias couldn't be resolved, give the user - // a chance to locate the profile folder - if (err < 0) { - success = false; - CStr255 errStr; - CStr31 profileName; - GetIndString(errStr, CUserProfile::kProfileStrings, CUserProfile::kBadAliasError); - GetProfileName(id, profileName); - StringParamText(errStr, profileName); - - if (ErrorManager::PlainConfirm(errStr)) - { - StandardFileReply reply; - reply.sfFile = CPrefs::GetFilePrototype(CPrefs::UsersFolder); - if ( CFilePicker::DoCustomGetFile(reply, CFilePicker::Folders, true) ) - { - CFileMgr::CopyFSSpec(reply.sfFile, profileFolder); - Boolean changed; - err = UpdateAlias(nil, &reply.sfFile, a, &changed); - ThrowIfOSErr_(err); - ChangedResource((Handle) a); - success = true; - } - } - } - } - else - { - short aliasCount = 1; - - err = MatchAlias( NULL, kARMMountVol | kARMNoUI | kARMMultVols | kARMSearch | kARMSearchMore, - a, &aliasCount, &profileFolder, &changed, NULL, NULL ); - if ( err < 0 ) - success = false; - } - - ReleaseResource((Handle) a); - - return success; -} - -// This will change the value of selectedID if it becomes out of bounds -void CUserProfileDB::DeleteProfile(short selectedID) -{ - selectedID += kFirstProfileID; - // delete profile resources and move the subsequent - // resources down to fill the space - Handle toDelete = GetDBResource('STR ', selectedID); - if (toDelete) - RemoveResource(toDelete); - toDelete = GetDBResource('alis', selectedID); - if (toDelete) - RemoveResource(toDelete); - - toDelete = GetDBResource('DATA', selectedID); - if (toDelete) - RemoveResource(toDelete); - - int id = selectedID + 1; - Handle next = GetDBResource('STR ', id); - while (next) { - ::SetResInfo(next, id - 1, nil); - - next = GetDBResource('DATA', id); - if (next) { - ::SetResInfo(next, id - 1, nil); - ReleaseResource(next); - } - - next = GetDBResource('alis', id); - if (next) { - ::SetResInfo(next, id - 1, nil); - ReleaseResource(next); - } - // don't need to release strings because Populate uses them - next = GetDBResource('STR ', ++id); - } -} - -Handle CUserProfileDB::GetDBResource(ResType theType, short theID) -{ - StUseResFile resFile( fFile.GetResourceForkRefNum() ); - - return ::Get1Resource(theType, theID); -} - - -/***************************************************************************** -*/ -const int cmd_NextPane = 8000; -const int cmd_PrevPane = 8001; - -CProfilePaneMonitor::CProfilePaneMonitor( CDialogWizardHandler* wizard ) -{ - fWizard = wizard; - fCopiedName = false; -} - -// !! This needs some work. -void CProfilePaneMonitor::ListenToMessage( MessageT inMessage, void* /* ioParam */) -{ - PaneIDT nameField; - Boolean onNameField = false; - LView* window; - - window = fWizard->GetDialog(); - - LStdControl* next = (LStdControl*)window->FindPaneByID( 'ok ' ); - LStdControl* back = (LStdControl*)window->FindPaneByID( 'back' ); - CStr255 buttonTitle; - - if (fWizard->CurrentPane() == userNamePane) { - nameField = 'name'; - onNameField = true; - } - else if (fWizard->CurrentPane() == profileNamePane) { - nameField = 'pnam'; - onNameField = true; - } - - if ( next && ( inMessage == cmd_NextPane || inMessage == cmd_PrevPane ) ) - { - if ( fWizard->CurrentPaneNumber() == fWizard->TotalPanes() ) - { - LControl* radioNew = (LControl*)window->FindPaneByID( 'Rnew' ); - LControl* radioExs = (LControl*)window->FindPaneByID( 'Rexs' ); - LPane* vnorm = (LView*)window->FindPaneByID('Vnor'); - LPane* vexs = (LView*)window->FindPaneByID('Vexs'); - LPane* vnew = (LView*)window->FindPaneByID('Vnew'); - - vnorm->Hide(); - vexs->Hide(); - vnew->Hide(); - if ( radioExs && radioExs->GetValue() ) - { - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kCreateProfileLabel ); - vexs->Show(); - } - else if ( radioNew && radioNew->GetValue() ) - { - //GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kDoneLabel ); - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kRunASLabel ); - vnew->Show(); - } - else - { - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kDoneLabel ); - vnorm->Show(); - } - next->SetDescriptor( buttonTitle ); - } - else - { - GetIndString( buttonTitle, CUserProfile::kProfileStrings, CUserProfile::kNextLabel ); - next->SetDescriptor( buttonTitle ); - } - } - - if ( back && ( inMessage == cmd_NextPane || inMessage == cmd_PrevPane ) ) - { - if ( fWizard->CurrentPaneNumber() == LArray::index_First ) - back->Disable(); - else - back->Enable(); - } - - - // copy profile name to folder name, unless the user has changed - // the path or we're creating the default profile - if ( inMessage == cmd_NextPane && fWizard->CurrentPane() == profileFolderPane ) - { - CStr31 profileName; - fWizard->GetEditText('pnam', profileName); - StripColons(profileName); - CFilePicker* picker = (CFilePicker*) fWizard->GetDialog()->FindPaneByID('fold'); - if (picker && !picker->WasSet()) { - FSSpec folder = picker->GetFSSpec(); - LString::CopyPStr(profileName, folder.name, 32); - - CUserProfile::GetUniqueFolderName(folder); - picker->SetFSSpec(folder, false); - } - } - // copy user name to profile name (only do this once) - else if ( inMessage == cmd_NextPane && fWizard->CurrentPane() == profileNamePane - && !fCopiedName) - { - CStr31 profileName; - fWizard->GetEditText('name', profileName); - StripColons(profileName); - if (profileName.Length() > kStr31Len) - profileName.Length() = kStr31Len; - fWizard->SetEditText('pnam', profileName); - fCopiedName = true; - } - - // select Name field - if (onNameField && (inMessage == cmd_NextPane || inMessage == cmd_PrevPane)) { - LEditField* field = (LEditField*) fWizard->GetDialog()->FindPaneByID(nameField); - if (field) { - field->SwitchTarget(field); - field->SelectAll(); - } - } - - // disable Next button if user hasn't entered name - if (onNameField) - { - CStr255 text; - fWizard->GetEditText( nameField, text ); - if ( text.Length() == 0 ) - fWizard->DisableNextButton(); - else - fWizard->EnableNextButton(); - } - else - fWizard->EnableNextButton(); -} - -/***************************************************************************** -*/ - -CDialogWizardHandler::CDialogWizardHandler( ResIDT dlogID, LArray& paneList ): - fDialog( dlogID, CFrontApp::GetApplication() ), fPaneList( paneList ) -{ - ArrayIndexT index; - PaneIDT paneID; - LView* pane; - - index = LArray::index_First; - - fCurrentPane = LArray::index_First; - fListener = nil; - - LWindow* window = fDialog.GetDialog(); - ThrowIfNil_( window ); - - for ( index = LArray::index_First; index <= fPaneList.GetCount(); index++ ) - { - fPaneList.FetchItemAt( index, &paneID ); - LView::SetDefaultView( window ); - if ( GetResource( 'PPob', paneID ) == nil ) - break; - pane = (LView*)UReanimator::ReadObjects( 'PPob', paneID ); - if ( pane ) - { - if ( index != LArray::index_First ) - pane->Hide(); - pane->Enable(); - pane->FinishCreate(); - } - } -} - -PaneIDT CDialogWizardHandler::CurrentPane() -{ - PaneIDT paneID; - fPaneList.FetchItemAt( fCurrentPane, &paneID ); - return paneID; -} - -ArrayIndexT CDialogWizardHandler::CurrentPaneNumber() -{ - return fCurrentPane; -} - -ArrayIndexT CDialogWizardHandler::TotalPanes() -{ - return fPaneList.GetCount(); -} - -void CDialogWizardHandler::AddListener(LListener* st) -{ - fListener = st; -} - -Boolean CDialogWizardHandler::DoWizard() -{ - Boolean cancelled = false; - LWindow* window = fDialog.GetDialog(); - ShowPane( fCurrentPane, window ); - - Boolean done = false; - while ( !done ) - { - MessageT hit = fDialog.DoDialog(); - - switch ( hit ) - { - case cmd_NextPane: - done = ShowPane( fCurrentPane + 1, window ); - break; - - case cmd_PrevPane: - done = ShowPane( fCurrentPane - 1, window ); - break; - - case msg_Cancel: - cancelled = done = true; - break; - } - if ( !done && fListener ) - fListener->ListenToMessage( hit, nil ); - } - return !cancelled; -} - -Boolean CDialogWizardHandler::ShowPane( ArrayIndexT paneNum, LWindow* window ) -{ - PaneIDT paneID; - - if ( paneNum < LArray::index_First ) - return false; - - if ( paneNum != fCurrentPane ) - { - fPaneList.FetchItemAt( fCurrentPane, &paneID ); - LPane* pane = window->FindPaneByID( paneID ); - if ( pane ) - pane->Hide(); - } - - fCurrentPane = paneNum; - if ( paneNum > fPaneList.GetCount() ) - return true; - fPaneList.FetchItemAt( paneNum, &paneID ); - LPane* pane = window->FindPaneByID( paneID ); - if ( pane ) - pane->Show(); - - return false; -} - -void CDialogWizardHandler::EnableNextButton() -{ - LWindow* window = fDialog.GetDialog(); - if ( window ) - { - LStdControl* next = (LStdControl*)window->FindPaneByID( 'ok ' ); - if ( next ) - next->Enable(); - } -} - -void CDialogWizardHandler::DisableNextButton() -{ - LWindow* window = fDialog.GetDialog(); - if ( window ) - { - LStdControl* next = (LStdControl*)window->FindPaneByID( 'ok ' ); - if ( next ) - next->Disable(); - } -} - -LWindow* CDialogWizardHandler::GetDialog() -{ - return fDialog.GetDialog(); -} - -void CDialogWizardHandler::SetEditText(PaneIDT paneID, const CString& text) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LEditField* field = (LEditField*) window->FindPaneByID(paneID); - if (field) { - field->SetDescriptor(text); - } - } -} - -void CDialogWizardHandler::GetEditText(PaneIDT paneID, CString& text) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LEditField* field = (LEditField*) window->FindPaneByID(paneID); - if (field) { - field->GetDescriptor(text); - } - } -} - -void CDialogWizardHandler::SetCheckboxValue(PaneIDT paneID, const Boolean value) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LControl* checkbox = (LControl*) window->FindPaneByID(paneID); - if (checkbox) { - checkbox->SetValue((Int32)value); - } - } -} - -Boolean CDialogWizardHandler::GetCheckboxValue(PaneIDT paneID) -{ - LWindow* window = fDialog.GetDialog(); - if (window) { - LControl* checkbox = (LControl*) window->FindPaneByID(paneID); - if (checkbox) { - return (Boolean)checkbox->GetValue(); - } - } - - return -1; -} - diff --git a/mozilla/cmd/macfe/central/userprofile.h b/mozilla/cmd/macfe/central/userprofile.h deleted file mode 100644 index 88bebbf8267..00000000000 --- a/mozilla/cmd/macfe/central/userprofile.h +++ /dev/null @@ -1,229 +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. - */ - -#pragma once - -#include -#include "PascalString.h" -#include "StBlockingDialogHandler.h" - -const MessageT cmd_SelectProfile = 4000; -const MessageT cmd_NewProfile = 4001; -const MessageT cmd_DeleteProfile = 4002; -const MessageT cmd_RenameProfile = 4003; -const MessageT cmd_QuitProfile = 4004; -const MessageT cmd_EditDialSettings = 4010; -const MessageT cmd_LocationPopup = 4011; - -enum ProfileErr { - eUserCancelled = -2, - eUnknownError = -1, - eNeedUpgrade = 0, - eOK = 1, - eRunAccountSetup = 2, - eRunMUC = 3, - eSkipMUC = 4 -}; - - -/***************************************************************************** - * class CUserProfileDB - * - * Wrapper for multi-user profile database file. - * - *****************************************************************************/ -class CUserProfileDB -{ - -public: - - CUserProfileDB(FSSpec& spec, Boolean createIt = false); - - short CountProfiles(); - short GetNextProfileID(); - - short GetProfileIDByUsername(const CString& userName); - short GetProfileIDByEmail(const CString& emailAddr); - - short GetLastProfileID(); - void SetLastProfileID(short newUserID); - - void AddNewProfile(short id, const CStr31& profileName, - const FSSpec& profileFolder); - - Boolean GetProfileName(short id, CStr31& name); - void SetProfileName(short id, const CStr31& name); - - void SetProfileData(short id); - - Boolean GetProfileAlias(short id, FSSpec& profileFolder, Boolean allowUserInteraction = true); - void DeleteProfile(short selectedID); - - LFile * GetFile() {return &fFile;} - - -private: - LFile fFile; - Handle GetDBResource(ResType theType, short theID); - - enum { kFirstProfileID = 128 }; - -}; - - -/***************************************************************************** - * class CDialogWizardHandler - * - * A generic dialog wizard handler. - * - *****************************************************************************/ -class CDialogWizardHandler -{ -public: - CDialogWizardHandler( ResIDT dlogID, LArray& paneList ); - void AddListener(LListener* st); - - Boolean DoWizard(); - LWindow* GetDialog(); - - void GetEditText( PaneIDT paneID, CString& text ); - void SetEditText( PaneIDT paneID, const CString& text ); - - void SetCheckboxValue(PaneIDT paneID, const Boolean value); - Boolean GetCheckboxValue(PaneIDT paneID); - - PaneIDT CurrentPane(); - ArrayIndexT CurrentPaneNumber(); - ArrayIndexT TotalPanes(); - void EnableNextButton(); - void DisableNextButton(); - -protected: - Boolean ShowPane( ArrayIndexT paneNum, LWindow* window ); - - StBlockingDialogHandler fDialog; - LArray fPaneList; - ArrayIndexT fCurrentPane; - LListener* fListener; -}; - -/***************************************************************************** - * class CUserProfile - * - * Launches wizards and file operations for multi-user profile support. - * - *****************************************************************************/ -class CUserProfile -{ - -public: - static void InitUserProfiles(); - - // Opens the User Profiles registry and puts up a profile-selection - // dialog if there is more than one profile (or showDialog is true). - // Returns kNeedUpgrade if User Profiles does not exist (i.e. we need - // to call HandleUpgrade); else returns path of selected profile. - - static ProfileErr GetUserProfile( const FSSpec& usersFolder, - FSSpec& profileFolder, Boolean showDialog, short fileType ); - - // Creates a new network profile in the user's folder - static ProfileErr CreateNetProfile( FSSpec usersFolder, FSSpec& profileFolder ); - -private: - static ProfileErr DoNetProfileDialog(); - static void DoNetExtendedProfileDialog(LCommander * super); - -public: - // Launches upgrade wizard for users who have not run 4.0 before. - // Creates an initial profile folder and User Profiles file. - // If oldNetscapeF is non-null, it points to the user's 3.0 - // Netscape Ä folder and the profile "folder" is an alias to it. - // Returns error code if user cancelled; else returns profile path. - - static ProfileErr HandleUpgrade( FSSpec& profileFolder, - const FSSpec* oldNetscapeF = nil ); - - // Creates a unique profile folder name if necessary - static void GetUniqueFolderName(FSSpec& folder); - - static short sCurrentProfileID; - - enum { kRenamePrompt = 1, - kDeletePrompt, - kReadError, - kCreateError, - kDefaultName, - kBadAliasError, - kQuitLabel, - kDoneLabel, - kNextLabel, - kConfigFileError, - kInvalidConfigFile, - kRunASLabel, - kCreateProfileLabel, - kConfigurationFileName }; - enum { kProfileStrings = 900 }; - -private: - static ProfileErr HandleProfileDialog( FSSpec& profileSpec, CUserProfileDB& profileDB, - FSSpec& profileFolder, short& newUserID, short lastUserID, - Boolean wantsProfileManager ); - static void PopulateListBox( ListHandle& listHand, CUserProfileDB& profileDB, - short defaultID ); - - enum UpgradeEnum { eNoUpgrade, // an additional profile is being created - eExistingPrefs, // first profile, existing Netscape Prefs file - eNewInstall }; // first profile, fresh install - - static ProfileErr NewUserProfile( const FSSpec& profileSpec, FSSpec& profileFolder, - CStr31& profileName, UpgradeEnum upgrading = eNoUpgrade, - const FSSpec* oldNetscapeF = nil ); - static ProfileErr NewProfileWizard( UpgradeEnum upgrading, CStr31& profileName, - const FSSpec& profileFolder, FSSpec& newProfileFolder, - Boolean& userChoseFolder ); - - static void RenameProfile( short selectedID, CUserProfileDB& profileDB, - Cell& cell, ListHandle& listHand ); - static void DeleteProfile( short selectedID, CUserProfileDB& profileDB, - ListHandle& listHand ); - - static void ReflectToPreferences(const CStr31& profileName, - const FSSpec& profileFolder, short numProfiles = 1); - static void CreateDefaultProfileFolder(const FSSpec& profileFolder); - - static OSErr MakeDesktopIcons(const CStr31& profileName, - const Boolean wantsNavigator, const Boolean wantsInbox); - - enum { kInvalidProfileID = -1 }; - -protected: - // ¥ÊinPrefsFolder is the FSSpec of the users Preferences - // folderÉ we read a file directly below that - static long SendMessageToPlugin( long inMessage, void* pb = NULL ); - - static void* LoadConfigPlugin(); // really returns PE_PluginFuncType - static OSErr CloseConfigPlugin(); - - static Boolean DeleteMagicProfile( FSSpec& inSpec ); - - static CFragConnectionID mConfigPluginID; - static Boolean mHasConfigPlugin; - static Boolean mPluginLoaded; -}; - diff --git a/mozilla/cmd/macfe/debug/debug_m.cp b/mozilla/cmd/macfe/debug/debug_m.cp deleted file mode 100644 index 5698cb73260..00000000000 --- a/mozilla/cmd/macfe/debug/debug_m.cp +++ /dev/null @@ -1,69 +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. - */ - -#include - -#include - -#include "xp.h" -#include "xp_mem.h" -#include "xpassert.h" -//#include "sys/errno.h" - -#include "xp_mac.h" -#include "xp_debug.h" - -#include -#include -#include - -/*----------------------------------------------------------------------------- - xp_MacToUnixErr - Maps Mac system errors to unix-stype errno errors. ------------------------------------------------------------------------------*/ - -int xp_MacToUnixErr (OSErr err) -{ - if (!err) - return 0; - - switch (err) { - case noErr: return 0; - case memLockedErr: return -1; - /* some error messages have no standard counterpart; how to deal? */ - case resNotFound: - XP_Abort ("Macintosh-specific error, should not be mapped to unix."); - case rfNumErr: - return EBADF; - }; -#ifdef DEBUG - XP_Abort ("Can't figure out what to return"); -#endif - return -1; -} - -/*----------------------------------------------------------------------------- - Global Debug Variables ------------------------------------------------------------------------------*/ - -#ifdef DEBUG - -int Debug = 1; - -#endif /* DEBUG */ - diff --git a/mozilla/cmd/macfe/debug/xp_mac.h b/mozilla/cmd/macfe/debug/xp_mac.h deleted file mode 100644 index 589084e75d5..00000000000 --- a/mozilla/cmd/macfe/debug/xp_mac.h +++ /dev/null @@ -1,66 +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. - */ - -#pragma once -#include -#include -#include "poof.h" - -/*----------------------------------------------------------------------------- - xp_MacToUnixErr - Module function. Maps Mac system errors to unix-stype errno errors. ------------------------------------------------------------------------------*/ - -extern int xp_MacToUnixErr (OSErr err); - -/*----------------------------------------------------------------------------- - Debuging Setup ------------------------------------------------------------------------------*/ - -/* -#ifdef DEBUG - -class DebugMgr: public Manager { -public: - DebugMgr (); - ~DebugMgr (); - void Inspect (OSType item, int value); - // Delegation - Boolean ObeyCommand (CommandT command, void *param); - void FindCommandStatus (CommandT command, Boolean &enabled, - Boolean &usesMark, Char16 &mark, Str255 name); - void ExecuteSelf (MessageT message, void *ioParam); - // Printing - void Trace (char *message, int length); -private: // Module - void LoadState (); - void SaveState (); - void EnterSelf (); - void ExitSelf (); -public: - FILE * fTraceFile; -private: - LWindow *fInspector; - OSErr fTraceLog; -}; - -extern DebugMgr TheDebugMgr; - -#endif // DEBUG -*/ - diff --git a/mozilla/cmd/macfe/desktop/Messenger script b/mozilla/cmd/macfe/desktop/Messenger script deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mozilla/cmd/macfe/desktop/Navigator script b/mozilla/cmd/macfe/desktop/Navigator script deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mozilla/cmd/macfe/gui/BookmarksDialogs.cp b/mozilla/cmd/macfe/gui/BookmarksDialogs.cp deleted file mode 100644 index 6b567e19c18..00000000000 --- a/mozilla/cmd/macfe/gui/BookmarksDialogs.cp +++ /dev/null @@ -1,88 +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. - */ - -#include "BookmarksDialogs.h" -#include "PascalString.h" -#include "macutil.h" -#include "uapp.h" - -CBookmarksFindDialog *CBookmarksFindDialog::sFindDialog = NULL; - - -//=========================================================== -// CBookmarksFindDialog -//=========================================================== -CBookmarksFindDialog::CBookmarksFindDialog( LStream* inStream ): LDialogBox( inStream ) -{ - sFindDialog = this; -} - -CBookmarksFindDialog::~CBookmarksFindDialog() -{ - sFindDialog = NULL; -} - -void CBookmarksFindDialog::FinishCreateSelf() -{ - LDialogBox::FinishCreateSelf(); - fCheckName = (LStdCheckBox*)this->FindPaneByID( 'Cnam' ); - fCheckLocation = (LStdCheckBox*)this->FindPaneByID( 'Cloc' ); - fCheckDescription = (LStdCheckBox*)this->FindPaneByID( 'Cdes' ); - fMatchCase = (LStdCheckBox*)this->FindPaneByID( 'Ccas' ); - fWholeWord = (LStdCheckBox*)this->FindPaneByID( 'Cwor' ); - - fFindText = (LEditField*)this->FindPaneByID( 'Efnd' ); -} - - -void CBookmarksFindDialog::ListenToMessage( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) - { - case msg_OK: - { -#if 0 -// THIS IS JUST LEFT HERE AS AN EXAMPLE OF HOW TO PULL THE RESULTS OUT OF -// THE CONTROLS. THIS USES THE DEPRICATED BOOKMARKS API AND WILL BE REWRITTEN. - CStr255 tmp; - - fFindText->GetDescriptor( tmp ); - if ( fFindInfo->textToFind ) - { - XP_FREE( fFindInfo->textToFind ); - fFindInfo->textToFind = NULL; - } - NET_SACopy( &fFindInfo->textToFind, tmp ); - fFindInfo->checkName = fCheckName->GetValue(); - fFindInfo->checkLocation = fCheckLocation->GetValue(); - fFindInfo->checkDescription = fCheckDescription->GetValue(); - fFindInfo->matchCase = fMatchCase->GetValue(); - fFindInfo->matchWholeWord = fWholeWord->GetValue(); - BM_DoFindBookmark( fContext, fFindInfo ); -#endif - ListenToMessage( cmd_Close, ioParam ); - } - break; - case msg_Cancel: - ListenToMessage( cmd_Close, ioParam ); - break; - default: - LDialogBox::ListenToMessage( inMessage, ioParam ); - break; - } -} diff --git a/mozilla/cmd/macfe/gui/BookmarksDialogs.h b/mozilla/cmd/macfe/gui/BookmarksDialogs.h deleted file mode 100644 index 95dc75973b1..00000000000 --- a/mozilla/cmd/macfe/gui/BookmarksDialogs.h +++ /dev/null @@ -1,49 +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. - */ - -#pragma once - -#include - - -// -// Bookmarks Find Dialog Box -// -class CBookmarksFindDialog: public LDialogBox -{ -public: - enum { class_ID = 'bmfd', res_ID = 9502 }; - CBookmarksFindDialog( LStream* inStream ); - virtual ~CBookmarksFindDialog(); - - virtual void FinishCreateSelf(); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - - static CBookmarksFindDialog *GetFindDialog() { return sFindDialog; } - -protected: - LStdCheckBox* fCheckName; - LStdCheckBox* fCheckLocation; - LStdCheckBox* fCheckDescription; - LStdCheckBox* fMatchCase; - LStdCheckBox* fWholeWord; - - LEditField* fFindText; - - static CBookmarksFindDialog *sFindDialog; -}; diff --git a/mozilla/cmd/macfe/gui/CAutoCompleteURLEditField.cp b/mozilla/cmd/macfe/gui/CAutoCompleteURLEditField.cp deleted file mode 100644 index e3eaf4fbaf1..00000000000 --- a/mozilla/cmd/macfe/gui/CAutoCompleteURLEditField.cp +++ /dev/null @@ -1,169 +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. - */ - -// CAutoCompleteURLEditField.h - -// Subclass of CURLEditField that calls urlMatch function to do -// URL string matching - -#include "CAutoCompleteURLEditField.h" - -#include -#include "CAutoPtrXP.h" -#include // for Char16 typedef -#include // for UKeyFilters::IsPrintingChar proto -#include // for LMGetTicks() proto - -#include "xp_mem.h" // for XP_FREE macro -#include "glhist.h" // for urlMatch proto - - - -CAutoCompleteURLEditField::CAutoCompleteURLEditField(LStream* inStream) -: CURLEditField(inStream) - , mNextMatchTime(ULONG_MAX) - , mStartOver(true) -{ -} - -// NOTE: I believe UKeyFilters::IsPrintingChar() makes this method -// i18n unfriendly, but that's just a guess. -Boolean CAutoCompleteURLEditField::HandleKeyPress(const EventRecord& inKeyEvent) -{ - Char16 theChar = inKeyEvent.message & charCodeMask; - - // NOTE: I believe UKeyFilters::IsPrintingChar() makes this method - // i18n unfriendly, but that's just a guess. - if (UKeyFilters::IsPrintingChar(theChar)) - mNextMatchTime = ::LMGetTicks() + kMatchDelay; - - // urlMatch is optimized to search from the current entry when - // the search string is simply getting longer. But if the user - // edits the existing text, we want to search again from the start - if (UKeyFilters::IsTEDeleteKey(theChar) || - UKeyFilters::IsTECursorKey(theChar) || - UKeyFilters::IsExtraEditKey(theChar)) - { - mStartOver = true; - } - - return Inherited::HandleKeyPress(inKeyEvent); -} - -void CAutoCompleteURLEditField::ClickSelf(const SMouseDownEvent& inMouseDown) -{ - Inherited::ClickSelf(inMouseDown); - // this click can result in a selection that allows the user to - // overtype selected text. So autocomplete on the whole thing - // again - mStartOver = true; -} - -#pragma mark - - -class CAutocompleteTypingAction : public LTETypingAction -{ - public: - CAutocompleteTypingAction() - : LTETypingAction(nil, nil, nil) {} - void UpdateAfterAutocomplete(Int16 inNewLength); -}; - -void CAutocompleteTypingAction::UpdateAfterAutocomplete(Int16 inNewLength) -{ - mTypingEnd = inNewLength; -} - -#pragma mark - - -void CAutoCompleteURLEditField::SpendTime(const EventRecord &inMacEvent) -{ - if (LMGetTicks() >= mNextMatchTime) - { - autoCompStatus status = notFoundDone; // safe in case of throw below - - try - { - char urlText[2048]; - Int32 urlLength = sizeof(urlText); - GetDescriptorLen(urlText, urlLength); - if (urlLength > 0) - { - string originalText = urlText; - // remove selection from search string - UInt16 selStart = (**GetMacTEH()).selStart; - UInt16 selEnd = (**GetMacTEH()).selEnd; - if (selEnd - selStart > 0) - memmove(urlText + selStart, - urlText + selEnd, - 1 + (**GetMacTEH()).teLength - selEnd); - -#ifdef DEBUG - if (mStartOver) - mTimesSearched = 0; - - mTimesSearched ++; -#endif - char* tempResult = NULL; - status = urlMatch(urlText, &tempResult, mStartOver, false); - CAutoPtrXP result = tempResult; - mStartOver = false; - - // urlMatch will return foundDone even if it is returning the same - // string it found last time. So don't bother doing all the - // processing if that is the case. - if (status == foundDone && result.get() && result.get() != originalText ) - { - selEnd = strlen(result.get()); - SetDescriptorLen(result.get(), selEnd); - - FocusDraw(); // SetDescriptor() mucks with the port rect - // then set selection - ::TESetSelect(selStart, selEnd, GetMacTEH()); - - if (mTypingAction) - { - // If the user undoes, she wants to undo the autocompleted text AND the typing. - // This is a static cast, whose purpose is to get at the protected member - // mTypingEnd of the LTETypingAction class. Being a static_cast of one kind - // of class to another kind of class, it is, officially, skanky. If you don't - // want to be skanky, you could just cancel - // the undoability of the user's typed characters after a successful - // autocomplete, by calling PostAction(nil) instead. - // This would be doing the user a disservice, though. - CAutocompleteTypingAction* acTypingAction - = dynamic_cast(mTypingAction); - acTypingAction->UpdateAfterAutocomplete(selEnd); - } - } - } - } - catch(...) - { - } - // we want to keep searching next time we are called. mNextMatchTime is thus only - // updated when the user starts typing again, or we complete (successfully or not) - if (status != stillSearching) - { - mStartOver = true; - mNextMatchTime = ULONG_MAX; - } - } - - Inherited::SpendTime(inMacEvent); -} diff --git a/mozilla/cmd/macfe/gui/CAutoCompleteURLEditField.h b/mozilla/cmd/macfe/gui/CAutoCompleteURLEditField.h deleted file mode 100644 index 88166627d41..00000000000 --- a/mozilla/cmd/macfe/gui/CAutoCompleteURLEditField.h +++ /dev/null @@ -1,56 +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. - */ - -// -// CAutoCompleteURLEditField.h -// -// Subclass of CURLEditField that calls urlMatch function to do -// URL string completion -// - -#pragma once - -#include "CURLEditField.h" - -#include // for UInt32 typedef -#include - - -class CAutoCompleteURLEditField : public CURLEditField -{ - typedef CURLEditField Inherited; - -public: - enum { class_ID = 'AcUF' }; - enum { kMatchDelay = 20 }; // ticks before we start URL matching - - CAutoCompleteURLEditField(LStream* inStream); - -protected: - - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - virtual void ClickSelf ( const SMouseDownEvent & inMouseDown ); - virtual void SpendTime(const EventRecord &inMacEvent); - - UInt32 mNextMatchTime; // contains tick count for next match action - bool mStartOver; // true to start the search from scratch (url changed) -#ifdef DEBUG - Int32 mTimesSearched; // how many times we searched -#endif - -}; // class CAutoCompleteURLEditField \ No newline at end of file diff --git a/mozilla/cmd/macfe/gui/CBrowserSecurityButton.cp b/mozilla/cmd/macfe/gui/CBrowserSecurityButton.cp deleted file mode 100644 index e5457509b6f..00000000000 --- a/mozilla/cmd/macfe/gui/CBrowserSecurityButton.cp +++ /dev/null @@ -1,43 +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. - */ - -#include "CBrowserSecurityButton.h" - -CBrowserSecurityButton::CBrowserSecurityButton(LStream* inStream) -: CPatternButton(inStream) -{ -} - -ResIDT CBrowserSecurityButton::GetIconID(ESecurityState inSecurityState) -{ - ResIDT result = ResID_UnsecureIcon; - if (inSecurityState == eSecureState) - result = ResID_SecureIcon; - return result; -} - -void CBrowserSecurityButton::NoteSecurityState(ESecurityState inSecurityState) -{ - ResIDT wantedIconID = GetIconID(inSecurityState); - - if (wantedIconID != GetGraphicID()) - { - SetGraphicID(wantedIconID); - Draw(NULL); - } -} diff --git a/mozilla/cmd/macfe/gui/CBrowserSecurityButton.h b/mozilla/cmd/macfe/gui/CBrowserSecurityButton.h deleted file mode 100644 index 3605f539812..00000000000 --- a/mozilla/cmd/macfe/gui/CBrowserSecurityButton.h +++ /dev/null @@ -1,40 +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. - */ - -#pragma once - -#include "CPatternButton.h" -#include "CSecurityStateListener.h" - -class CBrowserSecurityButton : public CPatternButton, public CSecurityStateListener -{ - public: - enum { class_ID = 'BrSB' }; - - enum { - ResID_SecureIcon = 15447, - ResID_UnsecureIcon = 15439 - }; - - CBrowserSecurityButton(LStream* inStream); - - virtual ResIDT GetIconID(ESecurityState inSecurityState); - - protected: - virtual void NoteSecurityState(ESecurityState inSecurityState); -}; diff --git a/mozilla/cmd/macfe/gui/CBrowserView.cp b/mozilla/cmd/macfe/gui/CBrowserView.cp deleted file mode 100644 index 7822f35d3e4..00000000000 --- a/mozilla/cmd/macfe/gui/CBrowserView.cp +++ /dev/null @@ -1,802 +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. - */ - -#include "CBrowserView.h" - - // need these for various routine calls -#include "CHTMLClickrecord.h" -#include "msgcom.h" -//#include "proto.h" -#include "RandomFrontEndCrap.h" -#include "CBrowserContext.h" -//#include "CBookmarksAttachment.h" -#include "ufilemgr.h" -#include "CURLDispatcher.h" -#include "CEditorWindow.h" // cmd_EditFrame -//#include "secnav.h" -//#include "ntypes.h" -//#include "shist.h" -#include "macutil.h" -#include "CViewUtils.h" -//#include "CApplicationEventAttachment.h" -//#include "uerrmgr.h" // GetPString prototype -#include "CTargetFramer.h" - -extern "C" { -#include "layout.h" -} - - // ¥¥¥ I don't want to include this, but I need the ID of the popup menu -#include "resgui.h" - -#include "CMochaHacks.h" -#include "privacy.h" - -class CBrowserViewDoDragReceiveMochaCallback; - -void MochaDragDrop(MWContext* inContext, CBrowserViewDoDragReceiveMochaCallback * cb, Point inDragMouse, short inDragModifiers ); -Boolean HasFTPUpload(CBrowserContext * context); - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserView::CBrowserView(LStream* inStream) - : CHTMLView(inStream) -{ -} - -CBrowserView::~CBrowserView() -{ -} - -void -CBrowserView::MoveBy( - Int32 inHorizDelta, - Int32 inVertDelta, - Boolean inRefresh) -{ - Inherited::MoveBy(inHorizDelta, inVertDelta, inRefresh); - if (mContext != NULL && (inHorizDelta || inVertDelta)) - { - SPoint32 location; - GetFrameLocation(location); - CMochaHacks::SendMoveEvent(*mContext, location.h, location.v); - } -} - - -// --------------------------------------------------------------------------- -// ¥ DrawSelf -// --------------------------------------------------------------------------- - -void -CBrowserView::DrawSelf(void) -{ - Inherited::DrawSelf(); - ExecuteAttachments(CTargetFramer::msg_DrawSelfDone, this); -} - -/* BeTarget and DontBeTarget enable and disable the drawing of the selection. - This has the effect of not drawing the text as selected when the view is - not currently the target. Using LO_ClearSelection instead would have - the same effect, but the selection wouldn't be recovered when the target - is given back to the view (as in, when its window is deactivated then - reactivated). -*/ - - -// --------------------------------------------------------------------------- -// ¥ ScrollImageBy -// --------------------------------------------------------------------------- - -void -CBrowserView::ScrollImageBy( Int32 inLeftDelta, Int32 inTopDelta, Boolean inRefresh ) -{ - Boolean mayAutoScrollLeavingTurds = inRefresh && IsTarget(); //&& mDropRow; - - if (mayAutoScrollLeavingTurds) - ExecuteAttachments(CTargetFramer::msg_ResigningTarget, this); - - Inherited::ScrollImageBy(inLeftDelta, inTopDelta, inRefresh); - - if (mayAutoScrollLeavingTurds && FocusDraw()) - ExecuteAttachments(CTargetFramer::msg_BecomingTarget, this); -} - - - -// --------------------------------------------------------------------------- -// ¥ BeTarget -// --------------------------------------------------------------------------- - -void -CBrowserView::BeTarget() { - - LO_HighlightSelection (*mContext, TRUE); - ExecuteAttachments(CTargetFramer::msg_BecomingTarget, this); -} - -// --------------------------------------------------------------------------- -// ¥ DontBeTarget -// --------------------------------------------------------------------------- - -void -CBrowserView::DontBeTarget() { - -// LO_ClearSelection (*mContext); - LO_HighlightSelection (*mContext, FALSE); - ExecuteAttachments(CTargetFramer::msg_ResigningTarget, this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- COMMANDER OVERRIDES --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserView::FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - if (::StillDown()) - { - if (FindCommandStatusForContextMenu(inCommand, outEnabled,outUsesMark, outMark, outName)) - return; - } - MWContext *mwcontext; - outUsesMark = false; - - CBrowserWindow *browserWindow = dynamic_cast(CViewUtils::GetTopMostSuperView(this)); - Boolean isHTMLHelp = browserWindow ? browserWindow->IsHTMLHelp() : false; - -// Restricted targets are Netcaster things, right? -#ifdef MOZ_NETCAST - // Disable commands which don't apply to restricted targets, at the request of javascript. - // No special distinction needed for floaters here. - if (browserWindow && - browserWindow->CommandsAreDisabled() && - inCommand == cmd_EditFrame) - { - outEnabled = false; - return; - } -#endif // MOZ_NETCAST - switch (inCommand) - { -#ifdef EDITOR - case cmd_EditFrame: - mwcontext = *GetContext(); - if (mwcontext && !(XP_IsContextBusy(mwcontext)) && !Memory_MemoryIsLow()) - { - // we must have a frameset if this context has a non-grid parent - if ( XP_GetNonGridContext( mwcontext ) != mwcontext ) - outEnabled = true && !isHTMLHelp; - } - break; -#endif // EDITOR - -// case cmd_SecurityInfo: -// case cmd_DocumentInfo: -// outEnabled = true; -// break; - - case cmd_FTPUpload: - outEnabled = HasFTPUpload( GetContext() ) && !isHTMLHelp; - break; - - case cmd_PrivDisplayPolicy: - mwcontext = *GetContext(); - if (mwcontext && !XP_IsContextBusy(mwcontext)) - outEnabled = PRVCY_CurrentHasPrivacyPolicy(mwcontext); - else - outEnabled = false; - break; - - case cmd_PrivDisplaySiteInfo: - outEnabled = true; - break; - - default: - Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} - -Boolean CBrowserView::ObeyCommand(CommandT inCommand, void* ioParam) -{ - Boolean cmdHandled = false; - MWContext* mwcontext; - - switch (inCommand) - { -#ifdef EDITOR - case cmd_EditFrame: - CEditorWindow::MakeEditWindowFromBrowser( *GetContext() ); - break; -#endif // EDITOR - -// case cmd_SecurityInfo: -// mwcontext = *GetContext(); -// if (mwcontext) -// { -// URL_Struct* url = -// SHIST_CreateURLStructFromHistoryEntry( -// mwcontext, -// GetContext()->GetCurrentHistoryEntry() -// ); -// if (url) -// SECNAV_SecurityAdvisor(mwcontext,url); -// } -// break; - - case cmd_FTPUpload: - { - // NOTE - the backend currently only supports uploading the data fork - // of a file. A planned feature of 5.0 is to support MacBinary - // encoding during the upload process. To this end the routine - // UStdDialogs::AskUploadAsDataOrMacBin has been created to prompt - // for the desired upload mode in place of the call to - // StandardGetFile below. - FSSpec spec; - History_entry * he = GetContext()->GetCurrentHistoryEntry(); - char * fileURL = CFileMgr::EncodedPathNameFromFSSpec(spec, TRUE); - OSType myTypes[3]; - StandardFileReply myReply; - UDesktop::Deactivate(); - StandardGetFile(NULL, -1, myTypes, &myReply); - UDesktop::Activate(); - if (myReply.sfGood) - { - URL_Struct * request = NET_CreateURLStruct(he->address, NET_SUPER_RELOAD); - char ** newFileList = (char **) XP_ALLOC(2 * sizeof(char*)); - ThrowIfNil_(request); - ThrowIfNil_(newFileList); - request->method = URL_POST_METHOD; - - newFileList[0] = CFileMgr::EncodedPathNameFromFSSpec(myReply.sfFile, TRUE); - ThrowIfNil_(newFileList[0]); - newFileList[1] = NULL; - request->files_to_post = newFileList; - GetContext()->SwitchLoadURL( request, FO_CACHE_AND_PRESENT ); - } - - cmdHandled = true; - } - break; - -// case cmd_DocumentInfo: -// URL_Struct* aboutURL = NET_CreateURLStruct( "about:document", NET_DONT_RELOAD ); -// if ( aboutURL ) -// CURLDispatcher::GetURLDispatcher()->DispatchToView(mContext, aboutURL, FO_CACHE_AND_PRESENT, false, 1010, false); -// break; - - case cmd_PrivDisplayPolicy: - mwcontext = *GetContext(); - char * url = PRVCY_GetCurrentPrivacyPolicyURL(mwcontext); - URL_Struct* theURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - if (theURL) - FE_MakeNewWindow(NULL, theURL, NULL, NULL); - cmdHandled = true; - break; - - case cmd_PrivDisplaySiteInfo: - mwcontext = *GetContext(); - PRVCY_SiteInfo(mwcontext); - cmdHandled = true; - break; - - default: - cmdHandled = Inherited::ObeyCommand(inCommand, ioParam); - break; - } - - return cmdHandled; -} - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CONTEXTUAL POPUP --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CBrowserView::FindCommandStatusForContextMenu( - CommandT inCommand, - Boolean &outEnabled, - Boolean &/*outUsesMark*/, - Char16 &/*outMark*/, - Str255 /*outName*/) -{ - // We come here only if a CContextMenuAttachment is installed. (This is the new way). - // Return true if we want to bypass standard status processing. - if (!mCurrentClickRecord) - return false; - CHTMLClickRecord& cr = *mCurrentClickRecord; // for brevity. - Boolean isAnchor = FALSE; - Boolean isImage = FALSE; - if (cr.mElement) - { - isAnchor = cr.IsAnchor(); - isImage = cr.mElement->type == LO_IMAGE - && NET_URL_Type(mContext->GetCurrentURL()) != FTP_TYPE_URL; - } - - CBrowserWindow *browserWindow = dynamic_cast(CViewUtils::GetTopMostSuperView(this)); - Boolean isHTMLHelp = browserWindow ? browserWindow->IsHTMLHelp() : false; - // We're overloading command disabling to handle menu items too. - Boolean commandsAreDisabled = browserWindow ? browserWindow->CommandsAreDisabled() : false; - - switch (inCommand) - { - case cmd_NEW_WINDOW_WITH_FRAME: - outEnabled = ((MWContext (*mContext)).is_grid_cell - && (mContext->GetCurrentHistoryEntry() != NULL)) && !isHTMLHelp; - return true; - case cmd_OPEN_LINK: - outEnabled = isAnchor && !commandsAreDisabled; - return true; - case cmd_AddToBookmarks: - if (isAnchor) - outEnabled = !isHTMLHelp; - return true; // for now, only have a "add bookmark for this link" command. -// return isAnchor; // we don't know unless it's an anchor - case cmd_NEW_WINDOW: -#ifdef MOZ_MAIL_NEWS - Boolean newWindowProhibited = ::MSG_NewWindowProhibited(*mContext, cr.mClickURL); -#else - // MSG_NewWindowProhibited doesn't exist in a non-mail/news world so just say - // we don't prohibit creating a new window - Boolean newWindowProhibited = false; -#endif // MOZ_MAIL_NEWS - outEnabled = !newWindowProhibited && isAnchor && !isHTMLHelp; - return true; - case cmd_SAVE_LINK_AS: - outEnabled = isAnchor && !IsMailToLink(cr.mClickURL) && !isHTMLHelp; - return true; // we don't know unless it's an anchor - case cmd_COPY_LINK_LOC: - outEnabled = (isAnchor && mCurrentClickRecord->mClickURL.length() > 0) && !isHTMLHelp; - return true; - case cmd_VIEW_IMAGE: - outEnabled = isImage && !isHTMLHelp && !commandsAreDisabled; - return true; - case cmd_SAVE_IMAGE_AS: - case cmd_COPY_IMAGE: - case cmd_COPY_IMAGE_LOC: - outEnabled = isImage && !isHTMLHelp; - return true; - case cmd_LOAD_IMAGE: - outEnabled = isImage && !commandsAreDisabled; - return true; - } - return false; // we don't know about it -} // CBrowserView::FindCommandStatusForContextMenu - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- DRAG AND DROP --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// Drag and drop is now reflected into javascript. On drag drop, the browser view -// packages the URLs received into a new event and sends it to javascript with a -// callback. If javascript lets us have the drop, the callback dispatches the URLs. - - - -Boolean CBrowserView::DragIsAcceptable(DragReference inDragRef) -{ - Boolean doAccept = false; - DragAttributes theAttributes = {0}; - - (void) GetDragAttributes(inDragRef, &theAttributes); - doAccept = !(theAttributes & kDragInsideSenderWindow); - - if (doAccept) - { - doAccept = Inherited::DragIsAcceptable(inDragRef); - } - - return doAccept; -} - - - -Boolean CBrowserView::ItemIsAcceptable(DragReference inDragRef, ItemReference inItemRef) -{ - FlavorFlags theFlags; - Boolean doAccept = false; - - doAccept |= (::GetFlavorFlags(inDragRef, inItemRef, 'TEXT', &theFlags) == noErr); - doAccept |= (::GetFlavorFlags(inDragRef, inItemRef, flavorTypeHFS, &theFlags) == noErr); - - return doAccept; -} - - - -/* -void CBrowserView::ReceiveDragItem(DragReference inDragRef, - DragAttributes inDragAttrs, - ItemReference inItemRef, - Rect& inItemBounds) // In local coordinates -{ - FlavorFlags theFlags; - OSErr anError = noErr; - URL_Struct* request = nil; - - anError = ::GetFlavorFlags(inDragRef, inItemRef, 'TEXT', &theFlags); - if (anError == noErr) - { - long theDataSize = 0; - char* theData = nil; - - ::GetFlavorDataSize(inDragRef, inItemRef, 'TEXT', &theDataSize); - if (theDataSize > 255) // ¥¥¥Êare there any limits to the URL string length? - { - theDataSize = 255; - } - - theData = (char*) ::NewPtr(theDataSize+1); - // assert(theData != nil); - - ::GetFlavorData(inDragRef, inItemRef, 'TEXT', theData, &theDataSize, nil); - theData[theDataSize] = 0; - - request = NET_CreateURLStruct(theData, NET_DONT_RELOAD); - // assert(request != nil); - - ::DisposePtr(theData); - } - - anError = ::GetFlavorFlags(inDragRef, inItemRef, flavorTypeHFS, &theFlags); - if (anError == noErr) - { - long theDataSize = 0; - HFSFlavor theData; - char* localURL; - - ::GetFlavorDataSize(inDragRef, inItemRef, flavorTypeHFS, &theDataSize); - ::GetFlavorData(inDragRef, inItemRef, flavorTypeHFS, &theData, &theDataSize, nil); - localURL = CFileMgr::GetURLFromFileSpec(theData.fileSpec); - // assert(localURL != nil); - - request = NET_CreateURLStruct(localURL, NET_DONT_RELOAD); - // assert(request != nil); - - XP_FREE(localURL); - } - - if (request != nil) - { - XP_MEMSET(&request->savedData, 0, sizeof(SHIST_SavedData)); - CURLDispatcher::GetURLDispatcher()->DispatchToView(mContext, request, FO_CACHE_AND_PRESENT, false); - } -} -*/ - -/* - * CBrowserViewDoDragReceiveMochaCallback - * callback for DoDragReceive - */ -class CBrowserViewDoDragReceiveMochaCallback : public CMochaEventCallback -{ -public: - CBrowserViewDoDragReceiveMochaCallback( CBrowserView * view, XP_List* inRequestList, char** inURLArray) - : fBrowserView(view), fRequestList(inRequestList), fURLArray(inURLArray) {} - - virtual void Complete(MWContext *, - LO_Element * , int32 /*type*/, ETEventStatus status) - { - if (status == EVENT_OK) - { - fBrowserView->DoDragReceiveCallback(fRequestList ); - } - else if (status == EVENT_PANIC || status == EVENT_CANCEL) - { - // free the URL_Structs we created in DoDragReceive since they weren't dispatched. - for (int i = 1; i <= XP_ListCount(fRequestList); i++) - { - URL_Struct* request = (URL_Struct *)XP_ListGetObjectNum(fRequestList, i); - NET_FreeURLStruct(request); - } - } - XP_ListDestroy(fRequestList); - XP_FREE(fURLArray); - } - - int LengthURLArray() { return XP_ListCount(fRequestList); } - - char** GetURLArray() { return fURLArray; } - -private: - CBrowserView * fBrowserView; - XP_List* fRequestList; - char** fURLArray; -}; - -// This is handled through a callback from javascript now. -// Creates a list of the URL_Structs to process in the callback because the DragReference -// will no longer be valid. -void -CBrowserView::DoDragReceive(DragReference inDragRef) -{ - // This gets freed in the callback. - XP_List* requestList = XP_ListNew(); - if ( !requestList ) return; - - FlavorFlags theFlags; - OSErr anError = noErr; - URL_Struct* request = nil; - - Uint16 itemCount; // Number of Items in Drag - ::CountDragItems(inDragRef, &itemCount); - - for (Uint16 item = 1; item <= itemCount; item++) - { - ItemReference itemRef; - ::GetDragItemReferenceNumber(inDragRef, item, &itemRef); - - // First check if this has a TEXT flavor. If so, this is either a URL dragged from - // another app or a text clipping dragged from the desktop. Either way, we need - // to guarantee that we don't try below to read the drop as an HFSFlavor - // (which a clipping also has). - anError = ::GetFlavorFlags(inDragRef, itemRef, 'TEXT', &theFlags); - if (anError == noErr) - { - long theDataSize = 0; - char* theData = nil; - - ::GetFlavorDataSize(inDragRef, itemRef, 'TEXT', &theDataSize); - if (theDataSize > 1024) // ¥¥¥Êare there any limits to the URL string length? - theDataSize = 1024; - - theData = (char*) ::NewPtr(theDataSize+1); - // assert(theData != nil); - - if (theData != NULL) - { - ::GetFlavorData(inDragRef, itemRef, 'TEXT', theData, &theDataSize, nil); - theData[theDataSize] = 0; - - request = NET_CreateURLStruct(theData, NET_DONT_RELOAD); - if (request != NULL) XP_ListAddObjectToEnd(requestList, request); - // assert(request != nil); - - ::DisposePtr(theData); - } - - } // if has TEXT flavor - else - { - // if this item was not a clipping or dragged text, then process it as an HTML - // file - long theDataSize = 0; - HFSFlavor theData; - char* localURL; - Boolean ignore1, ignore2; - - ::GetFlavorDataSize(inDragRef, itemRef, flavorTypeHFS, &theDataSize); - anError = ::GetFlavorData(inDragRef, itemRef, flavorTypeHFS, &theData, &theDataSize, nil); - if (anError == badDragFlavorErr) - anError = GetHFSFlavorFromPromise (inDragRef, itemRef, &theData, true); - - if (anError == noErr) - { - if (HasFTPUpload(GetContext())) - { - History_entry * he = GetContext()->GetCurrentHistoryEntry(); - - if (!request) - { - request = NET_CreateURLStruct(he->address, NET_SUPER_RELOAD); - request->method = URL_POST_METHOD; - } - - QueueFTPUpload(theData.fileSpec, request); - } - else - { - // if there's an error resolving the alias, the local file url will refer to the alias itself. - ::ResolveAliasFile(&theData.fileSpec, true, &ignore1, &ignore2); - localURL = CFileMgr::GetURLFromFileSpec(theData.fileSpec); - // assert(localURL != nil); - - if (localURL != NULL) - { - request = NET_CreateURLStruct(localURL, NET_DONT_RELOAD); - if (request != NULL) XP_ListAddObjectToEnd(requestList, request); - // assert(request != nil); - - XP_FREE(localURL); - } - } - - } // if we are sure this is a file. - - } // if not a clipping or text - - } // for each drag item - - // After all that, do we have any files to post? - if (HasFTPUpload(GetContext()) && request->files_to_post) - XP_ListAddObjectToEnd(requestList, request); - - if (requestList != NULL) - { - int numItems = XP_ListCount(requestList); - int size = sizeof(char*) * (numItems + 1); - char ** urlArray = (char**)XP_ALLOC(size); - XP_ASSERT(urlArray); - - int i; - for (i = 0; i < numItems; i++) - { - // the URL_Struct already has the url allocated so use that. - URL_Struct* request = (URL_Struct *)XP_ListGetObjectNum(requestList, i+1); // XP_Lists are 1-indexed - urlArray[i] = request->address; - } - urlArray[i] = 0; - - Point dragMouse; - short dragModifiers; - - ::GetDragMouse(inDragRef, &dragMouse, NULL); - ::GetDragModifiers(inDragRef, &dragModifiers, NULL, NULL); - MochaDragDrop(*mContext, - new CBrowserViewDoDragReceiveMochaCallback(this, requestList, urlArray), - dragMouse, - dragModifiers); - - } // if requestList has things to process - -} // CBrowserView :: DoDragReceive - - -// Dispatch the urls collected in DoDragReceive. -// This is executed if javascript lets us have the event. -void -CBrowserView::DoDragReceiveCallback(XP_List* inRequestList) -{ - for (int i = 1; i <= XP_ListCount(inRequestList); i++) - { - URL_Struct* request = (URL_Struct *)XP_ListGetObjectNum(inRequestList, i); - if (request != nil) - { - XP_MEMSET(&request->savedData, 0, sizeof(SHIST_SavedData)); - //CURLDispatcher::GetURLDispatcher()->DispatchToView(mContext->GetTopContext(mContext), - //request, FO_CACHE_AND_PRESENT, false); - - // We need this to be delayed so that we can confirm ftp drag & drop since we can't confirm - //inside the drag handler -// CURLDispatcher::GetURLDispatcher()->DispatchToView(mContext->GetTopContext(mContext), - //request, FO_CACHE_AND_PRESENT, false, 1010, true); - CURLDispatcher::DispatchURL(request, mContext->GetTopContext(), true); - } - } -} - -// Mocha allows drag receive to be cancelled, so send a dragdrop message. -void -MochaDragDrop(MWContext* inContext, CBrowserViewDoDragReceiveMochaCallback * cb, Point inDragMouse, short inDragModifiers) -{ - JSEvent* event = XP_NEW_ZAP(JSEvent); - - if (event != NULL) - { - // event's data field is an array of urls. - - event->type = EVENT_DRAGDROP; - event->data = (void *)cb->GetURLArray(); - event->dataSize = cb->LengthURLArray(); - event->screenx = inDragMouse.h; - event->screeny = inDragMouse.v - ::GetMBarHeight(); - event->modifiers = CMochaHacks::MochaModifiers(inDragModifiers); - ET_SendEvent( inContext, 0, event, CMochaEventCallback::MochaCallback, cb ); - } -} - - -// True if we might be able to do FTP upload. -Boolean HasFTPUpload(CBrowserContext * context) -{ - History_entry * he = context->GetCurrentHistoryEntry(); - return (he && - !strncasecomp(he->address, "ftp", 3) && - he->address[strlen(he->address)-1] == '/' ); -} - - -// Adds file for FTP file upload -void CBrowserView::QueueFTPUpload(const FSSpec & spec, URL_Struct* request) -{ - FSSpec theResolvedSpec = spec; - Boolean isFolder; - Boolean wasAliased; - - // If we drop the whole HD, allow bailout - if (CmdPeriod()) - return; - - // If it's an alias to a folder - skip it! - if (::ResolveAliasFile(&theResolvedSpec, TRUE, &isFolder, &wasAliased) == noErr && isFolder && wasAliased) - return; - - // If it is a folder, add it recursively - if (CFileMgr::IsFolder(spec)) - { - FSSpec newSpec; - FInfo dummy; - Boolean dummy2; - CFileIter iter((FSSpec&)spec); - while (iter.Next(newSpec, dummy, dummy2)) - QueueFTPUpload(newSpec, request); - return; - } - - // We want to use the resolved alias spec here so we get the right file name - char * fileURL = CFileMgr::EncodedPathNameFromFSSpec(theResolvedSpec, TRUE); - - // Add file argument to the URL struct (queued up as the fLatentRequest - - // Duplicate the current file list - int newFilePos = 0; - char ** newFileList; - if (request->files_to_post) - while (request->files_to_post[newFilePos] != NULL) - newFilePos++; - - newFileList = (char **) XP_ALLOC((newFilePos+2) * sizeof(char*)); - ThrowIfNil_(newFileList); - - for (int i = 0; i < newFilePos; i++) - newFileList[i] = request->files_to_post[i]; - - // Add the new member - newFileList[newFilePos] = fileURL; - newFileList[newFilePos + 1] = NULL; - - if (request->files_to_post) - XP_FREE(request->files_to_post); - - request->files_to_post = newFileList; - -} - - -#pragma mark - - - -// -// DragIsAcceptable -// -// Since this is smack-dab in the middle of the chrome and shows only what we want -// it to show, don't let the user drag urls here (say from bookmarks) and launch them. -// -Boolean -CAdSpaceView :: DragIsAcceptable ( DragReference inDragRef ) -{ - return false; - -} // DragIsAcceptable - diff --git a/mozilla/cmd/macfe/gui/CBrowserView.h b/mozilla/cmd/macfe/gui/CBrowserView.h deleted file mode 100644 index 2920dfc365b..00000000000 --- a/mozilla/cmd/macfe/gui/CBrowserView.h +++ /dev/null @@ -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. - */ - -#pragma once - -#include "CHTMLView.h" -#include "CKeyUpReceiver.h" - -class CBrowserViewDoDragReceiveMochaCallback; - -class CBrowserView : public CHTMLView, public CKeyUpReceiver -{ - private: - typedef CHTMLView Inherited; - public: - - enum { class_ID = 'BrVw' }; - - CBrowserView(LStream* inStream); - virtual ~CBrowserView(); - - virtual void DrawSelf(); // needed for target framer to work properly - - virtual void ScrollImageBy( Int32 inLeftDelta, Int32 inTopDelta, Boolean inRefresh ); - - virtual Boolean DragIsAcceptable(DragReference inDragRef); - virtual Boolean ItemIsAcceptable(DragReference inDragRef, - ItemReference inItemRef); -/* - virtual void ReceiveDragItem(DragReference inDragRef, - DragAttributes inDragAttrs, - ItemReference inItemRef, - Rect& inItemBounds); -*/ - // Drag receive is now processed through a callback, so that javascript has a - // chance to cancel the event. - virtual void DoDragReceive(DragReference inDragRef); - virtual void DoDragReceiveCallback(XP_List* inRequestList); - - virtual void MoveBy( - Int32 inHorizDelta, - Int32 inVertDelta, - Boolean inRefresh); - - // COMMANDER - Boolean FindCommandStatusForContextMenu( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand(CommandT inCommand, void* ioParam); - - protected: - virtual void BeTarget(); - virtual void DontBeTarget(); - - virtual void QueueFTPUpload(const FSSpec & spec, URL_Struct* request); - -}; - - -// -// class CAdSpaceView -// -// A derivative of a browser view that fits inside the docked Aurora pane for showing -// "useful Netcenter information" to the user. You and I both know what that means. -// - -class CAdSpaceView : public CBrowserView -{ -private: - typedef CBrowserView Inherited; - -public: - - enum { class_ID = 'AdVw' }; - - CAdSpaceView(LStream* inStream) - : CBrowserView(inStream) { }; - virtual ~CAdSpaceView() { }; - - virtual Boolean DragIsAcceptable(DragReference inDragRef); - -}; // class CAdSpaceView diff --git a/mozilla/cmd/macfe/gui/CBrowserWindow.cp b/mozilla/cmd/macfe/gui/CBrowserWindow.cp deleted file mode 100644 index 5ae04be893a..00000000000 --- a/mozilla/cmd/macfe/gui/CBrowserWindow.cp +++ /dev/null @@ -1,2704 +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. - */ - -#include "Netscape_Constants.h" -#include "CBrowserWindow.h" -#ifdef MOZ_OFFLINE -#include "MailNewsgroupWindow_Defines.h" // for the offline button id -#endif //MOZ_OFFLINE - -#include "CAutoPtrXP.h" - -#include "CBevelView.h" -#include "CApplicationEventAttachment.h" -#include "CHTMLView.h" -#include "CBrowserContext.h" -#include "CHistoryMenu.h" -#include "mimages.h" -#include "mversion.h" -#include "CURLEditField.h" -#include "CURLCaption.h" -#include "CProxyPane.h" -#include "URDFUtilities.h" // for LaunchURL - -//#include "CEditView.h" // need for SetWindowContext, using CEditView::class_ID -#include "CEditorWindow.h" -// need these for dynamic window modification - mjc -#include "CDragBar.h" // need for GetChromeInfo -#include "CDragBarContainer.h" // need for SetChromeInfo, using CDragBarContainer::class_ID -#include "CHyperScroller.h" // need for SetChromeInfo -#include "CPaneEnabler.h" -#include "UDeferredTask.h" - -#include "CSpinningN.h" -#include "CBrowserSecurityButton.h" -#include "CMiniSecurityButton.h" - -#include "CRDFCoordinator.h" -#include "CRDFToolbarContainer.h" // to handle HT commands, we need to tell the container - - // stuff added by deeje -#include "macutil.h" -#include "xp.h" -#include "uerrmgr.h" // GetPString prototype -#include "shist.h" -#include "resgui.h" -#include "CURLDispatcher.h" -#include "prefapi.h" -#include "CPrefsDialog.h" -#include "xp_ncent.h" // for XP_SetLastActiveContext - - -#include "libi18n.h" -#include "ufilemgr.h" - - // stuff for AppleEvent support -#include "CAppleEventHandler.h" -#include "resae.h" -#include "uapp.h" - -#include "CMochaHacks.h" // for SendMoveEvent, SendResizeEvent, and RemoveDependents 1997-02-26 mjc - -#include "RandomFrontEndCrap.h" // for IsSpecialBrowserWindow - -#include -#include -#include - -// pane id constants - for SetChromeInfo and GetChromeInfo - mjc -const PaneIDT HTML_Container_PaneID = 'HtCt'; -const PaneIDT Button_Bar_PaneID = 'NBar'; -const PaneIDT Location_Bar_PaneID = 'LBar'; -const PaneIDT Directory_Bar_PaneID = 'DBar'; -const PaneIDT PersonalToolbar_PaneID = 'PBar'; -const PaneIDT SWatch_View_PaneID = 'SwBv'; -const PaneIDT Hyper_Scroller_PaneID = 1005; -const PaneIDT Status_Bar_PaneID = 'StBv'; -const PaneIDT CoBrandLogo_PaneID = 'Bnet'; - -// These are obsolete once scc puts in the configurable toolbars. They should go away for 5.0 -const char* Pref_ShowToolbar = "browser.chrome.show_toolbar"; -const char* Pref_ShowLocationBar = "browser.chrome.show_url_bar"; -const char* Pref_ShowPersonalToolbar = "browser.chrome.show_personal_toolbar"; - -enum { eNavigationBar, - eLocationBar, - eStatusBar, - ePersonalToolbar }; - - -CPopdownRDFCoordinator* CBrowserWindow::sPopdownParent = NULL; - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserWindow::CBrowserWindow(LStream* inStream) - : CNetscapeWindow(inStream, WindowType_Browser), - CSaveWindowStatus(this) -{ - mProgressListener = NULL; - mContext = NULL; - mAlwaysOnBottom = false; // javascript alwaysLowered window property - mjc - mZLocked = false; - mMenubarMode = BrWn_Menubar_Default; - mCommandsDisabled = false; - fCloseNotifier = MakeNoProcessPSN(); - mSupportsPageServices = false; - mAllowSubviewPopups = true; - mIsRootDocInfo = false; - mIsViewSource = false; - mIsHTMLHelp = false; - mHTMLView = nil; - mNavCenterParent = nil; - mToolbarContainer = nil; - - mPopdownParent = nil; // popdown tree view stuff - mSavedPopdownTarget = nil; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CBrowserWindow::~CBrowserWindow() -{ - delete mProgressListener; - if (mContext != NULL) CMochaHacks::RemoveDependents(*mContext); // close windows declared as dependents in Javascript - 1997-02-26 mjc - SetWindowContext(NULL); - - RemoveAllAttachments(); - // Kludgy, but prevents crash in LUndoer caused by view being destroyed before - // attachments. This happens if a form element which is a text field exists. - - // if there is a popdown window it will be destroyed when the view hierarchy is - // destroyed so we don't need to delete it ourselves. - ClosePopdownTreeView(); - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::FinishCreateSelf(void) -{ - CNetscapeWindow::FinishCreateSelf(); - - mHTMLView = dynamic_cast(FindPaneByID(CHTMLView::pane_ID)); - ThrowIfNil_(mHTMLView); - - mNavCenterParent = dynamic_cast(FindPaneByID(CDockedRDFCoordinator::pane_ID)); - - if (HasAttribute(windAttr_Regular) && HasAttribute(windAttr_Resizable)) - FinishCreateWindow(); - AdjustStagger(WindowType_Browser); // <--- I moved this down to CNetscapeWindow - jrm 98/04/14 - UReanimator::LinkListenerToControls(this, this, mPaneID); - - // Get the toolbar container. If it is an RDF container, store it so that we can send HT - // commands to it later. Recall that editor has a 'DbCt' as well - mToolbarContainer = dynamic_cast(FindPaneByID('DbCt')); - - // Show/hide toolbars based on preference settings - XP_Bool value; - PREF_GetBoolPref(Pref_ShowToolbar, &value); - mToolbarShown[eNavigationBar] = value; - ShowOneDragBar(Button_Bar_PaneID, value); - PREF_GetBoolPref(Pref_ShowLocationBar, &value); - mToolbarShown[eLocationBar] = value; - ShowOneDragBar(Location_Bar_PaneID, value); - PREF_GetBoolPref(Pref_ShowPersonalToolbar, &value); - mToolbarShown[ePersonalToolbar] = value; - ShowOneDragBar(PersonalToolbar_PaneID, value); - mToolbarShown[eStatusBar] = TRUE; // no pref for status bar - - // Handle NavCenter pane. - // - //¥¥¥For now, always hide it at startup, but this will proabably change, hopefully - //¥¥¥with an XP callback so this code can stay the same... - if ( mNavCenterParent ) { - mNavCenterParent->NavCenterShelf().SetShelfState ( false ); - } // if there is a navcenter - - // Delete the Admin Kit co-brand button if a - // custom animation has not been installed - if ( !CPrefs::HasCoBrand() ) { - LPane* button = FindPaneByID(CoBrandLogo_PaneID); - if (button) { - RemoveSubPane(button); - delete button; - } - } - - /* - // the HTML view handles many of the buttons in the tool bar - LListener* theHTMLView = (LListener*) FindPaneByID(CHTMLView::pane_ID); - if (theHTMLView != nil) - { - UReanimator::LinkListenerToControls(theHTMLView, this, mPaneID); - } - */ - - // Make the tab group the latent sub commander - - CURLEditField* theURLEditField = dynamic_cast(FindPaneByID(CURLEditField::class_ID)); - if (theURLEditField) - { - // Find the tab group which is a super commander of the edit field and make it - // the latent sub commander which should rotate the target to the first target. - - LCommander* theCommander = theURLEditField->GetSuperCommander(); - LTabGroup* theTabGroup = nil; - while (theCommander && !(theTabGroup = dynamic_cast(theCommander))) - { - theCommander = theCommander->GetSuperCommander(); - } - - if (theTabGroup) - { - SetLatentSub(theTabGroup); - } - } -} - - -// -// HookupContextToToolbars -// -// Handle connecting the current context to the various bits and pieces in the toolbars. This -// routine may be called multiple times w/out problems because PP is smart enough not to -// add listeners for things already registered. -// -void -CBrowserWindow :: HookupContextToToolbars ( ) -{ - if ( mContext ) { - // now hook up CProxyPane to listen to context - CProxyPane* browserPageProxy = dynamic_cast(FindPaneByID(CProxyPane::class_ID)); - if (browserPageProxy) - mContext->AddListener(browserPageProxy); - // now hook up CURLCaption to listen to context - CURLCaption* urlCaption = dynamic_cast(FindPaneByID(CURLCaption::class_ID)); - if (urlCaption) - mContext->AddListener(urlCaption); - // now hook up CURLEditField to listen to context - CURLEditField* urlField = dynamic_cast(FindPaneByID(CURLEditField::class_ID)); - if (urlField) - { - mContext->AddListener(urlField); - urlField->AddListener(this); - if (urlCaption) - urlField->AddListener(urlCaption); - } - CSpinningN* theN = dynamic_cast(FindPaneByID(CSpinningN::class_ID)); - if (theN) - mContext->AddListener(theN); - } - -} // HookupContextToToolbars - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// NOTE: This will handle registering/unregistering the embedded navCenter -// for sitemap info. When the context is cleared (by passing NULL), -// it will unregister so we don't need to do it elsewhere. -void CBrowserWindow::SetWindowContext(CBrowserContext* inContext) -{ - if (mContext != NULL) { - if ( mNavCenterParent ) - mNavCenterParent->UnregisterNavCenter(); - mContext->RemoveUser(this); - } - - mContext = inContext; - - if (mContext != NULL) - { - mContext->SetRequiresClone(true); - mContext->AddListener(this); - try { - // Let there be a progress listener, placed in my firmament, - // which shall listen to the context - mProgressListener = new CProgressListener(this, inContext); - } catch (...) { - mProgressListener = NULL; - } - mContext->AddUser(this); - - HookupContextToToolbars(); - - CBrowserSecurityButton* securityButton = - dynamic_cast(FindPaneByID(CBrowserSecurityButton::class_ID)); - if (securityButton) - mContext->AddListener(securityButton); - - CMiniSecurityButton* miniSecurityButton = - dynamic_cast(FindPaneByID(CMiniSecurityButton::class_ID)); - if (miniSecurityButton) - mContext->AddListener(miniSecurityButton); - -#ifdef MOZ_OFFLINE - // hook up the offline icon - LBroadcaster* offlineButton - = dynamic_cast(FindPaneByID(kOfflineButtonPaneID)); - if (offlineButton) - offlineButton->AddListener(CFrontApp::GetApplication()); -#endif //MOZ_OFFLINE - - // setup navCenter for sitemaps - if ( mNavCenterParent && !HasAttribute(windAttr_Floating)) - mNavCenterParent->RegisterNavCenter ( *inContext ); - - } - - GetHTMLView()->SetContext(mContext); - - // This call links up the model object hierarchy for any potential - // sub model that gets created within the scope of the html view. - GetHTMLView()->SetFormElemBaseModel(this); - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CNSContext* CBrowserWindow::GetWindowContext() const -{ - return mContext; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - outUsesMark = false; - - if (mIsHTMLHelp && UDesktop::FrontWindowIsModal() && inCommand != cmd_About) - { - outEnabled = false; - return; - } - // Floating browser windows whose commands have been disabled should only disable the - // commands that apply to the floating window. - if (mCommandsDisabled) - if (HasAttribute(windAttr_Floating)) - { - if ( - inCommand == cmd_GoBack || - inCommand == cmd_GoForward || - inCommand == cmd_Home || - inCommand == cmd_Close || - inCommand == cmd_ToggleToolbar || - inCommand == cmd_ToggleLocationBar || - inCommand == cmd_Reload || - inCommand == cmd_LoadImages || - inCommand == cmd_Stop || - inCommand == cmd_FontLarger || - inCommand == cmd_FontSmaller -#ifdef EDITOR - || - inCommand == cmd_EditFrameSet || - inCommand == cmd_EditDocument -#endif // EDITOR - ) - { - outEnabled = false; - return; - } - } - // Commands may be disabled from javascript. The motivation for this is to prevent - // users from loading new content into windows that have a special purpose (i.e. Constellation). - // Don't disable Apple Menu Items or Quit menu item. - // NOTE: it appears that the Apple Menu Items will be disabled unless I enable - // the About command. Assume for now that menubar hiding will be implemented, so the - // user won't be able to access the About menu item. - else if ( - inCommand != cmd_Quit && - inCommand != cmd_SecurityInfo && - inCommand != cmd_About) - { - outEnabled = false; - return; - } - - // - // Handle the remainder of commands - // - switch (inCommand) - { - case cmd_DocumentInfo: - case cmd_ViewSource: - if (mContext && (mIsRootDocInfo || mIsViewSource || mIsHTMLHelp)) - { - outEnabled = false; - break; - } - case cmd_PageSetup: - case cmd_Print: - case cmd_PrintOne: - case cmd_AddToBookmarks: - case cmd_SaveAs: - case cmd_SecurityInfo: - case cmd_FTPUpload: - case cmd_Find: - case cmd_MailDocument: - case cmd_LoadImages: - case cmd_Reload: - case cmd_FontLarger: - case cmd_FontSmaller: - case cmd_PrivDisplayPolicy: - case cmd_PrivDisplaySiteInfo: - { - // Need to be very careful what gets delegated here, in order to aviod infinite - // recursion a la bug #313498. Handling the command status in CBrowserView is not - // sufficient - it also needs to be handled in CHTMLView, which is the class that - // will receive this if it's a Composer window instead of a Browser window. - - // Delegate this to the view. - GetHTMLView()->FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } - case cmd_GoForward: - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - LString::CopyPStr(::GetPString(MENU_FORWARD_ONE_HOST), outName); - } - else - { - LString::CopyPStr(::GetPString(MENU_FORWARD), outName); - } - - if (mContext != NULL) - { - outEnabled = mContext->CanGoForward() && !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp); - - } - break; - case cmd_GoBack: - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - LString::CopyPStr(::GetPString(MENU_BACK_ONE_HOST), outName); - } - else - { - LString::CopyPStr(::GetPString(MENU_BACK), outName); - } - - if (mContext != NULL) - { - outEnabled = mContext->CanGoBack() && !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp); - - } - break; - case cmd_Home: - outEnabled = (mContext) ? !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp) : true; - break; - - case cmd_ToggleToolbar: - outEnabled = (mContext) ? !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp || PREF_PrefIsLocked(Pref_ShowToolbar)) : true; - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, (mToolbarShown[eNavigationBar] ? HIDE_NAVIGATION_TOOLBAR_STRING : SHOW_NAVIGATION_TOOLBAR_STRING)); - break; - - case cmd_ToggleLocationBar: - outEnabled = (mContext) ? !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp || PREF_PrefIsLocked(Pref_ShowLocationBar)) : true; - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, (mToolbarShown[eLocationBar] ? HIDE_LOCATION_TOOLBAR_STRING : SHOW_LOCATION_TOOLBAR_STRING)); - break; - - case cmd_TogglePersonalToolbar: - outEnabled = (mContext) ? !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp || PREF_PrefIsLocked(Pref_ShowPersonalToolbar)) : true; - ::GetIndString(outName, BROWSER_MENU_TOGGLE_STRINGS_ID, (mToolbarShown[ePersonalToolbar] ? HIDE_PERSONAL_TOOLBAR_STRING : SHOW_PERSONAL_TOOLBAR_STRING)); - break; - - case cmd_NetSearch: - outEnabled = (mContext) ? !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp) : true; - break; - - case cmd_ToolbarButton: - // we always want the toolbar buttons that don't correspond to any real command (that are - // either HT containers or just simple url's) to be enabled and clickable. - outEnabled = true; - break; - - case cmd_Stop: - { - // Default name is STOP_LOADING_INDEX - - ::GetIndString(outName, STOP_STRING_LIST, STOP_LOADING_INDEX ); - - if (mContext) - { - if (XP_IsContextStoppable((MWContext*) (*mContext))) - { - outEnabled = true; - } - else if (mContext->IsContextLooping()) - { - outEnabled = true; - - ::GetIndString(outName, STOP_STRING_LIST, STOP_ANIMATIONS_INDEX ); - } - } - break; - } - -#ifdef EDITOR - case cmd_EditFrameSet: - case cmd_EditDocument: - { - if ((mContext != nil) && !(XP_IsContextBusy(*mContext)) && !Memory_MemoryIsLow()) - outEnabled = !(mIsRootDocInfo || mIsViewSource || mIsHTMLHelp); - break; - } -#endif // EDITOR - - case cmd_PageServices: - outEnabled = mSupportsPageServices; - break; - - default: - { - if(inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) - { - // Delegate this to the view. - GetHTMLView()->FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } - else - CNetscapeWindow::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// Revised to handle back, forward, home, reload through AppleEvents - 1997-02-26 mjc -Boolean CBrowserWindow::ObeyCommand( - CommandT inCommand, - void *ioParam) -{ - if ( inCommand >= cmd_NavCenterBase && inCommand <= cmd_NavCenterCap ) { - if ( mToolbarContainer) - mToolbarContainer->HandleHTCommand(inCommand); - return true; - } - - LCommander *target; - Boolean cmdHandled = false; - // check for synthetic commands from history items - if (CHistoryMenu::IsHistoryMenuSyntheticCommandID(inCommand) && mContext != NULL) - { - // Compute correct history list index. - // Menu item number - last non-dynamic menu item number is - // index to history entry starting from the *END* of history list -- - // because we list history entries in menu bar starting with the most - // recent history entry at the top which is at the end of the history list in the - // MWContext. Therefore, compute correct history list index before calling - // CNSContext::LoadHistoryEntry - Int32 histIndex = mContext->GetHistoryListCount() - - (CHistoryMenu::GetFirstSyntheticCommandID() - inCommand); - // histIndex should now be the one-based index to the history entry we want - // starting from the beginning of the list. - mContext->LoadHistoryEntry(histIndex); - cmdHandled = true; - } - else - { - switch (inCommand) - { - case cmd_Print: - case cmd_PrintOne: - // if the current target happens to be a subview of our main HTMLView, let it - // handle the command. else, hand it to our main HTML view. - target = LCommander::GetTarget(); - while (target && target != GetHTMLView()) - target = target->GetSuperCommander(); - if (target == GetHTMLView()) - LCommander::GetTarget()->ObeyCommand (inCommand, ioParam); - else - GetHTMLView()->ObeyCommand (inCommand, ioParam); - break; - case cmd_ViewSource: - case cmd_Find: - case cmd_AddToBookmarks: - case cmd_SaveAs: - case cmd_SecurityInfo: - case cmd_DocumentInfo: - case cmd_MailDocument: - case cmd_LoadImages: - case cmd_FTPUpload: - case cmd_FontLarger: - case cmd_FontSmaller: - case cmd_PrivDisplayPolicy: - case cmd_PrivDisplaySiteInfo: - { - // Delegate this to the view. - GetHTMLView()->ObeyCommand(inCommand, ioParam); - } - break; - - case cmd_GoForward: - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - if (mContext) - { - mContext->GoForwardOneHost(); - } - } - else - { - SendAEGo(kAENext); - } - cmdHandled = true; - break; - - case cmd_GoBack: - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - if (mContext) - { - mContext->GoBackOneHost(); - } - } - else - { - SendAEGo(kAEPrevious); - } - cmdHandled = true; - break; - - case cmd_Home: - SendAEGo(AE_www_go_home); - - // ¥¥¥ what the hell is this? deeje 97-03-06 - // cmdHandled = CNetscapeWindow::ObeyCommand(inCommand, ioParam); - break; - - case cmd_NetSearch: - HandleNetSearchCommand(); - break; - - case cmd_ToggleToolbar: - ToggleDragBar(Button_Bar_PaneID, eNavigationBar, Pref_ShowToolbar); - cmdHandled = true; - break; - - case cmd_ToggleLocationBar: - ToggleDragBar(Location_Bar_PaneID, eLocationBar, Pref_ShowLocationBar); - cmdHandled = true; - break; - - case cmd_TogglePersonalToolbar: - ToggleDragBar(PersonalToolbar_PaneID, ePersonalToolbar, Pref_ShowPersonalToolbar); - cmdHandled = true; - break; - - case cmd_Reload: - { - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) || - CApplicationEventAttachment::CurrentEventHasModifiers(shiftKey)) - { - SendAEGo(AE_www_super_reload); - } - else - { - SendAEGo(AE_www_go_again); - } - cmdHandled = true; - break; - } - - case cmd_Stop: - { - TrySetCursor(watchCursor); - XP_InterruptContext(*mContext); - SetCursor( &qd.arrow ); - cmdHandled = true; - break; - } - -#ifdef EDITOR - case cmd_EditFrameSet: - case cmd_EditDocument: - MWContext *frontWindowMWContext; - frontWindowMWContext = XP_GetNonGridContext( GetWindowContext()->operator MWContext*() ); - CEditorWindow::MakeEditWindowFromBrowser( frontWindowMWContext ); - cmdHandled = true; - break; -#endif // EDITOR - - case cmd_SaveDefaultCharset: - { - Int32 default_csid = GetDefaultCSID(); - CPrefs::SetLong(default_csid, CPrefs::DefaultCharSetID); - } - break; - - case cmd_PageServices: - { - char* url = SHIST_GetCurrentPageServicesURL(*mContext); - if (url) - { - URL_Struct* newURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - if (newURL) - mContext->SwitchLoadURL(newURL, FO_CACHE_AND_PRESENT); - } - } - break; - - default: - { - if ( inCommand > ENCODING_BASE && inCommand < ENCODING_CEILING ) - { - // Delegate this to the view. - GetHTMLView()->SetDefaultCSID(CPrefs::CmdNumToDocCsid(inCommand)); - cmdHandled = true; - } - else - cmdHandled = CNetscapeWindow::ObeyCommand(inCommand, ioParam); - break; - } - - } // case of which command - } // else not a history command - - return cmdHandled; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::ListenToMessage(MessageT inMessage, void* ioParam) -{ - switch (inMessage) - { - case msg_NSCConfirmLoadNewURL: - long response = 0; - // kludge alert: - // expand windowshaded floating windows to work around bug reported with system 7.6.1 (and probably earlier) - // which breaks the window when a new url is loaded. - if (IsVisible() && - HasAttribute(windAttr_TitleBar) && - HasAttribute(windAttr_Floating) && - ::EmptyRgn(((WindowPeek)GetMacPort())->contRgn) && - (noErr == ::Gestalt (gestaltSystemVersion, &response)) && - (response < 0x800)) - { - GrafPtr savePort; // get the port rectangle and convert - ::GetPort(&savePort); // to global coordinates - ::SetPort(GetMacPort()); - Rect expandedRect = GetMacPort()->portRect; - ::LocalToGlobal(&topLeft(expandedRect)); - ::LocalToGlobal(&botRight(expandedRect)); - ::SetPort(savePort); - DoSetBounds(expandedRect); - } - break; - - case msg_NSCDocTitleChanged: - NoteDocTitleChanged((const char*)ioParam); - break; - - case msg_NSCInternetKeywordChanged: - NoteInternetKeywordChanged((const char*)ioParam); - break; - - case msg_NSCLayoutNewDocument: - NoteBeginLayout(); - break; - - case msg_NSCFinishedLayout: - NoteFinishedLayout(); - break; - - case msg_NSCAllConnectionsComplete: - NoteAllConnectionsComplete(); - break; - - case msg_UserSubmittedURL: - // user hit enter or return in URL edit field - const char* urlString = (const char*)ioParam; - - if (urlString && *urlString && mContext) - SendAEGetURL(urlString); - break; - - case CPopdownRDFCoordinator::msg_ClosePopdownTree: - ClosePopdownTreeView(); - break; - - case cmd_GoForward: - case cmd_GoBack: - case cmd_Home: - case cmd_Reload: - case cmd_Stop: - case cmd_LoadImages: - case cmd_Print: - case cmd_CoBrandLogo: - case cmd_NetSearch: - case cmd_SecurityInfo: - case LOGO_BUTTON: - ObeyCommand(inMessage, ioParam); - break; - } -} - -//---------------------------------------------------------------------------------------- -void CBrowserWindow::DoClose() -//---------------------------------------------------------------------------------------- -{ - AttemptCloseWindow(); - super::DoClose(); -} - -//---------------------------------------------------------------------------------------- -Boolean CBrowserWindow::AttemptQuitSelf(Int32 /* inSaveOption */) -// Derived classes should be careful to call DeferredClose if they override this fn. -//---------------------------------------------------------------------------------------- -{ - CDeferredCloseTask::DeferredClose(this); - return true; -} - -//---------------------------------------------------------------------------------------- -void CBrowserWindow::AttemptClose() -{ - if (HasProcess(fCloseNotifier)) // If someone has registered for window closing, notify them - Try_ - { - AEAddressDesc closeApp; - AppleEvent closeEvent; - Int32 aWindowID = mContext->GetContextUniqueID(); - - OSErr err = ::AECreateDesc(typeProcessSerialNumber, &fCloseNotifier, - sizeof(fCloseNotifier), &closeApp); - ThrowIfOSErr_(err); - err = ::AECreateAppleEvent(AE_spy_send_suite, AE_spy_winClosed, - &closeApp, - kAutoGenerateReturnID, - kAnyTransactionID, - &closeEvent); - ThrowIfOSErr_(err); - - // windowID is the direct object - err = ::AEPutParamPtr(&closeEvent, keyDirectObject, - typeLongInteger, &aWindowID, sizeof(aWindowID)); - ThrowIfOSErr_(err); - - // Are we quitting is another parameter - Boolean quitting = (CFrontApp::GetApplication()->GetState() == programState_Quitting); - err =::AEPutParamPtr(&closeEvent, AE_spy_winClosedExiting, typeBoolean, - &quitting, sizeof(quitting)); - ThrowIfOSErr_(err); - - // send the event - AppleEvent reply; - ::AESend(&closeEvent,&reply,kAENoReply,kAENormalPriority,0,nil, nil); - } - Catch_(inErr){} - EndCatch_ - - CDeferredCloseTask::DeferredClose(this); -} - - -// modified so z-locked window will not automatically be selected - mjc -void -CBrowserWindow::Select() -{ - if (!mZLocked) - { - SendSelfAE(kAEMiscStandards, kAESelect, false); - UDesktop::SelectDeskWindow(this); - } -} - - -// -// ActivateSelf -// -// When this window comes to the front, we want to make sure that RDF knows about this window's -// context so that navCenter windows can display the site map info correctly for this window. -// -// Make sure not to do this for floating windows or for editor windows. -// -void -CBrowserWindow::ActivateSelf ( ) -{ - super::ActivateSelf(); - if ( mNavCenterParent && !HasAttribute(windAttr_Floating) ) - XP_SetLastActiveContext ( *GetWindowContext() ); -} - - -// -// DeactivateSelf -// -// When this window loses focus, hide the popdown tree view if it exists -// -void -CBrowserWindow :: DeactivateSelf ( ) -{ - // don't need to check if one is already open, CPTV() does that for us. - ClosePopdownTreeView(); - - CNetscapeWindow::DeactivateSelf(); - -} // DeactivateSelf - - -// ClickInDrag modified so z-locked window will not automatically be selected - mjc -void -CBrowserWindow::ClickInDrag(const EventRecord &inMacEvent) -{ - if (mZLocked) - { - EventRecord filterMacEvent = inMacEvent; - filterMacEvent.modifiers = filterMacEvent.modifiers | cmdKey; // command-key modifier disables select - super::ClickInDrag(filterMacEvent); - } - else super::ClickInDrag(inMacEvent); -} - -// Allow us to restrict user from growing the window by setting the Resizable attribute, -// even if there is a grow box. -void -CBrowserWindow::ClickInGrow(const EventRecord &inMacEvent) -{ - if (HasAttribute(windAttr_Resizable)) - super::ClickInGrow(inMacEvent); -} - -// Return the window for the top-level context of the one passed in. -CBrowserWindow* -CBrowserWindow::WindowForContext(CBrowserContext* inContext) -{ - if (inContext == NULL) return NULL; - - CMediatedWindow* theIterWindow = NULL; - DataIDT windowType = WindowType_Browser; - CWindowIterator theWindowIterator(windowType); - - CBrowserContext* theTopContext = inContext->GetTopContext(); - - while (theWindowIterator.Next(theIterWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theIterWindow); - CNSContext* theCurrentContext = theBrowserWindow->GetWindowContext(); - if (theBrowserWindow->GetWindowContext() == theTopContext) - { - return theBrowserWindow; - break; - } - } - return NULL; -} - -// Retrieve a window with the given Window ID -// In : ID of window -// Out: Pointer returned. (ct hull) -// GetWindowByID -// return the window for the context. -CBrowserWindow* -CBrowserWindow::GetWindowByID(const Int32 windowID) -{ - CMediatedWindow* theIterWindow = NULL; - DataIDT windowType = WindowType_Browser; - CWindowIterator theWindowIterator(windowType); - while (theWindowIterator.Next(theIterWindow)) - { - CBrowserWindow* theBrowserWindow = dynamic_cast(theIterWindow); - CNSContext* theCurrentContext = theBrowserWindow->GetWindowContext(); - if (theCurrentContext->GetContextUniqueID() == windowID) - { - return theBrowserWindow; - break; - } - } - return NULL; -} - -Boolean -CBrowserWindow::IsRestrictedTarget(void) -{ - return mContext->IsRestrictedTarget(); -} - -// override to send javascript move, resize, and zoom events -void -CBrowserWindow::DoSetPosition(Point inPosition) -{ - super::DoSetPosition(inPosition); - - if (mContext != NULL) - { - Rect bounds; - bounds = UWindows::GetWindowStructureRect(GetMacPort()); - CMochaHacks::SendMoveEvent(*mContext, bounds.left, bounds.top - ::GetMBarHeight()); - } -} - -void -CBrowserWindow::DoSetBounds(const Rect &inBounds) -{ - // inBounds is in global coordinates - - // Early exit if the bounds have not - // really changed. - Rect bounds = UWindows::GetWindowContentRect(GetMacPort()); - - if (::EqualRect(&bounds, &inBounds)) - return; - - Boolean didMove = (bounds.top != inBounds.top) || (bounds.left != inBounds.left); - - // Set size and location of Toolbox - // WindowRecord - ::SizeWindow(mMacWindowP, inBounds.right - inBounds.left, - inBounds.bottom - inBounds.top, false); - ::MoveWindow(mMacWindowP, inBounds.left, inBounds.top, false); - - // Set our Frame - ResizeFrameTo(inBounds.right - inBounds.left, - inBounds.bottom - inBounds.top, true); - - SDimension16 frameSize; // For Windows, Image is always the - GetFrameSize(frameSize); // same size as its Frame - ResizeImageTo(frameSize.width, frameSize.height, false); - - // Changing Bounds establishes a - // new User state for zooming - CalcPortFrameRect(mUserBounds); - PortToGlobalPoint(topLeft(mUserBounds)); - PortToGlobalPoint(botRight(mUserBounds)); - mMoveOnlyUserZoom = false; - - - if (mContext != NULL) - { - Rect structureBounds = UWindows::GetWindowStructureRect(GetMacPort()); - if (didMove) - CMochaHacks::SendMoveEvent(*mContext, structureBounds.left, structureBounds.top - ::GetMBarHeight()); - //CMochaHacks::SendResizeEvent(*mContext, structureBounds.right - structureBounds.left, structureBounds.bottom - structureBounds.top); - } -} - -void -CBrowserWindow::DoSetZoom(Boolean inZoomToStdState) -{ - if (!HasAttribute(windAttr_Zoomable)) { - ThrowOSErr_(errAENotModifiable); - } - - Rect currBounds = UWindows::GetWindowContentRect(mMacWindowP); - Rect zoomBounds; - - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - - StValueChanger changeStandardWidth(mStandardSize.width, max_Int16); - StValueChanger changeStandardHeight(mStandardSize.height, max_Int16); - - CalcStandardBounds(zoomBounds); - - - // Changing bounds via option-zoom - // establishes a new User state - // for zooming - mUserBounds = zoomBounds; - } - else - { - if (inZoomToStdState) { // Zoom to Standard state - if (CalcStandardBounds(zoomBounds)) { - return; // Already at Standard state - } - - } else { // Zoom to User state - zoomBounds = mUserBounds; - - if (mMoveOnlyUserZoom) { // Special case for zooming a Window - // that is at standard size, but - // is partially offscreen - zoomBounds.right = zoomBounds.left + - (currBounds.right - currBounds.left); - zoomBounds.bottom = zoomBounds.top + - (currBounds.bottom - currBounds.top); - } - } - } - - Int16 zoomWidth = zoomBounds.right - zoomBounds.left; - Int16 zoomHeight = zoomBounds.bottom - zoomBounds.top; - mMoveOnlyUserZoom = false; - - // To avoid unnecessary redraws, we check to see if the - // current and zoom states are either the same size - // or at the same location - - if ( ((currBounds.right - currBounds.left) == zoomWidth) && - ((currBounds.bottom - currBounds.top) == zoomHeight) ) { - // Same size, just move - ::MoveWindow(mMacWindowP, zoomBounds.left, zoomBounds.top, false); - mMoveOnlyUserZoom = true; - - } else if (::EqualPt(topLeft(currBounds), topLeft(zoomBounds))) { - // Same location, just resize - ::SizeWindow(mMacWindowP, zoomWidth, zoomHeight, false); - ResizeFrameTo(zoomWidth, zoomHeight, true); - - } else { // Different size and location - // Zoom appropriately - FocusDraw(); - ApplyForeAndBackColors(); - ::EraseRect(&mMacWindowP->portRect); - if (inZoomToStdState) { - SetWindowStandardState(mMacWindowP, &zoomBounds); - ::ZoomWindow(mMacWindowP, inZoomOut, false); - } else { - SetWindowUserState(mMacWindowP, &zoomBounds); - ::ZoomWindow(mMacWindowP, inZoomIn, false); - } - ResizeFrameTo(zoomWidth, zoomHeight, false); - } - - if (mContext != NULL) - { - Rect bounds; - bounds = UWindows::GetWindowStructureRect(GetMacPort()); - CMochaHacks::SendMoveEvent(*mContext, bounds.left, bounds.top - ::GetMBarHeight()); - //CMochaHacks::SendResizeEvent(*mContext, bounds.right - bounds.left, bounds.bottom - bounds.top); - } -} - -// --------------------------------------------------------------------------- -// ¥ CalcStandardBoundsForScreen -// --------------------------------------------------------------------------- - -void -CBrowserWindow::CalcStandardBoundsForScreen( - const Rect& inScreenBounds, - Rect& outStdBounds) const -{ - CHTMLView* theHTMLView = nil; - CBrowserContext* theTopContext = nil; - - theTopContext = dynamic_cast(mContext->GetTopContext()); - if (theTopContext) - { - theHTMLView = ::ExtractHyperView((MWContext*)(*theTopContext)); - } - - StValueChanger saveStandardWidth(const_cast(this)->mStandardSize.width, max_Int16); - StValueChanger saveStandardHeight(const_cast(this)->mStandardSize.height, max_Int16); - - CHTMLView::CalcStandardSizeForWindowForScreen( - theHTMLView, - *this, - inScreenBounds, - const_cast(this)->mStandardSize); - - // Calculate standard bounds given standard size - - super::CalcStandardBoundsForScreen(inScreenBounds, outStdBounds); -} - -// dynamically show/hide the status bar - mjc -void -CBrowserWindow::ShowStatus(Chrome* inChromeInfo) -{ - LPane* theSWatchStuff = FindPaneByID(SWatch_View_PaneID); - LPane* theStatusBar = FindPaneByID(Status_Bar_PaneID); - - // ¥ show or hide status bar - if (theStatusBar != nil && theSWatchStuff != nil) - { - if (!inChromeInfo->show_bottom_status_bar) // status=no - { - // FIXME grow box draws correctly? - if (mToolbarShown[eStatusBar]) - { - SDimension16 theStatusSize = {0, 0}; - theStatusBar->GetFrameSize(theStatusSize); - theStatusBar->Hide(); - theSWatchStuff->ResizeFrameBy(0, theStatusSize.height, false); - mToolbarShown[eStatusBar] = false; - // 97-05-12 pkc -- have CHyperScroller handle grow icon if we're - // resizeable - // 97-06-05 pkc -- hide size box because it looks bad - ClearAttribute(windAttr_SizeBox); - if (inChromeInfo->allow_resize) - { - CHyperScroller* scroller = dynamic_cast(FindPaneByID(Hyper_Scroller_PaneID)); - if (scroller) - scroller->SetHandleGrowIconManually(true); - } - } - } - else if (!mToolbarShown[eStatusBar]) // status=yes - { - // we want to show status bar, but it's currently hidden - SDimension16 theStatusSize = {0, 0}; - theStatusBar->Show(); - theStatusBar->GetFrameSize(theStatusSize); - theSWatchStuff->ResizeFrameBy(0, -theStatusSize.height, false); - mToolbarShown[eStatusBar] = true; - // 97-05-12 pkc -- tell CHyperScroller not to handle grow icon if we're - // resizeable - if (inChromeInfo->allow_resize) - { - CHyperScroller* scroller = dynamic_cast(FindPaneByID(Hyper_Scroller_PaneID)); - if (scroller) - { - SetAttribute(windAttr_SizeBox); - scroller->SetHandleGrowIconManually(false); - } - // make sure we turn on bevelling of grow icon area - SetSystemGrowIconBevel(); - } - else - ClearAttribute(windAttr_SizeBox); - } - else if (!inChromeInfo->allow_resize) - { - // we want to show status bar, it's already showing, and we don't - // want it resizeable - ClearAttribute(windAttr_SizeBox); - // also clear bevelling of grow icon area - ClearSystemGrowIconBevel(); - } - } -} - -// dynamically show/hide the drag bars - mjc (without changing pref value) -// modified to synchronize with menu items by using ShowOneDragBar and mToolbarShown - 1997-02-27 mjc -void -CBrowserWindow::ShowDragBars(Boolean inShowNavBar, Boolean inShowLocBar, Boolean inShowPersToolbar) -{ - ShowOneDragBar(Button_Bar_PaneID, inShowNavBar); - mToolbarShown[eNavigationBar] = inShowNavBar; - - ShowOneDragBar(Location_Bar_PaneID, inShowLocBar); - mToolbarShown[eLocationBar] = inShowLocBar; - - ShowOneDragBar(PersonalToolbar_PaneID, inShowPersToolbar); - mToolbarShown[ePersonalToolbar] = inShowPersToolbar; -} - -void -CBrowserWindow::ClearSystemGrowIconBevel() -{ - CBevelView* statusArea = dynamic_cast(FindPaneByID('StBv')); - if (statusArea) - statusArea->DontBevelGrowIcon(); -} - -void -CBrowserWindow::SetSystemGrowIconBevel() -{ - CBevelView* statusArea = dynamic_cast(FindPaneByID('StBv')); - if (statusArea) - statusArea->BevelGrowIcon(); -} - -// set up the window based on the chrome structure -// this may be called more than once. -void CBrowserWindow::SetChromeInfo(Chrome* inChrome, Boolean inNotifyMenuBarModeChanged, Boolean inFirstTime) -{ - LPane* theHTMLContainer = FindPaneByID(HTML_Container_PaneID); - LPane* theSWatchStuff = FindPaneByID(SWatch_View_PaneID); - CHyperScroller* theScroller = (CHyperScroller*)FindPaneByID(Hyper_Scroller_PaneID); - - if (inChrome != nil) - { - Assert_(mMacWindowP != NULL); - Rect windowBounds = {0, 0, 0, 0}; - Rect contentBounds = {0, 0, 0, 0}; - Rect newWindowBounds = {0, 0, 0, 0}; - Rect portRect = mMacWindowP->portRect; - short titlebarHeight, deltaWidth, deltaHeight; - - FocusDraw(); - - // ¥ reposition bars based on chrome attributes. The "directory button" is really - // the personal toolbar, though no one has thought to update the chrome structure yet. - ShowDragBars(inChrome->show_button_bar, inChrome->show_url_bar, inChrome->show_directory_buttons); - - // ¥ show or hide scrollbars - if (theScroller != nil) - { - if (inChrome->show_scrollbar) - GetHTMLView()->ResetScrollMode(); - else GetHTMLView()->SetScrollMode(LO_SCROLL_NEVER); - } - - //¥¥¥ This should be reflected in the Chrome data structure, but since I'm too scared to - // touch it, we can hack it so that if the chrome says not to have a personal toolbar, then - // we probably don't want the NavCenter showing up. Don't let this temporary setting of - // the shelf states affect the global preference, however. - if ( mNavCenterParent ) { - if ( !inChrome->show_directory_buttons ) - mNavCenterParent->NavCenterShelf().SetShelfState(CShelf::kClosed, false); - } - ShowStatus(inChrome); - - // w_hint and h_hint are inner dimensions (html view). - // outw_hint and outh_hint are outer dimensions (window structure). - // l_hint and t_hint are position of window structure. - // location_is_chrome will always be set for positioning so that {0,0} - // positioning is possible (i.e. we know the chrome record is not just zeroed out). - // ALERT: positioning applies menubar height regardless of multiple monitor situation. - - windowBounds = UWindows::GetWindowStructureRect(GetMacPort()); - contentBounds = UWindows::GetWindowContentRect(GetMacPort()); - // if the window is windowshaded then correct the windowBounds because height of content is zero. - if (IsVisible() && HasAttribute(windAttr_TitleBar) && ::EmptyRgn(((WindowPeek)GetMacPort())->contRgn)) - { - short lostHeight = portRect.bottom - portRect.top; // portRect is immune to windowshading - windowBounds.bottom = windowBounds.bottom + lostHeight; - contentBounds.bottom = contentBounds.bottom + lostHeight; - } - deltaWidth = (windowBounds.right - windowBounds.left) - (contentBounds.right - contentBounds.left); // difference of width of structure and content - deltaHeight = (windowBounds.bottom - windowBounds.top) - (contentBounds.bottom - contentBounds.top); // difference of height of structure and content - titlebarHeight = contentBounds.top - windowBounds.top; - - // convert newWindowBounds to the content rect suitable for passing to DoSetBounds(). - if ((inChrome->outw_hint && inChrome->outh_hint) || - (inChrome->w_hint && inChrome->h_hint) || - (inChrome->location_is_chrome)) // reposition is intended - { - RgnHandle desktopRgnH = ::GetGrayRgn(); // max size of window is size of desktop region - short maxWidth = MAX((**desktopRgnH).rgnBBox.right - (**desktopRgnH).rgnBBox.left, 100); - short maxHeight = MAX((**desktopRgnH).rgnBBox.bottom - (**desktopRgnH).rgnBBox.top, 100); - - if (inChrome->location_is_chrome) { // position if specified - newWindowBounds.left = inChrome->l_hint + contentBounds.left - windowBounds.left; - newWindowBounds.top = inChrome->t_hint + titlebarHeight + ::GetMBarHeight(); - } - else { - newWindowBounds.left = contentBounds.left; - newWindowBounds.top = contentBounds.top; - } - - // set outer dimensions if specified or inner dimensions. Prevent a non-resizable - // window from being resized unless it's the first time we're setting chrome info. - if ((inChrome->outw_hint > 0) && - (inChrome->outh_hint > 0) && - (inChrome->allow_resize || inFirstTime)) // outer dimensions both > 0 - { - // pin the window dimensions specified in the chrome to the maximum dimensions - inChrome->outw_hint = MIN(maxWidth, inChrome->outw_hint); - inChrome->outh_hint = MIN(maxHeight, inChrome->outh_hint); - newWindowBounds.right = MIN(SHRT_MAX, newWindowBounds.left + inChrome->outw_hint - deltaWidth); - newWindowBounds.bottom = MIN(SHRT_MAX, newWindowBounds.top + inChrome->outh_hint - deltaHeight); - } - else if ((inChrome->w_hint > 0) && - (inChrome->h_hint > 0) && - (inChrome->allow_resize || inFirstTime)) // inner dimensions both > 0 - { - SDimension16 theInnerSize; - /* if (theScroller != nil) theScroller->GetFrameSize(theInnerSize); - else */ GetHTMLView()->GetFrameSize(theInnerSize); - // pin the window dimensions specified in the chrome to the maximum dimensions - inChrome->w_hint = MIN(maxWidth, inChrome->w_hint); - inChrome->h_hint = MIN(maxHeight, inChrome->h_hint); - newWindowBounds.right = MIN(SHRT_MAX, newWindowBounds.left + portRect.right - portRect.left + (inChrome->w_hint - theInnerSize.width)); - newWindowBounds.bottom = MIN(SHRT_MAX, newWindowBounds.top + portRect.bottom - portRect.top + (inChrome->h_hint - theInnerSize.height)); - } - else // no dimensions specified, so get default dimensions from port rect. - { - newWindowBounds.right = newWindowBounds.left + portRect.right - portRect.left; - newWindowBounds.bottom = newWindowBounds.top + portRect.bottom - portRect.top; - } - if (!::EqualRect(&newWindowBounds, &contentBounds)) - DoSetBounds(newWindowBounds); - } - - // ¥ set window attributes - // the layout's window attributes don't necessarily specify floating so set it here. - // z-lock means that the window cannot move in front of other windows in its layer. - ClearAttribute(windAttr_Floating); // clear all the layer bits before we set again - 1997-02-28 mjc - ClearAttribute(windAttr_Regular); - ClearAttribute(windAttr_Modal); - if (inChrome->topmost) // alwaysRaised=yes - SetAttribute(windAttr_Floating); // javascript under windows doesn't hide a topmost window so we won't either - else SetAttribute(windAttr_Regular); - - if (inChrome->z_lock) - { - mZLocked = true; - ClearAttribute(windAttr_DelaySelect); - // z-locked window must be able to get the select click because it isn't selectable. - SetAttribute(windAttr_GetSelectClick); - } - else - { - mZLocked = false; - SetAttribute(windAttr_DelaySelect); - } - - if (inChrome->bottommost && !inChrome->topmost) - { - // a bottommost window has to be in the regular layer. - // if there is more than one regular window, we'll have to send it to the back. - if (CWindowMediator::GetWindowMediator()->CountOpenWindows( - WindowType_Browser, - regularLayerType) > 1) - { - if (UDesktop::FetchTopRegular() == this) - Deactivate(); - ::SendBehind(GetMacPort(), NULL); // send to the back - // The following hack is based on UDesktop::Resume() and fixes a case where the - // window just sent to the back would be activated, when there is a floating - // window present. - LWindow* theTopWindow = UDesktop::FetchTopRegular(); - if (theTopWindow != NULL) - { - theTopWindow->Activate(); - LMSetCurActivate(nil); // Suppress any Activate event - } - } - mAlwaysOnBottom = true; - mZLocked = true; // bottommost implies z-lock - ClearAttribute(windAttr_DelaySelect); // see z_lock for explanation - SetAttribute(windAttr_GetSelectClick); - } - else - { - mAlwaysOnBottom = false; - if (mZLocked == false) SetAttribute(windAttr_DelaySelect); - } - - if (inChrome->hide_title_bar) - { - // a titlebar-less window must get the click that selected it because there is - // little feedback that window is selected. - SetAttribute(windAttr_GetSelectClick); - } - else if (!HasAttribute(windAttr_Floating)) - { - SetAttribute(windAttr_Targetable); // window which has titlebar and is non-floating, is targetable. - } - - // 97-05-08 pkc -- set windAttr_Modal flag appropriately - if (inChrome->type == MWContextDialog) - { - AllowSubviewPopups (false); - if (!mContext->IsSpecialBrowserContext()) - SetAttribute(windAttr_Modal); - } - - mIsRootDocInfo = mContext->IsRootDocInfoContext(); - mIsViewSource = mContext->IsViewSourceContext(); - - // ¥¥¥ TODO: if we have the right security we should be able to set menubar mode to BrWn_Menubar_None - if (inChrome->show_menu || mIsRootDocInfo || mIsViewSource) - mMenubarMode = BrWn_Menubar_Default; - else - mMenubarMode = BrWn_Menubar_Minimal; - - // ¥ Broadcast that the menubar mode has changed - if (inNotifyMenuBarModeChanged) - NoteWindowMenubarModeChanged(); - - mIsHTMLHelp = (inChrome->type == MWContextHTMLHelp); - mCommandsDisabled = inChrome->disable_commands && !mIsHTMLHelp; - - if (inChrome->allow_resize && !HasAttribute(windAttr_Resizable)) - { - Str255 desc; - SetAttribute(windAttr_Resizable); - if (!HasAttribute(windAttr_Floating)) - { - ((WindowPeek)GetMacPort())->spareFlag = true; // enable zoom box - GetDescriptor(desc); // force titlebar update - SetDescriptor(desc); - } - } else if (!inChrome->allow_resize && HasAttribute(windAttr_Resizable)) - { - Str255 desc; - ClearAttribute(windAttr_Resizable); - if (!HasAttribute(windAttr_Floating)) - { - ((WindowPeek)GetMacPort())->spareFlag = false; // disable zoom box - GetDescriptor(desc); // force titlebar update - SetDescriptor(desc); - } - } - - Refresh(); - } - else - { - // reset the window... but how? - } -} - -// Set the chrome structure based on window state - mjc -void CBrowserWindow::GetChromeInfo(Chrome* inChrome) -{ - // ¥ controls - // modified to modified to synchronize with menu items by using mToolbarShown - 1997-02-27 mjc - // The directory button bar is really the personal toolbar, though the chrome struct has yet to - // be updated to reflect this change. - inChrome->show_button_bar = mToolbarShown[eNavigationBar]; - inChrome->show_url_bar = mToolbarShown[eLocationBar]; - inChrome->show_directory_buttons = mToolbarShown[ePersonalToolbar]; - inChrome->show_bottom_status_bar = mToolbarShown[eStatusBar]; - inChrome->show_menu = mMenubarMode == BrWn_Menubar_Default; - inChrome->show_security_bar = FALSE; // ¥¥¥ always false in javascript? - - inChrome->hide_title_bar = !HasAttribute(windAttr_TitleBar); - - // ¥¥¥ NEED SOMETHING HERE FOR THE NAV CENTER - - // ¥ position and size use window structure bounds - Rect windowBounds = UWindows::GetWindowStructureRect(GetMacPort()); - // if the window is windowshaded then correct the windowBounds because height of content is zero. - if (IsVisible() && HasAttribute(windAttr_TitleBar) && ::EmptyRgn(((WindowPeek)GetMacPort())->contRgn)) - windowBounds.bottom = windowBounds.bottom + mMacWindowP->portRect.bottom - mMacWindowP->portRect.top; - - inChrome->outw_hint = windowBounds.right - windowBounds.left; - inChrome->outh_hint = windowBounds.bottom - windowBounds.top; - inChrome->l_hint = windowBounds.left; - inChrome->t_hint = windowBounds.top - ::GetMBarHeight(); - inChrome->location_is_chrome = TRUE; // set to insure these coordinates are used. - - // ¥ window properties - inChrome->topmost = this->HasAttribute(windAttr_Floating); - //inChrome->bottommost = - inChrome->z_lock = mZLocked; - - inChrome->is_modal = FALSE; // always FALSE in javascript - inChrome->allow_resize = HasAttribute(windAttr_Resizable); - inChrome->allow_close = TRUE; // always TRUE in javascript - inChrome->disable_commands = mCommandsDisabled; - //inChrome->copy_history = FALSE; /* XXX need data tainting */ - - // default values if there is no scroller of HTMLView - inChrome->w_hint = inChrome->outw_hint; - inChrome->h_hint = inChrome->outh_hint; - inChrome->show_scrollbar = FALSE; - - CHyperScroller* theScroller = (CHyperScroller*)FindPaneByID(Hyper_Scroller_PaneID); - - if (theScroller == NULL) return; - - SDimension16 theInnerSize; - /* if (theScroller != nil) theScroller->GetFrameSize(theInnerSize); - else */ GetHTMLView()->GetFrameSize(theInnerSize); - - inChrome->w_hint = theInnerSize.width; - inChrome->h_hint = theInnerSize.height; - - inChrome->show_scrollbar = (theScroller != nil) && (GetHTMLView()->GetScrollMode() != LO_SCROLL_NEVER); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::NoteDocTitleChanged(const char* inNewTitle) -{ - CStr255 netscapeTitle; - // Get Window title prefix - ::GetIndString( netscapeTitle, ID_STRINGS, APPNAME_STRING_INDEX ); - netscapeTitle += ": "; - // append title - netscapeTitle += inNewTitle; - SetDescriptor( netscapeTitle ); -} - - -void CBrowserWindow :: NoteInternetKeywordChanged(const char* inTitle) -{ - if ( inTitle ) - mCurrentKeyword = inTitle; - else - mCurrentKeyword = "\p"; - -} // NoteInternetKeywordChanged - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::NoteBeginLayout(void) -{ -// -// if (!is_grid) // If we are laying out main new document, adjust the URLs -// { -// CStr31 newTitle = CFileMgr::FileNameFromURL (request->address); -// SetDocTitle( newTitle ); -// -// if ( fTopWrapper ) -// fTopWrapper->SetLayingOutURLCaption( CStr255( NET_URLStruct_Address( request ) ) , request->is_netsite); -// fHasTitle = FALSE; -// } -// this->UpdateStatusBar(); - - // ¥¥¥ TELL NAVCENTER ABOUT THE CHANGE? - - // 1997-05-22 brade -- context can be NULL - if (mContext) - { - // 1997-05-02 pkc -- hack to select doc info window if we're laying it out. - if (mContext->IsRootDocInfoContext()) - Select(); - // 1997-05-09 pkc -- set mSupportsPageServices - mSupportsPageServices = mContext->SupportsPageServices(); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::NoteFinishedLayout(void) -{ - // Do we need to do anything?? - // ¥ TELL NAVCENTER ABOUT THE CHANGE? -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CBrowserWindow::NoteAllConnectionsComplete(void) -{ -// NetscapeContext::AllConnectionsComplete(); -// -// HideProgressBar(); -// -// if (fProgress) -// fProgress->SetValue(0); -// -// this->SetMessage( CStr255( *GetString(DOCUMENT_DONE_RESID)) ); -// this->UpdateStatusBar(); -// this->StopSpinIcon(); - -// CleanupImagesInTempMemory(); -// fHyperView->RepaginateIfNeeded(); // This is needed for grids. The main view gets - // done before its subviews are done, so repagination never happens - - // CPaneEnabler::UpdatePanes(); // moved this to CHTMLView.cp deeje 97-02-10 -} - - -CBrowserWindow* CBrowserWindow::MakeNewBrowserWindow(Boolean inShow, Boolean inSelect) -{ - ThrowIf_(Memory_MemoryIsLow()); - - CBrowserWindow* result = nil; - - try - { - CBrowserContext* theContext = new CBrowserContext(MWContextBrowser); - StSharer theShareLock(theContext); - - result = dynamic_cast(LWindow::CreateWindow(res_ID, LCommander::GetTopCommander())); - ThrowIfNil_(result); - result->SetWindowContext(theContext); - - if (inShow) - result->Show(); - - if (inSelect) - result->Select(); - } - catch(...) - { - } - - return result; -} - -CBrowserWindow* CBrowserWindow::FindAndShow(Boolean inMakeNew) -{ - ThrowIf_(Memory_MemoryIsLow()); - - CBrowserWindow* result = NULL; - CWindowIterator iter(WindowType_Browser); - CMediatedWindow* window; - - iter.Next(window); - - if (window) - { - result = dynamic_cast(window); - } - else if (inMakeNew) - { - try - { -// ThrowIfNil_(CURLDispatcher::GetURLDispatcher()); -// CURLDispatcher::GetURLDispatcher()->DispatchToView(nil, nil, FO_CACHE_AND_PRESENT, true); - result = CURLDispatcher::CreateNewBrowserWindow(); - } - catch(...) - { - } - -// iter.Next(window); -// -// if (window) -// { -// result = dynamic_cast(window); -// } - } - else - { - CWindowMediator* mediator = CWindowMediator::GetWindowMediator(); - CMediatedWindow* topWindow = mediator->FetchTopWindow(WindowType_Browser, dontCareLayerType, false); - result = dynamic_cast(topWindow); - } - - return result; -} - -CBrowserWindow* CBrowserWindow::FindAndPrepareEmpty(Boolean inMakeNew) -{ -/* - CWindowIterator iter(WindowType_Browser); - CMediatedWindow* window; - CBrowserWindow* result = NULL; - iter.Next(window); -*/ - CMediatedWindow* window; - CBrowserWindow* result = NULL; - // Find the topmost regular browser window which is not a restricted target - window = CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Browser, regularLayerType, false); - - if (window) - result = dynamic_cast(window); - else if (inMakeNew) - { - result = MakeNewBrowserWindow(kShow, kSelect); - } - return result; -} - -Boolean CBrowserWindow::HandleKeyPress(const EventRecord &inKeyEvent) -{ - Char16 theChar = inKeyEvent.message & charCodeMask; - short modifiers = inKeyEvent.modifiers & (cmdKey | shiftKey | optionKey | controlKey); - - // Command-Key Events - if ( ( modifiers & cmdKey ) == cmdKey ) - { - switch ( theChar & charCodeMask ) - { - case char_LeftArrow: - ObeyCommand( cmd_GoBack ); - return true; - - case char_RightArrow: - ObeyCommand( cmd_GoForward ); - return true; - } - } - - // Passing on the scrolling keys - - // ¥¥¥ tj - only when modifiers are 0, because - // we the hyperview may have already passed the key - // up to us if there are modifiers - // - - if ( modifiers == 0 && GetHTMLView()) - { - if ((theChar == char_UpArrow) || - (theChar == char_DownArrow) || - (theChar == char_PageUp) || - (theChar == char_PageDown) || - (theChar == ' ') || - (theChar == char_Home) || - (theChar == char_End)) - return GetHTMLView()->HandleKeyPress( inKeyEvent ); - } - - return CNetscapeWindow::HandleKeyPress(inKeyEvent); -} - -// -// WriteWindowStatus -// -// Write out status of the toolbars and nav center -// -void CBrowserWindow :: WriteWindowStatus ( LStream *outStatusData ) -{ - CSaveWindowStatus::WriteWindowStatus(outStatusData); - CDragBarContainer* dragContainer = dynamic_cast(FindPaneByID('DbCt')); - if (dragContainer && outStatusData) - dragContainer->SavePlace(outStatusData); - - if ( mNavCenterParent ) - mNavCenterParent->SavePlace(outStatusData); - -} // CBrowserWindow :: WriteWindowStatus - - -// -// ReadWindowStatus -// -// Read in status of toolbars and nav center -// -void CBrowserWindow :: ReadWindowStatus ( LStream *inStatusData ) -{ - CSaveWindowStatus::ReadWindowStatus(inStatusData); - CDragBarContainer* dragContainer = dynamic_cast(FindPaneByID('DbCt')); - if (dragContainer && inStatusData) - dragContainer->RestorePlace(inStatusData); - - if ( mNavCenterParent ) - mNavCenterParent->RestorePlace(inStatusData); - -} // ReadWindowStatus - - -// -// IsPopdownTreeViewVisible -// -// Allows anyone to check and see if there is a popdown tree view currently displayed -// in a browser window -// -bool -CBrowserWindow :: IsPopdownTreeViewVisible ( ) -{ - return sPopdownParent && sPopdownParent->IsVisible(); - -} // IsPopdownTreeViewVisible - - -// -// ClipOutPopdown -// -// Adds to the current clipRgn the popdown box, if visible. |inView| is needed so we -// know what view we're drawing in for coordinate adjustments -// -void -CBrowserWindow :: ClipOutPopdown ( LView* inView ) -{ - if ( IsPopdownTreeViewVisible() ) { - StRegion clip; - ::GetClip(clip); - - Rect portPopdownFrame; - sPopdownParent->CalcPortFrameRect(portPopdownFrame); - Rect localPopdownFrame = PortToLocalRect ( inView, portPopdownFrame ) ; - StRegion popdownRgn(localPopdownFrame); - - ::DiffRgn ( clip, popdownRgn, clip ); - ::SetClip ( clip ); - } - -} // ClipOutPopdown - - -// -// PopDownTreeView -// -// Create a popdown Aurora tree view at the given coords (in port coords) from the given -// HT_Resource. This will dynamically size the height of the tree view. -// -void -CBrowserWindow :: PopDownTreeView ( Uint16 inLeft, Uint16 inTop, HT_Resource inResource ) -{ - // hide the old one if it is around. - if ( sPopdownParent ) - ClosePopdownTreeView(); - else { - try { - mPopdownParent = dynamic_cast - (UReanimator::CreateView(CPopdownRDFCoordinator::res_ID, this, this)); - } - catch ( ... ) { - mPopdownParent = NULL; - } - } - - if ( mPopdownParent ) { - // compute the height of tree (80% of the space between top of tree and bottom of browser) - const Uint16 kMinTreeHeight = 75; - const Uint16 kMaxTreeHeight = 700; - const Uint16 kTreeWidth = 250; - const float kHeightPercentage = 0.8; // 80% - const Uint16 kExtraPadding = 5; - - SDimension16 browserFrame; - GetFrameSize ( browserFrame ); - Uint16 spaceToWorkWith = browserFrame.height - inTop; - Uint16 newHeight = (Uint16)(spaceToWorkWith * kHeightPercentage); - if ( newHeight < kMinTreeHeight ) - newHeight = kMinTreeHeight; - if ( newHeight > kMaxTreeHeight ) - newHeight = kMaxTreeHeight; - - // make sure we don't allow it to go off the right side of the browser by pulling it - // back to the left just enough to still fit (like menus) - if ( inLeft + kTreeWidth > browserFrame.width ) - inLeft = browserFrame.width - kTreeWidth - kExtraPadding; - - mPopdownParent->ResizeFrameTo ( kTreeWidth, newHeight, false ); - mPopdownParent->PlaceInSuperImageAt ( inLeft, inTop, false ); - mPopdownParent->BuildHTPane ( inResource, *(mHTMLView->GetContext()) ); - - mSavedPopdownTarget = LCommander::GetTarget(); - LCommander::SwitchTarget(mPopdownParent); - mPopdownParent->AddListener(this); // listen for close messages - mPopdownParent->Show(); - - // make sure that we draw NOW if this is created in response to a drag - // and drop. - if ( ::StillDown() ) - mPopdownParent->Draw(nil); - } - - sPopdownParent = mPopdownParent; // make this the globally accessible one - -} // PopDownTreeView - - -// -// ClosePopdownTreeView -// -// Closes up the popdown tree view and resets the target to what was active before the -// popdown was opened. -// -void -CBrowserWindow :: ClosePopdownTreeView ( ) -{ - if ( sPopdownParent ) { - sPopdownParent->Hide(); // hide it in whatever window it may be in - - // if it was in this window, redraw things immediately if we're in the middle of - // a drag and drop and then reset the target commander to what it was before the - // popdown was activated. - if ( sPopdownParent == mPopdownParent ) { - - if ( ::StillDown() ) { // redraw browser window if mouse down - Rect treePortRect; - FocusDraw(); - - // set the clip rgn to only redraw the area obscured by the tree - mPopdownParent->CalcPortFrameRect(treePortRect); - StRegion redrawArea(treePortRect); - Draw(nil); - } - - LCommander::SwitchTarget(mSavedPopdownTarget); - - } // if popdown in this window - } // if a popdown is visible - - // no tree visible anymore, so clear this out. - sPopdownParent = NULL; - -} // ClosePopdownTreeView - - -// -// OpenDockedTreeView -// -// Make sure the embedded aurora shelf is open and create a new pane to fill it with data -// -void -CBrowserWindow :: OpenDockedTreeView ( HT_Resource inTopNode ) -{ - mNavCenterParent->NavCenterShelf().SetShelfState(true, NULL); - mNavCenterParent->BuildHTPane ( inTopNode, *mHTMLView->GetContext() ); - -} // OpenDockedTreeView - - -// -// Click -// -// Override the default behavior to handle when a popdown Aurora tree is showing. If it -// is and the click is outside of it, dispose of it and throw away the click. Otherwise, -// just do the normal thing. -// -//¥¥¥this should probably not ignore the click when closing up the popdown. It just feels -//¥¥¥weird. -void -CBrowserWindow :: Click( SMouseDownEvent &inMouseDown ) -{ - if ( IsPopdownTreeViewVisible() ) { - LPane *clickedPane = FindSubPaneHitBy(inMouseDown.wherePort.h, inMouseDown.wherePort.v); - if ( clickedPane == sPopdownParent ) - clickedPane->Click(inMouseDown); - else { - // don't do it on a mouse-down, wait for the mouse up - while ( ::StillDown() ) - ; - ClosePopdownTreeView(); - } - } - else - CNetscapeWindow::Click(inMouseDown); // process click normally -} - -#pragma mark -- I18N Support -- -Int16 CBrowserWindow::DefaultCSIDForNewWindow() -{ - Int16 default_csid; - CHTMLView *mainView = GetHTMLView(); - - /* mainView might be zero if the window is still being created (haven't executed - FinishCreateSelf). (note that in that case, we could still fetch mainView by - calling FindPaneByID, but again in that case, the pane's context hasn't been set up - and the view simply returns a 0, so we just skip that step and do the same) */ - default_csid = mainView ? mainView->DefaultCSIDForNewWindow() : 0; - - // Get it from mContext - if((0 == default_csid) && mContext) - default_csid = mContext->GetDefaultCSID(); - - return default_csid; -} - -Int16 CBrowserWindow::GetDefaultCSID() const -{ - if(mContext) - return mContext->GetDefaultCSID(); - return 0; -} -void CBrowserWindow::SetDefaultCSID(Int16 default_csid) -{ - if(mContext) - mContext->SetDefaultCSID(default_csid); -} -#pragma mark -- AppleEvent Support -- - -// pkc 2/17/97 -// This code copied from mcontext.cp -// If the event action is long, dispatches it to the proper handler -// short actions are handled in this loop -void CBrowserWindow::HandleAppleEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - long inAENumber) -{ - switch (inAENumber) { - case AE_Go: - { - StAEDescriptor directionSpec; - OSErr err = ::AEGetParamDesc(&inAppleEvent,AE_www_go_direction,typeWildCard,&directionSpec.mDesc); - ThrowIfOSErr_(err); - OSType direction; - UExtractFromAEDesc::TheEnum(directionSpec.mDesc, direction); - DoAEGo((Int32)direction); - } - break; - case AE_GetURL: - HandleGetURLEvent(inAppleEvent, outAEReply, outResult); - break; - case AE_OpenURL: - HandleOpenURLEvent(inAppleEvent, outAEReply, outResult); - break; - case AE_RegisterWinClose: - Try_ - { - OSType appSignature; - Size realSize; - OSType realType; - - OSErr err = ::AEGetParamPtr(&inAppleEvent, keyDirectObject, typeApplSignature, &realType, - &appSignature, sizeof(appSignature), &realSize); - if (err == noErr) // No parameters, extract the signature from the Apple Event - fCloseNotifier = GetPSNBySig(appSignature); - else - fCloseNotifier = MoreExtractFromAEDesc::ExtractAESender(inAppleEvent); - break; - } - Catch_(inErr) - { - fCloseNotifier = MakeNoProcessPSN(); - } - EndCatch_ - break; - case AE_UnregisterWinClose: - fCloseNotifier = MakeNoProcessPSN(); - break; - default: - LWindow::HandleAppleEvent( inAppleEvent, outAEReply, outResult, inAENumber ); - break; - } -} - - -void CBrowserWindow::GetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc &outPropertyDesc) const -{ - switch (inProperty) - { - case AE_www_typeWindowURL: // Current URL - { - if (!GetWindowContext()) - { - ThrowOSErr_(errAEDescNotFound); - } - - History_entry* theCurrentHistoryEntry = GetWindowContext()->GetCurrentHistoryEntry(); - if (!theCurrentHistoryEntry || !theCurrentHistoryEntry->address) - { - ThrowOSErr_(errAEDescNotFound); - } - - OSErr err = ::AECreateDesc(typeChar, - (Ptr) theCurrentHistoryEntry->address, - strlen(theCurrentHistoryEntry->address), - &outPropertyDesc); - ThrowIfOSErr_(err); - } - break; - - case AE_www_typeWindowBusy: // is the window busy? - { - if ( !GetWindowContext() ) - { - ThrowOSErr_(errAEDescNotFound); - } - - Uint32 busy = XP_IsContextBusy ( *GetWindowContext() ); - OSErr err = ::AECreateDesc(typeLongInteger, - &busy, - sizeof(Uint32), - &outPropertyDesc); - ThrowIfOSErr_(err); - - } - break; - - case AE_www_typeWindowID: // get the window ID - { - if ( !GetWindowContext() ) - { - ThrowOSErr_(errAEDescNotFound); - } - - Uint32 id = GetWindowContext()->GetContextUniqueID(); - OSErr err = ::AECreateDesc(typeLongInteger, - & id, - sizeof(Uint32), - &outPropertyDesc); - ThrowIfOSErr_(err); - - } - break; - - - default: - super::GetAEProperty(inProperty, inRequestedType, outPropertyDesc); - break; - } -} - - - - -// Sends an GetURL event -void CBrowserWindow::SendAEGetURL(const char* url) -{ - OSErr anError = noErr; - try - { - AppleEvent getURLEvent; - UAppleEventsMgr::MakeAppleEvent(AE_url_suite, AE_url_getURL, - getURLEvent); - - // URL - anError = ::AEPutParamPtr(&getURLEvent, - keyDirectObject, - typeChar, - url, - strlen(url)); - ThrowIfOSErr_(anError); - - // This window - StAEDescriptor modelSpec; - LWindow::MakeSpecifier(modelSpec.mDesc); - anError = ::AEPutParamDesc(&getURLEvent, - AE_www_typeWindow, - &modelSpec.mDesc); - ThrowIfOSErr_(anError); - - /* - // Refererer - if (strlen(refererer) > 0) - { - anError = ::AEPutParamPtr(&getURLEvent, - AE_url_getURLrefererer, - typeChar, - refererer, - strlen(refererer)); - ThrowIfOSErr_(anError); - } - - // Window name - if (strlen(winName) > 0) - { - anError = ::AEPutParamPtr(&getURLEvent, - AE_url_getURLname, - typeChar, - winName, - strlen(winName)); - ThrowIfOSErr_(anError); - } - - // Optional load-to-disk parameter - if (loadToDisk) - { - anError = ::AEPutParamPtr(&getURLEvent, - AE_url_getURLdestination, - typeNull, - NULL, - 0); - ThrowIfOSErr_(anError); - } - */ - - UAppleEventsMgr::SendAppleEvent(getURLEvent); - } - catch(...) - { - URL_Struct* theURL = NET_CreateURLStruct(url, NET_DONT_RELOAD); - mContext->SwitchLoadURL(theURL, FO_CACHE_AND_PRESENT); - } -} - - - - - -// Simplify the navigation events to only a single event, Go -// Still incomplete, since I have not figured out how to deal with history -// in an easy way. -// right now, the possible constants are: -// kAENext -// kAEPrevious -// AE_www_go_again -// AE_www_super_reload -void CBrowserWindow::SendAEGo( OSType direction ) -{ - OSErr anError = noErr; - - try - { - AppleEvent goEvent; - UAppleEventsMgr::MakeAppleEvent(AE_www_suite, AE_www_go, goEvent); - - // ¥Êthis window - StAEDescriptor modelSpec; - LWindow::MakeSpecifier(modelSpec.mDesc); - anError = ::AEPutParamDesc(&goEvent, keyDirectObject, &modelSpec.mDesc); - ThrowIfOSErr_(anError); - - StAEDescriptor directionSpec(typeEnumerated, &direction, sizeof(direction)); - anError = ::AEPutParamDesc(&goEvent, AE_www_go_direction, &directionSpec.mDesc); - ThrowIfOSErr_(anError); - - UAppleEventsMgr::SendAppleEvent(goEvent); - } - catch(...) - { - DoAEGo(direction); - } -} - - - - - -// updated to send an event to javascript, also checks for null context - 1997-02-26 mjc -// Handles the navigation events -void CBrowserWindow::DoAEGo( OSType direction ) -{ - switch ( direction ) - { - case kAENext: // going back in history - if (mContext != NULL) - { - mContext->GoForward(); - CMochaHacks::SendForwardEvent(*mContext); - } - break; - - case kAEPrevious: - if (mContext != NULL) - { - mContext->GoBack(); - CMochaHacks::SendBackEvent(*mContext); - } - break; - - case AE_www_go_again: - if (mContext != NULL) - mContext->LoadHistoryEntry(CBrowserContext::index_Reload); - break; - - case AE_www_super_reload: - if (mContext != NULL) - mContext->LoadHistoryEntry(CBrowserContext::index_Reload, true); - break; - - case AE_www_go_home: - { - URL_Struct* homeURL = - NET_CreateURLStruct(CPrefs::GetString(CPrefs::HomePage), NET_DONT_RELOAD); - if (mContext != NULL) - mContext->SwitchLoadURL(homeURL, FO_CACHE_AND_PRESENT); - } - break; - - default: - SysBeep( 1 ); - break; - } -} - - - - - -void CBrowserWindow::HandleGetURLEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &/*outResult*/, - CBrowserWindow *inBrowserWindow) -{ - FSSpec fileSpec; - Boolean hasFileSpec = FALSE; - Boolean doLoadToDisk = FALSE; - DescType realType; - Size actualSize; - OSErr err; - char * url = NULL; - char * refererer = NULL; - char * winName = NULL; - -#ifdef DEBUG - StValueChanger changeDebugThrow(UDebugging::gDebugThrow, debugAction_Nothing); -#endif - MoreExtractFromAEDesc::GetCString(inAppleEvent, keyDirectObject, url); - - // Extract the referer, if possible - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_url_getURLrefererer, refererer, false); - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_url_getURLname, winName, false); - - // See if we are doing load-to-disk. - // If the descriptor is of typeNull, we should load to disk - // but we have to file spec - { - StAEDescriptor fileDesc; - err = ::AEGetParamDesc(&inAppleEvent,AE_url_getURLdestination,typeWildCard,&fileDesc.mDesc); - if (err == noErr) - { - if (fileDesc.mDesc.descriptorType == typeNull) - doLoadToDisk = TRUE; - else - { - err = ::AEGetParamPtr(&inAppleEvent, AE_url_getURLdestination, - typeFSS, &realType, - &fileSpec, - sizeof(FSSpec), &actualSize); - if (err == errAECoercionFail) - { - char * filePath = NULL; - Try_ - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_url_getURLdestination, filePath); - err = CFileMgr::FSSpecFromPathname(filePath, &fileSpec); - if (err == fnfErr) - err = noErr; - ThrowIfOSErr_(err); - } - Catch_(inErr) - { - err = fnfErr; - } - EndCatch_ - if (filePath) - XP_FREE(filePath); - } - hasFileSpec = (err == noErr); - doLoadToDisk = TRUE; - } - } - } - - URL_Struct * request = NET_CreateURLStruct (url, NET_DONT_RELOAD); - if (winName) - request->window_target = XP_STRDUP(winName); - ThrowIfNil_(request); - request->referer = refererer; - - if (hasFileSpec && doLoadToDisk) - { - CURLDispatcher::DispatchToStorage(request, fileSpec, FO_SAVE_AS, true); - } - else if (!hasFileSpec && !doLoadToDisk) - { - if (inBrowserWindow) - { - ThrowIfNil_(inBrowserWindow->mContext); - - long windowIndex = inBrowserWindow->mContext->GetContextUniqueID(); - if ( !URDFUtilities::LaunchURL(url, inBrowserWindow) ) - CURLDispatcher::DispatchURL(request, inBrowserWindow->mContext, true); - - if (outAEReply.descriptorType != typeNull) - err = ::AEPutParamPtr (&outAEReply, keyAEResult, typeLongInteger, &windowIndex, sizeof(windowIndex)); - } - else - { - if (CFrontApp::GetApplication()->HasProperlyStartedUp()) - { - // Get a window - but don't show it - - CBrowserWindow* win = CBrowserWindow::MakeNewBrowserWindow(kDontShow); - ThrowIfNil_(win); - - ThrowIfNil_(win->mContext); - long windowIndex = win->mContext->GetContextUniqueID(); - - if ( !URDFUtilities::LaunchURL(url, win) ) - CURLDispatcher::DispatchURL(request, win->mContext, true); - - if (outAEReply.descriptorType != typeNull) - err = ::AEPutParamPtr (&outAEReply, keyAEResult, typeLongInteger, &windowIndex, sizeof(windowIndex)); - } - else - { - // MGY 5/22: If there are multiple profiles and the event is handled before the user selects a profile, - // then prefs have not been loaded and we will crash trying to restore the position of the browser window. - // To fix it right, we will have to delay the positioning of the window until it is shown. The mechanism - // by which the position of windows is restored is not flexible enough to allow this and to make it so now - // would be too intrusive of a change at this late date. So we just return 0 for the window ID and the - // window will be created when the delayed URL is handled. - - if ( !URDFUtilities::LaunchURL(url) ) - CURLDispatcher::DispatchURL(request, nil, true); - - long windowIndex = 0; - if (outAEReply.descriptorType != typeNull) - err = ::AEPutParamPtr (&outAEReply, keyAEResult, typeLongInteger, &windowIndex, sizeof(windowIndex)); - } - } - } - XP_FREE (url); - if (winName) - XP_FREE(winName); -} - -//-------------------------------------------------------------------------------- -// Spyglass AppleEvent suite -//-------------------------------------------------------------------------------- - -void CBrowserWindow::HandleOpenURLEvent(const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &/*outResult*/, - CBrowserWindow *inBrowserWindow) -{ - char * formData = NULL; // Do not free this - char * formHeader = NULL; // form headers (MIME type) - ProcessSerialNumber psn; - FSSpec fileSpec; - Boolean hasFileSpec = FALSE; - Boolean hasFormData = FALSE; - Boolean hasPSN = FALSE; - Boolean forceReload = FALSE; - OSErr err; - Size actualSize; - DescType realType; - - // Get the url - char* foo; - MoreExtractFromAEDesc::GetCString(inAppleEvent, keyDirectObject, foo); - CAutoPtrXP url(foo); - - { // See if we are doing load-to-disk - err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_into, - typeFSS, &realType, - &fileSpec, - sizeof(fileSpec), &actualSize); - if (err == noErr) - hasFileSpec = TRUE; - } - // Flags - Try_ - { - long flags; - err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_flag, typeLongInteger, - &realType, &flags, sizeof(flags), &actualSize); - ThrowIfOSErr_(err); - if ((flags & 0x1) || (flags & 0x2)) - forceReload = TRUE; - } - Catch_(inErr){} - EndCatch_ - // Form data? - Try_ - { - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_openURL_post, formData); - hasFormData = TRUE; - } - Catch_(inErr){} - EndCatch_ - // If we have form data, get the form MIME type - if (formData) - Try_ - { - char * newFormHeader = NULL; - MoreExtractFromAEDesc::GetCString(inAppleEvent, AE_spy_openURL_mime, formHeader); - StrAllocCat(formHeader, CRLF); - } - Catch_(inErr) - { - StrAllocCopy(formHeader, "Content-type: application/x-www-form-urlencoded"); - StrAllocCat(formHeader, CRLF); - } - EndCatch_ - if (formData && formHeader) - { - char buffer[64]; - XP_SPRINTF(buffer, "Content-length: %ld%s", strlen(formData), CRLF); - StrAllocCat(formHeader, buffer); - } - { // Progress application - err = ::AEGetParamPtr(&inAppleEvent, AE_spy_openURL_prog, - typeProcessSerialNumber, &realType, - &psn, - sizeof(psn), &actualSize); - if (err == noErr) - hasPSN = TRUE; - } - - // create a Netlib geturl thread - URL_Struct * request = NET_CreateURLStruct (url.get(), NET_DONT_RELOAD); - ThrowIfNil_(request); - - if (forceReload) - request->force_reload = NET_NORMAL_RELOAD; - else - request->force_reload = NET_DONT_RELOAD; - if (hasFormData) - { - request->method = 1; - request->post_data = formData; - request->post_data_size = strlen(formData); - request->post_headers = formHeader; - } - - // service non-interactive request from a different application - - /* - ¥¥¥ what do we do with this in dobgert, since SetProgressApp no longer exists? - if (hasPSN) - mContext->SetProgressApp(psn); - */ - - if (hasFileSpec) - { - CURLDispatcher::DispatchToStorage(request, fileSpec, FO_SAVE_AS, true); - } - else - { - if (inBrowserWindow) - { - ThrowIfNil_(inBrowserWindow->mContext); - - long windowID = inBrowserWindow->mContext->GetContextUniqueID(); - /* - ¥¥¥ what is this? deeje 97-03-07 - if (!fHyperView->CanLoad()) - windowID = 0; - */ - if (outAEReply.descriptorType != typeNull) - { - StAEDescriptor windowIDDesc(windowID); - err = ::AEPutParamDesc(&outAEReply, keyAEResult, &windowIDDesc.mDesc); - } - - if ( !URDFUtilities::LaunchURL(url.get(), inBrowserWindow) ) - CURLDispatcher::DispatchURL(request, inBrowserWindow->mContext, true); - } - else - { - if (CFrontApp::GetApplication()->HasProperlyStartedUp()) - { - // Get a window - but don't show it - - CBrowserWindow* win = CBrowserWindow::MakeNewBrowserWindow(kDontShow); - ThrowIfNil_(win); - - ThrowIfNil_(win->mContext); - long windowIndex = win->mContext->GetContextUniqueID(); - - if ( !URDFUtilities::LaunchURL(url.get(), win) ) - CURLDispatcher::DispatchURL(request, win->mContext, true); - - if (outAEReply.descriptorType != typeNull) - err = ::AEPutParamPtr (&outAEReply, keyAEResult, typeLongInteger, &windowIndex, sizeof(windowIndex)); - } - else - { - // MGY 5/22: If there are multiple profiles and the event is handled before the user selects a profile, - // then prefs have not been loaded and we will crash trying to restore the position of the browser window. - // To fix it right, we will have to delay the positioning of the window until it is shown. The mechanism - // by which the position of windows is restored is not flexible enough to allow this and to make it so now - // would be too intrusive of a change at this late date. So we just return 0 for the window ID and the - // window will be created when the delayed URL is handled. - - if ( !URDFUtilities::LaunchURL(url.get()) ) - CURLDispatcher::DispatchURL(request, nil, true); - - long windowIndex = 0; - if (outAEReply.descriptorType != typeNull) - err = ::AEPutParamPtr (&outAEReply, keyAEResult, typeLongInteger, &windowIndex, sizeof(windowIndex)); - } - } - } - -} - -// override to send javascript move events when the user performs the action -// because ClickInDrag sends an AppleEvent which doesn't come back to the app. -void -CBrowserWindow::SendAESetPosition(Point inPosition, Boolean inExecuteAE) -{ - CNetscapeWindow::SendAESetPosition(inPosition, inExecuteAE); - if (mContext != NULL) - { - Rect bounds; - bounds = UWindows::GetWindowStructureRect(GetMacPort()); - CMochaHacks::SendMoveEvent(*mContext, bounds.left, bounds.top - ::GetMBarHeight()); - } -} - -void CBrowserWindow::DoDefaultPrefs() -{ - CPrefsDialog::EditPrefs(CPrefsDialog::eExpandBrowser); -} - - - -#if 0 -History_entry* CBrowserWindow::GetBookmarksEntry() -{ - return mContext->GetCurrentHistoryEntry(); -} -#endif // 0 - - -#pragma mark -- Helper functions for ObeyCommand -- - -// --------------------------------------------------------------------------- -// ¥ HandleNetSearchCommand -// --------------------------------------------------------------------------- - -void -CBrowserWindow::HandleNetSearchCommand() -{ - CAutoPtrXP url; - char* tempURL = 0; - int rc; - - rc = PREF_CopyConfigString("internal_url.net_search.url", &tempURL); - url.reset(tempURL); - - if (rc == PREF_NOERROR) - { - CFrontApp& theApp = dynamic_cast(CApplicationEventAttachment::GetApplication()); - - theApp.DoGetURL(url.get()); - } -} diff --git a/mozilla/cmd/macfe/gui/CBrowserWindow.h b/mozilla/cmd/macfe/gui/CBrowserWindow.h deleted file mode 100644 index 95d11887018..00000000000 --- a/mozilla/cmd/macfe/gui/CBrowserWindow.h +++ /dev/null @@ -1,265 +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. - */ - -#pragma once - -#include -#include "CWindowMediator.h" -#include "CNetscapeWindow.h" -#include "CProgressListener.h" -#include "CSaveWindowStatus.h" -#include "divview.h" -#include "htrdf.h" -#include "CRDFCoordinator.h" - - -#include "ntypes.h" - -// menubar manager will adjust menubar according to browser window's menubar mode -typedef enum { - BrWn_Menubar_None, // hide menubar - BrWn_Menubar_Minimal, // File and Edit menus only - BrWn_Menubar_Default // standard browser window menubar -} BrWn_Menubar_Mode; - - -class CBrowserContext; -class CNSContext; // mjc -class CHTMLView; -class CRDFToolbarContainer; - - -class CBrowserWindow : public CNetscapeWindow, public CSaveWindowStatus, public LListener -{ - public: - enum { class_ID = 'BrWn', - res_ID = 1010, - dialog_res_ID = 1013, - titlebarless_res_ID = 1012, - floating_res_ID = 1014, - nozoom_res_ID = 1016}; - - enum EBooleanParms { - kShow = true, - kDontShow = false, - kSelect = true, - kDontSelect = false - }; - - typedef CNetscapeWindow super; - - CBrowserWindow(LStream* inStream); - virtual ~CBrowserWindow(); - - virtual void SetWindowContext(CBrowserContext* inContext); - virtual CNSContext* GetWindowContext() const; - virtual void HookupContextToToolbars ( ) ; - - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam = nil); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - virtual void AttemptClose(void); - virtual void DoClose(void); - virtual Boolean AttemptQuitSelf(Int32 inSaveOption); - - // deeje 1997-01-13 - // inFirstTime can be specified when setting chrome info on a window for the first time. - // This allows some parameters to be set once and locked (eg. size of non-resizable window). - virtual void SetChromeInfo(Chrome* theChrome, Boolean inNotifyMenuBarModeChanged = false, Boolean inFirstTime = false); - virtual void GetChromeInfo(Chrome* theChrome); - - // pinkerton 98-06-04 for internet keywords - const LStr255 & GetInternetKeyword ( ) const { return mCurrentKeyword; } - - static CBrowserWindow* MakeNewBrowserWindow(Boolean inShow = kShow, Boolean inSelect = kSelect); - - // FindAndShow returns an empty new CBrowserWindow without putting - // a new CNSContext in the window - static CBrowserWindow* FindAndShow(Boolean inMakeNew = false); - // FindAndPrepare returns a new CBrowserWindow with a CNSContext already - // hooked in the window - static CBrowserWindow* FindAndPrepareEmpty(Boolean inMakeNew = false); - - static CBrowserWindow* WindowForContext(CBrowserContext* inContext); - - static CBrowserWindow* GetWindowByID(const Int32 windowID); - - virtual void Select(); // mjc modified for always on bottom - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - - virtual void ClickInDrag(const EventRecord &inMacEvent); - virtual void ClickInGrow(const EventRecord &inMacEvent); - virtual void Click( SMouseDownEvent &inMouseDown ) ; - - // override to send javascript move, resize, and zoom events - // these might be called from handling an AppleEvent. - virtual void DoSetPosition(Point inPosition); - virtual void DoSetBounds(const Rect &inBounds); - virtual void DoSetZoom(Boolean inZoomToStdState); - - virtual void CalcStandardBoundsForScreen( - const Rect& inScreenBounds, - Rect& outStdBounds) const; - - virtual BrWn_Menubar_Mode GetMenubarMode() { return mMenubarMode; } - - virtual Boolean IsRestrictedTarget(void); - Boolean IsAlwaysLowered(void) { return mAlwaysOnBottom; } - Boolean IsZLocked(void) { return mZLocked; } - Boolean CommandsAreDisabled(void) { return mCommandsDisabled; } - - // AppleEvent support - virtual void HandleAppleEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - Int32 inAENumber); - - void SendAEGetURL(const char* url); - void SendAEGo( OSType direction ); // mjc - void DoAEGo(OSType direction); - - static void HandleGetURLEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - CBrowserWindow* inBrowserWindow = nil); - static void HandleOpenURLEvent( - const AppleEvent &inAppleEvent, - AppleEvent &outAEReply, - AEDesc &outResult, - CBrowserWindow* inBrowserWindow = nil); - - // enable/disable subview's context-sensitive popup menus - void AllowSubviewPopups (Boolean inAllow) - { mAllowSubviewPopups = inAllow; } - Boolean AllowSubviewPopups (void) - { return mAllowSubviewPopups; } - - Boolean IsRootDocInfo() { return mIsRootDocInfo; } - Boolean IsViewSource() { return mIsViewSource; } - Boolean IsHTMLHelp() { return mIsHTMLHelp; } - - // override to send javascript move and resize events when the user performs the action - // because ClickInDrag moves the window but doesn't execute its AppleEvent. - virtual void SendAESetPosition(Point inPosition, Boolean inExecuteAE); - - // I18N stuff - virtual Int16 DefaultCSIDForNewWindow(void); - virtual Int16 GetDefaultCSID(void) const; - - - // better bookmarks support - virtual void DoDefaultPrefs(); - - // AEOM support - virtual void GetAEProperty(DescType inProperty, - const AEDesc &inRequestedType, - AEDesc& outPropertyDesc) const; - - // sometimes you just need the HTPane of the window... - HT_Pane HTPane ( ) const { return GetNavCenterParentView()->HTPane(); } ; - - virtual void PopDownTreeView ( Uint16 inLeft, Uint16 inTop, HT_Resource inResource ) ; - virtual void ClosePopdownTreeView ( ) ; - virtual void OpenDockedTreeView ( HT_Resource inTopNode ) ; - static void ClipOutPopdown ( LView* inView ) ; - static bool IsPopdownTreeViewVisible ( ) ; - - protected: - virtual void FinishCreateSelf(void); - const CHTMLView* GetHTMLView() const { return mHTMLView; } - CHTMLView* GetHTMLView() { return mHTMLView; } - const CRDFCoordinator* GetNavCenterParentView() const { return mNavCenterParent; } - CRDFCoordinator* GetNavCenterParentView() { return mNavCenterParent; } - - virtual void HandleNetSearchCommand(); - - virtual void NoteDocTitleChanged(const char* inTitle); - virtual void NoteInternetKeywordChanged(const char* inTitle); - virtual void NoteBeginLayout(void); - virtual void NoteFinishedLayout(void); - virtual void NoteAllConnectionsComplete(void); - - virtual ResIDT GetStatusResID(void) const { return res_ID; } - virtual UInt16 GetValidStatusVersion(void) const { return 0x0114; } - - virtual void ShowStatus(Chrome* inChromeInfo); // 97-05-12 pkc -- pass in Chrome struct - - virtual void ShowDragBars(Boolean inShowNavBar, Boolean inShowLocBar, Boolean inShowDirBar); // mjc - - void ClearSystemGrowIconBevel(); - void SetSystemGrowIconBevel(); - - void WriteWindowStatus ( LStream *outStatusData ) ; - void ReadWindowStatus ( LStream *outStatusData ) ; - - // I18N stuff - virtual void SetDefaultCSID(Int16); - -//Boolean mIsTitled; - - CBrowserContext* mContext; - CProgressListener* mProgressListener; - Boolean mAlwaysOnBottom; // javascript alwaysLowered window property - mjc - Boolean mZLocked; // javascript z-lock window property - BrWn_Menubar_Mode mMenubarMode; // specifies menubar for window - Boolean mCommandsDisabled; // javascript hotkeys window option - - ProcessSerialNumber fCloseNotifier; // apple event support - Boolean mSupportsPageServices; - Boolean mAllowSubviewPopups; - - Boolean mIsRootDocInfo; - Boolean mIsViewSource; - Boolean mIsHTMLHelp; - - private: - - // The popup Aurora tree. Each browser needs its own version because of - // timing issues with deleting it when it closes and the impossibility of - // sharing one among multiple browser windows (the scroll bar cannot be shuffled - // around between windows once it has been created). - CPopdownRDFCoordinator* mPopdownParent; - LCommander* mSavedPopdownTarget; - - // the currently visible popdown. Needed so anyone can get to it if need be. - static CPopdownRDFCoordinator* sPopdownParent; - - CDockedRDFCoordinator* mNavCenterParent; // the docked Aurora tree, etc - CHTMLView* mHTMLView; - - LStr255 mCurrentKeyword; // holds current internet keyword string - - CRDFToolbarContainer* mToolbarContainer; // the HT_Pane containing the toolbars -}; diff --git a/mozilla/cmd/macfe/gui/CConfigActiveScroller.cp b/mozilla/cmd/macfe/gui/CConfigActiveScroller.cp deleted file mode 100644 index c5fde856730..00000000000 --- a/mozilla/cmd/macfe/gui/CConfigActiveScroller.cp +++ /dev/null @@ -1,46 +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. - */ - -#include "CConfigActiveScroller.h" -#include "uprefd.h" - -CConfigActiveScroller::CConfigActiveScroller(LStream* inStream) - : LActiveScroller(inStream) -{ -} - -void CConfigActiveScroller::HandleThumbScroll(LStdControl *inWhichControl) -{ - if (CPrefs::GetBoolean(CPrefs::EnableActiveScrolling)) - LActiveScroller::HandleThumbScroll(inWhichControl); -} - -void CConfigActiveScroller::ListenToMessage(MessageT inMessage, void *ioParam) -{ - if (inMessage == msg_ThumbDragged) - { - // NOTE: we call the LScroller implemetation if active scrolling - // is _not_ enabled. We do not call the LActiveScroller implementation - // because it ignores thumb dragged messages, assuming that the image is - // already at the right place after tracking - if (!CPrefs::GetBoolean(CPrefs::EnableActiveScrolling)) - LScroller::ListenToMessage(inMessage, ioParam); - } - else - LActiveScroller::ListenToMessage(inMessage, ioParam); -} diff --git a/mozilla/cmd/macfe/gui/CConfigActiveScroller.h b/mozilla/cmd/macfe/gui/CConfigActiveScroller.h deleted file mode 100644 index 2adfda4b37b..00000000000 --- a/mozilla/cmd/macfe/gui/CConfigActiveScroller.h +++ /dev/null @@ -1,31 +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. - */ - -#pragma once - -#include - -class CConfigActiveScroller : public LActiveScroller -{ - public: - enum { class_ID = 'CgAs' }; - CConfigActiveScroller(LStream* inStream); - protected: - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - virtual void HandleThumbScroll(LStdControl *inWhichControl); -}; diff --git a/mozilla/cmd/macfe/gui/CDateView.cp b/mozilla/cmd/macfe/gui/CDateView.cp deleted file mode 100644 index 18c060265aa..00000000000 --- a/mozilla/cmd/macfe/gui/CDateView.cp +++ /dev/null @@ -1,977 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CDateView.h" - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -// Pane IDs -static const PaneIDT eDayEditFieldID = 1; -static const PaneIDT eMonthEditFieldID = 2; -static const PaneIDT eYearEditFieldID = 3; - -// Resource IDs -static const short cArrowWidth = 11; -static const short cArrowHeight = 9; - -static const UInt32 cBroadcastMessageDelay = 12; - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - -class CDateArrowButton : public LButton { - -public: - - enum { class_ID = 'DaBt' }; - CDateArrowButton(LStream *inStream); - - // When clicking in button, send these messages - enum { msg_ClickUpArrow = CDateView::paneID_UpButton, - msg_ClickDownArrow = CDateView::paneID_DownButton }; - - virtual void SimulateHotSpotClick(Int16 inHotSpot); - -protected: - - // Overriden methods - - virtual void DisableSelf(void); - virtual void EnableSelf(void); - - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - virtual void HotSpotAction(Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside); - virtual void HotSpotResult(short inHotSpot); - - // Instance variables ========================================================== - - UInt32 mNextBroadcastTime; // Last time a message was broadcast - UInt16 mBroadcastCount; // Number of continuous braodcast messages -}; - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - -#ifdef Debug_Signal - #define AssertFail_(test) ThrowIfNot_(test) -#else // Debug_Signal - #define AssertFail_(test) ((void) 0) -#endif // Debug_Signal - -static inline Boolean IsBetween(long inVal, long inMin, long inMax) { - return ((inVal >= inMin) && (inVal <= inMax)); -} - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Register classes related to this class. -======================================================================================*/ - -void CDateView::RegisterDateClasses(void) { - - RegisterClass_(CDateView); - RegisterClass_(CDateField); - RegisterClass_(CDateArrowButton); -} - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -CDateView::CDateView(LStream *inStream) : - LView(inStream) { - - mDayField = mMonthField = mYearField = nil; -} - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -void CDateView::FinishCreateSelf(void) { - - // Load in date/time resources - - Intl0Hndl int0H = (Intl0Hndl) ::GetIntlResource(0); - UInt8 leadingDayChar, leadingMonthChar, separatingChar; - - if ( int0H ) { - switch ( (**int0H).dateOrder ) { - case mdy: mDayPosition = 2; mMonthPosition = 1; mYearPosition = 3; break; - case dmy: mDayPosition = 1; mMonthPosition = 2; mYearPosition = 3; break; - case ymd: mDayPosition = 3; mMonthPosition = 2; mYearPosition = 1; break; - case myd: mDayPosition = 3; mMonthPosition = 1; mYearPosition = 2; break; - case dym: mDayPosition = 1; mMonthPosition = 3; mYearPosition = 2; break; - default: /* ydm */ mDayPosition = 2; mMonthPosition = 3; mYearPosition = 1; break; - } - leadingDayChar = ((**int0H).shrtDateFmt & dayLdingZ) ? '0' : ' '; - leadingMonthChar = ((**int0H).shrtDateFmt & mntLdingZ) ? '0' : ' '; - separatingChar = (**int0H).dateSep; - } else { - // Set to defaults - separatingChar = '/'; - leadingDayChar = '0'; - leadingMonthChar = '0'; - mDayPosition = 2; - mMonthPosition = 1; - mYearPosition = 3; - } - - SetRefreshAllWhenResized(false); - - // Must create the subpanes here for correct function of tabbed edit fields - - CreateDateFields(leadingDayChar, leadingMonthChar, separatingChar); -} - - -/*====================================================================================== - Destructor. -======================================================================================*/ - -CDateView::~CDateView(void) { - -} - - -/*====================================================================================== - Determine if the specified date is valid. - - inYear (cMinViewYear..cMaxViewYear) - inMonth (1..12) - inDay (1..31) -======================================================================================*/ - -Boolean CDateView::IsValidDate(Int16 inYear, UInt8 inMonth, UInt8 inDay) { - - if ( (inDay < 1) || (inDay > 31) || (inMonth < 1) || (inMonth > 12) || - (inYear < cMinViewYear) || (inYear > cMaxViewYear) ) { - - return false; - } - - DateTimeRec dtRec = { inYear, inMonth, inDay, 1, 1, 1 }; - - UInt32 seconds; - ::DateToSeconds(&dtRec, &seconds); - ::SecondsToDate(seconds, &dtRec); - - return ((inDay == dtRec.day) && (inMonth == dtRec.month) && (inYear == dtRec.year)); -} - - -/*====================================================================================== - Get the currently displayed date. - - outYear (cMinViewYear..cMaxViewYear) - outMonth (1..12) - outDay (1..31) -======================================================================================*/ - -void CDateView::GetDate(Int16 *outYear, UInt8 *outMonth, UInt8 *outDay) { - - *outYear = mYearField->GetValue(); - *outMonth = mMonthField->GetValue(); - *outDay = mDayField->GetValue(); -} - - -/*====================================================================================== - Set the displayed date to the date specified by the input parameters. If the - input parameters specify a date that is not valid, return false and don't do - anything; otherwise return true. - - inYear (cMinViewYear..cMaxViewYear) - inMonth (1..12) - inDay (1..31) -======================================================================================*/ - -Boolean CDateView::SetDate(Int16 inYear, UInt8 inMonth, UInt8 inDay) { - - Boolean rtnVal = IsValidDate(inYear, inMonth, inDay); - - if ( rtnVal ) { - SetDateString(mYearField, inYear, '0'); - SetDateString(mMonthField, inMonth, mMonthField->GetLeadingChar()); - SetDateString(mDayField, inDay, mDayField->GetLeadingChar()); - } - - return rtnVal; -} - - -/*====================================================================================== - Set the date displayed to today's date. -======================================================================================*/ - -void CDateView::SetToToday(void) { - - UInt32 seconds; - ::GetDateTime(&seconds); - DateTimeRec dtRec; - ::SecondsToDate(seconds, &dtRec); - - if ( dtRec.year < cMinViewYear ) { - dtRec.year = cMinViewYear; - } else if ( dtRec.year > cMaxViewYear ) { - dtRec.year = cMaxViewYear; - } - - SetDate(dtRec.year, dtRec.month, dtRec.day); -} - - -/*====================================================================================== - Select the specified date field in this view. -======================================================================================*/ - -void CDateView::SelectDateField(Int16 inField) { - - PaneIDT paneID; - - switch ( inField ) { - case eYearField: paneID = eYearEditFieldID; break; - case eMonthField: paneID = eMonthEditFieldID; break; - case eDayField: paneID = eDayEditFieldID; break; - default: Assert_(false); return; - } - - CDateField *newTarget = (CDateField *) FindPaneByID(paneID); - Assert_(newTarget != nil); - - if ( LCommander::SwitchTarget(newTarget) ) { - newTarget->SelectAll(); - } -} - - -/*====================================================================================== - Select the first date field in this view if one is not yet selected. -======================================================================================*/ - -void CDateView::Select(void) { - - // Check if we're already there - if ( ContainsTarget() ) return; - - // Find the first field - LEditField *newTarget; - if ( mDayPosition == 1 ) { - newTarget = mDayField; - } else if ( mMonthPosition == 1 ) { - newTarget = mMonthField; - } else { - Assert_(mYearPosition == 1); - newTarget = mYearField; - } - - if ( LCommander::SwitchTarget(newTarget) ) { - newTarget->SelectAll(); - } -} - - -/*====================================================================================== - Return true if one of the date fields in this view is the current target. -======================================================================================*/ - -Boolean CDateView::ContainsTarget(void) { - - return (mDayField->IsTarget() || mMonthField->IsTarget() || mYearField->IsTarget()); -} - - -/*====================================================================================== - Listen to message from broadcasters. -======================================================================================*/ - -void CDateView::ListenToMessage(MessageT inMessage, void *ioParam) { - - #pragma unused(ioParam) - - switch ( inMessage ) { - - case CDateArrowButton::msg_ClickUpArrow: - case CDateArrowButton::msg_ClickDownArrow: - DoClickArrow(inMessage == CDateArrowButton::msg_ClickUpArrow); - break; - - case CDateField::msg_HideDateArrows: - case CDateField::msg_ShowDateArrows: - ShowHideArrows(inMessage == CDateField::msg_ShowDateArrows); - break; - - case CDateField::msg_UserChangedText: - BroadcastMessage(msg_DateViewChanged, this); - break; - } -} - - -/*====================================================================================== - Process a click in an arrow from a key. -======================================================================================*/ - -void CDateView::DoKeyArrow(Boolean inClickUpArrow) { - - LControl *theControl; - if ( inClickUpArrow ) { - theControl = (LControl *) FindPaneByID(paneID_UpButton); - } else { - theControl = (LControl *) FindPaneByID(paneID_DownButton); - } - if ( theControl && theControl->FocusDraw() ) { - theControl->SimulateHotSpotClick(1); - } -} - - -/*====================================================================================== - Process a click in an arrow. -======================================================================================*/ - -void CDateView::DoClickArrow(Boolean inClickUpArrow) { - - #pragma unused(inClickUpArrow) - - CDateField *theDateField = (CDateField *) LCommander::GetTarget(); - Assert_(theDateField); - if ( !theDateField ) return; - - Int16 year; - UInt8 month, day; - - GetDate(&year, &month, &day); - - // Validate that the current character is OK for the active field - - Int16 adder = inClickUpArrow ? 1 : -1; - switch ( theDateField->GetPaneID() ) { - case eDayEditFieldID: - day += adder; - if ( day > 31 ) { - day = 1; - } else if ( day < 1 ) { - day = 31; - } - break; - case eMonthEditFieldID: - month += adder; - if ( month > 12 ) { - month = 1; - } else if ( month < 1 ) { - month = 12; - } - break; - default: - year += adder; - if ( year > cMaxViewYear ) { - year = cMinViewYear; - } else if ( year < cMinViewYear ) { - year = cMaxViewYear; - } - break; - } - - if ( !SetDate(year, month, day) ) { - if ( adder > 0 ) { - // Day must be wrong, too large! - SetDate(year, month, 1); - } else { - while ( !SetDate(year, month, --day) ) { - ; // Nothing - } - } - } -} - - -/*====================================================================================== - Hide or show the arrows. -======================================================================================*/ - -void CDateView::ShowHideArrows(Boolean inShow) { - - ShowHideArrow(FindPaneByID(paneID_UpButton), inShow); - ShowHideArrow(FindPaneByID(paneID_DownButton), inShow); -} - - -/*====================================================================================== - Filter for incoming data characters. -======================================================================================*/ - -EKeyStatus CDateView::DateFieldFilter(TEHandle inMacTEH, Char16 theKey, Char16& theChar, UInt16 inModifiers) { - - EKeyStatus theKeyStatus = keyStatus_PassUp; - //Char16 theKey = inKeyEvent.message; - //Char16 theChar = theKey & charCodeMask; - - CDateField *theDateField = (CDateField *) LCommander::GetTarget(); - Assert_(theDateField); - CDateView *theDateView = (CDateView *) theDateField->GetSuperView(); - Assert_(theDateView); - - if ( !theDateField || !theDateView ) return theKeyStatus; - - switch (theChar) - { - case char_UpArrow: - case char_DownArrow: - theKeyStatus = keyStatus_Ignore; - theDateView->DoKeyArrow(theChar == char_UpArrow); - break; - - case char_Tab: - case char_Enter: - case char_Return: - case char_Escape: - theKeyStatus = keyStatus_PassUp; - break; - - default: - if ( UKeyFilters::IsPrintingChar(theChar) && UKeyFilters::IsNumberChar(theChar) ) - { - PaneIDT paneID = theDateField->GetPaneID(); - Str15 currentText; - theDateField->GetDescriptor(currentText); - - theKeyStatus = keyStatus_Input; - - Int16 year; - UInt8 month, day; - - theDateView->GetDate(&year, &month, &day); - - // Validate that the current character is OK for the active field - - Str15 numString; - long wouldBeNumber; - theDateField->GetDescriptor(numString); - Assert_(numString[0] == 2 || numString[0] == 4); - numString[numString[0] - 1] = currentText[currentText[0]]; - numString[numString[0]] = theChar; - ::StringToNum(numString, &wouldBeNumber); - - switch ( paneID ) - { - case eDayEditFieldID: - day = wouldBeNumber; - break; - - case eMonthEditFieldID: - month = wouldBeNumber; - break; - - default: // eYearEditFieldID - year = wouldBeNumber; - if ( year > cMaxViewYear ) year -= 100; - if ( year < cMinViewYear ) year += 100; - if (year != wouldBeNumber) - { - Str15 temp; - theDateField->GetDescriptor(temp); - temp[1] = '0' + year/1000; - temp[2] = '0' + (year/100)%10; - theDateField->SetDescriptor(temp); - } - break; - } - - if ( !theDateView->IsValidDate(year, month, day) || - ((paneID != eYearEditFieldID) && (numString[1] == '0')) ) - { - if ( theChar == '0' ) - theKeyStatus = keyStatus_Reject; - else - { - currentText[1] = currentText[2] = theDateField->GetLeadingChar(); - theDateField->SetDescriptor(currentText); - } - } - } - else - { - theKeyStatus = keyStatus_Reject; - } - break; - } - return theKeyStatus; -} - -/*====================================================================================== - Set the edit field date. -======================================================================================*/ - -void CDateView::SetDateString(LEditField *inField, UInt16 inValue, UInt8 inLeadingChar) { - - Str15 valueString, tempString; - - ::NumToString(inValue, valueString); - if ( valueString[0] == 1 ) { - valueString[2] = valueString[1]; - valueString[1] = inLeadingChar; - valueString[0] = 2; - } - inField->GetDescriptor(tempString); - if (! ::EqualString(tempString, valueString, false, false)) { - inField->SetDescriptor(valueString); - if ( inField->IsTarget() ) { - inField->SelectAll(); - } - inField->Draw(nil); - } -} - - -/*====================================================================================== - Show or hide the arrow nicely. -======================================================================================*/ - -void CDateView::ShowHideArrow(LPane *inArrow, Boolean inShow) { - - if ( inArrow ) { - if ( inShow ) { - inArrow->DontRefresh(true); - if ( !inArrow->IsVisible() ) { - inArrow->Show(); - inArrow->DontRefresh(); - inArrow->Draw(nil); - } - } else { - inArrow->Hide(); - } - } -} - - -/*====================================================================================== - Finish creating the search dialog. -======================================================================================*/ - -void CDateView::CreateDateFields(UInt8 inLeadingDayChar, UInt8 inLeadingMonthChar, - UInt8 inSeparatingChar) { - - // Init the panes in the view - - UInt8 separatingString[2] = { 1, inSeparatingChar }; - - PaneIDT field1ID, field2ID, field3ID; - UInt8 leadingChar1, leadingChar2, leadingChar3; - - switch ( mDayPosition ) { - case 1: - field1ID = eDayEditFieldID; - leadingChar1 = inLeadingDayChar; - if ( mMonthPosition == 2 ) { - field2ID = eMonthEditFieldID; - leadingChar2 = inLeadingMonthChar; - field3ID = eYearEditFieldID; - leadingChar3 = '0'; - } else { - field3ID = eMonthEditFieldID; - leadingChar3 = inLeadingMonthChar; - field2ID = eYearEditFieldID; - leadingChar2 = '0'; - } - break; - case 2: - field2ID = eDayEditFieldID; - leadingChar2 = inLeadingDayChar; - if ( mMonthPosition == 1 ) { - field1ID = eMonthEditFieldID; - leadingChar1 = inLeadingMonthChar; - field3ID = eYearEditFieldID; - leadingChar3 = '0'; - } else { - field3ID = eMonthEditFieldID; - leadingChar3 = inLeadingMonthChar; - field1ID = eYearEditFieldID; - leadingChar1 = '0'; - } - break; - default: - field3ID = eDayEditFieldID; - leadingChar3 = inLeadingDayChar; - if ( mMonthPosition == 1 ) { - field1ID = eMonthEditFieldID; - leadingChar1 = inLeadingMonthChar; - field2ID = eYearEditFieldID; - leadingChar2 = '0'; - } else { - field2ID = eMonthEditFieldID; - leadingChar2 = inLeadingMonthChar; - field1ID = eYearEditFieldID; - leadingChar1 = '0'; - } - break; - } - - // Field 1 - CDateField *theDateField = (CDateField *) FindPaneByID(paneID_DateField1); - ThrowIfResFail_(theDateField); - theDateField->SetPaneID(field1ID); - theDateField->SetLeadingChar(leadingChar1); - theDateField->SetKeyFilter(DateFieldFilter); - theDateField->AddListener(this); - - // Separator 1 - LCaption *theCaption = (LCaption *) FindPaneByID(paneID_Separator1); - ThrowIfResFail_(theCaption); - theCaption->SetDescriptor(separatingString); - - // Field 2 - theDateField = (CDateField *) FindPaneByID(paneID_DateField2); - ThrowIfResFail_(theDateField); - theDateField->SetPaneID(field2ID); - theDateField->SetLeadingChar(leadingChar2); - theDateField->SetKeyFilter(DateFieldFilter); - theDateField->AddListener(this); - - // Separator 2 - theCaption = (LCaption *) FindPaneByID(paneID_Separator2); - ThrowIfResFail_(theCaption); - theCaption->SetDescriptor(separatingString); - - // Field 3 - theDateField = (CDateField *) FindPaneByID(paneID_DateField3); - ThrowIfResFail_(theDateField); - theDateField->SetPaneID(field3ID); - theDateField->SetLeadingChar(leadingChar3); - theDateField->SetKeyFilter(DateFieldFilter); - theDateField->AddListener(this); - - // Up/down arrows - - LButton *theButton = (LButton *) FindPaneByID(paneID_UpButton); - ThrowIfResFail_(theButton); - theButton->AddListener(this); - - theButton = (LButton *) FindPaneByID(paneID_DownButton); - ThrowIfResFail_(theButton); - theButton->AddListener(this); - - mDayField = (CDateField *) FindPaneByID(eDayEditFieldID); - mMonthField = (CDateField *) FindPaneByID(eMonthEditFieldID); - mYearField = (CDateField *) FindPaneByID(eYearEditFieldID); - - // Set the date to the current date - - ShowHideArrows(eHideArrows); - SetToToday(); -} - -#pragma mark - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -CDateField::CDateField(LStream *inStream) : - LGAEditField(inStream) { - mLeadingChar = '/'; - Str15 initString = { 2, mLeadingChar, mLeadingChar }; - SetDescriptor(initString); -} - - -/*====================================================================================== - Set the text for the date field. This method does not refresh or redraw the - field after setting the text. -======================================================================================*/ - -void CDateField::SetDescriptor(ConstStr255Param inDescriptor) { - - if ( FocusExposed() ) { - //StEmptyVisRgn emptyRgn(GetMacPort()); - ::TESetText(inDescriptor + 1, StrLength(inDescriptor), mTextEditH); - } else { - ::TESetText(inDescriptor + 1, StrLength(inDescriptor), mTextEditH); - } -} - - -/*====================================================================================== - Disallow pasting and cutting. -======================================================================================*/ - -void CDateField::FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName) { - - switch ( inCommand ) { - - case cmd_Paste: - case cmd_Cut: - case cmd_Clear: - case cmd_SelectAll: - outEnabled = false; - break; - - default: - LEditField::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - } -} - - -/*====================================================================================== - Select all text when clicking. -======================================================================================*/ - -void CDateField::ClickSelf(const SMouseDownEvent &inMouseDown) { - - #pragma unused(inMouseDown) - - if ( !IsTarget() ) { - if ( LCommander::SwitchTarget(this) ) { - this->SelectAll(); - } - } -} - - -/*====================================================================================== - Handle a key press. -======================================================================================*/ - -Boolean CDateField::HandleKeyPress(const EventRecord &inKeyEvent) { - - Boolean keyHandled; - - if ( (inKeyEvent.modifiers & cmdKey) || !mKeyFilter ) { - - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - - } else { - - Char16 theChar = inKeyEvent.message & charCodeMask; - //EKeyStatus theKeyStatus = (*mKeyFilter)(inKeyEvent, (**mTextEditH).selStart); - EKeyStatus theKeyStatus = (*mKeyFilter)(mTextEditH, inKeyEvent.message & keyCodeMask, theChar, inKeyEvent.modifiers); - - switch ( theKeyStatus ) { - - case keyStatus_PassUp: - keyHandled = LCommander::HandleKeyPress(inKeyEvent); - break; - - case keyStatus_Reject: - SysBeep(1); - break; - - case keyStatus_Input: { - - // Get the current string - - Str15 numString; - GetDescriptor(numString); - - Assert_(numString[0] == 2 || numString[0] == 4); - - numString[numString[0] - 1] = numString[numString[0]]; - numString[numString[0]] = theChar; - - Boolean doDraw = FocusExposed(); - - SetDescriptor(numString); - SelectAll(); - - if ( doDraw ) { - DrawSelf(); - } - - keyHandled = true; - } - break; - } - } - - return keyHandled; -} - - -/*====================================================================================== - Select all text when clicking. -======================================================================================*/ - -void CDateField::AdjustCursorSelf(Point inPortPt, const EventRecord &inMacEvent) { - - LPane::AdjustCursorSelf(inPortPt, inMacEvent); -} - - -/*====================================================================================== - EditField is becoming the Target. -======================================================================================*/ - -void CDateField::BeTarget(void) { - - StFocusAndClipIfHidden focus(this); - ::TEActivate(mTextEditH); // Show active selection - BroadcastMessage(msg_ShowDateArrows); -} - - -/*====================================================================================== - EditField is no longer the Target. -======================================================================================*/ - -void CDateField::DontBeTarget(void) { - - StFocusAndClipIfHidden focus(this); - ::TEDeactivate(mTextEditH); // Show inactive selection - BroadcastMessage(msg_HideDateArrows); -} - - -/*====================================================================================== - The user has changed some text, broadcast a message. -======================================================================================*/ - -void CDateField::UserChangedText(void) { - - LEditField::UserChangedText(); - BroadcastMessage(msg_UserChangedText, this); -} - - -#pragma mark - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -CDateArrowButton::CDateArrowButton(LStream *inStream) : - LButton(inStream) { - - mNextBroadcastTime = 0; - mBroadcastCount = 0; -} - - -/*====================================================================================== -======================================================================================*/ - -void CDateArrowButton::DisableSelf(void) { - - Draw(nil); -} - - -/*====================================================================================== -======================================================================================*/ - -void CDateArrowButton::EnableSelf(void) { - - Draw(nil); -} - - -/*====================================================================================== -======================================================================================*/ - -Boolean CDateArrowButton::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) { - - mBroadcastCount = 0; - mNextBroadcastTime = 0; - - return LButton::TrackHotSpot(inHotSpot, inPoint, inModifiers); -} - - -/*====================================================================================== -======================================================================================*/ - -void CDateArrowButton::HotSpotAction(Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside) { - - LButton::HotSpotAction(inHotSpot, inCurrInside, inPrevInside); - - if ( inCurrInside ) { - if ( mNextBroadcastTime < LMGetTicks() ) { - BroadcastValueMessage(); - if ( mBroadcastCount > 4 ) { - mNextBroadcastTime = LMGetTicks() + (cBroadcastMessageDelay/3); - } else { - ++mBroadcastCount; - mNextBroadcastTime = LMGetTicks() + cBroadcastMessageDelay; - } - } - } else { - mBroadcastCount = 0; - } -} - - -/*====================================================================================== -======================================================================================*/ - -void CDateArrowButton::HotSpotResult(short inHotSpot) { - - if ( mBroadcastCount ) { - HotSpotAction(inHotSpot, false, true); - } else { - LButton::HotSpotResult(inHotSpot); - } -} - - -/*====================================================================================== -======================================================================================*/ - -void CDateArrowButton::SimulateHotSpotClick(Int16 inHotSpot) { - - if ( IsEnabled() ) { - - mBroadcastCount = 0; - mNextBroadcastTime = 0; - - unsigned long endTicks; - HotSpotAction(inHotSpot, true, false); // Do action for click inside - ::Delay(4, &endTicks); - //HotSpotAction(inHotSpot, false, true); // Undo visual effect - HotSpotResult(inHotSpot); - ::Delay(4, &endTicks); - } -} - - diff --git a/mozilla/cmd/macfe/gui/CDateView.h b/mozilla/cmd/macfe/gui/CDateView.h deleted file mode 100644 index 3eb43524c9d..00000000000 --- a/mozilla/cmd/macfe/gui/CDateView.h +++ /dev/null @@ -1,189 +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 __H_CDateView -#define __H_CDateView -#pragma once - -/*====================================================================================== - - DESCRIPTION: Implements a view for display and input of a date. Formats the date - as the user has it set up in their Date & Time control panel. - - To use this class, you must include the following PP classes: - - LGAEditField - LCaption - LButton - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include -#include -#include - -class CDateField; - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class CDateView : public LView, - public LListener, - public LBroadcaster { - -public: - - enum { // Pane IDs - paneID_DateField1 = 'DAT1' - , paneID_DateField2 = 'DAT2' - , paneID_DateField3 = 'DAT3' - , paneID_Separator1 = 'SEP1' - , paneID_Separator2 = 'SEP2' - , paneID_UpButton = 'BTNU' - , paneID_DownButton = 'BTND' - }; - - // Stream creator method - - enum { class_ID = 'DaTe' }; - static void RegisterDateClasses(void); - - CDateView(LStream *inStream); - virtual ~CDateView(void); - - // Start public interface ---------------------------------------------------------- - - enum { cMinViewYear = 1920, cMaxViewYear = (cMinViewYear+99) }; - - Boolean IsValidDate(Int16 inYear, UInt8 inMonth, UInt8 inDay); - void GetDate(Int16 *outYear, UInt8 *outMonth, UInt8 *outDay); - - Boolean SetDate(Int16 inYear, UInt8 inMonth, UInt8 inDay); - void SetToToday(void); - - enum { eYearField = 1, eMonthField = 2, eDayField = 3 }; - void SelectDateField(Int16 inField); - void Select(void); - - Boolean ContainsTarget(void); - - // Boradcasting messages - enum { msg_DateViewChanged = 9109221 /*this*/ }; - - // End public interface ------------------------------------------------------------ - -protected: - - // Overriden methods - - virtual void FinishCreateSelf(void); - virtual void ListenToMessage(MessageT inMessage, void *ioParam = nil); - - void DoKeyArrow(Boolean inClickUpArrow); - void DoClickArrow(Boolean inClickUpArrow); - - enum { eShowArrows = true, eHideArrows = false }; - void ShowHideArrows(Boolean inShow); - - static EKeyStatus DateFieldFilter(TEHandle inMacTEH, Char16 inKeyCode, Char16& ioCharCode, UInt16 inModifiers); - static void SetDateString(LEditField *inField, UInt16 inValue, UInt8 inLeadingChar); - static void ShowHideArrow(LPane *inArrow, Boolean inShow); - -private: - - void CreateDateFields(UInt8 inLeadingDayChar, UInt8 inLeadingMonthChar, - UInt8 inSeparatingChar); - -protected: - - // Instance variables ========================================================== - - UInt8 mDayPosition; // Position of the day in the view (1..3) - UInt8 mMonthPosition; // Position of the month in the view (1..3) - UInt8 mYearPosition; // Position of the year in the view (1..3) - - Rect mFrameRect; - - CDateField *mDayField; - CDateField *mMonthField; - CDateField *mYearField; -}; - - -#pragma mark - - -class CDateField : public LGAEditField { - -public: - - enum { class_ID = 'DaFd' }; - CDateField(LStream *inStream); - - virtual void SetDescriptor(ConstStr255Param inDescriptor); - UInt8 GetLeadingChar(void) const { return mLeadingChar; } - void SetLeadingChar(UInt8 inChar) { mLeadingChar = inChar; } - - // Boradcasting messages - enum { msg_HideDateArrows = 780954, msg_ShowDateArrows = 780955, - msg_UserChangedText = 780956 }; - -protected: - - // Overriden methods - - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - virtual void FindCommandStatus(CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, - Str255 outName); - virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); - virtual void AdjustCursorSelf(Point inPortPt, const EventRecord &inMacEvent); - - virtual void BeTarget(void); - virtual void DontBeTarget(void); - - virtual void UserChangedText(void); - - // Instance variables ========================================================== - - UInt8 mLeadingChar; // Character to use for leading number when -}; - -#endif // __H_CDateView diff --git a/mozilla/cmd/macfe/gui/CDeviceLoop.cp b/mozilla/cmd/macfe/gui/CDeviceLoop.cp deleted file mode 100644 index 7cb87acbfb6..00000000000 --- a/mozilla/cmd/macfe/gui/CDeviceLoop.cp +++ /dev/null @@ -1,169 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CDeviceLoop.h" - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -CDeviceLoop::CDeviceLoop(const Rect &inLocalRect, Int16 &outFirstDepth) { - - mSaveClip = nil; - mGlobalRect = inLocalRect; // Convert to Global coords - ::LocalToGlobal(&topLeft(mGlobalRect)); - ::LocalToGlobal(&botRight(mGlobalRect)); - mCurrentDevice = nil; - - outFirstDepth = 0; - NextDepth(outFirstDepth); -} - - -/*====================================================================================== - Destructor. -======================================================================================*/ - -CDeviceLoop::~CDeviceLoop(void) { - - if ( mSaveClip != nil ) { // Restore clipping region - ::SetClip(mSaveClip); - ::DisposeRgn(mSaveClip); - mSaveClip = nil; - } -} - - -/*====================================================================================== - Get the next drawing depth, return false if none. -======================================================================================*/ - -static Boolean RectEnclosesRect(const Rect *inEnclosingRect, const Rect *inTestRect) { - - return ((inEnclosingRect->top <= inTestRect->top) && - (inEnclosingRect->left <= inTestRect->left) && - (inEnclosingRect->right >= inTestRect->right) && - (inEnclosingRect->bottom >= inTestRect->bottom)); -} - -Boolean CDeviceLoop::NextDepth(Int16 &outNextDepth) { - - if ( mCurrentDevice ) { - if ( !mSaveClip ) { - // The first device we found that contained any portion of the specified - // rectangle actually contained ALL of the rectangle, so exit here. - return false; - } - mCurrentDevice = GetNextDevice(mCurrentDevice); - } else { - mCurrentDevice = GetDeviceList(); - } - - // Locate the first device for processing - - while ( mCurrentDevice ) { - - if ( ::TestDeviceAttribute(mCurrentDevice, screenDevice) && - ::TestDeviceAttribute(mCurrentDevice, screenActive) ) { - - Rect deviceRect = (**mCurrentDevice).gdRect, intersection; - - if ( ::SectRect(&mGlobalRect, &deviceRect, &intersection) ) { - - // Some portion of the device rect encloses the specified rect - - outNextDepth = (**((**mCurrentDevice).gdPMap)).pixelSize; - - if ( !mSaveClip ) { - if ( RectEnclosesRect(&deviceRect, &mGlobalRect) ) { - // Specified rectangle is completely enclosed within this device - // DON'T create a clipping region and exit here - break; - } else { - mSaveClip = ::NewRgn(); // Save clipping region - if ( mSaveClip ) { - ::GetClip(mSaveClip); - } - } - } - - // Set clipping region to the intersection of the target - // rectangle, the screen rectangle, and the original - // clipping region - - ::GlobalToLocal(&topLeft(intersection)); - ::GlobalToLocal(&botRight(intersection)); - ClipToIntersection(intersection); - break; // Exit device loop - } - } - - mCurrentDevice = ::GetNextDevice(mCurrentDevice); - } - - return (mCurrentDevice != nil); -} - - -/*====================================================================================== - Draw the control. -======================================================================================*/ - -void CDeviceLoop::ClipToIntersection(const Rect &inLocalRect) { - - if ( mSaveClip ) { - RgnHandle overlap = ::NewRgn(); - ::RectRgn(overlap, &inLocalRect); - ::SectRgn(mSaveClip, overlap, overlap); - ::SetClip(overlap); - ::DisposeRgn(overlap); - } -} - diff --git a/mozilla/cmd/macfe/gui/CDeviceLoop.h b/mozilla/cmd/macfe/gui/CDeviceLoop.h deleted file mode 100644 index 6160f6645e7..00000000000 --- a/mozilla/cmd/macfe/gui/CDeviceLoop.h +++ /dev/null @@ -1,102 +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 __H_CDeviceLoop -#define __H_CDeviceLoop -#pragma once - -/*====================================================================================== - - DESCRIPTION: Implements an optimized stack-based device loop object. - - Example: - - Int16 depth; - TDeviceLoop theLoop(frame, depth); - - if ( depth ) do { - switch ( depth ) { - - case 1: // Black & white - break; - - case 4: // 16 colors - break; - - case 8: // 256 colors - break; - - case 16: // Thousands of colors - break; - - case 32: // Millions of colors - break; - } - } while ( theLoop.NextDepth(depth) ); - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class CDeviceLoop { - -public: - - CDeviceLoop(const Rect &inLocalRect, Int16 &outFirstDepth); - ~CDeviceLoop(void); - - Boolean NextDepth(Int16 &outNextDepth); - -protected: - - void ClipToIntersection(const Rect &inLocalRect); - - // Instance variables - - Rect mGlobalRect; - GDHandle mCurrentDevice; - RgnHandle mSaveClip; - -}; - -#endif // __H_CDeviceLoop - diff --git a/mozilla/cmd/macfe/gui/CDividerGrippyPane.cp b/mozilla/cmd/macfe/gui/CDividerGrippyPane.cp deleted file mode 100644 index 80b92c313a7..00000000000 --- a/mozilla/cmd/macfe/gui/CDividerGrippyPane.cp +++ /dev/null @@ -1,85 +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. - */ - -// Implementation for class that adapts the CPatternedGrippyPane for use in the chrome of -// the window as visual feedback/interaction point for sliding a drawer in and out. -// -// NOTE: Makes an "implicit" assumption that the superView is an LDividedView. By this -// I mean that it assumes that the super view will handle certain behaviors and will -// understand certain messages broadcast to it. There are no dependancies on data or -// on the LDividedView class itself. -// - -#include "CDividerGrippyPane.h" -#include "macutil.h" - - -// -// Constructor -// -CDividerGrippyPane :: CDividerGrippyPane ( LStream* inStream ) - : CPatternedGrippyPane(inStream) -{ - -} - - -// -// ClickSelf -// -// Overloaded to handle clicking and dragging. If the user drags the grippy pane, -// step aside and let the parent's ClickSelf() routine handle it (which is most likely -// an LDividedView). If the user just clicks on the pane, send a message saying that -// there was a click (the LDividedView is listening). -// -void CDividerGrippyPane::ClickSelf(const SMouseDownEvent& inMouseDown) -{ - // Drags are passed to the superView. Handle only single clicks. - Point where; - ::GetMouse(&where); - if (::WaitForMouseAction( - where, - inMouseDown.macEvent.when, - ::LMGetDoubleTime()) == MOUSE_DRAGGING) - { - LView* superView = GetSuperView(); - if (superView) - { - this->LocalToPortPoint(((SMouseDownEvent&)inMouseDown).whereLocal); - superView->PortToLocalPoint(((SMouseDownEvent&)inMouseDown).whereLocal); - superView->ClickSelf(inMouseDown); - } - return; - } // if drag - else - BroadcastMessage ( 'Zap!', this ); - -} // ClickSelf - - -// -// AdjustCursorSelf -// -// Change the cursor to a hand while mouse is over this pane -// -void CDividerGrippyPane::AdjustCursorSelf(Point /* inPortPt */, const EventRecord & /*inMacEvent*/) -{ - const ResIDT kPointingFingerID = 128; - ::SetCursor(*::GetCursor(kPointingFingerID)); - -} // AdjustCursorSelf diff --git a/mozilla/cmd/macfe/gui/CDividerGrippyPane.h b/mozilla/cmd/macfe/gui/CDividerGrippyPane.h deleted file mode 100644 index f13a5287e8d..00000000000 --- a/mozilla/cmd/macfe/gui/CDividerGrippyPane.h +++ /dev/null @@ -1,43 +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. - */ - - -// -// Interface for class that adapts the CPatternedGrippyPane for use in the chrome of -// the window as visual feedback/interaction point for sliding a drawer in and out. -// - -#pragma once - -#include "CPatternedGrippyPane.h" - - -class CDividerGrippyPane : public CPatternedGrippyPane, public LBroadcaster -{ -public: - enum { class_ID = 'DiPg' }; - - CDividerGrippyPane(LStream* inStream); - virtual ~CDividerGrippyPane() { }; - - virtual void ClickSelf ( const SMouseDownEvent & inEvent ) ; - virtual void AdjustCursorSelf ( Point inPortPt, const EventRecord &inMacEvent ) ; - - int foo; - -}; // CDividerGrippyPane diff --git a/mozilla/cmd/macfe/gui/CDownloadProgressWindow.cp b/mozilla/cmd/macfe/gui/CDownloadProgressWindow.cp deleted file mode 100644 index 40e3f9a4008..00000000000 --- a/mozilla/cmd/macfe/gui/CDownloadProgressWindow.cp +++ /dev/null @@ -1,311 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDownloadProgressWindow.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CDownloadProgressWindow.h" -#include "CNSContext.h" -#include "COffscreenCaption.h" -#include "Netscape_Constants.h" -#include "PascalString.h" - -#include "mkgeturl.h" -#include "resgui.h" - -#include -#include - -#define MIN_TICKS (60/4) // Don't refresh the progress bar more than 4x /sec. - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDownloadProgressWindow::CDownloadProgressWindow(LStream* inStream) - : CMediatedWindow(inStream, WindowType_Progress) - , CSaveWindowStatus(this) -{ - mContext = NULL; - mClosing = false; - mMessageLastTicks = 0; - mPercentLastTicks = 0; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDownloadProgressWindow::~CDownloadProgressWindow() -{ - SetWindowContext(NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -ResIDT CDownloadProgressWindow::GetStatusResID() const -{ - return WIND_DownloadProgress; -} // client must provide! - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -UInt16 CDownloadProgressWindow::GetValidStatusVersion() const -{ - return 0x0001; -} // CDownloadProgressWindow::GetValidStatusVersion - -//----------------------------------- -void CDownloadProgressWindow::AttemptClose() -//----------------------------------- -{ - CSaveWindowStatus::AttemptCloseWindow(); - Inherited::AttemptClose(); -} - -//----------------------------------- -void CDownloadProgressWindow::DoClose() -//----------------------------------- -{ - CSaveWindowStatus::AttemptCloseWindow(); - Inherited::DoClose(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::FinishCreateSelf(void) -{ - CMediatedWindow::FinishCreateSelf(); - - mBar = dynamic_cast(FindPaneByID(PaneID_ProgressBar)); - Assert_(mBar != NULL); - - mMessage = dynamic_cast(FindPaneByID(PaneID_ProgressMessage)); - Assert_(mMessage != NULL); - - mComment = dynamic_cast(FindPaneByID(PaneID_ProgressComment)); - Assert_(mComment != NULL); - - LControl* theButton = dynamic_cast(FindPaneByID(PaneID_ProgressCancelButton)); - Assert_(theButton != NULL); - theButton->AddListener(this); - CSaveWindowStatus::FinishCreateWindow(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::SetWindowContext(CNSContext* inContext) -{ - if (mContext != NULL) - mContext->RemoveUser(this); - - mContext = inContext; - - if (mContext != NULL) - { - mContext->AddListener(this); - mContext->AddUser(this); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CNSContext* CDownloadProgressWindow::GetWindowContext(void) -{ - return mContext; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDownloadProgressWindow::HandleKeyPress( - const EventRecord& inKeyEvent) -{ - Boolean keyHandled = false; - LControl *keyButton = nil; - - switch (inKeyEvent.message & charCodeMask) - { - case char_Escape: - if ((inKeyEvent.message & keyCodeMask) == vkey_Escape) - keyButton = (LControl*)FindPaneByID(PaneID_ProgressCancelButton); - break; - - default: - if (UKeyFilters::IsCmdPeriod(inKeyEvent)) - keyButton = (LControl*)FindPaneByID(PaneID_ProgressCancelButton); - else - keyHandled = CMediatedWindow::HandleKeyPress(inKeyEvent); - break; - } - - if (keyButton != nil) - { - keyButton->SimulateHotSpotClick(kControlButtonPart); - keyHandled = true; - } - - return keyHandled; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - if (inCommand == cmd_Stop) - { - outEnabled = true; - return; - } - CMediatedWindow::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDownloadProgressWindow::ObeyCommand( - CommandT inCommand, - void* /*ioParam*/) -{ - if (inCommand == cmd_Stop) - { - LControl *keyButton = (LControl*)FindPaneByID(PaneID_ProgressCancelButton); - if (keyButton != nil) - keyButton->SimulateHotSpotClick(kControlButtonPart); - return true; - } - return false; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - if (mClosing) - return; - - switch (inMessage) - { - case msg_Cancel: -// NET_SilentInterruptWindow(*mContext); -// replaced the line above with the following ones... - mClosing = true; - if (mContext) { - XP_InterruptContext(*mContext); - SetWindowContext(NULL); // calls RemoveUser() and destroys context - } - DoClose(); - break; - - case msg_NSCAllConnectionsComplete: - DoClose(); - break; - - case msg_NSCProgressBegin: - NoteProgressBegin(*(CContextProgress*)ioParam); - break; - - case msg_NSCProgressUpdate: - NoteProgressUpdate(*(CContextProgress*)ioParam); - break; - - case msg_NSCProgressEnd: - NoteProgressEnd(*(CContextProgress*)ioParam); - break; - - case msg_NSCProgressMessageChanged: -// CContextProgress* theProgress = (CContextProgress*)ioParam; -// Assert_(theProgress != NULL); -// mMessage->SetDescriptor(theProgress->mMessage); - if (::TickCount() - mMessageLastTicks >= MIN_TICKS) - { - mMessageLastTicks = ::TickCount(); - mMessage->SetDescriptor((const char*)ioParam); - } - break; - - case msg_NSCProgressPercentChanged: - if (::TickCount() - mPercentLastTicks >= MIN_TICKS) - { - mPercentLastTicks = ::TickCount(); - mBar->SetValue(*(Int32*)ioParam); - } - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::NoteProgressBegin(const CContextProgress& inProgress) -{ - SetDescriptor(CStr255(inProgress.mAction)); - - mMessage->SetDescriptor(inProgress.mMessage); - mComment->SetDescriptor(inProgress.mComment); - Show(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::NoteProgressUpdate(const CContextProgress& inProgress) -{ - if (inProgress.mPercent != mBar->GetValue()) - mBar->SetValue(inProgress.mPercent); - - mMessage->SetDescriptor(inProgress.mMessage); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDownloadProgressWindow::NoteProgressEnd(const CContextProgress& ) -{ - Hide(); -} - diff --git a/mozilla/cmd/macfe/gui/CDownloadProgressWindow.h b/mozilla/cmd/macfe/gui/CDownloadProgressWindow.h deleted file mode 100644 index 0bf1845d0f1..00000000000 --- a/mozilla/cmd/macfe/gui/CDownloadProgressWindow.h +++ /dev/null @@ -1,90 +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. - */ - -#pragma once - -#include "CWindowMediator.h" -#include "CNSContext.h" -#include "CSaveWindowStatus.h" -#include - -class LProgressBar; -class COffscreenCaption; - -const ResIDT WIND_DownloadProgress = 1011; -const PaneIDT PaneID_ProgressCancelButton = 'cncl'; -const PaneIDT PaneID_ProgressMessage = 'pgms'; -const PaneIDT PaneID_ProgressComment = 'pgcm'; -const PaneIDT PaneID_ProgressBar = 'pgbr'; - -class CDownloadProgressWindow : - public CMediatedWindow, - public LListener, - public CSaveWindowStatus -{ - private: - typedef CMediatedWindow Inherited; - public: - enum { class_ID = 'PgWd' }; - - CDownloadProgressWindow(LStream* inStream); - virtual ~CDownloadProgressWindow(); - - virtual void AttemptClose(); - virtual void DoClose(); - virtual ResIDT GetStatusResID() const; // client must provide! - virtual UInt16 GetValidStatusVersion() const; // client must provide! - - virtual void SetWindowContext(CNSContext* inContext); - virtual CNSContext* GetWindowContext(void); - - virtual Boolean HandleKeyPress( - const EventRecord& inKeyEvent); - - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam = nil); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - protected: - - virtual void FinishCreateSelf(void); - - virtual void NoteProgressBegin(const CContextProgress& inProgress); - virtual void NoteProgressUpdate(const CContextProgress& inProgress); - virtual void NoteProgressEnd(const CContextProgress& inProgress); - - CNSContext* mContext; - LProgressBar* mBar; - COffscreenCaption* mMessage; - COffscreenCaption* mComment; - Boolean mClosing; - unsigned long mMessageLastTicks; - unsigned long mPercentLastTicks; -}; - diff --git a/mozilla/cmd/macfe/gui/CDragBar.cp b/mozilla/cmd/macfe/gui/CDragBar.cp deleted file mode 100644 index 2f005949d98..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBar.cp +++ /dev/null @@ -1,271 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBar.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include "CDragBar.h" -#include "CDragBarDragTask.h" -#include "CSharedPatternWorld.h" -#include "UGraphicGizmos.h" -#include "CPatternedGrippyPane.h" - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBar::CDragBar(LStream* inStream) - : LView(inStream) - { - inStream->ReadPString(mTitle); - *inStream >> mIsDocked; - - common_initialization(); - } - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBar::CDragBar( const SPaneInfo& inPaneInfo, const SViewInfo& inViewInfo, bool inDocked ) - : LView(inPaneInfo, inViewInfo), - mIsDocked(inDocked) - { - common_initialization(); - } - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void -CDragBar::common_initialization() - { - mPatternWorld = CSharedPatternWorld::CreateSharedPatternWorld(10000); - ThrowIfNULL_(mPatternWorld); - mPatternWorld->AddUser(this); - - ::SetEmptyRgn(mDockedMask); - - mIsTracking = false; - // The visible flag will be off or latent at this point. If it's invisible in the - // resource, we want to mark it as fully hidden (ie, not docked either) - mIsAvailable = (mVisible != triState_Off); - SetRefreshAllWhenResized(false); - } - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBar::~CDragBar() -{ - mPatternWorld->RemoveUser(this); - ::SetEmptyRgn(mDockedMask); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::Dock(void) -{ - mIsDocked = true; - Hide(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::Undock(void) -{ - mIsDocked = false; - Show(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDragBar::IsDocked(void) const -{ - return mIsDocked; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::StartTracking(void) -{ - mIsTracking = true; - Draw(NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::StopTracking(void) -{ - mIsTracking = false; - Draw(NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -StringPtr CDragBar::GetDescriptor(Str255 outDescriptor) const -{ - LString::CopyPStr(mTitle, outDescriptor); - return outDescriptor; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::SetDescriptor(ConstStringPtr inDescriptor) -{ - mTitle = inDescriptor; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::Draw(RgnHandle inSuperDrawRgnH) -{ - // Don't draw if invisible or unable to put in focus - if (IsVisible() && FocusDraw()) - { - // Area of this View to draw is the intersection of inSuperDrawRgnH - // with the Revealed area of this View - RectRgn(mUpdateRgnH, &mRevealedRect); - if (inSuperDrawRgnH != nil) - SectRgn(inSuperDrawRgnH, mUpdateRgnH, mUpdateRgnH); - - if (!EmptyRgn(mUpdateRgnH)) // Some portion needs to be drawn - { - - Rect frame; - CalcLocalFrameRect(frame); - - // A View is visually behind its SubPanes so it draws itself first, - //then its SubPanes - if (ExecuteAttachments(msg_DrawOrPrint, &frame)) - DrawSelf(); - - if (!mIsTracking) - { - LArrayIterator iterator(mSubPanes, LArrayIterator::from_Start); - LPane *theSub; - while (iterator.Next(&theSub)) - theSub->Draw(mUpdateRgnH); - } - } - - ::SetEmptyRgn(mUpdateRgnH); // Emptying update region frees up memory - // if this region wasn't rectangular - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::Click(SMouseDownEvent& inMouseDown) -{ - LPane* theClickedPane = FindDeepSubPaneContaining(inMouseDown.wherePort.h, inMouseDown.wherePort.v ); - if ((theClickedPane != NULL) && (theClickedPane->GetPaneID() == CPatternedGrippyPane::class_ID)) - { - ClickDragSelf(inMouseDown); - } - else - { - theClickedPane = FindSubPaneHitBy(inMouseDown.wherePort.h, inMouseDown.wherePort.v); - if (theClickedPane != NULL) - theClickedPane->Click(inMouseDown); - else - ClickSelf(inMouseDown); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DragBars may be hidden from container and dock by javascript - mjc -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::SetAvailable(Boolean inAvailable) -{ - mIsAvailable = inAvailable; -} - -Boolean CDragBar::IsAvailable() -{ - return mIsAvailable; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::DrawSelf(void) -{ - StColorPenState::Normalize(); - - Rect theFrame; - CalcLocalFrameRect(theFrame); - - Point theAlignment; - CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment); - - // We do this instead of LPane::GetMacPort() because we may be being - // drawn offscreen. - CGrafPtr thePort; - ::GetPort(&(GrafPtr)thePort); - mPatternWorld->Fill(thePort, theFrame, theAlignment); - - if (mIsTracking) - UGraphicGizmos::LowerColorVolume(theFrame, 0x2000); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBar::ClickDragSelf(const SMouseDownEvent& inMouseDown) -{ - FocusDraw(); - - Point theGlobalPoint = inMouseDown.wherePort; - PortToGlobalPoint(theGlobalPoint); - if (::WaitMouseMoved(theGlobalPoint)) - { - CDragBarDragTask theTask(this, inMouseDown.macEvent); - theTask.DoDrag(); - } - else - BroadcastMessage(msg_DragBarCollapse, this); -} diff --git a/mozilla/cmd/macfe/gui/CDragBar.h b/mozilla/cmd/macfe/gui/CDragBar.h deleted file mode 100644 index e58eafb2cae..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBar.h +++ /dev/null @@ -1,80 +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. - */ - -#pragma once - -#include -#include -#include - -#include "CGWorld.h" - -class CSharedPatternWorld; - -const FlavorType Flavor_DragBar = 'dgdb'; -const MessageT msg_DragBarCollapse = 'dgbc'; // CDragBar* -const MessageT msg_DragBarExpand = 'dbex'; // CDragBar* - -class CDragBar : - public LView, - public LBroadcaster -{ - friend class CDragBarDockControl; - public: - - enum { class_ID = 'DgBr' }; - - CDragBar(LStream* inStream); - CDragBar(const SPaneInfo&, const SViewInfo&, bool inDocked); - virtual ~CDragBar(); - - virtual void Dock(void); - virtual void Undock(void); - virtual Boolean IsDocked(void) const; - - virtual void StartTracking(void); - virtual void StopTracking(void); - - virtual StringPtr GetDescriptor(Str255 outDescriptor) const; - virtual void SetDescriptor(ConstStringPtr inDescriptor); - - virtual void Draw(RgnHandle inSuperDrawRgnH); - virtual void Click(SMouseDownEvent& inMouseDown); - - virtual void SetAvailable(Boolean inAvailable); // for javascript - - virtual Boolean IsAvailable(); // for javascript - - private: - void common_initialization(); - - protected: - - virtual void DrawSelf(void); - - virtual void ClickDragSelf(const SMouseDownEvent& inMouseDown); - - TString mTitle; - CSharedPatternWorld* mPatternWorld; - StRegion mDockedMask; - Boolean mIsDocked; - Boolean mIsAvailable; // for javascript - Boolean mIsTracking; -}; - - diff --git a/mozilla/cmd/macfe/gui/CDragBarContainer.cp b/mozilla/cmd/macfe/gui/CDragBarContainer.cp deleted file mode 100644 index 1d59fae6cd5..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBarContainer.cp +++ /dev/null @@ -1,606 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBarContainer.cp -// -// -// NOTE: It is assumed that the first level sub views of this container are -// either CDragBar's or the CDragBarDockControl. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CDragBar.h" -#include "CDragBarContainer.h" -#include "CDragBarDockControl.h" -#include "CDragBarDragTask.h" -#include "UGraphicGizmos.h" - -#include -#include -#include -#include - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBarContainer::CDragBarContainer(LStream* inStream) - : CBrokeredView(inStream), - LDropArea(GetMacPort()), - mBars(sizeof(CDragBar*)) -{ - *inStream >> mBarListResID; - mDock = NULL; - - SetRefreshAllWhenResized(false); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBarContainer::~CDragBarContainer() -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::FinishCreateSelf(void) -{ - CBrokeredView::FinishCreateSelf(); - - // We need to get the dock first so that when we initialize the initial - // state of the bars we have somewhere to put them. - mDock = dynamic_cast(FindPaneByID(CDragBarDockControl::class_ID)); - Assert_(mDock != NULL); - mDock->AddListener(this); - - BuildToolbarsPresentAtStartup ( ); - - AdjustContainer(); - AdjustDock(); - - // Because new toolbar drag bars could adjust their frames - // at FinishCreateSelf time, call RepositionBars - RepositionBars(); -} - - -// -// BuildToolbarsPresentAtStartup -// -// Add what toolbars have at creation time to the toolbar. -// -void -CDragBarContainer :: BuildToolbarsPresentAtStartup ( ) -{ - StResource theIDList('RidL', mBarListResID); - if ( theIDList ) { - StHandleLocker theLock(theIDList); - LDataStream theBarStream(*theIDList.mResourceH, ::GetHandleSize(theIDList)); - - Int16 theItemCount; - theBarStream >> theItemCount; - for (Int16 i = 0; i < theItemCount; i++) { - PaneIDT thePaneID; - theBarStream >> thePaneID; - - CDragBar* theBar = dynamic_cast(FindPaneByID(thePaneID)); - Assert_(theBar != NULL); - - if (theBar->IsDocked()) - mDock->AddBarToDock(theBar); - - mBars.InsertItemsAt(1, LArray::index_Last, &theBar); - theBar->AddListener(this); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void -CDragBarContainer::AddBar( CDragBar* inBar ) - { - if ( inBar->IsDocked() && mDock ) - mDock->AddBarToDock(inBar); - mBars.InsertItemsAt(1, LArray::index_Last, &inBar); - inBar->AddListener(this); - - ShowBar(inBar, false); - } - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - if (inMessage == msg_DragBarCollapse) - { - CDragBar* theBar = (CDragBar*)ioParam; - NoteCollapseBar(theBar); - } - else if (inMessage == msg_DragBarExpand) - { - CDragBar* theBar = (CDragBar*)ioParam; - NoteExpandBar(theBar); - } - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::SavePlace(LStream *outPlace) -{ - *outPlace << mBars.GetCount(); - - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - { - *outPlace << theBar->GetPaneID(); - *outPlace << theBar->IsDocked(); - *outPlace << theBar->IsAvailable(); - } - - mDock->SavePlace(outPlace); - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::RestorePlace(LStream *inPlace) -{ - Int32 theBarCount; - *inPlace >> theBarCount; - for (Int32 theIndex = LArray::index_First; theIndex <= theBarCount; theIndex++) - { - PaneIDT thePaneID; - *inPlace >> thePaneID; - - Boolean bIsDocked; - *inPlace >> bIsDocked; - - Boolean bIsAvailable; - *inPlace >> bIsAvailable; - - CDragBar* theBar = dynamic_cast(FindPaneByID(thePaneID)); - - // Assert_(theBar != NULL); -- oops! theBar might legitimately not exist yet - if ( theBar ) - { - // First we want to place the bar in the same position in the - // bar array as it was before. We can tell that by its position - // from when it was saved out. - ArrayIndexT theBarIndex = mBars.FetchIndexOf(&theBar); - Assert_(theBarIndex != LArray::index_Bad); - mBars.MoveItem(theBarIndex, theIndex); - - // Now we need to sync the state of the bar properly. - if (bIsDocked && !theBar->IsDocked()) - mDock->AddBarToDock(theBar); - if (bIsAvailable) - theBar->Show(); - else - theBar->Hide(); - theBar->SetAvailable(bIsAvailable); - } - - } - - - mDock->RestorePlace(inPlace); - - RepositionBars(); - AdjustContainer(); - AdjustDock(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Hides the drag bar from the container AND dock without changing the docking -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CDragBarContainer::HideBar(CDragBar* inBar, Boolean inRefresh) -{ // hide drag bar - if (inBar->IsAvailable()) - { - if (!inBar->IsDocked()) inBar->Hide(); // hide if undocked - if ( mDock ) - mDock->HideBar(inBar); - inBar->SetAvailable(false); - - RepositionBars(); - AdjustContainer(); - AdjustDock(); - if (inRefresh) Refresh(); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Show the drag bar without changing the docking -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CDragBarContainer::ShowBar(CDragBar* inBar, Boolean inRefresh) -{ - if (!inBar->IsAvailable()) - { - if (!inBar->IsDocked()) inBar->Show(); // show if undocked - if ( mDock ) - mDock->ShowBar(inBar); - inBar->SetAvailable(true); - - RepositionBars(); - AdjustContainer(); - AdjustDock(); - if (inRefresh) Refresh(); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::NoteCollapseBar(CDragBar* inBar) -{ - FocusDraw(); - - // 3/6/97 pkc - // When inBar is NULL, we just want to adjust things, but we - // don't need to add a bar to the dock - if (inBar && mDock) - mDock->AddBarToDock(inBar); - - RepositionBars(); - AdjustContainer(); - AdjustDock(); - Refresh(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::NoteExpandBar(CDragBar* inBar) -{ - FocusDraw(); - - mDock->RemoveBarFromDock(inBar); - AdjustDock(); // show or hide as appropriate - - RepositionBars(); - AdjustContainer(); - Refresh(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::RepositionBars(void) -{ - Rect theContainerFrame; - CalcLocalFrameRect(theContainerFrame); - - Int32 theHeight = theContainerFrame.top; - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - { - if (theBar->IsDocked()) // Docked bars are ignored - continue; - if (!theBar->IsAvailable()) // Unavailable (hidden from container and dock) - continue; - - SDimension16 theBarSize; - theBar->GetFrameSize(theBarSize); - theBar->PlaceInSuperFrameAt(theContainerFrame.left, theHeight, false); - - theHeight += theBarSize.height; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::SwapBars( - CDragBar* inSourceBar, - CDragBar* inDestBar, - Boolean inRefresh) -{ - if (inSourceBar == inDestBar) - return; - - // Get the indeces and swap the bars in the array - ArrayIndexT theSourceIndex = mBars.FetchIndexOf(&inSourceBar); - Assert_(theSourceIndex != LArray::index_Bad); - - ArrayIndexT theDestIndex = mBars.FetchIndexOf(&inDestBar); - Assert_(theDestIndex != LArray::index_Bad); - - mBars.SwapItems(theSourceIndex, theDestIndex); - - // align the indeces so we can loop up from one to another. - if (theSourceIndex > theDestIndex) - { - ArrayIndexT theTemp = theSourceIndex; - theSourceIndex = theDestIndex; - theDestIndex = theTemp; - } - - // Now we need to invalidate all of the bars between, and including, - // the source and destination. - - FocusDraw(); - while (theSourceIndex <= theDestIndex) - { - CDragBar* theBar = NULL; - mBars.FetchItemAt(theSourceIndex, &theBar); - Assert_(theBar != NULL); - - Rect thePortFrame; - theBar->CalcPortFrameRect(thePortFrame); - theBar->InvalPortRect(&thePortFrame); - - theSourceIndex++; - } - - if (inRefresh) - { - RepositionBars(); - UpdatePort(); // expensive call!!! use sparingly - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::AdjustContainer(void) -{ - // First get our frame size, we need the width. - SDimension16 theNewSize; - GetFrameSize(theNewSize); - - // The height is the sum of the non-docked bars - // If all bars are docked, the size is the height of the dock - theNewSize.height = 0; - - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - { - if (theBar->IsDocked()) // Docked bars are ignored. - continue; - if (!theBar->IsAvailable()) // Unavailable (hidden from container and dock) - continue; - - SDimension16 theBarSize; - theBar->GetFrameSize(theBarSize); - theNewSize.height += theBarSize.height; - } - - // AdjustContainer can be called before dock is created. - if ( mDock && mDock->HasDockedBars() ) { - SDimension16 theDockSize; - mDock->GetFrameSize(theDockSize); - - theNewSize.height += theDockSize.height; - } - - ResizeFrameTo(theNewSize.width, theNewSize.height, true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarContainer::AdjustDock(void) -{ - if ( mDock ) { - if (mDock->HasDockedBars()) - mDock->Show(); - else - mDock->Hide(); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- DROP AREA BEHAVIOUR --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ PointInDropArea -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Return whether a Point, in Global coords, is inside a DropArea - -Boolean CDragBarContainer::PointInDropArea( - Point inPoint) -{ - GlobalToPortPoint(inPoint); - return IsHitBy(inPoint.h, inPoint.v); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDragBarContainer::ItemIsAcceptable( - DragReference inDragRef, - ItemReference inItemRef) -{ - Boolean bIsAcceptable = false; - - FlavorFlags theFlags; - OSErr theErr = ::GetFlavorFlags(inDragRef, inItemRef, Flavor_DragBar, &theFlags); - if (theErr == noErr) - { - DragAttributes theAttributes; - theErr = ::GetDragAttributes(inDragRef, &theAttributes); - if (theErr == noErr) - bIsAcceptable = (theAttributes & kDragInsideSenderWindow) != 0; - } - - return bIsAcceptable; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ EnterDropArea -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// A Drag is entering a DropArea. This call will be followed by a -// corresponding LeaveDropArea call (when the Drag moves out of the -// DropArea or after the Drag is received by this DropArea). -// -// If the DropArea can accept the Drag and the Drag is coming from outside -// the DropArea, hilite the DropArea - -void CDragBarContainer::EnterDropArea( - DragReference /* inDragRef */, - Boolean /* inDragHasLeftSender */) -{ - // NULL IMPLEMENTATION - // No hiliting necessary. -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ LeaveDropArea -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// A Drag is leaving a DropArea. This call will have been preceded by -// a corresponding EnterDropArea call. -// -// Remove hiliting of the DropArea if necessary - -void CDragBarContainer::LeaveDropArea( - DragReference /* inDragRef */) -{ - // No hiliting necessary. - mCanAcceptCurrentDrag = false; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ InsideDropArea -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Track a Drag while it is inside a DropArea. This function is called -// repeatedly while an acceptable Drag is inside a DropArea. -// -// This more difficult than it needs to be, because PowerPlant does not pass the refCon -// through to this routine. If it did, I could easily get at the tracking bar. -// Instead I need to go through the drag item reference number to get the -// task, and then get the tracking bar. - -void CDragBarContainer::InsideDropArea(DragReference inDragRef) -{ - FocusDraw(); - - Point theMouse, thePinnedMouse; - OSErr theErr = ::GetDragMouse(inDragRef, &theMouse, &thePinnedMouse); - if (theErr != noErr) - { - return; - } - - GlobalToPortPoint(theMouse); - LPane* thePane = FindShallowSubPaneContaining(theMouse.h, theMouse.v); - - // We have the special knowledge that the top level sub panes - // can only be other drag bars, or the dock. - - CDragBar* theBar = dynamic_cast(thePane); - if (theBar != NULL) - { - CDragBarDragTask* theTask = NULL; - theErr = ::GetDragItemReferenceNumber(inDragRef, 1, (ItemReference*)(&theTask)); - if (theErr != noErr) - { - return; - } - - - // See if we're over a bar, and it's not the one we're dragging - CDragBar* theTrackingBar = theTask->GetTrackingBar(); - if (theBar != theTrackingBar) - { - ArrayIndexT theBarPosition; - theBarPosition = mBars.FetchIndexOf(&theBar); - - ArrayIndexT theTrackPosition; - theTrackPosition = mBars.FetchIndexOf(&theTrackingBar); - - // OK, we have the indeces which correspond to the bars' top to - // bottom ordering on the screen. To prevent violent swapping of the bars, - // we only want to swap if the point has passed through the mid horizontal - // point of the bar in the direction leading away from the current tracking - // bar. - - Rect theBarPortFrame; - theBar->CalcPortFrameRect(theBarPortFrame); - - Int16 theMidLine = theBarPortFrame.top + (RectHeight(theBarPortFrame) / 2); - - Boolean bShouldSwap; - if ((theBarPosition < theTrackPosition) && (theMouse.v <= theMidLine)) - bShouldSwap = true; - else if ((theBarPosition > theTrackPosition) && (theMouse.v >= theMidLine)) - bShouldSwap = true; - else - bShouldSwap = false; - - if (bShouldSwap) - SwapBars(theTrackingBar, theBar, true); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ ReceiveDragItem -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Process an Item which has been dragged into a DropArea -// -// This function gets called once for each Item contained in a completed -// Drag. The Item will have returned true from ItemIsAcceptable(). -// -// The DropArea is focused upon entry and inItemBounds is specified -// in the local coordinates of the DropArea. - -void CDragBarContainer::ReceiveDragItem( - DragReference /* inDragRef */, - DragAttributes /* inDragAttrs */, - ItemReference /* inItemRef */, - Rect& /* inItemBounds */) // In Local coordinates -{ -} - - - - - - diff --git a/mozilla/cmd/macfe/gui/CDragBarContainer.h b/mozilla/cmd/macfe/gui/CDragBarContainer.h deleted file mode 100644 index 0d79cc627c2..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBarContainer.h +++ /dev/null @@ -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. - */ - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBarContainer.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include "CSwatchBrokerView.h" -#include -#include -#include - -class CDragBarDockControl; -class CDragBar; - -class CDragBarContainer : - public CBrokeredView, - public LDropArea, - public LListener -{ - public: - - enum { class_ID = 'DbCt' }; - - CDragBarContainer(LStream* inStream); - virtual ~CDragBarContainer(); - - virtual Boolean PointInDropArea(Point inGlobalPt); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - virtual void SavePlace(LStream *outPlace); - virtual void RestorePlace(LStream *inPlace); - - // from JavaScript one can hide/show drag bars independently of docking - virtual void HideBar(CDragBar* inBar, Boolean inRefresh = false); - virtual void ShowBar(CDragBar* inBar, Boolean inRefresh = false); - protected: - - virtual void AddBar(CDragBar* inBar); - - virtual void NoteCollapseBar(CDragBar* inBar); - virtual void NoteExpandBar(CDragBar* inBar); - - virtual void RepositionBars(void); - - virtual void SwapBars( - CDragBar* inSouceBar, - CDragBar* inDestBar, - Boolean inRefresh = false); - - virtual void AdjustContainer(void); - virtual void AdjustDock(void); - - virtual void FinishCreateSelf(void); - virtual void BuildToolbarsPresentAtStartup ( ) ; - - // DROP AREA BEHAVIOUR - - virtual Boolean ItemIsAcceptable( - DragReference inDragRef, - ItemReference inItemRef); - - virtual void EnterDropArea( - DragReference inDragRef, - Boolean inDragHasLeftSender); - - virtual void LeaveDropArea( - DragReference inDragRef); - - virtual void InsideDropArea( - DragReference inDragRef); - - virtual void ReceiveDragItem( - DragReference inDragRef, - DragAttributes inDragAttrs, - ItemReference inItemRef, - Rect &inItemBounds); - - - ResIDT mBarListResID; - LArray mBars; - CDragBarDockControl* mDock; -}; - - diff --git a/mozilla/cmd/macfe/gui/CDragBarDockControl.cp b/mozilla/cmd/macfe/gui/CDragBarDockControl.cp deleted file mode 100644 index b00c8b8cbe9..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBarDockControl.cp +++ /dev/null @@ -1,516 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBarDockControl.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -#include "CDragBarDockControl.h" - - -#include "CDragBar.h" -#include "CSharedPatternWorld.h" -#include "UGraphicGizmos.h" - -#include -#include -#include -#include - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBarDockControl::CDragBarDockControl(LStream* inStream) - : LControl(inStream), - mBars(sizeof(CDragBar*)) -{ - mNeedsRecalc = true; - mMouseInside = nil; - - // ¥ÊThese constants should be in the PPob.... - - ResIDT thePatternID; - *inStream >> thePatternID; - mBackPattern = CSharedPatternWorld::CreateSharedPatternWorld(thePatternID); - ThrowIfNULL_(mBackPattern); - mBackPattern->AddUser(this); - mBackPatternHilite = CSharedPatternWorld::CreateSharedPatternWorld(10001); - ThrowIfNULL_(mBackPatternHilite); - mBackPatternHilite->AddUser(this); - - mGrippy = CSharedPatternWorld::CreateSharedPatternWorld(10004); - ThrowIfNULL_(mGrippy); - mGrippy->AddUser(this); - mGrippyHilite = CSharedPatternWorld::CreateSharedPatternWorld(10005); - ThrowIfNULL_(mGrippyHilite); - mGrippyHilite->AddUser(this); - - *inStream >> mBarTraitsID; - - mTriangle = ::GetCIcon(10000); - ThrowIfNULL_(mTriangle); - - SetRefreshAllWhenResized(false); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBarDockControl::~CDragBarDockControl() -{ - mBackPattern->RemoveUser(this); - mBackPatternHilite->RemoveUser(this); - mGrippy->RemoveUser(this); - mGrippyHilite->RemoveUser(this); - - ::DisposeCIcon(mTriangle); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::SetNeedsRecalc(Boolean inRecalc) -{ - mNeedsRecalc = inRecalc; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDragBarDockControl::IsRecalcRequired(void) const -{ - return mNeedsRecalc; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::AddBarToDock(CDragBar* inBar) -{ - inBar->Dock(); - mBars.InsertItemsAt(1, LArray::index_First, &inBar); - SetNeedsRecalc(true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::RemoveBarFromDock(CDragBar* inBar) -{ - inBar->Undock(); - mBars.Remove(&inBar); - SetNeedsRecalc(true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDragBarDockControl::HasDockedBars(void) const -{ - return (mBars.GetCount() > 0); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::RecalcDock(void) -{ - FocusDraw(); - UTextTraits::SetPortTextTraits(mBarTraitsID); - - Rect theFrame; - CalcLocalFrameRect(theFrame); - Int16 theLeftIndex = theFrame.left; - - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - { - SDimension16 theBarSize; - theBar->GetFrameSize(theBarSize); - - Rect theBarFrame; - theBarFrame.left = theLeftIndex; - theBarFrame.top = theFrame.top; - theBarFrame.right = theBarFrame.left + theBarSize.height + 12; - theBarFrame.bottom = theFrame.bottom; - CalcOneDockedBar(theBar, theBarFrame); - - theLeftIndex += RectWidth(theBarFrame); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::CalcOneDockedBar( - CDragBar* inBar, - const Rect& inBounds) -{ - Int16 theHeight = RectHeight(inBounds); - - ::OpenRgn(); - ::MoveTo(inBounds.left, inBounds.top); - ::LineTo(inBounds.right, inBounds.top); - ::LineTo(inBounds.right - theHeight, inBounds.bottom); - - if (mBars.FetchIndexOf(&inBar) == LArray::index_First) - ::LineTo(inBounds.left, inBounds.bottom); - else - ::LineTo(inBounds.left - theHeight, inBounds.bottom); - - ::LineTo(inBounds.left, inBounds.top); - ::CloseRgn(inBar->mDockedMask); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::DrawSelf(void) -{ - if (mBars.GetCount() == 0) - { - Assert_(false); // we should have been hidden and not drawn - return; - } - - if (IsRecalcRequired()) - RecalcDock(); - - Rect theFrame; - CalcLocalFrameRect(theFrame); - StClipRgnState theClipSaver(theFrame); - - // FIXME the port relative calculation works when you're a view and not a pane - Point theAlignment; - // CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment); - mSuperView->GetPortOrigin(theAlignment); - - // We do this instead of LPane::GetMacPort() because we may be being - // drawn offscreen. - CGrafPtr thePort; - ::GetPort(&(GrafPtr)thePort); - - mBackPattern->Fill(thePort, theFrame, theAlignment); - UGraphicGizmos::LowerColorVolume(theFrame, 0x2000); - - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - DrawOneDockedBar(theBar); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -void CDragBarDockControl::DrawOneDockedBar( - CDragBar* inBar) -{ - StClipRgnState theClipSaver(inBar->mDockedMask); - Rect theTabFrame = (**static_cast(inBar->mDockedMask)).rgnBBox; - Int16 theHeight = RectHeight(theTabFrame); - Int16 theHalfHeight = theHeight / 2; - - // FIXME the port relative calculation works when you're a view and not a pane - Point theAlignment; - // CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment); - mSuperView->GetPortOrigin(theAlignment); - - CGrafPtr thePort; - ::GetPort(&(GrafPtr)thePort); - if ( mMouseInside == inBar ) - mBackPatternHilite->Fill(thePort, theTabFrame, theAlignment); - else - mBackPattern->Fill(thePort, theTabFrame, theAlignment); - - // Draw the beveled outline hilighting - RGBColor theTintColor = { 0x5000, 0x5000, 0x5000 }; - ::RGBForeColor(&theTintColor); - ::OpColor(&UGraphicGizmos::sLighter); - ::PenMode(addPin); - - ArrayIndexT theIndex = mBars.FetchIndexOf(&inBar); - ::MoveTo(theTabFrame.left, theTabFrame.bottom - 1); - if (theIndex == LArray::index_First) - ::LineTo(theTabFrame.left, theTabFrame.top); - else - ::LineTo(theTabFrame.left + theHeight, theTabFrame.top); - - ::LineTo(theTabFrame.right - 1, theTabFrame.top); - - ::OpColor(&UGraphicGizmos::sDarker); - ::PenMode(subPin); - - ::LineTo(theTabFrame.right - theHeight - 1, theTabFrame.bottom - 1); - ::LineTo(theTabFrame.left, theTabFrame.bottom - 1); - - // Draw the triangle - Rect theTriangleDest = theTabFrame; - if (theIndex == LArray::index_First) - theTriangleDest.left += theHalfHeight; - else - theTriangleDest.left += theHeight; - theTriangleDest.right = theTriangleDest.left + (theHeight / 2); - - Rect theTriangleFrame = (**mTriangle).iconPMap.bounds; - UGraphicGizmos::CenterRectOnRect(theTriangleFrame, theTriangleDest); - ::PlotCIcon(&theTriangleFrame, mTriangle); - - // Inset the tab shape then knock out the area surrounding the triangle. - StRegion theInsetCopy(inBar->mDockedMask); - ::InsetRgn(theInsetCopy, 2, 2); - - theTriangleDest.left = theTabFrame.left; - theTriangleDest.right += theHalfHeight; - StRegion theTriangleMask(theTriangleDest); - ::DiffRgn(theInsetCopy, theTriangleMask, theInsetCopy); - ::SetClip(theInsetCopy); - - // draw the grippy pattern - Rect thePatternFrame = (**static_cast(theInsetCopy)).rgnBBox; - if ( mMouseInside == inBar ) - mGrippyHilite->Fill(thePort, thePatternFrame, theAlignment); - else - mGrippy->Fill(thePort, thePatternFrame, theAlignment); - -} - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -{ - LControl::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - SetNeedsRecalc(true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Hides the bar from the dock if docked - mjc -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CDragBarDockControl::HideBar(CDragBar* inBar) -{ - if (inBar->IsDocked() && inBar->IsAvailable()) - { - mBars.Remove(&inBar); - SetNeedsRecalc(true); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Shows the bar in the dock if it was docked previously (use with HideBar) - mjc -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CDragBarDockControl::ShowBar(CDragBar* inBar) -{ - if (inBar->IsDocked() && !inBar->IsAvailable()) - { - mBars.InsertItemsAt(1, LArray::index_First, &inBar); - SetNeedsRecalc(true); - } -} - - -// -// MouseWithin -// -// Called by powerPlant when the mouse is inside the control. Find which collapsed bar the mouse -// is hovering over and if it is different from the one that is currently hilighted, -// redraw. -// -void -CDragBarDockControl :: MouseWithin ( Point inPoint, const EventRecord & /* inEvent */) -{ - PortToLocalPoint(inPoint); - const CDragBar* curr = FindBarSpot ( inPoint ); - if ( mMouseInside != curr ) { - mMouseInside = curr; - Refresh(); - ExecuteAttachments(msg_HideTooltip, nil); - } -} - - -// -// MouseLeave -// -// Called by powerplant when the mouse leaves the control. No more hilighting, so forget -// that any bar is selected and redraw back to the normal state -// -void -CDragBarDockControl :: MouseLeave ( ) -{ - if ( mMouseInside ) { - mMouseInside = nil; - Refresh(); - } -} - - -// -// -void -CDragBarDockControl :: FindTooltipForMouseLocation ( const EventRecord& inMacEvent, StringPtr outTip ) -{ - Point where = inMacEvent.where; - GlobalToPortPoint ( where ); - PortToLocalPoint ( where ); - const CDragBar* curr = FindBarSpot ( where ); - if ( curr ) - curr->GetDescriptor(outTip); - else - ::GetIndString ( outTip, 10506, 13 ); // supply a helpful message... - -} // FindTooltipForMouseLocation - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CONTROL BEHAVIOUR --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CDragBarDockControl::FindHotSpot(Point inPoint) const -{ - Int16 theHotSpot = 0; - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - { - if (::PtInRgn(inPoint, theBar->mDockedMask)) - { - theHotSpot = theIter.GetCurrentIndex(); - break; - } - } - - return theHotSpot; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CDragBarDockControl::PointInHotSpot(Point inPoint, Int16 inHotSpot) const -{ - CDragBar* theBar = NULL; - mBars.FetchItemAt(inHotSpot, &theBar); - Assert_(theBar != NULL); - - Boolean bInHotSpot = ::PtInRgn(inPoint, theBar->mDockedMask); - return bInHotSpot; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::HotSpotAction( - Int16 /* inHotSpot */, - Boolean /* inCurrInside */, - Boolean /* inPrevInside */) -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::HotSpotResult(Int16 inHotSpot) -{ - CDragBar* theBar = NULL; - mBars.FetchItemAt(inHotSpot, &theBar); - Assert_(theBar != NULL); - - BroadcastMessage(msg_DragBarExpand, theBar); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::SavePlace(LStream *outPlace) -{ - *outPlace << mBars.GetCount(); - - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - *outPlace << theBar->GetPaneID(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDockControl::RestorePlace(LStream *inPlace) -{ - Int32 theBarCount; - *inPlace >> theBarCount; - - for (Int32 theIndex = LArray::index_First; theIndex <= theBarCount; theIndex++) - { - PaneIDT theBarID; - *inPlace >> theBarID; - - CDragBar* theBar; - LArrayIterator theIter(mBars, LArrayIterator::from_Start); - while (theIter.Next(&theBar)) - { - if (theBar->GetPaneID() == theBarID) - mBars.MoveItem(theIter.GetCurrentIndex(), theIndex); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -const CDragBar* CDragBarDockControl::FindBarSpot( - Point inLocalPoint) -{ - const CDragBar* theBar = NULL; - Int16 theHotSpot = FindHotSpot(inLocalPoint); - if (theHotSpot != 0) - mBars.FetchItemAt(theHotSpot, &theBar); - - return theBar; -} diff --git a/mozilla/cmd/macfe/gui/CDragBarDockControl.h b/mozilla/cmd/macfe/gui/CDragBarDockControl.h deleted file mode 100644 index 4098116cf86..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBarDockControl.h +++ /dev/null @@ -1,112 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBarDockControl.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include "CToolTipAttachment.h" -#include "CDynamicTooltips.h" - -class CDragBar; -class CSharedPatternWorld; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CDragBarDockControl : public LControl, public CDynamicTooltipMixin -{ - public: - enum { class_ID = 'DbDc' }; - - CDragBarDockControl(LStream* inStream); - virtual ~CDragBarDockControl(); - - virtual void AddBarToDock(CDragBar* inBar); - virtual void RemoveBarFromDock(CDragBar* inBar); - virtual Boolean HasDockedBars(void) const; - - virtual void SavePlace(LStream *outPlace); - virtual void RestorePlace(LStream *inPlace); - - // ¥ Drawing - - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); - - virtual void SetNeedsRecalc(Boolean inRecalc); - virtual Boolean IsRecalcRequired(void) const; - - virtual void HideBar(CDragBar* inBar); // for javascript - mjc - virtual void ShowBar(CDragBar* inBar); // for javascript - mjc - - const CDragBar* FindBarSpot( - Point inLocalPoint); - - // for hilighting on mouse entry/exit - void MouseLeave ( ) ; - void MouseWithin ( Point inPoint, const EventRecord & inEvent ) ; - - virtual void FindTooltipForMouseLocation ( const EventRecord& inMacEvent, - StringPtr outTip ) ; - - protected: - - - // ¥ Drawing - virtual void DrawSelf(void); - virtual void DrawOneDockedBar( - CDragBar* inBar); - - virtual void RecalcDock(void); - virtual void CalcOneDockedBar( - CDragBar* inBar, - const Rect& inBounds); - - // CONTROL BEHAVIOUR - - virtual Int16 FindHotSpot( - Point inPoint) const; - - virtual Boolean PointInHotSpot( - Point inPoint, - Int16 inHotSpot) const; - - virtual void HotSpotAction( - Int16 inHotSpot, - Boolean inCurrInside, - Boolean inPrevInside); - - virtual void HotSpotResult(Int16 inHotSpot); - - CSharedPatternWorld* mBackPattern; - CSharedPatternWorld* mBackPatternHilite; - CSharedPatternWorld* mGrippy; - CSharedPatternWorld* mGrippyHilite; - ResIDT mBarTraitsID; - LArray mBars; - Boolean mNeedsRecalc; - CIconHandle mTriangle; - const CDragBar* mMouseInside; // which bar is mouse hovering over? -}; diff --git a/mozilla/cmd/macfe/gui/CDragBarDragTask.cp b/mozilla/cmd/macfe/gui/CDragBarDragTask.cp deleted file mode 100644 index 36ef397a7b2..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBarDragTask.cp +++ /dev/null @@ -1,161 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBarDragTask.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CDragBarDragTask.h" -#include "CDragBar.h" -#include "CGWorld.h" - -#include "StCaptureView.h" -#include "CEnvironment.h" - -#include - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBarDragTask::CDragBarDragTask( - CDragBar* inBar, - const EventRecord& inEventRecord) - : LDragTask(inEventRecord) -{ - mBar = inBar; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CDragBarDragTask::~CDragBarDragTask() -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -OSErr CDragBarDragTask::DoDrag(void) -{ - if (UEnvironment::HasFeature(env_HasDragMgrImageSupport)) - { - Boolean bTranslucentFailed = false; - try - { - DoTranslucentDrag(); - } - catch (...) - { - bTranslucentFailed = true; - } - - if (bTranslucentFailed) - DoNormalDrag(); - } - else - DoNormalDrag(); - - return noErr; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDragTask::DoNormalDrag(void) -{ - mBar->StartTracking(); - LDragTask::DoDrag(); - mBar->StopTracking(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDragTask::DoTranslucentDrag(void) -{ - StColorState::Normalize(); - mBar->FocusDraw(); - - Rect theFrame; - mBar->CalcLocalFrameRect(theFrame); - - CGWorld theOffWorld(theFrame, 0, useTempMem); - StCaptureView theCaptureView(*mBar); - theCaptureView.Capture(theOffWorld); - - mBar->FocusDraw(); - - Point theOffsetPoint = topLeft(theFrame); - ::LocalToGlobal(&theOffsetPoint); - - StRegion theTrackMask(theFrame); - PixMapHandle theMap = ::GetGWorldPixMap(theOffWorld.GetMacGWorld()); - OSErr theErr = ::SetDragImage(mDragRef, theMap, theTrackMask, theOffsetPoint, kDragDarkerTranslucency); - ThrowIfOSErr_(theErr); - - mBar->StartTracking(); - LDragTask::DoDrag(); - mBar->StopTracking(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDragTask::AddFlavors( - DragReference inDragRef) -{ - // We have to send |flavorNotSaved| or OS8 Finder will crash if you try to drag a bar onto the desktop. - OSErr theErr = ::AddDragItemFlavor(inDragRef, (ItemReference)this, Flavor_DragBar, mBar, sizeof(CDragBar*), - flavorSenderOnly | flavorNotSaved); - ThrowIfOSErr_(theErr); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CDragBarDragTask::MakeDragRegion( - DragReference inDragRef, - RgnHandle /* inDragRegion */) -{ - - Rect theLocalBarFrame; - mBar->FocusDraw(); - mBar->CalcLocalFrameRect(theLocalBarFrame); - - Rect theGlobalFrame = theLocalBarFrame; - ::LocalToGlobal(&topLeft(theGlobalFrame)); - ::LocalToGlobal(&botRight(theGlobalFrame)); - - // Get the single item and add this, its rectangle - ItemReference item; - ::GetDragItemReferenceNumber(inDragRef, 1, &item); - AddRectDragItem(item, theGlobalFrame); -} - - - - - - diff --git a/mozilla/cmd/macfe/gui/CDragBarDragTask.h b/mozilla/cmd/macfe/gui/CDragBarDragTask.h deleted file mode 100644 index 777f1c4fb19..00000000000 --- a/mozilla/cmd/macfe/gui/CDragBarDragTask.h +++ /dev/null @@ -1,61 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CDragBarDragTask.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include - -class CDragBar; - -class CDragBarDragTask : - public LDragTask -{ - public: - CDragBarDragTask( - CDragBar* inBar, - const EventRecord& inEventRecord); - - virtual ~CDragBarDragTask(); - - virtual OSErr DoDrag(void); - - CDragBar* GetTrackingBar(void); - - - protected: - - virtual void DoNormalDrag(void); - virtual void DoTranslucentDrag(void); - - virtual void AddFlavors( - DragReference inDragRef); - - virtual void MakeDragRegion( - DragReference inDragRef, - RgnHandle inDragRegion); - - - CDragBar* mBar; -}; - -inline CDragBar* CDragBarDragTask::GetTrackingBar(void) - { return mBar; } diff --git a/mozilla/cmd/macfe/gui/CDrawable.cp b/mozilla/cmd/macfe/gui/CDrawable.cp deleted file mode 100644 index 9c951c1b0bd..00000000000 --- a/mozilla/cmd/macfe/gui/CDrawable.cp +++ /dev/null @@ -1,507 +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. - */ - -// drawable.cpp - Classes used for maintaining the notion of -// offscreen and onscreen drawables, so that -// document contents can be drawn to either -// location. Currently used for LAYERS. - -// -// To Do: -// 1. Allocate a GWorld that matches the depth of the screen the window is -// currently being displayed on. This will involve cooperation from -// CHTMLView.cp and could well be done through the Lock mechanism assuming -// there's a way to get back at where the fe window is. -// -// 2. Keep the GWorld around and mark the pixels purgeable. LockDrawable would -// then call UpdateGWorld before it locked the pixels. -// -// 3. Take out the parent stuff. It isn't useful anymore unless it ends up -// being needed for item 1 above (which I don't think it will). -// -// 4. Allocate a COffscreenDrawable per CHTMLView but then share the actual -// GWorld between them all. That would allow the CHTMLView to update the -// drawable whenever the scrolling origin changes. COffscreenDrawable can -// then offset the clip when it gets set as opposed to doing it both in -// SetLayerClip and FocusDraw (and CHTMLView wouldn't need to override -// SetLayerClip anymore). -// - -#ifdef LAYERS - -#include "CDrawable.h" - -COffscreenDrawable *COffscreenDrawable::mOffscreenDrawable = NULL; - -// CDrawable base class -CDrawable::CDrawable() -{ - mParent = NULL; - mGWorld = NULL; - mRefCnt = 0; - mOriginX = mOriginY = 0; - mClipRgn = NewRgn(); - mClipChanged = false; -} - -// CDrawable base class -CDrawable::~CDrawable() -{ - DisposeRgn ( mClipRgn ); -} - -// Each user should call InitDrawable before using the drawable -// and RelinquishDrawable when it is done. This allows us to -// maintain a reference count of users. -void CDrawable::InitDrawable( - CL_Drawable* /* inCLDrawable */) -{ - mRefCnt++; -} - -void CDrawable::RelinquishDrawable( - CL_Drawable* /* inCLDrawable */) -{ - Assert_(mRefCnt > 0); - - if (mRefCnt) - { - mRefCnt--; - } -} - -// Set and get the origin of the drawable -void CDrawable::SetLayerOrigin( - int32 inX, - int32 inY) -{ - mOriginX = inX; - mOriginY = inY; -} - -void CDrawable::GetLayerOrigin( - int32* outX, - int32* outY) -{ - *outX = mOriginX; - *outY = mOriginY; -} - -// Set the clip region of the drawable. -void CDrawable::SetLayerClip( - FE_Region inClipRgn) -{ - - if ( inClipRgn != NULL ) - { - CopyRgn ( FE_GetMDRegion(inClipRgn), mClipRgn ); - mClipChanged = true; - - // if we're the current port, make the change be immediate. I wish layers - // would tell the drawable directly that it's being made active rather than - // calling a global FE entry point - if ( UQDGlobals::GetCurrentPort() == (GrafPtr) mGWorld ) - { - mClipChanged = false; - - ::OffsetRgn ( mClipRgn, -mGWorld->portRect.left, -mGWorld->portRect.top ); - - ::SetClip ( mClipRgn ); - - ::OffsetRgn ( mClipRgn, mGWorld->portRect.left, mGWorld->portRect.top ); - } - } -} - -Boolean CDrawable::HasClipChanged() -{ - Boolean changed; - - changed = mClipChanged; - mClipChanged = false; - - return changed; -} - -void CDrawable::CopyPixels( - CDrawable* /* inSrcDrawable */, - FE_Region /* inCopyRgn */) -{ -} - -void CDrawable::SetParent( - CDrawable* parent ) -{ - mParent = parent; -} - - -COnscreenDrawable::COnscreenDrawable() -{ -} - - -CRouterDrawable::CRouterDrawable() -{ -} - -void CRouterDrawable::SetLayerOrigin( - int32 inX, - int32 inY) -{ - if ( mParent != NULL ) - { - mParent->SetLayerOrigin ( inX, inY ); - } -} - -void CRouterDrawable::GetLayerOrigin( - int32* outX, - int32* outY) -{ - if ( mParent != NULL ) - { - mParent->GetLayerOrigin ( outX, outY ); - } -} - -void CRouterDrawable::SetLayerClip( - FE_Region inClipRgn) -{ - if ( mParent != NULL ) - { - mParent->SetLayerClip ( inClipRgn ); - } -} - -FE_Region CRouterDrawable::GetLayerClip() -{ - FE_Region clip; - - clip = mClipRgn; - if ( mParent != NULL ) - { - clip = mParent->GetLayerClip(); - } - - return clip; -} - -Boolean CRouterDrawable::HasClipChanged() -{ - Boolean changed; - - changed = mClipChanged; - if ( mParent != NULL ) - { - changed = mParent->HasClipChanged(); - } - - return changed; -} - -void CRouterDrawable::CopyPixels( - CDrawable * inSrcDrawable, - FE_Region hCopyRgn) -{ - if ( mParent != NULL ) - { - mParent->CopyPixels ( inSrcDrawable, hCopyRgn ); - } -} - -// For the current implementation, only a single offscreen drawable -// is created using this factory method. -COffscreenDrawable * COffscreenDrawable::AllocateOffscreen() -{ - if (mOffscreenDrawable == NULL) - { - mOffscreenDrawable = new COffscreenDrawable(); - } - - return mOffscreenDrawable; -} - -COffscreenDrawable::COffscreenDrawable() -{ - mGWorld = NULL; - mOwner = NULL; - mWidth = mHeight = 0; -} - -// Get rid of any offscreen constructs if they exist -void COffscreenDrawable::delete_offscreen() -{ - /* we should probably just mark ourselves purgable... */ - DisposeGWorld ( mGWorld ); - mGWorld = NULL; - mWidth = mHeight = 0; - mOwner = NULL; -} - -COffscreenDrawable::~COffscreenDrawable() -{ - delete_offscreen(); -} - -void -COffscreenDrawable::RelinquishDrawable( - CL_Drawable* inCLDrawable) -{ - CDrawable::RelinquishDrawable(inCLDrawable); - - // There are no clients left. Let's get rid of the offscreen - // bitmap. - if (mRefCnt == 0) - { - delete_offscreen(); - } -} - -// Called before using the drawable. -PRBool COffscreenDrawable::LockDrawable( - CL_Drawable* inCLDrawable, - CL_DrawableState inState) -{ - if (inState == CL_UNLOCK_DRAWABLE) - { - return PR_TRUE; - } - - /* - * Check to see if this CL_Drawable was the last one to use - * this drawable. If not, someone else might have modified - * the bits since the last time this CL_Drawable wrote to - * to them. - */ - if ( (inState & CL_LOCK_DRAWABLE_FOR_READ) && (mOwner != inCLDrawable) ) - { - return PR_FALSE; - } - - mOwner = inCLDrawable; - - if ( mGWorld == NULL ) - { - return PR_FALSE; - } - - LockPixels ( GetGWorldPixMap ( mGWorld ) ); - - return PR_TRUE; -} - -// Set the required dimensions of the drawable. -void -COffscreenDrawable::SetDimensions(int32 inWidth, int32 inHeight) -{ - - if ( (inWidth > mWidth) || (inHeight > mHeight) ) - { - /* - * If there is only one client of the backing store, - * we can resize it to the dimensions specified. - * Otherwise, we can make it larger, but not smaller - */ - if (mRefCnt > 1) - { - if (inWidth < mWidth) - { - inWidth = mWidth; - } - - if (inHeight < mHeight) - { - inHeight = mHeight; - } - } - - /* - * Create our offscreen. We need to try to find the deepest device that - * intersects the current screen area. Not sure how to do that at present. - * [hint: DeviceLoop] - * - * If a drawable is always set as the current drawable before its - * SetDimensions method is called, then we can have an explicit SetScreenArea - * method that allows us to track the current deepest screen that intersects - * us. - * - * We should also be able to keep the GWorld allocated and just reallocate the - * pixels rather than the whole damn thing. This will be a slight memory hit - * but a big speed win. - */ - - OSErr err; - Rect r = { 0, 0, inHeight, inWidth }; - GDHandle deepestDevice; - GDHandle gdList; - UInt32 deviceDepth; - UInt32 maxDepth; - Boolean maxIsColor; - - /* - * Find the deepest device, or at least a color one - */ - maxIsColor = false; - maxDepth = 0; - deepestDevice = 0L; - gdList = GetDeviceList(); - - while ( gdList ) - { - deviceDepth = (*(*gdList)->gdPMap)->pixelSize; - - if ( deviceDepth > maxDepth ) - { - // our new device is deeper, use it - maxDepth = deviceDepth; - maxIsColor = (*gdList)->gdFlags & 1; - deepestDevice = gdList; - } - else - if ( deviceDepth == maxDepth && !maxIsColor ) - { - if ( ( (*gdList)->gdFlags & 1 ) != 0 ) - { - // our new device is color, use it - maxIsColor = true; - deepestDevice = gdList; - } - } - - gdList = GetNextDevice ( gdList ); - } - - Assert_ ( deepestDevice != NULL ); - - /* if we didn't find anything, then we just do an 8 bit color device */ - if ( deepestDevice == NULL ) - { - maxDepth = 8; - } - - if ( mGWorld == NULL ) - { - err = NewGWorld ( &mGWorld, maxDepth, &r, 0L, deepestDevice, noNewDevice + useTempMem ); - } - else - { - err = UpdateGWorld ( &mGWorld, maxDepth, &r, 0L, deepestDevice, 0 ); - } - - if ( err != noErr ) - { - mGWorld = NULL; - } - else - { - GDHandle gd; - CGrafPtr gp; - - GetGWorld ( &gp, &gd ); - SetGWorld ( mGWorld, NULL ); - - #if DEBUG - // DEBUG - so we know for sure when we draw unitialized pixels! - ForeColor ( redColor ); - PaintRect ( &mGWorld->portRect ); - #endif - - SetGWorld ( gp, gd ); - - mWidth = inWidth; - mHeight = inHeight; - } - } -} - - -/* - * These are all our fe callback routines - */ -static PRBool fe_lock_drawable(CL_Drawable *drawable, CL_DrawableState state) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - return pDrawable->LockDrawable(drawable, state); -} - -static void fe_init_drawable(CL_Drawable *drawable) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->InitDrawable(drawable); -} - -static void fe_relinquish_drawable(CL_Drawable *drawable) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->RelinquishDrawable(drawable); -} - -static void fe_set_drawable_origin(CL_Drawable *drawable, int32 x_offset, int32 y_offset) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->SetLayerOrigin(x_offset, y_offset); -} - -static void fe_get_drawable_origin(CL_Drawable *drawable, int32 *x_offset, int32 *y_offset) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->GetLayerOrigin(x_offset, y_offset); -} - -static void fe_set_drawable_clip(CL_Drawable *drawable, FE_Region clip_region) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->SetLayerClip(clip_region); -} - -static void fe_restore_drawable_clip(CL_Drawable *drawable) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->SetLayerClip(NULL); -} - -static void fe_copy_pixels(CL_Drawable *drawable_src, CL_Drawable *drawable_dest, FE_Region region) -{ - CDrawable *pSrcDrawable = (CDrawable *)CL_GetDrawableClientData(drawable_src); - CDrawable *pDstDrawable = (CDrawable *)CL_GetDrawableClientData(drawable_dest); - - pDstDrawable->CopyPixels(pSrcDrawable, region); -} - -static void fe_set_drawable_dimensions(CL_Drawable *drawable, uint32 width, uint32 height) -{ - CDrawable *pDrawable = (CDrawable *)CL_GetDrawableClientData(drawable); - pDrawable->SetDimensions(width, height); -} - -CL_DrawableVTable mfe_drawable_vtable = { - fe_lock_drawable, - fe_init_drawable, - fe_relinquish_drawable, - NULL, - fe_set_drawable_origin, - fe_get_drawable_origin, - fe_set_drawable_clip, - fe_restore_drawable_clip, - fe_copy_pixels, - fe_set_drawable_dimensions -}; - - -#endif // LAYERS diff --git a/mozilla/cmd/macfe/gui/CDrawable.h b/mozilla/cmd/macfe/gui/CDrawable.h deleted file mode 100644 index 48c06b4085a..00000000000 --- a/mozilla/cmd/macfe/gui/CDrawable.h +++ /dev/null @@ -1,170 +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. - */ - -// drawable.h - Classes used for maintaining the notion of -// offscreen and onscreen drawables, so that -// document contents can be drawn to either -// location. Currently used for LAYERS. - -#include -#include "ntypes.h" -#include "structs.h" - -#include "layers.h" -#include "cl_types.h" - -#ifndef _DRAWABLE_H_ -#define _DRAWABLE_H_ - - -#ifdef LAYERS - -extern CL_DrawableVTable mfe_drawable_vtable; - -class CDrawable -{ - public: - // Constructor and destructor - CDrawable(); - virtual ~CDrawable(); - - // Lock the drawable for use, based on the state passed in. - // Does nothing in the super class. - virtual PRBool LockDrawable( - CL_Drawable* /*pCLDrawable*/, - CL_DrawableState /*newState*/) { return PR_TRUE; } - - // Calls to indicate a new client or the relinquishing of the drawable - // by a client. - virtual void InitDrawable( - CL_Drawable* pCLDrawable); - - virtual void RelinquishDrawable( - CL_Drawable* pCLDrawable); - - // Get and set the origin of the drawable - virtual void SetLayerOrigin( - int32 inX, - int32 inY); - virtual void GetLayerOrigin( - int32* outX, - int32* outY); - - // Set the drawable's clip. A value of NULL indicates that the - // clip should be restored to its initial value. - virtual void SetLayerClip( - FE_Region inClipRgn); - - virtual FE_Region GetLayerClip() { return mClipRgn; } - - virtual Boolean HasClipChanged(); - - // Call to copy pixels from the given drawable - virtual void CopyPixels( - CDrawable * inSrcDrawable, - FE_Region hCopyRgn); - - // Call to set the width and height of a drawable; - virtual void SetDimensions( - int32 /*inWidth*/, - int32 /*inHeight*/) {} - - virtual GWorldPtr GetDrawableOffscreen() { return mGWorld; } - - // Set the parent drawable - virtual void SetParent( - CDrawable* parent ); - - CDrawable* mParent; - GWorldPtr mGWorld; - Uint32 mRefCnt; - int32 mOriginX; - int32 mOriginY; - RgnHandle mClipRgn; - Boolean mClipChanged; -}; - -class COnscreenDrawable : - public CDrawable -{ - public: - COnscreenDrawable(); - ~COnscreenDrawable() {} -}; - -class CRouterDrawable : - public CDrawable -{ - public: - CRouterDrawable(); - ~CRouterDrawable() {} - - virtual void SetLayerOrigin( - int32 inX, - int32 inY); - virtual void GetLayerOrigin( - int32* outX, - int32* outY); - - virtual void SetLayerClip( - FE_Region inClipRgn); - virtual FE_Region GetLayerClip(); - - virtual Boolean HasClipChanged(); - - virtual void CopyPixels( - CDrawable * inSrcDrawable, - FE_Region hCopyRgn); -}; - -class COffscreenDrawable : - public CDrawable -{ - - public: - COffscreenDrawable(); - ~COffscreenDrawable(); - - // Factory for creating offscreen drawables - static COffscreenDrawable* AllocateOffscreen(); - - virtual void RelinquishDrawable( - CL_Drawable* pCLDrawable); - - virtual PRBool LockDrawable( - CL_Drawable* pCLDrawable, - CL_DrawableState newState); - - virtual void SetDimensions( - int32 inWidth, - int32 inHeight); - - private: - void delete_offscreen(); - - protected: - CL_Drawable* mOwner; - int32 mWidth; - int32 mHeight; - - // In this implementation, we only have a single offscreen drawable - static COffscreenDrawable * mOffscreenDrawable; -}; - -#endif // LAYERS -#endif // _DRAWABLE_H_ diff --git a/mozilla/cmd/macfe/gui/CDynamicTooltips.cp b/mozilla/cmd/macfe/gui/CDynamicTooltips.cp deleted file mode 100644 index b210ee22f9c..00000000000 --- a/mozilla/cmd/macfe/gui/CDynamicTooltips.cp +++ /dev/null @@ -1,82 +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. - */ - -// -// Implementation for a pair of classes that provided a tooltip that takes its text dynamically -// based on the content of a pane and the mouse location. The CDynamicTooltipPane asks its -// parent view what string it should display depending on the current mouse location. -// The CDynamicTootipMixin class is mixed into the parent view to give the the correct -// interface. -// - -#include "CDynamicTooltips.h" - - -// -// CalcFrameWithRespectTo -// -// Figures out how big the tip needs to be and where it should be located in the port for -// the tip text. We are guaranteed that |mTip| (the string holding the text) has already -// been correctly set. -// -void -CDynamicTooltipPane :: CalcFrameWithRespectTo( LWindow* inOwningWindow, const EventRecord& inMacEvent, - Rect& outTipFrame) -{ - const short kXPadding = 5; - const short kYPadding = 3; - - StTextState theTextSaver; - UTextTraits::SetPortTextTraits(mTipTraitsID); - - FontInfo theFontInfo; - ::GetFontInfo(&theFontInfo); - Int16 theTextHeight = theFontInfo.ascent + theFontInfo.descent + theFontInfo.leading + (2 * 2); - Int16 theTextWidth = ::StringWidth(mTip) + (2 * ::CharWidth(char_Space)); - - Point theLocalPoint = inMacEvent.where; - GlobalToPortPoint(theLocalPoint); - - Rect theWindowFrame; - mOwningPane->CalcPortFrameRect(theWindowFrame); - - outTipFrame.left = theLocalPoint.h + kXPadding; - outTipFrame.top = theLocalPoint.v + kYPadding; - outTipFrame.right = outTipFrame.left + theTextWidth + kXPadding; - outTipFrame.bottom = outTipFrame.top + theTextHeight + kYPadding; - - ForceInPortFrame(inOwningWindow, outTipFrame); - -} // CDynamicTooltipPane :: CalcFrameWithRespectTo - - -// -// CalcTipText -// -// Asks the parent pane (which has the interface provided by the CDynamicTooltipMixin class) -// for the tooltip at the current mouse location -// -void -CDynamicTooltipPane :: CalcTipText( LWindow* /* inOwningWindow */, const EventRecord& inMacEvent, - StringPtr outTipText) -{ - CDynamicTooltipMixin* parent = dynamic_cast(mOwningPane); - Assert_(parent != NULL); - parent->FindTooltipForMouseLocation ( inMacEvent, outTipText ); - -} // CDynamicTooltipPane :: CalcTipText diff --git a/mozilla/cmd/macfe/gui/CDynamicTooltips.h b/mozilla/cmd/macfe/gui/CDynamicTooltips.h deleted file mode 100644 index e777dc847e7..00000000000 --- a/mozilla/cmd/macfe/gui/CDynamicTooltips.h +++ /dev/null @@ -1,105 +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. - */ - -// -// Interface for a pair of classes that provided a tooltip that takes its text dynamically -// based on the content of a pane and the mouse location. The CDynamicTooltipPane asks its -// parent view what string it should display depending on the current mouse location. -// The CDynamicTootipMixin class is mixed into the parent view to give the the correct -// interface. -// - -#pragma once - -#include "CTooltipAttachment.h" - -// -// class CDynamicTooltipPane -// -// Handles querying the parent view to get the appropriate text based on the mouse location. -// Works with the CDynamicTooltipMixin class, which the parent view MUST mixin for this -// to work. -// -// To use this class instead of the normal tooltip pane, include the PPob id of an -// instantiation of this class (located in Tooltips.cnst) in the appropriate -// CTooltipAttachment's properties where it asks for the mTipPaneResID. -// -// NOTE: This will not _crash_ when the parent is not a CDynamicTooltipMixin, but will -// assert so you know you're using it incorrectly. -// - -class CDynamicTooltipPane : public CToolTipPane -{ -public: - enum { class_ID = 'DyTT' } ; - - CDynamicTooltipPane ( LStream* inStream ) : CToolTipPane(inStream) { }; - virtual ~CDynamicTooltipPane ( ) { } ; - - virtual void CalcFrameWithRespectTo( - LWindow* inOwningWindow, - const EventRecord& inMacEvent, - Rect& outTipFrame); - - virtual void CalcTipText( - LWindow* inOwningWindow, - const EventRecord& inMacEvent, - StringPtr outTipText); - -}; // CDynamicTooltipPane - - -// -// class CDynamicTooltipMixin -// -// Mix into your view/pane and override the appropriate methods to return the correct -// information to the query for dynamic tooltip text from the CDynamicTooltipPane. -// All methods are pure virtual so you must override them if you intend to use this class. -// -// There is no data in this class, as it only presents an interface. -// -// As a side note, in addition to implementing the FindTooltipforMouseLocation() -// method, you will probably want to override MouseWithin() and track when the -// mouse enters/leaves a "hot" area that gets a tooltip. This is quite important -// if you want to hide the tooltip when the mouse moves away from that spot. The -// code to do this in MouseWithin() would look something like: -// -// if ( newArea != oldArea ) { -// ... update your own roll-over feedback as necessary ... -// ExecuteAttachments ( msg_HideTooltip, nil ); -// } -// -// The CTooltipAttachment responds to this message by hiding the tooltip, thereby -// resetting it for the next "hot spot" the user may move the cursor to within -// the pane. -// - -class CDynamicTooltipMixin -{ - -public: - virtual void FindTooltipForMouseLocation ( const EventRecord& inMacEvent, - StringPtr outTip ) = 0; - -private: - - // make these private so you can't instantiate one of these standalone - CDynamicTooltipMixin ( ) { } ; - ~CDynamicTooltipMixin ( ) { } ; - -}; // CDynamicTooltipMixin diff --git a/mozilla/cmd/macfe/gui/CFontReference.cp b/mozilla/cmd/macfe/gui/CFontReference.cp deleted file mode 100644 index 2c6fe29e94c..00000000000 --- a/mozilla/cmd/macfe/gui/CFontReference.cp +++ /dev/null @@ -1,791 +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. - */ - -#include "CFontReference.h" - -#include - -#include "uprefd.h" -#include "xp_hash.h" -#include "xp_mem.h" -#include "lo_ele.h" - -#include "FontTypes.h" -#include "shist.h" - -#include "resgui.h" - -// Set this to 1 to force WebFont lookup instead of native font lookup -#define TEST_NATIVE_DISPLAYER 0 - -#if TEST_NATIVE_DISPLAYER -#include "mcfp.h" -#endif - -#include "libi18n.h" -#include "UPropFontSwitcher.h" -#include "UFixedFontSwitcher.h" -#include "UUTF8TextHandler.h" - -#define WEIGHT_BOLD 700 -#define WEIGHT_NORMAL 400 - -class NameList -{ -public: - NameList(char *list); - ~NameList(); - - Boolean Empty(); - void Next(); - char *Current(); - -private: - char *list, *name; - int start, next; -}; - -NameList::NameList(char *list) -{ - int length = strlen(list); - - this->list = list; - start = next = 0; - - - if (length > 0) - { - name = new char[length + 1]; - this->Next(); - } - else - { - name = NULL; - } -} - -NameList::~NameList() -{ - if (name != NULL) - delete[] name; -} - -char *NameList::Current() -{ - if (Empty()) - return NULL; - - return name; -} - -Boolean NameList::Empty() -{ - return list == NULL || list[start] == '\0'; -} - -void NameList::Next() -{ - start = next; - - if (Empty()) - return; - - // skip over leading whitespace and commas to find the start of the name - while (list[start] != '\0' && (list[start] == ',' || isspace(list[start]))) - { - start += 1; - } - - // find the end of the name - next = start; - while(list[next] != '\0' && list[next] != ',') - { - if (list[next] == '"' || list[next] == '\'') - { - char final = list[next]; - - // find the matching quote - next += 1; - while (list[next] != '\0' && list[next] != final) - { - next += 1; - } - - // if list[next] is null, there was no matching quote, so bail - if (list[next] == '\0') - { - break; - } - } - - next += 1; - } - - // strip off trailing whitespace - int end = next - 1; - - while (end >= start && isspace(list[end])) - { - end -= 1; - } - - // copy what's between start and end into name - int src = start; - int dst = 0; - - // if it's quoted, strip off the quotes - if ((list[start] == '"' || list[start] == '\'') && list[end] == list[start]) - { - src += 1; - end -= 1; - } - - // copy the characters from src to end into the name - while (src <= end) - { - name[dst++] = list[src++]; - } - - name[dst] = '\0'; -} - -void FE_ReleaseTextAttrFeData(MWContext * /* context */, LO_TextAttr *attr) -{ - CFontReference *fontReference = (CFontReference *) attr->FE_Data; - - if (fontReference != NULL) - delete fontReference; -} - -short CFontReference::GetScaledTextSize(short size, short attrSize) -{ - short scaledSize; - - if ( attrSize < 1 ) - attrSize = 1; - else if ( attrSize > 7 ) - attrSize = 7; - - // ¥ Houck's font table from WINFE - switch ( attrSize ) - { - case 0: scaledSize = size / 2 ; break; - case 1: scaledSize = 7 * size / 10 ; break; - case 2: scaledSize = 85 * size / 100 ; break; - case 3: scaledSize = size ; break; - case 4: scaledSize = 12 * size / 10 ; break; - case 5: scaledSize = 3 * size / 2 ; break; - case 6: scaledSize = 2 * size ; break; - case 7: scaledSize = 3 * size ; break; - } - - // should this test be at a higher level? - if ( scaledSize < 9 ) // looks bad at anything lower - scaledSize = 9; - - return scaledSize; -} - -CFontReference *CFontReference::GetFontReference(const CCharSet *charSet, LO_TextAttr* attr, MWContext *context, Boolean underlineLinks) -{ - CFontReference *result = NULL; - - if (attr->FE_Data != NULL) - { - result = (CFontReference *) attr->FE_Data; - - result->SynchToPort(qd.thePort); - - return result; - } - - for (NameList list(attr->font_face); !list.Empty(); list.Next()) - { - - result = CWebFontReference::LookupWebFont(list.Current(), charSet, attr, context, underlineLinks); - - if (result != NULL) - goto cache_result; - - result = CNativeFontReference::LookupNativeFont(list.Current(), charSet, attr, underlineLinks); - - if (result != NULL) - goto cache_result; - - result = CNativeFontReference::LookupGenericFont(list.Current(), charSet, attr, underlineLinks); - - if (result != NULL) - goto cache_result; - } - - // if we get this far, we don't have any matching fonts - // just return the default font for the character set. - - short fontID; - - if ( attr->fontmask & LO_FONT_FIXED ) - fontID = charSet->fFixedFontNum; - else - fontID = charSet->fPropFontNum; - - result = new CNativeFontReference(fontID, charSet, attr, underlineLinks); - -cache_result: - attr->FE_Data = (void *) result; - return result; -} - -CFontReference::CFontReference(const CCharSet *charSet, const LO_TextAttr *attr) -{ - fIsGetFontInfoDirty = true; - - fMode = srcOr; - - if (attr->point_size == 0) - { - short textSize; - - if (attr->fontmask & LO_FONT_FIXED) - textSize = charSet->fFixedFontSize; - else - textSize = charSet->fPropFontSize; - - fSize = GetScaledTextSize(textSize, attr->size); - } - else - { - fSize = attr->point_size; - } -} - -CFontReference::~CFontReference() -{ - // **** is there anything to do here? -} - -void CNativeFontReference::Apply() -{ - if ( qd.thePort->txFont != fFont ) - ::TextFont( fFont ); - - if ( qd.thePort->txSize != fSize ) - ::TextSize( fSize ); - - if ( qd.thePort->txFace != fStyle ) - ::TextFace( fStyle ); - - if ( qd.thePort->txMode != fMode ) - ::TextMode( fMode ); -} - -CFontReference *CNativeFontReference::LookupNativeFont(char *fontName, const CCharSet *charSet, const LO_TextAttr *attr, - Boolean underlineLinks) -{ - short fontID; - CStr255 pName(fontName); - - ::GetFNum(pName, &fontID); - - if (fontID == 0) - { - - /* - Font ID 0 is the system font. Did we get this - ID because the named font doesn't exist, or - because we asked for the system font by name? - */ - static CStr255 systemFontName; - - if (systemFontName[0] == 0) - ::GetFontName(0, systemFontName); - - if (pName != systemFontName) - return NULL; - } - - return new CNativeFontReference(fontID, charSet, attr, underlineLinks); -} - -CFontReference *CNativeFontReference::LookupGenericFont(char *fontName, const CCharSet *charSet, const LO_TextAttr *attr, - Boolean underlineLinks) -{ - struct GenericFontFamily - { - char *genericName; - char *nativeName; - }; - - // NOTE: These need to be in the same order as they are - // in the resource. - static GenericFontFamily genericNames[] = - { - {"serif", NULL}, - {"sans-serif", NULL}, - {"cursive", NULL}, - {"fantasy", NULL}, - {"monospace", NULL} - }; - - static const int genericNameCount = sizeof(genericNames) / sizeof(GenericFontFamily); - - for (int nameIndex = 0; nameIndex < genericNameCount; nameIndex += 1) - { - if (!XP_STRCASECMP( fontName, genericNames[nameIndex].genericName)) - { - if (genericNames[nameIndex].nativeName == NULL) - { - Str255 nativeName; - - ::GetIndString(nativeName, GENERIC_FONT_NAMES_RESID, nameIndex + 1); - - XP_ASSERT(nativeName[0] != 0); - - // allocate memory for a copy of the name - genericNames[nameIndex].nativeName = (char *) XP_ALLOC(nativeName[0] + 1); - - // bail if no memory for the name - if (genericNames[nameIndex].nativeName == NULL) - return NULL; - - // copy it as a C string - strncpy(genericNames[nameIndex].nativeName, (char *) &nativeName[1], nativeName[0]); - genericNames[nameIndex].nativeName[nativeName[0]] = '\0'; - } - - return CNativeFontReference::LookupNativeFont(genericNames[nameIndex].nativeName, charSet, attr, underlineLinks); - } - } - - return NULL; -} - -CNativeFontReference::CNativeFontReference(short font, const CCharSet *charSet, const LO_TextAttr *attr, - Boolean /* underlineLinks */) : - CFontReference(charSet, attr) -{ - fFont = font; - fStyle = 0; - - if ((charSet->fCSID & MULTIBYTE) != SINGLEBYTE) - { - switch(charSet->fCSID) - { - case CS_UTF8: - fTextHandler = UUTF8TextHandler::Instance(); - break; - - /* - // **** really want handlers for all multi-byte text - // use system for now... - case CS_SJIS: - fTextHandler = SJISTextHandler::Instance(); - break; - - default: - fTextHandler = MBTextHandler::Instance(); - */ - default: - fTextHandler = NULL; - } - - if (attr->fontmask & LO_FONT_FIXED) - fFontSwitcher = UFixedFontSwitcher::Instance(); - else - fFontSwitcher = UPropFontSwitcher::Instance(); - } - else - { - fTextHandler = NULL; - fFontSwitcher = NULL; - } - - if (attr->font_weight >= WEIGHT_BOLD || (attr->fontmask & LO_FONT_BOLD) != 0) - fStyle |= bold; - - if (attr->fontmask & LO_FONT_ITALIC) - fStyle |= italic; - - if (attr->attrmask & LO_ATTR_UNDERLINE) - fStyle |= underline; -} - -CNativeFontReference::~CNativeFontReference() -{ - // **** Anything interesting to do here? -} - -void CNativeFontReference::DrawText(int x, int y, char *text, int start, int end) -{ - ::MoveTo(x, y); - - if (fTextHandler != NULL) - fTextHandler->DrawText(fFontSwitcher, &text[start], end - start + 1); - else - ::DrawText(text, start, end - start + 1); - -} - -short CNativeFontReference::TextWidth(char *text, int firstByte, int byteCount) -{ - if (fTextHandler != NULL) - return fTextHandler->TextWidth(fFontSwitcher, &text[firstByte], byteCount); - else - return ::TextWidth(text, firstByte, byteCount); -} - -short CNativeFontReference::MeasureText(char *text, int firstByte, int byteCount, short* charLocs) -{ - if (fTextHandler != NULL) - return 0; - else - { - text = &text[firstByte]; - ::MeasureText(byteCount, text, charLocs); - - // remove null chars widths - short widthOffset = 0; - short nullCharWidth = 0; - for (int i = 1; i <= byteCount; i ++) - { - if (text[i-1] == '\0') - { - if (nullCharWidth == 0) - { - nullCharWidth = charLocs[i] - charLocs[i-1]; - if (nullCharWidth == 0) - break; - } - widthOffset += nullCharWidth; - } - charLocs[i] -= widthOffset; - } - - return byteCount; - } -} - -void CNativeFontReference::GetFontInfo(FontInfo *fontInfo) -{ - if (fIsGetFontInfoDirty) - { - if (fTextHandler != NULL) - fTextHandler->GetFontInfo(fFontSwitcher, &fCachedFontInfoValues); - else - ::GetFontInfo(&fCachedFontInfoValues); - - fIsGetFontInfoDirty = false; - } - - *fontInfo = fCachedFontInfoValues; -} - -FontBrokerHandle CWebFontReference::sBroker = NULL; -FontBrokerUtilityHandle CWebFontReference::sUtility = NULL; -XP_HashTable CWebFontReference::sPortHash = NULL; - -char *CWebFontReference::sCatalogPath = NULL; - -#define REQUIRED_GUTS_PATH "/usr/local/netscape/RequiredGuts/" - -void CWebFontReference::Init() -{ - jint jresult; - char *displayerPath; - Str31 essentialFiles, dynamicFonts, dynamicFontCatalog; - FontBrokerDisplayerHandle brokerDisplayer; -#if TEST_NATIVE_DISPLAYER - FontDisplayerHandle nativeDisplayer; -#endif - - sPortHash = XP_HashTableNew(10, PortHash, PortCompFunction); - - sBroker = NF_FontBrokerInitialize(); - if (sBroker == NULL) - { - // error? - return; - } - - brokerDisplayer = (FontBrokerDisplayerHandle) nffbc_getInterface(sBroker, &nffbp_ID, NULL); - if(brokerDisplayer == NULL) - { - // error? - return; - } - -#if TEST_NATIVE_DISPLAYER - nativeDisplayer = (FontDisplayerHandle) cfpFactory_Create(NULL, brokerDisplayer); - if (nativeDisplayer != NULL) - { - nffbp_RegisterFontDisplayer(brokerDisplayer, nativeDisplayer, NULL); - } -#endif - - sUtility = (FontBrokerUtilityHandle) nffbc_getInterface(sBroker, &nffbu_ID, NULL); - if (sUtility == NULL) - { - // error? - return; - } - - ::GetIndString(essentialFiles, 14000, 1); - ::GetIndString(dynamicFonts, 14000, 3); - ::GetIndString(dynamicFontCatalog, 14000, 4); - - XP_ASSERT(essentialFiles[0] != 0 && dynamicFonts[0] != 0 && dynamicFontCatalog[0] != 0); - - // "+ 4" is for three colons plus the null - sCatalogPath = (char *) XP_ALLOC(essentialFiles[0] + dynamicFonts[0] + dynamicFontCatalog[0] + 4); - if (sCatalogPath != NULL) - { - // Build ":Essential Files:DynamicFonts:Dynamic Font Catalog" - strcpy(sCatalogPath, PATH_SEPARATOR_STR); - strncat(sCatalogPath, (char *) &essentialFiles[1], essentialFiles[0]); - strcat(sCatalogPath, PATH_SEPARATOR_STR); - strncat(sCatalogPath, (char *) &dynamicFonts[1], dynamicFonts[0]); - strcat(sCatalogPath, PATH_SEPARATOR_STR); - strncat(sCatalogPath, (char *) &dynamicFontCatalog[1], dynamicFontCatalog[0]); - - // Don't care if this fails, file will be created when we save it. - jresult = nffbu_LoadCatalog(sUtility, sCatalogPath, NULL); - } - - // "+ 2" is for one slash and the null - displayerPath = (char *) XP_ALLOC(sizeof(REQUIRED_GUTS_PATH) + dynamicFonts[0] + 2); - if (displayerPath != NULL) - { - // Build REQUIRED_GUTS_PATH "Dynamic Fonts/" - strcpy(displayerPath, REQUIRED_GUTS_PATH); - strncat(displayerPath, (char *) &dynamicFonts[1], dynamicFonts[0]); - strcat(displayerPath, DIRECTORY_SEPARATOR_STR); - - // Result is number of displayers created, we don't really care - jresult = nffbp_ScanForFontDisplayers(brokerDisplayer, displayerPath, NULL); - - XP_FREE(displayerPath); - } -} - -void CWebFontReference::Finish() -{ - jint result; - - if (sCatalogPath != NULL) - { - result = nffbu_SaveCatalog(sUtility, sCatalogPath, NULL); - XP_FREE(sCatalogPath); - sCatalogPath = NULL; - } -} - -// Make sure the rc's port is port... -void CWebFontReference::SynchToPort(GrafPtr port) -{ - struct rc_data rcd = nfrc_GetPlatformData(fRenderingContext, NULL); - - if (rcd.t.directRc.port != port) - { - rcd.t.directRc.port = port; - nfrc_SetPlatformData(fRenderingContext, &rcd, NULL); - } - -} - -// It's not clear to me that this is good hash, but it's fast! -uint32 CWebFontReference::PortHash(const void *port) -{ - return (uint32) port; -} - -// Should I look at the port fields if the addresses aren't equal? -int CWebFontReference::PortCompFunction(const void *port1, const void *port2) -{ - return port1 != port2; -} - -RenderingContextHandle CWebFontReference::GetCachedRenderingContext(GrafPtr port) -{ - RenderingContextHandle rc = (RenderingContextHandle) XP_Gethash(sPortHash, port, NULL); - - if (rc == NULL) - { - void *rcArgs[1]; - - rcArgs[0] = port; - rc = nffbu_CreateRenderingContext(sUtility, NF_RC_DIRECT, 0, rcArgs, 1, NULL); - - if (rc != NULL) - { - XP_Puthash(sPortHash, port, rc); - } - // error? - } - - return rc; -} - -CFontReference *CWebFontReference::LookupWebFont(char *fontName, const CCharSet *charSet, const LO_TextAttr *attr, MWContext *context, Boolean underlineLinks) -{ - FontMatchInfoHandle fmi; - RenderingContextHandle renderingContext; - WebFontHandle webFont; - - char encoding[64]; // Should get the "64" from a header file... - char *charset = NULL; // Is this the right value? - int weight; - int style = nfStyleNormal; - int escapement = nfSpacingProportional; - int underline = nfUnderlineNo; - int strikeout = nfStrikeOutNo; - int resolutionX, resolutionY; - - if (attr->font_weight != 0) - weight = attr->font_weight; - else if (attr->fontmask & LO_FONT_BOLD) - weight = WEIGHT_BOLD; - else - weight = WEIGHT_NORMAL; - - if (attr->fontmask & LO_FONT_ITALIC) - style = nfStyleItalic; - - if (attr->fontmask & LO_FONT_FIXED) - escapement = nfSpacingMonospaced; - - if (attr->attrmask & LO_ATTR_UNDERLINE) - underline = nfUnderlineYes; - - if ((attr->attrmask & LO_ATTR_ANCHOR) != 0 && underlineLinks) - underline = nfUnderlineYes; - - if (attr->attrmask & LO_ATTR_STRIKEOUT) - strikeout = nfStrikeOutYes; - - if (context->type == MWContextPrint) - { - THPrint hp = CPrefs::GetPrintRecord(); - - if (hp != NULL) - { - ::PrValidate(hp); - - resolutionX = (**hp).prInfo.iHRes; - resolutionY = (**hp).prInfo.iVRes; - } - else - { - // **** What is a good default in this case? - resolutionX = 72; - resolutionY = 72; - } - } - else - { - resolutionX = context->XpixelsPerPoint * 72.0; - resolutionY = context->YpixelsPerPoint * 72.0; - } - - INTL_CharSetIDToName(charSet->fCSID, encoding); - - fmi = nffbu_CreateFontMatchInfo(sUtility, fontName, charset, encoding, - weight, escapement, style, underline, strikeout, - resolutionX, resolutionY, - NULL); - - if (fmi == NULL) - { - // if we can't get an fmi, just bail - return NULL; - } - - // **** Is qd.thePort the right place to get the port from? - History_entry *he = SHIST_GetCurrent(&context->hist); - char *url = NULL; - - if (he != NULL) - url = he->address; - - renderingContext = GetCachedRenderingContext(qd.thePort); - webFont = nffbc_LookupFont(sBroker, renderingContext, fmi, url, NULL); - - if (webFont == NULL) - { - nffbu_LookupFailed(sUtility, context, renderingContext, fmi, NULL); - nffmi_release(fmi, NULL); - - return NULL; - } - - return new CWebFontReference(webFont, charSet, attr); -} - -CWebFontReference::CWebFontReference(WebFontHandle webFont, const CCharSet *charSet, const LO_TextAttr *attr) : - CFontReference(charSet, attr) -{ - fRenderingContext = GetCachedRenderingContext(qd.thePort); - fRenderableFont = nff_GetRenderableFont(webFont, fRenderingContext, fSize, NULL); - - nff_release(webFont, NULL); -} - -CWebFontReference::~CWebFontReference() -{ - nfrf_release(fRenderableFont, NULL); -} - -void CWebFontReference::Apply() -{ - if ( qd.thePort->txMode != fMode ) - ::TextMode( fMode ); -} - -void CWebFontReference::DrawText(int x, int y, char *text, int start, int end) -{ - nfrf_DrawText(fRenderableFont, fRenderingContext, x, y, 0, (jbyte*)&text[start], end - start + 1, NULL); -} - -short CWebFontReference::TextWidth(char *text, int firstByte, int byteCount) -{ - jint totalLength; - jint *charLocs; - - // **** Do we need to calculate the character count here? - charLocs = (jint *) XP_ALLOC(byteCount * sizeof(jint)); - - totalLength = nfrf_MeasureText(fRenderableFont, fRenderingContext, 0, (jbyte*)&text[firstByte], byteCount, charLocs, byteCount, NULL); - - XP_FREE(charLocs); - return (short) totalLength; -} - -void CWebFontReference::GetFontInfo(FontInfo *fontInfo) -{ - if (fIsGetFontInfoDirty) - { - fCachedFontInfoValues.ascent = nfrf_GetFontAscent(fRenderableFont, NULL); - fCachedFontInfoValues.descent = nfrf_GetFontDescent(fRenderableFont, NULL); - fCachedFontInfoValues.widMax = nfrf_GetMaxWidth(fRenderableFont, NULL); - - // **** Can we do better here? - fontInfo->leading = 0; - - fIsGetFontInfoDirty = false; - } - - *fontInfo = fCachedFontInfoValues; -} diff --git a/mozilla/cmd/macfe/gui/CFontReference.h b/mozilla/cmd/macfe/gui/CFontReference.h deleted file mode 100644 index 230c923f44a..00000000000 --- a/mozilla/cmd/macfe/gui/CFontReference.h +++ /dev/null @@ -1,117 +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. - */ - -#pragma once -/* - Font References - Classes for holding a native Macintosh font id or a Web Font handle. -*/ -#include "uprefd.h" -#include "xp_hash.h" -#include "lo_ele.h" - -#include "FontTypes.h" - -#include "UPropFontSwitcher.h" -#include "UFixedFontSwitcher.h" -#include "UUTF8TextHandler.h" - -typedef struct LO_TextAttr_struct LO_TextAttr; - -class CFontReference -{ -public: - CFontReference(const CCharSet *charSet, const LO_TextAttr *attr); - virtual ~CFontReference(); - virtual void DrawText(int x, int y, char *text, int start, int end) = 0; - virtual short TextWidth(char *text, int firstByte, int byteCount) = 0; - virtual void GetFontInfo(FontInfo *fontInfo) = 0; - virtual void Apply() = 0; - - short GetMode() {return fMode;} - void SetMode(short mode) {fMode = mode;} - - static CFontReference *GetFontReference(const CCharSet *charSet, LO_TextAttr *attr, MWContext *context, Boolean underlineLinks); - -protected: - - short fSize; - short fMode; - Boolean fIsGetFontInfoDirty; - FontInfo fCachedFontInfoValues; - -private: - virtual void SynchToPort(GrafPtr port) = 0; - static short GetScaledTextSize(short size, short attrSize); -}; - -class CNativeFontReference : public CFontReference -{ -public: - CNativeFontReference(short font, const CCharSet *charSet, const LO_TextAttr *attr, Boolean underlineLinks); - virtual ~CNativeFontReference(); - void DrawText(int x, int y, char *text, int start, int end); - short TextWidth(char *text, int firstByte, int byteCount); - short MeasureText(char *text, int firstByte, int byteCount, short* charLocs); - void GetFontInfo(FontInfo *fontInfo); - void Apply(); - - static CFontReference *LookupNativeFont(char *fontName, const CCharSet *charSet, const LO_TextAttr *attr, Boolean underlineLinks); - static CFontReference *LookupGenericFont(char *fontName, const CCharSet *charSet, const LO_TextAttr *attr, Boolean underlineLinks); - -private: - short fFont; - Style fStyle; - UFontSwitcher *fFontSwitcher; - UMultiFontTextHandler *fTextHandler; - - void SynchToPort(GrafPtr /*port*/) {}; -}; - -class CWebFontReference : public CFontReference -{ -public: - CWebFontReference(WebFontHandle webFont, const CCharSet *charSet, const LO_TextAttr *attr); - virtual ~CWebFontReference(); - void DrawText(int x, int y, char *text, int start, int end); - short TextWidth(char *text, int firstByte, int byteCount); - void GetFontInfo(FontInfo *fontInfo); - void Apply(); - - static CFontReference *LookupWebFont(char *fontName, const CCharSet *charSet, const LO_TextAttr *attr, MWContext *context, Boolean underlineLinks); - static void Init(); - static void Finish(); - static Boolean NeedToReload(MWContext *context) { return nffbu_WebfontsNeedReload(sUtility, context, NULL); }; - -private: - RenderingContextHandle fRenderingContext; - RenderableFontHandle fRenderableFont; - - static FontBrokerHandle sBroker; - static FontBrokerUtilityHandle sUtility; - - static char *sCatalogPath; - - static XP_HashTable sPortHash; - - void SynchToPort(GrafPtr port); - static uint32 PortHash(const void *port); - static int PortCompFunction(const void *port1, const void *port2); - static RenderingContextHandle GetCachedRenderingContext(GrafPtr port); -}; - diff --git a/mozilla/cmd/macfe/gui/CGAIconPopup.cp b/mozilla/cmd/macfe/gui/CGAIconPopup.cp deleted file mode 100644 index fdc731f67b4..00000000000 --- a/mozilla/cmd/macfe/gui/CGAIconPopup.cp +++ /dev/null @@ -1,198 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CGAIconPopup.h" - -#include -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -static const Int16 gsPopup_RightInset = 24; // Used to position the title rect -static const Int16 gsPopup_TitleInset = 8; // Apple specification -static const Int16 gsPopup_LabelOffset = 2; // Offset of label from popup - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Return the icon resource ID for the current title, 0 if none. Returns the actual - resource ID that can be used to access the icon using ::GetCIcon(). -======================================================================================*/ - -Int16 CGAIconPopup::GetTitleIconID(void) { - - Int16 iconID; - ::GetItemIcon(GetMacMenuH(), mValue, &iconID); - - return (iconID ? iconID + 256 : 0); -} - - -/*====================================================================================== - Refresh just the menu portion, not the title -======================================================================================*/ - -void CGAIconPopup::RefreshMenu(void) { - - if ( !IsVisible() || (GetSuperView() == nil) ) return; - - Rect refreshRect, superRevealed; - GetSuperView()->GetRevealedRect(superRevealed); - - CalcLocalPopupFrameRect(refreshRect); - ::InsetRect(&refreshRect, 0, 2); // Dont refresh shadows - refreshRect.right -= gsPopup_RightInset; - refreshRect.left += gsPopup_TitleInset; - - LocalToPortPoint(topLeft(refreshRect)); - LocalToPortPoint(botRight(refreshRect)); - - if ( ::SectRect(&refreshRect, &superRevealed, &refreshRect) ) { - InvalPortRect(&refreshRect); - } -} - - - -/*====================================================================================== - Get the title rect. Fix a bug in class that doesn't center text vertically. -======================================================================================*/ - -void CGAIconPopup::CalcTitleRect(Rect &outRect) { - - StTextState theTextState; - const Int16 bevelWidth = 2; - - UTextTraits::SetPortTextTraits(GetTextTraitsID()); - - FontInfo fInfo; - GetFontInfo(&fInfo); - Int16 textHeight = fInfo.ascent + fInfo.descent; - - CalcLocalPopupFrameRect(outRect); - ::InsetRect(&outRect, 0, bevelWidth); - outRect.right -= gsPopup_RightInset; - outRect.left += gsPopup_TitleInset; - - outRect.top += ((UGraphicsUtilities::RectHeight(outRect) - textHeight) / 2) - 1; - outRect.bottom = outRect.top + textHeight; - - if ( GetTitleIconID() ) { - outRect.left += cMenuIconWidth + cMenuIconTitleMargin; - } -} - - - -/*====================================================================================== - Get the label rect. Fix a bug in class that doesn't center text vertically. -======================================================================================*/ - -void CGAIconPopup::CalcLabelRect(Rect &outRect) { - - if ( HasLabel() ) { - StTextState theTextState; - const Int16 bevelWidth = 2; - - UTextTraits::SetPortTextTraits(GetTextTraitsID()); - - FontInfo fInfo; - GetFontInfo(&fInfo); - Int16 textHeight = fInfo.ascent + fInfo.descent; - - CalcLocalFrameRect(outRect); - outRect.right = outRect.left + (mLabelWidth - gsPopup_LabelOffset); - ::InsetRect(&outRect, 0, bevelWidth); - - outRect.top += ((UGraphicsUtilities::RectHeight(outRect) - textHeight) / 2) - 1; - outRect.bottom = outRect.top + textHeight; - } else { - outRect = gEmptyRect; - } -} - - - -/*====================================================================================== - Draw the popup title -======================================================================================*/ - -void CGAIconPopup::DrawPopupTitle(void) { - - LGAPopup::DrawPopupTitle(); - - Int16 iconID = GetTitleIconID(); - - if ( iconID != 0 ) { - - CIconHandle theIconH = ::GetCIcon(iconID); - - if ( theIconH != nil ) { - Rect iconRect; - LGAPopup::CalcTitleRect(iconRect); - - iconRect.right = iconRect.left + cMenuIconWidth; - iconRect.top = iconRect.top + ((iconRect.bottom - iconRect.top - cMenuIconHeight) / 2); - iconRect.bottom = iconRect.top + cMenuIconHeight; - - Int16 transform = ttNone; - - if ( IsEnabled() ) { - if ( IsHilited() ) { - transform = ttSelected; - } - } else { - transform = ttDisabled; - } - - ::PlotCIconHandle(&iconRect, ttNone, transform, theIconH); - - ::DisposeCIcon(theIconH); - } - } -} - - diff --git a/mozilla/cmd/macfe/gui/CGAIconPopup.h b/mozilla/cmd/macfe/gui/CGAIconPopup.h deleted file mode 100644 index 00541e2f042..00000000000 --- a/mozilla/cmd/macfe/gui/CGAIconPopup.h +++ /dev/null @@ -1,83 +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 __H_CGAIconPopup -#define __H_CGAIconPopup -#pragma once - -/*====================================================================================== - AUTHOR: Ted Morris - 07 NOV 96 - - DESCRIPTION: Implements a class for drawing a popup with associated 16x16 'cicn' - icons for each item. - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class CGAIconPopup : public LGAPopup { - -public: - - enum { class_ID = 'Gipu' }; - - enum { cMenuIconWidth = 16, cMenuIconHeight = 16, cMenuIconTitleMargin = 4, - cMenuIconType = 'cicn' }; - - CGAIconPopup(LStream *inStream) : - LGAPopup(inStream) { - } - - Int16 GetTitleIconID(void); - virtual void RefreshMenu(void); - -protected: - - virtual void CalcTitleRect(Rect &outRect); - virtual void CalcLabelRect(Rect &outRect); - virtual void DrawPopupTitle(void); -}; - - -#endif // __H_CGAIconPopup diff --git a/mozilla/cmd/macfe/gui/CGAStatusBar.cp b/mozilla/cmd/macfe/gui/CGAStatusBar.cp deleted file mode 100644 index 26b2acb488f..00000000000 --- a/mozilla/cmd/macfe/gui/CGAStatusBar.cp +++ /dev/null @@ -1,344 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CGAStatusBar.h" - -#include -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -CGAStatusBar::CGAStatusBar(LStream *inStream) : - LGABox(inStream), - mIndefiniteProgessPatH(nil) { - - mValue = eHiddenValue; - mHasBorder = true; - mBorderStyle = borderStyleGA_RecessedOneBorder; - mTitlePosition = titlePositionGA_None; - mCurIndefiniteIndex = 0; - mNextIndefiniteDraw = 0; - Assert_((mUserCon < 0) || ((mUserCon <= 100) && (mUserCon >= 0))); -} - - -/*====================================================================================== - Destructor. -======================================================================================*/ - -CGAStatusBar::~CGAStatusBar(void) { - - if ( mIndefiniteProgessPatH != nil ) { - ::DisposePixPat(mIndefiniteProgessPatH); - mIndefiniteProgessPatH = nil; - } -} - - -/*====================================================================================== - Get the status title. -======================================================================================*/ - -StringPtr CGAStatusBar::GetDescriptor(Str255 outDescriptor) const { - - return Inherited::GetDescriptor(outDescriptor); -} - - -/*====================================================================================== - Set the status title. -======================================================================================*/ - -void CGAStatusBar::SetDescriptor(ConstStr255Param inDescriptor) { - - if ( mTitle != inDescriptor ) { - if ( FocusExposed() ) { - Rect titleRect1, titleRect2; - CalcTitleRect(titleRect1); - mTitle = inDescriptor; - CalcTitleRect(titleRect2); - ::PenNormal(); - ApplyForeAndBackColors(); - if ( titleRect1.right > (titleRect2.right - 1) ) { - titleRect1.left = titleRect2.right - 1; - ::EraseRect(&titleRect1); - } - DrawBoxTitle(); - } else { - mTitle = inDescriptor; - } - } -} - - -/*====================================================================================== - Get the current progress value (0..100) or eIndefiniteValue. -======================================================================================*/ - -Int32 CGAStatusBar::GetValue(void) const { - - return mValue; -} - - -/*====================================================================================== - Set the current progress value (0..100) or eIndefiniteValue. -======================================================================================*/ - -void CGAStatusBar::SetValue(Int32 inValue) { - - if ( inValue == eIndefiniteValue ) { - if ( mNextIndefiniteDraw < LMGetTicks() ) { - if ( ++mCurIndefiniteIndex > eMaxIndefiniteIndex ) { - mCurIndefiniteIndex = 0; - } - } else { - mValue = inValue; - return; - } - } else if ( inValue != eHiddenValue ) { - if ( inValue < eMinValue ) { - inValue = eMinValue; - } else if ( inValue > eMaxValue ) { - inValue = eMaxValue; - } - if ( mValue == inValue ) return; - } else { - if ( mValue != inValue ) { - mValue = inValue; - Refresh(); - } - return; - } - - mValue = inValue; - if ( FocusExposed() ) DrawBoxBorder(); - if ( mValue == eIndefiniteValue ) mNextIndefiniteDraw = LMGetTicks() + 2; -} - - -/*====================================================================================== - Draw the b&w progress bar. -======================================================================================*/ - -void CGAStatusBar::DrawBoxTitle(void) { - - StTextState theTextState; - StColorPenState theColorPenState; - Rect titleRect; - CalcTitleRect(titleRect); - - UTextTraits::SetPortTextTraits(GetTextTraitsID()); - - Str255 boxTitle; - GetDescriptor(boxTitle); - - { - RGBColor textColor; - ::GetForeColor(&textColor); - ApplyForeAndBackColors(); - ::RGBForeColor(&textColor); - } - - StClipRgnState clipState(titleRect); - - UStringDrawing::DrawJustifiedString(boxTitle, titleRect, teJustCenter ); -} - - -/*====================================================================================== - Draw the b&w progress bar. -======================================================================================*/ - -void CGAStatusBar::DrawBlackAndWhiteBorder(const Rect &inBorderRect, - EGABorderStyle inBorderStyle) { - - #pragma unused(inBorderStyle) - - if ( mValue == eHiddenValue ) return; - - DrawProgressBar(inBorderRect, false); -} - - -/*====================================================================================== - Draw the color progress bar. -======================================================================================*/ - -void CGAStatusBar::DrawColorBorder(const Rect &inBorderRect, - EGABorderStyle inBorderStyle) { - - #pragma unused(inBorderStyle) - - if ( mValue == eHiddenValue ) return; - - Inherited::DrawColorBorder(inBorderRect, inBorderStyle); - - DrawProgressBar(inBorderRect, true); -} - - -/*====================================================================================== - Draw the progress bar. -======================================================================================*/ - -void CGAStatusBar::DrawProgressBar(const Rect &inBorderRect, Boolean inUseColor) { - - StColorPenState::Normalize(); - Rect drawRect = inBorderRect; - - ::InsetRect(&drawRect, 1, 1); - ::FrameRect(&drawRect); - ::InsetRect((Rect *) &drawRect, 1, 1); - - if ( mValue != eIndefiniteValue ) { - Int16 mid = drawRect.left + (((drawRect.right - drawRect.left) * mValue) / eMaxValue); - Int16 right = drawRect.right; - - drawRect.right = mid; - if ( inUseColor ) { - ::RGBForeColor(&UGAColorRamp::GetColor(11)); - } - ::PaintRect(&drawRect); - drawRect.right = right; - drawRect.left = mid; - if ( inUseColor ) { - ::RGBForeColor(&UGAColorRamp::GetColor(colorRamp_Purple1)); - ::PaintRect(&drawRect); - ::ForeColor(blackColor); - } else { - ::EraseRect(&drawRect); - } - } else { - if ( mIndefiniteProgessPatH == nil ) { - mIndefiniteProgessPatH = ::GetPixPat(mTextTraitsID); - } - if ( mIndefiniteProgessPatH != nil ) { - Point saveOrigin = topLeft(GetMacPort()->portRect); - ::SetOrigin(saveOrigin.h - mCurIndefiniteIndex, saveOrigin.v); - ::OffsetRgn(GetMacPort()->clipRgn, -mCurIndefiniteIndex, 0); - ::OffsetRect(&drawRect, -mCurIndefiniteIndex, 0); - ::PenPixPat(mIndefiniteProgessPatH); - ::PaintRect(&drawRect); - StColorPenState::Normalize(); - ::OffsetRgn(GetMacPort()->clipRgn, mCurIndefiniteIndex, 0); - ::SetOrigin(saveOrigin.h, saveOrigin.v); - } - } -} - - -/*====================================================================================== - Calculate the rectagle used for drawing the status bar. -======================================================================================*/ - -static const Int16 cStatusBarHeight = 12; -static const Int16 cStatusBarTitleMargin = 5; - -void CGAStatusBar::CalcBorderRect(Rect &outRect) { - - CalcLocalFrameRect(outRect); - - if ( mValue == eHiddenValue ) { - outRect.right = outRect.left; - outRect.bottom = outRect.top; - return; - } else if ( mUserCon < 0 ) { - outRect.left = outRect.right + mUserCon; - } else { - const Int32 width = outRect.right - outRect.left; - outRect.left = outRect.right - ((width * mUserCon) / 100L); - } - - const Int32 height = outRect.bottom - outRect.top; - outRect.top += (height - cStatusBarHeight) / 2; - outRect.bottom = outRect.top + cStatusBarHeight; -} - - -/*====================================================================================== - Nothing. -======================================================================================*/ - -void CGAStatusBar::CalcContentRect(Rect &outRect) { - - CalcLocalFrameRect(outRect); - ::SetRect(&outRect, outRect.left, outRect.top, outRect.left, outRect.top); -} - - -/*====================================================================================== - Calculate the rectangle for drawing the status text. -======================================================================================*/ - -void CGAStatusBar::CalcTitleRect(Rect &outRect) { - - CalcLocalFrameRect(outRect); - - Int16 txHeight, txWidth; - CalculateTitleHeightAndWidth(&txHeight, &txWidth); - - if ( mUserCon < 0 ) { - outRect.right += mUserCon; - } else { - const Int32 width = outRect.right - outRect.left; - outRect.right -= ((width * mUserCon) / 100L); - } - outRect.right -= cStatusBarTitleMargin; - - if ( outRect.right < outRect.left ) outRect.right = outRect.left; - if ( (outRect.right - outRect.left) > txWidth ) { - outRect.right = outRect.left + txWidth; - } -} - - diff --git a/mozilla/cmd/macfe/gui/CGAStatusBar.h b/mozilla/cmd/macfe/gui/CGAStatusBar.h deleted file mode 100644 index c1c9cbc4a8e..00000000000 --- a/mozilla/cmd/macfe/gui/CGAStatusBar.h +++ /dev/null @@ -1,110 +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 __H_CGAStatusBar -#define __H_CGAStatusBar -#pragma once - -/*====================================================================================== - AUTHOR: Ted Morris - 01 NOV 96 - - DESCRIPTION: Implements a class for drawing a status bar and associated status - text. - - If the mUserCon is negative, specifies the width of the status bar - in pixels. If positive, specifies a percentage (0..100) of the width - of the pane for the width of the status bar. - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class CGAStatusBar : protected LGABox { - -private: - - typedef LGABox Inherited; - - -public: - - enum { class_ID = 'Gbar' }; - - CGAStatusBar(LStream *inStream); - virtual ~CGAStatusBar(void); - - virtual StringPtr GetDescriptor(Str255 outDescriptor) const; - virtual void SetDescriptor(ConstStr255Param inDescriptor); - - virtual Int32 GetValue(void) const; - - enum { eIndefiniteValue = -1, eHiddenValue = -2, - eMaxValue = 100, eMinValue = 0, - eMaxIndefiniteIndex = 15 }; - virtual void SetValue(Int32 inValue); - -protected: - - virtual void DrawBoxTitle(void); - virtual void DrawColorBorder(const Rect &inBorderRect, - EGABorderStyle inBorderStyle); - virtual void DrawBlackAndWhiteBorder(const Rect &inBorderRect, - EGABorderStyle inBorderStyle); - void DrawProgressBar(const Rect &inBorderRect, Boolean inUseColor); - - - virtual void CalcBorderRect(Rect &outRect); - virtual void CalcContentRect(Rect &outRect); - virtual void CalcTitleRect(Rect &outRect); - - // Instance variables - - Int16 mValue; - Int16 mCurIndefiniteIndex; - PixPatHandle mIndefiniteProgessPatH; - UInt32 mNextIndefiniteDraw; -}; - - -#endif // __H_CGAStatusBar diff --git a/mozilla/cmd/macfe/gui/CGATabBox.cp b/mozilla/cmd/macfe/gui/CGATabBox.cp deleted file mode 100644 index 1d6623875c0..00000000000 --- a/mozilla/cmd/macfe/gui/CGATabBox.cp +++ /dev/null @@ -1,604 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CGATabBox.h" - -#include -#include -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - -typedef struct { - PaneIDT tabPaneID; // ID of the pane associated with the tab - PaneIDT latentCommanderID; // Last active commander ID, 0 if none -} TabLatentCommanderT; - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -static const Int16 cSelectedTabShiftH = 2; -static const Int16 cSelectedTabShiftV = 2; - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - -// CGATabBoxTab - -class CGATabBoxTab : public LGAPushButton { - -public: - - enum { class_ID = 'TbBt' }; - CGATabBoxTab(LStream *inStream) : - LGAPushButton(inStream), - mSelected(false) { - } - - void RefreshHiddenBottom(void); - -protected: - - virtual void DrawSelf(void); - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - virtual void BroadcastValueMessage(void); - - virtual void CalcTitleRect(Rect &outRect); - virtual void DrawButtonNormalColor(void); - - Boolean IsSelectedTab(void) { - return (((CGATabBox *) mSuperView)->GetCurrentTabID() == mPaneID); - } - - // Instance variables - - Boolean mSelected; -}; - - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Register PP classes associated with this tab box. -======================================================================================*/ - -void CGATabBox::RegisterTabBoxClasses(void) { - - RegisterClass_(CGATabBoxTab); - RegisterClass_(CGATabBox); -} - - -/*====================================================================================== - Constructor. -======================================================================================*/ - -CGATabBox::CGATabBox(LStream *inStream) : - LGABox_fixes(inStream), - LListener(), - LBroadcaster(), - mCurrentTabID(0), - mCurrentPaneID(0), - mTabLatentCommanders(sizeof(TabLatentCommanderT)) { - - mHasBorder = true; - mBorderStyle = borderStyleGA_EmbossedOneBorder; - mTitlePosition = titlePositionGA_None; - mTitle[0] = 0; -} - - -/*====================================================================================== - Set the currently selected tab. -======================================================================================*/ - -void CGATabBox::SetCurrentTabID(PaneIDT inTabID) { - - if ( mCurrentTabID == inTabID ) return; - Boolean updatePort = false; - - CGATabBoxTab *lastTab = nil, *newTab = nil; - LTabGroup *theTabGroup = nil; - - // Hide old view - - if ( mCurrentTabID != 0 ) { - lastTab = GetTab(mCurrentTabID); - if ( lastTab != nil ) { - TabBoxCanChangeT canChangeRec = { this, true }; - BroadcastMessage(msg_TabViewCanChange, &canChangeRec); - if ( canChangeRec.canChange ) { - if ( lastTab->GetValueMessage() != 0 ) { - LPane *thePane = FindPaneByID(lastTab->GetValueMessage()); - if ( thePane != nil ) { - theTabGroup = FindTabGroup(); - StoreLatentTabCommander(dynamic_cast(thePane)); - // Switch the window to the current commander so that a tab group - // doesn't swap commanders as they are hidden - if ( theTabGroup != nil ) { - LCommander::SwitchTarget(LWindow::FetchWindowObject(GetMacPort())); - } - thePane->Hide(); - } - } - lastTab->SetTextTraitsID(GetTextTraitsID() + 1); - lastTab->RefreshHiddenBottom(); - } else { - return; // Can't change - } - } - } - - mCurrentTabID = inTabID; - - if ( mCurrentTabID != 0 ) { - newTab = GetTab(mCurrentTabID); - if ( newTab != nil ) { - PaneIDT paneID = newTab->GetValueMessage(); - if ( paneID != 0 ) { - LPane *thePane = FindPaneByID(paneID); - if ( thePane != nil ) { - thePane->Show(); - if ( !RestoreLatentTabCommander(dynamic_cast(thePane)) && - (theTabGroup != nil) ) { - - //StEmptyVisRgn emptyRgn(GetMacPort()); // Hide any flicker - LCommander::SwitchTarget(theTabGroup); - } - } - } - newTab->SetTextTraitsID(GetTextTraitsID()); - newTab->RefreshHiddenBottom(); - BroadcastMessage(msg_TabViewChanged, this); - } - } - - if ( (lastTab != nil) || (newTab != nil) ) { - if ( lastTab != nil ) lastTab->Draw(nil); - if ( newTab != nil ) newTab->Draw(nil); - UpdatePort(); - } -} - - -/*====================================================================================== - Calculate the border rect, which will be offset by the bottom of the tabs. -======================================================================================*/ - -void CGATabBox::CalcBorderRect(Rect &outRect) { - - LGABox_fixes::CalcBorderRect(outRect); - - ::InsetRect(&outRect, 1, 1); // For border - - Rect tabRect; - CalcCurrentTabRect(tabRect); - - outRect.top = tabRect.bottom - 4; -} - - -/*====================================================================================== - Calculate the current tab rect in local coordinates. -======================================================================================*/ - -void CGATabBox::CalcCurrentTabRect(Rect &outRect) { - - Assert_(mCurrentTabID != 0); - - if ( mCurrentTabID ) { - CGATabBoxTab *theTab = GetTab(mCurrentTabID); - Assert_(theTab != nil); - if ( theTab != nil ) { - theTab->CalcPortFrameRect(outRect); - PortToLocalPoint(topLeft(outRect)); - PortToLocalPoint(botRight(outRect)); - } - } -} - - -/*====================================================================================== - Finish creating the tab box. -======================================================================================*/ - -void CGATabBox::FinishCreateSelf(void) { - - LGABox_fixes::FinishCreateSelf(); - - SetupTabs(); - - SetCurrentTabID(GetUserCon()); -} - - -/*====================================================================================== - Draw the box border. -======================================================================================*/ - -void CGATabBox::DrawBoxBorder(void) { - - StColorPenState::Normalize(); - - Rect borderRect; - CalcBorderRect(borderRect); - ::InsetRect(&borderRect, -1, -1); - - ::FrameRect(&borderRect); - - LGABox_fixes::DrawBoxBorder(); -} - - -/*====================================================================================== - Respond to tab messages. Only tabs will broadcast messages to this class, so that's - all we need to be concerned with. -======================================================================================*/ - -void CGATabBox::ListenToMessage(MessageT inMessage, void */*ioParam*/) { - - SetCurrentTabID((PaneIDT) inMessage); -} - - -/*====================================================================================== - Called from FinishCreateSelf() to setup the tabs for the view. -======================================================================================*/ - -void CGATabBox::SetupTabs(void) { - - // Loop through all subpanes to find the relevant tabs - - LArrayIterator iterator(mSubPanes, LArrayIterator::from_Start); - LPane *theSub; - CGATabBoxTab *theTab = nil; - Boolean foundTabs = false; - while ( iterator.Next(&theSub) ) { - theTab = dynamic_cast(theSub); - if ( theTab != nil ) { - if ( theTab->GetValueMessage() != 0 ) { - PaneIDT paneID = theTab->GetValueMessage(); - LPane *thePane = FindPaneByID(paneID); - if ( thePane != nil ) { - thePane->Hide(); - LView *theView = dynamic_cast(thePane); - if ( theView != nil ) { - // Initialize the last active commander for the tab's pane - TabLatentCommanderT rec = { paneID, 0 }; - mTabLatentCommanders.InsertItemsAt(1, LArray::index_Last, &rec); - } - } - } - theTab->SetTextTraitsID(GetTextTraitsID() + 1); - theTab->AddListener(this); - foundTabs = true; - } - } - Assert_(foundTabs); // Should have found at least one tab! -} - - -/*====================================================================================== - A new tab view has just been activated. Try to find the last active commander and - make it the currently active commander. Return true if a valid commander was actually - found and stored. -======================================================================================*/ - -Boolean CGATabBox::StoreLatentTabCommander(LView *inTabView) { - - if ( inTabView == nil ) return false; - - const Int32 count = mTabLatentCommanders.GetCount(); - if ( count < 1 ) return false; - - PaneIDT paneID = inTabView->GetPaneID(); - Int32 index = 1; - - // Try to find the tab pane id in our list - do { - if ( ((TabLatentCommanderT *) mTabLatentCommanders.GetItemPtr(index))->tabPaneID == paneID ) { - break; - } - } while ( ++index < count ); - - paneID = 0; - - if ( index < count ) { - LCommander *curTarget = LCommander::GetTarget(); - - if ( curTarget != nil ) { - LPane *thePane = dynamic_cast(curTarget); - if ( (thePane != nil) && thePane->IsEnabled() && - inTabView->FindPaneByID(thePane->GetPaneID()) ) { - - paneID = thePane->GetPaneID(); // We foud our commander! - } - } - - ((TabLatentCommanderT *) mTabLatentCommanders.GetItemPtr(index))->latentCommanderID = paneID; - } - - return (paneID != 0); -} - - -/*====================================================================================== - A new tab view has just been activated. Try to find the last active commander and - make it the currently active commander. Return true if a valid commander was actually - found and restored. -======================================================================================*/ - -Boolean CGATabBox::RestoreLatentTabCommander(LView *inTabView) { - - if ( inTabView == nil ) return false; - - Int32 count = mTabLatentCommanders.GetCount(); - if ( count < 1 ) return false; - - PaneIDT paneID = inTabView->GetPaneID(); - Int32 index = 1; - - // Try to find the tab pane id in our list - do { - if ( ((TabLatentCommanderT *) mTabLatentCommanders.GetItemPtr(index))->tabPaneID == paneID ) { - break; - } - } while ( ++index < count ); - - LCommander *theCommander = nil; - - if ( index < count ) { - PaneIDT latentCommanderID = ((TabLatentCommanderT *) mTabLatentCommanders.GetItemPtr(index))->latentCommanderID; - if ( latentCommanderID != 0 ) { - // We found our view, now see if there was an active commander - LPane *thePane = inTabView->FindPaneByID(latentCommanderID); - if ( (thePane != nil) && thePane->IsEnabled() ) { - theCommander = dynamic_cast(thePane); - if ( theCommander != nil ) { - LCommander::SwitchTarget(theCommander); - } - } - } - } - - return (theCommander != nil); -} - - -/*====================================================================================== - Get the specified tab. Return nil if the tab cannot be found. -======================================================================================*/ - -CGATabBoxTab *CGATabBox::GetTab(PaneIDT inID) { - - LArrayIterator iterator(mSubPanes, LArrayIterator::from_Start); - LPane *theSub; - while ( iterator.Next(&theSub) ) { - if ( theSub->GetPaneID() == inID ) { - CGATabBoxTab *theTab = dynamic_cast(theSub); - if ( theTab != nil ) return theTab; - } - } - - Assert_(false); // Should have found tab! - return nil; -} - - -/*====================================================================================== - Find the tab group for the window if it is currently active or nil if there is not - one. -======================================================================================*/ - -LTabGroup *CGATabBox::FindTabGroup(void) { - - LCommander *theCommander = LCommander::GetTarget(); - - if ( !theCommander ) return nil; - - LCommander *windowCommander = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - Assert_(windowCommander != nil); - - if ( windowCommander == theCommander ) return nil; - - LTabGroup *lastTabGroup = nil; - - do { - LTabGroup *tabGroup = dynamic_cast(theCommander); - if ( tabGroup != nil ) { - lastTabGroup = tabGroup; - } - } while ( ((theCommander = theCommander->GetSuperCommander()) != nil) && - (theCommander != windowCommander) ); - - return lastTabGroup; -} - - -#pragma mark - - -/*====================================================================================== - Refresh just the bottom portion of the button. -======================================================================================*/ - -void CGATabBoxTab::RefreshHiddenBottom(void) { - - Rect refreshRect; - if ( IsVisible() && CalcPortFrameRect(refreshRect) ) { - refreshRect.top = refreshRect.bottom - 5; - Rect superRevealed; - mSuperView->GetRevealedRect(superRevealed); - if ( ::SectRect(&refreshRect, &superRevealed, &refreshRect) ) { - InvalPortRect(&refreshRect); - } - } -} - - -/*====================================================================================== - Draw the button except for the bottom edge. -======================================================================================*/ - -void CGATabBoxTab::DrawSelf(void) { - - Rect clipRect; - CalcLocalFrameRect(clipRect); - - RgnHandle clipRgn = ::NewRgn(); - - if ( IsSelectedTab() ) { - RgnHandle tempRgn = ::NewRgn(); - clipRect.bottom -= 4; - ::RectRgn(clipRgn, &clipRect); - ::SetRect(&clipRect, clipRect.left + 1, clipRect.bottom, clipRect.right - 4, clipRect.bottom + 1); - ::RectRgn(tempRgn, &clipRect); - ::UnionRgn(clipRgn, tempRgn, clipRgn); - ::DisposeRgn(tempRgn); - } else { - clipRect.bottom -= 5; - ::RectRgn(clipRgn, &clipRect); - } - - StClipRgnState saveClip(clipRgn); - ::DisposeRgn(clipRgn); - - LGAPushButton::DrawSelf(); -} - - -/*====================================================================================== - Clicking atomatically selects. -======================================================================================*/ - -void CGATabBoxTab::ClickSelf(const SMouseDownEvent &/*inMouseDown*/) { - - BroadcastValueMessage(); -} - - -/*====================================================================================== - Broadcast pane id instead of value message. -======================================================================================*/ - -void CGATabBoxTab::BroadcastValueMessage(void) { - - MessageT valueMsg = mValueMessage; - BroadcastMessage(mPaneID, &mValueMessage); -} - - -/*====================================================================================== - Offset since hiding a portion of button. -======================================================================================*/ - -void CGATabBoxTab::CalcTitleRect(Rect &outRect) { - - LGAPushButton::CalcTitleRect(outRect); - - if ( IsSelectedTab() ) { - ::OffsetRect(&outRect, 0, -1); - } else { - ::OffsetRect(&outRect, 0, -2); - } -} - - -/*====================================================================================== - Draw darker if not selected. Direct copy/paste from LGAPushButton except for - IsSelectedTab() sections. -======================================================================================*/ - -void CGATabBoxTab::DrawButtonNormalColor(void) { - - StColorPenState theColorPenState; - theColorPenState.Normalize(); - - Boolean isSelected = IsSelectedTab(); - - Rect localFrame; - CalcLocalFrameRect ( localFrame ); - - ::RGBForeColor (&UGAColorRamp::GetBlackColor()); - ::FrameRoundRect (&localFrame, 8, 8); - - if ( isSelected ) { - ::RGBForeColor(&UGAColorRamp::GetColor(2)); - } else { - ::RGBForeColor(&UGAColorRamp::GetColor(3)); - } - ::InsetRect(&localFrame, 1, 1); - ::PaintRoundRect(&localFrame, 4, 4); - ::InsetRect(&localFrame, -1, -1); - - if ( isSelected ) { - ::RGBForeColor(&UGAColorRamp::GetWhiteColor()); - } else { - ::RGBForeColor(&UGAColorRamp::GetColor(1)); - } - UGraphicsUtilities::TopLeftSide (&localFrame, - 2, // TOP - 2, // LEFT - 3, // BOTTOM - 3 ); // RIGHT - UGraphicsUtilities::PaintColorPixel ( localFrame.left + 3, localFrame.top + 3, &UGAColorRamp::GetWhiteColor()); - UGraphicsUtilities::PaintColorPixel ( localFrame.left + 1, localFrame.top + 2, &UGAColorRamp::GetColor(4)); - UGraphicsUtilities::PaintColorPixel ( localFrame.left + 2, localFrame.top + 1, &UGAColorRamp::GetColor(4)); - UGraphicsUtilities::PaintColorPixel ( localFrame.left + 1, localFrame.bottom - 3, &UGAColorRamp::GetColor(4)); - UGraphicsUtilities::PaintColorPixel ( localFrame.left + 2, localFrame.bottom - 2, &UGAColorRamp::GetColor(4)); - UGraphicsUtilities::PaintColorPixel ( localFrame.right - 3, localFrame.top + 1, &UGAColorRamp::GetColor(4)); - UGraphicsUtilities::PaintColorPixel ( localFrame.right - 2, localFrame.top + 2, &UGAColorRamp::GetColor(4)); - - // ¥ SHADOW EDGES - ::RGBForeColor ( &UGAColorRamp::GetColor(8)); - ::MoveTo ( localFrame.left + 3, localFrame.bottom - 2 ); - ::LineTo ( localFrame.right - 3, localFrame.bottom - 2 ); - ::MoveTo ( localFrame.right - 2, localFrame.bottom - 3 ); - ::LineTo ( localFrame.right - 2, localFrame.top + 3 ); - ::RGBForeColor ( &UGAColorRamp::GetColor(5)); - UGraphicsUtilities::BottomRightSide ( &localFrame, - 3, // TOP - 3, // LEFT - 2, // BOTTOM - 2 ); // RIGHT - UGraphicsUtilities::PaintColorPixel ( localFrame.right - 3, localFrame.bottom - 3, &UGAColorRamp::GetColor(8)); - UGraphicsUtilities::PaintColorPixel ( localFrame.right - 4, localFrame.bottom - 4, &UGAColorRamp::GetColor(5)); -} - - diff --git a/mozilla/cmd/macfe/gui/CGATabBox.h b/mozilla/cmd/macfe/gui/CGATabBox.h deleted file mode 100644 index 24fe133218e..00000000000 --- a/mozilla/cmd/macfe/gui/CGATabBox.h +++ /dev/null @@ -1,131 +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 __H_CGATabBox -#define __H_CGATabBox -#pragma once - -/*====================================================================================== - AUTHOR: Ted Morris - 18 NOV 96 - - DESCRIPTION: Implements a view displaying tabbed panes. - - The user con is used to specify the initial tab in Constructor. - The GetTextTraitsID() specifies the font for a selected tab, - GetTextTraitsID() + 1 for an unselected tab. - - The message value of the tabs (CGATabBoxTab) in this view are - used to specified the PaneIDT for the pane that is displayed - when the tab is clicked, or 0 if no pane is to be displayed. - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "LGABox_fixes.h" - -class CGATabBoxTab; -class CGATabBox; -class LTabGroup; - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - -// Message structures - -typedef struct { - CGATabBox *box; // The view - Boolean canChange; // Initially set to true, set to false if cannot change -} TabBoxCanChangeT; - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class CGATabBox : public LGABox_fixes, - protected LListener, - protected LBroadcaster { - -public: - // Broadcast messages - - enum { - msg_TabViewCanChange = 'CnCh' // TabBoxCanChangeT *, tab view is about - // to change, return true if this is - // alright - , msg_TabViewChanged = 'TvCh' // this, the current view was just - // changed but is not yet visibly updated, - // react as necessary - }; - - enum { class_ID = 'TbOx' }; - - static void RegisterTabBoxClasses(void); - - CGATabBox(LStream *inStream); - - PaneIDT GetCurrentTabID(void) { - return mCurrentTabID; - } - PaneIDT GetCurrentViewID(void) { - return mCurrentPaneID; - } - void SetCurrentTabID(PaneIDT inTabID); - - virtual void CalcBorderRect(Rect &outRect); - -protected: - - virtual void FinishCreateSelf(void); - virtual void DrawBoxBorder(void); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - void SetupTabs(void); - Boolean StoreLatentTabCommander(LView *inTabView); - Boolean RestoreLatentTabCommander(LView *inTabView); - void CalcCurrentTabRect(Rect &outRect); - CGATabBoxTab *GetTab(PaneIDT inID); - LTabGroup *FindTabGroup(void); - - // Instance variables - - PaneIDT mCurrentTabID; // Currently selected tab - PaneIDT mCurrentPaneID; // Currently displayed pane - LArray mTabLatentCommanders; // Latent commanders for each tab -}; - - -#endif // __H_CGATabBox - diff --git a/mozilla/cmd/macfe/gui/CGuidePopupMenu.cp b/mozilla/cmd/macfe/gui/CGuidePopupMenu.cp deleted file mode 100644 index 2e14e2fdb12..00000000000 --- a/mozilla/cmd/macfe/gui/CGuidePopupMenu.cp +++ /dev/null @@ -1,253 +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. - */ - -// =========================================================================== -// CGuidePopupMenu.cp -// =========================================================================== - -#include "CGuidePopupMenu.h" - -#include - -#include "prefapi.h" -#include "CApplicationEventAttachment.h" -#include "uapp.h" -#include "CAutoPtrXP.h" - -// --------------------------------------------------------------------------- -// ¥ [static member data] -// --------------------------------------------------------------------------- - -CAutoPtr CGuidePopupMenu::sMenu; -Boolean CGuidePopupMenu::sOwnsMenu = true; -Boolean CGuidePopupMenu::sMenuIsSetup = false; -vector CGuidePopupMenu::sURLs; - -// --------------------------------------------------------------------------- -// ¥ CGuidePopupMenu -// --------------------------------------------------------------------------- - -CGuidePopupMenu::CGuidePopupMenu( - LStream* inStream) - - : super(inStream) -{ -} - -// --------------------------------------------------------------------------- -// ¥ ~CGuidePopupMenu -// --------------------------------------------------------------------------- - -CGuidePopupMenu::~CGuidePopupMenu() -{ -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ FinishCreateSelf -// --------------------------------------------------------------------------- - -void -CGuidePopupMenu::FinishCreateSelf() -{ - super::FinishCreateSelf(); - - SetupMenu(); -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ SetupMenu -// --------------------------------------------------------------------------- - -void -CGuidePopupMenu::SetupMenu() -{ - ThrowIfNil_(GetMenu()); - ThrowIfNil_(GetMenu()->GetMacMenuH()); - - if (!sMenuIsSetup) - { - // Populate the URL vector with the toolbar places items using - // the javascript preferences mechanism - - for (int i = 0, rc = PREF_NOERROR; rc == PREF_NOERROR; i++) - { - CAutoPtrXP label; - CAutoPtrXP url; - char* tempLabel = 0; - char* tempURL = 0; - - rc = PREF_CopyIndexConfigString("toolbar.places.item", i, "label", &tempLabel); - label.reset(tempLabel); - - if (rc == PREF_NOERROR) - { - PREF_CopyIndexConfigString("toolbar.places.item", i, "url", &tempURL); - url.reset(tempURL); - - CtoPstr(label.get()); - - // Insert a "blank" item first... - - GetMenu()->InsertCommand("\p ", cmd_Nothing, i); - - // Then change it. We do this so that no interpretation of metacharacters will occur. - - ::SetMenuItemText(GetMenu()->GetMacMenuH(), i + 1, (StringPtr)label.get()); - - sURLs.push_back(url.get()); - } - } - - sMenuIsSetup = true; - } -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ GetMenu -// --------------------------------------------------------------------------- - -LMenu* -CGuidePopupMenu::GetMenu() const -{ - return sMenu.get(); - -} - -// --------------------------------------------------------------------------- -// ¥ OwnsMenu -// --------------------------------------------------------------------------- - -Boolean -CGuidePopupMenu::OwnsMenu() const -{ - return sOwnsMenu; - -} - -// --------------------------------------------------------------------------- -// ¥ SetMenu -// --------------------------------------------------------------------------- - -void -CGuidePopupMenu::SetMenu(LMenu* inMenu) -{ - ThrowIfNot_(GetMenu() == nil); - ThrowIfNot_(inMenu == nil); - - sMenu.reset(nil); -} - -// --------------------------------------------------------------------------- -// ¥ AdoptMenu -// --------------------------------------------------------------------------- - -void -CGuidePopupMenu::AdoptMenu( - LMenu* inMenuToAdopt) -{ - ThrowIfNot_(GetMenu() == nil); - - EliminatePreviousMenu(); - - sMenu.reset(inMenuToAdopt); - sOwnsMenu = true; -} - -// --------------------------------------------------------------------------- -// ¥ MakeNewMenu -// --------------------------------------------------------------------------- -// We are caching the menu in a static CAutoPtr. So we guard instantiations -// and only allow one. - -void -CGuidePopupMenu::MakeNewMenu() -{ - if (!GetMenu()) - { - super::MakeNewMenu(); - } -} - -// --------------------------------------------------------------------------- -// ¥ EliminatePreviousMenu -// --------------------------------------------------------------------------- -// This is intentionally empty. The lifetime of the menu is controlled by -// the static CAutoPtr. - -void -CGuidePopupMenu::EliminatePreviousMenu() -{ -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ GetItem -// --------------------------------------------------------------------------- - -short -CGuidePopupMenu::GetItem(const string& inURL) const -{ - short item = 0; - - vector::const_iterator theItem = find(sURLs.begin(), sURLs.end(), inURL.c_str()); - - if (theItem != sURLs.end()) - { - item = (theItem - sURLs.begin()) + 1; - } - - return item; -} - -// --------------------------------------------------------------------------- -// ¥ GetURL -// --------------------------------------------------------------------------- - -string -CGuidePopupMenu::GetURL(short item) const -{ - ThrowIfNot_(item >= 0 && item <= sURLs.size() - 1); - - return sURLs[item]; -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ HandleNewValue -// --------------------------------------------------------------------------- - -Boolean -CGuidePopupMenu::HandleNewValue(Int32 inNewValue) -{ - if (inNewValue) - { - CFrontApp& theApp = dynamic_cast(CApplicationEventAttachment::GetApplication()); - - theApp.DoGetURL(GetURL(inNewValue - 1).c_str()); - } - - return true; -} diff --git a/mozilla/cmd/macfe/gui/CGuidePopupMenu.h b/mozilla/cmd/macfe/gui/CGuidePopupMenu.h deleted file mode 100644 index 994924699aa..00000000000 --- a/mozilla/cmd/macfe/gui/CGuidePopupMenu.h +++ /dev/null @@ -1,72 +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. - */ - -// =========================================================================== -// CGuidePopupMenu.h -// =========================================================================== - -#ifndef CGuidePopupMenu_H -#define CGuidePopupMenu_H -#pragma once - -// Includes - -#include "CPatternButtonPopup.h" - -#include -#include - -#include "CAutoPtr.h" - -// Class declaration - -class CGuidePopupMenu : public CPatternButtonPopup -{ -public: - enum { class_ID = 'PbGp' }; - - typedef CPatternButtonPopup super; - - CGuidePopupMenu(LStream* inStream); - ~CGuidePopupMenu(); - - short GetItem(const string& inURL) const; - string GetURL(short item) const; - - LMenu* GetMenu() const; - void SetMenu(LMenu* inMenu); - void AdoptMenu(LMenu* inMenuToAdopt); - Boolean OwnsMenu() const; - -protected: - void MakeNewMenu(); - void EliminatePreviousMenu(); - void SetupMenu(); - - void FinishCreateSelf(); - - Boolean HandleNewValue(Int32 inNewValue); - - static CAutoPtr sMenu; - static Boolean sOwnsMenu; - static Boolean sMenuIsSetup; - static vector sURLs; -}; - - -#endif diff --git a/mozilla/cmd/macfe/gui/CHTMLClickRecord.cp b/mozilla/cmd/macfe/gui/CHTMLClickRecord.cp deleted file mode 100644 index ea6ad05df60..00000000000 --- a/mozilla/cmd/macfe/gui/CHTMLClickRecord.cp +++ /dev/null @@ -1,323 +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. - */ - -// CHTMLClickRecord.cp - -#include "CHTMLClickRecord.h" -#include "CNSContext.h" -#include "CContextMenuAttachment.h" -#include "CApplicationEventAttachment.h" - -#include "layers.h" -#include "mimages.h" -#include "proto.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CHTMLClickRecord::CHTMLClickRecord( - Point inLocalWhere, - const SPoint32& inImageWhere, - CNSContext* inContext, - LO_Element* inElementelement, - CL_Layer* inLayer) - : - mLocalWhere(inLocalWhere), - mImageWhere(inImageWhere), - mElement(inElementelement), - mAnchorData(NULL), - mContext(inContext), - mLayer(inLayer), - mClickKind(eWaiting), - mClickIsInSelection(false) -{ - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Figures out everything (anchors, click kind) about the current cursor position -// called only once -- this is completely horrible - -void CHTMLClickRecord::Recalc(void) -{ - if (mElement == NULL) - { - mClickKind = eNone; - return; - } - - switch (mElement->type) - { - case LO_IMAGE: - mClickKind = CalcImageClick(); - break; - - case LO_TEXT: - mClickKind = CalcTextClick(); - break; - - case LO_EDGE: - mClickKind = CalcEdgeClick(); - break; - - default: - mClickKind = eNone; - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -EClickKind CHTMLClickRecord::CalcImageClick(void) -{ - EClickKind theKind; - - // Get the image URL - PA_LOCK(mImageURL, char *, (char*)mElement->lo_image.image_url); - PA_UNLOCK(loImage->image_url); - - // find with layer coordinates (mImageWhere) not local coordinates - theKind = FindImagePart ( *mContext, &mElement->lo_image, &mImageWhere, - &mClickURL, &mWindowTarget, mAnchorData ); - - // is this image in the selection? ¥¥¥ THIS DOESN'T WORK because layout doesn't - // mark images as in the selection...one day... - //mClickIsInSelection = (mElement->lo_image.image_attr->attrmask & LO_ELE_SELECTED) != 0; - - return theKind; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -EClickKind CHTMLClickRecord::CalcTextClick(void) -{ - EClickKind theKind = eNone; - if (mElement->lo_text.anchor_href) - { - theKind = eTextAnchor; - PA_LOCK(mClickURL, char*, (char*)mElement->lo_text.anchor_href->anchor); - PA_UNLOCK(mElement->lo_text.anchor_href->anchor); - - PA_LOCK(mWindowTarget, char *,(char*)mElement->lo_text.anchor_href->target); - PA_UNLOCK(mElement->lo_text.anchor_href->target); - } - - // is this click in the selection? - mClickIsInSelection = (mElement->lo_text.ele_attrmask & LO_ELE_SELECTED) != 0; - - return theKind; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -EClickKind CHTMLClickRecord::CalcEdgeClick(void) -{ - EClickKind theKind = eNone; - if (mElement->lo_edge.movable) - { - theKind = eEdge; - mIsVerticalEdge = mElement->lo_edge.is_vertical; - mEdgeLowerBound = mElement->lo_edge.left_top_bound; - mEdgeUpperBound = mElement->lo_edge.right_bottom_bound; - } - - return theKind; -} - -Boolean CHTMLClickRecord::IsClickOnAnchor(void) const -{ - return ((mClickKind != eNone) && (mClickKind != eEdge)); -} - -Boolean CHTMLClickRecord::IsClickOnEdge(void) const -{ - return (mClickKind == eEdge); -} - - -#if 0 - -void CClickRecord::ResetNamedWindow() -{ - fWindowTarget = ""; -} - -#endif - - - -// Pixels hang below their points, and thus the pixels equal to -// the top/left points are inside, but equal to the bottom/right -// of the bounding box are outside. - -Boolean CHTMLClickRecord::PixelReallyInElement( - const SPoint32& inImagePoint, - LO_Element* inElement) -{ - // account for image border - Int32 borderWidth = 0; - - if (inElement->type == LO_IMAGE) - borderWidth = inElement->lo_image.border_width; - - Int32 realX = inElement->lo_any.x + inElement->lo_any.x_offset; - Int32 realY = inElement->lo_any.y + inElement->lo_any.y_offset; - return - realY <= inImagePoint.v - && inImagePoint.v < (realY + inElement->lo_any.height + (2 * borderWidth)) - && realX <= inImagePoint.h - && inImagePoint.h < (realX + inElement->lo_any.width + (2 * borderWidth)); -} - -//----------------------------------- -EClickState CHTMLClickRecord::WaitForMouseAction( - const SMouseDownEvent& inMouseDown, - LAttachable* inAttachable, - Int32 inDelay, - Boolean inExecuteContextMenuAttachment) -//----------------------------------- -{ - // ¥ The new way. Give a context menu attachment a chance to - // execute. If this returns true ("execute host"), there is no attachment, - // so do things the old way. If it returns false, assume the popup has been - // handled. This can go away if the browser folkies decide to use - // the attachment mechanism. - - CContextMenuAttachment::SExecuteParams params; - params.inMouseDown = &inMouseDown; - params.outResult = eMouseUndefined; - if (inExecuteContextMenuAttachment) - { - inAttachable->ExecuteAttachments( - CContextMenuAttachment::msg_ContextMenu, - (void*)¶ms); - } - if (params.outResult != eMouseUndefined) - return (EClickState)params.outResult; - - // ¥ The old way. - return WaitForMouseAction( - inMouseDown.whereLocal, - inMouseDown.macEvent.when, - inDelay); -} // CHTMLClickRecord::WaitForMouseAction - -//----------------------------------- -EClickState CHTMLClickRecord::WaitForMouseAction( - const Point& inInitialPoint, - Int32 inWhen, - Int32 inDelay) -//----------------------------------- -{ - if (CApplicationEventAttachment::CurrentEventHasModifiers(controlKey)) - { - return eMouseTimeout; - } - - // Spin on mouse down and wait for either the user to start - // dragging or for the popup delay to expire or for mouse up - // (in which case we just fall through) - while (::StillDown()) - { - Point theCurrentPoint; - ::GetMouse(&theCurrentPoint); - - if ((abs(theCurrentPoint.h - inInitialPoint.h) >= kMouseHysteresis) || - (abs(theCurrentPoint.v - inInitialPoint.v) >= kMouseHysteresis)) - return eMouseDragging; - - Int32 now = ::TickCount(); - - if (abs( now - inWhen ) > inDelay) - return eMouseTimeout; - } - - return eMouseUpEarly; -} // CHTMLClickRecord::WaitForMouseAction - -//----------------------------------- -void CHTMLClickRecord::CalculatePosition() -// Snarfed from mclick.cp -// Figures out everything (anchors, click kind) about the current cursor position -// called only once -- this is completely horrible -// -// Figure all this out even if the click is in the selection because we'll still -// need it if the selection click isn't a drag. -//----------------------------------- -{ - if ( mClickKind != eWaiting ) - return; - - if ( !mElement ) - { - mClickKind = eNone; - return; - } - - if ( mElement->type == LO_IMAGE ) - { - // ¥ click in the image. Complicated case: - mClickKind = FindImagePart(*mContext, &mElement->lo_image, &mImageWhere, &mImageURL, &mWindowTarget, mAnchorData); - } - else if ( mElement->type == LO_TEXT && mElement->lo_text.anchor_href ) - { - if ( mElement->lo_text.anchor_href ) - { - mClickKind = eTextAnchor; - PA_LOCK( mClickURL, char*, (char*)mElement->lo_text.anchor_href->anchor ); - PA_UNLOCK( mElement->lo_text.anchor_href->anchor ); - PA_LOCK( mWindowTarget, char *,(char*)mElement->lo_text.anchor_href->target ); - PA_UNLOCK( mElement->lo_text.anchor_href->target ); - } - else - mClickKind = eNone; - } - else if ( mElement->type == LO_EDGE && mElement->lo_edge.movable ) - { - mClickKind = eEdge; - mIsVerticalEdge = mElement->lo_edge.is_vertical; - mEdgeLowerBound = mElement->lo_edge.left_top_bound; - mEdgeUpperBound = mElement->lo_edge.right_bottom_bound; - } - else - mClickKind = eNone; -} - - -Boolean CHTMLClickRecord::IsAnchor() -{ - CalculatePosition(); - return ((mClickKind != eNone) && (mClickKind != eEdge)); -} - -Boolean CHTMLClickRecord::IsEdge() -{ - CalculatePosition(); - return (mClickKind == eEdge); -} - - diff --git a/mozilla/cmd/macfe/gui/CHTMLClickRecord.h b/mozilla/cmd/macfe/gui/CHTMLClickRecord.h deleted file mode 100644 index cb781bc8680..00000000000 --- a/mozilla/cmd/macfe/gui/CHTMLClickRecord.h +++ /dev/null @@ -1,112 +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. - */ - -// CHTMLClickRecord.h - -#pragma once - -#include "lo_ele.h" -#include "cstring.h" -#include "Netscape_Constants.h" - -class CNSContext; -class CHTMLView; -struct SMouseDownEvent; - -class CHTMLClickRecord -{ - friend class CHTMLView; - friend class CBrowserView; - friend class CEditView; - - public: - - CHTMLClickRecord( - Point inLocalWhere, - const SPoint32& inImageWhere, - CNSContext* inContext, - LO_Element* inElementelement, - CL_Layer* inLayer = NULL); - - void Recalc(void); - - - static Boolean PixelReallyInElement( - const SPoint32& inImagePoint, - LO_Element* inElement); - - static EClickState WaitForMouseAction( - const Point& inInitialPoint, - Int32 inWhen, - Int32 inDelay); - static EClickState WaitForMouseAction( - const SMouseDownEvent& inMouseDown, - LAttachable* inAttachable, - Int32 inDelay, - Boolean inExecuteContextMenuAttachment = true); - // This version allows a CContextMenuAttachment to work. - - Boolean IsClickOnAnchor(void) const; - Boolean IsClickOnEdge(void) const; - Boolean IsClickOnSelection(void) const { return mClickIsInSelection; }; - - const char* GetClickURL() const { return (const char*)mClickURL; } - - protected: - - EClickKind CalcImageClick(void); - EClickKind CalcTextClick(void); - EClickKind CalcEdgeClick(void); - - Point mLocalWhere; - SPoint32 mImageWhere; - - LO_Element* mElement; - LO_AnchorData* mAnchorData; - CNSContext* mContext; - CL_Layer* mLayer; - EClickKind mClickKind; - - Boolean mClickIsInSelection; // true if mElement is selected - - cstring mClickURL; - cstring mImageURL; - cstring mWindowTarget; - - // Click in Edge members - Boolean mIsVerticalEdge; // If we are dragging verticaly - Int32 mEdgeUpperBound; // top and bottom (if vertical) - Int32 mEdgeLowerBound; // or left and right (if horizontal) - - -// ¥¥ access - Boolean IsAnchor(); // The key routine, initializes all the fields bellow - Boolean IsEdge(); - void ResetNamedWindow(); // No named windows here -// ¥¥ variables - void CalculatePosition(); // Initializes all the variables - - public: - Boolean IsVerticalEdge(void) { return mIsVerticalEdge; }; - LO_Element* GetLayoutElement(void) { return mElement; }; - SPoint32 GetImageWhere(void) { return mImageWhere; }; - CL_Layer* GetLayer(void) { return mLayer; }; - -}; - - diff --git a/mozilla/cmd/macfe/gui/CHTMLView.cp b/mozilla/cmd/macfe/gui/CHTMLView.cp deleted file mode 100644 index ab66b791725..00000000000 --- a/mozilla/cmd/macfe/gui/CHTMLView.cp +++ /dev/null @@ -1,7481 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CHTMLView.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CHTMLView.h" - - -#include "CStLayerOriginSetter.h" - -#include -#include - -#include "CHTMLClickRecord.h" -#include "BookmarksFile.h" -#include "CBrowserContext.h" -#include "CBrowserWindow.h" -#include "CURLDispatcher.h" -#include "UFormElementFactory.h" -#include "RandomFrontEndCrap.h" -#include "CDrawable.h" -#include "CMochaHacks.h" // this includes libevent.h -#include "CHyperScroller.h" -#include "UGraphicGizmos.h" -#include "CContextMenuAttachment.h" -#include "CSharedPatternWorld.h" -#include "CApplicationEventAttachment.h" -#include "CViewUtils.h" -#include "CTargetFramer.h" -#include "uapp.h" - -#include "libimg.h" -//#include "allxpstr.h" THE DATA DEFINITION MOVED TO StringLibPPC -#include "xlate.h" -#include "xp_rect.h" -#include "xp_core.h" - -#include "layers.h" -#include "nppriv.h" - -#include "resgui.h" -#include "macgui.h" -#include "mimages.h" -#include "mplugin.h" - -#if defined (JAVA) -#include "mjava.h" -#endif /* defined (JAVA) */ - -#include "mforms.h" -#include "mkutils.h" - -#include "libi18n.h" - -#include "prefapi.h" -#include "secnav.h" - -extern "C" { -#include "typedefs_md.h" - -#if defined (JAVA) -#include "native.h" -#include "sun_awt_macos_MComponentPeer.h" -#include "java_awt_Component.h" -#include "interpreter.h" -#include "exceptions.h" -#include "prlog.h" -#endif /* defined (JAVA) */ - -#undef __cplusplus -#define IMPLEMENT_netscape_applet_MozillaAppletContext -#include "n_applet_MozillaAppletContext.h" -// #include "mdmacmem.h" -#include "java.h" -#include "jri.h" -#include "lj.h" -} - -#if defined (JAVA) -#include "MToolkit.h" -#include "MFramePeer.h" -#endif /* defined (JAVA) */ - -#include "mprint.h" // 97/01/24 jrm -#include "ufilemgr.h" // 96-12-16 deeje -#include "uerrmgr.h" -#include "CBookmarksAttachment.h" -#include "Drag.h" -#include "macutil.h" -#include "UStdDialogs.h" -#include "findw.h" -#include "CPaneEnabler.h" -#include "msgcom.h" // for MSG_MailDocument - -#include -#include -#include -#include - -const Int16 FocusBox_Size = 3; - -const Int16 TableBorder_TintLevel = 20000; - -const ResIDT cPaulsMiscStrListID = 16010; -const Int16 cSendPageIndex = 4; -const Int16 cSendFrameIndex = 5; - - -// Utility function for table borders -Uint16 AddWithoutOverflow(Uint16 base, Uint16 addition); -Uint16 SubWithoutUnderflow(Uint16 base, Uint16 difference); -void ComputeBevelColor(Boolean inRaised, RGBColor inBaseColor, RGBColor& outBevelColor); - -static void MochaFocusCallback(MWContext * pContext, LO_Element * lo_element, int32 lType, void * whatever, ETEventStatus status); - -Boolean HasEventHandler(MWContext *context, uint32 events); - -/* returns true if any of the events specified has a handler in the context and its parents. */ -Boolean HasEventHandler(MWContext *context, uint32 events) -{ - if (context == NULL) return false; - if (context->event_bit & events) - return true; - if (context->grid_parent) - return HasEventHandler(context->grid_parent, events); - return false; -} - -void SafeSetCursor(ResIDT inCursorID) -{ - CursPtr cursorPtr; - CursHandle cursorHandle; - - cursorHandle = ::GetCursor(inCursorID); - if (cursorHandle != NULL) { - cursorPtr = *cursorHandle; - } - else { - cursorPtr = &UQDGlobals::GetQDGlobals()->arrow; - } - - ::SetCursor(cursorPtr); -} - -UInt32 CHTMLView::sLastFormKeyPressDispatchTime = 0; // to prevent infinite event dispatching loop -Boolean CHTMLView::sCachedAlwaysLoadImages = false; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CHTMLView::CHTMLView(LStream* inStream) - : LView(inStream) - , LDragAndDrop(GetMacPort(), this) - , mContext(nil) - , mSuperHTMLView(nil) - , mCompositor(nil) - , mPendingDocDimension_IsValid(false) - , mCurrentClickRecord(nil) - , mDragElement(nil) - , mPatternWorld(nil) - , mNeedToRepaginate(false) - , mDontAddGridEdgeToList(false) - , mLoadingURL(false) - , mStopEnablerHackExecuted(false) - , mInFocusCallAlready(false) - , mDragSelection(false) - , mFontScaling(eDefaultFontScaling) - , mTimerURLString(nil) - , mTimerURLReloadPolicy(NET_SUPER_RELOAD) - , mTimerURLFireTime(0) -{ - - // FIX ME: Use C++. I.e., use mem-initializers where possible (as above) - mNoBorder = false; - mCachedPort = NULL; - mDefaultScrollMode = LO_SCROLL_AUTO; - mScrollMode = mDefaultScrollMode; - mHasGridCells = false; - mShowFocus = false; - mElemBaseModel = NULL; - mBackgroundImage = NULL; - mEraseBackground = TRUE; - memset(&mBackgroundColor, 0xFF, sizeof(mBackgroundColor)); // white - - mCompositor = NULL; - mLayerClip = NULL; - ::SetEmptyRgn(mSaveLayerClip); - - mSendDataUPP = NewDragSendDataProc(LDropArea::HandleDragSendData); - Assert_(mSendDataUPP != NULL); - -// FIX ME!!! the scroller dependency needs to be removed - mScroller = NULL; - - mOffscreenDrawable = NULL; - mOnscreenDrawable = NULL; - mCurrentDrawable = NULL; - mWaitMouseUp = false; - - mLayerOrigin.h = mLayerOrigin.v = 0; - - RegisterCallBackCalls(); - - // Sets sCachedAlwaysLoadImages for the first time - PrefInvalidateCachedPreference("general.always_load_images", (void *)this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CHTMLView::~CHTMLView() -{ - if (!GetSuperHTMLView()) - { - UnregisterCallBackCalls(); - } - if (mPatternWorld) - mPatternWorld->RemoveUser(this); - - if (mSendDataUPP != NULL) - DisposeRoutineDescriptor(mSendDataUPP); - - if ( mOnscreenDrawable != NULL ) - mOnscreenDrawable->SetParent ( NULL ); - - - //mScroller = NULL; // do we need this? - - SetContext(NULL); - //CL_DestroyCompositor(mCompositor); - // brade: check for NULL in case compositor wasn't created yet - if ( mCompositor ) - mCompositor->RemoveUser(this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::FinishCreateSelf(void) -{ - LView::FinishCreateSelf(); - - mCachedPort = GetMacPort(); - Assert_(mCachedPort != NULL); - - // ¥¥¥ Hack, how else do we do this though? - // Main view or the frames - - mScroller = dynamic_cast(mSuperView); // - jrm - - SDimension16 theFrameSize; - GetFrameSize(theFrameSize); - - /* create our onscreen drawable that will route drawable method calls from the compositor */ - /* to this view */ - mOnscreenDrawable = new CRouterDrawable(); - if ( mOnscreenDrawable != NULL ) - { - // send all onscreen drawable method calls this way - mOnscreenDrawable->SetParent ( this ); - - CL_Drawable * theDrawable = CL_NewDrawable(theFrameSize.width, theFrameSize.height, CL_WINDOW, - &mfe_drawable_vtable, (void *) mOnscreenDrawable); - - if (theDrawable != NULL) - { - CL_Drawable* theOffscreen = NULL; - - // Create our offscreen drawable. If it fails for whatever reason, we don't really care - // as we'll just always be onscreen - mOffscreenDrawable = COffscreenDrawable::AllocateOffscreen(); - if ( mOffscreenDrawable != NULL ) - { - /* have the offscreen defer all layers calls to us */ - mOffscreenDrawable->SetParent ( this ); - - theOffscreen = CL_NewDrawable(theFrameSize.width, theFrameSize.height, CL_BACKING_STORE, - &mfe_drawable_vtable, (void *) mOffscreenDrawable); - } - - // now create our compositor - CL_Compositor* c = CL_NewCompositor(theDrawable, theOffscreen, 0, 0, theFrameSize.width, theFrameSize.height, 10); - mCompositor = new CSharableCompositor(c); - mCompositor->AddUser(this); // shared by context and view. - } - } - - // set up background color and pattern - // This code is here so that we display default background when - // user has blank home page. - no, that's not the only reason. PLEASE - // TRY TO REMEMBER THAT THIS CLASS IS USED FOR MAIL MESSAGES AND COMPOSER VIEWS! - // ¥ install the user's default solid background color & pattern - InstallBackgroundColor(); - // now use installed background color to set window background color - SetWindowBackgroundColor(); - - mOriginalOrigin.v = mOriginalOrigin.h = 0; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetContext( - CBrowserContext* inNewContext) -{ - // jrm - I added these bookend calls to disable the compositor - 97/02/15. - // callbacks from timer were crashing! - if (!inNewContext && mCompositor) - CL_SetCompositorEnabled(*mCompositor, PR_FALSE); - if (mContext != NULL) - { - mContext->RemoveListener(this); - // mContext->SetCompositor(NULL); - // ^^^^^^^^Do NOT do this. If you do, layout will not be able - // to clean up properly. This is very bad. - // The compositor needs to stick around till the context is deleted. - // So the context shares the CSharableCompositor - mContext->RemoveUser(this); - // set pointer to this view in MWContext to NULL - mContext->ClearMWContextViewPtr(); // MUST BE LAST, AFTER POSSIBLE DELETION! - } - - mContext = inNewContext; - - if (mContext != NULL) - { - // Set up the character set stuff - SetFontInfo(); - - mContext->SetCurrentView(this); - mContext->SetCompositor(mCompositor); // context will share it. - mContext->AddListener(this); - mContext->AddUser(this); - } - if (mCompositor && inNewContext) - CL_SetCompositorEnabled(*mCompositor, PR_TRUE); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- ACCESSORS --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::IsBorderless(void) const -{ - return (mNoBorder && !IsRootHTMLView()); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::IsRootHTMLView(void) const -{ - return (mSuperHTMLView == NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::IsFocusedFrame(void) const -{ - return (mShowFocus && !mHasGridCells && IsOnDuty()); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CHTMLView* CHTMLView::GetSuperHTMLView(void) -{ - return mSuperHTMLView; -} - -// --------------------------------------------------------------------------- -// ¥ BeTarget -// --------------------------------------------------------------------------- -/* since CHTMLView is an LTabGroup, its default behaviour would be to cycle - among its subpanes until it found the next one that wanted to be the target. - There can be situations, however, where none of our subpanes want to be - the target; a silly impasse. Our BeTarget then mimics the behaviour of - LTabGroup::BeTarget, but is prepared to accept the focus itself if necessary. - An added wrinkle comes from the inability of certain of our subpanes - (CPluginView) to correctly preflight whether they will be able to accept - the target (in ProcessCommand). When this happens, CPluginView tells its - supercommander (us) to be the target and a stack explosion results. - Thus the member variable, mTargeting, which detects recursive calls*/ - -/* Later note: BeTarget was gutted so that CHTMLView _could_ take the focus. - This solves problems that happen with simultaneous text selection in the - CHTMLView body and in a form edit field. If you wish to reinstate BeTarget(), - you must declare a private class boolean called mTargeting, and initialize - it to false in the constructor. -*/ - -void -CHTMLView::BeTarget() { - -/* - // punt if one of our [bleep]ing subcommanders is trying to put the onus back on us - if (mTargeting) - return; - StValueChanger targetMode (mTargeting, true); - - LCommander *onDutySub = GetOnDutySub(); - Int32 pos, // index of the subcommander currently handed the torch - subCount = mSubCommanders.GetCount(); - - pos = subCount; - if (onDutySub) - pos = mSubCommanders.FetchIndexOf (&onDutySub); - - // find the next willing subcommander in rotation (a la LTabGroup::BeTarget) - if (pos > 0) { - Int32 startingPos = pos; - LCommander *newTarget; - - do { - // increment and wrap - if (++pos > subCount) - pos = 1; - mSubCommanders.FetchItemAt (pos, &newTarget); - - if (newTarget->ProcessCommand(msg_TabSelect)) { - SwitchTarget (newTarget); - if (newTarget->IsTarget()) - break; - } - } while (pos != startingPos); - } -*/ - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Shows the pane by scrolling to it -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ShowView( LPane& pane ) -{ - if (mScroller && mScroller->HasVerticalScrollbar()) - -// ¥¥¥ FIX ME. We really need to know which way do we want to scroll, -// and then constrain it based on whether we have scrollbars - { - SPoint32 topLeft, botRight; - SDimension16 size; - pane.GetFrameLocation(topLeft); // This is in window coordinates - pane.GetFrameSize(size); - topLeft.v -= mImageLocation.v; // Adjust for our view's image position - topLeft.h -= mImageLocation.h; - botRight.h = topLeft.h + size.width; - botRight.v = topLeft.v + size.height; - RevealInImage(this, topLeft, botRight); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetRepaginate(Boolean inSetting) -{ - mNeedToRepaginate = inSetting; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::GetRepaginate() -{ - return mNeedToRepaginate; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetSuperHTMLView(CHTMLView *inView) -{ - // If we have a SuperHTMLView then we don't want to be called back. - if (inView && !mSuperHTMLView) - { - UnregisterCallBackCalls(); - } - else if (!inView && mSuperHTMLView) - { - RegisterCallBackCalls(); - } - mSuperHTMLView = inView; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetFormElemBaseModel(LModelObject* inModel) -{ - mElemBaseModel = inModel; -} - -LModelObject* CHTMLView::GetFormElemBaseModel(void) -{ - LModelObject* theBase; - - if (mElemBaseModel != NULL) - theBase = mElemBaseModel; - else - theBase = LModelObject::GetDefaultModel(); - - return theBase; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ ScrollBits -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// LView::ScrollBits works by calling ::ScrollRect() which unfortunately paints -// the invalidated area with the background pattern. This causes lots of ugly -// flashing and makes us look pretty bad. Instead, we roll our own ::ScrollRect() -// by using ::CopyBits() to scroll the image in the view and then set the update -// rgn appropriately so that the compositor can blit it to the screen. - -void -CHTMLView :: ScrollBits ( Int32 inLeftDelta, Int32 inTopDelta ) -{ - if (FocusExposed()) { - - // Get Frame in local coords from clip rect (there might be a border around view) - StRegion clipRgn; - Rect frame; - ::GetClip(clipRgn); - clipRgn.GetBounds(frame); - - StRegion totalView(frame); - - // compute the source rect (rect that gets scrolled) - Rect source = frame; - if ( inTopDelta > 0 ) - source.top += inTopDelta; - else if ( inTopDelta < 0 ) - source.bottom -= inTopDelta; - if ( inLeftDelta > 0 ) - source.left += inLeftDelta; - else if ( inLeftDelta < 0 ) - source.right -= inLeftDelta; - - // compute the destination of copybits (post-scroll) - Rect dest = source; - if ( inTopDelta ) { - dest.top -= inTopDelta; - dest.bottom -= inTopDelta; - } - if ( inLeftDelta ) { - dest.left -= inLeftDelta; - dest.right -= inLeftDelta; - } - - // compute the area that is to be updated by subtracting the dest from the visible area - StRegion updateRgn(frame); - StRegion destRgn(dest); - ::DiffRgn ( updateRgn, destRgn, updateRgn ); - - - if(::EmptyRgn(mCachedPort->visRgn)) - { - ::CopyBits ( - &mCachedPort->portBits, - &mCachedPort->portBits, - &source, - &dest, - srcCopy, - nil); - } - else - { - // compute the non-visable region - StRegion nonVisableRgn; - ::DiffRgn ( totalView, mCachedPort->visRgn, nonVisableRgn ); - - // compute the extra area that may need to be updated - // scoll the non-visable region to determine what needs updating - ::OffsetRgn ( nonVisableRgn, -inLeftDelta, -inTopDelta ); - - // calculate a mask region to not copy the non-visble portions of the window from the port - StRegion copyMaskRgn; - ::DiffRgn(totalView, nonVisableRgn, copyMaskRgn); - - // use copybits to simulate a ScrollRect() - StColorPenState saved; - StColorPenState::Normalize(); - - ::CopyBits ( - &mCachedPort->portBits, - &mCachedPort->portBits, - &source, - &dest, - srcCopy, - copyMaskRgn); - - // union the update regions together and invalidate them - ::UnionRgn(nonVisableRgn, updateRgn, updateRgn); - } - - ::OffsetRgn(updateRgn, -mPortOrigin.h, -mPortOrigin.v); - InvalPortRgn(updateRgn); - } - -} // ScrollBits - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Reset scroll mode to default (LO_SCROLL_AUTO). Use to transition from LO_SCROLL_NEVER. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CHTMLView::ResetScrollMode(Boolean inRefresh) -{ - mScrollMode = LO_SCROLL_YES; - SetScrollMode(mScrollMode, inRefresh); - mScrollMode = mDefaultScrollMode; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Reset scroll mode to default (LO_SCROLL_AUTO). This really resets to -// default. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// 97.12.19 pchen. Add method to *REALLY* reset scroll mode to default scroll mode. -void CHTMLView::ResetToDefaultScrollMode() -{ - SetScrollMode(mDefaultScrollMode); - mScrollMode = mDefaultScrollMode; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ LO_SCROLL_NEVER disallows changing the scroll mode until ResetScrollMode() called. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetScrollMode( - Int8 inScrollMode, - Boolean inRefresh) -{ - if (mScrollMode != LO_SCROLL_NEVER) mScrollMode = inScrollMode; - if (mScroller != NULL) - { - if ((mScrollMode == LO_SCROLL_NEVER) || (mScrollMode == LO_SCROLL_NO) || (mScrollMode == LO_SCROLL_AUTO)) - mScroller->ShowScrollbars(false, false); - else - mScroller->ShowScrollbars(true, true); - - // FIX ME!!! if this is never used, take it out - if ( inRefresh ) - ;// ¥¥ FIX ME - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int8 CHTMLView::GetScrollMode(void) const -{ - return mScrollMode; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SpendTime(const EventRecord& /* inMacEvent */) -{ -// // Pagination -// if (fLastLedge != NO_LEDGE && fNextLedgeUpdate < TickCount()) -// DoSetDocDimension( fLastLedge, fLastWidthDelta, fLastHeightDelta ); -// - // Refresh timer - if (mTimerURLString && - (mTimerURLFireTime < LMGetTicks()) && - IsEnabled() && - ( XP_IsContextBusy(*mContext) == false) && - CFrontApp::GetApplication() && CFrontApp::GetApplication()->HasProperlyStartedUp()) - { - URL_Struct * request = NET_CreateURLStruct (mTimerURLString, mTimerURLReloadPolicy); - ClearTimerURL(); // ...frees mTimerURLString, so must do this _after_ |NET_CreateURLStruct|. - if (request) - { - // Fix bug: call GetURLForReferral() to set referer field in URL_Struct - request->referer = XP_STRDUP( mContext->GetURLForReferral() ); - mContext->SwitchLoadURL( request, FO_CACHE_AND_PRESENT ); - } - } -} -#pragma mark --- I18N SUPPORT --- - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CHTMLView::DefaultCSIDForNewWindow(void) -{ - Int16 csid = 0; - if (mContext) - { - csid = mContext->GetDocCSID(); - if(0 == csid) - csid = mContext->GetDefaultCSID(); - } - // If we have auto-detected csid but no corresponding encoding menu item (e.g. JIS), - // use CS_SJIS_AUTO for CS_JIS, CS_KSC_8BIT_AUTO for CS_2022_KR. - if (CS_JIS == (~CS_AUTO & csid)) - csid = CS_SJIS_AUTO; - else if (CS_2022_KR == (~CS_AUTO & csid) || CS_KSC_8BIT == csid) - csid = CS_KSC_8BIT_AUTO; - - return csid; -} -Int16 CHTMLView::GetWinCSID(void) const -{ - if (mContext) - return mContext->GetWinCSID(); - else - return 0; -} - -void CHTMLView::SetFontInfo() -{ - Boolean found; - found = CPrefs::GetFont( GetWinCSID(), &mCharSet ); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- NOTIFICATION RESPONSE --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Mocha submit callback -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void MochaFormSubmitCallback(MWContext* pContext, - LO_Element* lo_element, - int32 lType, - void* whatever, - ETEventStatus status); - -void MochaFormSubmitCallback(MWContext* pContext, - LO_Element* lo_element, - int32 /* lType */, - void* /* whatever */, - ETEventStatus status) -{ - if (status == EVENT_OK) - { - // Call the LO module to figure out the form's context - LO_FormSubmitData* submit = LO_SubmitForm(pContext, (LO_FormElementStruct*)lo_element); - if (submit == NULL) - return; - - #ifdef SingleSignon - // Check for a password submission and remember the data if so - SI_RememberSignonData(pContext, submit); - #endif - - URL_Struct* url = NET_CreateURLStruct((char *)submit->action, NET_DONT_RELOAD); - CBrowserContext* context = ExtractBrowserContext(pContext); - if (context && url) - { - History_entry* current = context->GetCurrentHistoryEntry(); - if (current && current->address) - { - // Fix bug -- prefer origin_url to referer - url->referer = XP_STRDUP(current->origin_url ? current->origin_url : current->address); - } - NET_AddLOSubmitDataToURLStruct(submit, url); - - // Toshok's fix moved over from the XFE code - if (submit->window_target) - { - CBrowserContext* tempContext = ExtractBrowserContext(XP_FindNamedContextInList(pContext, (char *)submit->window_target)); - - if (tempContext) - { - submit->window_target = NULL; - url->window_target = NULL; // don't let window_target get resolved later - context = tempContext; - } - } - - context->SwitchLoadURL(url, FO_CACHE_AND_PRESENT); - } - LO_FreeSubmitData(submit); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Mocha image form submit callback -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -struct ImageFormSubmitData -{ - LO_ImageStruct* lo_image; - int32 x; - int32 y; -}; - -void MochaImageFormSubmitCallback(MWContext* pContext, - LO_Element* lo_element, - int32 lType, - void* whatever, - ETEventStatus status); - -void MochaImageFormSubmitCallback(MWContext* pContext, - LO_Element* /* lo_element */, - int32 /* lType */, - void* whatever, - ETEventStatus status) -{ - if (status == EVENT_OK) - { - LO_FormSubmitData *theSubmit = NULL; - ImageFormSubmitData *data = reinterpret_cast(whatever); - try - { - theSubmit = LO_SubmitImageForm(pContext, data->lo_image, data->x, data->y); - - #ifdef SingleSignon - // Check for a password submission and remember the data if so - SI_RememberSignonData(pContext, theSubmit); - #endif - - // 97-06-07 pkc -- NULL is a valid return value from LO_SubmitImageForm - if (theSubmit) - { - URL_Struct* theURL = NET_CreateURLStruct((char*)theSubmit->action, NET_DONT_RELOAD); - ThrowIfNULL_(theURL); - - CBrowserContext* theContext = ExtractBrowserContext(pContext); - - if (theContext) - { - // Fix bug -- call GetURLForReferral() to set referer field in URL_Struct - cstring theCurrentURL = theContext->GetURLForReferral(); - if (theCurrentURL.length() > 0) - theURL->referer = XP_STRDUP(theCurrentURL); - - if (NET_AddLOSubmitDataToURLStruct(theSubmit, theURL)) - { - // Toshok's fix moved over from the XFE code - if (theSubmit->window_target) - { - CBrowserContext* tempContext = ExtractBrowserContext(XP_FindNamedContextInList(pContext, (char *)theSubmit->window_target)); - - if (tempContext) - { - theSubmit->window_target = NULL; - theURL->window_target = NULL; // don't let window_target get resolved later - theContext = tempContext; - } - } - - CURLDispatcher::DispatchURL(theURL, theContext, true); - } - - LO_FreeSubmitData(theSubmit); - } - } - } - catch (...) - { - LO_FreeSubmitData(theSubmit); - throw; - } - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - switch (inMessage) - { - case msg_NSCFinishedLayout: - NoteFinishedLayout(); - break; - - case msg_NSCAllConnectionsComplete: - NoteAllConnectionsComplete(); - - /* update any commands which might change based on allConnectionsComplete */ - LCommander::SetUpdateCommandStatus(true); - break; - - case msg_NSCPEmptyRepagination: - NoteEmptyRepagination(); - break; - - case msg_NSCPAboutToRepaginate: - NoteStartRepagination(); - break; - - case msg_NSCConfirmLoadNewURL: - NoteConfirmLoadNewURL(*(Boolean*)ioParam); - break; - - case msg_NSCStartLoadURL: - NoteStartLoadURL(); - break; - - case msg_NSCProgressMessageChanged: - // Update Panes to enable the stop button - if (!mStopEnablerHackExecuted && - mLoadingURL && - GetContext() == GetContext()->GetTopContext()) - { - CPaneEnabler::UpdatePanes(); - mStopEnablerHackExecuted = true; - } - break; - - case msg_NSCGridContextPreDispose: - NoteGridContextPreDispose(*(Boolean*)ioParam); - break; - - case msg_NSCGridContextDisposed: - NoteGridContextDisposed(); - break; - - // FORMS - case msg_SubmitButton: // submission - case msg_SubmitText: - { - void * formID; - - StTempFormBlur tempBlur; // see mforms.h for an explanation - - if (inMessage == msg_SubmitButton) - { - LPane* thePane = (LPane*)ioParam; - - LControl* theControl = dynamic_cast(thePane); - ThrowIfNil_(theControl); - - formID = (void*) theControl->GetUserCon(); - } - else - formID = ((CFormLittleText*)ioParam)->GetLayoutForm(); - - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_SUBMIT; - // The code above will get executed in MochaFormSubmitCallback - ET_SendEvent(*mContext, - (LO_Element*)formID, - event, - MochaFormSubmitCallback, - NULL); - } - } - break; - - case msg_ResetButton: // Reset the form. ioParam is LStdButton - { - LPane* thePane = (LPane*)ioParam; - - LControl* theControl = dynamic_cast(thePane); - ThrowIfNil_(theControl); - - LO_ResetForm(*mContext, (LO_FormElementStruct*) theControl->GetUserCon()); - } - - break; - case msg_ControlClicked: // Click on the radio button. Change da others - { - LPane* thePane = (LPane*)ioParam; - - LControl* theControl = dynamic_cast(thePane); - ThrowIfNil_(theControl); - - LO_FormRadioSet(*mContext, (LO_FormElementStruct*) theControl->GetUserCon()); - } - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteFinishedLayout(void) -{ - FlushPendingDocResize(); - - /* - Ugly hack: since `asynchronous' layout might have slightly overwritten the - scrollbars, get just the scrollbars to redraw. - */ - - if ( mScroller ) - mScroller->RefreshSelf(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteAllConnectionsComplete(void) -{ -// StopRepeating(); - - // Look to see if my context, or any context enclosing my context, needs to be repaginated. - CBrowserContext* contextToRepaginate = 0; - if ( mContext ) - for ( MWContext* ctx = *mContext; ctx; ctx = ctx->grid_parent ) - { - CBrowserContext* browserContext = ExtractBrowserContext(ctx); - if ( browserContext && browserContext->IsRepagintaitonPending() ) - contextToRepaginate = browserContext; - } - - /* - Try to repaginate the most enclosing context that needs it. If some busy child - stops the repagination, no big deal... that childs |NoteAllConnectionsComplete| - will try again. - */ - - if ( contextToRepaginate ) - contextToRepaginate->Repaginate(); - else - ClearDeferredImageQueue(); - - //Enable(); - CPaneEnabler::UpdatePanes(); - - mLoadingURL = false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteStartRepagination(void) -{ - SPoint32 theScrollPosition; - GetScrollPosition(theScrollPosition); - mContext->RememberHistoryPosition(theScrollPosition.h, theScrollPosition.v); - -// FIX ME!!! may want to reset the size flush timer here -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteEmptyRepagination(void) -{ - // Adjust scroll bars - - AdjustScrollBars(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteConfirmLoadNewURL(Boolean& ioCanLoad) -{ -// if ( HasDownloads( *mContext ) ) -// if (!ErrorManager::PlainConfirm((const char*) GetCString( ABORT_CURR_DOWNLOAD ), nil, nil, nil )) -// return; - - ioCanLoad = true; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteStartLoadURL(void) -{ - //Disable(); -// FIX ME!!! we should disable the view. it will be enabled through all connection complete - - ClearTimerURL(); // jrm 97/08/22 - - SPoint32 theScrollPosition; - GetScrollPosition(theScrollPosition); - mContext->RememberHistoryPosition(theScrollPosition.h, theScrollPosition.v); - mLoadingURL = true; - mStopEnablerHackExecuted = false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteGridContextPreDispose(Boolean inSavingHistory) -{ - if (inSavingHistory) - { - SPoint32 theScrollPosition; - GetScrollPosition(theScrollPosition); - mContext->RememberHistoryPosition(theScrollPosition.h, theScrollPosition.v); - } - - // our grid context is going to be orphaned by it's super context - // which is our clue that we aren't supposed to be here anymore. - // Deleting outself releases our shared interest in the context. - // - // FIX ME!!! This needs to change. The assumption here is that the - // superview of the HTML view is a scroller and was created at the - // same time as this. This will need to go away when the scroller - // dependency is removed. - delete mSuperView; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::NoteGridContextDisposed(void) -{ - if (mContext->CountGridChildren() == 0) - SetScrollMode(mDefaultScrollMode, true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// replaces the old fCanLoad Member -void CHTMLView::EnableSelf(void) -{ - // for the click code - mOldPoint.h = mOldPoint.v = -1; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::DisableSelf(void) -{ - mOldPoint.h = mOldPoint.v = -1; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- DRAWING AND UPDATING --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ResetBackgroundColor() const -{ - UGraphics::SetIfBkColor(mBackgroundColor); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ ContextMenuPopupsEnabled -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// determine whether context-sensitive popup menus are enabled by querying -// the parent browser window - -Boolean CHTMLView::ContextMenuPopupsEnabled (void) -{ - CBrowserWindow *browserWindow = dynamic_cast(CViewUtils::GetTopMostSuperView (this)); - // 8-13-97 context menus disabled when commands are disabled unless the control key is down. - // this is mac specific and may go away when we have an xp way to disable context menus from javascript. - return browserWindow ? browserWindow->AllowSubviewPopups() && !browserWindow->IsHTMLHelp() && (!browserWindow->CommandsAreDisabled() || CApplicationEventAttachment::CurrentEventHasModifiers(controlKey)) : true; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ GetCurrentPort -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CGrafPtr CHTMLView::GetCurrentPort(Point& outPortOrigin) -{ - if ((mCurrentDrawable == NULL) || (mCurrentDrawable == mOnscreenDrawable)) { - outPortOrigin = mPortOrigin; - return (CGrafPtr) GetMacPort(); - } - else { - outPortOrigin.h = outPortOrigin.v = 0; - /* If a windowless plugin is forcing a redraw, we need to - account for the scroll position in our origin calculation */ - if(NPL_IsForcingRedraw()) - { - outPortOrigin.h = mPortOrigin.h - mOriginalOrigin.h; - outPortOrigin.v = mPortOrigin.v - mOriginalOrigin.v; - } - return mCurrentDrawable->GetDrawableOffscreen(); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ FocusDraw -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::FocusDraw(LPane* /*inSubPane*/) -{ - Boolean bFocused = true; - GWorldPtr gworld = NULL; - - // I don't really want to write my own FocusDraw, but PowerPlant has this nasty - // habit of setting the origin and clip on me... - bFocused = (mRevealedRect.left < mRevealedRect.right); - - // Skip if already in focus - if (this != sInFocusView) - { - // Always set PowerPlant's origin and clip for the onscreen port. - if (LView::EstablishPort()) - { - // Set up local coordinate system - ::SetOrigin(mPortOrigin.h, mPortOrigin.v); - - // Clip to revealed area of View - Rect clippingRect = mRevealedRect; - - PortToLocalPoint( topLeft(clippingRect) ); - PortToLocalPoint( botRight(clippingRect) ); - - // if we're focussed then we need to do some extra stuff - if ( bFocused && IsFocusedFrame() ) - { - ::InsetRect( &clippingRect, FocusBox_Size, FocusBox_Size ); - } - - ::ClipRect( &clippingRect ); - } - - - // Set our current Mac Port - could be either onscreen or offscreen - if (EstablishPort()) - { - // If the current drawable is not us, don't screw with the origin and clip. - // The drawable is set to nil during normal operation so that's assumed to - // also be us. - if ( ( mCurrentDrawable != NULL ) && ( mCurrentDrawable != mOnscreenDrawable ) ) - { - // offscreen - Rect theFrame; - CalcLocalFrameRect(theFrame); - - ::SetOrigin(theFrame.left, theFrame.top); - } - - // Cache current Focus - sInFocusView = this; - - // be sure to reset the background color - if ( bFocused && ( mRevealedRect.left < mRevealedRect.right ) ) - { - ResetBackgroundColor(); - } - } - else - { - SignalPStr_("\pFocus View with no GrafPort"); - } - } - - // if we have a current drawable, then we need to do magic with the clip - if ( mCurrentDrawable != NULL ) - { - if ( mCurrentDrawable->HasClipChanged() ) - { - RgnHandle clip; - - // - // Warning: If the drawable is our offscreen, then we need to make sure - // to move the clip into the correct coordinate space. The problem here is that - // the drawable has no way of knowing what its coordinate space is. To make - // matters worse, Drawables are shared across multiple HTMLViews. - // - // We could simplify this by keeping one back buffer for the browser as a whole - // and then instantiating a COffscreenDrawable per CHTMLView. That way the HTMLView - // could notify the offscreen whenever it's origin changes. It could then offset - // its clip correctly whenever a new one is set. - clip = (RgnHandle) mCurrentDrawable->GetLayerClip(); - if ( mCurrentDrawable == mOffscreenDrawable ) - { - Rect theFrame; - - CalcLocalFrameRect(theFrame); - - ::OffsetRgn ( clip, theFrame.left, theFrame.top ); - ::SetClip ( clip ); - ::OffsetRgn ( clip, -theFrame.left, -theFrame.top ); - } - else - { - ::SetClip ( clip ); - } - } - } - - return bFocused; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ EstablishPort -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -Boolean -CHTMLView::EstablishPort() -{ - Boolean portSet = false; - GWorldPtr gworld = NULL; - - // if the current drawable, is an offscreen one, be sure to set it - if ( mCurrentDrawable != NULL ) - { - gworld = mCurrentDrawable->GetDrawableOffscreen(); - } - - if ( gworld != NULL ) - { - portSet = true; - if ( UQDGlobals::GetCurrentPort() != (GrafPtr) mGWorld ) - { - SetGWorld ( gworld, NULL ); - mOffscreenDrawable->mClipChanged = true; - } - } - else - { - // make sure to restore the main device - SetGDevice ( GetMainDevice() ); - portSet = LView::EstablishPort(); - } - - return portSet; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawSelf -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::DrawSelf(void) -{ - if (Memory_MemoryIsLow() || !mContext) - return; - // A CHTMLView can have a nil mContext, but if it does, it doesn't draw. - - // update the image display context if we need to. it would be nice to reload the images - // on the current page, but we cuurently cannot doing so without other side effects - // such as losing form data... - VerifyDisplayContextColorSpace ( *mContext ); - -// this is the new (layered) drawing. It flashes WAY to much. -// FIX ME!!! clean up - - if (GetRepaginate()) - { - GetContext()->Repaginate(NET_CACHE_ONLY_RELOAD); - SetRepaginate(false); - } - - // For layers all drawing is done through the compositor - // BUGBUG LAYERS The assumption here is that the cutout region - // (including plugins) will be removed from the composited - // area...this still needs to be done. - -// if ( sNoTextUpdateLock ) -// return; - - // Get the update region - StRegion theImageUpdateRgn(mUpdateRgnH); - - if (!mContext || !mContext->GetCurrentHistoryEntry()) - { - ClearBackground(); - } - else - { - /* Convert to frame coordinates */ - SPoint32 theFrameLocation; - GetFrameLocation(theFrameLocation); - ::OffsetRgn(theImageUpdateRgn, -theFrameLocation.h, -theFrameLocation.v); - - if (mCompositor && CL_GetCompositorEnabled(*mCompositor)) - CL_RefreshWindowRegion(*mCompositor, (FE_Region)static_cast(theImageUpdateRgn)); - else - DrawBackground((*static_cast(theImageUpdateRgn))->rgnBBox); - - // 07-06-11 pkc -- Update grid edges only if mContext isn't busy which means that - // layout isn't running, i.e. calling FE_DisplayEdge directly - /* 18.Jun.97 drm -- removed the check so we update grid edges even when layout - is already doing that. While layout is creating a new page, the last redraw - that goes through tends to happen while the context is busy. This check - causes frame edges to not be redrawn, which leaves a bevel line from the - enclosing CBevelView running across the end of the frame edge. - */ -// if (!XP_IsContextBusy(*mContext)) - DrawGridEdges(theImageUpdateRgn); - } - - if (IsFocusedFrame()) - DrawFrameFocus(); - ExecuteAttachments(CTargetFramer::msg_DrawSelfDone, this); - - /* Used in CHTMLView::GetCurrentPort() calculate the origin offset due to scrolling */ - if(mOriginalOrigin.h == 0) - mOriginalOrigin = mPortOrigin; - -/* this is the old drawing code - mCalcDontDraw = false; - - Rect theFrame; - CalcLocalFrameRect(theFrame); - RgnHandle theLocalUpdateRgn = GetLocalUpdateRgn(); - - Rect theLocalUpdateFrame = (*theLocalUpdateRgn)->rgnBBox; - ::SectRect(&theFrame, &theLocalUpdateFrame, &theLocalUpdateFrame); - - if (!mHasGridCells) - DrawBackground(theLocalUpdateFrame); - - SPoint32 itl, ibr; - Point tl, br; - tl = topLeft( theLocalUpdateFrame ); - br = botRight( theLocalUpdateFrame ); - LocalToImagePoint( tl, itl ); - LocalToImagePoint( br, ibr ); - - LO_RefreshArea(*mContext, itl.h, itl.v, ibr.h - itl.h, ibr.v - itl.v ); - - if (IsFocusedFrame()) - DrawFrameFocus(); - - ::DisposeRgn(theLocalUpdateRgn); - mCalcDontDraw = true; -*/ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawFrameFocus -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::DrawFrameFocus(void) -{ - StRegion theFocusMask; - CalcFrameFocusMask(theFocusMask); - - Point theLocalOffset = { 0, 0 }; - PortToLocalPoint(theLocalOffset); - ::OffsetRgn(theFocusMask, theLocalOffset.h, theLocalOffset.v); - - StClipRgnState theClipSaver(theFocusMask); - StColorPenState savePen; - - ::PenPat(&UQDGlobals::GetQDGlobals()->black); - ::PenMode(srcCopy); - - RGBColor theHiliteColor; - LMGetHiliteRGB(&theHiliteColor); - ::RGBForeColor(&theHiliteColor); - - ::PaintRgn(theFocusMask); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ CalcFrameFocusMask -// -// This region is in port coordinates -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::CalcFrameFocusMask(RgnHandle outFocusMask) -{ - ::SetEmptyRgn(outFocusMask); - - Rect theFrame; - CalcPortFrameRect(theFrame); - ::SectRect(&theFrame, &mRevealedRect, &theFrame); - - ::RectRgn(outFocusMask, &theFrame); - StRegion theSubFocus(theFrame); - - ::InsetRgn(theSubFocus, FocusBox_Size, FocusBox_Size); - ::DiffRgn(outFocusMask, theSubFocus, outFocusMask); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ InvalFocusArea -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::InvalFocusArea(void) -{ - if (mShowFocus) - { - StRegion theFocusMask; - CalcFrameFocusMask(theFocusMask); - InvalPortRgn(theFocusMask); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ AdjustScrollBars -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// FIX ME!!! this needs to be removed when the mScroller is removed -void CHTMLView::AdjustScrollBars() -{ - if ((mScroller == NULL) || (GetScrollMode() != LO_SCROLL_AUTO)) - return; - - mScroller->AdjustScrollBars(); - -/* - SDimension16 theFrameSize; - GetFrameSize(theFrameSize); - - SDimension32 theImageSize; - GetImageSize(theImageSize); - - // If we are only showing scrollers when needed, turn them on if we have overgrown - - mScroller->ShowScrollbars( - theImageSize.width > theFrameSize.width, - theImageSize.height > theFrameSize.height); -*/ -} - -void -CHTMLView::RegisterCallBackCalls() -{ - PREF_RegisterCallback("intl", PrefUpdateCallback, (void *)this); - // At some point we should decide if it makes more sense to register a single - // "browser" call back. - PREF_RegisterCallback( "browser.underline_anchors", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "browser.background_color", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "browser.use_document_fonts", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "browser.foreground_color", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "browser.anchor_color", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "browser.visited_color", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "browser.use_document_colors", - PrefUpdateCallback, (void *)this); - PREF_RegisterCallback( "general.always_load_images", - PrefInvalidateCachedPreference, (void *)this); -} - -void -CHTMLView::UnregisterCallBackCalls() -{ - PREF_UnregisterCallback("intl", PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.underline_anchors", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.background_color", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.use_document_fonts", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.foreground_color", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.anchor_color", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.visited_color", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "browser.use_document_colors", - PrefUpdateCallback, (void *)this); - PREF_UnregisterCallback( "general.always_load_images", - PrefInvalidateCachedPreference, (void *)this); -} - -int -CHTMLView::PrefUpdateCallback(const char * /*inPrefString */, void *inCHTMLView) -{ - CHTMLView *theView = (CHTMLView *)inCHTMLView; - theView = dynamic_cast(theView); - XP_ASSERT(theView); - XP_ASSERT(!theView->GetSuperHTMLView()); - if (theView && - !theView->GetRepaginate() && // No need to do it again if we have been here before. - theView->IsRootHTMLView()) - { - theView->SetRepaginate(true); - Rect paneRect; - theView->CalcPortFrameRect(paneRect); - theView->InvalPortRect(&paneRect); - } - return 0; // You don't even want to know my opinion of this! -} - -int -CHTMLView::PrefInvalidateCachedPreference(const char *inPrefString, void * /*inCHTMLView */) -{ - int returnValue = 0; - - if (!XP_STRCMP(inPrefString, "general.always_load_images")) { - XP_Bool prefValue; - returnValue = PREF_GetBoolPref(inPrefString, &prefValue); - if (returnValue != PREF_OK && returnValue != PREF_NOERROR) - sCachedAlwaysLoadImages = true; - else - sCachedAlwaysLoadImages = (Boolean)prefValue; - } - - return returnValue; -} - -// 97-06-11 pkc -- Code to handle redrawing grid edges -void CHTMLView::DrawGridEdges(RgnHandle inRgnHandle) -{ - // quick check -- if mGridEdgeList is empty, no grid edges to draw - if(!mGridEdgeList.empty()) - { - // set mDontAddGridEdgeToList to true so that that DisplayEdge does not - // to add this LO_EdgeStruct* to mGridEdgeList - mDontAddGridEdgeToList = true; - // Check each grid edge to see if it intersects the update region - vector::iterator iter = mGridEdgeList.begin(); - while (iter != mGridEdgeList.end()) - { - LO_EdgeStruct* edge = *iter; - Rect edgeFrame; - if (CalcElementPosition((LO_Element*)edge, edgeFrame)) - { - // grid edge is visible - if(::RectInRgn(&edgeFrame, inRgnHandle)) - { - // grid edge is in update region, draw it - DisplayEdge(NULL, edge); - } - } - ++iter; - } - // set mDontAddGridEdgeToList to false - mDontAddGridEdgeToList = false; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- LAYER DISPATCH --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetLayerOrigin( - Int32 inX, - Int32 inY) -{ - mLayerOrigin.h = inX; - mLayerOrigin.v = inY; -} - -void CHTMLView::GetLayerOrigin( - Int32* outX, - Int32* outY) -{ - /* - * certain things like images get the current layer origin from the current hyperview. - * If they can learn how to get this from the current drawable (through the doc context - * then this hack can go away - */ - if ( mCurrentDrawable != NULL && mCurrentDrawable != mOnscreenDrawable ) - { - mCurrentDrawable->GetLayerOrigin ( outX, outY ); - } - else - { - *outX = mLayerOrigin.h; - *outY = mLayerOrigin.v; - } -} - -void CHTMLView::SetLayerClip( - FE_Region inRegion) -{ - - // do we need to restore a magic region? - if ( inRegion == NULL ) - { - mLayerClip = NULL; - - if (!::EmptyRgn(mSaveLayerClip)) - { - mClipChanged = true; - ::CopyRgn ( mSaveLayerClip, mClipRgn ); - ::SetEmptyRgn(mSaveLayerClip); - } - } - else - { - Point portOrigin, scrollOffset; - SPoint32 frameLocation; - - // do we need to save a magic region? - if ( mLayerClip == NULL ) - { - ::GetClip(mSaveLayerClip); - mLayerClip = FE_GetMDRegion(inRegion); - } - - // now, copy this region to our own copy and move it to the correct coordinate - // space - CopyRgn ( FE_GetMDRegion(inRegion), mClipRgn ); - - // The region passed in is in frame coordinates. To use it, - // we need to convert it to local coordinates. The scrollOffset - // represents how much we need to offset the region for this - // transformation. - GetPortOrigin(portOrigin); - GetFrameLocation(frameLocation); - - scrollOffset.h = portOrigin.h + frameLocation.h; - scrollOffset.v = portOrigin.v + frameLocation.v; - - ::OffsetRgn(mClipRgn, scrollOffset.h, scrollOffset.v); - - mClipChanged = true; - } - - // because we're lame and don't know how to test if the current - // port is us, we save the port, and then focus ourselves. since - // we marked the clip as having changed, it will always be set - // How can I tell if I'm the current port? - - GDHandle saveGD; - CGrafPtr savePort; - - GetGWorld ( &savePort, &saveGD ); - - FocusDraw(); - - SetGWorld ( savePort, saveGD ); -} - -void CHTMLView::CopyPixels( - CDrawable* inSrcDrawable, - FE_Region inCopyRgn) -{ - GWorldPtr srcGWorld; - - FocusDraw(); - - srcGWorld = inSrcDrawable->GetDrawableOffscreen(); - if ( srcGWorld != NULL ) - { - Rect srcRect; - Rect dstRect; - - GDHandle gdh; - CGrafPtr port; - - GetGWorld ( &port, &gdh ); - SetGWorld ( srcGWorld, NULL ); - - SetOrigin ( 0, 0 ); - - SetGWorld ( port, gdh ); - - StColorPenState save; - - StColorPenState::Normalize(); - - /* we use the bounding rectangle for the copy rgn as the src/dst rect */ - /* for the copy. however, we need to make sure that the onscreen rect is */ - /* in the correct coordinate space */ - srcRect = (*(RgnHandle) inCopyRgn)->rgnBBox; - dstRect = srcRect; - - Point portOrigin, scrollOffset; - SPoint32 frameLocation; - - // The region passed in is in frame coordinates. To use it, - // we need to convert it to local coordinates. The scrollOffset - // represents how much we need to offset the region for this - // transformation. - GetPortOrigin(portOrigin); - GetFrameLocation(frameLocation); - - scrollOffset.h = portOrigin.h + frameLocation.h; - scrollOffset.v = portOrigin.v + frameLocation.v; - - ::OffsetRgn(FE_GetMDRegion(inCopyRgn), scrollOffset.h, scrollOffset.v ); - ::OffsetRect ( &dstRect, scrollOffset.h, scrollOffset.v ); - - // pinkerton - // we need a way to prevent images/etc in the HTML area from drawing over the - // popdown treeView if it is visible. Clip it out. - StClipRgnState savedClip; - CBrowserWindow::ClipOutPopdown(this); - - CopyBits ( &((GrafPtr) srcGWorld)->portBits, &qd.thePort->portBits, &srcRect, - &dstRect, srcCopy, FE_GetMDRegion(inCopyRgn) ); - - ::OffsetRgn(FE_GetMDRegion(inCopyRgn), -scrollOffset.h, -scrollOffset.v); - } -} - -// Dispatcher for events arriving from layers. These events may have originated in -// the front end and sent to layers, or they may have been synthesized. -PRBool CHTMLView::HandleLayerEvent( - CL_Layer* inLayer, - CL_Event* inEvent) -{ - CStLayerOriginSetter makeOriginInLayerOrigin(this, inLayer); - fe_EventStruct *fe_event = (fe_EventStruct *)inEvent->fe_event; - - SPoint32 theLayerPoint; - theLayerPoint.h = inEvent->x; - theLayerPoint.v = inEvent->y; - - if (!fe_event) - // Fill in FE event if the event was synthesized in the backend - { - EventRecord event; - Point whereLocal, wherePort, whereGlobal; - - ImageToLocalPoint(theLayerPoint, whereLocal); - wherePort = whereLocal; - LocalToPortPoint(wherePort); - whereGlobal = wherePort; - PortToLocalPoint(whereGlobal); - - event.when = ::TickCount(); - event.where = whereGlobal; - event.modifiers = ((inEvent->modifiers & EVENT_SHIFT_MASK) ? shiftKey : 0) | - ((inEvent->modifiers & EVENT_CONTROL_MASK) ? controlKey : 0) | - ((inEvent->modifiers & EVENT_ALT_MASK) ? optionKey : 0) | - ((inEvent->modifiers & EVENT_META_MASK) ? cmdKey : 0); - - switch (inEvent->type) - { - case CL_EVENT_MOUSE_BUTTON_DOWN: - case CL_EVENT_MOUSE_BUTTON_MULTI_CLICK: - SMouseDownEvent mouseDownEvent; - LWindow *window = LWindow::FetchWindowObject(GetMacPort()); - - event.what = mouseDown; - // event.message is undefined - mouseDownEvent.wherePort = wherePort; - mouseDownEvent.whereLocal = whereLocal; - mouseDownEvent.macEvent = event; - mouseDownEvent.delaySelect = (window != nil) ? (!UDesktop::WindowIsSelected(window) && window->HasAttribute(windAttr_DelaySelect)) : false; - fe_event->event.mouseDownEvent = mouseDownEvent; - break; - case CL_EVENT_MOUSE_MOVE: - event.what = nullEvent; - event.message = mouseMovedMessage; - fe_event->event.macEvent = event; - break; - case CL_EVENT_KEY_DOWN: - event.what = keyDown; - event.message = inEvent->which; - fe_event->event.macEvent = event; - break; - default: - return PR_TRUE; // ignore the event - } - } - -/* - // Make sure this event came from the front-end. - // i.e. ignore synthesized events - return PR_TRUE; -*/ - - // Call the per-layer event handlers - switch (inEvent->type) - { - case CL_EVENT_MOUSE_BUTTON_DOWN: - case CL_EVENT_MOUSE_BUTTON_MULTI_CLICK: - { - //SMouseDownEvent* mouseDown = (SMouseDownEvent *)fe_event->event; - //ClickSelfLayer(*mouseDown, inLayer, theLayerPoint); - SMouseDownEvent mouseDown = fe_event->event.mouseDownEvent; - ClickSelfLayer(mouseDown, inLayer, theLayerPoint); - } - break; - - case CL_EVENT_MOUSE_MOVE: - { - Point portPt = fe_event->portPoint; - //EventRecord *macEvent = (EventRecord *)fe_event->event; - //AdjustCursorSelfForLayer(portPt, *macEvent, inLayer, theLayerPoint); - // modified for new fe_EventStruct typedef 1997-02-25 mjc - EventRecord macEvent = fe_event->event.macEvent; - AdjustCursorSelfForLayer(portPt, macEvent, inLayer, theLayerPoint); - } - break; - case CL_EVENT_KEY_DOWN: - { - EventRecord macEvent = fe_event->event.macEvent; - HandleKeyPressLayer(macEvent, inLayer, theLayerPoint); - break; - } - case CL_EVENT_KEY_UP: - case CL_EVENT_MOUSE_BUTTON_UP: - case CL_EVENT_KEY_FOCUS_GAINED: - case CL_EVENT_KEY_FOCUS_LOST: - // Nothing to do, but grab the event - break; - default: - // Pass the event through - return PR_FALSE; - } - - return PR_TRUE; - -} - -PRBool CHTMLView::HandleEmbedEvent( - LO_EmbedStruct* inEmbed, - CL_Event* inEvent) -{ - NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbed->objTag.FE_Data; - if (app && app->fe_data) - { - CPluginView* view = (CPluginView*) app->fe_data; - return (PRBool)view->HandleEmbedEvent(inEvent); - } - return PR_FALSE; -} - -void CHTMLView::ScrollImageBy( - Int32 inLeftDelta, - Int32 inTopDelta, - Boolean inRefresh) -{ - if ( ( inLeftDelta == 0 ) && ( inTopDelta == 0 ) ) - return; - - // Get the image coordinates of the frame origin - - Rect theFrame; - CalcLocalFrameRect(theFrame); - - SPoint32 imageTopLeft; - LocalToImagePoint(topLeft(theFrame), imageTopLeft); - imageTopLeft.h += inLeftDelta; - imageTopLeft.v += inTopDelta; - - if (mCompositor != NULL) - CL_ScrollCompositorWindow(*mCompositor, imageTopLeft.h, imageTopLeft.v); - -// FIX ME!!! this seems like it might be a bug. The image can be pinned and -// not scroll as much as the request. It seems like the commpositor would be out of sync. - - // Let PowerPlant do the rest - Boolean mayAutoScrollLeavingTurds = inRefresh && IsTarget(); //&& mDropRow; - // Turds will be left if we call scrollbits in ScrollImageBy - if (mayAutoScrollLeavingTurds) - { - // Notify the CTargetFramer (if any) to erase the frame hilite - ExecuteAttachments(CTargetFramer::msg_ResigningTarget, this); - } - LView::ScrollImageBy(inLeftDelta, inTopDelta, inRefresh); - if (mayAutoScrollLeavingTurds && FocusDraw()) - { - // Turn hiliting back on - // Notify the CTargetFramer to draw the border now. - ExecuteAttachments(CTargetFramer::msg_BecomingTarget, this); // invert - } - // normally, the compositor will add forms control subpanes later, during - // LPeriodical time. if the subpanes are being displayed now for the first time, - // they've never been added to this view, so we need to force the compositor to - // add them now, while the update region is still fresh. - if (mCompositor) - CL_CompositeNow (*mCompositor); -} - - -// until flag is turned on... -extern "C" { -void LO_RelayoutOnResize(MWContext *context, int32 width, int32 height, int32 leftMargin, int32 topMargin); -} - -// This method gets called when window changes size. -// Make sure we call mContext->Repaginate() -void CHTMLView::AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh) -{ - UCursor::SetWatch(); - - LView::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh); - - if (IsRootHTMLView()) - { - if ((mContext != NULL) && ((inSurrWidthDelta != 0) || (inSurrHeightDelta != 0)) && (!mContext->IsViewSourceContext())) - { - SDimension16 theFrameSize; - Rect theFrame; - int32 leftMargin; - int32 topMargin; - - GetFrameSize(theFrameSize); - - leftMargin = 8; - topMargin = 8; - - CalcLocalFrameRect(theFrame); - if ( theFrame.right - theFrame.left > 0 ) - { - if (leftMargin > (theFrame.right / 2 )) - leftMargin = MAX( theFrame.right / 2 - 50, 0); - } - if ( theFrame.bottom - theFrame.top > 0 ) - { - if ( topMargin > (theFrame.bottom / 2 ) ) - topMargin = MAX(theFrame.bottom / 2 -50, 0); - } - - // set the image size to the current frame size - SDimension16 curFrameSize; - GetFrameSize(curFrameSize); - - ResizeImageTo ( curFrameSize.width, curFrameSize.height, false ); - - // If the vertical scrollbar might be shown, - // tell layout that we already have it, so that it does - // the correct wrapping of text. - // If we do not do this, when vertical scrollbar only is - // shown, some text might be hidden - if (GetScrollMode() == LO_SCROLL_AUTO) - theFrameSize.width -= 15; - - LO_RelayoutOnResize ( *mContext, theFrameSize.width, theFrameSize.height, leftMargin, topMargin ); - AdjustScrollBars(); - - } - } - UCursor::SetArrow(); -} - -void CHTMLView::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -{ - // are we on drugs? - if ( ( inWidthDelta == 0 ) && ( inHeightDelta == 0 ) ) - return; - - SDimension16 theFrameSize; - GetFrameSize(theFrameSize); - theFrameSize.width += inWidthDelta; - theFrameSize.height += inHeightDelta; - - // Let PowerPlant do the rest - LView::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - - // We need to adjust the compositor before the inherited call in case - // in refresh is true (immediate draw). - if (mCompositor != NULL) - CL_ResizeCompositorWindow(*mCompositor, theFrameSize.width, theFrameSize.height); - - // We now call Repaginate in AdaptToSuperFrameSize -} - -void CHTMLView::SetCurrentDrawable( - CDrawable* inDrawable) -{ - if ( inDrawable != NULL ) - { - mCurrentDrawable = inDrawable; - - /* make sure this new drawable calls us */ - mCurrentDrawable->SetParent ( this ); - } - else - { - mCurrentDrawable = NULL; - } - - /* Our focus has most likely changed */ - OutOfFocus ( nil ); - FocusDraw(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- COMMANDER OVERRIDES --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void MochaFocusCallback( MWContext * /* pContext */, - LO_Element * /* lo_element */, - int32 /* lType */, - void * whatever, - ETEventStatus status ) -{ - if (status == EVENT_OK && whatever) - { - CHTMLView* htmlView = reinterpret_cast(whatever); - htmlView->ClearInFocusCallAlready(); - } -} - -void CHTMLView::PutOnDuty(LCommander*) -{ - if (IsFocusedFrame() && FocusDraw()) - DrawFrameFocus(); - // javascript onFocus callback - 1997-02-27 mjc - if (mContext != NULL && !mInFocusCallAlready) - { - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_FOCUS; - event->layer_id = LO_DOCUMENT_LAYER_ID; - mInFocusCallAlready = true; - ET_SendEvent( *mContext, NULL, event, MochaFocusCallback, this ); - } - } -} - -void CHTMLView::TakeOffDuty(void) -{ - if (FocusDraw()) - InvalFocusArea(); - // javascript onBlur callback - 1997-02-27 mjc - if (mContext != NULL && !mInFocusCallAlready) - { - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_BLUR; - event->layer_id = LO_DOCUMENT_LAYER_ID; - mInFocusCallAlready = true; - ET_SendEvent( *mContext, NULL, event, MochaFocusCallback, this ); - } - } -} - -void CHTMLView::FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - outUsesMark = false; - if (!mContext) // yes, this can happen. It happened to me! - { - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - return; - } - - CBrowserWindow *browserWindow = dynamic_cast(CViewUtils::GetTopMostSuperView(this)); - Boolean isRootDocInfo = browserWindow ? browserWindow->IsRootDocInfo() : false; - Boolean isHTMLHelp = browserWindow ? browserWindow->IsHTMLHelp() : false; - Boolean isViewSource = browserWindow ? browserWindow->IsViewSource() : false; - - // Disable commands which don't apply to restricted targets, at the request of javascript. - // No special distinction needed for floaters here. - if (browserWindow && - browserWindow->CommandsAreDisabled() && - ( - inCommand == cmd_AddToBookmarks || - inCommand == cmd_ViewSource || - inCommand == cmd_DocumentInfo || - inCommand == cmd_Find || - inCommand == cmd_FindAgain || - inCommand == cmd_MailDocument || - inCommand == cmd_LoadImages || - inCommand == cmd_Reload || - inCommand == cmd_SaveAs)) - { - outEnabled = false; - return; - } - - switch (inCommand) - { - case cmd_LoadImages: - if (mContext && !isViewSource) - { - outEnabled = !sCachedAlwaysLoadImages; - } - break; - - case cmd_Reload: - { - if (GetContext()) - { - CBrowserContext* theTopContext = GetContext()->GetTopContext(); - if ((theTopContext != nil) && (theTopContext->GetCurrentHistoryEntry() != nil) && !XP_IsContextBusy(*theTopContext)) - { - outEnabled = true; - - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey) || - CApplicationEventAttachment::CurrentEventHasModifiers(shiftKey)) - { - LString::CopyPStr(::GetPString(MENU_SUPER_RELOAD), outName); - } - else - { - LString::CopyPStr(::GetPString(MENU_RELOAD), outName); - } - } - } - } - break; - - case cmd_SecurityInfo: - { - outEnabled = !UDesktop::FrontWindowIsModal(); - break; - } - case cmd_ViewSource: - case cmd_DocumentInfo: - { - outEnabled = !isHTMLHelp; - break; - } - case cmd_AddToBookmarks: - outUsesMark = false; - outEnabled = mContext && mContext->GetCurrentHistoryEntry() && !(isRootDocInfo || isHTMLHelp); - break; - case cmd_SaveAs: - { - if ((mContext->GetCurrentHistoryEntry() != nil) && !XP_IsContextBusy(*mContext)) - { - outEnabled = !isHTMLHelp; - } - break; - } - - case cmd_Copy: - { - outEnabled = LO_HaveSelection(*mContext); - break; - } - - case cmd_SelectAll: - { - outEnabled = (mContext->GetCurrentHistoryEntry() != NULL); - break; - } - - case cmd_Find: - { - outEnabled = (mContext->GetCurrentHistoryEntry() != NULL); - break; - } - - case cmd_FindAgain: - { - outEnabled = ((mContext->GetCurrentHistoryEntry() != NULL) && CFindWindow::CanFindAgain()); - break; - } - - case cmd_FontLarger: - outEnabled = (mFontScaling < eMaxFontScaling); - break; - - case cmd_FontSmaller: - outEnabled = (mFontScaling > eMinFontScaling); - break; - - case cmd_PageSetup: - if (CanPrint()) - outEnabled = TRUE; - break; - case cmd_Print: - case cmd_PrintOne: - { - if (CanPrint()) - outEnabled = TRUE; - if (mContext && (MWContext (*mContext)).is_grid_cell) - LString::CopyPStr( GetPString( MENU_PRINT_FRAME ), outName); - else - LString::CopyPStr( GetPString( MENU_PRINT ), outName); - break; - } - case cmd_MailDocument: // Send Page/Frame - if (mContext->IsGridCell()) - { // frame view, set menu command to "Send Frame..." - LStr255 sendFrameStr(cPaulsMiscStrListID, cSendFrameIndex); - LString::CopyPStr(sendFrameStr, outName); - outEnabled = !isHTMLHelp; - } - else if (!mContext->HasGridChildren() && !mContext->HasGridParent()) - { // non-frame view - LStr255 sendPageStr(cPaulsMiscStrListID, cSendPageIndex); - LString::CopyPStr(sendPageStr, outName); - outEnabled = !isHTMLHelp; - } - else - { // frame container view - LStr255 sendFrameStr(cPaulsMiscStrListID, cSendFrameIndex); - LString::CopyPStr(sendFrameStr, outName); - outEnabled = false; - } - break; - case cmd_FTPUpload: // fix for #313498 - case cmd_PrivDisplayPolicy: - case cmd_PrivDisplaySiteInfo: - outEnabled = false; - break; - default: - if(inCommand >= ENCODING_BASE && inCommand < ENCODING_CEILING) - { - outEnabled = true; - outUsesMark = true; - - int16 csid = CPrefs::CmdNumToDocCsid( inCommand ); - outMark = (csid == mContext->GetDefaultCSID()) ? checkMark : ' '; - } else - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - } -} // CHTMLView::FindCommandStatus - - -void CHTMLView::GetDefaultFileNameForSaveAs(URL_Struct* url, CStr31& defaultName) -{ - // Overridden by CMessageView to use the message subject instead. - fe_FileNameFromContext(*mContext, url->address, defaultName); -} - - -void CHTMLView::NoteFontScalingChanged ( ) -{ - if ( GetContext() ) { - MWContext* mwContext = *GetContext(); - mwContext->fontScalingPercentage = LO_GetScalingFactor(static_cast(mFontScaling)); - GetContext()->Repaginate(NET_SUPER_RELOAD); - } - -} // NoteFontScalingChanged - - -Boolean CHTMLView::ObeyCommand(CommandT inCommand, void* ioParam) -{ - Boolean cmdHandled = false; - CHTMLClickRecord* cr = mCurrentClickRecord; // for brevity. - // cr will be non-null when handling a context menu command. - mCurrentClickRecord = nil; // set it back. - LClipboard* clip = LClipboard::GetClipboard(); - switch (inCommand) - { - case cmd_NEW_WINDOW_WITH_FRAME: - URL_Struct* url = CreateURLStructOfCurrent(false); - if (url) { - url->history_num = 0; - DispatchURL(url, mContext, false, true); - } - cmdHandled = true; - break; - - case cmd_OPEN_LINK: - if (cr) - { - if (cr->mClickKind == eImageIcon) - { - // Make sure that we follow the link, and not load the image - cr->mClickKind = eImageAnchor; - } - ClickSelfLink(*(SMouseDownEvent*)ioParam, *cr, FALSE); - } - cmdHandled = true; - break; - case cmd_NEW_WINDOW: - if (cr) - { - ClickSelfLink(*(SMouseDownEvent*)ioParam, *cr, TRUE);// case C - cmdHandled = true; - } - break; - case cmd_COPY_LINK_LOC: - if (cr) - { - try //Êcase D - { - if (cr->IsAnchor() && (cr->mClickURL.length() > 0)) - clip->SetData('TEXT', cr->mClickURL.data(), cr->mClickURL.length(), TRUE); - else // case E - { - cstring urlString = mContext->GetCurrentURL(); - clip->SetData('TEXT', urlString.data(), urlString.length(), TRUE); - } - } - catch(...) {} - cmdHandled = true; - } - break; - case cmd_VIEW_IMAGE: - if (cr) - { - cstring urlString = GetURLFromImageElement(mContext, (LO_ImageStruct*) cr->mElement); - if (urlString != "") - { - URL_Struct* url = NET_CreateURLStruct(urlString, NET_DONT_RELOAD); - DispatchURL(url, mContext); - } - cmdHandled = true; - } - break; - case cmd_SAVE_IMAGE_AS: - if (cr) - { - StandardFileReply reply; - cstring urlString = GetURLFromImageElement(mContext, (LO_ImageStruct*) cr->mElement); - if (urlString == "") - break; - CStr31 fileName = CFileMgr::FileNameFromURL( urlString ); - Boolean isMailAttachment = false; - #ifdef MOZ_MAIL_NEWS - isMailAttachment = XP_STRSTR( urlString, "?part=") || XP_STRSTR(urlString, "&part="); - if( isMailAttachment ) - { - fe_FileNameFromContext(*mContext, urlString, fileName); - } - #endif // MOZ_MAIL_NEWS - - StandardPutFile(GetPString(MCLICK_SAVE_IMG_AS), fileName, &reply); - if (reply.sfGood) - { - URL_Struct* url = NET_CreateURLStruct(urlString, NET_DONT_RELOAD); - XP_MEMSET(&url->savedData, 0, sizeof(SHIST_SavedData)); - CURLDispatcher::DispatchToStorage(url, reply.sfFile); - } - cmdHandled = true; - } - break; - case cmd_COPY_IMAGE: - if (cr) - { - PicHandle pict = ConvertImageElementToPICT((LO_ImageStruct*) cr->mElement); - if (pict != NULL) - { - try - { - clip->SetData('PICT', (Handle) pict, TRUE); - } - catch(...) - { - } - KillPicture(pict); - } - cmdHandled = true; - } - break; - case cmd_COPY_IMAGE_LOC: - if (cr) - { - cstring urlString = GetURLFromImageElement(mContext, (LO_ImageStruct*) cr->mElement); - if (urlString != "") - { - try - { - clip->SetData('TEXT', urlString, strlen(urlString), TRUE ); - } - catch(...) - {} - } - cmdHandled = true; - } - break; - case cmd_LOAD_IMAGE: - if (cr) - { - PostDeferredImage(cr->mImageURL); - cmdHandled = true; - } - break; - - case cmd_LoadImages: - { - // Load images for the top-most browser context - - cmdHandled = true; - - if (GetContext()) - { - CBrowserContext* theTopContext = GetContext()->GetTopContext(); - if (theTopContext) - { - LO_SetForceLoadImage(NULL, TRUE); - theTopContext->Repaginate(); - } - } - } - break; - - case cmd_ViewSource: - { - URL_Struct* url = CreateURLStructOfCurrent(true); - if (url) - mContext->ImmediateLoadURL(url, FO_VIEW_SOURCE); - cmdHandled = true; - break; - } - - case cmd_AddToBookmarks: - { - // two cases: is this the "Add URL to bookmarks" from context menu or - // using "Add Bookmarks" from the bookmark menu. - - if ( cr && cr->IsAnchor() ) - { - // strip off the protocol then truncate the middle - char trunkedAddress[HIST_MAX_URL_LEN + 1]; - string url = cr->GetClickURL(); - const char* strippedAddr = SHIST_StripProtocol( const_cast(url.c_str()) ); - INTL_MidTruncateString( 0, strippedAddr, trunkedAddress, HIST_MAX_URL_LEN ); - - CBookmarksAttachment::AddToBookmarks( cr->GetClickURL(), trunkedAddress); - } - else { - History_entry *entry = mContext->GetCurrentHistoryEntry(); - if ( entry ) - CBookmarksAttachment::AddToBookmarks(entry->address, entry->title); - } - break; - } - case cmd_SAVE_LINK_AS: - case cmd_SaveAs: - { - URL_Struct* url = nil; - if (cr && cr->IsAnchor() && inCommand == cmd_SAVE_LINK_AS ) - url = NET_CreateURLStruct(cr->mClickURL, NET_DONT_RELOAD); - else - url = CreateURLStructOfCurrent(true); - - CStr31 fileName; - Boolean isMailAttachment = false; -#ifdef MOZ_MAIL_NEWS - isMailAttachment = XP_STRSTR( url->address, "?part=") || XP_STRSTR(url->address, "&part="); - if( isMailAttachment ) - CHTMLView::GetDefaultFileNameForSaveAs(url, fileName); - else -#endif // MOZ_MAIL_NEWS - { - if (inCommand == cmd_SAVE_LINK_AS) - fileName = CFileMgr::FileNameFromURL( url->address ); - else - GetDefaultFileNameForSaveAs(url, fileName); - } - - StandardFileReply reply; - short format; - if (cr && cr->IsAnchor() && (!strncasecomp(url->address, "ftp://", 6) || isMailAttachment ) ) - (void) UStdDialogs::AskSaveAsSource(reply, fileName, format); - else - (void) UStdDialogs::AskSaveAsTextOrSource(reply, fileName, format); - if (reply.sfGood) - { - // Set the type and creator - bug #107708 - url->x_mac_type = (char*)XP_ALLOC(9); - ThrowIfNil_(url->x_mac_type); - sprintf(url->x_mac_type, "%X", emTextType); - url->x_mac_creator = (char*)XP_ALLOC(9); - ThrowIfNil_(url->x_mac_creator); - sprintf(url->x_mac_creator, "%X", emSignature); - - short saveType = (format == 2) ? FO_SAVE_AS : FO_SAVE_AS_TEXT; - CURLDispatcher::DispatchToStorage(url, reply.sfFile, saveType, isMailAttachment ); - } - - cmdHandled = true; - break; - } - - case cmd_Copy: - { - char* realText; - XP_Block copyText = LO_GetSelectionText(*mContext); - OSErr err = ::ZeroScrap(); - - XP_LOCK_BLOCK(realText, char*, copyText); - err = ::PutScrap(strlen(realText), 'TEXT', (Ptr)realText); - ::TEFromScrap(); - XP_UNLOCK_BLOCK(copyText); - XP_FREE_BLOCK(copyText); - break; - } - - case cmd_SelectAll: - { - (void) LO_SelectAll(*mContext); - break; - } - - case cmd_Find: - { - CFindWindow::DoFind(this); - break; - } - - case cmd_FindAgain: - { - DoFind(); - break; - } - - case cmd_Print: - case cmd_PrintOne: - { - DoPrintCommand(inCommand); - cmdHandled = true; - break; - } - - case cmd_SecurityInfo: - { - MWContext* mwcontext = *GetContext(); - if (mwcontext) - { - URL_Struct* url = - SHIST_CreateURLStructFromHistoryEntry( - mwcontext, - GetContext()->GetCurrentHistoryEntry() - ); - - // It's OK if we call SECNAV_SecurityAdvisor with a NULL URL - // which is the case when the user has a blank page as their startup - // BUG #66435 - //if (url) - SECNAV_SecurityAdvisor(mwcontext,url); - } - break; - } - - case cmd_DocumentInfo: - URL_Struct* aboutURL = NET_CreateURLStruct( "about:document", NET_DONT_RELOAD ); - if ( aboutURL ) - { - // about:document is displayed in the doc info window, so we don't need to call CURLDispatcher. - // Just call SwitchLoadURL on mContext - mContext->SwitchLoadURL(aboutURL, FO_CACHE_AND_PRESENT); - } - break; - - case cmd_FTPUpload: - case msg_TabSelect: - case cmd_PrivDisplayPolicy: - case cmd_PrivDisplaySiteInfo: - cmdHandled = true; - break; - - case cmd_MailDocument: // Send Page/Frame - MSG_MailDocument(*mContext); - break; - - - case cmd_FontLarger: - if ( mFontScaling < eMaxFontScaling ) { - ++mFontScaling; - NoteFontScalingChanged(); - } - break; - - case cmd_FontSmaller: - if ( mFontScaling > eMinFontScaling ) { - --mFontScaling; - NoteFontScalingChanged(); - } - break; - - default: - cmdHandled = LCommander::ObeyCommand(inCommand, ioParam); - break; - } - if (cr && cr->IsAnchor()) - LO_HighlightAnchor(*mContext, cr->mElement, FALSE); - return cmdHandled; -} // CHTMLView::ObeyCommand - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -Boolean CHTMLView::SetDefaultCSID(Int16 default_csid, Boolean forceRepaginate /* = false */) -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - if (mContext) - { - if (default_csid != mContext->GetDefaultCSID()) - { - mContext->SetDefaultCSID(default_csid); - mContext->SetWinCSID(INTL_DocToWinCharSetID(default_csid)); - forceRepaginate = true; - } - if (forceRepaginate) - mContext->Repaginate(); - } - return true; -} // CHTMLView::SetDefaultCSID - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -Boolean CHTMLView::CanPrint() const -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - // ¥ in order to be able to print we must - // not already be printing, - // not be busy loading, - // not be busy repaginating, - // have a page loaded, - // not be low on memory, - // and have a print record to print with - return mContext && - !XP_IsContextBusy(*mContext) && - !mContext->IsRepaginating() && - (mContext->GetCurrentHistoryEntry() != nil) && - !Memory_MemoryIsLow(); -// && CPrefs::GetPrintRecord(); -/* We no longer checking for a print record; now we allow the user to make - the menu selection and then provide feedback about its failure) */ -} // CHTMLView::CanPrint() const - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -URL_Struct *CHTMLView::GetURLForPrinting(Boolean& outSuppressURLCaption, MWContext * /* context */) -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - MWContext *context = *GetContext(); - History_entry* current = SHIST_GetCurrent(&context->hist); - ThrowIfNil_(current); - - URL_Struct* url = SHIST_CreateWysiwygURLStruct(context, current); - ThrowIfNil_(url); - - LO_SaveFormData(context); - - outSuppressURLCaption = false; - - return url; -} // CHTMLView::GetURLForPrinting() - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CHTMLView::DoPrintCommand(CommandT inCommand) -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - THPrint hp; - hp = CPrefs::GetPrintRecord(); - if ( !hp ) - { - FE_Alert( *GetContext(), GetPString ( NO_PRINTER_RESID ) ); - return; - } - - UPrintingMgr::ValidatePrintRecord( hp ); - - Boolean printOne = ( inCommand == cmd_PrintOne ); - - // - // If this page is a single fullscreen plugin, give the - // plugin a chance to handle the entire print process. If - // it returns false, it doesnÕt want to take over printing, - // so we should print as normal. - // - Boolean doPrint = true; - - NPEmbeddedApp* app = ((MWContext*)*mContext)->pluginList; - if (app != NULL && app->next == NULL && app->pagePluginType == NP_FullPage) - { - CPluginView* plugin = (CPluginView*) app->fe_data; - if ( plugin ) - doPrint = ( plugin->PrintFullScreen( printOne, hp ) != TRUE ); - } - - // - // There wasnÕt a fullscreen plugin, or there was a plugin - // but it wants us to take care of printing. In this case - // we should show the normal dialog if necessary and print. - // - if ( doPrint ) - { - if ( printOne ) - { - (**hp).prJob.iFstPage = 1; - (**hp).prJob.iLstPage = max_Pages; - (**hp).prJob.iCopies = 1; - UHTMLPrinting::BeginPrint( hp, this ); - } - else - { - if ( UPrintingMgr::AskPrintJob( hp ) ) - UHTMLPrinting::BeginPrint( hp, this ); - } - } -} // CHTMLView::DoPrintCommand - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- FIND SUPPORT --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - - -void CHTMLView::CreateFindWindow() -{ - LWindow::CreateWindow(6000, LCommander::GetTopCommander()); -} - - // history code, I am not sure what does it do -static void SelectionToImage(LO_Element* startElement, - int32 /*startPos*/, - LO_Element* /*endElement*/, - int32 /*endPos*/, - SPoint32* topLeft, - SPoint32* botRight) -{ - /* - Calculate an image rectangle which is good enough to display some portion - of a selection. Since selections can wrap around and do other wierd stuff, - we'll make it big enough to cover the first "element" of the selection. - */ - - topLeft->h = startElement->lo_any.x; - topLeft->v = startElement->lo_any.y; - - botRight->h = startElement->lo_any.x + 64 /*endPos*/; - botRight->v = startElement->lo_any.y + 20; -} - -// Returns whether the search string was found - 1997-02-27 mjc -Boolean CHTMLView::DoFind() -{ - int32 start_position; - int32 end_position; - LO_Element* start_ele_loc = NULL; - LO_Element* end_ele_loc = NULL; - CL_Layer* layer; - MWContext* gridContext; - MWContext* currentContext = *mContext; - Boolean found = false; - char* lookFor = CFindWindow::sLastSearch; - Boolean caseless = CFindWindow::sCaseless; - Boolean backward = CFindWindow::sBackward; - Boolean doWrap = CFindWindow::sWrap; - - /* - I didn't like doing that, that being "grabbing statics from a class" - but it's a lot cleaner than before, and it works. Mail gets this for - free, and only need a few overrides to provide their own search dialog - deeje 1997-01-22 - */ - - // work within the current selection - LO_GetSelectionEndpoints(currentContext, - &start_ele_loc, - &end_ele_loc, - &start_position, - &end_position, - &layer); - - do { - gridContext = currentContext; - found = LO_FindGridText(currentContext, - &gridContext, - lookFor, - &start_ele_loc, - &start_position, - &end_ele_loc, - &end_position, - !caseless, - !backward); - - if (found) - break; - if (doWrap) { - /* try again from the beginning. these are the values LO_GetSelectionEndpoints - returns if there was no selection */ - start_ele_loc = NULL; - end_ele_loc = NULL; - start_position = 0; - end_position = 0; - doWrap = false; - } else { - SysBeep(1); - return false; - } - } while (true); - - /* 6.6.97: set target even if we didn't switch cells. do this in case the CHTMLView - isn't the target at all. this is entirely possible after the first Find on - a new window. */ -// if (currentContext != gridContext) // Text was found in a different cell -// { - SwitchTarget(gridContext->fe.newView); -// } - - SPoint32 selTopLeft, selBotRight; - int32 tlx, tly; - - // Scroll before selecting because otherwise hilighting gets screwed up - SelectionToImage(start_ele_loc, - start_position, - end_ele_loc, - end_position, - &selTopLeft, - &selBotRight); - - RevealInImage(gridContext->fe.newView, selTopLeft, selBotRight); - LO_SelectText(gridContext, - start_ele_loc, - start_position, - end_ele_loc, - end_position, - &tlx, - &tly); - return true; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- MOUSING AND KEYING --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Converts image point to offset from the origin of the available screen rect. -// That is, the screen origin + menubar height. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ImageToAvailScreenPoint(const SPoint32 &inImagePoint, Point &outPoint) const -{ - ImageToLocalPoint(inImagePoint, outPoint); - LocalToPortPoint(outPoint); - PortToGlobalPoint(outPoint); - outPoint.v -= ::GetMBarHeight(); -} - -void CHTMLView::ClickSelf(const SMouseDownEvent& inMouseDown) -{ -// With LAYERS, the original method gets the compositor to dispatch -// the event, which is then dealt with (in this method) on a per-layer -// basis. - - if ((mContext != NULL) && FocusDraw() && SwitchTarget(this)) - { - Int16 clickCount = GetClickCount(); - SPoint32 theImageClick; - LocalToImagePoint(inMouseDown.whereLocal, theImageClick); - if (mCompositor != NULL) - { - fe_EventStruct fe_event; - fe_event.portPoint = inMouseDown.wherePort; - //fe_event.event = (void *)&inMouseDown; - fe_event.event.mouseDownEvent = inMouseDown; // 1997-02-25 mjc - - CL_Event event; - - if (clickCount > 2) return; // ignore triple (or more) clicks - event.type = CL_EVENT_MOUSE_BUTTON_DOWN; - event.fe_event = (void *)&fe_event; - event.fe_event_size = sizeof(fe_EventStruct); // 1997-02-25 mjc - event.x = theImageClick.h; - event.y = theImageClick.v; - event.which = 1; - event.data = clickCount; - event.modifiers = CMochaHacks::MochaModifiers(inMouseDown.macEvent.modifiers); // 1997-02-27 mjc - - // set a wait flag that gives ClickSelfLink and EventMouseUp a chance to execute, - // and prevents the possibility of two mouse ups occurring for one mouse down. - // ALERT: - // This approach may have to be revised if we need to handle double clicks in JS. - // This is because there seem to be some cases in which a double click might cause - // EventMouseUp to be called when ClickSelfLink should be called instead. While this - // has no adverse affect on the browser, a script may not expect that the mouse up - // is not followed by a click. - mWaitMouseUp = true; - CL_DispatchEvent(*mCompositor, &event); - } - else - { - mWaitMouseUp = true; - ClickSelfLayer(inMouseDown, NULL, theImageClick); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Callback for click handling for new mocha event stuff -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// DoExecuteClickInLinkRecord -// Used as a Mocha callback structure -// holds all the information needed to call ReallyDoExecuteClickInLink -class DoExecuteClickInLinkRecord -{ -public: - SMouseDownEvent mWhere; - CHTMLClickRecord mCr; - Boolean mMakeNewWindow; - Boolean mSaveToDisk; - LO_AnchorData* mMouseOverMapArea; // for click event handling in image maps - CHTMLView * mView; - int32 mEventType; - - DoExecuteClickInLinkRecord( CHTMLView * view, - const SMouseDownEvent& where, - CHTMLClickRecord cr, - Boolean makeNewWindow, - Boolean saveToDisk, - LO_AnchorData* mouseOverMapArea, - int32 eventType) - : mCr(cr) // do we really want to use default copy contructor? - { - mView = view; - mWhere = where; - mMakeNewWindow = makeNewWindow; - mSaveToDisk = saveToDisk; - mMouseOverMapArea = mouseOverMapArea; - mEventType = eventType; - } - - void ExecuteClickInLink() - { - Assert_(mView != NULL); - mView->PostProcessClickSelfLink(mWhere, mCr, mMakeNewWindow, mSaveToDisk, false); - } -}; - -// Mocha callback for DoExecuteClickInLink -// Click preceded by mouse up - 1997-03-08 mjc -void MochaDoExecuteClickInLinkCallback(MWContext * pContext, LO_Element * lo_element, int32 lType, void * whatever, ETEventStatus status); -void MochaDoExecuteClickInLinkCallback(MWContext * pContext, - LO_Element * lo_element, - int32 /* lType */, - void * whatever, - ETEventStatus status) -{ - DoExecuteClickInLinkRecord * p = (DoExecuteClickInLinkRecord*)whatever; - - if (status == EVENT_OK) - { - if (p->mEventType == EVENT_MOUSEUP) - { - try { - - DoExecuteClickInLinkRecord* clickRecord = - new DoExecuteClickInLinkRecord(p->mView, - p->mWhere, - p->mCr, - p->mMakeNewWindow, - p->mSaveToDisk, - p->mMouseOverMapArea, - EVENT_CLICK); - - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - if (p->mMouseOverMapArea != NULL) - { - lo_element = XP_NEW_ZAP(LO_Element); // Need to fake the element, ask chouck for details - lo_element->type = LO_TEXT; - lo_element->lo_text.anchor_href = p->mMouseOverMapArea; - if (lo_element->lo_text.anchor_href->anchor) - lo_element->lo_text.text = lo_element->lo_text.anchor_href->anchor; // to pass js freed element check - } - CL_Layer* layer = p->mCr.GetLayer(); - event->type = EVENT_CLICK; - event->which = 1; - event->x = p->mCr.GetImageWhere().h; - event->y = p->mCr.GetImageWhere().v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - Point screenPt = { event->docy, event->docx }; - SPoint32 imagePt; - p->mView->LocalToImagePoint(screenPt, imagePt); - p->mView->ImageToAvailScreenPoint(imagePt, screenPt); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - - event->layer_id = LO_GetIdFromLayer(pContext, layer); - event->modifiers = CMochaHacks::MochaModifiers(p->mWhere.macEvent.modifiers); - ET_SendEvent(pContext, - lo_element, - event, - MochaDoExecuteClickInLinkCallback, - clickRecord); - } - } - catch (...) - { - } - } - else if (p->mEventType == EVENT_CLICK && p->mCr.IsClickOnAnchor()) - p->ExecuteClickInLink(); - } - // Free faked element after click - if (p->mEventType == EVENT_CLICK && p->mMouseOverMapArea != NULL) - XP_FREE(lo_element); - delete p; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// Mouse tracking. -// On click if it is an anchor, track it. If the mouse does not move, load the anchor. -// If it is not an anchor, continue the selection. - -void CHTMLView::ClickSelfLayer( - const SMouseDownEvent& inMouseDown, - CL_Layer* inLayer, - SPoint32 inLayerWhere) -{ - SPoint32 theElementWhere = inLayerWhere; - LO_Element* theElement = LO_XYToElement(*mContext, theElementWhere.h, theElementWhere.v, inLayer); - - CHTMLClickRecord cr(inMouseDown.whereLocal, inLayerWhere, mContext, theElement, inLayer); - cr.Recalc(); - - Boolean bClickHandled = false; - - // ¥ with shift key, just track selection - if ((inMouseDown.macEvent.modifiers & shiftKey) == 0) - { - if ((theElement != NULL) && cr.PixelReallyInElement(theElementWhere, theElement)) - { - // Also, check for click in selection first, as it takes precedence over others. If - // the drag is successful, set |bClickHandled| so we don't try to do anyting else - // with it. - if ( cr.IsClickOnSelection() ) { - // are we dragging? Use a try block to ensure that we set click record back to nil - mCurrentClickRecord = &cr; - EClickState theMouseAction = eMouseUndefined; - try { - // don't allow context menus here, we'll handle them below. Is this the - // right thing to do? - theMouseAction = cr.WaitForMouseAction(inMouseDown, this, GetDblTime(), false); - } - catch(...) {} - mCurrentClickRecord = nil; - - // if so, drag the selection - try { - if ( theMouseAction == eMouseDragging ) { - StValueChanger val (mDragSelection, true); - ClickDragSelection(inMouseDown, theElement); - bClickHandled = true; - } - } - catch ( ... ) { } - - } // if click on selection - - // Move check for edge click here; otherwise, if you hold down mouse button over - // edge, then context menu pops up. Whoops. - if ( !bClickHandled && cr.IsClickOnEdge()) - ClickTrackEdge(inMouseDown, cr); - else if ( !bClickHandled && cr.IsClickOnAnchor()) - { - Int32 theClickStart = inMouseDown.macEvent.when; - Point thePrevPoint = inMouseDown.whereLocal; - - LO_HighlightAnchor(*mContext, theElement, true); - - mCurrentClickRecord = &cr; - EClickState theMouseAction = eMouseUndefined; - // Use a try block to ensure that we set it back to nil - try - { - theMouseAction = cr.WaitForMouseAction(inMouseDown, this, GetDblTime(), ContextMenuPopupsEnabled()); - } - catch(...) {} - mCurrentClickRecord = nil; - - // Whether we need to unhighlight after handling the click. - // In the mouse up early case, unhighlighting must be done before the - // content changes, not afterwards, otherwise we would crash because the - // element is no longer there. - Boolean doUnhighlight = true; - - switch (theMouseAction) - { - case eMouseDragging: - ClickDragLink(inMouseDown, theElement); - break; - - case eMouseTimeout: -/* - { - Int16 thePopResult = this->DoPopup(inMouseDown, cr); - if (thePopResult) - this->HandlePopupResult(inMouseDown, cr, thePopResult); - else - LO_HighlightAnchor(*mContext, cr.mElement, false); - } -*/ - break; - - case eMouseUpEarly: - ClickSelfLink(inMouseDown, cr, false); - doUnhighlight = false; - break; - - case eMouseHandledByAttachment: - // Nothing else to do. - break; - default: - SignalPStr_("\pUnhandled click case!!!"); - break; - } - - if (doUnhighlight) LO_HighlightAnchor(*mContext, cr.mElement, false); - bClickHandled = true; - } - else if ( !bClickHandled && (theElement != NULL) && (theElement->type == LO_IMAGE)) - { - // ¥ allow dragging of non-anchor images - mCurrentClickRecord = &cr; - EClickState theMouseAction = eMouseUndefined; - try - { - theMouseAction = cr.WaitForMouseAction(inMouseDown.whereLocal, inMouseDown.macEvent.when, GetDblTime()); - } - catch(...) {} - mCurrentClickRecord = nil; - if (theMouseAction == eMouseDragging) - { - ClickDragLink(inMouseDown, theElement); - bClickHandled = true; - } - } - } - } - - // callback for form elements - mjc - if (!bClickHandled) - { - if ((theElement != NULL) && - (theElement->type == LO_FORM_ELE) && - (inLayerWhere.h - theElement->lo_form.x - theElement->lo_form.x_offset <= theElement->lo_form.width) && - (inLayerWhere.h - theElement->lo_form.x - theElement->lo_form.x_offset >= 0) && - (inLayerWhere.v - theElement->lo_form.y - theElement->lo_form.y_offset <= theElement->lo_form.height) && - (inLayerWhere.v - theElement->lo_form.y - theElement->lo_form.y_offset >= 0)) - { - switch (theElement->lo_form.element_data->type) - { - case FORM_TYPE_SUBMIT: - case FORM_TYPE_RESET: - case FORM_TYPE_BUTTON: - { - LPane* thePane = ((FormFEData *)theElement->lo_form.element_data->ele_minimal.FE_Data)->fPane; - - CFormButton* theFormButton = dynamic_cast(thePane); - CGAFormPushButton* theGAFormPushButton = dynamic_cast(thePane); - - if (theFormButton) - { - theFormButton->ClickSelfLayer(inMouseDown); - } - else if (theGAFormPushButton) - { - theGAFormPushButton->ClickSelfLayer(inMouseDown); - } - else - { - Assert_(false); - } - - bClickHandled = true; - } - break; - case FORM_TYPE_RADIO: - { - LPane* thePane = ((FormFEData *)theElement->lo_form.element_data->ele_minimal.FE_Data)->fPane; - - CFormRadio* theFormRadio = dynamic_cast(thePane); - CGAFormRadio* theGAFormRadio = dynamic_cast(thePane); - - if (theFormRadio) - { - theFormRadio->ClickSelfLayer(inMouseDown); - } - else if (theGAFormRadio) - { - theGAFormRadio->ClickSelfLayer(inMouseDown); - } - else - { - Assert_(false); - } - - bClickHandled = true; - } - break; - case FORM_TYPE_CHECKBOX: - { - LPane* thePane = ((FormFEData *)theElement->lo_form.element_data->ele_minimal.FE_Data)->fPane; - - CFormCheckbox* theFormCheckbox = dynamic_cast(thePane); - CGAFormCheckbox* theGAFormCheckbox = dynamic_cast(thePane); - - if (theFormCheckbox) - { - theFormCheckbox->ClickSelfLayer(inMouseDown); - } - else if (theGAFormCheckbox) - { - theGAFormCheckbox->ClickSelfLayer(inMouseDown); - } - else - { - Assert_(false); - } - - bClickHandled = true; - } - break; - } - } - } - - // ¥¥¥Êthere must be a better way... - // - // this is just about the same code as above for handling a click - // but it's repeated here because the code above handles clicks on graphical elements? - // - // also, I see two version of WaitForMouseAction being called, one global and one inside cr - // which is appropriate? - // - // 96-12-18 deeje - - if (!bClickHandled && ContextMenuPopupsEnabled()) - { - mCurrentClickRecord = &cr; - EClickState mouseAction = eMouseUndefined; - try - { - mouseAction = CHTMLClickRecord::WaitForMouseAction(inMouseDown, this, GetDblTime()); - } - catch (...) {} - mCurrentClickRecord = nil; - if ( mouseAction == eMouseHandledByAttachment ) - bClickHandled = TRUE; -/* - if ( mouseAction == CHTMLClickRecord::eMouseTimeout ) // No popup when we have grids - { - Int16 thePopResult = this->DoPopup(inMouseDown, cr); - if (thePopResult) - this->HandlePopupResult(inMouseDown, cr, thePopResult); - - bClickHandled = TRUE; - } -*/ - } - - if (!bClickHandled) - { - Boolean didTrackSelection = ClickTrackSelection(inMouseDown, cr); - // if no selection, and we're not over an element, - // send a mouse up and click to the document - if (!didTrackSelection && (cr.mClickKind == eNone)) - { - EventRecord macEvent; - - GetOSEvent(mUpMask, &macEvent); // grab the mouse up event so LEventDispatcher never sees it - - mWaitMouseUp = false; - try { - DoExecuteClickInLinkRecord* clickRecord = - new DoExecuteClickInLinkRecord(this, - inMouseDown, - cr, - false, - false, - NULL, - EVENT_MOUSEUP); - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - // 97-06-10 pkc -- Turn off grab mouse events here because we don't call - // compositor for mouse ups. - MWContext* mwContext = *mContext; - if (mwContext->js_dragging==TRUE) { - CL_GrabMouseEvents(mwContext->compositor, NULL); - mwContext->js_dragging = 0; - } - - event->type = EVENT_MOUSEUP; - event->which = 1; - event->x = cr.mImageWhere.h; - event->y = cr.mImageWhere.v; - event->docx = event->x + CL_GetLayerXOrigin(cr.mLayer); - event->docy = event->y + CL_GetLayerYOrigin(cr.mLayer); - - Point screenPt = { event->docy, event->docx }; - SPoint32 imagePt; - LocalToImagePoint(screenPt, imagePt); - ImageToAvailScreenPoint(imagePt, screenPt); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - - event->layer_id = LO_GetIdFromLayer(*mContext, cr.mLayer); - event->modifiers = CMochaHacks::MochaModifiers(inMouseDown.macEvent.modifiers); - ET_SendEvent(*mContext, - NULL, - event, - MochaDoExecuteClickInLinkCallback, - clickRecord); - } - } catch (...) { - } - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ClickSelfLink( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord, - Boolean inMakeNewWindow) -{ - // Execute this only if there was a previous mouse down which did not have a corresponding - // mouse up. - if (mWaitMouseUp) - { - EventRecord macEvent; - - GetOSEvent(mUpMask, &macEvent); // grab the mouse up event so LEventDispatcher never sees it - - mWaitMouseUp = false; // got a mouse up so clear the wait flag. - - Boolean bSaveToDisk = ((inMouseDown.macEvent.modifiers & optionKey) == optionKey) - && !inMakeNewWindow; - - // do we also have to use a StTempFormBlur in PostProcessClickSelfLink? - StTempFormBlur tempBlur; // mforms.h for an explanation - - // check for event handler in containing contexts or on anchor for the events - // we are about to send. - LO_Element* element = inClickRecord.GetLayoutElement(); - if (HasEventHandler(*mContext, (EVENT_MOUSEUP | EVENT_CLICK)) || - // map area anchor with an event handler - (CMochaHacks::GetMouseOverMapArea() && CMochaHacks::GetMouseOverMapArea()->event_handler_present) || - (element && - // ALERT: event_handler_present doesn't seem to be initialized properly so test against TRUE. - ((element->type == LO_TEXT && element->lo_text.anchor_href && (element->lo_text.anchor_href->event_handler_present == TRUE)) || - (element->type == LO_IMAGE && element->lo_image.anchor_href && (element->lo_image.anchor_href->event_handler_present == TRUE)) || - // a plain image without an anchor could have event handlers, but there is no bit to tell us that. - ((element->type == LO_IMAGE) && - (element->lo_image.anchor_href == NULL) && - (element->lo_image.image_attr->usemap_name == NULL) && // not a client-side image map - !(element->lo_image.image_attr->attrmask & LO_ATTR_ISMAP))))) // not a server-side image map - { - try { - DoExecuteClickInLinkRecord* clickRecord = - new DoExecuteClickInLinkRecord(this, - inMouseDown, - inClickRecord, - inMakeNewWindow, - bSaveToDisk, - CMochaHacks::GetMouseOverMapArea(), - EVENT_MOUSEUP); - // ET_SendEvent now takes a JSEvent struct instead of an int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - // 97-06-10 pkc -- Turn off grab mouse events here because we don't call - // compositor for mouse ups. - MWContext* mwContext = *mContext; - if (mwContext->js_dragging==TRUE) { - CL_GrabMouseEvents(mwContext->compositor, NULL); - mwContext->js_dragging = 0; - } - - event->type = EVENT_MOUSEUP; - event->which = 1; - // send layer relative position info to mocha - mjc - event->x = inClickRecord.mImageWhere.h; - event->y = inClickRecord.mImageWhere.v; - event->docx = event->x + CL_GetLayerXOrigin(inClickRecord.mLayer); - event->docy = event->y + CL_GetLayerYOrigin(inClickRecord.mLayer); - - Point screenPt; - ImageToAvailScreenPoint(inClickRecord.mImageWhere, screenPt); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - - event->layer_id = LO_GetIdFromLayer(*mContext, inClickRecord.mLayer); // 1997-03-02 mjc - event->modifiers = CMochaHacks::MochaModifiers(inMouseDown.macEvent.modifiers); // 1997-02-27 mjc - ET_SendEvent(*mContext, - inClickRecord.mElement, - event, - MochaDoExecuteClickInLinkCallback, - clickRecord); - } - } catch (...) { - } - } - // We delay DispatchToView because we're completely handling the mouse - // down in the front end, so the compositor needs to unwind before we switch content. - else PostProcessClickSelfLink(inMouseDown, inClickRecord, inMakeNewWindow, bSaveToDisk, true); - } -} - -// PostProcessClickSelfLink -// Mocha callback routine, post processes DoExecuteClickInLink -// Because of the new threaded mocha, we have to wait for a call back -// after mocha calls, this code used to come after the call to LM_SendOnClick in ClickSelfLink. -// Now, this code gets executed after the call to ET_SendEvent calls us back through -// MochaDoExecuteClickInLinkCallback. -// -// inDelay - set to true if there is a possibility that the content will change before the compositor -// has finished unwinding from the mouse down event dispatch. If there were intervening -// javascript or compositor calls, for example, there is no need to delay. -void CHTMLView::PostProcessClickSelfLink( - const SMouseDownEvent& /* inMouseDown */, - CHTMLClickRecord& inClickRecord, - Boolean inMakeNewWindow, - Boolean inSaveToDisk, - Boolean inDelay) -{ - // Sniff the URL to detect mail attachment. Set inSaveToDisk accordingly before - // dispatching. Note that in Constellation, mail messages may be viewed in a browser - // view! - -/* - Boolean isMailAttachment = false; - const char* url = inClickRecord.GetClickURL(); - if (!strncasecomp (url, "mailbox:", 8)) - { - if (XP_STRSTR(url, "?part=") || XP_STRSTR(url, "&part=")) - isMailAttachment = true; // Yep, mail attachment. - } -*/ - - CBrowserContext* theSponsorContext = (inMakeNewWindow) ? NULL : mContext; - - EClickKind oldClickKind = inClickRecord.mClickKind; - - inClickRecord.Recalc(); - - switch (inClickRecord.mClickKind) - { - case eTextAnchor: - case eImageAnchor: - case eImageIsmap: - case eImageAltText: - { - // unhighlight the anchor while it is still around (before content is switched) - LO_HighlightAnchor(*mContext, inClickRecord.mElement, false); - - FO_Present_Types theType = (inSaveToDisk) ? FO_SAVE_AS : FO_CACHE_AND_PRESENT; - URL_Struct* theURL = NET_CreateURLStruct(inClickRecord.mClickURL, NET_DONT_RELOAD); - ThrowIfNULL_(theURL); - - // Fix bug -- call GetURLForReferral() to set referer field in URL_Struct - cstring theReferer = mContext->GetURLForReferral(); - if (theReferer.length() > 0) - theURL->referer = XP_STRDUP(theReferer); - - if (inMakeNewWindow) - theURL->window_target = XP_STRDUP(""); - else - { - if (XP_STRCMP(inClickRecord.mWindowTarget, "") != 0) - theURL->window_target = XP_STRDUP(inClickRecord.mWindowTarget); - else - theURL->window_target = NULL; - } - - if (FO_SAVE_AS == theType) - { - // See also the code for popup stuff. Combine these later. FIX ME. - CStr31 fileName = CFileMgr::FileNameFromURL( theURL->address ); - //fe_FileNameFromContext(*mContext, theURL->address, fileName); - StandardFileReply reply; -/* - if (isMailAttachment) - { - // ad decoder will prompt for the name. - reply.sfGood = true; - ::FSMakeFSSpec(0, 0, fileName, &reply.sfFile); - } - else -*/ - ::StandardPutFile(GetPString(SAVE_AS_RESID), fileName, &reply); - if (reply.sfGood) - { - CURLDispatcher::DispatchToStorage(theURL, reply.sfFile, FO_SAVE_AS, false); - } - } - else if (FO_CACHE_AND_PRESENT == theType) - { - DispatchURL(theURL, theSponsorContext, inDelay, inMakeNewWindow); - } - break; - } - - case eImageForm: // Image that is an ISMAP form - { - // ET_SendEvent now takes a JSEvent struct instead of an int type - ImageFormSubmitData* data = new ImageFormSubmitData; - LO_ImageStruct* image = &inClickRecord.mElement->lo_image; - data->lo_image = image; - // set the coordinates relative to the image (not the document), taking into account the border. - data->x = inClickRecord.mImageWhere.h - (image->x + image->x_offset + image->border_width); - data->y = inClickRecord.mImageWhere.v - (image->y + image->y_offset + image->border_width); - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_SUBMIT; - // The code above will get executed in MochaFormSubmitCallback - ET_SendEvent(*mContext, - inClickRecord.mElement, - event, - MochaImageFormSubmitCallback, - data); - } - } - break; - - case eImageIcon: - { - if (!inSaveToDisk) - { - HandleImageIconClick(inClickRecord); - } - else - { - URL_Struct* theURL = NET_CreateURLStruct(inClickRecord.mClickURL, NET_DONT_RELOAD); - if (theURL == NULL) - break; - - cstring theReferer = theURL->address; - if (theReferer.length() > 0) - theURL->referer = XP_STRDUP(theReferer); - - if (inMakeNewWindow) - { - theURL->window_target = XP_STRDUP(""); - if (XP_STRCMP(inClickRecord.mWindowTarget, "") != 0) - theURL->window_target = XP_STRDUP(inClickRecord.mWindowTarget); - else - theURL->window_target = NULL; - } - - DispatchURL(theURL, theSponsorContext, false, inMakeNewWindow); - } - } - break; - - case eNone: - { - // 97-06-10 pkc -- Hack to dispatch URL's after mocha is done loading image. - // If oldClickKind is eImageAnchor, then we're in the case where mocha is loading - // an image over a current image. - if (oldClickKind == eImageAnchor && (((char*)inClickRecord.mClickURL) != NULL)) - { - URL_Struct* theURL = NET_CreateURLStruct(inClickRecord.mClickURL, NET_DONT_RELOAD); - ThrowIfNULL_(theURL); - - // Fix bug -- call GetURLForReferral() to set referer field in URL_Struct - cstring theReferer = mContext->GetURLForReferral(); - if (theReferer.length() > 0) - theURL->referer = XP_STRDUP(theReferer); - - if (inMakeNewWindow) - theURL->window_target = XP_STRDUP(""); - else - { - if (XP_STRCMP(inClickRecord.mWindowTarget, "") != 0) - theURL->window_target = XP_STRDUP(inClickRecord.mWindowTarget); - else - theURL->window_target = NULL; - } - // Call DispatchToView with inDelay = true and inWaitingForMochaImageLoad = true -// theDispatcher->DispatchToView(theSponsorContext, theURL, FO_CACHE_AND_PRESENT, inMakeNewWindow, 1010, true, true, true); - CURLDispatcher::DispatchURL(theURL, theSponsorContext, true, inMakeNewWindow, BrowserWindow_ResID, true, FO_CACHE_AND_PRESENT, true); - } - } - break; - - - default: - case eWaiting: - Assert_(false); - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CHTMLView::Click(SMouseDownEvent &inMouseDown) -// Special processing for drag-n-drop stuff, not to select the window until mouse up. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - LPane *clickedPane = FindSubPaneHitBy(inMouseDown.wherePort.h, - inMouseDown.wherePort.v); - if ( clickedPane != nil ) - clickedPane->Click(inMouseDown); - else - { - if ( !inMouseDown.delaySelect ) LCommander::SwitchTarget(this); - StValueChanger change(inMouseDown.delaySelect, false); - // For drag-n-drop functionality - LPane::Click(inMouseDown); // will process click on this View - } -} // CHTMLView::Click - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::HandleImageIconClick(CHTMLClickRecord& inClickRecord) -{ - char* url = inClickRecord.mImageURL; - // check to see if the click was on the attachment or SMime icon - if (!XP_STRNCMP(url, "internal-smime", 14) || !XP_STRNCMP(url, "internal-attachment-icon", 24) ) - { - URL_Struct* theURL = NET_CreateURLStruct(inClickRecord.mClickURL, NET_DONT_RELOAD); - mContext->SwitchLoadURL(theURL, FO_CACHE_AND_PRESENT); - } - else - PostDeferredImage(url); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ClickDragLink( - const SMouseDownEvent& inMouseDown, - LO_Element* inElement) -{ - FocusDraw(); - - Rect theGlobalRect; - Boolean bVisible = CalcElementPosition(inElement, theGlobalRect); - ::LocalToGlobal(&topLeft(theGlobalRect)); - ::LocalToGlobal(&botRight(theGlobalRect)); - - // account for image border - Int32 borderWidth = 0; - - if (inElement->type == LO_IMAGE) - borderWidth = inElement->lo_image.border_width; - - ::OffsetRect(&theGlobalRect, borderWidth, borderWidth); - - StValueChanger theValueChanger(mDragElement, inElement); - - CDragURLTask theDragTask(inMouseDown.macEvent, theGlobalRect, *this); - - OSErr theErr = ::SetDragSendProc(theDragTask.GetDragReference(), mSendDataUPP, (LDragAndDrop*)this); - ThrowIfOSErr_(theErr); - - theDragTask.DoDrag(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ ClickDragSelection -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// User has clicked somewhere in the current selection. Do the drag - -void CHTMLView::ClickDragSelection ( - const SMouseDownEvent& inMouseDown, - LO_Element* inElement) -{ - FocusDraw(); - - // get the local rect of the element. The drag task will convert it to - // global coords for it. - Rect theLocalRect; - Boolean bVisible = CalcElementPosition(inElement, theLocalRect); - - StValueChanger theValueChanger(mDragElement, inElement); - - LDragTask theDragTask ( inMouseDown.macEvent, theLocalRect, (unsigned long)this, 'TEXT', NULL, - 0, flavorSenderTranslated ); - OSErr theErr = ::SetDragSendProc(theDragTask.GetDragReference(), mSendDataUPP, (LDragAndDrop*)this); - ThrowIfOSErr_(theErr); - - theDragTask.DoDrag(); - -} // ClickDragSelection - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::ClickTrackEdge( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord) -{ -// ¥¥¥ FIX ME!!! we need to stop the blinkers - - Rect limitRect, slopRect; - Int16 axis; - - // Figure out the outline of the region. This should come from layout somehow - Point topRgn = inMouseDown.whereLocal; - Point bottomRgn = inMouseDown.whereLocal; - if ( inClickRecord.mIsVerticalEdge ) // Edge is vertical, we can drag horizontally. - { - topRgn.v = inClickRecord.mElement->lo_edge.y; - bottomRgn.v = topRgn.v + inClickRecord.mElement->lo_edge.height; - topRgn.h = inClickRecord.mElement->lo_edge.x; - bottomRgn.h = topRgn.h + inClickRecord.mElement->lo_edge.width; - limitRect.left = inClickRecord.mEdgeLowerBound; - limitRect.right = inClickRecord.mEdgeUpperBound; - limitRect.top = topRgn.v; - limitRect.bottom = bottomRgn.v; - slopRect = limitRect; - axis = hAxisOnly; - } - else - { - topRgn.h = inClickRecord.mElement->lo_edge.x; - bottomRgn.h = topRgn.h + inClickRecord.mElement->lo_edge.width; - topRgn.v = inClickRecord.mElement->lo_edge.y; - bottomRgn.v = topRgn.v + inClickRecord.mElement->lo_edge.height; - limitRect.top = inClickRecord.mEdgeLowerBound; - limitRect.bottom = inClickRecord.mEdgeUpperBound; - limitRect.left = topRgn.h; - limitRect.right = bottomRgn.h; - slopRect = limitRect; - axis = vAxisOnly; - } - - Rect tmp; - tmp.top = topRgn.v; - tmp.left = topRgn.h; - tmp.right = bottomRgn.h; - tmp.bottom = bottomRgn.v; - - StRegion rgn(tmp); - FocusDraw(); - - long movedBy = ::DragGrayRgn(rgn, inMouseDown.whereLocal, &limitRect, &slopRect, axis, NULL); - if ( HiWord( movedBy ) != -32768 ) // We have a valid movement - { - // We set a null clip so we don't flicker and flash - StClipRgnState theSavedClip(NULL); - - LocalToPortPoint(topLeft(tmp)); - LocalToPortPoint(botRight(tmp)); - ::InsetRect(&tmp, -2, -2); - InvalPortRect(&tmp); - - Point newPoint; - Rect newRect = tmp; - if ( axis == vAxisOnly ) - { - newPoint.v = inMouseDown.whereLocal.v + HiWord(movedBy); - ::OffsetRect(&newRect, 0, HiWord(movedBy)); - } - else - { - newPoint.h = inMouseDown.whereLocal.h + LoWord( movedBy ); - ::OffsetRect(&newRect, LoWord(movedBy), 0); - } - - if (inClickRecord.mIsVerticalEdge) - ::InsetRect(&newRect, -RectWidth(limitRect), -3); - else - ::InsetRect(&newRect, -3, -RectHeight(limitRect)); - - ::UnionRect(&tmp, &newRect, &tmp); - - { - StClipRgnState theClipSaver(NULL); - // 97-06-11 pkc -- Set mDontAddGridEdgeToList to true so that DisplayEdge - // doesn't add this grid edge into list and DrawGridEdge doesn't draw - // because LO_MoveGridEdge will call DisplayEdge - mDontAddGridEdgeToList = true; - LO_MoveGridEdge(*mContext, (LO_EdgeStruct*)inClickRecord.mElement, newPoint.h, newPoint.v ); - mDontAddGridEdgeToList = false; - } - - InvalPortRect( &tmp ); - } - -// FIX ME!!! we need to start the blinkers -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -inline void CHTMLView::LocalToLayerCoordinates( - const XP_Rect& inBoundingBox, - Point inWhereLocal, - SPoint32& outWhereLayer) const -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - LocalToImagePoint(inWhereLocal, outWhereLayer); - // Convert from image to layer coordinates - outWhereLayer.h -= inBoundingBox.left; - outWhereLayer.v -= inBoundingBox.top; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -Boolean CHTMLView::ClickTrackSelection( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord) -// ¥ Returns true if a selection was started and extended. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ -// FIX ME!!! we need to stop the blinkers - bool shiftDown = (inMouseDown.macEvent.modifiers & shiftKey) != 0; - - ::SetCursor(*GetCursor(iBeamCursor)); - XP_Rect theBoundingBox; - CL_GetLayerBboxAbsolute(inClickRecord.mLayer, &theBoundingBox); - - // Convert from image to layer coordinates - SPoint32 theImagePointStart; - LocalToLayerCoordinates(theBoundingBox, inMouseDown.whereLocal, theImagePointStart); - - SPoint32 theImagePointEnd = theImagePointStart; - - if ( GetClickCount() == 2 & !shiftDown ) - LO_DoubleClick ( *mContext, theImagePointStart.h, theImagePointStart.v, - inClickRecord.GetLayer() ) ; - else { - if ( shiftDown && !inClickRecord.IsClickOnAnchor()) - LO_ExtendSelection(*mContext, theImagePointStart.h, theImagePointStart.v); - else - LO_StartSelection(*mContext, theImagePointStart.h, theImagePointStart.v, inClickRecord.mLayer); - } - - // track mouse till we are done - Boolean didTrackSelection = false; - while (::StillDown()) - { - Point qdWhere; - FocusDraw(); // so that we get coordinates right - ::GetMouse(&qdWhere); - if (AutoScrollImage(qdWhere)) - { - Rect theFrame; - CalcLocalFrameRect(theFrame); - if (qdWhere.v < theFrame.top) - qdWhere.v = theFrame.top; - else if (qdWhere.v > theFrame.bottom) - qdWhere.v = theFrame.bottom; - } - - SPoint32 theTrackImagePoint; - LocalToLayerCoordinates(theBoundingBox, qdWhere, theTrackImagePoint); - - if (theTrackImagePoint.v != theImagePointEnd.v - || theTrackImagePoint.h != theImagePointEnd.h) - { - didTrackSelection = true; - LO_ExtendSelection(*mContext, theTrackImagePoint.h, theTrackImagePoint.v); - } - theImagePointEnd = theTrackImagePoint; - - // ¥Êidling - ::SystemTask(); - EventRecord dummy; - ::WaitNextEvent(0, &dummy, 5, NULL); - } - - LO_EndSelection(*mContext); - return didTrackSelection; - -// FIX ME!!! we need to restart the blinkers -} // CHTMLView::ClickTrackSelection - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CHTMLView::EventMouseUp(const EventRecord& inMouseUp) -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -{ - // FocusDraw() && SwitchTarget(this) appears to be a copy/paste error from ClickSelf. - // We will dispatch a mouse up only if a mouse down has been dispatched. Otherwise there - // would be a possibility of this getting called if a click selects the window containing - // this view but does not perform a mouse down. - if (mContext != NULL && mWaitMouseUp) /* && FocusDraw() && SwitchTarget(this) */ - { - SPoint32 firstP; - Point localPt = inMouseUp.where; - - mWaitMouseUp = false; - GlobalToPortPoint( localPt); // 1997-02-27 mjc - PortToLocalPoint( localPt ); - LocalToImagePoint( localPt, firstP ); - - if (mCompositor != NULL) - { - fe_EventStruct fe_event; - fe_event.portPoint = inMouseUp.where; - //fe_event.event = (void *)&inMouseUp; - fe_event.event.macEvent = inMouseUp; // 1997-02-27 mjc - - CL_Event event; - event.type = CL_EVENT_MOUSE_BUTTON_UP; - event.fe_event = (void *)&fe_event; - event.fe_event_size = sizeof(fe_EventStruct); // 1997-02-27 mjc - event.x = firstP.h; - event.y = firstP.v; - event.which = 1; - event.modifiers = CMochaHacks::MochaModifiers(inMouseUp.modifiers); - - CL_DispatchEvent(*mCompositor, &event); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::HandleKeyPress( const EventRecord& inKeyEvent ) -{ - - Char16 theChar = inKeyEvent.message & charCodeMask; - short modifiers = inKeyEvent.modifiers & (cmdKey | shiftKey | optionKey | controlKey); - SPoint32 firstP; - Point localPt = inKeyEvent.where; - - GlobalToPortPoint(localPt); - PortToLocalPoint( localPt ); - LocalToImagePoint( localPt, firstP ); - -#ifdef LAYERS - if (mCompositor) - { - // If no one has key event focus, set event focus to the main document. - if (CL_IsKeyEventGrabber(*mCompositor, NULL) && CL_GetCompositorRoot(*mCompositor)) - { - CL_GrabKeyEvents( - *mCompositor, - CL_GetLayerChildByName( - CL_GetCompositorRoot(*mCompositor), - LO_BODY_LAYER_NAME)); - } - - // If there's a compositor and someone has keyboard focus, dispatch the event. - if (!CL_IsKeyEventGrabber(*mCompositor, NULL) && (sLastFormKeyPressDispatchTime != inKeyEvent.when)) - { - CL_Event event; - fe_EventStruct fe_event; - - fe_event.event.macEvent = inKeyEvent; // 1997-02-25 mjc - - event.data = 0; - switch (inKeyEvent.what) - { - case keyDown: - event.type = CL_EVENT_KEY_DOWN; - break; - case autoKey: - event.type = CL_EVENT_KEY_DOWN; - event.data = 1; // repeating - break; - case keyUp: - event.type = CL_EVENT_KEY_UP; - break; - } - - event.fe_event = (void *)&fe_event; - event.fe_event_size = sizeof(fe_EventStruct); - event.x = firstP.h; - event.y = firstP.v; - event.which = theChar; - event.modifiers = CMochaHacks::MochaModifiers(inKeyEvent.modifiers); // 1997-02-27 mjc - - CL_DispatchEvent(*mCompositor, &event); - return true; - } - else return HandleKeyPressLayer(inKeyEvent, NULL, firstP); - } else -#endif // LAYERS - return HandleKeyPressLayer(inKeyEvent, NULL, firstP); -} - -Boolean CHTMLView::HandleKeyPressLayer(const EventRecord& inKeyEvent, - CL_Layer *inLayer, - SPoint32 inLayerWhere ) -{ - Char16 theChar = inKeyEvent.message & charCodeMask; - short modifiers = inKeyEvent.modifiers & (cmdKey | shiftKey | optionKey | controlKey); - Boolean handled = false; - -#ifdef LAYERS - if ((inLayer != NULL) && (sLastFormKeyPressDispatchTime != inKeyEvent.when)) - { - SPoint32 theElementWhere = inLayerWhere; - LO_Element* theElement = LO_XYToElement(*mContext, theElementWhere.h, theElementWhere.v, inLayer); - - if ((theElement != NULL) && - (theElement->type == LO_FORM_ELE)) - { - switch (theElement->lo_form.element_data->type) - { - case FORM_TYPE_TEXTAREA: - CFormBigText *bigText = (CFormBigText *)((FormFEData *)theElement->lo_form.element_data->ele_minimal.FE_Data)->fPane->FindPaneByID(formBigTextID); - sLastFormKeyPressDispatchTime = inKeyEvent.when; - handled = bigText->HandleKeyPress(inKeyEvent); - break; - case FORM_TYPE_TEXT: - case FORM_TYPE_PASSWORD: - CFormLittleText *text = (CFormLittleText *)((FormFEData *)theElement->lo_form.element_data->ele_minimal.FE_Data)->fPane; - sLastFormKeyPressDispatchTime = inKeyEvent.when; - handled = text->HandleKeyPress(inKeyEvent); - break; - } - } - } -#endif - // forms didn't handle the event - if (!handled) - { - // we may get keyUp events (javascript needs them) but just ignore them - 1997-02-27 mjc - if (keyUp == inKeyEvent.what) return TRUE; - - if ( modifiers == 0 || (modifiers & shiftKey) == shiftKey) - switch ( theChar & charCodeMask ) - { - case char_UpArrow: - if ( mScroller && mScroller->HasVerticalScrollbar()) - mScroller->VertScroll( kControlUpButtonPart ); - return TRUE; - case char_DownArrow: - if ( mScroller && mScroller->HasVerticalScrollbar() ) - mScroller->VertScroll( kControlDownButtonPart ); - return TRUE; - - // Seems only fair to allow scrolling left and right like the other platforms - case char_LeftArrow: - if ( mScroller && mScroller->HasHorizontalScrollbar()) - mScroller->HorizScroll( kControlUpButtonPart ); - return TRUE; - case char_RightArrow: - if ( mScroller && mScroller->HasHorizontalScrollbar() ) - mScroller->HorizScroll( kControlDownButtonPart ); - return TRUE; - - case char_PageUp: - case char_Backspace: - if ( mScroller && mScroller->HasVerticalScrollbar()) - mScroller->VertScroll( kControlPageUpPart ); - return TRUE; - case char_PageDown: - if ( mScroller && mScroller->HasVerticalScrollbar()) - mScroller->VertScroll( kControlPageDownPart ); - return TRUE; - case char_Space: - if ((modifiers & shiftKey) == shiftKey) - { - if ( mScroller && mScroller->HasVerticalScrollbar()) - mScroller->VertScroll( kControlPageUpPart ); - } - else - { - if ( mScroller && mScroller->HasVerticalScrollbar()) - mScroller->VertScroll( kControlPageDownPart ); - } - return TRUE; - case char_Home: - ScrollImageTo( 0, 0, TRUE ); - return TRUE; - case char_End: - int32 y; - y = mImageSize.height - mFrameSize.height; - if ( y < 0) - y = 0; - ScrollImageTo( 0, y, TRUE ); - return TRUE; - } - - if ( ( modifiers & cmdKey ) == cmdKey ) - switch ( theChar & charCodeMask ) - { - case char_UpArrow: - if ( mScroller && mScroller->HasVerticalScrollbar() ) - mScroller->VertScroll( kControlPageUpPart ); - return TRUE; - - case char_DownArrow: - if ( mScroller && mScroller->HasVerticalScrollbar() ) - mScroller->VertScroll( kControlPageDownPart ); - return TRUE; - } - - if ( ( modifiers & (controlKey | optionKey ) ) == ( controlKey | optionKey ) ) - switch ( theChar & charCodeMask ) - { - case 'h' - 96: - if ( mScroller ) - { - mScroller->ShowScrollbars( FALSE, FALSE ); - return TRUE; - } - case 'j' - 96: - if ( mScroller ) - { - mScroller->ShowScrollbars( TRUE, TRUE ); - return TRUE; - } - case 'k' - 96: - if ( mScroller ) - { - mScroller->ShowScrollbars( FALSE, TRUE ); - return TRUE; - } - case 'l' - 96: - if ( mScroller ) - { - mScroller->ShowScrollbars( TRUE, FALSE ); - return TRUE; - } - } - return LCommander::HandleKeyPress( inKeyEvent ); - } - return handled; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Callback for cursor handling for new mocha event stuff -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// AdjustCursorRecord -// Used as a Mocha callback structure -// holds all the information needed to call MochaExecuteClickInLink -class AdjustCursorRecord -{ - public: - char * mMessage; - AdjustCursorRecord(const char * message) - { - if (message) - mMessage = XP_STRDUP( message ); - else - mMessage = NULL; - } - ~AdjustCursorRecord() - { - FREEIF( mMessage ); - } -}; - -// Mocha callback for MochaAdjustCursorRecord -void MochaAdjustCursorCallback(MWContext * pContext, - LO_Element * lo_element, - int32 lType, - void * whatever, - ETEventStatus status); -void MochaAdjustCursorCallback(MWContext * pContext, - LO_Element * /* lo_element */, - int32 /* lType */, - void * whatever, - ETEventStatus status) -{ - AdjustCursorRecord * p = (AdjustCursorRecord*)whatever; - if (status == EVENT_CANCEL) - { - CNSContext* nsContext = ExtractNSContext(pContext); - nsContext->SetStatus(p->mMessage); - } - delete p; -} - -// Mocha callback for MochaAdjustCursorRecord -// Also frees the layout record. Layout record needs to be allocated -// because of a hack for map areas -void MochaAdjustCursorCallbackLayoutFree(MWContext * pContext, - LO_Element * lo_element, - int32 lType, - void * whatever, - ETEventStatus status); -void MochaAdjustCursorCallbackLayoutFree(MWContext * pContext, - LO_Element * lo_element, - int32 lType, - void * whatever, - ETEventStatus status) -{ - MochaAdjustCursorCallback( pContext, lo_element, lType, whatever, status); - XP_FREE( lo_element ); -} - - -void CHTMLView::AdjustCursorSelf( Point inPortPt, const EventRecord& inMacEvent ) -{ - // if this page is tied-up, display a watch - if ( !IsEnabled() ) - { - ::SafeSetCursor( watchCursor ); - return; - } - - // bail if we did not move, saves time and flickering - if ( ( inPortPt.h == mOldPoint.h ) && ( inPortPt.v == mOldPoint.v ) ) - return; - - mOldPoint.h = inPortPt.h; - mOldPoint.v = inPortPt.v; - - Point localPt = inPortPt; - SPoint32 firstP; - - PortToLocalPoint( localPt ); - LocalToImagePoint( localPt, firstP ); - if (mCompositor != NULL) { - CL_Event event; - fe_EventStruct fe_event; - - fe_event.portPoint = inPortPt; - //fe_event.event = (void *)&inMacEvent; - fe_event.event.macEvent = inMacEvent; // 1997-02-27 mjc - - event.type = CL_EVENT_MOUSE_MOVE; - event.fe_event = (void *)&fe_event; - event.fe_event_size = sizeof(fe_EventStruct); // 1997-02-27 mjc - event.x = firstP.h; - event.y = firstP.v; - event.which = 1; - event.modifiers = 0; - - CL_DispatchEvent(*mCompositor, &event); - } - else - AdjustCursorSelfForLayer(inPortPt, inMacEvent, NULL, firstP); -} - -void CHTMLView::AdjustCursorSelfForLayer( Point inPortPt, const EventRecord& inMacEvent, - CL_Layer *layer, SPoint32 inLayerPt ) -{ -// With LAYERS, the original method gets the compositor to dispatch -// the event, which is then dealt with (in this method) on a per-layer -// basis. - - // find the element the cursor is above, - SPoint32 firstP; - LO_Element* element; - - PortToLocalPoint( inPortPt ); - firstP = inLayerPt; - - FocusDraw(); // Debugging only - - element = LO_XYToElement( *mContext, firstP.h, firstP.v, layer ); - - // - // Send MouseLeave events for layout elements - // and areas of client-side image maps. - // - - if (!CMochaHacks::IsMouseOverElement(element)) - CMochaHacks::SendOutOfElementEvent(*mContext, layer, firstP); // add where parameter - mjc - - // - // If cursor is over blank space, reset and bail - // - // pkc (6/5/96) If there is a defaultStatus string, don't clear status area - if ( element == NULL && mContext->GetDefaultStatus() == NULL ) - { - CMochaHacks::SetMouseOverElement(NULL); - CMochaHacks::ResetMochaMouse(); - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - mContext->SetStatus(CStr255::sEmptyString); - mOldEleID = -1; - return; - } - - - // - // If cursor is over same element as last time and that element - // is not a client-side image map (sMouseOverMapArea != NULL), then - // we're done - // - if (element - && element->lo_any.ele_id == mOldEleID - && !CMochaHacks::GetMouseOverMapArea() ) - return; - - cstring anchor, location; - CHTMLClickRecord cr(inPortPt, firstP, mContext, element, layer); - - if ( cr.IsAnchor() && !( inMacEvent.modifiers & shiftKey ) ) - { - // tj (4/29/96): I belive this code forces us to recompute - // every time in the case of images - // - // (5/2/96): Don't set the element to NULL if its an image. - // We need to absolutely know if we're over the same image - // the next time through this call. - // - // We can use mOldEleID to force a redisplay of status for - // images (image map coords). - // - if ( ( element->type == LO_IMAGE && - ( element->lo_image.image_attr->attrmask & LO_ATTR_ISMAP ) ) || - ( cr.mClickKind == eImageIcon ) ) - mOldEleID = -1; - else - mOldEleID = element->lo_any.ele_id; - - // 97-06-21 pkc -- Also save MWContext along with element because if we mouse out - // and we switch frames, the mContext when we send the mouseout event is NOT the same - // one that contains the LO_Element. - CMochaHacks::SetMouseOverElement(element, *mContext); - location = (cr.mClickKind == eImageAnchor) ? cr.mImageURL : cr.mClickURL; - // - // Handle changes in client-side map area - // - if (!CMochaHacks::IsMouseOverMapArea(cr.mAnchorData)) - { - // leave the old area -// if ( CFrontApp::sMouseOverMapArea ) -// LM_SendMouseOutOfAnchor( *mContext, CFrontApp::sMouseOverMapArea ); - CMochaHacks::SendOutOfMapAreaEvent(*mContext, layer, firstP); // add where parameter - mjc - CMochaHacks::SetMouseOverMapArea(cr.mAnchorData); - - // If the mouseover handler returns true, then - // we don't change the location in the status filed - // -// if ( CFrontApp::sMouseOverMapArea ) -// showLocation = ! LM_SendMouseOverAnchor( *mContext, CFrontApp::sMouseOverMapArea ); - if (CMochaHacks::GetMouseOverMapArea()) - { - LO_Element * el = XP_NEW_ZAP(LO_Element); // Need to fake the element, ask chouck for details - el->type = LO_TEXT; - el->lo_text.anchor_href = CMochaHacks::GetMouseOverMapArea(); - el->lo_text.text = el->lo_text.anchor_href->anchor; // for js freed element test - AdjustCursorRecord * r = new AdjustCursorRecord(location); - // ET_SendEvent now takes a JSEvent struct instead of a int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_MOUSEOVER; - event->x = firstP.h; // layer-relative coordinates - mjc - event->y = firstP.v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - Point screenPt; - ImageToAvailScreenPoint(firstP, screenPt); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - - event->layer_id = LO_GetIdFromLayer(*mContext, layer); // 1997-03-02 mjc - ET_SendEvent( *mContext, el, event, MochaAdjustCursorCallbackLayoutFree, r ); - } - } - } - - // - // Only send mouseover for the layout element if the cursor - // is not over a client-side map area - // - if ( !CMochaHacks::GetMouseOverMapArea() ) - { -// showLocation = !LM_SendMouseOver( *mContext, element ); - AdjustCursorRecord * r = new AdjustCursorRecord(location); - // ET_SendEvent now takes a JSEvent struct instead of a int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_MOUSEOVER; - event->x = firstP.h; // layer-relative coordinates - mjc - event->y = firstP.v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - Point screenPt; - ImageToAvailScreenPoint(firstP, screenPt); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - - event->layer_id = LO_GetIdFromLayer(*mContext, layer); // 1997-03-02 mjc - ET_SendEvent( *mContext, element, event, MochaAdjustCursorCallback, r ); - } - } - - ::SafeSetCursor(curs_Hand); - return; - } - else if ( cr.IsEdge() ) - { - ::SafeSetCursor( (cr.mIsVerticalEdge) ? curs_HoriDrag : curs_VertDrag ); -/* 97-06-11 pkc -- what in blue blazes is all this code for? - mOldEleID = -1; - { - FocusDraw(); // Debugging only - Rect limitRect, slopRect; - int axis; - StRegion rgn; - - // Figure out the outline of the region. This should come from layout somehow - Point topRgn = inPortPt; - Point bottomRgn = inPortPt; - if ( cr.mIsVerticalEdge ) // Edge is vertical, we can drag horizontally. - { - topRgn.v = element->lo_edge.y; - bottomRgn.v = topRgn.v + element->lo_edge.height; - topRgn.h = element->lo_edge.x; - bottomRgn.h = topRgn.h + element->lo_edge.width; - limitRect.left = cr.mEdgeLowerBound; - limitRect.right = cr.mEdgeUpperBound; - limitRect.top = topRgn.v; - limitRect.bottom = bottomRgn.v; - slopRect = limitRect; - axis = hAxisOnly; - } - else - { - topRgn.h = element->lo_edge.x; - bottomRgn.h = topRgn.h + element->lo_edge.width; - topRgn.v = element->lo_edge.y; - bottomRgn.v = topRgn.v + element->lo_edge.height; - limitRect.top = cr.mEdgeLowerBound; - limitRect.bottom = cr.mEdgeUpperBound; - limitRect.left = topRgn.h; - limitRect.right = bottomRgn.h; - slopRect = limitRect; - axis = vAxisOnly; - } - OpenRgn(); -// ShowPen(); - MoveTo(topRgn.h, topRgn.v); - LineTo(bottomRgn.h, topRgn.v); // Framing of the rect - LineTo(bottomRgn.h, bottomRgn.v); - LineTo(topRgn.h, bottomRgn.v); - LineTo(topRgn.h, topRgn.v); - CloseRgn(rgn.mRgn); -// FillRgn(rgn.mRgn, &qd.black); -// FrameRect(&limitRect); - }*/ - return; - } - - - // - // The cursor is over blank space - // - - // If we were previously over a map area, leave the old area - - if (CMochaHacks::GetMouseOverMapArea() != NULL) { -// LM_SendMouseOutOfAnchor(*mContext, CFrontApp::sMouseOverMapArea); - LO_Element * el = XP_NEW_ZAP(LO_Element); // Need to fake the element, ask chouck for details - el->type = LO_TEXT; - el->lo_text.anchor_href = CMochaHacks::GetMouseOverMapArea(); - if (el->lo_text.anchor_href->anchor) - el->lo_text.text = el->lo_text.anchor_href->anchor; // to pass js freed element check - AdjustCursorRecord * r = new AdjustCursorRecord(location); - // ET_SendEvent now takes a JSEvent struct instead of a int type - JSEvent* event = XP_NEW_ZAP(JSEvent); - if (event) - { - event->type = EVENT_MOUSEOUT; - event->x = firstP.h; // layer-relative coordinates - mjc - event->y = firstP.v; - event->docx = event->x + CL_GetLayerXOrigin(layer); - event->docy = event->y + CL_GetLayerYOrigin(layer); - - Point screenPt; - ImageToAvailScreenPoint(firstP, screenPt); - event->screenx = screenPt.h; - event->screeny = screenPt.v; - event->layer_id = LO_GetIdFromLayer(*mContext, layer); // 1997-03-02 mjc - ET_SendEvent( *mContext, el, event, MochaAdjustCursorCallbackLayoutFree, r ); - } - CMochaHacks::SetMouseOverMapArea(NULL); - } - - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - mOldEleID = -1; - mContext->SetStatus( ( mContext->GetDefaultStatus() != NULL) ? - mContext->GetDefaultStatus() : - CStr255::sEmptyString ); -} - - - - - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- DRAG AND DROP --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - - - -void CHTMLView::DoDragSendData(FlavorType inFlavor, - ItemReference inItemRef, - DragReference inDragRef) -{ - OSErr theErr; - cstring theUrl; - cstring theText; - - // Get the URL of the thing we're dragging... - if (mDragElement->type == LO_IMAGE) - { - theUrl = GetURLFromImageElement(mContext, (LO_ImageStruct*) mDragElement); // do this so we can get name of non-anchor images - } - else - { - PA_Block anchor; - XP_ASSERT(mDragElement->type == LO_TEXT); - if ( mDragSelection ) { - CAutoPtrXP chunk = LO_GetSelectionText(*mContext); - theText = reinterpret_cast(chunk.get()); - } - else { - anchor = mDragElement->lo_text.anchor_href->anchor; - PA_LOCK (theUrl, char*, anchor); - PA_UNLOCK(anchor); - } - } - - // Now send the data - switch (inFlavor) - { - // Just send the URL text - case 'TEXT': - { - if ( mDragSelection ) - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, theText, strlen(theText), 0); - else - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, theUrl, strlen(theUrl), 0); - ThrowIfOSErr_ (theErr); - break; - } - - // Send the image as a PICT - case 'PICT': - { - Assert_(mDragElement->type == LO_IMAGE); - PicHandle thePicture = ConvertImageElementToPICT((LO_ImageStruct_struct*) mDragElement); - ThrowIfNULL_(thePicture); - - { - StHandleLocker theLock((Handle)thePicture); - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, *thePicture, GetHandleSize((Handle)thePicture), 0); - ThrowIfOSErr_(theErr); - } - - ::KillPicture(thePicture); - break; - } - - case emBookmarkFileDrag: - { - // Get the target drop location - AEDesc dropLocation; - - theErr = ::GetDropLocation(inDragRef, &dropLocation); - //ThrowIfOSErr_(theErr); - if (theErr != noErr) - return; - - // Get the directory ID and volume reference number from the drop location - SInt16 volume; - SInt32 directory; - - theErr = GetDropLocationDirectory(&dropLocation, &directory, &volume); - //ThrowIfOSErr_(theErr); - - // Ok, this is a hack, and here's why: This flavor type is sent with the FlavorFlag 'flavorSenderTranslated' which - // means that this send data routine will get called whenever someone accepts this flavor. The problem is that - // it is also called whenever someone calls GetFlavorDataSize(). This routine assumes that the drop location is - // something HFS related, but it's perfectly valid for something to query the data size, and not be a HFS - // derrivative (like the text widget for example). - // So, if the coercion to HFS thingy fails, then we just punt to the textual representation. - if (theErr == errAECoercionFail) - { - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, theUrl, strlen(theUrl), 0); - return; - } - - if (theErr != noErr) - return; - if (mDragElement->type == LO_IMAGE && theUrl == "") - break; - - URL_Struct* request; - request = NET_CreateURLStruct(theUrl, NET_DONT_RELOAD); - // Combine with the unique name to make an FSSpec to the new file - FSSpec prototypeFilespec; - FSSpec locationSpec; - prototypeFilespec.vRefNum = volume; - prototypeFilespec.parID = directory; - CStr31 filename; - Boolean isMailAttachment = false; -#ifdef MOZ_MAIL_NEWS - isMailAttachment = XP_STRSTR( request->address , "?part=") || XP_STRSTR( request->address, "&part="); - if ( isMailAttachment ) - { - CHTMLView::GetDefaultFileNameForSaveAs( request, filename); - } - else -#endif // MOZ_MAIL_NEWS - { - filename = CFileMgr::FileNameFromURL( request->address ); - //GetDefaultFileNameForSaveAs( request , filename ); - } - - //theErr = CFileMgr::NewFileSpecFromURLStruct(filename, prototypeFilespec, locationSpec); - theErr = CFileMgr::UniqueFileSpec( prototypeFilespec,filename, locationSpec ); - if (theErr && theErr != fnfErr) // need a unique name, so we want fnfErr! - ThrowIfOSErr_(theErr); - - // Set the flavor data to our emBookmarkFileDrag flavor with an FSSpec to the new file. - theErr = ::SetDragItemFlavorData (inDragRef, inItemRef, inFlavor, &locationSpec, sizeof(FSSpec), 0); - ThrowIfOSErr_(theErr); -#ifdef MOZ_MAIL_NEWS - // For mailto ULRsNetLIB creates a new compose window but passes a bogus parameter( a FileSpec) - // instead of a mail_action Leads to a lovely crash. Instead we should save a file containing the URL. - // It could be argued that this should be done in Netlib but I am far too scared to attempt this - // for a 4.0x release. - Boolean isMailTo = false; - isMailTo = XP_STRCASESTR( request->address , "mailto:") ? true : false ; - if ( isMailTo ) - { - WriteBookmarksFile( request->address, locationSpec ); - return; - } -#endif - - XP_MEMSET(&request->savedData, 0, sizeof(SHIST_SavedData)); - CURLDispatcher::DispatchToStorage(request, locationSpec, FO_SAVE_AS, isMailAttachment); - // ¥¥¥ both blocks of the if/then/else above call break, so does this get called? 96-12-17 deeje - //CFileMgr::UpdateFinderDisplay(locationSpec); - } - - case emBookmarkDrag: - { - cstring urlAndTitle(theUrl); - if (mDragElement->type == LO_IMAGE) - urlAndTitle += "\r[Image]"; - else if (mDragElement->type == LO_TEXT) - { - urlAndTitle += "\r"; - cstring title; - PA_LOCK(title, char *, mDragElement->lo_text.text); - PA_UNLOCK(mDragElement->lo_text.text); - urlAndTitle += title; - } - - theErr = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, urlAndTitle, strlen(urlAndTitle), 0); - break; - } - - default: - { - Throw_(cantGetFlavorErr); // caught by PP handler - break; - } - } - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- TIMER URL --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::SetTimerURL(const URL_Struct* inURL) -{ - if (inURL) - mTimerURLString = XP_STRDUP(inURL->refresh_url); - else - return; - mTimerURLFireTime = ::TickCount() + inURL->refresh * 60; - if ( inURL->dont_cache ) - mTimerURLReloadPolicy = NET_SUPER_RELOAD; - else - mTimerURLReloadPolicy = inURL->force_reload; - StartRepeating(); -} - -void CHTMLView::ClearTimerURL(void) -{ - if (mTimerURLString) - XP_FREE(mTimerURLString); - mTimerURLString = NULL; - StopRepeating(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- DEFERRED LOADING --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::PostDeferredImage(const char* inImageURL) -{ - Assert_(inImageURL != NULL); - - LO_SetForceLoadImage((char *)inImageURL, FALSE); - string theURL(inImageURL); - mImageQueue.push_back(theURL); - mContext->Repaginate(); -} - -Boolean CHTMLView::IsImageInDeferredQueue(const char* inImageURL) const -{ - Boolean bFound = false; - if (mImageQueue.size() > 0) - { - vector::const_iterator theIter = mImageQueue.begin(); - while (theIter != mImageQueue.end()) - { - if (*theIter == inImageURL) - { - bFound = true; - break; - } - ++theIter; - } - } - - return bFound; -} - -void CHTMLView::ClearDeferredImageQueue(void) -{ - mImageQueue.erase(mImageQueue.begin(), mImageQueue.end()); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- URL DISPATCHING --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -// -// CreateURLStructOfCurrent -// -// Get a URL struct for the URL that's being displayed, say for -// printing, or saving to a file. -// -URL_Struct* -CHTMLView :: CreateURLStructOfCurrent ( Boolean inCopyFormData ) -{ - MWContext* mwcontext = *GetContext(); - if (!mwcontext) return NULL; - - URL_Struct* url = SHIST_CreateURLStructFromHistoryEntry(mwcontext, - mContext->GetCurrentHistoryEntry()); - if (!url) return NULL; - - SHIST_SavedData savedData; - XP_MEMCPY(&savedData, &url->savedData, sizeof(SHIST_SavedData)); - XP_MEMSET( &url->savedData, 0, sizeof( SHIST_SavedData ) ); - - if (inCopyFormData) - LO_CloneFormData(&savedData, mwcontext, url); - - return url; -} - - -// 97-05-30 pkc -- These methods are here so that subclasses can alter the -// CURLDispatchInfo struct as necessary before we call CURLDispatcher::DispatchURL - -void CHTMLView::DispatchURL( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - Boolean inDelay, - Boolean inForceCreate, - FO_Present_Types inOutputFormat) -{ - CURLDispatchInfo* info = - new CURLDispatchInfo(inURLStruct, inTargetContext, inOutputFormat, inDelay, inForceCreate); - DispatchURL(info); -} - -void CHTMLView::DispatchURL(CURLDispatchInfo* inDispatchInfo) -{ - CURLDispatcher::DispatchURL(inDispatchInfo); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -#pragma mark --- CONTEXT CALLBACK IMPLEMENTATION --- -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// XXX CALLBACK -void CHTMLView::LayoutNewDocument( - URL_Struct* /* inURL */, - Int32* ioWidth, - Int32* ioHeight, - Int32* ioMarginWidth, - Int32* ioMarginHeight) -{ - if (IsRootHTMLView()) - { - //Assert_(mScroller != NULL); Don't HAVE to have scrollers, as long as we check for 'em. - if (mScroller) - { - mScroller->ResetExpansion(); - mScroller->AdjustHyperViewBounds(); - } - } - - // clear these so we don't send JavaScript mouseover/exit - // events for deleted elements - // ¥¥¥ FIX ME!!! - CMochaHacks::ResetMochaMouse(); - - // FIX ME!!! determine why we need this here - // Answer: - // Because the we may load a docuemnt in different CharSet (eg. Japanese, Korean ) - // ftang - SetFontInfo(); - - mHasGridCells = FALSE; - *ioWidth = *ioHeight = 0; - - if (*ioMarginWidth == 0) - { - *ioMarginWidth = 8; - *ioMarginHeight = 8; - } - - Assert_(mContext != NULL); - if (IsRootHTMLView()) - SetScrollMode(mDefaultScrollMode); - - // Clear the previous page - ScrollImageTo(0, 0, false); - if (mEraseBackground) - ClearView(); - - Rect theFrame; - CalcLocalFrameRect(theFrame); - - *ioWidth = theFrame.right; - *ioHeight = theFrame.bottom; - - // Resize the images from the _current_ document size to the _preferred_ size. - // Resize directly, because SetDocDimension does not decrease the size for main view - ResizeImageTo(*ioWidth, *ioHeight, false); - - // 97-06-18 pkc -- Fix bug #70661. Don't do this margin altering code if frame width - // and/or height is zero. - if (theFrame.right - theFrame.left > 0) - { - if (*ioMarginWidth > (theFrame.right / 2 )) - *ioMarginWidth = MAX( theFrame.right / 2 - 50, 0); - } - if (theFrame.bottom - theFrame.top > 0) - { - if (*ioMarginHeight > (theFrame.bottom / 2 )) - *ioMarginHeight = MAX(theFrame.bottom / 2 -50, 0); - } - - // If the vertical scrollbar might be shown, - // tell layout that we already have it, so that it does - // the correct wrapping of text. - // If we do not do this, when vertical scrollbar only is - // shown, some text might be hidden - if (GetScrollMode() == LO_SCROLL_AUTO) - *ioWidth -= 15; -} - - -// XXX CALLBACK - -void CHTMLView::ClearView( - int /* inWhich */) -{ - ClearBackground(); - StopRepeating(); -} - - -void CHTMLView::InstallBackgroundColor(void) -{ - // ¥ install the user's default solid background color & pattern - mBackgroundColor = CPrefs::GetColor(CPrefs::TextBkgnd); -} - -void CHTMLView::GetDefaultBackgroundColor(LO_Color* outColor) const -{ - *outColor = UGraphics::MakeLOColor(mBackgroundColor); -} - -void CHTMLView::SetWindowBackgroundColor() -{ - // Danger! Port is not necessarily a window. - // To fix, compare LWindow::FetchWindowObject result versus LWindow - // found by going up view hierarchy. - LWindow* portWindow = LWindow::FetchWindowObject(GetMacPort()); - LWindow* ourWindow = NULL; - LView* view = this; - - while( view != NULL ) - { - view = view->GetSuperView(); - if (view) - { - ourWindow = dynamic_cast(view); - if (ourWindow) - break; - } - } - - if (portWindow == ourWindow) - UGraphics::SetWindowColor(GetMacPort(), wContentColor, mBackgroundColor); -} - -void CHTMLView::ClearBackground(void) -{ - if (!FocusDraw()) - return; - - // ¥ dispose of the current background - mBackgroundImage = NULL; - - // ¥ install the user's default solid background color & pattern - InstallBackgroundColor(); - - // Danger! Port is not necessarily a window. -// if (LWindow::FetchWindowObject(GetMacPort())) -// UGraphics::SetWindowColor(GetMacPort(), wContentColor, mBackgroundColor); - SetWindowBackgroundColor(); - ::RGBBackColor(&mBackgroundColor); - - // erase the widget to the user's default background - - Rect theFrame; - if (CalcLocalFrameRect(theFrame)) - DrawBackground(theFrame, nil); -} - -void CHTMLView::DrawBackground( - const Rect& inArea, - LO_ImageStruct* inBackdrop) -{ - if (!FocusDraw()) - return; - - // We're using this to denote that we _do_ have an outline - Rect theFrame; //, theEraseArea; - CalcLocalFrameRect(theFrame); - - ::SectRect(&theFrame, &inArea, &theFrame); - - // - // Get our default clip from the port so that we use the correct clip - // from layers - // - StRegion theUpdateMask; - ::GetClip(theUpdateMask); - - // - // Never erase the plug-in area -- the plug-ins - // will take care of that for us, and we donÕt - // want to cause flicker with redundant drawing. - // - StRegion thePluginMask; - ::SetEmptyRgn(thePluginMask); - CalcPluginMask(thePluginMask); - - if (!::EmptyRgn(thePluginMask)) - { - Point theLocalOffset = { 0, 0 }; - PortToLocalPoint(theLocalOffset); - ::OffsetRgn(thePluginMask, theLocalOffset.h, theLocalOffset.v); - ::DiffRgn(theUpdateMask, thePluginMask, theUpdateMask); - } - - StClipRgnState theClipState(theUpdateMask); - DrawBackgroundSelf(theFrame, inBackdrop); -} - - -void CHTMLView::DrawBackgroundSelf( - const Rect& inArea, - LO_ImageStruct* inBackdrop) -{ - LO_ImageStruct *backdrop; - - if (inBackdrop) - backdrop = inBackdrop; - else if (mBackgroundImage) - backdrop = mBackgroundImage; - else - backdrop = NULL; - - // ¥ if we can't draw the image then fall back on the pattern/solid - if ( backdrop ) - { - } - else - ::EraseRect(&inArea); -} - -void CHTMLView::EraseBackground( - int /* inLocation */, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor) -{ - if (!FocusExposed(false)) - return; - - // Convert draw rect from image coordinate system to local - SPoint32 imageTopLeft; - imageTopLeft.h = inX; - imageTopLeft.v = inY; - - SPoint32 imageBottomRight; - imageBottomRight.h = inX + inWidth; - imageBottomRight.v = inY + inHeight; - - Rect theLocalEraseArea; - ImageToLocalPoint(imageTopLeft, topLeft(theLocalEraseArea)); - ImageToLocalPoint(imageBottomRight, botRight(theLocalEraseArea)); - - if (inColor != NULL) - { - // Make sure we don't erase the scrollbars. - // NOTE: don't call StClipRgnState() here: - // it messes up with the text selection. - Rect frame; - CalcLocalFrameRect(frame); -// StClipRgnState tempClip(frame); - if (theLocalEraseArea.right > frame.right) - theLocalEraseArea.right = frame.right; - if (theLocalEraseArea.bottom > frame.bottom) - theLocalEraseArea.bottom = frame.bottom; - - RGBColor theBackColor = UGraphics::MakeRGBColor(inColor->red, inColor->green, inColor->blue); - ::RGBBackColor(&theBackColor); - ::EraseRect(&theLocalEraseArea); - } - else - DrawBackground(theLocalEraseArea); -} - -int CHTMLView::SetColormap( - IL_IRGB* /* inMap */, - int /* inRequested */) -{ - return 0; -} - -void CHTMLView::SetBackgroundColor( - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue) -{ - RGBColor theBackground = UGraphics::MakeRGBColor(inRed, inGreen, inBlue); - - GrafPtr thePort = GetMacPort(); - if (thePort != NULL && mContext != NULL && IsRootHTMLView() - && LWindow::FetchWindowObject(GetMacPort())) - { - UGraphics::SetWindowColor(thePort, wContentColor, theBackground); - } - - if (!UGraphics::EqualColor(mBackgroundColor, theBackground)) - { - mBackgroundColor = theBackground; - Refresh(); - } - - /* now, call the image code to setup this new background color in the color map */ - SetImageContextBackgroundColor ( *GetContext(), inRed, inGreen, inBlue ); -} - -void CHTMLView::SetBackgroundImage( - LO_ImageStruct* inImageStruct, - Boolean inRefresh) -{ - mBackgroundImage = inImageStruct; - - if (inRefresh) - { - Rect theFrame; - CalcLocalFrameRect(theFrame); - DrawBackground(theFrame); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ CalcPluginMask -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// The following code calculates the union of all exposed plugin areas. The -// result is added to ioPluginRgn. It is assumed that ioPluginRgn is a -// valid region (already constructed with NewRgn()). The region is port -// relative. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// REGION IS BASED ON PORT COORDINATES - -void CHTMLView::CalcPluginMask(RgnHandle ioPluginRgn) -{ - Assert_(ioPluginRgn != NULL); - - if (mSubPanes.GetCount() == 0) // Any subpanes? - return; - - LArrayIterator iter(mSubPanes); - LPane* pane = NULL; - while (iter.Next(&pane )) // Check each subpane - { - if ((pane->GetPaneID() == CPluginView::class_ID) || - (pane->GetPaneID() == 'java')) // Is it a plug-in or a java pane? - { - CPluginView* plugin = (CPluginView*)pane; - if (plugin->IsPositioned() && // Position is valid? - NPL_IsEmbedWindowed(plugin->GetNPEmbeddedApp())) - { - Rect theRevealedFrame; - plugin->GetRevealedRect(theRevealedFrame); - if (!EmptyRect(&theRevealedFrame)) // Plug-in visible in page? - { - StRegion thePluginFrameRgn(theRevealedFrame); - ::UnionRgn(ioPluginRgn, thePluginFrameRgn, ioPluginRgn); - } - } - } - } -} - -Boolean CHTMLView::IsGrowCachingEnabled() const - /* - ...only derived classes with special needs would need better control than this. - See |CEditView|. - */ - { - return true; - } - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ SetDocDimension -// -// This evidently gets called a bazillion times from within layout. We need -// to cache the calls so that the image is not resized all the time. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// XXX CALLBACK - -void CHTMLView::SetDocDimension( - int /* inLocation */, - Int32 inWidth, - Int32 inHeight) -{ - SDimension32 oldImageSize; - GetImageSize(oldImageSize); - - SDimension32 newImageSize; - newImageSize.width = inWidth; - newImageSize.height = inHeight; - - // If we can cache `grows' to enhance performance... - if ( IsGrowCachingEnabled() ) - { - // ...then we only need to grow if we ran out of space... - if ( (oldImageSize.width < inWidth) || (oldImageSize.height < inHeight) ) - { - SDimension16 curFrameSize; - GetFrameSize(curFrameSize); - // Warning: in some funky Java cases, |curFrameSize| can be 0,0. - - - // Start doubling from which ever is greater, the frame height or the old image height. - newImageSize.height = ((curFrameSize.height >= oldImageSize.height) ? curFrameSize.height : oldImageSize.height); - - // Ensure that doubling the height will terminate the doubling-loop. - if ( newImageSize.height < 1 ) - newImageSize.height = 1; - - // Now, double the current height until it's greater than the requested height - do - newImageSize.height += newImageSize.height; - while ( newImageSize.height < inHeight ); - // That ought to hold 'em for a while... - } - else - // ...else, we'll grow later, what we have now is good enough. - newImageSize = oldImageSize; - } - - - // Resize the image, if we need to... - if ( (newImageSize.height != oldImageSize.height) || (newImageSize.width != oldImageSize.width) ) - ResizeImageTo(newImageSize.width, newImageSize.height, true); - - - // If we didn't exactly satisfy the request, then we'll have to later... - if ( (mPendingDocDimension_IsValid = ((newImageSize.height != inHeight) || (newImageSize.width != inWidth))) == true ) - { - mPendingDocDimension.width = inWidth; - mPendingDocDimension.height = inHeight; - } -} - - -void CHTMLView::FlushPendingDocResize(void) -{ - if ( mPendingDocDimension_IsValid ) - { - mPendingDocDimension_IsValid = false; - - SDimension32 imageSize; - GetImageSize(imageSize); - - if ( (imageSize.width != mPendingDocDimension.width) || (imageSize.height != mPendingDocDimension.height) ) - ResizeImageTo(mPendingDocDimension.width, mPendingDocDimension.height, true); - } -} - - -// XXX CALLBACK - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ SetDocPosition -// -// Scrolls the image to (inX, inY), limited to the image size minus the frame size. The x position is -// left unchanged if it is already visible. -// -// inLocation: ignored -// inX, inY: new position. Negative values will be converted to zero. -// inScrollEvenIfVisible: if true, will cause the html view to scroll even if the x position is already -// visible (defaults to false, which is the historical behavior). -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CHTMLView::SetDocPosition( - int /* inLocation */, - Int32 inX, - Int32 inY, - Boolean inScrollEvenIfVisible) -{ - // - // If we're displaying a full-page plug-in, ignore the - // request to position the document. When displaying - // a full-page plug-in, we don't show scroll bars and - // all positioning is handled by the plug-in itself. - // - if (mContext->HasFullPagePlugin()) - return; - - // Make sure our size is not our of sync, flush any pending resize - FlushPendingDocResize(); - - //Ê¥Êlocation is the variable affecting which view are we in - // Make sure that the view is big enough so that we do not get - // auto-cropped with PPlant when we auto-scroll - - SDimension16 theFrameSize; - GetFrameSize(theFrameSize); - - SPoint32 theFrameLocation; - GetFrameLocation(theFrameLocation); - - SDimension32 theImageSize; - GetImageSize(theImageSize); - - SPoint32 theImageLocation; - GetImageLocation(theImageLocation); - - theImageLocation.h -= theFrameLocation.h; - theImageLocation.v -= theFrameLocation.v; - - // ¥ÊCalculate proper position. - - Int32 scrollToX = inX; - Int32 scrollToY = inY; - - if ((scrollToY + theFrameSize.height) > theImageSize.height) - { - scrollToY = theImageSize.height - theFrameSize.height; - } - - // rebracket this test so it's done all the time (not only when we exceed image height) - mjc 97-9-12 - // Sometimes the image height is 0 and scrollToY goes negative. It - // seems stupid that image height should ever be 0 - oh well. - if (scrollToY < 0) - { - scrollToY = 0; - } - - // If x is visible, do not change it. - if (!inScrollEvenIfVisible && (inX >= theImageLocation.h) && (inX + 10 <= (theImageLocation.h + theFrameSize.width ))) - { - scrollToX = theImageLocation.h; - } - - // limit the x position as we do with the y position - mjc 97-9-12 - scrollToX = MIN(scrollToX, theImageSize.width - theFrameSize.width); - if (scrollToX < 0) scrollToX = 0; - - ScrollImageTo(scrollToX, scrollToY, true); -} - -// XXX CALLBACK - -void CHTMLView::GetDocPosition( - int /* inLocation */, - Int32* outX, - Int32* outY) -{ - // Make sure our size is not our of sync, flush any pending resize - FlushPendingDocResize(); - - SPoint32 theScrollPosition; - GetScrollPosition(theScrollPosition); - *outX = theScrollPosition.h; - *outY = theScrollPosition.v; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -int CHTMLView::GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* outTextInfo) -{ - Assert_(inText != NULL); - Assert_(outTextInfo != NULL); - Assert_(mContext != NULL); - - LO_TextAttr* theTextAttr = inText->text_attr; - - Assert_(theTextAttr != NULL); - if (theTextAttr == NULL) - return 1; - - -// FIX ME!!! need to optimize the getting of the port (cache it) -// No, don't. This is open to error, and the amount of time saved is minimal. - - GrafPtr theSavePort = NULL; - if (GetCachedPort() != qd.thePort) - { - theSavePort = qd.thePort; - ::SetPort(GetCachedPort()); - } - - { - HyperStyle theStyle(*mContext, &mCharSet, theTextAttr, true); - theStyle.Apply(); - theStyle.GetFontInfo(); - - outTextInfo->ascent = theStyle.fFontInfo.ascent; - outTextInfo->descent = theStyle.fFontInfo.descent; - outTextInfo->lbearing = 0; - - char* theText; - PA_LOCK(theText, char*, inText->text); - - // ¥Êmeasure the text - Int16 theWidth = theStyle.TextWidth(theText, 0, inText->text_len); - - // **** Don't know which of these is better; the first only works for native single byte scritps - // The second will always work, but produces different results... - // Probably need to Add a function to HyperStyle to handle this... - - /* - if (theTextAttr->fontmask & LO_FONT_ITALIC ) - outTextInfo->rbearing = theWidth + (::CharWidth(theText[inText->text_len - 1]) / 2); - else - outTextInfo->rbearing = 0; - */ - if (theTextAttr->fontmask & LO_FONT_ITALIC ) - outTextInfo->rbearing = theWidth + (theStyle.fFontInfo.widMax / 2); - else - outTextInfo->rbearing = 0; - - PA_UNLOCK(inText->text); - - outTextInfo->max_width = theWidth; - } //so that theStyle goes out of scope and resets the text traits in the correct port - - if (theSavePort != NULL) - ::SetPort(theSavePort); - - return 1; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ MeasureText -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -int CHTMLView::MeasureText( - LO_TextStruct* inText, - short* outCharLocs) -{ - Assert_(inText != NULL); - Assert_(outCharLocs != NULL); - Assert_(mContext != NULL); - - LO_TextAttr* theTextAttr = inText->text_attr; - - Assert_(theTextAttr != NULL); - if (theTextAttr == NULL) - return 0; - - // FIX ME!!! need to optimize the getting of the port (cache it) - GrafPtr theSavePort = NULL; - if (GetCachedPort() != qd.thePort) - { - theSavePort = qd.thePort; - ::SetPort(GetCachedPort()); - } - - Int16 measuredBytes = 0; - - { - HyperStyle theStyle(*mContext, &mCharSet, theTextAttr, true); - theStyle.Apply(); - - // FIX ME!!! we only work with Native font references for now - CNativeFontReference* nativeFontReference = - dynamic_cast(theStyle.fFontReference); - if (nativeFontReference != NULL) - { - // measure the text - measuredBytes = nativeFontReference->MeasureText( - (char*)inText->text, 0, inText->text_len, outCharLocs); - } - } //so that theStyle goes out of scope and resets the text traits in the correct port - - if (theSavePort != NULL) - ::SetPort(theSavePort); - - return measuredBytes; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::GetTextFrame( - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame) -{ - Assert_(inTextStruct != NULL); - Assert_(outFrame != NULL); - - GrafPtr theSavePort = NULL; - if (GetCachedPort() != qd.thePort) - { - theSavePort = qd.thePort; - ::SetPort(GetCachedPort()); - } - - { - LO_TextAttr* theTextAttr = inTextStruct->text_attr; - HyperStyle theStyle(*mContext, &mCharSet, theTextAttr, true, inTextStruct); - - Point theLocalTopLeft = { 0, 0 }; - - char* theText; - PA_LOCK(theText, char*, inTextStruct->text); - Rect theLocalFrame = theStyle.InvalBackground(theLocalTopLeft, theText, inStartPos, inEndPos, false); - PA_UNLOCK(inTextStruct->text); - - // Convert to layer coordinates - outFrame->left = theLocalFrame.left + inTextStruct->x + inTextStruct->x_offset; - outFrame->top = theLocalFrame.top + inTextStruct->y + inTextStruct->y_offset; - outFrame->right = theLocalFrame.right + inTextStruct->x + inTextStruct->x_offset; - outFrame->bottom = theLocalFrame.bottom + inTextStruct->y + inTextStruct->y_offset; - } //so that theStyle goes out of scope and resets the text traits in the correct port - - if (theSavePort != NULL) - ::SetPort(theSavePort); -} - -void CHTMLView::DisplaySubtext( - int /* inLocation */, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG) -{ - // ¥ if we can't focus, don't do anything - if (!FocusDraw()) - return; - - // ¥Êif we're not visible, don't do anything - Rect theTextFrame; - if (!CalcElementPosition((LO_Element*)inText, theTextFrame)) - return; - - LO_TextAttr* theTextAttr = inText->text_attr; - -// FIX ME!!! this needs to do the right thing in the editor -// Boolean bBlinks = (attr->attrmask & LO_ATTR_BLINK) && (!EDT_IS_EDITOR(*mContext)); // no blinking in the editor because of problems with moving text which is blinking - - - HyperStyle style(*mContext, &mCharSet, theTextAttr, false, inText); - - char *theTextPtr; - PA_LOCK(theTextPtr, char*, inText->text); - - if (inNeedBG) // ¥Êerase the background - { - Rect theInvalRect = style.InvalBackground( topLeft(theTextFrame), theTextPtr, inStartPos, inEndPos, false); - - if ( theTextAttr->no_background ) - { - StClipRgnState theClipSaver; - theClipSaver.ClipToIntersection(theInvalRect); - DrawBackground(theInvalRect); - } - else - { - ::PenPat(&qd.black ); - UGraphics::SetIfColor( - UGraphics::MakeRGBColor(theTextAttr->bg.red, - theTextAttr->bg.green, - theTextAttr->bg.blue)); - - ::FillRect(&theInvalRect, &qd.black); - } - } - - style.DrawText(topLeft(theTextFrame), theTextPtr, inStartPos, inEndPos); - - PA_UNLOCK(inText->text); -} - -void CHTMLView::DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG) -{ - DisplaySubtext(inLocation, inText, 0, inText->text_len - 1, inNeedBG); -} - -void CHTMLView::DisplayLineFeed( - int /* inLocation */, - LO_LinefeedStruct* /* inLinefeedStruct */, - XP_Bool /* inNeedBG */) -{ -#ifdef LAYERS - -#else - Rect frame; - Boolean doDraw; - - // BUGBUG LAYERS: Linefeed drawing causes problems with layers (the problem - // is not in FE code - the selection code needs to do the same special casing - // it did for text in the case of line feeds and hrules). The temporary fix is - // to not draw linefeeds. - - if ( !FocusDraw() ) - return; - - if ( needBg ) - { - doDraw = CalcElementPosition( (LO_Element*)lineFeed, frame ); - - if ( !doDraw ) - return; - - // ¥Êfill the background in the color given by layout - if ( lineFeed->text_attr->no_background == FALSE ) - { - UGraphics::SetIfColor( - UGraphics::MakeRGBColor( lineFeed->text_attr->bg.red, - lineFeed->text_attr->bg.green, - lineFeed->text_attr->bg.blue ) ); - - ::FillRect( &frame, &qd.black ); - } - else - this->DrawBackground( frame ); - } - - Boolean selected = lineFeed->ele_attrmask & LO_ELE_SELECTED; - - if ( selected ) - { - if ( CalcElementPosition( (LO_Element*)lineFeed, frame ) ) - { - RGBColor color; - LMGetHiliteRGB( &color ); - - ::RGBBackColor( &color ); - ::EraseRect( &frame ); - } - } - -#endif -} - -void CHTMLView::DisplayHR( - int /* inLocation */, - LO_HorizRuleStruct* inRuleStruct) -{ - if (!FocusDraw()) - return; - - Rect theFrame; - if (!CalcElementPosition( (LO_Element*)inRuleStruct, theFrame)) - return; - -// FIX ME!!! remove lame drawing - if (((inRuleStruct->ele_attrmask & LO_ELE_SHADED)== 0) || ( theFrame.top + 1 >= theFrame.bottom ) ) // No shading, or 1 pixel rect - { - UGraphics::SetFore(CPrefs::Black); - FillRect(&theFrame, &UQDGlobals::GetQDGlobals()->black); - } - else - UGraphics::FrameRectShaded(theFrame, TRUE); -} - -void CHTMLView::DisplayBullet( - int /* inLocation */, - LO_BullettStruct* inBulletStruct) -{ - if (!FocusDraw()) - return; - - Rect theFrame; - if (!CalcElementPosition((LO_Element*)inBulletStruct, theFrame)) - return; - - if (inBulletStruct->text_attr) - UGraphics::SetIfColor( - UGraphics::MakeRGBColor( inBulletStruct->text_attr->fg.red, - inBulletStruct->text_attr->fg.green, - inBulletStruct->text_attr->fg.blue )); - else - UGraphics::SetFore(CPrefs::Black); - - switch ( inBulletStruct->bullet_type ) - { - case BULLET_ROUND: - ::PenPat(&qd.black); - ::FrameOval(&theFrame); - break; - - case BULLET_SQUARE: - ::PenPat(&qd.black); - ::FrameRect(&theFrame); - break; - - case BULLET_BASIC: - ::FillOval(&theFrame, &UQDGlobals::GetQDGlobals()->black); - break; - - case BULLET_MQUOTE: - ::PenPat(&qd.black); - ::MoveTo(theFrame.left, theFrame.top); - ::LineTo(theFrame.left, theFrame.bottom); - break; - - default: // Should not happen - ::MoveTo(theFrame.left, theFrame.bottom); - ::DrawChar('?'); - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::GetEmbedSize( - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod /* inReloadMethod */) -{ - if (inEmbedStruct->objTag.FE_Data == NULL) // Creating plugin from scratch - { - Try_ - { - NPEmbeddedApp* app = NPL_EmbedCreate(*mContext, inEmbedStruct); - ThrowIfNil_(app); - - // XXX This is so bogus. Figure out how to pull the junk in - // EmbedCreate() up here or at least rework it so it's cleaner. - CPluginView* newPlugin = (CPluginView*) app->fe_data; - newPlugin->EmbedCreate(*mContext, inEmbedStruct); - } - Catch_(inErr) - { - inEmbedStruct->objTag.FE_Data = NULL; - } - EndCatch_ - } - else - NPL_EmbedSize((NPEmbeddedApp*) inEmbedStruct->objTag.FE_Data); -} - -void CHTMLView::FreeEmbedElement( - LO_EmbedStruct* inEmbedStruct) -{ - NPL_EmbedDelete(*mContext, inEmbedStruct); - inEmbedStruct->objTag.FE_Data = NULL; -} - -void CHTMLView::CreateEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - // Ensure that we have a layout struct so that we can size - // the plugin properly. - ThrowIfNil_(inEmbeddedApp->np_data); - LO_EmbedStruct* embed_struct = ((np_data*) inEmbeddedApp->np_data)->lo_struct; - - ThrowIfNil_(embed_struct); - - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(GetMacPort())); - LPane::SetDefaultView(NULL); - - CPluginView* newPlugin = NULL; - newPlugin = (CPluginView*) UReanimator::ReadObjects('PPob', 4010); - ThrowIfNil_(newPlugin); - - newPlugin->FinishCreate(); - newPlugin->PutInside(this); - newPlugin->SetSuperCommander(this); - - SDimension16 hyperSize; - this->GetFrameSize(hyperSize); // Get the size of the hyperView - - newPlugin->EmbedSize(embed_struct, hyperSize); - - // XXX Don't we need to create the NPWindow struct here, too? - // Ugh. Actually that's done in CPluginView::EmbedCreate(), which we - // call after NPL_EmbedCreate(). That probably needs some massaging... - inEmbeddedApp->fe_data = (void*) newPlugin; -} - -void CHTMLView::SaveEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - ThrowIfNil_(inEmbeddedApp); - CPluginView *view = (CPluginView*) inEmbeddedApp->fe_data; - - ThrowIfNil_(view); - - // Make sure that we are not targeting the plugin view - // - // XXX Note that this will be overly aggressive in removing the - // focus. Probably what we really want to do is check to see if - // some sub-pane of the view has focus, and if so, reset it to - // a well-known safe place. - LCommander::SwitchTarget(NULL); - - // Un-intsall the plugin view, hide it, and re-target - // it to the owning window. - view->Hide(); - - // PCB: clear the plugin's knowledge that it has been positioned, so it will be layed out correctly. - view->SetPositioned(false); - - LView *previousParentView = NULL; - LView *currentParentView = view->GetSuperView(); - while (currentParentView != NULL) { - previousParentView = currentParentView; - currentParentView = currentParentView->GetSuperView(); - } - - view->PutInside((LWindow *)previousParentView); - view->SetSuperCommander((LWindow *)previousParentView); - - // XXX This should probably move to the Stop() method of the JVM plugin. - //FlushEventHierarchy(view); -} - -void CHTMLView::RestoreEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - CPluginView* view = (CPluginView*) inEmbeddedApp->fe_data; - LView* parentView = view->GetSuperView(); - - // If we are parented inside the outermost window, then - // reparent us to the hyperview. - - if (parentView->GetSuperView() == NULL) { - view->PutInside(this); - view->SetSuperCommander(this); - - int32 xp = 0; - int32 yp = 0; - - if (XP_OK_ASSERT(inEmbeddedApp->np_data)) { - LO_EmbedStruct* embed_struct = ((np_data*) inEmbeddedApp->np_data)->lo_struct; - if (XP_OK_ASSERT(embed_struct)) { - xp = embed_struct->objTag.x + embed_struct->objTag.x_offset - /* - CONTEXT_DATA(*mContext)->document_x */; - yp = embed_struct->objTag.y + embed_struct->objTag.y_offset - /* - CONTEXT_DATA(*mContext)->document_y */; - } - } - - view->PlaceInSuperImageAt(xp, yp, TRUE); - } - - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(GetMacPort())); - LPane::SetDefaultView(NULL); -} - -void CHTMLView::DestroyEmbedWindow( - NPEmbeddedApp* inEmbeddedApp) -{ - if (inEmbeddedApp && inEmbeddedApp->fe_data) - { - // XXX Why does EmbedFree need the LO_EmbedStruct? - ThrowIfNil_(inEmbeddedApp->np_data); - LO_EmbedStruct* embed_struct = ((np_data*) inEmbeddedApp->np_data)->lo_struct; - - // XXX The following check crashes (why?) when embed_struct is NULL, which it always is. - // ThrowIfNil_(embed_struct); - - CPluginView* view = (CPluginView*) inEmbeddedApp->fe_data; - view->EmbedFree(*mContext, embed_struct); - delete view; - inEmbeddedApp->fe_data = NULL; - } -} - -void CHTMLView::DisplayEmbed( - int /* inLocation */, - LO_EmbedStruct* inEmbedStruct) -{ - NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbedStruct->objTag.FE_Data; - if (app && app->fe_data) - { - if ( !FocusDraw() ) - return; - - CPluginView* view = (CPluginView*) app->fe_data; - view->EmbedDisplay(inEmbedStruct, false); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::GetJavaAppSize( - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod) -{ - LJ_GetJavaAppSize(*mContext, inJavaAppStruct, inReloadMethod); -} - -static void PR_CALLBACK -FE_SaveJavaWindow(MWContext * /* context */, LJAppletData* /* ad */, void* window) -{ -#if defined (JAVA) - CJavaView* javaAppletView = (CJavaView *)window; - LWindow* javaCommanderWindow; - - // Make sure that we are not targeting this - // java applet. - - LCommander::SwitchTarget(GetContainerWindow(javaAppletView)); - - // Un-intsall the java view, hide it, and re-target - // it to the owning window. - - javaAppletView->Hide(); - - LView *currentParentView, - *previousParentView = NULL; - - currentParentView = javaAppletView->GetSuperView(); - while (currentParentView != NULL) - { - previousParentView = currentParentView; - currentParentView = currentParentView->GetSuperView(); - } - - // Bug fix -- crash when printing applet window. - // This routine is in the call chain from ~LPrintout(), and - // the applet being printed was _not_ in a window. Hence - // we need the dynamic cast. The basic problem is that - // LPrintout does not inherit from LCommander, but LWindow - // does. - - javaCommanderWindow = dynamic_cast(previousParentView); - - javaAppletView->PutInside(javaCommanderWindow); - javaAppletView->SetSuperCommander(javaCommanderWindow); - - FlushEventHierarchy(javaAppletView); -#endif /* defined (JAVA) */ -} - -void CHTMLView::HideJavaAppElement( - LJAppletData* inAppletData) -{ - LJ_HideJavaAppElement(*mContext, inAppletData, FE_SaveJavaWindow); -} - -static void PR_CALLBACK -FE_DisplayNoJavaIcon(MWContext *, LO_JavaAppStruct *) -{ - /* write me */ -} - -static void* PR_CALLBACK -FE_CreateJavaWindow(MWContext *context, LO_JavaAppStruct * /* inJavaAppStruct */, - int32 xp, int32 yp, int32 xs, int32 ys) -{ -#if defined (JAVA) - CNSContext* theNSContext = ExtractNSContext(context); - Assert_(theNSContext != NULL); - CHTMLView* theCurrentView = ExtractHyperView(*theNSContext); - Assert_(theCurrentView != NULL); - - CJavaView *newJavaView = NULL; - Try_ - { - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(theCurrentView->GetMacPort())); - LPane::SetDefaultView(NULL); - newJavaView = (CJavaView *)UReanimator::ReadObjects('PPob', 2090); - newJavaView->FinishCreate(); - newJavaView->PutInside(theCurrentView); - newJavaView->SetSuperCommander(theCurrentView); - newJavaView->PlaceInSuperImageAt(xp, yp, TRUE); - - newJavaView->SetPositioned(); - -/* - // If the plugin size is 1x1, this really means that the plugin is - // full-screen, and that we should set up the pluginÕs real width - // for XP since it doesnÕt know how big to make it. Since a full- - // screen plugin should resize when its enclosing view (the hyperview) - // resizes, we bind the plugin view on all sides to its superview. - // -bing 11/16/95 - // - if (inJavaAppStruct->width == 1 && inJavaAppStruct->height == 1) { - SBooleanRect binding = {true, true, true, true}; - newJavaView->SetFrameBinding(binding); - SDimension16 hyperSize; - this->GetFrameSize(hyperSize); // Get the size of the hyperView - inJavaAppStruct->width = hyperSize.width - 1; - inJavaAppStruct->height = hyperSize.height - 1; - - const short kLeftMargin = 8; // ¥¥¥ These should be defined in mhyper.h!!! - const short kTopMargin = 8; - inJavaAppStruct->x -= kLeftMargin; // Allow the plugin to use ALL the screen space - inJavaAppStruct->y -= kTopMargin; - } -*/ - } - - Catch_(inErr) - { - } - EndCatch_ - - // Resize the image - - if (newJavaView != NULL) { - newJavaView->ResizeImageTo(xs, ys, FALSE); - newJavaView->ResizeFrameTo(xs, ys, FALSE); - } - - return (void*)newJavaView; -#else - return (void*)NULL; -#endif /* defined (JAVA) */ -} - -static void* PR_CALLBACK -FE_GetAwtWindow(MWContext * /* context */, LJAppletData* ad) -{ -#if defined (JAVA) - CJavaView* newJavaView = (CJavaView *)ad->window; - return (void*)newJavaView->GetUserCon(); -#else - return (void*)NULL; -#endif /* defined (JAVA) */ -} - -static void PR_CALLBACK -FE_RestoreJavaWindow(MWContext *context, LJAppletData* ad, - int32 xp, int32 yp, int32 /* xs */, int32 /* ys */) -{ -#if defined (JAVA) - CNSContext* theNSContext = ExtractNSContext(context); - Assert_(theNSContext != NULL); - CHTMLView* theCurrentView = ExtractHyperView(*theNSContext); - Assert_(theCurrentView != NULL); - - CJavaView* newJavaView = (CJavaView *)ad->window; - - LView *parentView = newJavaView->GetSuperView(); - - // If we are parented inside the outermost window, then - // reparent us to the hyperview. - - if (parentView->GetSuperView() == NULL) { - - newJavaView->PutInside(theCurrentView); - newJavaView->SetSuperCommander(theCurrentView); - newJavaView->PlaceInSuperImageAt(xp, yp, TRUE); - - } - - LCommander::SetDefaultCommander(LWindow::FetchWindowObject(theCurrentView->GetMacPort())); - LPane::SetDefaultView(NULL); -#endif /* defined (JAVA) */ -} - -static void PR_CALLBACK -FE_SetJavaWindowPos(MWContext * /* context */, void* window, - int32 xp, int32 yp, int32 /* xs */, int32 /* ys */) -{ -#if defined (JAVA) - CJavaView* newJavaView = (CJavaView *)window; - - newJavaView->PlaceInSuperImageAt(xp, yp, TRUE); -#endif /* defined (JAVA) */ -} - -static void PR_CALLBACK -FE_SetJavaWindowVisibility(MWContext *context, void* window, PRBool visible) -{ -#if defined (JAVA) - CNSContext* theNSContext = ExtractNSContext(context); - Assert_(theNSContext != NULL); - CHTMLView* theCurrentView = ExtractHyperView(*theNSContext); - Assert_(theCurrentView != NULL); - - CJavaView* newJavaView = (CJavaView *)window; - Boolean isComponentVisible = TRUE; - Hsun_awt_macos_MComponentPeer *componentPeer = PaneToPeer(newJavaView); - - if (componentPeer != NULL) { - if (unhand(unhand(componentPeer)->target)->visible) - isComponentVisible = TRUE; - else - isComponentVisible = FALSE; - } - - if (newJavaView != NULL) { - // This call could mean that either the visibility or the position of the - // applet has changed, so we make the appropriate changes to the view. - if ((newJavaView->IsVisible() && !visible) || - (isComponentVisible == FALSE)) - newJavaView->Hide(); - - if ((!newJavaView->IsVisible() && visible) && - isComponentVisible) - newJavaView->Show(); - } -#endif /* defined (JAVA) */ -} - -void CHTMLView::DisplayJavaApp( - int /* inLocation */, - LO_JavaAppStruct* inJavaAppStruct) -{ - LJ_DisplayJavaApp(*mContext, inJavaAppStruct, - FE_DisplayNoJavaIcon, - FE_GetFullWindowSize, - FE_CreateJavaWindow, - FE_GetAwtWindow, - FE_RestoreJavaWindow, - FE_SetJavaWindowPos, - FE_SetJavaWindowVisibility); -} - -static void PR_CALLBACK -FE_FreeJavaWindow(MWContext * /* context */, struct LJAppletData * /* appletData */, - void* window) -{ -#if defined (JAVA) - CJavaView* javaAppletView = (CJavaView *)window; - delete javaAppletView; -#endif /* defined (JAVA) */ -} - -void CHTMLView::FreeJavaAppElement( - LJAppletData* inAppletData) -{ - LJ_FreeJavaAppElement(*mContext, inAppletData, - FE_SaveJavaWindow, - FE_FreeJavaWindow); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::DrawJavaApp( - int /*inLocation*/, - LO_JavaAppStruct* ) -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::HandleClippingView( - struct LJAppletData* , - int /*x*/, - int /*y*/, - int /*width*/, - int /*height*/) -{ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::GetFormElementInfo( - LO_FormElementStruct* inElement) -{ - UFormElementFactory::MakeFormElem(this, mContext, inElement); -} - - -void CHTMLView::ResetFormElementData( - LO_FormElementStruct* inElement, - Boolean inRefresh, - Boolean inFromDefaults) -{ - UFormElementFactory::ResetFormElementData(inElement, inRefresh, inFromDefaults, true); -} - - - - -void CHTMLView::DisplayFormElement( - int /* inLocation */, - LO_FormElementStruct* inFormElement) -{ - CDrawable *currentDrawable = mCurrentDrawable; - - // When we're drawing form elements, we force our current drawable to be onscreen - SetCurrentDrawable(nil); - UFormElementFactory::DisplayFormElement(mContext, inFormElement); - SetCurrentDrawable(currentDrawable); -} - -void CHTMLView::DisplayBorder( - int /* inLocation */, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle) -{ - if (!FocusDraw() || (inBW == 0)) - return; - - SPoint32 topLeftImage; - Point topLeft; - int32 layerOriginX, layerOriginY; - Rect borderRect; - RGBColor borderColor; - - if ( mCurrentDrawable != NULL ) { - mCurrentDrawable->GetLayerOrigin(&layerOriginX, &layerOriginY); - } - else { - layerOriginX = mLayerOrigin.h; - layerOriginY = mLayerOrigin.v; - } - topLeftImage.h = inX + layerOriginX; - topLeftImage.v = inY + layerOriginY; - ImageToLocalPoint(topLeftImage, topLeft); - - borderRect.left = topLeft.h; - borderRect.top = topLeft.v; - borderRect.right = borderRect.left + inWidth; - borderRect.bottom = borderRect.top + inHeight; - - borderColor = UGraphics::MakeRGBColor(inColor->red, inColor->green, inColor->blue); - RGBForeColor(&borderColor); - ::PenSize(inBW, inBW); - - switch (inStyle) { - case LO_SOLID: - ::FrameRect(&borderRect); - break; - - case LO_BEVEL: - ::UGraphics::FrameRectShaded(borderRect, FALSE); - break; - - default: - break; - } - - ::PenSize(1, 1); -} - -void CHTMLView::UpdateEnableStates() -{ - // this is a Composer function so that the state of buttons can change(enabled/disabled) -} - -void CHTMLView::DisplayFeedback( - int /*inLocation*/, - LO_Element* ) -{ - // this is a Composer function for showing selection of Images -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::FreeEdgeElement( - LO_EdgeStruct* inEdgeStruct) -{ - if (FocusDraw()) - { - Rect theEdgeFrame; - if (CalcElementPosition((LO_Element*)inEdgeStruct, theEdgeFrame)) - { - ::InsetRect(&theEdgeFrame, -1, -1); - ::InvalRect(&theEdgeFrame); - } - } - - // 97-06-11 pkc -- delete inEdgeStruct from edge list - // NOTE: This line assumes that inEdgeStruct is in the list. - vector::iterator found = find(mGridEdgeList.begin(), mGridEdgeList.end(), inEdgeStruct); - if (found != mGridEdgeList.end()) - mGridEdgeList.erase(found); -} - -void CHTMLView::DisplayEdge( - int /* inLocation */, - LO_EdgeStruct* inEdgeStruct) -{ - if ( !FocusDraw() ) - return; - - // 97-06-21 pkc -- In some instances, like when the Security Advisor brings the Page Info - // window to the front, FocusDraw won't call SetPort on the window port for some reason. - // Use an StPortOriginState to make sure the port is set correctly. - StPortOriginState theOriginSaver((GrafPtr)GetMacPort()); - - if (IsRootHTMLView()) - mShowFocus = FALSE; - - // 97-06-11 pkc -- If we're not redrawing a grid edge via DrawSelf, and we're also not - // drawing because the user dragged an edge, then add this LO_EdgeStruct* to list - if (!mDontAddGridEdgeToList) - { - mGridEdgeList.push_back(inEdgeStruct); - } - - Rect docFrame; - Boolean isVisible; - isVisible = CalcElementPosition( (LO_Element*)inEdgeStruct, docFrame ); - int32 size; - - if ( !isVisible ) - return; - - SBooleanRect thePartialBevels = { true, true, true, true }; - if ( inEdgeStruct->is_vertical ) - { - size = inEdgeStruct->width; - /* top - 2 ? Try anything else and look closely at the top of the frame edge, - where it abutts the enclosing bevel view. -2 seems to be only benevolent; - if you find otherwise, more tweaking may be necessary. I suspect the unexpected - extra pixel correction has something to do with the unfortunate circumstance - that the first time an edge is drawn, while the frame is being laid out, - the port origin is often one pixel off (both vertically and horizontally) - from its final position after layout is complete. */ - docFrame.top -= 2; - docFrame.bottom++; - thePartialBevels.top = thePartialBevels.bottom = false; - } - else - { - size = inEdgeStruct->height; - ::InsetRect( &docFrame, -1, 0 ); - thePartialBevels.left = thePartialBevels.right = false; - } - - StClipRgnState theClipSaver(docFrame); - - SBevelColorDesc theBevelColors; - if ( inEdgeStruct->bg_color ) - { - UGraphics::SetIfColor( UGraphics::MakeRGBColor( inEdgeStruct->bg_color->red, - inEdgeStruct->bg_color->green, - inEdgeStruct->bg_color->blue ) ); - ::FillRect( &docFrame, &qd.black ); - } - else - { - // Cinco de Mayo '97 pkc - // Added code to draw using background pattern like our pattern bevel views - if (!mPatternWorld) - { - mPatternWorld = CSharedPatternWorld::CreateSharedPatternWorld(10000); - if (mPatternWorld) - { - mPatternWorld->AddUser(this); - } - } - - if (mPatternWorld) - { - Point theAlignment; - CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment); - - CGrafPtr thePort = (CGrafPtr)GetMacPort(); - - mPatternWorld->Fill(thePort, docFrame, theAlignment); - } - else - { - UGraphicGizmos::LoadBevelTraits(10000, theBevelColors); - ::PmForeColor(theBevelColors.fillColor); - ::PaintRect(&docFrame); - } - } - - if ( size > 2 ) - { - // shrink the beveled edges rect back to the original size specified - if ( inEdgeStruct->is_vertical ) - ::InsetRect( &docFrame, 0, 1 ); - else - ::InsetRect( &docFrame, 1, 0 ); - if ( inEdgeStruct->bg_color ) - { - UGraphics::FrameRectShaded( docFrame, FALSE ); - } - else - { - // Cinco de Mayo '97 pkc - // Use BevelTintPartialRect if we're drawing using a pattern - if (mPatternWorld) - { - UGraphicGizmos::BevelTintPartialRect(docFrame, 1, - 0x2000, 0x2000, thePartialBevels); - } - else - { - UGraphicGizmos::BevelPartialRect(docFrame, 1, - theBevelColors.topBevelColor, theBevelColors.bottomBevelColor, thePartialBevels); - } - } - - if ( inEdgeStruct->movable ) - { - Rect theDotFrame = { 0, 0, 2, 2 }; - UGraphicGizmos::CenterRectOnRect(theDotFrame, docFrame); - UGraphics::FrameCircleShaded( theDotFrame, TRUE ); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::DisplayTable( - int /* inLocation */, - LO_TableStruct* inTableStruct) -{ - if (!FocusDraw() || - ((inTableStruct->border_width == 0) && - (inTableStruct->border_top_width == 0) && - (inTableStruct->border_right_width == 0) && - (inTableStruct->border_bottom_width == 0) && - (inTableStruct->border_left_width == 0))) - return; - - // Retain akbar (3.0) functionality -- we used to call UGraphics::FrameRectShaded - // which set a light rgb pin color of { 60000, 60000, 60000 }. By default, - // UGraphicGizmos has a light pin color of { 0xFFFF, 0xFFFF, 0xFFFF }. So as - // not to diverge from akbar, set UGraphicGizmos::sLighter then restore its value - RGBColor savedLighter = UGraphicGizmos::sLighter; - UGraphicGizmos::sLighter.red = 0xFFFF; - UGraphicGizmos::sLighter.green = 0xFFFF; - UGraphicGizmos::sLighter.blue = 0xFFFF; - // ¥Êelement->width + borderWidth, element->height + borderWidth); - Rect theFrame; - if (CalcElementPosition( (LO_Element*)inTableStruct, theFrame )) - { - RGBColor borderColor = - UGraphics::MakeRGBColor((inTableStruct->border_color).red, - (inTableStruct->border_color).green, - (inTableStruct->border_color).blue); - switch (inTableStruct->border_style) - { - case BORDER_NONE: - break; - - case BORDER_DOTTED: - case BORDER_DASHED: - case BORDER_SOLID: - DisplaySolidBorder(theFrame, - borderColor, - inTableStruct->border_top_width, - inTableStruct->border_left_width, - inTableStruct->border_bottom_width, - inTableStruct->border_right_width); - break; - - case BORDER_DOUBLE: - { - Int32 borderTopWidth = inTableStruct->border_top_width / 3; - Int32 borderLeftWidth = inTableStruct->border_left_width / 3; - Int32 borderBottomWidth = inTableStruct->border_bottom_width / 3; - Int32 borderRightWidth = inTableStruct->border_right_width / 3; - - // draw outer border - DisplaySolidBorder(theFrame, - borderColor, - borderTopWidth, - borderLeftWidth, - borderBottomWidth, - borderRightWidth); - // adjust frame - theFrame.top += (inTableStruct->border_top_width - borderTopWidth); - theFrame.left += (inTableStruct->border_left_width - borderLeftWidth); - theFrame.bottom -= (inTableStruct->border_bottom_width - borderBottomWidth); - theFrame.right -= (inTableStruct->border_right_width - borderRightWidth); - - // draw inner border - DisplaySolidBorder(theFrame, - borderColor, - borderTopWidth, - borderLeftWidth, - borderBottomWidth, - borderRightWidth); - } - break; - - case BORDER_GROOVE: - // Groove border has sunken outer border with a raised inner border - DisplayGrooveRidgeBorder(theFrame, - borderColor, - true, - inTableStruct->border_top_width, - inTableStruct->border_left_width, - inTableStruct->border_bottom_width, - inTableStruct->border_right_width); - break; - case BORDER_RIDGE: - // Ridge border has raised outer border with a sunken inner border - DisplayGrooveRidgeBorder(theFrame, - borderColor, - false, - inTableStruct->border_top_width, - inTableStruct->border_left_width, - inTableStruct->border_bottom_width, - inTableStruct->border_right_width); - break; - - case BORDER_INSET: - // sunken border - DisplayBevelBorder(theFrame, - borderColor, - false, - inTableStruct->border_top_width, - inTableStruct->border_left_width, - inTableStruct->border_bottom_width, - inTableStruct->border_right_width); - break; - - case BORDER_OUTSET: - // raised border - DisplayBevelBorder(theFrame, - borderColor, - true, - inTableStruct->border_top_width, - inTableStruct->border_left_width, - inTableStruct->border_bottom_width, - inTableStruct->border_right_width); - break; - - default: - Assert_(false); - } - - // restore UGraphicGizmos::sLighter - UGraphicGizmos::sLighter = savedLighter; - } -} - -void CHTMLView::DisplaySolidBorder( - const Rect& inFrame, - const RGBColor& inBorderColor, - Int32 inTopWidth, - Int32 inLeftWidth, - Int32 inBottomWidth, - Int32 inRightWidth) -{ - StColorPenState state; - state.Normalize(); - ::RGBForeColor(&inBorderColor); - // Check for easy case -- all border widths equal - if (inTopWidth == inLeftWidth && - inTopWidth == inBottomWidth && - inTopWidth == inRightWidth) - { - ::PenSize(inTopWidth, inTopWidth); - ::FrameRect(&inFrame); - } - else - { - // Otherwise manually draw each side - if (inTopWidth > 0) - { - ::PenSize(1, inTopWidth); - ::MoveTo(inFrame.left, inFrame.top); - ::LineTo(inFrame.right, inFrame.top); - } - if (inLeftWidth > 0) - { - ::PenSize(inLeftWidth, 1); - ::MoveTo(inFrame.left, inFrame.top); - ::LineTo(inFrame.left, inFrame.bottom); - } - if (inBottomWidth > 0) - { - ::PenSize(1, inBottomWidth); - // Don't forget, pen draws down and to the right - ::MoveTo(inFrame.left, inFrame.bottom - inBottomWidth); - ::LineTo(inFrame.right, inFrame.bottom - inBottomWidth); - } - if (inRightWidth > 0) - { - ::PenSize(inRightWidth, 1); - // Don't forget, pen draws down and to the right - ::MoveTo(inFrame.right - inRightWidth, inFrame.bottom); - ::LineTo(inFrame.right - inRightWidth, inFrame.top); - } - } -} - -Uint16 AddWithoutOverflow(Uint16 base, Uint16 addition) -{ - if ((base + addition) > 0xFFFF) - { - // overflow, return max Uint16 value - return 0xFFFF; - } - else - return base + addition; -} - -Uint16 SubWithoutUnderflow(Uint16 base, Uint16 difference) -{ - if ((base - difference) < 0x0000) - { - // underflow, return 0 - return 0x0000; - } - else - return base - difference; -} - -void ComputeBevelColor(Boolean inRaised, RGBColor inBaseColor, RGBColor& outBevelColor) -{ - if (inRaised) - { - outBevelColor.red = AddWithoutOverflow(inBaseColor.red, TableBorder_TintLevel); - outBevelColor.green = AddWithoutOverflow(inBaseColor.green, TableBorder_TintLevel); - outBevelColor.blue = AddWithoutOverflow(inBaseColor.blue, TableBorder_TintLevel); - } - else - { - outBevelColor.red = SubWithoutUnderflow(inBaseColor.red, TableBorder_TintLevel); - outBevelColor.green = SubWithoutUnderflow(inBaseColor.green, TableBorder_TintLevel); - outBevelColor.blue = SubWithoutUnderflow(inBaseColor.blue, TableBorder_TintLevel); - } -} - -void CHTMLView::DisplayBevelBorder( - const Rect& inFrame, - const RGBColor& inBorderColor, - Boolean inRaised, - Int32 inTopWidth, - Int32 inLeftWidth, - Int32 inBottomWidth, - Int32 inRightWidth) -{ - // 97-06-10 pkc -- No longer use UGraphicGizmos::BevelRect - StColorPenState state; - state.Normalize(); - PolyHandle poly = NULL; - RGBColor raisedBevelColor, loweredBevelColor; - ComputeBevelColor(true, inBorderColor, raisedBevelColor); - ComputeBevelColor(false, inBorderColor, loweredBevelColor); - // First do top and left sides - if (inTopWidth > 0 || inLeftWidth > 0) - { - poly = OpenPoly(); - if (inRaised) - ::RGBForeColor(&raisedBevelColor); - else - ::RGBForeColor(&loweredBevelColor); - ::MoveTo(inFrame.left, inFrame.top); - if (inTopWidth > 0) - { - ::LineTo(inFrame.right, inFrame.top); - ::LineTo(inFrame.right - inRightWidth, inFrame.top + inTopWidth); - ::LineTo(inFrame.left + inLeftWidth, inFrame.top + inTopWidth); - } - if (inLeftWidth > 0) - { - if (inTopWidth == 0) - ::LineTo(inFrame.left + inLeftWidth, inFrame.top + inTopWidth); - ::LineTo(inFrame.left + inLeftWidth, inFrame.bottom - inBottomWidth); - ::LineTo(inFrame.left, inFrame.bottom); - } - ::ClosePoly(); - ::PaintPoly(poly); - ::KillPoly(poly); - poly = NULL; - } - if (inRightWidth > 0 || inBottomWidth > 0) - { - poly = OpenPoly(); - // Then do bottom and right sides - if (inRaised) - ::RGBForeColor(&loweredBevelColor); - else - ::RGBForeColor(&raisedBevelColor); - ::MoveTo(inFrame.right, inFrame.bottom); - if (inRightWidth > 0) - { - ::LineTo(inFrame.right, inFrame.top); - ::LineTo(inFrame.right - inRightWidth, inFrame.top + inTopWidth); - ::LineTo(inFrame.right - inRightWidth, inFrame.bottom - inBottomWidth); - } - if (inBottomWidth > 0) - { - if (inRightWidth == 0) - ::LineTo(inFrame.right - inRightWidth, inFrame.bottom - inBottomWidth); - ::LineTo(inFrame.left + inLeftWidth, inFrame.bottom - inBottomWidth); - ::LineTo(inFrame.left, inFrame.bottom); - } - ::ClosePoly(); - ::PaintPoly(poly); - ::KillPoly(poly); - poly = NULL; - } -} - -void CHTMLView::DisplayGrooveRidgeBorder( - const Rect& inFrame, - const RGBColor& inBorderColor, - Boolean inIsGroove, - Int32 inTopWidth, - Int32 inLeftWidth, - Int32 inBottomWidth, - Int32 inRightWidth) -{ - Rect theFrame = inFrame; - Int32 borderTopWidth = inTopWidth / 2; - Int32 borderLeftWidth = inLeftWidth / 2; - Int32 borderBottomWidth = inBottomWidth / 2; - Int32 borderRightWidth = inRightWidth / 2; - - // draw outer border - DisplayBevelBorder(theFrame, - inBorderColor, - inIsGroove ? false : true, - borderTopWidth, - borderLeftWidth, - borderBottomWidth, - borderRightWidth); - // adjust frame - theFrame.top += borderTopWidth; - theFrame.left += borderLeftWidth; - theFrame.bottom -= borderBottomWidth; - theFrame.right -= borderRightWidth; - // draw inner border - DisplayBevelBorder(theFrame, - inBorderColor, - inIsGroove ? true : false, - borderTopWidth, - borderLeftWidth, - borderBottomWidth, - borderRightWidth); -} - -void CHTMLView::DisplayCell( - int /* inLocation */, - LO_CellStruct* inCellStruct) -{ - if (!FocusDraw() ) - return; - - // ¥ subdoc->width + borderWidth, subdoc->height + borderWidth); - Rect theFrame; - if (CalcElementPosition( (LO_Element*)inCellStruct, theFrame )) - { - - // ¥Êthis is really slow LAM - for ( int i = 1; i <= inCellStruct->border_width; i++ ) - { - UGraphics::FrameRectShaded( theFrame, true ); - ::InsetRect( &theFrame, 1, 1 ); - } - } -} - -void CHTMLView::InvalidateEntireTableOrCell(LO_Element*) -{ - /* composer only */ -} - -void CHTMLView::DisplayAddRowOrColBorder(XP_Rect*, XP_Bool /*inDoErase*/) -{ - /* composer only */ -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CHTMLView::CalcElementPosition( - LO_Element* inElement, - Rect& outFrame) -{ - // This function takes the real position of a layout element, - // .. and returns the local position and whether it is visible. - // the calculated position is valid, even if the element is not currently visible - - XP_Rect absoluteFrame; - Point portOrigin; - SPoint32 frameLocation; - SDimension16 frameSize; - SPoint32 imageLocation; - Boolean isVisible; - - portOrigin.h = 0; portOrigin.v = 0; - PortToLocalPoint (portOrigin); - GetFrameLocation (frameLocation); - GetFrameSize (frameSize); - GetImageLocation (imageLocation); - - long realFrameLeft = frameLocation.h - imageLocation.h; - long realFrameRight = realFrameLeft + frameSize.width; - long realFrameTop = frameLocation.v - imageLocation.v; - long realFrameBottom = realFrameTop + frameSize.height; - - CalcAbsoluteElementPosition (inElement, absoluteFrame); - - isVisible = realFrameRight > absoluteFrame.left - && realFrameLeft < absoluteFrame.right - && realFrameBottom > absoluteFrame.top - && realFrameTop < absoluteFrame.bottom; - - outFrame.left = absoluteFrame.left + portOrigin.h + imageLocation.h; - outFrame.top = absoluteFrame.top + portOrigin.v + imageLocation.v; - outFrame.right = outFrame.left + inElement->lo_any.width; - outFrame.bottom = outFrame.top + inElement->lo_any.height; - - return isVisible; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::CalcAbsoluteElementPosition( - LO_Element* inElement, - XP_Rect& outFrame) -{ - // calculates the position of a layout element within the document, disregarding - // scroll positions and whatnot - - // make sure we have the actual element position - long elementPosLeft = inElement->lo_any.x + inElement->lo_any.x_offset; - long elementPosTop = inElement->lo_any.y + inElement->lo_any.y_offset; - -#ifdef LAYERS - if (inElement->type != LO_FORM_ELE // coordinates of these types... - && inElement->type != LO_EMBED // ... are already document-relative - && inElement->type != LO_JAVA) - { - int32 layerOriginX,layerOriginY; - - if (mCurrentDrawable != NULL) - mCurrentDrawable->GetLayerOrigin ( &layerOriginX, &layerOriginY ); - else { - layerOriginX = mLayerOrigin.h; - layerOriginY = mLayerOrigin.v; - } - - elementPosLeft += layerOriginX; - elementPosTop += layerOriginY; - } -#endif - - outFrame.left = elementPosLeft; - outFrame.top = elementPosTop; - outFrame.right = outFrame.left + inElement->lo_any.width; - outFrame.bottom = outFrame.top + inElement->lo_any.height; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CHTMLView::CreateGridView( - CBrowserContext* inGridContext, - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight, - Int8 inScrollMode, - Bool inNoEdge) -{ - - CHyperScroller* theContainer = NULL; - - try - { -// URL_Struct* request = NULL; -// CHyperScroller* theContainer; -// MWContext* newContext; -// CHyperView* newView; - - SetScrollMode(LO_SCROLL_NO); - mShowFocus = false; - - FocusDraw(); - LCommander::SetDefaultCommander( this ); - LPane::SetDefaultView( this ); - - theContainer = (CHyperScroller*)UReanimator::ReadObjects('PPob', 1005); - ThrowIfNULL_(theContainer); - theContainer->FinishCreate(); - - CHTMLView* theNewView = (CHTMLView*)theContainer->FindPaneByID(2005); - ThrowIfNULL_(theNewView); - - // ¥ position it - theNewView->mNoBorder = inNoEdge; - theNewView->SetSuperHTMLView(this); - - Rect theOwningFrame; - CalcLocalFrameRect(theOwningFrame); - - Rect theNewFrame; - CropFrameToContainer(inX, inY, inWidth, inHeight, theNewFrame); - - CHyperScroller* theSuperScroller = mScroller; - if (!theNewView->mNoBorder) - { - // for each side that intersects the container, - // expand the container out one - if (inX == 0) - if (theSuperScroller) - theSuperScroller->ExpandLeft(); - - if (inY == 0) - if (theSuperScroller) - theSuperScroller->ExpandTop(); - - if (theNewFrame.right == theOwningFrame.right) - if (theSuperScroller) - theSuperScroller->ExpandRight(); - - if (theNewFrame.bottom == theOwningFrame.bottom) - if (theSuperScroller) - theSuperScroller->ExpandBottom(); - - if (theSuperScroller) - theSuperScroller->AdjustHyperViewBounds(); - } - else - { - theContainer->ExpandLeft(); - theContainer->ExpandTop(); - theContainer->ExpandRight(); - theContainer->ExpandBottom(); - theContainer->AdjustHyperViewBounds(); - } - - CropFrameToContainer(inX, inY, inWidth, inHeight, theNewFrame); - - theContainer->PlaceInSuperFrameAt(theNewFrame.left, theNewFrame.top, true); - theContainer->ResizeFrameTo(RectWidth(theNewFrame), RectHeight(theNewFrame), false); - - if (theSuperScroller) - theSuperScroller->AdjustHyperViewBounds(); - theContainer->AdjustHyperViewBounds(); - - theNewView->SetScrollMode(inScrollMode); - // 97-05-07 pkc -- if inNoEdge is true, we've got a borderless frame, don't - // display frame focus - if (!inNoEdge) - theNewView->mShowFocus = true; - - // ¥ so that we call scroller's activate, and it actually enables the scrollbars -// theContainer->ActivateSelf(); -// FIX ME!!! this used to be the line above. I hope this still works - theContainer->Activate(); - - if (theSuperScroller) - theSuperScroller->Refresh(); - - theNewView->SetContext(inGridContext); - mHasGridCells = true; - - // give the grid context the same listeners as the root context - mContext->CopyListenersToContext(inGridContext); - } - catch (...) - { - delete theContainer; - throw; - } - -} - -void CHTMLView::CropFrameToContainer( - Int32 inImageLeft, - Int32 inImageTop, - Int32 inImageWidth, - Int32 inImageHeight, - Rect& outLocalFrame) const -{ - Rect theOwningFrame; - CalcLocalFrameRect(theOwningFrame); - - SPoint32 theImageTopLeft; - theImageTopLeft.h = inImageLeft; - theImageTopLeft.v = inImageTop; - - SPoint32 theImageBotRight; - theImageBotRight.h = inImageLeft + inImageWidth; - theImageBotRight.v = inImageTop + inImageHeight; - - ImageToLocalPoint(theImageTopLeft, topLeft(outLocalFrame)); - ImageToLocalPoint(theImageBotRight, botRight(outLocalFrame)); - - ::SectRect(&theOwningFrame, &outLocalFrame, &outLocalFrame); -} - -// --------------------------------------------------------------------------- -// ¥ CalcStandardSizeForWindowForScreen -// --------------------------------------------------------------------------- - -void -CHTMLView::CalcStandardSizeForWindowForScreen( - CHTMLView* inTopMostHTMLView, - const LWindow& inWindow, - const Rect& inScreenBounds, - SDimension16& outStandardSize) -{ - bool haveAnHTMLView = false; - Rect minMaxSize; - SDimension16 htmlFrameSize; - SDimension16 windowContentSize; - SDimension32 htmlImageSize; - CBrowserContext* theTopContext = nil; - Boolean puntToADefaultStandardSize = false; - - if (CApplicationEventAttachment::CurrentEventHasModifiers(optionKey)) - { - outStandardSize.width = max_Int16; - outStandardSize.height = max_Int16; - - return; - } - - inWindow.GetMinMaxSize(minMaxSize); - inWindow.GetFrameSize(windowContentSize); - - // Note: If inTopMostHTMLView is nil, then we use the punt size - - if (inTopMostHTMLView) - { - theTopContext = inTopMostHTMLView->GetContext(); - - // Get the image size of the html view - - inTopMostHTMLView->GetImageSize(htmlImageSize); - htmlImageSize.width = MIN(htmlImageSize.width, max_Int16); - htmlImageSize.height = MIN(htmlImageSize.height, max_Int16); - - if (htmlImageSize.width != 0 && htmlImageSize.height != 0) - { - haveAnHTMLView = true; - } - } - - // Calculate standard size - - if (theTopContext && haveAnHTMLView) - { - CBrowserContext* theTopContext = inTopMostHTMLView->GetContext(); - - ThrowIfNil_(theTopContext); - - if (!theTopContext->CountGridChildren()) - { - // Get the frame size of the html view - - inTopMostHTMLView->GetFrameSize(htmlFrameSize); - - outStandardSize.width = ((windowContentSize.width - htmlFrameSize.width) + htmlImageSize.width); - outStandardSize.height = ((windowContentSize.height - htmlFrameSize.height) + htmlImageSize.height); - - // Shrink the standard size in each dimension if the other dimension has a scroll bar - // which will disappear at the new standard size. We attempt to adjust the standard - // size height first. If the standard width for the screen does cause a previous - // horizontal scrollbar to disappear then we adjust the height. We remember whether - // it was adjusted. Then we attempt to adjust the width. Then we try once more on the - // height if it wasn't already adjusted. - - Boolean heightAdjusted = false; - - if (inTopMostHTMLView->GetScroller() && - inTopMostHTMLView->GetScroller()->HasHorizontalScrollbar() && - outStandardSize.width < (inScreenBounds.right - inScreenBounds.left)) - { - outStandardSize.height -= (ScrollBar_Size - 1); - heightAdjusted = true; - } - - if (inTopMostHTMLView->GetScroller() && - inTopMostHTMLView->GetScroller()->HasVerticalScrollbar() && - outStandardSize.height < (inScreenBounds.bottom - inScreenBounds.top)) - { - outStandardSize.width -= (ScrollBar_Size - 1); - } - - if (inTopMostHTMLView->GetScroller() && - inTopMostHTMLView->GetScroller()->HasHorizontalScrollbar() && - outStandardSize.width < (inScreenBounds.right - inScreenBounds.left) && - !heightAdjusted) - { - outStandardSize.height -= (ScrollBar_Size - 1); - heightAdjusted = true; - } - - // Don't shrink window smaller than the minimum size - - if (outStandardSize.width < minMaxSize.left) - outStandardSize.width = minMaxSize.left; - - if (outStandardSize.height < minMaxSize.top) - outStandardSize.height = minMaxSize.top; - } - else - { - // We have frames. - // - // We will pick a "reasonable" size out of our... Note that Akbar would - // simply reuse the mStandardSize for the previously viewed page (which - // produces inconsistent results when zooming a given frames page). At least - // this method will produce consistent results. - // - // It would be cool, of course, if we could figure out which frames should - // contribute to the calculation of the new width and height of the window - // to miminize scrolling and do that instead. That would produce a better - // standard size for frame documents. - - puntToADefaultStandardSize = true; - } - } - else - { - // No context or top-most context is not and html view or the user held - // down the optionKey, so we just punt - - puntToADefaultStandardSize = true; - } - - if (puntToADefaultStandardSize) - { - Int16 height = 850; - Int16 width = 0.85 * height; - - // If the punt height is greater than the screen height then - // recalculate with a punt height equal to the screen height. - - if ((inScreenBounds.bottom - inScreenBounds.top) < height) - { - height = inScreenBounds.bottom - inScreenBounds.top; - width = 0.85 * height; - } - - outStandardSize.width = width; - outStandardSize.height = height; - } -} - -void CHTMLView::GetFullGridSize( - Int32& outWidth, - Int32& outHeight) -{ - // FIX ME!!! here's another thing that will need to change - // when the scroller dependency is removed. - if (mScroller != NULL) - { - SDimension16 theContainerSize; - mScroller->GetFrameSize(theContainerSize); - outWidth = theContainerSize.width; - outHeight = theContainerSize.height; - } - else - { - Assert_(false); - outWidth = outHeight = 0; - } -} - -void CHTMLView::RestructureGridView( - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight) -{ - mSuperHTMLView->FocusDraw(); - - if (mScroller != NULL) - { - CHyperScroller* theSuperScroller = mScroller; - - Rect theNewFrame; - mSuperHTMLView->CropFrameToContainer(inX, inY, inWidth, inHeight, theNewFrame); - theSuperScroller->PlaceInSuperFrameAt(theNewFrame.left, theNewFrame.top, false); - theSuperScroller->ResizeFrameTo(RectWidth(theNewFrame), RectHeight(theNewFrame), false); - theSuperScroller->AdjustHyperViewBounds(); - } - -// if ( mContext ) -// { -// History_entry* he = SHIST_GetCurrent( &fHContext->hist ); -// if ( !he || he->is_binary ) -// { -// this->Refresh(); -// this->ReadjustScrollbars( TRUE ); -// this->Refresh(); -// return; -// } -// } - - // ¥ causes repositioning of the scrollbars - SetScrollMode(mDefaultScrollMode, true); - ClearBackground(); - mContext->Repaginate(); -} - -const char* -CHTMLView :: GetBuiltInAttribute ( LO_BuiltinStruct *inBuiltinStruct, const char* inAttribute ) -{ - lo_NVList& attributes = inBuiltinStruct->attributes; - for ( uint16 n = 0; n < attributes.n; n++ ) { - const char* attName = attributes.names[n]; - const char* attValue = attributes.values[n]; - if ( attName && (XP_STRCASECMP(attName, inAttribute) == 0) ) - return attValue; - } - return NULL; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ FreeBuiltinElement -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Dispose of an embedded SHACK widget -void -CHTMLView :: FreeBuiltinElement ( LO_BuiltinStruct* inBuiltinStruct ) -{ - LView* tree = static_cast(inBuiltinStruct->FE_Data); - if ( tree ) { - RemoveSubPane ( tree ); - delete tree; - inBuiltinStruct->FE_Data = NULL; - } - -} // FreeBuiltinElement - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DisplayBuiltin -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Create and display builtin elements like the embedded composer or shack widgets. -void -CHTMLView :: DisplayBuiltin ( int /*inLocation*/, LO_BuiltinStruct* inBuiltinStruct ) -{ - // create the widget if it hasn't already been created, else refresh - if ( ! inBuiltinStruct->FE_Data ) { - - // get tag attributes - const char* url = GetBuiltInAttribute(inBuiltinStruct, "data"); - const char* target = GetBuiltInAttribute(inBuiltinStruct, "target"); - - // reanimate the builtin version of Aurora - CShackRDFCoordinator* tree = dynamic_cast - (UReanimator::CreateView(9503, this, this)); - tree->ResizeFrameTo ( inBuiltinStruct->width, inBuiltinStruct->height, false ); - tree->PlaceInSuperImageAt ( inBuiltinStruct->x, inBuiltinStruct->y, false ); - - // set window target and url - lo_NVList& attributes = inBuiltinStruct->attributes; - tree->BuildHTPane ( url, attributes.n, attributes.names, attributes.values); - tree->SetTargetFrame ( target ); - - tree->Refresh(); - inBuiltinStruct->FE_Data = tree; - inBuiltinStruct->htPane = tree->HTPane(); - } - else { - LView* tree = static_cast(inBuiltinStruct->FE_Data); - tree->Refresh(); - } - -} // DisplayBuiltin - - -/* -// MAY WANT TO ADD HERE AS BSE IMPLEMENTATION -void CHTMLView::BeginPreSection(void) -{ - // Empty NS_xxx implementation -} - -void CHTMLView::EndPreSection(void) -{ - // Empty NS_xxx implementation -} - -*/ - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ CDragURLTask -// --------------------------------------------------------------------------- - -CDragURLTask::CDragURLTask( - const EventRecord& inEventRecord, - const Rect& inGlobalFrame, - CHTMLView& inHTMLView) - : mGlobalFrame(inGlobalFrame), - mHTMLView(inHTMLView), - - super(inEventRecord) -{ -} - -// --------------------------------------------------------------------------- -// ¥ AddFlavors -// --------------------------------------------------------------------------- - -void -CDragURLTask::AddFlavors( - DragReference /* inDragRef */) -{ - OSErr theErr; - - // If the option-key is down and the element is an image, we drag as a PICT, even to the finder.. - // If not, we drag real image data (JPEF or GIF).. - Boolean isOptionDown = ((mEventRecord.modifiers & optionKey) != 0); - - if (mHTMLView.mDragElement->type != LO_IMAGE || !isOptionDown) - { - AddFlavorBookmarkFile(static_cast(this)); - } - - AddFlavorURL(static_cast(this)); - - AddFlavorBookmark(static_cast(this)); - - // Add a PICT flavor for images - - if (mHTMLView.mDragElement->type == LO_IMAGE) - { - LO_ImageStruct* imageElement = (LO_ImageStruct*)mHTMLView.mDragElement; - - if (!IsInternalTypeLink((char*)imageElement->image_url) || IsMailNewsReconnect((char*)imageElement->image_url)) - { - // flavorSenderTranslated will prevent us from being saved as a PICT clipping - // in the Finder. When the option key is down, this is exactly what we want - - FlavorFlags flavorFlags = (isOptionDown) ? 0 : flavorSenderTranslated; - theErr = ::AddDragItemFlavor (mDragRef, (ItemReference) this, 'PICT', nil, 0, flavorFlags); - ThrowIfOSErr_(theErr); - } - } -} - -// --------------------------------------------------------------------------- -// ¥ MakeDragRegion -// --------------------------------------------------------------------------- - -void -CDragURLTask::MakeDragRegion( - DragReference /* inDragRef */, - RgnHandle /* inDragRegion */) -{ - AddRectDragItem((ItemReference)mHTMLView.mDragElement, mGlobalFrame); -} - -#pragma mark - - -#if defined (JAVA) -void FlushEventHierarchyRecursive(LPane *currentPane) -{ - Hsun_awt_macos_MComponentPeer *componentPeerHandle = PaneToPeer(currentPane); - - // Flush the events associated with the component; - - if (componentPeerHandle != NULL) { - - // Clear the interface queue of events related to the component to help garbage collection. - - ClassClass *interfaceEventClass; - - interfaceEventClass = FindClass(EE(), "sun/awt/macos/InterfaceEvent", (PRBool)TRUE); - - if (interfaceEventClass != NULL) { - MToolkitExecutJavaStaticMethod(interfaceEventClass, "flushInterfaceQueue", "(Lsun/awt/macos/MComponentPeer;)V", componentPeerHandle); - } - - // Recurse on the sub-panes - - if (unhand(componentPeerHandle)->mIsContainer) { - - LArrayIterator iterator(((LView *)currentPane)->GetSubPanes()); - LPane *theSub; - - while (iterator.Next(&theSub)) - FlushEventHierarchyRecursive(theSub); - } - - } - -} - -void FlushEventHierarchy(LView *javaAppletView) -{ - LPane *canvas = javaAppletView->FindPaneByID('cvpr'); - - FlushEventHierarchyRecursive(canvas); - -} -#endif /* defined (JAVA) */ diff --git a/mozilla/cmd/macfe/gui/CHTMLView.h b/mozilla/cmd/macfe/gui/CHTMLView.h deleted file mode 100644 index f667fb24c8c..00000000000 --- a/mozilla/cmd/macfe/gui/CHTMLView.h +++ /dev/null @@ -1,873 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CHTMLView.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ntypes.h" -#include "structs.h" -#include "ctxtfunc.h" -#include "uprefd.h" -#include "layers.h" -#include "CDrawable.h" -#include "CBrowserDragTask.h" - -#include "Events.h" // need for new fe_EventStruct - mjc - -#include "net.h" // for FO_CACHE_AND_PRESENT - -// The FE part of a cross-platform event. The event will get filtered -// through the compositor and will be dispatched on a per-layer basis. -/* -typedef struct fe_EventStruct { - Point portPoint; // The point (in port coordinates) associated with the event - void *event; // The specifics of the event - event dependent -} fe_EventStruct; -*/ - -// new typedef replaces void* with union for meaningful value on return from event dispatch. -typedef struct fe_EventStruct { - Point portPoint; - union event_union { - SMouseDownEvent mouseDownEvent; - EventRecord macEvent; - } event; -} fe_EventStruct; - -void SafeSetCursor( ResIDT inCursorID ); -void FlushEventHierarchy(LView *javaAppletView); -void FlushEventHierarchyRecursive(LPane *currentPane); - -class CHyperScroller; -class CHTMLClickRecord; -class CSharableCompositor; -class CSharedPatternWorld; -class CURLDispatchInfo; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CHTMLView : - public COnscreenDrawable, - public LView, - public LListener, - public LDragAndDrop, - public LCommander, - public LPeriodical -{ - friend class CBrowserContext; - friend class CPluginView; - friend class CDragURLTask; - - public: - - enum { pane_ID = 'html', class_ID = 'HtVw' }; - - CHTMLView(LStream* inStream); - virtual ~CHTMLView(); - - virtual void SetContext( - CBrowserContext* inNewContext); - - // ACCESSORS - - CHyperScroller* GetScroller() { return mScroller; } - - CBrowserContext* GetContext() const { return mContext; } - Boolean IsBorderless(void) const; - Boolean IsRootHTMLView(void) const; - Boolean IsFocusedFrame(void) const; - - CHTMLView* GetSuperHTMLView(void); - void SetSuperHTMLView(CHTMLView *inView); - GrafPtr GetCachedPort(void); - - void SetFormElemBaseModel(LModelObject* inModel); - LModelObject* GetFormElemBaseModel(void); - - virtual void ResetScrollMode(Boolean inRefresh = false); // resets to default, LO_SCROLL_AUTO - // Add method to *REALLY* reset scroll mode to default scroll mode. - void ResetToDefaultScrollMode(); - - virtual void SetScrollMode( - Int8 inScrollMode, - Boolean inRefresh = false); - - virtual Int8 GetScrollMode(void) const; - - void SetDefaultScrollMode(Int8 inScrollMode) {mDefaultScrollMode = inScrollMode; } - void SetEraseBackground(Boolean inErase) {mEraseBackground = inErase; } - - RGBColor GetBackgroundColor() const { return mBackgroundColor; } - - virtual Int16 GetWinCSID(void) const; - virtual Int16 DefaultCSIDForNewWindow(void); - - virtual Boolean SetDefaultCSID(Int16 default_csid, Boolean forceRepaginate = false); - virtual void SetFontInfo(); - - void SetWindowBackgroundColor(); - virtual void GetDefaultFileNameForSaveAs(URL_Struct* url, CStr31& defaultName); - // overridden by CMessageView to use subject. - - static void CalcStandardSizeForWindowForScreen( - CHTMLView* inTopMostHTMLView, - const LWindow& inWindow, - const Rect& inScreenBounds, - SDimension16& outStandardSize); - - void ClearInFocusCallAlready() - { mInFocusCallAlready = false; } - - // COMMANDER STUFF - - virtual Boolean HandleKeyPress( const EventRecord& inKeyEvent ); - - virtual void ShowView(LPane& pane); - - // PERIODICAL AND LISTENER STUFF - - virtual void SpendTime(const EventRecord& inMacEvent); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - // LAYER DISPATCH - - virtual void SetLayerOrigin( - Int32 inX, - Int32 inY); - - virtual void GetLayerOrigin( - Int32* outX, - Int32* outY); - - virtual void SetLayerClip( - FE_Region inRegion); - - virtual void CopyPixels( - CDrawable* inSrcDrawable, - FE_Region inCopyRgn); - - PRBool HandleLayerEvent( - CL_Layer* inLayer, - CL_Event* inEvent); - - PRBool HandleEmbedEvent( - LO_EmbedStruct* inEmbed, - CL_Event* inEvent); - - void SetCurrentDrawable( - CDrawable* inDrawable); - - CGrafPtr GetCurrentPort( - Point& outPortOrigin); - - // DRAWING AND UPDATING - - virtual void ScrollImageBy( - Int32 inLeftDelta, - Int32 inTopDelta, - Boolean inRefresh); - virtual void ScrollBits ( Int32 /* left */, Int32 /* top */ ) ; - - virtual void AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh); - - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); - - virtual Boolean FocusDraw( - LPane* inSubPane = nil); - - virtual Boolean EstablishPort(); - - static int PrefUpdateCallback( - const char *inPrefString, - void *inCHTMLView); - static int PrefInvalidateCachedPreference( - const char *inPrefString, - void *inCHTMLView); - - virtual void DrawGridEdges(RgnHandle inUpdateRgn); - - protected: - virtual void BeTarget(); - void SetRepaginate(Boolean inSetting); - Boolean GetRepaginate(); - - protected: - virtual Boolean IsGrowCachingEnabled() const; - - public: - - // MOUSING - virtual void AdjustCursorSelf( - Point inPortPt, - const EventRecord& inMacEvent ); - void AdjustCursorSelfForLayer( - Point inPortPt, - const EventRecord& inMacEvent, - CL_Layer *layer, - SPoint32 inLayerPt ); - - virtual void ImageToAvailScreenPoint(const SPoint32 &inImagePoint, Point &outPoint) const; - // TIMER URL - - virtual void SetTimerURL(const URL_Struct* inURL); - virtual void ClearTimerURL(void); - - inline CCharSet GetCharSet() { return mCharSet; } - - // FIND SUPPORT - - virtual void CreateFindWindow(); - virtual Boolean DoFind(); - - // MOUSING AND KEYING - - virtual void PostProcessClickSelfLink( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord, - Boolean inMakeNewWindow, - Boolean inSaveToDisk, - Boolean inDelay); - - static void SetLastFormKeyPressDispatchTime(UInt32 inTime) { sLastFormKeyPressDispatchTime = inTime; } - - virtual void HandleImageIconClick(CHTMLClickRecord& inClickRecord); - - - protected: - - enum { - eDefaultFontScaling = 0, - eMinFontScaling = -8, - eMaxFontScaling = 8 - }; - - virtual void NoteFontScalingChanged ( ) ; - - virtual void DrawSelf(void); - virtual void DrawFrameFocus(void); - virtual void CalcFrameFocusMask(RgnHandle outFocusMask); - virtual void InvalFocusArea(void); - virtual void AdjustScrollBars(); - - virtual void FinishCreateSelf(void); - virtual void EnableSelf(void); - virtual void DisableSelf(void); - - // COMMANDER ISSUES - - virtual void PutOnDuty(LCommander*); - virtual void TakeOffDuty(void); - void RegisterCallBackCalls(); - void UnregisterCallBackCalls(); - - public: - - virtual void FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand(CommandT inCommand, void* ioParam); - virtual URL_Struct* GetURLForPrinting(Boolean& outSuppressURLCaption, - MWContext *printingContext); - - protected: - - // URL DISPATCHING - virtual void DispatchURL( - URL_Struct* inURLStruct, - CNSContext* inTargetContext, - Boolean inDelay = false, - Boolean inForceCreate = false, - FO_Present_Types inOutputFormat = FO_CACHE_AND_PRESENT - ); - virtual void DispatchURL(CURLDispatchInfo* inDispatchInfo); - virtual URL_Struct* CreateURLStructOfCurrent ( Boolean inCopyFormData ) ; - - Boolean CanPrint() const; - void DoPrintCommand(CommandT); - - // MOUSING AND KEYING - - virtual void Click(SMouseDownEvent &inMouseDown); - - virtual void ClickSelf(const SMouseDownEvent& inMouseDown); - - virtual void ClickSelfLayer( - const SMouseDownEvent& inMouseDown, - CL_Layer* inLayer, - SPoint32 inLayerWhere); - - virtual void ClickSelfLink( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord, - Boolean inMakeNewWindow); - - virtual void ClickDragLink( - const SMouseDownEvent& inMouseDown, - LO_Element* inElement); - virtual void ClickDragSelection( - const SMouseDownEvent& inMouseDown, - LO_Element* inElement); - - virtual void ClickTrackEdge( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord); - - virtual Boolean ClickTrackSelection( - const SMouseDownEvent& inMouseDown, - CHTMLClickRecord& inClickRecord); - - virtual void EventMouseUp(const EventRecord& inMouseUp); - - virtual Boolean HandleKeyPressLayer( const EventRecord& inKeyEvent, CL_Layer* inLayer, SPoint32 inLayerWhere ); - - // Drag and Drop support - - virtual void DoDragSendData( - FlavorType inFlavor, - ItemReference inItemRef, - DragReference inDragRef); - - // NOTIFICATION RESPONSE - - virtual void NoteFinishedLayout(void); - virtual void NoteAllConnectionsComplete(void); - virtual void NoteStartRepagination(void); - virtual void NoteEmptyRepagination(void); - virtual void NoteConfirmLoadNewURL(Boolean& ioCanLoad); - virtual void NoteStartLoadURL(void); - virtual void NoteGridContextPreDispose(Boolean inSavingHistory); - virtual void NoteGridContextDisposed(void); - - // DEFERRED LOADING - - virtual void PostDeferredImage(const char* inImageURL); - virtual Boolean IsImageInDeferredQueue(const char* inImageURL) const; - virtual void ClearDeferredImageQueue(void); - - // CONTEXT DISPATCH - - virtual void LayoutNewDocument( - URL_Struct* inURL, - Int32* inWidth, - Int32* inHeight, - Int32* inMarginWidth, - Int32* inMarginHeight); - - virtual void ClearView( - int inWhich = 0); - - virtual void ClearBackground(void); - - virtual void DrawBackground( - const Rect& inArea, - LO_ImageStruct* inBackdrop = NULL); - - virtual void DrawBackgroundSelf( - const Rect& inArea, - LO_ImageStruct* inBackdrop); - - virtual void EraseBackground( - int inLocation, - Int32 inX, - Int32 inY, - Uint32 inWidth, - Uint32 inHeight, - LO_Color* inColor); - - virtual int SetColormap( - IL_IRGB* inMap, - int inRequested); - - virtual void SetBackgroundColor( - Uint8 inRed, - Uint8 inGreen, - Uint8 inBlue); - - virtual void SetBackgroundImage( - LO_ImageStruct* inImageStruct, - Boolean inRefresh = true); - - - virtual void CalcPluginMask(RgnHandle ioRgn); - -//----------------------- - - public: - // needs to be public for FE_ScrollTo and FE_ScrollBy - // added default Boolean arg to scroll even if position is visible - mjc 97-9-12 - virtual void SetDocPosition( - int inLocation, - Int32 inX, - Int32 inY, - Boolean inScrollEvenIfVisible = false); - - protected: - - virtual void SetDocDimension( - int inLocation, - Int32 inWidth, - Int32 inHeight); - -#if 0 - virtual void SetDocDimensionSelf( - Int32 inWidth, - Int32 inHeight); -#endif - - virtual void GetDocPosition( - int inLocation, - Int32* outX, - Int32* outY); - - virtual void FlushPendingDocResize(void); - -//------------------------ - - virtual int GetTextInfo( - LO_TextStruct* inText, - LO_TextInfo* outTextInfo); - - virtual int MeasureText( - LO_TextStruct* inText, - short* outCharLocs); - - virtual void GetTextFrame( - LO_TextStruct* inTextStruct, - Int32 inStartPos, - Int32 inEndPos, - XP_Rect* outFrame); - - virtual void DisplaySubtext( - int inLocation, - LO_TextStruct* inText, - Int32 inStartPos, - Int32 inEndPos, - XP_Bool inNeedBG); - - virtual void DisplayText( - int inLocation, - LO_TextStruct* inText, - XP_Bool inNeedBG); - - virtual void DisplayLineFeed( - int inLocation, - LO_LinefeedStruct* inLinefeedStruct, - XP_Bool inNeedBG); - - virtual void DisplayHR( - int inLocation, - LO_HorizRuleStruct* inRuleStruct); - - virtual void DisplayBullet( - int inLocation, - LO_BullettStruct* inBulletStruct); - -//----------------------- - - protected: - - virtual void GetEmbedSize( - LO_EmbedStruct* inEmbedStruct, - NET_ReloadMethod inReloadMethod); - - virtual void FreeEmbedElement( - LO_EmbedStruct* inEmbedStruct); - - virtual void CreateEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void SaveEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void RestoreEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void DestroyEmbedWindow( - NPEmbeddedApp* inEmbeddedApp); - - virtual void DisplayEmbed( - int inLocation, - LO_EmbedStruct* inEmbedStruct); - -//----------------------- - - protected: - - virtual void GetJavaAppSize( - LO_JavaAppStruct* inJavaAppStruct, - NET_ReloadMethod inReloadMethod); - - virtual void FreeJavaAppElement( - LJAppletData* inAppletData); - - virtual void HideJavaAppElement( - LJAppletData* inAppletData); - - virtual void DisplayJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - virtual void DrawJavaApp( - int inLocation, - LO_JavaAppStruct* inJavaAppStruct); - - virtual void HandleClippingView( - struct LJAppletData *appletD, - int x, - int y, - int width, - int height); -//----------------------- - - protected: - - virtual void GetFormElementInfo( - LO_FormElementStruct* inElement); - -/* - nothing view-specific about these routines, so the BrowserContext just calls thru - to the status functions in UFormElementFactory. - deeje 97-02-13 - - virtual void GetFormElementValue( - LO_FormElementStruct* inElement, - XP_Bool inHide); - - virtual void ResetFormElement( - LO_FormElementStruct* inElement); - - virtual void SetFormElementToggle( - LO_FormElementStruct* inElement, - XP_Bool inToggle); - - virtual void FormTextIsSubmit( - LO_FormElementStruct* inElement); -*/ - - virtual void ResetFormElementData( - LO_FormElementStruct* inElement, - Boolean inRefresh, - Boolean inFromDefaults); - - virtual void DisplayFormElement( - int inLocation, - LO_FormElementStruct* inFormElement); - - virtual void DisplayBorder( - int inLocation, - int inX, - int inY, - int inWidth, - int inHeight, - int inBW, - LO_Color* inColor, - LO_LineStyle inStyle); - - virtual void UpdateEnableStates(); - - virtual void DisplayFeedback( - int inLocation, - LO_Element* inElement); - -//----------------------- - - protected: - - virtual void FreeEdgeElement( - LO_EdgeStruct* inEdgeStruct); - - virtual void DisplayEdge( - int inLocation, - LO_EdgeStruct* inEdgeStruct); - -//----------------------- - - protected: - - virtual void DisplayTable( - int inLocation, - LO_TableStruct* inTableStruct); - - virtual void DisplayCell( - int inLocation, - LO_CellStruct* inCellStruct); - - virtual void InvalidateEntireTableOrCell( - LO_Element* inElement); - - virtual void DisplayAddRowOrColBorder( - XP_Rect* inRect, - XP_Bool inDoErase); - - - virtual Boolean CalcElementPosition( - LO_Element* inElement, - Rect& outFrame); - - virtual void CalcAbsoluteElementPosition( - LO_Element* inElement, - XP_Rect& outFrame); - - // Support for style sheet borders - virtual void DisplaySolidBorder( - const Rect& inFrame, - const RGBColor& inBorderColor, - Int32 inTopWidth, - Int32 inLeftWidth, - Int32 inBottomWidth, - Int32 inRightWidth); - - virtual void DisplayBevelBorder( - const Rect& inFrame, - const RGBColor& inBorderColor, - Boolean inRaised, - Int32 inTopWidth, - Int32 inLeftWidth, - Int32 inBottomWidth, - Int32 inRightWidth); - - virtual void DisplayGrooveRidgeBorder( - const Rect& inFrame, - const RGBColor& inBorderColor, - Boolean inIsGroove, - Int32 inTopWidth, - Int32 inLeftWidth, - Int32 inBottomWidth, - Int32 inRightWidth); -//----------------------- - - protected: - - virtual void CreateGridView( - CBrowserContext* inGridContext, - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight, - Int8 inScrollMode, - Bool inNoEdge); - - virtual void CropFrameToContainer( - Int32 inImageLeft, - Int32 inImageTop, - Int32 inImageWidth, - Int32 inImageHeight, - Rect& outLocalFrame) const; - - virtual void RestructureGridView( - Int32 inX, - Int32 inY, - Int32 inWidth, - Int32 inHeight); - - virtual void GetFullGridSize( - Int32& outWidth, - Int32& outHeight); - -//----------------------- -// SHACK PROTOTYPES - - protected: - - const char* GetBuiltInAttribute ( - LO_BuiltinStruct *inBuiltinStruct, - const char* inAttribute ) ; - virtual void FreeBuiltinElement( - LO_BuiltinStruct * inBuiltinStruct) ; - virtual void DisplayBuiltin( - int inLocation, - LO_BuiltinStruct* inBuiltinStruct) ; - -//----------------------- - - protected: - - virtual void InstallBackgroundColor(void); - // Sets mBackgroundColor. Called from ClearBackground(). - // The base class implementation uses the text background - // preference, but derived classes can override this. - - virtual void GetDefaultBackgroundColor(LO_Color* outColor) const; - // Called by layout before setting the background color - // of a context. The view can leave it alone (which will - // use the global default background color) or override it. - - virtual void ResetBackgroundColor() const; - // Calls RGBBackColor(mBackgroundColor). Printview overrides. - - Boolean ContextMenuPopupsEnabled (void); - - inline void LocalToLayerCoordinates( - const XP_Rect& inBoundingBox, - Point inWhereLocal, - SPoint32& outWhereLayer) const; - -// char * fURLTimer; // URL to load when timer goes off -// UInt32 fURLFireTime; // When this url should be fired up - - -//----------------------- -// Data - - protected: - - CBrowserContext* mContext; - - RGBColor mBackgroundColor; - LO_ImageStruct* mBackgroundImage; - Boolean mEraseBackground; - - Point mOriginalOrigin; - - private: - CHTMLView* mSuperHTMLView; - - protected: - - Boolean mNoBorder; - Boolean mHasGridCells; - Boolean mShowFocus; - GrafPtr mCachedPort; - - string mTimerURL; - vector mImageQueue; - - LModelObject* mElemBaseModel; - - Int8 mScrollMode; // LO_SCROLL_YES, LO_SCROLL_NO, and LO_SCROLL_AUTO - Int8 mDefaultScrollMode; // same - CCharSet mCharSet; - - SDimension32 mPendingDocDimension; - Boolean mPendingDocDimension_IsValid; - - Int8 mFontScaling; // -8 <= mFontScaling <= 8 - StRegion mSaveLayerClip; - RgnHandle mLayerClip; - SPoint32 mLayerOrigin; - CSharableCompositor* mCompositor; - - DragSendDataUPP mSendDataUPP; - - LO_Element* mDragElement; - - Uint32 mTimerURLFireTime; - char* mTimerURLString; - NET_ReloadMethod mTimerURLReloadPolicy; - - CRouterDrawable* mOnscreenDrawable; - COffscreenDrawable* mOffscreenDrawable; - CDrawable* mCurrentDrawable; - - CSharedPatternWorld* mPatternWorld; - Boolean mNeedToRepaginate; - - Point mOldPoint; // Last place cursor was adjusted. No initializing - long mOldEleID; // Last anchor text block whose URL we displayed. No initializing - - // 97-06-11 pkc -- Add vector to keep track of grid edges and flag that tells us - // not to add LO_EdgeStruct* to vector because it's already in vector - vector mGridEdgeList; - Boolean mDontAddGridEdgeToList; - - Boolean mLoadingURL; - Boolean mStopEnablerHackExecuted; - - Boolean mInFocusCallAlready; - static Boolean sCachedAlwaysLoadImages; // Caches general.always_load_images - -// FIX ME!!! the following things need to be removed in another pass - - CHyperScroller* mScroller; - // Set this when we dispatch a key event to a form, to prevent an infinite loop - // (otherwise, if the form doesn't handle the key, the event will get passed up - // the chain, and the html view will dispatch the same event to layers). - static UInt32 sLastFormKeyPressDispatchTime; - // Set when a mouse down is dispatched, so the view's mouse up handlers don't - // otherwise get called. - Boolean mWaitMouseUp; - CHTMLClickRecord* mCurrentClickRecord; - // So that FindCommandStatus can use it for disabling context menu items. - // This will be non-null only when testing or executing context menu commands. - Boolean mDragSelection; - // used for drag and drop to determine if drag was dragging around the - // selected text. - -}; // class CHTMLView - - -inline GrafPtr CHTMLView::GetCachedPort(void) - { return mCachedPort; } - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CDragURLTask : public CBrowserDragTask -{ -private: - typedef CBrowserDragTask super; - -public: - CDragURLTask( - const EventRecord& inEventRecord, - const Rect& inGlobalFrame, - CHTMLView& inHTMLView); - - virtual void AddFlavors( - DragReference inDragRef); - virtual void MakeDragRegion( - DragReference inDragRef, - RgnHandle inDragRegion); - -protected: - Rect mGlobalFrame; - CHTMLView& mHTMLView; -}; - - - diff --git a/mozilla/cmd/macfe/gui/CHistoryMenu.cp b/mozilla/cmd/macfe/gui/CHistoryMenu.cp deleted file mode 100644 index 0128d2e3a48..00000000000 --- a/mozilla/cmd/macfe/gui/CHistoryMenu.cp +++ /dev/null @@ -1,171 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CHistoryMenu.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Netscape_Constants.h" - -#include "CHistoryMenu.h" -#include "CWindowMediator.h" -#include "CBrowserContext.h" -#include "CBrowserWindow.h" -#include "UMenuUtils.h" -#include "cstring.h" - -#include "xp_list.h" - -CHistoryMenu* CHistoryMenu::sHistoryMenu = NULL; - -CHistoryMenu::CHistoryMenu(ResIDT inMenuID) : - LMenu(inMenuID), - mCurrentHistoryEntry(NULL) -{ - mLastNonDynamicItem = ::CountMenuItems(GetMacMenuH()); - sHistoryMenu = this; -} - -CHistoryMenu::~CHistoryMenu() -{ - sHistoryMenu = NULL; -} - -void CHistoryMenu::Update(void) -{ - CMediatedWindow* topWindow = (CWindowMediator::GetWindowMediator())->FetchTopWindow(WindowType_Any, regularLayerType); - if (topWindow) - { - if (topWindow->GetWindowType() == WindowType_Browser) - { - CBrowserWindow* browserWindow = (CBrowserWindow*)topWindow; - if (browserWindow->GetWindowContext()) - { - History_entry* currentEntry = (browserWindow->GetWindowContext())->GetCurrentHistoryEntry(); - if (GetCurrentHistoryEntry() != currentEntry) - SyncMenuToHistory(browserWindow->GetWindowContext()); - } - } - } - else - // If there are no windows, we default to browser menus, so clear - // history items from menu - UMenuUtils::PurgeMenuItems(GetMacMenuH(), GetLastNonDynamicItem()); -} - -#define Min(a,b) (((a) < (b)) ? (a) : (b)) - -// Rebuild history menu -void CHistoryMenu::SyncMenuToHistory(CNSContext* inNSContext) -{ - Int16 menuSize; - Int16 numHistoryMenuEntries; - Int16 historyLength; - - menuSize = ::CountMItems(GetMacMenuH()); - historyLength = inNSContext->GetHistoryListCount(); - - // this is total number of history menu items we want in menu - // add one because we loop from 1 -> num instead of from 0 -> (num - 1) - numHistoryMenuEntries = Min(historyLength, cMaxHistoryMenuItems) + 1; - - Int16 count = 1, - // since we want most recent history entries, grab entries from end - // of history list - entryIndex = historyLength, - // this is index of menu item we're going to insert - currentMenuItemIndex = count + GetLastNonDynamicItem(), - // index of of current history entry in - currentEntryIndex = inNSContext->GetIndexOfCurrentHistoryEntry(); - // Now loop over current history menu items, overwriting current menu items. - // If the new history is longer than current one, append menu items - while (count < numHistoryMenuEntries) - { - // copy title string because we need to 'unescape' string - CAutoPtr title; - - title.reset(inNSContext->GetHistoryEntryTitleByIndex(entryIndex)); - if (title.get()) - { - if (!title->length()) - { - title.reset(new cstring); - inNSContext->GetHistoryURLByIndex(*title, entryIndex); - } - - UMenuUtils::AdjustStringForMenuTitle(*title); - LStr255 pstr(*title); - // append menu item if we've reached end of menu - if (currentMenuItemIndex > menuSize) - UMenuUtils::AppendMenuItem(GetMacMenuH(), pstr, true); - else - ::SetMenuItemText(GetMacMenuH(), currentMenuItemIndex, pstr); - } - -// NOTE: These command keys are used in the "Window" menu now. -// if (count < 11) // Setting of command numbers -// ::SetItemCmd(GetMacMenuH(), currentMenuItemIndex, '0' + count - 1); -// else -// ::SetItemCmd(GetMacMenuH(), currentMenuItemIndex, 0); - - if (entryIndex == currentEntryIndex) // Checkmark next to current entry - ::SetItemMark(GetMacMenuH(), currentMenuItemIndex, ''); - else - ::SetItemMark(GetMacMenuH(), currentMenuItemIndex, 0); - ++count; - --entryIndex; - ++currentMenuItemIndex; - } - // remove left over menu items just in case new history list is - // smaller than previous one - if (currentMenuItemIndex <= menuSize) - UMenuUtils::PurgeMenuItems(GetMacMenuH(), currentMenuItemIndex - 1); - SetCurrentHistoryEntry(inNSContext->GetCurrentHistoryEntry()); -} - -CommandT CHistoryMenu::GetFirstSyntheticCommandID(void) -{ - if (sHistoryMenu) - return (-(((Int32)sHistoryMenu->GetMenuID()) << 16) - - sHistoryMenu->GetLastNonDynamicItem() - - 1); - else - return cmd_Nothing; -} - -Boolean CHistoryMenu::IsHistoryMenuSyntheticCommandID(CommandT inCommandID) -{ - Boolean result = false; - CommandT firstCommandID, lastCommandID; - - if (sHistoryMenu) - { - firstCommandID = -(((Int32)sHistoryMenu->GetMenuID()) << 16) - - sHistoryMenu->GetLastNonDynamicItem() - - 1; - lastCommandID = firstCommandID - - (::CountMenuItems(sHistoryMenu->GetMacMenuH()) - - sHistoryMenu->GetLastNonDynamicItem()) - + 1; - // check that lastCommandID <= inCommandID <= firstCommandID - // note: we're checking synthetic commands which are negative - result = lastCommandID <= inCommandID && inCommandID <= firstCommandID; - } - - return result; -} diff --git a/mozilla/cmd/macfe/gui/CHistoryMenu.h b/mozilla/cmd/macfe/gui/CHistoryMenu.h deleted file mode 100644 index ecc521e5c5a..00000000000 --- a/mozilla/cmd/macfe/gui/CHistoryMenu.h +++ /dev/null @@ -1,70 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CHistoryMenu.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include - -// Mozilla - -const Int16 cMaxHistoryMenuItems = 32; - -class CNSContext; -typedef struct _History_entry History_entry; - -class CHistoryMenu : public LMenu -{ -public: - CHistoryMenu(ResIDT inMenuID); - virtual ~CHistoryMenu(); - - void Update(void); - - static CommandT GetFirstSyntheticCommandID(void); - - static Boolean IsHistoryMenuSyntheticCommandID(CommandT inCommandID); - -protected: - void SyncMenuToHistory(CNSContext* inNSContext); - - History_entry* GetCurrentHistoryEntry(void); - void SetCurrentHistoryEntry(History_entry* inHistoryEntry); - - Int16 GetLastNonDynamicItem(void); - -public: - static CHistoryMenu* sHistoryMenu; - -protected: - Int16 mLastNonDynamicItem; - History_entry* mCurrentHistoryEntry; -}; - -inline History_entry* CHistoryMenu::GetCurrentHistoryEntry() - { return mCurrentHistoryEntry; }; - -inline void CHistoryMenu::SetCurrentHistoryEntry(History_entry* inHistoryEntry) - { mCurrentHistoryEntry = inHistoryEntry; }; - -inline Int16 CHistoryMenu::GetLastNonDynamicItem() - { return mLastNonDynamicItem; }; diff --git a/mozilla/cmd/macfe/gui/CHyperScroller.cp b/mozilla/cmd/macfe/gui/CHyperScroller.cp deleted file mode 100644 index c66de98ca69..00000000000 --- a/mozilla/cmd/macfe/gui/CHyperScroller.cp +++ /dev/null @@ -1,497 +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. - */ - -#include -#include "CHyperScroller.h" -#include "UGraphicGizmos.h" -#include "macgui.h" - -const ResIDT cSizeBoxIconID = 29200; - -//------------------------------------------------------------------------------ -// CHyperScroller -//------------------------------------------------------------------------------ -#define FOCUSBOXWIDTH 3 - - -#include "CHTMLView.h" - -CHyperScroller::CHyperScroller(LStream *inStream) - : LScrollerView(inStream) -{ - fVerticalBar = NULL; - fHorizontalBar = NULL; - mHandleGrowIconManually = false; - - ResetExpansion(); -} - - -void CHyperScroller::ResetExpansion(void) -{ - mExpanded.left = false; - mExpanded.top = false; - mExpanded.right = false; - mExpanded.bottom = false; -} - - -void CHyperScroller::ExpandLeft(void) -{ - mExpanded.left = true; -} - -void CHyperScroller::ExpandTop(void) -{ - mExpanded.top = true; -} - -void CHyperScroller::ExpandRight(void) -{ - mExpanded.right = true; -} - -void CHyperScroller::ExpandBottom(void) -{ - mExpanded.bottom = true; -} - - -void CHyperScroller::AdjustHyperViewBounds(void) -{ - Assert_(mScrollingView); - - if (!mScrollingView) - { - return; - } - - CHTMLView* theHyperView = dynamic_cast(mScrollingView); - - SDimension16 theFrameSize; - GetFrameSize(theFrameSize); - - SDimension16 theHyperSize = theFrameSize; - - if (!mExpanded.top) - theHyperSize.height--; - - if (!mExpanded.left) - theHyperSize.width--; - - if (!mExpanded.bottom) - theHyperSize.height--; - - if (!mExpanded.right) - theHyperSize.width--; - - if (mVerticalBar != NULL) - { - theHyperSize.width -= (ScrollBar_Size - 1); - if (mExpanded.right) - theHyperSize.width--; - } - - if (mHorizontalBar != NULL) - { - theHyperSize.height -= (ScrollBar_Size - 1); - if (mExpanded.bottom) - theHyperSize.height--; - } - - Int32 theHorizOffset = 1; - Int32 theVertOffset = 1; - - if (mExpanded.top) - theVertOffset--; - - if (mExpanded.left) - theHorizOffset--; - - mScrollingView->PlaceInSuperFrameAt(theHorizOffset, theVertOffset, false); - mScrollingView->ResizeFrameTo(theHyperSize.width, theHyperSize.height, false); -} - -void CHyperScroller::AdjustScrollBars() - { - Boolean need_inherited_AdjustScrollbars = true; - - /* - If there is no scrolling view, then we don't adjust anything (even though - you might think we should) because there probably is about to be a scrolling - view, and adjusting now will mess things up... - */ - - if ( mScrollingView ) - { - Boolean hasHorizontal = mHorizontalBar != NULL; - Boolean hasVertical = mVerticalBar != NULL; - - // Unless told otherwise, assume we've got what we need. - Boolean needHorizontal = hasHorizontal; - Boolean needVertical = hasVertical; - - CHTMLView* htmlView = dynamic_cast(mScrollingView); - if ( !htmlView || (htmlView->GetScrollMode()==LO_SCROLL_AUTO) ) - { - switch ( htmlView->GetScrollMode() ) - { - case LO_SCROLL_NO: - needHorizontal = needVertical = false; - break; - - case LO_SCROLL_YES: - needHorizontal = needVertical = true; - break; - - case LO_SCROLL_AUTO: - { - /* - ...if there is a scrolling view, and either it's not a |CHTMLView| or - if it is a |CHTMLView|, it allows scrollbars... then figure out if we - need scrollbars based on the size of the frame and image - */ - - SDimension16 frameSize; - mScrollingView->GetFrameSize(frameSize); - - SDimension32 imageSize; - mScrollingView->GetImageSize(imageSize); - - needHorizontal = imageSize.width > frameSize.width; - needVertical = imageSize.height > frameSize.height; - } - break; - } - } - - if ( (hasHorizontal != needHorizontal) || (hasVertical != needVertical) ) - { - ShowScrollbars(needHorizontal, needVertical); - need_inherited_AdjustScrollbars = false; // ...since |ShowScrollbars| calls it. - } - } - - if ( need_inherited_AdjustScrollbars ) - Inherited::AdjustScrollBars(); - } - -Boolean CHyperScroller::ScrolledToMaxVerticalExtent() -{ - if ( mVerticalBar ) - return ( mVerticalBar->GetValue() == mVerticalBar->GetMaxValue() ); - - return true; -} - -Boolean CHyperScroller::ScrolledToMinVerticalExtent() -{ - if ( mVerticalBar ) - return ( mVerticalBar->GetValue() == 0 ); - - return true; -} - -void CHyperScroller::RefreshSelf() - /* - ...refresh just the area occupied by me and my scrollers, - and not by my mScrollingView - */ - { - if ( mHorizontalBar ) - mHorizontalBar->Refresh(); - - if ( mVerticalBar ) - mVerticalBar->Refresh(); - -// if ( mHorizontalBar && mVerticalBar ) - if ((mHandleGrowIconManually && (mVerticalBar || mHorizontalBar)) || (mVerticalBar && mHorizontalBar)) - { - Rect R = CalcDummySizeBox(); - LocalToPortPoint(topLeft(R)); - LocalToPortPoint(botRight(R)); - InvalPortRect(&R); - } - } - -// ¥¥ display control -// Show/hide the controls -// Adjust the hyperview size -void CHyperScroller::ShowScrollbars( Boolean horiOn, Boolean vertOn ) -{ - Boolean hasHorizontal = mHorizontalBar != NULL; - Boolean hasVertical = mVerticalBar != NULL; - - // ¥ quick check - if ((hasHorizontal == horiOn) && (hasVertical == vertOn)) - return; - - SDimension16 theFrameSize; - GetFrameSize(theFrameSize); - - // ¥ vertical scrollbar - { - // ¥ adjustment for visiblity of horizontal scroller - // ¥ show/hide - if (mVerticalBar && !vertOn) - { - mVerticalBar->Hide(); - fVerticalBar = mVerticalBar; - mVerticalBar = NULL; - } - else if (!mVerticalBar && vertOn) - { - mVerticalBar = fVerticalBar; - fVerticalBar = NULL; - if (mVerticalBar) - mVerticalBar->Show(); - } - - Int32 theVerticalSize = theFrameSize.height; -// if (hasHorizontal || horiOn) - if (mHandleGrowIconManually || hasHorizontal || horiOn) - theVerticalSize -= (ScrollBar_Size - 1); - - LScrollBar* theBar = (mVerticalBar != NULL) ? mVerticalBar : fVerticalBar; - StFocusAndClipIfHidden theControlClip(theBar); - theBar->PlaceInSuperFrameAt((theFrameSize.width - ScrollBar_Size), 0, false); - theBar->ResizeFrameTo(ScrollBar_Size, theVerticalSize, false); - - if (mVerticalBar != NULL) - mVerticalBar->Refresh(); - } - - // ¥Êhorizontal scrollbar - { - - if (mHorizontalBar && !horiOn) - { - mHorizontalBar->Hide(); - fHorizontalBar = mHorizontalBar; - mHorizontalBar = NULL; - } - else if (!mHorizontalBar && horiOn) - { - mHorizontalBar = fHorizontalBar; - fHorizontalBar = NULL; - if (mHorizontalBar) - mHorizontalBar->Show(); - } - - Int32 theHorizontalSize = theFrameSize.width; -// if (hasVertical || vertOn) - if (mHandleGrowIconManually || hasVertical || vertOn) - theHorizontalSize -= (ScrollBar_Size - 1); - - LPane* theBar = (mHorizontalBar != NULL) ? mHorizontalBar : fHorizontalBar; - if ( theBar ) - { - StFocusAndClipIfHidden theControlClip(theBar); - theBar->PlaceInSuperFrameAt(0, (theFrameSize.height - ScrollBar_Size), false); - theBar->ResizeFrameTo(theHorizontalSize, ScrollBar_Size, false); - } - - if (mHorizontalBar != NULL) - mHorizontalBar->Refresh(); - } - - if ( mScrollingView ) - AdjustHyperViewBounds(); - Inherited::AdjustScrollBars(); // call inherited AdjustScrollBars(), as mine could call _this_ routine back - - // ¥ only refresh the little box. Refreshing the whole view causes flashes -// if (HasScrollbars()) - if ((mHandleGrowIconManually && (mVerticalBar || mHorizontalBar)) || (mVerticalBar && mHorizontalBar)) - { - Rect sizeBox = CalcDummySizeBox(); - sizeBox.top += mFrameLocation.v; - sizeBox.bottom += mFrameLocation.v; - sizeBox.left += mFrameLocation.h; - sizeBox.right += mFrameLocation.h; - InvalPortRect( &sizeBox ); - } -} - -// Calculates the position of the dummy size box -Rect CHyperScroller::CalcDummySizeBox() -{ - Rect r; - - r.bottom = mFrameSize.height; - r.right = mFrameSize.width; - r.top = r.bottom - 16; - r.left = r.right - 16; - - return r; -} - -// This is the little box between the scrollers. -// HyperView and windows draw it -void CHyperScroller::DrawDummySizeBox() -{ - // We need to erase that little rect above the grow box -// if ( mHorizontalBar && mVerticalBar ) - if ((mHandleGrowIconManually && (mVerticalBar || mHorizontalBar)) || (mVerticalBar && mHorizontalBar)) - { - if ( !FocusDraw() ) - return; - Rect theDummyFrame = CalcDummySizeBox(); - - if ( IsActive() ) - { - if (!mHandleGrowIconManually) - { - SBevelColorDesc theTraits; - UGraphicGizmos::LoadBevelTraits(1000, theTraits); - - ::PmForeColor(theTraits.fillColor); - ::PaintRect(&theDummyFrame); - - ::PmForeColor(eStdGrayBlack); - ::FrameRect(&theDummyFrame); - ::InsetRect(&theDummyFrame, 1, 1); - UGraphicGizmos::BevelRect(theDummyFrame, 1, theTraits.topBevelColor, theTraits.bottomBevelColor); - } - else - { - ::PlotIconID(&theDummyFrame, atAbsoluteCenter, ttNone, cSizeBoxIconID); - } - } - else - { - ::PmForeColor(eStdGrayWhite); - theDummyFrame.top += 1; - theDummyFrame.left += 1; - ::EraseRect(&theDummyFrame); - } - } -} - -void CHyperScroller::DrawEmptyScroller( LScrollBar* scrollBar ) -{ - Rect frame; - - scrollBar->CalcPortFrameRect( frame ); - PortToLocalPoint( topLeft( frame ) ); - PortToLocalPoint( botRight( frame ) ); - ::FrameRect( &frame ); - ::InsetRect( &frame, 1, 1 ); - ::EraseRect( &frame ); -} - -// Empty scrollbar drawing copied from LScroller -// Also draws the frame if needed - -void CHyperScroller::DrawSelf(void) -{ - StColorPenState::Normalize(); - - Rect theFrame; - CalcLocalFrameRect(theFrame); - - CHTMLView* theHyperView = dynamic_cast(mScrollingView); - - Boolean bIsBorderless = theHyperView->IsBorderless(); - if ((!mExpanded.top) && (!bIsBorderless)) - { - ::MoveTo(theFrame.left, theFrame.top); - ::LineTo(theFrame.right, theFrame.top); - } - - if ((!mExpanded.left) && (!bIsBorderless)) - { - ::MoveTo(theFrame.left, theFrame.top); - ::LineTo(theFrame.left, theFrame.bottom); - } - - if ((!mExpanded.bottom) && (!bIsBorderless)) - { - ::MoveTo(theFrame.left, theFrame.bottom - 1); - ::LineTo(theFrame.right, theFrame.bottom - 1); - } - - if ((!mExpanded.right) && (!bIsBorderless)) - { - ::MoveTo(theFrame.right - 1, theFrame.top); - ::LineTo(theFrame.right - 1, theFrame.bottom - 1); - } - - if (!IsActive()) - { - UGraphics::SetFore(CPrefs::Black); - UGraphics::SetBack(CPrefs::WindowBkgnd); - - if (mVerticalBar) - DrawEmptyScroller(mVerticalBar); - if (mHorizontalBar) - DrawEmptyScroller(mHorizontalBar); - } - -// if (mVerticalBar && mHorizontalBar) - if ((mHandleGrowIconManually && (mVerticalBar || mHorizontalBar)) || (mVerticalBar && mHorizontalBar)) - DrawDummySizeBox(); -} - -// Adjust the position of the scrollbars by 1 pixel, so that they fix well. -// This cannot be done inside the constructor, because -1 offset means that there are no scrollers -void CHyperScroller::FinishCreateSelf() -{ - Inherited::FinishCreateSelf(); - -// FIX ME!!! put back in -// if (((CHTMLView*)mScrollingView)->GetScrollable() != LO_SCROLL_YES) -// ShowScrollbars( FALSE, FALSE ); - - // Initially there is no content, so we don't need scroll bars - - ShowScrollbars(false, false); -} - -// 97-05-06 pkc -- override ActivateSelf so that we call draw dummy size box in active state. -void CHyperScroller::ActivateSelf() -{ - Inherited::ActivateSelf(); - - // 97-06-06 pkc -- also check to see if we're visible -// if ((mVisible == triState_On) && mVerticalBar && mHorizontalBar) - if ((mVisible == triState_On) && ((mHandleGrowIconManually && (mVerticalBar || mHorizontalBar)) || (mVerticalBar && mHorizontalBar))) - DrawDummySizeBox(); -} - -// 97-05-12 pkc -- override ClickSelf so that we can handle grow icon manually -void CHyperScroller::ClickSelf(const SMouseDownEvent &inMouseDown) -{ - if(mHandleGrowIconManually) - { - Rect theDummyFrame = CalcDummySizeBox(); - if (::PtInRect(inMouseDown.whereLocal, &theDummyFrame)) - { - // Find our LWindow superview and call ClickInGrow - LView* superView = this; - LWindow* window; - do { - superView = superView->GetSuperView(); - window = dynamic_cast(superView); - } while (!window && superView); - if (window) - window->ClickInGrow(inMouseDown.macEvent); - } - } - else - LView::ClickSelf(inMouseDown); -} diff --git a/mozilla/cmd/macfe/gui/CHyperScroller.h b/mozilla/cmd/macfe/gui/CHyperScroller.h deleted file mode 100644 index 38cc4e316d7..00000000000 --- a/mozilla/cmd/macfe/gui/CHyperScroller.h +++ /dev/null @@ -1,88 +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. - */ - -#pragma once - -#include - -/****************************************************************************** - * CHyperScroller - * Each hyperview needs the ability to show/hide a - * - focus/dragging border - * - scrollers - ******************************************************************************/ - -class CHyperScroller: public LScrollerView -{ - typedef LScrollerView Inherited; - -public: - enum { class_ID = 'HSCR' }; - - CHyperScroller( LStream* inStream ); - - void ResetExpansion(void); - - void ExpandLeft(void); - void ExpandTop(void); - void ExpandRight(void); - void ExpandBottom(void); - - // ¥ display control - void ShowScrollbars( Boolean hori, Boolean vert ); - Boolean HasScrollbars() { return ( !fVerticalBar && !fHorizontalBar ); } - Boolean HasVerticalScrollbar() { return !fVerticalBar;} - Boolean HasHorizontalScrollbar() {return !fHorizontalBar; } - - Boolean ScrolledToMinVerticalExtent(); - Boolean ScrolledToMaxVerticalExtent(); - - // Draw a little gray rectangle next to scrollers if needed - void DrawDummySizeBox(); - - void AdjustHyperViewBounds(void); - virtual void AdjustScrollBars(); - - virtual void RefreshSelf(); - - // Access to handle grow icon state - Boolean GetHandleGrowIconManually() { return mHandleGrowIconManually; } - void SetHandleGrowIconManually(Boolean inState) - { mHandleGrowIconManually = inState; } - - // Override ClickSelf so that we can handle grow icon clicking - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - -protected: - // ¥ Standard overrides - virtual void FinishCreateSelf(void); - virtual void DrawSelf(void); - virtual void ActivateSelf(); - - SBooleanRect mExpanded; - - Rect CalcDummySizeBox(); // Rectangle enclosing the dummy box - void DrawEmptyScroller( LScrollBar* scrollBar ); - LScrollBar* fVerticalBar; // When it is hidden, we need to save this value - // because LScroller assumes that we want scrollbars - // to be visible. The only way to turn this off - // is to set scrollbars to NIL. - LScrollBar* fHorizontalBar; - - Boolean mHandleGrowIconManually; -}; diff --git a/mozilla/cmd/macfe/gui/CIconTextDragTask.cp b/mozilla/cmd/macfe/gui/CIconTextDragTask.cp deleted file mode 100644 index d235bc85966..00000000000 --- a/mozilla/cmd/macfe/gui/CIconTextDragTask.cp +++ /dev/null @@ -1,501 +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. - */ - -// -// Implementation for class that handles dragging an outline of an icon and descriptive text. -// Will do translucent dragging if available (which it almost always should be). It makes -// use of a helper class (CIconTextSuite) to handle building an icon suite and text caption. -// I broke this out to allow more flexibility in how the suite is created (from a resource -// file, from RDF backend, etc). -// -// Hopefully, this (or a derrivative) should be able to meet the needs of any drag and drop -// behavior in the toolbars or the nav center instead of having us reinvent the wheel over -// and over again. -// -// This rather poor first stab is enough functionality to get its first client (the personal -// toolbar) working. It provides a caption to the right of the icon. Translucent -// dragging is broken and commented out. Future versions will also support the ability to -// drag multiple items. -// - - -#include "CIconTextDragTask.h" -#include "miconutils.h" -#include "CEnvironment.h" -#include "macutil.h" -#include "CGWorld.h" -#include "StRegionHandle.h" -#include "StCaptureView.h" -#include "LDragTask.h" -#include "LArray.h" -#include "resgui.h" - - -// -// Constructor -// -// Takes a pre-built list of CIconTextSuite's -// -CIconTextDragTask :: CIconTextDragTask( const EventRecord& inEventRecord, - const LArray & inDragItems, - const Rect& inLocalFrame ) - : mFrame(inLocalFrame), mDragItems(inDragItems), - super(inEventRecord) -{ - // do nothing -} - - -// -// Constructor -// -// Takes a single CIconTextSuite and adds it to our internal list automatically -// -CIconTextDragTask :: CIconTextDragTask ( const EventRecord& inEventRecord, - const CIconTextSuite * inItem, - const Rect& inLocalFrame ) - : mFrame(inLocalFrame), super(inEventRecord) -{ - AddDragItem ( inItem ); -} - - -// -// Constructor -// -// Provided so user doesn't have to supply a list when the drag task is created, but -// can use AddDragItem() later -// -CIconTextDragTask :: CIconTextDragTask ( const EventRecord& inEventRecord, - const Rect& inLocalFrame ) - : mFrame(inLocalFrame), super(inEventRecord) -{ - - -} - - -// -// Destructor -// -CIconTextDragTask :: ~CIconTextDragTask ( ) -{ - // do nothing -} - - -// -// AddDragItem -// -// Add the item to our internal list -// -void -CIconTextDragTask :: AddDragItem ( const CIconTextSuite * inItem ) -{ - mDragItems.InsertItemsAt ( 1, LArray::index_Last, &inItem ); - -} // AddDragItem - - -// -// MakeDragRegion -// -// Compute the outline of the region the user sees when they drag. We use the -// CIconTextSuite to do all the work, since it knows how (and where) it wants to draw. -// Multiple drag items are handled by iterating over the item list and adding each -// item's rectangles to the overall region. -// -void -CIconTextDragTask :: MakeDragRegion( DragReference /*inDragRef*/, RgnHandle inDragRegion) -{ - CIconTextSuite* curr = NULL; - LArrayIterator it ( mDragItems ); - while ( it.Next(&curr) ) - { - { - Rect iconRect = curr->IconRectGlobal(); - AddRectDragItem(static_cast(1), iconRect); - StRegionHandle iconRectRgn ( iconRect ); - StRegionHandle inset ( iconRectRgn ); // sub out all but the outline - ::InsetRgn ( inset, 1, 1 ); - ::DiffRgn ( iconRectRgn, inset, iconRectRgn ); - - ::UnionRgn ( inDragRegion, iconRectRgn, inDragRegion ); - } - { - Rect textRect = curr->TextRectGlobal(); - AddRectDragItem(static_cast(1), textRect); - StRegionHandle textRectRgn ( textRect ); - StRegionHandle inset ( textRectRgn ); // sub out all but the outline - ::InsetRgn ( inset, 1, 1 ); - ::DiffRgn ( textRectRgn, inset, textRectRgn ); - - ::UnionRgn ( inDragRegion, textRectRgn, inDragRegion ); - } - } // for each item to be dragged - -} // MakeDragRegion - - -// -// AddFlavors -// -// Overloaded to allow for multiple items being dragged and to assign them each -// a different item reference number. -// -void -CIconTextDragTask :: AddFlavors ( DragReference inDragRef ) -{ - Uint32 itemRef = 1; - CIconTextSuite* curr = NULL; - LArrayIterator it ( mDragItems ); - while ( it.Next(&curr) ) { - AddFlavorForItem ( inDragRef, itemRef, curr ); - itemRef++; - } // for each item - -} // AddFlavors - - -// -// AddFlavorForItem -// -// Register the flavors for the given item. Overload this (as opposed to AddFlavors()) to -// do something out of the ordinary for each item or do register different -// drag flavors from the standard bookmark flavors. -// -void -CIconTextDragTask :: AddFlavorForItem ( DragReference inDragRef, ItemReference inItemRef, - const CIconTextSuite* inItem ) -{ - #pragma unused (inDragRef) - - // ...register standard bookmark flavors - AddFlavorBookmarkFile(inItemRef); - AddFlavorURL(inItemRef); - AddFlavorHTNode(inItemRef, inItem->GetHTNodeData()); - - string urlAndTitle = HT_GetNodeURL(inItem->GetHTNodeData()); - if ( inItem->IconText().length() ) { - urlAndTitle += "\r"; - urlAndTitle += inItem->IconText().c_str(); - } - AddFlavorBookmark ( inItemRef, urlAndTitle.c_str() ); - -} // AddFlavorForItem - - -// -// AddFlavorHTNode -// -// This flavor contains the RDF information for a node in a hypertree. It only has -// meaning internally to Navigator. -// -void -CIconTextDragTask :: AddFlavorHTNode ( ItemReference inItemRef, const HT_Resource inNode ) -{ - OSErr theErr = ::AddDragItemFlavor( - mDragRef, - inItemRef, - emHTNodeDrag, - &inNode, - sizeof(HT_Resource), - flavorSenderOnly); - ThrowIfOSErr_(theErr); - - -} // AddFlavorHTNode - - -// -// DoDrag -// -// Register the normal url flavors then dispatch to handle either translucent or -// normal dragging -// -OSErr -CIconTextDragTask :: DoDrag ( ) -{ - MakeDragRegion(mDragRef, mDragRegion); - AddFlavors(mDragRef); - - if (UEnvironment::HasFeature(env_HasDragMgrImageSupport)) { - try { - DoTranslucentDrag(); - } - catch (...) { - DoNormalDrag(); - } - } - else - DoNormalDrag(); - - return noErr; - -} // DoDrag - - -// -// DoNormalDrag -// -// Just tracks the drag displaying the outline of the region created from MakeDragRegion() -// -void -CIconTextDragTask :: DoNormalDrag ( ) -{ - ::TrackDrag(mDragRef, &mEventRecord, mDragRegion); - -} // DoNormalDrag - - -// -// DoTranslucentDrag -// -// Tracks the drag but also draws the icon and caption translucently. -// -void -CIconTextDragTask :: DoTranslucentDrag ( ) -{ - - ::TrackDrag(mDragRef, &mEventRecord, mDragRegion); - -#if THIS_WOULD_ACTUALLY_WORK - - CIconTextSuite* mSuite; - mDragItems.FetchItemAt(1, &mSuite); - - // Normalize the color state (to make CopyBits happy) - StColorPortState theColorPortState(mSuite->Parent()->GetMacPort()); - StColorState::Normalize(); - - // Build a GWorld. The rectangle passed to CGWorld should be in local coordinates. - CGWorld theGWorld(mSuite->BoundingRect(), 0, useTempMem); - theGWorld.BeginDrawing(); - StCaptureView theCaptureView( *mSuite->Parent() ); - - try - { - theCaptureView.Capture(theGWorld); - - // draw into the GWorld - mSuite->Parent()->FocusDraw(); - mSuite->DrawText(); - mSuite->DrawIcon(); - theGWorld.EndDrawing(); - - Point theOffsetPoint = topLeft(mFrame); - mSuite->Parent()->LocalToPortPoint(theOffsetPoint); - mSuite->Parent()->PortToGlobalPoint (theOffsetPoint); - - // create the mask. - StRegionHandle theTrackMask; - MakeDragRegion(mDragRef, theTrackMask); -// ThrowIfOSErr_(::IconSuiteToRgn(theTrackMask, &mFrame, kAlignAbsoluteCenter, mIconSuite)); -// Rect textArea = mSuite.TextRectLocal(); // Use frame which bounds the actual text, not the frame bounds -// theTrackMask += textArea; - - // Set the drag image - PixMapHandle theMap = ::GetGWorldPixMap(theGWorld.GetMacGWorld()); - OSErr theErr = ::SetDragImage(mDragRef, theMap, theTrackMask, theOffsetPoint, kDragDarkerTranslucency); - ThrowIfOSErr_(theErr); - - // Track the drag - ::TrackDrag(mDragRef, &mEventRecord, mDragRegion); - } - catch (...) - { - DebugStr("\pError in Translucent Drag; g"); - } - -// mSuite.mDisplayText->Hide(); - -#endif // THIS_WOULD_ACTUALLY_WORK - -} // DoTranslucentDrag - - -#pragma mark - - -CIconTextSuite :: CIconTextSuite ( ) - : mIconID(0), mIconText(""), mDisplayText(nil), mParent(nil), mHTNodeData(nil) -{ - -} // constructor - - -// -// Constructor -// -// Creates a icon suite that is loaded in from an icon in a resource file. |inBounds| must -// be in local coordinates, and is only used as a guideline for giving a top/left to -// draw the icon and caption relative to. It is NOT used as a clipping rectangle. -// -CIconTextSuite :: CIconTextSuite ( LView* inParent, const Rect & inBounds, ResIDT inIconId, - const string & inIconText, const HT_Resource inHTNodeData ) - : mIconText(inIconText), mBounds(inBounds), mParent(inParent), mHTNodeData(inHTNodeData), - mIconID(inIconId) -{ - - // build a caption for the icon's title relative to the bounding rect we're given. - // The top and left offsets are from the LSmallIconTable's drawing routine. - SPaneInfo paneInfo; - paneInfo.width = ::TextWidth(inIconText.c_str(), 0, inIconText.length()); - paneInfo.height = 16; - paneInfo.visible = false; - paneInfo.left = inBounds.left + 22; - paneInfo.top = inBounds.top + 2; - paneInfo.superView = inParent; - mDisplayText = new LCaption ( paneInfo, LStr255(mIconText.c_str()), 130 ); - ThrowIfNil_(mDisplayText); - -} // constructor - - -// -// Copy Constructor -// -CIconTextSuite :: CIconTextSuite ( const CIconTextSuite & other ) - : mHTNodeData(other.mHTNodeData) -{ - mIconID = other.mIconID; - mBounds = other.mBounds; - mIconText = other.mIconText; - mDisplayText = other.mDisplayText; - mParent = other.mParent; - -} // copy constructor - - -// -// Destructor -// -// Clean up our mess -// -CIconTextSuite :: ~CIconTextSuite ( ) -{ - delete mDisplayText; - -} // destructor - - -// -// IconRectLocal -// -// Returns the rectangle (in local coordinates) of the icon, relative to the |mBounds| -// rectangle. The offsets are from LSmallIconTable's draw routine. -// -Rect -CIconTextSuite :: IconRectLocal ( ) const -{ - Rect iconRect; - - // Add the icon region - iconRect.left = mBounds.left + 3; - iconRect.right = iconRect.left + 16; - iconRect.bottom = mBounds.bottom - 2; - iconRect.top = iconRect.bottom - 16; - return iconRect; - -} // IconRectLocal - - -// -// IconRectGlobal -// -// Takes the local icon bounds and makes them global -// -Rect -CIconTextSuite :: IconRectGlobal ( ) const -{ - return ( PortToGlobalRect(mParent, LocalToPortRect(mParent, IconRectLocal())) ); - -} // IconRectGlobal - - -// -// TextRectLocal -// -// Returns the rectangle (in local coordinates) of the text caption, relative to the |mBounds| -// rectangle. Since we've already positioned the caption when we started up, this is -// pretty easy. -// -Rect -CIconTextSuite :: TextRectLocal ( ) const -{ - Rect theFrame; - - mDisplayText->CalcLocalFrameRect(theFrame); - return theFrame; - -} // TextRectLocal - - -// -// TextRectGlobal -// -// Takes the local text bounds and makes them global -// -Rect -CIconTextSuite :: TextRectGlobal ( ) const -{ - return ( PortToGlobalRect(mParent, LocalToPortRect(mParent, TextRectLocal())) ); - -} // TextRectGlobal - - -// -// BoundingRect -// -// Compute the rect that can contain the icon and caption entirely. This rect will have -// its top/left at (0,0) -// -Rect -CIconTextSuite :: BoundingRect ( ) const -{ - Rect bounds = mBounds; - - mParent->FocusDraw(); - Rect textRect = TextRectLocal(); - - if ( textRect.right > bounds.right ) - bounds.right = textRect.right; - - ::OffsetRect(&bounds, -bounds.left, -bounds.top); // move to (0,0) - return bounds; - -} // BoundingRect - - -void -CIconTextSuite :: DrawIcon ( ) const -{ - Rect iconRect = IconRectLocal(); - if ( ::PlotIconID(&iconRect, atNone, kTransformSelected, mIconID) != noErr ) - throw; - -} // DrawIcon - - -void -CIconTextSuite :: DrawText ( ) const -{ - ::EraseRect ( &mBounds ); -// mDisplayText->Show(); -// mDisplayText->Draw(nil); -// mDisplayText->Hide(); -} diff --git a/mozilla/cmd/macfe/gui/CIconTextDragTask.h b/mozilla/cmd/macfe/gui/CIconTextDragTask.h deleted file mode 100644 index f4fa2c6b765..00000000000 --- a/mozilla/cmd/macfe/gui/CIconTextDragTask.h +++ /dev/null @@ -1,148 +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. - */ - -// -// Interface for class that handles dragging an outline of an icon and descriptive text. -// Will do translucent dragging if available (which it almost always should be). It makes -// use of a helper class (CIconTextSuite) to handle building an icon suite and text caption. -// I broke this out to allow more flexibility in how the suite is created (from a resource -// file, from RDF backend, etc). -// -// Hopefully, this (or a derrivative) should be able to meet the needs of any drag and drop -// behavior in the toolbars or the nav center instead of having us reinvent the wheel over -// and over again. -// -// This rather poor first stab is enough functionality to get its first client (the personal -// toolbar) working. It provides a caption to the right of the icon. Translucent -// dragging is broken and commented out. Future versions will also support the ability to -// drag multiple items. -// - -#pragma once - - -#include "CBrowserDragTask.h" -#include "htrdf.h" - -#include - -class LCaption; -class LDragTask; -class LArray; - - -// -// CIconTextSuite -// -// A standalone class that is helpful in building a suite of icon and text caption. Classes -// that use this don't need to know how the suite is created (resource, RDF backend, etc), -// how the icon and the text go together (text beside icon, text below icon..), or even the -// size of the icon (16x16, 32x32...) -// - -class CIconTextSuite { - -public: - CIconTextSuite ( ) ; - CIconTextSuite ( LView* inParent, const Rect & inBounds, ResIDT inIconId, - const string & inIconText, const HT_Resource inHTNodeData = nil ) ; - CIconTextSuite ( const CIconTextSuite & other ) ; - virtual ~CIconTextSuite ( ) ; - - virtual Rect IconRectGlobal ( ) const; - virtual Rect IconRectLocal ( ) const; - virtual Rect TextRectGlobal ( ) const; - virtual Rect TextRectLocal ( ) const; - virtual Rect BoundingRect ( ) const; - - virtual void DrawIcon ( ) const; - virtual void DrawText ( ) const; - - // - // Accessors/Mutators - // - void IconText ( const string & inIconText ) { mIconText = inIconText; } ; - string & IconText ( ) { return mIconText; } ; - const string & IconText ( ) const { return mIconText; } - LView* Parent ( ) const { return mParent; } ; - - const HT_Resource GetHTNodeData ( ) const { return mHTNodeData; } - - protected: - - ResIDT mIconID; - string mIconText; - Rect mBounds; - LCaption* mDisplayText; - LView* mParent; - - const HT_Resource mHTNodeData; // pointer to HT_Resource in RDF - -}; // CIconTextSuite - - -// -// CIconTextDragTask -// -// Use this class when you need to drag a bookmark (or something url-ish) in the browser window. It -// handles building the drag region and registering the appropriate drag flavors for all drag -// items provided. -// -// The |inLocalFrame| parameter to the constructor is currently not used....soon it may just -// become a point, but we'll see how the translucent dragging stuff goes after feature complete date... -// - -class CIconTextDragTask : public CBrowserDragTask -{ -public: - typedef CBrowserDragTask super; - - CIconTextDragTask ( const EventRecord& inEventRecord, const LArray & inDragItems, - const Rect& inLocalFrame ); - CIconTextDragTask ( const EventRecord& inEventRecord, const CIconTextSuite* inItem, - const Rect& inLocalFrame ); - CIconTextDragTask ( const EventRecord& inEventRecord, const Rect& inLocalFrame ); - virtual ~CIconTextDragTask ( ) ; - - // dispatch to do either normal or translucent dragging - virtual OSErr DoDrag(); - - // for adding drag items one by one after drag task created - void AddDragItem ( const CIconTextSuite * inItem ) ; - // void AddDragItem ( const LArray & inItems ) ; maybe? probably not needed.... - -protected: - - virtual void DoNormalDrag(); - virtual void DoTranslucentDrag(); - - // coordinate with the multiple CIconTextSuites to create a drag region - virtual void MakeDragRegion ( DragReference inDragRef, RgnHandle inDragRegion ) ; - - // add drag flavor info for multiple items - virtual void AddFlavors ( DragReference inDragRef ) ; - - virtual void AddFlavorForItem ( DragReference inDragRef, ItemReference inItemRef, - const CIconTextSuite* inItem ) ; - - virtual void AddFlavorHTNode ( ItemReference inItemRef, const HT_Resource inNode ) ; - - Rect mFrame; - LArray mDragItems; - -}; // CIconTextDragTask diff --git a/mozilla/cmd/macfe/gui/CIncludeView.cp b/mozilla/cmd/macfe/gui/CIncludeView.cp deleted file mode 100644 index 89975f699bd..00000000000 --- a/mozilla/cmd/macfe/gui/CIncludeView.cp +++ /dev/null @@ -1,190 +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. - */ - - -#include "CIncludeView.h" - -//----------------------------------- -CIncludeView::CIncludeView(LStream* inStream) -//----------------------------------- -: LPane(inStream) -{ - *inStream >> mInstalledViewID; - - if ( mInstalledViewID == 0 ) { // No view to install. - //Assert_(mInstalledViewID != 0); - return; - } - - // We need to create the pane immediately so that it is added to the superview in the order - // specified in Constructor. - - // If the installed view ID is negative, we take the absolute value of it and install - // the created view directly. Otherwise, we install the first subpane of the created - // view. - - const Boolean installViewDirectly = (mInstalledViewID < 0); - - // Store default commander and view, do we need to do this? - LCommander *defaultCommander = LCommander::GetDefaultCommander(); - LView *defaultView = LPane::GetDefaultView(); - - // - // Because of the way that the new stream classes work in CWPro1 PP, we had - // to make a change to how we read in the included object. Previously, we - // could just call UReanimator::ReadObjects to do this. However, the new - // classes change the way things work to use a static counter variable to assign - // a key for each object in an internal hash table. This would normally be ok, but - // this class forces a reset of that counter (using ReadObjects() does that) and - // that messes up all the internal bookkeeping for the reanimator. - // - // To get around that, we have duplicated the code in UReanimator::ReadObjects - // with the exception of the line that resets the counter. (mcmullen & pinkerton) - // - LView *newView = nil; - { - StResource objectRes('PPob', installViewDirectly ? - -mInstalledViewID : mInstalledViewID); - HLockHi(objectRes.mResourceH); - - LDataStream objectStream(*objectRes.mResourceH, - GetHandleSize(objectRes.mResourceH)); - - // sObjectCount = 0; // THIS IS THE BAD THING WE DON'T WANT TO HAPPEN - - Int16 ppobVersion; - objectStream.ReadBlock(&ppobVersion, sizeof(Int16)); - - SignalIf_(ppobVersion != 2); - - newView = (LView *) UReanimator::ObjectsFromStream(&objectStream); - } - - // Restore default commander and view, do we need to do this? - LCommander::SetDefaultCommander(defaultCommander); - LPane::SetDefaultView(defaultView); - - Assert_(newView != nil); - if ( newView == nil ) { - mInstalledViewID = 0; // So that we don't delete ourselves in FinishCreateSelf() - return; // Get outta here! - } - - Try_ { - - if ( installViewDirectly ) { - - InstallPane(newView); - - } else { - - // The pane we want should be the lone sibling of the root of the installed view's - // hierarchy. Why? Because constructor will only allow the root of the - // hierarchy to be an LView or an LWindow, and we want to allow all types of - // panes. So here we dig out the real pane that we want to install. - - LPane *subPane = nil; - newView->GetSubPanes().FetchItemAt(1, subPane); - Assert_(subPane != nil); - - if ( subPane != nil ) { - - InstallPane(subPane); - //subPane->FinishCreate(); - // NOT! Superview will call this, because it's added to the iterator. - } - - delete newView; // old parent of the installed view. An empty shell, now. - } - - } - Catch_(inErr) { - delete newView; // Make sure we delete the view! - Throw_(inErr); - } - EndCatch_ -} - -//----------------------------------- -CIncludeView::~CIncludeView() -//----------------------------------- -{ -} - -//----------------------------------- -void CIncludeView::InstallPane(LPane* inPane) -// This matches LPane::InitPane. Unfortunately, this may go out of date -// when InitPane changes. -//----------------------------------- -{ - inPane->SetPaneID(mPaneID); - mPaneID = 0; // Set our id to 0 so that we are not confused with the installed pane - - inPane->SetUserCon(mUserCon); - - if ( mVisible == triState_Off ) { - inPane->Hide(); - } else { - inPane->Show(); - } - - if ( mEnabled == triState_Off ) { - inPane->Disable(); - } else { - inPane->Enable(); - } - - SDimension16 frameSize; - GetFrameSize(frameSize); - inPane->ResizeFrameTo(frameSize.width, frameSize.height, false); - SPoint32 location; - inPane->GetFrameLocation(location); - inPane->MoveBy(mFrameLocation.h - location.h, mFrameLocation.v - location.v, false); - - SBooleanRect frameBinding; - GetFrameBinding(frameBinding); - inPane->SetFrameBinding(frameBinding); - - // Associate Pane with its SuperView - LView *theSuperView = mSuperView; - Assert_(theSuperView); - inPane->PutInside(theSuperView, false); - - // Negative width and/or height means to expand the - // Pane to the size of the SuperView - - if (theSuperView != nil) - { - Boolean expandHoriz = (mFrameSize.width < 0); - Boolean expandVert = (mFrameSize.height < 0); - if (expandHoriz || expandVert) - theSuperView->ExpandSubPane(inPane, expandHoriz, expandVert); - } -} // CIncludeView::InstallPane - -//----------------------------------- -void CIncludeView::FinishCreateSelf() -//----------------------------------- -{ - Inherited::FinishCreateSelf(); - - if ( mInstalledViewID != 0 ) { - delete this; // removes this from superview in ~LPane - } - -} // CIncludeView::FinishCreateSelf diff --git a/mozilla/cmd/macfe/gui/CIncludeView.h b/mozilla/cmd/macfe/gui/CIncludeView.h deleted file mode 100644 index 230c812b77f..00000000000 --- a/mozilla/cmd/macfe/gui/CIncludeView.h +++ /dev/null @@ -1,46 +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. - */ - -#pragma once -#include "LPane.h" - -//====================================== -class CIncludeView : public LPane -// This pane lets its superview "include" another view, allowing several windows to -// share a subview hierarchy that is defined by single 'PPob' resource. -// When FinishCreateSelf() is called, this view creates the installed view, and -// then replaces itself by that view. All location characteristics of the original view -// are copied into the newly installed view. -//====================================== -{ - - typedef LPane Inherited; - - -public: - enum { class_ID = 'Incl' }; - CIncludeView(LStream* inStream); - virtual ~CIncludeView(); - virtual void FinishCreateSelf(); -protected: - virtual void InstallPane(LPane* inPane); - -// data -protected: - ResIDT mInstalledViewID; -}; // class LIncludeView diff --git a/mozilla/cmd/macfe/gui/CInternetKeywordTooltipPane.cp b/mozilla/cmd/macfe/gui/CInternetKeywordTooltipPane.cp deleted file mode 100644 index ddb3fbfe57b..00000000000 --- a/mozilla/cmd/macfe/gui/CInternetKeywordTooltipPane.cp +++ /dev/null @@ -1,81 +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. - */ - -// -// CInternetKeywordTooltipPane.h -// Mike Pinkerton -// Netscape Communications -// -// A new kind of tooltip pane which gets its text from the browser window. It -// displays the "internet keyword" of the current url, specified in the html. -// - -#include "CInternetKeywordTooltipPane.h" - -#include "CBrowserWindow.h" - - -CInternetKeywordTooltipPane* -CInternetKeywordTooltipPane :: CreateInternetKeywordTooltipPaneStream ( LStream* inStream ) -{ - return new CInternetKeywordTooltipPane ( inStream ); - -} - - -// -// CalcTipText -// -// The current internet keyword has nicely been stashed in the browser window for us. Go look -// it up and make it the text of the tooltip. -// -void -CInternetKeywordTooltipPane :: CalcTipText( LWindow* inOwningWindow, LPane* /*inOwningPane*/, - const EventRecord& /*inMacEvent*/, StringPtr outTipText) -{ - CBrowserWindow* browserWindow = dynamic_cast(inOwningWindow); - const LStr255 & keyword = browserWindow->GetInternetKeyword(); - LStr255::CopyPStr ( keyword, outTipText ); - -} // CInternetKeywordTooltipPane :: CalcTipText - - -// -// CalcFrameWithRespectTo -// -// Use the inherited version to size the tooltip, etc, but after all is said and done, -// move it just below the bottom left corner of the parent. -// -void -CInternetKeywordTooltipPane :: CalcFrameWithRespectTo ( LWindow* inOwningWindow, - LPane* inOwningPane, - const EventRecord& inMacEvent, - Rect& outPortFrame ) -{ - // calc pane size with it centered under the location bar - CToolTipPane::CalcFrameWithRespectTo ( inOwningWindow, inMacEvent, outPortFrame ); - - Rect theOwningPortFrame; - inOwningPane->CalcPortFrameRect(theOwningPortFrame); - - // move it to just below the bottom left corner - const short width = outPortFrame.right - outPortFrame.left; - outPortFrame.left = theOwningPortFrame.left; - outPortFrame.right = theOwningPortFrame.left + width; - -} // CalcFrameWithRespectTo diff --git a/mozilla/cmd/macfe/gui/CInternetKeywordTooltipPane.h b/mozilla/cmd/macfe/gui/CInternetKeywordTooltipPane.h deleted file mode 100644 index fa31499e60b..00000000000 --- a/mozilla/cmd/macfe/gui/CInternetKeywordTooltipPane.h +++ /dev/null @@ -1,49 +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. - */ - -// -// CInternetKeywordTooltipPane.h -// Mike Pinkerton -// Netscape Communications -// -// A new kind of tooltip pane which gets its text from the browser window. It -// displays the "internet keyword" of the current url, specified in the html. -// - -#pragma once - -#include "CTooltipAttachment.h" - - -class CInternetKeywordTooltipPane : public CToolTipPane -{ -public: - enum { class_ID = 'IKTT' } ; - - static CInternetKeywordTooltipPane* - CreateInternetKeywordTooltipPaneStream ( LStream* inStream ) ; - - CInternetKeywordTooltipPane ( LStream* inStream ) : CToolTipPane(inStream) { }; - virtual ~CInternetKeywordTooltipPane ( ) { } ; - - void CalcFrameWithRespectTo ( LWindow* inOwningWindow, LPane* inOwningPane, - const EventRecord& inMacEvent, Rect& outPortFrame ) ; - virtual void CalcTipText( LWindow* inOwningWindow, LPane* inOwningPane, - const EventRecord& inMacEvent, StringPtr outTipText) ; - -}; // CDynamicTooltipPane diff --git a/mozilla/cmd/macfe/gui/CKeyUpReceiver.h b/mozilla/cmd/macfe/gui/CKeyUpReceiver.h deleted file mode 100644 index d9ab8591335..00000000000 --- a/mozilla/cmd/macfe/gui/CKeyUpReceiver.h +++ /dev/null @@ -1,34 +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. - */ - -// =========================================================================== -// CKeyUpReceiver.h -// =========================================================================== -// -// A CKeyUpReceiver is a mixin class for views which should receive key up events. -// - -#ifndef CKeyUpReceiver_H -#define CKeyUpReceiver_H -#pragma once - -class CKeyUpReceiver -{ -}; - -#endif diff --git a/mozilla/cmd/macfe/gui/CLargeEditField.cp b/mozilla/cmd/macfe/gui/CLargeEditField.cp deleted file mode 100644 index 720cdd05269..00000000000 --- a/mozilla/cmd/macfe/gui/CLargeEditField.cp +++ /dev/null @@ -1,46 +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. - */ - -#include "CLargeEditField.h" -#include "xp_mem.h" - -// returns a c-string -char * CLargeEditField::GetLongDescriptor() -{ - CharsHandle theText = ::TEGetText(mTextEditH); - long len = ::GetHandleSize(theText); - if ( len <= 0 ) - return NULL; - - char *returnValue = (char *)XP_ALLOC( len + 1 ); - if ( returnValue ) - { - ::BlockMoveData(*theText, returnValue, len); - returnValue[ len ] = 0; - } - - return returnValue; -} - - -// takes a c-string -void CLargeEditField::SetLongDescriptor( const char* inDescriptor ) -{ - ::TESetText(inDescriptor, strlen(inDescriptor), mTextEditH); - Refresh(); -} diff --git a/mozilla/cmd/macfe/gui/CLargeEditField.h b/mozilla/cmd/macfe/gui/CLargeEditField.h deleted file mode 100644 index b5a1af468c8..00000000000 --- a/mozilla/cmd/macfe/gui/CLargeEditField.h +++ /dev/null @@ -1,48 +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. - */ - -#include "LGAEditField.h" -const MessageT msg_EditField2 = 'Ctrn'; - -/* CBigGrayEditField is the LGAEditField with additional calls to handle c-strings - (more than 255 characters). */ - -class CLargeEditField : public LGAEditField -{ - public: - enum { class_ID = 'Ledt' }; - - CLargeEditField( LStream* inStream ) : LGAEditField ( inStream ) {}; - - // c-string members - char * GetLongDescriptor(); // ALLOCATES MEMORY! - void SetLongDescriptor( const char *inDescriptor ); -}; - - -// this class is used to broadcast UserChangedText -class CLargeEditFieldBroadcast : public CLargeEditField -{ - public: - enum { class_ID = 'LedB' }; - - CLargeEditFieldBroadcast( LStream* inStream ) : CLargeEditField ( inStream ) {}; - - virtual void UserChangedText() { BroadcastMessage(msg_EditField2, this); }; -}; - diff --git a/mozilla/cmd/macfe/gui/CMiniSecurityButton.cp b/mozilla/cmd/macfe/gui/CMiniSecurityButton.cp deleted file mode 100644 index aef55cb55d7..00000000000 --- a/mozilla/cmd/macfe/gui/CMiniSecurityButton.cp +++ /dev/null @@ -1,59 +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. - */ - -#include "CMiniSecurityButton.h" -#include "CSharedPatternWorld.h" - -CMiniSecurityButton::CMiniSecurityButton(LStream* inStream) -: CBrowserSecurityButton(inStream) -{ -} - -ResIDT CMiniSecurityButton::GetIconID(ESecurityState inSecurityState) -{ - ResIDT result = ResID_UnsecureIcon; - if (inSecurityState == eSecureState) - result = ResID_SecureIcon; - return result; -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawButtonContent -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CMiniSecurityButton::DrawButtonContent(void) -{ - CGrafPtr thePort; - ::GetPort(&(GrafPtr)thePort); - - Rect theFrame = mCachedButtonFrame; - Point theAlignment; - - CalcOrientationPoint(theAlignment); - mPatternWorld->Fill(thePort, theFrame, theAlignment); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawButtonGraphic -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CMiniSecurityButton::DrawButtonGraphic(void) -{ - CToolbarButton::DrawButtonGraphic(); -} diff --git a/mozilla/cmd/macfe/gui/CMiniSecurityButton.h b/mozilla/cmd/macfe/gui/CMiniSecurityButton.h deleted file mode 100644 index dc5957b88ab..00000000000 --- a/mozilla/cmd/macfe/gui/CMiniSecurityButton.h +++ /dev/null @@ -1,41 +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. - */ - -#pragma once - -#include "CBrowserSecurityButton.h" - -class CMiniSecurityButton : public CBrowserSecurityButton -{ - public: - enum { class_ID = 'MiSB' }; - - enum { - ResID_SecureIcon = 15336, - ResID_UnsecureIcon = 15335 - }; - - CMiniSecurityButton(LStream* inStream); - - virtual ResIDT GetIconID(ESecurityState inSecurityState); - - protected: - - virtual void DrawButtonContent(void); - virtual void DrawButtonGraphic(void); -}; diff --git a/mozilla/cmd/macfe/gui/CMouseDragger.cp b/mozilla/cmd/macfe/gui/CMouseDragger.cp deleted file mode 100644 index b372261fa5d..00000000000 --- a/mozilla/cmd/macfe/gui/CMouseDragger.cp +++ /dev/null @@ -1,768 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CMouseDragger.h" - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Track the mouse within the view specified by inView. The beginning mouse tracking - point is given by inStartMouseImagePt, which is in the image coordinate system - of inView. The mouse movements are pinned to the rect specified by inMouseImagePinRect, - which again is in the image coordinate system of inView. If inMouseImagePinRect is - nil, the mouse is pinned to the current image size of the view. This method handles - all interaction with the user until the mouse button is let up. If inStartMouseImagePt - is not within inMouseImagePinRect, it is forced to be within the rect by this method. - The inMinHMoveStart and inMinVMoveStart values specify the minimum amount of movement - required in either the horizontal or vertical directions to begin mouse tracking. - - If the mouse moved from the original point specified by inStartMouseImagePt (as adjusted - to be within inMouseImagePinRect, if necessary), the method returns true; otherwise, - no mouse movement occurred and the method returns false. - - The methods BeginTracking(), KeepTracking(), and EndTracking() are meant to be - overriden by subclasses to implement the behavior of the mouse movements. See these - method for descriptions. -======================================================================================*/ - -Boolean CMouseDragger::DoTrackMouse(LView *inView, const SPoint32 *inStartMouseImagePt, - const LImageRect *inMouseImagePinRect, - const Int16 inMinHMoveStart, const Int16 inMinVMoveStart) { - - mView = inView; - - // Setup tracking variables. In addtion to pinning the current mouse point to the specified - // image rect, we also pin it to the frame of the view. - - LImageRect imagePinRect; - LImageRect viewImageBounds; - LImageRect viewFrameImageBounds; - - { - SDimension32 imageSize; - inView->GetImageSize(imageSize); - viewImageBounds.Set(0, 0, imageSize.width, imageSize.height); // Add one since pin-rect subtracts 1 - } - - if ( inMouseImagePinRect ) { - imagePinRect.Set(inMouseImagePinRect); - if ( imagePinRect.Left() < viewImageBounds.Left() ) imagePinRect.Left(viewImageBounds.Left()); - if ( imagePinRect.Top() < viewImageBounds.Top() ) imagePinRect.Top(viewImageBounds.Top()); - if ( imagePinRect.Right() > viewImageBounds.Right() ) imagePinRect.Right(viewImageBounds.Right()); - if ( imagePinRect.Bottom() > viewImageBounds.Bottom() ) imagePinRect.Bottom(viewImageBounds.Bottom()); - } else { - imagePinRect.Set(&viewImageBounds); - } - - Rect viewGlobalFrame, viewPortFrame; - mView->CalcPortFrameRect(viewPortFrame); - viewGlobalFrame = viewPortFrame; - mView->PortToGlobalPoint(topLeft(viewGlobalFrame)); - mView->PortToGlobalPoint(botRight(viewGlobalFrame)); - - // Pin start point - - mStartImagePt = *inStartMouseImagePt; - imagePinRect.PinPoint(&mStartImagePt.h, &mStartImagePt.v); - PortToImageRect(mView, &viewPortFrame, &viewFrameImageBounds); - viewFrameImageBounds.PinPoint(&mStartImagePt.h, &mStartImagePt.v); - - mEndImagePt = mStartImagePt; - SPoint32 lastPoint = mStartImagePt; - - // Let subclasses do something when we start - - BeginTracking(&mStartImagePt); - - // Do the tracking - - Boolean trackingStarted = false, keepTracking = true; - EventRecord macEvent; - - Int32 nextScrollTime = 0; - - Try_ { - while ( keepTracking && ::WaitMouseUp() ) { - - // Give background processing time - ::WaitNextEvent(0, &macEvent, 0, nil); - - SPoint32 newImagePoint; - GlobalToImagePt(mView, macEvent.where, &newImagePoint); - - Boolean didntScrollView = true; - - // Determine if we need to scroll the image, if so handle - // user tracking here - - if ( CanScrollView(mView, macEvent.where, &viewGlobalFrame) ) { - - // Make sure that we don't scroll too quickly - - if ( nextScrollTime <= LMGetTicks() ) { - - // Need to scroll the view - Point localPt = macEvent.where; - mView->GlobalToPortPoint(localPt); - mView->PortToLocalPoint(localPt); - AboutToScrollView(&mStartImagePt, &mEndImagePt); - - mView->AutoScrollImage(localPt); // Auto scroll the image - didntScrollView = false; - nextScrollTime = LMGetTicks() + 2; - - // Pin point - - GlobalToImagePt(mView, macEvent.where, &newImagePoint); - imagePinRect.PinPoint(&newImagePoint.h, &newImagePoint.v); - PortToImageRect(mView, &viewPortFrame, &viewFrameImageBounds); - viewFrameImageBounds.PinPoint(&newImagePoint.h, &newImagePoint.v); - - if ( !LImageRect::EqualPoints32(&newImagePoint, &mEndImagePt) ) { - lastPoint = mEndImagePt; - mEndImagePt = newImagePoint; - } - DoneScrollingView(&mStartImagePt, &mEndImagePt); - } - } - - // If we didn't scroll the image, handle user tracking here - - if ( didntScrollView ) { - imagePinRect.PinPoint(&newImagePoint.h, &newImagePoint.v); - viewFrameImageBounds.PinPoint(&newImagePoint.h, &newImagePoint.v); - if ( !LImageRect::EqualPoints32(&newImagePoint, &mEndImagePt) ) { - if ( !trackingStarted ) { - Int32 deltaH = newImagePoint.h - mStartImagePt.h; - Int32 deltaV = newImagePoint.v - mStartImagePt.v; - if ( deltaH < 0 ) deltaH = -deltaH; - if ( deltaV < 0 ) deltaV = -deltaV; - trackingStarted = ((deltaH >= inMinHMoveStart) || (deltaV >= inMinVMoveStart)); - } - if ( trackingStarted ) { - lastPoint = mEndImagePt; - mEndImagePt = newImagePoint; - - keepTracking = KeepTracking(&mStartImagePt, &lastPoint, &mEndImagePt); - } - } - } - } - - EndTracking(&mStartImagePt, &mEndImagePt); - } - Catch_(inErr) { - // Always call EndTracking() - EndTracking(&mStartImagePt, &mEndImagePt); - - Throw_(inErr); - } - EndCatch_ - - return !LImageRect::EqualPoints32(&mStartImagePt, &mEndImagePt); -} - - -/*====================================================================================== - Return true if the global point inGlobalMousePt will cause a scroll of the view - inView. inGlobalViewFrame is the frame of the view in global coordinates or nil - if it has not been calculated yet. -======================================================================================*/ - -Boolean CMouseDragger::CanScrollView(LView *inView, Point inGlobalMousePt, const Rect *inGlobalViewFrame) { - - Rect viewGlobalFrame; - - if ( inGlobalViewFrame == nil ) { - // We calculate it here for caller! - inView->CalcPortFrameRect(viewGlobalFrame); - inView->PortToGlobalPoint(topLeft(viewGlobalFrame)); - inView->PortToGlobalPoint(botRight(viewGlobalFrame)); - inGlobalViewFrame = &viewGlobalFrame; - } - - Boolean canScroll = false; - - SPoint32 scrollUnits; - inView->GetScrollUnit(scrollUnits); - - Int32 horizScroll = 0; - if ( inGlobalMousePt.h < inGlobalViewFrame->left ) { - horizScroll = -scrollUnits.h; - } else if ( inGlobalMousePt.h > inGlobalViewFrame->right ) { - horizScroll = scrollUnits.h; - } - - Int32 vertScroll = 0; - if ( inGlobalMousePt.v < inGlobalViewFrame->top ) { - vertScroll = -scrollUnits.v; - } else if (inGlobalMousePt.v > inGlobalViewFrame->bottom) { - vertScroll = scrollUnits.v; - } - - if ( (horizScroll != 0) || (vertScroll != 0) ) { - - SPoint32 imageLocation; - inView->GetImageLocation(imageLocation); - SPoint32 frameLocation; - inView->GetFrameLocation(frameLocation); - SDimension32 imageSize; - inView->GetImageSize(imageSize); - SDimension16 frameSize; - inView->GetFrameSize(frameSize); - - if ( vertScroll != 0 ) { - Int32 tryDown = imageLocation.v - vertScroll; - if ( tryDown > frameLocation.v ) { - if ( imageLocation.v <= frameLocation.v ) { - vertScroll = imageLocation.v - frameLocation.v; - } else if ( vertScroll < 0 ) { - vertScroll = 0; - } - } else if ( (tryDown + imageSize.height) < (frameLocation.v + frameSize.height)) { - if ( (imageLocation.v + imageSize.height) >= (frameLocation.v + frameSize.height) ) { - vertScroll = imageLocation.v - frameLocation.v + imageSize.height - frameSize.height; - } else if ( vertScroll > 0 ) { - vertScroll = 0; - } - } - } - - if ( horizScroll != 0 ) { - Int32 tryLeft = imageLocation.h - horizScroll; - if ( tryLeft > frameLocation.h ) { - if ( imageLocation.h <= frameLocation.h ) { - horizScroll = imageLocation.h - frameLocation.h; - } else if ( horizScroll < 0 ) { - horizScroll = 0; - } - } else if ( (tryLeft + imageSize.width) < (frameLocation.h + frameSize.width) ) { - if ( (imageLocation.h + imageSize.width) >= (frameLocation.h + frameSize.width) ) { - horizScroll = imageLocation.h - frameLocation.h + imageSize.width - frameSize.width; - } else if (horizScroll > 0) { - horizScroll = 0; - } - } - } - - canScroll = (horizScroll != 0) || (vertScroll != 0); - } - - return canScroll; -} - - -/*====================================================================================== - Convert the specified global point to the image coordinate system of inView. -======================================================================================*/ - -void CMouseDragger::GlobalToImagePt(LView *inView, Point inGlobalPt, SPoint32 *outImagePt) { - - inView->GlobalToPortPoint(inGlobalPt); - inView->PortToLocalPoint(inGlobalPt); - inView->LocalToImagePoint(inGlobalPt, *outImagePt); -} - - -/*====================================================================================== - Convert the specified image point to the port coordinate system of inView. -======================================================================================*/ - -void CMouseDragger::ImageToPortPt(LView *inView, const SPoint32 *inImagePt, Point *outPortPt) { - - inView->ImageToLocalPoint(*inImagePt, *outPortPt); - inView->LocalToPortPoint(*outPortPt); -} - - -/*====================================================================================== - Convert the specified port point to the image coordinate system of inView. -======================================================================================*/ - -void CMouseDragger::PortToImagePt(LView *inView, Point inPortPoint, SPoint32 *outImagePt) { - - inView->PortToLocalPoint(inPortPoint); - inView->LocalToImagePoint(inPortPoint, *outImagePt); -} - - -/*====================================================================================== - Convert the specified port rect to the image coordinate system of inView. -======================================================================================*/ - -void CMouseDragger::PortToImageRect(LView *inView, const Rect *inPortRect, LImageRect *outImageRect) { - - PortToImagePt(inView, topLeft(*inPortRect), outImageRect->TopLeft()); - PortToImagePt(inView, botRight(*inPortRect), outImageRect->BotRight()); -} - - -/*====================================================================================== - Convert the specified port rect to the image coordinate system of inView. -======================================================================================*/ - -void CMouseDragger::ImageToLocalRect(LView *inView, LImageRect *inImageRect, - Rect *outLocalRect) { - - inView->ImageToLocalPoint(*inImageRect->TopLeft(), topLeft(*outLocalRect)); - inView->ImageToLocalPoint(*inImageRect->BotRight(), botRight(*outLocalRect)); -} - - -/*====================================================================================== - This method is ALWAYS called from within the DoTrackMouse() method just before - the mouse tracking loop begins. If you want to setup instance varibles before - tracking begins, or draw an initial outline of a tracking image, this is the - place to do it. - - The inStartMouseImagePt parameter has been pinned to the bounds passed to - DoTrackMouse() in the inMouseImagePinRect parameter and is also pinned to the - frame of the view. -======================================================================================*/ - -void CMouseDragger::BeginTracking(const SPoint32 *inStartMouseImagePt) { - - // Draw - DrawDragRegion(inStartMouseImagePt, inStartMouseImagePt, eDoDraw); -} - - -/*====================================================================================== - This method is called anytime the mouse moves to a new location within the - bounds passed to DoTrackMouse() in the inMouseImagePinRect parameter. The points - inPrevMouseImagePt and inCurrMouseImagePt will always be different. Note that - this method may NEVER be called if the user never moves the mouse from its - initial position. This method should perform visual dragging of a region or - other user tracking interaction. - - If the method returns false, mouse tracking is stopped. - - All input points have been pinned to the bounds passed to DoTrackMouse() in the - inMouseImagePinRect parameter and are also pinned to the frame of the view. -======================================================================================*/ - -Boolean CMouseDragger::KeepTracking(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inPrevMouseImagePt, - const SPoint32 *inCurrMouseImagePt) { - - // Erase - DrawDragRegion(inStartMouseImagePt, inPrevMouseImagePt, eDoErase); - - // Draw - DrawDragRegion(inStartMouseImagePt, inCurrMouseImagePt, eDoDraw); - - return true; // Continue tracking -} - - -/*====================================================================================== - This method is ALWAYS called at the end of user mouse tracking. If the points - inStartMouseImagePt and inEndMouseImagePt not are equal, the user actually move - the mouse somewhere different from where it started. This method should normally - erase any visual representation of a dragging region. - - All input points have been pinned to the bounds passed to DoTrackMouse() in the - inMouseImagePinRect parameter and are also pinned to the frame of the view. -======================================================================================*/ - -void CMouseDragger::EndTracking(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inEndMouseImagePt) { - - // Erase - DrawDragRegion(inStartMouseImagePt, inEndMouseImagePt, eDoErase); -} - - -/*====================================================================================== - The mouse has reached a point that will cause the view to be scrolled. This method is - called just BEFORE the view is scolled to allow any dragging region to be erased - from the view before scrolling it. After the view is scrolled, the - DoneScrollingView() method will be called. The input points represent the - last points passed to KeepTracking() if it has been called. - - All input points have been pinned to the bounds passed to DoTrackMouse() in the - inMouseImagePinRect parameter and are also pinned to the frame of the view. -======================================================================================*/ - -void CMouseDragger::AboutToScrollView(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt) { - - // Erase - DrawDragRegion(inStartMouseImagePt, inCurrMouseImagePt, eDoEraseScroll); -} - - -/*====================================================================================== - The AboutToScrollView() was called and the view was just scolled. This method should - redraw any dragging region to the screen. The input points represent the NEW images - points of the mouse after scrolling. - - All input points have been pinned to the bounds passed to DoTrackMouse() in the - inMouseImagePinRect parameter and are also pinned to the frame of the view. -======================================================================================*/ - -void CMouseDragger::DoneScrollingView(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt) { - - // Draw - DrawDragRegion(inStartMouseImagePt, inCurrMouseImagePt, eDoDraw); -} - - -/*====================================================================================== - Draw the draw region taking into the difference in mouse positions specified by - inStartMouseImagePt and inCurrMouseImagePt. inDrawState specifies whether to draw - the drag region or erase it. -======================================================================================*/ - -void CMouseDragger::DrawDragRegion(const SPoint32 * /* inStartMouseImagePt */, - const SPoint32 * /* inCurrMouseImagePt */, - EDrawRegionState /* inDrawState */) { - -} - - -#pragma mark - - -/*====================================================================================== - This method is ALWAYS called from within the DoTrackMouse() method just before - the mouse tracking loop begins. If you want to setup instance varibles before - tracking begins, or draw an initial outline of a tracking image, this is the - place to do it. - - The inStartMouseImagePt parameter has been pinned to the bounds passed to - DoTrackMouse() in the inMouseImagePinRect parameter. -======================================================================================*/ - -void CTableRowDragger::BeginTracking(const SPoint32 * /* inStartMouseImagePt */) -{ - - mDidDraw = false; - Rect frame; - mView->CalcPortFrameRect(frame); - - mPortInsertionLineV = min_Int16; - mPortInsertionLineLeft = frame.left; - mPortInsertionLineRight = frame.right - 1; - mPortFrameMinV = frame.top; - mPortFrameMaxV = frame.bottom - 1; - - // Calculate rects for the arrows - mView->GetSuperView()->CalcPortFrameRect(frame); - - mPortLeftArrowBox.top = mPortRightArrowBox.top = -cArrowVCenterTopOffset; - mPortLeftArrowBox.right = frame.left - cArrowHMargin; - mPortLeftArrowBox.bottom = mPortRightArrowBox.bottom = mPortLeftArrowBox.top + cSmallIconHeight; - mPortLeftArrowBox.left = mPortLeftArrowBox.right - cSmallIconWidth; - mPortRightArrowBox.left = frame.right + cArrowHMargin; - mPortRightArrowBox.right = mPortRightArrowBox.left + cSmallIconWidth; - - LTableView *theTable = dynamic_cast(mView); - Assert_(theTable != nil); - TableIndexT rows; - theTable->GetTableSize(rows, mNumCols); -} - - -/*====================================================================================== - This method is ALWAYS called at the end of user mouse tracking. If the points - inStartMouseImagePt and inEndMouseImagePt not are equal, the user actually move - the mouse somewhere different from where it started. This method should normally - erase any visual representation of a dragging region. - - All input points have been pinned to the bounds passed to DoTrackMouse() in the - inMouseImagePinRect parameter. -======================================================================================*/ - -void CTableRowDragger::EndTracking(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inEndMouseImagePt) { - - DrawDragRegion(inStartMouseImagePt, inEndMouseImagePt, eDoEraseScroll); -} - - -/*====================================================================================== - Draw the local row rectangle taking into account the current and starting mouse - positions. -======================================================================================*/ - -void CTableRowDragger::DrawDragRegion(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt, - EDrawRegionState inDrawState) { - - if ( !mDidDraw && (inDrawState != eDoDraw) ) return; // Nothing to erase - - LTableView *theTable = dynamic_cast(mView); - mDidDraw = true; - - // Calculate image rectangle to draw - - LImageRect drawImageRect; - { - SPoint32 topLeftPt, botRightPt; - - theTable->GetImageCellBounds(STableCell(mClickedRow, 1), topLeftPt.h, topLeftPt.v, - botRightPt.h, botRightPt.v); - if ( mNumCols > 1 ) { - SPoint32 tempPt; - theTable->GetImageCellBounds(STableCell(mClickedRow, mNumCols), tempPt.h, tempPt.v, - botRightPt.h, botRightPt.v); - } - Assert_((topLeftPt.v != 0) || (botRightPt.v != 0)); - --botRightPt.v; - - drawImageRect.Set(topLeftPt.h, topLeftPt.v, botRightPt.h, botRightPt.v); - drawImageRect.Offset(inCurrMouseImagePt->h - inStartMouseImagePt->h, - inCurrMouseImagePt->v - inStartMouseImagePt->v); - } - - // Setup the port - - if ( inDrawState == eDoDraw ) { - UpdateInsertionPoint(&drawImageRect, theTable, inDrawState); - } - - theTable->FocusDraw(); - - StColorPenState::Normalize(); - - ::PenMode(patXor); - ::PenPat(&UQDGlobals::GetQDGlobals()->gray); - - Rect rowRect; - CMouseDragger::ImageToLocalRect(theTable, &drawImageRect, &rowRect); - - ::FrameRect(&rowRect); - - ::PenNormal(); - - if ( inDrawState != eDoDraw ) { - UpdateInsertionPoint(&drawImageRect, theTable, inDrawState); - } -} - - -/*====================================================================================== - Update display of the insertion line. -======================================================================================*/ - -void CTableRowDragger::UpdateInsertionPoint(const LImageRect *inImageCellDrawRect, - LTableView *inTableView, - EDrawRegionState inDrawState) { - - // Calculate the current row we're over - - - STableCell hitCell; - SPoint32 curCenterPt; - - curCenterPt.h = inImageCellDrawRect->Left() + - ((inImageCellDrawRect->Right() - inImageCellDrawRect->Left()) / 2); - curCenterPt.v = inImageCellDrawRect->Top() + - ((inImageCellDrawRect->Bottom() - inImageCellDrawRect->Top()) / 2); - - inTableView->GetCellHitBy(curCenterPt, hitCell); - Assert_(inTableView->IsValidRow(hitCell.row)); - - Int16 newPortInsertionLineV = min_Int16; - - if ( inDrawState == eDoDraw ) { - - if ( hitCell.row != mClickedRow ) { - - TableIndexT rows, cols; - inTableView->GetTableSize(rows, cols); - - // Adjust the cell so that mouse drawing occurs over the insertion line - SPoint32 topLeftPt, botRightPt; - - inTableView->GetImageCellBounds(hitCell, topLeftPt.h, topLeftPt.v, - botRightPt.h, botRightPt.v); - - Assert_((topLeftPt.v != 0) || (botRightPt.v != 0)); - Int32 cellMidV = topLeftPt.v + ((botRightPt.v - topLeftPt.v)>>1); - Boolean ignoreChanges = true; - - if ( curCenterPt.v >= cellMidV ) { - if ( hitCell.row < mClickedRow ) { - if ( hitCell.row < rows ) { - ++hitCell.row; - ignoreChanges = false; - } - } - } else { - if ( hitCell.row > mClickedRow ) { - if ( (hitCell.row > 1) && ((hitCell.row != rows) || (curCenterPt.v < cellMidV)) ) { - --hitCell.row; - ignoreChanges = false; - } - } - } - if ( !ignoreChanges ) { - ignoreChanges = (hitCell.row != mClickedRow); - if ( ignoreChanges ) { - inTableView->GetImageCellBounds(hitCell, topLeftPt.h, topLeftPt.v, - botRightPt.h, botRightPt.v); - Assert_((topLeftPt.v != 0) || (botRightPt.v != 0)); - } - } - if ( ignoreChanges ) { - Point portPoint; - if ( hitCell.row > mClickedRow ) { - CMouseDragger::ImageToPortPt(inTableView, &botRightPt, &portPoint); - newPortInsertionLineV = portPoint.v; - } else { - CMouseDragger::ImageToPortPt(inTableView, &topLeftPt, &portPoint); - newPortInsertionLineV = portPoint.v - 1; - } -#ifdef Debug_Signal - { - Rect portRect; - LImageRect imageRect; - inTableView->CalcPortFrameRect(portRect); - CMouseDragger::PortToImageRect(inTableView, &portRect, &imageRect); - Assert_(portRect.bottom >= newPortInsertionLineV); - Assert_(portRect.top - 2 <= newPortInsertionLineV); - } -#endif // Debug_Signal - } - } - - mOverRow = hitCell.row; - } - - if ( (mPortInsertionLineV != newPortInsertionLineV) && (inDrawState != eDoErase) ) { - - LWindow *viewWindow = LWindow::FetchWindowObject(inTableView->GetMacPort()); - - viewWindow->FocusDraw(); - StColorPenState::Normalize(); - - Int16 vPos; - Rect arrowLeft, arrowRight; - - // Erase old insertion line - - if ( mPortInsertionLineV != min_Int16 ) { - CalcArrowRects(mPortInsertionLineV, &arrowLeft, &arrowRight, true); - if ( mPortInsertionLineV < mPortFrameMinV ) { - vPos = mPortFrameMinV; - } else if ( mPortInsertionLineV >= mPortFrameMaxV ) { - vPos = mPortFrameMaxV; - } else { - vPos = mPortInsertionLineV; - ::PenSize(1, 2); - } - ::ForeColor(whiteColor); - ::MoveTo(mPortInsertionLineLeft, vPos); - ::LineTo(mPortInsertionLineRight, vPos); - - // Update insertion arrows - - viewWindow->InvalPortRect(&arrowLeft); - viewWindow->InvalPortRect(&arrowRight); - viewWindow->UpdatePort(); - viewWindow->FocusDraw(); - -/* Old code that relies on ApplyForeAndBackColors() - - // Update insertion arrows - - inTableView->ApplyForeAndBackColors(); - ::EraseRect(&arrowLeft); - ::EraseRect(&arrowRight); - ::ForeColor(blackColor); - ::PenSize(1, 1); -*/ - } - - mPortInsertionLineV = newPortInsertionLineV; - - // Draw new insertion line - - if ( mPortInsertionLineV != min_Int16 ) { - CalcArrowRects(mPortInsertionLineV, &arrowLeft, &arrowRight, false); - if ( mPortInsertionLineV < mPortFrameMinV ) { - vPos = mPortFrameMinV; - } else if ( mPortInsertionLineV >= mPortFrameMaxV ) { - vPos = mPortFrameMaxV; - } else { - vPos = mPortInsertionLineV; - ::PenSize(1, 2); - } - ::MoveTo(mPortInsertionLineLeft, vPos); - ::LineTo(mPortInsertionLineRight, vPos); - ::PlotIconID(&arrowLeft, atNone, ttNone, icm8_LeftInsertArrow); - ::PlotIconID(&arrowRight, atNone, ttNone, icm8_RightInsertArrow); - } - - ::PenSize(1, 1); - } -} - - -/*====================================================================================== - Update display of the insertion arrows. -======================================================================================*/ - -void CTableRowDragger::CalcArrowRects(Int16 inPortLineV, Rect *outLeftRect, Rect *outRightRect, - Boolean inErase) { - - // Calculate rects for the arrows - - *outLeftRect = mPortLeftArrowBox; - *outRightRect = mPortRightArrowBox; - ::OffsetRect(outLeftRect, 0, inPortLineV); - ::OffsetRect(outRightRect, 0, inPortLineV); - if ( inErase ) { - outLeftRect->left = outLeftRect->right - cArrowPolyWidth; - outRightRect->right = outRightRect->left + cArrowPolyWidth; - } -} - - diff --git a/mozilla/cmd/macfe/gui/CMouseDragger.h b/mozilla/cmd/macfe/gui/CMouseDragger.h deleted file mode 100644 index 4f94eb12756..00000000000 --- a/mozilla/cmd/macfe/gui/CMouseDragger.h +++ /dev/null @@ -1,340 +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 __H_CMouseDragger -#define __H_CMouseDragger -#pragma once - -/*====================================================================================== - AUTHOR: Ted Morris - 25 SEPT 96 - ©1996 Netscape Communications Corp. All rights reserved worldwide. - - DESCRIPTION: Implements a class used for tracking a mouse action within an LView - class and making it undoable. - - To use this class, do the following: - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class LImageRect { - -public: - - LImageRect(void) { - Set(0, 0, 0, 0); - } - LImageRect(Int32 inLeft, Int32 inTop, Int32 inRight, Int32 inBottom) { - Set(inLeft, inTop, inRight, inBottom); - } - LImageRect(const LImageRect *inImageRect) { - Set(inImageRect->Left(), inImageRect->Top(), - inImageRect->Right(), inImageRect->Bottom()); - } - - Int32 Left(void) const { - return mTopLeft.h; - } - Int32 Top(void) const { - return mTopLeft.v; - } - Int32 Right(void) const { - return mBotRight.h; - } - Int32 Bottom(void) const { - return mBotRight.v; - } - void Left(Int32 inValue) { - mTopLeft.h = inValue; - } - void Top(Int32 inValue) { - mTopLeft.v = inValue; - } - void Right(Int32 inValue) { - mBotRight.h = inValue; - } - void Bottom(Int32 inValue) { - mBotRight.v = inValue; - } - void Set(const LImageRect *inImageRect) { - mTopLeft.h = inImageRect->Left(); - mTopLeft.v = inImageRect->Top(); - mBotRight.h = inImageRect->Right(); - mBotRight.v = inImageRect->Bottom(); - } - void Set(Int32 inLeft, Int32 inTop, Int32 inRight, Int32 inBottom) { - mTopLeft.h = inLeft; - mTopLeft.v = inTop; - mBotRight.h = inRight; - mBotRight.v = inBottom; - } - void Offset(Int32 inDeltaH, Int32 inDeltaV) { - mTopLeft.h += inDeltaH; - mTopLeft.v += inDeltaV; - mBotRight.h += inDeltaH; - mBotRight.v += inDeltaV; - } - SPoint32 *TopLeft(void) { - return &mTopLeft; - } - SPoint32 *BotRight(void) { - return &mBotRight; - } - Boolean IsEmpty(void) const { - return ((mTopLeft.h >= mBotRight.h) || (mTopLeft.v >= mBotRight.v)); - } - Boolean PointIn(Int32 inHorz, Int32 inVert) const { - return (((inHorz >= mTopLeft.h) && (inHorz < mBotRight.h)) && - ((inVert >= mTopLeft.v) && (inVert < mBotRight.v))); - } - Boolean PinPoint(Int32 *ioHorz, Int32 *ioVert) const { - Boolean rtnVal = false; - if ( *ioHorz < mTopLeft.h ) { - *ioHorz = mTopLeft.h; rtnVal = true; - } else if ( *ioHorz >= mBotRight.h ) { - *ioHorz = mBotRight.h; rtnVal = true; - } - if ( *ioVert < mTopLeft.v ) { - *ioVert = mTopLeft.v; rtnVal = true; - } else if ( *ioVert >= mBotRight.v ) { - *ioVert = mBotRight.v; rtnVal = true; - } - return rtnVal; - } - - static Boolean EqualPoints32(const SPoint32 *inPointA, const SPoint32 *inPointB) { - return ((inPointA->h == inPointB->h) && (inPointA->v == inPointB->v)); - } - -protected: - - // Instance variables ========================================================== - - SPoint32 mTopLeft; - SPoint32 mBotRight; -}; - -#pragma mark - - -class CMouseDragger { - -public: - - CMouseDragger(void) { - } - virtual ~CMouseDragger(void) { - } - - // Start public interface ---------------------------------------------------------- - - Boolean DoTrackMouse(LView *inView, const SPoint32 *inStartMouseImagePt, - const LImageRect *inMouseImagePinRect = nil, - const Int16 inMinHMoveStart = 1, const Int16 inMinVMoveStart = 1); - - // End public interface ------------------------------------------------------------ - - static Boolean CanScrollView(LView *inView, Point inGlobalMousePt, - const Rect *inGlobalViewFrame = nil); - - static void GlobalToImagePt(LView *inView, Point inGlobalPt, - SPoint32 *outImagePt); - static void ImageToPortPt(LView *inView, const SPoint32 *inImagePt, - Point *outPortPt); - static void PortToImagePt(LView *inView, Point inPortPoint, - SPoint32 *outImagePt); - static void PortToImageRect(LView *inView, const Rect *inPortRect, - LImageRect *outImageRect); - static void ImageToLocalRect(LView *inView, LImageRect *inImageRect, - Rect *outLocalRect); - -protected: - - // Override methods - - virtual void BeginTracking(const SPoint32 *inStartMouseImagePt); - - virtual Boolean KeepTracking(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inPrevMouseImagePt, - const SPoint32 *inCurrMouseImagePt); - - virtual void EndTracking(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inEndMouseImagePt); - - virtual void AboutToScrollView(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt); - virtual void DoneScrollingView(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt); - - enum EDrawRegionState { - eDoErase = 0 // Normal erase - , eDoEraseScroll = 1 // Erase just before a scoll - , eDoDraw = 2 // Draw - }; - - virtual void DrawDragRegion(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt, - EDrawRegionState inDrawState); - - // Instance variables ========================================================== - - LView *mView; - SPoint32 mStartImagePt; - SPoint32 mEndImagePt; -}; - - -// Class specific for dragging rows in an LTableView. Be careful, it hasn't been -// tested on a wide range of LTableView descendents! Also, assumes that the -// table only has a single column! Note: This class also assumes the presence -// of icm8 resources for the arrow icons. - -/*====================================================================================== - The ClickCell() method for your table will look something like this: - - void CMyTableView::ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown) { - - if ( LPane::GetClickCount() == 2 ) { - - // Do double click stuff - - } else if ( mRows > 1 ) { - - CTableRowDragger dragger(inCell.row); - - SPoint32 startMouseImagePt; - LocalToImagePoint(inMouseDown.whereLocal, startMouseImagePt); - - // Restrict dragging to a thin vertical column the height of the image - - LImageRect dragPinRect; - { - Int32 left, top, right, bottom; - GetImageCellBounds(inCell, left, top, right, bottom); - dragPinRect.Set(startMouseImagePt.h, startMouseImagePt.v - top, startMouseImagePt.h, - mImageSize.height - (bottom - startMouseImagePt.v) + 1); - } - - TrySetCursor(cHandClosedCursorID); - dragger.DoTrackMouse(this, &startMouseImagePt, &dragPinRect, 2, 2); - - TableIndexT newRow = dragger.GetDraggedRow(); - - if ( newRow ) { - CMyMoveRowAction *action = new CMyMoveRowAction(this, inCell.row, newRow); - FailNIL_(action); - PostAction(action); - } - } - } -======================================================================================*/ - -// CTableRowDragger - -class CTableRowDragger : public CMouseDragger { - -public: - - CTableRowDragger(TableIndexT inClickedRow) : - CMouseDragger(), - mClickedRow(inClickedRow), - mOverRow(inClickedRow), - mNumCols(1) { - - } - - TableIndexT GetDraggedRow(void) { - return ((mClickedRow == mOverRow) ? 0 : mOverRow); - } - -protected: - - enum { // Constants - icm8_LeftInsertArrow = 29203 - , icm8_RightInsertArrow = 29204 - , cArrowVCenterTopOffset = 3 - , cArrowPolyWidth = 4 - , cArrowHMargin = 1 - , cSmallIconWidth = 16 - , cSmallIconHeight = 12 - - }; - - virtual void BeginTracking(const SPoint32 *inStartMouseImagePt); - virtual void EndTracking(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inEndMouseImagePt); - - virtual void DrawDragRegion(const SPoint32 *inStartMouseImagePt, - const SPoint32 *inCurrMouseImagePt, - EDrawRegionState inDrawState); - void UpdateInsertionPoint(const LImageRect *inImageCellDrawRect, - LTableView *inTableView, - EDrawRegionState inDrawState); - void CalcArrowRects(Int16 inPortLineV, Rect *outLeftRect, Rect *outRightRect, - Boolean inErase); - - // Instance variables ========================================================== - - TableIndexT mClickedRow; // The row that was clicked - TableIndexT mOverRow; // The current row that the mouse is over - TableIndexT mNumCols; // The current row that the mouse is over - - Boolean mDidDraw; - - Int16 mPortInsertionLineV; // Port vertical coordinate that the last - // insertion line and arrows was draw at, - // min_Int16 if no line was last drawn - Int16 mPortInsertionLineLeft; // Port left coordinate for drawing the insertion line - Int16 mPortInsertionLineRight;// Port right coordinate for drawing the insertion line - - Rect mPortLeftArrowBox; - Rect mPortRightArrowBox; - - Int16 mPortFrameMinV; - Int16 mPortFrameMaxV; -}; - - -#endif // __H_CMouseDragger diff --git a/mozilla/cmd/macfe/gui/CMozillaToolbarPrefsProxy.cp b/mozilla/cmd/macfe/gui/CMozillaToolbarPrefsProxy.cp deleted file mode 100644 index db5f380c314..00000000000 --- a/mozilla/cmd/macfe/gui/CMozillaToolbarPrefsProxy.cp +++ /dev/null @@ -1,36 +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. - */ - -// CMozillaToolbarPrefsProxy.cp - -#include "CMozillaToolbarPrefsProxy.h" - -#include "prefapi.h" - -CMozillaToolbarPrefsProxy::CMozillaToolbarPrefsProxy() -{ -} - -CMozillaToolbarPrefsProxy::~CMozillaToolbarPrefsProxy() -{ -} - -int CMozillaToolbarPrefsProxy::GetToolbarPref(Int32& ioPref) -{ - return PREF_GetIntPref("browser.chrome.toolbar_style", &ioPref); -} diff --git a/mozilla/cmd/macfe/gui/CMozillaToolbarPrefsProxy.h b/mozilla/cmd/macfe/gui/CMozillaToolbarPrefsProxy.h deleted file mode 100644 index d0d5b4ff0e2..00000000000 --- a/mozilla/cmd/macfe/gui/CMozillaToolbarPrefsProxy.h +++ /dev/null @@ -1,32 +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. - */ - -// CMozillaToolbarPrefsProxy.h - -#pragma once - -#include "CToolbarPrefsProxy.h" - -class CMozillaToolbarPrefsProxy : public CToolbarPrefsProxy -{ -public: - CMozillaToolbarPrefsProxy(); - virtual ~CMozillaToolbarPrefsProxy(); - - virtual int GetToolbarPref(Int32& ioPref); -}; diff --git a/mozilla/cmd/macfe/gui/CNSMenuBarManager.cp b/mozilla/cmd/macfe/gui/CNSMenuBarManager.cp deleted file mode 100644 index df8d8d1e6ad..00000000000 --- a/mozilla/cmd/macfe/gui/CNSMenuBarManager.cp +++ /dev/null @@ -1,194 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CNSMenuBarManager.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CNSMenuBarManager.h" -#include "CWindowMediator.h" -#include "CWindowMenu.h" -#include "CHistoryMenu.h" -#include "CBookmarksAttachment.h" -#include "CToolsAttachment.h" -#include "CFontMenuAttachment.h" -#include "CRecentEditMenuAttachment.h" -#include "Netscape_Constants.h" -#ifdef MOZ_MAIL_NEWS -#include "CMailFolderButtonPopup.h" -#endif -#include "CBrowserWindow.h" // need for MapWindowTypeToMBARResID - mjc -#include "menusharing.h" -#include - -CNSMenuBarManager* CNSMenuBarManager::sManager = NULL; - -CNSMenuBarManager::CNSMenuBarManager( - CWindowMediator* inWindowMediator) : -mCurrentMenuBarID(MBAR_Initial) -{ - inWindowMediator->AddListener(this); - sManager = this; -} - -CNSMenuBarManager::~CNSMenuBarManager() -{ - sManager = NULL; -} - -void CNSMenuBarManager::ListenToMessage(MessageT inMessage, void* ioParam) -{ - switch (inMessage) - { - case msg_WindowActivated: - case msg_WindowMenuBarModeChanged: - { - CMediatedWindow* inWindow = (CMediatedWindow*)ioParam; - if (inWindow->HasAttribute(windAttr_Floating)) return; - ResIDT newMenuBarID = MapWindowTypeToMBARResID(inWindow->GetWindowType(), inWindow); - if (newMenuBarID > 0 && newMenuBarID != mCurrentMenuBarID) - SwitchMenuBar(newMenuBarID); - } - break; - - case msg_WindowDisposed: - { - // Switch to initial menubar under these conditions - if (mCurrentMenuBarID != MBAR_Initial) - { - CWindowMediator* windowMediator = CWindowMediator::GetWindowMediator(); - CMediatedWindow* inWindow = (CMediatedWindow*)ioParam; - // count the regular, visible, mediated windows of any type - int count = windowMediator->CountOpenWindows(WindowType_Any, regularLayerType, false); - // two cases to switch: - // 1. there are no regular mediated windows (so we must be closing a mediated floater or modal) - // 2. we're closing the last regular mediated window - if (count == 0 || (count == 1 && inWindow->IsVisible() && inWindow->HasAttribute(windAttr_Regular))) - SwitchMenuBar(MBAR_Initial); - } - } - break; - } -} - -ResIDT CNSMenuBarManager::MapWindowTypeToMBARResID(Uint32 inWindowType, CMediatedWindow* inWindow) -{ - ResIDT result = -1; - - switch(inWindowType) - { - case WindowType_Browser: - if (inWindow != nil) - { // ask the browser window what kind of menubar it wants - mjc - CBrowserWindow* theBrWn = dynamic_cast(inWindow); - switch(theBrWn->GetMenubarMode()) - { - case BrWn_Menubar_None: - // ¥ FIXME return a value which tells the manager to hide the menubar. - // fall through for now - case BrWn_Menubar_Minimal: - result = cMinimalMenubar; - break; - case BrWn_Menubar_Default: - result = cBrowserMenubar; - break; - } - } - else result = cBrowserMenubar; - break; - case WindowType_Editor: - result = cEditorMenubar; - break; -#ifdef MOZ_MAIL_NEWS - case WindowType_SearchMailNews: - case WindowType_MailNews: - case WindowType_MailThread: - case WindowType_Message: - result = cMailNewsMenubar; - break; - case WindowType_Address: - result = cAddressBookMenubar; - break; -#endif - case WindowType_NavCenter: - result = cBookmarksMenubar; - break; - case WindowType_Compose: - result = cComposeMenubar; - break; - } - return result; -} - -void CNSMenuBarManager::SwitchMenuBar(ResIDT inMenuBarID) -{ - // remove go (history) and window menus from menubar so that it doesn't get deleted - CHistoryMenu* historyMenu = CHistoryMenu::sHistoryMenu; - CWindowMenu* windowMenu = CWindowMenu::sWindowMenu; - LMenuBar* currentMenuBar = LMenuBar::GetCurrentMenuBar(); - currentMenuBar->RemoveMenu(windowMenu); - -#ifdef EDITOR - LMenu *fontMenu = CFontMenuAttachment::GetMenu(); - currentMenuBar->RemoveMenu(fontMenu); -#endif // EDITOR - - CBookmarksAttachment::RemoveMenus(); -#ifdef EDITOR - CToolsAttachment::RemoveMenus(); - CRecentEditMenuAttachment::RemoveMenus(); -#endif // EDITOR -#ifdef MOZ_MAIL_NEWS - CMailFolderSubmenu::RemoveMailFolderSubmenus(); -#endif // MOZ_MAIL_NEWS - if (mCurrentMenuBarID == MBAR_Initial) - currentMenuBar->RemoveMenu(historyMenu); - delete (currentMenuBar); - DisposeSharedMenus(); - - // create new menubar (use appearance if present) - if ( UEnvironment::HasFeature( env_HasAppearance ) ) - new LAppearanceMBAR(inMenuBarID); - else - new LMenuBar(inMenuBarID); - - // now put go and window menus into new menubar - currentMenuBar = LMenuBar::GetCurrentMenuBar(); - if (inMenuBarID == MBAR_Initial) - currentMenuBar->InstallMenu(historyMenu, InstallMenu_AtEnd); -#ifdef EDITOR - // put the tools menu in the editor menubar only - if ((inMenuBarID == cEditorMenubar) || (inMenuBarID == cComposeMenubar)) - { - CFontMenuAttachment::InstallMenus(); - CToolsAttachment::InstallMenus(); - CRecentEditMenuAttachment::InstallMenus(); - } -#endif // EDITOR - if ((inMenuBarID != cBookmarksMenubar) && (inMenuBarID != cMinimalMenubar)) // don't put bookmarks menu in minimal menubar - mjc - CBookmarksAttachment::InstallMenus(); -#ifdef MOZ_MAIL_NEWS - if ( inMenuBarID == cMailNewsMenubar ) { - CMailFolderSubmenu::InstallMailFolderSubmenus(); - } -#endif // MOZ_MAIL_NEWS - if (inMenuBarID != cMinimalMenubar) // don't put window menu in minimal menubar - mjc - currentMenuBar->InstallMenu(windowMenu, InstallMenu_AtEnd); - // cache current menubar MBAR ID - mCurrentMenuBarID = inMenuBarID; -} diff --git a/mozilla/cmd/macfe/gui/CNSMenuBarManager.h b/mozilla/cmd/macfe/gui/CNSMenuBarManager.h deleted file mode 100644 index 35a1eed30d7..00000000000 --- a/mozilla/cmd/macfe/gui/CNSMenuBarManager.h +++ /dev/null @@ -1,48 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CNSMenuBarManager.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include - -class CWindowMediator; -class CWindowMenu; -class CMediatedWindow; - -class CNSMenuBarManager : public LListener -{ -public: - CNSMenuBarManager( - CWindowMediator* inWindowMediator - ); - virtual ~CNSMenuBarManager(); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - -protected: - ResIDT MapWindowTypeToMBARResID(Uint32 inWindowType, CMediatedWindow* inWindow = nil); - - void SwitchMenuBar(ResIDT inMenuBarID); - - ResIDT mCurrentMenuBarID; - static CNSMenuBarManager* sManager; -}; diff --git a/mozilla/cmd/macfe/gui/CNavCenterSelectorPane.cp b/mozilla/cmd/macfe/gui/CNavCenterSelectorPane.cp deleted file mode 100644 index beb900cbceb..00000000000 --- a/mozilla/cmd/macfe/gui/CNavCenterSelectorPane.cp +++ /dev/null @@ -1,1088 +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. - */ - -#include "CNavCenterSelectorPane.h" - -#include -#include - -#include "CRDFCoordinator.h" -#include "CContextMenuAttachment.h" -#include "Netscape_constants.h" -#include "CIconContext.h" -#include "CIconCache.h" - -#include "UGAColorRamp.h" - -#include "net.h" -#include "mimages.h" - - -#pragma mark -- CNavCenterSelectorPane methods -- - - - -CNavCenterSelectorPane::CNavCenterSelectorPane( LStream* inStream ) - : LView(inStream), LDragAndDrop ( GetMacPort(), this ), - mIsEmbedded(false), mHTPane(nil), mTooltipIndex(-1), mMouseIsInsidePane(false), - mImageMode(0L), mCellHeight(25), mCachedWorkspace(NULL), mDropRow(LArray::index_Last), - mDropPreposition(kDropOn) -{ - // nothing else to do here. -} - - -CNavCenterSelectorPane::~CNavCenterSelectorPane() -{ - // nothing else to do here since all FE data is cleaned up by workspace remove events -} - - -// -// SetActiveWorkspace -// -// Call this to change the current workspace. Passing in NULL will clear the selection. Most -// of the work is done in NoticeActiveWorkspaceChanged() where the view is redrawn and the -// view change is broadcast to the RDFCoordinator. This doesn't actually change HT's -// currently selected view, as it is done by the coordinator. -// -void -CNavCenterSelectorPane :: SetActiveWorkspace ( HT_View inNewWorkspace ) -{ - HT_View oldWorkspace = mCachedWorkspace; - mCachedWorkspace = inNewWorkspace; - NoticeActiveWorkspaceChanged(oldWorkspace); - -} // SetActiveWorkspace - - -// -// DrawSelf -// -// Iterate over each view and draw it. We store the class that is responsible for drawing a -// workspace in the FE data in HT. -// -void -CNavCenterSelectorPane::DrawSelf() -{ - Rect cellBounds; - CalcLocalFrameRect(cellBounds); - - // erase the background - StColorState saved; - ::RGBBackColor(&UGAColorRamp::GetColor(colorRamp_Gray2)); - ::EraseRect(&cellBounds); - - // find the bounds of the first cell - cellBounds.top = 0; - cellBounds.bottom = mCellHeight; - -#if DRAW_WITH_TITLE - StTextState savedState; - UTextTraits::SetPortTextTraits(130); -#endif - - // iterate over workspaces, drawing each in turn. - const listCount = HT_GetViewListCount(GetHTPane()); - const HT_View selectedView = HT_GetSelectedView(GetHTPane()); - for ( int i = 0; i < listCount; i++ ) { - unsigned long drawMode = mImageMode; - - HT_View currView = HT_GetNthView(GetHTPane(), i); - ViewFEData* viewData = static_cast(HT_GetViewFEData(currView)); - if ( viewData ) { - if ( currView == selectedView ) - drawMode |= kSelected; - if ( viewData->mSelector ) - viewData->mSelector->workspaceImage->DrawInCurrentView(cellBounds, drawMode); - } - - // prepare to draw next selector - cellBounds.top += mCellHeight; - cellBounds.bottom += mCellHeight; - - } // for each selector - - ResizeImageTo ( mFrameSize.width, cellBounds.top, true ); - -} // DrawSelf - - -// -// ClickSelf -// -// Handle when the user clicks in this pane. A click on a workspace icon will switch to that -// view. Also handle opening and closing the shelf (if we're embedded) and context clicking. -// -void -CNavCenterSelectorPane::ClickSelf( const SMouseDownEvent& inMouseDown ) -{ - FocusDraw(); // to make the context menu stuff works - - CContextMenuAttachment::SExecuteParams params; - params.inMouseDown = &inMouseDown; - - // do nothing if click not in any workspace except show context menu. - HT_View clickedView = FindSelectorForPoint(inMouseDown.whereLocal); - if ( !clickedView ) { - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenu, (void*)¶ms); - return; - } - - // if the user clicks on a workspace icon, open the shelf to display the workspace. If - // they click on the same workspace icon as is already displayed, close the shelf. Don't - // change the shelf state on a context click. - if ( clickedView != GetActiveWorkspace() ) { - HT_View oldSelection = GetActiveWorkspace(); - SetActiveWorkspace(clickedView); - - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenu, (void*)¶ms); - if ( params.outResult != CContextMenuAttachment::eHandledByAttachment && mIsEmbedded ) { - bool value = true; - BroadcastMessage ( msg_ShelfStateShouldChange, &value ); // force open - } - else { - // this combats the problem when there is no workspace and the user context clicks. We - // select the one they clicked on, but don't open the shelf. We can't just leave the - // item selected and the shelf closed, so we just reset the active workspace to none. - // Icky code but it doesn't freak out the user. - if ( !oldSelection ) - SetActiveWorkspace(NULL); - } - } - else { - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenu, (void*)¶ms); - if ( params.outResult != CContextMenuAttachment::eHandledByAttachment && mIsEmbedded ) { - bool value = false; - BroadcastMessage ( msg_ShelfStateShouldChange, &value ); // force closed - SetActiveWorkspace( NULL ); - } - } - -} // ClickSelf - - -// -// AdjustCursorSelf -// -// Use the context menu attachment to handle showing context menu cursor when cmd key is -// down and mouse is over this view. -// -void -CNavCenterSelectorPane::AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) -{ - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenuCursor, - static_cast(const_cast(&inEvent))); - -} // AdjustCursorSelf - - -// -// FindTooltipForMouseLocation -// -// Provide the tooltip for the workspace that the mouse is hovering over -// -void -CNavCenterSelectorPane :: FindTooltipForMouseLocation ( const EventRecord& inMacEvent, - StringPtr outTip ) -{ - Point temp = inMacEvent.where; - GlobalToPortPoint(temp); - PortToLocalPoint(temp); - - HT_View selector = FindSelectorForPoint ( temp ); - if ( selector ) { - // pull the name out of HT and stuff it into the Pascal string...DO NOT DELETE |buffer|. - const char* buffer = HT_GetViewName ( selector ); - outTip[0] = strlen(buffer); - strcpy ( (char*) &outTip[1], buffer ); - } - else - ::GetIndString ( outTip, 10506, 15); // supply a helpful message... - -} // FindTooltipForMouseLocation - - -// -// MouseLeave -// -// Called when the mouse leaves the view. Just update our "hot" cell to an invalid cell. -// -void -CNavCenterSelectorPane :: MouseLeave ( ) -{ - mTooltipIndex = -1; - mMouseIsInsidePane = false; - -} // MouseLeave - - -// -// MouseWithin -// -// Called while the mouse moves w/in the pane. Find which workspace the mouse is -// currently over and if it differs from the last workspace it was in, hide the -// tooltip and remember the new cell. -// -void -CNavCenterSelectorPane :: MouseWithin ( Point inPortPt, const EventRecord& /*inEvent*/ ) -{ - mMouseIsInsidePane = true; - - size_t index = FindIndexForPoint ( inPortPt ); - if ( mTooltipIndex != index ) { - mTooltipIndex = index; - ExecuteAttachments(msg_HideTooltip, this); // hide tooltip - } - -} // MouseWithin - - -// -// NoticeActiveWorkspaceChanged -// -// Redraw the old and new workspace icons only when there is a change. Also tell the RDFCoordinator -// to update HT's active workspace. -// -void -CNavCenterSelectorPane :: NoticeActiveWorkspaceChanged ( HT_View inOldSel ) -{ - BroadcastMessage(msg_ActiveSelectorChanged, GetActiveWorkspace()); - - FocusDraw(); - -#if DRAW_WITH_TITLE - StTextState savedState; - ::TextFont(kFontIDGeneva); - ::TextSize(9); - ::TextFace(0); -#endif - - // redraw old - Rect previous = { 0, 0, 0, 0 }; - if ( inOldSel ) { - CalcLocalFrameRect(previous); - previous.top = HT_GetViewIndex(inOldSel) * mCellHeight; - previous.bottom = previous.top + mCellHeight; - ViewFEData* data = static_cast(HT_GetViewFEData(inOldSel)); - if ( data && data->mSelector ) - data->mSelector->workspaceImage->DrawInCurrentView ( previous, mImageMode ); - } - - // redraw new - Rect current = { 0, 0, 0, 0 }; - if ( GetActiveWorkspace() ) { - CalcLocalFrameRect(current); - current.top = HT_GetViewIndex(GetActiveWorkspace()) * mCellHeight; - current.bottom = current.top + mCellHeight; - ViewFEData* data = static_cast(HT_GetViewFEData(GetActiveWorkspace())); - if ( data && data->mSelector ) - data->mSelector->workspaceImage->DrawInCurrentView ( current, mImageMode | kSelected ); - } - - -} // NoticeActiveWorkspaceChanged - - -// -// ItemIsAcceptable -// -// Just about anything should be acceptable because we just want to make sure -// that the appropriate nav center view is open for the user to then drag into. Drops -// can occur here, so I guess we have to make sure that it is something that we -// recognize. -// -// If FindBestFlavor() finds an acceptable flavor, then this item can be accepted. If not, it -// can't. We don't really care at this point what that flavor is. -// -Boolean -CNavCenterSelectorPane :: ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) -{ - FlavorType ignored; - return FindBestFlavor ( inDragRef, inItemRef, ignored ); - -} // ItemIsAcceptable - - -// -// EnterDropArea -// -// If the drag comes from an outside source, record when the mouse entered this pane -// -void -CNavCenterSelectorPane :: EnterDropArea ( DragReference /* inDragRef */, Boolean inDragHasLeftSender ) -{ - // if the drag did not originate here, go into "timed switching" mode - if ( inDragHasLeftSender ) - mDragAndDropTickCount = ::TickCount(); - -} // EnterDropArea - - -// -// LeaveDropArea -// -// Reset our counter -// -void -CNavCenterSelectorPane :: LeaveDropArea ( DragReference inDragRef ) -{ - if ( mDropRow != LArray::index_Last ) - DrawDividingLine ( mDropRow, mDropPreposition ); - - mDragAndDropTickCount = 0L; - mDropRow = LArray::index_Last; - mDropPreposition = kDropOn; - - LDragAndDrop::LeaveDropArea ( inDragRef ); - -} // LeaveDropArea - - -// -// InsideDropArea -// -// Called when the mouse moves inside this pane on a drag and drop. -// -// There are two cases here: the drag originated here or it didn't. When it did, the user -// is trying to rearrange the order of the views. When the drag comes from outside, we need -// to do our fancy timed switching behavior. We can tell the difference between these two -// modes by checking the value of |mDragAndDropTickCount| which will be non-zero if the -// drag originated outside. -// -void -CNavCenterSelectorPane :: InsideDropArea ( DragReference inDragRef ) -{ - const Uint32 kPaneSwitchDelay = 60; // 1 second delay - - if ( mDragAndDropTickCount ) { - - FocusDraw(); - Point mouseLoc; - ::GetDragMouse(inDragRef, &mouseLoc, NULL); - ::GlobalToLocal(&mouseLoc); - - // find which view the user is hovering over and what part of the cell the mouse is in. - // If it is in the top or bottom regions, they want to do a drop to create a new workspace, - // so do the drop feedback. If they are hovering over the middle, then proceed with - // the pane switching behavior. - EDropLocation newDropPrep; - TableIndexT newDropRow; - HT_View newSelection = FindSelectorForPoint(mouseLoc, newDropPrep, newDropRow); - if ( newDropPrep != kDropOn ) { // do drag feedback - - if ( newDropRow != mDropRow || newDropPrep != mDropPreposition ) { - - // erase old line - DrawDividingLine ( mDropRow, mDropPreposition ); - - mDropRow = newDropRow; - mDropPreposition = newDropPrep; - - // draw new line - DrawDividingLine ( newDropRow, newDropPrep ); - - } // if something has changed - - mDragAndDropTickCount = ::TickCount(); // see comment below - - // we don't want to continue through the rest of the routine because it is for - // switching views on the fly.... - return; - - } // if mouse not over middle of cell - - // clear out any old divider lines now that we're dropping on and set d&d members - // for any drop on this workspace. - DrawDividingLine ( mDropRow, mDropPreposition ); - mDropRow = newDropRow; - mDropPreposition = kDropOn; - - // if the user hasn't sat here long enough, don't do anything... - if ( ::TickCount() - mDragAndDropTickCount < kPaneSwitchDelay ) - return; - - // ...ok, they really want to switch panes... - - // make sure the shelf is visible (only necessary if in chrome). This - // shouldn't be necessary, but things won't redraw correctly unless we do this. - if ( mIsEmbedded ) { - bool value = true; - BroadcastMessage ( msg_ShelfStateShouldChange, &value ); // force open - } - - // switch to the workspace the user is now hovering over - if ( newSelection != GetActiveWorkspace() ) - SetActiveWorkspace ( newSelection ); - - // we need to reset the timer so we don't get into the situation where the user - // hovers over the selected item for a long time and then when they move to the next - // selector, the time will be > |kPaneSwitchDelay| and it will instantly switch. - // Keeping our timer up to date should avoid this and force the user to always - // wait the delay. NOTE: we don't get here if they have yet to reach the delay amount - // so we're not actually reseting the timer every time this is called. - mDragAndDropTickCount = ::TickCount(); - - } // if we are tracking an outside drag. - else { - // do nothing as of yet... - } - -} // InsideDropArea - - -// -// CycleCurrentWorkspace -// -// If the shelf is open, advance the current workspace, wrapping around if we get to the end -// -void -CNavCenterSelectorPane :: CycleCurrentWorkspace ( ) -{ - if ( GetActiveWorkspace() ) { - HT_View newSelector = HT_GetNthView ( GetHTPane(), - HT_GetViewIndex(GetActiveWorkspace()) + 1 ); - if ( !newSelector ) - newSelector = HT_GetNthView ( GetHTPane(), 0 ); - - SetActiveWorkspace(newSelector); - } // if there is a selection - -} // CycleCurrentWorkspace - - -// -// FindIndexForPoint -// -// Given a point in image coordinates, find the index of the selector the mouse was over. Right -// now, this is just an easy division because the selector regions all butt up against each -// other. If there were ever any space between them, this would need to be more complicated. -// -// This index is 0-based, not 1-based like most other things in Powerplant. This is ok because -// HT is also 0-based and we only use this index when talking to HT. -// -size_t -CNavCenterSelectorPane :: FindIndexForPoint ( const Point & inMouseLoc ) const -{ - return inMouseLoc.v / mCellHeight; - -} // FindIndexForPoint - - -// -// FindIndexForPoint -// -// Used to tell not only which cell the user is hovering over, but also what part of that cell. -// This info can be combined with drag feedback to allow for inserting before/after the cell the -// mouse is over. The cell is divided horizontally into 3 parts, with the middle being the largest -// area. -// -size_t -CNavCenterSelectorPane :: FindIndexForPoint ( const Point & inMouseLoc, EDropLocation & outWhere ) const -{ - TableIndexT cell = inMouseLoc.v / mCellHeight; // remember: 0-based - Uint32 distFromMouseToPrevCell = inMouseLoc.v % mCellHeight; - - // the cell is divided into 3 parts: 7 pixels at top & bottom, remaining space in the middle - const Uint8 kCellDividerSize = 7; - if ( distFromMouseToPrevCell <= kCellDividerSize ) - outWhere = kDropBefore; - else if ( distFromMouseToPrevCell >= mCellHeight - kCellDividerSize ) - outWhere = kDropAfter; - else - outWhere = kDropOn; - - return cell; - -} // FindIndexForPoint - - -// -// FindSelectorForPoint -// -// Grabs the view where the user clicked from HT and returns it. -// -HT_View -CNavCenterSelectorPane :: FindSelectorForPoint ( const Point & inMouseLoc ) const -{ - return HT_GetNthView ( GetHTPane(), FindIndexForPoint(inMouseLoc) ); - -} // FindSelectorForPoint - - -// -// FindSelectorForPoint -// -// Returns the view, row#, and a relative indicator (before, after, middle) for where the -// new workspace will be created if the drop is at the current mouse location. -// -HT_View -CNavCenterSelectorPane :: FindSelectorForPoint ( const Point & inMouseLoc, - EDropLocation & outWhere, - TableIndexT & outRow ) const -{ - outRow = FindIndexForPoint ( inMouseLoc, outWhere ); - - // If the row we've calculated is > then number of rows, the user has dragged below all the - // existing workspaces, so translate this to a drop after the last row. - Uint32 numViews = HT_GetViewListCount(GetHTPane()); - if ( outRow > numViews - 1 ) { - outRow = numViews - 1; - outWhere = kDropAfter; - } - return HT_GetNthView ( GetHTPane(), outRow ); - -} // FindSelectorForPoint - - -// -// FindCommandStatus -// -void -CNavCenterSelectorPane :: FindCommandStatus ( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) -{ - if ( inCommand >= cmd_NavCenterBase && inCommand <= cmd_NavCenterCap ) - outEnabled = HT_IsMenuCmdEnabled(GetHTPane(), (HT_MenuCmd)(inCommand - cmd_NavCenterBase)); - else - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - -} // FindCommandStatus - - -// -// DrawDividingLine -// -// Draws a horizontal black line before or after the given row in the bar (or undraws if one -// is already there) depending on the value of |inPrep|. Used during drag and drop for drop -// feedback. -// -void -CNavCenterSelectorPane :: DrawDividingLine( TableIndexT inRow, EDropLocation inPrep ) -{ - if ( inRow == LArray::index_Last || inPrep == kDropOn ) - return; - - Uint32 numItems = HT_GetViewListCount(GetHTPane()); - if ( !numItems ) // don't draw anything if toolbar empty - return; - - // find the boundary of the line we are going to draw. This will be relative to - // the given row as specified (before or after) by inPrep. - Uint32 frameTop; - frameTop = inRow * mCellHeight; - if ( inPrep == kDropAfter ) - frameTop += mCellHeight; - - // Focus the pane and get the table and cell frames. - if ( FocusDraw() ) { - StColorPenState theDrawState; - - // Setup the color and pen state then draw the line - ::ForeColor( blackColor ); - ::PenMode( patXor ); - ::PenSize ( 2, 2 ); - ::MoveTo( 0, frameTop ); - ::LineTo( mFrameSize.width, frameTop ); - } - -} // DrawDividingLine - - -// -// ReceiveDragItem -// -// Pass this along to the implementation in CURLDragMixin. -// -void -CNavCenterSelectorPane :: ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) -{ - CHTAwareURLDragMixin::ReceiveDragItem(inDragRef, inDragAttrs, inItemRef, inItemBounds ); - -} // ReceiveDragItem - - -// -// HandleDropOfHTResource -// -// The user dropped something from HT onto the selector bar. If they dropped _on_ the -// selector icon, drop it into that workspace. If they dropped it _between_ two workspaces, -// get HT to create a new workspace for us with that data in it. If there are no -// workspaces, we have to create our own and put the data in it. -// -void -CNavCenterSelectorPane :: HandleDropOfHTResource ( HT_Resource inDropNode ) -{ - if ( HT_GetViewListCount(GetHTPane()) ) { - HT_View view = HT_GetNthView ( GetHTPane(), mDropRow ); - HT_Resource viewTopNode = HT_TopNode(view); - - if ( mDropPreposition == kDropOn ) - HT_DropHTROn ( viewTopNode, inDropNode ); - else - HT_DropHTRAtPos ( viewTopNode, inDropNode, mDropPreposition == kDropBefore ? PR_TRUE : PR_FALSE ); - } - else { - // there are no existing workspaces to drop before/after, so we must create our own - DebugStr("\pDrop when no workspaces present not implemented"); - } - -} // HandleDropOfHTResource - - -// -// HandleDropOfPageProxy -// -// The user dropped something from navigator onto the selector bar. If they dropped _on_ the -// selector icon, drop it into that workspace. If they dropped it _between_ two workspaces, -// get HT to create a new workspace for us with that data in it. If there are no -// workspaces, we have to create our own and put the data in it. -// -void -CNavCenterSelectorPane :: HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) -{ - // cast away constness for HT - char* url = const_cast(inURL); - char* title = const_cast(inTitle); - - if ( HT_GetViewListCount(GetHTPane()) ) { - HT_View view = HT_GetNthView ( GetHTPane(), mDropRow ); - HT_Resource viewTopNode = HT_TopNode(view); - - if ( mDropPreposition == kDropOn ) - HT_DropURLAndTitleOn ( viewTopNode, url, title ); - else - HT_DropURLAndTitleAtPos ( viewTopNode, url, title, mDropPreposition == kDropBefore ? PR_TRUE : PR_FALSE ); - } - else { - // there are no existing workspaces to drop before/after, so we must create our own - DebugStr("\pDrop when no workspaces present not implemented"); - } - -} // HandleDropOfPageProxy - - -// -// HandleDropOfLocalFile -// -// The user dropped something from the Finder onto the selector bar. Since a file url is -// just a url, cheat and use the same code as the page proxy. -// -void -CNavCenterSelectorPane :: HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & /*inFileData*/ ) -{ - HandleDropOfPageProxy ( inFileURL, fileName ); - -} // HandleDropOfLocalFile - - -// -// HandleDropOfText -// -// Called when user drops a text clipping onto the navCenter. Do nothing for now. -// -void -CNavCenterSelectorPane :: HandleDropOfText ( const char* /*inTextData*/ ) -{ - DebugStr("\pDropping TEXT here not implemented"); - -} // HandleDropOfText - - -#pragma mark --- struct SelectorData --- - - -SelectorData :: SelectorData ( HT_View inView, CNavCenterSelectorPane* inSelectorBar ) -{ - const ResIDT cFolderIconID = -3999; // use the OS Finder folder icon - - char viewName[64]; -#if DRAW_WITH_TITLE - HT_ViewDisplayString ( inView, viewName, 8 ); - viewName[8] = NULL; -#else - viewName[0] = NULL; -#endif - - // Because of the way we get GIF images into the app (loading them into a 'Tang' resource), - // we look for certain url's that we know are internal to the product and use the about:XXX.gif - // hack on them. FE_AboutData() knows how to decode these images so we're set. If things aren't - // of a form we recognize, they are probably a real url to a real icon somewhere on the net. - - char* iconURL = HT_GetWorkspaceSmallIconURL(inView); - - string aboutURL = "about:"; - char workspace[500]; - workspace[0] = '\0'; - sscanf ( iconURL, "icon/small:workspace,%s", workspace ); - if ( *workspace ) { - aboutURL += workspace; // make into form: about:XXX.gif - aboutURL += ".gif"; - } - else - aboutURL = iconURL; // probably a url to something on the net, leave it alone - - workspaceImage = new TitleImage(viewName, cFolderIconID, aboutURL, inSelectorBar); - -} // constructor - -SelectorData :: ~SelectorData ( ) -{ - delete workspaceImage; -} - - -#pragma mark -- class TitleImage -- - -#include "UGraphicGizmos.h" - -TitleImage :: TitleImage ( const LStr255 & inTitle, ResIDT inIconID, const string & inIconURL, CNavCenterSelectorPane* inSelectorBar ) - : mTitle(inTitle), mIconID(inIconID), mSelector(inSelectorBar), SelectorImage(inIconURL) -{ - Assert_(mSelector != NULL); - -#if DRAW_WITH_TITLE - ::TextFont(kFontIDGeneva); - ::TextSize(9); - ::TextFace(0); - mTextWidth = ::TextWidth( inTitle, 0, inTitle.Length() ) + 6; -#endif - -} - - -TitleImage :: ~TitleImage ( ) -{ - -} - - -// -// ListenToMessage -// -// Listen to messages from the icon cache so we can display the image when imageLib gives us -// something to display. -// -void -TitleImage :: ListenToMessage ( MessageT inMessage, void* inData ) -{ - switch ( inMessage ) { - case CIconContext::msg_ImageReadyToDraw: - mSelector->Refresh(); //¥¥ do this better after it all works - break; - } - -} // ListenToMessage - - -// -// DrawInCurrentView -// -// Draw a selector. The code for drawing the title has been commented out for now because -// it has not been hooked up to the text/graphics prefs. -// -void -TitleImage :: DrawInCurrentView( const Rect& inBounds, unsigned long inMode ) const -{ - StColorState saved; - - ::RGBBackColor(&UGAColorRamp::GetColor(colorRamp_Gray2)); - ::EraseRect(&inBounds); - - Rect iconRect = inBounds; - Rect textbg = { 0, 0, 0, 0 }; - -#if DRAW_WITH_TITLE - if ( TextWidth() > inBounds.right - inBounds.left ) - textbg.right = inBounds.right - inBounds.left; - else - textbg.right = TextWidth(); - UGraphicGizmos::CenterRectOnRect(textbg, inBounds); - textbg.bottom = inBounds.bottom; - textbg.top = inBounds.bottom - 12; -#endif - - iconRect.right = iconRect.left + 16; - iconRect.bottom = iconRect.top + 16; - UGraphicGizmos::CenterRectOnRect ( iconRect, inBounds ); - - SInt16 iconTransform = kTransformNone; - if ( inMode & CNavCenterSelectorPane::kSelected ) { - iconTransform = kTransformSelected; -#if DRAW_WITH_TITLE - ::BackColor(blackColor); - ::EraseRect(&textbg); - ::TextMode(srcXor); -#endif -#if DRAW_SELECTED_AS_TAB - Rect temp = inBounds; - temp.left += 2; - StRegion boundsRgn(temp); - DrawOneTab(boundsRgn); -#endif - } - - DrawImage ( *(Point*)&inBounds, iconTransform, 0, 0 ) ; - -#if DRAW_WITH_TITLE - ::MoveTo( textbg.left + 2, inBounds.bottom - 2 ); - ::DrawString ( Title() ); -#endif - -} // DrawInCurrentView - - -// -// DrawStandby -// -// Override to just draw a folder icon when the appropriate image has not yet been loaded -// -void -TitleImage :: DrawStandby ( const Point & inTopLeft, const IconTransformType inTransform ) const -{ - Rect bounds = { inTopLeft.v + 3, inTopLeft.h + 3, inTopLeft.v + 19, inTopLeft.h + 19 } ; - OSErr err = ::PlotIconID(&bounds, kAlignNone, inTransform, IconID()); - -} // DrawStandby - - -#if DRAW_SELECTED_AS_TAB - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void TitleImage::DrawOneTabBackground( - RgnHandle inRegion, - Boolean inCurrentTab) const -{ - SBevelColorDesc mActiveColors; - - SBevelColorDesc theTabColors; - UGraphicGizmos::LoadBevelTraits(1000, theTabColors); - Int16 thePaletteIndex = theTabColors.fillColor; -// if (mTrackInside) -// thePaletteIndex--; - ::PmForeColor(thePaletteIndex); - ::PaintRgn(inRegion); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void TitleImage::DrawOneTabFrame(RgnHandle inRegion, Boolean inCurrentTab) const -{ - // Draw the tab frame - SBevelColorDesc theTabColors; - UGraphicGizmos::LoadBevelTraits(1000, theTabColors); - Int16 thePaletteIndex = theTabColors.frameColor; - ::PmForeColor(thePaletteIndex); - ::FrameRgn(inRegion); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void TitleImage::DrawCurrentTabSideClip(RgnHandle inRegion) const -{ - SBevelColorDesc theTabColors; - UGraphicGizmos::LoadBevelTraits(1000, theTabColors); - - // Always only for the current tab - ::SetClip(inRegion); - ::PmForeColor(theTabColors.fillColor); -// ::PaintRect(&mSideClipFrame); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -void TitleImage::DrawOneTab(RgnHandle inBounds) const -{ - StClipRgnState theClipSaver; - -#if 0 - Rect theControlFrame; - CalcLocalFrameRect(theControlFrame); - - Boolean isCurrentTab = (inTab == mCurrentTab); - if (isCurrentTab) - { - StRegion theTempMask(inTab->mMask); - StRegion theSideMask(mSideClipFrame); - ::DiffRgn(theTempMask, theSideMask, theTempMask); - ::SetClip(theTempMask); - } - else - { - StRegion theTempMask(inTab->mMask); - ::DiffRgn(theTempMask, mCurrentTab->mMask, theTempMask); - ::SetClip(theTempMask); - } -#endif - - // This draws the fill pattern in the tab - DrawOneTabBackground(inBounds, true); - // This just calls FrameRgn on inTab->mMask -// DrawOneTabFrame(inBounds, true); - - StColorPenState thePenSaver; - thePenSaver.Normalize(); - - DrawCurrentTabSideClip(inBounds); - - Uint8 mBevelDepth = 2; - if (mBevelDepth > 0) - { - - ::PenSize(mBevelDepth, mBevelDepth); - - bool isCurrentTab = true; - if (isCurrentTab) { - // Draw the top bevel - RGBColor theAddColor = {0x4000, 0x4000, 0x4000}; - ::RGBForeColor(&theAddColor); - ::OpColor(&UGraphicGizmos::sLighter); - ::PenMode(subPin); - - // This runs the pen around the top and left sides - DrawTopBevel(inBounds); - } - - // Draw the bevel shadow -// StRegion theShadeRgn(inTab->mShadeFrame); - -// ::SetClip(theShadeRgn); - // Set up the colors for the bevel shadow - RGBColor theSubColor = {0x4000, 0x4000, 0x4000}; - ::RGBForeColor(&theSubColor); - ::OpColor(&UGraphicGizmos::sDarker); - ::PenMode(subPin); - // This runs the pen around the bottom and right sides - DrawBottomBevel(inBounds, true); - } - -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void TitleImage::DrawTopBevel(RgnHandle inBounds) const -{ - const Rect& theTabFrame = (**inBounds).rgnBBox; - enum { eNorthTab = 0, eEastTab, eSouthTab, eWestTab }; - Uint8 mOrientation = eWestTab; - Uint8 mCornerPixels = 5, mBevelDepth = 2; - - switch (mOrientation) - { - case eNorthTab: - { - ::MoveTo(theTabFrame.left + 1, theTabFrame.bottom + 1); - ::LineTo(theTabFrame.left + 1, theTabFrame.top + mCornerPixels); - ::LineTo(theTabFrame.left + mCornerPixels, theTabFrame.top + 1); - ::LineTo(theTabFrame.right - (mCornerPixels + mBevelDepth) + 1, theTabFrame.top + 1); - } - break; - - case eEastTab: - { - // I'm not sure whether this is quite right... - ::MoveTo(theTabFrame.left - 1, theTabFrame.top + 1); - ::LineTo(theTabFrame.right - (mCornerPixels + mBevelDepth) + 1, theTabFrame.top + 1); - ::LineTo(theTabFrame.right - mBevelDepth, theTabFrame.top + mCornerPixels); - } - break; - - case eSouthTab: - { - // I'm not sure whether this is quite right... - ::MoveTo(theTabFrame.left + 1, theTabFrame.top - 1); - ::LineTo(theTabFrame.left + 1, theTabFrame.bottom - (mCornerPixels + mBevelDepth) + 1); - ::LineTo(theTabFrame.left + mCornerPixels, theTabFrame.bottom - mBevelDepth); - } - break; - - case eWestTab: - { - ::MoveTo(theTabFrame.right + 1, theTabFrame.top + 1); - ::LineTo(theTabFrame.left + mCornerPixels, theTabFrame.top + 1); - ::LineTo(theTabFrame.left + 1, theTabFrame.top + mCornerPixels); - ::LineTo(theTabFrame.left + 1, theTabFrame.bottom - (mCornerPixels + mBevelDepth) + 1); - } - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawBottomBevel -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void TitleImage::DrawBottomBevel(RgnHandle inBounds, Boolean inCurrentTab) const -{ - const Rect& theTabFrame = (**inBounds).rgnBBox; - enum { eNorthTab = 0, eEastTab, eSouthTab, eWestTab }; - Uint8 mOrientation = eWestTab; - Uint8 mCornerPixels = 5, mBevelDepth = 2; - - switch (mOrientation) - { - case eNorthTab: - { - ::MoveTo(theTabFrame.right - mBevelDepth, theTabFrame.top + mCornerPixels); - ::LineTo(theTabFrame.right - mBevelDepth, theTabFrame.bottom + 1); - } - break; - - case eEastTab: - { - // I'm not sure whether this is quite right... - ::MoveTo(theTabFrame.right - mBevelDepth, theTabFrame.top + mCornerPixels); - ::LineTo(theTabFrame.right - mBevelDepth, theTabFrame.bottom - (mCornerPixels + mBevelDepth) + 1); - ::LineTo(theTabFrame.right - (mCornerPixels + mBevelDepth) + 1, theTabFrame.bottom - mBevelDepth); - ::LineTo(theTabFrame.left - 1, theTabFrame.bottom - mBevelDepth); - } - break; - - case eSouthTab: - { - // I'm not sure whether this is quite right... - ::MoveTo(theTabFrame.left + mCornerPixels, theTabFrame.bottom - mBevelDepth); - ::LineTo(theTabFrame.right - (mCornerPixels + mBevelDepth) + 1, theTabFrame.bottom - mBevelDepth); - ::LineTo(theTabFrame.right - mBevelDepth, theTabFrame.bottom - (mCornerPixels + mBevelDepth) + 1); - ::LineTo(theTabFrame.right - mBevelDepth, theTabFrame.top - 1); - } - break; - - case eWestTab: - { - ::MoveTo(theTabFrame.left + mCornerPixels, theTabFrame.bottom - mBevelDepth); - ::LineTo(theTabFrame.right + 1, theTabFrame.bottom - mBevelDepth); - } - break; - } -} - -#endif \ No newline at end of file diff --git a/mozilla/cmd/macfe/gui/CNavCenterSelectorPane.h b/mozilla/cmd/macfe/gui/CNavCenterSelectorPane.h deleted file mode 100644 index 69b478bbb7e..00000000000 --- a/mozilla/cmd/macfe/gui/CNavCenterSelectorPane.h +++ /dev/null @@ -1,230 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Contains: -// -// ¥ SelectorImage -// an abstract class for drawing the workspace icon -// -// ¥ TitleImage -// implements above -// -// ¥ CNavCenterSelectorPane -// handles drawing/clicking/tooltips/etc of workspaces and all powerplant interactions -// - -#pragma once - -#include -#include - -#include "LString.h" -#include "htrdf.h" -#include "CDynamicTooltips.h" -#include "CURLDragHelper.h" -#include "CImageIconMixin.h" - -#include "il_types.h" - - -class CIconContext; -class CNavCenterSelectorPane; - -#pragma mark -- class SelectorImage and SelectorData -- - - -// -// SelectorImage -// -// An abstract base class that knows how to draw itself in the appropriate mode (text/icon/text&icon) -// as well as selected or not-selected. -// -class SelectorImage : public CImageIconMixin -{ -public: - SelectorImage ( const string & inURL ) : CImageIconMixin(inURL) { } ; - virtual ~SelectorImage ( ) { } ; - virtual void DrawInCurrentView( const Rect& bounds, unsigned long mode ) const = 0; -}; - - -// -// SelectorData -// -// an element within the Nav Center workspace list. -// -struct SelectorData -{ - SelectorData ( HT_View inView, CNavCenterSelectorPane* inSelectorBar ) ; - ~SelectorData(); - - SelectorImage* workspaceImage; // ptr to object that knows how to draw workspace icon -}; - - -#pragma mark -- class CNavCenterSelectorPane -- - -// -// CNavCenterSelectorPane -// -// Draws the workspace icons in a vertical table. Handles setting the currently selected -// workspace when an icon is clicked on and telling the RDFCoordinator to change the open/close -// state of the shelf if need be. -// - -class CNavCenterSelectorPane - : public LView, public LDragAndDrop, public LBroadcaster, public LCommander, - public CDynamicTooltipMixin, public CHTAwareURLDragMixin -{ -public: - friend class CNavCenterSelectorContextMenuAttachment; - - // modes for drawing icons - enum { - kSelected = 1, kIcon = 2, kText = 4 - }; - - // powerplant stuff (panes and messages) - enum { - class_ID = 'NvSl', - msg_ShelfStateShouldChange = 'shlf', // broadcast when shelf should open/close - msg_ActiveSelectorChanged = 'selc' // broadcast when selector changes - }; - - CNavCenterSelectorPane( LStream* ); - virtual ~CNavCenterSelectorPane(); - - // Tell view to select the next workspace, wrapping around if we hit the ends - virtual void CycleCurrentWorkspace ( ) ; - - // Tell view if it is in a browser window - void SetEmbedded ( bool isEmbedded ) { mIsEmbedded = isEmbedded; } - - // Get/Set info about the HT_Pane that contains all the workspaces to display - void SetHTPane ( HT_Pane inPane ) { mHTPane = inPane; } - HT_Pane GetHTPane ( ) const { return mHTPane; } - - // access and change the current workspace. - void SetActiveWorkspace ( HT_View inNewWorkspace ) ; - HT_View GetActiveWorkspace ( ) const { return mCachedWorkspace; } - -protected: - enum EDropLocation { kDropBefore, kDropOn, kDropAfter } ; - - // PowerPlant overrides - virtual void DrawSelf(); - virtual void ClickSelf( const SMouseDownEvent& ); - virtual void AdjustCursorSelf( Point, const EventRecord& ); - virtual void FindCommandStatus ( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) ; - - // redraw when things change and broadcast that they have. - virtual void NoticeActiveWorkspaceChanged ( HT_View iter ) ; - - // click handling - size_t FindIndexForPoint ( const Point & inMouseLoc ) const; - size_t FindIndexForPoint ( const Point & inMouseLoc, EDropLocation & outWhere ) const ; - HT_View FindSelectorForPoint ( const Point & inMouseLoc ) const; - HT_View FindSelectorForPoint ( const Point & inMouseLoc, EDropLocation & outWhere, - TableIndexT & outRowBefore ) const; - - // stuff for dynamic tooltips - virtual void FindTooltipForMouseLocation ( const EventRecord& inMacEvent, StringPtr outTip ) ; - virtual void MouseWithin ( Point inPortPt, const EventRecord& ) ; - virtual void MouseLeave ( ) ; - - // stuff for drag and drop - virtual Boolean ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) ; - virtual void InsideDropArea ( DragReference inDragRef ) ; - virtual void EnterDropArea ( DragReference inDragRef, Boolean inDragHasLeftSender ) ; - virtual void LeaveDropArea ( DragReference inDragRef ) ; - virtual void DrawDividingLine( TableIndexT inRow, EDropLocation inPrep ) ; - virtual void HandleDropOfHTResource ( HT_Resource node ) ; - virtual void HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) ; - virtual void HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & /*inFileData*/ ) ; - virtual void HandleDropOfText ( const char* inTextData ) ; - virtual void ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) ; - - bool mIsEmbedded; // is this embedded in chrome or standalone window? - HT_Pane mHTPane; - HT_View mCachedWorkspace; // which view is currently active? - short mTooltipIndex; // which item is mouse hovering over - bool mMouseIsInsidePane; // is the mouse in the pane? - - Uint32 mDragAndDropTickCount; // used only during d&d as a timer - TableIndexT mDropRow; // row mouse is over during a drop. - // holds |LArray::index_Last| when invalid - EDropLocation mDropPreposition; // where does drop go, in relation to mDropRow? - - unsigned long mImageMode; - size_t mCellHeight; - -}; // class CNavCenterSelectorPane - - -#pragma mark -- class TitleImage -- - -// -// TitleImage -// -// Display the image for the workspace (and possibly the title). The icon will be a gif/jpeg -// loaded from the URL specified in HT. -// -class TitleImage : public SelectorImage -{ -public: - TitleImage ( const LStr255 & inTitle, ResIDT inIconID, const string & inIconURL, CNavCenterSelectorPane* inSelectorBar ) ; - ~TitleImage ( ) ; - - virtual void DrawInCurrentView( const Rect& bounds, unsigned long mode ) const ; - - const LStr255 & Title ( ) const { return mTitle; } ; - ResIDT IconID ( ) const { return mIconID; } ; - Uint16 TextWidth ( ) const { return mTextWidth; } ; - -protected: - - // overrides for CImageIconMixin to handle drawing of images - virtual void ListenToMessage ( MessageT inMessage, void* inData ) ; - virtual void DrawStandby ( const Point & inTopLeft, const IconTransformType inTransform ) const ; - -private: - -#if DRAW_SELECTED_AS_TAB - virtual void DrawOneTab(RgnHandle inBounds) const; - virtual void DrawTopBevel(RgnHandle inTab) const; - virtual void DrawBottomBevel(RgnHandle inTab, Boolean inCurrentTab) const; - virtual void DrawOneTabBackground( - RgnHandle inRegion, - Boolean inCurrentTab) const; - virtual void DrawOneTabFrame(RgnHandle inRegion, Boolean inCurrentTab) const; - virtual void DrawCurrentTabSideClip(RgnHandle inRegion) const; -#endif - - LStr255 mTitle; - ResIDT mIconID; - Uint16 mTextWidth; - - CNavCenterSelectorPane* mSelector; // selector bar reference, so it can be told when - // we need to redraw the image -}; // classTitleImage diff --git a/mozilla/cmd/macfe/gui/CNavCenterWindow.cp b/mozilla/cmd/macfe/gui/CNavCenterWindow.cp deleted file mode 100644 index aac9034f99b..00000000000 --- a/mozilla/cmd/macfe/gui/CNavCenterWindow.cp +++ /dev/null @@ -1,130 +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. - */ - -// Implementation of the class that handles the nav-center in a stand-alone window. - -#include "CNavCenterWindow.h" -#include "CRDFCoordinator.h" - -#include "resgui.h" -#include "Netscape_Constants.h" -#include "CPrefsDialog.h" - - -// -// Constructor -// -CNavCenterWindow :: CNavCenterWindow ( LStream* inStream ) - : CNetscapeWindow ( inStream, WindowType_NavCenter ), CSaveWindowStatus(this) -{ -} - - -// -// Destructor -// -CNavCenterWindow :: ~CNavCenterWindow ( ) -{ - mTree->UnregisterNavCenter(); -} - - -// -// FinishCreateSelf -// -// Handle the remainder of the initialization stuff... -// -void -CNavCenterWindow :: FinishCreateSelf() -{ - // use saved positioning information - FinishCreateWindow(); - - mTree = dynamic_cast(FindPaneByID(CWindowRDFCoordinator::pane_ID)); - Assert_(mTree); - mTree->RegisterNavCenter(NULL); - - SwitchTarget(mTree); - -} // FinishCreateSelf - - -// -// BringPaneToFront -// -// make the given pane the one that is in front -// -void -CNavCenterWindow :: BuildHTPane ( HT_Resource inTopNode ) -{ - mTree->BuildHTPane ( inTopNode ); -// mTree->SelectView ( inPane ); - -} // BringPaneToFront - - -void -CNavCenterWindow :: BuildHTPane ( RDF_Resource inTopNode ) -{ - mTree->BuildHTPane ( inTopNode ); -// mTree->SelectView ( inPane ); - -} // BringPaneToFront - - -// -// DoClose -// -// Make sure the size/location gets saved when we close the window... -// -void -CNavCenterWindow :: DoClose() -{ - AttemptCloseWindow(); // save state - CMediatedWindow::DoClose(); // finish the job... - -} // DoClose - - -// -// AttemptClose -// -// Make sure the size/location gets saved when we close the window... -// -// ¥ At some point this should be made like CBrowserWindow::AttemptClose -// to do scripting right -// -void -CNavCenterWindow :: AttemptClose() - { - AttemptCloseWindow(); // save state - CMediatedWindow::AttemptClose(); // finish the job... - -} // AttemptClose - - -// -// DoDefaultPrefs -// -// Show the prefs when called upon -// -void -CNavCenterWindow :: DoDefaultPrefs() -{ - CPrefsDialog::EditPrefs(CPrefsDialog::eExpandBrowser); -} diff --git a/mozilla/cmd/macfe/gui/CNavCenterWindow.h b/mozilla/cmd/macfe/gui/CNavCenterWindow.h deleted file mode 100644 index 3b90ed368a8..00000000000 --- a/mozilla/cmd/macfe/gui/CNavCenterWindow.h +++ /dev/null @@ -1,58 +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. - */ - -// Interface to the class that handles the nav-center in a stand-alone window - - -#include "CNetscapeWindow.h" -#include "CSaveWindowStatus.h" -#include "htrdf.h" - -class LStream; -class CWindowRDFCoordinator; - - -class CNavCenterWindow : public CNetscapeWindow, CSaveWindowStatus -{ - public: - enum { class_ID = 'NavW', res_ID = 9500 } ; - - CNavCenterWindow ( LStream* inStream ); - virtual ~CNavCenterWindow ( ) ; - - // make the given pane the one that is in front - virtual void BuildHTPane ( HT_Resource inPane ) ; - virtual void BuildHTPane ( RDF_Resource inPane ) ; - - virtual CNSContext* GetWindowContext() const { return nil; }; - - virtual void DoClose() ; - virtual void AttemptClose() ; - - protected: - - virtual UInt16 GetValidStatusVersion(void) const { return 0x0201; } - virtual ResIDT GetStatusResID(void) const { return res_ID; } - - virtual void FinishCreateSelf(); - - void DoDefaultPrefs() ; - - CWindowRDFCoordinator* mTree; - -}; // CNavCenterWindow diff --git a/mozilla/cmd/macfe/gui/CNavigationButtonPopup.cp b/mozilla/cmd/macfe/gui/CNavigationButtonPopup.cp deleted file mode 100644 index 26a4b907915..00000000000 --- a/mozilla/cmd/macfe/gui/CNavigationButtonPopup.cp +++ /dev/null @@ -1,217 +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. - */ - -// =========================================================================== -// CNavigationButtonPopup.cp -// -// =========================================================================== - -#include "CNavigationButtonPopup.h" - -#include "prefapi.h" -#include "xp_mem.h" -#include "shist.h" -#include "Netscape_Constants.h" -#include "CWindowMediator.h" -#include "CBrowserContext.h" -#include "CBrowserWindow.h" -#include "UMenuUtils.h" -#include "CAutoPtr.h" -#include "macutil.h" -#include "net.h" - -#include - -// --------------------------------------------------------------------------- -// ¥ CNavigationButtonPopup -// --------------------------------------------------------------------------- - -CNavigationButtonPopup::CNavigationButtonPopup( - LStream* inStream) - - : mBrowserContext(nil), - mHistory(nil), - mCurrentEntry(nil), - mCurrentEntryIndex(0), - mNumItemsInHistory(0), - - super(inStream) -{ -} - -// --------------------------------------------------------------------------- -// ¥ ~CNavigationButtonPopup -// --------------------------------------------------------------------------- - -CNavigationButtonPopup::~CNavigationButtonPopup() -{ -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ AdjustMenuContents -// --------------------------------------------------------------------------- - -void -CNavigationButtonPopup::AdjustMenuContents() -{ - if (!GetMenu() || !GetMenu()->GetMacMenuH()) - { - return; - } - - if (!AssertPreconditions()) - { - return; - } - - // Purge the menu - - UMenuUtils::PurgeMenuItems(GetMenu()->GetMacMenuH()); - - // Fill the menu - - if (GetQuickClickValueOrCommand() == cmd_GoBack) - { - for (int insertAfterItem = 0, i = mCurrentEntryIndex - 1; i >= 1; i--, insertAfterItem++) - { - InsertHistoryItemIntoMenu(i, insertAfterItem); - } - } - else if (GetQuickClickValueOrCommand() == cmd_GoForward) - { - for (int insertAfterItem = 0, i = mCurrentEntryIndex + 1; i <= mNumItemsInHistory; i++, insertAfterItem++) - { - InsertHistoryItemIntoMenu(i, insertAfterItem); - } - } - - // Set the min/max values of the control since we populated the menu - - SetPopupMinMaxValues(); -} - -// --------------------------------------------------------------------------- -// ¥ InsertHistoryItemIntoMenu -// --------------------------------------------------------------------------- - -void -CNavigationButtonPopup::InsertHistoryItemIntoMenu( - Int32 inHistoryItemIndex, - Int16 inAfterItem) -{ - Assert_(GetMenu() && GetMenu()->GetMacMenuH()); - Assert_(mBrowserContext); - - CAutoPtr theTitle = mBrowserContext->GetHistoryEntryTitleByIndex(inHistoryItemIndex); - - if (!theTitle.get() || !theTitle->length()) - { - theTitle.reset(new cstring); - mBrowserContext->GetHistoryURLByIndex(*theTitle, inHistoryItemIndex); - } - - UMenuUtils::AdjustStringForMenuTitle(*theTitle); - - LStr255 thePString(*theTitle); - - // Insert a "blank" item first... - - ::InsertMenuItem(GetMenu()->GetMacMenuH(), "\p ", inAfterItem + 1); - - // Then change it. We do this so that no interpretation of metacharacters will occur. - - ::SetMenuItemText(GetMenu()->GetMacMenuH(), inAfterItem + 1, thePString); -} - -#pragma mark - - -// --------------------------------------------------------------------------- -// ¥ HandleNewValue -// --------------------------------------------------------------------------- - -Boolean -CNavigationButtonPopup::HandleNewValue( - Int32 inNewValue) -{ - if (AssertPreconditions() && inNewValue) - { - Int32 historyIndex = 0; - - if (GetQuickClickValueOrCommand() == cmd_GoBack) - { - historyIndex = SHIST_GetIndex(mHistory, mCurrentEntry) - inNewValue; - } - else if (GetQuickClickValueOrCommand() == cmd_GoForward) - { - historyIndex = SHIST_GetIndex(mHistory, mCurrentEntry) + inNewValue; - } - - if (historyIndex) - { - mBrowserContext->LoadHistoryEntry(historyIndex); - } - } - - return true; -} - -// --------------------------------------------------------------------------- -// ¥ AssertPreconditions -// --------------------------------------------------------------------------- -// Assert preconditions and fill in interesting member data - -Boolean -CNavigationButtonPopup::AssertPreconditions() -{ - CMediatedWindow* topWindow = CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Any, regularLayerType); - - if (!topWindow || topWindow->GetWindowType() != WindowType_Browser) - { - return false; - } - - CBrowserWindow* browserWindow = dynamic_cast(topWindow); - - if (!browserWindow) - { - return false; - } - - if (!(mBrowserContext = (CBrowserContext*)browserWindow->GetWindowContext())) - { - return false; - } - - if (!(mHistory = &((MWContext*)(*mBrowserContext))->hist)) - { - return false; - } - - if (!(mCurrentEntry = mBrowserContext->GetCurrentHistoryEntry())) - { - return false; - } - - mCurrentEntryIndex = SHIST_GetIndex(mHistory, mCurrentEntry); - - mNumItemsInHistory = mBrowserContext->GetHistoryListCount(); - - return true; -} diff --git a/mozilla/cmd/macfe/gui/CNavigationButtonPopup.h b/mozilla/cmd/macfe/gui/CNavigationButtonPopup.h deleted file mode 100644 index 079fee5859e..00000000000 --- a/mozilla/cmd/macfe/gui/CNavigationButtonPopup.h +++ /dev/null @@ -1,68 +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. - */ - -// =========================================================================== -// CNavigationButtonPopup.h -// -// =========================================================================== - -#ifndef CNavigationButtonPopup_H -#define CNavigationButtonPopup_H -#pragma once - -// Includes - -#include "CPatternButtonPopup.h" -#include "shist.h" - -// Forward declarations - -class CBrowserContext; - -// Class declaration - -class CNavigationButtonPopup : public CPatternButtonPopup -{ -public: - enum { class_ID = 'PbNv' }; - - typedef CPatternButtonPopup super; - - CNavigationButtonPopup(LStream* inStream); - virtual ~CNavigationButtonPopup(); - -protected: - virtual void AdjustMenuContents(); - - virtual void InsertHistoryItemIntoMenu( - Int32 inHistoryItemIndex, - Int16 inAfterItem); - - virtual Boolean HandleNewValue(Int32 inNewValue); - - Boolean AssertPreconditions(); - - CBrowserContext* mBrowserContext; - History* mHistory; - History_entry* mCurrentEntry; - Int32 mCurrentEntryIndex; - Int32 mNumItemsInHistory; -}; - - -#endif diff --git a/mozilla/cmd/macfe/gui/CNetscapeWindow.cp b/mozilla/cmd/macfe/gui/CNetscapeWindow.cp deleted file mode 100644 index b6c77935a78..00000000000 --- a/mozilla/cmd/macfe/gui/CNetscapeWindow.cp +++ /dev/null @@ -1,402 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CNetscapeWindow.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CNetscapeWindow.h" - -#ifdef PowerPlant_PCH -#include PowerPlant_PCH -#endif - -#include "prefapi.h" -#include "resgui.h" - -#include "CDragBar.h" -#include "CDragBarContainer.h" - -#ifdef MOZ_OFFLINE -#include "CPatternProgressBar.h" -#include "MailNewsgroupWindow_Defines.h" -#include "LGAIconSuiteControl.h" -#endif //MOZ_OFFLINE - -#include "CNSContext.h" -#include "net.h" -#include "client.h" -#include "PascalString.h" -#include "uapp.h" - - -//----------------------------------- -CNetscapeWindow::CNetscapeWindow(LStream *inStream, DataIDT inWindowType) -//----------------------------------- -: CMediatedWindow(inStream, inWindowType) -{ - // We need to read the preferences to really know whether - // or not a tool bar should be visible. This can be taken - // care of in the FinishCreateSelf method of derived classes. - // For now, just assume they are all visible - for (int i = 0; i < kMaxToolbars; i++) - mToolbarShown[i] = true; - - SetAttribute(windAttr_DelaySelect); -} // CNetscapeWindow::CNetscapeWindow - -//----------------------------------- -CNetscapeWindow::~CNetscapeWindow() -//----------------------------------- -{ -} - -//----------------------------------- -void CNetscapeWindow::ShowOneDragBar(PaneIDT dragBarID, Boolean isShown) -// shows or hides a single toolbar -// This used to be in CBrowserWindow. Moved up to CNetscapeWindow on 5/23/97 by andrewb -//----------------------------------- -{ - CDragBarContainer* container = dynamic_cast(FindPaneByID(CDragBarContainer::class_ID)); - CDragBar* theBar = dynamic_cast(FindPaneByID(dragBarID)); - - if (container && theBar) { - if (isShown) - container->ShowBar(theBar); - else - container->HideBar(theBar); - } -} // CNetscapeWindow::ShowOneDragBar - -//----------------------------------- -void CNetscapeWindow::AdjustStagger(NetscapeWindowT inType) -// Moved here from CBrowserWindow -//----------------------------------- -{ - if (HasAttribute(windAttr_Regular) && HasAttribute(windAttr_Resizable)) - { - Rect structureBounds = UWindows::GetWindowStructureRect(mMacWindowP); - - GDHandle windowDevice = UWindows::FindDominantDevice(structureBounds); - GDHandle mainDevice = ::GetMainDevice(); - - Rect staggerBounds; - - if (windowDevice && (windowDevice != mainDevice)) - staggerBounds = (*windowDevice)->gdRect; - else - { - staggerBounds = (*mainDevice)->gdRect; - staggerBounds.top += LMGetMBarHeight(); - } - ::InsetRect(&staggerBounds, 4, 4); // Same as zoom limit - - Rect contentBounds = UWindows::GetWindowContentRect(mMacWindowP); - - Rect windowBorder; - windowBorder.top = contentBounds.top - structureBounds.top; - windowBorder.left = contentBounds.left - structureBounds.left; - windowBorder.bottom = structureBounds.bottom - contentBounds.bottom; - windowBorder.right = structureBounds.right - contentBounds.right; - - Point maxTopLeft; - maxTopLeft.v = staggerBounds.bottom - - (windowBorder.top + mMinMaxSize.top + windowBorder.bottom); - maxTopLeft.h = staggerBounds.right - - (windowBorder.left + mMinMaxSize.left + windowBorder.right); - - UInt16 vStaggerOffset = windowBorder.top; - - if (vStaggerOffset > 12) - vStaggerOffset -= 4; // Tweak it up - - const int maxStaggerPositionsCount = 10; - Point staggerPositions[maxStaggerPositionsCount]; - UInt16 usedStaggerPositions[maxStaggerPositionsCount]; - int staggerPositionsCount; - - for ( staggerPositionsCount = 0; - staggerPositionsCount < maxStaggerPositionsCount; - ++staggerPositionsCount) - { - staggerPositions[staggerPositionsCount].v - = staggerBounds.top + (vStaggerOffset * staggerPositionsCount); - staggerPositions[staggerPositionsCount].h - = staggerBounds.left + (4 * staggerPositionsCount); - - if ((staggerPositions[staggerPositionsCount].v > maxTopLeft.v) - || (staggerPositions[staggerPositionsCount].h > maxTopLeft.h)) - break; - - usedStaggerPositions[staggerPositionsCount] = 0; - } - unsigned int windowCount = 0; - CMediatedWindow *foundWindow = NULL; - CWindowIterator windowIterator(inType); - - for (windowIterator.Next(foundWindow); foundWindow; windowIterator.Next(foundWindow)) - { - CNetscapeWindow *netscapeWindow = dynamic_cast(foundWindow); - - if (netscapeWindow && (netscapeWindow != this) - && netscapeWindow->HasAttribute(windAttr_Regular)) - { - ++windowCount; - Rect bounds = UWindows::GetWindowStructureRect(netscapeWindow->mMacWindowP); - - for (int index = 0; index < staggerPositionsCount; ++index) - { - Boolean matchTop = (bounds.top == staggerPositions[index].v); - Boolean matchLeft = (bounds.left == staggerPositions[index].h); - - if ((matchTop) && (matchLeft)) - usedStaggerPositions[index] += 1; - - if ((matchTop) || (matchLeft)) - break; - } - } - } - Point structureSize; - structureSize.v = structureBounds.bottom - structureBounds.top; - structureSize.h = structureBounds.right - structureBounds.left; - - if (windowCount) - { - Boolean foundStaggerPosition = false; - - for (UInt16 minCount = 0; (minCount < 100) && !foundStaggerPosition; ++minCount) - { - for (int index = 0; index < staggerPositionsCount; ++index) - { - if (usedStaggerPositions[index] == minCount) - { - structureBounds.top = staggerPositions[index].v; - structureBounds.left = staggerPositions[index].h; - foundStaggerPosition = true; - break; - } - } - } - if (!foundStaggerPosition) - { - structureBounds.top = staggerBounds.top; - structureBounds.left = staggerBounds.left; - } - structureBounds.bottom = structureBounds.top + structureSize.v; - structureBounds.right = structureBounds.left + structureSize.h; - } - if ((structureBounds.top > maxTopLeft.v) || (structureBounds.left > maxTopLeft.h)) - { - structureBounds.top = staggerBounds.top; - structureBounds.left = staggerBounds.left; - structureBounds.bottom = structureBounds.top + structureSize.v; - structureBounds.right = structureBounds.left + structureSize.h; - } - if (structureBounds.bottom > staggerBounds.bottom) - structureBounds.bottom = staggerBounds.bottom; - - if (structureBounds.right > staggerBounds.right) - structureBounds.right = staggerBounds.right; - - contentBounds.top = structureBounds.top + windowBorder.top; - contentBounds.left = structureBounds.left + windowBorder.left; - contentBounds.bottom = structureBounds.bottom - windowBorder.bottom; - contentBounds.right = structureBounds.right - windowBorder.right; - - DoSetBounds(contentBounds); - } -} // CNetscapeWindow::AdjustStagger() - -//----------------------------------- -void CNetscapeWindow::ToggleDragBar(PaneIDT dragBarID, int whichBar, const char* prefName) -// toggles a toolbar and updates the specified preference -// This used to be in CBrowserWindow. Moved up to CNetscapeWindow on 5/23/97 by andrewb -//----------------------------------- -{ - Boolean showIt = ! mToolbarShown[whichBar]; - ShowOneDragBar(dragBarID, showIt); - - if (prefName) { - PREF_SetBoolPref(prefName, showIt); - } - - // force menu items to update show "Show" and "Hide" string changes are reflected - LCommander::SetUpdateCommandStatus(true); - - mToolbarShown[whichBar] = showIt; -} // CNetscapeWindow::ToggleDragBar - -//----------------------------------- -URL_Struct* CNetscapeWindow::CreateURLForProxyDrag(char* outTitle) -//----------------------------------- -{ - // Default implementation - URL_Struct* result = nil; - CNSContext* context = GetWindowContext(); - if (context) - { - History_entry* theCurrentHistoryEntry = context->GetCurrentHistoryEntry(); - if (theCurrentHistoryEntry) - { - result = NET_CreateURLStruct(theCurrentHistoryEntry->address, NET_NORMAL_RELOAD); - if (outTitle) - { - // The longest string that outTitle can contain is 255 characters but it - // will eventually be truncated to 31 characters before it's used so why - // not just truncate it here. Fixes bug #86628 where a page has an - // obscenely long (something like 1000 characters) title - strncpy(outTitle, theCurrentHistoryEntry->title, 255); - outTitle[255] = 0; // Make damn sure it's truncated - NET_UnEscape(outTitle); - } - } - } - return result; -} // CNetscapeWindow::CreateURLForProxyDrag - -//----------------------------------- -/*static*/void CNetscapeWindow::DisplayStatusMessageInAllWindows(ConstStringPtr inMessage) -//----------------------------------- -{ - CMediatedWindow* aWindow = NULL; - CWindowIterator iter(WindowType_Any); - while (iter.Next(aWindow)) - { - CNetscapeWindow* nscpWindow = dynamic_cast(aWindow); - if (nscpWindow) // Bug #113623 - { - CNSContext* cnsContext = nscpWindow->GetWindowContext(); - if (cnsContext) - { - MWContext* mwContext = *cnsContext; - if (mwContext) - FE_Progress(mwContext, CStr255(inMessage)); - } - -#ifdef MOZ_OFFLINE - else - { - // Mail Compose window (for instance?) has no context but has a status bar - CProgressCaption* progressCaption - = dynamic_cast - (nscpWindow->FindPaneByID(kMailNewsStatusPaneID)); - if (progressCaption) - progressCaption->SetDescriptor(inMessage); - } - LGAIconSuiteControl* offlineButton - = dynamic_cast - (nscpWindow->FindPaneByID(kOfflineButtonPaneID)); - if (offlineButton) - { - ResIDT iconID = NET_IsOffline() ? 15200 : 15201; - offlineButton->SetIconResourceID(iconID); - offlineButton->Refresh(); - } - -#endif //MOZ_OFFLINE - } - } -} // CNetscapeWindow::DisplayStatusMessageInAllWindows - -//---------------------------------------------------------------------------------------- -void CNetscapeWindow::StopAllContexts() -//---------------------------------------------------------------------------------------- -{ - CNSContext* context = GetWindowContext(); - if (context) - XP_InterruptContext(*context); -} - -//---------------------------------------------------------------------------------------- -Boolean CNetscapeWindow::IsAnyContextBusy() -//---------------------------------------------------------------------------------------- -{ - CNSContext* context = GetWindowContext(); - if (context) - return XP_IsContextBusy(*context); - return false; -} - -//----------------------------------- -Boolean CNetscapeWindow::ObeyCommand(CommandT inCommand, void *ioParam) -//----------------------------------- -{ - Boolean cmdHandled = false; - - switch (inCommand) - { - case cmd_Preferences: - DoDefaultPrefs(); - return true; - case cmd_Stop: - // The stop bucks here. - StopAllContexts(); - return true; - default: - cmdHandled = Inherited::ObeyCommand(inCommand, ioParam); - break; - } - - return cmdHandled; -} - -//---------------------------------------------------------------------------------------- -void CNetscapeWindow::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -//---------------------------------------------------------------------------------------- -{ - outUsesMark = false; - - switch (inCommand) - { - case cmd_Stop: - outEnabled = IsAnyContextBusy(); - break; - - default: - Inherited::FindCommandStatus( - inCommand, outEnabled, outUsesMark, outMark, outName); - } -} // CNetscapeWindow::FindCommandStatus - - -//---------------------------------------------------------------------------------------- -void CNetscapeWindow::Show() -// This is intended to make initial drawing of a window much faster, so we don't -// look so bad when windows are first displayed. -//---------------------------------------------------------------------------------------- -{ - Boolean wasVisible = IsVisible(); - - Inherited::Show(); - - if (wasVisible) - return; - - // make sure the window is hilited, if we are the frontmost app - if (CFrontApp::GetApplication()->IsOnDuty() && UDesktop::FetchTopRegular() == this) - LWindow::Activate(); - - // force an immediate redraw to look good - LWindow::UpdatePort(); -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/gui/CNetscapeWindow.h b/mozilla/cmd/macfe/gui/CNetscapeWindow.h deleted file mode 100644 index f9b851cac4e..00000000000 --- a/mozilla/cmd/macfe/gui/CNetscapeWindow.h +++ /dev/null @@ -1,100 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CNetscapeWindow.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include "CWindowMediator.h" - -typedef struct _History_entry History_entry; - -#define kMaxToolbars (4) - -enum -{ - BROWSER_MENU_TOGGLE_STRINGS_ID = 1037 -, HIDE_NAVIGATION_TOOLBAR_STRING = 5 -, SHOW_NAVIGATION_TOOLBAR_STRING = 6 -, HIDE_LOCATION_TOOLBAR_STRING = 7 -, SHOW_LOCATION_TOOLBAR_STRING = 8 -, HIDE_MESSAGE_TOOLBAR_STRING = 9 -, SHOW_MESSAGE_TOOLBAR_STRING = 10 -, HIDE_FOLDERPANE_STRING = 11 -, SHOW_FOLDERPANE_STRING = 12 -, HIDE_NAVCENTER_STRING = 13 -, SHOW_NAVCENTER_STRING = 14 -, HIDE_PERSONAL_TOOLBAR_STRING = 15 -, SHOW_PERSONAL_TOOLBAR_STRING = 16 -#ifdef MOZ_MAIL_NEWS -, SAVE_DRAFT_STRING = 17 -, SAVE_TEMPLATE_STRING = 18 -#endif //MOZ_MAIL_NEWS -}; - - -class CNSContext; -class CExtraFlavorAdder; -typedef struct URL_Struct_ URL_Struct; - - -//======================================================================================== -class CNetscapeWindow -//======================================================================================== -: public CMediatedWindow -{ - private: - typedef CMediatedWindow Inherited; - public: - CNetscapeWindow( - LStream* inStream, - DataIDT inWindowType); - - virtual ~CNetscapeWindow(); - - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - virtual Boolean ObeyCommand( - CommandT inCommand, - void *ioParam = nil); - void ShowOneDragBar(PaneIDT dragBarID, Boolean isShown); - void ToggleDragBar(PaneIDT dragBarID, int whichBar, - const char* prefName = nil); - - void AdjustStagger(NetscapeWindowT inType); - virtual CNSContext* GetWindowContext() const = 0; - virtual void StopAllContexts(); - virtual Boolean IsAnyContextBusy(); - virtual CExtraFlavorAdder* CreateExtraFlavorAdder() const { return nil; } - virtual URL_Struct* CreateURLForProxyDrag(char* outTitle = nil); - - static void DisplayStatusMessageInAllWindows(ConstStringPtr inMessage); - - virtual void Show ( ) ; - - protected: - // Visibility of toolbars and status bars - Boolean mToolbarShown[kMaxToolbars]; - virtual void DoDefaultPrefs() = 0; -}; // class CNetscapeWindowclass CNetscapeWindow diff --git a/mozilla/cmd/macfe/gui/CPasteSnooper.cp b/mozilla/cmd/macfe/gui/CPasteSnooper.cp deleted file mode 100644 index 60fb82e2aa4..00000000000 --- a/mozilla/cmd/macfe/gui/CPasteSnooper.cp +++ /dev/null @@ -1,322 +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. - */ - -// =========================================================================== -// CPasteSnooper.cp -// an attachment for filtering characters from a paste command -// =========================================================================== - -#include "CPasteSnooper.h" - -#include "PascalString.h" -#include "xp_mcom.h" - -#include -#include - -#ifndef __TYPES__ -#include -#endif - -#ifndef __SCRAP__ -#include -#endif - -#ifndef __TOOLUTILS__ -#include -#endif - -#include "CTSMEditField.h" - -//======================================================================================== -class CPasteActionSnooper : public LTEPasteAction -//======================================================================================== -{ -public: - CPasteActionSnooper ( - TEHandle inMacTEH, - LCommander *inTextCommander, - LPane *inTextPane, - char *inFind, - char *inReplace, - UInt32 inMaxChars); - -protected: - void DoReplace(char inFind, char inReplace); - void DoDelete(char inDelete); - void StripLeading(char inStrip); - void DoFilter(char inFilter); -}; - -// goal is to make this more general -CPasteSnooper::CPasteSnooper (char *inFind, char *inReplace) : - // first param to LAttachment says we want to intercept paste commmands - // second param says that we're going to take care of handling the - // action and that our host should do nothing - LAttachment(cmd_Paste, false) -{ - mFind = XP_STRDUP(inFind); - mReplace = XP_STRDUP(inReplace); -} - -CPasteSnooper::~CPasteSnooper () -{ - XP_FREEIF(mFind); - XP_FREEIF(mReplace); -} - -// there's no beef here. look in CPasteActionSnooper's -// constructor to see where the actual filtering is done -void CPasteSnooper::ExecuteSelf (MessageT inMessage, void * /* ioParam */) -{ - - // did we get called with good params? - if (!mFind || !mReplace) - return; - Assert_(strlen(mFind) == strlen(mReplace)); - if (strlen(mFind) != strlen(mReplace)) - return; - - // paranoia - Assert_(inMessage == cmd_Paste); - - // if you used something other than an LEditField you're in trouble - LEditField *editField = dynamic_cast(mOwnerHost); - Assert_(editField != nil); - if (!editField) - return; - - // Because mMaxChars is a protected data member of LEditField, we can only find - // out the maximum count if the edit field is a CTSMEditField. - CTSMEditField* tsmEdit = dynamic_cast(editField); - UInt32 maxChars = tsmEdit ? tsmEdit->GetMaxChars() : 32000; - - // here's where the paste gets done... but our CPasteSnooperAction gets a shot - // at it first to take out all the unwanted characters - editField->PostAction( - new CPasteActionSnooper( - editField->GetMacTEH(), - editField, editField, - mFind, mReplace, - maxChars) - ); -} - -// here's where we actually filter stuff -CPasteActionSnooper::CPasteActionSnooper ( - TEHandle inMacTEH, - LCommander *inTextCommander, - LPane *inTextPane, - char *inFind, - char *inReplace, - UInt32 inMaxChars) - : LTEPasteAction(inMacTEH, inTextCommander, inTextPane) -{ - for (int i = 0; inFind[i] != '\0'; i++) - switch (inReplace[i]) { - case '\b': - DoDelete(inFind[i]); - break; - case '\f': - DoFilter(inFind[i]); - break; - case '\a': - StripLeading(inFind[i]); - break; - default: - DoReplace(inFind[i], inReplace[i]); - } - Int32 maxSize = inMaxChars - (**inMacTEH).teLength + ((**inMacTEH).selEnd - (**inMacTEH).selStart); - if (mPastedTextH && GetHandleSize(mPastedTextH) > maxSize) - { - SysBeep(1); - SetHandleSize(mPastedTextH, maxSize); - } -} - -// removes all instances of inDelete from mPastedTextH -// Example: -// if mPastedTextH referenced the string "\r\rHello World!\rMy Name is Andy!\r" -// a call to DoDelete('\r') would make mPastedTextH -// reference "Hello World!My Name is Andy!" upon completion -void CPasteActionSnooper::DoDelete (char inDelete) { - // did our inherited class succeed in allocating memory for the scrap? - if (*mPastedTextH == nil) - return; - - Int32 scrapLength = ::GetHandleSize(mPastedTextH); - - // make sure this is a legal operation - if (scrapLength < 0) - return; - - // create a new handle to store our result - Handle newScrapText = ::NewHandle(scrapLength); - - // did it work? - if (*newScrapText == nil) - return; - - // we're going to work with dereferenced handles from here - // on so we'd better lock them - ::HLock(mPastedTextH); - ::HLock(newScrapText); - - // search through mPastedTextH and copy all characters except - // inFind over to newScrapText - Int32 srcIndex = 0; - Int32 destIndex = 0; - - do { - if ((*mPastedTextH)[srcIndex] != inDelete) - (*newScrapText)[destIndex++] = (*mPastedTextH)[srcIndex]; - } while (++srcIndex < scrapLength); - - // unlock our handles - ::HUnlock(newScrapText); - ::HUnlock(mPastedTextH); - - // shrink newScrapText down to the minimum size - ::SetHandleSize(newScrapText, destIndex); - - // dispose of the text we were going to paste... - ::DisposeHandle(mPastedTextH); - - // ...and replace it with the new text that we really wanted to paste - mPastedTextH = newScrapText; -} - -// strips leading occurences of inFilter in mPastedTextH and then -// clips mPastedTextH right before the next occurence of inFind -// Example: -// if mPastedTextH referenced the string "\r\rHello World!\rMy Name is Andy!\r" -// a call to DoFilter('\r') would make mPastedTextH -// reference "Hello World!" upon completion -void CPasteActionSnooper::DoFilter (char inFilter) { - StripLeading(inFilter); - - // did our inherited class succeed in allocating memory for the scrap? - if (*mPastedTextH == nil) - return; - - Int32 scrapLength = ::GetHandleSize(mPastedTextH); - - // make sure this is a legal operation - if (scrapLength < 0) - return; - - // we're going to work with the dereferenced handle from here - // on so I'll just lock it out of habit - ::HLock(mPastedTextH); - - // only take characters up to the first occurence of inFind - int endOfNewScrap = 0; - while ((*mPastedTextH)[endOfNewScrap] != inFilter && endOfNewScrap < scrapLength) - endOfNewScrap++; - - // OK, all done with dereferencing - ::HUnlock(mPastedTextH); - - // truncate the handle after the first occurence of inFind - if (endOfNewScrap < scrapLength) - ::SetHandleSize(mPastedTextH, endOfNewScrap); -} - -// strips leading occurences of inFind -// Example: -// if mPastedTextH referenced the string "\t\tI luv\tCS\t\t" -// a call to StripLeading('\t') would make mPastedTextH -// reference "I luv\tCS\t\t" upon completion -void CPasteActionSnooper::StripLeading (char inStrip) { - // did our inherited class succeed in allocating memory for the scrap? - if (*mPastedTextH == nil) - return; - - Int32 scrapLength = ::GetHandleSize(mPastedTextH); - - // make sure this is a legal operation - if (scrapLength < 0) - return; - - // we're going to work with the dereferenced handle from here - // on so we'd better lock it - ::HLock(mPastedTextH); - - Int32 startOfNewScrap; - Int32 newScrapSize; - Handle newScrapText = nil; - - // skip over initial occurences of inStrip - startOfNewScrap = 0; - while ((*mPastedTextH)[startOfNewScrap] == inStrip) - startOfNewScrap++; - - // make a new Handle to hold the characters we really want - newScrapSize = scrapLength - startOfNewScrap; - newScrapText = ::NewHandle(newScrapSize); - - // did NewHandle work? - if (*newScrapText == nil) { - // better not forget to do this - ::HUnlock(mPastedTextH); - return; - } - - // now copy those characters into the new handle - ::HLock(newScrapText); - ::BlockMove((*mPastedTextH + startOfNewScrap), *newScrapText, newScrapSize); - ::HUnlock(newScrapText); - - // unlock and dispose of the text we were going to paste... - ::HUnlock(mPastedTextH); - ::DisposeHandle(mPastedTextH); - - // ...and replace it with the new text that we really wanted to paste - mPastedTextH = newScrapText; -} - -// replaces all instances of inFind in mPastedTextH with inReplace -// Example: -// if mPastedTextH referenced the string "\r\rHello World!\rMy Name is Andy!\r" -// a call to DoReplace('\r', '#') would make mPastedTextH -// reference "##Hello World!#My Name is Andy!#" upon completion -void CPasteActionSnooper::DoReplace (char inFind, char inReplace) { - // did our inherited class succeed in allocating memory for the scrap? - if (*mPastedTextH == nil) - return; - - Int32 scrapLength = ::GetHandleSize(mPastedTextH); - - // make sure this is a legal operation - if (scrapLength < 0) - return; - - // we're going to work the dereferenced handle from here - // on so we'd better lock it - ::HLock(mPastedTextH); - - // search through mPastedTextH and replace all occurences - // of inFind with inReplace - for (int i = 0; i < scrapLength; i++) { - if ((*mPastedTextH)[i] == inFind) - (*mPastedTextH)[i] = inReplace; - } - - // unlock our handle and we're done! - ::HUnlock(mPastedTextH); -} diff --git a/mozilla/cmd/macfe/gui/CPasteSnooper.h b/mozilla/cmd/macfe/gui/CPasteSnooper.h deleted file mode 100644 index 92f95ff9c06..00000000000 --- a/mozilla/cmd/macfe/gui/CPasteSnooper.h +++ /dev/null @@ -1,70 +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. - */ - -// =========================================================================== -// CPasteSnooper.h -// an attachment for filtering characters from a paste command -// =========================================================================== - -#pragma once - -#include - -class CStr31; - -#define ONLY_TAKE_FIRST_LINE "\r\n", "\f\f" -#define MAKE_RETURNS_SPACES "\r\n", " " -#define DELETE_RETURNS "\r\n", "\b\b" - -//======================================================================================== -class CPasteSnooper : public LAttachment -// an attachment for filtering characters from a paste command -//======================================================================================== -{ -public: - - // inFind is a pascal string of characters that you - // don't want to allow the user to paste. inReplace is - // a pascal string of characters to replace the inFind - // characters with. ie every instance of inFind[1] is - // replaced with inReplace[1]. to specify that a certain - // character is to be simply deleted, put the character in - // inFind at any location i and set inReplace[i] to - // '\b'. The '\b' code is reserved for deleting characters - // A '\f' in inReplace[i] means that we only take characters up - // to the first occurence of inFind[i] and discard everything - // after that. \a in inReplace[i] means that leading occurences - // of inFind[i] should be stripped - CPasteSnooper (char *inFind, char *inReplace); - - virtual ~CPasteSnooper(); - -protected: - // this creates a CPasteActionSnooper to really do the paste - virtual void ExecuteSelf(MessageT inMessage, void *ioParam); - -// Data -protected: - // characters that we're not allowing the user to paste - char *mFind; - // characters used to replace those found in mFilter. '\b' if - // we're supposed to delete a char rather than replace it - char *mReplace; - - UInt32 mMaxChars; -}; // class CPasteSnooper diff --git a/mozilla/cmd/macfe/gui/CPatternedGrippyPane.cp b/mozilla/cmd/macfe/gui/CPatternedGrippyPane.cp deleted file mode 100644 index afed5678ae3..00000000000 --- a/mozilla/cmd/macfe/gui/CPatternedGrippyPane.cp +++ /dev/null @@ -1,150 +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. - */ - -// -// CPatternedGrippyPane.cp -// -// Implementation for class that draws a "grippy" pattern in the pane rectangle so users know -// they can drag/click in this area. Also hilights when mouse enters (roll-over feedback). -// -// I didn't actually write this class, just moved it out of DragBar.h. -// - - -#include "CPatternedGrippyPane.h" -#include "CSharedPatternWorld.h" -#include "UGraphicGizmos.h" - - -CPatternedGrippyPane::CPatternedGrippyPane(LStream* inStream) - : LPane(inStream) -{ - ResIDT theBackgroundID; - *inStream >> theBackgroundID; - ResIDT theBackgroundHiliteID; - *inStream >> theBackgroundHiliteID; - - ResIDT theTopPatternID; // read in but ignore...unused... - *inStream >> theTopPatternID; - - Int16 theTopPatternIndex; // read in but ignore...unused... - *inStream >> theTopPatternIndex; - - ResIDT theBottomPatternID; // read in but ignore...unused... - *inStream >> theBottomPatternID; - - Int16 theBottomPatternIndex; // read in but ignore...unused... - *inStream >> theBottomPatternIndex; - - mBackPattern = CSharedPatternWorld::CreateSharedPatternWorld(theBackgroundID); - ThrowIfNULL_(mBackPattern); - mBackPattern->AddUser(this); - mBackPatternHilite = CSharedPatternWorld::CreateSharedPatternWorld(theBackgroundHiliteID); - ThrowIfNULL_(mBackPatternHilite); - mBackPatternHilite->AddUser(this); - - mGrippy = CSharedPatternWorld::CreateSharedPatternWorld(10002); - ThrowIfNULL_(mGrippy); - mGrippy->AddUser(this); - mGrippyHilite = CSharedPatternWorld::CreateSharedPatternWorld(10003); - ThrowIfNULL_(mGrippyHilite); - mGrippyHilite->AddUser(this); - - mTriangle = ::GetCIcon(10001); - ThrowIfNULL_(mTriangle); - - mMouseInside = false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CPatternedGrippyPane::~CPatternedGrippyPane() -{ - mGrippy->RemoveUser(this); - mGrippyHilite->RemoveUser(this); - mBackPattern->RemoveUser(this); - mBackPatternHilite->RemoveUser(this); - ::DisposeCIcon(mTriangle); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CPatternedGrippyPane::DrawSelf(void) -{ - Rect theFrame; - CalcLocalFrameRect(theFrame); - StClipRgnState theClipSaver(theFrame); - - Point theAlignment; - CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Self, theAlignment); - - // We do this instead of LPane::GetMacPort() - // because we may be being drawn offscreen. - CGrafPtr thePort; - ::GetPort(&(GrafPtr)thePort); - if ( mMouseInside ) - mBackPatternHilite->Fill(thePort, theFrame, theAlignment); - else - mBackPattern->Fill(thePort, theFrame, theAlignment); - - UGraphicGizmos::BevelTintRect(theFrame, 1, 0x4000, 0x4000); - - Rect theTriangleFrame = (**mTriangle).iconPMap.bounds; - Rect theTriangleDest = theFrame; - theTriangleDest.bottom = theTriangleDest.top + RectWidth(theFrame); - - UGraphicGizmos::CenterRectOnRect(theTriangleFrame, theTriangleDest); - ::PlotCIcon(&theTriangleFrame, mTriangle); - - Rect thePatternDest = theFrame; - ::InsetRect(&thePatternDest, 2, 2); - thePatternDest.top = theTriangleDest.bottom - 1; - ::ClipRect(&thePatternDest); - - // hack to make it look centered for both drag bars and expand/collapse widget - if ( thePatternDest.right - thePatternDest.left > 5 ) - theAlignment.h++; - - if ( mMouseInside ) - mGrippyHilite->Fill(thePort, thePatternDest, theAlignment); - else - mGrippy->Fill(thePort, thePatternDest, theAlignment); - -// UGraphicGizmos::DrawArithPattern(theFrame, mBottomShadePat, 0x6000, false); -} - - -void -CPatternedGrippyPane :: MouseEnter ( Point /* inPoint */, const EventRecord & /* inEvent */ ) -{ - mMouseInside = true; - Refresh(); -} - -void -CPatternedGrippyPane :: MouseLeave ( ) -{ - mMouseInside = false; - Refresh(); -} - - diff --git a/mozilla/cmd/macfe/gui/CPatternedGrippyPane.h b/mozilla/cmd/macfe/gui/CPatternedGrippyPane.h deleted file mode 100644 index cb302c246a4..00000000000 --- a/mozilla/cmd/macfe/gui/CPatternedGrippyPane.h +++ /dev/null @@ -1,60 +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. - */ - -// -// CPatternedGrippyPane.h -// -// Interface for class that draws a "grippy" pattern in the pane rectangle so users know -// they can drag/click in this area. Also hilights when mouse enters (roll-over feedback). -// -// I didn't actually write this class, just moved it out of DragBar.h. -// - -#pragma once - -class LPane; -class LStream; -class CSharedPatternWorld; - - -class CPatternedGrippyPane : public LPane -{ - public: - - enum { class_ID = 'PgPn' }; - - CPatternedGrippyPane(LStream* inStream); - virtual ~CPatternedGrippyPane(); - - // for hilighting on mouse entry/exit - virtual void MouseEnter ( Point inPoint, const EventRecord & inEvent ) ; - virtual void MouseLeave ( ) ; - - protected: - - virtual void DrawSelf(void); - - CIconHandle mTriangle; - CSharedPatternWorld* mBackPattern; // back pattern when mouse outside - CSharedPatternWorld* mBackPatternHilite; // back pattern when mouse inside - Boolean mMouseInside; - - CSharedPatternWorld* mGrippy; // grippy pattern (gray bg) - CSharedPatternWorld* mGrippyHilite; // grippy pattern hilite (purple bg) - -}; // CPatternedGrippyPane diff --git a/mozilla/cmd/macfe/gui/CPersonalToolbarManager.cp b/mozilla/cmd/macfe/gui/CPersonalToolbarManager.cp deleted file mode 100644 index a3f9182e89c..00000000000 --- a/mozilla/cmd/macfe/gui/CPersonalToolbarManager.cp +++ /dev/null @@ -1,315 +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. - */ - -// -// CPersonalToolbarManager.cp -// -// Implementation of the CPersonalToolbarManager class which handles keeping all the -// personal toolbars in sync. This reads all its info from RDF, not the old BM UI. -// -// I REALLY dislike that most of this code is in Hungarian notation, but the Windows -// code that it originally came from was like that and instead of doing a slew of -// global replaces, I'll just complain about it. -// - -#include "CPersonalToolbarManager.h" -#include "CPersonalToolbarTable.h" -#include "URDFUtilities.h" - -#include "prefapi.h" - -#pragma mark ¥¥ CPersonalToolbarManager -#pragma mark -- Public Methods - - -const char* CPersonalToolbarManager::kMaxButtonCharsPref = "browser.personal_toolbar_button.max_chars"; -const char* CPersonalToolbarManager::kMinButtonCharsPref = "browser.personal_toolbar_button.min_chars"; - - -// -// Constructor -// -// Setup. Assumes that preferences and RDF have been initialized fully by this point. -// -CPersonalToolbarManager :: CPersonalToolbarManager ( ) - : mUserButtonInfoArray ( sizeof(CUserButtonInfo*) ) -{ - // setup our window into the RDF world and register this class as the one to be notified - // when the personal toolbar changes. - HT_Notification notifyStruct = CreateNotificationStruct(); - mToolbarView = HT_GetSelectedView ( HT_NewPersonalToolbarPane(notifyStruct) ); - Assert_(mToolbarView != NULL); - mToolbarRoot = HT_TopNode ( mToolbarView ); - Assert_(mToolbarRoot != NULL); - HT_SetOpenState ( mToolbarRoot, PR_TRUE ); // ensure container is open so we can see its contents - - // read in the maximum size we're allowing for personal toolbar items. If not - // found in prefs, use our own - int32 maxToolbarButtonChars, minToolbarButtonChars; - if ( PREF_GetIntPref(kMaxButtonCharsPref, &maxToolbarButtonChars ) == PREF_ERROR ) - mMaxToolbarButtonChars = CPersonalToolbarManager::kMaxPersonalToolbarChars; - else - mMaxToolbarButtonChars = maxToolbarButtonChars; - if ( PREF_GetIntPref(kMinButtonCharsPref, &minToolbarButtonChars ) == PREF_ERROR ) - mMinToolbarButtonChars = CPersonalToolbarManager::kMinPersonalToolbarChars; - else - mMinToolbarButtonChars = minToolbarButtonChars; - - InitializeButtonInfo(); - -} // constructor - - -// -// Destructor -// -// The toolbars in individual windows will delete themselves when the window dies and -// unregister themselves as listeners. We don't need to do anything along those -// lines here. -// -CPersonalToolbarManager :: ~CPersonalToolbarManager ( ) -{ - //¥¥¥ delete the contents of the button list -} // destructor - - -// -// RegisterNewToolbar -// -// This must be called for each new toolbar created in a browser window. It fills in -// the toolbar with the correct items and registers it as a listener to the messages -// we emit. -// -void -CPersonalToolbarManager :: RegisterNewToolbar ( CPersonalToolbarTable* inBar ) -{ - AddListener ( inBar ); - BroadcastMessage ( k_PTToolbarChanged ); - -} // RegisterNewToolbar - - -// -// ToolbarChanged -// -// The user has just made some change to the toolbar, such as manipulating items in the nav center -// or changing the personal toolbar folder. Since these changes could be quite extensive, we -// just clear out the whole thing and start afresh. Tell all the toolbars that they have to -// clear themselves and grab the new information. Changes to the toolbar directly, such as by -// drag and drop, are handled elsewhere. -// -void -CPersonalToolbarManager :: ToolbarChanged ( ) -{ - RemoveToolbarButtons(); // out with the old... - InitializeButtonInfo(); // ...in with the new - BroadcastMessage ( k_PTToolbarChanged ); - -} // ToolbarHeaderChanged - - -// -// AddButton -// -// Given a pre-created HT item, add it to the personal toolbar folder before the -// given id and tell all the toolbars to update. This is called when the user -// drops an item from another RDF source on a personal toolbar -// -void -CPersonalToolbarManager :: AddButton ( HT_Resource inBookmark, Uint32 inIndex ) -{ - // Add this to RDF. - if ( GetButtons().GetCount() ) { - // If we get back a null resource then we must be trying to drop after - // the last element, or there just plain aren't any in the toolbar. Re-fetch the last element - // (using the correct index) and add the new bookmark AFTER instead of before or just add - // it to the parent for the case of an empty toolbar - PRBool before = PR_TRUE; - HT_Resource dropOn = HT_GetNthItem( mToolbarView, URDFUtilities::PPRowToHTRow(inIndex) ); - if ( ! dropOn ) { - dropOn = HT_GetNthItem( mToolbarView, URDFUtilities::PPRowToHTRow(inIndex) - 1 ); - before = PR_FALSE; - } - HT_DropHTRAtPos ( dropOn, inBookmark, before ); - } // if items in toolbar - else - HT_DropHTROn ( mToolbarRoot, inBookmark ); - - // no need to tell toolbars to refresh because we will get an HT node added event and - // refresh at that time. - -} // Addbutton - - -// -// AddButton -// -// Given just a URL, add it to the personal toolbar folder before the -// given id and tell all the toolbars to update. This is called when the user -// drops an item from another RDF source on a personal toolbar -// -void -CPersonalToolbarManager :: AddButton ( const string & inURL, const string & inTitle, Uint32 inIndex ) -{ - // Add this to RDF. - if ( GetButtons().GetCount() ) { - // If we get back a null resource then we must be trying to drop after - // the last element, or there just plain aren't any in the toolbar. Re-fetch the last element - // (using the correct index) and add the new bookmark AFTER instead of before or just add - // it to the parent for the case of an empty toolbar - PRBool before = PR_TRUE; - HT_Resource dropOn = HT_GetNthItem( mToolbarView, URDFUtilities::PPRowToHTRow(inIndex) ); - if ( ! dropOn ) { - dropOn = HT_GetNthItem( mToolbarView, URDFUtilities::PPRowToHTRow(inIndex) - 1 ); - before = PR_FALSE; - } - HT_DropURLAndTitleAtPos ( dropOn, const_cast(inURL.c_str()), - const_cast(inTitle.c_str()), before ); - } // if items in toolbar - else - HT_DropURLAndTitleOn ( mToolbarRoot, const_cast(inURL.c_str()), - const_cast(inTitle.c_str()) ); - - // no need to tell toolbars to refresh because we will get an HT node added event and - // refresh at that time. - -} // Addbutton - - -// -// RemoveButton -// -// The user has explicitly removed a button from the toolbar in one of the windows (probably -// by dragging it to the trash). Tell all the other toolbars about it, remove it from our -// own bookkeeping list, then let RDF get rid of it. -// -void -CPersonalToolbarManager :: RemoveButton ( Uint32 inIndex ) -{ - CUserButtonInfo* deadBookmark; - GetButtons().FetchItemAt ( inIndex, &deadBookmark ); - - // remove it from RDF - HT_Resource deadNode = HT_GetNthItem ( GetHTView(), URDFUtilities::PPRowToHTRow(inIndex) ); - HT_RemoveChild ( mToolbarRoot, deadNode ); - - delete deadBookmark; - - // no need to tell toolbars to refresh because we will get an HT view update event and - // refresh at that time. - -} // RemoveButton - - -// -// RemoveToolbarButtons -// -// Clears out our own internal list of toolbar button information. -// -void -CPersonalToolbarManager :: RemoveToolbarButtons (void) -{ - mUserButtonInfoArray.RemoveItemsAt(mUserButtonInfoArray.GetCount(), LArray::index_First); - -} // RemoveToolbarButtons - - -#pragma mark -- Protected Utility Methods -/////////////////////////////////////////////////////////////////////////////////// -// CPersonalToolbarManager Helpers -/////////////////////////////////////////////////////////////////////////////////// - - -// -// InitializeButtonInfo -// -// Create our list of information for each bookmark that belongs in the toolbar. This -// involves iterating over the RDF data in the folder pre-selected to be the personal -// toolbar folder, compiling some info about it, and adding to an internal list which -// will be used by each toolbar to build their tables. -// -// ¥¥¥NOTE: this will put folders in the bar if they exist. Strange things may happen if the -// user clicks on them.... -// -void -CPersonalToolbarManager :: InitializeButtonInfo(void) -{ - HT_Cursor cursor = HT_NewCursor( mToolbarRoot ); - if ( cursor ) { - HT_Resource currNode = HT_GetNextItem(cursor); - while ( currNode ) { - CUserButtonInfo *info = new CUserButtonInfo ( HT_GetNodeName(currNode), HT_GetNodeURL(currNode), - 0, 0, HT_IsContainer(currNode)); - mUserButtonInfoArray.InsertItemsAt(1, LArray::index_Last, &info); - currNode = HT_GetNextItem(cursor); - } // for each top-level node - } - -} // InitializeButtonInfo - - -// -// HandleNotification -// -// Called when the user makes a change to the personal toolbar folder from some other -// place (like the bookmarks view). Reset our internal list and tell our listeners -// that things are now different. -// -void -CPersonalToolbarManager :: HandleNotification( - HT_Notification /*notifyStruct*/, - HT_Resource node, - HT_Event event) -{ - switch (event) - { - case HT_EVENT_NODE_ADDED: - case HT_EVENT_VIEW_REFRESH: - case HT_EVENT_NODE_VPROP_CHANGED: - { - // only update toolbar if the quickfile view changes - if ( HT_GetView(node) == mToolbarView ) - ToolbarChanged(); - break; - } - } -} - - -#pragma mark ¥¥ class CUserButtonInfo - -/////////////////////////////////////////////////////////////////////////////////// -// Class CUserButtonInfo -/////////////////////////////////////////////////////////////////////////////////// - -CUserButtonInfo::CUserButtonInfo( const string & pName, const string & pURL, Uint32 nBitmapID, - Uint32 nBitmapIndex, bool bIsFolder) -: mName(pName), mURL(pURL), mBitmapID(nBitmapID), mBitmapIndex(nBitmapIndex), - mIsResourceID(true), mIsFolder(bIsFolder) -{ -} - - -CUserButtonInfo::~CUserButtonInfo() -{ - // string destructor takes care of everything... -} - - - - diff --git a/mozilla/cmd/macfe/gui/CPersonalToolbarManager.h b/mozilla/cmd/macfe/gui/CPersonalToolbarManager.h deleted file mode 100644 index 0d25544b1c1..00000000000 --- a/mozilla/cmd/macfe/gui/CPersonalToolbarManager.h +++ /dev/null @@ -1,117 +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. - */ - -// -// CPersonalToolbarManager.h -// -// Interface to the class that manages all of the personal toolbars in browser windows. We -// need a central manager so that we can keep all the windows in sync when things change -// (say when the user adds a bookmark to one window). This reads all its info from RDF, -// not from the outdated BM UI. -// - -#pragma once - -#include -#include "htrdf.h" -#include "ntypes.h" -#include "CRDFNotificationHandler.h" - -class CPersonalToolbarTable; -class CBookmarksContext; - - -// -// CUserButtonInfo -// -class CUserButtonInfo -{ -public: - - CUserButtonInfo( const string & pName, const string & pURL, Uint32 nBitmapID, Uint32 nBitmapIndex, - bool bIsFolder); - ~CUserButtonInfo(); - - const string & GetName(void) const { return mName; } - const string & GetURL(void) const { return mURL; } - - bool IsResourceID(void) const { return mIsResourceID; } - Uint32 GetBitmapID(void) const { return mBitmapID; } - Uint32 GetBitmapIndex(void) const { return mBitmapIndex; } - bool IsFolder(void) const { return mIsFolder;} - -private: - const string mName; - const string mURL; - bool mIsResourceID; - Uint32 mBitmapID; - Uint32 mBitmapIndex; - string mBitmapFile; - bool mIsFolder; - -}; // CUserButtonInfo - - -// -// CPersonalToolbarManager -// -// Nothing really needs to be static because there will be only one of these and it -// can be easily accessed from a static variable in CFrontApp -// -class CPersonalToolbarManager : public LBroadcaster, public CRDFNotificationHandler -{ - public: - //--- some constants and messages - enum { kMinPersonalToolbarChars = 15, kMaxPersonalToolbarChars = 30 }; - enum MessageT { k_PTToolbarChanged = 'TbCh' } ; - - CPersonalToolbarManager ( ) ; - virtual ~CPersonalToolbarManager ( ) ; - - //--- create, add, delete, etc operations on the toolbars - void RegisterNewToolbar ( CPersonalToolbarTable* inBar ); - void ToolbarChanged(); - void AddButton ( HT_Resource inBookmark, Uint32 inIndex) ; - void AddButton ( const string & inURL, const string & inTitle, Uint32 inIndex ) ; - void RemoveButton ( Uint32 inIndex ); - - //--- utilities - Uint32 GetMaxToolbarButtonChars() const { return mMaxToolbarButtonChars; } - Uint32 GetMinToolbarButtonChars() const { return mMinToolbarButtonChars; } - void SetMaxToolbarButtonChars(Uint32 inNewMax) { mMaxToolbarButtonChars = inNewMax; } - void SetMinToolbarButtonChars(Uint32 inNewMin) { mMinToolbarButtonChars = inNewMin; } - - LArray & GetButtons ( ) { return mUserButtonInfoArray; } - HT_View GetHTView() const { return mToolbarView; } - - protected: - - HT_View mToolbarView; - HT_Resource mToolbarRoot; - Uint32 mMaxToolbarButtonChars; - Uint32 mMinToolbarButtonChars; - LArray mUserButtonInfoArray; - - static const char* kMaxButtonCharsPref; - static const char* kMinButtonCharsPref; - - void InitializeButtonInfo(); - void RemoveToolbarButtons(); - void HandleNotification( HT_Notification notifyStruct, HT_Resource node, HT_Event event); - -}; // CPersonalToolbarManager diff --git a/mozilla/cmd/macfe/gui/CPersonalToolbarTable.cp b/mozilla/cmd/macfe/gui/CPersonalToolbarTable.cp deleted file mode 100644 index e3e7aa3e748..00000000000 --- a/mozilla/cmd/macfe/gui/CPersonalToolbarTable.cp +++ /dev/null @@ -1,1230 +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. - */ - -// -// Implementation of the table that is the main component of the personal toolbar. -// - -#include -#include - -#include "CPersonalToolbarTable.h" -#include "CBrowserWindow.h" -#include "uapp.h" -#include "LTableMultiGeometry.h" -#include "CURLDragHelper.h" -#include "macutil.h" -#include "CIconTextDragTask.h" -#include "resgui.h" -#include "URDFUtilities.h" -#include "prefapi.h" -#include "miconutils.h" -#include "UMemoryMgr.h" - - -static const RGBColor blue = { 0, 0, 0xFFFF }; -static const RGBColor black = { 0, 0, 0 }; -static const RGBColor bgColor = { 0xDDDD, 0xDDDD, 0xDDDD }; - - -DragSendDataUPP CPersonalToolbarTable::sSendDataUPP; - -const char* CPersonalToolbarTable::kMaxButtonCharsPref = "browser.personal_toolbar_button.max_chars"; -const char* CPersonalToolbarTable::kMinButtonCharsPref = "browser.personal_toolbar_button.min_chars"; - -// init to something wacky so we can tell if they have been initialized already and avoid doing -// it again with every new toolbar -Uint32 CPersonalToolbarTable :: mMaxToolbarButtonChars = LArray::index_Last; -Uint32 CPersonalToolbarTable :: mMinToolbarButtonChars = LArray::index_Last; - - - - -CPersonalToolbarTable :: CPersonalToolbarTable ( LStream* inStream ) - : LSmallIconTable(inStream), LDragAndDrop ( GetMacPort(), this ), - mDropCol(LArray::index_Bad), mHiliteCol(LArray::index_Bad), mDropOn(false), mButtonList(NULL), - mIsInitialized(false), mInlineFeedbackOn(true) -{ - // setup our window into the RDF world and register this class as the one to be notified - // when the personal toolbar changes. - HT_Notification notifyStruct = CreateNotificationStruct(); - mToolbarPane = HT_NewPersonalToolbarPane(notifyStruct); - if ( !mToolbarPane ) - throw SomethingBadInHTException(); - mToolbarView = HT_GetSelectedView ( mToolbarPane ); - if ( !mToolbarView ) - throw SomethingBadInHTException(); - mToolbarRoot = HT_TopNode ( mToolbarView ); - if ( !mToolbarRoot ) - throw SomethingBadInHTException(); - HT_SetOpenState ( mToolbarRoot, PR_TRUE ); // ensure container is open so we can see its contents - - // read in the maximum size we're allowing for personal toolbar items. If not - // found in prefs, use our own. Only do this if the static members have not yet - // been initialized to prevent doing it with each new toolbar. - if ( mMaxToolbarButtonChars == LArray::index_Last ) { - int32 maxToolbarButtonChars, minToolbarButtonChars; - if ( PREF_GetIntPref(kMaxButtonCharsPref, &maxToolbarButtonChars ) == PREF_ERROR ) - mMaxToolbarButtonChars = kMaxPersonalToolbarChars; - else - mMaxToolbarButtonChars = maxToolbarButtonChars; - if ( PREF_GetIntPref(kMinButtonCharsPref, &minToolbarButtonChars ) == PREF_ERROR ) - mMinToolbarButtonChars = kMinPersonalToolbarChars; - else - mMinToolbarButtonChars = minToolbarButtonChars; - } - - // LSmallIconTable wants to use a LTableSingleGeometry, but since we want the toolbar - // to have variable column widths, replace it with a multiGeometry implementation - if ( mTableGeometry ) { - delete mTableGeometry; - mTableGeometry = new LTableMultiGeometry ( this, mFrameSize.width, 20 ); - } - -} // constructor - - -// -// Destructor -// -// Get rid of the button list. Since it is a list of objects, not pointers, we can just -// let the vector destructor handle everything. -// -CPersonalToolbarTable :: ~CPersonalToolbarTable ( ) -{ - delete mButtonList; - - if ( mToolbarPane ) { - // we don't want to know about any events while we're being deleted! - HT_SetNotificationMask ( mToolbarPane, HT_EVENT_NO_NOTIFICATION_MASK ); - HT_DeletePane ( mToolbarPane ); - } - -} // destructor - - -// -// FinishCreateSelf -// -// Makes sure there is one row to put stuff in and creates a drag send proc. -// -void -CPersonalToolbarTable :: FinishCreateSelf ( ) -{ - InsertRows ( 1, 1, NULL, 0, false ); - InitializeButtonInfo(); - - if ( !sSendDataUPP) { - sSendDataUPP = NewDragSendDataProc(LDropArea::HandleDragSendData); - ThrowIfNil_(sSendDataUPP); - } - - mIsInitialized = true; - -} // FinishCreateSelf - - -// -// InitializeButtonInfo -// -// Create our list of information for each bookmark that belongs in the toolbar. This -// involves iterating over the RDF data in the folder pre-selected to be the personal -// toolbar folder, compiling some info about it, and adding to an internal list. -// -// Why build into an internal list when HT already has it? The assumption is that users -// will be resizing windows more often than adding things to the personal toolbar. By -// keeping a list around, when the user resizes, we don't have to go back to HT for all -// this information but can keep it in our local list. Better still, this also allows us to have the -// routines that fill in the toolbar not rely directly on and will allow us to more easily -// rework the underlying toolbar infrastructure in the future. -// -void -CPersonalToolbarTable :: InitializeButtonInfo ( ) -{ - delete mButtonList; - mButtonList = new ButtonList( HT_GetItemListCount(GetHTView()) ); - ButtonListIterator currButton = mButtonList->begin(); - - HT_Cursor cursor = HT_NewCursor( mToolbarRoot ); - if ( cursor ) { - HT_Resource currNode = HT_GetNextItem(cursor); - while ( currNode ) { - CUserButtonInfo info ( HT_GetNodeName(currNode), HT_GetNodeURL(currNode), - 0, 0, HT_IsContainer(currNode), currNode); - *currButton = info; - currNode = HT_GetNextItem(cursor); - currButton++; - - } // for each top-level node - } - -} // InitializeButtonInfo - - -// -// HandleNotification -// -// Called when the user makes a change to the personal toolbar folder from some other -// place (like the bookmarks view). Reset our internal list and tell our listeners -// that things are now different. -// -void -CPersonalToolbarTable :: HandleNotification( - HT_Notification /*notifyStruct*/, - HT_Resource node, - HT_Event event, - void* token, - uint32 tokenType) -{ - switch (event) - { - case HT_EVENT_NODE_ADDED: - case HT_EVENT_VIEW_REFRESH: // catches deletes - case HT_EVENT_NODE_VPROP_CHANGED: - { - // only update toolbar if the this view is the one that changed - if ( HT_GetView(node) == GetHTView() ) - ToolbarChanged(); - break; - } - } -} - - -// -// ToolbarChanged -// -// The user has just made some change to the toolbar, such as manipulating items in the nav center -// or changing the personal toolbar folder. Since these changes could be quite extensive, we -// just clear out the whole thing and start afresh. Tell all the toolbars that they have to -// clear themselves and grab the new information. Changes to the toolbar directly, such as by -// drag and drop, are handled elsewhere. -// -void -CPersonalToolbarTable :: ToolbarChanged ( ) -{ - if ( mCols ) - RemoveCols ( mCols, 1, false ); - InitializeButtonInfo(); // out with the old... - FillInToolbar(); // ...in with the new - -} // ToolbarHeaderChanged - - -// -// RemoveButton -// -// The user has explicitly removed a button from the toolbar in one of the windows (probably -// by dragging it to the trash). Let HT get rid of it. -// -void -CPersonalToolbarTable :: RemoveButton ( Uint32 inIndex ) -{ - // remove it from HT - HT_Resource deadNode = HT_GetNthItem ( GetHTView(), URDFUtilities::PPRowToHTRow(inIndex) ); - HT_RemoveChild ( mToolbarRoot, deadNode ); - - // no need to refresh because we will get an HT view update event and - // refresh at that time. The deleted node will also be removed from the list as it is - // rebuilt. - -} // RemoveButton - - -// -// AddButton -// -// Given a pre-created HT item, add it to the personal toolbar folder before the -// given id and tell all the toolbars to update. This is called when the user -// drops an item from another RDF source on a personal toolbar -// -void -CPersonalToolbarTable :: AddButton ( HT_Resource inBookmark, Uint32 inIndex ) -{ - // Add this to RDF. - if ( mButtonList->size() ) { - // If we get back a null resource then we must be trying to drop after - // the last element, or there just plain aren't any in the toolbar. Re-fetch the last element - // (using the correct index) and add the new bookmark AFTER instead of before or just add - // it to the parent for the case of an empty toolbar - PRBool before = PR_TRUE; - HT_Resource dropOn = NULL; - if ( inIndex <= mButtonList->size() ) - dropOn = GetInfoForPPColumn(inIndex).GetHTResource(); - else { - dropOn = (*mButtonList)[mButtonList->size() - 1].GetHTResource(); - before = PR_FALSE; - } - HT_DropHTRAtPos ( dropOn, inBookmark, before ); - } // if items in toolbar - else - HT_DropHTROn ( mToolbarRoot, inBookmark ); - - // no need to tell toolbars to refresh because we will get an HT node added event and - // refresh at that time. - -} // Addbutton - - -// -// AddButton -// -// Given just a URL, add it to the personal toolbar folder before the -// given id and tell all the toolbars to update. This is called when the user -// drops an item from another RDF source on a personal toolbar -// -void -CPersonalToolbarTable :: AddButton ( const string & inURL, const string & inTitle, Uint32 inIndex ) -{ - // Add this to RDF. - if ( mButtonList->size() ) { - // If we get back a null resource then we must be trying to drop after - // the last element, or there just plain aren't any in the toolbar. Re-fetch the last element - // (using the correct index) and add the new bookmark AFTER instead of before or just add - // it to the parent for the case of an empty toolbar - PRBool before = PR_TRUE; - HT_Resource dropOn = NULL; - if ( inIndex <= mButtonList->size() ) - dropOn = GetInfoForPPColumn(inIndex).GetHTResource(); - else { - dropOn = (*mButtonList)[mButtonList->size() - 1].GetHTResource(); - before = PR_FALSE; - } - HT_DropURLAndTitleAtPos ( dropOn, const_cast(inURL.c_str()), - const_cast(inTitle.c_str()), before ); - } // if items in toolbar - else - HT_DropURLAndTitleOn ( mToolbarRoot, const_cast(inURL.c_str()), - const_cast(inTitle.c_str()) ); - - // no need to tell toolbars to refresh because we will get an HT node added event and - // refresh at that time. - -} // Addbutton - - -// -// FillInToolbar -// -// Add rows to the table and try to give each column as much space as possible on the fly. -// Don't make any assumptions about the incoming text mode...be paranoid! -// -void -CPersonalToolbarTable :: FillInToolbar ( ) -{ - const Uint32 kPadRight = 15; - const Uint32 kBMIconWidth = 28; - const Uint32 kButtonCount = mButtonList->size(); - const Uint32 kMaxLength = GetMaxToolbarButtonChars(); - const Uint32 kMinLength = GetMinToolbarButtonChars(); - - StTextState saved; - UTextTraits::SetPortTextTraits(kTextTraitsID); - - // - // create an array that holds the # of characters currently in each column. Initialize this with - // the min column size (specified in prefs), or less if the title has less chars. - // - vector widthArray(kButtonCount); - vector::iterator widthArrayIter = widthArray.begin(); - Uint16 totalWidth = 0; - for ( ButtonListConstIterator it = mButtonList->begin(); it != mButtonList->end(); it++ ) { - - Uint16 numChars = min ( kMinLength, it->GetName().length() ); - *widthArrayIter = numChars; - totalWidth += ::TextWidth(it->GetName().c_str(), 0, numChars) + kBMIconWidth; // extend the total... - widthArrayIter++; - - } // initialize each item - - - if ( mCols > kButtonCount ) - RemoveRows ( mCols - kButtonCount, 0, false ); - else - InsertCols ( kButtonCount - mCols, 0, NULL, 0, false ); - - // compute how much room we have left to divvy out after divvying out the minimum above. Leave - // a few pixels on the right empty... - int16 emptySpace = (mFrameSize.width - kPadRight) - totalWidth; - - // - // divvy out space to each column, one character at a time to each column - // - while ( emptySpace > 0 ) { - - bool updated = false; - widthArrayIter = widthArray.begin(); - for ( ButtonListConstIterator it = mButtonList->begin(); it != mButtonList->end(); it++, widthArrayIter++ ) { - if ( emptySpace && *widthArrayIter < it->GetName().length() && *widthArrayIter < kMaxLength ) { - // subtract off the single character we're adding to the column - char addedChar = it->GetName()[*widthArrayIter]; - emptySpace -= ::TextWidth(&addedChar, 0, 1); - (*widthArrayIter)++; - updated = true; // we found something to add, allow us to continue - } - } // for each column - - // prevent infinite looping if no column can be expanded and we still have extra room remaining - if ( !updated ) - break; - - } // while space remains to divvy out - - // - // assign the widths to the columns and set the data in the columns. - // - STableCell where (1, 1); - widthArrayIter = widthArray.begin(); - for ( ButtonListConstIterator it = mButtonList->begin(); it != mButtonList->end(); it++ ) { - - const string & bmText = it->GetName(); - Uint32 textLength = bmText.length(); - - // - // fill in the cell with the name of the bookmark and set the column width to - // the width of the string. If the name is longer than the max, chop it. - // - SIconTableRec data; - Uint16 dispLength = *widthArrayIter; - ::BlockMove ( bmText.c_str(), &data.name[1], dispLength + 1 ); - data.name[0] = dispLength <= kMaxLength ? dispLength : kMaxLength; - data.iconID = it->IsFolder() ? kFOLDER_ICON : kBOOKMARK_ICON; - SetCellData ( where, &data, sizeof(SIconTableRec) ); - Uint32 pixelWidth = ::TextWidth(bmText.c_str(), 0, dispLength)+ kBMIconWidth; - mTableGeometry->SetColWidth ( pixelWidth, where.col, where.col ); - - widthArrayIter++; - where.col++; // next column, please.... - - } // for each bookmark in the folder - - Refresh(); - -} // FillInToolbar - - -// -// MouseLeave -// -// Called when the mouse leaves the personal toolbar. Redraw the previous selection to get rid -// of the blue text color. -// -void -CPersonalToolbarTable :: MouseLeave ( ) -{ - if ( !IsActive() ) - return; - - STableCell refresh(1, mHiliteCol); - mHiliteCol = LArray::index_Bad; - - StClipRgnState savedClip; - FocusDraw(); - RedrawCellWithTextClipping ( refresh ); - -} // MouseLeave - - -// -// MouseWithin -// -// Called while the mouse moves w/in the personal toolbar. Find which cell the mouse is -// currently over and remember it. If we've moved to a different cell, make sure to -// refresh the old one so it is drawn normally. -// -void -CPersonalToolbarTable :: MouseWithin ( Point inPortPt, const EventRecord& ) -{ - if ( !IsActive() ) - return; - - // get the previous selection - STableCell old(1, mHiliteCol); - SPoint32 imagePt; - PortToLocalPoint(inPortPt); - LocalToImagePoint(inPortPt, imagePt); - - STableCell hitCell; - if ( GetCellHitBy(imagePt, hitCell) ) - if ( old != hitCell ) { - StClipRgnState savedClip; - - mHiliteCol = hitCell.col; - - FocusDraw(); - if ( old.col ) - RedrawCellWithTextClipping(old); - if ( hitCell.col ) - RedrawCellWithTextClipping(hitCell); - - ExecuteAttachments(msg_HideTooltip, this); // hide tooltip - } - -} // MouseWithin - - -// -// Click -// -// Allow drags to occur when another window is in front of us. -// -void -CPersonalToolbarTable :: Click ( SMouseDownEvent& inMouseDown ) -{ - PortToLocalPoint(inMouseDown.whereLocal); - UpdateClickCount(inMouseDown); - - if (ExecuteAttachments(msg_Click, &inMouseDown)) - { - ClickSelf(inMouseDown); - } -} - - -#if 0 -// -// Click -// -// Overridden to handle clase of drag and drop when communicator is in the background. Code -// copied from CWPro1 CD sample code (CDragAndDropTable.cp). -// -// FOR SOME REASON, THIS DOESN'T WORK....DUNNO WHY... -void -CPersonalToolbarTable :: Click ( SMouseDownEvent& inMouseDown ) -{ - if ( inMouseDown.delaySelect && DragAndDropIsPresent() ) { - - // In order to support dragging from an inactive window, - // we must explicitly test for delaySelect and the - // presence of Drag and Drop. - - // Convert to a local point. - PortToLocalPoint( inMouseDown.whereLocal ); - - // Execute click attachments. - if ( ExecuteAttachments( msg_Click, &inMouseDown ) ) { - - // Handle the actual click event. - ClickSelf( inMouseDown ); - - } - - } else { - - // Call inherited for default behavior. - LTableView::Click( inMouseDown ); - - } - -} // Click -#endif - - -// -// ClickSelect -// -// Override to always say that we can be selected, because there is no concept of selection -// in this toolbar. -Boolean -CPersonalToolbarTable :: ClickSelect( const STableCell &/*inCell*/, const SMouseDownEvent &/*inMouseDown*/) -{ - return true; -} - - -// -// ClickCell -// -// Override the default behavior of selecting a cell to open the url associated with the bookmark -// there. -// -void -CPersonalToolbarTable :: ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown) -{ - if ( inCell.col > mCols ) - return; - - if ( ::WaitMouseMoved(inMouseDown.macEvent.where) ) { - - if (LDropArea::DragAndDropIsPresent()) { - - mDraggedCell = inCell; // save which cell is being dragged for later - - // create the drag task - Rect bounds; - GetLocalCellRect ( inCell, bounds ); - const CUserButtonInfo & data = GetInfoForPPColumn(inCell.col); - string finalCaption = CURLDragHelper::MakeIconTextValid ( data.GetName().c_str() ); - CIconTextSuite suite ( this, bounds, kBOOKMARK_ICON, finalCaption, data.GetHTResource() ); - CIconTextDragTask theTask(inMouseDown.macEvent, &suite, bounds); - - // setup our special data transfer proc called upon drag completion - OSErr theErr = ::SetDragSendProc ( theTask.GetDragReference(), sSendDataUPP, (LDropArea*) this ); - ThrowIfOSErr_(theErr); - - theTask.DoDrag(); - - // remove the url if it went into the trash - if ( theTask.DropLocationIsFinderTrash() ) - RemoveButton ( inCell.col ); - - } // if d&d allowed - - } // if drag - else { - - const CUserButtonInfo & data = GetInfoForPPColumn(inCell.col); - - // code for context menu here, if appropriate.... - - if ( data.IsFolder() ) { - // TEMP CODE (pinkerton) - // Ignores HT's placement hints....just used for testing - - // convert local to port coords for this cell - Rect bounds; - GetLocalCellRect ( inCell, bounds ); - Rect portRect = LocalToPortRect ( this, bounds ); - - // find the Browser window and tell it to show a popdown with - // the give HT_Resource for this cell - LView* top=GetSuperView(); - while ( top->GetSuperView() ) - top = top->GetSuperView(); - - // popdown the tree - CBrowserWindow* browser = dynamic_cast(top); - Assert_(browser != NULL); - if ( browser ) { - if ( inMouseDown.macEvent.modifiers & shiftKey ) - browser->OpenDockedTreeView ( data.GetHTResource() ); - else if ( inMouseDown.macEvent.modifiers & optionKey ) - LCommander::GetTopCommander()->ProcessCommand(cmd_NCOpenNewWindow, data.GetHTResource() ); - else - browser->PopDownTreeView ( portRect.left, portRect.bottom + 5, data.GetHTResource() ); - } - } - else { - if ( !URDFUtilities::LaunchNode(data.GetHTResource()) ) - CFrontApp::DoGetURL( data.GetURL().c_str() ); - } - - } // else just a click - -} // ClickCell - - -// -// RedrawCellWithHilite -// -// A helpful utility routine that wraps DrawCell() with calls to setup the drawing params -// appropriately. When redrawing a cell during a drag and drop, call this routine instead -// of calling DrawCell directly. -// -void -CPersonalToolbarTable :: RedrawCellWithHilite ( const STableCell inCell, bool inHiliteOn ) -{ - if ( inCell.col == LArray::index_Bad ) - return; - - Rect localCellRect; - GetLocalCellRect ( inCell, localCellRect ); - - // since mDropOn is used as the flag in DrawCell() for whether or not we want to - // draw the hiliting on the cell, save its value and set it to what was passed in - // before calling DrawCell(). - StValueChanger oldHilite(mDropOn, inHiliteOn); - - // if the hiliting is being turned off, erase the cell so it draws normally again - if ( !inHiliteOn ) { - StColorState saved; - ::RGBBackColor(&bgColor); - ::EraseRect(&mTextHiliteRect); // we can be sure this has been previously computed - } - - DrawCell ( inCell, localCellRect ); - -} // RedrawCellWithHilite - - -// -// DrawCell -// -// Override to draw differently when this is the selected cell and for drop feedback -// during a drop on a folder. -// -void -CPersonalToolbarTable :: DrawCell ( const STableCell &inCell, const Rect &inLocalRect ) -{ - StTextState savedText; - StColorPenState savedColor; - ::RGBForeColor(&black); - - SIconTableRec iconAndName; - Uint32 dataSize = sizeof(SIconTableRec); - GetCellData(inCell, &iconAndName, dataSize); - - Rect iconRect; - iconRect.left = inLocalRect.left + 3; - iconRect.right = iconRect.left + 16; - iconRect.bottom = inLocalRect.bottom - 2; - iconRect.top = iconRect.bottom - 16; - IconTransformType transform = kTransformNone; - if ( mDropOn && inCell.col == mDropCol ) // handle drop on folder - transform = kTransformSelected; - ::PlotIconID(&iconRect, atNone, transform, iconAndName.iconID); - - UTextTraits::SetPortTextTraits(kTextTraitsID); - - if ( mDropOn && inCell.col == mDropCol ) { // handle drop on folder - mTextHiliteRect = ComputeTextRect ( iconAndName, inLocalRect ); - StColorState savedColorForTextDrawing; - ::RGBBackColor(&black); - ::EraseRect(&mTextHiliteRect); - ::TextMode(srcXor); - } - else if ( mHiliteCol == inCell.col ) { - TextFace(underline); - RGBForeColor( &blue ); - } - ::MoveTo(inLocalRect.left + 22, inLocalRect.bottom - 4); - ::DrawString(iconAndName.name); - -} // DrawCell - - -// -// DoDragSendData -// -// When the drag started, the ClickCell() routine cached which cell was the start of the drag in -// |mDraggedCell|. Extract the URL and Title from this cell and pass it along to the helper -// routine from CURLDragHelper -// -void -CPersonalToolbarTable :: DoDragSendData( FlavorType inFlavor, ItemReference inItemRef, - DragReference inDragRef) -{ - const CUserButtonInfo & dragged = GetInfoForPPColumn ( mDraggedCell.col ); - CURLDragHelper::DoDragSendData ( dragged.GetURL().c_str(), - const_cast(dragged.GetName().c_str()), - inFlavor, inItemRef, inDragRef ); - -} // DoDragSendData - - -// -// HiliteDropArea -// -// Show that this toolbar is a drop site for urls, but only if there aren't any items -// in the bar already. If there are, the drop feedback should take care of it. -// -void -CPersonalToolbarTable :: HiliteDropArea ( DragReference inDragRef ) -{ - if ( mCols && mInlineFeedbackOn ) // let in-line drop feedback do the job - return; - - Rect frame; - CalcLocalFrameRect ( frame ); - - // show the drag hilite in drop area - try { - StRegion rgn; - ::RectRgn ( rgn, &frame ); - ::ShowDragHilite ( inDragRef, rgn, true ); - } - catch ( ... ) { } - -} // HiliteDropArea - - -// -// InsideDropArea -// -// Called repeatedly while mouse is inside this during a drag. For each column, the cell -// can be divided into several sections. -// -void -CPersonalToolbarTable :: InsideDropArea ( DragReference inDragRef ) -{ - FocusDraw(); - -#if 0 - // If the container is sorted, don't let the user drop in any given location. Just - // hilight the entire area - //¥¥¥can't do this here, else you won't be able to drop on folders! - if ( ! HT_ContainerSupportsNaturalOrderSort(HT_TopNode(GetHTView())) ) { - StValueChanger old ( mInlineFeedbackOn, false ); - HiliteDropArea(inDragRef); - return; - } // if container is sorted -#endif - - Point mouseLoc; - SPoint32 imagePt; - ::GetDragMouse(inDragRef, &mouseLoc, NULL); - ::GlobalToLocal(&mouseLoc); - LocalToImagePoint(mouseLoc, imagePt); - - Rect localRect; - TableIndexT colMouseIsOver = mTableGeometry->GetColHitBy(imagePt); - GetLocalCellRect ( STableCell(1, colMouseIsOver), localRect ); - TableIndexT newDropCol; - bool newDropOn = false; - if ( colMouseIsOver <= mCols ) { - const CUserButtonInfo & info = GetInfoForPPColumn(colMouseIsOver); - if ( info.IsFolder() ) { - Rect leftSide, rightSide; - ComputeFolderDropAreas ( localRect, leftSide, rightSide ); - if ( ::PtInRect(mouseLoc, &leftSide) ) - newDropCol = colMouseIsOver; // before this cell - else if ( ::PtInRect(mouseLoc, &rightSide) ) - newDropCol = colMouseIsOver + 1; // after this cell - else { - newDropCol = colMouseIsOver; - newDropOn = true; // hilite folder, don't draw line - } - } - else { - // draw line between rows - Rect leftSide, rightSide; - ComputeItemDropAreas ( localRect, leftSide, rightSide ); - if ( ::PtInRect(mouseLoc, &leftSide) ) - newDropCol = colMouseIsOver; // before this cell - else - newDropCol = colMouseIsOver + 1; // after this cell - } - } // if drag over existing column - else { - // else drag over empty part of toolbar - newDropCol = mCols + 1; - } - - // we now know where the drop SHOULD go, now check if it CAN go there - HT_Resource targetNode = NULL; - if ( newDropOn ) { - const CUserButtonInfo & info = GetInfoForPPColumn(newDropCol); - targetNode = info.GetHTResource(); - } - else - targetNode = HT_TopNode(GetHTView()); - mCanAcceptCurrentDrag = NodeCanAcceptDrop ( inDragRef, targetNode ); - if ( !mCanAcceptCurrentDrag ) { - newDropOn = false; - newDropCol = LArray::index_Bad; - } - - // if something has changed, redraw as necessary - if ( newDropCol != mDropCol || newDropOn != mDropOn ) { - - // unhilight old one (if necessary) - if ( mDropOn ) - RedrawCellWithHilite( STableCell(1, mDropCol), false ); - else - if ( mDropCol > 0 ) - DrawDividingLine ( mDropCol ); - - mDropCol = newDropCol; - mDropOn = newDropOn; - - // hilight new one - if ( newDropOn ) { - RedrawCellWithHilite ( STableCell(1, newDropCol), true ); - - const CUserButtonInfo & info = GetInfoForPPColumn(newDropCol); - - // TEMP CODE (pinkerton) - // Ignores HT's placement hints....just used for testing - - // convert local to port coords for this cell - Rect bounds; - GetLocalCellRect ( STableCell(1, newDropCol), bounds ); - Rect portRect = LocalToPortRect ( this, bounds ); - - // find the Browser window and tell it to show a popdown with - // the give HT_Resource for this cell - LView* top=GetSuperView(); - while ( top->GetSuperView() ) - top = top->GetSuperView(); - - // popdown the tree - CBrowserWindow* browser = dynamic_cast(top); - Assert_(browser != NULL); - if ( browser ) - browser->PopDownTreeView ( portRect.left, portRect.bottom + 5, info.GetHTResource() ); - - } - else - DrawDividingLine ( newDropCol ); - - } // if mouse moved to another drop location - -} // InsideDropArea - - -// -// LeaveDropArea -// -// Clean up the drop feedback stuff when the mouse leaves the area -// -void -CPersonalToolbarTable :: LeaveDropArea( DragReference inDragRef ) -{ - FocusDraw(); - - // if we were hiliting a folder, redraw it without the hiliting. If we were drawing a - // line, undraw it. - if ( mDropOn ) - RedrawCellWithHilite ( STableCell(1,mDropCol), false ); - else - DrawDividingLine( mDropCol ); - - mDropCol = LArray::index_Bad; - mDropOn = false; - - // Call inherited. - LDragAndDrop::LeaveDropArea( inDragRef ); -} - - -// -// ComputeItemDropAreas -// -// When a drag goes over a cell that contains a single node, divide the node in half. The left -// side will represent dropping before the node, the right side after. -// -void -CPersonalToolbarTable :: ComputeItemDropAreas ( const Rect & inLocalCellRect, Rect & oLeftSide, - Rect & oRightSide ) -{ - oRightSide = oLeftSide = inLocalCellRect; - uint16 midPt = (oLeftSide.right - oLeftSide.left) / 2; - oLeftSide.right = oLeftSide.left + midPt; - oRightSide.left = oLeftSide.left + midPt + 1; - -} // ComputeItemDropAreas - - -// -// ComputeFolderDropAreas -// -// When a drag goes over a cell that contains a folder, divide the cell area into 3 parts. The middle -// area, which corresponds to a drop on the folder takes up the majority of the cell space with the -// left and right areas (corresponding to drop before and drop after, respectively) taking up the rest -// at the ends. -// -void -CPersonalToolbarTable :: ComputeFolderDropAreas ( const Rect & inLocalCellRect, Rect & oLeftSide, - Rect & oRightSide ) -{ - // make sure the left/right area widths aren't too big for the cell - Uint16 endAreaWidth = 20; - if ( inLocalCellRect.right - inLocalCellRect.left < 50 ) - endAreaWidth = 5; - - oRightSide = oLeftSide = inLocalCellRect; - oLeftSide.right = oLeftSide.left + endAreaWidth; - oRightSide.left = oRightSide.right - endAreaWidth; - -} // ComputeFolderDropAreas - - -// -// DrawDividingLine -// -// Draws a vertical black line before the given column in the toolbar (or undraws if one -// is already there). If the column given is after the right edge of the last column, it -// draws after the last column (as the user expects). -// -void -CPersonalToolbarTable :: DrawDividingLine( TableIndexT inCol ) -{ - if ( inCol == LArray::index_Bad ) - return; - - Uint32 numItems = mButtonList->size(); - if ( !numItems ) // don't draw anything if toolbar empty - return; - - // Setup the target cell. - STableCell theCell; - theCell.row = 1; - theCell.col = inCol; - - // find the boundary of the cell we're supposed to be drawing the line before. If - // the incoming column is at the end (greater than the # of buttons) then hack up - // a boundary rect to draw after the last column. - Rect cellBounds; - if ( inCol > numItems ) { - // get the boundary of the last column - theCell.col = numItems; - GetLocalCellRect ( theCell, cellBounds ); - - // make the left edge of our fake column the right edge of the last column - cellBounds.left = cellBounds.right; - } - else - GetLocalCellRect ( theCell, cellBounds ); - - // Focus the pane and get the table and cell frames. - Rect theFrame; - if ( FocusDraw() && CalcLocalFrameRect( theFrame ) ) { - - // Save the draw state and clip the list view rect. - StColorPenState theDrawState; - StColorState::Normalize(); - StClipRgnState theClipState( theFrame ); - - // Setup the color and pen state then draw the line - ::PenMode( patXor ); - ::PenSize( 2, 2 ); - ::MoveTo( cellBounds.left, cellBounds.top ); - ::LineTo( cellBounds.left, cellBounds.bottom ); - - } - -} // DrawDividingLine - - -// -// ReceiveDragItem -// -// Pass this along to the implementation in CHTAwareURLDragMixin. -// -void -CPersonalToolbarTable :: ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) -{ - CHTAwareURLDragMixin::ReceiveDragItem(inDragRef, inDragAttrs, inItemRef, inItemBounds ); - -} // ReceiveDragItem - - -// -// ItemIsAcceptable -// -// Determine if the current item can be dropped in this pane. Check to see if the -// pane as a whole accepts drops (history, for example, will not). The data, at this -// point, is fairly moot and will be checked in RowCanAcceptDrop*() routines. -// -// -Boolean -CPersonalToolbarTable :: ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) -{ - FlavorType ignored; - - bool paneAllowsDrop = HT_CanDropURLOn ( HT_TopNode(GetHTView()), "http://foo.com" ); - bool acceptableFlavorFound = FindBestFlavor ( inDragRef, inItemRef, ignored ); - - return paneAllowsDrop && acceptableFlavorFound; - -} // ItemIsAcceptable - - -// -// HandleDropOfHTResource -// -// Called when the user drops an HT_Resource from some other HT aware view on the -// personal toolbar. Add a button for this new item. -// -void -CPersonalToolbarTable :: HandleDropOfHTResource ( HT_Resource inDropNode ) -{ - if ( mDropOn ) { - SysBeep(1); //¥¥¥ implement - } - else - AddButton ( inDropNode, mDropCol ); - -} // HandleDropOfHTResource - - -// -// HandleDropOfPageProxy -// -// Called when user drops the page proxy icon (or an embedded url) onto the personal -// toolbar. Add a button for this new item. -// -void -CPersonalToolbarTable :: HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) -{ - if ( mDropOn ) { - SysBeep(1); //¥¥¥ implement - } - else - AddButton ( inURL, inTitle, mDropCol ); - -} // HandleDropOfPageProxy - - -// -// HandleDropOfLocalFile -// -// A local file is just an url and a title, so cheat. -// -void -CPersonalToolbarTable :: HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & /*inFileData*/ ) -{ - HandleDropOfPageProxy ( inFileURL, fileName ); - -} // HandleDropOfLocalFile - - -// -// HandleDropOfText -// -// Need to implement -// -void -CPersonalToolbarTable :: HandleDropOfText ( const char* inTextData ) -{ - DebugStr("\pDropping TEXT here not implemented; g"); - -} // HandleDropOfText - - -void -CPersonalToolbarTable :: FindTooltipForMouseLocation ( const EventRecord& inMacEvent, - StringPtr outTip ) -{ - Point temp = inMacEvent.where; - SPoint32 where; - GlobalToPortPoint(temp); - PortToLocalPoint(temp); - LocalToImagePoint(temp, where); - - STableCell hitCell; - if ( GetCellHitBy(where, hitCell) && hitCell.col <= mCols ) { - const CUserButtonInfo & bkmk = GetInfoForPPColumn(hitCell.col); - outTip[0] = bkmk.GetName().length(); - strcpy ( (char*) &outTip[1], bkmk.GetName().c_str() ); - } - else - ::GetIndString ( outTip, 10506, 12); // supply a helpful message... - -} // FindTooltipForMouseLocation - - -void -CPersonalToolbarTable :: ResizeFrameBy ( Int16 inWidth, Int16 inHeight, Boolean inRefresh ) -{ - LSmallIconTable::ResizeFrameBy(inWidth, inHeight, inRefresh); - - // don't call ToolbarChanged() because that will reload from HT. Nothing has really - // changed except for the width of the toolbar. Checking if we've gone through - // FinishCreateSelf() will cut down on the number of times we recompute the toolbar - // as the window is being created. - if ( mIsInitialized ) - FillInToolbar(); - -} // ResizeFrameTo - - -// -// ComputeTextRect -// -// Compute the area of the text rectangle so we can clip to it on redraw -// -Rect -CPersonalToolbarTable :: ComputeTextRect ( const SIconTableRec & inText, const Rect & inLocalRect ) -{ - Rect textRect; - - uint16 width = ::TextWidth(inText.name, 1, *inText.name); - textRect.left = inLocalRect.left + 20; - textRect.right = textRect.left + width + 2; - textRect.bottom = inLocalRect.bottom - 1; - textRect.top = inLocalRect.top + 1; - - return textRect; - -} // ComputeTextRect - - -// -// RedrawCellWithTextClipping -// -// A pretty way to redraw the cell because it won't flash. This sets the clip region to the -// text that needs to be redrawn so it looks fast to the user. -// -// NOTE: This blows away the current clip region so if you care, you must restore it afterwards. I -// don't do it here because you may want to make a couple of these calls in a row and restoring the -// clip rect in between would be a waste. It also blows away the background color. -// -void -CPersonalToolbarTable :: RedrawCellWithTextClipping ( const STableCell & inCell ) -{ - StTextState savedText; - SIconTableRec iconAndName; - Rect localRect; - - UTextTraits::SetPortTextTraits(kTextTraitsID); - - Uint32 dataSize = sizeof(SIconTableRec); - GetCellData(inCell, &iconAndName, dataSize); - GetLocalCellRect ( inCell, localRect ); - Rect textRect = ComputeTextRect(iconAndName,localRect); - ::ClipRect(&textRect); - ::RGBBackColor(&bgColor); - ::EraseRect(&textRect); - DrawCell(inCell, localRect); - -} // RedrawCellWithTextClipping - - -// -// GetInfoForPPColumn -// -// Given a column in a powerplant table, this returns a reference to the appropriate CUserButtonInfo -// class for that column. -inline const CUserButtonInfo & -CPersonalToolbarTable :: GetInfoForPPColumn ( const TableIndexT & inCol ) const -{ - // recall PP is 1-based and HT (and vectors) are 0 based, so do the conversion first - return (*mButtonList)[URDFUtilities::PPRowToHTRow(inCol)]; - -} // GetInfoForPPColumn - - -#pragma mark - - -/////////////////////////////////////////////////////////////////////////////////// -// Class CUserButtonInfo -/////////////////////////////////////////////////////////////////////////////////// - -CUserButtonInfo::CUserButtonInfo( const string & pName, const string & pURL, Uint32 nBitmapID, - Uint32 nBitmapIndex, bool bIsFolder, HT_Resource inRes ) - : mName(pName), mURL(pURL), mBitmapID(nBitmapID), mBitmapIndex(nBitmapIndex), - mIsResourceID(true), mIsFolder(bIsFolder), mResource(inRes) -{ -} - - -CUserButtonInfo :: CUserButtonInfo ( ) - : mBitmapID(0), mBitmapIndex(0), mIsResourceID(false), mIsFolder(false), mResource(NULL) -{ - -} - - -CUserButtonInfo::~CUserButtonInfo() -{ - // string destructor takes care of everything... -} - diff --git a/mozilla/cmd/macfe/gui/CPersonalToolbarTable.h b/mozilla/cmd/macfe/gui/CPersonalToolbarTable.h deleted file mode 100644 index a920702d221..00000000000 --- a/mozilla/cmd/macfe/gui/CPersonalToolbarTable.h +++ /dev/null @@ -1,173 +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. - */ - -// -// Interface for the table that is the main component of the personal toolbar. -// - -#pragma once - -#include - -#include -#include "ntypes.h" -#include "CDynamicTooltips.h" -#include "CURLDragHelper.h" -#include "CRDFNotificationHandler.h" - - -// -// CUserButtonInfo -// -class CUserButtonInfo -{ -public: - - CUserButtonInfo( const string & pName, const string & pURL, Uint32 nBitmapID, Uint32 nBitmapIndex, - bool bIsFolder, HT_Resource inRes ); - CUserButtonInfo ( ) ; - ~CUserButtonInfo(); - - const string & GetName(void) const { return mName; } - const string & GetURL(void) const { return mURL; } - HT_Resource GetHTResource() const { return mResource; } - - bool IsResourceID(void) const { return mIsResourceID; } - Uint32 GetBitmapID(void) const { return mBitmapID; } - Uint32 GetBitmapIndex(void) const { return mBitmapIndex; } - bool IsFolder(void) const { return mIsFolder;} - -private: - string mName; - string mURL; - bool mIsResourceID; - Uint32 mBitmapID; - Uint32 mBitmapIndex; - string mBitmapFile; - bool mIsFolder; - HT_Resource mResource; - -}; // CUserButtonInfo - - -class CPersonalToolbarTable : public LSmallIconTable, public LDragAndDrop, - public CDynamicTooltipMixin, public CHTAwareURLDragMixin, - public CRDFNotificationHandler -{ - public: - - enum { class_ID = 'PerT', kTextTraitsID = 130 }; - enum { kBOOKMARK_ICON = 15313, kFOLDER_ICON = -3999 }; - enum { kMinPersonalToolbarChars = 15, kMaxPersonalToolbarChars = 30 }; - - CPersonalToolbarTable ( LStream* inStream ) ; - virtual ~CPersonalToolbarTable ( ) ; - - // calculate tooltip to display url text for the item mouse is over - virtual void FindTooltipForMouseLocation ( const EventRecord& inMacEvent, - StringPtr outTip ); - - protected: - - class SomethingBadInHTException { } ; - - typedef vector ButtonList; - typedef ButtonList::iterator ButtonListIterator; - typedef ButtonList::const_iterator ButtonListConstIterator; - - virtual void FillInToolbar ( ) ; - void InitializeButtonInfo ( ) ; - void ToolbarChanged ( ) ; - - //--- utilities - Uint32 GetMaxToolbarButtonChars() const { return mMaxToolbarButtonChars; } - Uint32 GetMinToolbarButtonChars() const { return mMinToolbarButtonChars; } - void SetMaxToolbarButtonChars(Uint32 inNewMax) { mMaxToolbarButtonChars = inNewMax; } - void SetMinToolbarButtonChars(Uint32 inNewMin) { mMinToolbarButtonChars = inNewMin; } - HT_View GetHTView ( ) const { return mToolbarView; } - const CUserButtonInfo & GetInfoForPPColumn ( const TableIndexT & inCol ) const; - - void AddButton ( HT_Resource inBookmark, Uint32 inIndex) ; - void AddButton ( const string & inURL, const string & inTitle, Uint32 inIndex ) ; - void RemoveButton ( Uint32 inIndex ); - - void HandleNotification( HT_Notification notifyStruct, HT_Resource node, HT_Event event, void* token, uint32 tokenType); - - // for handling mouse tracking - virtual void MouseLeave ( ) ; - virtual void MouseWithin ( Point inPortPt, const EventRecord& ) ; - virtual void Click ( SMouseDownEvent &inMouseDown ) ; - - virtual void ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown); - virtual Boolean ClickSelect( const STableCell &inCell, const SMouseDownEvent &inMouseDown); - virtual void FinishCreateSelf ( ) ; - virtual void DrawCell ( const STableCell &inCell, const Rect &inLocalRect ) ; - virtual void RedrawCellWithHilite ( const STableCell inCell, bool inHiliteOn ) ; - virtual void ResizeFrameBy ( Int16 inWidth, Int16 inHeight, Boolean inRefresh ); - - // override to do nothing - virtual void HiliteSelection ( Boolean /*inActively*/, Boolean /*inHilite*/) { } ; - - // drag and drop overrides for drop feedback, etc - void HiliteDropArea ( DragReference inDragRef ); - Boolean ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) ; - void InsideDropArea ( DragReference inDragRef ) ; - void DrawDividingLine ( TableIndexT inCol ) ; - void LeaveDropArea( DragReference inDragRef ) ; - virtual void HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) ; - virtual void HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & /*inFileData*/ ) ; - virtual void HandleDropOfText ( const char* inTextData ) ; - virtual void HandleDropOfHTResource ( HT_Resource node ) ; - - virtual void ComputeItemDropAreas ( const Rect & inLocalCellRect, Rect & oLeftSide, - Rect & oRightSide ) ; - virtual void ComputeFolderDropAreas ( const Rect & inLocalCellRect, Rect & oLeftSide, - Rect & oRightSide ) ; - virtual Rect ComputeTextRect ( const SIconTableRec & inText, const Rect & inLocalRect ) ; - virtual void RedrawCellWithTextClipping ( const STableCell & inCell ) ; - - // send data when a drop occurs - void DoDragSendData( FlavorType inFlavor, ItemReference inItemRef, DragReference inDragRef) ; - void ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect &inItemBounds ) ; - - // these are valid only during a D&D and are used for hiliting and determining - // the drop location - STableCell mDraggedCell; - TableIndexT mDropCol; // position where a drop will go - bool mDropOn; // are they on a folder? - Rect mTextHiliteRect; // cached rect drawn behind selected folder title - TableIndexT mHiliteCol; // which column is mouse hovering over? - bool mInlineFeedbackOn; // do we draw the inline feedback or frame entire area? - - HT_View mToolbarView; - HT_Resource mToolbarRoot; - HT_Pane mToolbarPane; - - ButtonList* mButtonList; // list of buttons pulled from HT - bool mIsInitialized; // is this class ready for prime time? - - static DragSendDataUPP sSendDataUPP; - - static Uint32 mMaxToolbarButtonChars; - static Uint32 mMinToolbarButtonChars; - static const char* kMaxButtonCharsPref; - static const char* kMinButtonCharsPref; - -}; // CPersonalToolbarTable diff --git a/mozilla/cmd/macfe/gui/CPlaceHolderView.cp b/mozilla/cmd/macfe/gui/CPlaceHolderView.cp deleted file mode 100644 index 8d40cd11a0d..00000000000 --- a/mozilla/cmd/macfe/gui/CPlaceHolderView.cp +++ /dev/null @@ -1,181 +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. - */ - -#include "CPlaceHolderView.h" - -/* -Overview: ---------- - A CPlaceHolderView allows you define a space where another view - from the same window is moved to when the CPlaceHolderView becomes - visible. When the CPlaceHolderView is hidden, the view is put back - where it was. - - It is similar to the CIncludeView with the difference that the - CIncludeView creates the included view from an external 'PPob' - while the CPlaceHolderView assumes that the included view is - already somewhere in the same window. - -Application: ------------- - It has been developed for the CSubscribeWindow which contains - a TabSwitcher where each Tab panel displays the same list which - can't be disposed when switching panels. The list is originally - attached to the Window (under Constructor) and each Tab panel - contains a CPlaceHolderView which refers to the list. - -Limitation: ------------ - It does not take care of the Commander chain. If the view that - you plan to move around with different CPlaceHolderViews is also - a Commander, you will have to manually link it where it fits - in the Commander chain . - - -¥¥¥ KNOWN BUG: -============== - In the application described above, we have a crash if the - TabSwitcher is hidden after having selected at least one - other tab than the original one (ie. if the view displayed - by the PlaceHolder view was grabbed by another PlaceHolder - in another tab panel). To reproduce, call Hide() in - CMailNewsWindow::DoClose()... - -*/ - - -//------------------------------------------------------------------------------------ -// CPlaceHolderView -// -//------------------------------------------------------------------------------------ -CPlaceHolderView::CPlaceHolderView(LStream* inStream) -: LView(inStream), - mSaveSuperViewOfInstalledView(nil), - mInstalledView(nil) -{ - *inStream >> mInstalledViewID; -} - - -//------------------------------------------------------------------------------------ -// ~CPlaceHolderView -// -//------------------------------------------------------------------------------------ -CPlaceHolderView::~CPlaceHolderView() -{ -} - - -//------------------------------------------------------------------------------------ -// FinishCreateSelf -// -//------------------------------------------------------------------------------------ -void CPlaceHolderView::FinishCreateSelf() -{ - LView::FinishCreateSelf(); - AcquirePane(); -} - - -//------------------------------------------------------------------------------------ -// ShowSelf -// -//------------------------------------------------------------------------------------ -void CPlaceHolderView::ShowSelf() -{ - AcquirePane(); -} - - -//------------------------------------------------------------------------------------ -// HideSelf -// -//------------------------------------------------------------------------------------ -void CPlaceHolderView::HideSelf() -{ - ReturnPane(); -} - - -//------------------------------------------------------------------------------------ -// AcquirePane -// -//------------------------------------------------------------------------------------ -void CPlaceHolderView::AcquirePane() -{ - if (mInstalledViewID == 0) // no view to install - return; - - if (mInstalledView != nil) // view already installed - return; - - // Starting from the top of the view hierarchy, we look - // inside the window for a pane with the specified id - LWindow * myWindow = LWindow::FetchWindowObject(GetMacPort()); - mInstalledView = (LView *)myWindow->FindPaneByID(mInstalledViewID); - - // We don't want to re-install ourselves, though - if (mInstalledView == (LView *)this) - mInstalledView = nil; - - // Install the view - Assert_(mInstalledView != nil); - if (mInstalledView != nil) - { - mSaveSuperViewOfInstalledView = mInstalledView->GetSuperView(); - InstallPane(mInstalledView); - } -} - - -//------------------------------------------------------------------------------------ -// ReturnPane -// -//------------------------------------------------------------------------------------ -void CPlaceHolderView::ReturnPane() -{ - // Put back the included view to its original place before I disappear... - if (mInstalledView) - { - // ... but check first if I'm still the owner of the view. - if (mInstalledView->GetSuperView() == this) - { - if (mSaveSuperViewOfInstalledView) - mInstalledView->PutInside(mSaveSuperViewOfInstalledView, false); - } - mInstalledView = nil; - } -} - -//------------------------------------------------------------------------------------ -// InstallPane -// -//------------------------------------------------------------------------------------ -void CPlaceHolderView::InstallPane(LPane* inPane) -{ - // Set the Pane's binding to my binding - SBooleanRect frameBinding; - GetFrameBinding(frameBinding); - inPane->SetFrameBinding(frameBinding); - - // Associate Pane with its superview: me - inPane->PutInside(this, false); - - // Expand the Pane to my size - this->ExpandSubPane(inPane, true, true); -} diff --git a/mozilla/cmd/macfe/gui/CPlaceHolderView.h b/mozilla/cmd/macfe/gui/CPlaceHolderView.h deleted file mode 100644 index 1ac0bcfde16..00000000000 --- a/mozilla/cmd/macfe/gui/CPlaceHolderView.h +++ /dev/null @@ -1,57 +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. - */ - -#pragma once -#include "LView.h" - -//------------------------------------------------------------------------------------ - -class CPlaceHolderView : public LView - -// Similarly to the CIncludeView, this pane lets its superview "include" another view -// but unlike the CIncludeView, it doesn't create the included view from a 'PPob' resource: -// instead it searches for it in the window. This allows to create a global object like -// a CFlexTable for instance, attach it to the window and have different tab panels share it. -// -// The included view is put back to its original place when the CPlaceHolderView is hidden. -// -//------------------------------------------------------------------------------------ -{ -public: - - enum { class_ID = 'Hold' }; - - CPlaceHolderView(LStream* inStream); - virtual ~CPlaceHolderView(); - - virtual void FinishCreateSelf(); - virtual void ShowSelf(); - virtual void HideSelf(); - - virtual void AcquirePane(); - virtual void ReturnPane(); - -protected: - virtual void InstallPane(LPane* inPane); - - -protected: - PaneIDT mInstalledViewID; - LView * mInstalledView; - LView * mSaveSuperViewOfInstalledView; -}; diff --git a/mozilla/cmd/macfe/gui/CProgressCaption.cp b/mozilla/cmd/macfe/gui/CProgressCaption.cp deleted file mode 100644 index d0acd381930..00000000000 --- a/mozilla/cmd/macfe/gui/CProgressCaption.cp +++ /dev/null @@ -1,258 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CProgressCaption.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CProgressCaption.h" - -#ifdef PowerPlant_PCH -#include PowerPlant_PCH -#endif - -#include -#include "UGraphicGizmos.h" - -#pragma mark public - -enum {eNoColorSet = -1}; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CProgressCaption::CProgressCaption(LStream* inStream) - : LView(inStream), - mBar(NULL), mStatusText(NULL) -{ -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CProgressCaption::~CProgressCaption() -{ -} - - -void -CProgressCaption :: FinishCreateSelf ( ) -{ - mBar = dynamic_cast(FindPaneByID(kProgressBar)); - mStatusText = dynamic_cast(FindPaneByID(kStatusText)); - - Assert_(mBar != NULL); - Assert_(mStatusText != NULL); - -} // FinishCreateSelf - - -// -// GetDescriptor -// SetDescriptor -// -// Pass-through's to the caption object. -// - -StringPtr -CProgressCaption::GetDescriptor( - Str255 outDescriptor) const -{ - return mStatusText->GetDescriptor ( outDescriptor ); -} - -void -CProgressCaption::SetDescriptor(ConstStringPtr inDescriptor) -{ - // don't do anything if the new text is the same as the old - Str255 oldText; - if ( ::IdenticalString(GetDescriptor(oldText), inDescriptor, nil) != 0 ) { - mStatusText->SetDescriptor ( inDescriptor ); - if (FocusExposed()) - Draw(NULL); - } -} - -void -CProgressCaption::SetDescriptor(const char* inCDescriptor) -{ - // don't do anything if the new text is the same as the old - Str255 oldText; - LStr255 newText(inCDescriptor); - if ( ::IdenticalString(GetDescriptor(oldText), newText, nil) != 0 ) { - mStatusText->SetDescriptor ( newText ); - if (FocusExposed()) - Draw(NULL); - } -} - - -// -// SetMaxValue -// -// Sets the max value of the progress bar control. -// -void -CProgressCaption :: SetMaxValue ( Int32 inNewMaxValue ) -{ - mBar->SetMaxValue ( inNewMaxValue ) ; - -} // SetMaxValue - - -// -// GetValue -// SetValue -// -// Pass-throughs to the progress bar object. The value (-1) from layout means set the -// bar to an indefinite state (barber pole). -// - -void -CProgressCaption :: SetValue ( Int32 inValue ) -{ - if ( inValue == eIndefinite ) { - EventRecord ignored; // SpendTime() really doesn't use this. Only needed - // because there is no API to spin barber pole (idle). - mBar->SetIndeterminateFlag ( true ); - mBar->SpendTime(ignored); - } - else { - mBar->SetIndeterminateFlag ( false ); - mBar->SetValue ( inValue ); - } -} - -Int32 -CProgressCaption :: GetValue ( ) const -{ - return mBar->GetValue ( ); -} - - -#if 0 -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CProgressCaption::Draw(RgnHandle inSuperDrawRgnH) -{ - Rect theFrame; - if ((mVisible == triState_On) && CalcPortFrameRect(theFrame) && - ((inSuperDrawRgnH == nil) || RectInRgn(&theFrame, inSuperDrawRgnH)) && FocusDraw()) - { - PortToLocalPoint(topLeft(theFrame)); // Get Frame in Local coords - PortToLocalPoint(botRight(theFrame)); - - if (ExecuteAttachments(msg_DrawOrPrint, &theFrame)) - { - Boolean bDidDraw = false; - - StColorPenState thePenSaver; - StColorPenState::Normalize(); - - // Fail safe offscreen drawing - StValueChanger okayToFail(gDebugThrow, debugAction_Nothing); - try - { - LGWorld theOffWorld(theFrame, 0, useTempMem); - - if (!theOffWorld.BeginDrawing()) - throw memFullErr; - - DrawSelf(); - - theOffWorld.EndDrawing(); - theOffWorld.CopyImage(GetMacPort(), theFrame, srcCopy); - bDidDraw = true; - } - catch (...) - { - // & draw onscreen - } - - if (!bDidDraw) - DrawSelf(); - } - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CProgressCaption::GetActiveColors(RGBColor& bodyColor, RGBColor& barColor, RGBColor& frameColor) const -{ - CProgressBar::GetActiveColors(bodyColor, barColor, frameColor); - barColor.red = 0x8888; - barColor.green = 0x8888; - barColor.blue = 0xFFFF; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CProgressCaption::DrawSelf(void) -{ - Rect theFrame; - CalcLocalFrameRect(theFrame); - - ResIDT theTraitsID; - switch (GetValue()) - { - case eIndefinite: - theTraitsID = mIndefiniteTraitsID; - break; - case eBarHidden: - theTraitsID = mHiddenTraitsID; - break; - default: - theTraitsID = mBoundedTraitsID; - break; - } - - Int16 just = UTextTraits::SetPortTextTraits(theTraitsID); - - if (GetValue() == eBarHidden) - { - RGBColor theTextColor; - ::GetForeColor(&theTextColor); - - if (mEraseColor != eNoColorSet) - ::PmBackColor(mEraseColor); - else - ApplyForeAndBackColors(); - - ::EraseRect(&theFrame); - ::RGBForeColor(&theTextColor); - } - else - { - CProgressBar::DrawSelf(); - } - theFrame.right -= 3; - theFrame.left += 3; - theFrame.top -= 1; - UGraphicGizmos::PlaceStringInRect(mText, theFrame, just); -} - -#endif \ No newline at end of file diff --git a/mozilla/cmd/macfe/gui/CProgressCaption.h b/mozilla/cmd/macfe/gui/CProgressCaption.h deleted file mode 100644 index d530cf3c95c..00000000000 --- a/mozilla/cmd/macfe/gui/CProgressCaption.h +++ /dev/null @@ -1,58 +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. - */ - -// -// CProgressCaption -// -// Manages a progress bar and a text area to show loading status messages. -// Rewritten to use standard toolbox controls instead of drawing our own. -// - -#pragma once - - -#include -#include - - -class CProgressCaption : public LView -{ - public: - enum { class_ID = 'PgCp', kProgressBar = 'prog', kStatusText = 'capt' }; - enum { eBarHidden = -2, eIndefinite = -1 }; - - CProgressCaption(LStream* inStream); - virtual ~CProgressCaption(); - - virtual void SetDescriptor(ConstStringPtr inDescriptor); - virtual void SetDescriptor(const char* inCDescriptor); - virtual StringPtr GetDescriptor(Str255 outDescriptor) const; - - virtual void SetValue(Int32 inValue); - virtual Int32 GetValue() const; - - virtual void SetMaxValue ( Int32 inMax ) ; - - protected: - - virtual void FinishCreateSelf ( ) ; - - LProgressBar* mBar; - LCaption* mStatusText; -}; - diff --git a/mozilla/cmd/macfe/gui/CProxyCaption.cp b/mozilla/cmd/macfe/gui/CProxyCaption.cp deleted file mode 100644 index ed8ee10c223..00000000000 --- a/mozilla/cmd/macfe/gui/CProxyCaption.cp +++ /dev/null @@ -1,153 +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. - */ - -// =========================================================================== -// CProxyCaption.cp -// -// =========================================================================== - -#include "CProxyCaption.h" - -#include "mfinder.h" // needed for workaround function to bug in Appe's - // ::TruncText and ::TruncString - andrewb 6/20/97 - -#include -#include -#include - -// --------------------------------------------------------------------------- -// ¥ CProxyPane -// --------------------------------------------------------------------------- - -CProxyCaption::CProxyCaption( - LStream* inStream) - - : Inherited(inStream) -{ -} - -// --------------------------------------------------------------------------- -// ¥ FinishCreateSelf -// --------------------------------------------------------------------------- - -void -CProxyCaption::FinishCreateSelf() -{ - Inherited::FinishCreateSelf(); - - CalcLocalFrameRect(mOriginalFrame); -} - -// --------------------------------------------------------------------------- -// ¥ SetDescriptor -// --------------------------------------------------------------------------- - -void -CProxyCaption::SetDescriptor( - ConstStringPtr inDescriptor) -{ - Inherited::SetDescriptor(inDescriptor); - - FocusDraw(); - - // Adjust frame to fit new descriptor - - Rect frame = mOriginalFrame; - Rect newFrame; - - Int16 just = UTextTraits::SetPortTextTraits(mTxtrID); - - StringPtr theDescriptor = const_cast(inDescriptor); - - frame.left += 1; // A little extra padding looks better - - UNewTextDrawing::MeasureWithJustification( - reinterpret_cast(&theDescriptor[1]), - inDescriptor[0], - frame, - just, - newFrame, - true); - - if ((newFrame.right - newFrame.left) > (frame.right - frame.left)) - { - newFrame = frame; - } - - - // The + 2 factor seems to be necessary to not lose the - // last word of the title - ResizeFrameTo((newFrame.right - newFrame.left) + 2, newFrame.bottom - newFrame.top, true); -} - -// --------------------------------------------------------------------------- -// ¥ DrawSelf -// --------------------------------------------------------------------------- - -void -CProxyCaption::DrawSelf() -{ - Rect frame; - CalcLocalFrameRect(frame); - - Int16 justification = UTextTraits::SetPortTextTraits(mTxtrID); - - ::RGBBackColor(&UGAColorRamp::GetBlackColor()); - ::RGBForeColor(&UGAColorRamp::GetWhiteColor()); - - ::EraseRect(&frame); - - frame.left += 1; // A little extra padding looks better - - DrawText((Ptr)&mText[1], mText[0], frame); -} - -// --------------------------------------------------------------------------- -// ¥ DrawText -// --------------------------------------------------------------------------- -// NOTE: This version is differs from UDrawingUtils::DrawWithJustification -// in that we don't wrap lines, we just draw one line truncated. However, -// the measurements are identical to UDrawingUtils::DrawWithJustification -// so that UNewTextDrawing::MeasureWithJustification will correspond to what -// is drawn. - -void -CProxyCaption::DrawText( - Ptr inText, - Int32 inLength, - const Rect& inRect) -{ - FontInfo fontInfo; - - ::GetFontInfo(&fontInfo); - - Int16 lineBase = inRect.top + fontInfo.ascent + fontInfo.leading; - - StClipRgnState saveClip; // Draw within input rectangle - saveClip.ClipToIntersection(inRect); - - ::MoveTo(inRect.left, lineBase); - - short length = inLength; - - // DANGER! If you were to use Apple's ::TruncText with TruncMiddle as the - // last parameter you run the risk of crashing--in a very bad way. andrewb - MiddleTruncationThatWorks((char *)inText, length, inRect.right - inRect.left); - ::DrawText(inText, 0, length); -} - diff --git a/mozilla/cmd/macfe/gui/CProxyCaption.h b/mozilla/cmd/macfe/gui/CProxyCaption.h deleted file mode 100644 index 7adecea1d5c..00000000000 --- a/mozilla/cmd/macfe/gui/CProxyCaption.h +++ /dev/null @@ -1,59 +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. - */ - -// =========================================================================== -// CProxyCaption.h -// -// =========================================================================== - -#ifndef CProxyCaption_H -#define CProxyCaption_H -#pragma once - -#include - -class CProxyCaption : public LCaption -{ -private: - - typedef LCaption Inherited; - -public: - enum { class_ID = 'Bpxc' }; - - - - CProxyCaption( - LStream* inStream); - - virtual void SetDescriptor( - ConstStringPtr inDescriptor); - -protected: - virtual void FinishCreateSelf(); - virtual void DrawSelf(); - - static void DrawText( - Ptr inText, - Int32 inLength, - const Rect& inRect); - - Rect mOriginalFrame; -}; - -#endif diff --git a/mozilla/cmd/macfe/gui/CProxyPane.cp b/mozilla/cmd/macfe/gui/CProxyPane.cp deleted file mode 100644 index 6dbc7b75899..00000000000 --- a/mozilla/cmd/macfe/gui/CProxyPane.cp +++ /dev/null @@ -1,374 +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. - */ - -// =========================================================================== -// CProxyPane.cp -// -// =========================================================================== - -#include - -#include "CProxyPane.h" - -#include -#include -#include -#include -#include - -#include "CStandardFlexTable.h" -#include "CViewUtils.h" -#include "CProxyDragTask.h" -#include "CNetscapeWindow.h" -#include "CBrowserContext.h" -#include "CSuspenderResumer.h" -#include "resgui.h" -#include "mkgeturl.h" -#include "CURLDispatcher.h" -#include "macutil.h" -#include "CURLDragHelper.h" - -// --------------------------------------------------------------------------- -// ¥ CProxyPane -// --------------------------------------------------------------------------- - -CProxyPane::CProxyPane( - LStream* inStream) - : mNetscapeWindow(nil), - mProxyView(nil), - mPageProxyCaption(nil), - mSendDataUPP(nil), - mMouseInFrame(false), - - LDragAndDrop(GetMacPort(), this), - - Inherited(inStream) -{ - SetIconIDs(kProxyIconNormalID, kProxyIconMouseOverID); -} - -// --------------------------------------------------------------------------- -// ¥ ~CProxyPane -// --------------------------------------------------------------------------- - -CProxyPane::~CProxyPane() -{ - if (mSendDataUPP) - { - DisposeRoutineDescriptor(mSendDataUPP); - } -} - -// --------------------------------------------------------------------------- -// ¥ FinishCreateSelf -// --------------------------------------------------------------------------- - -void -CProxyPane::FinishCreateSelf() -{ - Inherited::FinishCreateSelf(); - - mSendDataUPP = NewDragSendDataProc(LDropArea::HandleDragSendData); - ThrowIfNil_(mSendDataUPP); - - ThrowIfNil_(mNetscapeWindow = dynamic_cast(LWindow::FetchWindowObject(GetMacPort()))); - ThrowIfNil_(mProxyView = dynamic_cast(mNetscapeWindow->FindPaneByID(kProxyViewID))); - ThrowIfNil_(mPageProxyCaption = dynamic_cast(mNetscapeWindow->FindPaneByID(kProxyTitleCaptionID))); - -} - -// --------------------------------------------------------------------------- -// ¥ ListenToMessage -// --------------------------------------------------------------------------- - -void -CProxyPane::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - const Uint8 kMaxTitleLength = 50; - switch (inMessage) - { - case msg_NSCDocTitleChanged: // browser, mail window and message window case - { - const char* theCTitle = static_cast(ioParam); - - if (theCTitle) - { - const char* tempCaption; - URL_Struct* theURL = nil; - if (strlen(theCTitle)) // We have a title - tempCaption = theCTitle; - else - { - // We don't have a title: use the URL instead of the title - ThrowIfNil_(mNetscapeWindow->GetWindowContext()); - - theURL = mNetscapeWindow->CreateURLForProxyDrag(nil); - if (theURL && theURL->address) - tempCaption = theURL->address; - } - - // now we at least have something (either title or url). Handle middle - // truncation, etc and then set the new title. - string finalCaption = CURLDragHelper::MakeIconTextValid( tempCaption ); - - NET_FreeURLStruct( theURL ); // we're done with the address string. - mPageProxyCaption->SetDescriptor(LStr255(finalCaption.c_str())); - - Boolean enabled = false; - Boolean a; Char16 b; Str255 c; - LCommander* target = LCommander::GetTarget(); - if (target) - target->ProcessCommandStatus(cmd_AddToBookmarks, enabled, a,b, c); - if (enabled) - Enable(); - else - Disable(); - - } - else - Disable(); - - } - break; - } -} - -// --------------------------------------------------------------------------- -// ¥ ToggleIcon -// --------------------------------------------------------------------------- - -void -CProxyPane::ToggleIcon( - ResIDT inResID) -{ - StPortOriginState thePortOriginState(GetMacPort()); - - SetIconResourceID(inResID); - LoadIconSuiteHandle(); - - Refresh(); - UpdatePort(); -} - -// --------------------------------------------------------------------------- -// ¥ ToggleIconSelected -// --------------------------------------------------------------------------- - -void -CProxyPane::ToggleIconSelected( - Boolean inIconIsSelected) -{ - StPortOriginState thePortOriginState(GetMacPort()); - - if (inIconIsSelected) - { - SetIconTransform(kTransformSelected); - } - else - { - SetIconTransform(kTransformNone); - } - - Refresh(); - UpdatePort(); -} - -// --------------------------------------------------------------------------- -// ¥ MouseEnter -// --------------------------------------------------------------------------- - -void -CProxyPane::MouseEnter( - Point /*inPortPt*/, - const EventRecord& /*inMacEvent*/) -{ - mMouseInFrame = true; - if (IsEnabled() && !CSuspenderResumer::IsSuspended()) - { - // We intentionally "animate" the icon even when it's not in - // a frontmost window. Since the animation is intended to - // somehow signify that the icon is draggable, it makes sense - // for it to animate even in a deactive window. Recall that - // we use delay select to do the proper drag UI so that icon - // is really active even in an inactive window. - - ToggleIcon(mProxyIconMouseOverID); - } -} - -// --------------------------------------------------------------------------- -// ¥ MouseLeave -// --------------------------------------------------------------------------- - -void -CProxyPane::MouseLeave() -{ - mMouseInFrame = false; - if (IsEnabled() && !CSuspenderResumer::IsSuspended()) - { - ToggleIcon(mProxyIconNormalID); - } -} - -// --------------------------------------------------------------------------- -// ¥ Click -// --------------------------------------------------------------------------- -// We override Click here so we can handle the delay select appropriately for -// dragging the page proxy. - -void -CProxyPane::Click( - SMouseDownEvent& inMouseDown) -{ - PortToLocalPoint(inMouseDown.whereLocal); - UpdateClickCount(inMouseDown); - - if (ExecuteAttachments(msg_Click, &inMouseDown)) - { - ClickSelf(inMouseDown); - } -} - -// --------------------------------------------------------------------------- -// ¥ ClickSelf -// --------------------------------------------------------------------------- - -void -CProxyPane::ClickSelf( - const SMouseDownEvent& inMouseDown) -{ - FocusDraw(); - - Point theGlobalPoint = inMouseDown.wherePort; - PortToGlobalPoint(theGlobalPoint); - - StToggleIconSelected theToggleIconSelected(*this, true); - - if (::WaitMouseMoved(theGlobalPoint)) - { - if (LDropArea::DragAndDropIsPresent()) - { - char title[256]; - URL_Struct* url = mNetscapeWindow->CreateURLForProxyDrag(title); - if ( url ) { - string urlAndTitle = CURLDragHelper::CreateBookmarkFlavorURL ( url->address, title ); - - CProxyDragTask theTask( - *mProxyView, - *this, - *mPageProxyCaption, - inMouseDown.macEvent, - mNetscapeWindow->CreateExtraFlavorAdder(), - urlAndTitle.c_str()); - - OSErr theErr = ::SetDragSendProc( - theTask.GetDragReference(), - mSendDataUPP, - (LDragAndDrop*)this); - ThrowIfOSErr_(theErr); - - theTask.DoDrag(); - } - } - } - else - { - if (GetClickCount() == 2) - { - LCommander* target = LCommander::GetTarget(); - if (target) - target->ObeyCommand(cmd_AddToBookmarks, nil); - - // Provide visual feedback by hilighting the bookmark menu -- mdp - const long kVisualDelay = 8; // 8 ticks, as recommended by Apple - unsigned long temp; - ::HiliteMenu( cBookmarksMenuID ); - ::Delay( kVisualDelay, &temp ); - ::HiliteMenu( 0 ); - - // Also put a message in the status window -- mdp - Str255 mesg; - MWContext* context = *mNetscapeWindow->GetWindowContext(); - ::GetIndString( mesg, 7099, 20 ); // why are there no constants for these? - FE_Progress( context, CStr255(mesg) ); - } - } -} - -// --------------------------------------------------------------------------- -// ¥ ActivateSelf -// --------------------------------------------------------------------------- - -void -CProxyPane::ActivateSelf() -{ - // Intentionally blank. The inherited version draws icon enabled (to undo what - // was done in DeactivateSelf() which is not what we want. -} - -// --------------------------------------------------------------------------- -// ¥ DeactivateSelf -// --------------------------------------------------------------------------- - -void -CProxyPane::DeactivateSelf() -{ - // Intentionally blank. The inherited version draws icon disabled which - // is not what we want. -} - -// --------------------------------------------------------------------------- -// ¥ DoDragSendData -// --------------------------------------------------------------------------- - -void -CProxyPane::DoDragSendData( - FlavorType inFlavor, - ItemReference inItemRef, - DragReference inDragRef) -{ - char title[256]; - URL_Struct* url = mNetscapeWindow->CreateURLForProxyDrag(title); - CURLDragHelper::DoDragSendData(url->address, title, inFlavor, inItemRef, - inDragRef); -} // CProxyPane::DoDragSendData - -//----------------------------------- -void CProxyPane::HandleEnablingPolicy() -//----------------------------------- -{ - // We may be in background, and we need to allow dragging. So the idea is to - // enable the icon if it WOULD be enabled when the window was active. So - // do nothing (neither enable nor disable) when in the background. - if (mNetscapeWindow->IsOnDuty()) - { - LCommander* target = LCommander::GetTarget(); - if (target) - { - Boolean enabled = false; - Boolean a; Char16 b; Str255 c; - target->ProcessCommandStatus(cmd_AddToBookmarks, enabled, a,b, c); - if (enabled) - Enable(); - else - Disable(); - } - } -} // CProxyPane::HandleEnablingPolicy diff --git a/mozilla/cmd/macfe/gui/CProxyPane.h b/mozilla/cmd/macfe/gui/CProxyPane.h deleted file mode 100644 index 5a09d204c1a..00000000000 --- a/mozilla/cmd/macfe/gui/CProxyPane.h +++ /dev/null @@ -1,148 +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. - */ - -// =========================================================================== -// CProxyPane.h -// -// =========================================================================== - -#ifndef CProxyPane_H -#define CProxyPane_H -#pragma once - -// Includes - -#include -#include -#include - -#include "CProxyCaption.h" -#include "MPaneEnablerPolicy.h" - -// Forward declarations - -class LView; -class CNetscapeWindow; - -// -// Class declaration -// - -class CProxyPane -: public LGAIconSuite -, public LListener -, public LDragAndDrop -, public MPaneEnablerPolicy -{ -private: - typedef LGAIconSuite Inherited; - -public: - enum { - class_ID = 'Bpxy', - - kProxyViewID = 'Bpxv', - kProxyPaneID = CProxyPane::class_ID, - kProxyTitleCaptionID = CProxyCaption::class_ID, - - kProxyIconNormalID = 15313, - kProxyIconMouseOverID = 15314 - - }; - - CProxyPane( - LStream* inStream); - virtual ~CProxyPane(); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - virtual void DoDragSendData( - FlavorType inFlavor, - ItemReference inItemRef, - DragReference inDragRef); - - virtual void Click( - SMouseDownEvent& inMouseDown); - - virtual void MouseEnter( - Point inPortPt, - const EventRecord& inMacEvent); - virtual void MouseLeave(); - - void SetIconIDs(ResIDT inNormalID, ResIDT inMouseOverID) - { mProxyIconNormalID = inNormalID; - mProxyIconMouseOverID = inMouseOverID; - SetIconResourceID(inNormalID); - Refresh(); } - virtual void HandleEnablingPolicy(); // required as a MPaneEnablerPolicy - -protected: - - virtual void FinishCreateSelf(); - - virtual void ActivateSelf(); - virtual void DeactivateSelf(); - - virtual void ClickSelf( - const SMouseDownEvent& inMouseDown); - - virtual void ToggleIcon( - ResIDT inResID); - - CNetscapeWindow* mNetscapeWindow; - LView* mProxyView; - LCaption* mPageProxyCaption; - - DragSendDataUPP mSendDataUPP; - Boolean mMouseInFrame; - ResIDT mProxyIconNormalID; - ResIDT mProxyIconMouseOverID; - - - virtual void ToggleIconSelected( - Boolean inIconIsSelected); - - // Stack-based helper class to handle toggling selected state of icon. - - class StToggleIconSelected - { - public: - StToggleIconSelected(CProxyPane& inProxyPane, Boolean inSelected) - : mProxyPane(inProxyPane), - mSelectedState(inSelected) - { - mProxyPane.ToggleIconSelected(mSelectedState); - } - - ~StToggleIconSelected() - { - mProxyPane.ToggleIconSelected(!mSelectedState); - } - - protected: - CProxyPane& mProxyPane; - Boolean mSelectedState; - }; - - friend class CProxyPane::StToggleIconSelected; -}; - - -#endif diff --git a/mozilla/cmd/macfe/gui/CRDFToolbar.cp b/mozilla/cmd/macfe/gui/CRDFToolbar.cp deleted file mode 100644 index 4a62694efc2..00000000000 --- a/mozilla/cmd/macfe/gui/CRDFToolbar.cp +++ /dev/null @@ -1,463 +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 "CRDFToolbar.h" -#include "CRDFToolbarItem.h" -#include "URDFUtilities.h" - -#include -#include -#include "htrdf.h" -#include "CPaneEnabler.h" -#include "CRDFToolbarContainer.h" // so we can tell it we have changed size -#include "UGraphicGizmos.h" -#include "CNavCenterContextMenuAtt.h" - -#include "vocab.h" // provides tokens needed in lookup functions - // ...and because vocab.h mistakenly does not declare these, we must -extern RDF_NCVocab gNavCenter; -extern RDF_CoreVocab gCoreVocab; - - - - - -namespace - { - // BULLSHIT ALERT: the following magic numbers should be derived from HT - const SInt16 TOOLBAR_HORIZONTAL_PADDING = 2; - const SInt16 TOOLBAR_VERTICAL_PADDING = 2; - const SInt16 TOOLBAR_INITIAL_VERTICAL_OFFSET = 14; - - struct item_spec - { - item_spec() - { - // nothing else to do - } - - item_spec( CRDFToolbarItem& item, SDimension16 available_space ) - : _item( &item ), - _size( item.NaturalSize(available_space) ), - _is_stretchy( item.IsStretchy() ) - { - // nothing else to do - } - - CRDFToolbarItem* _item; - SDimension16 _size; - bool _is_stretchy; - }; - - typedef std::vector item_list; - - - void - layout_row( item_list::iterator first, item_list::iterator last, SInt16 inLeft, SInt16 inBottom, SInt16 stretchy_space ) - { - for ( ; first != last; ++first ) - { - if ( first->_is_stretchy ) - first->_size.width += stretchy_space; - - first->_item->ResizeFrameTo(first->_size.width, first->_size.height, false); - first->_item->PlaceInSuperFrameAt(inLeft, inBottom-first->_size.height, false); - - inLeft += first->_size.width + TOOLBAR_HORIZONTAL_PADDING; - } - } - - SPaneInfo - pane_params_from( HT_View /*ht_view*/, LView* pp_superview ) - { - SPaneInfo info; - - info.paneID = 0; - - SDimension16 superview_size; - pp_superview->GetFrameSize(superview_size); - info.width = superview_size.width; - - info.height = 55; // NO! Get this value from the |HT_View|. - info.visible = false; // we'll get shown when bar is added. - info.enabled = false; - - SBooleanRect bindings = { true, true, true, false }; - info.bindings = bindings; - - info.left = 0; - info.top = 0; - - info.userCon = 0; - info.superView = pp_superview; - - return info; - } - - SViewInfo - view_params_from( HT_View /*ht_view*/ ) - { - SViewInfo info; - - SDimension32 image_size = { 0, 0 }; - info.imageSize = image_size; - - SPoint32 scroll_pos = { 0, 0 }; - info.scrollPos = scroll_pos; - - SPoint32 scroll_unit = { 1, 1 }; - info.scrollUnit = scroll_unit; - - info.reconcileOverhang = 0; - - return info; - } - - bool - is_docked( HT_View /*ht_view*/ ) - { - return false; - } - - - } // namespace - - - - -CRDFToolbar::CRDFToolbar( HT_View ht_view, LView* pp_superview ) - : CDragBar( pane_params_from(ht_view, pp_superview), view_params_from(ht_view), is_docked(ht_view) ), - _ht_view(ht_view) - { - assert( _ht_view ); // There must be an |HT_View|... - assert( !HT_GetViewFEData(_ht_view) ); // ...and it must not be linked to any other FE object. - - // the toolbar can stream in at any time, so we need to make sure that the container gets - // updated even after it has been initialized. Setting the |available| flag to false ensures - // that the container will update correctly when it sees this toolbar. - SetAvailable(false); - - HT_SetViewFEData(_ht_view, this); - - // TO BE FIXED: 1103 needs a better name and visibility - // TO BE FIXED: is there a better way to insert the grippy pane? - - LWindow* window = LWindow::FetchWindowObject(pp_superview->GetMacPort()); - UReanimator::CreateView(1103, this, window); // create the CPatternedGrippyPane -#if 0 - LView* view = UReanimator::CreateView(1104, this, window); // create the CToolbarPatternBevelView - view->ResizeFrameBy(-12, 0, false); -#endif - - notice_background_changed(); - - // The top node of the toolbar may or may not be open (sigh). Make sure it _is_ open - // and then fill in our toolbars from the contents. - HT_SetOpenState(TopNode(), PR_TRUE); - FillInToolbar(); - - // when the toolbars stream in, we need to create them as invisible, disabled, and - // inactive. The first two are handled above in pane_params_from() so we need to - // make sure it is deactivated. All three properties will be adjusted to their - // correct settings in EnableSelf() below, which is called when the toolbar is - // added to the container. - Deactivate(); - - CToolbarContextMenuAttachment* tip = new CToolbarContextMenuAttachment; - Assert_(tip != NULL); - if ( tip ) - AddAttachment(tip); - } - -CRDFToolbar::~CRDFToolbar() - { - assert( _ht_view ); // There must be an |HT_View|... - - HT_SetViewFEData(_ht_view, 0); - } - - -// -// FillInToolbar -// -// Loop through HT and create buttons for each item present. Once we build them all, -// lay them out. -// -// Note: We will certainly get more buttons streaming in, so we'll have to -// pitch our layout and re-layout again, but they may not stream in for a while so -// we still should layout what we have (WinFE has this same problem and hyatt -// and I have yelled at rjc about it...but to no avail). -// -void -CRDFToolbar :: FillInToolbar ( ) -{ - assert(HTView() && TopNode()); - - HT_Cursor cursor = HT_NewCursor(TopNode()); - if (cursor == NULL) - return; - - HT_Resource item = NULL; - while ( (item = HT_GetNextItem(cursor)) != 0 ) - AddHTButton(item); - - HT_DeleteCursor(cursor); - - LayoutButtons(); - -} // FillInToolbar - - - - -void -CRDFToolbar::LayoutButtons() - /* - ...some property has changed that may effect the layout of the items within me. - I need to re-calculate the layout of my contents. - - TO DO: make sure this doesn't get called recursively, i.e., when it resizes itself. - No harm done, just wasted work. - - TO DO: make and use an |auto_ptr<_HT_Cursor>|. - */ - { - // loop over the items, if we can - if ( HT_Cursor cursor = HT_NewCursor(TopNode()) ) - { - SDimension16 toolbar_size; - GetFrameSize(toolbar_size); - // BULLSHIT ALERT: do I need to account for the grippy pane? - - SInt16 row_bottom = 0; - - SInt16 row_height = 0; - SInt16 width_available = toolbar_size.width; - size_t number_of_stretchy_items = 0; - - item_list row; - row.reserve(32); // reserve room for enough items to make allocation unlikely - - while ( HT_Resource resource = HT_GetNextItem(cursor) ) - if ( CRDFToolbarItem* toolbar_item = reinterpret_cast(HT_GetNodeFEData(resource)) ) - { - item_spec spec(*toolbar_item, toolbar_size); - - // If the current item is too big to fit in this row... - if ( spec._size.width > width_available ) - { - // ...we're done with this row. Lay it out. - layout_row(row.begin(), row.end(), TOOLBAR_INITIAL_VERTICAL_OFFSET, row_bottom+=(TOOLBAR_VERTICAL_PADDING+row_height), width_available / number_of_stretchy_items); - - // And start accumulating a new row. - row.resize(0); - row_height = 0; - width_available = toolbar_size.width; - number_of_stretchy_items = 0; - } - - // Add this item to the row we're currently accumulating. - row.push_back(spec); - - // ...and account for its size. - width_available -= (spec._size.width + TOOLBAR_HORIZONTAL_PADDING); - if ( spec._size.height > row_height ) - row_height = spec._size.height; // this item makes the row taller - if ( spec._is_stretchy ) - ++number_of_stretchy_items; - } - - // The final row comprises all remaining accumulated items. Lay it out. - layout_row(row.begin(), row.end(), TOOLBAR_INITIAL_VERTICAL_OFFSET, row_bottom+=(TOOLBAR_VERTICAL_PADDING+row_height), width_available / number_of_stretchy_items); - if ( toolbar_size.height != (row_bottom += TOOLBAR_VERTICAL_PADDING) ) { - ResizeFrameTo(toolbar_size.width, row_bottom, false); - - // let the container know that this toolbar has just resized so it can adjust itself - CRDFToolbarContainer* container = dynamic_cast(GetSuperView()); - if ( container ) - container->ToolbarChanged(); - } - - HT_DeleteCursor(cursor); - } - Refresh(); - - } - - - - - - -// -// AddHTButton -// -// Make a button that corresponds to the given HT_Resource. The button can be -// one of numerous types, including things like separators, throbbers, or -// the url entry field. -// -void -CRDFToolbar :: AddHTButton ( HT_Resource inNode ) -{ - string nodeName = HT_GetNodeName(inNode); - string commandURL = HT_GetNodeURL(inNode); - - CRDFToolbarItem* newItem = NULL; - if (HT_IsURLBar(inNode)) - newItem = new CRDFURLBar(inNode); - else if (HT_IsSeparator(inNode)) - newItem = new CRDFSeparator(inNode); - else newItem = new CRDFPushButton(inNode); - - if ( newItem ) { - newItem->PutInside ( this ); - newItem->ResizeFrameTo ( 50, 50, false ); // give it a default size - } - - // IMPORTANT: these must be done AFTER PutInside() - newItem->FinishCreate(); - newItem->HookUpToListeners(); - - HT_SetNodeFEData(inNode, newItem); - -} // AddHTButton - - -void -CRDFToolbar::Draw( RgnHandle inSuperDrawRgnH ) - { - // We don't like the way |CDragBar| does it - LView::Draw(inSuperDrawRgnH); - } - -void -CRDFToolbar::DrawSelf() - { - Rect frame; - if ( CalcLocalFrameRect(frame) ) - { - Point top_left = { frame.top, frame.left }; - DrawImage(top_left, kTransformNone, frame.right-frame.left, frame.bottom-frame.top); - - UGraphicGizmos::BevelTintRect ( frame, 1, 0x6000, 0x6000 ); - } - // Note: I don't want |CDragBar::DrawSelf()|s behavior, and |LView| doesn't implement - // |DrawSelf|, so, nothing else to do here. - } - -void -CRDFToolbar::ImageIsReady() - { - Refresh(); - } - - -void -CRDFToolbar::DrawStandby( const Point&, const IconTransformType ) const - // Called to take alternative action when the BG image is not ready, or does not exist. - { - EraseBackground(); - } - - -void -CRDFToolbar::EraseBackground() const - // Erase to the HT supplied color. We know we don't have an image, or it would have been drawn already. - { - Rect backRect = { 0, 0, mFrameSize.height, mFrameSize.width }; - - URDFUtilities::SetupBackgroundColor ( TopNode(), gNavCenter->viewBGColor, kThemeListViewBackgroundBrush ); - ::EraseRect(&backRect); - } - - -void -CRDFToolbar::HandleNotification( HT_Notification, HT_Resource inNode, HT_Event event, void* /*inToken*/, uint32 /*inTokenType*/ ) - { - switch ( event ) - { - case HT_EVENT_NODE_ADDED: - AddHTButton(inNode); - LayoutButtons(); - break; - - case HT_EVENT_NODE_VPROP_CHANGED: - notice_background_changed(); - break; - } - } - -void -CRDFToolbar::notice_background_changed() - { - char* cp = 0; - if ( HT_GetTemplateData(TopNode(), gNavCenter->viewBGURL, HT_COLUMN_STRING, &cp) ) - SetImageURL(string(cp)); - } - - -void -CRDFToolbar::ShowSelf ( ) -{ - CDragBar::ShowSelf(); - Enable(); - Activate(); - -} // ShowSelf - - -void -CRDFToolbar::ResizeFrameBy ( SInt16 inH, SInt16 inW, Boolean inRefresh ) -{ - CDragBar :: ResizeFrameBy ( inH, inW, inRefresh ); - LayoutButtons(); - -} - - -// -// AdjustCursorSelf -// -// Handle changing cursor to contextual menu cursor if cmd key is down -// -void -CRDFToolbar::AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) -{ - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenuCursor, - static_cast(const_cast(&inEvent))); - -} - - -// -// ClickSelf -// -// Try context menu if control key is down -// -void -CRDFToolbar :: ClickSelf( const SMouseDownEvent &inMouseDown ) -{ - if (inMouseDown.macEvent.modifiers & controlKey) { - CContextMenuAttachment::SExecuteParams params; - params.inMouseDown = &inMouseDown; - ExecuteAttachments( CContextMenuAttachment::msg_ContextMenu, ¶ms ); - } - else - CDragBar::ClickSelf(inMouseDown); - -} // ClickSelf diff --git a/mozilla/cmd/macfe/gui/CRDFToolbar.h b/mozilla/cmd/macfe/gui/CRDFToolbar.h deleted file mode 100644 index b80b3d20339..00000000000 --- a/mozilla/cmd/macfe/gui/CRDFToolbar.h +++ /dev/null @@ -1,86 +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. - */ - -#pragma once - -#include "CDragBar.h" // ...is a base class -#include "CImageIconMixin.h" // ...is a base class -#include "CRDFNotificationHandler.h" // ...is a base class - -class CToolbarContextMenuAttachment; - - -class CRDFToolbar - : public CDragBar, - public CTiledImageMixin, - public CRDFNotificationHandler - - /* - ... - - A |CRDFToolbar| has a one-to-one relationship with a particular |HT_View|. No more - than one FE object should ever be instantiated for this |HT_View|. - */ - { - public: - CRDFToolbar( HT_View, LView* ); - virtual ~CRDFToolbar(); - - friend class CToolbarContextMenuAttachment; - - private: // Pass-by-value is not allowed. A single |CRDFToolbar| corresponds to a single on-screen object; copying doesn't make sense. - CRDFToolbar( const CRDFToolbar& ); // DON'T IMPLEMENT - CRDFToolbar& operator=( const CRDFToolbar& ); // DON'T IMPLEMENT - - public: - // ...for |LPane|, |LView|, |CDragBar|... - virtual void Draw( RgnHandle ); - - // ...for |CRDFNotificationHandler| - virtual void HandleNotification( HT_Notification, HT_Resource, HT_Event, void*, uint32 ); - - protected: - // ...for |CTiledImageMixin| - virtual void ImageIsReady(); - virtual void DrawStandby( const Point&, const IconTransformType ) const; - - // PowerPlant overrides - virtual void DrawSelf ( ) ; - virtual void EraseBackground ( ) const; - virtual void ShowSelf ( ) ; - virtual void ResizeFrameBy ( SInt16 inWidth, SInt16 inHeight, Boolean inRefresh ); - virtual void AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) ; - virtual void ClickSelf( const SMouseDownEvent &inMouseDown ) ; - - virtual void FillInToolbar ( ) ; - virtual void LayoutButtons ( ) ; - - virtual void AddHTButton ( HT_Resource inButton ) ; - - // helpful accessors - HT_View HTView() { return _ht_view; } - const HT_View HTView() const { return _ht_view; } - HT_Resource TopNode() { return HT_TopNode(HTView()); } - const HT_Resource TopNode() const { return HT_TopNode(HTView()); } - - void notice_background_changed(); - - private: - HT_View _ht_view; - }; - diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarContainer.cp b/mozilla/cmd/macfe/gui/CRDFToolbarContainer.cp deleted file mode 100644 index 9efa309c142..00000000000 --- a/mozilla/cmd/macfe/gui/CRDFToolbarContainer.cp +++ /dev/null @@ -1,136 +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 "CRDFToolbarContainer.h" -#include "CRDFToolbar.h" - - -const ClassIDT CRDFToolbarContainer::class_ID; - - - -CRDFToolbarContainer::CRDFToolbarContainer( LStream* inStream ) - : CDragBarContainer(inStream) - { - /* - We don't want to actually create the toolbar |HT_Pane| until everything else exists, - i.e., after we've done everything needed in |FinishCreateSelf()|. - */ - } - - -void -CRDFToolbarContainer::FinishCreateSelf() - { - CDragBarContainer::FinishCreateSelf(); - - // Everything we need to create the |HT_Pane| now exists... - _ht_root = auto_ptr<_HT_PaneStruct>(HT_NewToolbarPane(CreateNotificationStruct())); - HT_SetPaneFEData(_ht_root.get(), this); - } - - -void -CRDFToolbarContainer::BuildToolbarsPresentAtStartup() - { - } - - -void -CRDFToolbarContainer::RestorePlace( LStream *inPlace ) - { - } - - -void -CRDFToolbarContainer :: HandleHTCommand ( CommandT inPPCommand ) -{ - HT_Error err = HT_DoMenuCmd ( _ht_root.get(), (HT_MenuCmd)(inPPCommand - cmd_NavCenterBase) ); - Assert_( err == HT_NoErr ); - -} // HandleHTCommand - - -void -CRDFToolbarContainer::HandleNotification( HT_Notification notification, HT_Resource node, HT_Event event, void* token, uint32 tokenType ) - { - HT_View ht_view = HT_GetView(node); - - switch ( event ) - { - case HT_EVENT_VIEW_ADDED: // i.e., create a toolbar - AddBar( new CRDFToolbar(ht_view, this) ); - break; - - case HT_EVENT_VIEW_DELETED: // i.e., destroy a toolbar - if( CRDFToolbar* toolbar = reinterpret_cast(HT_GetViewFEData(ht_view)) ) { - mBars.Remove(&toolbar); - delete toolbar; - } - ToolbarChanged(); - break; - -#if 0 - case HT_EVENT_NODE_ADDED: - case HT_EVENT_NODE_DELETED_DATA: - case HT_EVENT_NODE_DELETED_NODATA: - case HT_EVENT_NODE_VPROP_CHANGED: - case HT_EVENT_NODE_SELECTION_CHANGED: - case HT_EVENT_NODE_OPENCLOSE_CHANGED: - case HT_EVENT_VIEW_SELECTED: - case HT_EVENT_NODE_OPENCLOSE_CHANGING: - case HT_EVENT_VIEW_SORTING_CHANGED: - case HT_EVENT_VIEW_REFRESH: - case HT_EVENT_VIEW_WORKSPACE_REFRESH: - case HT_EVENT_NODE_EDIT: - case HT_EVENT_WORKSPACE_EDIT: - case HT_EVENT_VIEW_HTML_ADD: - case HT_EVENT_VIEW_HTML_REMOVE: - case HT_EVENT_NODE_ENABLE: - case HT_EVENT_NODE_DISABLE: - case HT_EVENT_NODE_SCROLLTO: - case HT_EVENT_COLUMN_ADD: - case HT_EVENT_COLUMN_DELETE: - case HT_EVENT_COLUMN_SIZETO: - case HT_EVENT_COLUMN_REORDER: - case HT_EVENT_COLUMN_SHOW: - case HT_EVENT_COLUMN_HIDE: - case HT_EVENT_VIEW_MODECHANGED: -#endif - default: // If it's not a message for me, it may be for some object under me... - if ( CRDFToolbar* toolbar = reinterpret_cast(HT_GetViewFEData(ht_view)) ) - toolbar->HandleNotification(notification, node, event, token, tokenType); - } - } - - -// -// ToolbarChanged -// -// One of the toolbars w/in us has changed in such a way that it's height is -// different than before. Readjust our size as well as all the other toolbars -// to accomodate. -// -void -CRDFToolbarContainer :: ToolbarChanged ( ) -{ - AdjustDock(); - RepositionBars(); - AdjustContainer(); - -} // ResizeFrameBy diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarContainer.h b/mozilla/cmd/macfe/gui/CRDFToolbarContainer.h deleted file mode 100644 index 8ec0aaad822..00000000000 --- a/mozilla/cmd/macfe/gui/CRDFToolbarContainer.h +++ /dev/null @@ -1,73 +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. - */ - -#pragma once - -#include "auto_HT_Pane.h" // ...for |auto_ptr<_HT_PaneStruct>|, a member -#include "CDragBarContainer.h" // ...is a base class -#include "CRDFNotificationHandler.h" // ...is a base class - - - -class CRDFToolbarContainer - : public CDragBarContainer, - public CRDFNotificationHandler - /* - ... - - Why didn't I just fold this functionality into |CDragBarContainer|? - Well... |CDragBarContainer| seemed very comprehensible. It supplies just the - functionality of moving the individual toolbars around, and machinery very - closely related to that. - - _This_ class strictly enhances that functionality with the idea that RDF - specifies the attributes of the bars rather than a resource. - */ - { - public: - - static const ClassIDT class_ID = 'RTCt'; - - CRDFToolbarContainer( LStream* ); - // virtual ~CRDFToolbarContainer(); -- already virtual from bases, |auto_ptr| member means no destructor needed - - // call when a toolbar has changed in some way to readjust the container - // and all the bars w/in it. - virtual void ToolbarChanged ( ) ; - - // execute a command we know to be an HT command. |inPPCommand| should be what - // we get from PowerPlant, not adjusted to HT's version. - virtual void HandleHTCommand ( CommandT inPPCommand ) ; - - private: // Pass-by-value is not allowed. A single |CRDFToolbarContainer| corresponds to a single on-screen object; copying doesn't make sense. - CRDFToolbarContainer( const CRDFToolbarContainer& ); // DON'T IMPLEMENT - CRDFToolbarContainer& operator=( const CRDFToolbarContainer& ); // DON'T IMPLEMENT - - - protected: - // overriding the appropriate methods of |CRDFNotificationHandler| - virtual void HandleNotification( HT_Notification, HT_Resource, HT_Event, void*, uint32 ); - - // overriding the appropriate methods of |CDragBarContainer| - virtual void BuildToolbarsPresentAtStartup() ; - virtual void RestorePlace( LStream* ); - virtual void FinishCreateSelf(); - - private: - auto_ptr<_HT_PaneStruct> _ht_root; - }; diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp b/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp deleted file mode 100644 index 3f0d0d1727c..00000000000 --- a/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp +++ /dev/null @@ -1,1089 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Implementations for all the things that can go on a toolbar. -// -// CRDFToolbarItem - the base class for things that go on toolbars -// CRDFPushButton - a toolbar button -// CRDFSeparator - a separator bar -// CRDFURLBar - the url bar w/ proxy icon -// -// I apologize profusely for the poor design and amount of copied code -// from CButton. We had to do this is about a week from start to finish -// about a month _after_ the feature-complete deadline. If you don't like -// the code, deal (pinkerton). -// - -#include "CRDFToolbarItem.h" -#include "CToolbarModeManager.h" -#include "UGraphicGizmos.h" -#include "UGAAppearance.h" -#include "URDFUtilities.h" -#include "CBrowserWindow.h" -#include "CTargetedUpdateMenuRegistry.h" -#include "uapp.h" -#include "CPaneEnabler.h" -#include "CNavCenterContextMenuAtt.h" - - -extern RDF_NCVocab gNavCenter; // RDF vocab struct for NavCenter - - -CRDFToolbarItem :: CRDFToolbarItem ( HT_Resource inNode ) - : mNode(inNode) -{ - Assert_(mNode != NULL); -} - - -CRDFToolbarItem :: ~CRDFToolbarItem ( ) -{ - -} - - -void -CRDFToolbarItem :: FinishCreate ( ) -{ - AttachContextMenu(); -} - - -#pragma mark - - - -CRDFPushButton :: CRDFPushButton ( HT_Resource inNode ) - : CRDFToolbarItem(inNode), mTitleTraitsID(130), mCurrentMode(eTOOLBAR_TEXT_AND_ICONS), - mMouseInFrame(false), mTrackInside(false), mGraphicPadPixels(5), mTitlePadPixels(3), - mOvalWidth(8), mOvalHeight(8) -{ - // figure out icon and text placement depending on the toolbarBitmapPosition property in HT. The - // first param is the alignment when the icon is one top, the 2nd when the icon is on the side. - mTitleAlignment = CalcAlignment(kAlignCenterBottom, kAlignCenterRight); - mGraphicAlignment = CalcAlignment(kAlignCenterTop, kAlignCenterLeft); - - mCurrentMode = CalcDisplayMode(); - - AttachTooltip(); - AttachPaneEnabler(); - - AssignCommand(); - - // get ready to draw by caching all the graphic and title rects. - PrepareDrawButton(); -} - - -CRDFPushButton :: ~CRDFPushButton ( ) -{ - -} - - -// -// HookUpToListeners -// -// Find the top level browser window and register it as a listener for commands, but only -// if this button is a special command. Other kinds of buttons don't need to be registered as -// they just dispatch immediately and don't broadcast commands. -// -void -CRDFPushButton :: HookUpToListeners ( ) -{ - const char* url = HT_GetNodeURL(HTNode()); - if ( url && IsCommandButton() ) { - LView* top=GetSuperView(); - while ( top && top->GetSuperView() ) - top = top->GetSuperView(); - LListener* topListener = dynamic_cast(top); - if ( topListener ) - AddListener(topListener); - } - -} // HookUpToListeners - - -// -// AssignCommand -// -// Set LControl's value message for clicking and command enabling. The default is |cmd_ToolbarButton| -// which is a container or url (a la personal toolbar button). Explicit commands (anything with -// "command:" in their URL) have their own command ID's in the FE. -// -void -CRDFPushButton :: AssignCommand ( ) -{ - SetValueMessage ( cmd_ToolbarButton ); - - // check for one of our known commands. If it is one of those, change the command id. - const char* url = HT_GetNodeURL(HTNode()); - if ( url && strncmp(url, "command:", 8) == 0 ) { - if ( strcmp(url, "command:back") == 0 ) - SetValueMessage ( cmd_GoBack ); - else if ( strcmp(url, "command:forward") == 0 ) - SetValueMessage ( cmd_GoForward ); - else if ( strcmp(url, "command:stop") == 0 ) - SetValueMessage ( cmd_Stop ); - else if ( strcmp(url, "command:reload") == 0 ) - SetValueMessage ( cmd_Reload ); - else if ( strcmp(url, "command:search") == 0 ) - SetValueMessage ( cmd_NetSearch ); - } - -} // AssignCommand - - -// -// CalcDisplayMode -// -// Computes the appropriate FE constant for the toolbar mode given what is in HT. Because this -// property can be specified/overridden, we have to check several places in a cascading -// manner: 1) check the node; if not there, 2) check the view the node is in. -// -UInt32 -CRDFPushButton :: CalcDisplayMode ( ) const -{ - Uint32 retVal = eTOOLBAR_TEXT_AND_ICONS; - char* data = NULL; - if ( ! HT_GetTemplateData(HTNode(), gNavCenter->toolbarDisplayMode, HT_COLUMN_STRING, &data) ) - if ( ! HT_GetTemplateData(HT_TopNode(HT_GetView(HTNode())), gNavCenter->toolbarDisplayMode, HT_COLUMN_STRING, &data) ) - data = NULL; - - if ( data ) { - if ( strcmp(data, "text") == 0 ) - retVal = eTOOLBAR_TEXT; - else if ( strcmp(data, "pictures") == 0 ) - retVal = eTOOLBAR_ICONS; - } - - return retVal; - -} // CalcDisplayMode - - -// -// CalcAlignment -// -// Compute the FE alignment of a specific HT property. If HT specifies the icon is on top, use |inTopAlignment|, -// otherwise use |inSideAlignment|. -// -UInt32 -CRDFPushButton :: CalcAlignment ( UInt32 inTopAlignment, Uint32 inSideAlignment ) const -{ - return IsIconAboveText() ? inTopAlignment : inSideAlignment; - -} // CalcAlignment - - -// -// IsIconAboveText -// -// A utility routine that asks HT for our icon/text orientation. -// This property is a view-level property so we need to pass in the top node -// of the view, not the node associated with this button. As a result, all buttons -// on a given toolbar MUST have the same alignment. You cannot have one button with -// the icon on top and another with the icons on the side in the same toolbar. -// -bool -CRDFPushButton :: IsIconAboveText ( ) const -{ - bool retVal = false; // assume icon is on the side (that's the default in HT) - char* value = NULL; - PRBool success = HT_GetTemplateData ( HT_TopNode(HT_GetView(HTNode())), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &value ); - if ( success && value ) { - if ( strcmp(value, "top") == 0 ) - retVal = true; - } - return retVal; - -} // IsIconAboveText - - -// -// CalcTitleFrame -// -// This calculates the bounding box of the title (if any). This is useful -// for both the string placement, as well as position the button graphic -// (again, if any). -// -// Note that this routine sets the text traits for the ensuing draw. If -// you override this method, make sure that you're doing the same. -// -void -CRDFPushButton :: CalcTitleFrame ( ) -{ - char* title = HT_GetNodeName(HTNode()); - if ( !title || !*title ) - return; - - UTextTraits::SetPortTextTraits(mTitleTraitsID); - - FontInfo theInfo; - ::GetFontInfo(&theInfo); - mCachedTitleFrame.top = mCachedButtonFrame.top; - mCachedTitleFrame.left = mCachedButtonFrame.left; - mCachedTitleFrame.right = mCachedTitleFrame.left + UGraphicGizmos::GetUTF8TextWidth(title, strlen(title)); - mCachedTitleFrame.bottom = mCachedTitleFrame.top + theInfo.ascent + theInfo.descent + theInfo.leading; - - if (mCurrentMode != eTOOLBAR_TEXT) - { - UGraphicGizmos::AlignRectOnRect(mCachedTitleFrame, mCachedButtonFrame, mTitleAlignment); - UGraphicGizmos::PadAlignedRect(mCachedTitleFrame, mTitlePadPixels, mTitleAlignment); - } - else - { - UGraphicGizmos::CenterRectOnRect(mCachedTitleFrame, mCachedButtonFrame); - } -} - - -// -// CalcGraphicFrame -// -// Precompute where the graphic should go. -// -void -CRDFPushButton :: CalcGraphicFrame ( ) -{ - // The container for the graphic starts out as a 32x32 area. If HT tells us - // the icon is a small icon, use 16x16. If the icon image is loaded, use its - // width and height. - // - // For some odd reason, even when HT wants us to draw a big icon, such as - // for command buttons like back/forward, it will still tell us it wants a - // small icon. Simply check to make sure that it's not a command button before - // shrinking the frame to 16. - Rect theContainerFrame = mCachedButtonFrame; - Rect theImageFrame = { 0, 0, 32, 32 }; - char* url = HT_GetIconURL ( HTNode(), PR_TRUE, HT_TOOLBAR_ENABLED ); - if ( url ) { - if ( strncmp(url, "icon/small", 10) == 0 ) { - if ( !IsCommandButton() ) - theImageFrame.right = theImageFrame.bottom = 16; - } - else { - SetImageURL(url); - - SDimension16 imageSize; - if ( GetImageDimensions(imageSize) ) { - theImageFrame.right = imageSize.width; - theImageFrame.bottom = imageSize.height; - } - } - } - - UGraphicGizmos::AlignRectOnRect(theImageFrame, theContainerFrame, mGraphicAlignment); - UGraphicGizmos::PadAlignedRect(theImageFrame, mGraphicPadPixels, mGraphicAlignment); - mCachedGraphicFrame = theImageFrame; -} - - -// -// AttachTooltip -// -// Creates the tooltip that asks HT to fill it in -// -void -CRDFPushButton :: AttachTooltip ( ) -{ - CToolTipAttachment* tip = new CToolTipAttachment(80, 11508); - Assert_(tip != NULL); - if ( tip ) - AddAttachment(tip); - -} // AttachTooltip - - -// -// AttachPaneEnabler -// -// Creates a enabler policy attachment. We can use the default enabling policy (which is based off -// FindCommandStatus) because we are an LControl. -// -void -CRDFPushButton :: AttachPaneEnabler ( ) -{ - CPaneEnabler* enabler = new CPaneEnabler; - Assert_(enabler != NULL); - if ( enabler ) - AddAttachment(enabler); - -} // AttachPaneEnabler - - -// -// AttachContextMenu -// -// Creates a context menu attachment that will be filled in from HT. -// -void -CRDFPushButton :: AttachContextMenu ( ) -{ - CToolbarButtonContextMenuAttachment* tip = new CToolbarButtonContextMenuAttachment; - Assert_(tip != NULL); - if ( tip ) - AddAttachment(tip); -} - - -// -// FindTooltipForMouseLocation -// -// Dredge the tooltip text out of HT for this button -// -void -CRDFPushButton :: FindTooltipForMouseLocation ( const EventRecord& inMacEvent, StringPtr outTip ) -{ - char* tipText = NULL; - PRBool success = HT_GetNodeData ( HTNode(), gNavCenter->buttonTooltipText, HT_COLUMN_STRING, &tipText ); - if ( success && tipText ) { - outTip[0] = strlen(tipText); - strcpy ( (char*) &outTip[1], tipText ); - } - else { - tipText = HT_GetNodeName(HTNode()); - if ( tipText ) { - outTip[0] = strlen(tipText); - strcpy ( (char*) &outTip[1], tipText ); - } - else - *outTip = 0; - } - -} // FindTooltipForMouseLocation - - -// -// AdjustCursorSelf -// -// Handle changing cursor to contextual menu cursor if cmd key is down -// -void -CRDFPushButton::AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) -{ - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenuCursor, - static_cast(const_cast(&inEvent))); - -} - - -void -CRDFPushButton::GetPlacement( placement& outPlacement, SDimension16 space_available ) const - { - outPlacement.natural_size = NaturalSize(space_available); - - // our min width is the width of the icon + the min # of chars HT tells us we can - // display (only if the icon is on the side). If the icon is above the text, we don't - // want to shrink - if ( ! IsIconAboveText() ) { - const int kBullshitSpacingConstant = 15; - UInt16 graphicWidth = mCachedGraphicFrame.right - mCachedGraphicFrame.left; - - string itemText = HT_GetNodeName(HTNode()); - char* minCharsStr = NULL; - Uint16 minChars = 15; -// PRBool success = HT_GetTemplateData ( HTNode(), gNavCenter->toolbarMinChars, HT_COLUMN_STRING, &minCharsStr ); -// if ( success && minCharsStr ) -// minChars = atoi(minChars); - if ( minChars < itemText.length() ) - itemText[minChars] = '\0'; - UInt16 textWidth = UGraphicGizmos::GetUTF8TextWidth(itemText.c_str(), itemText.length()) ; - - outPlacement.max_horizontal_shrink = outPlacement.natural_size.width - - (graphicWidth + textWidth + kBullshitSpacingConstant); - } - else - outPlacement.max_horizontal_shrink = 0 ; - - outPlacement.is_stretchable = false; - } - -// -// NaturalSize -// -SDimension16 -CRDFPushButton::NaturalSize( SDimension16 inAvailable ) const - /* - ...returns the natural size of this item. The toolbar asks this of - each item during layout. If possible, the toolbar will resize the - item to its natural size, as returned by this routine. - - If you return exactly the value from |inAvailable| for width, the - toolbar may assume that you wish to consume all available width, e.g., - for a URL entry field, or a status message. This does not apply to - height (mainly because of the problem described below). Returning a - height greater than |inAvailable| may encourage the toolbar to grow - vertically. - - For a particular dimension: - * an item with a fixed size can ignore |inAvailable| and return its - size; - * an item with a percentage size can calculate it based on - |inAvailable|; - * an item with a space-filling size should return the smallest space - it can live in. The toolbar will know it is stretchy because - it can call IsStretchy(). - - Problems: - this routine is essentially a hack. In particular, if |inAvailable| - happens to coincide with the natural size in either dimension, - hilarity ensues. Hopefully, |inAvailable| will always reflect a - toolbar wider than a normal button :-> - - Assumptions: - any toolbar item can be resized arbitrarilly small (to an - unspecified limit). - */ -{ - SDimension16 desiredSpace; - - if ( !IsIconAboveText() ) { - desiredSpace.width = (mCachedTitleFrame.right - mCachedTitleFrame.left) + - (mCachedGraphicFrame.right - mCachedGraphicFrame.left) + 15; - desiredSpace.height = min ( max(mCachedGraphicFrame.bottom - mCachedGraphicFrame.top, - mCachedTitleFrame.bottom - mCachedTitleFrame.top), 24); - } - else { - desiredSpace.width = 50; - desiredSpace.height = 50; //¥¥¥ for now - } - - return desiredSpace; -} - - -// -// PrepareDrawButton -// -// Sets up frames and masks before we draw -// -void -CRDFPushButton :: PrepareDrawButton( ) -{ - CalcLocalFrameRect(mCachedButtonFrame); - - // Calculate the drawing mask region. - ::OpenRgn(); - ::FrameRoundRect(&mCachedButtonFrame, mOvalWidth, mOvalHeight); - ::CloseRgn(mButtonMask); - - CalcTitleFrame(); - CalcGraphicFrame(); -} - - -// -// FinalizeDrawButton -// -// Called after we are done drawing. -// -void -CRDFPushButton :: FinalizeDrawButton ( ) -{ - // nothing for now. -} - - -void -CRDFPushButton::DrawSelf() -{ - PrepareDrawButton(); - - DrawButtonContent(); - - const char* title = HT_GetNodeName(HTNode()); - if ( title ) { - if (mCurrentMode != eTOOLBAR_ICONS && *title != 0) - DrawButtonTitle(); - } - - if (mCurrentMode != eTOOLBAR_TEXT) - DrawButtonGraphic(); - - if (!IsEnabled() || !IsActive()) - DrawSelfDisabled(); - - FinalizeDrawButton(); -} - - -// -// DrawButtonContent -// -// Handle drawing things other than the graphic or title. For instance, if the -// mouse is within this frame, draw a border around the button. If the mouse is -// down, draw the button to look depressed. -// -void -CRDFPushButton :: DrawButtonContent ( ) -{ - if (IsActive() && IsEnabled()) { - if ( IsTrackInside() ) - DrawButtonHilited(); - else if (IsMouseInFrame()) - DrawButtonOutline(); - } - -} // DrawButtonContent - - -// -// DrawButtonTitle -// -// Draw the title of the button. -// -void -CRDFPushButton :: DrawButtonTitle ( ) -{ - StColorPenState savedState; - StColorPenState::Normalize(); - - if (IsTrackInside() || GetValue() == Button_On) - ::OffsetRect(&mCachedTitleFrame, 1, 1); - - if ( IsMouseInFrame() ) - URDFUtilities::SetupForegroundTextColor ( HTNode(), gNavCenter->viewRolloverColor, kThemeIconLabelTextColor ) ; - else { - if ( IsEnabled() ) - URDFUtilities::SetupForegroundTextColor ( HTNode(), gNavCenter->viewFGColor, kThemeIconLabelTextColor ) ; - else - URDFUtilities::SetupForegroundTextColor ( HTNode(), gNavCenter->viewDisabledColor, kThemeInactivePushButtonTextColor ) ; - } - - char* title = HT_GetNodeName(HTNode()); - UGraphicGizmos::PlaceUTF8TextInRect(title, strlen(title), mCachedTitleFrame, teCenter, teCenter); - -} // DrawButtonTitle - - -// -// DrawButtonGraphic -// -// Draw the image specified by HT. -// ¥¥¥If there isn't an image, what should we do -// -void -CRDFPushButton :: DrawButtonGraphic ( ) -{ - // figure out which graphic to display. We need to check for pressed before rollover because - // rollover will always be true when tracking a mouseDown, but not vice-versa. - HT_IconType displayType = HT_TOOLBAR_ENABLED; - IconTransformType iconTransform = kTransformNone; - if ( !IsEnabled() ) { - displayType = HT_TOOLBAR_DISABLED; - iconTransform = kTransformDisabled; - } - else if ( IsTrackInside() ) { - displayType = HT_TOOLBAR_PRESSED; - iconTransform = kTransformSelected; - } - else if ( IsMouseInFrame() ) - displayType = HT_TOOLBAR_ROLLOVER; - - char* url = HT_GetIconURL ( HTNode(), PR_TRUE, displayType ); - if ( url ) { - if ( strncmp(url, "icon", 4) == 0 ) { - // HT specified that we use an FE icon to draw. If we're a command button, - // draw our hardcoded FE icons based on the command (this is done by DrawStandby()). - // Otherwise, draw an item or a container icon. - Point unused = {0,0}; - DrawStandby ( unused, iconTransform ) ; - } - else { - // HT specified we use a GIF. - Point topLeft; - topLeft.h = mCachedGraphicFrame.left; topLeft.v = mCachedGraphicFrame.top; - - // draw - SetImageURL ( url ); - DrawImage ( topLeft, iconTransform, 0, 0 ); - } - } - -} // DrawButtonGraphic - - -void -CRDFPushButton :: DrawSelfDisabled ( ) -{ - -} // DrawSelfDisabled - - -// -// DrawButtonOutline -// -// Draw the frame around the button to show rollover feedback -// -void -CRDFPushButton :: DrawButtonOutline ( ) -{ - // ¥ Setup a device loop so that we can handle drawing at the correct bit depth - StDeviceLoop theLoop ( mCachedButtonFrame ); - Int16 depth; - - // Draw face of button first - while ( theLoop.NextDepth ( depth )) - if ( depth >= 4 ) // don't do anything for black and white - { - Rect rect = mCachedButtonFrame; - ::InsetRect(&rect, 1, 1); - UGraphicGizmos::LowerRoundRectColorVolume(rect, 4, 4, - UGAAppearance::sGAHiliteContentTint); - } - - // Now draw GA button bevel, but only if HT hasn't specified a rollover color - StColorPenState thePenSaver; - thePenSaver.Normalize(); - if ( URDFUtilities::SetupForegroundColor(HTNode(), gNavCenter->viewRolloverColor, kThemeIconLabelTextColor) ) { - ::PenSize(2,2); - ::FrameRoundRect(&mCachedButtonFrame, mOvalWidth, mOvalHeight); - } - else - UGAAppearance::DrawGAButtonBevelTint(mCachedButtonFrame); - -} // DrawButtonOutline - - -// -// DrawButtonHilited -// -// Draw the button as if it has been clicked on, drawing the insides depressed -// -void -CRDFPushButton :: DrawButtonHilited ( ) -{ - // ¥ Setup a device loop so that we can handle drawing at the correct bit depth - StDeviceLoop theLoop ( mCachedButtonFrame ); - Int16 depth; - - // Draw face of button first - while ( theLoop.NextDepth ( depth )) - if ( depth >= 4 ) // don't do anything for black and white - { - Rect frame = mCachedButtonFrame; - ::InsetRect(&frame, 1, 1); - - // Do we need to do this very slight darkening? -// UGraphicGizmos::LowerRoundRectColorVolume(frame, 4, 4, UGAAppearance::sGASevenGrayLevels); - } - - // Now draw GA pressed button bevel - if ( URDFUtilities::SetupBackgroundColor(HTNode(), gNavCenter->viewPressedColor, kThemeIconLabelBackgroundBrush) ) { - Rect frame = mCachedButtonFrame; - ::InsetRect(&frame, 1, 1); - ::EraseRect(&frame); - } - else - UGAAppearance::DrawGAButtonPressedBevelTint(mCachedButtonFrame); -} - - -// -// ImageIsReady -// -// Called when the icon is ready to draw so we can refresh accordingly. -// -void -CRDFPushButton :: ImageIsReady ( ) -{ - // image dimensions have probably changed, and now that we know what they are, we - // should recompute accordingly. - CalcGraphicFrame(); - - Refresh(); // for now. - -} // ImageIsReady - - -// -// DrawStandby -// -// Called when the image we want to draw has not finished loading. We get -// called to draw something in its place. -// -void -CRDFPushButton :: DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const -{ - const ResIDT cItemIconID = 15313; - const ResIDT cFileIconID = kGenericDocumentIconResource; - - SInt16 iconID = 15165; - if ( IsCommandButton() ) { - switch ( mValueMessage ) { - case cmd_GoBack: - iconID = 15129; - break; - case cmd_GoForward: - iconID = 15133; - break; - case cmd_Reload: - iconID = 15161; - break; - case cmd_Stop: - iconID = 15165; - break; - case cmd_NetSearch: - iconID = 15149; - break; - } - } - else - iconID = HT_IsContainer(HTNode()) ? kGenericFolderIconResource : cItemIconID; - - ::PlotIconID(&mCachedGraphicFrame, atNone, inTransform, iconID); - -} // DrawStandby - - -void -CRDFPushButton :: MouseEnter ( Point /*inPortPt*/, const EventRecord & /*inMacEvent*/ ) -{ - mMouseInFrame = true; - if (IsActive() && IsEnabled()) - Refresh(); -} - - -void -CRDFPushButton :: MouseWithin ( Point /*inPortPt*/, const EventRecord & /*inMacEvent*/ ) -{ - // Nothing to do for now -} - - -void -CRDFPushButton :: MouseLeave( ) -{ - if ( !IsMouseInFrame() ) - return; - - mMouseInFrame = false; - if (IsActive() && IsEnabled()) - Refresh(); - -} // MouseLeave - - -// -// HotSpotAction -// -// Called when the mouse is clicked w/in this control -// -void -CRDFPushButton :: HotSpotAction(short /* inHotSpot */, Boolean inCurrInside, Boolean inPrevInside) -{ - if (inCurrInside != inPrevInside) { - SetTrackInside(inCurrInside); - Draw(NULL); // draw immed. because mouse is down, can't wait for update event - } - -} // HotSpotAction - - -void -CRDFPushButton :: HotSpotResult(Int16 inHotSpot) -{ - const char* url = HT_GetNodeURL(HTNode()); - if ( url && IsCommandButton() ) - { - // We're a command, baby. Look up our FE command and execute it. - HotSpotAction ( 0, false, true ); - BroadcastValueMessage(); - } - else if ( !HT_IsContainer(HTNode()) ) - { - // we're a plain old url (personal toolbar style). Launch it if HT says we're allowed to. - if ( !URDFUtilities::LaunchNode(HTNode()) ) - CFrontApp::DoGetURL( url ); - } - else { - - // we're a popdown treeview. Open it the way it wants to be opened - // convert local to port coords for this cell - Rect portRect; - CalcPortFrameRect ( portRect ); - - // find the Browser window and tell it to show a popdown with - // the give HT_Resource for this cell - LView* top=GetSuperView(); - while ( top && top->GetSuperView() ) - top = top->GetSuperView(); - - // popdown the tree - CBrowserWindow* browser = dynamic_cast(top); - Assert_(browser != NULL); - if ( browser ) { - switch ( HT_GetTreeStateForButton(HTNode()) ) { - - case HT_DOCKED_WINDOW: - browser->OpenDockedTreeView ( HTNode() ); - break; - - case HT_STANDALONE_WINDOW: - LCommander::GetTopCommander()->ProcessCommand(cmd_NCOpenNewWindow, HTNode() ); - break; - - case HT_POPUP_WINDOW: - browser->PopDownTreeView ( portRect.left, portRect.bottom + 5, HTNode() ); - break; - - default: - DebugStr("\pHT_GetTreeStateForButton returned unknown type"); - break; - } // case of which tree type to create - } // if browser window found - - } // else create a tree - -} // HotSpotResult - - -// -// DoneTracking -// -// Reset the toolbar back to its original state. -// -void -CRDFPushButton :: DoneTracking ( SInt16 inHotSpot, Boolean inGoodTrack ) -{ - SetTrackInside(false); - - if ( inGoodTrack ) - Refresh(); - else - MouseLeave(); // mouse has left the building. Redraw the correct state now, not later -} - - -// -// EnableSelf -// DisableSelf -// -// Override to redraw immediately when enabled or disabled. -// - -void -CRDFPushButton :: EnableSelf ( ) -{ - if (FocusExposed()) { - FocusDraw(); - Draw(NULL); - } -} - -void -CRDFPushButton :: DisableSelf ( ) -{ - if (FocusExposed()) { - FocusDraw(); - Draw(NULL); - } -} - - -// -// IsCommandButton -// -// A utility routine to tell us if this is a special button (like back, forward, reload, etc) or -// just a simple button (a la the personal toolbar). If the button has a message different from -// that of a simple button (set by AssignCommand()) then we're special. -// -// Note: because of this, this routine is not valid until AssignCommand() has been called. Any time -// after the constructor (where AssignCommand() is called) should be ok. -// -bool -CRDFPushButton :: IsCommandButton ( ) const -{ - return mValueMessage != cmd_ToolbarButton; - -} // IsCommandButton - - -// -// ClickSelf -// -// Try context menu if control key is down, otherwise be a button -// -void -CRDFPushButton :: ClickSelf( const SMouseDownEvent &inMouseDown ) -{ - if (inMouseDown.macEvent.modifiers & controlKey) { - CContextMenuAttachment::SExecuteParams params; - params.inMouseDown = &inMouseDown; - ExecuteAttachments( CContextMenuAttachment::msg_ContextMenu, ¶ms ); - } - else - LControl::ClickSelf(inMouseDown); - -} // ClickSelf - - -#pragma mark - - - -CRDFSeparator :: CRDFSeparator ( HT_Resource inNode ) - : CRDFToolbarItem(inNode) -{ - - -} - - -CRDFSeparator :: ~CRDFSeparator ( ) -{ - - - -} - - -// a strawman drawing routine for testing purposes only -void -CRDFSeparator :: DrawSelf ( ) -{ - Rect localRect; - CalcLocalFrameRect ( localRect ); - - ::PaintRect ( &localRect ); -} - - -// -// NaturalSize -// (See comment on CRDFPushButton::NaturalSize() for tons of info.) -// -// Return the appropriate size for a separator. -// -SDimension16 -CRDFSeparator :: NaturalSize( SDimension16 inAvailable ) const -{ - SDimension16 desiredSpace; - desiredSpace.width = 5; - desiredSpace.height = 24; - - return desiredSpace; - -} // NaturalSize - - -void -CRDFSeparator::GetPlacement( placement& outPlacement, SDimension16 space_available ) const - { - outPlacement.natural_size = NaturalSize(space_available); - outPlacement.is_stretchable = false; - outPlacement.max_horizontal_shrink = 0; - } - -#pragma mark - - - -CRDFURLBar :: CRDFURLBar ( HT_Resource inNode ) - : CRDFToolbarItem(inNode) -{ - -} - - -CRDFURLBar :: ~CRDFURLBar ( ) -{ - - - -} - - -// -// FinishCreate -// -// Called after this item has been placed into the widget hierarchy. Reanimate the -// url bar from a PPob. This needs to be done here (and not in the constructor) -// because some of its components (proxy icon, etc) throw/assert if they are not -// part of a window at creation time. -// -void -CRDFURLBar :: FinishCreate ( ) -{ - CRDFToolbarItem::FinishCreate(); - - LWindow* window = LWindow::FetchWindowObject(GetMacPort()); - LView* view = UReanimator::CreateView(1104, this, window); // create the url bar - - // chances are good that if this button streams in after the window has been - // created, the url bar will have not been hooked up to the current context. Doing - // it here ensures it will. - CBrowserWindow* browser = dynamic_cast(window); - if ( browser ) - browser->HookupContextToToolbars(); - -} // FinishCreate - - -// -// AttachContextMenu -// -// Creates a context menu attachment that will be filled in from HT. -// -void -CRDFURLBar :: AttachContextMenu ( ) -{ - CToolbarButtonContextMenuAttachment* tip = new CToolbarButtonContextMenuAttachment; - Assert_(tip != NULL); - if ( tip ) - AddAttachment(tip); -} - - -void -CRDFURLBar::GetPlacement( placement& outPlacement, SDimension16 space_available ) const - { - outPlacement.natural_size = NaturalSize(space_available); - outPlacement.is_stretchable = true; //¥¥¥ for now - outPlacement.max_horizontal_shrink = outPlacement.natural_size.width - 100; //¥¥¥ for now - } - - -// -// NaturalSize -// (See comment on CRDFPushButton::NaturalSize() for tons of info.) -// -// Return the smallest size we can live in. -// -SDimension16 -CRDFURLBar::NaturalSize( SDimension16 inAvailable ) const -{ - SDimension16 desiredSpace; - desiredSpace.width = 100; desiredSpace.height = 50; //¥¥¥ is this enough? - - return desiredSpace; - -} // NaturalSize - - -// -// IsStretchy -// -// -bool -CRDFURLBar :: IsStretchy ( ) const -{ - return true; //¥¥¥ do this right. -} diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarItem.h b/mozilla/cmd/macfe/gui/CRDFToolbarItem.h deleted file mode 100644 index 09da7d824a2..00000000000 --- a/mozilla/cmd/macfe/gui/CRDFToolbarItem.h +++ /dev/null @@ -1,281 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Interfaces for all the things that can go on a toolbar. -// -// CRDFToolbarItem - the base class for things that go on toolbars -// CRDFPushButton - a toolbar button -// CRDFSeparator - a separator bar -// CRDFURLBar - the url bar w/ proxy icon -// - -#pragma once - -#include "htrdf.h" -#include "CImageIconMixin.h" -#include "CDynamicTooltips.h" - -class CToolbarButtonContextMenuAttachment; - - -// -// class CRDFToolbarItem -// -// The base class for things that go on toolbars. This is a virtual class -// and should never be instantiated by itself. -// -class CRDFToolbarItem -{ -public: - friend class CToolbarButtonContextMenuAttachment; - - struct placement - /* - */ - { - SDimension16 natural_size; - SInt16 max_horizontal_shrink; // min width is natural_size.width-max_horizontal_shrink - bool is_stretchable; // can usefully grow, e.g., true for a text entry field - }; - - // Frame management routines - // These MUST be implemented in every subclass. We do this so subclasses - // can inherit from the appropriate LView (such as LControl) w/out forcing - // that decision into the base class. - virtual void PutInside ( LView *inView, Boolean inOrient = true) = 0; - virtual void ResizeFrameTo ( SInt16 inWidth, SInt16 inHeight, Boolean inRefresh ) = 0; - virtual void PlaceInSuperFrameAt ( SInt32 inHoriz, SInt32 inVert, Boolean inRefresh ) = 0; - virtual SDimension16 NaturalSize ( SDimension16 inAvail ) const = 0; // OBSOLETE - virtual bool IsStretchy ( ) const { return false; } // OBSOLETE - virtual void GetPlacement( placement&, SDimension16 space_available ) const = 0; - - // Post-creation init routines - // These are called AFTER the item has been placed inside its parent - // toolbar. This is important because some items need to be part of - // a window or need to walk up the view hierarchy to register themselves. - virtual void HookUpToListeners ( ) { } ; - virtual void FinishCreate ( ) ; - - -protected: - - HT_Resource HTNode ( ) { return mNode; } - const HT_Resource HTNode ( ) const { return mNode; } - - virtual void AttachContextMenu ( ) { } ; - -private: - - HT_Resource mNode; - - // don't instantiate one of these - CRDFToolbarItem ( HT_Resource inNode ) ; - virtual ~CRDFToolbarItem ( ) ; - - // items cannot be passed by value because they exist in 1-to-1 - // correspondance with UI elements - CRDFToolbarItem( const CRDFToolbarItem& ); // DON'T IMPLEMENT - CRDFToolbarItem& operator=( const CRDFToolbarItem& ); // DON'T IMPLEMENT - -}; // CRDFToolbarItem - - -// -// class CRDFPushButton -// -// It's a button, it's a slicer, it's a mulcher, it's a .... -// -class CRDFPushButton : public CRDFToolbarItem, public LControl, public CImageIconMixin, - public CDynamicTooltipMixin -{ -public: - CRDFPushButton ( HT_Resource inNode ) ; - virtual ~CRDFPushButton ( ) ; - - // returns how the buttons wants to display: icon only, icon & text, text only - // based on the properties in HT. - UInt32 CalcDisplayMode ( ) const; - - virtual void PutInside ( LView *inView, Boolean inOrient = true) { - LPane::PutInside(inView, inOrient); - } - virtual void ResizeFrameTo ( SInt16 inWidth, SInt16 inHeight, Boolean inRefresh ) { - LPane::ResizeFrameTo(inWidth, inHeight, inRefresh); - } - virtual void PlaceInSuperFrameAt ( SInt32 inHoriz, SInt32 inVert, Boolean inRefresh ) { - LPane::PlaceInSuperFrameAt(inHoriz, inVert, inRefresh); - } - virtual SDimension16 NaturalSize ( SDimension16 inAvail ) const ; - virtual void GetPlacement( placement&, SDimension16 space_available ) const ; - - virtual void HookUpToListeners ( ) ; - -protected: - - // computations for drawing text and icon - virtual void PrepareDrawButton ( ) ; - virtual void CalcGraphicFrame ( ) ; - virtual void CalcTitleFrame ( ) ; - virtual void FinalizeDrawButton ( ) ; - - // handle actual drawing - virtual void DrawSelf ( ) ; - virtual void DrawButtonContent ( ) ; - virtual void DrawButtonTitle ( ) ; - virtual void DrawButtonGraphic ( ) ; - virtual void DrawSelfDisabled ( ) ; - virtual void DrawButtonOutline ( ) ; - virtual void DrawButtonHilited ( ) ; - virtual void EnableSelf ( ) ; - virtual void DisableSelf ( ) ; - - // handle drawing icon as an image - virtual void ImageIsReady ( ) ; - virtual void DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const ; - - // handle rollover feedback - virtual void MouseEnter ( Point inPortPt, const EventRecord &inMacEvent) ; - virtual void MouseWithin ( Point inPortPt, const EventRecord &inMacEvent); - virtual void MouseLeave(void); - virtual void AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) ; - - // handle control tracking - virtual void HotSpotAction(short /* inHotSpot */, Boolean inCurrInside, Boolean inPrevInside) ; - virtual void DoneTracking ( SInt16 inHotSpot, Boolean /* inGoodTrack */) ; - virtual void HotSpotResult ( Int16 inHotSpot ); - virtual void ClickSelf( const SMouseDownEvent &inMouseDown ) ; - - bool IsMouseInFrame ( ) const { return mMouseInFrame; } ; - void SetTrackInside(bool inInside) { mTrackInside = inInside; } - bool IsTrackInside() const { return mTrackInside; } - - // calculate tooltip to display title - virtual void FindTooltipForMouseLocation ( const EventRecord& inMacEvent, - StringPtr outTip ); - - virtual void AssignCommand ( ) ; - // is this a special button like back/forward/reload or is it just a url - bool IsCommandButton ( ) const ; - bool IsIconAboveText ( ) const ; - -private: - - UInt32 CalcAlignment ( UInt32 inTopAlignment, Uint32 inSideAlignment ) const; - void AttachTooltip ( ) ; - void AttachContextMenu ( ) ; - void AttachPaneEnabler ( ) ; - - StRegion mButtonMask; - Rect mCachedButtonFrame; - Rect mCachedTitleFrame; - Rect mCachedGraphicFrame; - - ResIDT mTitleTraitsID; - UInt8 mCurrentMode; - Int8 mGraphicPadPixels; - Int8 mTitlePadPixels; - Int8 mTitleAlignment; - Int8 mGraphicAlignment; - Uint8 mOvalWidth, mOvalHeight; - - bool mMouseInFrame; - bool mTrackInside; - - // items cannot be passed by value because they exist in 1-to-1 - // correspondance with UI elements - CRDFPushButton( const CRDFPushButton& ); // DON'T IMPLEMENT - CRDFPushButton& operator=( const CRDFPushButton& ); // DON'T IMPLEMENT - -}; // CRDFToolbarItem - - -// -// class CRDFSeparator -// -// Draws a 3d-beveled vertical separator between portions of toolbars. -// -class CRDFSeparator : public CRDFToolbarItem, public LPane -{ -public: - CRDFSeparator ( HT_Resource inNode ) ; - virtual ~CRDFSeparator ( ) ; - - // Frame management routines - virtual void PutInside ( LView *inView, Boolean inOrient = true) { - LPane::PutInside(inView, inOrient); - } - virtual void ResizeFrameTo ( SInt16 inWidth, SInt16 inHeight, Boolean inRefresh ) { - LPane::ResizeFrameTo(inWidth, inHeight, inRefresh); - } - virtual void PlaceInSuperFrameAt ( SInt32 inHoriz, SInt32 inVert, Boolean inRefresh ) { - LPane::PlaceInSuperFrameAt(inHoriz, inVert, inRefresh); - } - virtual SDimension16 NaturalSize ( SDimension16 inAvail ) const ; - virtual void GetPlacement( placement&, SDimension16 space_available ) const ; - - virtual void DrawSelf ( ) ; - -private: - // items cannot be passed by value because they exist in 1-to-1 correspondance - // with UI elements - CRDFSeparator( const CRDFSeparator& ); // DON'T IMPLEMENT - CRDFSeparator& operator=( const CRDFSeparator& ); // DON'T IMPLEMENT - -}; // CRDFToolbarItem - - -// -// class CRDFURLBar -// -// Our fabled url entry bar with page proxy icon. -// -class CRDFURLBar : public CRDFToolbarItem, public LView -{ -public: - CRDFURLBar ( HT_Resource inNode ) ; - virtual ~CRDFURLBar ( ) ; - - // Frame management routines - virtual void PutInside ( LView *inView, Boolean inOrient = true) { - LPane::PutInside(inView, inOrient); - } - virtual void ResizeFrameTo ( SInt16 inWidth, SInt16 inHeight, Boolean inRefresh ) { - LPane::ResizeFrameTo(inWidth, inHeight, inRefresh); - } - virtual void PlaceInSuperFrameAt ( SInt32 inHoriz, SInt32 inVert, Boolean inRefresh ) { - LPane::PlaceInSuperFrameAt(inHoriz, inVert, inRefresh); - } - virtual SDimension16 NaturalSize ( SDimension16 inAvail ) const ; - virtual bool IsStretchy ( ) const ; - virtual void GetPlacement( placement&, SDimension16 space_available ) const ; - - virtual void FinishCreate ( ) ; - -private: - - void AttachContextMenu ( ) ; - - // items cannot be passed by value because they exist in 1-to-1 correspondance - // with UI elements - CRDFURLBar( const CRDFURLBar& ); // DON'T IMPLEMENT - CRDFURLBar& operator=( const CRDFURLBar& ); // DON'T IMPLEMENT - -}; // CRDFToolbarItem diff --git a/mozilla/cmd/macfe/gui/CSecurityStateListener.cp b/mozilla/cmd/macfe/gui/CSecurityStateListener.cp deleted file mode 100644 index 574280684b8..00000000000 --- a/mozilla/cmd/macfe/gui/CSecurityStateListener.cp +++ /dev/null @@ -1,46 +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. - */ - -#include "CSecurityStateListener.h" - -#include "CBrowserContext.h" // for msg_SecurityState -#include "ssl.h" // for SSL_SECURITY_STATUS_* defines - -CSecurityStateListener::CSecurityStateListener() -{ -} - -CSecurityStateListener::~CSecurityStateListener() -{ -} - -void CSecurityStateListener::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - if (inMessage == msg_SecurityState) - { - int status = (int)ioParam; - ESecurityState state = eUnsecureState; - if (status == SSL_SECURITY_STATUS_ON_LOW || status == SSL_SECURITY_STATUS_ON_HIGH) - { - state = eSecureState; - } - NoteSecurityState(state); - } -} diff --git a/mozilla/cmd/macfe/gui/CSecurityStateListener.h b/mozilla/cmd/macfe/gui/CSecurityStateListener.h deleted file mode 100644 index 1f91898c716..00000000000 --- a/mozilla/cmd/macfe/gui/CSecurityStateListener.h +++ /dev/null @@ -1,40 +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. - */ - -#pragma once - -#include - -enum ESecurityState -{ - eUnsecureState, - eSecureState -}; - -class CSecurityStateListener : public LListener -{ - public: - CSecurityStateListener(); - virtual ~CSecurityStateListener(); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - protected: - - virtual void NoteSecurityState(ESecurityState inSecurityState) = 0; -}; diff --git a/mozilla/cmd/macfe/gui/CShelfMixin.cp b/mozilla/cmd/macfe/gui/CShelfMixin.cp deleted file mode 100644 index 070b2f5f9a9..00000000000 --- a/mozilla/cmd/macfe/gui/CShelfMixin.cp +++ /dev/null @@ -1,119 +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. - */ - -// -// CShelfMixin.cp -// -// Implementation of the CShelf class. See header files for details -// - -#include "CShelfMixin.h" -#include "prefapi.h" -#include "CTargetFramer.h" - -#include "LCommander.h" - - -// -// Constructor -// -CShelf :: CShelf ( LDividedView* inDivView, const char* inPrefString, - LDividedView::FeatureFlags inFlags ) - : mPrefString(inPrefString), mShelf(inDivView) -{ - // configure the divided view appropriately - mShelf->OnlySetFeatureFlags ( inFlags ); -} - - -// -// Destructor -// -// Don't dispose of anything explicitly. -// -CShelf :: ~CShelf ( ) -{ -} - - -// -// ToggleShelf -// -// Expand or collapse the shelf based on the previous state. Will also update the -// preference if the parameter flag is true. -// -void -CShelf :: ToggleShelf ( bool inUpdatePref ) -{ - if ( !mShelf ) - return; // this is the case for composer - - mShelf->DoZapAction(); - - // Update the visible pref. The pref should be true if the pane is showing (!collapsed) - if ( inUpdatePref && mPrefString.c_str() ) - PREF_SetBoolPref ( mPrefString.c_str(), IsShelfOpen() ); - - // force menu items to update show "Show" and "Hide" string changes are reflected - LCommander::SetUpdateCommandStatus(true); - -} // ToggleShelf - - -// -// SetShelfState -// -// Explicitly set the state of the shelf (useful for initialization based on a preference). -// This is so confusing because all we can do is toggle the panes in LDividedView. -// -void -CShelf :: SetShelfState ( bool inShelfOpen, bool inUpdatePref ) -{ - if ( !mShelf ) - return; // this is the case for composer - - bool isShelfOpenNow = IsShelfOpen(); - if ( inShelfOpen ) { - if ( !isShelfOpenNow ) - ToggleShelf(inUpdatePref); - } - else - if ( isShelfOpenNow ) - ToggleShelf(inUpdatePref); - -} // SetShelfState - - -// -// IsShelfOpen -// -// return the state of the shelf. -// -bool -CShelf :: IsShelfOpen ( ) -{ - if ( !mShelf ) - return false; // this is the case for composer - - // this class handles both the case where the first pane is the one being collapsed - // and also the case where the 2nd pane is the one being collapsed. Either way, if - // one of them is collapsed, then the shelf is not open (because the concept of the - // shelf is tied to the one that is collapsed) - return ( ! (mShelf->IsFirstPaneCollapsed() || mShelf->IsSecondPaneCollapsed()) ) ; - -} // IsShelfOpen diff --git a/mozilla/cmd/macfe/gui/CShelfMixin.h b/mozilla/cmd/macfe/gui/CShelfMixin.h deleted file mode 100644 index 521b31f242e..00000000000 --- a/mozilla/cmd/macfe/gui/CShelfMixin.h +++ /dev/null @@ -1,54 +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. - */ - -// -// File: CShelfMixin.h -// -// Interface for the CShelf class which you can add to your window class to provide -// a wrapper around the basic functionality for manipulating a collapsable shelf in the -// browser window. -// - -#pragma once - -#include -#include "divview.h" - - -class CShelf -{ - public: - - enum { kClosed = false, kOpen = true } ; - - CShelf ( LDividedView* inDivView, const char* inPrefString, LDividedView::FeatureFlags inFlags ) ; - virtual ~CShelf ( ) ; - - virtual void ToggleShelf ( bool inUpdatePref = true ) ; - virtual void SetShelfState ( bool inNewState, bool inUpdatePref = true ); - virtual bool IsShelfOpen ( ) ; - - // in case this class doesn't provide enough of functionality... - LDividedView* GetShelf() const { return mShelf; } ; - - protected: - - LDividedView* mShelf; - string mPrefString; - -}; // CShelfMixin diff --git a/mozilla/cmd/macfe/gui/CSingleLineEditField.cp b/mozilla/cmd/macfe/gui/CSingleLineEditField.cp deleted file mode 100644 index 47963065ce6..00000000000 --- a/mozilla/cmd/macfe/gui/CSingleLineEditField.cp +++ /dev/null @@ -1,43 +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. - */ - -#ifdef MOZ_MAIL_NEWS -// =========================================================================== -// CSingleLineEditField.cp -// =========================================================================== -// -// Filters out carriage returns in the scrap on a paste command - -#include "CSingleLineEditField.h" - -#include - -#include "CPasteSnooper.h" - -// install an attachment to filter out carriage returns in a paste -CSingleLineEditField::CSingleLineEditField (LStream* inStream) - : CSearchEditField(inStream) -{ - AddAttachment(new CPasteSnooper(ONLY_TAKE_FIRST_LINE)); -} - -// Does nothing. -CSingleLineEditField::~CSingleLineEditField () -{ -} -#endif // MOZ_MAIL_NEWS diff --git a/mozilla/cmd/macfe/gui/CSingleLineEditField.h b/mozilla/cmd/macfe/gui/CSingleLineEditField.h deleted file mode 100644 index d2bb14232ce..00000000000 --- a/mozilla/cmd/macfe/gui/CSingleLineEditField.h +++ /dev/null @@ -1,54 +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. - */ - -/* - -FILE: CSingleLineEditField.h -CLASS: CSingleLineEditField -DESCRIPTION: Filters out carriage returns when responding to a cmd_Paste - This is the only change from LGAEditField -CREATION DATE: 97.06.03 - ----------------------------------------<< ¥ >>---------------------------------------- - -Overrides ObeyCommand to enable filtering of carriage returns from the clipboard. -Reason this fix is important is because there are fields where you really don't want -to permit carriage returns. In the preferences dialog and in the mail filters dialog -for example. Carriage returns end up rendering the files used by these dialogs -unreadable by the parser - -Inherits from LGAEditField so it has a gray scale appearance - ----------------------------------------<< ¥ >>---------------------------------------- -*/ - -#pragma once - -#include "SearchHelpers.h" - -class CSingleLineEditField : public CSearchEditField { - - public: - - enum { class_ID = 'sLEF' }; - - CSingleLineEditField (LStream* inStream); - - virtual ~CSingleLineEditField (); - -}; diff --git a/mozilla/cmd/macfe/gui/CSizeBox.cp b/mozilla/cmd/macfe/gui/CSizeBox.cp deleted file mode 100644 index 30eb1724036..00000000000 --- a/mozilla/cmd/macfe/gui/CSizeBox.cp +++ /dev/null @@ -1,115 +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. - */ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CSizeBox.h" - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - - -/*====================================================================================== - Broadcast a message. -======================================================================================*/ - -void CSizeBox::ClickSelf(const SMouseDownEvent &inMouseDown) { - - // Find the window object - LWindow *theWindow = LWindow::FetchWindowObject(GetMacPort()); - - // Click in its grow - theWindow->ClickInGrow(inMouseDown.macEvent); -} - - -/*====================================================================================== - Redraw the control. -======================================================================================*/ - -void CSizeBox::ActivateSelf(void) { - - Inherited::ActivateSelf(); - - if ( FocusExposed() ) { - DrawSelf(); - } -} - - -/*====================================================================================== - Redraw the control. -======================================================================================*/ - -void CSizeBox::DeactivateSelf(void) { - - Inherited::ActivateSelf(); - - if ( FocusExposed() ) { - DrawSelf(); - } -} - - -/*====================================================================================== - Draw the control. -======================================================================================*/ - -void CSizeBox::DrawSelf(void) { - - Rect frame; - if ( !CalcLocalFrameRect(frame) ) return; - - ApplyForeAndBackColors(); - - if ( IsActive() ) { - Inherited::DrawSelf(); - } else { - ::InsetRect(&frame, 1, 1); - ::EraseRect(&frame); - ::InsetRect(&frame, -1, -1); - ::FrameRect(&frame); - } -} - diff --git a/mozilla/cmd/macfe/gui/CSizeBox.h b/mozilla/cmd/macfe/gui/CSizeBox.h deleted file mode 100644 index 5fd8be6eebf..00000000000 --- a/mozilla/cmd/macfe/gui/CSizeBox.h +++ /dev/null @@ -1,85 +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 __H_CSizeBox -#define __H_CSizeBox -#pragma once - -/*====================================================================================== - - DESCRIPTION: Implements a class for placing a resize box anywhere within a window - and allowing it to be resized. - - The CSizeBox.rsrc resource file should also be included. - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include - - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - - -class CSizeBox : public LButton { - -private: - - typedef LButton Inherited; - - -public: - - enum { class_ID = 'SiZe' }; - - CSizeBox(LStream *inStream) : - LButton(inStream) { - } - -protected: - - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - virtual void ActivateSelf(void); - virtual void DeactivateSelf(void); - virtual void DrawSelf(void); -}; - - -#endif // __H_CSizeBox - diff --git a/mozilla/cmd/macfe/gui/CSpinningN.cp b/mozilla/cmd/macfe/gui/CSpinningN.cp deleted file mode 100644 index dcab6717791..00000000000 --- a/mozilla/cmd/macfe/gui/CSpinningN.cp +++ /dev/null @@ -1,542 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CSpinningN.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include -#include "CSpinningN.h" -#include "UGraphicGizmos.h" -#include "UGAAppearance.h" -#include "CSharedPatternWorld.h" -#include "CToolbarModeManager.h" -#include "macutil.h" -#include "CNSContext.h" // for the broadcast messages -#include "uapp.h" -#include "resgui.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Internal Constants -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -const Int32 kSpinInterval = 10; -const ResIDT ResID_LargeSpinIconBase = 700; -const ResIDT ResID_SmallSpinIconBase = 800; -const ResIDT ResID_LargeCicnBase = 700; -const ResIDT ResID_SmallCicnBase = 128; -short CSpinningN::mAnimResFile = -1; // refNum_Undefined - -const Int16 cLargeIconHeight = 30; -const Int16 cLargeIconWidth = 30; -const Int16 cSmallIconHeight = 16; -const Int16 cSmallIconWidth = 16; -const Int16 cButtonBevelBorderSize = 8; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CSpinningN::CSpinningN(LStream *inStream) - : mAdornment(nil), - mFill(nil), - - CPatternButton(inStream) -{ - mSpinCounter = 0; // 0 indicates the icon is not spinning - mIsCoBranded = false; - mSmallSeqCount = 0; - mLargeSeqCount = 0; - mRefCount = 0; - - mHasLargeCoBrand = true; - mHasSmallCoBrand = true; - - mFinishedCreatingSelf = false; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::FinishCreateSelf(void) -{ - CPatternButton::FinishCreateSelf(); - - CalcAnimationMode(); - RepositionSelf(); - mFinishedCreatingSelf = true; - - LView* theSuperView = GetSuperView(); - if (theSuperView) - { - mAdornment = theSuperView->FindPaneByID(kAdornmentPaneID); - mFill = theSuperView->FindPaneByID(kFillPaneID); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::ListenToMessage( - MessageT inMessage, - void* /* ioParam */) -{ - switch (inMessage) - { - case msg_NSCStartLoadURL: - StartRepeating(); - break; - - case msg_NSCAllConnectionsComplete: - StopRepeating(); - break; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh) -{ - LPane::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh); - -// 1997-03-22 pkc -// Put in hack to work around problem below. We can't comment out call -// to RepositionSelf because then the spinning 'n' won't resize itself when -// the toolbar containing it changes its size. - if (mFinishedCreatingSelf) - RepositionSelf(); -// Don't do that here: AdaptToSuperFrameSize() can be called before -// FinishCreateSelf() and for some reason, the resource file may -// not be positionned correctly at that time. -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::StartRepeating(void) -{ - if (mRefCount == 0) - { - mSpinCounter = 1; // > 0 means that we're spinning - mLastSpinTicks = ::TickCount(); - - LPeriodical::StartRepeating(); - } - ++mRefCount; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::StopRepeating() -{ - if (mRefCount <= 1) - { - LPeriodical::StopRepeating(); - - mSpinCounter = 0; // 0 indicates the icon is not spinning - mLastSpinTicks = ::TickCount(); - - if (IsVisible() && FocusDraw()) - Draw(NULL); - } - - --mRefCount; - if (mRefCount < 0) - mRefCount = 0; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// BEWARE: this method bypasses the mRefCount counter in order to force -// the icon to stop spinning. It's useful in several places where we do -// know for sure that all background activity has stopped. -void CSpinningN::StopSpinningNow() -{ - mRefCount = 1; - StopRepeating(); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::SpendTime(const EventRecord& /* inMacEvent */) -{ - if ((::TickCount() - mLastSpinTicks) < kSpinInterval) - return; - - mLastSpinTicks = ::TickCount(); - - mSpinCounter = (mSpinCounter + 1) % mIconCount; - if (mSpinCounter == 0) // skip zero - mSpinCounter++; - - if (IsVisible() && FocusDraw()) - Draw(NULL); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::DrawSelf(void) -{ - PrepareDrawButton(); - - DrawButtonContent(); - - DrawButtonGraphic(); - - FinalizeDrawButton(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawButtonContent -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::DrawButtonContent(void) -{ - CGrafPtr thePort; - ::GetPort(&(GrafPtr)thePort); - - Rect theFrame = mCachedButtonFrame; - Point theAlignment; - - CalcOrientationPoint(theAlignment); - mPatternWorld->Fill(thePort, theFrame, theAlignment); - - ::InsetRect(&theFrame, 2, 2); - - if (IsActive() && IsEnabled()) - { - if (IsTrackInside() || (!IsBehaviourButton() && (mValue == Button_On))) - { - DrawButtonHilited(); - } - else - { - DrawButtonNormal(); - } - } - else - { - DrawSelfDisabled(); - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawSelfDisabled -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::DrawSelfDisabled(void) -{ - UGAAppearance::DrawGAButtonDimmedBevelTint(mCachedButtonFrame); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ DrawButtonGraphic -// -// the first cicn's or icl8's in each of the large and small sequences should -// be preloaded and locked. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::DrawButtonGraphic(void) -{ - Rect theFrame; - CalcLocalFrameRect(theFrame); - - UGraphicGizmos::CenterRectOnRect(mCachedIconFrame, theFrame); - - if (IsTrackInside() || (GetValue() == Button_On)) - ::OffsetRect(&mCachedIconFrame, 1, 1); - - if (mIsCoBranded) - { - StUseResFile rf(mAnimResFile); - CIconHandle theHandle = ::GetCIcon(mGraphicID + mSpinCounter); - if (theHandle == NULL) - theHandle = ::GetCIcon(mGraphicID); - - if (theHandle != NULL) - { - ::PlotCIcon(&mCachedIconFrame, theHandle); - ::DisposeCIcon(theHandle); - } - } - else - { -// UGraphicGizmos::CenterRectOnRect(mCachedIconFrame, theFrame); - OSErr theErr = ::PlotIconID(&mCachedIconFrame, atNone, ttNone, mGraphicID + mSpinCounter); - if (theErr != noErr) - ::PlotIconID(&mCachedIconFrame, atNone, ttNone, mGraphicID); - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// For E-Kit compatability continue to support cicn resources as well -// as icl icons. E-Kit must also allow for a variable number of frames -// and non-default icon dimensions. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::CalcAnimationMode(void) -{ - StResLoad theResLoad(false); - StUseResFile rf(mAnimResFile); - - Handle theSequence = ::Get1Resource('cicn', ResID_LargeCicnBase + mLargeSeqCount); - while (theSequence != NULL) - { - mLargeSeqCount++; - theSequence = ::Get1Resource('cicn', ResID_LargeCicnBase + mLargeSeqCount); - } - - theSequence = ::Get1Resource('cicn', ResID_SmallCicnBase + mSmallSeqCount); - while (theSequence != NULL) - { - mSmallSeqCount++; - theSequence = ::Get1Resource('cicn', ResID_SmallCicnBase + mSmallSeqCount); - } - - mHasSmallCoBrand = mSmallSeqCount > 0; - mHasLargeCoBrand = mLargeSeqCount > 0; - - if (!mHasSmallCoBrand) { - mSmallSeqCount = kMaxSpinStages; - } - - if (!mHasLargeCoBrand) { - mLargeSeqCount = kMaxSpinStages; - } -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ ChangeMode -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean CSpinningN::ChangeMode(Int8 inNewMode, SDimension16& outDimensionDeltas) -{ - SDimension16 oldDimensions, frameSize; - GetFrameSize(oldDimensions); - - outDimensionDeltas.width = 0; - outDimensionDeltas.height = 0; - - mCurrentMode = inNewMode; - - switch (inNewMode) - { - case eTOOLBAR_ICONS: - case eTOOLBAR_TEXT: - GetSmallIconFrameSize(frameSize); - break; - - case eTOOLBAR_TEXT_AND_ICONS: - GetLargeIconFrameSize(frameSize); - break; - } - - outDimensionDeltas.width = frameSize.width - oldDimensions.width; - outDimensionDeltas.height = frameSize.height - oldDimensions.height; - ResizeFrameBy(outDimensionDeltas.width, outDimensionDeltas.height, true); - return true; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSpinningN::RepositionSelf(SDimension16* inNewToolbarSize) -{ - SDimension16 theSuperFrameSize; - - Assert_(GetSuperView() != NULL); - if (!GetSuperView()) - return; - - if (!inNewToolbarSize) - GetSuperView()->GetFrameSize(theSuperFrameSize); - else - { - theSuperFrameSize.height = inNewToolbarSize->height; - theSuperFrameSize.width = inNewToolbarSize->width; - } - - Int16 theHeight, theWidth; - SDimension16 frameSize; - // Initalize frameSize to default value just in case GetLargeIconFrameSize fails - frameSize.height = frameSize.width = cLargeIconHeight + cButtonBevelBorderSize; - GetLargeIconFrameSize(frameSize); - - if (theSuperFrameSize.height >= frameSize.height) - { - mIconCount = mLargeSeqCount; - mIsCoBranded = mHasLargeCoBrand; - - if (mIsCoBranded) - { - mGraphicID = ResID_LargeCicnBase; - } - else - { - mGraphicID = ResID_LargeSpinIconBase; - theHeight = theWidth = cLargeIconHeight; - ::SetRect(&mCachedIconFrame, 0, 0, 32, 32); - } - } - else - { - mIconCount = mSmallSeqCount; - mIsCoBranded = mHasSmallCoBrand; - - if (mIsCoBranded) - { - mGraphicID = ResID_SmallCicnBase; - } - else - { - mGraphicID = ResID_SmallSpinIconBase; - theHeight = theWidth = cSmallIconHeight; - ::SetRect(&mCachedIconFrame, 0, 0, 32, 32); - } - } - - if (mIsCoBranded) - { - StUseResFile rf(mAnimResFile); - CIconHandle theIcon = ::GetCIcon(mGraphicID); - if (theIcon != NULL) - { - theHeight = RectHeight((*theIcon)->iconPMap.bounds); - theWidth = RectWidth((*theIcon)->iconPMap.bounds); - ::SetRect(&mCachedIconFrame, 0, 0, theWidth, theHeight); - ::DisposeCIcon(theIcon); - } - } - - if (mSpinCounter >= mIconCount) - mSpinCounter = 1; - - - // Adjust the position and size of this pane (center vertically) - - SInt32 h; - SInt32 v; - -// SDimension16 frameSize; - GetFrameSize(frameSize); - -// v = (theSuperFrameSize.height - theHeight) / 2; -// h = theSuperFrameSize.width - theWidth - v - 1; -// PlaceInSuperFrameAt(h, v, false); -// ResizeFrameTo(theWidth, theHeight, true); - - // Adjust theWidth and theHeight to take into account - // button bevel - - theWidth += 8; - theHeight += 8; - - v = (theSuperFrameSize.height - theHeight) / 2; - h = theSuperFrameSize.width - theWidth - v - 1; - PlaceInSuperFrameAt(h, v, false); - ResizeFrameTo(theWidth, theHeight, true); - -/* - // Adjust the adornment pane - - if (theSuperFrameSize.height <= theHeight || theHeight < 40) - { - if (mAdornment) - mAdornment->Hide(); - } - else - { - if (mAdornment) - { - mAdornment->PlaceInSuperFrameAt(h - 1, v - 1, false); - mAdornment->ResizeFrameTo(theWidth + 2, theHeight + 2, true); - mAdornment->Show(); - } - } - - // Adjust the position and size of the fill pane - - if (mFill) - { - h = theSuperFrameSize.width - theWidth - v - 1; - mFill->PlaceInSuperFrameAt(h, 1, false); - mFill->ResizeFrameTo(theSuperFrameSize.width - h, theSuperFrameSize.height - 2, true); - } -*/ -} - -void CSpinningN::GetLargeIconFrameSize(SDimension16& outFrameSize) -{ - if (mHasLargeCoBrand) - { - StUseResFile rf(mAnimResFile); - CIconHandle theIcon = ::GetCIcon(ResID_LargeCicnBase); - if (theIcon != NULL) - { - outFrameSize.height = RectHeight((*theIcon)->iconPMap.bounds) + cButtonBevelBorderSize; - outFrameSize.width = RectWidth((*theIcon)->iconPMap.bounds) + cButtonBevelBorderSize; - ::DisposeCIcon(theIcon); - } - } - else - { - outFrameSize.height = cLargeIconHeight + cButtonBevelBorderSize; - outFrameSize.width = cLargeIconWidth + cButtonBevelBorderSize; - } -} - -void CSpinningN::GetSmallIconFrameSize(SDimension16& outFrameSize) -{ - if (mHasSmallCoBrand) - { - StUseResFile rf(mAnimResFile); - CIconHandle theIcon = ::GetCIcon(ResID_SmallCicnBase); - if (theIcon != NULL) - { - outFrameSize.height = RectHeight((*theIcon)->iconPMap.bounds) + cButtonBevelBorderSize; - outFrameSize.width = RectWidth((*theIcon)->iconPMap.bounds) + cButtonBevelBorderSize; - ::DisposeCIcon(theIcon); - } - } - else - { - outFrameSize.height = cSmallIconHeight + cButtonBevelBorderSize; - outFrameSize.width = cSmallIconWidth + cButtonBevelBorderSize; - } -} - - diff --git a/mozilla/cmd/macfe/gui/CSpinningN.h b/mozilla/cmd/macfe/gui/CSpinningN.h deleted file mode 100644 index eb27fcf73ef..00000000000 --- a/mozilla/cmd/macfe/gui/CSpinningN.h +++ /dev/null @@ -1,113 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CSpinningN.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include -#include - -#include "CPatternButton.h" - -const Int16 kMaxSpinStages = 40; - -class CSpinningN : - public CPatternButton, - public LListener, - protected LPeriodical -{ - public: - enum { - class_ID = 'SpnN', - kAdornmentPaneID = 'Adrn', - kFillPaneID = 'Fill' - }; - - CSpinningN(LStream* inStream); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - virtual void AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh); - static short& AnimResFile() { return mAnimResFile; } - - virtual void StopSpinningNow(void); - - virtual Boolean ChangeMode(Int8 newMode, SDimension16& outDimensionDeltas); - - protected: - - virtual void SpendTime( - const EventRecord& inMacEvent); - - virtual void StartRepeating(void); - virtual void StopRepeating(void); - - - virtual void FinishCreateSelf(void); - virtual void DrawSelf(void); - - virtual void DrawButtonGraphic(void); - virtual void DrawButtonContent(void); - virtual void DrawSelfDisabled(void); - - // We redraw on Activate/Deactivate/Enable/Disable in order to play well - // with the darn CBevelView stuff. - virtual void ActivateSelf() { Draw(nil); } - virtual void DeactivateSelf() { Draw(nil); } - virtual void EnableSelf() { Draw(nil); } - virtual void DisableSelf() { Draw(nil); } - - virtual void CalcAnimationMode(void); - virtual void RepositionSelf(SDimension16* inNewToolbarSize = NULL); - - void GetLargeIconFrameSize(SDimension16& outFrameSize); - void GetSmallIconFrameSize(SDimension16& outFrameSize); - - Int32 mIconCount; - ResIDT mGraphicID; - Rect mCachedIconFrame; - - Int32 mLastSpinTicks; // Last time icon was spun. - Int16 mSpinCounter; // 0 == not spinning - // 1..num icons == spin stage - - Boolean mIsCoBranded; - - Boolean mHasLargeCoBrand; - Int32 mLargeSeqCount; - - Boolean mHasSmallCoBrand; - Int32 mSmallSeqCount; - static short mAnimResFile; - - Int32 mRefCount; - - Boolean mFinishedCreatingSelf; - - LPane* mAdornment; - LPane* mFill; -}; diff --git a/mozilla/cmd/macfe/gui/CSwatchBrokerView.cp b/mozilla/cmd/macfe/gui/CSwatchBrokerView.cp deleted file mode 100644 index 91516b748ec..00000000000 --- a/mozilla/cmd/macfe/gui/CSwatchBrokerView.cp +++ /dev/null @@ -1,220 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CSwatchBrokerView.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CSwatchBrokerView.h" -#include "CBevelView.h" - - -CBrokeredView::CBrokeredView(LStream* inStream) - : LView(inStream) -{ -} - -void CBrokeredView::GetPendingFrameSize(SDimension16& outSize) const -{ - outSize = mPendingSize; -} - -void CBrokeredView::GetPendingFrameLocation(SPoint32& outLocation) const -{ - outLocation = mPendingLocation; -} - -void CBrokeredView::ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh) -{ - if (inRefresh) - { - GetFrameSize(mPendingSize); - mPendingSize.width += inWidthDelta; - mPendingSize.height += inHeightDelta; - BroadcastMessage(msg_BrokeredViewAboutToChangeSize, this); - } - - LView::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); - - if (!inRefresh) - BroadcastMessage(msg_BrokeredViewChangeSize, this); -} - -void CBrokeredView::MoveBy( - Int32 inHorizDelta, - Int32 inVertDelta, - Boolean inRefresh) -{ - if (inRefresh) - { - GetFrameLocation(mPendingLocation); - mPendingLocation.h += inHorizDelta; - mPendingLocation.v += inVertDelta; - BroadcastMessage(msg_BrokeredViewAboutToMove, this); - } - - LView::MoveBy(inHorizDelta, inVertDelta, inRefresh); - - if (!inRefresh) - BroadcastMessage(msg_BrokeredViewMoved, this); -} - -CSwatchBrokerView::CSwatchBrokerView(LStream* inStream) - : LView(inStream) -{ - *inStream >> mDynamicPaneID; - *inStream >> mBalancePaneID; - SetRefreshAllWhenResized(false); -} - - -void CSwatchBrokerView::FinishCreateSelf(void) -{ - LView::FinishCreateSelf(); - - mBalancePane = FindPaneByID(mBalancePaneID); - Assert_(mBalancePane != NULL); - - mDynamicPane = dynamic_cast(FindPaneByID(mDynamicPaneID)); - if (mDynamicPane) - { - mDynamicPane->AddListener(this); - - // We need to "prime to pump". The dynamic view may have resized itself - // in it's FinishCreateSelf(), at which point we were not listening. - SDimension16 theSize; - mDynamicPane->GetFrameSize(theSize); - AdaptToBrokeredViewResize(mDynamicPane, theSize, true); - } -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// on adapt to super frame size we ignore broadcasts from the subs -// so that we dont recalculate too often. we really want to know when -// a sub changes height so we can reposition and resize the others. - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void CSwatchBrokerView::AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh) -{ - StopListening(); - LView::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh); - StartListening(); -} - - -void CSwatchBrokerView::ListenToMessage( - MessageT inMessage, - void* ioParam) -{ - CBrokeredView* theView = (CBrokeredView*)ioParam; - - switch (inMessage) - { - case msg_BrokeredViewAboutToChangeSize: - { - SDimension16 thePendingSize; - theView->GetPendingFrameSize(thePendingSize); - AdaptToBrokeredViewResize(theView, thePendingSize, true); - } - break; - - case msg_BrokeredViewChangeSize: - { - SDimension16 theNewSize; - theView->GetFrameSize(theNewSize); - AdaptToBrokeredViewResize(theView, theNewSize, false); - } - break; - - case msg_BrokeredViewAboutToMove: - { - SPoint32 thePendingLocation; - theView->GetPendingFrameLocation(thePendingLocation); - AdaptToBrokeredViewMove(theView, thePendingLocation, true); - } - break; - - case msg_BrokeredViewMoved: - { - SPoint32 theNewLocation; - theView->GetFrameLocation(theNewLocation); - AdaptToBrokeredViewMove(theView, theNewLocation, false); - } - break; - } - -} - -// this whole thing needs to be way more robust. multiple brokered views, -// top to bottom ordering, etc. - -void CSwatchBrokerView::AdaptToBrokeredViewResize( - CBrokeredView* inView, - const SDimension16 inNewSize, - Boolean inRefresh) -{ - SDimension16 theBrokerSize; - GetFrameSize(theBrokerSize); - - SDimension16 theBalanceSize; - mBalancePane->GetFrameSize(theBalanceSize); - - SPoint32 theBalanceLocation; - mBalancePane->GetFrameLocation(theBalanceLocation); - - SPoint32 theNewLocation; - inView->GetFrameLocation(theNewLocation); - - Int32 theBalanceHeight= (theBrokerSize.height - inNewSize.height) - theBalanceSize.height; - - mBalancePane->ResizeFrameBy(0, theBalanceHeight, false); - - // Need to determine if the balance pane is above or below the dynamic pane - SPoint32 dynamicPaneLocation, balancePaneLocation; - mDynamicPane->GetFrameLocation( dynamicPaneLocation ); - mBalancePane->GetFrameLocation( balancePaneLocation ); - if( balancePaneLocation.v >= dynamicPaneLocation.v) - mBalancePane->MoveBy(0, -theBalanceHeight, false); - - // if we're in an enclosing CBevelView, we need to notify it that - // it's subpanes have changed so that it can recalculate the - // bevel region. - - CBevelView::SubPanesChanged(this, inRefresh); - - if (inRefresh) - Refresh(); -} - -void CSwatchBrokerView::AdaptToBrokeredViewMove( - CBrokeredView* /*inView*/, - const SPoint32& /*inNewLocation*/, - Boolean /*inRefresh*/) -{ - -} - diff --git a/mozilla/cmd/macfe/gui/CSwatchBrokerView.h b/mozilla/cmd/macfe/gui/CSwatchBrokerView.h deleted file mode 100644 index 3a43ed6a060..00000000000 --- a/mozilla/cmd/macfe/gui/CSwatchBrokerView.h +++ /dev/null @@ -1,111 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CSwatchBrokerView.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include -#include - - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -const MessageT msg_BrokeredViewAboutToChangeSize = 'bvas'; // CBrokeredView* -const MessageT msg_BrokeredViewChangeSize = 'bvcs'; // CBrokeredView* -const MessageT msg_BrokeredViewAboutToMove = 'bvam'; // CBrokeredView* -const MessageT msg_BrokeredViewMoved = 'bvmv'; // CBrokeredView* - - - -class CBrokeredView : - public LView, - public LBroadcaster -{ - public: - enum { class_ID = 'BkVw' }; - CBrokeredView(LStream* inStream); - void GetPendingFrameSize(SDimension16& outSize) const; - void GetPendingFrameLocation(SPoint32& outLocation) const; - - virtual void ResizeFrameBy( - Int16 inWidthDelta, - Int16 inHeightDelta, - Boolean inRefresh); - - virtual void MoveBy( - Int32 inHorizDelta, - Int32 inVertDelta, - Boolean inRefresh); - protected: - - SDimension16 mPendingSize; - SPoint32 mPendingLocation; -}; - - - - -class CSwatchBrokerView : - public LView, - public LListener -{ - public: - enum { class_ID = 'SwBv' }; - - CSwatchBrokerView(LStream* inStream); - - virtual void AdaptToSuperFrameSize( - Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh); - - virtual void ListenToMessage( - MessageT inMessage, - void* ioParam); - - protected: - - virtual void FinishCreateSelf(void); - - virtual void AdaptToBrokeredViewResize( - CBrokeredView* inView, - const SDimension16 inNewSize, - Boolean inRefresh); - - virtual void AdaptToBrokeredViewMove( - CBrokeredView* inView, - const SPoint32& inNewLocation, - Boolean inRefresh); - - PaneIDT mDynamicPaneID; - CBrokeredView* mDynamicPane; - - PaneIDT mBalancePaneID; - LPane* mBalancePane; -}; - - - - diff --git a/mozilla/cmd/macfe/gui/CTaskBarListener.cp b/mozilla/cmd/macfe/gui/CTaskBarListener.cp deleted file mode 100644 index e25f18e1729..00000000000 --- a/mozilla/cmd/macfe/gui/CTaskBarListener.cp +++ /dev/null @@ -1,78 +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. - */ - -#include "CTaskBarListener.h" - -#include "Netscape_Constants.h" -#include "CWindowMediator.h" -#include "macutil.h" -#include "UTearOffPalette.h" -#include "resgui.h" - -enum -{ - eTaskBarFloatingWindowID = 1003 -}; - -void CTaskBarListener::GetToggleTaskBarWindowMenuItemName(Str255 &name) -{ - CTearOffManager *theTearOffManger = CTearOffManager::GetDefaultManager(); - - short stringID; - /* - StringHandle hString; - if (theTearOffManger->IsFloatingWindow(eTaskBarFloatingWindowID)) - { - stringID = cmd_ToggleTaskBar + 1; - } - else - { - stringID = cmd_ToggleTaskBar; - } - hString = GetString(stringID); - CopyString(name, (*hString)); - */ - - if (theTearOffManger->IsFloatingWindow(eTaskBarFloatingWindowID)) - { - stringID = 1; - } - else - { - stringID = 2; - } - - GetIndString(name, cmd_ToggleTaskBar, stringID); -} - -void CTaskBarListener::ToggleTaskBarWindow() -{ - CTearOffManager *theTearOffManger = CTearOffManager::GetDefaultManager(); - - if (theTearOffManger->IsFloatingWindow(eTaskBarFloatingWindowID)) - { - theTearOffManger->CloseFloatingWindow(eTaskBarFloatingWindowID); - } - else - { - Point topLeft; - topLeft.h = topLeft.v = 100; - theTearOffManger->OpenFloatingWindow( eTaskBarFloatingWindowID, - topLeft, false, 0, "\p"); - } -} diff --git a/mozilla/cmd/macfe/gui/CTaskBarListener.h b/mozilla/cmd/macfe/gui/CTaskBarListener.h deleted file mode 100644 index ef39283d123..00000000000 --- a/mozilla/cmd/macfe/gui/CTaskBarListener.h +++ /dev/null @@ -1,35 +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. - */ - -#include - -//====================================== -class CTaskBarListener : public LListener -//====================================== -{ -protected: -public: - CTaskBarListener() {} - virtual ~CTaskBarListener() {} - -// statics - - static void GetToggleTaskBarWindowMenuItemName(Str255 &name); - static void ToggleTaskBarWindow(); - -}; // class CTaskBarListener diff --git a/mozilla/cmd/macfe/gui/CTaskBarView.cp b/mozilla/cmd/macfe/gui/CTaskBarView.cp deleted file mode 100644 index ba4e892bc2f..00000000000 --- a/mozilla/cmd/macfe/gui/CTaskBarView.cp +++ /dev/null @@ -1,68 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CTaskBarView.cp -// A subclass of UTearOffBar for task bar view in main browser window -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CTaskBarView.h" -#include "CGrayBevelView.h" - -CTaskBarView::CTaskBarView(LStream *inStream) : -CTearOffBar(inStream) -{ - *inStream >> fControlPaneID; - fAllowClickDrag = true; -} - -CTaskBarView::~CTaskBarView() -{ -} - -void CTaskBarView::Click( SMouseDownEvent &inMouseDown ) -{ - // Check if a SubPane of this View - // is hit -// Modified code -// Check if we have clicked on a 0 pane - LPane *clickedPane; - clickedPane = FindDeepSubPaneContaining(inMouseDown.wherePort.h, - inMouseDown.wherePort.v ); - if ( clickedPane != nil ) - { - // If the controlling pane is click, we treat it as if the CTaskBarView - // were clicked and we process the drag. - if (clickedPane->GetPaneID() == fControlPaneID) - { - ClickSelf(inMouseDown); - return; - } - } - -// LView::Click code - // If it was one of our subpanes (but not the controlling pane-- we would have - // already returned) then we let it get the click. - clickedPane = FindSubPaneHitBy(inMouseDown.wherePort.h, - inMouseDown.wherePort.v); - - if ( clickedPane != nil ) - { // SubPane is hit, let it respond to the Click - clickedPane->Click(inMouseDown); - } -} diff --git a/mozilla/cmd/macfe/gui/CTaskBarView.h b/mozilla/cmd/macfe/gui/CTaskBarView.h deleted file mode 100644 index f78e19e4c48..00000000000 --- a/mozilla/cmd/macfe/gui/CTaskBarView.h +++ /dev/null @@ -1,45 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CTaskBarView.h -// TaskBar view in browser window -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include "UTearOffPalette.h" - -class CTaskBarView : public CTearOffBar -// This class differs from CTearOffBar in two ways. -// 1) With the exception of the controlling pane (see below) it does not -// create a floating window by dragging (it ignores mouse clicks). -// 2) This class relys on subpane, called the controlling pane. If this -// pane is *clicked or dragged* it creates a floating window. -{ - public: - enum { class_ID = 'TskV' }; - - CTaskBarView(LStream *inStream); - virtual ~CTaskBarView(); - - virtual void Click( SMouseDownEvent &inMouseDown ); - - private: - PaneIDT fControlPaneID; // the pane ID of the pane that controls dragging -}; diff --git a/mozilla/cmd/macfe/gui/CToolbarDragBar.cp b/mozilla/cmd/macfe/gui/CToolbarDragBar.cp deleted file mode 100644 index 9644f4cebb3..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarDragBar.cp +++ /dev/null @@ -1,80 +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. - */ - -// CToolbarDragBar.cp - -#include -#include - -#include "CToolbarDragBar.h" -#include "CToolbarModeManager.h" -#include "CButton.h" - -CToolbarDragBar::CToolbarDragBar(LStream* inStream) - : CDragBar(inStream) -{ -} - -CToolbarDragBar::~CToolbarDragBar() -{ -} - -void CToolbarDragBar::FinishCreateSelf() -{ - // if current toolbar mode is different that defaultToolbarMode - // then we need to change mode of this drag bar - Int32 toolbarStyle; - int result = CToolbarModeManager::GetToolbarPref(toolbarStyle); - if (result == noErr) - { - // 97-10-07 pchen -- Don't check against default toolbar mode; we still - // need to call HandleModeChange because cobrand large icon might - // make "spinning N" button bigger than size in PPob. - // if (toolbarStyle != CToolbarModeManager::defaultToolbarMode) - HandleModeChange(toolbarStyle); - } -} - -void CToolbarDragBar::HandleModeChange(Int8 inNewMode) -{ - SDimension16 sizeChange; - LArrayIterator iter(mSubPanes); - LPane* pane = NULL; - - while (iter.Next(&pane)) - { - CToolbarButtonContainer* container = - dynamic_cast(pane); - if (container) - { - container->HandleModeChange(inNewMode, sizeChange); - } - } - - // check to see if we need to change our height - if (sizeChange.height) - { - // Now resize drag bar based on heightChange - ResizeFrameBy(0, sizeChange.height, false); - - // broadcast msg_DragBarCollapse with a null ioParam - // to force container to readjust itself because we've changed - // out size - BroadcastMessage(msg_DragBarCollapse); - } -} diff --git a/mozilla/cmd/macfe/gui/CToolbarDragBar.h b/mozilla/cmd/macfe/gui/CToolbarDragBar.h deleted file mode 100644 index ce6735daf78..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarDragBar.h +++ /dev/null @@ -1,43 +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. - */ - -// CToolbarDragBar.h - -#pragma once - -#include - -#include "CDragBar.h" -#include "CToolbarModeManager.h" - -class CToolbarDragBar - : public CDragBar, - public CToolbarModeChangeListener -{ - public: - enum { class_ID = 'TbDB' }; - - CToolbarDragBar(LStream* inStream); - virtual ~CToolbarDragBar(); - - protected: - - virtual void FinishCreateSelf(); - - virtual void HandleModeChange(Int8 inNewMode); -}; diff --git a/mozilla/cmd/macfe/gui/CToolbarModeManager.cp b/mozilla/cmd/macfe/gui/CToolbarModeManager.cp deleted file mode 100644 index bc8625ab6d0..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarModeManager.cp +++ /dev/null @@ -1,79 +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. - */ - -// CToolbarModeManager.cp - -#include "CToolbarModeManager.h" - -#include - -#include "CToolbarPrefsProxy.h" - -LBroadcaster* CToolbarModeManager::sBroadcaster = NULL; -CToolbarPrefsProxy* CToolbarModeManager::sPrefsProxy = NULL; - -#pragma mark -- CToolbarModeManager -- - -int CToolbarModeManager::BroadcastToolbarModeChange( - const char* /* domain */, - void* /* instance_data */) -{ - Int32 toolbarStyle; - int result = GetToolbarPref(toolbarStyle); - if (result == noErr) - { - if (sBroadcaster) - sBroadcaster->BroadcastMessage(msg_ToolbarModeChange, - (void*)toolbarStyle); - } - return result; -} - -void CToolbarModeManager::AddToolbarModeListener(LListener* inListener) -{ - try { - if (!sBroadcaster) - sBroadcaster = new LBroadcaster; - sBroadcaster->AddListener(inListener); - } catch (...) { - sBroadcaster = NULL; - } -} - -int CToolbarModeManager::GetToolbarPref(Int32& ioPref) -{ - int result = noErr; - if (sPrefsProxy) - result = sPrefsProxy->GetToolbarPref(ioPref); - else - ioPref = defaultToolbarMode; - return result; -} - -#pragma mark -- CToolbarModeChangeListener -- - -CToolbarModeChangeListener::CToolbarModeChangeListener() -{ - CToolbarModeManager::AddToolbarModeListener(this); -} - -void CToolbarModeChangeListener::ListenToMessage(MessageT inMessage, void* ioParam) -{ - if (inMessage == CToolbarModeManager::msg_ToolbarModeChange) - HandleModeChange((Int8)ioParam); -} diff --git a/mozilla/cmd/macfe/gui/CToolbarModeManager.h b/mozilla/cmd/macfe/gui/CToolbarModeManager.h deleted file mode 100644 index e119aca6ce5..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarModeManager.h +++ /dev/null @@ -1,87 +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. - */ - -// CToolbarModeManager.h - -#pragma once - -#include -#include - -//#include "resgui.h" // for TOOLBAR_TEXT_AND_ICONS #define - -enum { - eTOOLBAR_ICONS, // Toolbar display style possible values - eTOOLBAR_TEXT, - eTOOLBAR_TEXT_AND_ICONS -}; - -class CToolbarPrefsProxy; - -class CToolbarModeManager -{ - public: - enum { msg_ToolbarModeChange = 'modC' }; - - // defaultToolbarMode is mode that PPob's are defined for - enum { defaultToolbarMode = eTOOLBAR_TEXT_AND_ICONS }; - -// static void BroadcastToolbarModeChange(); - static int BroadcastToolbarModeChange( - const char* domain, - void* instance_data); - static void AddToolbarModeListener(LListener* inListener); - - static void SetPrefsProxy(CToolbarPrefsProxy* inPrefsProxy) - { sPrefsProxy = inPrefsProxy; } - - static int GetToolbarPref(Int32& ioPref); - - protected: - static LBroadcaster* sBroadcaster; - static CToolbarPrefsProxy* sPrefsProxy; -}; - -// Mix-in classes to get toolbar mode change propagated to the -// toolbar buttons - -// This is the class that listens for changes in toolbar mode -// and "handles" mode change -class CToolbarModeChangeListener - : public LListener -{ - public: - CToolbarModeChangeListener(); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - protected: - // Pure virtual. Subclasses must implement - virtual void HandleModeChange(Int8 inNewMode) = 0; -}; - -// This is the class that has the toolbar buttons as shallow subpanes -class CToolbarButtonContainer -{ - public: - CToolbarButtonContainer() {} - virtual ~CToolbarButtonContainer() {} - - // Pure virtual. Subclasses must implement - virtual void HandleModeChange(Int8 inNewMode, SDimension16& outSizeChange) = 0; -}; diff --git a/mozilla/cmd/macfe/gui/CToolbarPatternBevelView.cp b/mozilla/cmd/macfe/gui/CToolbarPatternBevelView.cp deleted file mode 100644 index 4f604991f77..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarPatternBevelView.cp +++ /dev/null @@ -1,278 +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. - */ - -// CToolbarPatternBevelView.cp - -#include - -#include "CToolbarPatternBevelView.h" -#include "CToolbarButton.h" -#include "StRegionHandle.h" - -#include - - - -// Bug #79175 -// Change the update command status so that the "Show/Hide Component Bar" works -CToolbarPatternBevelView::CToolbarPatternBevelView(LStream* inStream) -: CPatternBevelView(inStream) -{ - LCommander::SetUpdateCommandStatus(true); -} - -// Bug #79175 -// Change the update command status so that the "Show/Hide Component Bar" works -CToolbarPatternBevelView::~CToolbarPatternBevelView() -{ - LCommander::SetUpdateCommandStatus(true); -} - -void CToolbarPatternBevelView::HandleModeChange( Int8 inNewMode, SDimension16& outSizeChange ) - { - CalcArrangement(false, inNewMode, outSizeChange); - } - -void CToolbarPatternBevelView::RotateArrangement( SDimension16& outSizeChange ) - { - CalcArrangement(true, Int8(), outSizeChange); - } - -void CToolbarPatternBevelView::CalcArrangement( Boolean inRotateArrangement, Int8 inNewMode, SDimension16& outSizeChange) - /* - Note: either rotates the arrangement _or else_ changes the mode, but not both. - - ...treats |CToolbarButtons| sub-views as though they are layed out in a grid - whose cell-size is the maximum height and width of any of them. In a mode change, - their sizes change, the grid must be recalculated, and the buttons moved - appropriately. - */ -{ - size_t number_of_buttons = 0; - SDimension16 old_cell_size={ 0, 0 }, new_cell_size={ 0, 0 }; - SDimension16 grid_origin; - - /* - Iterate over the |CToolbarButtons| within me, _twice_... - */ - - // ...once to calculate the old and new grid cell-size, and change the mode of each button; - LPane* current_subview_ptr = 0; - for ( LArrayIterator iter(mSubPanes); iter.Next(¤t_subview_ptr); ) - if ( CToolbarButton* button = dynamic_cast(current_subview_ptr) ) - { - ++number_of_buttons; - - SDimension16 button_size; - - // Use the pre-ChangeMode size of this button to calculate |old_cell_size| - button->GetFrameSize(button_size); - - - /* - The origin of the grid is the remainder when dividing the maximum sized - cells offset by its size (independently for x and y). - */ - - Boolean recalc_origin_x = button_size.width > old_cell_size.width; - Boolean recalc_origin_y = button_size.height > old_cell_size.height; - - if ( recalc_origin_x || recalc_origin_y ) - { - Rect button_rect; - button->CalcLocalFrameRect(button_rect); - - if ( recalc_origin_x ) - { - old_cell_size.width = button_size.width; - grid_origin.width = button_rect.left - (button_size.width * (button_rect.left / button_size.width)); - } - else // recalc_origin_y - { - old_cell_size.height = button_size.height; - grid_origin.height = button_rect.top - (button_size.height * (button_rect.top / button_size.height)); - } - } - - - if ( !inRotateArrangement ) - { - SDimension16 dummy; - button->ChangeMode(inNewMode, dummy); - - // ...and the post-ChangeMode size for |new_cell_size| - button->GetFrameSize(button_size); - if ( new_cell_size.width < button_size.width ) - new_cell_size.width = button_size.width; - if ( new_cell_size.height < button_size.height ) - new_cell_size.height = button_size.height; - } - } - - if ( inRotateArrangement ) - new_cell_size = old_cell_size; - - - Int16 number_of_columns = 0; - Int16 number_of_rows = 0; - - // ...and again (if buttons were found in the first pass) to actually move them. - if ( number_of_buttons > 0 ) - { - for ( LArrayIterator iter(mSubPanes); (number_of_buttons > 0) && iter.Next(¤t_subview_ptr); ) - if ( CToolbarButton* button = dynamic_cast(current_subview_ptr) ) - { - --number_of_buttons; - - // Determine which cell this button occupies. It hasn't been moved yet, so use |old_cell_size|, and the buttons top-left. - Rect button_rect; - button->CalcLocalFrameRect(button_rect); - Int16 column = (button_rect.left - grid_origin.width) / old_cell_size.width; - Int16 row = (button_rect.top - grid_origin.height) / old_cell_size.height; - - if ( inRotateArrangement ) - { - Int16 temp = column; - column = row; - row = temp; - } - - if ( number_of_columns <= column ) - number_of_columns = column + 1; - if ( number_of_rows <= row ) - number_of_rows = row + 1; - - // Calculate the padding needed to center this button within a (new-size) cell. - SDimension16 button_size; - button->GetFrameSize(button_size); - Int16 horizontal_padding = (new_cell_size.width - button_size.width) / 2; - Int16 vertical_padding = (new_cell_size.height - button_size.height) / 2; - - // Calculate the buttons new position within its superview (i.e., within |me|) - Int32 x = grid_origin.width + (column * new_cell_size.width) + horizontal_padding; - Int32 y = grid_origin.height + (row * new_cell_size.height) + vertical_padding; - - button->PlaceInSuperFrameAt(x, y, true); // ...only moves if it has to - } - } - - Int16 old_number_of_columns = inRotateArrangement ? number_of_rows : number_of_columns; - Int16 old_number_of_rows = inRotateArrangement ? number_of_columns : number_of_rows; - - outSizeChange.width = (number_of_columns * new_cell_size.width) - (old_number_of_columns * old_cell_size.width); - outSizeChange.height = (number_of_rows * new_cell_size.height) - (old_number_of_rows * old_cell_size.height); -} - -#pragma mark - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ FocusDraw -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Set up coordinates system and clipping region -// -// Panes rely on their superview to focus them. When a Pane requests -// focus for drawing, we set the clipping region to the revealed -// portion of that Pane's Frame minus the Frames of all sibling Panes -// that are in front of that Pane. - -Boolean -CToolbarPatternBevelView::FocusDraw( - LPane *inSubPane) -{ - Boolean revealed = true; - - if (inSubPane == nil) { // Focus this view - revealed = LView::FocusDraw(); - - } else { // Focus a SubPane - - if (EstablishPort()) { // Set current Mac Port - sInFocusView = nil; // Saved focus is now invalid - - // Set up local coordinate system - ::SetOrigin(mPortOrigin.h, mPortOrigin.v); - - // Build clipping region - - // Start with the intersection of the - // revealed rect of this View with the - // Frame of the SubPane - Rect subRect; - inSubPane->CalcPortFrameRect(subRect); - - if (!::SectRect(&subRect, &mRevealedRect, &subRect)) { - // No intersection, so subpane is - // not revealed. Set empty clip. - ::ClipRect(&subRect); - return false; - } - - // SubPane is revealed. Make region - // from the intersection. - StRegionHandle clipR; - ::RectRgn(clipR, &subRect); - - // Determine first sibling which is in front of this SubPane. - ArrayIndexT subIndex = 0; - LPane* thePane = nil; - - { - LArrayIterator iterator(mSubPanes, LArrayIterator::from_Start); - while (iterator.Next(&thePane)) - { - subIndex++; - if (thePane == inSubPane) - break; - } - } - - // Subtract Frames of all sibling Panes (which are visible) - // that are in front of this SubPane (i.e., come after the - // SubPane in this View's list of SubPanes. - - StRegionHandle siblingR; - LArrayIterator iterator(mSubPanes, subIndex); - Rect siblingFrame; - - while (iterator.Next(&thePane)) - { - if (thePane->IsVisible() && thePane->CalcPortFrameRect(siblingFrame)) - { - // Subtract sibling's Frame from - // the clipping region - ::RectRgn(siblingR, &siblingFrame); - ::DiffRgn(clipR, siblingR, clipR); - } - } - - // Convert Clip region from Port to - // Local coords and set it - ::OffsetRgn(clipR, mPortOrigin.h, mPortOrigin.v); - ::SetClip(clipR); - - revealed = !::EmptyRgn(clipR); - - } else { - SignalPStr_("\pFocus View with no GrafPort"); - revealed = false; - } - - } - - return revealed; -} diff --git a/mozilla/cmd/macfe/gui/CToolbarPatternBevelView.h b/mozilla/cmd/macfe/gui/CToolbarPatternBevelView.h deleted file mode 100644 index ce85741e9f9..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarPatternBevelView.h +++ /dev/null @@ -1,43 +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. - */ - -// CToolbarPatternBevelView.h - -#pragma once - -#include "CPatternBevelView.h" -#include "CToolbarModeManager.h" - -class CToolbarPatternBevelView - : public CPatternBevelView, - public CToolbarButtonContainer -{ - public: - enum { class_ID = 'TBPv' }; - - CToolbarPatternBevelView(LStream* inStream); - virtual ~CToolbarPatternBevelView(); - - virtual void HandleModeChange(Int8 inNewMode, SDimension16& outSizeChange); - virtual void RotateArrangement( SDimension16& outSizeChange ); - - virtual Boolean FocusDraw(LPane* inSubPane = nil); - - private: - void CalcArrangement(Boolean inRotateArrangement, Int8 inNewMode, SDimension16& outSizeChange); -}; diff --git a/mozilla/cmd/macfe/gui/CToolbarPopup.cp b/mozilla/cmd/macfe/gui/CToolbarPopup.cp deleted file mode 100644 index bc7475c1c18..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarPopup.cp +++ /dev/null @@ -1,176 +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. - */ - -#include "CToolbarPopup.h" - -// this class overrides LGAPopup in order to draw popup menus in the editor and compose -// windows in a dimmed state when the application is switched out. - -CToolbarPopup::CToolbarPopup( LStream *inStream ) : LGAPopup( inStream ) -{ -} - - -CToolbarPopup::~CToolbarPopup() -{ -} - - -void CToolbarPopup::DrawSelf() -{ - - StColorPenState::Normalize (); - - // ¥ Get the control drawn in its various states - if ( IsEnabled () && IsActive () ) - { - if ( IsHilited ()) - DrawPopupHilited (); - else - DrawPopupNormal (); - } - else - DrawPopupDimmed (); - - // ¥ Get the arrow drawn - DrawPopupArrow (); - - // ¥ Draw the popup Label - if ( !IsArrowOnly ()) - DrawPopupLabel (); - - // ¥ Get the title for the popup drawn - if ( !IsArrowOnly ()) - DrawPopupTitle (); - -} // LGAPopup::DrawSelf - - -void CToolbarPopup::ActivateSelf() -{ - // ¥ Get things redrawn so that we can see the state change - Draw ( nil ); -} - - -void CToolbarPopup::DeactivateSelf() -{ - // ¥ Get things redrawn so that we can see the state change - Draw ( nil ); -} - - -#pragma mark - - - -CIconToolbarPopup::CIconToolbarPopup( LStream *inStream ) : CGAIconPopup( inStream ) -{ -} - - -CIconToolbarPopup::~CIconToolbarPopup() -{ -} - - -void CIconToolbarPopup::DrawSelf() -{ - StColorPenState::Normalize (); - - // ¥ Get the control drawn in its various states - if ( IsEnabled() && IsActive()) - { - if ( IsHilited()) - DrawPopupHilited(); - else - DrawPopupNormal(); - } - else - DrawPopupDimmed(); - - // ¥ Get the arrow drawn - DrawPopupArrow(); - - // ¥ Draw the popup Label - if ( !IsArrowOnly()) - DrawPopupLabel(); - - // ¥ Get the title for the popup drawn - if ( !IsArrowOnly()) - DrawPopupTitle(); - -} - - -// override since we don't want to use the constants but the actual size of the icon -void CIconToolbarPopup::DrawPopupTitle(void) -{ - LGAPopup::DrawPopupTitle(); - - Int16 iconID = GetTitleIconID(); - - if ( iconID != 0 ) { - - CIconHandle theIconH = ::GetCIcon(iconID); - - if ( theIconH != nil ) { - Rect iconRect; - LGAPopup::CalcTitleRect(iconRect); - - Rect trueSize = (**theIconH).iconPMap.bounds; - if ( EmptyRect( &trueSize ) ) - trueSize = (**theIconH).iconBMap.bounds; - - // if we still don't have a good rect, bail out--nothing to draw - if ( EmptyRect( &trueSize ) ) - return; - - iconRect.right = iconRect.left + (trueSize.right - trueSize.left); - iconRect.top = iconRect.top + ((iconRect.bottom - iconRect.top - (trueSize.bottom - trueSize.top)) / 2); - iconRect.bottom = iconRect.top + trueSize.bottom - trueSize.top; - - Int16 transform = ttNone; - - if ( IsEnabled() ) { - if ( IsHilited() ) { - transform = ttSelected; - } - } else { - transform = ttDisabled; - } - - ::PlotCIconHandle(&iconRect, ttNone, transform, theIconH); - - ::DisposeCIcon(theIconH); - } - } -} - - -void CIconToolbarPopup::ActivateSelf() -{ - // ¥ Get things redrawn so that we can see the state change - Draw ( nil ); -} - -void CIconToolbarPopup::DeactivateSelf() -{ - // ¥ Get things redrawn so that we can see the state change - Draw ( nil ); -} - diff --git a/mozilla/cmd/macfe/gui/CToolbarPopup.h b/mozilla/cmd/macfe/gui/CToolbarPopup.h deleted file mode 100644 index 1e32e4314ec..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarPopup.h +++ /dev/null @@ -1,51 +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. - */ - -#include -#include "CGAIconPopup.h" - - -class CToolbarPopup : public LGAPopup -{ - public: - enum { class_ID = 'Tpop' }; - - CToolbarPopup( LStream *inStream ); // ¥ Constructor - ~CToolbarPopup(); // ¥ Destructor - virtual void DrawSelf(); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); -}; - -class CIconToolbarPopup: public CGAIconPopup -{ - public: - enum { class_ID = 'TBip' }; - - - CIconToolbarPopup( LStream *inStream ); // ¥ Constructor - ~CIconToolbarPopup(); // ¥ Destructor - - virtual void DrawSelf(); - virtual void DrawPopupTitle(void); - virtual void ActivateSelf(); - virtual void DeactivateSelf(); -}; - - -//CPatternButtonPopup diff --git a/mozilla/cmd/macfe/gui/CToolbarPrefsProxy.cp b/mozilla/cmd/macfe/gui/CToolbarPrefsProxy.cp deleted file mode 100644 index 4253e5cba12..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarPrefsProxy.cp +++ /dev/null @@ -1,32 +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. - */ - -// CToolbarPrefsProxy.cp - -#include "CToolbarPrefsProxy.h" -#include "CToolbarModeManager.h" - -CToolbarPrefsProxy::~CToolbarPrefsProxy() -{ -} - -int CToolbarPrefsProxy::GetToolbarPref(Int32& ioPref) -{ - ioPref = CToolbarModeManager::defaultToolbarMode; - return noErr; -} diff --git a/mozilla/cmd/macfe/gui/CToolbarPrefsProxy.h b/mozilla/cmd/macfe/gui/CToolbarPrefsProxy.h deleted file mode 100644 index b54d810dd29..00000000000 --- a/mozilla/cmd/macfe/gui/CToolbarPrefsProxy.h +++ /dev/null @@ -1,31 +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. - */ - -// CToolbarPrefsProxy.h - -#pragma once - -class CToolbarPrefsProxy -{ -public: - - CToolbarPrefsProxy() {}; - virtual ~CToolbarPrefsProxy(); - - virtual int GetToolbarPref(Int32& ioPref); -}; diff --git a/mozilla/cmd/macfe/gui/CURLCaption.cp b/mozilla/cmd/macfe/gui/CURLCaption.cp deleted file mode 100644 index 9f3ecf6b651..00000000000 --- a/mozilla/cmd/macfe/gui/CURLCaption.cp +++ /dev/null @@ -1,55 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CURLCaption.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CURLCaption.h" -#include "CNSContext.h" -#include "PascalString.h" -#include "CURLEditField.h" - -#include "net.h" -#include "resgui.h" -#include "uerrmgr.h" - -CURLCaption::CURLCaption(LStream* inStream) : -LCaption(inStream) -{ -} - -void CURLCaption::ListenToMessage(MessageT inMessage, void* ioParam) -{ - switch(inMessage) - { - case msg_NSCLayoutNewDocument: - if (ioParam) - { - URL_Struct* theURL = (URL_Struct*)ioParam; - if (theURL->is_netsite) - SetDescriptor(GetPString(NETSITE_RESID)); - else - SetDescriptor(GetPString(LOCATION_RESID)); - } - break; - case msg_UserChangedURL: - SetDescriptor(GetPString(GOTO_RESID)); - break; - } -} diff --git a/mozilla/cmd/macfe/gui/CURLCaption.h b/mozilla/cmd/macfe/gui/CURLCaption.h deleted file mode 100644 index ffea7bc32a0..00000000000 --- a/mozilla/cmd/macfe/gui/CURLCaption.h +++ /dev/null @@ -1,41 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CURLCaption.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// This is the LCaption that sits to the left of the URL EditField in the -// browser window. It needs to display "Location:", "Goto:", and "NetSite:". -// It does this by listening to a CNSContext and to the CURLEditField - -#pragma once - -#include -#include - -class CURLCaption : public LCaption, public LListener -{ - public: - enum { class_ID = 'UCpt' }; - - CURLCaption(LStream* inStream); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); -}; - diff --git a/mozilla/cmd/macfe/gui/CURLDragHelper.cp b/mozilla/cmd/macfe/gui/CURLDragHelper.cp deleted file mode 100644 index b0d0049f1d7..00000000000 --- a/mozilla/cmd/macfe/gui/CURLDragHelper.cp +++ /dev/null @@ -1,637 +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. - */ - -// -// Mike Pinkerton -// Netscape Communications -// -// A collection of classes for helping out with drag and drop. See header file -// for more information regarding usage. -// - -#include "CURLDragHelper.h" -#include "CNetscapeWindow.h" -#include "libi18n.h" -#include "shist.h" -#include "resgui.h" -#include "ufilemgr.h" -#include "mkgeturl.h" -#include "CURLDispatcher.h" -#include "macutil.h" -#include "FSpCompat.h" -#include "CAutoPtrXP.h" - - -// -// DoDragSendData -// -// call after a drop. Handles sending the data or creating files. -// -void -CURLDragHelper :: DoDragSendData( const char* inURL, char* inTitle, FlavorType inFlavor, - ItemReference inItemRef, DragReference inDragRef ) -{ - OSErr err = noErr; - - if (!inURL) - return; - - switch (inFlavor) - { - case 'TEXT': - { - // Just send the URL text - - err = ::SetDragItemFlavorData( - inDragRef, - inItemRef, - inFlavor, - inURL, - strlen(inURL), - 0); - if (err != noErr) - goto Cleanup; - } - break; - - case emBookmarkFileDrag: - { - // Get the target drop location - AEDesc dropLocation; - - err = ::GetDropLocation(inDragRef, &dropLocation); - if (err != noErr) - { - goto Cleanup; - } - - // Get the directory ID and volume reference number from the drop location - SInt16 volume; - SInt32 directory; - - err = GetDropLocationDirectory(&dropLocation, &directory, &volume); - //ThrowIfOSErr_(err); - - // Ok, this is a hack, and here's why: This flavor type is sent with the - // FlavorFlag 'flavorSenderTranslated' which means that this send data routine - // will get called whenever someone accepts this flavor. The problem is that - // it is also called whenever someone calls GetFlavorDataSize(). This routine - // assumes that the drop location is something HFS related, but it's perfectly - // valid for something to query the data size, and not be a HFS derivative (like - // the text widget for example). - // So, if the coercion to HFS thingy fails, then we just punt to the textual - // representation. - if (err == errAECoercionFail) - { - ::SetDragItemFlavorData(inDragRef, inItemRef, - inFlavor, inURL, strlen(inURL), 0); - err = noErr; - goto Cleanup; - } - - if (err != noErr) - { - goto Cleanup; - } - - // Combine with the unique name to make an FSSpec to the new file - FSSpec prototypeFilespec; - FSSpec locationSpec; - prototypeFilespec.vRefNum = volume; - prototypeFilespec.parID = directory; - err = CFileMgr::NewFileSpecFromURLStruct(inURL, prototypeFilespec, locationSpec); - if (err && err != fnfErr) // need a unique name, so we want fnfErr! - goto Cleanup; - - // Clean up the title for use as a file name, and stuff it in the spec... - do - { - char* colonPos = XP_STRCHR(inTitle, ':'); - if (!colonPos) - break; - *colonPos = '/'; - - } while (1); - if (strlen(inTitle) > 31) - inTitle[31] = '\0'; - *(CStr31*)(locationSpec.name) = inTitle; - - // Set the flavor data to our emBookmarkFileDrag flavor with an FSSpec to the new file. - err = ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, &locationSpec, sizeof(FSSpec), 0); - if (err) - goto Cleanup; -#define SAVE_SOURCE 0 -#if 0 - if (theElement->type == LO_IMAGE) - { - URL_Struct* request; - cstring urlString; - - urlString = GetURLFromImageElement(mContext, (LO_ImageStruct*) theElement); - if (urlString==NULL) break; - request = NET_CreateURLStruct(urlString, NET_DONT_RELOAD); - XP_MEMSET(&request->savedData, 0, sizeof(SHIST_SavedData)); - - CURLDispatcher::DispatchToStorage(request, locationSpec); - // XP_FREE(urlString); - break; - } - else -#elif SAVE_SOURCE -// jrm 97/08/13. Currently turned off... - { - URL_Struct* request = NET_CreateURLStruct(inURL, NET_DONT_RELOAD); - XP_MEMSET(&request->savedData, 0, sizeof(SHIST_SavedData)); - CURLDispatcher::DispatchToStorage(request, locationSpec); - break; - } -#else -// ... in favor of - { - // create file (same as dragging a bookmark). - err = FSpCreateCompat(&locationSpec, emSignature, 'URL ', smSystemScript ); - if ( err ) - goto Cleanup; - - // open file - short refNum; - err = ::FSpOpenDFCompat( &locationSpec, fsRdWrPerm, &refNum ); - if ( err ) - goto Cleanup; - - // write out URL - long actualSizeWritten = strlen(inURL); - err = ::FSWrite(refNum, &actualSizeWritten, inURL); - if ( err ) - goto Cleanup; - const char foo = 0x0D; - actualSizeWritten = sizeof(foo); - err = ::FSWrite(refNum, &actualSizeWritten, &foo); - if ( err ) - goto Cleanup; - - // close file - ::FSClose( refNum ); - break; - } -#endif - - // ¥¥¥ both blocks of the if/then/else above call break, so does this get called? 96-12-17 deeje - CFileMgr::UpdateFinderDisplay(locationSpec); - } - break; - - case emBookmarkDrag: - { - // send urltitle with the null terminator - string urlAndTitle = CreateBookmarkFlavorURL ( inURL, inTitle ); - ::SetDragItemFlavorData(inDragRef, inItemRef, inFlavor, urlAndTitle.c_str(), urlAndTitle.length() + 1, 0); - } - break; - - default: - { - err = cantGetFlavorErr; - } - break; - } -Cleanup: - if (err) - Throw_(err); // caught by PP handler - -} // CURLDragHelper :: DoDragSendData - - -// -// MakeIconTextValid -// -// Use this to make sure that the caption for a dragged item is not too long, and if it -// is, middle truncates it to avoid the visual turdfest -// -string -CURLDragHelper :: MakeIconTextValid ( const char* inText ) -{ - const Uint8 kMaxTitleLength = 50; - char finalText[100]; - const char* result = nil; - - if ( strlen(inText) > kMaxTitleLength ) { - INTL_MidTruncateString ( 0, inText, finalText, kMaxTitleLength ); - result = finalText; - } - else - result = inText; - - return result; - -} // MakeIconTextValid - - -// -// ExtractURLAndTitle -// THROWS errorCode (int) -// -// Extracts the url and title from a bookmark drag (url\rtitle). Will throw if -// can't get the right data. -// -void -CURLDragHelper :: ExtractURLAndTitle ( DragReference inDragRef, ItemReference inItemRef, - string & outURL, string & outTitle ) -{ - Size theDataSize = 0; - OSErr err = ::GetFlavorDataSize(inDragRef, inItemRef, emBookmarkDrag, &theDataSize); - if ( err && err != badDragFlavorErr ) - throw(err); - else if ( theDataSize ) { - vector urlAndTitle ( theDataSize + 1 ); - ThrowIfOSErr_( ::GetFlavorData( inDragRef, inItemRef, emBookmarkDrag, - &(*urlAndTitle.begin()), &theDataSize, 0 ) ); - urlAndTitle[theDataSize] = NULL; - char* title = &(*find(urlAndTitle.begin(), urlAndTitle.end(), '\r')); - if ( title != &(*urlAndTitle.end()) ) { - // hack up the data string into it's components - title[0] = NULL; - title++; - char* url = &(*urlAndTitle.begin()); - - // assign those components to the output parameters - outURL = url; - outTitle = title; - } - else { - outURL = &(*urlAndTitle.begin()); - outTitle = ""; - } - } - else - throw(0); - -} // ExtractURLAndTitle - - -// -// ExtractFileURL -// THROWS errorcode (int) -// -// Extracts the file url from a file drag. -void -CURLDragHelper :: ExtractFileURL ( DragReference inDragRef, ItemReference inItemRef, - string & outFileName, HFSFlavor & outData ) -{ - Boolean ignore1, ignore2; - Size theDataSize = 0; - - ::GetFlavorDataSize(inDragRef, inItemRef, flavorTypeHFS, &theDataSize); - OSErr anError = ::GetFlavorData(inDragRef, inItemRef, flavorTypeHFS, &outData, &theDataSize, nil); - if ( anError == badDragFlavorErr ) - ThrowIfOSErr_( ::GetHFSFlavorFromPromise (inDragRef, inItemRef, &outData, true) ); - - // if there's an error resolving the alias, the local file url will refer to the alias itself. - ::ResolveAliasFile(&outData.fileSpec, true, &ignore1, &ignore2); - CAutoPtrXP localURL = CFileMgr::GetURLFromFileSpec(outData.fileSpec); - if ( localURL.get() ) - outFileName = localURL.get(); - else - throw(0); - -} // ExtractFileURL - - -// -// CreateBookmarkFlavorURL -// -// build a url/title pair for the bookmark flavor. This is of the form: URL title. -// -string -CURLDragHelper :: CreateBookmarkFlavorURL ( const char* inURL, const char* inTitle ) -{ - string urlAndTitle(inURL); -/* - if (theElement->type == LO_IMAGE) - { - urlAndTitle += "\r[Image]"; - } - else if (theElement->type == LO_TEXT) -*/ - { - urlAndTitle += "\r"; - - if (inTitle) - { - urlAndTitle += inTitle; - } - else - { - urlAndTitle += inURL; - } - } - - return urlAndTitle; - -} // CreateBookmarkFlavorURL - - -#pragma mark - - - -// -// CURLDragMixin constructor -// -// Fill in the vector of acceptable drag flavors in this order: -// - proxy icon (title & url) -// - TEXT from some other app (should contain a URL, but doesn't have to) -// - file from desktop -// -CURLDragMixin :: CURLDragMixin ( ) - : mAcceptableFlavors(4) -{ - static const FlavorType checkFor[] = { emBookmarkDrag, 'TEXT', flavorTypeHFS, flavorTypePromiseHFS }; - AcceptedFlavors().assign(checkFor, &checkFor[sizeof(checkFor) - 1]); - -} // constructor - - -// -// ReceiveDragItem -// -// Called for each item dropped on the table. Pass it off the the backend, etc to do the -// right thing for the kind dropped here. -// -void -CURLDragMixin :: ReceiveDragItem ( DragReference inDragRef, DragAttributes /*inDragAttrs*/, - ItemReference inItemRef, Rect & /*inItemBounds*/ ) -{ - try { - FlavorType useFlavor; - FindBestFlavor ( inDragRef, inItemRef, useFlavor ); - Size theDataSize = 0; - switch ( useFlavor ) { - - case emBookmarkDrag: - { - try { - string url, title; - CURLDragHelper::ExtractURLAndTitle ( inDragRef, inItemRef, url, title ) ; - HandleDropOfPageProxy ( url.c_str(), title.c_str() ); - } - catch ( ... ) { - DebugStr ( "\pError getting flavor data for proxy drag" ); - } - } - break; - - case flavorTypeHFS: - case flavorTypePromiseHFS: - { - try { - string url; - HFSFlavor theData; - CURLDragHelper::ExtractFileURL ( inDragRef, inItemRef, url, theData ) ; - HandleDropOfLocalFile ( url.c_str(), CStr255(theData.fileSpec.name), theData ); - } - catch ( ... ) { - DebugStr ( "\pError getting flavor data for proxy drag" ); - } - } - break; - - case 'TEXT': - { - OSErr err = ::GetFlavorDataSize(inDragRef, inItemRef, 'TEXT', &theDataSize); - if ( err && err != badDragFlavorErr ) - throw(err); - else if ( theDataSize ) { - vector textData ( theDataSize + 1 ); - try { - ThrowIfOSErr_( ::GetFlavorData( inDragRef, inItemRef, 'TEXT', - &(*textData.begin()), &theDataSize, 0 ) ); - HandleDropOfText ( &(*textData.begin()) ); - } - catch ( ... ) { - DebugStr("\pError getting flavor data for TEXT"); - } - } - } - break; - - default: - throw(-1); - break; - - } // case of best flavor - } - catch ( ... ) { - DebugStr ( "\pCan't find the flavor we want; g" ); - } - -} // ReceiveDragItem - - -// -// FindBestFlavor -// -// Checks the item being dropped and returns the best flavor that we support. It does -// this by searching through the list of acceptable flavors, returning the first one -// supported by the drag item. Since the acceptable flavors are ordered by preference, -// the first one found is the best one. -// -bool -CURLDragMixin :: FindBestFlavor ( DragReference inDragRef, ItemReference inItemRef, - FlavorType & oFlavor ) const -{ - // a function object which implements the body of the find_if() loop below. Returns - // true if the flavor given is present in the drag item - class FindBestFlavor_imp - { - public: - FindBestFlavor_imp ( DragReference inDragRef, ItemReference inItemRef ) - : mDragRef(inDragRef), mItemRef(inItemRef) { } ; - bool operator() ( const FlavorType & inType ) - { - FlavorFlags ignore; - if ( ::GetFlavorFlags(mDragRef, mItemRef, inType, &ignore) == noErr ) - return true; - return false; - } - private: - DragReference mDragRef; - ItemReference mItemRef; - }; - - FlavorType* result = &(* find_if ( AcceptedFlavors().begin(), AcceptedFlavors().end(), - FindBestFlavor_imp(inDragRef, inItemRef) ) ); - if ( result != &(*AcceptedFlavors().end()) ) { - oFlavor = *result; - return true; - } - return false; - -} // FindBestFlavor - - -#pragma mark - - - -// -// CHTAwareURLDragMixin constructor -// -// As the name implies, this version of the URLDragMixin class knows about HT, and thus -// HT_Resources. Add the HT_Resource drag flavor to the front of the acceptable flavors -// list, because we want to use that first if it is present over all other drag flavors -// -CHTAwareURLDragMixin :: CHTAwareURLDragMixin ( ) -{ - AcceptedFlavors().insert ( AcceptedFlavors().begin(), 1, (FlavorType)emHTNodeDrag ); - -} // constructor - - -// -// ReceiveDragItem -// -// Overridden to handle the HT_Resource drag flavor before all the others -// -void -CHTAwareURLDragMixin :: ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) -{ - try { - FlavorType useFlavor; - FindBestFlavor ( inDragRef, inItemRef, useFlavor ); - Size theDataSize = 0; - switch ( useFlavor ) { - - case emHTNodeDrag: - { - HT_Resource draggedNode = NULL; - HT_Resource node = NULL; - theDataSize = sizeof(void*); - ThrowIfOSErr_(::GetFlavorData( inDragRef, inItemRef, emHTNodeDrag, &node, &theDataSize, 0 )); - HandleDropOfHTResource ( node ); - } - break; - - default: - CURLDragMixin::ReceiveDragItem(inDragRef, inDragAttrs, inItemRef, inItemBounds); - break; - - } // switch on best flavor - } - catch ( ... ) { - DebugStr ( "\pCan't find the flavor we want; g" ); - } - -} // ReceiveDragItem - - -// -// NodeCanAcceptDrop -// -// Check each item in the drop to see if it can be dropped on the particular node given in |inTargetNode|. -// This will _and_ together the results for all the items in a drag so that if any of of them succeeds, -// they all do. Is this the right behavior? -// -bool -CHTAwareURLDragMixin :: NodeCanAcceptDrop ( DragReference inDragRef, HT_Resource inTargetNode ) const -{ - Uint16 itemCount; - ::CountDragItems(inDragRef, &itemCount); - bool acceptableDrop = true; - bool targetIsContainer = HT_IsContainer ( inTargetNode ); - - for ( Uint16 item = 1; item <= itemCount; item++ ) { - ItemReference itemRef; - ::GetDragItemReferenceNumber(inDragRef, item, &itemRef); - - try { - FlavorType useFlavor; - FindBestFlavor ( inDragRef, itemRef, useFlavor ); - switch ( useFlavor ) { - - case emHTNodeDrag: - { - try { - HT_Resource draggedNode = NULL; - Size theDataSize = sizeof(HT_Resource); - ThrowIfOSErr_(::GetFlavorData( inDragRef, itemRef, emHTNodeDrag, &draggedNode, &theDataSize, 0 )); - if ( targetIsContainer ) - acceptableDrop &= HT_CanDropHTROn ( inTargetNode, draggedNode ); // FIX TO CHANGE CURSOR - else - acceptableDrop &= HT_CanDropHTRAtPos ( inTargetNode, draggedNode, PR_TRUE ); - } - catch ( ... ) { - acceptableDrop = false; - } - } - break; - - case emBookmarkDrag: - { - try { - string url, title; - CURLDragHelper::ExtractURLAndTitle ( inDragRef, itemRef, url, title ); - char* castURL = const_cast(url.c_str()); // lame. - if ( targetIsContainer ) - acceptableDrop &= HT_CanDropURLOn ( inTargetNode, castURL ); // FIX TO CHANGE CURSOR - else - acceptableDrop &= HT_CanDropURLAtPos ( inTargetNode, castURL, PR_TRUE ); - } - catch ( ... ) { - acceptableDrop = false; - } - } - break; - - case flavorTypeHFS: - case flavorTypePromiseHFS: - { - try { - string url; - HFSFlavor ignored; - CURLDragHelper::ExtractFileURL ( inDragRef, itemRef, url, ignored ); - char* castURL = const_cast(url.c_str()); // lame. - if ( targetIsContainer ) - acceptableDrop &= HT_CanDropURLOn ( inTargetNode, castURL ); // FIX TO CHANGE CURSOR.... - else - acceptableDrop &= HT_CanDropURLAtPos ( inTargetNode, castURL, PR_TRUE ); - } - catch ( ... ) { - acceptableDrop = false; - } - } - break; - - case 'TEXT': - break; - - default: - // throw? - break; - } - } - catch ( ... ) { - #if DEBUG - DebugStr("\pDrag with no recognized flavors; g"); - #endif - } - - } // for each file - - return acceptableDrop; - -} // NodeCanAcceptDrop diff --git a/mozilla/cmd/macfe/gui/CURLDragHelper.h b/mozilla/cmd/macfe/gui/CURLDragHelper.h deleted file mode 100644 index d97d783b861..00000000000 --- a/mozilla/cmd/macfe/gui/CURLDragHelper.h +++ /dev/null @@ -1,151 +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. - */ - -// -// Mike Pinkerton -// Netscape Communications -// -// A collection of classes that help out when implementing drag and drop. CURLDragHelper -// is just a bunch of static utility routines. CURLDragMixin (and its subclasses) are -// the real meat of this file, implementing most of the work of pulling information -// out of the drag manager for the 4 or so most common drag flavors encountered when -// dragging an icon around in Navigator. -// -// To use the CURLDragMixin classes, just mix them into the class that deals with d&d, -// overload PP's ReceiveDragItem() to call the one in CURLDragMixin and override the -// functions that actually do the work for your class: -// virtual void HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) = 0; -// virtual void HandleDropOfLocalFile ( const char* inFileURL, const char* fileName ) = 0; -// virtual void HandleDropOfText ( const char* inTextData ) = 0; -// -// CHTAwareURLDragMixin adds the ability to understand drags from HT (Aurora) and adds -// one more method to override -// virtual void HandleDropOfHTResource ( HT_Resource node ) = 0; -// - -#pragma once - -#include -#include -#include "htrdf.h" - - -// -// class CURLDragHelper -// -// Interface to a class that contains code common to classes that have to do drag and -// drop for items w/ urls (bookmarks, etc). Nothing really out of the ordinary here. -// - -class CURLDragHelper -{ -public: - - // call after a drop. Handles sending the data or creating files from flavors - // registered for url-ish items - static void DoDragSendData ( const char* inURL, char* inTitle, FlavorType inFlavor, - ItemReference inItemRef, DragReference inDragRef) ; - - // Extracts the url and title from a bookmark drag (url\rtitle). Will throw if - // can't get the right data. - static void ExtractURLAndTitle ( DragReference inDragRef, ItemReference inItemRef, - string & outURL, string & outTitle ) ; - - // Extracts the file url from a file drag. Will throw if can't get the right data. - static void ExtractFileURL ( DragReference inDragRef, ItemReference inItemRef, - string & outFileName, HFSFlavor & outData ) ; - - // Make sure the caption for an icon isn't too long so that it leaves turds. - // handles middle truncation, etc if title is too long - static string MakeIconTextValid ( const char* inTitle ); - - // build a url/title pair for the bookmark flavor. - static string CreateBookmarkFlavorURL ( const char* inURL, const char* inTitle ) ; - -}; // CURLDragHelper - - - -// -// class CURLDragMixin -// -// A mixin class for implementing drag and drop for the common drag flavors encountered -// when the user drags around something with a URL. -// - -class CURLDragMixin -{ -public: - - CURLDragMixin ( ) ; - virtual ~CURLDragMixin ( ) { } ; - -protected: - - virtual void ReceiveDragItem ( DragReference inDragRef, DragAttributes /*inDragAttrs*/, - ItemReference inItemRef, Rect & /*inItemBounds*/ ) ; - virtual bool FindBestFlavor ( DragReference inDragRef, ItemReference inItemRef, - FlavorType & oFlavor ) const; - - // must override to do the right thing - virtual void HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) = 0; - virtual void HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & inFileData ) = 0; - virtual void HandleDropOfText ( const char* inTextData ) = 0; - - typedef vector FlavorList; - typedef vector::iterator FlavorListIterator; - typedef vector::const_iterator FlavorListConst_Iterator; - - // access to the flavor list - FlavorList & AcceptedFlavors() { return mAcceptableFlavors; } - const FlavorList & AcceptedFlavors() const { return mAcceptableFlavors; } - -private: - - FlavorList mAcceptableFlavors; - -}; // CURLDragMixin - - -// -// class CHTAwareURLDragMixin -// -// Adds to CURLDragMixin the ability to understand things coming from HT (Aurora). -// - -class CHTAwareURLDragMixin : public CURLDragMixin -{ -public: - - CHTAwareURLDragMixin ( ); - virtual ~CHTAwareURLDragMixin ( ) { } ; - -protected: - - // overridden to handle HT_Resource drops - virtual void ReceiveDragItem ( DragReference inDragRef, DragAttributes /*inDragAttrs*/, - ItemReference inItemRef, Rect & /*inItemBounds*/ ) ; - - // must override to do the right thing - virtual void HandleDropOfHTResource ( HT_Resource node ) = 0; - - // help to determine if HT will accept all the items dropped on this pane - virtual bool NodeCanAcceptDrop ( DragReference inDragRef, HT_Resource inTargetNode ) const; - -}; // CHTAwareURLDragMixin \ No newline at end of file diff --git a/mozilla/cmd/macfe/gui/CURLEditField.cp b/mozilla/cmd/macfe/gui/CURLEditField.cp deleted file mode 100644 index 8261bdb00c8..00000000000 --- a/mozilla/cmd/macfe/gui/CURLEditField.cp +++ /dev/null @@ -1,227 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CURLEditField.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "CURLEditField.h" - -#include - -#include - -#include "net.h" // for URL_Struct - -#include "CNSContext.h" // for CNSContext messages -#include "ufilemgr.h" // for CFileMgr::FileNameFromURL - -#include "libmocha.h" // for LM_StripWysiwygURLPrefix - -const size_t cCompareWholeString = 0; - -struct urlFilter { - const char* string; - size_t comparisonLength; -}; - -// table of URL's not to display -const Uint8 numFilteredURLs = 3; -const urlFilter cAboutFilter = { "about:document", cCompareWholeString }; -const urlFilter cMailtoFilter = { "mailto:", 7 }; -const urlFilter cNetHelpFilter = { "nethelp:", 8 }; -const urlFilter* filteredURLs[] = -{ - &cAboutFilter, - &cMailtoFilter, - &cNetHelpFilter -}; - -CURLEditField::CURLEditField(LStream *inStream) : -CTSMEditField(inStream), mURLStringInSync(false) -{ -} - -Boolean CURLEditField::HandleKeyPress(const EventRecord& inKeyEvent) -{ - char c = inKeyEvent.message & charCodeMask; - Boolean handled = false; - - if ((c == char_Enter) || (c == char_Return)) - { - Int32 blockSize = 1024; // 1024 is max len of field in PPob - char *urlBlock = (char *)XP_ALLOC(blockSize); - ThrowIfNil_(urlBlock); - GetDescriptorLen(urlBlock, blockSize); - BroadcastMessage(msg_UserSubmittedURL, urlBlock); - XP_FREE(urlBlock); - handled = true; - } - else - { - handled = CTSMEditField::HandleKeyPress(inKeyEvent); - if (handled) - { - if ((c != char_Tab) && mURLStringInSync) - { - BroadcastMessage(msg_UserChangedURL); - mURLStringInSync = false; - } - } - } - return handled; -} - -void CURLEditField::DrawSelf() -{ - StColorPenState::Normalize(); - - Rect theFrame; - CalcLocalFrameRect(theFrame); - ::EraseRect(&theFrame); - - CTSMEditField::DrawSelf(); -} - -void CURLEditField::ClickSelf(const SMouseDownEvent& inMouseDown) -{ - Boolean wasTarget = IsTarget(); - - if (wasTarget && GetClickCount() == 3) - SelectAll(); - else - { - CTSMEditField::ClickSelf(inMouseDown); - - // If we just switched the target to ourselves and the user - // didn't just make a partial selection of the text, - // then we select the entire field for convenience. - // - if (!wasTarget && IsTarget()) - { - TEHandle textEditHandle = GetMacTEH(); - - if ( (**textEditHandle).selStart == (**textEditHandle).selEnd ) - SelectAll(); - } - } -} - - - -// Needed for strings > 255 chars long -// inDescriptorStorage must have been allocated. It's length is given in ioLength -void CURLEditField::GetDescriptorLen(char *inDescriptorStorage, Int32 &ioLength) const -{ - Int32 curLength; - - curLength = (**mTextEditH).teLength; - - if (curLength >= ioLength) - curLength = ioLength - 1; // space for terminator - - Handle textHandle = ::TEGetText(mTextEditH); //the handle is owned by the TE - - ::BlockMoveData(*textHandle, inDescriptorStorage, curLength); - inDescriptorStorage[curLength] = '\0'; - ioLength = curLength; // excludes the terminator, i.e. same as strlen - - return ; -} - - -// Needed for strings > 255 chars long -void CURLEditField::SetDescriptorLen(const char *inDescriptor, Int32 inLength) -{ - Assert_(inLength < mMaxChars); - - if (inLength > mMaxChars) - inLength = mMaxChars; - - ::TESetText(inDescriptor, inLength, mTextEditH); - Refresh(); -} - - -void CURLEditField::ListenToMessage(MessageT inMessage, void* ioParam) -{ - if (ioParam) - { - switch (inMessage) - { - // NOTE: We assume we only get this broadcast from the main - // CNSContext - case msg_NSCStartLoadURL: - case msg_NSCLayoutNewDocument: - URL_Struct* theURL = (URL_Struct*)ioParam; - // 1997-03-23 pkc - // Call LM_StripWysiwygURLPrefix to strip those pesky - // "wysiwyg" URL's. According to Brendan, LM_StripWysiwygURLPrefix - // doesn't allocate a new string. - const char *urlOffset = LM_StripWysiwygURLPrefix(theURL->address); - if (DisplayURL(urlOffset)) - { - SetDescriptorLen(urlOffset, XP_STRLEN(urlOffset)); - mURLStringInSync = true; - } - } - } -} - -// Filter function to determine whether or not to display URL - -Boolean CURLEditField::DisplayURL(const char *inURL) -{ - // if inURL is in filteredURLs table, return false - for(int i = 0; i < numFilteredURLs; i++) - { - const urlFilter* filter = filteredURLs[i]; - if (filter->comparisonLength == cCompareWholeString) - { - if (XP_STRCMP(filter->string, inURL) == 0) - return false; - } - else - { - if (XP_STRNCMP(filter->string, inURL, filter->comparisonLength) == 0) - return false; - } - } - return true; -} - -Boolean CURLEditField::ObeyCommand(CommandT inCommand,void *ioParam) -{ - if (inCommand == msg_TabSelect) - { - if (IsVisible()) - return true; - else - return false; - } - else - { - return CTSMEditField::ObeyCommand(inCommand, ioParam); - } -} - -void CURLEditField::BeTarget() -{ - CTSMEditField::BeTarget(); - SelectAll(); -} diff --git a/mozilla/cmd/macfe/gui/CURLEditField.h b/mozilla/cmd/macfe/gui/CURLEditField.h deleted file mode 100644 index fe59c1055a6..00000000000 --- a/mozilla/cmd/macfe/gui/CURLEditField.h +++ /dev/null @@ -1,78 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CURLEditField.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// -// This is the URL EditField for the browser. -// It updates the text via broadcasts from a CNSContext, and it broadcasts -// a message when the user types a key (so that we can change "Location" to "Goto") -// and when the user hits return or enter - -#pragma once - -#include -#include - -//#include "VEditField.h" -#include "CTSMEditField.h" - -#include "PascalString.h" // for CString and subclasses - -// Messages broadcasted by CURLEditField -enum { - // user hit enter or return - msg_UserSubmittedURL = 'USuU', // CStr255* url - // user typed into edit field - msg_UserChangedURL = 'UChU' // -}; - -// CURLEditField -// -// This class is similar to CURLText in mviews.cp, but it listens directly for -// layout new document messages to set it's text - -class CURLEditField : public CTSMEditField, public LBroadcaster, public LListener -{ - private: - typedef CTSMEditField Inherited; - - public: - enum { class_ID = 'UEdF' }; - - CURLEditField(LStream* inStream); - virtual ~CURLEditField() {}; - - virtual Boolean HandleKeyPress(const EventRecord& inKeyEvent); - void DrawSelf(); - virtual void ClickSelf(const SMouseDownEvent& inMouseDown); - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - virtual void SetDescriptorLen(const char *inDescriptor, Int32 inLength); - virtual void GetDescriptorLen(char *inDescriptorStorage, Int32 &ioLength) const; - - virtual Boolean ObeyCommand(CommandT inCommand, - void *ioParam = nil); - - protected: - virtual Boolean DisplayURL(const char *inURL); - virtual void BeTarget(); - - Boolean mURLStringInSync; -}; diff --git a/mozilla/cmd/macfe/gui/CWindowMediator.cp b/mozilla/cmd/macfe/gui/CWindowMediator.cp deleted file mode 100644 index ff0bba2d40b..00000000000 --- a/mozilla/cmd/macfe/gui/CWindowMediator.cp +++ /dev/null @@ -1,386 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CWindowMediator.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef PowerPlant_PCH -#include PowerPlant_PCH -#endif - -#include "CWindowMediator.h" - -#include "CCloseAllAttachment.h" // MGY: added CCloseAllAttachment stuff -#include "resgui.h" // MGY: added CCloseAllAttachment stuff -#include "CBrowserWindow.h" - -CAutoPtr CWindowMediator::sMediator; - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CMediatedWindow::CMediatedWindow(LStream* inStream, DataIDT inWindowType) - : LWindow(inStream) -{ - mWindowType = inWindowType; - (CWindowMediator::GetWindowMediator())->NoteWindowCreated(this); - - // MGY: added CCloseAllAttachment stuff - - if (HasAttribute(windAttr_Regular | windAttr_CloseBox)) - { - AddAttachment(new CCloseAllAttachment(CLOSE_WINDOW, CLOSE_ALL_WINDOWS)); - } -} - -CMediatedWindow::~CMediatedWindow() -{ - (CWindowMediator::GetWindowMediator())->NoteWindowDisposed(this); -} - -DataIDT CMediatedWindow::GetWindowType(void) const -{ - return mWindowType; -} - -void CMediatedWindow::SetWindowType(DataIDT inWindowType) -{ - mWindowType = inWindowType; -} - -void CMediatedWindow::SetDescriptor(ConstStr255Param inDescriptor) -{ - LWindow::SetDescriptor(inDescriptor); - (CWindowMediator::GetWindowMediator())->NoteWindowDescriptorChanged(this); -} - -void CMediatedWindow::ActivateSelf(void) -{ - LWindow::ActivateSelf(); - (CWindowMediator::GetWindowMediator())->NoteWindowActivated(this); -} - -void CMediatedWindow::DeactivateSelf(void) -{ - LWindow::DeactivateSelf(); - (CWindowMediator::GetWindowMediator())->NoteWindowDeactivated(this); -} - -void CMediatedWindow::Hide(void) -{ - LWindow::Hide(); - (CWindowMediator::GetWindowMediator())->NoteWindowHidden(this); -} - -void CMediatedWindow::Show(void) -{ - LWindow::Show(); - (CWindowMediator::GetWindowMediator())->NoteWindowShown(this); -} - -void -CMediatedWindow::NoteWindowMenubarModeChanged() -{ - (CWindowMediator::GetWindowMediator())->NoteWindowMenubarModeChanged(this); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CWindowIterator::CWindowIterator(DataIDT inWindowType, Boolean inCountHidden) -: mWindowType(inWindowType) -, mIndexWindow(NULL) -, mCountHidden(inCountHidden) -{ -} - -Boolean CWindowIterator::Next(CMediatedWindow*& outWindow) -{ - WindowPtr theStartWindow; - if (mIndexWindow == NULL) - theStartWindow = (WindowPtr)LMGetWindowList(); - else - { - theStartWindow = mIndexWindow->GetMacPort(); - theStartWindow = (WindowPtr) ((WindowPeek) theStartWindow)->nextWindow; - } - - CMediatedWindow *theWindow, *theFoundWindow = NULL; - for ( ; theStartWindow != NULL; theStartWindow = (WindowPtr)((WindowPeek)theStartWindow)->nextWindow) - { - theWindow = dynamic_cast(LWindow::FetchWindowObject(theStartWindow)); - if (theWindow == NULL || (!mCountHidden && !theWindow->IsVisible())) - continue; - - if ((mWindowType == WindowType_Any || theWindow->GetWindowType() == mWindowType)) - { - theFoundWindow = theWindow; - break; - } - } - - outWindow = theFoundWindow; - mIndexWindow = theFoundWindow; - - return (theFoundWindow != NULL); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CWindowMediator* CWindowMediator::GetWindowMediator(void) -{ - if (!sMediator.get()) - { - sMediator.reset(new CWindowMediator); - } - - return sMediator.get(); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Int16 CWindowMediator::CountOpenWindows(Int32 inWindType) -{ - return CountOpenWindows(inWindType, dontCareLayerType); -} - - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Count windows of a type in a layer -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -Int16 CWindowMediator::CountOpenWindows(Int32 inWindType, LayerType inLayerType, Boolean inIncludeInvisible) -{ - Int16 theWindowCount = 0; - - CMediatedWindow *theWindow = NULL; - WindowPtr macWindowP = (WindowPtr) LMGetWindowList(); - while (macWindowP != NULL) - { - if ((theWindow = dynamic_cast(LWindow::FetchWindowObject(macWindowP))) == NULL) - { - macWindowP = (WindowPtr) ((WindowPeek) macWindowP)->nextWindow; - continue; - } - - if ((inWindType == WindowType_Any) || (theWindow->GetWindowType() == inWindType)) - { - if (inIncludeInvisible || theWindow->IsVisible()) - { - switch (inLayerType) - { - case dontCareLayerType: - theWindowCount++; - break; - case modalLayerType: - if (theWindow->HasAttribute(windAttr_Modal)) - theWindowCount++; - break; - case floatingLayerType: - if (theWindow->HasAttribute(windAttr_Floating)) - theWindowCount++; - break; - case regularLayerType: - if (theWindow->HasAttribute(windAttr_Regular)) - theWindowCount++; - break; - } - } - } - - macWindowP = (WindowPtr) ((WindowPeek) macWindowP)->nextWindow; - } - - return theWindowCount; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CMediatedWindow* CWindowMediator::FetchTopWindow(Int32 inWindType) -{ - CMediatedWindow *theFoundWindow = NULL; - - CWindowIterator theIterator(inWindType); - theIterator.Next(theFoundWindow); - - return theFoundWindow; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Returns the topmost mediated window in a given layer -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -CMediatedWindow* CWindowMediator::FetchTopWindow(LayerType inLayerType) -{ - return FetchTopWindow(WindowType_Any, inLayerType); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Returns the topmost mediated window of a given type in a given layer -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -CMediatedWindow* CWindowMediator::FetchTopWindow(Int32 inWindType, LayerType inLayerType) -{ - return FetchTopWindow(inWindType, inLayerType, true); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Returns the topmost mediated window of a given type in a given layer, with -// the option of excluding windows which are restricted targets (created by javascript). -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -CMediatedWindow* CWindowMediator::FetchTopWindow(Int32 inWindType, LayerType inLayerType, Boolean inIncludeRestrictedTargets) -{ - CMediatedWindow *theFoundWindow = NULL; - - CWindowIterator theIterator(inWindType); - theIterator.Next(theFoundWindow); - - while (theFoundWindow != NULL) - { - if (!inIncludeRestrictedTargets && (inWindType == WindowType_Browser)) - { - CBrowserWindow* theBrWn = dynamic_cast(theFoundWindow); - if ((theBrWn != nil) && theBrWn->IsRestrictedTarget()) - { - theIterator.Next(theFoundWindow); - continue; - } - } - switch (inLayerType) - { - case dontCareLayerType: - return theFoundWindow; - case modalLayerType: - if (theFoundWindow->HasAttribute(windAttr_Modal)) - return theFoundWindow; - else break; - case floatingLayerType: - if (theFoundWindow->HasAttribute(windAttr_Floating)) - return theFoundWindow; - else break; - case regularLayerType: - if (theFoundWindow->HasAttribute(windAttr_Regular)) - return theFoundWindow; - else break; - } - theIterator.Next(theFoundWindow); - } - return theFoundWindow; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Returns the bottommost mediated window. -// If inIncludeAlwaysLowered is false, returns the window above the topmost alwaysLowered -// window. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -CMediatedWindow* CWindowMediator::FetchBottomWindow(Boolean inIncludeAlwaysLowered) -{ - CMediatedWindow *theFoundWindow = NULL; - CMediatedWindow *lastFoundWindow = NULL; - - CWindowIterator theIterator(WindowType_Any); - theIterator.Next(theFoundWindow); - - while (theFoundWindow != NULL) - { - if (!inIncludeAlwaysLowered) - { - CBrowserWindow* theBrWn = dynamic_cast(theFoundWindow); - if ((theBrWn != nil) && theBrWn->IsAlwaysLowered()) - return lastFoundWindow; - } - lastFoundWindow = theFoundWindow; - theIterator.Next(theFoundWindow); - } - return lastFoundWindow; -} - -void CWindowMediator::CloseAllWindows(Int32 inWindType) -{ - CMediatedWindow* theWindow; - - CWindowIterator theIterator(inWindType); - theIterator.Next(theWindow); - - while (theWindow != NULL) - { - CMediatedWindow* theNextWindow; - theIterator.Next(theNextWindow); - - theWindow->AttemptClose(); - theWindow = theNextWindow; - } -} - -CWindowMediator::CWindowMediator() -{ -} - -CWindowMediator::~CWindowMediator() -{ -} - -void CWindowMediator::NoteWindowCreated(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowCreated, inWindow); - mWindowList.InsertItemsAt(1, LArray::index_First, &inWindow); -} - -void CWindowMediator::NoteWindowDisposed(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowDisposed, inWindow); - mWindowList.Remove(&inWindow); -} - -void CWindowMediator::NoteWindowShown(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowCreated, inWindow); -} - -void CWindowMediator::NoteWindowHidden(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowDisposed, inWindow); -} - -void CWindowMediator::NoteWindowDescriptorChanged(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowDescriptorChanged, inWindow); -} - -void CWindowMediator::NoteWindowActivated(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowActivated, inWindow); -} - -void CWindowMediator::NoteWindowDeactivated(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowDeactivated, inWindow); -} - -void CWindowMediator::NoteWindowMenubarModeChanged(CMediatedWindow* inWindow) -{ - BroadcastMessage(msg_WindowMenuBarModeChanged, inWindow); -} - diff --git a/mozilla/cmd/macfe/gui/CWindowMediator.h b/mozilla/cmd/macfe/gui/CWindowMediator.h deleted file mode 100644 index 134e7bd8c70..00000000000 --- a/mozilla/cmd/macfe/gui/CWindowMediator.h +++ /dev/null @@ -1,141 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CWindowMediator.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include - -#include "CAutoPtr.h" - -enum { - WindowType_Any = '****' -}; - -const MessageT msg_WindowCreated = 'cre8'; -const MessageT msg_WindowDisposed = 'dsp0'; -const MessageT msg_WindowDescriptorChanged = 'dscG'; -const MessageT msg_WindowActivated = 'wact'; -const MessageT msg_WindowDeactivated = 'wdct'; -const MessageT msg_WindowMenuBarModeChanged = 'wmbr'; - -#include "Netscape_Constants.h" - -class CMediatedWindow : public LWindow -{ - public: - enum { class_ID = 'CMDW' }; // for PowerPlant - - CMediatedWindow(LStream* inStream); - CMediatedWindow( - LStream* inStream, - DataIDT inWindowType); - - virtual ~CMediatedWindow(); - - DataIDT GetWindowType(void) const; - void SetWindowType(DataIDT inWindowType); - - virtual void SetDescriptor(ConstStr255Param inDescriptor); - - // I18N stuff - // If the subclass of CMediatedWindow know the default csid for a new context - // It should overload the DefaultCSIDForNewWindow() function and return non-0 value - virtual Int16 DefaultCSIDForNewWindow(void) { return 0; }; - - virtual void Show(void); - virtual void Hide(void); - - protected: - - virtual void ActivateSelf(void); - virtual void DeactivateSelf(void); - - void NoteWindowMenubarModeChanged(); - - DataIDT mWindowType; -}; - - -class CWindowIterator -{ - public: - CWindowIterator(DataIDT inWindowType, Boolean inCountHidden = true); - - Boolean Next(CMediatedWindow*& outWindow); - - protected: - - CMediatedWindow* mIndexWindow; - DataIDT mWindowType; - Boolean mCountHidden; -}; - -enum LayerType -{ - dontCareLayerType, - modalLayerType, - floatingLayerType, - regularLayerType -}; - -class CWindowMediator : public LBroadcaster -{ - friend class CMediatedWindow; - - public: - static CWindowMediator* GetWindowMediator(); - - // ¥ Window Fetching - Int16 CountOpenWindows(Int32 inWindType); - Int16 CountOpenWindows(Int32 inWindType, LayerType inLayerType, Boolean inIncludeInvisible = true); - CMediatedWindow* FetchTopWindow(Int32 inWindType); - CMediatedWindow* FetchTopWindow(LayerType inLayerType); - CMediatedWindow* FetchTopWindow(Int32 inWindType, LayerType inLayerType); - CMediatedWindow* FetchTopWindow(Int32 inWindType, LayerType inLayerType, Boolean inIncludeRestrictedTargets); - CMediatedWindow* FetchBottomWindow(Boolean inIncludeAlwaysLowered); - - void CloseAllWindows(Int32 inWindType); - - protected: - - void NoteWindowCreated(CMediatedWindow* inWindow); - void NoteWindowDisposed(CMediatedWindow* inWindow); - void NoteWindowShown(CMediatedWindow* inWindow); - void NoteWindowHidden(CMediatedWindow* inWindow); - void NoteWindowDescriptorChanged(CMediatedWindow* inWindow); - void NoteWindowActivated(CMediatedWindow* inWindow); - void NoteWindowDeactivated(CMediatedWindow* inWindow); - void NoteWindowMenubarModeChanged(CMediatedWindow* inWindow); - - LArray mWindowList; - - static CAutoPtr sMediator; - - private: - friend class CAutoPtr; - - CWindowMediator(); - virtual ~CWindowMediator(); -}; - - diff --git a/mozilla/cmd/macfe/gui/CWindowMenu.cp b/mozilla/cmd/macfe/gui/CWindowMenu.cp deleted file mode 100644 index 2e58702039f..00000000000 --- a/mozilla/cmd/macfe/gui/CWindowMenu.cp +++ /dev/null @@ -1,207 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CWindowMenu.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef PowerPlant_PCH -#include PowerPlant_PCH -#endif - -#include "CWindowMenu.h" -#include "CWindowMediator.h" -#include "UMenuUtils.h" -//#include "UAEGizmos.h" - -//#include -#include -#include - -CWindowMenu* CWindowMenu::sWindowMenu = NULL; - -//----------------------------------- -CWindowMenu::CWindowMenu(ResIDT inMenuID) -//----------------------------------- - : LMenu(inMenuID) - , mWindowList(sizeof(const CMediatedWindow*)) - , mDirty(true) -{ - MenuHandle macMenu = GetMacMenuH(); - - if (macMenu) - UMenuUtils::ConvertToIconMenu(macMenu, 15550); - - mLastNonDynamicItem = ::CountMenuItems(macMenu); - sWindowMenu = this; -} - -//----------------------------------- -CWindowMenu::~CWindowMenu() -//----------------------------------- -{ - sWindowMenu = NULL; -} - -//----------------------------------- -void CWindowMenu::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case msg_WindowCreated: - { - const CMediatedWindow* window = (CMediatedWindow*)ioParam; - AddWindow(window); - } - break; - - case msg_WindowDisposed: - { - const CMediatedWindow* window = (CMediatedWindow*)ioParam; - RemoveWindow(window); - } - break; - - case msg_WindowDescriptorChanged: - { - LCommander::SetUpdateCommandStatus(true); - SetMenuDirty(true); - } - break; - } -} - -//----------------------------------- -void CWindowMenu::AddWindow(const CMediatedWindow* inWindow) -//----------------------------------- -{ - // Check if a window is already there (needed now that we call remove on - // both hide/dispose and add on both show/add) - ArrayIndexT index = mWindowList.FetchIndexOf(&inWindow); - if (index == LArray::index_Bad) - { - mWindowList.InsertItemsAt(1, LArray::index_Last, &inWindow); - LCommander::SetUpdateCommandStatus(true); - SetMenuDirty(true); - } -} - -//----------------------------------- -void CWindowMenu::RemoveWindow(const CMediatedWindow* inWindow) -//----------------------------------- -{ - ArrayIndexT index = mWindowList.FetchIndexOf(&inWindow); - if (index != LArray::index_Bad) - { - mWindowList.Remove(&inWindow); - LCommander::SetUpdateCommandStatus(true); - SetMenuDirty(true); - } -} - -//----------------------------------- -void CWindowMenu::Update() -//---------------------------------- -{ - if (!sWindowMenu || !sWindowMenu->IsMenuDirty()) - return; - sWindowMenu->UpdateSelf(); -} - -//----------------------------------- -void CWindowMenu::UpdateSelf() -//---------------------------------- -{ - if (!sWindowMenu || !sWindowMenu->IsMenuDirty()) - return; - - MenuHandle theMacMenu = GetMacMenuH(); - Assert_(theMacMenu != NULL); - - UMenuUtils::PurgeMenuItems(theMacMenu, mLastNonDynamicItem); - - TString windowName; - CMediatedWindow* window; - Boolean bFirstTime = true; - - LArrayIterator theIterator(mWindowList, LArrayIterator::from_Start); - while (theIterator.Next(&window)) - { - - if (bFirstTime) - { - UMenuUtils::AppendSeparator(theMacMenu); - bFirstTime = false; - } - -// if (window->GetWindowType() == WindowType_Browser) - { - window->GetDescriptor(windowName); - Int16 theAppendIndex = UMenuUtils::AppendMenuItem(theMacMenu, windowName); - } - } - - SetMenuDirty(false); -} - -//----------------------------------- -Boolean CWindowMenu::ObeyWindowCommand(CommandT inCommand) -//----------------------------------- -{ - if (!sWindowMenu) - return false; - ResIDT menuID; - Int16 menuItem; - if (LCommander::IsSyntheticCommand(inCommand, menuID, menuItem)) - return sWindowMenu->ObeyWindowCommand(menuID, menuItem); - return false; -} - -//----------------------------------- -Boolean CWindowMenu::ObeyWindowCommand(Int16 inMenuID, Int16 inMenuItem) -//----------------------------------- -{ - if (inMenuID != GetMenuID()) - return false; - inMenuItem -= (mLastNonDynamicItem + 1); // 1 for the separator - if (mLastNonDynamicItem <= 0) - return false; - const CMediatedWindow* window = NULL; - if (!mWindowList.FetchItemAt(inMenuItem, &window) || !window) - return false; - //AppleEvent theSelectEvent; - //LAEStream theEventStream(kAEMiscStandards, kAESelect); - //StAEDescriptor windowDesc; - //window->MakeSpecifier(windowDesc.mDesc); - //theEventStream.WriteKeyDesc(keyDirectObject, windowDesc); - //theEventStream.Close(&theSelectEvent); - //UAppleEventsMgr::SendAppleEvent(theSelectEvent); - return true; -} - -// called from CFrontApp to remove commands from the Window menu; -// updates the item count if necessary. -void CWindowMenu::RemoveCommand(CommandT inCommand) -{ - if (inCommand > 0) { - LMenu::RemoveCommand(inCommand); - mLastNonDynamicItem--; - } -} - diff --git a/mozilla/cmd/macfe/gui/CWindowMenu.h b/mozilla/cmd/macfe/gui/CWindowMenu.h deleted file mode 100644 index bc112901cdf..00000000000 --- a/mozilla/cmd/macfe/gui/CWindowMenu.h +++ /dev/null @@ -1,72 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// CWindowMenu.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include -#include -#include - -class CMediatedWindow; - -//====================================== -class CWindowMenu : public LMenu, public LListener -//====================================== -{ - // API: - public: - CWindowMenu(ResIDT inMenuID); - virtual ~CWindowMenu(); - - static void Update(); - static Boolean ObeyWindowCommand(CommandT inCommand); - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - void RemoveCommand(CommandT inCommand); - - protected: - - void UpdateSelf(); - Boolean ObeyWindowCommand(Int16 inMenuID, Int16 inMenuItem); - void AddWindow(const CMediatedWindow* inWindow); - void RemoveWindow(const CMediatedWindow* inWindow); - - void SetMenuDirty(Boolean inDirty); - Boolean IsMenuDirty() const; - // Data: - public: - static CWindowMenu* sWindowMenu; - - protected: - - Int16 mLastNonDynamicItem; - Boolean mDirty; - - LArray mWindowList; - -}; - -inline void CWindowMenu::SetMenuDirty(Boolean inDirty) - { mDirty = inDirty; } - -inline Boolean CWindowMenu::IsMenuDirty() const - { return mDirty; } diff --git a/mozilla/cmd/macfe/gui/StSetBroadcasting.h b/mozilla/cmd/macfe/gui/StSetBroadcasting.h deleted file mode 100644 index 68a9c794890..00000000000 --- a/mozilla/cmd/macfe/gui/StSetBroadcasting.h +++ /dev/null @@ -1,51 +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. - */ - -// StSetBroadcasting - -#pragma once - -class StSetBroadcasting { - -public: - - StSetBroadcasting(LBroadcaster *inBroadcaster, Boolean inSetIsBroadcasting) { - Assert_(inBroadcaster != nil); - mBroadcaster = inBroadcaster; - mWasBroadcasting = inBroadcaster->IsBroadcasting(); - SetBroadcasting(inSetIsBroadcasting); - } - ~StSetBroadcasting(void) { - SetBroadcasting(mWasBroadcasting); - } - void SetBroadcasting(Boolean inSetIsBroadcasting) { - Boolean isBroadcasting = mBroadcaster->IsBroadcasting(); - if ( inSetIsBroadcasting && !isBroadcasting ) { - mBroadcaster->StartBroadcasting(); - } else if ( !inSetIsBroadcasting && isBroadcasting ) { - mBroadcaster->StopBroadcasting(); - } - } - -protected: - - // Instance variables ========================================================== - - Boolean mWasBroadcasting; - LBroadcaster *mBroadcaster; -}; diff --git a/mozilla/cmd/macfe/gui/UStClasses.cp b/mozilla/cmd/macfe/gui/UStClasses.cp deleted file mode 100644 index 295efbc881f..00000000000 --- a/mozilla/cmd/macfe/gui/UStClasses.cp +++ /dev/null @@ -1,105 +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. - */ - -// -// File: UStClasses.cp -// -// This file contains a couple of stack-based save/restore classes -// - -#include "UStClasses.h" - - -//====================================================================================== -#pragma mark * StSetResAttrs - -// -// Constructor. Set the resource handle attributes to the specified attributes. If -// inAddAttrs is true, add the specified attributes to the current attributes; otherwise -// reset the attributes completely. -// -StSetResAttrs::StSetResAttrs(Handle inResourceH, short inResAttrs, Boolean inAddAttrs) { - - Assert_(inResourceH != nil); - - mResourceH = nil; - - mSavedAttrs = ::GetResAttrs(inResourceH); - ThrowIfResError_(); - ::SetResAttrs(inResourceH, inAddAttrs ? (mSavedAttrs | inResAttrs) : inResAttrs); - ThrowIfResError_(); - mResourceH = inResourceH; -} - - -// -// Destructor -// -StSetResAttrs::~StSetResAttrs(void) { - - if ( mResourceH ) { - ::SetResAttrs(mResourceH, mSavedAttrs); - OSErr theErr = ::ResError(); - Assert_(theErr == noErr); - } -} - -//====================================================================================== -#pragma mark * StExcludeVisibleRgn - -// -// Constructor. -// -// Exclude the specified port rectangle from the current visible region. -// -StExcludeVisibleRgn::StExcludeVisibleRgn(LPane *inPane) { - - mGrafPtr = nil; - - Assert_(inPane != nil); - FailNIL_(mSaveVisRgn = ::NewRgn()); - - Rect portFrame; - GrafPtr port = inPane->GetMacPort(); - inPane->CalcPortFrameRect(portFrame); - StRegion tempRgn(portFrame); - ::CopyRgn(port->visRgn, mSaveVisRgn); - ::DiffRgn(port->visRgn, tempRgn, port->visRgn); - - mGrafPtr = port; - mSavePortOrigin = topLeft(mGrafPtr->portRect); -} - - -// -// Destructor. -// -StExcludeVisibleRgn::~StExcludeVisibleRgn(void) { - - if ( mGrafPtr != nil ) { - Point deltaOrigin = topLeft(mGrafPtr->portRect); - deltaOrigin.h -= mSavePortOrigin.h; - deltaOrigin.v -= mSavePortOrigin.v; - if ( (deltaOrigin.h != 0) || (deltaOrigin.v != 0) ) { - ::OffsetRgn(mSaveVisRgn, deltaOrigin.h, deltaOrigin.v); - } - RgnHandle tempRgn = mGrafPtr->visRgn; - mGrafPtr->visRgn = mSaveVisRgn; - ::DisposeRgn(tempRgn); - } -} diff --git a/mozilla/cmd/macfe/gui/UStClasses.h b/mozilla/cmd/macfe/gui/UStClasses.h deleted file mode 100644 index 1de81d56509..00000000000 --- a/mozilla/cmd/macfe/gui/UStClasses.h +++ /dev/null @@ -1,60 +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. - */ - -// -// File: UStClasses.h -// -// This file contains a couple of stack-based save/restore classes -// - -class LPane; - - -class StExcludeVisibleRgn { - -public: - - StExcludeVisibleRgn(LPane *inPane); - ~StExcludeVisibleRgn(void); - -private: - - GrafPtr mGrafPtr; - RgnHandle mSaveVisRgn; - Point mSavePortOrigin; -}; - - - -#pragma mark - - -class StSetResAttrs { - -public: - - enum { eAddAttrs = true, eDontAddAttrs = false }; - - StSetResAttrs(Handle inResourceH, short inResAttrs, - Boolean inAddAttrs = eDontAddAttrs); - ~StSetResAttrs(void); - -protected: - - Handle mResourceH; - short mSavedAttrs; -}; diff --git a/mozilla/cmd/macfe/gui/auto_HT_Pane.h b/mozilla/cmd/macfe/gui/auto_HT_Pane.h deleted file mode 100644 index 4942cfed6e0..00000000000 --- a/mozilla/cmd/macfe/gui/auto_HT_Pane.h +++ /dev/null @@ -1,169 +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. - */ - -// auto_HT_Pane.h - -#pragma once - -#include // for the definition of |auto_ptr| before specializing it -#include "htrdf.h" // for the definition of |HT_Pane| and the declaration of |HT_DeletePane| - - /* - Please note the usual admonition: An |auto_ptr| is a the owner of a given resource. - Certain syntactic liberties have been taken so that functions that return |auto_ptr|s - can yield ownership in expressions like this where a |const| temporary might otherwise - interfere - - auto_ptr create_X(); - auto_ptr x; - // ... - x = create_X(); - - The machinery that allows that assignment to succeed will make other, less desirable - assigments succeed as well. To avoid problems, remember this rule of thumb - - "If you don't intend to give away ownership, don't show them your |auto_ptr|." - - Give them a reference (e.g., |*x|), give them a pointer (e.g., |x.get()|), but don't - even think of giving them an |auto_ptr| or a reference to it, EVEN A CONST REFERENCE, - because you may end up yielding ownership. - - Additionally, when you write the equivalent of |create_X|, above, try to write to - facilitate the return-value optimization, e.g., - - auto_ptr - create_X() - { - return auto_ptr(new X) - } - */ - -class auto_ptr<_HT_PaneStruct> - /* - ...specializes |auto_ptr| template to deal with |HT_Pane| which is - really a |_HT_PaneStruct*|. This class should be transparent to anyone - who already knows how |auto_ptr| works, and already thinks of |HT_Pane| - as a pointer. - - This class implements the Nov '97 version of the C++ standard, but - will require some small modifications when member templates are fully supported. - */ - { - public: - - struct auto_ptr_ref - { - auto_ptr& p_; - - auto_ptr_ref( const auto_ptr& a ) - : p_( const_cast(a) ) - { - // nothing else to do - } - }; - - public: - typedef _HT_PaneStruct element_type; - - explicit - auto_ptr( HT_Pane P = 0 ) - : _pane(P) - { - // nothing else to do - } - - auto_ptr( auto_ptr& a ) - : _pane(a.release()) - { - // nothing else to do - } - - ~auto_ptr() - { - if ( _pane ) - HT_DeletePane(_pane); - } - - auto_ptr& - operator=( auto_ptr& a ) - { - reset(a.release()); - return *this; - } - - _HT_PaneStruct& - operator*() const - { - return *get(); - } - - HT_Pane - operator->() const - { - return get(); - } - - HT_Pane - get() const - { - return _pane; - } - - HT_Pane - release() - { - HT_Pane result = get(); - _pane = 0; - return result; - } - - void - reset( HT_Pane P = 0 ) - { - if ( get() != P ) - { - if ( _pane ) - HT_DeletePane(_pane); - _pane = P; - } - } - - auto_ptr( auto_ptr_ref r ) - : _pane(r.p_.release()) - { - // nothing else to do - } - - // not in the C++ standard (yet?), but needed for the same reason as the method above - auto_ptr& - operator=( auto_ptr_ref r ) - { - reset(r.p_.release()); - return *this; - } - - operator auto_ptr_ref() - { - return *this; - } - - private: - HT_Pane _pane; - }; - - diff --git a/mozilla/cmd/macfe/gui/cached.h b/mozilla/cmd/macfe/gui/cached.h deleted file mode 100644 index a81cba82044..00000000000 --- a/mozilla/cmd/macfe/gui/cached.h +++ /dev/null @@ -1,94 +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. - */ - - -#pragma once - -template -class cached - /* - ... - */ - { - public: - - cached() - : _cached_value_is_valid(false) - { - // nothing else to do - } - - explicit - cached( const T& initial_value_to_cache ) - : _cached_value (initial_value_to_cache), - _cached_value_is_valid(true) - { - // nothing else to do - } - - - - operator const T&() const - // ...(not explicit) so you can treat a cached as a T in _most_ cases. - { - return _cached_value; - } - - cached& - operator=( const T& value ) - // ...assigning a value into a cache means 'cache this value' - { - set_cached_value(value); - return *this; - } - - cached& - operator=( const cached& other ) - // ...otherwise assignment might make a valid copy of an invalid cache. - { - if ( (_cached_value_is_valid = other._cached_value_is_valid) == true ) - _cached_value = other._cached_value; - return *this; - } - - - bool - is_valid() const - { - return _cached_value_is_valid; - } - - void - invalidate() - { - _cached_value_is_valid = false; - } - - protected: - - void - set_cached_value( const T& value ) - { - _cached_value = value; - _cached_value_is_valid = true; - } - - private: - T _cached_value; - bool _cached_value_is_valid; - }; diff --git a/mozilla/cmd/macfe/gui/macgui.cp b/mozilla/cmd/macfe/gui/macgui.cp deleted file mode 100644 index 640c0ce267e..00000000000 --- a/mozilla/cmd/macfe/gui/macgui.cp +++ /dev/null @@ -1,854 +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. - */ - -// StPrepareForDialog - - // macfe -#include "macgui.h" -#include "uprefd.h" -#include "resgui.h" -#include "mimages.h" -#include "uerrmgr.h" -#include "macutil.h" - - // Netscape -#include "client.h" -#include "ntypes.h" -#include "shist.h" -#include "glhist.h" -#include "lo_ele.h" -#include "mkutils.h" -#include "prefapi.h" - - // PowerPlant -#include - // system - -#include - -#ifdef PROFILE -#pragma profile on -#endif - -void DrawArc( const RGBColor& initColor, const Rect& box, Boolean inset ); - -// ¥¥ StPrepareForDialog - -StPrepareForDialog::StPrepareForDialog() -{ - ErrorManager::PrepareToInteract(); - UDesktop::Deactivate(); -} - -StPrepareForDialog::~StPrepareForDialog() -{ - UDesktop::Activate(); -} - - -// class StTempClipRgn -RgnHandle StTempClipRgn::sOldClip = NULL; -RgnHandle StTempClipRgn::sMergedNewClip = NULL; - -StTempClipRgn::StTempClipRgn (RgnHandle newClip) -{ - if (sOldClip == NULL) sOldClip = ::NewRgn(); - if (sMergedNewClip == NULL) sMergedNewClip = ::NewRgn(); - - ::GetClip(sOldClip); - ::SectRgn(sOldClip, newClip, sMergedNewClip); - ::SetClip(sMergedNewClip); -} - -StTempClipRgn::~StTempClipRgn() -{ - ::SetClip(sOldClip); -} - - -// class HyperStyle -extern Boolean gIsPrinting; - -/* -HyperStyle::HyperStyle( HyperStyle* style ) -{ - memcpy( this, style, sizeof( HyperStyle ) ); // Just copy the fields -} -*/ - -HyperStyle::HyperStyle( MWContext *context, const CCharSet* charSet, LO_TextAttr* attr, Boolean onlyMeasuring, - LO_TextStruct* element ) -{ - fElement = element; - - fAttr = *attr; - fAttr.size *= context->fontScalingPercentage; - - // GetFontReference() stashes font info into fAttr->FE_Data so we need to make sure that - // we propogate that info to the attribute struct that is going back to layout. - fFontReference = CFontReference::GetFontReference(charSet, &fAttr, context, sUnderlineLinks); - attr->FE_Data = fAttr.FE_Data; - - strike = ( attr->attrmask & LO_ATTR_STRIKEOUT ); - fInlineInput = ( attr->attrmask & ( LO_ATTR_INLINEINPUT | LO_ATTR_INLINEINPUTTHICK | LO_ATTR_INLINEINPUTDOTTED ) ); - fOnlyMeasuring = onlyMeasuring; - - if ( !fOnlyMeasuring ) - { - rgbFgColor = UGraphics::MakeRGBColor( attr->fg.red, attr->fg.green, attr->fg.blue ); - rgbBkColor = UGraphics::MakeRGBColor( attr->bg.red, attr->bg.green, attr->bg.blue ); - } - -} - -// ¥ calculate a rectangular area of the page based on "where" and the -// length of "text", using this style's font information; note that if -// we have a reference element, we use the line height given by layout, -// otherwise we figure out a line height using the text metrics -Rect HyperStyle::InvalBackground( Point where, char* text, int start, int end, Boolean blinks ) -{ - int usedText; - int unusedText; - Rect hiliteArea; - - int length; - - Apply(); - GetFontInfo(); - - length = end - start + 1; - - usedText = fFontReference->TextWidth(text, start, length); - unusedText = start ? fFontReference->TextWidth(text, 0, start) : 0; - if ( !fElement || !fElement->line_height ) - { - hiliteArea.top = where.v; - hiliteArea.left = where.h + unusedText; - hiliteArea.bottom = hiliteArea.top + fFontInfo.ascent + fFontInfo.descent; - hiliteArea.right = hiliteArea.left + usedText; - } - else - { - hiliteArea.top = where.v - fElement->y_offset; - hiliteArea.left = where.h + unusedText; - hiliteArea.bottom = hiliteArea.top + fElement->line_height; - hiliteArea.right = hiliteArea.left + usedText; - - if ( blinks || - ( fAttr.fontmask & LO_FONT_ITALIC ) ) - { - hiliteArea.right += ( fFontInfo.widMax / 2 ); - hiliteArea.left -= MIN( 2, ( fFontInfo.widMax / 8 ) ); - } - } - - return hiliteArea; -} - - -void HyperStyle::DrawText( Point where, - char* text, - int start, - int end ) -{ - Boolean selected; - Boolean swapped = FALSE; - int length = end - start + 1; - - Assert_( fElement ); - - selected = ( ( fElement->ele_attrmask & LO_ELE_SELECTED ) != 0 && - fElement->sel_start <= start && - end <= fElement->sel_end ); - - Boolean paint_background = selected || !fAttr.no_background; - - fFontReference->SetMode( paint_background ? srcCopy : srcOr ); - - // ¥ stupid layout reverses bk / fg colors when it tries to draw selected - // put the actual fg color back in fg, and put the user's hilite color - // into bk - // ¥ selection takes precedence over blink - if ( selected ) - { - // ¥ put the colors back and check to make sure that highlighting - // will actually show up - rgbFgColor = rgbBkColor; - LMGetHiliteRGB( &rgbBkColor ); - if ( UGraphics::EqualColor( rgbFgColor, rgbBkColor ) ) - { - swapped = TRUE; - rgbFgColor.red = ~rgbBkColor.red; - rgbFgColor.green = ~rgbBkColor.green; - rgbFgColor.blue = ~rgbBkColor.blue; - } - } - - Apply(); - GetFontInfo(); - - long unusedText = start ? fFontReference->TextWidth(text, 0, start) : 0; - int x = where.h + unusedText; - int y = where.v + fFontInfo.ascent; - - fFontReference->DrawText(x, y, text, start, end ); - - if ( paint_background ) - { - short fontHeight = fFontInfo.ascent + fFontInfo.descent + fFontInfo.leading; - - if ( !fElement ) - return; - - // ¥Êif the font height is less than the element's line height, - // there will be rectangular areas above and below the text - // that are not drawn with the selection highlighting - // we draw them here - if ( fontHeight < fElement->line_height ) - { - long usedText = fFontReference->TextWidth(text, start, length); - Rect hiliteArea; - - hiliteArea.top = where.v - fElement->y_offset; - hiliteArea.left = where.h + unusedText; - hiliteArea.right = hiliteArea.left + usedText; - hiliteArea.bottom = where.v; - - ::EraseRect( &hiliteArea ); - - hiliteArea.bottom = hiliteArea.top + fElement->line_height; - hiliteArea.top += ( fFontInfo.ascent + fFontInfo.descent + fElement->y_offset ); - ::EraseRect( &hiliteArea ); - } - } - -/* - // ¥Êspecial case for selected italics -// FIX ME! Don't forget about this when we redo printing -// if ( !gIsPrinting && ( (fStyle & italic) != 0 ) ) - if ( (fAttr.fontmask & LO_FONT_ITALIC) != 0 ) - { - if ( swapped ) - ::RGBForeColor( &rgbBkColor ); - - // **** should this use fFontReference->SetMode? - ::TextMode( srcOr ); - fFontReference->DrawText(where.h, where.v + fFontInfo.ascent, text, 0, fElement->text_len ); - } -*/ - - Boolean isMisspelled = (fAttr.attrmask & LO_ATTR_SPELL) != 0; - if ( strike || isMisspelled ) - { - // I have consciously decided that if a word is misspelled and - // striked that it is preferable to not strike and just mark - // for misspelling; this may not be the correct decision. [brade] - long usedText = fFontReference->TextWidth(text, start, length); - short vstrike; - - if ( isMisspelled ) - { - // for misspelled words we want a dashed underline - PenPat( &qd.gray ); - vstrike = -( fFontInfo.descent - 1 ); - } - else - vstrike = ( fFontInfo.ascent / 2 ) - 1; - - ::Move( -usedText, -vstrike ); - ::Line( usedText, 0 ); - - // restore things... - ::Move( 0, vstrike ); - - if ( isMisspelled ) - PenPat( &qd.black ); - } - - if ( fInlineInput ) - { - long usedText = fFontReference->TextWidth( text, start, length ); - short vInline = fFontInfo.descent; - - if ( fInlineInput & LO_ATTR_INLINEINPUTTHICK ) { - - PenSize( 1, 2); - vInline -= 2; - - } else { - - PenSize( 1, 1); - vInline -= 1; - - } - - if ( fInlineInput & LO_ATTR_INLINEINPUTDOTTED ) - PenPat( &UQDGlobals::GetQDGlobals()->gray); - else - PenPat( &UQDGlobals::GetQDGlobals()->black); - - - ::Move( -usedText, vInline ); - ::Line( usedText, 0 ); - - // restore things... - ::Move( 0, -vInline ); - PenSize( 1, 1); - PenPat( &UQDGlobals::GetQDGlobals()->black); - - } -} - -const char* sUnderlineLinksPref = "browser.underline_anchors"; -Boolean HyperStyle::sUnderlineLinks = true; -XP_HashTable HyperStyle::sFontHash = NULL; - -void HyperStyle::InitHyperStyle() -{ -#if 0 - if ( !sFontHash ) - { - // the table size be: 2 fonts * 7 styles (bold, italic underline combos) * - // 10 for safety (multiple languages) - sFontHash = XP_HashTableNew( 140, StyleHash, StyleCompFunction ); - } -#endif - - PREF_RegisterCallback(sUnderlineLinksPref, SetUnderlineLinks, nil); - SetUnderlineLinks(sUnderlineLinksPref, nil); - - CWebFontReference::Init(); -} - -void HyperStyle::FinishHyperStyle() -{ - CWebFontReference::Finish(); -} - -int HyperStyle::SetUnderlineLinks(const char * /*newpref*/, void * /*stuff*/) -{ - XP_Bool value; - PREF_GetBoolPref(sUnderlineLinksPref, &value); - sUnderlineLinks = value; - return 0; -} - -/* -// Hash it. -// Time critical -uint32 HyperStyle::StyleHash( const void* style ) -{ - return (( ((HyperStyle*)style)->fFont << 1 ) + - ((HyperStyle*)style)->fSize ); -} - -// Compare two hyperstyles -// time critical routine -// should function like strcmp -int HyperStyle::StyleCompFunction( const void* style1, const void* style2 ) -{ - Boolean equal = ( style1 && - style2 && - (((HyperStyle*)style1)->fFont == ((HyperStyle*)style2)->fFont) && - (((HyperStyle*)style1)->fSize == ((HyperStyle*)style2)->fSize) ); - - if ( equal ) - return 0; - else if ( !style1 ) - return -1; - else if ( !style2 ) - return 1; - else if ( - (((HyperStyle*)style1)->fFont + ((HyperStyle*)style1)->fSize) > - (((HyperStyle*)style2)->fFont + ((HyperStyle*)style2)->fSize) ) - return -1; - else - return 1; -} -*/ - -void HyperStyle::GetFontInfo() -{ -/* - HyperStyle* hashStyle = (HyperStyle*)XP_Gethash( sFontHash, this, NULL ); - if ( !hashStyle ) - { - fFontReference->GetFontInfo(&fFontInfo); - - hashStyle = new HyperStyle(this); - XP_Puthash(sFontHash, hashStyle, hashStyle); - } - else - fFontInfo = hashStyle->fFontInfo; -*/ - fFontReference->GetFontInfo(&fFontInfo); -} - -// TextWidth Dispatch routine -short HyperStyle::TextWidth(char* text, int firstByte, int byteCount ) -{ - return fFontReference->TextWidth(text, firstByte, byteCount); -} - -/*----------------------------------------------------------------------------- -UGraphics is full of little graphics utilities -Original version by atotic -mark messed it up ------------------------------------------------------------------------------*/ - -void UGraphics::Initialize() -{ -} - -void UGraphics::SetFore( CPrefs::PrefEnum r ) -{ - UGraphics::SetIfColor( CPrefs::GetColor( r ) ); -} - -void UGraphics::SetBack( CPrefs::PrefEnum r ) -{ - UGraphics::SetIfBkColor( CPrefs::GetColor( r ) ); -} - -void UGraphics::VertLine( int x, int top, int height, CPrefs::PrefEnum r ) -{ - UGraphics::SetFore( r ); - MoveTo( x, top ); - LineTo( x, top + height - 1 ); -} - -void UGraphics::HorizLineAtWidth (int vertical, int left, int width, CPrefs::PrefEnum r) -{ - UGraphics::SetFore (r); - MoveTo (left, vertical); - LineTo (left + width - 1, vertical); -} - - -// Draws a diagonal to the rectangle -void UGraphics::DrawLine( int16 top, int16 left, int16 bottom, int16 right, CPrefs::PrefEnum color ) -{ - UGraphics::SetFore( color ); - MoveTo( left, top ); - LineTo( right, bottom ); -} - -CGrafPtr UGraphics::IsColorPort( GrafPtr port ) -{ - Assert_( port ); - return ((((CGrafPtr)port)->portVersion) & 0xC000) == 0xC000? (CGrafPtr) port: nil; -} - -// -// Important Note! -// If you are going to muck with the colors of a window, be sure to give it -// a custom wctb resource! Otherwise the window will be created with a pointer -// to the SYSTEMWIDE global AuxRec and you'll change EVERYTHING. -// - -void -UGraphics::SetWindowColor( GrafPort* window, short field, const RGBColor& color ) -{ - if ( !UEnvironment::HasFeature( env_SupportsColor ) ) - return; - - // Get window's auxilary record. Skip on failure - AuxWinHandle aux = NULL; - AuxWinHandle def = NULL; - - CTabHandle awCTable = NULL; - Boolean foundFieldInTable = FALSE; - Boolean hasAuxWinRec = FALSE; - Boolean isDefault = FALSE; - - Assert_( window ); - if ( !window ) - return; - - hasAuxWinRec = ::GetAuxWin( window, &aux ); - ::GetAuxWin( NULL, &def ); - isDefault = (*aux)->awCTable == (*def)->awCTable; - - if ( isDefault || !hasAuxWinRec || !aux ) - { - //XP_TRACE(("UGraphics::SetWindowColor (%p) -> nil", window)); - return; - } - - // Get the color table - // Find the fore/background colors, and set them to the unified scheme - awCTable = (*aux)->awCTable; - - for ( unsigned long i = 0; i <= (*awCTable)->ctSize; i++ ) - { - if ( (*awCTable)->ctTable[ i ].value == field ) - { - foundFieldInTable = true; - if ( UGraphics::EqualColor( (*awCTable)->ctTable[ i ].rgb, color ) ) - return; - - (*awCTable)->ctTable[ i ].rgb = color; - CTabChanged( awCTable ); - } - } - Assert_( foundFieldInTable ); -} - -void UGraphics::SetWindowColors (LWindow *window) -{ - SetWindowColor (window->GetMacPort(), wContentColor, CPrefs::GetColor(CPrefs::WindowBkgnd)); -} - -void UGraphics::FrameRectMotif (const Rect& box, Boolean inset) -{ - RGBColor lighter = {65535,65535,65535}, darker = {0,0,0}; - FrameRectBevel(box, inset, lighter, darker); -} - - -void UGraphics::FrameRectSubtle (const Rect& box, Boolean inset) -{ - RGBColor lighter = {60000,60000,60000}, darker = {20000,20000,20000}; - FrameRectBevel(box, inset, lighter, darker); -} - -void UGraphics::FrameRectBevel (const Rect& box, Boolean inset, const RGBColor &lighter, - const RGBColor &darker ) -{ - ::PenSize(1,1); - if (inset) UGraphics::SetIfColor (darker); - else UGraphics::SetIfColor (lighter); - MoveTo (box.left, box.top); - LineTo (box.right-1, box.top); - MoveTo (box.left, box.top); - LineTo (box.left, box.bottom-1); - - if (inset) UGraphics::SetIfColor (lighter); - else UGraphics::SetIfColor (darker); - MoveTo (box.right-1, box.bottom-1); - LineTo (box.right-1, box.top+1); - MoveTo (box.right-1, box.bottom-1); - LineTo (box.left+1, box.bottom-1); -} - -void UGraphics::FrameRectShaded (const Rect& box, Boolean inset) -{ - RGBColor addOn = {20000, 20000, 20000}; - RGBColor lighter = {60000,60000,60000}, darker = {0,0,0}; - // subPin substracts value, makes color darker - // addPin adds value, makes color lighter - SetIfColor(addOn); - if (inset) - { - OpColor(&darker); - PenMode(subPin); - } - else - { - OpColor(&lighter); - PenMode(addPin); - } - MoveTo (box.left, box.top); - LineTo (box.right-1, box.top); - MoveTo (box.left, box.top); - LineTo (box.left, box.bottom-1); - - if (inset) - { - OpColor(&lighter); - PenMode(addPin); - } - else - { - OpColor(&darker); - PenMode(subPin); - } - MoveTo (box.right-1, box.bottom-1); - LineTo (box.right-1, box.top+1); - MoveTo (box.right-2, box.bottom-1); - LineTo (box.left+1, box.bottom-1); - PenMode(srcCopy); -} - -void DrawArc( const RGBColor& initColor, const Rect& box, Boolean inset ) -{ - RGBColor lighter = {60000,60000,60000}, darker = {0,0,0}; - - UGraphics::SetIfColor( initColor ); - if ( inset ) - { - OpColor( &darker ); - PenMode( subPin ); - } - else - { - OpColor( &lighter ); - PenMode( addPin ); - } - FrameArc( &box, 225, 180 ); - if ( inset ) - { - OpColor( &lighter ); - PenMode( addPin ); - } - else - { - OpColor( &darker ); - PenMode( subPin ); - } - FrameArc( &box, 45, 180 ); -} - -void UGraphics::FrameCircleShaded( const Rect& box, Boolean inset ) -{ - RGBColor first = { 20000, 20000, 20000 }; - RGBColor second = { 30000, 30000, 30000 }; - // subPin substracts value, makes color darker - // addPin adds value, makes color lighter - DrawArc( first, box, inset ); - Rect tempRect = box; // box is CONST! - InsetRect( &tempRect, -1, -1 ); - DrawArc( second, tempRect, inset ); - PenMode( srcCopy ); -} - -void ArithHighlight( const Rect& box, const RGBColor& curr ); -void ArithHighlight( const Rect& box, const RGBColor& curr ) -{ - RGBColor tmp = curr; - - tmp.red = ~tmp.red; - tmp.green = ~tmp.green; - tmp.blue = ~tmp.blue; - - RGBColor darker = { 0, 0, 0}; - RGBColor addOn = { 30000, 30000, 30000 }; - - UGraphics::SetIfColor( addOn ); - OpColor( &tmp ); - - PenMode( addPin ); - PenPat( &UQDGlobals::GetQDGlobals()->black ); - ::PaintRect( &box ); - PenMode( patCopy ); -} - -void UGraphics::FrameTopLeftShaded( const Rect& box, short width, const RGBColor& curr ) -{ - Rect l; - l.top = box.top; - l.left = box.left; - l.right = box.right; - l.bottom = box.top + width; - ArithHighlight( l, curr ); - l.top += width; - l.right = l.left + width; - l.bottom = box.bottom; - ArithHighlight( l, curr ); -} - -void UGraphics::FrameEraseRect( const Rect& box, short width, Boolean focussed ) -{ - Rect lineRect; - - // top left -> top right - lineRect.top = box.top; - lineRect.left = box.left; - lineRect.bottom = lineRect.top + width; - lineRect.right = box.right; - - ::EraseRect( &lineRect ); - if ( focussed ) - DarkenRect( lineRect ); - - // bottom left -> bottom right - lineRect.top = box.bottom - width; - lineRect.bottom = box.bottom; - ::EraseRect( &lineRect ); - if ( focussed ) - DarkenRect( lineRect ); - - // top left -> bottom left - lineRect.top = box.top; - lineRect.left = box.left; - lineRect.bottom = box.bottom; - lineRect.right = lineRect.left + width; - ::EraseRect( &lineRect ); - if ( focussed ) - DarkenRect( lineRect ); - - // top right -> bottom right - lineRect.left = box.right - width; - lineRect.right = box.right; - ::EraseRect( &lineRect ); - if ( focussed ) - DarkenRect( lineRect ); -} - -void UGraphics::DarkenRect( const Rect& box ) -{ - RGBColor darker = { 0, 0, 0}; - RGBColor addOn = { 10000, 10000, 10000 }; - SetIfColor( addOn ); - OpColor( &darker ); - PenMode( subPin ); - PenPat( &UQDGlobals::GetQDGlobals()->black ); - ::PaintRect( &box ); - PenMode( patCopy ); -} - -Boolean UGraphics::PointInBigRect(SPoint32 rectLoc, SDimension16 rectSize, SPoint32 loc) -{ - return ((loc.v > rectLoc.v) && - (loc.v < (rectLoc.v + rectSize.height)) && - (loc.h > rectLoc.h) && - (loc.h < (rectLoc.h + rectSize.width))); -} - - - -RgnHandle UGraphics::sTempRegions[] = { NULL, NULL, NULL, NULL, NULL }; -Boolean UGraphics::sRegionsUsed[] = { false, false, false, false, false }; - -// -// Get a temporary region from our cache (array, actually) of -// allocated regions, if possible. A parallel array of booleans -// indicates which regions are in use; if all are unavailable, -// just allocate a new one. Call ReleaseTempRegion() when youÕre -// done using the region. -// -RgnHandle UGraphics::GetTempRegion() -{ - for (short i = 0; i < kRegionCacheSize; i++) - { - if (sRegionsUsed[i] == false) - { - sRegionsUsed[i] = true; - if (sTempRegions[i] == NULL) - sTempRegions[i] = ::NewRgn(); - return sTempRegions[i]; - - } - } - - return (::NewRgn()); -} - -// -// Release a temporary region returned from GetTempRegion(). -// We call SetEmptyRgn() here to save some memory, and because -// when the region is reused in GetTempRegion the caller will -// expect the ÒnewÓ region to be empty. If the region wasnÕt -// found in the cache array, then it must have been freshly -// allocated by GetTempRegion because all cached regions were -// in use at the time, so just dispose of the region. -// -void UGraphics::ReleaseTempRegion(RgnHandle rgn) -{ - for (short i = 0; i < kRegionCacheSize; i++) - { - if (sTempRegions[i] == rgn) - { - sRegionsUsed[i] = false; - SetEmptyRgn(rgn); - return; - } - } - - ::DisposeRgn(rgn); -} - - -/***************************************************************************** - * class CEditBroadcaster - * LEditField that notifies listeners about its changes - *****************************************************************************/ - -CEditBroadcaster::CEditBroadcaster(LStream *inStream) - : CTSMEditField(inStream) -{ -} - -void CEditBroadcaster::UserChangedText() -{ - BroadcastMessage(msg_EditField, this); -} - -/***************************************************************************** - * class CGAEditBroadcaster - * LGAEditField that notifies listeners about its changes - *****************************************************************************/ - -CGAEditBroadcaster::CGAEditBroadcaster(LStream *inStream) - : LGAEditField(inStream) -{ -} - -void CGAEditBroadcaster::UserChangedText() -{ - BroadcastMessage(msg_EditField, this); -} - -void -CGAEditBroadcaster::BroadcastValueMessage() -{ - BroadcastMessage(msg_EditField, this); -} - -/***************************************************************************** - * class CTextEdit - * LTextEdit that keeps track if it has been modified - *****************************************************************************/ - -CTextEdit::CTextEdit(LStream *inStream) : LTextEditView(inStream) -{ - fModified = FALSE; -} - -void CTextEdit::UserChangedText() -{ - fModified = TRUE; - LTextEditView::UserChangedText(); -} - -/***************************************************************************** - * class CResPicture - * LPicture with an associated resfile ID - *****************************************************************************/ -CResPicture::CResPicture(LStream *inStream) - : LPicture(inStream) -{ - mResFileID = -1; -} - -void CResPicture::DrawSelf() -{ - Int16 resfile = ::CurResFile(); - if (mResFileID != -1) - ::UseResFile(mResFileID); - - LPicture::DrawSelf(); - - ::UseResFile(resfile); -} - - -#ifdef PROFILE -#pragma profile off -#endif - diff --git a/mozilla/cmd/macfe/gui/macgui.h b/mozilla/cmd/macfe/gui/macgui.h deleted file mode 100644 index 452ba121637..00000000000 --- a/mozilla/cmd/macfe/gui/macgui.h +++ /dev/null @@ -1,340 +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. - */ - -#pragma once -/* - GUI Library - Classes for customizing the GUI of a program. There are subclasses of - various PowerPlant classes in lieu of a more dynamic mechanism - CS - Color Scheme Library -*/ -#include -#include -#include "CFontReference.h" -//#include "VEditField.h" -#include "CTSMEditField.h" -#include "uprefd.h" -#include "xp_hash.h" -#include "lo_ele.h" -#include - -typedef struct LO_TextAttr_struct LO_TextAttr; - -/******************************************************************************* - * StPrepareForDialog is a simple class that ensures application is in the - * foreground, and desktop deactivated. - * Insert into functions that will open Toolbox dialog boxes. - * Used only for side-effects - *******************************************************************************/ -class StPrepareForDialog -{ -public: - StPrepareForDialog(); - ~StPrepareForDialog(); -}; - - -/*----------------------------------------------------------------------------- - UGraphics is full of little graphics utilities ------------------------------------------------------------------------------*/ -class UGraphics -{ -public: - - // Note, the numbering of these enums is reflected in pref.r - // Be sure to reflect changes there as well - static void Initialize(); - - static const RGBColor& Get( CPrefs::PrefEnum r ); - static void SetFore( CPrefs::PrefEnum r ); - static void SetBack( CPrefs::PrefEnum r ); - static inline void SetIfColor( const RGBColor& color ); // Use instead of RGBForeColor - static inline void SetIfBkColor( const RGBColor& color ); // Use instead of RGBBackColor -- optimized - static inline Boolean EqualColor( const RGBColor& c1, const RGBColor& c2 ); - static inline RGBColor MakeRGBColor( UInt8 red, UInt8 green, UInt8 blue ); - static inline RGBColor MakeRGBColor( LO_Color color ); - static inline LO_Color MakeLOColor(const RGBColor& color); - static void VertLine( int x, int top, int height, CPrefs::PrefEnum r ); - static void HorizLineAtWidth( int vertical, int left, int width, - CPrefs::PrefEnum r ); - static CGrafPtr IsColorPort( GrafPtr port ); // TRUE if GrafPtr is a color port - static void SetWindowColors( LWindow *window ); -#if TARGET_CARBON - static void SetWindowColor( GrafPtr *window, short field, const RGBColor& color ); -#else - static void SetWindowColor( GrafPort *window, short field, const RGBColor& color ); -#endif - - static void DrawLine( Int16 top, Int16 left, Int16 bottom, Int16 right, - CPrefs::PrefEnum color ); - static void FrameRectMotif( const Rect& box, Boolean inset ); - static void FrameRectSubtle (const Rect& box, Boolean inset); - static void FrameRectBevel (const Rect& box, Boolean inset, const RGBColor &lighter, const RGBColor &darker ); - static void FrameTopLeftShaded( const Rect& box, short width, const RGBColor& curr ); - static void FrameRectShaded( const Rect& box, Boolean inset ); - static void FrameEraseRect(const Rect& box, short width, Boolean focussed); // Erases rect in background patterns - static void DarkenRect(const Rect & box); - // Used in pane calculations - static Boolean PointInBigRect( SPoint32 rectLoc, SDimension16 rectSize, SPoint32 loc ); - static void FrameCircleShaded( const Rect& box, Boolean inset ); - - static RgnHandle GetTempRegion(); // Get a region for a while - static void ReleaseTempRegion(RgnHandle rgn); // Return the region to the pile - -private: - enum { kRegionCacheSize = 5 }; // If you change this constant, change the static array initializer in macgui.c! - static RgnHandle sTempRegions[kRegionCacheSize]; // Cached regions for use by UGraphics:GetTempRegion - static Boolean sRegionsUsed[kRegionCacheSize]; // Which cached regions are in use? -}; - -inline Boolean UGraphics::EqualColor( const RGBColor& c1, const RGBColor& c2 ) -{ - return ((c1.red == c2.red) && (c1.green == c2.green) && (c1.blue == c2.blue)); -} - -inline void UGraphics::SetIfColor( const RGBColor& newColor ) -{ -#if TARGET_CARBON - RGBColor currentColor; - ::GetPortForeColor((CGrafPtr)qd.thePort, ¤tColor); -#else - RGBColor currentColor = ((CGrafPtr)qd.thePort)->rgbFgColor; -#endif // TARGET_CARBON - - if ( !EqualColor( currentColor, newColor ) ) - ::RGBForeColor( &newColor ); -} - -inline void UGraphics::SetIfBkColor( const RGBColor& newColor ) -{ - CGrafPtr cgp = (CGrafPtr)qd.thePort; -#if TARGET_CARBON - RGBColor currentColor; - ::GetPortBackColor(cgp, ¤tColor); -#else - RGBColor currentColor = ((CGrafPtr)qd.thePort)->rgbBkColor; -#endif // TARGET_CARBON - if ( !EqualColor( currentColor, newColor ) ) - ::RGBBackColor( &newColor ); -} - -inline RGBColor UGraphics::MakeRGBColor( UInt8 red, UInt8 green, UInt8 blue ) -{ - RGBColor temp; - temp.red = (red == 255 ? 65535 : (((unsigned short)red) << 8)); - temp.green = (green == 255 ? 65535 : (((unsigned short)green) << 8)); - temp.blue = (blue == 255 ? 65535 : (((unsigned short)blue) << 8)); - return temp; -} - -inline RGBColor UGraphics::MakeRGBColor( LO_Color color ) -{ - RGBColor temp; - temp.red = (color.red == 255 ? 65535 : (((unsigned short)color.red) << 8)); - temp.green = (color.green == 255 ? 65535 : (((unsigned short)color.green) << 8)); - temp.blue = (color.blue == 255 ? 65535 : (((unsigned short)color.blue) << 8)); - return temp; -} - -inline LO_Color UGraphics::MakeLOColor(const RGBColor& color ) -{ - LO_Color temp; - temp.red = (((unsigned short)color.red) >> 8); - temp.green = (((unsigned short)color.green) >> 8); - temp.blue = (((unsigned short)color.blue) >> 8); - return temp; -} - - -/*----------------------------------------------------------------------------- - HyperStyle is a Mac-oriented style sheet. It is produced once we've - done all the mapping from HTML. It keeps things in native format, so - even though Color comes from a restricted set, it's in here as RGB, - and Strikethrough, logically a style, is kept out of the style field. - The goal is to make setting text attributes fast. Creating them can - be done via a caching table. ------------------------------------------------------------------------------*/ -class HyperStyle -{ -public: - static void InitHyperStyle(); - static void FinishHyperStyle(); -/* - HyperStyle( HyperStyle * s ); -*/ - HyperStyle( MWContext *context, - const CCharSet* charSet, - LO_TextAttr* attr, - Boolean onlyMeasuring = FALSE, - LO_TextStruct* element = NULL ); -/* - ~HyperStyle() { if (fFontReference) delete fFontReference; } -*/ - - Rect InvalBackground( Point where, char* text, - int start, - int end, Boolean blinks ); - - inline void Apply(); - void GetFontInfo(); - - // draw text using these attributes - void DrawText( Point where, - char* text, - int start, - int end ); - - short TextWidth( char* text, - int firstByte, - int byteCount); - - // Actual style elements - CFontReference *fFontReference; - RGBColor rgbFgColor; - RGBColor rgbBkColor; - Boolean strike; - Int32 fInlineInput; - LO_TextStruct* fElement; - Boolean fOnlyMeasuring; - -// Font info hashing stuff - FontInfo fFontInfo; -private: - LO_TextAttr fAttr; - - // save/restore the pen and text state to be a good neighbor - StColorPenState fSavedPen; - StTextState fSavedText; - - static XP_HashTable sFontHash; - static Boolean sUnderlineLinks; - static int SetUnderlineLinks(const char * newpref, void * stuff); - static uint32 StyleHash( const void* hyperStyle ); - static int StyleCompFunction( const void* style1, const void* style2 ); -}; - -inline void HyperStyle::Apply() -{ - fFontReference->Apply(); - UGraphics::SetIfColor( rgbFgColor ); - UGraphics::SetIfBkColor( rgbBkColor ); -} - - - -/***************************************************************************** - * class CCoolBackground - * Sets up the background color for drawing chrome in the main window - * It is either gray, or utility pattern, depending upon your preferences - ****************************************************************************/ -class CCoolBackground -{ -private: - static PixPatHandle sPixPat; - PixPatHandle fOldPixPat; -public: - CCoolBackground(); - virtual ~CCoolBackground(); -}; - -const MessageT msg_EditField = 2002; // Edit field has been modified - -/***************************************************************************** - * class CEditBroadcaster - * CTSMEditField that notifies listeners about its changes - *****************************************************************************/ -class CEditBroadcaster : public CTSMEditField, public LBroadcaster -{ -public: - - // ¥¥ Constructors/destructors - enum { class_ID = 'ebro' }; - CEditBroadcaster(LStream *inStream); - - // ¥¥ Misc - // Broadcast - void UserChangedText(); -}; - -/***************************************************************************** - * class CGAEditBroadcaster - * LGAEditField that notifies listeners about its changes - *****************************************************************************/ -class CGAEditBroadcaster : public LGAEditField -{ -public: - - // ¥¥ Constructors/destructors - enum { class_ID = 'Gebr' }; - CGAEditBroadcaster(LStream *inStream); - - // ¥¥ Misc - // Broadcast - void BroadcastValueMessage(); - void UserChangedText(); -}; - -/***************************************************************************** - * class CTextEdit - * LTextEdit, keeps track if it has been modified - *****************************************************************************/ -class CTextEdit : public LTextEditView, public LBroadcaster -{ - Boolean fModified; // Has user modified this field -public: - - // ¥¥ Constructors/destructors - enum { class_ID = 'etxt' }; - CTextEdit(LStream *inStream); - - // ¥¥ Misc - Boolean IsModified(){return fModified;}; - virtual void UserChangedText(); -}; - -/***************************************************************************** - * class CResPicture - * LPicture with an associated resfile ID - *****************************************************************************/ -class CResPicture : public LPicture -{ -public: - enum { class_ID = 'rpic' }; - CResPicture(LStream *inStream); - - virtual void DrawSelf(); - void SetResFileID(short id) { mResFileID = id; }; - -private: - Int16 mResFileID; -}; - -/****************************************************************************** - * class StTempClipRgn - * creates a temporary clip region. Old region is restored on exit - * CANNOT BE NESTED - *****************************************************************************/ -class StTempClipRgn -{ - static RgnHandle sOldClip; // Saved clip - static RgnHandle sMergedNewClip; // New clip regions -public: - StTempClipRgn (RgnHandle newClip); - ~StTempClipRgn(); -}; diff --git a/mozilla/cmd/macfe/gui/macutil.cp b/mozilla/cmd/macfe/gui/macutil.cp deleted file mode 100644 index 29854fed371..00000000000 --- a/mozilla/cmd/macfe/gui/macutil.cp +++ /dev/null @@ -1,2031 +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. - */ - -/*********************************************************************************** - * macutil.cp - * - * Various mac utility routines - * - ***********************************************************************************/ - -#include - -#include -#include -#include -//#include -#include "macutil.h" -#include "resgui.h" -#include "uprefd.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "xp.h" -#include "cstring.h" -#include "xpassert.h" -#include "xp_trace.h" -#include "macgui.h" -#include "prefapi.h" -#include "MoreDesktopMgr.h" -extern "C" { - #include "asyncCursors.h" -} - -#ifndef MOZ_NGLAYOUT -#include "CSimpleTextView.h" -#endif - -#include "mfinder.h" // needed for workaround function to bug in Apple's - // ::TruncText and ::TruncString - andrewb 6/20/97 - -#include "MoreMixedMode.h" -#include "PascalString.h" - -/*----------------------------------------------------------------------------- - Layout Utilities ------------------------------------------------------------------------------*/ - -// Another mlanett special -static void GetImageRect( LView* view, SPoint32* topLeft, SPoint32* botRight ); -static void GetImageRect( LView* view, SPoint32* topLeft, SPoint32* botRight ) -{ -/* - Return the visible image of this view. -*/ - SPoint32 frameLocation; - SDimension16 frameSize; - SPoint32 imageLocation; - - view->GetFrameLocation( frameLocation ); - view->GetFrameSize( frameSize ); - view->GetImageLocation( imageLocation ); - - // convert local rectangle to image rectangle - topLeft->h = frameLocation.h - imageLocation.h; // frameLocation.h - portOrigin.h - imageLocation.h; - botRight->h = topLeft->h + frameSize.width; - topLeft->v = frameLocation.v - imageLocation.v; // frameLocation.v - portOrigin.v - imageLocation.v; - botRight->v = topLeft->v + frameSize.height; -} - -void RevealInImage( LView* view, SPoint32 selTopLeft, SPoint32 selBotRight ) -{ -/* - Scroll the minimum amount necessary to reveal this image rectangle. - In this diagram, the selection is scrolled above the visible rectangle. - Therefore selection-top is less than image-top, so we need to scroll - down by above-amount. - /---\ - /---| | - | \---/ - v - /--------------\ - | | - | | - | | - | | - \--------------/ -*/ - SPoint32 iTopLeft; - SPoint32 iBotRight; - - GetImageRect( view, &iTopLeft, &iBotRight ); - - Int32 aboveAmount = selTopLeft.v - 20 - iTopLeft.v; - Int32 belowAmount = selTopLeft.v + 20 - iTopLeft.v; - Int32 leftAmount = selTopLeft.h - iTopLeft.h; - Int32 rightAmount = selBotRight.h - iBotRight.h; - - if ( aboveAmount < 0 ) - view->ScrollImageBy( 0, aboveAmount, TRUE ); - else if ( ( selBotRight.v - iBotRight.v ) > 0 ) - { - // don't scroll the top off! - // belowAmount and aboveAmount are negative - // belowAmount must be (absolute) less than aboveAmount - view->ScrollImageBy( 0, belowAmount > aboveAmount ? aboveAmount : belowAmount, TRUE ); - } - - if ( leftAmount < 0 ) - view->ScrollImageBy( leftAmount, 0, TRUE ); - else if ( rightAmount > 0 ) - { - // don't scroll the left off! - // belowAmount and leftAmount are negative - // belowAmount must be (absolute) less than aboveAmount - view->ScrollImageBy( rightAmount > leftAmount? leftAmount: rightAmount, 0, TRUE ); - } -} - -Boolean TooDifferent( const Point& a, const Point& b ) -{ - return abs( b.h - a.h ) >= MOUSE_HYSTERESIS || abs( b.v - a.v ) >= MOUSE_HYSTERESIS; -} - -short WaitForMouseAction( const Point& initial, long clickStart, long delay ) -{ - Point current; - long now; - - while ( ::StillDown() ) - { - ::GetMouse( ¤t ); - if ( TooDifferent( initial, current ) ) - return MOUSE_DRAGGING; - now = ::TickCount(); - if ( abs( now - clickStart ) > delay) - return MOUSE_TIMEOUT; - } - - return MOUSE_UP_EARLY; -} - - -int // offset -CalcCurrentSelected (lo_FormElementSelectData * selectData, Boolean fromDefaults) -{ - int offset = 0; - - lo_FormElementOptionData * optionData; - PA_LOCK(optionData, lo_FormElementOptionData *, selectData->options); - for (int i=0; ioption_cnt; i++) { - char * itemName = NULL; - PA_LOCK(itemName, char*, optionData[i].text_value); - if (fromDefaults) { - if (optionData[i].def_selected) { - offset = i; - break; - } - } - else { - if (optionData[i].selected) { - offset = i; - break; - } - } - PA_UNLOCK(optionData[i].text_value); - } - PA_UNLOCK(selectData->options); - - return offset; -} - -/*----------------------------------------------------------------------------- - Generic Utilities ------------------------------------------------------------------------------*/ - -Rect CenterInRect( Point thing, Rect destSpace ) -{ - Point destSize; - Point centeredSize; - Rect centeredThing; - - destSize.h = destSpace.right - destSpace.left; - destSize.v = destSpace.bottom - destSpace.top; - centeredSize.h = MIN( destSize.h, thing.h ); - centeredSize.v = MIN( destSize.v, thing.v ); - centeredThing.left = destSpace.left + ( destSize.h - centeredSize.h ) / 2; - centeredThing.top = destSpace.top + ( destSize.v - centeredSize.v ) / 2; - centeredThing.right = centeredThing.left + centeredSize.h; - centeredThing.bottom = centeredThing.top + centeredSize.v; - return centeredThing; -} - -/*----------------------------------------------------------------------------- - String Copying ------------------------------------------------------------------------------*/ - -unsigned char* CopyString( unsigned char* destination, const unsigned char* source ) -{ - BlockMove (source, destination, source[0]+1); - return destination; -} - -unsigned char* CopyString( unsigned char* destination, const char* source ) -{ - destination[0] = strlen (source); - BlockMove (source, destination + 1, destination[0]); - return destination; -} - -char* CopyString( char* destination, const unsigned char* source ) -{ - BlockMove (source + 1, destination, source[0]); - destination[source[0]] = 0; - return destination; -} - -char* CopyString( char* destination, const char* source ) -{ - register int length = strlen (source); - BlockMove (source, destination, length + 1); - return destination; -} - -void CopyAlloc(char ** destination, StringPtr source) -{ - // NET_SACopy frees a non-null destination itself - //if (*destination != NULL) - // XP_FREE(*destination); - p2cstr(source); - - // We don't really want to delete any existing storage for destination so borrow - // some code from NET_SACopy and skip the XP_FREE of destination - //NET_SACopy(destination, (char*)source); - if (! source) - { - *destination = NULL; - } - else - { - *destination = (char *) XP_ALLOC (XP_STRLEN((const char *)source) + 1); - if (*destination != NULL) - XP_STRCPY (*destination, (const char *)source); - } - - c2pstr((char*)source); -} - -// Takes colons out of a string -void StripColons( CStr31& fileName ) -{ - short count; - - for ( count = 1; count <= fileName.Length(); count++ ) - if ( fileName[count] == ':' ) - fileName[count] = ' '; -} - -// strips single instances of ch from the given string. -// If ch appears twice in a row, the second one is not removed. -void StripChar( CStr255& str, char ch ) -{ - int len = str.Length(); - for (short i = 1; i <= len; i++) - if (str[i] == ch) { - BlockMoveData(&str[i + 1], &str[i], len - i); - i++; - len -= 1; - } - str[0] = len; -} - -// ¥ Takes a string of text (dragged/pasted), and turns -// it into a URL (strips CR, whitespace preceeding/trailing <> -void CleanUpTextToURL(char* text) -{ - if (text == NULL) - return; - - long len = XP_STRLEN(text); - - int i=0; - - if (text[0] == '<') // Swallow the surrounding '<' and '>' - ::BlockMoveData(&text[1], &text[0], len); - - while (text[i] != 0) // Loop till whitespace - { - if (XP_IS_SPACE(text[i])) - break; - i++; - } - if (text[i-1] == '>') // Swallow the ending '>' - i--; - - text[i] = 0; -} - -void CleanUpLocationString (CStr255 & url) -{ -// Strips spaces & returns at end of url (happens often -// when you paste into url box) - int last; - while ((last = url.Length()) != 0) { - if (url[last] == '\n' || url[last] == ' ' || url[last] == '\r') - url.Length()--; - else break; - } -} - -// TRUE if the key is down. Bypasses the event loop -Boolean IsThisKeyDown(const UInt8 theKey) -{ - KeyMap map; - - GetKeys(map); - - return ((*((UInt8 *)map + (theKey >> 3)) >> (theKey & 7)) & 1) != 0; -} // IsThisKeyDown - don's improved non-union (as in struct) version - - - -// A mess that figures out if cmd-. was pressed -/* Borrowed from tech note 263 */ - -#define kMaskModifiers 0xFE00 // we need the modifiers without the - // command key for KeyTrans -#define kMaskVirtualKey 0x0000FF00 // get virtual key from event message - // for KeyTrans -#define kUpKeyMask 0x0080 -#define kShiftWord 8 // we shift the virtual key to mask it - // into the keyCode for KeyTrans -#define kMaskASCII1 0x00FF0000 // get the key out of the ASCII1 byte -#define kMaskASCII2 0x000000FF // get the key out of the ASCII2 byte -#define kPeriod 0x2E // ascii for a period -Boolean CmdPeriod() -{ - EvQElPtr eventQ = (EvQElPtr)LMGetEventQueue()->qHead; - - while (eventQ != NULL) - { - EventRecord * theEvent = (EventRecord *)&eventQ->evtQWhat; - - UInt16 keyCode; - UInt32 state; - long virtualKey, keyInfo, lowChar, highChar, keyCId; - Handle hKCHR; - Ptr KCHRPtr; - - - if (((*theEvent).what == keyDown) || ((*theEvent).what == autoKey)) { - - // see if the command key is down. If it is, find out the ASCII - // equivalent for the accompanying key. - - if ((*theEvent).modifiers & cmdKey ) { - - virtualKey = ((*theEvent).message & kMaskVirtualKey) >> kShiftWord; - // And out the command key and Or in the virtualKey - keyCode = short(((*theEvent).modifiers & kMaskModifiers) | virtualKey); - state = 0; - - - hKCHR = nil; /* set this to nil before starting */ - KCHRPtr = (Ptr)GetScriptManagerVariable(smKCHRCache); - - if ( !KCHRPtr ) { - keyCId = ::GetScriptVariable(short(GetScriptManagerVariable(smKeyScript)), smScriptKeys); - - hKCHR = GetResource('KCHR',short(keyCId)); - KCHRPtr = *hKCHR; - } - if (KCHRPtr) { - keyInfo = KeyTranslate(KCHRPtr, keyCode, &state); - if (hKCHR) - ReleaseResource(hKCHR); - } else - keyInfo = (*theEvent).message; - - lowChar = keyInfo & kMaskASCII2; - highChar = (keyInfo & kMaskASCII1) >> 16; - if (lowChar == kPeriod || highChar == kPeriod) - return TRUE; - - } // end the command key is down - } // end key down event - eventQ = (EvQElPtr)eventQ->qLink; - } - return FALSE; -} - -// Sets button state and redraws it -void SetEnable( LPane* button, Boolean enable ) -{ - if ( !button->IsEnabled() && enable ) - button->Enable(); - else if ( button->IsEnabled() && !enable ) - button->Disable(); -} - -// Changes the string to something acceptable to mac menu manager -void CreateMenuString( CStr255& itemName ) -{ - itemName=NET_UnEscape(itemName); - if ( itemName.Length() > 50 ) // Cut it down to reasonable size - { - itemName.Length() = 50; - itemName += "..."; - } - if ( itemName.Length() && itemName[ 1 ] == '-' ) - itemName[ 1 ] = 'Ð'; -} - -// TextHandleToHardLineBreaks -// converts TextEdit handle to text handle that has hard carriage returns. - -Handle TextHandleToHardLineBreaks( CSimpleTextView &inTextView ) -{ - Handle theOldText = inTextView.GetTextHandle(); - ThrowIfNULL_(theOldText); - - SInt32 theTotalLength = inTextView.GetTextLength(); - -// TextRangeT theTotalRange = inEngine->GetTotalRange(); - -// Int32 theLineCount = inEngine->CountParts(theTotalRange, cLine); - - Int32 theLineCount = inTextView.CountLines(); - - // text will expand by at most as many line breaks as there are lines - Handle theNewText = ::NewHandle(theTotalLength + theLineCount); - ThrowIfNULL_(theNewText); - - // Lock down both text buffers - StHandleLocker theOldLock(theOldText); - StHandleLocker theNewLock(theNewText); - - Int32 theBreakCount = 0; - Int32 theNewTextOffset = 0; - SInt32 lineStart = 0; - SInt32 lineEnd = 0; - - Boolean bEatAgain = false; - - for (Int32 theIndex = 1; theIndex <= theLineCount; theIndex++) - { -// TextRangeT theLineRange; -// inEngine->FindNthPart(theTotalRange, cLine, theIndex, &theLineRange); - - // Waste appears to be Zero based rather than 1 - inTextView.GetLineRange( theIndex - 1, &lineStart, &lineEnd ); - - ::BlockMoveData(*theOldText + lineStart, *theNewText + theNewTextOffset, lineEnd - lineStart ); - theNewTextOffset += lineEnd - lineStart; - - Boolean eatNextLine = ((theIndex + 1) < theLineCount) && // This is to prevent overflow on end - (((*theOldText)[lineStart] == '>' && - (*theOldText)[lineEnd + 1] != '>')) || - bEatAgain; - - if ((*theNewText)[theNewTextOffset -1 ] == CR) - { - (*theNewText)[theNewTextOffset - 1] = CR; - bEatAgain = false; - } - else - { - if (eatNextLine) - bEatAgain = true; // Only - else - { - (*theNewText)[++theNewTextOffset - 1] = CR; - bEatAgain = false; - } - } - } - - ::SetHandleSize(theNewText, theNewTextOffset); // Reduce the size of the handle - return theNewText; -} - - -void ConstrainTo( const long& min, const long& max, long& value ) -{ - XP_WARN_ASSERT( min <= value && value <= max ); - if ( value < min ) - value = min; - else if ( value > max ) - value = max; -} - -void * StructCopy(const void * struc, UInt32 size) -{ - if (struc == NULL) - return NULL; - - void * newStruct = XP_ALLOC(size); - if (newStruct == NULL) - return NULL; - ::BlockMoveData(struc, newStruct, size); - return newStruct; -} - - -void SetMenuSize( LStdPopupMenu* popup, short shouldBe ) -{ - MenuHandle menu; - short count; - - menu = popup->GetMacMenuH(); - count = ::CountMItems( menu ); - - while ( shouldBe > count ) - { - InsertMenuItem( menu, "\p ", count ); - count++; - } - - while ( shouldBe < count ) - { - DeleteMenuItem( menu, count ); - count--; - } - - popup->SetMinValue( 1 ); - popup->SetMaxValue( shouldBe ); -} - -void SetMenuSizeForLGAPopup( LGAPopup* popup, short shouldBe ) -{ - MenuHandle menu; - short count; - - menu = popup->GetMacMenuH(); - count = ::CountMItems( menu ); - - while ( shouldBe > count ) - { - InsertMenuItem( menu, "\p ", count ); - count++; - } - - while ( shouldBe < count ) - { - DeleteMenuItem( menu, count ); - count--; - } - - popup->SetMinValue( 1 ); - popup->SetMaxValue( shouldBe ); -} - -void SetMenuItem( CommandT whichItem, Boolean toState ) -{ - ResIDT menuID; - MenuHandle menu = NULL; - Int16 item; - LMenuBar* currentMenuBar; - - currentMenuBar = LMenuBar::GetCurrentMenuBar(); - - if (currentMenuBar) - currentMenuBar->FindMenuItem( whichItem, menuID, menu, item ); - if (menu) - { - if ( toState ) - SetItemMark( menu, item, checkMark ); - else - SetItemMark( menu, item, noMark ); - } -} - -// --------------------------------------------------------------------------- -// ¥ myStringToNum [static] -// --------------------------------------------------------------------------- -// Utility used the USizeMenu routines to convert strings to numbers that -// ignores anything that's not a number - -#define IsNumber_( x ) (( x ) >= '0' && ( x ) <= '9') - -void myStringToNum( const CStr255& inString, Int32* outNum ) -{ - CStr255 temp; - short j = 1; - - for ( short i = 1; i <= inString[ 0 ]; i++ ) - { - if ( IsNumber_( inString[ i ] ) ) - temp[ j++ ] = inString[ i ]; - } - - temp[0] = j - 1; - if (temp.Length() > 0) - StringToNum( temp, outNum ); -} - -short PointsToPixels( short inPoints, short iRes ) -{ - return ( (float)inPoints / 120.0 ) * iRes; -} - -void SetCaptionDescriptor( LCaption* captionToSet, const CStr255& newText, - const TruncCode trunc ) -{ - XP_ASSERT( captionToSet ); - - CStr255 tempText( newText ); - SDimension16 captionSize; - - captionToSet->GetFrameSize( captionSize ); - - // DANGER! There is a hideous crashing bug in Apple's ::TruncString - // (and ::TruncText) when called with TruncMiddle - if (trunc == truncMiddle) - MiddleTruncationThatWorks(tempText, captionSize.width - 4); - else - TruncString( captionSize.width - 4, tempText, trunc ); - captionToSet->SetDescriptor( tempText ); - captionToSet->Refresh(); -} - -void GetDateTimeString( CStr255& dateTime ) -{ - unsigned long dt; - - ::GetDateTime( &dt ); - ::DateString( dt, longDate, dateTime, NULL ); -} - -unsigned short GetTextLengthInPixels( LTextEditView* textEdit ); -unsigned short GetTextLengthInPixels( LTextEditView* textEdit ) -{ - XP_ASSERT( textEdit ); - - unsigned short width = 0; - TEHandle macTEH = NULL; - Handle text = NULL; - short length = 0; - - // ¥ this sets up the current port with the right text traits - if ( textEdit->FocusDraw() ) - { - macTEH = textEdit->GetMacTEH(); - XP_ASSERT( macTEH ); - - text = (*macTEH)->hText; - if ( text ) - { - length = (*macTEH)->teLength; - HLock( text ); - width = TextWidth( *text, 0, length ); - HUnlock( text ); - } - } - return width; -} - -// Could be optimized -char * GetPaneDescriptor(LPane * pane) -{ - char * ret = nil; - CStr255 ptempStr; - pane->GetDescriptor(ptempStr); - cstring ctempStr((unsigned char*)ptempStr); - if (ctempStr.length() > 0) - StrAllocCopy(ret, ctempStr); - return ret; -} - -void TurnOn( LControl* control ) -{ - control->SetValue( TRUE ); - control->BroadcastMessage( msg_ControlClicked, (void*)control ); -} - -Boolean SetPopupToNamedItem( LStdPopupMenu* whichMenu, const CStr255& itemText ) -{ - MenuHandle menuH; - short menuSize; - Str255 fontName; - - menuH = whichMenu->GetMacMenuH(); - menuSize = CountMItems( menuH ); - - for ( short i = 1; i <= menuSize; i++ ) - { - ::GetMenuItemText( menuH, i, fontName ); - if ( itemText == (CStr255)fontName ) - { - whichMenu->SetValue( i ); - return TRUE; - } - } - return FALSE; -} - -Boolean SetLGAPopupToNamedItem( LGAPopup* whichMenu, const CStr255& itemText ) -{ - MenuHandle menuH; - short menuSize; - Str255 fontName; - - menuH = whichMenu->GetMacMenuH(); - menuSize = CountMItems( menuH ); - - for ( short i = 1; i <= menuSize; i++ ) - { - ::GetMenuItemText( menuH, i, fontName ); - if ( itemText == (CStr255)fontName ) - { - whichMenu->SetValue( i ); - return TRUE; - } - } - return FALSE; -} - -unsigned long GetFreeSpaceInBytes( short vRefNum ) -{ - HVolumeParam pb; - OSErr err; - unsigned long result; - - pb.ioCompletion = NULL; - pb.ioVolIndex = 0; - pb.ioNamePtr = NULL; - pb.ioVRefNum = vRefNum; - - err = PBHGetVInfoSync( (HParmBlkPtr)&pb ); - - if ( err == noErr ) - result = pb.ioVFrBlk * pb.ioVAlBlkSiz; - else - result = 0; - - return result; -} - -// ¥ force a window to appear on the desktop -void ForceWindowOnScreen( LWindow* window ) -{ - // ¥Êget the desktop region - StRegion desktopRgn( LMGetGrayRgn() ); - - Rect windowFrame; - window->CalcPortFrameRect( windowFrame ); - windowFrame = PortToGlobalRect( window, windowFrame ); - - StRegion windowRgn( windowFrame ); - - StRegion destRgn; - Rect newRect; - - ::SectRgn( windowRgn, desktopRgn, destRgn ); - - if ( ::EmptyRgn( destRgn ) || - !::EqualRgn( destRgn, windowRgn ) ) - { - newRect = (**(static_cast(destRgn))).rgnBBox; - - // ¥ add 20 for title, 20 for menu bar - newRect.top = 40 + 2; - newRect.bottom = newRect.top + ( windowFrame.bottom - windowFrame.top ); - newRect.left = 2; - newRect.right = newRect.left + ( windowFrame.right - windowFrame.left ); - - window->DoSetBounds( newRect ); - } - -} - -void GrowWindowToScreenHeight( LWindow* win ) -{ - GDHandle device; - Rect windowFrame; - - win->CalcPortFrameRect( windowFrame ); - windowFrame = PortToGlobalRect( win, windowFrame ); - - device = WindowOnSingleDevice( win ); - if ( device ) - { - windowFrame.bottom = (**device).gdRect.bottom - 5; - win->DoSetBounds( windowFrame ); - } -} - -static -Boolean WillBeVisible( Rect& windowRect ) -{ - Rect newRect; - Boolean result = FALSE; - - StRegion desktopRgn( LMGetGrayRgn() ); - StRegion windowRgn( windowRect ); - StRegion destRgn; - - ::SectRgn( windowRgn, desktopRgn, destRgn ); - - newRect = (**static_cast(destRgn)).rgnBBox; - - if ( EmptyRgn( destRgn ) ) - result = FALSE; - else if ( !EqualRect( &newRect, &windowRect ) ) - result = FALSE; - else - result = TRUE; - - return result; -} - -void StaggerWindow( LWindow* win ) -{ - WindowPtr nextWindow; - LWindow* similarWindow; - Rect similarBounds; - Rect bounds; - Boolean changed = FALSE; - - win->CalcPortFrameRect( bounds ); - bounds = PortToGlobalRect( win, bounds ); - // ¥Êfind the window with the same ID - // if it has the same top left corner, offset our rect by 20, 5 - nextWindow = ::FrontWindow(); - while ( nextWindow ) - { - similarWindow = LWindow::FetchWindowObject( nextWindow ); - nextWindow = (WindowPtr)( (WindowPeek)nextWindow )->nextWindow; - if ( similarWindow && - similarWindow->GetPaneID() == win->GetPaneID() ) - { - similarWindow->CalcPortFrameRect( similarBounds ); - similarBounds = PortToGlobalRect( similarWindow, similarBounds ); - - if ( ( similarBounds.top == bounds.top ) && - ( similarBounds.left == bounds.left ) ) - { - ::OffsetRect( &bounds, 5, 20) ; - changed = TRUE; - // ¥ loop again, because we might run into another window - nextWindow = ::FrontWindow(); - } - } - } - if ( changed ) - win->DoSetBounds( bounds ); -} - -GDHandle WindowOnSingleDevice( LWindow* win ) -{ - // ¥ loop thru all GDevices - Rect windowFrame; - GDHandle device; - - win->CalcPortFrameRect( windowFrame ); - windowFrame = PortToGlobalRect( win, windowFrame ); - - device = GetDeviceList(); - - while ( device ) - { - if ( UDrawingUtils::IsActiveScreenDevice( device ) ) - { - Rect intersection; - // ¥ find intersection of Window with this active screen Device - if ( ::SectRect( &windowFrame, &(**device).gdRect, &intersection ) ) - { - // ¥ window intersects this Device - if ( ::EqualRect( &windowFrame, &intersection ) ) - return device; - } - - } - device = GetNextDevice( device ); - } - return NULL; -} - -#define SAVE_VERSION 23 - -// ¥ saving/restoring of the window's default state -Boolean RestoreDefaultWindowState(LWindow* inWindow) -{ - if (inWindow == NULL) - return false; - - // We are responsible for disposing of the window data - Handle theWindowData = CPrefs::ReadWindowData(inWindow->GetPaneID()); - if (theWindowData == NULL) - return false; - - // The destructor of the stream will kill the window data - LHandleStream stream(theWindowData); - - Int32 version; - stream.ReadData(&version, sizeof( version ) ); - if ( version != SAVE_VERSION ) - return false; - - Rect theWindowBounds; - stream.ReadData(&theWindowBounds, sizeof(theWindowBounds)); - - if (theWindowBounds.right > theWindowBounds.left && - theWindowBounds.bottom > theWindowBounds.top && - WillBeVisible(theWindowBounds) ) - inWindow->DoSetBounds(theWindowBounds); - - inWindow->RestorePlace(&stream); - ForceWindowOnScreen(inWindow); - - return true; -} - -void StoreDefaultWindowState( LWindow* win ) -{ - if ( !win ) - return; - - LHandleStream stream; - Rect windowBounds; - Int32 version = SAVE_VERSION; - - stream.WriteData( &version, sizeof( version ) ); - - win->EstablishPort(); - win->CalcPortFrameRect( windowBounds ); - windowBounds = PortToGlobalRect( win, windowBounds ); - stream.WriteData( &windowBounds, sizeof( windowBounds ) ); - - win->SavePlace( &stream ); - - CPrefs::WriteWindowData( stream.GetDataHandle(), win->GetPaneID() ); -} - -// Is front window modal? Used for command enabling -Boolean IsFrontWindowModal() -{ - return UDesktop::FrontWindowIsModal(); -} - -// ¥ÊFetch a window title resource and fill in the current profile name -void GetUserWindowTitle(short id, CStr255& title) -{ - char profileName[32] = ""; - int len = 32; - PREF_GetCharPref("profile.name", profileName, &len); - - ::GetIndString( title, WINDOW_TITLES_RESID, id ); - - StringParamText(title, profileName); -} - - -// Returns true if we are the front application -Boolean IsFrontApplication() -{ - ProcessSerialNumber netscapeProcess; - ProcessSerialNumber frontProcess; - Boolean inFront; - - OSErr err = ::GetCurrentProcess( &netscapeProcess ); - if ( err != noErr ) - return FALSE; - err = ::GetFrontProcess( &frontProcess ); - if ( err != noErr ) - return FALSE; - err = ::SameProcess( &frontProcess, &netscapeProcess, &inFront ); - if ( err != noErr ) - return FALSE; - return inFront; -} - -void MakeFrontApplication() -{ - ProcessSerialNumber netscapeProcess; - OSErr err = ::GetCurrentProcess( &netscapeProcess ); - if (err == noErr) - SetFrontProcess(&netscapeProcess); -} - -void FrameSubpaneSubtle( LView* view, LPane* pane ) -{ - Rect subFrame; - - GetSubpaneRect( view, pane, subFrame ); - ::InsetRect( &subFrame, -1, -1 ); - UGraphics::FrameRectSubtle( subFrame, true ); -} - -void GetSubpaneRgn( LView* view, LPane* pane, RgnHandle rgn ) -{ - Rect frame; - GetSubpaneRect( view, pane, frame ); - ::RectRgn( rgn, &frame ); -} - -void GetSubpaneRect( LView* view, LPane* pane, Rect& frame ) -{ - XP_ASSERT( view ); - XP_ASSERT( pane ); - pane->CalcPortFrameRect( frame ); - view->PortToLocalPoint( *(Point*)&( frame.top ) ); - view->PortToLocalPoint( *(Point*)&( frame.bottom) ); -} - -void WriteVersionTag( LStream* stream, Int32 version ) -{ - stream->WriteData( &version, sizeof( version ) ); -} - -Boolean ReadVersionTag( LStream* stream, Int32 version ) -{ - Int32 versionTag; - stream->ReadData( &versionTag, sizeof( versionTag ) ); - return ( versionTag == version ); -} - -void TrySetCursor( int whichCursor ) -{ - Cursor** c = GetCursor( whichCursor ); - if ( c ) - SetCursor( *c ); -#ifdef DEBUG - else - SysBeep( 1 ); -#endif -} - -void StripNewline( CStr255& msg ) -{ - if ( msg[ msg.Length() ] == '\n' ) - msg[ msg.Length() ] = 0; -} - -void StripDoubleCRs( CStr255& msg ) -{ - Boolean lastCR = FALSE; - for ( UInt32 i = 1; i < msg.Length(); i++ ) - { - if ( msg[ i ] == CR) - { - if ( lastCR ) - { - msg[ i - 1 ] = ' '; - lastCR = FALSE; - } - else - lastCR = TRUE; - } - else - lastCR = FALSE; - } -} - -int ConvertCRtoLF(CStr255 & msg) -{ - int ret = 0; - for ( long i = 1; i <= msg[0]; i++ ) - if ( msg[ i ] == LF ) - { - msg[ i ] = CR; - ret++; - } - return ret; -} - -void RectFromTwoPoints( Point p1, Point p2, Rect &outRect) -{ - outRect.top = MIN( p1.v, p2.v ); - outRect.bottom = MAX( p1.v, p2.v ); - outRect.left = MIN( p1.h, p2.h ); - outRect.right = MAX( p1.h, p2.h ); -} - -// Return true if inEnclosingRect encloses any portion of inCheckRect -Boolean RectInRect(const Rect *inCheckRect, const Rect *inEnclosingRect) { - - return (!::EmptyRect(inEnclosingRect) && - !((inCheckRect->right <= inEnclosingRect->left) || - (inCheckRect->bottom <= inEnclosingRect->top) || - (inCheckRect->left >= inEnclosingRect->right) || - (inCheckRect->top >= inEnclosingRect->bottom))); -} - -const RGBColor rgbBlack = { 0x0000, 0x0000, 0x0000 }; -const RGBColor rgbWhite = { 0xFFFF, 0xFFFF, 0xFFFF }; - - -void DrawAntsRect( Rect&r, short mode ) -{ - ::PenPat( &(UQDGlobals::GetQDGlobals()->gray) ); - ::PenMode( mode ); - ::RGBForeColor( &rgbBlack ); - ::RGBBackColor( &rgbWhite ); - ::FrameRect( &r ); -} - -void SafeGetFontInfo(ResIDT textTraits, FontInfo &outFontInfo) -{ - StTextState textState; - UTextTraits::SetPortTextTraits(textTraits); - - ::GetFontInfo(&outFontInfo); -} - -void FrameButton( const Rect& box, Boolean pushed ) -{ - UGraphics::FrameRectSubtle(box, pushed); -} - -void HiliteRect( const Rect& r ) -{ - LMSetHiliteMode( LMGetHiliteMode() & ! ( 1 << hiliteBit ) ) ; - ::InvertRect( &r ); -} - -void HiliteRgn( const RgnHandle& r ) -{ - LMSetHiliteMode( LMGetHiliteMode() & ! ( 1 << hiliteBit ) ) ; - ::InvertRgn( r ); -} - -LPane* FindPaneHitBy( const Point& globalMouse ) -{ - Int16 part; - WindowPtr macWindowP; - LPane* inPane = NULL; - - part = ::FindWindow( globalMouse, &macWindowP ); - if ( macWindowP && part == inContent ) - { - LWindow* whichWin; - whichWin = LWindow::FetchWindowObject( macWindowP ); - if ( whichWin ) - { - Point localMouse; - LPane* nextPane; - - localMouse = globalMouse; - whichWin->GlobalToPortPoint( localMouse ); - inPane = whichWin->FindSubPaneHitBy( localMouse.h, localMouse.v ); - nextPane = inPane; - while ( nextPane ) - { - inPane = nextPane; - nextPane = nextPane->FindSubPaneHitBy( localMouse.h, localMouse.v ); - } - } - } - return inPane; -} - -// --------------------------------------------------------------- -// Good 'ol Mac File Utilities -// --------------------------------------------------------------- - - -/*---------------------------------------------------------------------- - Get a full pathname given a sig and type - In: sig of process to look for ('MOSS' for nav but should use emSignature instead) - type of process to look for (typically APPL) - Out:Returns the file path as a nul-terminated allocated block - that must be freed by the caller using XP_FREE. - Returns NULL on error; - -------------------------------------------------------------------------*/ -char *PathURLFromProcessSignature (OSType sig, OSType type) -{ - ProcessSerialNumber targetPSN; // return process number - FSSpec targetFileSpec; // return file spec - char *appPath = NULL; - char *urlPath = NULL; - char prefix[] = "file://"; - OSErr err; - - // Get the file spec of our app - err = FindProcessBySignature(sig, type, targetPSN, &targetFileSpec); - if (err != noErr) return NULL; - - appPath = CFileMgr::EncodedPathNameFromFSSpec(targetFileSpec, true); - if (appPath == NULL) return NULL; - - urlPath = (char *)XP_ALLOC(strlen(appPath) + strlen(prefix) + 1); - if (urlPath == NULL) { - XP_FREE(appPath); - return NULL; - } - - XP_STRCPY(urlPath, prefix); - XP_STRCPY(urlPath + strlen(prefix), appPath), - - XP_FREE(appPath); - - return urlPath; -} - -// Given a process signature, gets its serial number -ProcessSerialNumber GetPSNBySig( OSType sig ) -{ - OSErr err; - FSSpec fileSpec; - ProcessInfoRec info; - ProcessSerialNumber psn; - - info.processAppSpec = &fileSpec; - psn.highLongOfPSN = 0; - psn.lowLongOfPSN = kNoProcess; - while ( GetNextProcess( &psn ) == noErr) - { - info.processInfoLength = sizeof( ProcessInfoRec ); - info.processName = NULL; - err= GetProcessInformation( &psn, &info ); - if ( info.processSignature == sig ) - return psn; - } - Throw_( paramErr ); - return psn; -} - -#define NO_PROCESS -1 // Constant used to indicate that there is no process in the PSN -// Creates an NoProcess serial number -ProcessSerialNumber MakeNoProcessPSN() -{ - ProcessSerialNumber psn; - psn.highLongOfPSN = NO_PROCESS; - psn.lowLongOfPSN = NO_PROCESS; - return psn; -} - -// Do we have a process -Boolean HasProcess( const ProcessSerialNumber& psn ) -{ - return ( ( psn.highLongOfPSN != NO_PROCESS ) || - ( psn.lowLongOfPSN!=NO_PROCESS ) ); -} - -// Given an application signature, finds the process -OSErr FindProcessBySignature(OSType sig, - OSType processType, - ProcessSerialNumber& psn, - FSSpec* fileSpec) -{ - OSErr err; - - ProcessInfoRec info; - - psn.highLongOfPSN = 0; - psn.lowLongOfPSN = kNoProcess; - do - { - err= GetNextProcess(&psn); - if( err == noErr ) - { - - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = NULL; - info.processAppSpec = fileSpec; - - err= GetProcessInformation(&psn, &info); - } - } while( (err == noErr) && - ((info.processSignature != sig) || - (info.processType != processType))); - - if( err == noErr ) - psn = info.processNumber; - - return err; -} // FindProcessBySignature - - -extern Boolean HasAppleEventObjects(); - -// On the 68K, the OSL glue checks to see whether it is -// installed. If it's not, the functions do nothing. On the PPC, -// if the Code Fragment Manager is unable to resolve an OSL -// stub, it performs an ExitToShell. Therefore we must -// insure that the OSL is available before calling any of -// its functions. These are called throughout PowerPlant's -// LModel* classes. - -// gestaltObjectSupportLibraryInSystem = 1, -// gestaltObjectSupportLibraryPowerPCSupport = 2 -// gestaltAppleEventsPresent -// gestaltScriptingSupport -// gestaltOSLInSystem ÃÃà not gestaltObjectSupportLibraryPowerPCSupport -Boolean HasAppleEventObjects() -{ - static Boolean isKnown = false, isInstalled = false; - - - if (!isKnown) - { - long attr = 0; - Boolean ae = UEnvironment::HasGestaltAttribute(gestaltAppleEventsAttr, gestaltAppleEventsPresent); - Boolean ppc = UEnvironment::HasGestaltAttribute(gestaltAppleEventsAttr, gestaltOSLInSystem); -#ifdef powerc - isInstalled = ae && ppc; -#else - isInstalled = 1; // we're linked with glue which always works -#endif - isKnown = true; - } - return isInstalled; -} - -/*---------------------------------------------------------------------------- - GetDropLocationDirectory - - Given an 'alis' drop location AEDesc, return the volume reference - number and directory ID of the directory. - - Entry: dropLocation = pointer to 'alis' AEDesc record. - - Exit: function result = error code. - *volumeID = volume reference number. - *directoryID = directory ID. - - From Apple "HFS Drag Sample" sample code. -----------------------------------------------------------------------------*/ -OSErr GetDropLocationDirectory (AEDesc *dropLocation, long *directoryID, short *volumeID) -{ - OSErr result; - AEDesc targetDescriptor; // 'fss ' descriptor for target directory - FSSpec targetLocation; // FSSpec for target directory - CInfoPBRec getTargetInfo; // paramBlock to get targetDirID - - // Coerce the 'alis' descriptor to a 'fss ' descriptor - result = AECoerceDesc(dropLocation, typeFSS, &targetDescriptor); - if (result != noErr) - return (result); - - // Extract the FSSpec from targetDescriptor - BlockMoveData((Ptr)(*targetDescriptor.dataHandle), (Ptr)&targetLocation, sizeof(FSSpec)); - - result = AEDisposeDesc(&targetDescriptor); - if (result != noErr) - return (result); - - // Use PBGetCatInfo to get the directoryID of the target directory from the FSSpec - - getTargetInfo.dirInfo.ioNamePtr = targetLocation.name; - getTargetInfo.dirInfo.ioVRefNum = targetLocation.vRefNum; - getTargetInfo.dirInfo.ioFDirIndex = 0; - getTargetInfo.dirInfo.ioDrDirID = targetLocation.parID; - - result = PBGetCatInfoSync(&getTargetInfo); - if (result != noErr) - return (result); - - // return directory ID and volume reference number - - *directoryID = getTargetInfo.dirInfo.ioDrDirID; - *volumeID = targetLocation.vRefNum; - - return result; -} - -/*---------------------------------------------------------------------------- - DragTargetWasTrash - - Check to see if the target of a drag and drop was the Finder trashcan. - - Entry: dragRef = drag reference. - - Exit: function result = true if target was trash. -----------------------------------------------------------------------------*/ - -Boolean DragTargetWasTrash (DragReference dragRef) -{ - AEDesc dropLocation; - OSErr err = noErr; - long dropDirID, trashDirID; - short dropVRefNum, trashVRefNum; - - err = GetDropLocation(dragRef, &dropLocation); - if (err != noErr) return false; - - if (dropLocation.descriptorType == typeNull) goto exit; - - err = GetDropLocationDirectory(&dropLocation, &dropDirID, &dropVRefNum); - if (err != noErr) goto exit; - - err = FindFolder(dropVRefNum, kTrashFolderType, false, &trashVRefNum, - &trashDirID); - if (err != noErr) goto exit; - - if (dropVRefNum != trashVRefNum || dropDirID != trashDirID) goto exit; - - AEDisposeDesc(&dropLocation); - return true; - -exit: - - AEDisposeDesc(&dropLocation); - return false; -} - - -long LArrowControl::fLastTicks = 0; -long LArrowControl::fDelay = 20; -long LArrowControl::fHits = 0; - -LArrowControl::LArrowControl( const SPaneInfo& inPaneInfo, MessageT valueMessage ): - LControl( inPaneInfo, valueMessage, 0, 0, 0 ) -{ - mCurrPict = mArrowsPict; -} - -void LArrowControl::HiliteControl( Int16 inHotSpot, Boolean inCurrInside ) -{ - if ( inCurrInside ) - { - if ( inHotSpot == mTopHalf ) - mCurrPict = mArrowsTopLit; - else if ( inHotSpot == mBottomHalf ) - mCurrPict = mArrowsBotLit; - } - else - mCurrPict = mArrowsPict; - - DrawSelf(); -} - -void LArrowControl::DrawSelf() -{ - PicHandle macPictureH = GetPicture( mCurrPict ); - if ( macPictureH ) - { - Rect pictureBounds; - - CalcLocalFrameRect( pictureBounds ); - ::DrawPicture( macPictureH, &pictureBounds ); - - } -} - -Boolean LArrowControl::PointInHotSpot( Point inPoint, Int16 inHotSpot ) const -{ - Rect localFrame; - Int16 midPoint; - - CalcLocalFrameRect( localFrame ); - midPoint = ( localFrame.bottom - localFrame.top ) / 2; - - if ( inHotSpot == mTopHalf ) - localFrame.bottom = midPoint; - else - localFrame.top = midPoint; - - return PtInRect( inPoint, &localFrame ); -} - -Int16 LArrowControl::FindHotSpot( Point inPoint ) const -{ - Rect localFrame; - Int16 midPoint; - - CalcLocalFrameRect( localFrame ); - midPoint = ( localFrame.bottom - localFrame.top ) / 2; - - if ( inPoint.v < midPoint ) - return mTopHalf; - else - return mBottomHalf; -} - -void LArrowControl::HotSpotAction( Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside ) -{ - - if ( inCurrInside != inPrevInside ) - { - FocusDraw(); - HiliteControl( inHotSpot, inCurrInside ); - } - - if ( inCurrInside ) - { - if ( ( ::TickCount() - fLastTicks ) < fDelay ) - return; - - if ( fDelay == 0 ) - fDelay = 20; - - fHits++; - if ( fHits > 6 ) - fDelay = 5; - - fLastTicks = TickCount(); - - BroadcastMessage( mValueMessage, &inHotSpot ); - } - else - { - fHits = 0; - fDelay = 20; - } -} - -void LArrowControl::HotSpotResult( Int16 /*inHotSpot*/ ) -{ - mCurrPict = mArrowsPict; - - DrawSelf(); - - fHits = 0; - fDelay = 0; -} - -/*============================================================================= - File & Stream Classes Utilities -=============================================================================*/ - -/*----------------------------------------------------------------------------- - StOpenResFile opens the resource fork and closes it later ------------------------------------------------------------------------------*/ - -StOpenResFile::StOpenResFile (LFile *file, short perms) -{ - fFile = file; - file->OpenResourceFork (perms); -} - -StOpenResFile::~StOpenResFile () -{ - // LAM may not be required to UpdateResFile - // CloseResFile is supposed to call UpdateResFile - //::UpdateResFile (fFile->GetResourceForkRefNum()); - fFile->CloseResourceFork(); -} - -/*----------------------------------------------------------------------------- - StUseResFile uses an open resource fork and stops using it later. ------------------------------------------------------------------------------*/ - -StUseResFile::StUseResFile( short refnum ) -{ - fPrevResFile = CurResFile(); - - if (refnum != -1) - UseResFile( refnum ); -} - -StUseResFile::~StUseResFile() -{ - UseResFile( fPrevResFile ); -} - -//======================================================================================== -// CLASS CStringListRsrc -//======================================================================================== - -typedef short** IntegerHandle; -//---------------------------------------------------------------------------------------- -// CStringListRsrc::GetString: -//---------------------------------------------------------------------------------------- - -void CStringListRsrc::GetString(short index, CStr255& theString) const -{ - if (fStrListID != 0) - GetIndString(theString, fStrListID, index); -} // CStringListRsrc::GetString - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::FindString: -//---------------------------------------------------------------------------------------- - -short CStringListRsrc::FindString(const CStr255& theString, Boolean addString) -{ - CStr255 testString; - short numStrings = this->CountStrings(); - - for (short i = 1; i <= numStrings; ++i) - { - this->GetString(i, testString); - - if (testString == theString) - return i; // found it! return the index - } - - // CString is not found, should we add it? - if (addString == kAddString) - return this->AppendString(theString); // added it! return the index - - // CString not found...sigh! - return 0; -} // CStringListRsrc::FindString - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::AppendString: -//---------------------------------------------------------------------------------------- - -short CStringListRsrc::AppendString(const CStr255& theString) -{ - long result; - short totalStringLength = theString.Length() + kLengthByte; - Handle aHandle = Get1Resource('STR#', fStrListID); - if (aHandle) - { - if (!*aHandle) - ::LoadResource(aHandle); - - if (*aHandle) - { - SInt8 flags = ::HGetState(aHandle); - ::HNoPurge(aHandle); - Size itsSize = GetHandleSize(aHandle); - if (itsSize > 0) - { - short numStrings = this->CountStrings(); - SetHandleSize(aHandle, itsSize + totalStringLength); - (**((IntegerHandle) aHandle)) = ++numStrings; // increment the count of strings in the STR# resource - - // needs a failure handler - result = Munger(aHandle, itsSize, NULL, totalStringLength, &theString, totalStringLength); - if (result > 0) - { - // mark it as changed - ChangedResource(aHandle); - ::HSetState(aHandle, flags); - - return numStrings; - } - ::HSetState(aHandle, flags); - } - } - } - else - { - // must create the resource... - aHandle = NewHandle(sizeof(short) + totalStringLength); - (**((IntegerHandle) aHandle)) = 1; // set the count of strings in the STR# resource - result = Munger(aHandle, sizeof(short), NULL, totalStringLength, &theString, totalStringLength); - if (result > 0) - { - AddResource(aHandle, 'STR#', fStrListID, fStrListRsrcName); - ThrowIfResError_(); // if fails, it's most likely because the file is read-only - - SetResAttrs(aHandle, resPurgeable); - - // Need the following ChangedResource call because the SetResAttrs call on the previous - // line cleared the "resChanged" attribute of the resource. - ChangedResource(aHandle); - - return 1; - } - } - return 0; -} // CStringListRsrc::AppendString - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::ClearAll: -//---------------------------------------------------------------------------------------- - -void CStringListRsrc::ClearAll() -{ - Handle aHandle = Get1Resource('STR#', fStrListID); - if (aHandle) - { - if (!*aHandle) - ::LoadResource(aHandle); - - if (*aHandle) - { - SInt8 flags = ::HGetState(aHandle); - ::HNoPurge(aHandle); - SetHandleSize(aHandle, sizeof(short)); - (**((IntegerHandle) aHandle)) = 0; // set the count of strings in the STR# resource - - // mark it as changed - ChangedResource(aHandle); - ::HSetState(aHandle, flags); - } - } -} // CStringListRsrc::ClearAll - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::CountStrings: -//---------------------------------------------------------------------------------------- - -short CStringListRsrc::CountStrings() const -{ - // return the leading integer in the STR# resource: - // - // type 'STR#' { - // integer = $$Countof(StringArray); - // array StringArray { - // pstring; - // }; - // }; - - Handle aHandle = Get1Resource('STR#', fStrListID); - if (aHandle) - { - if (!*aHandle) - ::LoadResource(aHandle); - - if (*aHandle) - return **((IntegerHandle) aHandle); - } - return 0; -} // CStringListRsrc::CountStrings - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::GetListName: -//---------------------------------------------------------------------------------------- - -void CStringListRsrc::GetListName(CStr255& theString) -{ - // Do we have the name in our field? - if ( fStrListRsrcName.Length () > 0 ) - theString = fStrListRsrcName; - else // We don't have the name so try and get it from the resource - { - short itsRsrcID; - CStr255 itsName; - ResType itsType; - - // Get the resource's handle - Handle aHandle = Get1Resource('STR#', fStrListID); - if (aHandle) - { - // Extract the resource info from the handle - GetResInfo ( aHandle, &itsRsrcID, &itsType, itsName ); - if ( itsName.Length () > 0 ) - { - theString = itsName; - - // Store the name in our field - fStrListRsrcName = theString; - } - - ReleaseResource ( aHandle ); - } - else // Sorry we don't have anything so return an empty CString - theString = CStr255::sEmptyString; - - } -} // CStringListRsrc::GetListName - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::RemoveAt: -//---------------------------------------------------------------------------------------- - -void CStringListRsrc::RemoveAt(short index) -{ - if ((index > 0) && (index <= this->CountStrings())) - { - Handle aHandle = Get1Resource('STR#', fStrListID); - if (aHandle) - { - if (!*aHandle) - ::LoadResource(aHandle); - - if (*aHandle) - { - SInt8 flags = ::HGetState(aHandle); - ::HNoPurge(aHandle); - - Size originalSize = GetHandleSize(aHandle); - - // determine the accumulated size - Size accumulatedSize = sizeof(short); // the accumulated size is the size of the count - for (short i = 1; i < index; ++i) - accumulatedSize += (*((CStringPtr) (*aHandle + accumulatedSize))).Length() + kLengthByte; - - // determine the actual CString size - Size stringSize = (*((CStringPtr) (*aHandle + accumulatedSize))).Length() + kLengthByte; - - // move the the data in the handle - BlockMoveData(*aHandle + accumulatedSize + stringSize, *aHandle + accumulatedSize, - originalSize - accumulatedSize - stringSize); - - // trim the handle down to its new size - SetHandleSize(aHandle, originalSize - stringSize); - - // decrement count of strings in STR# resource - --(**((IntegerHandle) aHandle)); - - // mark it as changed - ChangedResource(aHandle); - - ::HSetState(aHandle, flags); - } -#if qDebugMsg - else - fprintf(stderr, "CStringListRsrc::RemoveAt can't load STR# = %d.\n", fStrListID); -#endif - } -#if qDebugMsg - else - fprintf(stderr, "CStringListRsrc::RemoveAt can't find STR# = %d.\n", fStrListID); -#endif - } -#if qDebugMsg - else - fprintf(stderr, "CStringListRsrc::RemoveAt there's no CString at %d to remove!\n", index); -#endif -} // CStringListRsrc::RemoveAt - -//---------------------------------------------------------------------------------------- -// CStringListRsrc::ReplaceAt: -//---------------------------------------------------------------------------------------- - -void CStringListRsrc::ReplaceAt(const CStr255& theString, short index) -{ - if ((index > 0) && (index <= this->CountStrings())) - { - Handle aHandle = Get1Resource('STR#', fStrListID); - if (aHandle) - { - if (!*aHandle) - ::LoadResource(aHandle); - - if (*aHandle) - { - SInt8 flags = ::HGetState(aHandle); - ::HNoPurge(aHandle); - - Size newStringSize = theString.Length() + kLengthByte; // the actual CString size - Size originalSize = GetHandleSize(aHandle); - - // determine the accumulated size of the valid portion of the resource - Size accumulatedSize = sizeof(short); // the accumulated size is the size of the count - for (short i = 1; i < index; ++i) - accumulatedSize += (*((CStringPtr) (*aHandle + accumulatedSize))).Length() + kLengthByte; - - // determine the actual CString size - Size oldStringSize = (*((CStringPtr) (*aHandle + accumulatedSize))).Length() + kLengthByte; - - // determine the new handle size - Size newHandleSize = originalSize + (newStringSize - oldStringSize); - - // determine whether to grow or shrink the handle? - if (newStringSize > oldStringSize) - { - // grow the handle - SetHandleSize(aHandle, newHandleSize); - - // move the bytes - BlockMoveData(*aHandle + accumulatedSize + oldStringSize, *aHandle + accumulatedSize + newStringSize, - originalSize - accumulatedSize - oldStringSize); - } - else if (oldStringSize > newStringSize) - { - // move the bytes - BlockMoveData(*aHandle + accumulatedSize + oldStringSize, *aHandle + accumulatedSize + newStringSize, - originalSize - accumulatedSize - oldStringSize); - - // shrink the handle - SetHandleSize(aHandle, newHandleSize); - } - - // assign the CString - *((CStr255*) (*aHandle + accumulatedSize)) = theString; - - // mark it as changed - ChangedResource(aHandle); - - ::HSetState(aHandle, flags); - } -#if qDebugMsg - else - fprintf(stderr, "CStringListRsrc::ReplaceAt can't load STR# = %d.\n", fStrListID); -#endif - } -#if qDebugMsg - else - fprintf(stderr, "CStringListRsrc::ReplaceAt can't find STR# = %d.\n", fStrListID); -#endif - } -#if qDebugMsg - else - fprintf(stderr, "CStringListRsrc::ReplaceAt there's no CString at %d to replace!\n", index); -#endif -} // CStringListRsrc::ReplaceAt - - - - -StWatchCursor::StWatchCursor() { ::SetCursor( (CursPtr)*(::GetCursor(watchCursor)) ); } -StWatchCursor::~StWatchCursor() { ::SetCursor( &(UQDGlobals::GetQDGlobals()->arrow) ); } - -//----------------------------------- -void StringParamText( - CStr255& ioFormatString, - SInt32 inReplaceNumber0, - SInt32 inReplaceNumber1, - SInt32 inReplaceNumber2, - SInt32 inReplaceNumber3) -// Replace the characters "^0" ..."^3"within ioString with numerals. -// If "^0" or "^1" is not found in ioString, the method does nothing. -//----------------------------------- -{ - char t0[15], t1[15], t2[15], t3[15]; - sprintf(t0, "%ld", inReplaceNumber0); - sprintf(t1, "%ld", inReplaceNumber1); - sprintf(t2, "%ld", inReplaceNumber2); - sprintf(t3, "%ld", inReplaceNumber3); - ::StringParamText(ioFormatString, t0, t1, t2, t3); -} - -//----------------------------------- -void StringParamText( - CStr255& ioFormatString, - const char* inReplaceText0, - const char* inReplaceText1, - const char* inReplaceText2, - const char* inReplaceText3) -// Replace the substrings "^0" ..."^3" within ioString with inReplaceText0 ... inReplaceText3. -// (substring is just removed if inReplaceTextn is null). -// If any of the substrings "^0"..."^3" is not found in ioString, nothing happens there. -//----------------------------------- -{ - LStr255 resultString = (ConstStringPtr)&ioFormatString; - char target[] = "^0"; - const char* replaceString[] = { - inReplaceText0, - inReplaceText1, - inReplaceText2, - inReplaceText3 }; - for (int i = 0; i < 4; i++) - { - UInt8 position = resultString.Find(target, 1); - if ( position ) - { - const char* rs = replaceString[i]; - if ( rs ) - resultString.Replace(position, 2, rs, strlen(rs)); - else - resultString.Remove(position, 2); - } - target[1]++; // morph it into "^1" etc. ASCII standard supports this. - } - ioFormatString = (ConstStringPtr)resultString; -} - -// This code is taken from June 97 Dev.CD -enum -{ - kPromisedFlavor = 'fssP', - kPromisedFlavorFindFile = 'rWm1' -}; - -static Size MinimumBytesForFSSpec (const FSSpec *fss) -{ - // - // Some senders don't bother sending the unused bytes of the - // file name. This function helps make sure the FSSpec is - // minimally sane by computing the minimum number of bytes it - // would take to store it. - // - // THIS FUNCTION CANNOT MOVE MEMORY. - // - - return sizeof (*fss) - sizeof (fss->name) + *(fss->name) + 1; -} - -OSErr GetHFSFlavorFromPromise - (DragReference dragRef, ItemReference itemRef, - HFSFlavor *hfs, Boolean isSupposedlyFromFindFile) -{ - OSErr err = noErr; - PromiseHFSFlavor phfs; - Size size = sizeof (phfs); - - err = GetFlavorData - (dragRef,itemRef,flavorTypePromiseHFS,&phfs,&size,0); - - if (!err) - { - if (size != sizeof (phfs)) - err = cantGetFlavorErr; - else - { - Boolean isFromFindFile = - phfs.promisedFlavor == kPromisedFlavorFindFile; - - if (isSupposedlyFromFindFile != isFromFindFile) - err = paramErr; - else - { - size = sizeof (hfs->fileSpec); - err = GetFlavorData - (dragRef,itemRef,phfs.promisedFlavor, - &(hfs->fileSpec),&size,0); - - if (!err) - { - Size minSize = MinimumBytesForFSSpec - (&(hfs->fileSpec)); - - if (size < minSize) - err = cantGetFlavorErr; - else - { - hfs->fileType = phfs.fileType; - hfs->fileCreator = phfs.fileCreator; - hfs->fdFlags = phfs.fdFlags; - } - } - } - } - } - return err; -} -// End of cut and paste - - -StSpinningBeachBallCursor::StSpinningBeachBallCursor () -{ - startAsyncCursors(); -} - -StSpinningBeachBallCursor::~StSpinningBeachBallCursor() -{ - stopAsyncCursors(); -} diff --git a/mozilla/cmd/macfe/gui/macutil.h b/mozilla/cmd/macfe/gui/macutil.h deleted file mode 100644 index 16a6432903f..00000000000 --- a/mozilla/cmd/macfe/gui/macutil.h +++ /dev/null @@ -1,487 +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. - */ - -/* - Random Utilities -*/ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include "PascalString.h" -#include "CWindowMediator.h" -#ifndef MOZ_NGLAYOUT -//#include "CSimpleTextView.h" -#endif - -class LTextEngine; -class LStdPopupMenu; -class LWindow; - -#define MOUSE_HYSTERESIS 6 -#define MOUSE_DRAGGING 1 -#define MOUSE_TIMEOUT 2 -#define MOUSE_UP_EARLY 3 - -typedef struct LO_ImageStruct_struct LO_ImageStruct; -typedef union LO_Element_struct LO_Element; -typedef struct lo_FormElementSelectData_struct lo_FormElementSelectData; - -// Layout Utilities - -Boolean TooDifferent( const Point& a, const Point& b ); - -short WaitForMouseAction( const Point& initial, long clickStart, long delay ); - -SPoint32 LocalToImagePoint( LView* view, const Point& local ); - -void RevealInImage( LView* view, SPoint32 selTopLeft, SPoint32 selBotRight ); - -int CalcCurrentSelected( lo_FormElementSelectData* selectData, Boolean fromDefaults ); - -// Utilities - -void DrawBorder( const Rect& frame, Boolean topleft, int size ); - -Rect CenterInRect( Point thing, Rect destSpace ); - -/*----------------------------------------------------------------------------- - Panes/Views Coordinate Translation ------------------------------------------------------------------------------*/ -inline Rect PortToLocalRect( LView* view, const Rect& portRect ) -{ - Rect localRect; - localRect = portRect; - view->PortToLocalPoint( topLeft( localRect ) ); - view->PortToLocalPoint( botRight( localRect ) ); - return localRect; -} - -inline Rect LocalToPortRect( LPane* self, const Rect& localRect ) -{ - Rect portRect; - portRect = localRect; - self->LocalToPortPoint( topLeft( portRect ) ); - self->LocalToPortPoint( botRight( portRect ) ); - return portRect; -} - -inline Rect PortToGlobalRect( LPane* self, const Rect& portRect ) -{ - Rect globalRect; - globalRect = portRect; - self->PortToGlobalPoint( topLeft( globalRect ) ); - self->PortToGlobalPoint( botRight( globalRect ) ); - return globalRect; -} - -inline Rect GlobalToPortRect( LPane* self, const Rect& globalRect ) -{ - Rect portRect; - portRect = globalRect; - self->GlobalToPortPoint( topLeft( portRect ) ); - self->GlobalToPortPoint( botRight( portRect ) ); - return portRect; -} - -void StringParamText(CStr255& ioFormatString, // containing ^0, ^1, etc - const char* ioReplaceText0, - const char* inReplaceText1 = nil, - const char* inReplaceText2 = nil, - const char* inReplaceText3 = nil - ); - -void StringParamText(CStr255& ioFormatString, - SInt32 inReplaceNumber0, - SInt32 inReplaceNumber1, - SInt32 inReplaceNumber2, - SInt32 inReplaceNumber3 - ); // as above, but calls ::NumToString on the parameters first. - -/*----------------------------------------------------------------------------- - String Copying - - CopyString will copy strings. The format is (destination, source) which is - backwards from the way many functions have it but happens to be the same - order as operator= does it. IE since most copies look like this... - foo = bar - ...I wanted the string assignment/copy to look the same. - CopyString (foo, bar) - Also it makes converting between CString-using and Str255-using code easy. - - This stuff is overloaded for all pascal/c combinations. ------------------------------------------------------------------------------*/ -const short kCommandKey = 55; -const short kCtlKey = 0x3B; -const short kOptionKey = 58; -const short kShiftKey = 56; - -unsigned char* CopyString( unsigned char* destination, const unsigned char* source ); -unsigned char* CopyString( unsigned char* destination, const char* source ); -char* CopyString( char* destination, const unsigned char* source ); -char* CopyString( char* destination, const char* source ); - -// ¥ also frees the original if not NULL -void CopyAlloc( char** destination, StringPtr source ); - -// ¥Êtakes colons out of a string, useful for saving files -void StripColons( CStr31& fileName ); - -// ¥Êstrips the given character from a string; if it -// appears twice in a row the second char isn't removed -void StripChar( CStr255& str, char ch ); - -// ¥ Takes a string of text (dragged/pasted), and turns -// it into a URL (strips CR, whitespace preceeding/trailing <> -void CleanUpTextToURL(char* text); - -// ¥ strips spaces & returns at end of url (happens often -void CleanUpLocationString( CStr255& url ); - -// ¥ TRUE if the key is down. Bypasses the event loop -Boolean IsThisKeyDown( const UInt8 theKey ); - -// ¥ CmdPeriod - returns true if cmd-. is pressed -Boolean CmdPeriod(); - -// ¥Êenable/disable pane and refresh it -void SetEnable( LPane* button, Boolean enable ); - -// ¥ changes the string to something acceptable to mac menu manager -void CreateMenuString( CStr255& itemName ); - -// ¥ converts TextEdit handle to text handle that has hard carriage returns. -#ifndef MOZ_NGLAYOUT -class CSimpleTextView; -Handle TextHandleToHardLineBreaks(CSimpleTextView &inTextView); -#endif - -// ¥Êsets the number of entries in popup to be shouldBe -void SetMenuSize( LStdPopupMenu* popup, short shouldBe ); -void SetMenuSizeForLGAPopup( LGAPopup* popup, short shouldBe ); - -void SetMenuItem( CommandT whichItem, Boolean toState ); -// ¥Êconstrain value to be between min and max -void ConstrainTo( const long& min, const long& max, long& value ); - -// ¥ makes copy of the struct. Throws on failure -void * StructCopy(const void * struc, UInt32 size); - -// ¥ return the free space available on the volume referenced by vRefNum in bytes -unsigned long GetFreeSpaceInBytes( short vRefNum ); - -// ¥Êsets the std poup to the named item -Boolean SetPopupToNamedItem( LStdPopupMenu* whichMenu, const CStr255& itemText ); -Boolean SetLGAPopupToNamedItem( LGAPopup* whichMenu, const CStr255& itemText ); - -// ¥ -void TurnOn( LControl* control ); - -// ¥ -void myStringToNum( const CStr255& inString, Int32* outNum ); - -// ¥Êsets the captions descriptor to newText -void SetCaptionDescriptor( LCaption* captionToSet, const CStr255& newText, - const TruncCode truncWhere ); - -// ¥ get the descriptor as char * -char* GetPaneDescriptor( LPane* pane ); - -// ¥ Use to display the NetHelp window, given the appropriate help topic -void ShowHelp ( const char* inHelpTopic ); - -// ¥ force the window onto the desktop -void ForceWindowOnScreen( LWindow* window ); - -// ¥ grow the window to the height of the screen it is on -void GrowWindowToScreenHeight( LWindow* win ); - -// ¥Êwill all of the window be visible? -Boolean WillBeVisible( const Rect& windowRect ); - -// ¥ stagger the window -void StaggerWindow( LWindow* win ); - -// ¥ is the window fully on a single device? -GDHandle WindowOnSingleDevice( LWindow* win ); - -// ¥ Saving/restoring of the window's default state. -Boolean RestoreDefaultWindowState( LWindow* win ); -void StoreDefaultWindowState( LWindow* win ); - -// ¥ Is front window modal? Used for command enabling -Boolean IsFrontWindowModal(); - -// ¥ÊFetch a window title resource and fill in the current profile name -void GetUserWindowTitle(short id, CStr255& title); - -// ¥Êreturns the number of pixels (which is inPoints / 120 * iRes) -short PointsToPixels( short inPoints, short iRes ); - -// ¥ returns true if we are the front application -Boolean IsFrontApplication(); - -// Makes Netscape the frontmost application -void MakeFrontApplication(); - -void FrameSubpaneSubtle( LView* view, LPane* pane ); - -// ¥Êgets the are of window occupied by pane as a rgn -void GetSubpaneRgn( LView* view, LPane* pane, RgnHandle rgn ); - -void GetSubpaneRect( LView* view, LPane* pane, Rect& frame ); - -void WriteVersionTag( LStream* stream, Int32 version ); - -Boolean ReadVersionTag( LStream* stream, Int32 version ); - -// ¥ tries to set a cursor -void TrySetCursor( int whichCursor ); - -void StripNewline( CStr255& msg ); -void StripDoubleCRs( CStr255& msg ); -// ¥ Converts LF to CR in strings (used to cleanup Netlib stuff). Returns the number of conversions -int ConvertCRtoLF( CStr255& msg ); - -// ¥ Gets font info in a safe way -void SafeGetFontInfo(ResIDT textTraits, FontInfo &outFontInfo); - -void DrawAntsRect( Rect&r, short mode ); -void RectFromTwoPoints( Point p1, Point p2, Rect &outRect); -Boolean RectInRect(const Rect *inCheckRect, const Rect *inEnclosingRect); - -void GetDateTimeString( CStr255& dateTime ); - -void FrameButton( const Rect& box, Boolean pushed ); -void HiliteRect( const Rect& r ); -void HiliteRgn( const RgnHandle& r ); -LPane* FindPaneHitBy( const Point& globalMouse ); - - -// Good 'ol Mac File Utilities -#if 0 -StringPtr PathnameFromWD (short VRef, StringPtr s); -StringPtr PathnameFromDirID (long DirID, short VRef, StringPtr s); -#endif - -char* PathURLFromProcessSignature (OSType sig, OSType type); - -// This code is taken from June 97 Dev.CD -OSErr GetHFSFlavorFromPromise - (DragReference dragRef, ItemReference itemRef, - HFSFlavor *hfs, Boolean isSupposedlyFromFindFile); - -// ¥ given a process signature, gets its serial number -ProcessSerialNumber GetPSNBySig( OSType sig ); -// ¥ creates an NoProcess serial number -ProcessSerialNumber MakeNoProcessPSN(); -// ¥ do we have a process -Boolean HasProcess( const ProcessSerialNumber& psn ); -// ¥ given an application signature, finds the process if it is running. From MacApp -OSErr FindProcessBySignature( OSType sig, OSType processType, - ProcessSerialNumber& psn, FSSpec* fileSpec ); -// ¥ creates an apple event -OSErr CreateAppleEvent( OSType suite, OSType id, AppleEvent &event, ProcessSerialNumber targetPSN ); -// ¥ do we have an error reply in this event (noErr means that there is no error) -OSErr EventHasErrorReply( AppleEvent& event ); -// Drag'n'drop - -// finds where the file goes in drag to Finder -OSErr GetDropLocationDirectory (AEDesc *dropLocation, long *directoryID, short *volumeID); -// Did we drag to the trash -Boolean DragTargetWasTrash (DragReference dragRef); - -#define mTopHalf 1 -#define mBottomHalf 2 -#define mArrowsPict -4047 -#define mArrowsTopLit -4046 -#define mArrowsBotLit -4045 -class LArrowControl: public LControl -{ -public: - LArrowControl( const SPaneInfo& inPaneInfo, MessageT valueMessage ); - void HotSpotAction( Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside ); - void HiliteControl( Int16 inHotSpot, Boolean inCurrInside ); - Boolean PointInHotSpot( Point inPoint, Int16 inHotSpot ) const; - Int16 FindHotSpot( Point inPoint ) const; - void HotSpotResult( Int16 inHotSpot ); - - void DrawSelf(); -protected: - Int16 mCurrPict; - static long fLastTicks; - static long fDelay; - static long fHits; -}; - -#if 0 -/****************************************************************************** - * class CWindowIterator. - * Iterates over all the windows - *****************************************************************************/ -class CWindowIterator -{ -public: - CWindowIterator( OSType sig ); // If '****', iterates over all windows - - Boolean Next( LWindow*& outWindow ); -protected: - virtual Boolean DoThisWindow( const LWindow* window ); - - WindowPtr fNextWindow; - OSType fSig; -}; - -class CHyperWin; - -/****************************************************************************** - * class CHyperIterator. - * Legacy class that iterates over all the hyperwindows - *****************************************************************************/ -class CHyperIterator: public CWindowIterator -{ -public: - CHyperIterator(); - - Boolean Next( CHyperWin*& outWindow ); -}; - -class CHyperMailNewsIterator: public CHyperIterator -{ -public: - CHyperMailNewsIterator(); -protected: - virtual Boolean DoThisWindow( const LWindow* window ); -}; - -#endif - -//---------------------------------------------------------------------------------------- -// CStringListRsrc: A simple class for managing and accessing strings in STR# resources. -// -// Limitations: this class has no notion of which resource file to be used for accessing -// the strings from the CString list resource. This could be added as an enhancement. -//---------------------------------------------------------------------------------------- - -class CStringListRsrc { - -protected: - short fStrListID; // The ID of the STR# rsrc. - - CStr255 fStrListRsrcName; // The name of the STR# rsrc, this is - // only used when adding the STR# rsrc. - -public: - //---------------------------------------------------------------------------------------- - // class-scoped constants - //---------------------------------------------------------------------------------------- - enum { kDontAddString, kAddString }; - - //---------------------------------------------------------------------------------------- - // constructors - //---------------------------------------------------------------------------------------- - CStringListRsrc(short strListID, const CStr255& strListRsrcName) : - fStrListID(strListID), - fStrListRsrcName(strListRsrcName) - {} - // inline constructor - - CStringListRsrc(short strListID) : - fStrListID(strListID) - { fStrListRsrcName = CStr255::sEmptyString; } - // inline constructor - - //---------------------------------------------------------------------------------------- - // accessors - //---------------------------------------------------------------------------------------- - short AppendString(const CStr255& theString); - // append theString to the STR# resource whose id is fStrListID and return its index - - void ClearAll(); - // clears all strings in the STR# resource - - short CountStrings() const; - // returns the number of strings in the STR# resource whose id is fStrListID - - short FindString(const CStr255& theString, Boolean addString = kDontAddString); - // find theString in the STR# resource whose id is fStrListID and return its index - // if theString is not found in the STR# resource, add it if addString is kAddString - - void GetListName(CStr255& itsName); - // Returns the name of the STR# list either from its field or if that is empty - // from the actual resource - - void GetString(short index, CStr255& theString) const; - // return in theString the "index" CString in the STR# resource whose id is fStrListID - - void RemoveAt(short index); - // removes the CString at the specified index. - - void ReplaceAt(const CStr255& theString, short index); - // replace the CString at "index" with "theString" -}; - -/*----------------------------------------------------------------------------- - StOpenResFile opens the resource fork and closes it later ------------------------------------------------------------------------------*/ - -class StOpenResFile -{ -public: - StOpenResFile( LFile* file, short perms ); - ~StOpenResFile (); - operator short () { return fFile->GetResourceForkRefNum(); } -protected: - LFile* fFile; -}; - -/*----------------------------------------------------------------------------- - StUseResFile uses an open resource fork and stops using it later. ------------------------------------------------------------------------------*/ - -class StUseResFile -{ -public: - StUseResFile( short refnum ); - ~StUseResFile(); -protected: - short fPrevResFile; -}; - - - -/* sets to watch on construction, sets to arrow on destruction */ -class StWatchCursor -{ -public: - StWatchCursor(); - ~StWatchCursor(); -}; - -/* sets to beachball on construction, spin asynchronously, sets to arrow on destruction */ -class StSpinningBeachBallCursor -{ -public: - StSpinningBeachBallCursor(); - ~StSpinningBeachBallCursor(); -}; diff --git a/mozilla/cmd/macfe/gui/opaque_ptr.h b/mozilla/cmd/macfe/gui/opaque_ptr.h deleted file mode 100644 index 4a95d6c322f..00000000000 --- a/mozilla/cmd/macfe/gui/opaque_ptr.h +++ /dev/null @@ -1,41 +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. - */ - -#pragma once - -template -class opaque_ptr - { - friend bool operator==( const opaque_ptr&, const opaque_ptr& ); - - public: - opaque_ptr( const T* ptr = 0 ) : _ptr(ptr) { } - // Note: _not_ |explicit| - - private: - const T* _ptr; - }; - -template -inline -bool -operator==( const opaque_ptr& L, const opaque_ptr& R ) - { - return L._ptr == R._ptr; - } - diff --git a/mozilla/cmd/macfe/gui/own_ptr.h b/mozilla/cmd/macfe/gui/own_ptr.h deleted file mode 100644 index 0ced2fa7a12..00000000000 --- a/mozilla/cmd/macfe/gui/own_ptr.h +++ /dev/null @@ -1,113 +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. - */ - -#pragma once - -template -class own_ptr - /* - ...implements strict ownership model (as |auto_ptr| once did, before it was ruined). - */ - { - public: - - explicit - own_ptr( T* ptr = 0 ) - : _ptr(ptr) - { - // nothing else to do - } - - own_ptr( own_ptr& P ) - : _ptr( P.release() ) - { - // nothing else to do - } - - ~own_ptr() - { - delete _ptr; - } - - - own_ptr& - operator=( T* P ) - { - if ( _ptr != P ) - { - delete _ptr; - _ptr = P; - } - return *this; - } - - own_ptr& - operator=( own_ptr& P ) - { - return operator=( P.release() ); // (also) handles the self-assignment case - } - - T& - operator*() const - { - // PRECONDITION( _ptr ); - -//#if !defined(__NO_bad_dereference__) -// if ( !_ptr ) -// throw bad_dereference(); -//#endif - return *_ptr; - } - - T* - operator->() const - { - // PRECONDITION( _ptr ); - -//#if !defined(__NO_bad_dereference__) -// if ( !_ptr ) -// throw bad_dereference(); -//#endif - return _ptr; - } - - T* - get() const - { - return _ptr; - } - - T* - release() - { - T* P = _ptr; - _ptr = 0; - return P; - } - - bool - is_void() const - { - return _ptr == 0; - } - - - - private: - T* _ptr; - }; diff --git a/mozilla/cmd/macfe/include/NetscapeDragFlavors.h b/mozilla/cmd/macfe/include/NetscapeDragFlavors.h deleted file mode 100644 index 29add906395..00000000000 --- a/mozilla/cmd/macfe/include/NetscapeDragFlavors.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -#pragma once - -enum -{ - -/* browser */ - - -/* bookmarks */ - - - -/* mail & news */ - - kMailNewsSelectionDragFlavor = 'SELN', - - -/* address book */ - - kMailAddresseeFlavor = 'MAdr' // Single or multiple people or lists -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/include/Netscape_Constants.h b/mozilla/cmd/macfe/include/Netscape_Constants.h deleted file mode 100644 index 7707a9b1163..00000000000 --- a/mozilla/cmd/macfe/include/Netscape_Constants.h +++ /dev/null @@ -1,178 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Browser_Constants.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#pragma once - -#include // for MBAR_Initial - -// MenuBar MBAR ResIDT's -const ResIDT cBrowserMenubar = MBAR_Initial; -const ResIDT cEditorMenubar = 129; -const ResIDT cComposeMenubar = 132; -const ResIDT cBookmarksMenubar = 133; -const ResIDT cMinimalMenubar = 135; - -// Menu ResIDT's -//const ResIDT cDirectoryMenuID = 10; - -// WARNING: All other hierarchical menu IDs must be below 75 -// or bad things will happen! - -// Set aside 10 menu IDs for the Editor plugins hierarchical menus. -const ResIDT cEditorPluginsFirstHierMenuID = 75; -const ResIDT cEditorPluginsLastHierMenuID = 84; - -// Set aside 150 menu IDs for the Bookmarks hierarchical menus. -// (That's 85 to 235 inclusive minus menu ID 128 for the "Apple" menu.) -const ResIDT cBookmarksFirstHierMenuID = 85; -const ResIDT cBookmarksLastHierMenuID = 235; - -// Reserve this range for bookmark menus -const CommandT BOOKMARKS_MENU_BASE = 3050; -const CommandT BOOKMARKS_MENU_BASE_LAST = 3999; - -const ResIDT cHistoryMenuID = 303; -const ResIDT cBookmarksMenuID = 304; -const ResIDT cWindowMenuID = 305; -const ResIDT cToolsMenuID = 405; -const ResIDT cFontMenuID = 13; - -// Browser mediated window types -typedef enum { - WindowType_Browser = 'Brwz', - WindowType_Download = 'Down', - WindowType_NavCenter = 'NavW', - WindowType_Editor = 'Edit', - WindowType_Compose = 'Comp', - WindowType_Progress = 'Prog', - WindowType_NameCompletion = 'NmPk', - WindowType_OfflinePicker = 'OfPk' -} NetscapeWindowT; - -// Browser File Menu cmd id's -const CommandT cmd_OpenURL = 1032; - -// Browser Toolbar Button cmd id's -const CommandT cmd_GoForward = 1005; -const CommandT cmd_GoBack = 1006; -const CommandT cmd_Home = 1009; -const CommandT cmd_Stop = 1016; -const CommandT cmd_NetSearch = 1080; // load a search page -const CommandT cmd_ToolbarButton = 'Tlbr'; // a container or url button, always enabled. -const CommandT cmd_Reload = 1004; // Reload the URL in the top window - -// other cmd id's -const CommandT cmd_PageServices = 1195; - -// -// NavCenter XP menu commands. -// -// These constants can be computed by doing -// cmd_NavCenterBase + (corresponding HT command) -// but since we need to know the exact command number to put in constructor, I think -// it's clearer to just hardcode the constants in this file. -// -// To get the HT command back from the corresponding command id, just subtract off -// cmd_NavCenterBase. -// -const CommandT cmd_NavCenterBase = 5000; - -const CommandT cmd_NCOpen = 5001; -const CommandT cmd_NCOpenFile = 5002; -const CommandT cmd_NCPrint = 5003; -const CommandT cmd_NCOpenNewWindow = 5004; -const CommandT cmd_NCOpenComposer = 5005; -const CommandT cmd_NCOpenAsWorkspace = 5006; -const CommandT cmd_NCNewItem = 5007; -const CommandT cmd_NCNewFolder = 5008; -const CommandT cmd_NCNewSeparator = 5009; -const CommandT cmd_NCMakeAlias = 5010; -const CommandT cmd_NCAddToBookmarks = 5011; -const CommandT cmd_NCSaveAs = 5012; -const CommandT cmd_NCCreateShortcut = 5013; -const CommandT cmd_NCSetToolbarFolder = 5014; -const CommandT cmd_NCSetBMMenu = 5015; -const CommandT cmd_NCSetNewBMFolder = 5016; -const CommandT cmd_NCCut = 5017; -const CommandT cmd_NCCopy = 5018; -const CommandT cmd_NCPaste = 5019; -const CommandT cmd_NCDeleteFile = 5020; -const CommandT cmd_NCDeleteFolder = 5021; -const CommandT cmd_NCRevealInFinder = 5022; -const CommandT cmd_NCGetInfo = 5023; -const CommandT cmd_NCCopyLinkLocation = 5024; -const CommandT cmd_NCNewPane = 5025; -const CommandT cmd_NCRenamePane = 5026; -const CommandT cmd_NCDeletePane = 5027; -const CommandT cmd_NCFind = 5050; // find in workspace - -const CommandT cmd_NavCenterCap = 5099; - -const CommandT cmd_AddToBookmarks = 'AddB'; -const CommandT cmd_SortBookmarks = 'SrtB'; - -const CommandT cmd_AboutPlugins = 1191; -const CommandT cmd_LaunchImportModule = 1063; -const CommandT cmd_MailDocument = 1190; // Send Page/Frame -const CommandT cmd_ReloadFrame = 1192; -const CommandT cmd_FTPUpload = 1193; -const CommandT cmd_SecurityInfo = 1194; -const CommandT cmd_GetInfo = 'Info'; -const CommandT cmd_OpenSelectionNewWindow = 1161; // probably not needed -const CommandT cmd_OpenSelection = 1166 ; // probably not needed - -const MessageT msg_SigFile = 430; -const MessageT msg_Browse = 1200; -const MessageT msg_FolderChanged = 1201; -const MessageT msg_ClearDiskCache = 1202; - -const MessageT msg_Help = 'help'; // help button clicked -const MessageT msg_SubmitText = 'subT'; // Return hit in edit field, 'this' is ioParam -const MessageT msg_SubmitButton = 'subB'; // Submit button pressed -const MessageT msg_ResetButton = 'Rset'; // Form reset button pressed - -const MessageT msg_ChangeFontSize = -15381; - - -// Clicks -enum EClickKind { - eWaiting, // Uninitialized - eNone, // No anchors - eTextAnchor, // Plain text anchor - eImageAnchor, // Image that is a simple anchor - eImageIsmap, // Image that is ISMAP - eImageForm, // Image that is an ISMAP form - eImageIcon, // Image that is an icon (delayed) - eImageAltText, // Alt text part of the image - eEdge // Edge -}; - -enum EClickState { - eMouseUndefined = 0, - eMouseDragging = 1, - eMouseTimeout, - eMouseUpEarly, - eMouseHandledByAttachment, - eMouseWasCommandClick -}; - -const Int16 kMouseHysteresis = 6; diff --git a/mozilla/cmd/macfe/include/exception_codes.h b/mozilla/cmd/macfe/include/exception_codes.h deleted file mode 100644 index 3f2f141617c..00000000000 --- a/mozilla/cmd/macfe/include/exception_codes.h +++ /dev/null @@ -1,83 +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. - */ - -////////////////////////////////////////////////////////////////////////// -// -// exception_codes.h -// -// -// -////////////////////////////////////////////////////////////////////////// -// -// This file contains several enums to be used as codes for exceptions. -// This enums should be always synched with the resource file containing -// exception strings (i.e. for every enum there should be a corresponding -// and appropiate string in the resource file ). The file containing the -// exception string resources is "exception_str.r". -// -// For easier usage every enum should be followed by a comment. -// -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// mail/news codes - -#define genericExStringsID 800 // resource containing the generic exception strings - -enum GenericCode -{ - eDeafult = 1, // generic default exception - eUIResourceError = 2 // this error is thrown when either a UI resource is missing - // or is being casted to the wrong type. The user should - // never see this. - - - -}; - -////////////////////////////////////////////////////////////////////////// -// browser codes - -#define browserExStringsID 802 // resource containing the mail exception strings - -enum BrowserCode -{ - eBowserDeafult = 1 // default exception for the browser - - - - - -}; - -////////////////////////////////////////////////////////////////////////// -// mail/news codes - -#define mailExStringsID 801 // resource containing the browser exception strings - -enum MailCode -{ - eMailDeafult = 1, // default exception for news/mail - eMissingPreference = 2, // missing preference - eMoveMessageError = 1 // BE error while moving a message. Currently - // I am redefining as a default message. This might change - - - - -}; diff --git a/mozilla/cmd/macfe/include/mversion.h b/mozilla/cmd/macfe/include/mversion.h deleted file mode 100644 index 8e991e63735..00000000000 --- a/mozilla/cmd/macfe/include/mversion.h +++ /dev/null @@ -1,43 +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 __VERSION__ -#define __VERSION__ - -/*----------------------------------------------------------------------------- - Finder Strings -* GETINFO_DESC shows up under the application's name in Get Info -* GETINFO_VERSION shows up in Get Info by "Version:". It is standard - to have the version and then copyright line. ------------------------------------------------------------------------------*/ - -#define ID_STRINGS 210 -#define APPNAME_STRING_INDEX 1 /* "Netscape" */ -#define APPVERSION_STRING_INDEX 2 /* "1.1" */ -#define APPCODENAME_STRING_INDEX 3 /* "Mozilla" */ -#define USERAGENT_68K_STRING_INDEX 4 /* "(Macintosh, %s, 68K)" */ -#define USERAGENT_PPC_STRING_INDEX 5 /* "(Macintosh, %s, PPC)" */ -#define APPLANGUAGE_STRING_INDEX 6 /* "EN" */ -/*----------------------------------------------------------------------------- - Preferences ------------------------------------------------------------------------------*/ -#define PREFS_FOLDER_NAME "Navigator Ä" -#define PREFS_FILE_NAME "Navigator Preferences" - - -#endif diff --git a/mozilla/cmd/macfe/include/resae.h b/mozilla/cmd/macfe/include/resae.h deleted file mode 100644 index fd95e7b6e7d..00000000000 --- a/mozilla/cmd/macfe/include/resae.h +++ /dev/null @@ -1,531 +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. - */ - -/*--------------------------------------------------------------------------*/ -/* ---- Resource and Command Code Base IDs ---- */ -/*--------------------------------------------------------------------------*/ - -// ---- Base Values for Apple Event Command sets -//---------------------------------------------------------------------------------------- - -#define kSpyGlass_CmdBase 5000 // Base value for SpyGlass commands -#define kURLSuite_CmdBase 5100 // Base value for URL commands - -// ---- aedt Resource IDs used to associate Commands with Event Suite and ID pairs -//---------------------------------------------------------------------------------------- - -enum { - kRequired_aedtResID = 128, // Resource ID for Required suite's aedt resource - kCore_aedtResID, // Resource ID for Core suite's aedt resource - kMisc_aedtResID, // Resource ID for Misc suite's aedt resource - kPowerPlant_aedtResID, // Resource ID for PowerPlant suite's aedt resource - kURLSuite_aedtResID, // Resource ID for URL suite's aedt resource - kSpyGlass_aedtResID // Resource ID for SpyGlass suite's aedt resource -}; - -/*--------------------------------------------------------------------------*/ -/* ---- Event Command Codes ---- */ -/*--------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - The Apple Events Template resource 'aedt' (found in Types.r) - is used to associate an Event Class and Event ID with a - unique integer value. These integer values are private to the - application processing the events. - - restriction: PowerPlant uses integer valuse below 4000 -----------------------------------------------------------------------------*/ - - -// ---- World Wide Web / Spyglass Suite -//---------------------------------------------------------------------------------------- -enum { - AE_OpenURL = kSpyGlass_CmdBase, // OpenURL WWW! OURL - AE_RegisterViewer, // RegisterViewer WWW! RGVW - AE_UnregisterViewer, // UnregisterViewer WWW! UNRV - AE_ShowFile, // ShowFile WWW! SHWF - AE_ParseAnchor, // ParseAnchor WWW! PRSA - AE_RegisterURLEcho, // Register URL echo WWW! RGUE - AE_UnregisterURLEcho, // Unregister URL echo WWW! UNRU - AE_SpyActivate, // Activate WWW! ACTV - AE_SpyListWindows, // ListWindows WWW! LSTW - AE_GetWindowInfo, // GetWindowInfo WWW! WNFO - AE_RegisterWinClose, // RegisterWindowClose WWW! RGWC - AE_UnregisterWinClose, // UnregisterWindowClose WWW! UNRC - AE_RegisterProtocol, // RegisterProtocol WWW! RGPR - AE_UnregisterProtocol, // UnregisterProtocol WWW! UNRP - AE_CancelProgress, // Cancel download WWW! CNCL - AE_FindURL // Find the URL for the file WWW! FURL -}; - -// ---- Netscape Experimental Suite and Macintosh URL suite -//---------------------------------------------------------------------------------------- -enum { - - AE_GetWD = kURLSuite_CmdBase // Get working directory of app MOSS WURL -, AE_OpenBookmark // Open bookmarks MOSS book -, AE_ReadHelpFile // Read help file MOSS help -, AE_Go // Go MOSS gogo -, AE_OpenProfileManager // Launch app with user profile mgr MOSS prfl -, AE_GetURL // GetURL GURL GURL -, AE_OpenAddressBook // Open Address Book MOSS addr -, AE_OpenComponent // Open a component MOSS cpnt -, AE_GetActiveProfile // Get the name of the active profile MOSS upro -, AE_HandleCommand // Handle a command ae MOSS ncmd -, AE_GetProfileImportData // Handle a request from import module MOSS Impt -}; - - -// ---- The so called Option Suite. Never implemented, left here for historical purposes -//---------------------------------------------------------------------------------------- - -#define AE_GetOption 4016 // GetOption -#define AE_SetOption 4017 // SetOption -#define AE_ListOptions 4018 // ListOptions - -// ---- These are supposed to be "Events We Send" but I don't see these constants used -//---------------------------------------------------------------------------------------- - -#define AE_ViewDocFile 4019 // ViewDocFile -#define AE_BeginProgress 4020 // Begin progress -#define AE_SetProgressRange 4021 // Set progress range -#define AE_MakingProgress 4022 // Making progress -#define AE_EndProgress 4023 // End progress -#define AE_QueryViewer 4024 // Query viewer -#define AE_URLEcho 4026 // URL echo -#define AE_WindowClose 4027 // WindowClose - - -/*---------------------------------------------------------------------------- - List of Suites, Event IDs, and (I guess) parameters for events. - This information is public and needed by any application wanting - to send Apple Events to our application. -----------------------------------------------------------------------------*/ - -/********************************************************************************* - * Netscape suite - * Event: Go - * Arguments: keyDirectObject (objectSpecifier for a window - * direction (stil in flux, currently back, forward, home, and again) - * should really be a history object - *********************************************************************************/ -// Event codes -#define AE_www_suite 'MOSS' - -#define AE_www_workingURL 'wurl' // Get working URL - -#define AE_www_go 'gogo' // keyDirectObject HWIN, direction 'dire' -// direction can be kAENext, kAEPrevious, AE_www_go_again, AE_www_go_home -#define AE_www_go_direction 'dire' // directions -#define AE_www_go_again 'agai' // keyDirectObject HWIN -#define AE_www_go_home 'home' // keyDirectObject HWIN -#define AE_www_super_reload 'srld' // keyDirectObject HWIN - -#define AE_www_openBookmark 'book' // Open Bookmark file -#define AE_www_openAddressBook 'addr' // Open Address Book - -#define AE_www_ReadHelpFile 'help' // keyDirectObject is the file -#define AE_www_ReadHelpFileID 'idid' // Help file id. If none, use "DEFAULT" -#define AE_www_ReadHelpFileSearchText 'sear' // Search text, no default - -#define AE_www_ProfileManager 'prfl' //obsolete - -//Component stuff -#define AE_www_openComponent 'cpnt' - -#define AE_www_comp_navigator 'navg' -#define AE_www_comp_inbox 'inbx' -#define AE_www_comp_collabra 'colb' -#define AE_www_comp_composer 'cpsr' -#define AE_www_comp_conference 'conf' -#define AE_www_comp_calendar 'cald' -#define AE_www_comp_ibmHostOnDemand 'ibmh' -#define AE_www_comp_netcaster 'netc' - -//Handle a command -#define AE_www_handleCommand 'hcmd' - -//Get active profile -#define AE_www_getActiveProfile 'upro' - -// Handle request from an external import module for relevant data -#define AE_www_getImportData 'Impt' - -// Objects -#define AE_www_typeWindow 'HWIN' -// window properties -#define AE_www_typeWindowURL 'curl' // Property: current URL -#define AE_www_typeWindowID 'wiid' // unique ID -#define AE_www_typeWindowBusy 'busy' // Are we busy -// application properties -#define AE_www_typeApplicationAlert 'ALAP' -#define AE_www_typeKioskMode 'KOSK' // Kiosk mode -/********************************************************************************* - * URL suite - * Standard Mac "GetURL suite, as defined by John Norstad and others - * Look around ftp://ftp.acns.nwu.edu/pub/newswatcher/ for official spec - * Event: GetURL - * Arguments: keyDirectObject (typeText, the url - * to (destination) (typeFSS optional file to save to) - * from (refererer) (typeText, the referer) - * with (window) (typeObjectSpec, the window) - *********************************************************************************/ -#define AE_url_suite 'GURL' - -// Event codes -#define AE_url_getURL 'GURL' // keyDirectObject typeChar URL, -// AE_www_typeWindow window window to load the url in -#define AE_url_getURLdestination 'dest' -#define AE_url_getURLrefererer 'refe' -#define AE_url_getURLname 'name' // window name - - - - - - - - - -/********************************************************************************* - * "Spyglass" suite - * http://www.spyglass.com:4040/newtechnology/integration/iapi.htm - * - * Accepted events: - * Event: OpenURL - * Arguments: - * S: keyDirectObject typeChar the url - * S: typeFSS into - * S: typeLongInteger windowID (unique window ID for applescript) - * typeLongInteger flags -- unused - * S: typeWildCard post data -- you can post a form - * S: typeChar MIME type -- for post. Defaults to application/x-www-form-urlencoded - * S: typePSN Progress app - * Reply: windowID - * - * Event: RegisterViewer - * Arguments: - * keyDirectObject typeApplSignature - * typeChar MIME type - * Reply: bool success - * - * Event: UnRegisterViewer - * keyDirectObject typeApplSignature - * typeChar MIME type - * Reply: none - * - * Event: RegisterURLEcho - * keyDirectObject typeApplSignature (optional). Otherwise, sender is used - * Reply: typeBoolean on success, errAECoercionFail if already registered - * - * Event: UnregisterURLEcho - * keyDirectObject typeApplSignature (optional). Otherwise, sender is used - * - * SENDING: - * Event: ViewDocFile - * Arguments: - * keyDirectObject typeAlias file spec - * typeChar url - * typeChar mime type - * typeLongInteger window id - * Reply: none - * - * Event: BeginProgress - * Arguments: - * keyDirectObject typeLongInteger windowID - * typeChar message - * Reply: typeLongInteger transactionID - * - * Event: SetProgressRange - * Arguments: - * keyDirectObject typeLongInteger transactionID - * typeLongInteger max value. -1 if the value is unknown - * Reply: none - * - * Event: MakingProgress - * Arguments: - * keyDirectObject typeLongInteger transactionID - * typeText message - * typeLongInteger current value of the transaction - * Reply: typeBoolean cancel - * - * Event: EndProgress - * Arguments: - * keyDirectObject typeLongInteger transactionID - * Reply: none - * - * Event: QueryViewer - * Arguments: - * keyDirectObject typeChar url - * typeChar MIME type - * Reply: typeFSS fileSpec - * - * Event: ShowFile - * Arguments: - * keyDirectObject typeAlias -- the file - * - *********************************************************************************/ -#define AE_spy_receive_suite 'WWW!' -#define AE_spy_send_suite 'WWW?' - -// ===================== RECEIVING ========================== - -// ================== Miscelaneous events - -// ****************** OpenURL -#define AE_spy_openURL 'OURL' // typeChar OpenURL -#define AE_spy_openURL_into 'INTO' // typeFSS into -#define AE_spy_openURL_wind 'WIND' // typeLongInteger windowID -#define AE_spy_openURL_flag 'FLGS' // typeLongInteger flags -#define AE_spy_openURL_post 'POST' // typeWildCard post data -#define AE_spy_openURL_mime 'MIME' // typeChar MIME type -#define AE_spy_openURL_prog 'PROG' // typePSN Progress app - -// ****************** ShowFile -#define AE_spy_showFile 'SHWF' // typeAlias file spec -#define AE_spy_showFile_mime 'MIME' // typeChar MIME type -#define AE_spy_showFile_win 'WIND' // WindowID -#define AE_spy_showFile_url 'URL ' // URL -// ****************** ParseAnchor -#define AE_spy_parse 'PRSA' // typeChar main URL -#define AE_spy_parse_rel 'RELA' // typeChar relative URL - -// ****************** Progress (receiving) -#define AE_spy_CancelProgress 'CNCL' // typeLongInteger transactionID -#define AE_spy_CancelProgress_win 'WIND' // typeLongInteger windowID - -// ****************** FindURL -#define AE_spy_findURL 'FURL' // typeFSS file spec. Returns the URL of the file - -// =================== Windows - -// ****************** Activate -#define AE_spy_activate 'ACTV' // typeLong window ID -#define AE_spy_activate_flags 'FLGS' // typeLong unused flags -// ****************** ListWindows -#define AE_spy_listwindows 'LSTW' // no arguments -// ****************** GetWindowInfo -#define AE_spy_getwindowinfo 'WNFO' // typeLong window - -// -// ================== Registration events -// - -// ****************** RegisterURLEcho -#define AE_spy_registerURLecho 'RGUE' // typeApplSignature application -// ****************** UnregisterURLEcho -#define AE_spy_unregisterURLecho 'UNRU' // typeApplSignature application - -// ****************** RegisterViewer -#define AE_spy_registerViewer 'RGVW' // typeSign Application -#define AE_spy_registerViewer_mime 'MIME' // typeChar Mime type -#define AE_spy_registerViewer_flag 'MTHD' // typeLongInteger Flags -#define AE_spy_registerViewer_ftyp 'FTYP' // file type -// ****************** UnregisterViewer -#define AE_spy_unregisterViewer 'UNRV' // typeApplSignature application -#define AE_spy_unregisterViewer_mime 'MIME' // MIME type - -// ****************** Register protocol -#define AE_spy_register_protocol 'RGPR' // typeApplSignature application -#define AE_spy_register_protocol_pro 'PROT' // typeChar protocol -// ****************** Unregister protocol -#define AE_spy_unregister_protocol 'UNRP' // typeApplSignature application -#define AE_spy_register_protocol_pro 'PROT' // typeChar protocol - -// ****************** RegisterWindowClose -#define AE_spy_registerWinClose 'RGWC' // typeApplSignature application -#define AE_spy_registerWinClose_win 'WIND'// typeLong window -// ****************** UnregisterWindowClose -#define AE_spy_unregisterWinClose 'UNRC' // typeApplSignature application -#define AE_spy_unregisterWinClose_win 'WIND'// typeLong window - - -// ****************** SetOption -#define AE_spy_setOption 'SOPT' // typeChar option name -#define AE_spy_setOption_value 'OPTV' // type depends upon the option -// ****************** GetOption -#define AE_spy_getOption 'GOPT' // typeChar option name -// ****************** ListOptions -#define AE_spy_listOptions 'LOPT' // no arguments - -// -// ===================== SENDING ============================ -// -// ViewDocFile -#define AE_spy_viewDocFile 'VDOC' // typeAlias fileSpec -#define AE_spy_viewDocFile_url 'URL ' // typeChar url -#define AE_spy_viewDocFile_mime 'MIME' // typeChar mimeType -#define AE_spy_viewDocFile_wind 'WIND' // typeLongInteger Window ID -// BeginProgress -#define AE_spy_beginProgress 'PRBG' // typeLongInteger windowID -#define AE_spy_beginProgress_msg 'PMSG' // typeChar message -// SetProgressRange -#define AE_spy_setProgressRange 'PRSR' // typeLongInteger transactionID -#define AE_spy_setProgressRange_max 'MAXV' // typeLongInteger max -// MakingProgress -#define AE_spy_makingProgress 'PRMK' // typeLongInteger transactionID -#define AE_spy_makingProgress_msg 'PMSG' // typeChar message -#define AE_spy_makingProgress_curr 'CURR' // typeLongInteger current data size -// EndProgress -#define AE_spy_endProgress 'PREN' // typeLongInteger transactionID -// QueryViewer -#define AE_spy_queryViewer 'QVWR' // typeChar url -#define AE_spy_queryViewer_mime 'MIME' // typeChar MIME type -// URLEcho -#define AE_spy_URLecho 'URLE' // typeChar url -#define AE_spy_URLecho_mime 'MIME' // typeChar MIME type -#define AE_spy_URLecho_win 'WIND' // typeLongInt windowID -#define AE_spy_URLecho_referer 'RFRR' // typeChar referer -// Window closed -#define AE_spy_winClosed 'WNDC' // typeLong windowID -#define AE_spy_winClosedExiting 'EXIT' // typeBoolean are we quitting? - - -/*--------------------------------------------------------------------------*/ -/* ---- Eudora Suite ---- */ -/*--------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - Client applications can manipulate our Mail system to send, receive - and do other mail operations by remote contro. - We can also -----------------------------------------------------------------------------*/ - -// ---- Class Definitions for objects Eudora can manipulate -//---------------------------------------------------------------------------------------- - -#define cEuMailfolder 'euMF' // Class: folder for mailboxes and mail folders -#define pEuTopLevel 'euTL' // Property boolean: is top-level of Eudora Folder? -#define pEuFSS 'euFS' // Property alias: FSS for file - -#define cEuMailbox 'euMB' /* mailbox */ -#define pEuMailboxType 'euMT' /* in, out, trash, ... */ -#define pEuWasteSpace 'euWS' /* space wasted in mailbox */ -#define pEuNeededSpace 'euNS' /* space needed by messages in mailbox */ -#define pEuTOCFSS 'eTFS' /* FSS for toc file (pEuFSS is for mailbox) */ - -#define cEuNotify 'eNot' /* applications to notify */ - /* pEuFSS is the fsspec */ - -#define cEuMessage 'euMS' /* message */ -#define pEuPriority 'euPY' /* priority */ -#define pEuStatus 'euST' /* message status */ -#define pEuSender 'euSe' /* sender */ -#define pEuDate 'euDa' /* date */ -#define pEuSize 'euSi' /* size */ -#define pEuSubject 'euSu' /* subject */ -#define pEuOutgoing 'euOu' /* outgoing? */ -#define pEuSignature 'eSig' /* signature? */ -#define pEuWrap 'eWrp' /* wrap? */ -#define pEuFakeTabs 'eTab' /* fake tabs? */ -#define pEuKeepCopy 'eCpy' /* keep copy? */ -#define pEuHqxText 'eXTX' /* HQX -> TEXT? */ -#define pEuMayQP 'eMQP' /* may use quoted-printable? */ -#define pEuAttachType 'eATy' /* attachment type; 0 double, 1 single, 2 hqx, 3 uuencode */ -#define pEuShowAll 'eBla' /* show all headers */ -#define pEuTableId 'eTbl' /* resource id of table */ -#define pEuBody 'eBod' /* resource id of table */ -#define pEuSelectedText 'eStx' /* the text selected now */ -#define pEuWillFetch 'eWFh' /* is on list to fetch next time */ -#define pEuWillDelete 'eWDl' /* is on list to delete next time */ -#define pEuReturnReceipt 'eRRR' /* return receipt requested */ -#define pEuLabel 'eLbl' /* label index */ - -#define cEuField 'euFd' /* field in message */ - -#define cEu822Address 'e822' /* RFC 822 address */ - -#define cEuTEInWin 'EuWT' /* the teh of a window */ -#define cEuWTEText 'eWTT' /* text from the teh of a window */ - -#define cEuPreference 'ePrf' /* a preference string */ - -#define kEudoraSuite 'CSOm' /* Eudora suite */ -#define keyEuNotify 'eNot' /* Notify of new mail */ -#define kEuNotify keyEuNotify -#define kEuInstallNotify 'nIns' /* install a notification */ -#define kEuRemoveNotify 'nRem' /* remove a notification */ -#define keyEuWhatHappened 'eWHp' /* what happened */ -#define keyEuMessList 'eMLs' /* Message list */ - -#define eMailArrive 'wArv' /* mail has arrived */ -#define eMailSent 'wSnt' /* mail has been sent */ -#define eWillConnect 'wWCn' /* will connect */ -#define eHasConnected 'wHCn' /* has connected */ - -#define kEuReply 'eRep' /* Reply */ -#define keyEuToWhom 'eRWh' /* Reply to anyone in particular? */ -#define keyEuReplyAll 'eRAl' /* Reply to all? */ -#define keyEuIncludeSelf 'eSlf' /* Include self? */ -#define keyEuQuoteText 'eQTx' /* Quote original message text? */ - -#define kEuForward 'eFwd' /* Forward */ - -#define kEuRedirect 'eRdr' /* Redirect */ - -#define kEuSalvage 'eSav' /* Salvage a message */ - -#define kEuAttach 'eAtc' /* Attach a document */ -#define keyEuDocumentList 'eDcl' /* List of dox to attach */ - -#define kEuQueue 'eQue' /* Queue a message */ -#define keyEuWhen 'eWhn' /* When to send message */ - -#define kEuUnQueue 'eUnQ' /* Unqueue a message */ - -#define kEuConnect 'eCon' /* Connect (send/queue) */ -#define keyEuSend 'eSen' -#define keyEuCheck 'eChk' -#define keyEuOnIdle 'eIdl' /* wait until Eudora is idle? */ - -#define kEuNewAttach 'euAD' /* attach document, new style */ -#define keyEuToWhat 'euMS' /* attach to what message? */ - -#define typeVDId 'VDId' /* vref & dirid */ - -#define kIn IN -#define kOut OUT -#define kTrash TRASH -#define KRegular 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/cmd/macfe/include/reserr.h b/mozilla/cmd/macfe/include/reserr.h deleted file mode 100644 index 970e8c2d072..00000000000 --- a/mozilla/cmd/macfe/include/reserr.h +++ /dev/null @@ -1,65 +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. - */ - -/* reserr.h - * defines for error dialog boxes - */ -#ifndef __RESERR__ -#define __RESERR__ - -// ParamText: ^0 application name, ^1 file name, ^2 error code -// Returns: 1 save file, 2 delete file -#define ALRT_ODOCFailed 1000 - -// ParamText: ^0 application name, ^1 file name -// Returns: 1 save file, 2 delete file -#define ALRT_AppNotFound 1001 - -// ParamText: ^0 application name, ^1 file name -// Returns: 1 save file, 2 delete file, 3 try again -#define ALRT_AppMemFull 1002 - -// ParamText: ^0 application name, ^1 file name, ^2 error code -// Returns: 1 save file, 2 delete file -#define ALRT_AppMiscError 1003 - -// Clear. Use ParamText ^0^1^2^3 -#define ALRT_PlainAlert 1004 - -// resources between 1005 and 1007 are taken by password dialogs - -// Your last command could not be completed because ^0. Error number ^1. -#define ALRT_ErrorOccurred 1008 - -// Clear. Yes or no response. Use ParamText ^0^1^2^3 -#define ALRT_YorNAlert 1010 - -// Unknown MIME type alert ^0 is file name, ^1 is document type -#define ALRT_UnknownMimeType 1011 -#define ALRT_UnknownMimeType_Cancel 1 -#define ALRT_UnknownMimeType_Save 2 -#define ALRT_UnknownMimeType_PickApp 3 -#define ALRT_UnknownMimeType_MoreInfo 4 - -// -#define ALRT_BookmarkOutDrag 1013 - -#endif - - - diff --git a/mozilla/cmd/macfe/include/resgui.h b/mozilla/cmd/macfe/include/resgui.h deleted file mode 100644 index 257a404ab75..00000000000 --- a/mozilla/cmd/macfe/include/resgui.h +++ /dev/null @@ -1,881 +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. - */ - -/*----------------------------------------------------------------------------- - resgui.h - Module-Specific Interface Constants ------------------------------------------------------------------------------*/ -#ifndef __RESGUI__ -#define __RESGUI__ - -#ifdef MOZ_COMMUNICATOR_NAME -#define PROGRAM_NAME "Communicator" -#else -#define PROGRAM_NAME "Navigator" -#endif // MOZ_COMMUNICATOR_NAME - -#define emSignature 'MOZZ' // 'MOSS' for Netscape build, 'MOZZ' for free source build - -// ¥¥ File types -#define emPrefsType 'pref' -#define emTextType 'TEXT' -#define emBookmarkFile 'URL ' // Bookmark file -#define emPluginFile 'NSPL' -#define TEXT_FLAVOR 'TEXT' -#define emHelpType 'HELP' -#define emRegistry 'REGS' -#define emProfileType 'PRFL' -#define emNetprofileType 'PRFN' -#define emLDIFType 'LDIF' - -// Locale Boundle - use for l10n -#define emLocaleBndl 'lBDL' - -#define emKeyChain 'KCHN' // Key chain -#define emMagicCookie 'COOK' // Magic cookie -#define emCertificates 'CERT' // Certificates -#define emCertIndex 'CERI' // Certificate index -// DBM files have prefixes DBM -#define emGlobalHistory 'DBMG' // Global history file -#define emCacheFat 'DBMC' // CacheFAT -#define emExtCache 'DBME' // External cache - -// ¥¥ Drag/clip flavors -#define emBookmarkFileDrag 'urlF' // FSSpec for promiseHFS drags -#define emXPBookmarkClipboard 'urlX' // Cross-platform bookmark copy/paste -#define emBookmarkDrag 'URLD' // URL and a title drag for page proxy icon - // and in-page URLs -//#define emComposerNativeDrag 'CNDr' -#define emHTNodeDrag 'HTND' // HT_Resource data for a nav center item - -#define emContextPopupMenu 4100 - -// Stop Loading/Animations - -#define STOP_STRING_LIST 9000 -#define STOP_LOADING_INDEX 1 -#define STOP_ANIMATIONS_INDEX 2 - -// ¥¥Êmenu commands/messages. SEE ALSO MailNewsGroupWindow_Defines.h -#define cmd_Preferences 1001 -#define cmd_EditNetwork 1002 // Edit Network Prefs -#define cmd_EditSecurity 1003 // Edit Security Prefs -#define cmd_ViewSource 1007 // View source. Handled by hyperWindow -#define cmd_MailTo 1008 // Mail to -#define cmd_DelayImages 1010 // Delay image loading -#define cmd_LoadImages 1011 // Load all images -#define cmd_ReloadImage 1013 // Reload images -#define cmd_Find 1014 // Find -#define cmd_FindAgain 1015 // Find again -#define cmd_ToggleToolbar 1017 -#define cmd_ToggleLocationBar 1018 // The 4.0 and later terminology -#define cmd_TogglePersonalToolbar 1199 -#define cmd_ToggleStatusArea 1019 - -#define cmd_ShowLocationBar 1500 -#define cmd_HideLocationBar 1501 - -// Privacy commands -#define cmd_PrivAnonMode 1550 -#define cmd_PrivDisplayPolicy 1551 -#define cmd_PrivDisplayCookies 1552 -#define cmd_PrivDisplaySignons 1553 -#define cmd_PrivDisplaySiteInfo 1554 -#define cmd_PrivAboutPrivacy 1555 - - /* nav center toggle in Netscape_Constants.h */ -#define cmd_FancyFTP 1020 -#define cmd_SaveDefaultCharset 1021 -#define cmd_ShowDirectory 1022 -#define cmd_DocumentInfo 1023 -#define cmd_ShowSecurityBar 1024 -#define LOGO_BUTTON 1025 -#define cmd_CoBrandLogo 1026 -#define cmd_DocumentEncoding 1027 - -#define cmd_BookmarksWindow 1030 // Show the bm pane of NavCenter in new window -#define cmd_HistoryWindow 1031 // Show history pane of NavCenter in new window -#define cmd_Redo 1034 - -#define cmd_ViewFrameSource 1035 -#define cmd_ViewFrameInfo 1036 - -#define cmd_ToggleTaskBar 1037 - -#define cmd_NewFolder 1048 - -#ifdef FORTEZZA -#define cmd_FortezzaCard 1095 -#define cmd_FortezzaChange 1096 -#define cmd_FortezzaView 1097 -#define cmd_FortezzaInfo 1098 -#define cmd_FortezzaLogout 1099 -#endif - -/* Editor Window Menu */ -#define cmd_BrowserWindow 1206 - -#ifdef EDITOR /* editing commands */ - -/* Browser File Menu */ -#define cmd_NewWindowEditor 1221 -#define cmd_NewWindowEditorIFF 1200 -#define cmd_EditDocument 1201 -#define cmd_EditFrameSet 1220 // this works the same as EditDocument right now -#define cmd_EditFrame 1296 -#define cmd_OpenFileEditor 1202 - -/* Browser Options Menu (Preferences) */ -#define cmd_EditEditor 1203 - -/* Editor File Menu */ -#define cmd_OpenURLEditor 1204 -#define cmd_BrowseDocument 1205 - -/* Editor Insert Menu */ -#define cmd_Insert_Object 'InsO' -#define cmd_Insert_Link 1207 -#define cmd_InsertEditLink 1257 /* based on selection: edit existing or insert new */ -#define cmd_Insert_Target 1208 -#define cmd_InsertEdit_Target 1274 /* based on selection: edit existing or insert new */ -#define cmd_Insert_Image 1209 -#define cmd_InsertEditImage 1255 /* based on selection: edit existing or insert new */ -#define cmd_Insert_Line 1210 -#define cmd_InsertEditLine 1256 /* based on selection: edit existing or insert new */ -#define cmd_Insert_LineBreak 1211 -#define cmd_Insert_BreakBelowImage 1212 - -/* Editor Format Menu */ -#define cmd_Format_FontHierMenu 'FONT' -#define cmd_Format_Text 1214 -#define cmd_Format_PageTitle 1215 -#define cmd_Format_Document 1218 -#define cmd_Format_FontColor 1219 -#define cmd_FormatColorsAndImage 1213 // html mail compose only - -/* Editor Format Character Menu */ -//#define cmd_Format_Character_Normal 1220 // use cmd_Plain -//#define cmd_Format_Character_Bold 1221 // use cmd_Bold -//#define cmd_Format_Character_Italic 1222 // use cmd_Italic -#define cmd_Format_Character_Nonbreaking 1223 -#define cmd_Format_Character_Superscript 1224 -#define cmd_Format_Character_Subscript 1225 -#define cmd_Format_Character_Blink 1226 -#define cmd_Format_Character_ClearAll 1227 - -/* Editor Format Paragraph Menu */ -#define cmd_Format_Paragraph_Normal 1228 -#define cmd_Format_Paragraph_Head1 1229 -#define cmd_Format_Paragraph_Head2 1230 -#define cmd_Format_Paragraph_Head3 1231 -#define cmd_Format_Paragraph_Head4 1232 -#define cmd_Format_Paragraph_Head5 1233 -#define cmd_Format_Paragraph_Head6 1234 -#define cmd_Format_Paragraph_Address 1235 -#define cmd_Format_Paragraph_Formatted 1236 -#define cmd_Format_Paragraph_List_Item 1237 -#define cmd_Format_Paragraph_Desc_Title 1238 -#define cmd_Format_Paragraph_Desc_Text 1239 -#define cmd_Format_Paragraph_Indent 1240 -#define cmd_Format_Paragraph_UnIndent 1241 - -/* Editor Format Font Size Menu */ -#define cmd_Format_Font_Size_N2 1242 -#define cmd_Format_Font_Size_N1 1243 -#define cmd_Format_Font_Size_0 1244 -#define cmd_Format_Font_Size_P1 1245 -#define cmd_Format_Font_Size_P2 1246 -#define cmd_Format_Font_Size_P3 1247 -#define cmd_Format_Font_Size_P4 1248 - -/* Editor Options Menu */ -#define cmd_Toggle_Character_Toolbar 1250 -#define cmd_Toggle_Paragraph_Toolbar 1251 - -/* These are actually messages from toolbar buttons */ -//#define cmd_IncreaseFontSize 1253 // use cmd_FontLarger -//#define cmd_DecreaseFontSize 1254 // use cmd_FontSmaller -//#define cmd_AlignParagraphLeft 1258 // use cmd_JustifyLeft -//#define cmd_AlignParagraphCenter 1259 // use cmd_JustifyCenter -//#define cmd_AlignParagraphRight 1260 // use cmd_JustifyRight - -#define cmd_Format_Character_Strikeout 1261 - -// messages from the Editor Dialog Boxes -#define msg_Clear_Text_Styles 1267 -#define msg_Clear_All_Styles 1268 -#define msg_Paragraph_Style_Popup 1269 -#define msg_Paragraph_Addtnl_Style_Popup 1270 -#define msg_List_Style_Popup 1271 - -// messages from the paragraph toolbar -#define msg_MakeNoList 1222 -#define msg_MakeNumList 1272 -#define msg_MakeUnumList 1273 -// messages from the character toolbar -#define msg_Link_Browse_File 1275 -#define msg_Link_Clear_Link 1276 -#define msg_Default_Color_Radio 1280 -#define msg_Custom_Color_Radio 1281 -#define msg_Font_Face_Changed 1279 -#define msg_Font_Size_Changed 1282 -#define cmd_DisplayParagraphMarks 1283 -#define cmd_Insert_Unknown_Tag 1284 - -//Table support -#define cmd_Insert_Table 1285 -#define cmd_Delete_Table 1286 -#define cmd_Format_Table 1287 -#define cmd_Insert_Row_Above 1288 -#define cmd_Insert_Row_Below 2288 -#define cmd_Delete_Row 1289 -#define cmd_Insert_Col_Before 1290 -#define cmd_Insert_Col_After 2290 -#define cmd_Delete_Col 1291 -#define cmd_Insert_Cell 1316 -#define cmd_Delete_Cell 1317 -//#define cmd_Insert_Caption 1292 -//#define cmd_Delete_Caption 1293 -#define cmd_Format_Cell 1294 -#define cmd_Format_Row 1318 -// #define cmd_DisplayTableBoundaries 1315 -#define cmd_Select_Table 1319 -#define cmd_Select_Row 1320 -#define cmd_Select_Col 1321 -#define cmd_Select_Cell 1322 -#define cmd_Select_All_Cells 1323 -#define cmd_DisplayTables 1324 -#define cmd_Join_With_Next_Cell 1326 -#define cmd_Split_Cell 1327 -#define cmd_Convert_Table_To_Text 1328 -#define cmd_Convert_Text_To_Table 1329 - - -#define cmd_Paragraph_Hierarchical_Menu 'Para' // 1296 -#define cmd_Font_Size_Hierarchical_Menu 'Size' -#define cmd_Align_Hierarchical_Menu 'Algn' - -// font menu -#define cmd_FormatViewerFont 1253 -#define cmd_FormatFixedFont 1254 - -#define cmd_New_Document_Template 1301 -#define cmd_New_Document_Wizard 1302 -#define cmd_Publish 1303 -#define cmd_Refresh 1304 -#define cmd_EditSource 1305 -#define cmd_Remove_Links 1306 -#define cmd_Format_Target 1307 -#define cmd_Format_Unknown_Tag 1308 -#define cmd_Format_DefaultFontColor 1309 - -#define msg_Doc_Advanced_Prop_New_Tag 1312 -#define msg_Doc_Advanced_Prop_Set_Tag 1313 -#define msg_Doc_Advanced_Prop_Delete_Tag 1314 - -#define cmd_GoDefaultPublishLocation 1325 -#endif /* EDITOR */ - -#define msg_Apply 3001 -#define msg_Defaults 3002 - -#define HISTORY_MENU_BASE 2000 -#define HISTORY_LIMIT 32 -#define HISTORY_MENU_LAST HISTORY_MENU_BASE + HISTORY_LIMIT - -#define COPY_MOVE_BASE 2050 // reserved for entries in the "Copy toÉ" -#define COPY_MOVE_LAST 2200 // and "Move toÉ" submenus - -#define TOOLS_MENU_BASE 2500 // Reserved for up to 3000 for tools menus -#define TOOLS_MENU_BASE_LAST 2989 - -#define FONT_MENU_BASE 12500 // Reserved 485 for font menu -#define FONT_MENU_BASE_LAST 12984 - -#define RECENT_EDIT_MENU_BASE 12985 -#define RECENT_EDIT_MENU_BASE_LAST 12999 - -#define COLOR_POPUP_MENU_BASE 13000 // Reserve 260 for color popup menu -#define COLOR_POPUP_MENU_BASE_LAST 13259 - -#define cmd_EditorPluginStop 2991 - -#define cmd_LaunchAOLInstantMessenger 6603 - -#define cmd_ShowJavaConsole 7866 - -#define cmd_WINDOW_MENU_BASE 9001 // 9001 through 9050 reserved for windows -#define cmd_WINDOW_MENU_BASE_LAST 9050 - -#define CONTEXT_MENU_BASE 4070 -#define cmd_NEW_WINDOW_WITH_FRAME 4 + CONTEXT_MENU_BASE -// ---- -#define cmd_OPEN_LINK 6 + CONTEXT_MENU_BASE -#define cmd_NEW_WINDOW 8 + CONTEXT_MENU_BASE -#define cmd_SAVE_LINK_AS 9 + CONTEXT_MENU_BASE -#define cmd_COPY_LINK_LOC 10 + CONTEXT_MENU_BASE -// --- -#define cmd_VIEW_IMAGE 12 + CONTEXT_MENU_BASE -#define cmd_SAVE_IMAGE_AS 13 + CONTEXT_MENU_BASE -#define cmd_COPY_IMAGE 14 + CONTEXT_MENU_BASE -#define cmd_COPY_IMAGE_LOC 15 + CONTEXT_MENU_BASE -#define cmd_LOAD_IMAGE 16 + CONTEXT_MENU_BASE -#define CONTEXT_MENU_LAST 4999 - -// ¥¥ Cursors -#define curs_Hand 128 -#define curs_VertDrag 129 -#define curs_HoriDrag 130 -#define curs_CopyDrag 132 - -// ¥¥ Text traits -#define FieldTextTxtr 4001 - -// ¥¥ Windows -#define Wind_NamePass 1005 // Name and password for FE_Name -#define Wind_Prompt 1006 // Prompt for FE_Prompt -#define Wind_Pass 1007 // Prompt for a password - -// ¥¥ Preferences built-in types -#define PREF_SOURCE "Netscape/DocumentSource" -#define TELNET_APPLICATION_MIME_TYPE "Netscape/Telnet" -#define TELNET_APPLICATION_FILE_TYPE 'CONF' -#define HTML_VIEWER_APPLICATION_MIME_TYPE "Netscape/Source" -#define HTML_VIEWER_APPLICATION_FILE_TYPE 'TEXT' -#define TN3270_VIEWER_APPLICATION_MIME_TYPE "Netscape/tn3270" -#define TN3270_VIEWER_APPLICATION_FILE_TYPE 'GFTS' - -// Preference resources - -#define STARTUP_BROWSER 1 -#define STARTUP_VISIBLE 4 -#define BROWSER_STARTUP_ID 1 -#define NAVCENTER_STARTUP_ID 16 - -#define res_Strings1 2001 -// 2002 and 2003 are taken by obsolete preferences -#define res_StringsBoolean 2004 -#define res_StringsLong 2005 -#define res_StringsColor 2006 -#define res_Strings2 2007 -#define res_PrintRecord 1 - -#define BOOLEAN_PREFS_RESID 129 -#define LONG_PREFS_RESID 129 -#define COLORS_PREFS_RESID 129 -#define STRING_PREFS_RESID 2001 -#define FONT_PREFS_RESID 2002 -#define PROT_HANDLER_PREFS_RESID 2003 -#define MIME_PREFS_FIRST_RESID 129 - -// preferences error strings -#define mPREFS_UNSPECIFIED_ERR_ALERT 21000 -#define mPREFS_CANNOT_OPEN_SECOND_ALERT 21004 -#define mPREFS_CANNOT_CREATE 21008 -#define mPREFS_CANNOT_CREATE_PREFS_FOLDER 21012 -#define mPREFS_CANNOT_READ 21016 -#define mPREFS_CANNOT_WRITE 21020 -#define mPREFS_DUPLICATE_MIME 21024 - -#define BUTTON_STRINGS_RESID 301 -#define BUTTON_TOOLTIPS_RESID 302 -#define PREF_WINDOWNAMES_RESID 303 -#define HELPFILES_NAMES_RESID 304 - -#define TOOLBAR_ICONS 0 // Toolbar display style possible values -#define TOOLBAR_TEXT 1 -#define TOOLBAR_TEXT_AND_ICONS 2 - -#define DEFAULT_BACKGROUND 0 -#define CUSTOM_BACKGROUND 1 -#define GIF_FILE_BACKGROUND 2 - -#define PRINT_REDUCED XL -#define PRINT_CROPPED 1 -#define PRINT_RESIZED 2 - -#define DLOG_SAVEAS 1040 -#define DLOG_GETFOLDER 1041 -#define DLOG_UPLOADAS 1043 - -#define HELP_URLS_RESID 2020 -#define LOGO_BUTTON_URL_RESID 2022 -#define HELP_URLS_MENU_STRINGS 2090 -#define WINDOW_TITLES_RESID 2030 -#define NEW_DOCUMENT_URL_RESID 2040 - -#define GENERIC_FONT_NAMES_RESID 3000 - -#define BYTES_PER_MEG 1048576L - -#define NORMAL_PANE_CONFIG 0 -#define STACKED_PANE_CONFIG 1 -#define LEFT_PANE_CONFIG 2 - -#define neverAgain 3 - -#define FE_STRINGS_BASE 500 -#define MAIL_WIN_ERR_RESID (FE_STRINGS_BASE + 0) -#define MAIL_TOO_LONG_RESID (FE_STRINGS_BASE + 4) -#define MAIL_TMP_ERR_RESID (FE_STRINGS_BASE + 8) -#define NO_EMAIL_ADDR_RESID (FE_STRINGS_BASE + 12) -#define NO_SRVR_ADDR_RESID (FE_STRINGS_BASE + 16) -#define MAIL_SUCCESS_RESID (FE_STRINGS_BASE + 20) -#define MAIL_NOT_SENT_RESID (FE_STRINGS_BASE + 24) -#define MAIL_SENDING_RESID (FE_STRINGS_BASE + 30) -#define NEWS_POST_RESID (FE_STRINGS_BASE + 34) -#define MAIL_SEND_ERR_RESID (FE_STRINGS_BASE + 38) -#define MAIL_DELIVERY_ERR_RESID (FE_STRINGS_BASE + 40) -#define DISCARD_MAIL_RESID (FE_STRINGS_BASE + 44) -#define SECURITY_LEVEL_RESID (FE_STRINGS_BASE + 48) -#define NO_MEM_LOAD_ERR_RESID (FE_STRINGS_BASE + 52) -#define EXT_PROGRESS_RESID (FE_STRINGS_BASE + 56) -#define REVERT_PROGRESS_RESID (FE_STRINGS_BASE + 60) -#define START_LOAD_RESID (FE_STRINGS_BASE + 64) -#define NO_XACTION_RESID (FE_STRINGS_BASE + 68) -#define LAUNCH_TELNET_RESID (FE_STRINGS_BASE + 70) -#define LAUNCH_TN3720_RESID (FE_STRINGS_BASE + 74) -#define TELNET_ERR_RESID (FE_STRINGS_BASE + 78) -#define SAVE_AS_RESID (FE_STRINGS_BASE + 82) -#define NETSITE_RESID (FE_STRINGS_BASE + 86) -#define LOCATION_RESID (FE_STRINGS_BASE + 90) -#define GOTO_RESID (FE_STRINGS_BASE + 94) -#define DOCUMENT_DONE_RESID (FE_STRINGS_BASE + 98) -#define LAYOUT_COMPLETE_RESID (FE_STRINGS_BASE + 102) -#define CONFORM_ABORT_RESID (FE_STRINGS_BASE + 106) -#define SUBMIT_FORM_RESID (FE_STRINGS_BASE + 110) -#define SAVE_IMAGE_RESID (FE_STRINGS_BASE + 114) -#define SAVE_QUOTE_RESID (FE_STRINGS_BASE + 118) -#define WILL_OPEN_WITH_RESID (FE_STRINGS_BASE + 122) -#define WILL_OPEN_TERM_RESID (FE_STRINGS_BASE + 123) -#define SAVE_AS_A_RESID (FE_STRINGS_BASE + 126) -#define FILE_RESID (FE_STRINGS_BASE + 130) -#define COULD_NOT_SAVE_RESID (FE_STRINGS_BASE + 134) -#define DISK_FULL_RESID (FE_STRINGS_BASE + 138) -#define DISK_ERR_RESID (FE_STRINGS_BASE + 142) -#define BOOKMARKS_RESID (FE_STRINGS_BASE + 146) -#define NOT_VISITED_RESID (FE_STRINGS_BASE + 150) -#define NO_FORM2HOTLIST_RESID (FE_STRINGS_BASE + 154) -#define NEW_ITEM_RESID (FE_STRINGS_BASE + 158) -#define NEW_HEADER_RESID (FE_STRINGS_BASE + 162) -#define CONFIRM_RM_HDR_RESID (FE_STRINGS_BASE + 166) -#define AND_ITEMS_RESID (FE_STRINGS_BASE + 170) -#define SAVE_BKMKS_AS_RESID (FE_STRINGS_BASE + 174) -#define END_LIST_RESID (FE_STRINGS_BASE + 178) -#define ENTIRE_LIST_RESID (FE_STRINGS_BASE + 182) -#define NEW_RESID (FE_STRINGS_BASE + 186) -#define OTHER_RESID (FE_STRINGS_BASE + 190) -#define MEM_AVAIL_RESID (FE_STRINGS_BASE + 194) -#define SAVE_RESID (FE_STRINGS_BASE + 198) -#define LAUNCH_RESID (FE_STRINGS_BASE + 202) -#define INTERNAL_RESID (FE_STRINGS_BASE + 206) -#define UNKNOWN_RESID (FE_STRINGS_BASE + 210) -#define MEGA_RESID (FE_STRINGS_BASE + 214) -#define KILO_RESID (FE_STRINGS_BASE + 215) -#define PICK_COLOR_RESID (FE_STRINGS_BASE + 218) -#define BAD_APP_LOCATION_RESID (FE_STRINGS_BASE + 222) -#define REBUILD_DESKTOP_RESID (FE_STRINGS_BASE + 226) -#define UNTITLED_RESID (FE_STRINGS_BASE + 230) -#define REG_EVENT_ERR_RESID (FE_STRINGS_BASE + 234) -#define APP_NOT_REG_RESID (FE_STRINGS_BASE + 238) -#define UNREG_EVENT_ERR_RESID (FE_STRINGS_BASE + 242) -#define BOOKMARK_HTML_RESID (FE_STRINGS_BASE + 246) -#define NO_DISKCACHE_DIR_RESID (FE_STRINGS_BASE + 250) -#define NO_SIGFILE_RESID (FE_STRINGS_BASE + 254) -#define NO_BACKDROP_RESID (FE_STRINGS_BASE + 258) -#define SELECT_RESID (FE_STRINGS_BASE + 262) -#define AE_ERR_RESID (FE_STRINGS_BASE + 266) -#define CHARSET_RESID (FE_STRINGS_BASE + 270) -#define BROWSE_RESID (FE_STRINGS_BASE + 274) -#define ENCODING_CAPTION_RESID (FE_STRINGS_BASE + 278) -#define NO_TWO_NETSCAPES_RESID (FE_STRINGS_BASE + 282) -#define PG_NUM_FORM_RESID (FE_STRINGS_BASE + 286) -#define MENU_SAVE_AS (FE_STRINGS_BASE + 290) -#define MENU_SAVE_FRAME_AS (FE_STRINGS_BASE + 294) -#define MENU_PRINT (FE_STRINGS_BASE + 298) -#define MENU_PRINT_FRAME (FE_STRINGS_BASE + 302) -#define MENU_RELOAD (FE_STRINGS_BASE + 306) -#define MENU_SUPER_RELOAD (FE_STRINGS_BASE + 310) -#define MAC_PROGRESS_PREFS (FE_STRINGS_BASE + 314) -#define MAC_PROGRESS_NET (FE_STRINGS_BASE + 318) -#define MAC_PROGRESS_BOOKMARK (FE_STRINGS_BASE + 322) -#define MAC_PROGRESS_ADDRESS (FE_STRINGS_BASE + 326) -#define MAC_PROGRESS_JAVAINIT (FE_STRINGS_BASE + 328) -#define REPLY_FORM_RESID (FE_STRINGS_BASE + 330) - -#define MAC_UPLOAD_TO_FTP (FE_STRINGS_BASE + 334) -#define POP_USERNAME_ONLY (FE_STRINGS_BASE + 338) -#define THE_ERROR_WAS (FE_STRINGS_BASE + 342) -#define MAC_PLUGIN (FE_STRINGS_BASE + 346) -#define MAC_NO_PLUGIN (FE_STRINGS_BASE + 350) -#define MAC_REGISTER_PLUGINS (FE_STRINGS_BASE + 354) -#define DOWNLD_CONT_IN_NEW_WIND (FE_STRINGS_BASE + 358) -#define ATTACH_NEWS_MESSAGE (FE_STRINGS_BASE + 362) -#define ATTACH_MAIL_MESSAGE (FE_STRINGS_BASE + 366) -#define MBOOK_NEW_ENTRY (FE_STRINGS_BASE + 370) -#define MCLICK_BACK_IN_FRAME (FE_STRINGS_BASE + 374) -#define MCLICK_BACK (FE_STRINGS_BASE + 378) -#define MCLICK_FWRD_IN_FRAME (FE_STRINGS_BASE + 382) -#define MCLICK_FORWARD (FE_STRINGS_BASE + 386) -#define MCLICK_SAVE_IMG_AS (FE_STRINGS_BASE + 390) -#define SUBMIT_FILE_WITH_DATA_FK (FE_STRINGS_BASE + 394) -#define ABORT_CURR_DOWNLOAD (FE_STRINGS_BASE + 398) -#define MACDLG_SAVE_AS (FE_STRINGS_BASE + 402) - -#define MBOOK_NEW_BOOKMARK (FE_STRINGS_BASE + 406) - -#define MENU_SEND_NOW (FE_STRINGS_BASE + 410) -#define MENU_SEND_LATER (FE_STRINGS_BASE + 414) -#define QUERY_SEND_OUTBOX (FE_STRINGS_BASE + 418) -#define QUERY_SEND_OUTBOX_SINGLE (FE_STRINGS_BASE + 422) - -#define MENU_MAIL_DOCUMENT (FE_STRINGS_BASE + 426) -#define MENU_MAIL_FRAME (FE_STRINGS_BASE + 430) - -#define DEFAULT_PLUGIN_URL (FE_STRINGS_BASE + 434) - -#define MBOOK_SEPARATOR_STR (FE_STRINGS_BASE + 438) -#define RECIPIENT (FE_STRINGS_BASE + 442) - -#define DOCUMENT_SUFFIX (FE_STRINGS_BASE + 446) -#define PASSWORD_CHANGE_STRING (FE_STRINGS_BASE + 447) -#define PASSWORD_SET_STRING (FE_STRINGS_BASE + 448) -#define DELETE_MIMETYPE (FE_STRINGS_BASE + 449) -#define ERROR_LAUNCH_IBM3270 (FE_STRINGS_BASE + 450) -#define ERROR_OPEN_PROFILE_MANAGER (FE_STRINGS_BASE + 451) - -#define MEMORY_ERROR_LAUNCH (FE_STRINGS_BASE + 460) -#define FNF_ERROR_LAUNCH (FE_STRINGS_BASE + 461) -#define MISC_ERROR_LAUNCH (FE_STRINGS_BASE + 462) - -#define CONFERENCE_APP_NAME (FE_STRINGS_BASE + 470) -#define CALENDAR_APP_NAME (FE_STRINGS_BASE + 471) -#define IMPORT_APP_NAME (FE_STRINGS_BASE + 472) -#define AIM_APP_NAME (FE_STRINGS_BASE + 473) - -#define NO_SRC_EDITOR_PREF_SET (FE_STRINGS_BASE + 500) -#define NO_IMG_EDITOR_PREF_SET (FE_STRINGS_BASE + 504) -#define INVALID_PUBLISH_LOC (FE_STRINGS_BASE + 508) - -#define NO_DICTIONARY_FOUND (FE_STRINGS_BASE + 520) -#define NO_SPELL_SHLB_FOUND (FE_STRINGS_BASE + 524) - -#define CLOSE_STR_RESID (FE_STRINGS_BASE + 600) -#define DUPLICATE_TARGET (FE_STRINGS_BASE + 604) -#define CUT_ACROSS_CELLS (FE_STRINGS_BASE + 608) -#define NOT_HTML (FE_STRINGS_BASE + 612) -#define BAD_TAG (FE_STRINGS_BASE + 616) -#define EDITOR_ERROR_EDIT_REMOTE_IMAGE (FE_STRINGS_BASE + 624) - -#define EDITOR_PERCENT_WINDOW (FE_STRINGS_BASE + 664) -#define EDITOR_PERCENT_PARENT_CELL (FE_STRINGS_BASE + 665) -#define IMAGE_SUBMIT_FORM (FE_STRINGS_BASE + 666) - -#define OTHER_FONT_SIZE (FE_STRINGS_BASE + 667) - -#define FILE_NAME_NONE (FE_STRINGS_BASE + 668) - -#define MENU_BACK (FE_STRINGS_BASE + 669) -#define MENU_BACK_ONE_HOST (FE_STRINGS_BASE + 770) -#define MENU_FORWARD (FE_STRINGS_BASE + 771) -#define MENU_FORWARD_ONE_HOST (FE_STRINGS_BASE + 772) - -#define NETSCAPE_TELNET (FE_STRINGS_BASE + 773) -#define NETSCAPE_TELNET_NAME_ARG (FE_STRINGS_BASE + 774) -#define NETSCAPE_TELNET_HOST_ARG (FE_STRINGS_BASE + 775) -#define NETSCAPE_TELNET_PORT_ARG (FE_STRINGS_BASE + 776) - -#define NETSCAPE_TN3270 (FE_STRINGS_BASE + 777) - -#define CLOSE_WINDOW (FE_STRINGS_BASE + 778) -#define CLOSE_ALL_WINDOWS (FE_STRINGS_BASE + 779) - -#define NO_PRINTER_RESID (FE_STRINGS_BASE + 800) - -#define MALLOC_HEAP_LOW_RESID (FE_STRINGS_BASE + 801) -#define JAVA_DISABLED_RESID (FE_STRINGS_BASE + 802) - - -/*----------------------------------------------------------------------------- - Generic Resources ------------------------------------------------------------------------------*/ -#define Wind_OtherSizeDialog 1500 - -#define View_MimeTable 'ptbl' // Mime table - - // Mail to window -#define View_MailWindow 'mail' // CMailWindow - -// Universal pane constants -/*------------------------------------------------------------------------------ - Main window ------------------------------------------------------------------------------*/ - -// Resources -#define HYPER_WINDOW_ID 1000 -#define MAIL_SEND_WINDOW_ID 8001 - -//#ifdef EDITOR -// #define EDITOR_WINDOW_ID 10000 -//#endif - -// Hypertext widgets -#define SCROLLER_ID (HYPER_WINDOW_ID + 1) -#define MAIN_LEDGE_ID (HYPER_WINDOW_ID + 4) - -/*----------------------------------------------------------------------------- - Load Item / Open URL dialog box ------------------------------------------------------------------------------*/ -#define li_base_rez 27753 -#define li_base 10000 - -#define liLoadItemWind (li_base_rez + 0) - -#define liDoLoad (li_base + 11) // Load button, Load message, Load command -#define liDoCancel (li_base + 12) // cancel -#define liItem (li_base + 13) // the edit text -#define liHistory (li_base + 14) // the history popup - -/*----------------------------------------------------------------------------- - Forms - Views are outside of the window, need to be loaded into it ------------------------------------------------------------------------------*/ -#define formSubmitButton 4000 -#define formResetButton 4001 -#define formPlainButton 4002 -#define formCheckbox 4003 -#define formRadio 4004 -#define formBigText 4005 -#define formTextField 4006 -#define formScrollingList 4007 -#define formPasswordField 4008 -#define formPopup 4009 -#define pluginView 4010 -#define formFilePicker 4011 -#define formGAPopup 4012 -#define formGARadio 4013 -#define formGACheckbox 4014 -#define formGASubmitButton 4015 -#define formGAResetButton 4016 -#define formGAPlainButton 4017 -#define formBigTextScroll 4018 -#define formHTMLArea 4019 - -#define formScrollingListID 'list' // ID of the subview that is the list withing the scroller -#define formBigTextID 'text' // ID of the subview that is the TEXT withing the scroller -#define formHTMLAreaID 'ehtm' // ID of the subview that is the HTML within the scroller - -#define formPopupChosen 2003 - -/*----------------------------------------------------------------------------- - Preferences ------------------------------------------------------------------------------*/ -#define prefBaseWindowID 5000 // Window ID of the base window - -// Main preferences window -#define prefSubViewBase 5010 - -#define prefPopup 'Pchc' - -// Subviews of Mime mapping -#define pref8mainContain View_MimeTable -#define helpersEditMimeID 'edmi' // "Edit..." button -#define helpersNewMimeID 'nemi' // "New..." button -#define helpersDeleteMimeID 'demi' // "Delete..." button - -/*----------------------------------------------------------------------------- - New mime mapper dialog box ------------------------------------------------------------------------------*/ -#define newMimeTypeID 5001 -#define pref8EditDescription 2 -#define pref8EditType 3 -#define pref8EditExtensions 5 -#define pref8textAppName 6 -#define pref8butAppSet 7 -#define pref8dataMenu 8 -#define pref8radioSave 9 -#define pref8radioLaunch 10 -#define pref8radioPlugin 11 -#define pref8radioInternal 12 -#define pref8radioUnknown 13 -#define pref8AppMenuLabel 14 -#define pref8PluginMenu 15 - -#define msg_LinkColorChange 420 - -#define msg_NewUserStateForZoom 4000 // nil ioParam - -#define ENCODING_BASE 1400 -#define cmd_ASCII 1401 -#define cmd_LATIN1 1402 -#define cmd_JIS 1403 -#define cmd_SJIS 1404 -#define cmd_EUCJP 1405 -#define cmd_SJIS_AUTO 1406 -#define cmd_MAC_ROMAN 1407 -#define cmd_LATIN2 1408 -#define cmd_MAC_CE 1409 -#define cmd_BIG5 1410 -#define cmd_CNS_8BIT 1411 -#define cmd_GB_8BIT 1412 -#define cmd_KSC_8BIT 1413 -#define cmd_2022_KR 1414 -#define cmd_USER_DEFINED_ENCODING 1415 -#define cmd_MAC_CYRILLIC 1416 -#define cmd_8859_5 1417 -#define cmd_CP1251 1418 -#define cmd_KOI8R 1419 -#define cmd_MAC_GREEK 1420 -#define cmd_8859_7 1421 -#define cmd_CP1250 1422 -#define cmd_MAC_TURKISH 1423 -#define cmd_8859_9 1424 -#define cmd_UTF8 1425 -#define cmd_UTF7 1426 -#define cmd_CP1253 1427 - -#define ENCODING_CEILING 1499 // Can I assume we will allow at most 30 encodings? - // No!!! reserve 100 - ftang -#define MAX_ENCODINGS_IN_PULLRIGHT (ENCODING_CEILING - ENCODING_BASE) - -#define FENC_RESTYPE 'Fnec' -#define FNEC_RESID 128 -#define CSIDLIST_RESTYPE 'CsiL' -#define CSIDLIST_RESID 128 - - -#define cmd2csid_tbl_ResID 140 - -// ¥¥Êabout: resources -// if resources end in text they are 'TEXT' resources. -// Otherwise they are 'TANG' -#define ABOUT_ABOUTPAGE_TEXT 128 -#define ABOUT_BIGLOGO_TANG 129 -#define ABOUT_PLUGINS_TEXT 130 -#define ABOUT_AUTHORS_TEXT 131 -#define ABOUT_MAIL_TEXT 134 -#define ABOUT_RSALOGO_TANG 135 -#define ABOUT_MOZILLA_TEXT 136 -#define ABOUT_HYPE_TANG 137 -#define ABOUT_BLANK_TEXT 138 - -#define ABOUT_JAVALOGO_TANG 140 -#define ABOUT_CUSTOM_TEXT 201 // optional resource added by EKit -#ifdef EDITOR -#define ABOUT_NEW_DOCUMENT 139 -#endif -#define ABOUT_LICENSE 2890 - -#define ABOUT_QTLOGO_TANG 141 -#ifdef FORTEZZA -#define ABOUT_LITRONIC_TANG 142 -#endif - -// new for communicator - -#define ABOUT_INSOLOGO_TANG 132 -#define ABOUT_LITRONIC_TANG 133 -#define ABOUT_MCLOGO_TANG 150 -#define ABOUT_MMLOGO_TANG 151 -#define ABOUT_NCCLOGO_TANG 152 -#define ABOUT_ODILOGO_TANG 153 -#define ABOUT_SYMLOGO_TANG 154 -#define ABOUT_TDLOGO_TANG 155 -#define ABOUT_VISILOGO_TANG 156 -#define ABOUT_COSLOGO_TANG 157 - -// new for mozilla source release - -#define ABOUT_MOZILLA_FLAME 158 - -// Selector Bar icons in Aurora -#define ABOUT_HISTORYGIF_TANG 159 -#define ABOUT_PERSONALGIF_TANG 160 -#define ABOUT_SEARCHGIF_TANG 161 -#define ABOUT_SITEMAPGIF_TANG 162 -#define ABOUT_FILESGIF_TANG 163 -#define ABOUT_GUIDEGIF_TANG 164 - - -// Alerts for the help system -// where the hell am I suppose to define these? - -#define BAD_HELPDOC_ALERT 1050 -#define BAD_MEDIADOC_ALERT 1051 -#define HELPILIZE_FAILED 1052 - -// we use this next one in the browser now. -#define EDITDLG_SAVE_PROGRESS 5101 -#ifdef EDITOR -#define EDITDLG_SAVE_FILE_EXISTS 5103 -#define EDITDLG_LINE_FORMAT 5104 -#define EDITDLG_TARGET 5105 -#define EDITDLG_CONFIRM_OBLITERATE_LINK 5106 -#define EDITDLG_SAVE_BEFORE_QUIT 5109 -#define EDITDLG_COPYRIGHT_WARNING 5110 -#define EDITDLG_SAVE_BEFORE_BROWSE 5111 -#define EDITDLG_ENCODING 5112 -#define EDITDLG_UNKNOWN_TAG 5113 -#define EDITDLG_TABLE 5116 -#define EDITDLG_PUBLISH 5117 -#define EDITDLG_LIMITS 5118 -#define EDITDLG_FILE_MODIFIED 5119 -#define EDITDLG_AUTOSAVE 5120 -#define EDITDLG_BROWSE_PUBLISHED 5121 -#define EDITDLG_PAGE_TITLE 5122 - -// These are Tabbed dialog boxes used for the editor -// Each dialog box below has a Tab with several views -#define EDITDLG_TAB_BASE 5150 -#define EDITDLG_IMAGE 5150 -#define EDITDLG_TEXT_AND_LINK 5151 -#define EDITDLG_TEXT_STYLE 5152 -#define EDITDLG_DOC_INFO 5153 -#define EDITDLG_TABLE_INFO 5154 -#define EDITDLG_BKGD_AND_COLORS 5155 - -#endif // EDITOR - -// xlat resource stuff. This is use for single byte codeset conversion -// For CS_MAC_ROMAN -#define xlat_LATIN1_TO_MAC_ROMAN 128 -#define xlat_MAC_ROMAN_TO_LATIN1 129 -// For CS_MAC_CE -#define xlat_LATIN2_TO_MAC_CE 130 -#define xlat_MAC_CE_TO_LATIN2 131 -#define xlat_MAC_CE_TO_CP_1250 (((CS_MAC_CE & 0xff) << 8 ) | (CS_CP_1250 & 0xff)) -#define xlat_CP_1250_TO_MAC_CE (((CS_CP_1251 & 0xff) << 8 ) | (CS_MAC_CE & 0xff)) - -// For CS_MAC_CYRILLIC -#define xlat_MAC_CYRILLIC_TO_CP_1251 (((CS_MAC_CYRILLIC & 0xff) << 8 ) | (CS_CP_1251 & 0xff)) -#define xlat_CP_1251_TO_MAC_CYRILLIC (((CS_CP_1251 & 0xff) << 8 ) | (CS_MAC_CYRILLIC & 0xff)) -#define xlat_MAC_CYRILLIC_TO_8859_5 (((CS_MAC_CYRILLIC & 0xff) << 8 ) | (CS_8859_5 & 0xff)) -#define xlat_8859_5_TO_MAC_CYRILLIC (((CS_8859_5 & 0xff) << 8 ) | (CS_MAC_CYRILLIC & 0xff)) -#define xlat_MAC_CYRILLIC_TO_KOI8_R (((CS_MAC_CYRILLIC & 0xff) << 8 ) | (CS_KOI8_R & 0xff)) -#define xlat_KOI8_R_TO_MAC_CYRILLIC (((CS_KOI8_R & 0xff) << 8 ) | (CS_MAC_CYRILLIC & 0xff)) - -// For CS_MAC_GREEK -#define xlat_MAC_GREEK_TO_8859_7 (((CS_MAC_GREEK & 0xff) << 8 ) | (CS_8859_7 & 0xff)) -#define xlat_8859_7_TO_MAC_GREEK (((CS_8859_7 & 0xff) << 8 ) | (CS_MAC_GREEK & 0xff)) -#define xlat_MAC_GREEK_TO_CP_1253 (((CS_MAC_GREEK & 0xff) << 8 ) | (CS_CP_1253 & 0xff)) -#define xlat_CP_1253_TO_MAC_GREEK (((CS_CP_1253 & 0xff) << 8 ) | (CS_MAC_GREEK & 0xff)) - -// for CS_MAC_TURKISH -#define xlat_MAC_TURKISH_TO_8859_9 (((CS_MAC_TURKISH & 0xff) << 8 ) | (CS_8859_9 & 0xff)) -#define xlat_8859_9_TO_MAC_TURKISH (((CS_8859_9 & 0xff) << 8 ) | (CS_MAC_TURKISH & 0xff)) -#endif diff --git a/mozilla/cmd/macfe/interact/findw.cp b/mozilla/cmd/macfe/interact/findw.cp deleted file mode 100644 index d430ade9c0c..00000000000 --- a/mozilla/cmd/macfe/interact/findw.cp +++ /dev/null @@ -1,320 +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. - */ - -// =========================================================================== -// findw.cp -// Find dialog box -// Contains all the views/commands for the find dialog box -// Created by atotic, Aug 6th, 1994 -// =========================================================================== - -#include "findw.h" -#include "uapp.h" -#include "resgui.h" -#include "macutil.h" -//#include "VEditField.h" -#include "CTSMEditField.h" -#include -#include - -#include "csid.h" -#include "libi18n.h" - -#ifdef EDITOR -#include "edt.h" // composer find/replace dialog -#include "CBrowserContext.h" -#endif - - - - - // globals -CFindWindow* CFindWindow::sFindWindow = NULL; -CHTMLView* CFindWindow::sViewBeingSearched = NULL; // Who is being searched? -cstring CFindWindow::sLastSearch; // Last search string -Boolean CFindWindow::sCaseless = TRUE; // Search is caseless? -Boolean CFindWindow::sBackward = FALSE; // Search backward -Boolean CFindWindow::sWrap = FALSE; // Wrap ? - -Boolean LMailNewsFindWindow::sFindInHeaders = FALSE; // search message headers? -#ifdef EDITOR -cstring CComposeFindWindow::sLastReplace; // Last replacement string -#endif - -CFindWindow::CFindWindow(LStream* inStream) - : LDialogBox(inStream) -{ - sFindWindow = this; -} - -CFindWindow::~CFindWindow() -{ - StoreDefaultWindowState(this); - sFindWindow = NULL; -} - -void CFindWindow::FinishCreateSelf() -{ - LDialogBox::FinishCreateSelf(); - - RestoreDefaultWindowState(this); - - fSearchFor = (CTSMEditField*)sFindWindow->FindPaneByID('what'); - fCaseSensitive = (LStdCheckBox*)sFindWindow->FindPaneByID('case'); - fSearchBackwards = (LStdCheckBox*)sFindWindow->FindPaneByID('back'); - fWrapSearch = (LStdCheckBox*)sFindWindow->FindPaneByID('wrap'); -} - - // Interface to the application -void CFindWindow::RegisterViewTypes() -{ - RegisterClass_(CFindWindow); - - #ifdef EDITOR - RegisterClass_(CComposeFindWindow); - #endif - - #ifdef MOZ_MAIL_NEWS - RegisterClass_(LMailNewsFindWindow); - #endif -} - -void CFindWindow::SetDialogValues() -{ - CStr255 searchString(sLastSearch); - fSearchFor->SetDescriptor(searchString); - fSearchFor->SelectAll(); - sFindWindow->SetLatentSub(fSearchFor); - - fCaseSensitive->SetValue(!sCaseless); - fSearchBackwards->SetValue(sBackward); - - if (fWrapSearch != NULL) - fWrapSearch->SetValue(sWrap); -} - -void CFindWindow::SetTextTraitsID(ResIDT inTextTraitsID) -{ - fSearchFor->SetTextTraitsID(inTextTraitsID); -} - -void CFindWindow::DoFind(CHTMLView* theHTMLView) -{ - sViewBeingSearched = theHTMLView; - - if (!sFindWindow) - { - theHTMLView->CreateFindWindow(); - ThrowIfNil_(sFindWindow); - } - - if (theHTMLView->GetWinCSID() != INTL_CharSetNameToID(INTL_ResourceCharSet())) - { - sFindWindow->SetTextTraitsID( CPrefs::GetTextFieldTextResIDs(theHTMLView->GetWinCSID())); - } - - sFindWindow->SetDialogValues(); - sFindWindow->Show(); - sFindWindow->Select(); -} - -Boolean CFindWindow::CanFindAgain() -{ - return (sLastSearch.length() > 0); -} - -void CFindWindow::GetDialogValues() -{ - CStr255 lookFor; - fSearchFor->GetDescriptor(lookFor); - sLastSearch = (char*)lookFor; - sCaseless = (fCaseSensitive->GetValue() == 0); - sBackward = fSearchBackwards->GetValue(); - - sWrap = (fWrapSearch != NULL && fWrapSearch->GetValue()); -} - -void CFindWindow::ListenToMessage(MessageT inMessage, void* ioParam) -{ - switch( inMessage ) - { - case msg_OK: - { - this->GetDialogValues(); - sViewBeingSearched->DoFind(); - ListenToMessage( cmd_Close, NULL ); - break; - } - - - case msg_Cancel: - { - LDialogBox::ListenToMessage( cmd_Close, ioParam ); - break; - } - - default: - { - LDialogBox::ListenToMessage(inMessage, ioParam); - break; - } - } -} - - -/* SavePlace, RestorePlace and DoSetBounds all override the window and subpane - positioning behaviour used in FinishCreateSelf and the destructor, so that - only the window position is saved and restored. This is important to - the internationalization folks, who want the PPob to control pane positions, - rather than the preferences file. */ -void CFindWindow::SavePlace (LStream */*outPlace*/) -{ - // don't! -} - -void CFindWindow::RestorePlace (LStream */*inPlace*/) -{ - // don't -} - -void CFindWindow::DoSetBounds (const Rect &inBounds) // bounds in global coords -{ - // refuse to accept a change in window size: we're a fixed dialog, after all. - Rect newBounds = UWindows::GetWindowContentRect(GetMacPort()); - - newBounds.right += inBounds.left - newBounds.left; - newBounds.left = inBounds.left; - newBounds.bottom += inBounds.top - newBounds.top; - newBounds.top = inBounds.top; - - super::DoSetBounds (newBounds); -} - - -void CFindWindow::FindCommandStatus(CommandT /*inCommand*/, - Boolean & outEnabled, - Boolean & /*outUsesMark*/, - Char16 & /*outMark*/, - Str255 /*outName*/ ) -{ - // we're a modal dialog - outEnabled = false; -} - -#ifdef MOZ_MAIL_NEWS - -LMailNewsFindWindow::LMailNewsFindWindow( LStream* inStream ) -: CFindWindow( inStream ) -{ -} - -void LMailNewsFindWindow::FinishCreateSelf() -{ - CFindWindow::FinishCreateSelf(); - fFindInHeaders = (LStdRadioButton*)this->FindPaneByID( 'Rhea' ); -} - -void LMailNewsFindWindow::GetDialogValues() -{ - CFindWindow::GetDialogValues(); - sFindInHeaders = ( fFindInHeaders->GetValue() != 0 ); -} - - -#endif // MOZ_MAIL_NEWS - -# ifdef EDITOR -# pragma mark - - -CComposeFindWindow::CComposeFindWindow( LStream *inStream ) : CFindWindow( inStream ) -{ -} - - -void CComposeFindWindow::FinishCreateSelf() -{ - CFindWindow::FinishCreateSelf(); - - UReanimator::LinkListenerToControls( this, this, mPaneID ); - - fReplaceWith = (CTSMEditField *)sFindWindow->FindPaneByID( 'newT' ); - XP_ASSERT( fReplaceWith != NULL ); -} - - -void CComposeFindWindow::SetDialogValues() -{ - CFindWindow::SetDialogValues(); - - CStr255 replaceString( sLastReplace ); - fReplaceWith->SetDescriptor( replaceString ); - fReplaceWith->SelectAll(); - sFindWindow->SetLatentSub( fReplaceWith ); -} - - -void CComposeFindWindow::GetDialogValues() -{ - CFindWindow::GetDialogValues(); - - CStr255 replaceString; - fReplaceWith->GetDescriptor( replaceString ); - sLastReplace = (char*)replaceString; -} - - -void CComposeFindWindow::ListenToMessage(MessageT inMessage, void* ioParam) -{ - switch( inMessage ) - { - case msg_OK: /* find */ - { - this->GetDialogValues(); - sViewBeingSearched->DoFind(); - break; - } - - case 'Repl': - case 'RepA': - case 'RepN': - { - Str255 str; - fReplaceWith->GetDescriptor( str ); - p2cstr( str ); - - EDT_ReplaceText( (sViewBeingSearched->GetContext())->operator MWContext*(), (char *)str, - inMessage == 'RepA', sLastSearch, sCaseless, sBackward, sWrap ); - - /* do we need to find the next one? */ - if ( inMessage == 'RepN' ) - { - sViewBeingSearched->DoFind(); - } - break; - } - - default: - { - LDialogBox::ListenToMessage(inMessage, ioParam); - break; - } - } -} - - -# endif // EDITOR diff --git a/mozilla/cmd/macfe/interact/findw.h b/mozilla/cmd/macfe/interact/findw.h deleted file mode 100644 index 66a40d9f752..00000000000 --- a/mozilla/cmd/macfe/interact/findw.h +++ /dev/null @@ -1,144 +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. - */ - -// =========================================================================== -// findw.h -// Find dialog box. -// Contains find dialog box declarations. -// Minimal interface in the header file, most of the class definitions are in -// .cp file. -// Created by atotic, June 6th, 1994 -// =========================================================================== - - -#pragma once -#include -#include -#include -#include "cstring.h" -#include "CHTMLView.h" - -class CTSMEditField; - -/***************************************************************************** - * class CFindWindow - * Find dialog box - *****************************************************************************/ - -class CFindWindow: public LDialogBox -{ - private: - typedef LDialogBox super; - public: - enum { class_ID = 'find' }; - - // constructor - CFindWindow(LStream* inStream); - virtual ~CFindWindow(); - virtual void FinishCreateSelf(); - - virtual void GetDialogValues(); - virtual void SetDialogValues(); - virtual void SetTextTraitsID(ResIDT inTextTraitsID); - - static void DoFind(CHTMLView* theHTMLView); - static Boolean CanFindAgain(); - - // Interface to the application - static void RegisterViewTypes(); - - // events & commands - virtual void FindCommandStatus(CommandT inCommand, - Boolean& outEnabled, - Boolean& outUsesMark, - Char16& outMark, - Str255 outName); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void SavePlace (LStream *outPlace); - virtual void RestorePlace (LStream *inPlace); - virtual void DoSetBounds (const Rect &inBounds); - - static CHTMLView* sViewBeingSearched; - static CFindWindow* sFindWindow; // Global holds current find window - static cstring sLastSearch; // Last search string - static Boolean sCaseless; // Search is caseless? - static Boolean sBackward; // Search backward - static Boolean sWrap; // Wrap to beginning of doc - - protected: - CTSMEditField* fSearchFor; - LStdCheckBox* fCaseSensitive; - LStdCheckBox* fSearchBackwards; - LStdCheckBox* fWrapSearch; - - private: -}; - -class LMailNewsFindWindow: public CFindWindow -{ -public: - enum { class_ID = 'Dfmn' }; - - LMailNewsFindWindow( LStream* inStream ); - - virtual void FinishCreateSelf(); - virtual void GetDialogValues(); - - static Boolean sFindInHeaders; - -protected: - LStdRadioButton* fFindInHeaders; -}; - - -/***************************************************************************** - * class CComposeFindWindow - * handles Composer's Find/Replace dialog - *****************************************************************************/ - -class CComposeFindWindow: public CFindWindow -{ - public: - enum { class_ID = 'Efnd' }; - - CComposeFindWindow( LStream* inStream ); - virtual void FinishCreateSelf(); - virtual void ListenToMessage( MessageT inMessage, void* ioParam ); - virtual void SetDialogValues(); - virtual void GetDialogValues(); - - static cstring sLastReplace; // Last search string - - protected: - CTSMEditField* fReplaceWith; -}; - -/***************************************************************************** - * class CLoadURLBox - * The only thing it does is sets the fGetURLWindow of uapp to NULL on deletion - *****************************************************************************/ -class CLoadURLBox: public LDialogBox -{ -public: - CLoadURLBox( LStream* inStream ); - virtual ~CLoadURLBox(); -}; - - - - diff --git a/mozilla/cmd/macfe/pch/ClientDebugHeaders.pch b/mozilla/cmd/macfe/pch/ClientDebugHeaders.pch deleted file mode 100644 index 4c1d202d16f..00000000000 --- a/mozilla/cmd/macfe/pch/ClientDebugHeaders.pch +++ /dev/null @@ -1,45 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ClientDebugHeaders.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix_debug.h" - -#ifdef powerc - #pragma precompile_target "ClientDebugHeadersPPC" -#else - #pragma precompile_target "ClientDebugHeaders68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" diff --git a/mozilla/cmd/macfe/pch/ClientDebugHeaders.pch++ b/mozilla/cmd/macfe/pch/ClientDebugHeaders.pch++ deleted file mode 100644 index 193f48e7b0c..00000000000 --- a/mozilla/cmd/macfe/pch/ClientDebugHeaders.pch++ +++ /dev/null @@ -1,50 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ClientDebugHeaders.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix_debug.h" - -#ifdef powerc - #pragma precompile_target "ClientDebugHeadersPPC++" -#else - #pragma precompile_target "ClientDebugHeaders68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - diff --git a/mozilla/cmd/macfe/pch/ClientDebugPrefix.h b/mozilla/cmd/macfe/pch/ClientDebugPrefix.h deleted file mode 100644 index 83ccc6ae780..00000000000 --- a/mozilla/cmd/macfe/pch/ClientDebugPrefix.h +++ /dev/null @@ -1,49 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix_debug.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "ClientDebugHeadersPPC++" - #else - #include "ClientDebugHeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "ClientDebugHeaders68K++" - #else - #include "ClientDebugHeaders68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/ClientHeaders.pch b/mozilla/cmd/macfe/pch/ClientHeaders.pch deleted file mode 100644 index ea8720dffb8..00000000000 --- a/mozilla/cmd/macfe/pch/ClientHeaders.pch +++ /dev/null @@ -1,46 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ClientHeaders.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -#ifdef powerc - #pragma precompile_target "ClientHeadersPPC" -#else - #pragma precompile_target "ClientHeaders68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/ClientHeaders.pch++ b/mozilla/cmd/macfe/pch/ClientHeaders.pch++ deleted file mode 100644 index c3f5e43bc1c..00000000000 --- a/mozilla/cmd/macfe/pch/ClientHeaders.pch++ +++ /dev/null @@ -1,52 +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. - */ -// - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ClientHeaders.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -#ifdef powerc - #pragma precompile_target "ClientHeadersPPC++" -#else - #pragma precompile_target "ClientHeaders68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/ClientPrefix.h b/mozilla/cmd/macfe/pch/ClientPrefix.h deleted file mode 100644 index 8ffe9010094..00000000000 --- a/mozilla/cmd/macfe/pch/ClientPrefix.h +++ /dev/null @@ -1,49 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_Prefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "MacPrefix.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "ClientHeadersPPC++" - #else - #include "ClientHeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "ClientHeaders68K++" - #else - #include "ClientHeaders68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/Comm_Config.h b/mozilla/cmd/macfe/pch/Comm_Config.h deleted file mode 100644 index 24342b6a306..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Config.h +++ /dev/null @@ -1,34 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_Config.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -#undef DEBUG -#undef Debug_Throw -#undef Debug_Signal -#undef txtnDebug - - -#include "IDE_Options.h" -#include "Comm_Defines.h" - -#include "Component_Config.h" \ No newline at end of file diff --git a/mozilla/cmd/macfe/pch/Comm_DebugConfig.h b/mozilla/cmd/macfe/pch/Comm_DebugConfig.h deleted file mode 100644 index e7492baf340..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_DebugConfig.h +++ /dev/null @@ -1,33 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_DebugConfig.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -#define DEBUG 1 -#define Debug_Throw -#define Debug_Signal -#define txtnDebug - -#include "IDE_Options.h" -#include "Comm_Defines.h" - -#include "Component_Config.h" \ No newline at end of file diff --git a/mozilla/cmd/macfe/pch/Comm_DebugHeaders.pch b/mozilla/cmd/macfe/pch/Comm_DebugHeaders.pch deleted file mode 100644 index 18cddc9373c..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_DebugHeaders.pch +++ /dev/null @@ -1,47 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_DebugHeaders.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_DebugConfig.h" - -#ifdef powerc - #pragma precompile_target "Comm_DebugHeadersPPC" -#else - #pragma precompile_target "Comm_DebugHeaders68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/Comm_DebugHeaders.pch++ b/mozilla/cmd/macfe/pch/Comm_DebugHeaders.pch++ deleted file mode 100644 index 90e4c1b461b..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_DebugHeaders.pch++ +++ /dev/null @@ -1,52 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_DebugHeaders.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_DebugConfig.h" - -#ifdef powerc - #pragma precompile_target "Comm_DebugHeadersPPC++" -#else - #pragma precompile_target "Comm_DebugHeaders68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/Comm_DebugPrefix.h b/mozilla/cmd/macfe/pch/Comm_DebugPrefix.h deleted file mode 100644 index c5b446b424c..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_DebugPrefix.h +++ /dev/null @@ -1,50 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_DebugConfig.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Comm_DebugHeadersPPC++" - #else - #include "Comm_DebugHeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Comm_DebugHeaders68K++" - #else - #include "Comm_DebugHeaders68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/Comm_Defines.h b/mozilla/cmd/macfe/pch/Comm_Defines.h deleted file mode 100644 index c768de0ad0d..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Defines.h +++ /dev/null @@ -1,102 +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. - */ -#error "obsolete file" - -// ÑÑÑ Security -//#define NADA_VERSION -//#define EXPORT_VERSION -#define US_VERSION - -// ÑÑÑ Misc -//#define NO_DBM // define this to kill DBM -#define NEW_BOOKMARKS -// Enables us to switch profiling from project preferences - -// ÑÑÑ Version -//#define ALPHA -//#define BETA -// Comment out both ALPHA and BETA for the final version - -// ÑÑÑ Do we have an editor? -// 98-03-10 pchen -- moved into Component_Config.h -// #define EDITOR - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ You typically will not need to change things below here!!! -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#define MOCHA -#define MOZILLA_CLIENT -#ifndef NETSCAPE -#define NETSCAPE -#endif - -// #define JAVA 1 - -#ifdef JAVA - #define UNICODE_FONTLIST 1 -#endif - -#define LAYERS - -#define CASTED_READ_OBJECT(stream, type, reference) (reference = NULL) - -// Profile is set in project preferences -#if defined(__profile__) - #if(__profile__ == 1) - #ifndef PROFILE - #define PROFILE - #endif - #endif -#endif - -#ifdef EDITOR - // I don't know why I need this.. - #define CONST const -#endif - -#define VERSION_NUMBER "4_0b0" -#define ZIP_NAME "java"##VERSION_NUMBER - -// 1997-04-29 pkc -- if we ever remove this from zLibDebug.Prefixm then -// we need to remove this from here also -#define Z_PREFIX - -// 97/05/05 jrm -- use phil's new search scope api -#define B3_SEARCH_API - -#define macintosh // macintosh is defined for GUSI -#define XP_MAC 1 - -// we have to do this here because ConditionalMacros.h will be included from -// within OpenTptInternet.h and will stupidly define these to 1 if they -// have not been previously defined. The new PowerPlant (CWPro1) requires that -// this be set to 0. (pinkerton) -#define OLDROUTINENAMES 0 -#ifndef OLDROUTINELOCATIONS - #define OLDROUTINELOCATIONS 0 -#endif - -// OpenTransport.h has changed to not include the error messages we need from -// it unless this is defined. Why? dunnno...(pinkerton) -#define OTUNIXERRORS 1 - -#ifndef DEBUG - #define NDEBUG -#endif - diff --git a/mozilla/cmd/macfe/pch/Comm_Headers.c b/mozilla/cmd/macfe/pch/Comm_Headers.c deleted file mode 100644 index fd67d6bbb1c..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Headers.c +++ /dev/null @@ -1,50 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_Headers.c -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -// #include for some reason, including this messes up PP compiles, we get -// "already defined" errors - -// Unix headers -#include -#ifdef __MATH__ -#error scream -#endif -#include -#include -#include -#include -#include -#include -#ifdef __MATH__ -#error scream -#endif -#include -#include -#include -#include -#include -// #include -#include // include this first for errno's - -#include // Toolbox headers - // Action Classes -#include // Toolbox headers diff --git a/mozilla/cmd/macfe/pch/Comm_Headers.cp b/mozilla/cmd/macfe/pch/Comm_Headers.cp deleted file mode 100644 index 441436b2d59..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Headers.cp +++ /dev/null @@ -1,29 +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. - */ - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_Headers.cp -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -//#define __FP__ -// No! Powerplant's is now self-protecting. -#define PP_No_ObjectStreaming - -#include - -#include diff --git a/mozilla/cmd/macfe/pch/Comm_Headers.pch b/mozilla/cmd/macfe/pch/Comm_Headers.pch deleted file mode 100644 index 34997a0a48d..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Headers.pch +++ /dev/null @@ -1,47 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_Headers.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Config.h" - -#ifdef powerc - #pragma precompile_target "Comm_HeadersPPC" -#else - #pragma precompile_target "Comm_Headers68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/Comm_Headers.pch++ b/mozilla/cmd/macfe/pch/Comm_Headers.pch++ deleted file mode 100644 index af654f9d116..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Headers.pch++ +++ /dev/null @@ -1,52 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_Headers.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Config.h" - -#ifdef powerc - #pragma precompile_target "Comm_HeadersPPC++" -#else - #pragma precompile_target "Comm_Headers68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/Comm_Prefix.h b/mozilla/cmd/macfe/pch/Comm_Prefix.h deleted file mode 100644 index c8c96870246..00000000000 --- a/mozilla/cmd/macfe/pch/Comm_Prefix.h +++ /dev/null @@ -1,50 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Comm_Prefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Config.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Comm_HeadersPPC++" - #else - #include "Comm_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Comm_Headers68K++" - #else - #include "Comm_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/Component_Config.h b/mozilla/cmd/macfe/pch/Component_Config.h deleted file mode 100644 index c671073333a..00000000000 --- a/mozilla/cmd/macfe/pch/Component_Config.h +++ /dev/null @@ -1,49 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Component_Config.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// This file is the Mac equivalent to ns/config/liteness.mak on Windows. -// Set different #define's to control what components get built. - -#if defined(MOZ_LITE) // Nav-only - #define MOZ_JSD - #define MOZ_NAV_BUILD_PREFIX -#elif defined(MOZ_MEDIUM) // Nav + Composer - #define EDITOR - #define MOZ_JSD - #define MOZ_COMMUNICATOR_CONFIG_JS - #define MOZ_SPELLCHK -#else // The WHOLE enchilada - #define MOZ_MAIL_NEWS - #define EDITOR - #define MOZ_OFFLINE - #define MOZ_LOC_INDEP - #define MOZ_TASKBAR - #define MOZ_LDAP - #define MOZ_ADMIN_LIB - #define MOZ_COMMUNICATOR_NAME - #define MOZ_JSD - #define MOZ_IFC_TOOLS - #define MOZ_NETCAST - #define MOZ_COMMUNICATOR_ABOUT - #define MOZ_COMMUNICATOR_CONFIG_JS - #define MOZ_SPELLCHK -#endif diff --git a/mozilla/cmd/macfe/pch/MANIFEST b/mozilla/cmd/macfe/pch/MANIFEST deleted file mode 100644 index f035504014e..00000000000 --- a/mozilla/cmd/macfe/pch/MANIFEST +++ /dev/null @@ -1,6 +0,0 @@ -# -# This is a list of local files which get copied to the mozilla:dist directory -# - -ClientPrefix.h -ClientDebugPrefix.h diff --git a/mozilla/cmd/macfe/pch/Moz_Config.h b/mozilla/cmd/macfe/pch/Moz_Config.h deleted file mode 100644 index 7015ea57123..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_Config.h +++ /dev/null @@ -1,35 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_Config.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -#undef DEBUG -#undef Debug_Throw -#undef Debug_Signal -#undef txtnDebug - -#include "IDE_Options.h" -#include "Comm_Defines.h" - -#define MOZ_MEDIUM - -#include "Component_Config.h" \ No newline at end of file diff --git a/mozilla/cmd/macfe/pch/Moz_DebugConfig.h b/mozilla/cmd/macfe/pch/Moz_DebugConfig.h deleted file mode 100644 index 54ab6f20f81..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_DebugConfig.h +++ /dev/null @@ -1,35 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_DebugConfig.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -#define DEBUG 1 -#define Debug_Throw -#define Debug_Signal -#define txtnDebug - -#include "IDE_Options.h" -#include "Comm_Defines.h" - -#define MOZ_MEDIUM - -#include "Component_Config.h" \ No newline at end of file diff --git a/mozilla/cmd/macfe/pch/Moz_DebugHeaders.pch b/mozilla/cmd/macfe/pch/Moz_DebugHeaders.pch deleted file mode 100644 index a92944dd5d5..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_DebugHeaders.pch +++ /dev/null @@ -1,47 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_DebugHeaders.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Moz_DebugConfig.h" - -#ifdef powerc - #pragma precompile_target "Mozilla_DebugHeadersPPC" -#else - #pragma precompile_target "Mozilla_DebugHeaders68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/Moz_DebugHeaders.pch++ b/mozilla/cmd/macfe/pch/Moz_DebugHeaders.pch++ deleted file mode 100644 index 33f96848088..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_DebugHeaders.pch++ +++ /dev/null @@ -1,52 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_DebugHeaders.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Moz_DebugConfig.h" - -#ifdef powerc - #pragma precompile_target "Mozilla_DebugHeadersPPC++" -#else - #pragma precompile_target "Mozilla_DebugHeaders68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/Moz_DebugPrefix.h b/mozilla/cmd/macfe/pch/Moz_DebugPrefix.h deleted file mode 100644 index 55ffd79e3a2..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_DebugPrefix.h +++ /dev/null @@ -1,50 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Moz_DebugConfig.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Mozilla_DebugHeadersPPC++" - #else - #include "Mozilla_DebugHeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Mozilla_DebugHeaders68K++" - #else - #include "Mozilla_DebugHeaders68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/Moz_Headers.pch b/mozilla/cmd/macfe/pch/Moz_Headers.pch deleted file mode 100644 index 4dff6b624df..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_Headers.pch +++ /dev/null @@ -1,47 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_Headers.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Moz_Config.h" - -#ifdef powerc - #pragma precompile_target "Mozilla_HeadersPPC" -#else - #pragma precompile_target "Mozilla_Headers68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/Moz_Headers.pch++ b/mozilla/cmd/macfe/pch/Moz_Headers.pch++ deleted file mode 100644 index f919e4f86dc..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_Headers.pch++ +++ /dev/null @@ -1,53 +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. - */ -// -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_Headers.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Moz_Config.h" - -#ifdef powerc - #pragma precompile_target "Mozilla_HeadersPPC++" -#else - #pragma precompile_target "Mozilla_Headers68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/Moz_Prefix.h b/mozilla/cmd/macfe/pch/Moz_Prefix.h deleted file mode 100644 index 69fb49050ed..00000000000 --- a/mozilla/cmd/macfe/pch/Moz_Prefix.h +++ /dev/null @@ -1,50 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Moz_Prefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Moz_Config.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Mozilla_HeadersPPC++" - #else - #include "Mozilla_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Mozilla_Headers68K++" - #else - #include "Mozilla_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/Nav_Config.h b/mozilla/cmd/macfe/pch/Nav_Config.h deleted file mode 100644 index 8a518ade30e..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_Config.h +++ /dev/null @@ -1,35 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_Config.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -#undef DEBUG -#undef Debug_Throw -#undef Debug_Signal -#undef txtnDebug - -#include "IDE_Options.h" -#include "Comm_Defines.h" - -#define MOZ_LITE - -#include "Component_Config.h" \ No newline at end of file diff --git a/mozilla/cmd/macfe/pch/Nav_DebugConfig.h b/mozilla/cmd/macfe/pch/Nav_DebugConfig.h deleted file mode 100644 index 7b60094680b..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_DebugConfig.h +++ /dev/null @@ -1,35 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_DebugConfig.h -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - - -#define DEBUG 1 -#define Debug_Throw -#define Debug_Signal -#define txtnDebug - -#include "IDE_Options.h" -#include "Comm_Defines.h" - -#define MOZ_LITE - -#include "Component_Config.h" \ No newline at end of file diff --git a/mozilla/cmd/macfe/pch/Nav_DebugHeaders.pch b/mozilla/cmd/macfe/pch/Nav_DebugHeaders.pch deleted file mode 100644 index 5ca2b478b88..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_DebugHeaders.pch +++ /dev/null @@ -1,47 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_DebugHeaders.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Nav_DebugConfig.h" - -#ifdef powerc - #pragma precompile_target "Navigator_DebugHeadersPPC" -#else - #pragma precompile_target "Navigator_DebugHeaders68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/Nav_DebugHeaders.pch++ b/mozilla/cmd/macfe/pch/Nav_DebugHeaders.pch++ deleted file mode 100644 index 782c67b26c7..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_DebugHeaders.pch++ +++ /dev/null @@ -1,52 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_DebugHeaders.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Nav_DebugConfig.h" - -#ifdef powerc - #pragma precompile_target "Navigator_DebugHeadersPPC++" -#else - #pragma precompile_target "Navigator_DebugHeaders68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/Nav_DebugPrefix.h b/mozilla/cmd/macfe/pch/Nav_DebugPrefix.h deleted file mode 100644 index c41327304b4..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_DebugPrefix.h +++ /dev/null @@ -1,50 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_DebugPrefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Nav_DebugConfig.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Navigator_DebugHeadersPPC++" - #else - #include "Navigator_DebugHeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Navigator_DebugHeaders68K++" - #else - #include "Navigator_DebugHeaders68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/pch/Nav_Headers.pch b/mozilla/cmd/macfe/pch/Nav_Headers.pch deleted file mode 100644 index 89c66bcbadb..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_Headers.pch +++ /dev/null @@ -1,47 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_Headers.pch -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Nav_Config.h" - -#ifdef powerc - #pragma precompile_target "Navigator_HeadersPPC" -#else - #pragma precompile_target "Navigator_Headers68K" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the list of headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Comm_Headers.c" - diff --git a/mozilla/cmd/macfe/pch/Nav_Headers.pch++ b/mozilla/cmd/macfe/pch/Nav_Headers.pch++ deleted file mode 100644 index cab82be9a5a..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_Headers.pch++ +++ /dev/null @@ -1,53 +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. - */ -// -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_Headers.pch++ -// -// NOTE: -// -// You will typically not need to edit this file. If you want to add -// a file to the C/C++ precompiled header, do it in Comm_Headers.c -// or Borwser_Headers.cp respectively. -// -// If you're doing a non-debug build, use the non-debug project which -// will has pch files that generate non-debug dumps. -// -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Nav_Config.h" - -#ifdef powerc - #pragma precompile_target "Navigator_HeadersPPC++" -#else - #pragma precompile_target "Navigator_Headers68K++" -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ Include the headers. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -extern "C" { - #include "Comm_Headers.c" -} - -#include "Comm_Headers.cp" - - diff --git a/mozilla/cmd/macfe/pch/Nav_Prefix.h b/mozilla/cmd/macfe/pch/Nav_Prefix.h deleted file mode 100644 index cd67d380b54..00000000000 --- a/mozilla/cmd/macfe/pch/Nav_Prefix.h +++ /dev/null @@ -1,50 +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. - */ -#error "obsolete file" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// Nav_Prefix.h -// -// NOTE: -// You typically won't need to change anything in this file. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#include "Nav_Config.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ When we split out the procompiled headers seperately, we will not -// be including them here. We will instead define things like -// PowerPlant_PCH and include them at the top of the applicable source -// modules -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -#ifdef __powerc - #ifdef __cplusplus - #include "Navigator_HeadersPPC++" - #else - #include "Navigator_HeadersPPC" - #endif -#else - #ifdef __cplusplus - #include "Navigator_Headers68K++" - #else - #include "Navigator_Headers68K" - #endif -#endif - - diff --git a/mozilla/cmd/macfe/prefs/CAssortedMediators.cp b/mozilla/cmd/macfe/prefs/CAssortedMediators.cp deleted file mode 100644 index 542dc2f064f..00000000000 --- a/mozilla/cmd/macfe/prefs/CAssortedMediators.cp +++ /dev/null @@ -1,2018 +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. - */ - -#include "CAssortedMediators.h" - - -extern "C" -{ -#include "xp_help.h" -} - -#include "prefapi.h" -#ifdef MOZ_MAIL_NEWS -#include "CMailNewsContext.h" -#endif -#include "CBrowserWindow.h" -#include "CBrowserContext.h" -#include "InternetConfig.h" -#ifdef MOZ_MAIL_NEWS -#include "CMessageFolder.h" -#endif -#include "UGraphicGizmos.h" -#include "CToolTipAttachment.h" -#include "CValidEditField.h" - -#include "MPreference.h" -#include "PrefControls.h" - -//#include "prefwutil.h" -#include "glhist.h" -#include "proto.h" -//#include "meditdlg.h" -#include "macgui.h" -#include "resgui.h" -#include "ufilemgr.h" -#include "uerrmgr.h" -#include "libi18n.h" -#include "abdefn.h" -#include "addrbook.h" - -#include "np.h" -#include "uapp.h" - -#include "macutil.h" - -#include "CSizePopup.h" - -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include - -#include - - -//#include -//#include -#include -#ifdef MOZ_MAIL_NEWS -#define DEFAULT_NEWS_SERVER_KLUDGE -#ifdef DEFAULT_NEWS_SERVER_KLUDGE - #include "CMailNewsContext.h" - #include "CMailProgressWindow.h" -#endif -#endif - - -#pragma mark ---CEditFieldControl--- -//====================================== -class CEditFieldControl : public LGAEditField -//====================================== -{ - // Note: This is not derived from LControl! It has control in the - // name because it broadcasts when the user changes its contents. - - public: - enum - { - class_ID = 'edtC', - msg_ChangedText = 'TxtC' - }; - virtual ~CEditFieldControl() {} - CEditFieldControl(LStream *inStream) : - LGAEditField(inStream) - {} - virtual void UserChangedText(); -}; // class CEditFieldControl - -//----------------------------------- -void CEditFieldControl::UserChangedText() -//----------------------------------- -{ - BroadcastMessage(msg_ChangedText, this); -} - -//====================================== -#pragma mark --CAppearanceMainMediator--- -//====================================== - -enum -{ - eBrowserBox = 12001, - eMailBox, - eNewsBox, - eEditorBox, - eConferenceBox, - eCalendarBox, - eNetcasterBox, - ePicturesAndTextRButton, - eShowToolTipsBox, - ePicturesOnlyRButton, - eTextOnlyRButton, - eDesktopPatternBox -}; - -//----------------------------------- -CAppearanceMainMediator::CAppearanceMainMediator(LStream*) -//----------------------------------- -: CPrefsMediator(class_ID) -{ -} - -//----------------------------------- -void CAppearanceMainMediator::LoadPrefs() -//----------------------------------- -{ - const OSType kConferenceAppSig = 'Ncq¹'; - FSSpec fspec; - if (CFileMgr::FindApplication(kConferenceAppSig, fspec) != noErr) - { - LGACheckbox* checkbox = (LGACheckbox *)FindPaneByID(eConferenceBox); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - // disable the control - checkbox->Disable(); - } - - const OSType kCalendarAppSig = 'NScl'; - if (CFileMgr::FindApplication(kCalendarAppSig, fspec) != noErr) - { - LGACheckbox* checkbox = (LGACheckbox *)FindPaneByID(eCalendarBox); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - // disable the control - checkbox->Disable(); - } - - if (!FE_IsNetcasterInstalled()) - { - LGACheckbox* checkbox = (LGACheckbox *)FindPaneByID(eNetcasterBox); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - // disable the control - checkbox->Disable(); - } -} - -void CAppearanceMainMediator::WritePrefs() -{ - // this pref will not take effect immediately unless we tell the CToolTipAttachment - // class to make it so - LGACheckbox *theBox = (LGACheckbox *)FindPaneByID(eShowToolTipsBox); - XP_ASSERT(theBox); - CToolTipAttachment::Enable(theBox->GetValue()); -} - -enum -{ - eCharSetMenu = 12101, - ePropFontMenu, - ePropSizeMenu, - eFixedFontMenu, - eFixedSizeMenu, - eAlwaysOverrideRButton, - eQuickOverrideRButton, - eNeverOverrideRButton -}; - - -//----------------------------------- -CAppearanceFontsMediator::CAppearanceFontsMediator(LStream*) -//----------------------------------- -: CPrefsMediator(class_ID) -, mEncodings(nil) -{ -} - -int -CAppearanceFontsMediator::GetSelectEncMenuItem() -{ - LGAPopup *encMenu = (LGAPopup *)FindPaneByID(eCharSetMenu); - XP_ASSERT(encMenu); - return encMenu->GetValue(); -} - -void -CAppearanceFontsMediator::UpdateEncoding(PaneIDT changedMenuID) -{ - Int32 selectedEncMenuItem = GetSelectEncMenuItem(); - XP_ASSERT(selectedEncMenuItem <= mEncodingsCount); - - if (changedMenuID == ePropFontMenu || changedMenuID == eFixedFontMenu) - { - LGAPopup *changedMenu = (LGAPopup *)FindPaneByID(changedMenuID); - XP_ASSERT(changedMenu); - int changedMenuValue = changedMenu->GetValue(); - CStr255 itemString; - ::GetMenuItemText(changedMenu->GetMacMenuH(), changedMenuValue, itemString); - if (changedMenuID == ePropFontMenu) - { - mEncodings[selectedEncMenuItem - 1].mPropFont = itemString; - } - else - { - mEncodings[selectedEncMenuItem - 1].mFixedFont = itemString; - } - } - else if (changedMenuID == ePropSizeMenu || changedMenuID == eFixedSizeMenu) - { - CSizePopup *sizeMenu = (CSizePopup *)FindPaneByID(changedMenuID); - XP_ASSERT(sizeMenu); - if (changedMenuID == ePropSizeMenu) - { - mEncodings[selectedEncMenuItem - 1].mPropFontSize = sizeMenu->GetFontSize(); - } - else - { - mEncodings[selectedEncMenuItem - 1].mFixedFontSize = sizeMenu->GetFontSize(); - } - } -} - - -void -CAppearanceFontsMediator::UpdateMenus() -{ - Int32 selectedEncMenuItem = GetSelectEncMenuItem(); - XP_ASSERT(selectedEncMenuItem <= mEncodingsCount); - - CSizePopup *propSizeMenu = (CSizePopup *)FindPaneByID(ePropSizeMenu); - XP_ASSERT(propSizeMenu); - propSizeMenu->SetFontSize(mEncodings[selectedEncMenuItem - 1].mPropFontSize); - if (mEncodings[selectedEncMenuItem - 1].mPropFontSizeLocked) - { - propSizeMenu->Disable(); - } - else - { - propSizeMenu->Enable(); - } - CSizePopup *fixedSizeMenu = (CSizePopup *)FindPaneByID(eFixedSizeMenu); - XP_ASSERT(fixedSizeMenu); - fixedSizeMenu->SetFontSize(mEncodings[selectedEncMenuItem - 1].mFixedFontSize); - if (mEncodings[selectedEncMenuItem - 1].mFixedFontSizeLocked) - { - fixedSizeMenu->Disable(); - } - else - { - fixedSizeMenu->Enable(); - } - - Str255 fontName; - LGAPopup *propFontMenu = (LGAPopup *)FindPaneByID(ePropFontMenu); - XP_ASSERT(propFontMenu); - if (!SetLGAPopupToNamedItem(propFontMenu, mEncodings[selectedEncMenuItem - 1].mPropFont)) - { - GetFontName(applFont, fontName); - if (!SetLGAPopupToNamedItem(propFontMenu, fontName)) - { - propFontMenu->SetValue(1); - } - } - propSizeMenu->MarkRealFontSizes(propFontMenu); - if (mEncodings[selectedEncMenuItem - 1].mPropFontLocked) - { - propFontMenu->Disable(); - } - else - { - propFontMenu->Enable(); - } - - LGAPopup *fixedFontMenu = (LGAPopup *)FindPaneByID(eFixedFontMenu); - XP_ASSERT(fixedFontMenu); - if (!SetLGAPopupToNamedItem(fixedFontMenu, mEncodings[selectedEncMenuItem - 1].mFixedFont)) - { - GetFontName(applFont, fontName); - if (!SetLGAPopupToNamedItem(fixedFontMenu, fontName)) - { - fixedFontMenu->SetValue(1); - } - } - fixedSizeMenu->MarkRealFontSizes(fixedFontMenu); - if (mEncodings[selectedEncMenuItem - 1].mFixedFontLocked) - { - fixedFontMenu->Disable(); - } - else - { - fixedFontMenu->Enable(); - } -} - - -void -CAppearanceFontsMediator::SetEncodingWithPref(Encoding& enc) -{ - char *propFontTemplate = "intl.font%hu.prop_font"; - char *fixedFontTemplate = "intl.font%hu.fixed_font"; - char *propFontSizeTemplate = "intl.font%hu.prop_size"; - char *fixedFontSizeTemplate = "intl.font%hu.fixed_size"; - char prefBuffer[255]; - char fontNameBuffer[32]; - int bufferLength; - int32 fontSize; - - sprintf(prefBuffer, propFontTemplate, enc.mCSID); - bufferLength = 32; - PREF_GetCharPref(prefBuffer, fontNameBuffer, &bufferLength); - enc.mPropFont = fontNameBuffer; - enc.mPropFontLocked = PREF_PrefIsLocked(prefBuffer); - - sprintf(prefBuffer, fixedFontTemplate, enc.mCSID); - bufferLength = 32; - PREF_GetCharPref(prefBuffer, fontNameBuffer, &bufferLength); - enc.mFixedFont = fontNameBuffer; - enc.mFixedFontLocked = PREF_PrefIsLocked(prefBuffer); - - sprintf(prefBuffer, propFontSizeTemplate, enc.mCSID); - PREF_GetIntPref(prefBuffer, &fontSize); - enc.mPropFontSize = fontSize; - enc.mPropFontSizeLocked = PREF_PrefIsLocked(prefBuffer); - - sprintf(prefBuffer, fixedFontSizeTemplate, enc.mCSID); - PREF_GetIntPref(prefBuffer, &fontSize); - enc.mFixedFontSize = fontSize; - enc.mFixedFontSizeLocked = PREF_PrefIsLocked(prefBuffer); -} - -void -CAppearanceFontsMediator::ReadEncodings(Handle hndl) -{ - unsigned short numberEncodings; - - LHandleStream stream(hndl); - - stream.ReadData(&numberEncodings, sizeof(unsigned short)); - XP_ASSERT(numberEncodings > 0); - mEncodingsCount = numberEncodings; - mEncodings = new Encoding[numberEncodings]; - XP_ASSERT(mEncodings != nil); - for(int i = 0; i < numberEncodings; i++) - { - CStr31 EncodingName; - CStr31 PropFont; - CStr31 FixedFont; - unsigned short PropFontSize; - unsigned short FixedFontSize; - unsigned short CSID; - unsigned short FallbackFontScriptID; - unsigned short TxtrButtonResID; - unsigned short TxtrTextFieldResID; - - stream.ReadData(&EncodingName, sizeof( CStr31)); - stream.ReadData(&PropFont, sizeof( CStr31)); - stream.ReadData(&FixedFont, sizeof( CStr31)); - stream.ReadData(&PropFontSize, sizeof( unsigned short)); - stream.ReadData(&FixedFontSize, sizeof( unsigned short)); - stream.ReadData(&CSID, sizeof( unsigned short)); - stream.ReadData(&FallbackFontScriptID, sizeof( unsigned short)); - stream.ReadData(&TxtrButtonResID, sizeof( unsigned short)); - stream.ReadData(&TxtrTextFieldResID, sizeof( unsigned short)); - - mEncodings[i].mLanguageGroup = EncodingName; - mEncodings[i].mCSID = CSID; - mEncodings[i].mPropFont = PropFont; - mEncodings[i].mFixedFont = FixedFont; - mEncodings[i].mPropFontSize = PropFontSize; - mEncodings[i].mFixedFontSize = FixedFontSize; - SetEncodingWithPref(mEncodings[i]); - } -} - -void -CAppearanceFontsMediator::LoadEncodings() -{ - Handle hndl; - ::UseResFile(LMGetCurApRefNum()); - hndl = ::Get1Resource(FENC_RESTYPE,FNEC_RESID); - if (hndl) - { - if (!*hndl) - { - ::LoadResource(hndl); - } - if (*hndl) - { - ::DetachResource(hndl); - ThrowIfResError_(); - ReadEncodings(hndl); - DisposeHandle(hndl); - } - } -} - - -void -CAppearanceFontsMediator::PopulateEncodingsMenus(PaneIDT menuID) -{ - if (!mEncodings) - { - LoadEncodings(); - } - LGAPopup *theMenu = (LGAPopup *)FindPaneByID(menuID); - XP_ASSERT(theMenu); - for (int i = 0; i < mEncodingsCount; ++i) - { - MenuHandle menuH = theMenu->GetMacMenuH(); - AppendMenu(menuH, "\pabc"); - SetMenuItemText(menuH, i + 1, mEncodings[i].mLanguageGroup); - } - theMenu->SetMaxValue(mEncodingsCount); - theMenu->SetValue(1); -} - -void -CAppearanceFontsMediator::SetPrefWithEncoding(const Encoding& enc) -{ - char *propFontTemplate = "intl.font%hu.prop_font"; - char *fixedFontTemplate = "intl.font%hu.fixed_font"; - char *propFontSizeTemplate = "intl.font%hu.prop_size"; - char *fixedFontSizeTemplate = "intl.font%hu.fixed_size"; - char prefBuffer[255]; - - if (!enc.mPropFontLocked) - { - sprintf(prefBuffer, propFontTemplate, enc.mCSID); - PREF_SetCharPref(prefBuffer, (char *)enc.mPropFont); - } - - if (!enc.mFixedFontLocked) - { - sprintf(prefBuffer, fixedFontTemplate, enc.mCSID); - PREF_SetCharPref(prefBuffer, (char *)enc.mFixedFont); - } - - if (!enc.mPropFontSizeLocked) - { - sprintf(prefBuffer, propFontSizeTemplate, enc.mCSID); - PREF_SetIntPref(prefBuffer, enc.mPropFontSize); - } - - if (!enc.mFixedFontSizeLocked) - { - sprintf(prefBuffer, fixedFontSizeTemplate, enc.mCSID); - PREF_SetIntPref(prefBuffer, enc.mFixedFontSize); - } -} - -void -CAppearanceFontsMediator::WriteEncodingPrefs() -{ - for(int i = 0; i < mEncodingsCount; i++) - { - SetPrefWithEncoding(mEncodings[i]); - } -} - - -Int16 -CAppearanceFontsMediator::GetFontSize(LGAPopup* whichPopup) -{ - Str255 sizeString; - Int32 fontSize = 12; - MenuHandle sizeMenu; - short menuSize; - short inMenuItem; - - sizeMenu = whichPopup->GetMacMenuH(); - menuSize = CountMItems(sizeMenu); - inMenuItem = whichPopup->GetValue(); - - GetMenuItemText(sizeMenu, inMenuItem, sizeString); - - myStringToNum(sizeString, &fontSize); - return fontSize; -} - -void -CAppearanceFontsMediator::FontMenuChanged(PaneIDT changedMenuID) -{ - CSizePopup *sizePopup = - (CSizePopup *)FindPaneByID(ePropFontMenu == changedMenuID ? - ePropSizeMenu : - eFixedSizeMenu); - XP_ASSERT(sizePopup); - LGAPopup *fontPopup = (LGAPopup *)FindPaneByID(changedMenuID); - XP_ASSERT(fontPopup); - sizePopup->MarkRealFontSizes(fontPopup); - UpdateEncoding(changedMenuID); -} - -void -CAppearanceFontsMediator::SizeMenuChanged(PaneIDT changedMenuID) -{ - UpdateEncoding(changedMenuID); -} - -void -CAppearanceFontsMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case eCharSetMenu: - UpdateMenus(); - break; - case msg_ChangeFontSize: - break; - case ePropFontMenu: - case eFixedFontMenu: - FontMenuChanged(inMessage); - break; - case ePropSizeMenu: - case eFixedSizeMenu: - SizeMenuChanged(inMessage); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -void -CAppearanceFontsMediator::LoadPrefs() -{ - PopulateEncodingsMenus(eCharSetMenu); - UpdateMenus(); -} - -void -CAppearanceFontsMediator::WritePrefs() -{ - WriteEncodingPrefs(); -} - -enum -{ - eForegroundColorButton = 12201, - eBackgroundColorButton, - eUnvisitedColorButton, - eVisitedColorButton, - eUnderlineLinksBox, - eUseDefaultButton, - eOverrideDocColors -}; - -CAppearanceColorsMediator::CAppearanceColorsMediator(LStream*) -: CPrefsMediator(class_ID) -{ -} - -void -CAppearanceColorsMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case eUseDefaultButton: - UseDefaults(); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -void -CAppearanceColorsMediator::UseDefaults() -{ - ReadDefaultPref(eForegroundColorButton); - ReadDefaultPref(eUnvisitedColorButton); - ReadDefaultPref(eVisitedColorButton); - ReadDefaultPref(eBackgroundColorButton); -} - -enum -{ - eBlankPageRButton = 12301, - eHomePageRButton, - eLastPageRButton, - eHomePageTextEditBox, - eHomePageChooseButton, - eExpireAfterTextEditBox, - eExpireNowButton, - eUseCurrentButton -}; - -enum -{ - eExpireLinksDialog = 1060, - eClearDiskCacheDialog = 1065 -}; - -CBrowserMainMediator::CBrowserMainMediator(LStream*) -: CPrefsMediator(class_ID) -, mHomePageURLLocked(false) -, mCurrentURL(nil) -{ -} - -void -CBrowserMainMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { -// case msg_ControlClicked: -// break; - case eHomePageChooseButton: - SetEditFieldWithLocalFileURL(eHomePageTextEditBox, mHomePageURLLocked); - // do whatever it takes to find a home page file - break; - case eExpireNowButton: - // do whatever it takes to expire links - ExpireNow(); - break; - case eUseCurrentButton: - // do whatever it takes to find the current page - if (mCurrentURL && *mCurrentURL) - { - LStr255 pURL(mCurrentURL); - LEditField *theField = - (LEditField *)FindPaneByID(eHomePageTextEditBox); - XP_ASSERT(theField); - theField->SetDescriptor(pURL); - theField->SelectAll(); - } - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -void -CBrowserMainMediator::ExpireNow() -{ - StPrepareForDialog prepare; - short response = ::CautionAlert(eExpireLinksDialog, NULL); - if (1 == response) - { - GH_ClearGlobalHistory(); - XP_RefreshAnchors(); - } -} - -Boolean -CBrowserMainMediator::ExpireDaysValidationFunc(CValidEditField *daysTilExpire) -{ - Boolean result; - result = ConstrainEditField(daysTilExpire, EXPIRE_MIN, EXPIRE_MAX); - if (!result) - { - StPrepareForDialog prepare; - ::StopAlert(1064, NULL); - } - return result; -} - -void -CBrowserMainMediator::LoadMainPane() -{ - CPrefsMediator::LoadMainPane(); - SetValidationFunction(eExpireAfterTextEditBox, ExpireDaysValidationFunc); -} - -void -CBrowserMainMediator::UpdateFromIC() -{ - SetEditFieldsWithICPref(kICWWWHomePage, eHomePageTextEditBox); - URLChoosingButtons(!UseIC() && !mHomePageURLLocked); -} - -void -CBrowserMainMediator::URLChoosingButtons(Boolean enable) -{ - LButton *currentURLButton = (LButton *)FindPaneByID(eUseCurrentButton); - XP_ASSERT(currentURLButton); - LButton *chooseURLButton = (LButton *)FindPaneByID(eHomePageChooseButton); - XP_ASSERT(chooseURLButton); - if (enable) - { - currentURLButton->Enable(); - chooseURLButton->Enable(); - } - else - { - currentURLButton->Disable(); - chooseURLButton->Disable(); - } -} - -//----------------------------------- -void CBrowserMainMediator::LoadPrefs() -//----------------------------------- -{ - mHomePageURLLocked = PaneHasLockedPref(eHomePageTextEditBox); - if (!mHomePageURLLocked) // If locked we don't need the current url. - { - URLChoosingButtons(true); - CWindowMediator *mediator = CWindowMediator::GetWindowMediator(); - CBrowserWindow *browserWindow = - (CBrowserWindow *)mediator->FetchTopWindow(WindowType_Browser); - if (browserWindow) - { - CNSContext *context = browserWindow->GetWindowContext(); - mCurrentURL = XP_STRDUP(context->GetCurrentURL()); - } - } - else - { - URLChoosingButtons(false); - } - LButton *currentURLButton = (LButton *)FindPaneByID(eUseCurrentButton); - XP_ASSERT(currentURLButton); - if (mHomePageURLLocked || (!mCurrentURL) || (!(*mCurrentURL))) - currentURLButton->Disable(); - else - currentURLButton->Enable(); -} - -//----------------------------------- -void CBrowserMainMediator::WritePrefs() -//----------------------------------- -{ -} - -enum -{ - eBuiltInLanguageStringResID = 5028, - eBuiltInLanguageCodeResID = 5029, - eLanguageList = 12401, - eAddLanguageButton, - eDeleteLanguageButton, - eAddLanguageList, - eAddLanguageOtherEditField, - eAddLanguageDialogID = 12004 -}; - - - -CBrowserLanguagesMediator::CBrowserLanguagesMediator(LStream*) -: CPrefsMediator(class_ID) -, mLanguagesLocked(false) -, mBuiltInCount(0) -, mLanguageStringArray(nil) -, mLangaugeCodeArray(nil) -{ -} - -CBrowserLanguagesMediator::~CBrowserLanguagesMediator() -{ - int i; - if (mLanguageStringArray) - { - for (i = 0; i < mBuiltInCount; ++i) - { - if (mLanguageStringArray[i]) - { - XP_FREE(mLanguageStringArray[i]); - } - } - XP_FREE(mLanguageStringArray); - } - if (mLangaugeCodeArray) - { - for (i = 0; i < mBuiltInCount; ++i) - { - if (mLangaugeCodeArray[i]) - { - XP_FREE(mLangaugeCodeArray[i]); - } - } - XP_FREE(mLangaugeCodeArray); - } -} - -char * -CBrowserLanguagesMediator::GetLanguageDisplayString( const char *languageCode) -{ - char *result; - int i; - for (i = 0; i < mBuiltInCount; ++i) - { - if (!strcmp(languageCode, mLangaugeCodeArray[i])) - { - const char * const formatString = "%s [%s]"; - int newStringLength = strlen(mLangaugeCodeArray[i]) + - strlen(mLanguageStringArray[i]) + - strlen(formatString) - - 4; // the two "%s"s in the format string - result = (char *)XP_ALLOC(newStringLength + 1); - sprintf(result, formatString, mLanguageStringArray[i], mLangaugeCodeArray[i]); - break; - } - } - if (i == mBuiltInCount) // then we didn't find a match - { - result = (char *)XP_ALLOC(strlen(languageCode) + 1); - strcpy(result, languageCode); - } - return result; -} - -void -CBrowserLanguagesMediator::SetLanguageListWithPref( const char *prefName, - PaneIDT languageListID, - Boolean &locked) -{ - locked = PREF_PrefIsLocked(prefName); - CDragOrderTextList *languageList = - (CDragOrderTextList *)FindPaneByID(languageListID); - XP_ASSERT(languageList); - - char *theString; - int prefResult = PREF_CopyCharPref(prefName, &theString); - if (prefResult == PREF_NOERROR && theString != nil) - { - TableIndexT rowNumber = 0; - char *languageCode; - char *strtokFirstParam = theString; - #pragma warn_possunwant off - while (languageCode = strtok(strtokFirstParam, ", ")) - #pragma warn_possunwant reset - { - char *display = GetLanguageDisplayString(languageCode); - Str255 pDisplay; - strtokFirstParam = nil; - BlockMoveData(display, &pDisplay[1], pDisplay[0] = strlen(display)); - languageList->InsertRows(1, rowNumber++, pDisplay, sizeof(Str255), false); - XP_FREE(display); - } - XP_FREE(theString); - languageList->Refresh(); - } - if (locked) - { - LButton *button = - (LButton *)FindPaneByID(eAddLanguageButton); - XP_ASSERT(button); - button->Disable(); - button = (LButton *)FindPaneByID(eDeleteLanguageButton); - XP_ASSERT(button); - button->Disable(); - languageList->LockOrder(); - } -} - -char * -CBrowserLanguagesMediator::AppendLanguageCode( const char *originalString, - const char *stringToAdd) -{ - int originalLength = originalString ? strlen(originalString) : 0; - int lengthToAdd; - char *occur = strchr(stringToAdd, '['); - char *occurRight; - if (occur) - { - ++occur; - occurRight = strchr(occur, ']'); - if (occurRight) - { - lengthToAdd = occurRight - occur; - } - } - else - { - lengthToAdd = strlen(stringToAdd); - } - char *result = nil; - if (originalLength || lengthToAdd) - { - const char * const junctionString = ", "; - result = (char *)XP_ALLOC( originalLength + - lengthToAdd + - strlen(junctionString) + 1); - result[0] = '\0'; - if (originalLength) - { - strcpy(result, originalString); - strcat(result, junctionString); - } - if (lengthToAdd) - { - const char *source = occur ? occur : stringToAdd; - strncat(result, source, lengthToAdd); - } - } - return result; -} - -void CBrowserLanguagesMediator::SetPrefWithLanguageList(const char *prefName, - PaneIDT /*languageListID*/, - Boolean locked) -{ - if (!locked) - { - char *prefString = nil; - CDragOrderTextList *languageList = - (CDragOrderTextList *)FindPaneByID(eLanguageList); - XP_ASSERT(languageList); - TableIndexT rows, cols; - languageList->GetTableSize(rows, cols); - - STableCell iCell(1, 1); - for (int i = 0; i < rows; ++i) - { - Str255 languageStr; - Uint32 dataSize = sizeof(Str255); - languageList->GetCellData(iCell, languageStr, dataSize); - ++iCell.row; - languageStr[languageStr[0] + 1] = '\0'; // &languageStr[1] is now a C string - char *temp = prefString; - prefString = AppendLanguageCode(prefString, (char *)&languageStr[1]); - if (temp) - { - XP_FREE(temp); - } - } - - // only set if different than current - char terminator = '\0'; - char *currentValue; - - int prefResult = PREF_CopyCharPref(prefName, ¤tValue); - if (prefResult != PREF_NOERROR) - { - currentValue = &terminator; - } - if (prefResult != PREF_NOERROR || strcmp(currentValue, prefString)) - { - PREF_SetCharPref(prefName, prefString); - XP_FREE(prefString); - } - if (currentValue && (currentValue != &terminator)) - { - XP_FREE(currentValue); - } - } -} - -void -CBrowserLanguagesMediator::UpdateButtons(LTextColumn *languageList) -{ - if (!mLanguagesLocked) - { - if (!languageList) - { - languageList = (CDragOrderTextList *)FindPaneByID(eLanguageList); - XP_ASSERT(languageList); - } - STableCell currentCell; - currentCell = languageList->GetFirstSelectedCell(); - LButton *button = - (LButton *)FindPaneByID(eDeleteLanguageButton); - XP_ASSERT(button); - if (currentCell.row) - { - button->Enable(); - } - else - { - button->Disable(); - } - } -} - -void -CBrowserLanguagesMediator::FillAddList(LTextColumn *list) -{ - int i; - for (i = 0; i < mBuiltInCount; ++i) - { - char *displayString; - const char * const formatString = "%s [%s]"; - int newStringLength = strlen(mLangaugeCodeArray[i]) + - strlen(mLanguageStringArray[i]) + - strlen(formatString) - - 4; // the two "%s"s in the format string - displayString = (char *)XP_ALLOC(newStringLength + 1); - sprintf(displayString, formatString, mLanguageStringArray[i], mLangaugeCodeArray[i]); - Str255 pDisplayString; - BlockMoveData(displayString, &pDisplayString[1], newStringLength); - XP_FREE(displayString); - pDisplayString[0] = newStringLength; - list->InsertRows(1, i, &pDisplayString, sizeof(pDisplayString), false); - } -} - - -Boolean -CBrowserLanguagesMediator::GetNewLanguage(char *&newLanguage) -{ - Boolean result; - - StDialogHandler handler(eAddLanguageDialogID, sWindow->GetSuperCommander()); - LWindow *dialog = handler.GetDialog(); - - mAddLanguageList = - (LTextColumn *)dialog->FindPaneByID(eAddLanguageList); - XP_ASSERT(mAddLanguageList); - CEditFieldControl *theField = - (CEditFieldControl *)dialog->FindPaneByID(eAddLanguageOtherEditField); - XP_ASSERT(theField); - - mOtherTextEmpty = true; - - mAddLanguageList->AddListener(&handler); - theField->AddListener(this); - - FillAddList(mAddLanguageList); - MessageT message = msg_Nothing; - do - { - message = handler.DoDialog(); - if ('2sel' == message) - { - theField->SetDescriptor("\p"); - mOtherTextEmpty = true; - message = msg_OK; - } - if (msg_Nothing != message && - msg_OK != message && - msg_Cancel != message) - { - message = msg_Nothing; - } - } while (msg_Nothing == message); - - if (msg_OK == message) - { - Str255 newLanguageName; - theField->GetDescriptor(newLanguageName); - int newLanguageNameSize = newLanguageName[0]; - if (newLanguageNameSize) - { - newLanguage = (char *)XP_ALLOC(newLanguageNameSize + 1); - BlockMoveData(&newLanguageName[1], newLanguage, newLanguageNameSize); - newLanguage[newLanguageNameSize] = '\0'; - result = true; - } - else - { - STableCell selectedCell = mAddLanguageList->GetFirstSelectedCell(); - Str255 selectedLanguage; - if (selectedCell.row) - { - long dataSize = sizeof(selectedLanguage); - mAddLanguageList->GetCellData(selectedCell, selectedLanguage, dataSize); - newLanguage = (char *)XP_ALLOC(selectedLanguage[0] + 1); - BlockMoveData(&selectedLanguage[1], newLanguage, selectedLanguage[0]); - newLanguage[selectedLanguage[0]] = '\0'; - result = true; - } - else - { - result = false; - } - } - } - else - { - result = false; - } - return result; -} - -Boolean -CBrowserLanguagesMediator::GetNewUniqueLanguage(char *&newLanguage) -{ - Boolean result = GetNewLanguage(newLanguage); - if (result) - { - char *tempString = newLanguage; - newLanguage = GetLanguageDisplayString(tempString); - XP_FREE(tempString); - - CDragOrderTextList *languageList = - (CDragOrderTextList *)FindPaneByID(eLanguageList); - XP_ASSERT(languageList); - TableIndexT rows, cols; - languageList->GetTableSize(rows, cols); - - STableCell iCell(1, 1); - for (int i = 0; i < rows; ++i) - { - Str255 languageStr; - Uint32 dataSize = sizeof(Str255); - languageList->GetCellData(iCell, languageStr, dataSize); - ++iCell.row; - LStr255 pNewLangage(newLanguage); - if (!pNewLangage.CompareTo(languageStr)) // we already have this lanuage - { - result = false; - XP_FREE(newLanguage); - break; - } - } - } - return result; -} - - -void -CBrowserLanguagesMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case CEditFieldControl::msg_ChangedText: - Str255 languageStr; - ((CEditFieldControl *)ioParam)->GetDescriptor(languageStr); - if ((mOtherTextEmpty && languageStr[0]) || // The value of mOtherTextEmpty - (!mOtherTextEmpty && !languageStr[0])) // needs to change. - { -// STableCell selected = mAddLanguageList->GetFirstSelectedCell(); -// if (selected.row) -// { - if (mOtherTextEmpty) - { - mOtherTextEmpty = false; - mAddLanguageList->Deactivate(); - } - else - { - mOtherTextEmpty = true; - mAddLanguageList->Activate(); - } -// } - } - break; - case eSelectionChanged: - UpdateButtons((CDragOrderTextList *)ioParam); - break; - case eAddLanguageButton: - XP_ASSERT(!mLanguagesLocked); - char *newLanguage; - if (GetNewUniqueLanguage(newLanguage)) - { - CDragOrderTextList *languageList = - (CDragOrderTextList *)FindPaneByID(eLanguageList); - XP_ASSERT(languageList); - STableCell currentCell; - currentCell = languageList->GetFirstSelectedCell(); - TableIndexT insertAfter = currentCell.row; - if (!insertAfter) - { - // add it at the end - TableIndexT cols; - languageList->GetTableSize(insertAfter, cols); - } - LStr255 pNewLanguage(newLanguage); - languageList->InsertRows( 1, - insertAfter, - pNewLanguage, - sizeof(Str255), - true); - if (newLanguage) - { - XP_FREE(newLanguage); - } - UpdateButtons(languageList); - } - break; - case eDeleteLanguageButton: - XP_ASSERT(!mLanguagesLocked); - CDragOrderTextList *languageList = - (CDragOrderTextList *)FindPaneByID(eLanguageList); - XP_ASSERT(languageList); - STableCell currentCell; - currentCell = languageList->GetFirstSelectedCell(); - languageList->RemoveRows(1, currentCell.row, true); - UpdateButtons(languageList); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - - -void -CBrowserLanguagesMediator::LoadBuiltInArrays() -{ - // I guess we can tell how many strings are in a string list from the first - // two bytes of the resource. Is this documented? - short **countHandle = (short **)GetResource('STR#', eBuiltInLanguageStringResID); - XP_ASSERT(countHandle); - mBuiltInCount = **countHandle; - mLanguageStringArray = (char **)XP_ALLOC(mBuiltInCount * sizeof(char *)); - mLangaugeCodeArray = (char **)XP_ALLOC(mBuiltInCount * sizeof(char *)); - int i; - for (i = 0; i < mBuiltInCount; ++i) - { - Str255 builtInString; Str255 builtInCode; - - ::GetIndString(builtInString, eBuiltInLanguageStringResID, i + 1); - ::GetIndString(builtInCode, eBuiltInLanguageCodeResID, i + 1); - mLanguageStringArray[i] = (char *)XP_ALLOC(builtInString[0] + 1); - mLangaugeCodeArray[i] = (char *)XP_ALLOC(builtInCode[0] + 1); - ::BlockMoveData(&builtInString[1], mLanguageStringArray[i], (Size)builtInString[0]); - ::BlockMoveData(&builtInCode[1], mLangaugeCodeArray[i], (Size)builtInCode[0]); - mLanguageStringArray[i][builtInString[0]] = '\0'; - mLangaugeCodeArray[i][builtInCode[0]] = '\0'; - } -} - -//----------------------------------- -void CBrowserLanguagesMediator::LoadMainPane() -//----------------------------------- -{ - CPrefsMediator::LoadMainPane(); - CDragOrderTextList *languageList = - (CDragOrderTextList *)FindPaneByID(eLanguageList); - XP_ASSERT(languageList); - languageList->AddListener(this); - UpdateButtons(languageList); -} - -//----------------------------------- -void CBrowserLanguagesMediator::LoadPrefs() -//----------------------------------- -{ - LoadBuiltInArrays(); - SetLanguageListWithPref("intl.accept_languages", - eLanguageList, - mLanguagesLocked); -} - -//----------------------------------- -void CBrowserLanguagesMediator::WritePrefs() -//----------------------------------- -{ - SetPrefWithLanguageList("intl.accept_languages", - eLanguageList, - mLanguagesLocked); -} - - - - -enum -{ - eAuthorNameEditField = 13201, - eAutoSaveCheckBox, - eAutoSaveIntervalEditField, - eNewDocTemplateURLEditField, - eRestoreDefaultButton, - eChooseLocalFileButton, - eUseHTMLSourceEditorBox, - eHTMLSourceEditorFilePicker, - eUseImageEditorBox, - eImageEditorFilePicker -}; - -#ifdef EDITOR - -CEditorMainMediator::CEditorMainMediator(LStream*) -: CPrefsMediator(class_ID) -, mNewDocURLLocked(false) -{ -} - -void -CEditorMainMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case eUseHTMLSourceEditorBox: - CFilePicker *fPicker = - (CFilePicker *)FindPaneByID(eHTMLSourceEditorFilePicker); - XP_ASSERT(fPicker); - if (!fPicker->WasSet() && *(Int32 *)ioParam) - { // If the user has clicked the checkbox and the file picker is not set - // then we may want to trigger the file picker - if (mNeedsPrefs) - { - // If mNeedsPrefs, then we are setting up the pane. If the picker - // is not set (can happen if the app file was physically deleted), - // then we need to unset the "use" check box. - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(inMessage); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - } - else - { - fPicker->ListenToMessage(msg_Browse, nil); - if (!fPicker->WasSet()) - { // If the file picker is still unset, that means that the user - // cancelled the file browse so we don't want the checkbox set. - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(inMessage); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - } - } - } - break; - case eUseImageEditorBox: - fPicker = (CFilePicker *)FindPaneByID(eImageEditorFilePicker); - XP_ASSERT(fPicker); - if (!fPicker->WasSet() && *(Int32 *)ioParam) - { // If the user has clicked the checkbox and the file picker is not set - // then we may want to trigger the file picker - if (mNeedsPrefs) - { - // If mNeedsPrefs, then we are setting up the pane. If the picker - // is not set (can happen if the app file was physically deleted), - // then we need to unset the "use" check box. - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(inMessage); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - } - else - { - fPicker->ListenToMessage(msg_Browse, nil); - if (!fPicker->WasSet()) - { // If the file picker is still unset, that means that the user - // cancelled the file browse so we don't want the checkbox set. - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(inMessage); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - } - } - } - break; - case msg_FolderChanged: - PaneIDT checkBoxID; - switch (((CFilePicker *)ioParam)->GetPaneID()) - { - case eHTMLSourceEditorFilePicker: - checkBoxID = eUseHTMLSourceEditorBox; - break; - case eImageEditorFilePicker: - checkBoxID = eUseImageEditorBox; - break; - } - LGACheckbox *checkbox = (LGACheckbox *)FindPaneByID(checkBoxID); - XP_ASSERT(checkbox); - checkbox->SetValue(true); - break; - case eChooseLocalFileButton: - SetEditFieldWithLocalFileURL( eNewDocTemplateURLEditField, - mNewDocURLLocked); - break; - case eRestoreDefaultButton: - RestoreDefaultURL(); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -void -CEditorMainMediator::RestoreDefaultURL() -{ - ReadDefaultPref(eNewDocTemplateURLEditField); -} - -Boolean -CEditorMainMediator::SaveIntervalValidationFunc(CValidEditField *saveInterval) -{ - // If the checkbox isn't set then this value is really - // ignored, so I will only put up the alert if the checkbox - // is set, but I will force a valid value in any case. - - Boolean result = true; - - // force valid value - if (1 > saveInterval->GetValue()) - { - int32 newInterval = 10; - PREF_GetDefaultIntPref("editor.auto_save_delay", &newInterval); - saveInterval->SetValue(newInterval); - saveInterval->SelectAll(); - result = false; - } - if (!result) // if the value is within the range, who cares - { - // Check for the check box... - // We are assuming that the checkbox is a sub of the field's superview. - LView *superView = saveInterval->GetSuperView(); - XP_ASSERT(superView); - LGACheckbox *checkbox = - (LGACheckbox *)superView->FindPaneByID(eAutoSaveCheckBox); - XP_ASSERT(checkbox); - if (checkbox->GetValue()) - { - StPrepareForDialog prepare; - ::StopAlert(1067, NULL); - } - else - { - result = true; // go ahead and let them switch (after correcting the value) - // if the checkbox isn't set - } - } - return result; -} - -//----------------------------------- -void CEditorMainMediator::LoadMainPane() -//----------------------------------- -{ - CPrefsMediator::LoadMainPane(); - SetValidationFunction(eAutoSaveIntervalEditField, SaveIntervalValidationFunc); -} - -#endif // EDITOR - -enum -{ - eMaintainLinksBox = 13401, - eKeepImagesBox, - ePublishLocationField, - eBrowseLocationField -}; - -enum -{ - eOnlineRButton = 13501, - eOfflineRButton, - eAskMeRButton -}; - -enum -{ - eImagesBox = 13901, - eJaveBox, - eJavaScriptBox, - eStyleSheetBox, - eAutoInstallBox, - eFTPPasswordBox, - eCookieAlwaysRButton, - eCookieOriginatingServerRButton, - eCookieNeverRButton, - eCookieWarningBox -}; - -enum -{ - eDiskCacheEditField = 14101, - eClearDiskCacheButton, - eOncePerSessionRButton, - eEveryUseRButton, - eNeverRButton, - eCacheLocationFilePicker -}; - -CAdvancedCacheMediator::CAdvancedCacheMediator(LStream*) -: CPrefsMediator(class_ID) -{ -} - -void CAdvancedCacheMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case eClearDiskCacheButton: - ClearDiskCacheNow(); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -void CAdvancedCacheMediator::ClearDiskCacheNow() -{ - int32 originalDiskCacheSize; // in Kbytes - PREF_GetIntPref("browser.cache.disk_cache_size", &originalDiskCacheSize); - if (originalDiskCacheSize) // if the current cache size is zero then do nothing - { - UDesktop::Deactivate(); - short response = ::CautionAlert(eClearDiskCacheDialog, NULL); - UDesktop::Activate(); - if (1 == response) - { - TrySetCursor(watchCursor); - - // This is the approved way to clear the cache - PREF_SetIntPref("browser.cache.disk_cache_size", 0); - PREF_SetIntPref("browser.cache.disk_cache_size", originalDiskCacheSize); - - ::SetCursor( &UQDGlobals::GetQDGlobals()->arrow ); - } - } -} - -enum -{ - eManualProxyDialogResID = 12006, - eDirectConnectRButton = 14201, - eManualRButton, - eViewProxyConfigButton, - eAutoProxyConfigRButton, - eConfigURLTextBox, - eReloadButton, - eFTPEditField, - eFTPPortEditField, - eGopherEditField, - eGopherPortEditField, - eHTTPEditField, - eHTTPPortEditField, - eSSLEditField, - eSSLPortEditField, - eWAISEditField, - eWAISPortEditField, - eNoProxyEditField, - eSOCKSEditField, - eSOCKSPortEditField -}; - -CAdvancedProxiesMediator::Protocol::Protocol(): -mProtocolServer(nil), -mServerLocked(false), -mProtocolPort(0), -mPortLocked(false) -{ -} - -CAdvancedProxiesMediator::Protocol::Protocol(const Protocol& original): -mProtocolServer(nil), -mServerLocked(original.mServerLocked), -mProtocolPort(original.mProtocolPort), -mPortLocked(original.mPortLocked) -{ - if (original.mProtocolServer) - { - mProtocolServer = XP_STRDUP(original.mProtocolServer); - } - // else set to nil above -} - -CAdvancedProxiesMediator::Protocol::~Protocol() -{ - if (mProtocolServer) - { - XP_FREE(mProtocolServer); - } -} - -void -CAdvancedProxiesMediator::Protocol::LoadFromPref(const char *serverPrefName, - const char *portPrefName) -{ - mServerLocked = PREF_PrefIsLocked(serverPrefName); - mPortLocked = PREF_PrefIsLocked(portPrefName); - PREF_CopyCharPref(serverPrefName, &mProtocolServer); - PREF_GetIntPref(portPrefName, &mProtocolPort); -} - -void -CAdvancedProxiesMediator::Protocol::WriteToPref( const char *serverPrefName, - const char *portPrefName) -{ - if (!mServerLocked) - { - char *currentStringValue = nil; - PREF_CopyCharPref(serverPrefName, ¤tStringValue); - if (!currentStringValue || strcmp(currentStringValue, mProtocolServer)) - { - PREF_SetCharPref(serverPrefName, mProtocolServer); - } - if (currentStringValue) - { - XP_FREE(currentStringValue); - } - } - if (!mPortLocked) - { - int32 currentIntValue; - currentIntValue = mProtocolPort + 1; // anything != mCheckInterval - PREF_GetIntPref(portPrefName, ¤tIntValue); - if (currentIntValue != mProtocolPort) - { - PREF_SetIntPref(portPrefName, mProtocolPort); - } - } -} - -void -CAdvancedProxiesMediator::Protocol::PreEdit( LView *dialog, - ResIDT serverEditID, - ResIDT portEditID) -{ - LEditField *server = - (LEditField *)dialog->FindPaneByID(serverEditID); - XP_ASSERT(server); - if (mProtocolServer) - { - LStr255 protocolServerPStr(mProtocolServer); - server->SetDescriptor(protocolServerPStr); - server->SelectAll(); - } - if (mServerLocked) - { - server->Disable(); - } - LEditField *port = - (LEditField *)dialog->FindPaneByID(portEditID); - XP_ASSERT(port); - port->SetValue(mProtocolPort); - port->SelectAll(); - if (mPortLocked) - { - port->Disable(); - } -} - -void -CAdvancedProxiesMediator::Protocol::PostEdit(LView *dialog, - ResIDT serverEditID, - ResIDT portEditID) -{ - LEditField *server = - (LEditField *)dialog->FindPaneByID(serverEditID); - XP_ASSERT(server); - Str255 fieldValue; - if (!mServerLocked) - { - server->GetDescriptor(fieldValue); - int stringLength = fieldValue[0]; - char *serverString = (char *)XP_ALLOC(stringLength + 1); - if (serverString) - { - strncpy(serverString, (char *)&fieldValue[1], stringLength + 1); - serverString[stringLength] = '\0'; - if (mProtocolServer) - { - XP_FREE(mProtocolServer); - } - mProtocolServer = serverString; - } - } - LEditField *port = - (LEditField *)dialog->FindPaneByID(portEditID); - XP_ASSERT(port); - if (!mPortLocked) - { - mProtocolPort = port->GetValue(); - } -} - - - -CAdvancedProxiesMediator::ManualProxy::ManualProxy(): -mNoProxyList(nil), -mNoProxyListLocked(false) -{ -} - -CAdvancedProxiesMediator::ManualProxy::ManualProxy(const ManualProxy& original): -mFTP(original.mFTP), -mGopher(original.mGopher), -mHTTP(original.mHTTP), -mSSL(original.mSSL), -mWAIS(original.mWAIS), -mNoProxyList(nil), -mNoProxyListLocked(original.mNoProxyListLocked), -mSOCKS(original.mSOCKS) -{ - if (original.mNoProxyList) - { - mNoProxyList = XP_STRDUP(original.mNoProxyList); - } - // else set to nil above -} - -CAdvancedProxiesMediator::ManualProxy::~ManualProxy() -{ - XP_FREEIF(mNoProxyList); -} - -void -CAdvancedProxiesMediator::ManualProxy::LoadPrefs() -{ - mFTP.LoadFromPref("network.proxy.ftp", "network.proxy.ftp_port"); - mGopher.LoadFromPref("network.proxy.gopher", "network.proxy.gopher_port"); - mHTTP.LoadFromPref("network.proxy.http", "network.proxy.http_port"); - mWAIS.LoadFromPref("network.proxy.wais", "network.proxy.wais_port"); - mSSL.LoadFromPref("network.proxy.ssl", "network.proxy.ssl_port"); - - mNoProxyListLocked = PREF_PrefIsLocked("network.proxy.no_proxies_on"); - PREF_CopyCharPref("network.proxy.no_proxies_on", &mNoProxyList); - - mSOCKS.LoadFromPref("network.hosts.socks_server", "network.hosts.socks_serverport"); -} - -void -CAdvancedProxiesMediator::ManualProxy::WritePrefs() -{ - mFTP.WriteToPref("network.proxy.ftp", "network.proxy.ftp_port"); - mGopher.WriteToPref("network.proxy.gopher", "network.proxy.gopher_port"); - mHTTP.WriteToPref("network.proxy.http", "network.proxy.http_port"); - mWAIS.WriteToPref("network.proxy.wais", "network.proxy.wais_port"); - mSSL.WriteToPref("network.proxy.ssl", "network.proxy.ssl_port"); - - char *currentStringValue = nil; - if (!mNoProxyListLocked) - { - PREF_CopyCharPref("network.proxy.no_proxies_on", ¤tStringValue); - if (!currentStringValue || strcmp(currentStringValue, mNoProxyList)) - { - PREF_SetCharPref("network.proxy.no_proxies_on", mNoProxyList); - } - if (currentStringValue) - { - XP_FREE(currentStringValue); - } - } - mSOCKS.WriteToPref("network.hosts.socks_server", "network.hosts.socks_serverport"); -} - - -Boolean -CAdvancedProxiesMediator::ManualProxy::EditPrefs() -{ - Boolean result = false; - - StDialogHandler handler(eManualProxyDialogResID, nil); - LWindow *dialog = handler.GetDialog(); - - mFTP.PreEdit(dialog, eFTPEditField, eFTPPortEditField); - mGopher.PreEdit(dialog, eGopherEditField, eGopherPortEditField); - mHTTP.PreEdit(dialog, eHTTPEditField, eHTTPPortEditField); - mSSL.PreEdit(dialog, eSSLEditField, eSSLPortEditField); - mWAIS.PreEdit(dialog, eWAISEditField, eWAISPortEditField); - - LEditField *noProxy = - (LEditField *)dialog->FindPaneByID(eNoProxyEditField); - XP_ASSERT(noProxy); - if (mNoProxyList) - { - LStr255 noProxyPStr(mNoProxyList); - noProxy->SetDescriptor(noProxyPStr); - noProxy->SelectAll(); - } - if (mNoProxyListLocked) - { - noProxy->Disable(); - } - - mSOCKS.PreEdit(dialog, eSOCKSEditField, eSOCKSPortEditField); - - // Run the dialog - MessageT message = msg_Nothing; - do - { - message = handler.DoDialog(); - if (msg_Nothing != message && msg_OK != message && msg_Cancel != message) - { - message = msg_Nothing; - } - } while (msg_Nothing == message); - - if (msg_OK == message) - { - result = true; - // read all the controls back to the struct - - mFTP.PostEdit(dialog, eFTPEditField, eFTPPortEditField); - mGopher.PostEdit(dialog, eGopherEditField, eGopherPortEditField); - mHTTP.PostEdit(dialog, eHTTPEditField, eHTTPPortEditField); - mSSL.PostEdit(dialog, eSSLEditField, eSSLPortEditField); - mWAIS.PostEdit(dialog, eWAISEditField, eWAISPortEditField); - - Str255 fieldValue; - if (!mNoProxyListLocked) - { - noProxy->GetDescriptor(fieldValue); - int stringLength = fieldValue[0]; - char *noProxyString = (char *)XP_ALLOC(stringLength + 1); - if (noProxyString) - { - strncpy(noProxyString, (char *)&fieldValue[1], stringLength + 1); - noProxyString[stringLength] = '\0'; - if (mNoProxyList) - { - XP_FREE(mNoProxyList); - } - mNoProxyList = noProxyString; - } - } - mSOCKS.PostEdit(dialog, eSOCKSEditField, eSOCKSPortEditField); - } - else - { - result = false; - } - return result; -} - - -CAdvancedProxiesMediator::CAdvancedProxiesMediator(LStream*) -: CPrefsMediator(class_ID) -, mManualProxy(nil) -{ -} - -void -CAdvancedProxiesMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case msg_ControlClicked: - break; - case eViewProxyConfigButton: - LGARadioButton *theButton = (LGARadioButton *)FindPaneByID(eManualRButton); - XP_ASSERT(theButton); - if (!theButton->GetValue()) - { - theButton->SetValue(true); - } - ManualProxy *tempManualProxy; - if (!mManualProxy) - { - tempManualProxy = new ManualProxy; - tempManualProxy->LoadPrefs(); - } - else - { - tempManualProxy = new ManualProxy(*mManualProxy); - } - if (tempManualProxy->EditPrefs()) - { - if (mManualProxy) - { - delete mManualProxy; - } - mManualProxy = tempManualProxy; - } - else - { - delete tempManualProxy; - } - break; - case eReloadButton: - LEditField *theField = (LEditField *)FindPaneByID(eConfigURLTextBox); - XP_ASSERT(theField); - Str255 fieldValue; - theField->GetDescriptor(fieldValue); - int stringLength = fieldValue[0]; - char *prefString = (char *)XP_ALLOC(stringLength + 1); - XP_ASSERT(prefString); - strncpy(prefString, (char *)&fieldValue[1], stringLength); - prefString[stringLength] = '\0'; - NET_SetProxyServer(PROXY_AUTOCONF_URL, prefString); - NET_ReloadProxyConfig(nil); // The context is unused in the function. - XP_FREE(prefString); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -//----------------------------------- -void CAdvancedProxiesMediator::WritePrefs() -//----------------------------------- -{ - if (mManualProxy) - mManualProxy->WritePrefs(); -} - -#ifdef MOZ_MAIL_NEWS -enum -{ - eMessageSizeLimitBox = 13801, - eMessageSizeLimitEditField, - eKeepByDaysRButton, - eKeepDaysEditField, - eKeepAllRButton, - eKeepByCountRButton, - eKeepCountEditField, - eKeepOnlyUnreadBox, - eCompactingBox, - eCompactingEditField -}; - -CAdvancedDiskSpaceMediator::CAdvancedDiskSpaceMediator(LStream*) -: CPrefsMediator(class_ID) -{ -} - -void -CAdvancedDiskSpaceMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { -// case eNewsMessagesMoreButton: -// break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -// static -Boolean -CAdvancedDiskSpaceMediator::DiskSpaceValidationFunc(CValidEditField *editField) -{ - Boolean okeyDokey = true; - - // force valid value - if (1 > editField->GetValue()) - { - const char *prefName = nil; - PaneIDT controllingPaneID; - switch (editField->GetPaneID()) - { - case eMessageSizeLimitEditField: - controllingPaneID = eMessageSizeLimitBox; - prefName = "mail.max_size"; - break; - case eKeepDaysEditField: - controllingPaneID = eKeepByDaysRButton; - prefName = "news.keep.days"; - break; - case eKeepCountEditField: - controllingPaneID = eKeepByCountRButton; - prefName = "news.keep.count"; - break; - case eCompactingEditField: - controllingPaneID = eCompactingBox; - prefName = "mail.purge_threshhold"; - break; - default: - break; // XP_ASSERT()? - } - LControl* controllingPane = nil; - if (controllingPaneID) - controllingPane = - (LControl *)((editField->GetSuperView())->FindPaneByID(controllingPaneID)); - XP_ASSERT(controllingPane); - int32 newValue; - PREF_GetDefaultIntPref(prefName, &newValue); - editField->SetValue(newValue); - editField->SelectAll(); - okeyDokey = (controllingPane->GetValue() == 0); - } - if (!okeyDokey) - { // If the value is within the range, or - StPrepareForDialog prepare; // the control is not on, who cares? - ::StopAlert(1067, NULL); - } - return okeyDokey; -} - -//----------------------------------- -void CAdvancedDiskSpaceMediator::LoadMainPane() -//----------------------------------- -{ - CPrefsMediator::LoadMainPane(); - SetValidationFunction(eMessageSizeLimitEditField, DiskSpaceValidationFunc); - SetValidationFunction(eKeepDaysEditField, DiskSpaceValidationFunc); - SetValidationFunction(eKeepCountEditField, DiskSpaceValidationFunc); - SetValidationFunction(eCompactingEditField, DiskSpaceValidationFunc); -} - -#endif // MOZ_MAIL_NEWS - -//----------------------------------- -void UAssortedPrefMediators::RegisterViewClasses() -//----------------------------------- -{ - RegisterClass_(CEditFieldControl); - - - RegisterClass_(CColorButton); - RegisterClass_( CFilePicker); - - RegisterClass_(COtherSizeDialog); - RegisterClass_(CSizePopup); - - RegisterClass_( CGAEditBroadcaster); - RegisterClass_(CValidEditField); - RegisterClass_( LCicnButton); -// RegisterClass_( 'sbox', (ClassCreatorFunc)OneClickLListBox::CreateOneClickLListBox ); - RegisterClass_(OneRowLListBox); // added by ftang - UPrefControls::RegisterPrefControlViews(); -} // CPrefsDialog::RegisterViewClasses - diff --git a/mozilla/cmd/macfe/prefs/CAssortedMediators.h b/mozilla/cmd/macfe/prefs/CAssortedMediators.h deleted file mode 100644 index 9ad008d0180..00000000000 --- a/mozilla/cmd/macfe/prefs/CAssortedMediators.h +++ /dev/null @@ -1,315 +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. - */ - -#pragma once - -#include "CPrefsMediator.h" - -//====================================== -#pragma mark -class UAssortedPrefMediators -//====================================== -{ -public: - static void RegisterViewClasses(); -}; // class UAssortedPrefMediators - -class LTextColumn; -class CMIMEListPane; -class CDragOrderTextList; - -//====================================== -#pragma mark -class CAppearanceMainMediator -//====================================== -: public CPrefsMediator -{ - public: - - enum { class_ID = PrefPaneID::eAppearance_Main }; - CAppearanceMainMediator(LStream*); - - virtual void LoadPrefs(); - virtual void WritePrefs(); -}; - -//====================================== -#pragma mark -class CAppearanceFontsMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eAppearance_Fonts }; - CAppearanceFontsMediator(LStream*); - virtual ~CAppearanceFontsMediator() - { delete [] mEncodings; } - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void LoadPrefs(); - virtual void WritePrefs(); - - private: - - struct Encoding - { - Encoding(): - mCSID(0), - mPropFontSize(12), - mFixedFontSize(10), - mPropFontLocked(false), - mFixedFontLocked(false), - mPropFontSizeLocked(false), - mFixedFontSizeLocked(false) - { - }; - CStr31 mLanguageGroup; - unsigned short mCSID; - CStr31 mPropFont; - Boolean mPropFontLocked; - CStr31 mFixedFont; - Boolean mFixedFontLocked; - unsigned short mPropFontSize; - Boolean mPropFontSizeLocked; - unsigned short mFixedFontSize; - Boolean mFixedFontSizeLocked; - }; - - - void LoadEncodings(); - void ReadEncodings(Handle hndl); - void SetEncodingWithPref(Encoding& enc); - void SetPrefWithEncoding(const Encoding& enc); - void UpdateMenus(); - void UpdateEncoding(PaneIDT changedMenuID); - void PopulateEncodingsMenus(PaneIDT menuID); - void WriteEncodingPrefs(); - Int16 GetFontSize(LGAPopup* whichPopup); - int GetSelectEncMenuItem(); - void FontMenuChanged(PaneIDT changedMenuID); - void SizeMenuChanged(PaneIDT changedMenuID); - - Encoding *mEncodings; - int mEncodingsCount; -}; - -//====================================== -#pragma mark -class CAppearanceColorsMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eAppearance_Colors }; - CAppearanceColorsMediator(LStream*); - virtual ~CAppearanceColorsMediator() {}; - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - private: - void UseDefaults(); -}; - -//====================================== -#pragma mark -class CBrowserMainMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eBrowser_Main }; - CBrowserMainMediator(LStream*); - virtual ~CBrowserMainMediator() {if (mCurrentURL) XP_FREE(mCurrentURL);}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void LoadPrefs(); - virtual void UpdateFromIC(); - virtual void LoadMainPane(); - virtual void WritePrefs(); - - static Boolean ExpireDaysValidationFunc(CValidEditField *daysTilExpire); - - private: - void URLChoosingButtons(Boolean enable); - void ExpireNow(); - Boolean mHomePageURLLocked; - char *mCurrentURL; -}; - -//====================================== -#pragma mark -class CBrowserLanguagesMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eBrowser_Languages }; - CBrowserLanguagesMediator(LStream*); - virtual ~CBrowserLanguagesMediator(); - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void LoadMainPane(); - virtual void LoadPrefs(); - virtual void WritePrefs(); - - private: - void LoadBuiltInArrays(); - void SetLanguageListWithPref(const char *prefName, - PaneIDT languageListID, - Boolean &locked); - void SetPrefWithLanguageList(const char *prefName, - PaneIDT languageListID, - Boolean locked); - char *GetLanguageDisplayString(const char *languageCode); - // For a code from the prefs, allocates (with XP_ALLOC()) - // the proper string for display. - // If languageCode is fr then returns French [fr] - // If the languageCode is not a builtin code, then - // a copy of languageCode is returned. - void UpdateButtons(LTextColumn *languageList = nil); - // OK button. - Boolean GetNewLanguage(char *&newLanguage); - Boolean GetNewUniqueLanguage(char *&newLanguage); - void FillAddList(LTextColumn *list); - char *AppendLanguageCode(const char *originalString, - const char *stringToAdd); - Boolean mLanguagesLocked; - Int32 mBuiltInCount; - char **mLanguageStringArray; - char **mLangaugeCodeArray; - // The following two members are only meaningful when the Add Language - // dialog is up. - Boolean mOtherTextEmpty; // This means that the "Other:" text field is empty. - LTextColumn *mAddLanguageList; -}; - - -#ifdef EDITOR -//====================================== -#pragma mark -class CEditorMainMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eEditor_Main }; - CEditorMainMediator(LStream*); - virtual ~CEditorMainMediator() {}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void LoadMainPane(); - - static Boolean SaveIntervalValidationFunc(CValidEditField *saveInterval); - - private: - void RestoreDefaultURL(); - Boolean mNewDocURLLocked; -}; -#endif // EDITOR - -//====================================== -#pragma mark -class CAdvancedCacheMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eAdvanced_Cache }; - CAdvancedCacheMediator(LStream*); - virtual ~CAdvancedCacheMediator() {}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - private: - void ClearDiskCacheNow(); -}; - -//====================================== -#pragma mark -class CAdvancedProxiesMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eAdvanced_Proxies }; - CAdvancedProxiesMediator(LStream*); - virtual ~CAdvancedProxiesMediator() {}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - virtual void WritePrefs(); - class Protocol - { - public: - char *mProtocolServer; - Boolean mServerLocked; - Int32 mProtocolPort; - Boolean mPortLocked; - - Protocol(); - Protocol(const Protocol& original); - ~Protocol(); - void LoadFromPref(const char *serverPrefName, const char *portPrefName); - void WriteToPref(const char *serverPrefName, const char *portPrefName); - void PreEdit(LView *dialog, ResIDT serverEditID, ResIDT portEditID); - void PostEdit(LView *dialog, ResIDT serverEditID, ResIDT portEditID); - }; - - class ManualProxy - { - public: - Protocol mFTP; - Protocol mGopher; - Protocol mHTTP; - Protocol mSSL; - Protocol mWAIS; - char *mNoProxyList; - Boolean mNoProxyListLocked; - Protocol mSOCKS; - - ManualProxy(); - ManualProxy(const ManualProxy& original); - ~ManualProxy(); - void LoadPrefs(); - void WritePrefs(); - Boolean EditPrefs(); - }; - private: - ManualProxy *mManualProxy; -}; - -#ifdef MOZ_MAIL_NEWS -//====================================== -#pragma mark -class CAdvancedDiskSpaceMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eAdvanced_DiskSpace }; - CAdvancedDiskSpaceMediator(LStream*); - virtual ~CAdvancedDiskSpaceMediator() {}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void LoadMainPane(); - - static Boolean DiskSpaceValidationFunc(CValidEditField *editField); -}; -#endif // MOZ_MAIL_NEWS - diff --git a/mozilla/cmd/macfe/prefs/CBrowserApplicationsMediator.cp b/mozilla/cmd/macfe/prefs/CBrowserApplicationsMediator.cp deleted file mode 100644 index b6634598cb6..00000000000 --- a/mozilla/cmd/macfe/prefs/CBrowserApplicationsMediator.cp +++ /dev/null @@ -1,1598 +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. - */ -#include "CBrowserApplicationsMediator.h" -#include "LTableView.h" -#include -#include -#include -#include - -#include "UGraphicGizmos.h" -#include "LGADialogBox.h" -#include "LGACheckbox.h" -#include "LGARadioButton.h" -#include "CLargeEditField.h" - -#include "umimemap.h" -#include "macutil.h" -#include "resgui.h" -#include "prefAPI.h" -#include "macgui.h" -#include "np.h" -#include "uerrmgr.h" -#include "ufilemgr.h" -#include "miconutils.h" -#include "InternetConfig.h" - -enum -{ - eNormalTextTraits = 12003, - eGrayTextTraits = 12008, - eDescriptionField = 12507, - eMIMETypeField, - eSuffixes, - eCommunicatorRButton, - ePluginRButton, - ePluginPopupMenu, - eApplicationRButton, - eApplicationNameCaption, - eChooseApplicationButton, - eFileTypePopupMenu, - eSaveRButton, - eUnknownRButton -#ifdef ANTHRAX - , eAppletButton, - eAppletPopupMenu -#endif -}; - -#pragma mark --CMimeCell-- -//------------------------------------------------------------------------------ -// ¥ CMimeCell -//------------------------------------------------------------------------------ - -class CMimeCell -{ -public: - CMimeCell(): mMapper(nil) ,mIcon(nil) { }; - ~CMimeCell(); - CMimeMapper* mMapper; - Handle mIcon; - -}; - -//------------------------------------------------------------------------------ -// ¥ ~CMimeCell -//------------------------------------------------------------------------------ -// Frees the mapper and icon -// -CMimeCell::~CMimeCell() -{ - delete mMapper; - if (mIcon) - ::DisposeIconSuite(mIcon, true); -} - -#pragma mark --CMimeTableView-- -//------------------------------------------------------------------------------ -// ¥ CMimeTableView -//------------------------------------------------------------------------------ -class CMimeTableView : public LTableView, public LBroadcaster -{ -private: - typedef LTableView Inherited; -public: - enum - { - class_ID = 'MmLP', - msg_SelectionChanged = 'SelÆ', // ioparam = this - msg_DoubleClick = '2Clk' // ioparam = this - }; - - CMimeTableView( LStream *inStream); - virtual ~CMimeTableView(); - virtual void SelectionChanged(); - void GetCellData( const STableCell &inCell, void *outDataPtr, Uint32 &ioDataSize) const; - void AddEntry ( CMimeCell** cellToAdd ); - virtual void RemoveRows( Uint32 inHowMany, TableIndexT inFromRow, Boolean inRefresh = true); - Boolean MimeTypeExists(CMimeMapper* mapper); - -protected: - virtual void ClickCell( const STableCell &inCell, const SMouseDownEvent &inMouseDown); - virtual void DrawCell( const STableCell& inCell , const Rect& inLocalRect ); - virtual void FinishCreateSelf(); -public: - LArray mMimeData; - -}; - - -// --------------------------------------------------------------------------- -// ¥ CMimeTableView(LStream*) -// --------------------------------------------------------------------------- -// Construct from data in a Stream -// -CMimeTableView::CMimeTableView( - LStream *inStream) - : LTableView(inStream) -{ -} - -// --------------------------------------------------------------------------- -// ¥ ~CMimeTableView -// --------------------------------------------------------------------------- -// Destructor -// -CMimeTableView::~CMimeTableView() -{ - LArrayIterator iterator(mMimeData, LArrayIterator::from_Start); - CMimeCell* currentCell; - while (iterator.Next(¤tCell)) - { - delete currentCell; - } -} - -// --------------------------------------------------------------------------- -// ¥ FinishCreateSelf -// --------------------------------------------------------------------------- -// Sets up Table geometry and selector then loads the table with the current Mime -// types. -// -void CMimeTableView::FinishCreateSelf() -{ - // Initialize Table - const Int32 colWidth = 321; - const Int32 rowHeight = 20; - mRows = 0; - mCols = 0; - mTableStorage = nil; - SetTableGeometry(new LTableMonoGeometry(this, colWidth, rowHeight)); - SetTableSelector(new LTableSingleSelector(this));; - LTableView::InsertCols(1, 0, nil, 0, Refresh_No); - mUseDragSelect = false; - mCustomHilite = false; - mDeferAdjustment = false; - mRefreshAllWhenResized = false; - - // Load in MimeData - for (TableIndexT i = 1; i <= CPrefs::sMimeTypes.GetCount(); i++) // Insert a row for each mime type - { - CMimeMapper * mime; - CPrefs::sMimeTypes.FetchItemAt(i, &mime); - ThrowIfNil_(mime); - if (!mime->IsTemporary()) - { - CMimeMapper * duplicate = new CMimeMapper(*mime); - InsertRows(1, i); - CMimeCell* cell = new CMimeCell; - cell->mMapper = duplicate; - mMimeData.InsertItemsAt ( 1, i, &cell, sizeof( CMimeCell * ) ); - } - } - Refresh(); -} - -//------------------------------------------------------------------------------ -// ¥ AddEntry -//------------------------------------------------------------------------------ -// Adds the passed in cell to the end of the table -// -void CMimeTableView::AddEntry ( CMimeCell** cellToAdd ) -{ - InsertRows( 1, mRows ); - mMimeData.InsertItemsAt ( 1 , LArray::index_Last,cellToAdd, sizeof (CMimeCell * )); -} - -//------------------------------------------------------------------------------ -// ¥ RemoveRows -//------------------------------------------------------------------------------ -// -void CMimeTableView::RemoveRows( Uint32 inHowMany, TableIndexT inFromRow, Boolean /* inRefresh */) -{ - mMimeData.RemoveItemsAt(inHowMany, inFromRow); - Inherited::RemoveRows( inHowMany, inFromRow, true ); - -} -// --------------------------------------------------------------------------- -// ¥ SelectionChanged -// --------------------------------------------------------------------------- -// Broadcast message when selected cells change -// -void CMimeTableView::SelectionChanged() -{ - BroadcastMessage( msg_SelectionChanged, (void*) this); -} - - -// --------------------------------------------------------------------------- -// ¥ GetCellData -// --------------------------------------------------------------------------- -// Pass back the data for a particular Cell -// -void CMimeTableView::GetCellData( - const STableCell &inCell, - void *outDataPtr, - Uint32 &ioDataSize) const -{ - Assert_( ioDataSize >= sizeof ( CMimeCell* ) ); - ioDataSize = sizeof( CMimeCell* ); - if ( outDataPtr ) - mMimeData.FetchItemAt( inCell.row, outDataPtr); -} - -// --------------------------------------------------------------------------- -// ¥ ClickCell -// --------------------------------------------------------------------------- -// Broadcast message for a double-click on a cell -// -void CMimeTableView::ClickCell( - const STableCell& /* inCell */, - const SMouseDownEvent& /* inMouseDown */) -{ - if (GetClickCount() == 2) - BroadcastMessage(msg_DoubleClick, (void*) this); -} - - -// --------------------------------------------------------------------------- -// ¥ DrawCell -// --------------------------------------------------------------------------- -// Draw the contents of the specified Cell -// -void CMimeTableView::DrawCell( - const STableCell& inCell , - const Rect& inLocalRect ) -{ -// Some constants used for drawing - const uint32 offsetTable = 7; - const uint32 offsetTextTop = 15; - const uint32 offsetMimeType = (offsetTable + 0); - const uint32 offsetIcon = (offsetTable + 166); - const uint32 offsetHandler = (offsetIcon + 24); - const uint32 widthMimeType = (offsetIcon - offsetMimeType - 5); - Rect cellFrame = inLocalRect; - - ::PenPat( &(UQDGlobals::GetQDGlobals()->gray) ); - ::MoveTo(cellFrame.left, cellFrame.bottom-1); - ::LineTo(cellFrame.right, cellFrame.bottom-1); - ::PenPat( &(UQDGlobals::GetQDGlobals()->black) ); - UTextTraits::SetPortTextTraits(10000); // HACK - FontInfo textFontInfo; - ::GetFontInfo( &textFontInfo); - - CMimeCell* cellInfo = nil; - - mMimeData.FetchItemAt( inCell.row, &cellInfo ); - CMimeMapper* mapper = cellInfo->mMapper; - - - - // Draw mime type - if (cellInfo->mMapper->IsLocked()) - UTextTraits::SetPortTextTraits(eGrayTextTraits); - CStr255 description = mapper->GetDescription(); - if (description.IsEmpty()) - description = mapper->GetMimeName(); - - Rect textRect = cellFrame; - textRect.left += offsetTable; - textRect.right = widthMimeType; - textRect.top += 2; - textRect.bottom -= 2 ; - UGraphicGizmos::PlaceTextInRect( - (char *)description, description.Length(), - textRect, teFlushLeft, teJustCenter, &textFontInfo,true, smTruncMiddle ); - - - - // Draw the icon - CMimeMapper::LoadAction loadAction = mapper->GetLoadAction(); - - /*if ( loadAction == CMimeMapper::Launch || - loadAction == CMimeMapper::Plugin || - loadAction == CMimeMapper::Internal ) */ - { - Rect r; - r.left = offsetIcon; - r.top = cellFrame.top + 2; - r.right = r.left + 16; - r.bottom = r.top + 16; - - // Only create the icon when needed. - if( cellInfo->mIcon == nil ) - { - OSType appSig = mapper->GetAppSig(); - OSType docSig = 'APPL'; - - if( loadAction == CMimeMapper::Save ) - docSig = mapper->GetDocType(); - - if( loadAction == CMimeMapper::Internal ) - appSig = 'MOSS'; - - CIconUtils::GetDesktopIconSuite( appSig , docSig, kSmallIcon, &cellInfo->mIcon ); - } - - if ( cellInfo->mIcon ) - ::PlotIconSuite(&r, atHorizontalCenter, ttNone, cellInfo->mIcon); - - } - - // Draw the handler name - - CStr255 handlerName; - switch (loadAction) - { - case CMimeMapper::Save: - handlerName = *GetString(SAVE_RESID); - break; - case CMimeMapper::Unknown: - handlerName = *GetString(UNKNOWN_RESID); - break; - case CMimeMapper::Internal: - handlerName = *GetString(INTERNAL_RESID); - break; - case CMimeMapper::Launch: - handlerName = mapper->GetAppName(); - break; - case CMimeMapper::Plugin: - handlerName = mapper->GetPluginName(); - break; -#ifdef ANTHRAX - case CMimeMapper::Applet: - handlerName = mapper->GetAppletName(); - break; -#endif /* ANTHRAX */ - } - - textRect.left = offsetHandler; - textRect.right = inLocalRect.right; - if (cellInfo->mMapper->IsLocked()) - UTextTraits::SetPortTextTraits(eGrayTextTraits); - UGraphicGizmos::PlaceTextInRect( - (char *) handlerName, handlerName.Length(), - textRect, teFlushLeft, teJustCenter, &textFontInfo,true, smTruncEnd ); -} - - -// --------------------------------------------------------------------------- -// ¥ MimeTypeExists -// --------------------------------------------------------------------------- -// -Boolean CMimeTableView::MimeTypeExists(CMimeMapper* mapper) -{ - STableCell cell; - cell.col = 1; - - CMimeCell* cellInfo = nil; - - for (int i=1; i<= mRows; i++) - { - cell.row = i; - mMimeData.FetchItemAt( cell.row, &cellInfo ); - if (cellInfo->mMapper != mapper && - cellInfo->mMapper->GetMimeName() == mapper->GetMimeName()) - return true; - } - return false; -} - - -enum -{ - eEditTypeDialogResID = 12008, - eHelperScroller = 12501, - eHelperTable, - eHelperNewButton, - eHelperEditButton, - eHelperDeleteButton, - eDownloadFilePicker -}; - - - - -#pragma mark ---CEditMIMEWindow--- -// --------------------------------------------------------------------------- -// ¥ CEditMIMEWindow -// --------------------------------------------------------------------------- -// - -#define msg_LaunchRadio 300 // Launch option changed -#define msg_BrowseApp 301 // Pick a new application -#define msg_FileTypePopup 302 // New file type picked -//msg_EditField // User typed in a field -#define msg_NewMimeType 303 // New Mime type -#define msg_NewMimeTypeOK 305 // Sent by newMimeType dialog window -//#define msg_ClearCell 306 -#define msg_EditMimeType 307 // Edit Mime type -#define msg_DeleteMimeType 308 // Delete Mime type -#define msg_PluginPopup 309 // Pick a plug-in - - -class CEditMIMEWindow : public LGADialogBox -{ -public: - enum { class_ID = 'EMMW' }; - - CEditMIMEWindow(LStream* inStream); - virtual ~CEditMIMEWindow(); - - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - - void SetCellInfo(CMimeCell *cell); - - Boolean Modified() { return mModified; } - -protected: - virtual void FinishCreateSelf(); - -private: - void UpdateMapperToUI(); - void UpdateUIToMapper(); - void SyncTextControls(); - void UpdateRadioUItoMapper(); - void SyncInternalControl(); - void SyncApplicationControls(Boolean mimeTypeChanged); - void SyncPluginControls(Boolean mimeTypeChanged); - void BuildPluginMenu(); - void BuildPluginList(); - void DeletePluginList(); - void BuildFileTypeMenu(); -#ifdef ANTHRAX - void SyncAppletControls(Boolean mimeTypeChanged); - void BuildAppletList(); - void BuildAppletMenu(); - void DeleteAppletList(); -#endif - - CMimeMapper::LoadAction GetLoadAction(); - - Boolean mInitialized; // Initialized with fCellInfo yet? - Boolean mModified; // Have any MIMEs been modified? - - - CMimeCell* mCellInfo; // Data for selected item - char** mPluginList; // Null-terminated array of plug-in names - uint32 mPluginCount; // Number of plug-ins in array - - LGAPopup *mFileTypePopup; - LGAPopup *mPluginPopup; - CLargeEditField *mDescriptionEditField; - CLargeEditField *mTypeEditField; - CLargeEditField *mExtensionEditField; - LGARadioButton *mRadioSave; - LGARadioButton *mRadioLaunch; - LGARadioButton *mRadioInternal; - LGARadioButton *mRadioUnknown; - LGARadioButton *mRadioPlugin; -// CFilePicker *mAppPicker; - LCaption *mAppName; - LButton *mAppButton; -// LCaption *mAppMenuLabel; - CStr255 mAppStr; - OSType mAppSig; - Boolean mLocked; -#ifdef ANTHRAX - LGARadioButton *mRadioApplet; - LGAPopup *mAppletPopup; - char** mAppletList; - uint32 mAppletCount; -#endif -}; // class CEditMIMEWindow - -//----------------------------------- -CEditMIMEWindow::CEditMIMEWindow(LStream* inStream): -//----------------------------------- - LGADialogBox(inStream), - mModified(false), - mInitialized(false), -#ifdef ANTHRAX - mAppletList(nil), - mAppletCount(0), -#endif - mPluginList(nil), - mPluginCount(0), - mLocked( false ) -{ -} - - -//----------------------------------- -CEditMIMEWindow::~CEditMIMEWindow() -//----------------------------------- -{ - DeletePluginList(); -#ifdef ANTHRAX - DeleteAppletList(); -#endif -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::FinishCreateSelf: -// Fiddle around with a few of our subviews once they've been created. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::FinishCreateSelf() -{ - // Cache pointers to all the controls - mFileTypePopup = (LGAPopup *)FindPaneByID(eFileTypePopupMenu); - XP_ASSERT(mFileTypePopup); - - mPluginPopup = (LGAPopup *)FindPaneByID(ePluginPopupMenu); - XP_ASSERT(mPluginPopup); - - mDescriptionEditField = (CLargeEditField *)FindPaneByID(eDescriptionField); - XP_ASSERT(mDescriptionEditField); - - mTypeEditField = (CLargeEditField *)FindPaneByID(eMIMETypeField); - XP_ASSERT(mTypeEditField); - - mExtensionEditField = (CLargeEditField *)FindPaneByID(eSuffixes); - XP_ASSERT(mExtensionEditField); - - mRadioSave = (LGARadioButton *)FindPaneByID(eSaveRButton); - XP_ASSERT(mRadioSave); - - mRadioLaunch = (LGARadioButton *)FindPaneByID(eApplicationRButton); - XP_ASSERT(mRadioLaunch); - - mRadioInternal = (LGARadioButton *)FindPaneByID(eCommunicatorRButton); - XP_ASSERT(mRadioInternal); - - mRadioUnknown = (LGARadioButton *)FindPaneByID(eUnknownRButton); - XP_ASSERT(mRadioUnknown); - - mRadioPlugin = (LGARadioButton *)FindPaneByID(ePluginRButton); - XP_ASSERT(mRadioPlugin); - -#ifdef ANTHRAX - mRadioApplet = (LGARadioButton *)FindPaneByID(eAppletButton); - XP_ASSERT(mRadioApplet); - - mAppletPopup = (LGAPopup *)FindPaneByID(eAppletPopupMenu); - XP_ASSERT(mAppletPopup); -#endif /* ANTHRAX */ - -// mAppPicker = (CFilePicker *)FindPaneByID(eApplicationFilePicker); -// XP_ASSERT(mAppPicker); - - mAppName = (LCaption *)FindPaneByID(eApplicationNameCaption); - XP_ASSERT(mAppName); - - mAppButton = (LButton *)FindPaneByID(eChooseApplicationButton); - XP_ASSERT(mAppButton); - -// mAppMenuLabel = (LCaption *)FindPaneByID(pref8AppMenuLabel); -// XP_ASSERT(mAppMenuLabel); - - // Text fields cannot become broadcasters automatically because - // LinkListenerToControls expects fields to be descendants of LControl - // C++ vtable gets fucked up - mDescriptionEditField->AddListener(this); - mTypeEditField->AddListener(this); - mExtensionEditField->AddListener(this); - - LGADialogBox::FinishCreateSelf(); -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::SetCellInfo: -// After the CPrefHelpersContain creates us it calls this method to provide -// us with the info for the selected cell, which we copy. We can then -// synchronize our controls to the data they display. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::SetCellInfo(CMimeCell* cellInfo) -{ - mCellInfo = cellInfo; - UpdateUIToMapper(); - mInitialized = true; -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::DeletePluginList: -// Delete the list of plug-ins. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::DeletePluginList() -{ - if (mPluginList) - { - uint32 index = 0; - - while (mPluginList[index++]) - { - free(mPluginList[index]); - } - free(mPluginList); - mPluginList = nil; - } -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::BuildPluginList: -// Build a list of plug-ins for this MIME type. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::BuildPluginList() -{ - // Delete the old list - DeletePluginList(); - - // Get the new list from XP code - mPluginList = NPL_FindPluginsForType(mCellInfo->mMapper->GetMimeName()); - - // Count how many are in the list - mPluginCount = 0; - if (mPluginList) - { - while (mPluginList[mPluginCount]) - mPluginCount++; - } -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::BuildPluginMenu: -// Build the plug-in menu from the list of plug-ins available for the current -// MIME type. We need to redraw the popup if the plug-in list used to be non- -// empty or is non-empty now. (It's too expensive to try to detect the case -// of the plug-in list getting rebuilt but still containing the same items.) -// --------------------------------------------------------------------------- -void CEditMIMEWindow::BuildPluginMenu() -{ - uint32 oldCount = mPluginCount; - - BuildPluginList(); - - if (oldCount || mPluginCount) - { - SetMenuSizeForLGAPopup(mPluginPopup, mPluginCount); - - MenuHandle menuH = mPluginPopup->GetMacMenuH(); - uint32 index = 0; - uint32 desiredValue = 1; // Default desired value is first item - while (mPluginList[index]) - { - SetMenuItemText(menuH, index+1, CStr255(mPluginList[index])); - ::EnableItem(menuH, index+1); - if (mCellInfo->mMapper->GetPluginName() == mPluginList[index]) - { - desiredValue = index + 1; - } - index++; - } - - // - // If the previously-selected plug-in name is in this list, - // select it; otherwise just select the first item. - // If we didn't change the control value, make sure it - // redraws since the contents of the list have changed. - // - uint32 previousValue = mPluginPopup->GetValue(); - if (desiredValue != previousValue) - { - mPluginPopup->SetValue(desiredValue); - } - else - { - mPluginPopup->Refresh(); - } - } -} - -#ifdef ANTHRAX -void CEditMIMEWindow::DeleteAppletList() -{ - if (mAppletList) - { - uint32 index = 0; - - while (mAppletList[index++]) - { - free(mAppletList[index]); - } - free(mAppletList); - mAppletList = nil; - } -} - -void CEditMIMEWindow::BuildAppletList() -{ - // Delete the old list - DeleteAppletList(); - - // Get the new list from XP code - HACK!!!! for now - mAppletList = NPL_FindAppletsForType(mCellInfo->mMapper->GetMimeName()); - - // Count how many are in the list - mAppletCount = 0; - if (mAppletList) - { - while (mAppletList[mAppletCount]) - mAppletCount++; - } -} - -void CEditMIMEWindow::BuildAppletMenu() -{ - uint32 oldCount = mAppletCount; - - BuildAppletList(); - - if (oldCount || mAppletCount) - { - SetMenuSizeForLGAPopup(mAppletPopup, mAppletCount); - - MenuHandle menuH = mAppletPopup->GetMacMenuH(); - uint32 index = 0; - uint32 desiredValue = 1; // Default desired value is first item - while (mAppletList[index]) - { - SetMenuItemText(menuH, index+1, CStr255(mAppletList[index])); - ::EnableItem(menuH, index+1); - if (mCellInfo->mMapper->GetAppletName() == mAppletList[index]) - { - desiredValue = index + 1; - } - index++; - } - - // - // If the previously-selected applet name is in this list, - // select it; otherwise just select the first item. - // If we didn't change the control value, make sure it - // redraws since the contents of the list have changed. - // - uint32 previousValue = mAppletPopup->GetValue(); - if (desiredValue != previousValue) - { - mAppletPopup->SetValue(desiredValue); - } - else - { - mAppletPopup->Refresh(); - } - } -} -#endif /* ANTHRAX */ - -//struct BNDLIds -//{ // Utility structure for bundle parsing -// Int16 localID; -// Int16 resID; -//}; - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::BuildFileTypeMenu: -// Build the file-type menu from the list file types in the application info. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::BuildFileTypeMenu() -{ - - CApplicationIconInfo* newInfo = NULL; - short refNum; - Handle bundle = NULL; - OSErr err; - Handle appIcon = NULL; - Boolean handlesAE = TRUE; - - BNDLIds* iconOffset; - BNDLIds* frefOffset; - short numOfIcons; - short numOfFrefs; // Really number-1, just like in the resource - BNDLIds frefBNDL; - Handle iconFamily; - OSType iconType; - Handle frefRes = NULL; - - Try_ - { - SetResLoad( FALSE ); - FSSpec appSpec; - OSErr err = CFileMgr::FindApplication( mAppSig, appSpec ); - refNum = ::FSpOpenResFile( &appSpec,fsRdPerm ); - err = ResError(); - SetResLoad( TRUE ); - ThrowIfOSErr_( err ); - - // BNDL - bundle = ::Get1IndResource( 'BNDL' , 1 ); - ThrowIfNil_( bundle ); - HLock( bundle ); - HNoPurge( bundle ); - // Get the signature - ::BlockMoveData( *bundle, &mAppSig, 4 ); - - - OSType resType; - Ptr bundlePtr = NULL; - - bundlePtr = *bundle; - - ::BlockMoveData( bundlePtr + 8, &resType, 4 ); // Get the first resource type - if ( resType == 'ICN#' ) - { - ::BlockMoveData( bundlePtr + 12, &numOfIcons, 2 ); - iconOffset = (BNDLIds*)( bundlePtr + 14 ); - //::BlockMove( (Ptr)iconOffset + ( numOfIcons + 1) * sizeof( BNDLIds ), &resType, 4 ); // Just checkin' - ::BlockMoveData( (Ptr)iconOffset + (numOfIcons + 1) * sizeof( BNDLIds ) + 4, &numOfFrefs, 2 ); - frefOffset = (BNDLIds*)( (Ptr)iconOffset + 6 + ( numOfIcons + 1 ) * sizeof( BNDLIds ) ); - } - else // FREF - { - ::BlockMoveData( bundlePtr + 12, &numOfFrefs, 2 ); - frefOffset = (BNDLIds*) (bundlePtr + 14 ); - //::BlockMove( (Ptr)frefOffset + ( numOfFrefs + 1 ) * sizeof( BNDLIds ), &resType, 4 ); // Just checkin' - ::BlockMoveData( (Ptr)frefOffset + ( numOfFrefs + 1 ) * sizeof( BNDLIds ) + 4, &numOfIcons, 2 ); - iconOffset = (BNDLIds*)( (Ptr)frefOffset + 6 + (numOfFrefs + 1) * sizeof(BNDLIds) ); - } - // We have the offsets for FREF and ICN# resources - // Not every FREF has a matching icon, so we read in all - // the FREFs and try to find the matching icon for each - - - MenuHandle menuH = mFileTypePopup->GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - while ( numMenuItems > 0 ) - { - ::DeleteMenuItem(menuH, numMenuItems); - numMenuItems--; - } - - - for ( int i = 0; i <= numOfFrefs; i++ ) - { - // Algorithm: - // Get the FREF resource specified in BNDL - // Find the ICN# resource from BNDL with same local ID - // Get the icon specified in ICN# resource. - // If getting of the icon fails in any case, use the default icon - frefBNDL = frefOffset[i]; - iconFamily = NULL; - iconType = 'DUMB'; - frefRes = ::Get1Resource( 'FREF', frefBNDL.resID ); - if ( frefRes == NULL ) // Ignore the record if FREF resource is not found - continue; - ::BlockMoveData( *frefRes, &iconType, 4 ); - ::ReleaseResource( frefRes ); - - if ( ( iconType == 'fold' ) || // folders are not files - ( iconType == '****' ) || // any file will default to text later - ( iconType == 'pref' ) || // prefs are also ignored - ( iconType == 'PREF' ) ) - continue; - - if ( iconType == 'APPL' ) - { - // Don't do anything - } - else - { // Document icons - ::AppendMenu(menuH, CStr255(iconType)); - Int16 numMenuItems = ::CountMItems(menuH); - SetMenuItemText(menuH, numMenuItems, CStr255(iconType)); - - } - } // Done parsing all the file types - - HUnlock( bundle ); - HPurge( bundle ); - ReleaseResource( bundle ); - - // Error handling: no file types - numMenuItems = ::CountMItems(menuH); - if ( numMenuItems == 0 ) // No icons were read, add 1 dummy one - { - ::AppendMenu(menuH, CStr255(iconType)); - - SetMenuItemText(menuH, numMenuItems +1 , CStr255('TEXT')); - } - } - Catch_(inErr) - { - - } - EndCatch_ - mFileTypePopup->SetPopupMinMaxValues(); - CloseResFile( refNum ); - err = ResError(); -} - - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::SyncTextControls: -// Sync the edit text fields with their actual values (only called when -// the window is first created). -// --------------------------------------------------------------------------- -void CEditMIMEWindow::SyncTextControls() -{ - XP_ASSERT(mCellInfo->mMapper != nil); - - // MIME type - mAppStr = mCellInfo->mMapper->GetAppName(); - mDescriptionEditField->SetDescriptor(mCellInfo->mMapper->GetDescription() ); - - // MIME type - mTypeEditField->SetDescriptor(mCellInfo->mMapper->GetMimeName()); - - // Extensions - mExtensionEditField->SetDescriptor(mCellInfo->mMapper->GetExtensions()); -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::SyncRadioControlValues: -// Sync the radio buttons with their actual values (only called when -// the window is first created). -// --------------------------------------------------------------------------- -void CEditMIMEWindow::UpdateRadioUItoMapper() -{ - switch (mCellInfo->mMapper->GetLoadAction() ) - { - case CMimeMapper::Save: - mRadioSave->SetValue(1); - break; - case CMimeMapper::Launch: - mRadioLaunch->SetValue(1); - break; - case CMimeMapper::Internal: - mRadioInternal->SetValue(1); - break; - case CMimeMapper::Unknown: - mRadioUnknown->SetValue(1); - break; - case CMimeMapper::Plugin: - mRadioPlugin->SetValue(1); - break; -#ifdef ANTHRAX - case CMimeMapper::Applet: - mRadioApplet->SetValue(1); - break; -#endif - } -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::SyncInternalControl: -// Sync up the "Use Netscape" radio button when the MIME type changes. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::SyncInternalControl() -{ - CStr255 newText; - mTypeEditField->GetDescriptor( newText); - if (CMimeMapper::NetscapeCanHandle( newText)) - { - if( !mLocked ) - mRadioInternal->Enable(); - } - else - { - if (mRadioInternal->GetValue() == 1) - { - mRadioUnknown->SetValue(1); - } - mRadioInternal->Disable(); - } -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::SyncApplicationControls: -// Sync up the application-related controls when the "Use application" radio -// button changes state, etc. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::SyncApplicationControls(Boolean applicationChanged) -{ - if (applicationChanged) - { - BuildFileTypeMenu(); - } - - Boolean enableAppControls = ( GetLoadAction() == CMimeMapper::Launch) && !mLocked; - - // - // Application name - // - ResIDT oldTraits = mAppName->GetTextTraitsID(); - if (enableAppControls) - { - mAppName->SetTextTraitsID(eNormalTextTraits); // Normal - mAppButton->Enable(); - } - else - { - mAppName->SetTextTraitsID(eGrayTextTraits); // Dimmed - mAppButton->Disable(); - } - if (applicationChanged) - { - mAppName->SetDescriptor( mAppStr); - } - - else if (oldTraits != mAppName->GetTextTraitsID()) - { - mAppName->Refresh(); - } - - // - // Popup enabled state - // - MenuHandle menuH = mFileTypePopup->GetMacMenuH(); - Int16 numMenuItems = ::CountMItems(menuH); - if (enableAppControls && numMenuItems > 0 ) - { - mFileTypePopup->Enable(); - } - else - { - mFileTypePopup->Disable(); - } - - // - // File type - // - if (mRadioLaunch->GetValue() == 1) - { - #if 0 - uint32 item = mFileTypePopup->GetValue(); - XP_ASSERT(item > 0); - CFileType* fileType = mCellInfo->mIconInfo->GetFileType(item); - if (fileType) - { - mCellInfo->mMapper->SetDocType(fileType->fIconSig); - } - #endif - } -} - - -// --------------------------------------------------------------------------- -// CEditMIMEWindow::SyncPluginControls: -// Sync up the plugin-related controls when the "Use plugin" radio -// button changes state or the MIME type changes. -// --------------------------------------------------------------------------- -void CEditMIMEWindow::SyncPluginControls(Boolean mimeTypeChanged) -{ - if (mimeTypeChanged) - { - BuildPluginMenu(); - } - // - // Plug-in radio button enabled state - // - if (mPluginCount > 0) - { - mRadioPlugin->Enable(); - } - else - { - mRadioPlugin->Disable(); - if (mRadioPlugin->GetValue() == 1) - { - mRadioUnknown->SetValue(1); - } - } - - // - // Plug-in popup control enabled state - // - - if (GetLoadAction() == CMimeMapper::Plugin && mPluginCount > 0) - { - mPluginPopup->Enable(); - } - else - { - mPluginPopup->Disable(); - } - -} - -#ifdef ANTHRAX -void CEditMIMEWindow::SyncAppletControls(Boolean mimeTypeChanged) -{ - if (mimeTypeChanged) - { - BuildAppletMenu(); - } - // - // If we have an Applet installed, enable the radio button - // - if (mAppletCount > 0) - { - mRadioApplet->Enable(); - } - else - { - mRadioApplet->Disable(); - if (mRadioApplet->GetValue() == 1) - mRadioUnknown->SetValue(1); - } - - // - // Determine the Applet popup control enabled state - // - - if (GetLoadAction() == CMimeMapper::Applet && mAppletCount > 0) - { - mAppletPopup->Enable(); - } - else - { - mAppletPopup->Disable(); - } -} -#endif /* ANTHRAX */ - -CMimeMapper::LoadAction CEditMIMEWindow::GetLoadAction() -{ - if (mRadioSave->GetValue() ) return CMimeMapper::Save ; - if ( mRadioLaunch->GetValue() ) return CMimeMapper::Launch; - if ( mRadioInternal->GetValue() ) return CMimeMapper::Internal; - if ( mRadioUnknown->GetValue() ) return CMimeMapper::Unknown; - if (mRadioPlugin ->GetValue() ) return CMimeMapper::Plugin; -#ifdef ANTHRAX - if(mRadioApplet->GetValue()) return CMimeMapper::Applet; -#endif - return CMimeMapper::Unknown; -} - -//----------------------------------- -void CEditMIMEWindow::ListenToMessage(MessageT inMessage, void *ioParam) -// Process a message from the MIME types dialog -//----------------------------------- -{ - if (!mInitialized) - return; - - if ( ioParam == mRadioLaunch) - SyncApplicationControls(false); - if ( ioParam == mRadioPlugin ) - SyncPluginControls(false); -#ifdef ANTHRAX - if(ioParam == mRadioApplet) - SyncAppletControls(false); -#endif - - switch (inMessage) - { - // Pick a handler - case eSaveRButton: - case eApplicationRButton: - case eCommunicatorRButton: - case eUnknownRButton: - case ePluginRButton: -#ifdef ANTHRAX - case eAppletButton: -#endif - mModified = TRUE; - break; - - // Pick a new application - case eChooseApplicationButton: - { - StandardFileReply reply; - CFilePicker::DoCustomGetFile(reply, CFilePicker::Applications, FALSE); // Pick app - if (reply.sfGood) - { - // set mappers properties from the app - FInfo finderInfo; - OSErr err = FSpGetFInfo(&reply.sfFile, &finderInfo); - mAppSig = finderInfo.fdCreator; - mAppStr = reply.sfFile.name; - SyncApplicationControls(true); // App changed - mModified = TRUE; - } - break; - } - - // Change the file type - case eFileTypePopupMenu: - { - SyncApplicationControls(false); - mModified = TRUE; - break; - } - - // Change the plug-in - case ePluginPopupMenu: - { - SyncPluginControls(false); - mModified = TRUE; - break; - } - -#ifdef ANTHRAX - case eAppletPopupMenu: - { - SyncAppletControls(false); - mModified = TRUE; - break; - } -#endif /* ANTHRAX */ - - // Edit some text - case msg_EditField2: - { - CStr255 newText; - - mTypeEditField->GetDescriptor(newText); - if ( ioParam == mTypeEditField ) - { - SyncPluginControls(true); // Plug-in choices depend on MIME type - SyncInternalControl(); // "Use Netscape" radio depends on MIME type - } - - mModified = TRUE; - break; - } - - case msg_OK: - UpdateMapperToUI(); - break; - case msg_Cancel: - break; - default: - break; - } -} - -//------------------------------------------------------------------------------ -// ¥ UpdateUIToMapper -//------------------------------------------------------------------------------ -// Set up the controls in the dialog box (before it's visible) with the -// information from the currently selected cell. Note that the order of these -// unction calls is important -// -void CEditMIMEWindow::UpdateUIToMapper() -{ - - mAppSig = mCellInfo->mMapper->GetAppSig(); - UpdateRadioUItoMapper(); - SyncTextControls(); - SyncInternalControl(); -#ifdef ANTHRAX - SyncAppletControls(true); -#endif - SyncApplicationControls(true); - SyncPluginControls(true); - Int32 fileFlags = mCellInfo->mMapper->GetFileFlags(); - Boolean flag = ( fileFlags & ICmap_resource_fork_mask ) > 0; - - flag = (!(fileFlags & ICmap_not_outgoing_mask) )> 0; - mLocked = PREF_PrefIsLocked( CPrefs::Concat(mCellInfo->mMapper->GetBasePref(), ".mimetype") ); - if( mLocked ) - { -#ifdef ANTHRAX - for( PaneIDT i = eDescriptionField ; i<= eAppletPopupMenu ; i++ ) -#else - for( PaneIDT i = eDescriptionField ; i<= eUnknownRButton ; i++ ) -#endif - { - LPane* pane = FindPaneByID( i ); - if( pane ) - pane->Disable(); - } - // Disable OK - LPane* view = FindPaneByID( 900 ); - view->Disable(); - } -} - -//------------------------------------------------------------------------------ -// ¥ UpdateMapperToUI -//------------------------------------------------------------------------------ -// Update the UI for the original mapper -// The mediator is reponsible for actually commiting changes to the prefs -// -void CEditMIMEWindow::UpdateMapperToUI() -{ - CStr255 newText; - // Description - mDescriptionEditField->GetDescriptor(newText); - mCellInfo->mMapper->SetDescription(newText); - - // MimeType - mTypeEditField->GetDescriptor(newText); - mCellInfo->mMapper->SetMimeType(newText); - - // Extension Fields - mExtensionEditField->GetDescriptor(newText); - mCellInfo->mMapper->SetExtensions(newText); - - // Application Name and Signature - mCellInfo->mMapper->SetAppSig( mAppSig ); - mCellInfo->mMapper->SetAppName ( mAppStr ); - - // load action - mCellInfo->mMapper->SetLoadAction( GetLoadAction() ); - - // Plug-in name - if (mRadioPlugin->GetValue() == 1) - { - uint32 item = mPluginPopup->GetValue(); - XP_ASSERT(item > 0); - if (mPluginList && item > 0 && item <= mPluginCount) - { - char* plugin = mPluginList[item - 1]; // Menu is 1-based, list is 0-based - if (plugin) - mCellInfo->mMapper->SetPluginName(plugin); - } - } -#ifdef ANTHRAX - else if(mRadioApplet->GetValue() == 1) - { - uint32 item = mAppletPopup->GetValue(); - XP_ASSERT(item > 0); - if (mAppletList && item > 0 && item <= mAppletCount) - { - char* applet = mAppletList[item - 1]; // Menu is 1-based, list is 0-based - if (applet) - mCellInfo->mMapper->SetAppletName(applet); - } - } -#endif - else - mCellInfo->mMapper->SetPluginName( "\p" ); - - // Since the App has changed, get rid of the old icon - if ( mCellInfo -> mIcon) - { - ::DisposeIconSuite( mCellInfo->mIcon , true); - mCellInfo->mIcon = nil; - } - - // XXX this file flag stuff might no longer be needed, but I'm not sure - Int32 fileFlags = 0; - mCellInfo->mMapper->SetFileFlags( fileFlags ); -} -#pragma mark --CBrowserApplicationsMediator-- -//------------------------------------------------------------------------------ -// ¥ RegisterViewClasses -//------------------------------------------------------------------------------ -// -void CBrowserApplicationsMediator::RegisterViewClasses() -{ - RegisterClass_( CEditMIMEWindow); - RegisterClass_( CMimeTableView ); -} - -//------------------------------------------------------------------------------ -// ¥ CBrowserApplicationsMediator -//------------------------------------------------------------------------------ -// -CBrowserApplicationsMediator::CBrowserApplicationsMediator(LStream*) -: CPrefsMediator(class_ID) -, mModified(false) -, mMIMETable(nil) -{ -} - -//------------------------------------------------------------------------------ -// ¥ EditMimeEntry -//------------------------------------------------------------------------------ -// Brings up a property window for the selected Cell or -// if isNewEntry is true allows the user to add a new mime type -// -void CBrowserApplicationsMediator::EditMimeEntry( Boolean isNewEntry) -{ - StDialogHandler theHandler(eEditTypeDialogResID, sWindow->GetSuperCommander()); - CEditMIMEWindow* theDialog = (CEditMIMEWindow*)theHandler.GetDialog(); - XP_ASSERT(theDialog); - UReanimator::LinkListenerToControls(theDialog, theDialog, eEditTypeDialogResID); - - // Get the info that the dialog should display - CMimeCell* cellInfo = nil; - if( isNewEntry ) - { - cellInfo = new CMimeCell; - CStr255 emptyType = ""; - cellInfo->mMapper = CPrefs::CreateDefaultUnknownMapper(emptyType, FALSE); - } - else - { - STableCell cellToEdit = mMIMETable->GetFirstSelectedCell(); - uint32 size = sizeof( cellInfo ); - mMIMETable->GetCellData(cellToEdit, &cellInfo, size ); - } - - // Tell Dialog what to edit - theDialog->SetCellInfo( cellInfo); - - // Let the user have at it... - theDialog->Show(); - MessageT theMessage = msg_Nothing; - while ((theMessage != msg_Cancel) && (theMessage != msg_OK)) - { - theMessage = theHandler.DoDialog(); - - if (theMessage == msg_OK && - /* cellInfo->mMapper->GetMimeName() != cellInfo->mMapper->GetMimeName() && */ - mMIMETable->MimeTypeExists(cellInfo->mMapper) ) - { - ErrorManager::PlainAlert(mPREFS_DUPLICATE_MIME); - theMessage = msg_Nothing; - } - // The CEditMIMEWindow will handle all other messages - } - - // Process the munged data as appropriate - if (theMessage == msg_OK && theDialog->Modified()) - { - mModified = TRUE; // Remember that something changed - if( isNewEntry ) - mMIMETable->AddEntry( &cellInfo ); - mMIMETable->Refresh(); // Let table sync to the new data - - } - else if ( isNewEntry ) - { - delete cellInfo; // Throw away changes - } -} - - -void CBrowserApplicationsMediator::DeleteMimeEntry() -{ - if (ErrorManager::PlainConfirm((const char*) GetCString(DELETE_MIMETYPE))) - { - XP_ASSERT(mMIMETable); - STableCell cellToDelete = mMIMETable->GetFirstSelectedCell(); - - CMimeCell* cellInfo = nil; - uint32 size = sizeof( CMimeCell * ); - mMIMETable->GetCellData(cellToDelete, &cellInfo, size); - - // Instead of freeing the item, add it to a list of deleted mime types - // and at commit time, delete the items from xp pref storage. - mDeletedTypes.LArray::InsertItemsAt(1, LArray::index_Last, &cellInfo); - - mModified = TRUE; - - mMIMETable->RemoveRows(1, cellToDelete.row); - - // We want to select the cell immediately after the deleted one. It just so - // happens that its coordinates are now (after deleting), what the cell to - // delete was before. So we just need to select cellToDelete. However, if - // there is no cell after the deleted cell (it was the last one), then we - // just select the last one. - TableIndexT rows, columns; - mMIMETable->GetTableSize(rows, columns); - cellToDelete.row = cellToDelete.row > rows? rows: cellToDelete.row; - mMIMETable->ScrollCellIntoFrame(cellToDelete); - mMIMETable->SelectCell(cellToDelete); - mMIMETable->Refresh(); - } -} - -void CBrowserApplicationsMediator::ListenToMessage(MessageT inMessage, void *ioParam) -{ - switch (inMessage) - { - case eHelperDeleteButton: - DeleteMimeEntry(); - break; - - case eHelperNewButton: - EditMimeEntry( true ); - break; - - case eHelperEditButton: - case CMimeTableView::msg_DoubleClick: - EditMimeEntry( false ); - break; - - case CMimeTableView::msg_SelectionChanged: - LButton *deleteButton = (LButton *)FindPaneByID(eHelperDeleteButton); - XP_ASSERT(deleteButton); - LButton *editButton = (LButton *)FindPaneByID(eHelperEditButton); - XP_ASSERT(editButton); - - XP_ASSERT(ioParam); - STableCell cell = mMIMETable->GetFirstSelectedCell(); - Boolean inactive; - Boolean locked = false; - if (cell.row > 0) - { - CMimeCell* cellInfo = nil; - uint32 size = sizeof( CMimeCell * ); - mMIMETable->GetCellData(cell, &cellInfo, size ); - locked = cellInfo->mMapper->IsLocked(); - inactive = CMimeMapper::NetscapeCanHandle(cellInfo->mMapper->GetMimeName()); - editButton->Enable(); - } - else - { - inactive = true; - editButton->Disable(); - } - if (inactive) - deleteButton->Disable(); - else - { - if( locked == false ) - deleteButton->Enable(); - } - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -void CBrowserApplicationsMediator::LoadMainPane() -{ - CPrefsMediator::LoadMainPane(); - mMIMETable = (CMimeTableView *)FindPaneByID(eHelperTable); - XP_ASSERT(mMIMETable); - mMIMETable->AddListener(this); - STableCell currentCell(1, 1); // This has to be done after - mMIMETable->SelectCell(currentCell); // mMIMETable->AddListener(); to set the buttons. -} - -void CBrowserApplicationsMediator::WritePrefs() -{ - if (mModified) - { - CPrefs::sMimeTypes.DeleteAll(FALSE); - XP_ASSERT(mMIMETable); - TableIndexT rows, cols; - mMIMETable->GetTableSize(rows, cols); - for (int i = 1; i <= rows; i++) - { - CMimeCell* cellInfo = nil; - uint32 size = sizeof( CMimeCell * ); - STableCell cell( i, 1 ); - mMIMETable->GetCellData( cell , &cellInfo, size); - - cellInfo->mMapper->WriteMimePrefs(); - CMimeMapper* mapper = new CMimeMapper(*cellInfo->mMapper); - CPrefs::sMimeTypes.InsertItemsAt(1, LArray::index_Last, &mapper); - } - - for (Int32 i = 1; i <= mDeletedTypes.GetCount(); i++) - { - CMimeCell* mapper; - mDeletedTypes.FetchItemAt(i, &mapper); - PREF_DeleteBranch(mapper->mMapper->GetBasePref()); - delete mapper; - } - } -} - -void CBrowserApplicationsMediator::UpdateFromIC() -{ - CFilePicker* filePicker = dynamic_cast< CFilePicker*>( FindPaneByID( 12506 ) ); - XP_ASSERT( filePicker ); - if( UseIC() ) - { - FSSpec specFromIC; - if (!CInternetConfigInterface::GetFileSpec( kICDownloadFolder , specFromIC ) ) - { - filePicker->SetFSSpec( specFromIC,false); - filePicker->Disable(); - } - } - else - filePicker->Enable(); -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/prefs/CBrowserApplicationsMediator.h b/mozilla/cmd/macfe/prefs/CBrowserApplicationsMediator.h deleted file mode 100644 index d3a09d1d3ae..00000000000 --- a/mozilla/cmd/macfe/prefs/CBrowserApplicationsMediator.h +++ /dev/null @@ -1,46 +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. - */ -#pragma once -#include "CPrefsMediator.h" -class CMimeTableView; -//------------------------------------------------------------------------------ -// ¥ CBrowserApplicationsMediator -//------------------------------------------------------------------------------ -// -#pragma mark -class CBrowserApplicationsMediator : public CPrefsMediator -{ - public: - static void RegisterViewClasses(); - enum { class_ID = PrefPaneID::eBrowser_Applications }; - CBrowserApplicationsMediator(LStream*); - virtual ~CBrowserApplicationsMediator() {}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void LoadMainPane(); - virtual void WritePrefs(); - virtual void UpdateFromIC(); - private: - Boolean mModified; // Have any MIMEs been modified - CMimeTableView* mMIMETable; // Scrolling table of MIME types - LArray mDeletedTypes; - - void EditMimeEntry( Boolean isNewEntry); - void DeleteMimeEntry(); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/prefs/CLocationIndependenceMediator.h b/mozilla/cmd/macfe/prefs/CLocationIndependenceMediator.h deleted file mode 100644 index b0090236f14..00000000000 --- a/mozilla/cmd/macfe/prefs/CLocationIndependenceMediator.h +++ /dev/null @@ -1,39 +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) 1997 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#pragma once -#ifdef MOZ_LOC_INDEP -#include "CPrefsMediator.h" - -/* Its reason for existence is li.protocol preference, which is a radio text :( */ -class CLocationIndependenceMediator : public CPrefsMediator -//====================================== -{ - private: - typedef CPrefsMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eLocationIndependence_Server }; - CLocationIndependenceMediator(LStream*); - virtual ~CLocationIndependenceMediator(); - virtual void LoadPrefs(); - virtual void WritePrefs(); -}; - -#endif // MOZ_LOC_INDEP \ No newline at end of file diff --git a/mozilla/cmd/macfe/prefs/CMailNewsMainMediator.cp b/mozilla/cmd/macfe/prefs/CMailNewsMainMediator.cp deleted file mode 100644 index 0e50a1ba243..00000000000 --- a/mozilla/cmd/macfe/prefs/CMailNewsMainMediator.cp +++ /dev/null @@ -1,147 +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 MOZ_LITE - -#include "CMailNewsMainMediator.h" - -#include "xp_help.h" -#include "prefapi.h" -#include "macgui.h" - -#include "PascalString.h" -#include "StSetBroadcasting.h" -#include - -enum -{ - eQuoteStylePopup = 12601 -, eQuoteSizePopup -, eQuoteColorButton -, eFixedRButton -, eVariableRButton - -, eLocalMailDirFilePicker = 12910 -, eCheckForMailBox = 12912 -, eCheckForMailIntervalEditField = 12913 -, eNotificatonSoundPopup = 12914 -, eRememberPasswordBox = 12915 -}; - -//----------------------------------- -CMailNewsMainMediator::CMailNewsMainMediator(LStream*) -//----------------------------------- -: CPrefsMediator(class_ID) -{ -} - -//----------------------------------- -CMailNewsMainMediator::~CMailNewsMainMediator() -//----------------------------------- -{ -} - -//----------------------------------- -void CMailNewsMainMediator::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case eNotificatonSoundPopup: - LGAPopup *soundMenu = - (LGAPopup *)FindPaneByID(eNotificatonSoundPopup); - int menuItem = soundMenu->GetValue(); - MenuHandle soundMenuH = soundMenu->GetMacMenuH(); - CStr255 stringResName; - if (menuItem > 2) - GetMenuItemText(soundMenuH, menuItem, stringResName); - if (stringResName[0]) - { - SndListHandle soundH = - (SndListHandle)GetNamedResource('snd ', stringResName); - if (soundH) - { - ::DetachResource((Handle)soundH); - SndPlay(nil, soundH, false); - DisposeHandle((Handle)soundH); - } - } - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} - -//----------------------------------- -void CMailNewsMainMediator::WritePrefs() -//----------------------------------- -{ - if (!PaneHasLockedPref(eNotificatonSoundPopup) && !PREF_PrefIsLocked("mail.play_sound")) - { - char* soundName = nil; - LControl* popup = (LControl*)FindPaneByID(eNotificatonSoundPopup); - XP_Bool playSound = popup->GetValue() != 0; - PREF_SetBoolPref("mail.play_sound", playSound); - } -} // CMailNewsMainMediator::WritePrefs - -//----------------------------------- -Boolean CMailNewsMainMediator::BiffIntervalValidationFunc(CValidEditField *biffInterval) -//----------------------------------- -{ - // If the checkbox isn't set then this value is really - // ignored, so I will only put up the alert if the checkbox - // is set, but I will force a valid value in any case. - - Boolean result = true; - - // force valid value - if (1 > biffInterval->GetValue()) - { - int32 newInterval = 10; - PREF_GetDefaultIntPref("mail.check_time", &newInterval); - biffInterval->SetValue(newInterval); - biffInterval->SelectAll(); - result = false; - } - if (!result) // if the value is within the range, who cares - { - // Check for the check box... - // We are assuming that the checkbox is a sub of the field's superview. - LView *superView = biffInterval->GetSuperView(); - XP_ASSERT(superView); - LGACheckbox *checkbox = - (LGACheckbox *)superView->FindPaneByID(eCheckForMailBox); - XP_ASSERT(checkbox); - if (checkbox->GetValue()) - { - StPrepareForDialog prepare; - ::StopAlert(1067, NULL); - } - else - { - result = true; // go ahead and let them switch (after correcting the value) - // if the checkbox isn't set - } - } - return result; -} - -#endif // MOZ_LITE - diff --git a/mozilla/cmd/macfe/prefs/CMailNewsMainMediator.h b/mozilla/cmd/macfe/prefs/CMailNewsMainMediator.h deleted file mode 100644 index b2a089a2e41..00000000000 --- a/mozilla/cmd/macfe/prefs/CMailNewsMainMediator.h +++ /dev/null @@ -1,41 +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. - */ - -#pragma once - -#include "CPrefsMediator.h" - -#ifdef MOZ_MAIL_NEWS -//====================================== -class CMailNewsMainMediator : public CPrefsMediator -//====================================== -{ - public: - - enum { class_ID = PrefPaneID::eMailNews_Main }; - CMailNewsMainMediator(LStream*); - virtual ~CMailNewsMainMediator(); - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void WritePrefs(); - - static Boolean BiffIntervalValidationFunc(CValidEditField *biffInterval); -}; -#endif // MOZ_MAIL_NEWS - diff --git a/mozilla/cmd/macfe/prefs/CMenuTable.cp b/mozilla/cmd/macfe/prefs/CMenuTable.cp deleted file mode 100644 index c6ff4c12a6b..00000000000 --- a/mozilla/cmd/macfe/prefs/CMenuTable.cp +++ /dev/null @@ -1,532 +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. - */ - -#ifdef PowerPlant_PCH -#include PowerPlant_PCH -#endif - -#include "CMenuTable.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "CPrefsMediator.h" - -#pragma options align= packed - -struct CellData -{ - MessageT message; - Str255 label; -}; - -#pragma options align=reset - -//---------------------------------------------------------------------------------------- -CMenuTable::CMenuTable(LStream *inStream) -: LTextHierTable(inStream) -, CQAPartnerTableMixin(this) -//---------------------------------------------------------------------------------------- -{ - *inStream >> mLeafTextTraits; - *inStream >> mParentTextTraits; - *inStream >> mFirstIndent; - *inStream >> mLevelIndent; - *inStream >> mMenuID; -} - - -//---------------------------------------------------------------------------------------- -CMenuTable::~CMenuTable() -//---------------------------------------------------------------------------------------- -{ -} - - -//----------------------------------- -void CMenuTable::AddTableLabels( - TableIndexT ¤tRow, - ResIDT menuID, - Boolean firstLevel) -// Recursive. Adds table entries by using a hierarchical menu structure. -//----------------------------------- -{ - MenuHandle hMenu = nil; - Int16** theMcmdH = nil; - try - { - hMenu = ::GetMenu(menuID); - ThrowIfResFail_(hMenu); - short iItemCnt = ::CountMItems(hMenu); - theMcmdH = (Int16**)::GetResource('Mcmd', menuID); - ThrowIfResFail_(theMcmdH); - if (**theMcmdH != iItemCnt) - { - ReleaseResource((Handle)theMcmdH); - theMcmdH = nil; - throw((OSErr)resNotFound); - } - StHandleLocker hl((Handle)theMcmdH); - MessageT* messages = (MessageT *)(*theMcmdH + 1); - // There does not seem to be a way to add a row that is at a higher - // level than the one immediately preceding it. For this reason we - // must make two pass through the labels. The first pass creates all of - // the rows for a given level and the next pass adds the children. - int menuItem; - TableIndexT currentRowSaved = currentRow; - for (menuItem = 1; menuItem <= iItemCnt; ++menuItem) - { - CellData theData; - ::GetMenuItemText(hMenu, menuItem, theData.label); - if (messages) - theData.message = messages[menuItem - 1]; - else - theData.message = 0; - short cmdChar; - ::GetItemCmd(hMenu, menuItem, &cmdChar); - Boolean hasSubMenus = (hMenuCmd == cmdChar); - if (!firstLevel && (1 == menuItem)) - { - InsertChildRows( 1, currentRow++, &theData, - sizeof(MessageT) + theData.label[0] + 1, - hasSubMenus, false); - } - else - { - InsertSiblingRows( 1, currentRow++, &theData, - sizeof(MessageT) + theData.label[0] + 1, - hasSubMenus, false); - } - } - currentRow = currentRowSaved; - for (menuItem = 1; menuItem <= iItemCnt; ++menuItem) - { - short cmdChar; - ::GetItemCmd(hMenu, menuItem, &cmdChar); - Boolean hasSubMenus = (hMenuCmd == cmdChar); - ++currentRow; - if (hasSubMenus) - { - short markChar; - ::GetItemMark(hMenu, menuItem, &markChar); - // AddTableLabels(currentRow, markChar & 0x0F, false); - AddTableLabels(currentRow, markChar, false); - } - } - } - catch(...) - { - if (hMenu) - ReleaseResource((Handle)hMenu); - if (theMcmdH) - ReleaseResource((Handle)theMcmdH); - throw; - } - if (hMenu) - ReleaseResource((Handle)hMenu); - if (theMcmdH) - ReleaseResource((Handle)theMcmdH); -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::FinishCreate() -//---------------------------------------------------------------------------------------- -{ - // geometry - SDimension16 tableSize; - GetFrameSize(tableSize); - - StTextState ts; - UTextTraits::SetPortTextTraits(mParentTextTraits); - FontInfo fi; - - ::GetFontInfo(&fi); - Uint16 height = fi.ascent + fi.descent + fi.leading + 1; - // the height should never be less than 12 - height = height > 12? height: 12; - - LTableMonoGeometry *theGeometry = - new LTableMonoGeometry( this, - tableSize.width, - fi.ascent + fi.descent + fi.leading + 1); - SetTableGeometry(theGeometry); - // selector - LTableSingleSelector *theSelector = - new LTableSingleSelector(this); - SetTableSelector(theSelector); - // storage - LTableArrayStorage *theStorage = - new LTableArrayStorage(this, (unsigned long)0); - SetTableStorage(theStorage); - - // rows and cols - InsertCols(1, 0, "", 0, false); - - TableIndexT currentRow = 0; - AddTableLabels(currentRow, mMenuID); - UnselectAllCells(); -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::SelectionChanged() -//---------------------------------------------------------------------------------------- -{ - BroadcastMessage(msg_SelectionChanged, this); -} - -//---------------------------------------------------------------------------------------- -MessageT CMenuTable::GetSelectedMessage() -//---------------------------------------------------------------------------------------- -{ - MessageT result = 0; - STableCell theCell = GetFirstSelectedCell(); // we have only one - CellData theData; - unsigned long theSize = sizeof(theData); - if (theCell.row && theCell.col) - { - TableIndexT index; - CellToIndex(theCell, index); - index = GetWideOpenIndex(index); - STableCell expandedCell; - IndexToCell(index, expandedCell); - GetCellData(expandedCell, &theData, theSize); - if (theSize > sizeof(theData.message)) - { - result = theData.message; - } - } - return result; -} - -//---------------------------------------------------------------------------------------- -TableIndexT CMenuTable::FindMessage( MessageT message ) -// Returns Wide Open index -//---------------------------------------------------------------------------------------- -{ - TableIndexT index = 0; - CellData cellData; - STableCell cell(0,0); - unsigned long theSize = sizeof(cellData); - TableIndexT numberRows, numberCols; - GetWideOpenTableSize( numberRows, numberCols ) ; - - for ( TableIndexT i = 1; i<= numberRows; i++ ) - { - - IndexToCell( i, cell ); - GetCellData( cell , &cellData, theSize ); - if ( cellData.message == message ) - { - index = i; - break; - } - } - return index; -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::DrawCell( - const STableCell &inCell, - const Rect &inLocalRect) -//---------------------------------------------------------------------------------------- -{ - TableIndexT woRow = mCollapsableTree->GetWideOpenIndex(inCell.row); - - DrawDropFlag(inCell, woRow); - - STableCell woCell(woRow, inCell.col); - CellData cellData; - Uint32 dataSize = sizeof(cellData); - - GetCellData(woCell, &cellData, dataSize); - - ResIDT textTraitsID = mLeafTextTraits; - if (mCollapsableTree->IsCollapsable(woRow)) { - textTraitsID = mParentTextTraits; - } - UTextTraits::SetPortTextTraits(textTraitsID); - - Uint32 nestingLevel = mCollapsableTree->GetNestingLevel(woRow); - FontInfo fi; - ::GetFontInfo(&fi); - Int16 height = inLocalRect.top + - (inLocalRect.bottom - inLocalRect.top) / 2 + - fi.ascent - ((fi.ascent + fi.descent) / 2); - - MoveTo(inLocalRect.left + mFirstIndent + nestingLevel * mLevelIndent, - height); - DrawString(cellData.label); -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::GetHiliteRgn(RgnHandle ioHiliteRgn) -// Pass back a Region containing the frames of all selected cells which -// are within the visible rectangle of the Table -// -// Caller must allocate space for the region -//---------------------------------------------------------------------------------------- -{ - ::SetEmptyRgn(ioHiliteRgn); // Assume no visible selection - - Rect visRect; - GetRevealedRect(visRect); // Check if Table is revealed - if (!::EmptyRect(&visRect)) { - PortToLocalPoint(topLeft(visRect)); - PortToLocalPoint(botRight(visRect)); - - STableCell topLeftCell, botRightCell; - FetchIntersectingCells(visRect, topLeftCell, botRightCell); - - RgnHandle cellRgn = ::NewRgn(); - - STableCell cell; // Loop thru all cells - for (cell.row = topLeftCell.row; cell.row <= botRightCell.row; cell.row++) { - for (cell.col = topLeftCell.col; cell.col <= botRightCell.col; cell.col++) { - if (CellIsSelected(cell)) { - Rect cellRect; - GetLocalCellRect(cell, cellRect); - cellRect.left += (mFirstIndent - 1); - ::RectRgn(cellRgn, &cellRect); - ::UnionRgn(ioHiliteRgn, cellRgn, ioHiliteRgn); - } - } - } - - ::DisposeRgn(cellRgn); - } -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::HiliteSelection( - Boolean inActively, - Boolean inHilite) -// Draw or undraw hiliting for the current selection in either the -// active or inactive state -//---------------------------------------------------------------------------------------- -{ - STableCell theCell; - - while (GetNextSelectedCell(theCell)) - { - if (inActively) { - HiliteCellActively(theCell, inHilite); - } else { - HiliteCellInactively(theCell, inHilite); - } - } -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::HiliteCellActively(const STableCell &inCell, Boolean /* inHilite */) -//---------------------------------------------------------------------------------------- -{ - Rect cellFrame; - if (GetLocalCellRect(inCell, cellFrame) && FocusExposed()) - { - StColorPenState saveColorPen; // Preserve color & pen state - StColorPenState::Normalize(); - - UDrawingUtils::SetHiliteModeOn(); - TableIndexT woRow = mCollapsableTree->GetWideOpenIndex(inCell.row); - Uint32 nestingLevel = mCollapsableTree->GetNestingLevel(woRow); - - cellFrame.left += (mFirstIndent +nestingLevel*mLevelIndent ); - ::InvertRect(&cellFrame); - } -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::HiliteCellInactively(const STableCell &inCell, Boolean /* inHilite */) -//---------------------------------------------------------------------------------------- -{ - Rect cellFrame; - if (GetLocalCellRect(inCell, cellFrame) && FocusExposed()) - { - StColorPenState saveColorPen; // Preserve color & pen state - StColorPenState::Normalize(); - - TableIndexT woRow = mCollapsableTree->GetWideOpenIndex(inCell.row); - Uint32 nestingLevel = mCollapsableTree->GetNestingLevel(woRow); - cellFrame.left += (mFirstIndent +nestingLevel*mLevelIndent ); - - UDrawingUtils::SetHiliteModeOn(); - ::PenMode(srcXor); - ::FrameRect(&cellFrame); - } -} - -//---------------------------------------------------------------------------------------- -void CMenuTable::ClickSelf(const SMouseDownEvent &inMouseDown) -//---------------------------------------------------------------------------------------- -{ - STableCell hitCell; - SPoint32 imagePt; - - LocalToImagePoint(inMouseDown.whereLocal, imagePt); - - if (GetCellHitBy(imagePt, hitCell)) - { - // Before calling CPrefsPaneManager::CanSwitch() we should check to see - // if the click is on a different cell. (No point in calling CanSwitch() - // if we aren't going to switch.) - Boolean switchAllowed = true; - if (hitCell != GetFirstSelectedCell()) - { - switchAllowed = CPrefsMediator::CanSwitch(); - } - if (switchAllowed) - { - // Click is inside hitCell - // Check if click is inside DropFlag - TableIndexT woRow = mCollapsableTree->GetWideOpenIndex(hitCell.row); - Rect flagRect; - CalcCellFlagRect(hitCell, flagRect); - - if (mCollapsableTree->IsCollapsable(woRow) && - ::PtInRect(inMouseDown.whereLocal, &flagRect)) - { - // Click is inside DropFlag - FocusDraw(); - Boolean expanded = mCollapsableTree->IsExpanded(woRow); - if (LDropFlag::TrackClick(flagRect, inMouseDown.whereLocal, expanded)) - { - // Mouse released inside DropFlag - // so toggle the Row - if (inMouseDown.macEvent.modifiers & optionKey) - { - // OptionKey down means to do - // a deep collapse/expand - if (expanded) - { - DeepCollapseRow(woRow); - } - else - { - DeepExpandRow(woRow); - } - - } - else - { // Shallow collapse/expand - if (expanded) - { - CollapseRow(woRow); - } - else - { - ExpandRow(woRow); - } - } - } - } - if (ClickSelect(hitCell, inMouseDown)) - { - // Click outside of the DropFlag - ClickCell(hitCell, inMouseDown); - } - } // else don't allow the selection to change - } - else - { // Click is outside of any Cell - UnselectAllCells(); - } -} - -#pragma mark - -#if defined(QAP_BUILD) - -#include - -//----------------------------------- -void CMenuTable::QapGetListInfo(PQAPLISTINFO pInfo) -//----------------------------------- -{ - TableIndexT outRows, outCols, lcv; - - if (pInfo == nil) - return; - - GetWideOpenTableSize(outRows, outCols); - - for (lcv = 0; lcv < outRows; lcv++) - { - if (IsCollapsable(lcv) && !IsExpanded(lcv)) - { - ExpandRow(lcv); - } - } - - // fetch vertical scrollbar Macintosh control - ControlHandle macVScroll = NULL; - LScrollerView *myScroller = dynamic_cast(GetSuperView()); - if (myScroller != NULL) - { -#if 0 -// LScrollerView does not provide public access to the scrollbars (pinkerton) - if (myScroller->GetVScrollbar() != NULL) - macVScroll = myScroller->GetVScrollbar()->GetMacControl(); -#endif - } - - pInfo->itemCount = (short)outRows; - pInfo->topIndex = 0; - pInfo->itemHeight = GetRowHeight(0); - pInfo->visibleCount = outRows; - pInfo->vScroll = macVScroll; - pInfo->isMultiSel = false; - pInfo->isExtendSel = false; - pInfo->hasText = true; -} - - -//----------------------------------- -Ptr CMenuTable::QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell) -//----------------------------------- -{ - char str[256]; - short len = 0; - CellData theData; - - UInt32 dataSize = sizeof(theData); - GetCellData(sTblCell, (void *)&theData, dataSize); - - strncpy(str, (const char *)&theData.label[1], (short)theData.label[0]); - str[(short)theData.label[0]] = '\0'; - len = strlen(str) + 1; - - if (pBuf + sizeof(short) + len >= pLimit) - return NULL; - - *(unsigned short *)pBuf = sTblCell.row - 1; - if (CellIsSelected(sTblCell)) - *(unsigned short *)pBuf |= 0x8000; - - pBuf += sizeof(short); - - strcpy(pBuf, str); - pBuf += len; - - return pBuf; -} - -#endif //QAP_BUILD diff --git a/mozilla/cmd/macfe/prefs/CMenuTable.h b/mozilla/cmd/macfe/prefs/CMenuTable.h deleted file mode 100644 index ddbd346b59e..00000000000 --- a/mozilla/cmd/macfe/prefs/CMenuTable.h +++ /dev/null @@ -1,67 +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. - */ - -#pragma once - -#include -#include - -//======================================================================================== -class CMenuTable -// This descendant of LHierTextTable initializes itself from menu resources. The hierarchical -// menus give rise to a hierarchical table. This trick avoids the difficult task of defining a -// new dynamic hierarchical resource template for such tables. Currently this is only used -// for the left pane of the preferences dialog. -//======================================================================================== -: public LTextHierTable -, public LBroadcaster -, public CQAPartnerTableMixin -{ - public: - enum - { - class_ID = 'Itxh', - msg_SelectionChanged = 'selc' - }; - CMenuTable(LStream *inStream); - virtual ~CMenuTable(); - - virtual void FinishCreate(); - virtual void SelectionChanged(); - virtual MessageT GetSelectedMessage(); - virtual void GetHiliteRgn(RgnHandle ioHiliteRgn); - virtual void HiliteSelection(Boolean inActively, Boolean inHilite); - virtual void HiliteCellActively(const STableCell &inCell, Boolean inHilite); - virtual void HiliteCellInactively(const STableCell &inCell, Boolean inHilite); - virtual void ClickSelf(const SMouseDownEvent &inMouseDown); - TableIndexT FindMessage( MessageT message ); -#if defined(QAP_BUILD) - virtual void QapGetListInfo (PQAPLISTINFO pInfo); - virtual Ptr QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell); -#endif - protected: - ResIDT mMenuID; - - virtual void DrawCell( - const STableCell &inCell, - const Rect &inLocalRect); - void AddTableLabels( - TableIndexT ¤tRow, - ResIDT mMenuID, - Boolean firstLevel = true); -}; // class CMenuTable diff --git a/mozilla/cmd/macfe/prefs/CPrefsDialog.cp b/mozilla/cmd/macfe/prefs/CPrefsDialog.cp deleted file mode 100644 index a35c6ec2fb7..00000000000 --- a/mozilla/cmd/macfe/prefs/CPrefsDialog.cp +++ /dev/null @@ -1,497 +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. - */ - -#include "CPrefsDialog.h" - -#include "CMenuTable.h" -#include "CAssortedMediators.h" - -#ifdef MOZ_MAIL_NEWS -#include "MailNewsAddressBook.h" -#include "MailNewsMediators.h" -#include "CReceiptsMediator.h" -#endif // MOZ_MAIL_NEWS -#include "CSpecialFoldersMediator.h" -#include "CMailNewsMainMediator.h" - -#include "MPreference.h" - -#include "UStdDialogs.h" -#include "CValidEditField.h" -#include "macutil.h" - -#include "dirprefs.h" -#include "addrbook.h" -#include "abdefn.h" -#include "prefapi.h" - -#include "UStdDialogs.h" - -#include "resgui.h" // for cmd_AboutPlugins - -#include "uapp.h" - -#include "CBrowserApplicationsMediator.h" -#include "CLocationIndependenceMediator.h" - -// define this to have the prefs dialog open showing the last pane you -// used, with all twisties expanded -#define PREFS_DIALOG_REMEMBERS_PANE - -CPrefsDialog* CPrefsDialog::sThis = nil; -PrefPaneID::ID CPrefsDialog::sLastPrefPane = PrefPaneID::eNoPaneSpecified; - -//----------------------------------- -CPrefsDialog::CPrefsDialog() -//----------------------------------- -: LCommander(GetTopCommander()) -, mWindow(nil) -, mTable(nil) -{ - MPreferenceBase::SetWriteOnDestroy(false); -} - -//----------------------------------- -CPrefsDialog::~CPrefsDialog() -//----------------------------------- -{ - // all panes are freed by PowerPlant since they are subcommanders of this dialog... -} - -//----------------------------------- -void CPrefsDialog::EditPrefs( - Expand_T expand, - PrefPaneID::ID pane, - Selection_T selection) -//----------------------------------- -{ - -#ifdef PREFS_DIALOG_REMEMBERS_PANE - pane = (pane != PrefPaneID::eNoPaneSpecified) ? pane : sLastPrefPane; -#endif - - if (sThis) - { - // very suspicious - } - else - { - sThis = new CPrefsDialog(); - } - XP_Bool attachVCard; - const char * const usePABCPrefName = "mail.attach_vcard"; // fix me - int prefResult = PREF_GetBoolPref(usePABCPrefName, &attachVCard); -#ifdef MOZ_MAIL_NEWS - sThis->mNeedToCheckForVCard = ( prefResult == PREF_NOERROR && - false == attachVCard && - !PREF_PrefIsLocked(usePABCPrefName)); -#endif // MOZ_MAIL_NEWS - const char * const useInternetConfigPrefName = "browser.mac.use_internet_config"; // fix me - XP_Bool useIC; - prefResult = PREF_GetBoolPref(useInternetConfigPrefName, &useIC); - CPrefsMediator::UseIC(useIC); - - // make sure the prefs cache is empty before we may use it - MPreferenceBase::InitTempPrefCache(); - - sThis->DoPrefsWindow(expand, pane, selection); -} - -#ifdef MOZ_MAIL_NEWS -//----------------------------------- -void CPrefsDialog::CheckForVCard() -//----------------------------------- -{ - const char * const usePABCPrefName = "mail.attach_vcard"; // fix me - XP_Bool attachVCard; - PREF_GetBoolPref(usePABCPrefName, &attachVCard); - if (attachVCard) - { - char *email = (char *)FE_UsersMailAddress(); - if (email) - email = XP_STRDUP(email); - char *nameString = (char *)FE_UsersFullName(); - if (nameString) - { - nameString = XP_STRDUP(nameString); - } - XP_List *directories = CAddressBookManager::GetDirServerList(); - DIR_Server *pab; - DIR_GetPersonalAddressBook(directories, &pab); - XP_ASSERT(pab); - if (pab) - { - ABID entryID; - PersonEntry person; - person.Initialize(); - person.pGivenName = nameString; - person.pEmailAddress = email; - ABook *aBook = FE_GetAddressBook(nil); - AB_GetEntryIDForPerson(pab, aBook, &entryID, &person); - AB_BreakApartFirstName(aBook, &person); - if (MSG_MESSAGEIDNONE == entryID) - { - LCommander *super = LCommander::GetTopCommander(); - - StStdDialogHandler theHandler(12007, super); - theHandler.SetInitialDialogPosition(nil); - LWindow* theDialog = theHandler.GetDialog(); - - MessageT theMessage = msg_Cancel; - if (UStdDialogs::TryToInteract()) - { - theDialog->Show(); - theMessage = theHandler.WaitUserResponse(); - } - if (msg_Cancel != theMessage) - { - if (true != FE_ShowPropertySheetFor(nil, entryID, &person)) - { - theMessage = msg_Cancel; - } - } - if (msg_Cancel == theMessage) - { - PREF_SetBoolPref(usePABCPrefName, false); - } - } - person.CleanUp(); - } - } -} -#endif // MOZ_MAIL_NEWS - -//----------------------------------- -void CPrefsDialog::DoPrefsWindow( - Expand_T expand, - PrefPaneID::ID pane, - Selection_T selection) -//----------------------------------- -{ - if (!mWindow) - { - mCurrentMediator = nil; - mWindow = LWindow::CreateWindow(PrefPaneID::eWindowPPob, this); - if (mWindow) - { - UReanimator::LinkListenerToControls( this, - mWindow, - PrefPaneID::eWindowPPob); - mTable = (CMenuTable *)mWindow->FindPaneByID(eTableView); - XP_ASSERT(mTable); - mPanel = (LView *)mWindow->FindPaneByID(ePanelView); - XP_ASSERT(mPanel); - CPrefsMediator::SetStatics(mPanel, mWindow, selection); - - mTable->AddListener(this); - - PrefPaneID::ID panel = pane; - if ( ! pane ) - panel = (PrefPaneID::ID)expand; - - // Find the row - TableIndexT wideOpenRow = mTable->FindMessage( panel ); - - // Now have to collapse the all the rows except appearence - // This is icky -#ifndef PREFS_DIALOG_REMEMBERS_PANE - mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eBrowser_Main ) ); - #ifdef MOZ_MAIL_NEWS - mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eMailNews_Main ) ); - #endif // MOZ_MAIL_NEWS - #ifdef EDITOR - mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eEditor_Main ) ); - #endif // Editor - #ifdef MOZ_OFFLINE - mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eOffline_Main ) ); - #endif // MOZ_OFFLINE - mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eAdvanced_Main ) ); -#endif - - mTable->UnselectAllCells(); - STableCell initialCell( 1, 1 ); - - if (PrefPaneID::eNoPaneSpecified != panel) - { - // Reveal the selection - mTable->RevealRow( wideOpenRow ); - if ( pane == 0 ) - mTable->DeepExpandRow( wideOpenRow ); - - initialCell.row = - mTable->GetExposedIndex( wideOpenRow ); - - } - - mTable->SelectCell(initialCell); - // really should scroll selected category into view - LCommander::SetUpdateCommandStatus(true); - - CStr255 windowTitle; - GetUserWindowTitle(6, windowTitle); - mWindow->SetDescriptor(windowTitle); - - mWindow->Show(); - } - } -} - -//----------------------------------- -void CPrefsDialog::LoadICDependent() -//----------------------------------- -{ - sThis->GetMediator(PrefPaneID::eBrowser_Main)->LoadPanes(); // home page - // we don't actually load the eMailNews_Identity manager because it will always - // alreay be loaded -// sThis->GetMediator(eMailNews_Identity)->LoadPanes(); // User Name - // User Email - // Organization -#ifdef MOZ_MAIL_NEWS - sThis->GetMediator(PrefPaneID::eMailNews_MailServer)->LoadPanes(); // POP ID - // POP host - // SMTP host - sThis->GetMediator(PrefPaneID::eMailNews_NewsServer)->LoadPanes(); // News host -#endif // MOZ_MAIL_NEWS -} // CPrefsDialog::LoadICDependent - - - -//----------------------------------- -CPrefsMediator* CPrefsDialog::FindMediator(ResIDT paneID) -//----------------------------------- -{ - LArrayIterator iterator(mPanels, LArrayIterator::from_Start); - CPrefsMediator* prefManager; - while (iterator.Next(&prefManager)) - { - if ( prefManager->GetMainPaneID() == paneID ) - return prefManager; - } - return nil; -} // CPrefsDialog::FindMediator - -//----------------------------------- -CPrefsMediator* CPrefsDialog::GetMediator(ResIDT inPaneID) -//----------------------------------- -{ - if (inPaneID == PrefPaneID::eNoPaneSpecified) - return nil; - CPrefsMediator* result = FindMediator(inPaneID); - if (result) - return result; - - // The pane ID of the pane is equal to the class ID of the corresponding mediator - // Currently, we don't read in any resource data for a mediator, there are no resources, - // so the LStream* parameter is nil. We just use the factory feature of the registrar. - // Later, we may decide to use UReanimator::ObjectsFromStream(); - result = (CPrefsMediator*)URegistrar::CreateObject(inPaneID, nil); - if (!result) - { - // There's no special mediator with this class ID. So give them a default mediator. - result = new CPrefsMediator(inPaneID); - } - mPanels.InsertItemsAt(1,LArray::index_Last, &result, sizeof( result ) ); - AddListener(result); - return result; -} // CPrefsDialog::GetMediator - -//----------------------------------- -void CPrefsDialog::FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean& /* outUsesMark */, - Char16& /* outMark */, - Str255 /* outName */) -//----------------------------------- -{ - // Don't enable any commands except cmd_About, and cmd_AboutPlugins - // which will keep the Apple menu enabled. This function purposely - // does not call the inherited FindCommandStatus, thereby suppressing - // commands that are handled by SuperCommanders. Only those - // commands enabled by SubCommanders will be active. - // - // This is usually what you want for a moveable modal dialog. - // Commands such as "New", "Open" and "Quit" that are handled - // by the Applcation are disabled, but items within the dialog - // can enable commands. For example, an EditField would enable - // items in the "Edit" menu. - - outEnabled = false; - if ((cmd_About == inCommand) || (cmd_AboutPlugins == inCommand)) - { - outEnabled = true; - } -} - -//----------------------------------- -Boolean CPrefsDialog::AllowTargetSwitch(LCommander *inNewTarget) -//----------------------------------- -{ - CValidEditField *target = dynamic_cast(LCommander::GetTarget()); - if (target) - return target->AllowTargetSwitch(inNewTarget); - return LCommander::AllowTargetSwitch(inNewTarget); -} - -//----------------------------------- -void CPrefsDialog::ListenToMessage( - MessageT inMessage, - void */*ioParam*/) -//----------------------------------- -{ - switch (inMessage) - { - case CMenuTable::msg_SelectionChanged: - MessageT theViewID = mTable->GetSelectedMessage(); - CPrefsMediator *mediator = GetMediator(theViewID); - if (mediator) - { - if (mCurrentMediator) - mCurrentMediator->StepAside(); - mediator->StepForward(mWindow); - mCurrentMediator = mediator; - } - break; - case CPrefsMediator::eCommitPrefs: -#ifdef MOZ_MAIL_NEWS - CMailNewsMailServerMediator *serverMediator = nil; - // check if the Mail server pane manager exist - // if it does get it - if ( FindMediator( PrefPaneID::eMailNews_MailServer ) ) - { - serverMediator - = dynamic_cast( - GetMediator(PrefPaneID::eMailNews_MailServer)); - } -#endif // MOZ_MAIL_NEWS - if (CPrefsMediator::CanSwitch()) - { -#ifdef MOZ_MAIL_NEWS // Is MOZ_MAIL_NEWS the correct symbol to use? - Boolean forceQuit = false; - Boolean allowCommit = true; - // Add code here to check if we should quit or not... - if (allowCommit) - { -#endif // MOZ_MAIL_NEWS - BroadcastMessage(CPrefsMediator::eCommitPrefs, nil); - Finished(); -#ifdef MOZ_MAIL_NEWS - if (mNeedToCheckForVCard) - { - CheckForVCard(); - } - if (forceQuit) - { - CFrontApp* app = dynamic_cast(LCommander::GetTopCommander()); - if (app) - app->SendAEQuit(); - } - } - else - { - // we don't want to quit - mCurrentMediator->StepAside(); - serverMediator->StepForward(mWindow); - /* Don't reset the button back - serverMediator->ResetServerButtons(); - */ - TableIndexT wideOpenRow = mTable->FindMessage(PrefPaneID::eMailNews_MailServer); - mTable->RevealRow( wideOpenRow ); - - STableCell mailServerCell; - mTable->IndexToCell( wideOpenRow, mailServerCell ); - mTable->SelectCell( mailServerCell ); - } -#endif // MOZ_MAIL_NEWS - } - break; - case CPrefsMediator::eCancelPrefs: - BroadcastMessage(CPrefsMediator::eCancelPrefs, nil); - Finished(); - break; - case eHelpButtonID: - if (mCurrentMediator) - mCurrentMediator->ActivateHelp(); - break; - default: - break; - } -} // CPrefsDialog::ListenToMessage - -//----------------------------------- -void CPrefsDialog::Finished() -//----------------------------------- -{ - sLastPrefPane = (PrefPaneID::ID)mTable->GetSelectedMessage(); - - mWindow->DoClose(); - mWindow = nil; - sThis = nil; - if (MPreferenceBase::GetWriteOnDestroy()) // the controls wrote themselves - { - // sub-dialogs of the main prefs dialog, e.g. the mail server edit dialog, - // write their prefs into a temporary tree which MPreferenceBase knows about. - // So tell MPreferenceBase to copy these temp prefs into the main prefs, and - // delete that tree. - MPreferenceBase::CopyCachedPrefsToMainPrefs(); - - PREF_SavePrefFile(); - } - delete this; -} - -//----------------------------------- -void CPrefsDialog::RegisterViewClasses() -//----------------------------------- -{ - // Mediator classes: - RegisterClass_(CAppearanceMainMediator); - RegisterClass_(CAppearanceFontsMediator); - RegisterClass_(CAppearanceColorsMediator); - RegisterClass_(CBrowserMainMediator); - RegisterClass_(CBrowserLanguagesMediator); - RegisterClass_(CBrowserApplicationsMediator); - RegisterClass_(CAdvancedCacheMediator); - RegisterClass_(CAdvancedProxiesMediator); - - CBrowserApplicationsMediator::RegisterViewClasses(); -#ifdef MOZ_MAIL_NEWS - RegisterClass_(CMailNewsIdentityMediator); - RegisterClass_(CMailNewsMainMediator); - RegisterClass_(CMailNewsMessagesMediator); - RegisterClass_(CMailNewsOutgoingMediator); - RegisterClass_(CMailNewsMailServerMediator); - RegisterClass_(CMailNewsNewsServerMediator); - RegisterClass_(CReceiptsMediator); - RegisterClass_(CMailNewsDirectoryMediator); - RegisterClass_(CMailNewsAddressingMediator ); -#endif // MOZ_MAIL_NEWS -#ifdef EDITOR - RegisterClass_(CEditorMainMediator); -#endif -#ifdef MOZ_OFFLINE - RegisterClass_(COfflineNewsMediator); -#endif -#ifdef MOZ_LDAP - // And a dialog class: - RegisterClass_(CLDAPServerPropDialog); -#endif -#ifdef MOZ_LOC_INDEP - RegisterClass_(CLocationIndependenceMediator); -#endif -} // CPrefsDialog::RegisterViewClasses diff --git a/mozilla/cmd/macfe/prefs/CPrefsDialog.h b/mozilla/cmd/macfe/prefs/CPrefsDialog.h deleted file mode 100644 index 8070bba929d..00000000000 --- a/mozilla/cmd/macfe/prefs/CPrefsDialog.h +++ /dev/null @@ -1,141 +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. - */ - - -#include - -#pragma once - -#include "PrefsPaneIDs.h" - -class CMenuTable; -class CPrefsMediator; - - -//====================================== -class CPrefsDialog -//====================================== -: public LCommander -, public LListener -, public LBroadcaster -{ - - public: - - enum - { - cmd_Prefs = 12000 -, ePrefsTextTraits = 12000 -, ePrefsTableStrings = 12000 - }; - - enum - { - eOKButtonID = 8, - eCancelButtonID = 2, - eHelpButtonID, - eMainCaptionID, - eSubCaptionID, - ePanelView, - eTableView - }; - - enum Expand_T // note: Appearance is always expanded - { - eExpandAppearance = PrefPaneID::eAppearance_Main - , eExpandBrowser = PrefPaneID::eBrowser_Main - // Leave this in for Navigator only build to get email addr pref - , eExpandMailNews = PrefPaneID::eMailNews_Main - #ifdef EDITOR - , eExpandEditor = PrefPaneID::eEditor_Main - #endif - #ifdef MOZ_MAIL_NEWS - , eExpandOffline = PrefPaneID::eOffline_Main - #endif - , eExpandAdvanced = PrefPaneID::eAdvanced_Main - , eExpandAll = PrefPaneID::eNoPaneSpecified - }; - - enum Selection_T - { - eIgnore, - eEmailAddress, - ePOPUserID, - eSMTPHost, - ePOPHost, - eNewsHost - }; - - enum - { - ePrefsChanged = 'prfx' - }; - - static void RegisterViewClasses(); - static void EditPrefs( Expand_T expand = eExpandAppearance, - PrefPaneID::ID pane = PrefPaneID::eNoPaneSpecified, - Selection_T selection = eIgnore); - static void LoadICDependent(); - // This class must know which managers are IC dependent. Ugh. -// static void AddPrefsListener(LListener *newPrefsListener); - // The listener will receive the ePrefsChanged - // message and the ioParam will be long * to - // the value of the pref enum. - // Note this notification is only for changes - // generated by using the prefs UI. If there is - // a possibility that the pref can be change - // in another way, then a pref call back should - // be registered with the xp prefs. - - virtual void FindCommandStatus(CommandT inCommand, - Boolean &outEnabled, Boolean &outUsesMark, - Char16 &outMark, Str255 outName); - - virtual void ListenToMessage( - MessageT inMessage, - void *ioParam); - - virtual Boolean AllowTargetSwitch(LCommander *inNewTarget); - private: - CPrefsDialog(); - virtual ~CPrefsDialog(); - - void DoPrefsWindow( Expand_T expand = eExpandAppearance, - PrefPaneID::ID pane = PrefPaneID::eNoPaneSpecified, - Selection_T selection = eIgnore); - - CPrefsMediator *GetMediator(ResIDT paneID); - Boolean CheckMediator(ResIDT paneID) const; - CPrefsMediator* FindMediator( ResIDT paneID ); - - static void CheckForVCard(); - void Finished(); - - static CPrefsDialog *sThis; - - static PrefPaneID::ID sLastPrefPane; - - LWindow *mWindow; - CPrefsMediator *mCurrentMediator; - CMenuTable *mTable; - LView *mPanel; - Boolean mNeedToCheckForVCard; - - LArray mPanels; -}; // class CPrefsDialog - diff --git a/mozilla/cmd/macfe/prefs/CPrefsMediator.cp b/mozilla/cmd/macfe/prefs/CPrefsMediator.cp deleted file mode 100644 index 8010ec86806..00000000000 --- a/mozilla/cmd/macfe/prefs/CPrefsMediator.cp +++ /dev/null @@ -1,756 +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. - */ - -#include "CPrefsMediator.h" - -#include "prefapi.h" - -#include "macutil.h" -#include "ufilemgr.h" - -#include "MPreference.h" -#include "CSizePopup.h" -#ifdef MOZ_MAIL_NEWS -#include "CMessageFolder.h" -#endif -#include "StSetBroadcasting.h" -#include "InternetConfig.h" -#include "CMouseDragger.h" - -Boolean CPrefsMediator::sUseIC = false; -LView *CPrefsMediator::sPanel = nil; -LWindow *CPrefsMediator::sWindow = nil; -CPrefsDialog::Selection_T CPrefsMediator::sInitialSelection - = CPrefsDialog::eIgnore; - -#pragma mark ---CControlExtension--- -//====================================== -class CControlExtension: LCaption -//====================================== -{ - public: - - enum - { - class_ID = 'CtlX' - }; - - CControlExtension(LStream *inStream); - virtual ~CControlExtension() {} - - virtual void ClickSelf(const SMouseDownEvent& inMouseDown); - - virtual void FinishCreateSelf(); - - protected: - PaneIDT mControlID; - LControl *mControl; -}; // class CControlExtension - -//---------------------------------------------------------------------------------------- -CControlExtension::CControlExtension(LStream *inStream): - LCaption(inStream), - mControl(nil) -//---------------------------------------------------------------------------------------- -{ - *inStream >> mControlID; -} // CControlExtension::CControlExtension - -//---------------------------------------------------------------------------------------- -void CControlExtension::FinishCreateSelf() -//---------------------------------------------------------------------------------------- -{ - LPane *pane = this; - LView *superView, *topView = nil; - #pragma warn_possunwant off - while (superView = pane->GetSuperView()) - #pragma warn_possunwant reset - { - topView = superView; - pane = superView; - } - XP_ASSERT(topView); - if (topView) - { - mControl = (LControl *)topView->FindPaneByID(mControlID); - } - XP_ASSERT(mControl); -} // CControlExtension::FinishCreateSelf - -//---------------------------------------------------------------------------------------- -void CControlExtension::ClickSelf(const SMouseDownEvent& /*inMouseDown*/) -//---------------------------------------------------------------------------------------- -{ - if (mControl) - mControl->SimulateHotSpotClick(1); // any value > 0 && < 128 should work -} // CControlExtension::ClickSelf - -#if 0 - -#pragma mark ---class CControlExtensionAttachment--- -//====================================== -class CControlExtensionAttachment: LAttachment -//====================================== -{ - public: - CControlExtensionAttachment(LControl *targetControl); - virtual ~CControlExtensionAttachment() {} - - protected: - LControl *mControl; - - virtual void ExecuteSelf(MessageT inMessage, void *ioParam); -}; // class CControlExtensionAttachment - -//---------------------------------------------------------------------------------------- -CControlExtensionAttachment::CControlExtensionAttachment(LControl* targetControl) -//---------------------------------------------------------------------------------------- -: LAttachment(msg_Click, true) -, mControl(targetControl) -{ -} - -//---------------------------------------------------------------------------------------- -void CControlExtensionAttachment::ExecuteSelf(MessageT inMessage, void* ioParam) -//---------------------------------------------------------------------------------------- -{ - if (mControl) - mControl->SimulateHotSpotClick(1); // any value > 0 && < 128 should work -} -#endif // 0 - -#ifdef MOZ_MAIL_NEWS -#pragma mark ---CPopupFolderMenu--- - -//====================================== -class CPopupFolderMenu : public LGAPopup, public CGAPopupFolderMixin -//====================================== -{ - public: - enum - { - class_ID = 'PupF' - }; - - CPopupFolderMenu(LStream *inStream); - virtual ~CPopupFolderMenu(); - virtual void FinishCreateSelf(); - virtual Boolean FolderFilter(const CMessageFolder &folder); - -// private: -// It turns out that this causes a crash in some thread code. Apparently someone -// is counting on the MSG_Master not going away -// CMailNewsContext mMailNewsContext; - // OK, what the heck is this for? Well the CPopupFolderMenus that we - // create will call CMailFolderMixin::UpdateMailFolderMixinsNow() in - // FinishCreateSelf(). This call will call CMailNewsContext::GetMailMaster(). - // CMailNewsContext::GetMailMaster() will create a MSG_Master if the static - // MSG_Master does not already exist. This means that the code would work - // without mMailNewsContext, but the static MSG_Master would continue to exist - // after we are finished. This is not good if the user is not using mail. So - // we create a CMailNewsContext because its contrustor will create the - // the static MSG_Master but it is ref counted and destroyed in - // CMailNewsContext::~CMailNewsContext. -}; // class CPopupFolderMenu - -//---------------------------------------------------------------------------------------- -CPopupFolderMenu::CPopupFolderMenu(LStream *inStream) -//---------------------------------------------------------------------------------------- -: LGAPopup(inStream) -{ - mDesiredFolderFlags = eWantPOP; -} - -//---------------------------------------------------------------------------------------- -CPopupFolderMenu::~CPopupFolderMenu() -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CPopupFolderMenu::FinishCreateSelf() -//---------------------------------------------------------------------------------------- -{ - LGAPopup::FinishCreateSelf(); - CMailFolderMixin::UpdateMailFolderMixinsNow(this); -} - -//---------------------------------------------------------------------------------------- -Boolean CPopupFolderMenu::FolderFilter(const CMessageFolder& folder) -//---------------------------------------------------------------------------------------- -{ - Boolean result = CGAPopupFolderMixin::FolderFilter(folder); - // We want to exclude the Outbox. - if (result && (folder.GetFolderFlags() & MSG_FOLDER_FLAG_QUEUE)) - { - result = false; - } - return result; -} -#endif // MOZ_MAIL_NEWS - -#pragma mark ---CPrefsMediator--- - -//---------------------------------------------------------------------------------------- -CPrefsMediator::CPrefsMediator(PaneIDT inMainPaneID) -//---------------------------------------------------------------------------------------- -: mMainPane(nil) -, mNeedsPrefs(true) -, mMainPaneID(inMainPaneID) -, mLatentSub(nil) -{ - MPreferenceBase::SetWriteOnDestroy(false); -} - -//---------------------------------------------------------------------------------------- -CPrefsMediator::~CPrefsMediator() -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -{ -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::StepAside() -//---------------------------------------------------------------------------------------- -{ - if (mMainPane) - { - mLatentSub = LCommander::GetTarget(); - SwitchTarget(nil); // take current chain off duty, so that SetLatentSub() can work. - mMainPane->Hide(); - } -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::LoadPanes() -//---------------------------------------------------------------------------------------- -{ - if (!mMainPane) - LoadMainPane(); - mMainPane->Hide(); // this is needed for IC support - // when panes are loaded, but not immediately displayed - if (mNeedsPrefs) - { - LoadPrefs(); - mNeedsPrefs = false; - } - UpdateFromIC(); -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::StepForward(LCommander *defaultSub) -//---------------------------------------------------------------------------------------- -{ - TrySetCursor(watchCursor); - Boolean firstTime = (mMainPane == nil); - if (!firstTime && mLatentSub != sWindow) - sWindow->SetLatentSub(mLatentSub); // restore latent sub from previously hidden pane. - // In the first-time case, it's done in FinishCreate(). - LoadPanes(); - if (mMainPane) - { - mMainPane->Show(); - mLatentSub = sWindow->GetLatentSub(); - if (!mLatentSub) - mLatentSub = defaultSub; - SwitchTarget(mLatentSub); - } -// if (firstTime) -// SelectFirstEnabledEditField(); // On subsequent times, use the user's selection? - // Actually, don't do this. The edittext pref resources all stand up and say which - // one wants to be the target. - SetCursor(&qd.arrow); -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - sWindow->UpdatePort(); - // The previous contents have been "hidden" but they are still visible. If we - // did not call UpdatePort() then the new content would appear over the old, - // but that is OK because everything gets straightened out at the next update. - // The only problem is if a panel is slow to draw itself-- the - // Mail & News / Messages pane is a good example--then we can actually see both - // the old and the new contents at the same time. Bad thing. - PaneIDT paneID = GetMainPaneID(); - mMainPane = UReanimator::CreateView(paneID, sPanel, sWindow); - UReanimator::LinkListenerToControls(this, mMainPane, paneID); -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::Canceled() -//---------------------------------------------------------------------------------------- -{ - mNeedsPrefs = true; - MPreferenceBase::SetWriteOnDestroy(false); -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::ListenToMessage(MessageT inMessage, void */*ioParam*/) -//---------------------------------------------------------------------------------------- -{ - switch (inMessage) - { - case eCommitPrefs: - MPreferenceBase::SetWriteOnDestroy(true); - WritePrefs(); - break; - case eCancelPrefs: - Canceled(); - break; - default: - break; - } -} - -//---------------------------------------------------------------------------------------- -MPreferenceBase* CPrefsMediator::GetPreferenceObject(PaneIDT inPaneID) const -//---------------------------------------------------------------------------------------- -{ - LPane* p = FindPaneByID(inPaneID); - MPreferenceBase* pb = dynamic_cast(p); - SignalIf_(!pb); - return pb; -} - -//---------------------------------------------------------------------------------------- -Boolean CPrefsMediator::PaneHasLockedPref(PaneIDT inPaneID) const -//---------------------------------------------------------------------------------------- -{ - MPreferenceBase* pb = GetPreferenceObject(inPaneID); - if (pb) - return pb->IsLocked(); - return true; -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::ReadDefaultPref(PaneIDT inPaneID) -//---------------------------------------------------------------------------------------- -{ - MPreferenceBase* pb = GetPreferenceObject(inPaneID); - if (pb) - pb->ReadDefaultSelf(); -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::ChangePrefName(PaneIDT inPaneID, const char* inNewName) -//---------------------------------------------------------------------------------------- -{ - MPreferenceBase::ChangePrefName(mMainPane, inPaneID, inNewName); -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::SetValidationFunction( - PaneIDT inPaneID, - CValidEditField::ValidationFunc inFunc) const -//---------------------------------------------------------------------------------------- -{ - CValidEditField* p = - (CValidEditField*)FindPaneByID(inPaneID); - p = dynamic_cast(p); - Assert_(p); // only makes sense for CValidEditField. - if (p) - p->SetValidationFunction(inFunc); -} - -// static -//---------------------------------------------------------------------------------------- -Boolean CPrefsMediator::CanSwitch(LCommander *inNewTarget) -//---------------------------------------------------------------------------------------- -{ - CValidEditField *target = dynamic_cast(LCommander::GetTarget()); - if (target) - return target->AllowTargetSwitch(inNewTarget); - return true; -} - - -//---------------------------------------------------------------------------------------- -// static -void CPrefsMediator::SelectFirstEnabledEditField() -//---------------------------------------------------------------------------------------- -{ - LEditField *currentTarget = dynamic_cast(LCommander::GetTarget()); - if (currentTarget) - { - if (!currentTarget->IsEnabled()) - { - LTabGroup *tabGroup = - dynamic_cast(currentTarget->GetSuperCommander()); - if (tabGroup) - { - tabGroup->RotateTarget(false /*not backward*/); - LEditField *oldTarget = currentTarget; - currentTarget = dynamic_cast(LCommander::GetTarget()); - if (currentTarget) - { - if (currentTarget == oldTarget) - { - // This means that the tab group couldn't find any edit field - // that was not disabled. So we need to take this guy off duty. - currentTarget->SwitchTarget(nil); - } - } - // else what the heck does this mean? - } - if (currentTarget && currentTarget->IsEnabled()) - { - currentTarget->SelectAll(); - } - } - } -} - -enum -{ - eNNTPStandardPort = 119, - eNNTPSecurePort = 563 -}; - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::SetEditFieldsWithICPref(ConstStr255Param prefName, - PaneIDT editFieldID, - Boolean stripPortNumber, - PaneIDT portFieldID, - Boolean portLocked, - long /*portNumber*/) - // If stripPortNumber is false then portFieldID and portLocked are ignored. - // If stripPortNumber is true then the first colon and any chars following it are stripped. - // If portFieldID is non-zero and portLocked is false, then the port value is set. -//---------------------------------------------------------------------------------------- -{ - if (!PaneHasLockedPref(editFieldID)) - { - LEditField *editField = (LEditField *)FindPaneByID(editFieldID); - assert(editField); - if (UseIC()) - { - Str255 s; - long portNumber = eNNTPStandardPort; - long *portNumberPtr = stripPortNumber ? &portNumber: nil; - - CInternetConfigInterface::GetInternetConfigString(prefName, s, portNumberPtr); - editField->SetDescriptor(s); - editField->Disable(); - if (stripPortNumber && portFieldID && !portLocked) - { - LEditField *portField = (LEditField *)FindPaneByID(portFieldID); - assert(portField); - portField->SetValue(portNumber); - portField->Disable(); - } - } - else - { - editField->Enable(); - if (stripPortNumber && portFieldID && !portLocked) - { - LEditField *portField = (LEditField *)FindPaneByID(portFieldID); - assert(portField); - portField->Enable(); - } - } - } -} - -//---------------------------------------------------------------------------------------- -int CPrefsMediator::SetFontSizePopupWithIntPref(const char *prefName, - PaneIDT popupID, - Boolean &locked, - int defaultValue) -//---------------------------------------------------------------------------------------- -{ - int32 result = defaultValue; - int prefError = PREF_NOERROR; - CSizePopup *thePopup = (CSizePopup *)FindPaneByID(popupID); - XP_ASSERT(thePopup); - prefError = PREF_GetIntPref(prefName, &result); - locked = PREF_PrefIsLocked(prefName); - - if (prefError == PREF_NOERROR) - { - thePopup->SetFontSize(result); - } - if (locked) - { - thePopup->Disable(); - } - return result; -} - -#ifdef MOZ_MAIL_NEWS -//---------------------------------------------------------------------------------------- -void CPrefsMediator::SetFolderPopupWithPref( const char *prefName, - PaneIDT popupID, - Boolean& locked, - const char* /*defaultValue*/) -//---------------------------------------------------------------------------------------- -{ - CPopupFolderMenu *thePopup = - (CPopupFolderMenu *)FindPaneByID(popupID); - XP_ASSERT(thePopup); - // XP prefs: Read alias as binary type - AliasHandle aliasH = NULL; - int size; - void* alias; - if (PREF_CopyBinaryPref(prefName, &alias, &size ) == 0) - { - PtrToHand(alias, &(Handle)aliasH, size); - XP_FREE(alias); - } - - FSSpec target; - Boolean wasChanged; - OSErr err = ResolveAlias(nil, aliasH, &target, &wasChanged); - DisposeHandle((Handle)aliasH); - - if (!err) - { - locked = PREF_PrefIsLocked(prefName); - - // alias to path name - - char* pathName = CFileMgr::EncodedPathNameFromFSSpec(target, true); - if (pathName && *pathName) - { - thePopup->MSetSelectedFolderName(pathName); - } - XP_FREEIF(pathName); - if (locked) - { - thePopup->Disable(); - } - } - return; -} -#endif // MOZ_MAIL_NEWS - -//---------------------------------------------------------------------------------------- -Boolean CPrefsMediator::SetEditFieldWithLocalFileURL(PaneIDT editFieldID, Boolean /*locked*/) -//---------------------------------------------------------------------------------------- -{ - StandardFileReply spec; - - - - Boolean result = CFilePicker::DoCustomGetFile( - spec, - CFilePicker::TextFiles, - false); - if (result) - { - char *url = CFileMgr::GetURLFromFileSpec(spec.sfFile); - - if (url) - { - LEditField *theField = (LEditField *)FindPaneByID(editFieldID); - XP_ASSERT(theField); - LStr255 pString(url); - theField->SetDescriptor(pString); - theField->SelectAll(); - XP_FREE(url); - } - } - return result; -} - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::SetIntPrefWithFontSizePopup( const char *prefName, - PaneIDT popupID, - Boolean locked) -//---------------------------------------------------------------------------------------- -{ - if (!locked) - { - CSizePopup *thePopup = (CSizePopup *)FindPaneByID(popupID); - XP_ASSERT(thePopup); - Int32 popupValue = thePopup->GetFontSize(); - PREF_SetIntPref(prefName, popupValue); - } -} - -#ifdef MOZ_MAIL_NEWS -//---------------------------------------------------------------------------------------- -void CPrefsMediator::SetPrefWithFolderPopup( const char *prefName, - PaneIDT popupID, - Boolean locked) -//---------------------------------------------------------------------------------------- -{ - if (!locked) - { - CPopupFolderMenu *thePopup = - (CPopupFolderMenu *)FindPaneByID(popupID); - XP_ASSERT(thePopup); - const char* folderName = thePopup->MGetSelectedFolderName(); - - // drop out if no folder is selected (b2 patch; the popups should really have - // non-empty defaults but this may also happen if folder doesn't exist anymore?) - if (!folderName || !*folderName) - return; - - PREF_SetPathPref(prefName, folderName, FALSE); - } -} -#endif // MOZ_MAIL_NEWS - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::ActivateHelp( ) -// Called when the user clicks on the "Help" button in the Prefs window. Apart from working -// out the help name from the PPob resource name, this is just a pass-through -// to the appropriate FE call with the current help topic for this pane. -//---------------------------------------------------------------------------------------- -{ - // The help string is the resource name of the 'PPob' resource for the help pane. - ::SetResLoad(false); - Handle h = ::GetResource('PPob', mMainPaneID); - if (!h) - return; - ::SetResLoad(true); - short idIgnored; ResType resTypeIgnored; - CStr255 resName; - ::GetResInfo(h, &idIgnored, &resTypeIgnored, resName); - if (!*h) - ::ReleaseResource(h); // if master pointer is not nil, it was not we who loaded it! - if (resName.Length() == 0) - return; - // The pref strings are long and redundant. This means that the significant part - // is not visible in Constructor. So I replaced the two common substrings "avigat" and - // "r:PREFERENCES_" with "É" and I'm putting them back in here. Example: - // resource name "nÉAPPEARANCE" becomes help name "navigatr:PREFERENCES_APPEARANCE" - // resource name "cÉEDITOR_GENERAL" becomes help name "composer:PREFERENCES_EDITOR_GENERAL" - char fullhelpname[256]; - Assert_(resName[2] == (unsigned char)'É'); - if (resName[2] != (unsigned char)'É') - return; // No help available for this topic - switch (resName[1]) - { - case 'n': - XP_STRCPY(fullhelpname, "navigat"); - break; - case 'c': - XP_STRCPY(fullhelpname, "compose"); - break; - case 'm': - XP_STRCPY(fullhelpname, "messeng"); - break; - default: - Assert_(false); - return; - } - XP_STRCAT(fullhelpname, "r:PREFERENCES_"); - XP_STRCAT(fullhelpname, 2 + (const char*)resName); - ShowHelp(fullhelpname); -} // ActivateHelp - -//---------------------------------------------------------------------------------------- -void CDragOrderTextList::MoveRow(TableIndexT inCurrRow, TableIndexT inNewRow) -//---------------------------------------------------------------------------------------- -{ - Assert_(IsValidRow(inCurrRow) && IsValidRow(inNewRow)); - if (inCurrRow == inNewRow) - return; - - { // -- broadcasting scope - STableCell currCell(inCurrRow, 1); - StSetBroadcasting(this, false); - // Don't broadcast that the selection has changed, because it really hasn't - Uint32 ioDataSize; - GetCellData(currCell, nil, ioDataSize); - if (ioDataSize) - { - char *temp = (char *)XP_ALLOC(ioDataSize); - if (temp) - { - GetCellData(currCell, temp, ioDataSize); - RemoveRows(1, inCurrRow, false); - InsertRows(1, inNewRow - 1, temp, ioDataSize, true); - XP_FREE(temp); - } - } - } // -- broadcasting scope - BroadcastMessage(msg_ChangedOrder); - SelectCell(STableCell(inNewRow, 1)); - Refresh(); -} - -//---------------------------------------------------------------------------------------- -void CDragOrderTextList::ClickCell( const STableCell &inCell, - const SMouseDownEvent &inMouseDown) -//---------------------------------------------------------------------------------------- -{ - if ( LPane::GetClickCount() == 2 ) - { - if (mDoubleClickMsg != msg_Nothing) - { - BroadcastMessage(mDoubleClickMsg, (void*) this); - } - } - else if (mRows > 1 && !mOrderLocked) - { - CTableRowDragger dragger(inCell.row); - - SPoint32 startMouseImagePt; - LocalToImagePoint(inMouseDown.whereLocal, startMouseImagePt); - - // Restrict dragging to a thin vertical column the height of the image - - LImageRect dragPinRect; - { - Int32 left, top, right, bottom; - GetImageCellBounds(inCell, left, top, right, bottom); - dragPinRect.Set(startMouseImagePt.h, startMouseImagePt.v - top, startMouseImagePt.h, - mImageSize.height - (bottom - startMouseImagePt.v) + 1); - } - TrySetCursor(eHandClosedCursorID); - dragger.DoTrackMouse(this, &startMouseImagePt, &dragPinRect, 2, 2); - - TableIndexT newRow = dragger.GetDraggedRow(); - - if (newRow) - { - MoveRow(inCell.row, newRow); -// CMoveFilterAction *action = new CMoveFilterAction(this, inCell.row, newRow); -// FailNIL_(action); -// PostAction(action); - } - } -} // CDragOrderTextList::ClickCell - -//---------------------------------------------------------------------------------------- -void CPrefsMediator::RegisterViewClasses() -//---------------------------------------------------------------------------------------- -{ -#ifdef MOZ_MAIL_NEWS - RegisterClass_(CPopupFolderMenu); -#endif - RegisterClass_( CControlExtension); - RegisterClass_(CDragOrderTextList); -} - diff --git a/mozilla/cmd/macfe/prefs/CPrefsMediator.h b/mozilla/cmd/macfe/prefs/CPrefsMediator.h deleted file mode 100644 index 40a85bcc6e3..00000000000 --- a/mozilla/cmd/macfe/prefs/CPrefsMediator.h +++ /dev/null @@ -1,204 +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. - */ - -#include - -#pragma once - -#include "CPrefsDialog.h" -#include "prefwutil.h" -#include "uprefd.h" -#include "UMailFolderMenus.h" -#include "CValidEditField.h" - -#include - -class LWindow; -class LView; -class MPreferenceBase; - -//====================================== -#pragma mark -class CPrefsMediator -// The base class of all the panes that go inside the preferences window. This has to be -// an LCommander so that it can handle receiving messages from a dialog put up in front of -// it. - -// NOTE: Since it is an LCommander, PowerPlant will clean it up automatically -// when the prefs dialog goes away (since it is a subcommander of the dialog). Do NOT -// explicitly delete any class derived from this base class. - -// This is not an abstract class. In fact, it is the mediator you get if you don't register -// your own. It relies on the controls all being smart and doing their own thing, i.e., all -// controls in the pane are ones defined in, or inheriting from, those in PrefControls.cp. - -// The only reasons to define your own mediator would be (1) custom controls that are not -// prefapi-aware, or (2) a need to co-ordinate different controls. e.g., when this checkbox is -// on, I must enable these other controls, or (3) you have a button that does something special, -// such as display an extra dialog. - -// Concerning reason (2), you don't even need code for this, since the CSlaveEnabler attachment -// can be added in constructor and will handle dimming/undimming in preference to a "master" -// checkbox or radio button. -//====================================== - : public LListener - , public LCommander -{ - public: - - enum - { - eCommitPrefs = 12100, - eCancelPrefs = 12200 - }; - enum { refNum_Undefined = -1 }; - CPrefsMediator(PaneIDT inMainPaneID); - virtual ~CPrefsMediator(); - - static void RegisterViewClasses(); - static Boolean CanSwitch(LCommander *inNewTarget = nil); - static void SelectFirstEnabledEditField(); - - virtual void StepAside(); - static void UseIC(Boolean useIC) {sUseIC = useIC;}; - static Boolean UseIC() {return sUseIC;}; - - virtual void LoadPanes(); - virtual void StepForward(LCommander *defaultSub); - PaneIDT GetMainPaneID() const { return mMainPaneID; } - virtual void LoadMainPane(); - virtual void LoadPrefs(); - virtual void WritePrefs(); - virtual void Canceled(); - virtual void UpdateFromIC() {}; - virtual void ListenToMessage( - MessageT inMessage, - void *ioParam); - - static void SetStatics( LView *panel, - LWindow *window, - CPrefsDialog::Selection_T selection) - { - sPanel = panel; - sWindow = window; - sInitialSelection = selection; - } - - LWindow* GetWindow() const { return (LWindow*)mMainPane->GetMacPort(); } - virtual void ActivateHelp(); - LPane* FindPaneByID(PaneIDT inPaneID) const - { return mMainPane->FindPaneByID(inPaneID); } - - protected: - // setting controls with prefs - - void SetEditFieldsWithICPref(ConstStr255Param prefName, - PaneIDT editFieldID, - Boolean stripPortNumber = false, - PaneIDT portFieldID = 0, - Boolean portLocked = false, - long defaultPort = 0); - // If stripPortNumber is false then portFieldID and - // portLocked are ignored. - // If stripPortNumber is true then the first - // colon and any chars following it are stripped. - // If portFieldID is non-zero and portLocked is - // false, then the port value is set. - int SetFontSizePopupWithIntPref(const char *prefName, - PaneIDT popupID, - Boolean &locked, - int defaultValue = 12); - void SetFolderPopupWithPref( const char *prefName, - PaneIDT popupID, - Boolean &locked, - const char *defaultValue = ""); - -// int SetEditFieldWithAliasPref( const char *prefName, -// PaneIDT editFieldID, -// Alias &alias, -// Boolean &locked); - - // setting controls with SFGetFile - - Boolean SetEditFieldWithLocalFileURL(PaneIDT editFieldID, Boolean locked = false); - // returns true iff the user selects a file (as opposed to canceling) - - // setting prefs with controls - void SetIntPrefWithFontSizePopup( - const char *prefName, - PaneIDT popupID, - Boolean locked = false); - void SetPrefWithFolderPopup( - const char *prefName, - PaneIDT popupID, - Boolean locked = false); - - MPreferenceBase* GetPreferenceObject(PaneIDT inPaneID) const; - Boolean PaneHasLockedPref(PaneIDT inPaneID) const; - void ReadDefaultPref(PaneIDT inPaneID); - void ChangePrefName(PaneIDT inPaneID, const char* inNewName); - void SetValidationFunction( - PaneIDT inPaneID, - CValidEditField::ValidationFunc inFunc) const; - - - static LWindow * sWindow; - static LView * sPanel; - static CPrefsDialog::Selection_T sInitialSelection; - - Boolean mNeedsPrefs; - - LView* mMainPane; - PaneIDT mMainPaneID; - LCommander* mLatentSub; - private: - - static Boolean sUseIC; -}; // class CPrefsMediator - -//====================================== -#pragma mark -class CDragOrderTextList : public LTextColumn -//====================================== -{ - public: - enum - { - class_ID = 'DOTL', - eHandClosedCursorID = 29202, - msg_ChangedOrder = 'ROrd' - }; - - CDragOrderTextList(LStream *inStream) : - LTextColumn(inStream), - mOrderLocked(false) - {} - virtual ~CDragOrderTextList() {} - virtual void ClickCell(const STableCell &inCell, const SMouseDownEvent &inMouseDown); - void LockOrder(Boolean lock = true) {mOrderLocked = lock;} - Boolean IsLocked() {return mOrderLocked;} - protected: - virtual void MoveRow(TableIndexT inCurrRow, TableIndexT inNewRow); - Boolean mOrderLocked; -}; // class CDragOrderTextList - -enum -{ - eSelectionChanged = 'selc', - eDoubleClick = '2clk' -}; diff --git a/mozilla/cmd/macfe/prefs/CReceiptsMediator.cp b/mozilla/cmd/macfe/prefs/CReceiptsMediator.cp deleted file mode 100644 index e966932c40e..00000000000 --- a/mozilla/cmd/macfe/prefs/CReceiptsMediator.cp +++ /dev/null @@ -1,146 +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. - */ - -#include "CReceiptsMediator.h" - -#include "macutil.h" - -#include "prefapi.h" - -#include -#include - -//----------------------------------- -CReceiptsMediator::CReceiptsMediator(LStream*) -//----------------------------------- -: CPrefsMediator(class_ID) -, mCustomDialogHandler(nil) -{ -} // CReceiptsMediator::CReceiptsMediator - -//----------------------------------- -CReceiptsMediator::~CReceiptsMediator() -//----------------------------------- -{ - FinalizeCustomDialog(); -} // CReceiptsMediator::~CReceiptsMediator - -//----------------------------------- -void CReceiptsMediator::WritePrefs() -//----------------------------------- -{ - FinalizeCustomDialog(); -} // CReceiptsMediator::WritePrefs - -//----------------------------------- -void CReceiptsMediator::FinalizeCustomDialog() -//----------------------------------- -{ - delete mCustomDialogHandler; // this causes controls to write themselves. - mCustomDialogHandler = nil; -} // CReceiptsMediator::FinalizeCustomDialog - -//----------------------------------- -void CReceiptsMediator::DoCustomDialog() -//----------------------------------- -{ - LWindow* dialog = nil; - try - { - Boolean firstTime = (mCustomDialogHandler == nil); - if (firstTime) - mCustomDialogHandler = new StDialogHandler(12010, nil); - dialog = mCustomDialogHandler->GetDialog(); - - - if (firstTime) - { - // Set up the domain name in the caption. - char buf[256]; - const char* domainName = buf; - int bufLength = sizeof(buf); - PREF_GetCharPref("mail.identity.defaultdomain", buf, &bufLength); - if (!domainName[0]) - { - bufLength = sizeof(buf); - PREF_GetCharPref("mail.identity.useremail", buf, &bufLength); - char* cp = strchr(buf, '@'); - if (cp) - domainName = cp + 1; - } - LGACaption* domainField = (LGACaption*)dialog->FindPaneByID('Domn'); - ThrowIfNil_(domainField); - CStr255 captionText; - - domainField->GetDescriptor(captionText); - StringParamText(captionText, domainName); - domainField->SetDescriptor(captionText); - } - dialog->Show(); - dialog->Select(); - Int32 popupValue[3]; - // Store the dialog popup values in case cancel is hit - for (int32 i =0; i<3; i++ ) - { - LGAPopup* popup = dynamic_cast( dialog->FindPaneByID( i+ 1) ); - XP_ASSERT( popup ); - popupValue[i] = popup->GetValue(); - } - - MessageT message = msg_Nothing; - do { - message = mCustomDialogHandler->DoDialog(); - } while (message != msg_OK && message != msg_Cancel); - - // Use the result. - if (message == msg_OK) - { - // Nothing to do, the prefs are written out when the dialog is destroyed. - } - else if ( message == msg_Cancel ) - { - // Restore values from when the dialog was first put up - for ( int32 i =0; i<3; i++ ) - { - LGAPopup* popup = dynamic_cast( dialog->FindPaneByID( i+ 1) ); - XP_ASSERT( popup ); - popup->SetValue(popupValue[i]); - } - } - } - catch(...) - { - } - if (dialog) - dialog->Hide(); // don't delete, we delete when we want to write the prefs. -} // CReceiptsMediator::DoCustomDialog - -//----------------------------------- -void CReceiptsMediator::ListenToMessage(MessageT inMessage, void *ioParam) -//----------------------------------- -{ - switch (inMessage) - { - case 'Cust': - DoCustomDialog(); - break; - default: - CPrefsMediator::ListenToMessage(inMessage, ioParam); - break; - } -} // CReceiptsMediator::ListenToMessage diff --git a/mozilla/cmd/macfe/prefs/CReceiptsMediator.h b/mozilla/cmd/macfe/prefs/CReceiptsMediator.h deleted file mode 100644 index f38eeb6a0eb..00000000000 --- a/mozilla/cmd/macfe/prefs/CReceiptsMediator.h +++ /dev/null @@ -1,43 +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. - */ - -#pragma once - -#include "CPrefsMediator.h" - -class StDialogHandler; - -//====================================== -class CReceiptsMediator -// Mediator for the mail receipts prefs pane. Needed because this pane puts up another -// "custom" dialog. -//====================================== - : public CPrefsMediator -{ -public: - enum { class_ID = PrefPaneID::eMailNews_Receipts }; - CReceiptsMediator(LStream*); - virtual ~CReceiptsMediator(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - virtual void WritePrefs(); -protected: - void DoCustomDialog(); - void FinalizeCustomDialog(); -protected: - StDialogHandler* mCustomDialogHandler; -}; // class CReceiptsMediator diff --git a/mozilla/cmd/macfe/prefs/CSizePopup.cp b/mozilla/cmd/macfe/prefs/CSizePopup.cp deleted file mode 100644 index 22c679b8c4f..00000000000 --- a/mozilla/cmd/macfe/prefs/CSizePopup.cp +++ /dev/null @@ -1,451 +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. - */ - -/* Portions copyright Metrowerks Corporation. */ - -#include "CSizePopup.h" - -#include "PascalString.h" -#include "uerrmgr.h" -#include "resgui.h" -#include "macutil.h" -#include "UModalDialogs.h" -#include "UGraphicGizmos.h" - -#include -#include -#include - -static const Char16 gsPopup_SmallMark = '¥'; // Mark used for small font popups -static const Int16 gsPopup_ArrowButtonWidth = 22; // Width used in drawing the arrow only -static const Int16 gsPopup_ArrowButtonHeight = 16; // Height used for drawing arrow only -static const Int16 gsPopup_ArrowHeight = 5; // Actual height of the arrow -static const Int16 gsPopup_ArrowWidth = 9; // Actual width of the arrow at widest - -//----------------------------------- -CSizePopup::CSizePopup(LStream* inStream) -//----------------------------------- -: mFontNumber(0) -, LGAPopup(inStream) -{ -} - -//----------------------------------- -Int32 CSizePopup::GetMenuSize() const -//----------------------------------- -{ - Int32 size = 0; - MenuHandle menuH = const_cast(this)->GetMacMenuH(); - - if (menuH) - { - size = ::CountMItems(menuH); - } - - return size; -} - -//----------------------------------- -void CSizePopup::SetUpCurrentMenuItem(MenuHandle inMenuH, Int16 inCurrentItem ) -//----------------------------------- -{ - - // ¥ If the current item has changed then make it so, this - // also involves removing the mark from any old item - if (inMenuH) - { - CStr255 sizeString; - CStr255 itemString; - Handle ellipsisHandle = nil; - char ellipsisChar; - short menuSize = ::CountMItems(inMenuH); - - ThrowIfNil_(ellipsisHandle = ::GetResource('elps', 1000)); - - ellipsisChar = **ellipsisHandle; - ::ReleaseResource(ellipsisHandle); - - if (inCurrentItem == ::CountMItems(inMenuH)) - { - itemString = ::GetCString(OTHER_FONT_SIZE); - ::StringParamText(itemString, (SInt32) GetFontSize(), 0, 0, 0); - } - else - { - itemString = ::GetCString(OTHER_RESID); - itemString += ellipsisChar; - } - - ::SetMenuItemText(inMenuH, menuSize, itemString); - - // ¥ Get the current value - Int16 oldItem = GetValue(); - - // ¥ Remove the current mark - ::SetItemMark(inMenuH, oldItem, 0); - - // ¥ Always make sure item is marked - Char16 mark = GetMenuFontSize() < 12 ? gsPopup_SmallMark : checkMark; - ::SetItemMark(inMenuH, inCurrentItem, mark); - } - -} - -//----------------------------------- -Int32 CSizePopup::GetFontSizeFromMenuItem(Int32 inMenuItem) const -//----------------------------------- -{ - Str255 sizeString; - Int32 fontSize = 0; - - ::GetMenuItemText(const_cast(this)->GetMacMenuH(), inMenuItem, sizeString); - - myStringToNum(sizeString, &fontSize); - return fontSize; -} - -//----------------------------------- -void CSizePopup::SetFontSize(Int32 inFontSize) -//----------------------------------- -{ - mFontSize = inFontSize; - if (inFontSize) - { - MenuHandle sizeMenu = GetMacMenuH(); - short menuSize = ::CountMItems(sizeMenu); - Boolean isOther = true; - for (int i = 1; i <= menuSize; ++i) - { - CStr255 sizeString; - ::GetMenuItemText(sizeMenu, i, sizeString); - Int32 fontSize = 0; - myStringToNum(sizeString, &fontSize); - if (fontSize == inFontSize) - { - SetValue(i); - if (i != menuSize) - isOther = false; - break; - } - } - if (isOther) - SetValue(menuSize); - } -} - -//----------------------------------- -void CSizePopup::SetValue(Int32 inValue) -//----------------------------------- -{ - // ¥ We intentionally do not guard against setting the value to the - // same value the popup current has. This is so that the other - // size stuff works correctly. - - // ¥ Get the current item setup in the menu - MenuHandle menuH = GetMacMenuH(); - if ( menuH ) - { - SetUpCurrentMenuItem( menuH, inValue ); - } - - if (inValue < mMinValue) { // Enforce min/max range - inValue = mMinValue; - } else if (inValue > mMaxValue) { - inValue = mMaxValue; - } - - mValue = inValue; // Store new value - BroadcastValueMessage(); // Inform Listeners of value change - - // ¥ Now we need to get the popup redrawn so that the change - // will be seen - Draw( nil ); - -} // LGAPopup::SetValue - -//----------------------------------- -Boolean CSizePopup::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers) -//----------------------------------- -{ - // Portions of this function are from LGAPopup.cp in PowerPlant - - // ¥ We only want the popup menu to appear if the mouse went down - // in the our hot spot which is the popup portion of the control - // not the label area - if ( PointInHotSpot( inPoint, inHotSpot )) - { - // ¥ Get things started off on the right foot - Boolean currInside = true; - Boolean prevInside = false; - HotSpotAction( inHotSpot, currInside, prevInside ); - - // ¥ We skip the normal tracking that is done in the control as - // the call to PopupMenuSelect will take control of the tracking - // once the menu is up - // ¥ Now we need to handle the display of the actual popup menu - // we start by setting up some values that we will need - Int16 menuID = 0; - Int16 menuItem = GetValue(); - Int16 currItem = IsPulldownMenu() ? 1 : GetValue(); - Point popLoc; - GetPopupMenuPosition( popLoc ); - - // ¥ Call our utility function which handles the display of the menu - // menu is disposed of inside this function - HandlePopupMenuSelect( popLoc, currItem, menuID, menuItem ); - - if ( menuItem > 0) - { - if ( menuItem == ::CountMItems( GetMacMenuH() )) - { - StDialogHandler handler(Wind_OtherSizeDialog, nil); - LWindow* dialog = handler.GetDialog(); - LEditField *sizeField = (LEditField *)dialog->FindPaneByID(1504); - Assert_(sizeField); - sizeField->SetValue(GetFontSize()); - sizeField->SelectAll(); - - // Run the dialog - MessageT message = msg_Nothing; - do - { - message = handler.DoDialog(); - } while (message == msg_Nothing); - - if (msg_ChangeFontSize == message) - { - SetFontSize(sizeField->GetValue()); - } - } - else - { - SetFontSize(GetFontSizeFromMenuItem(menuItem)); - } - } - - // ¥ Make sure that we get the HotSpotAction called one last time - HotSpotAction( inHotSpot, false, true ); - - return menuItem > 0; - } - else - return false; - -} - -//----------------------------------- -void CSizePopup::MarkRealFontSizes(LGAPopup *fontPopup) -//----------------------------------- -{ - CStr255 fontName; - ::GetMenuItemText( fontPopup->GetMacMenuH(), - fontPopup->GetValue(), - fontName); - GetFNum(fontName, &mFontNumber); - MarkRealFontSizes(mFontNumber); -} - -//----------------------------------- -void CSizePopup::MarkRealFontSizes(short fontNum) -//----------------------------------- -{ - Str255 itemString; - MenuHandle sizeMenu; - short menuSize; - - sizeMenu = GetMacMenuH(); - menuSize = CountMItems(sizeMenu); - - for (short menuItem = 1; menuItem <= menuSize; ++menuItem) - { - Int32 fontSize; - ::GetMenuItemText(sizeMenu, menuItem, itemString); - fontSize = 0; - myStringToNum(itemString, &fontSize); - - Style theSyle; - - if (fontSize && RealFont(fontNum, fontSize)) - { - theSyle = outline; - } - else - { - theSyle = normal; - } - ::SetItemStyle( sizeMenu, - menuItem, - theSyle); - } -} - -//----------------------------------- -void CSizePopup::DrawPopupTitle() -// DrawPopupTitle is overridden to draw in the outline style -// as needed -//----------------------------------- -{ - StColorPenState theColorPenState; - StTextState theTextState; - - // ¥ Get some loal variables setup including the rect for the title - ResIDT textTID = GetTextTraitsID(); - Rect titleRect; - Str255 title; - GetCurrentItemTitle( title ); - - // ¥ Figure out what the justification is from the text trait and - // get the port setup with the text traits - UTextTraits::SetPortTextTraits( textTID ); - - // ¥ Set outline style if it's an outline size - - if (GetMacMenuH() && GetValue() != ::CountMItems(GetMacMenuH())) - { - Int32 fontSize; - CStr255 itemString; - - ::GetMenuItemText(GetMacMenuH(), GetValue(), itemString); - fontSize = 0; - myStringToNum(itemString, &fontSize); - - Style theSyle; - - if (fontSize && ::RealFont(mFontNumber, fontSize)) - { - theSyle = outline; - } - else - { - theSyle = normal; - } - - ::TextFace(theSyle); - } - - // ¥ Set up the title justification which is always left justified - Int16 titleJust = teFlushLeft; - - // ¥ Get the current item's title - Str255 currentItemTitle; - GetCurrentItemTitle( currentItemTitle ); - - // ¥ Calculate the title rect - CalcTitleRect( titleRect ); - - // ¥ Kludge for drawing (correctly) in outline style left-justified - Rect actualRect; - UNewTextDrawing::MeasureWithJustification( - (char*) ¤tItemTitle[1], - currentItemTitle[0], - titleRect, - titleJust, - actualRect); - actualRect.right += 2; - titleRect = actualRect; - titleJust = teJustRight; - - // ¥ Set up the text color which by default is black - RGBColor textColor; - ::GetForeColor( &textColor ); - - // ¥ Loop over any devices we might be spanning and handle the drawing - // appropriately for each devices screen depth - StDeviceLoop theLoop( titleRect ); - Int16 depth; - while ( theLoop.NextDepth( depth )) - { - if ( depth < 4 ) // ¥ BLACK & WHITE - { - // ¥ If the control is dimmed then we use the grayishTextOr - // transfer mode to draw the text - if ( !IsEnabled()) - { - ::RGBForeColor( &UGAColorRamp::GetBlackColor() ); - ::TextMode( grayishTextOr ); - } - else if ( IsEnabled() && IsHilited() ) - { - // ¥ When we are hilited we simply draw the title in white - ::RGBForeColor( &UGAColorRamp::GetWhiteColor() ); - } - - // ¥ Now get the actual title drawn with all the appropriate settings - UTextDrawing::DrawWithJustification( - (char*) ¤tItemTitle[1], - currentItemTitle[0], - titleRect, - titleJust); - } - else // ¥ COLOR - { - // ¥ If control is selected we always draw the text in the title - // hilite color, if requested - if ( IsHilited()) - ::RGBForeColor( &UGAColorRamp::GetWhiteColor() ); - - // ¥ If the box is dimmed then we have to do our own version of the - // grayishTextOr as it does not appear to work correctly across - // multiple devices - if ( !IsEnabled() || !IsActive()) - { - textColor = UGraphicsUtilities::Lighten( &textColor ); - ::TextMode( srcOr ); - ::RGBForeColor( &textColor ); - } - - // ¥ Now get the actual title drawn with all the appropriate settings - UTextDrawing::DrawWithJustification( - (char*) ¤tItemTitle[1], - currentItemTitle[0], - titleRect, - titleJust); - } - } -} // CSizePopup::DrawPopupTitle - -//----------------------------------- -void CSizePopup::DrawPopupArrow() -//----------------------------------- -{ - StColorPenState theColorPenState; - - // ¥ Get the local popup frame rect - Rect popupFrame; - CalcLocalPopupFrameRect( popupFrame ); - - // ¥ Set up some variables used in the drawing loop - Int16 start = (( UGraphicsUtilities::RectHeight( popupFrame ) - gsPopup_ArrowHeight) / 2) + 1; - - // ¥ Figure out the left and right edges based on whether we are drawing - // only the arrow portion or the entire popup - Int16 leftEdge = gsPopup_ArrowButtonWidth - 6; - Int16 rightEdge = leftEdge - (gsPopup_ArrowWidth - 1); - - popupFrame.top = popupFrame.top + start; - popupFrame.bottom = popupFrame.top + gsPopup_ArrowHeight - 1; - popupFrame.left = popupFrame.right - leftEdge; - popupFrame.right = popupFrame.right - rightEdge; - - UGraphicGizmos::DrawPopupArrow( - popupFrame, - IsEnabled(), - IsActive(), - IsHilited()); -} // CSizePopup::DrawPopupArrow - diff --git a/mozilla/cmd/macfe/prefs/CSizePopup.h b/mozilla/cmd/macfe/prefs/CSizePopup.h deleted file mode 100644 index 5c34b7bd394..00000000000 --- a/mozilla/cmd/macfe/prefs/CSizePopup.h +++ /dev/null @@ -1,57 +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. - */ - -#pragma once - -#include - -//====================================== -class CSizePopup: public LGAPopup -//====================================== -{ -public: - enum - { - class_ID = 'Szpp' - }; - CSizePopup(LStream* inStream); - Int32 GetMenuSize() const; - - virtual void SetFontSize(Int32 inFontSize); // the value is font size in points - Int32 GetFontSize() const // the value is font size in points - { - return mFontSize; - } - - virtual void SetValue(Int32 inValue); - - void MarkRealFontSizes(short fontNum); - void MarkRealFontSizes(LGAPopup *fontPopup); - - virtual void SetUpCurrentMenuItem(MenuHandle inMenuH, Int16 inCurrentItem); - -protected: - - virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers); - virtual Int32 GetFontSizeFromMenuItem(Int32 inMenuItem) const; - virtual void DrawPopupTitle(); - virtual void DrawPopupArrow(); - - Int32 mFontSize; - short mFontNumber; -}; // class CSizePopup diff --git a/mozilla/cmd/macfe/prefs/CSpecialFoldersMediator.cp b/mozilla/cmd/macfe/prefs/CSpecialFoldersMediator.cp deleted file mode 100644 index 7e8017c39c5..00000000000 --- a/mozilla/cmd/macfe/prefs/CSpecialFoldersMediator.cp +++ /dev/null @@ -1,22 +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. - */ - -#include "CSpecialFoldersMediator.h" - -// This currently doesn't need any code, because the controls in this pane are smart enough -// to look after themselves. diff --git a/mozilla/cmd/macfe/prefs/CSpecialFoldersMediator.h b/mozilla/cmd/macfe/prefs/CSpecialFoldersMediator.h deleted file mode 100644 index a508434ba7b..00000000000 --- a/mozilla/cmd/macfe/prefs/CSpecialFoldersMediator.h +++ /dev/null @@ -1,28 +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. - */ - -#include "CPrefsMediator.h" - -//====================================== -class CSpecialFoldersMediator -//====================================== -: public CPrefsMediator -{ - CSpecialFoldersMediator(PaneIDT inPaneID) - : CPrefsMediator(inPaneID) {} -}; // class CSpecialFoldersMediator diff --git a/mozilla/cmd/macfe/prefs/CValidEditField.cp b/mozilla/cmd/macfe/prefs/CValidEditField.cp deleted file mode 100644 index de2b88b9c98..00000000000 --- a/mozilla/cmd/macfe/prefs/CValidEditField.cp +++ /dev/null @@ -1,164 +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. - */ - -#include "CValidEditField.h" - -//----------------------------------- -CValidEditField::CValidEditField( LStream* s ) -//----------------------------------- -: LGAEditField( s ) -, mValidationFunc( nil ) -{ -} - -//----------------------------------- -Boolean CValidEditField::AllowTargetSwitch( LCommander* /*newTarget*/ ) -//----------------------------------- -{ - if ( mValidationFunc ) - return (*mValidationFunc )(this); - return true; -} - -//----------------------------------- -void CValidEditField::SetValidationFunction( ValidationFunc validationFunc ) -//----------------------------------- -{ - mValidationFunc = validationFunc; -} - -/******************************************************************************** - * Validation Functions - ********************************************************************************/ -#include "uprefd.h" // for constants used below. -#include "uerrmgr.h" -#include "resgui.h" - - -Boolean ConstrainEditField( LEditField* whichField, long minValue, long maxValue ) -{ - long value; - Boolean allowSwitch = TRUE; - - value = whichField->GetValue(); - if ( value > maxValue || value < minValue ) - { - allowSwitch = FALSE; - if ( value > maxValue ) - whichField->SetValue( maxValue ); - else - whichField->SetValue( minValue ); - } - return allowSwitch; -} - -Boolean ValidateCacheSize( CValidEditField* bufferSize ) -{ - Boolean allowSwitch = TRUE; - - allowSwitch = ConstrainEditField( bufferSize, BUFFER_MIN / BUFFER_SCALE, - BUFFER_MAX / BUFFER_SCALE ); - if ( !allowSwitch ) - { - UDesktop::Deactivate(); - ::CautionAlert( 1063, NULL ); - UDesktop::Activate(); - } - - return allowSwitch; -} - -Boolean ValidateNumberNewsArticles( CValidEditField* articles ) -{ - Boolean allowSwitch = TRUE; - - allowSwitch = ConstrainEditField( articles, NEWS_ARTICLES_MIN, NEWS_ARTICLES_MAX ); - if ( !allowSwitch ) - { - UDesktop::Deactivate(); - ::CautionAlert( 1066, NULL ); - UDesktop::Activate(); - } - return allowSwitch; -} - -Boolean ValidateDaysTilExpire( CValidEditField* daysTilExpire ) -{ - Boolean allowSwitch = TRUE; - - allowSwitch = ConstrainEditField( daysTilExpire, EXPIRE_MIN, EXPIRE_MAX ); - if ( !allowSwitch ) - { - UDesktop::Deactivate(); - ::CautionAlert( 1064, NULL ); - UDesktop::Activate(); - } - - return allowSwitch; -} - -Boolean ValidateNumberConnections( CValidEditField* connections ) -{ - Boolean allowSwitch = TRUE; - - allowSwitch = ConstrainEditField( connections, CONNECTIONS_MIN, CONNECTIONS_MAX ); - if ( !allowSwitch ) - { - UDesktop::Deactivate(); - ::CautionAlert( 1062, NULL ); - UDesktop::Activate(); - } - - return allowSwitch; -} - -Boolean ValidatePopID( CValidEditField* connections ) -{ - CStr255 value; - connections->GetDescriptor(value); - if (value.Pos("@")) - // ¥¥¥ FIX ME l10n - { - ErrorManager::PlainAlert(POP_USERNAME_ONLY); - return FALSE; - } - else - return TRUE; -} - -void TargetOnEditField( LEditField* editField, Boolean doTarget ) -{ - if ( doTarget ) - { - editField->Enable(); - editField->Refresh(); - // pkc -- Call SetLatentSub instead of SwitchTarget - if( editField->GetSuperCommander() ) - (editField->GetSuperCommander())->SetLatentSub(editField); - editField->SelectAll(); - } - else - { - editField->Disable(); - editField->Refresh(); - // pkc -- Call SetLatentSub instead of SwitchTarget - if( editField->GetSuperCommander() ) - (editField->GetSuperCommander())->SetLatentSub(editField); - } -} - diff --git a/mozilla/cmd/macfe/prefs/CValidEditField.h b/mozilla/cmd/macfe/prefs/CValidEditField.h deleted file mode 100644 index 03e0592f253..00000000000 --- a/mozilla/cmd/macfe/prefs/CValidEditField.h +++ /dev/null @@ -1,47 +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. - */ - -#pragma once - -#include - -//====================================== -class CValidEditField: public LGAEditField -//====================================== -{ -public: - enum { class_ID = 'vald' }; - typedef Boolean (*ValidationFunc)( CValidEditField* editField ); - CValidEditField( LStream* s ); - virtual Boolean AllowTargetSwitch( LCommander* newTarget ); - void SetValidationFunction( ValidationFunc validation ); -protected: - ValidationFunc mValidationFunc; -}; // CValidEditField - - -//====================================== -// Validation Functions -//====================================== -Boolean ConstrainEditField( LEditField* whichField, long minValue, long maxValue ); -void TargetOnEditField( LEditField* editField, Boolean doTarget ); -Boolean ValidateDaysTilExpire( CValidEditField* daysTilExpire ); -Boolean ValidateCacheSize( CValidEditField* bufferSize ); -Boolean ValidateNumberNewsArticles( CValidEditField* articles ); -Boolean ValidateNumberConnections( CValidEditField* connections ); -Boolean ValidatePopID( CValidEditField* connections ); diff --git a/mozilla/cmd/macfe/prefs/MUC.h b/mozilla/cmd/macfe/prefs/MUC.h deleted file mode 100644 index e7c598c12ac..00000000000 --- a/mozilla/cmd/macfe/prefs/MUC.h +++ /dev/null @@ -1,57 +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. - */ - -#pragma once -#include "PascalString.h" - -enum MUCError -{ - errProfileNotFound = 1, - errNeedToRunAccountSetup, - errCannotSwitchDialSettings, - errUserCancelledLaunch -}; - -enum MUCSelector -{ - kGetPluginVersion = 1, - kSelectDialConfig, - kAutoSelectDialConfig, - kEditDialConfig, - kGetDialConfig, - kSetDialConfig, - kNewProfileSelect, - kClearProfileSelect, - kInitListener - }; - -typedef struct -{ - CStr255 mProfileName; - CStr255 mAccountName; - CStr255 mModemName; - CStr255 mLocationName; -} -MUCInfo, *MUCInfoPtr; - -typedef OSErr (*TraversePPPListFunc)( Str255** list ); - -#pragma export on -typedef long (*PE_PluginFuncType)(long selectorCode, void* pb, void* returnData ); -extern "C" long PE_PluginFunc( long selectorCode, void* pb, void* returnData ); -#pragma export off diff --git a/mozilla/cmd/macfe/prefs/MailNewsMediators.cp b/mozilla/cmd/macfe/prefs/MailNewsMediators.cp deleted file mode 100644 index 92427b7efe2..00000000000 --- a/mozilla/cmd/macfe/prefs/MailNewsMediators.cp +++ /dev/null @@ -1,2419 +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. - */ - -#include "MailNewsMediators.h" - -//XP -extern "C" -{ -#include "xp_help.h" -} -#include "prefapi.h" -#include "dirprefs.h" -#define WANT_ENUM_STRING_IDS -#include "allxpstr.h" -#undef WANT_ENUM_STRING_IDS - -//Old Macintosh -#include "resgui.h" -#include "macgui.h" -#include "uerrmgr.h" -#include "macutil.h" - -//New Macintosh -#include "InternetConfig.h" -#include "CTSMEditField.h" -#include "MailNewsAddressBook.h" -#include "CMessageFolder.h" -#include "PrefControls.h" -#include "CMailNewsContext.h" -#include "StGetInfoHandler.h" -#include "CNewsSubscriber.h" -#include "COfflinePicker.h" -#include "UMenuUtils.h" -//3P -#include -#include - -//PP -#include -#include -#include -#include -#include - -#ifdef MOZ_MAIL_NEWS - -//---------------------------------------------------------------------------------------- -CLDAPServerPropDialog::CLDAPServerPropDialog( LStream* inStream ) -//---------------------------------------------------------------------------------------- -: LGADialogBox ( inStream ) -, mHelpTopic(HELP_LDAP_SERVER_PROPS) -, mServer(NULL) -, mIsPAB(false) -, mNewServer(eNewServer) -{ -} // CLDAPServerPropDialog::CLDAPServerPropDialog - - -//---------------------------------------------------------------------------------------- -CLDAPServerPropDialog::~CLDAPServerPropDialog( ) -//---------------------------------------------------------------------------------------- -{ - -} // CLDAPServerPropDialog::~CLDAPServerPropDialog - - -//---------------------------------------------------------------------------------------- -void CLDAPServerPropDialog::FinishCreateSelf( ) -//---------------------------------------------------------------------------------------- -{ - Inherited::FinishCreateSelf(); - - mDescription = (CTSMEditField *) FindPaneByID(eDescriptionEditField); - // use CTSMEditField to support Asian Inline input - XP_ASSERT(mDescription); - mLdapServer = (LEditField *) FindPaneByID(eLDAPServerEditField); - XP_ASSERT(mLdapServer); - mSearchRoot = (LEditField *) FindPaneByID(eSearchRootEditField); - XP_ASSERT(mSearchRoot); - mPortNumber = (CValidEditField *)FindPaneByID(ePortNumberEditField); - XP_ASSERT(mPortNumber); - mMaxHits = (CValidEditField *) FindPaneByID(eMaxHitsEditField); - XP_ASSERT(mMaxHits); - mSecureBox = (LGACheckbox *) FindPaneByID(eSecureBox); - XP_ASSERT(mSecureBox); - mSavePasswordBox = dynamic_cast(FindPaneByID ( eSaveLDAPServerPasswordBox) ); - Assert_( mSavePasswordBox ); - - mDownloadCheckBox = dynamic_cast( FindPaneByID ( eDownloadCheckBox ) ); - Assert_( mDownloadCheckBox ); - - UReanimator::LinkListenerToControls( this, this, eLDAPServerPropertiesDialogResID ); - -} // FinishCreateSelf - -//---------------------------------------------------------------------------------------- -void CLDAPServerPropDialog::ListenToMessage( MessageT inMessage, void* ioParam ) -//---------------------------------------------------------------------------------------- -{ - switch ( inMessage ) { - - case CLDAPServerPropDialog::cmd_HelpButton: // help button - ShowHelp(mHelpTopic); - break; - - // toggle the port numbers in the port field - case CLDAPServerPropDialog::eSecureBox: - if (mSecureBox->GetValue()) - { - mPortNumber->SetValue(eLDAPSecurePort); - mPortNumber->SelectAll(); - } - else - { - mPortNumber->SetValue(eLDAPStandardPort); - mPortNumber->SelectAll(); - } - break; - - - case CLDAPServerPropDialog::eUpdateButton: - // NEED XP API - break; - - // On an OK, fish out all of the data from the fields and stuff it into the - // server data structure. - case CLDAPServerPropDialog::cmd_OKButton: - { - // first check to make sure that the two validated edit fields are ok. If not, - // then break out of here and don't accept the OK, forcing the user to - // fix them. - if ( !MaxHitsValidationFunc(mPortNumber) || !PortNumberValidationFunc(mMaxHits) ) - break; - - if (mServer->searchBase) - XP_FREE(mServer->searchBase); - if (mServer->serverName) - XP_FREE(mServer->serverName); - if (mServer->description) - XP_FREE(mServer->description); - - Str255 pBuffer; - char *stringStart = (char *)&pBuffer[1]; - mDescription->GetDescriptor(pBuffer); - pBuffer[pBuffer[0] + 1] = '\0'; - mServer->description = XP_STRDUP(stringStart); - - if (!mIsPAB) - { - mLdapServer->GetDescriptor(pBuffer); - pBuffer[pBuffer[0] + 1] = '\0'; - mServer->serverName = XP_STRDUP(stringStart); - - mSearchRoot->GetDescriptor(pBuffer); - pBuffer[pBuffer[0] + 1] = '\0'; - mServer->searchBase = XP_STRDUP(stringStart); - - mServer->port = mPortNumber->GetValue(); - mServer->maxHits = mMaxHits->GetValue(); - - mServer->isSecure = mSecureBox->GetValue()? true: false; - mServer->savePassword = mSavePasswordBox->GetValue()? true: false; - DIR_SetServerFileName(mServer, mServer->serverName); - } - - Inherited::ListenToMessage( inMessage, ioParam ); // pass along OK - break; - } - default: // pass along Cancel, etc - Inherited::ListenToMessage( inMessage, ioParam ); - - } // case of message - -} // ListenToMessage - -//---------------------------------------------------------------------------------------- -void CLDAPServerPropDialog::SetUpDialog( - DIR_Server* inServer, Boolean inNewServer, Boolean inIsPAB, - Boolean inAllLocked ) -// Enables/disables all the fields and puts the initial values into them. -//---------------------------------------------------------------------------------------- -{ - mServer = inServer; - mNewServer = inNewServer; - mIsPAB = inIsPAB; - XP_ASSERT(inServer != nil); - - mPortNumber->SetValidationFunction(PortNumberValidationFunc); - mMaxHits->SetValidationFunction(MaxHitsValidationFunc); - - if (mServer->description) - { - LStr255 descriptionPStr(mServer->description); - mDescription->SetDescriptor(descriptionPStr); - mDescription->SelectAll(); - } - else - { - mDescription->SetDescriptor("\p"); - } - mDescription->SelectAll(); - - if (inIsPAB) - { - mLdapServer->Disable(); - mSearchRoot->Disable(); - mPortNumber->Disable(); - mMaxHits->Disable(); - mSecureBox->Disable(); - mSavePasswordBox->Disable(); - } - else - { - if (mServer->serverName) - { - LStr255 ldapServerPStr(mServer->serverName); - mLdapServer->SetDescriptor(ldapServerPStr); - mLdapServer->SelectAll(); - } - else - { - mLdapServer->SetDescriptor("\p"); - } - mLdapServer->SelectAll(); - if (mServer->searchBase) - { - LStr255 searchRootPStr(mServer->searchBase); - mSearchRoot->SetDescriptor(searchRootPStr); - mSearchRoot->SelectAll(); - } - else - { - mSearchRoot->SetDescriptor("\p"); - } - mSearchRoot->SelectAll(); - mPortNumber->SetValue(mServer->port); - mPortNumber->SelectAll(); - mMaxHits->SetValue(mServer->maxHits); - mMaxHits->SelectAll(); - mSecureBox->SetValue(mServer->isSecure ? 1: 0); - mSavePasswordBox->SetValue(mServer->savePassword ? 1: 0); - } - - // If the directories are locked, disable everything so the user can't make any changes. This - // allows them to view the information but not edit it. - if ( inAllLocked ) - { - mDescription->Disable(); - mLdapServer->Disable(); - mSearchRoot->Disable(); - mPortNumber->Disable(); - mMaxHits->Disable(); - mSecureBox->Disable(); -// pwBox->Disable(); - LGAPushButton *okButton = (LGAPushButton *) FindPaneByID(CPrefsDialog::eOKButtonID); - XP_ASSERT(okButton); - okButton->Disable(); - } - -} // SetUpDialog - -//---------------------------------------------------------------------------------------- -Boolean CLDAPServerPropDialog::PortNumberValidationFunc(CValidEditField *portNumber) -// Makes sure the port number field of the dialog is between 0 and 32767, but sets -// a reasonable default if the field is left blank. -//---------------------------------------------------------------------------------------- -{ - Boolean result; - Str255 currentValue; - portNumber->GetDescriptor(currentValue); - if (!currentValue[0]) - { - // If the user wipes out the port number field it is evaluated as zero, which - // is a valid port number, but it is not what we want to happen if the field - // is blank. - // We want to put in the Well Known port number, which depends on whether or - // not the server is secure. So we need to get the secure checkbox value. - // LDAP standard port = 389 - // LDAP secure (SSL) standard port = 636 - LView *superView = portNumber->GetSuperView(); - XP_ASSERT(superView); - LGACheckbox *checkbox = - (LGACheckbox *)superView->FindPaneByID(eSecureBox); - XP_ASSERT(checkbox); - portNumber->SetValue(checkbox->GetValue() ? eLDAPSecurePort : eLDAPStandardPort); - portNumber->SelectAll(); - result = false; - } - else - { - result = ConstrainEditField(portNumber, 0, 32767); - } - if (!result) - { - StPrepareForDialog prepare; - ::StopAlert(1068, NULL); - } - return result; -} - -//---------------------------------------------------------------------------------------- -Boolean CLDAPServerPropDialog::MaxHitsValidationFunc(CValidEditField *maxHits) -// Makes sure the max hits field of the dialog is between 1 and 65535. -//---------------------------------------------------------------------------------------- -{ - Boolean result; - result = ConstrainEditField(maxHits, 1, 65535); - if (!result) - { - // If it was constrained to 1 then make it 100 instead. - if (1 == maxHits->GetValue()) - { - maxHits->SetValue(100); - maxHits->SelectAll(); - } - StPrepareForDialog prepare; - ::StopAlert(1069, NULL); - } - return result; -} -#endif // MOZ_MAIL_NEWS - -enum -{ - eNameField = 12701, - eEMailField, - eReplyField, - eOrgField, - eUseSigFileBox, - eSigFilePicker, - eAttachPABCBox, - eEditCardButton, // not used - eInternetConfigBox, - eLaunchInternetConfig // currently only used in (MOZ_LITE) -}; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CMailNewsIdentityMediator::CMailNewsIdentityMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CPrefsMediator(class_ID) -{ -} - -//---------------------------------------------------------------------------------------- -void CMailNewsIdentityMediator::ListenToMessage(MessageT inMessage, void *ioParam) -//---------------------------------------------------------------------------------------- -{ - switch (inMessage) - { -#ifdef MOZ_LITE - case eLaunchInternetConfig: - const OSType kInternetConfigAppSig = 'ICAp'; - FSSpec appSpec; - if (CFileMgr::FindApplication(kInternetConfigAppSig, appSpec) == noErr) { - LaunchParamBlockRec launchThis; - launchThis.launchBlockID = extendedBlock; - launchThis.launchEPBLength = extendedBlockLen; - launchThis.launchFileFlags = NULL; - launchThis.launchControlFlags = launchContinue + launchNoFileFlags; - launchThis.launchAppSpec = (FSSpecPtr)&appSpec; - launchThis.launchAppParameters = NULL; - LaunchApplication(&launchThis); - } - break; -#endif // MOZ_LITE -#ifndef MOZ_LITE - case eUseSigFileBox: - // if IC is being used don't bring up the file picker - if( UseIC() ) - return; - CFilePicker *fPicker = - (CFilePicker *)FindPaneByID(eSigFilePicker); - XP_ASSERT(fPicker); - if (!fPicker->WasSet() && *(Int32 *)ioParam) - { // If the user has clicked the checkbox and the file picker is not set - // then we may want to trigger the file picker. - if (mNeedsPrefs) - { - // If mNeedsPrefs, then we are setting up the pane. If the picker - // is not set (can happen if the sig file was physically deleted), - // then we need to unset the "use" check box. - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(inMessage); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - } - else - { - fPicker->ListenToMessage(msg_Browse, nil); - if (!fPicker->WasSet()) - { // If the file picker is still unset, that means that the user - // cancelled the file browse so we don't want the checkbox set. - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(inMessage); - XP_ASSERT(checkbox); - checkbox->SetValue(false); - } - } - } - break; - case msg_FolderChanged: - LGACheckbox *checkbox = - (LGACheckbox *)FindPaneByID(eUseSigFileBox); - XP_ASSERT(checkbox); - checkbox->SetValue(true); - break; -#endif // MOZ_LITE - case eInternetConfigBox: - Boolean useIC = *(Int32 *)ioParam; - UseIC(useIC); - UpdateFromIC(); - #ifndef MOZ_MAIL_NEWS - LButton *button = - (LButton *)FindPaneByID(eLaunchInternetConfig); - XP_ASSERT(button); - if (UseIC()) - button->Enable(); - else - button->Disable(); - #endif // MOZ_MAIL_NEWS - - break; - default: - Inherited::ListenToMessage(inMessage, ioParam); - break; - } -} // CMailNewsIdentityMediator::ListenToMessage - -//---------------------------------------------------------------------------------------- -void CMailNewsIdentityMediator::UpdateFromIC() -//---------------------------------------------------------------------------------------- -{ - Boolean useIC = UseIC(); - #ifdef MOZ_LITE - LButton *button = - (LButton *)FindPaneByID(eLaunchInternetConfig); - XP_ASSERT(button); - if ( useIC ) - button->Enable(); - else - button->Disable(); -#endif // MOZ_LITE - if (useIC) - { - CPrefsDialog::LoadICDependent(); - } - // load IC prefs for this pane - SetEditFieldsWithICPref(kICRealName, - eNameField); - SetEditFieldsWithICPref(kICEmail, - eEMailField); -#ifndef MOZ_LITE - SetEditFieldsWithICPref(kICEmail, - eReplyField); -#endif // MOZ_LITE - SetEditFieldsWithICPref(kICOrganization, - eOrgField); - - CFilePicker *picker = - (CFilePicker *)FindPaneByID(eSigFilePicker); - - LCaption* caption = nil; - if( picker ) - caption = (LCaption*)picker->FindPaneByID( 1 ); - - if( picker && caption ) - { - if ( useIC ) - { - picker->Disable(); - LStr255 exampleString(12057, 1 ); - caption->SetDescriptor( exampleString); - } - else - { - picker->Enable(); - picker->SetCaptionForPath( caption, picker->GetFSSpec() ); - } - } -} - - - -//---------------------------------------------------------------------------------------- -void CMailNewsIdentityMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ - if (CPrefsDialog::eEmailAddress == sInitialSelection) - { - LEditField *theField = (LEditField *)FindPaneByID(eEMailField); - XP_ASSERT(theField); - sWindow->SetLatentSub(theField); - } -} // CMailNewsIdentityMediator::LoadPrefs - -#ifdef MOZ_MAIL_NEWS - -enum -{ - eMoreMessageOptionsDialogResID = 12005, - eHTMLBox = 12801, - eAutoQuoteBox, - eWrapLengthIntegerField = 12811, - eMailMailSelfBox = 12803, - eMailMailCCEditField = 12804, - eMailNewsSelfBox, - eMailNewsCCEditField, - eMailFCCPopup = 12808, - eNewsFCCPopup = 12810, - eMoreOptionsButton = 12812, - eNamesAndNickNamesRButton, - eNickNamesOnlyRButton, - eAsIsRButton, - eStrictlyMIMERButton, - eAskRButton, - eConvertRButton, - eSendHTMLRButton, - eSendBothRButton, - eOnlineSentFolderBox -}; - -//---------------------------------------------------------------------------------------- -CMailNewsMessagesMediator::CMailNewsMessagesMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CPrefsMediator(class_ID) -{ -} - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsMessagesMediator::WrapLinesValidationFunc(CValidEditField *wrapLines) -//---------------------------------------------------------------------------------------- -{ - Boolean result = true; - if (1 > wrapLines->GetValue()) - { - int32 newLength = 72; - PREF_GetDefaultIntPref("mailnews.wraplength", &newLength); - wrapLines->SetValue(newLength); - wrapLines->SelectAll(); - result = false; - } - if (!result) - { - StPrepareForDialog prepare; - ::StopAlert(1067, NULL); - } - return result; -} - -//---------------------------------------------------------------------------------------- -void CMailNewsMessagesMediator::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - Inherited::LoadMainPane(); - SetValidationFunction(eWrapLengthIntegerField, WrapLinesValidationFunc); -} - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CMailNewsOutgoingMediator::CMailNewsOutgoingMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CPrefsMediator(class_ID) -{ - char** p = &mFolderURL[0]; - for (int i = 0; i < UFolderDialogs::num_kinds; i++,p++) - { - *p = nil; - } -#ifdef HORRIBLE_HACK - Boolean* isDefault = &mFolderIsDefault[0]; - for (int i = 0; i < UFolderDialogs::num_kinds; i++,isDefault++) - *isDefault = false; -#endif // HORRIBLE_HACK -} - -//---------------------------------------------------------------------------------------- -CMailNewsOutgoingMediator::~CMailNewsOutgoingMediator() -//---------------------------------------------------------------------------------------- -{ - char** p = &mFolderURL[0]; - for (int i = 0; i < UFolderDialogs::num_kinds; i++,p++) - XP_FREEIF(*p); // BEWARE. The macro XP_FREEIF(*p++) increments three times! -} - -//---------------------------------------------------------------------------------------- -void CMailNewsOutgoingMediator::FixCaptionNameForFCC(UFolderDialogs::FolderKind kind, const char* mailOrNews) -// For mail/news_fcc, depending on a stupid boolean flag (blah.use_imap_sentmail), -// the prefname changes. This overload figures out the server/local status using the saved pref, -// and calls the other overload, below. -//---------------------------------------------------------------------------------------- -{ - // Check the boolean pref that determines the pref name to be used. - CStr255 prefname = "^0.use_imap_sentmail"; - StringParamText(prefname, mailOrNews); - XP_Bool onServer; - PREF_GetBoolPref(prefname, &onServer); - FixCaptionNameForFCC(kind, mailOrNews, onServer); -} // CMailNewsOutgoingMediator::FixCaptionNameForFCC - -//---------------------------------------------------------------------------------------- -void CMailNewsOutgoingMediator::FixCaptionNameForFCC(UFolderDialogs::FolderKind kind, const char* mailOrNews, Boolean onServer) -// For mail/news_fcc, depending on a stupid boolean flag (blah.use_imap_sentmail), -// the prefname changes. This overload is for the case where the prefs are not saved, and the -// onServer parameter is passed in by the caller. -//---------------------------------------------------------------------------------------- -{ - // Work out which checkbox we have to fix up, and which string to use. This only - // applies to mail_fcc and news_fcc. - PaneIDT checkboxPaneID; - if (kind == UFolderDialogs::mail_fcc) - checkboxPaneID = 'DoMF'; - else if (kind == UFolderDialogs::news_fcc) - checkboxPaneID = 'DoNF'; - else - return; - - // Set the caption pref name of the checkbox accordingly. - CStr255 prefname; - if (onServer) - prefname = "^0.imap_sentmail_path"; - else - prefname = "^0.default_fcc"; - StringParamText(prefname, mailOrNews); - LControl* pb = dynamic_cast(FindPaneByID(checkboxPaneID)); - SignalIf_(!pb); - if (pb) - UPrefControls::NoteSpecialFolderChanged(pb, prefname); -} // CMailNewsOutgoingMediator::FixCaptionNameForFCC - -//---------------------------------------------------------------------------------------- -void CMailNewsOutgoingMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ - FixCaptionNameForFCC(UFolderDialogs::news_fcc, "news"); - FixCaptionNameForFCC(UFolderDialogs::mail_fcc, "mail"); - - LControl* control = dynamic_cast(FindPaneByID(eMailMailSelfBox) ); - XP_ASSERT( control ); - CStr255 caption; - control->GetDescriptor( caption ); - CStr255 email = FE_UsersMailAddress(); - StringParamText(caption, email); - control->SetDescriptor( caption ); - control = dynamic_cast(FindPaneByID(eMailNewsSelfBox) ); - XP_ASSERT( control ); - control->SetDescriptor( caption ); -} // CMailNewsOutgoingMediator::LoadPrefs - -//---------------------------------------------------------------------------------------- -void CMailNewsOutgoingMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -{ - char** p = &mFolderURL[0]; -#ifdef HORRIBLE_HACK - Boolean* isDefault = &mFolderIsDefault[0]; -#endif // HORRIBLE_HACK - CStr255 prefName; - for (int i = 0; i < UFolderDialogs::num_kinds; i++,p++) - { - UFolderDialogs::FolderKind kind = (UFolderDialogs::FolderKind)i; - if (*p) - { - // For fcc, we must write out the IMAP/Local pref first, so that the prefs name - // will be set correctly in BuildPrefName(), below. - XP_Bool onServer = (XP_Bool)(NET_URL_Type(*p) == IMAP_TYPE_URL); - if (kind == UFolderDialogs::news_fcc) - PREF_SetBoolPref("news.use_imap_sentmail", onServer); - else if (kind == UFolderDialogs::mail_fcc) - PREF_SetBoolPref("mail.use_imap_sentmail", onServer); - Boolean saveAsAlias; - UFolderDialogs::BuildPrefName(kind, prefName, saveAsAlias); -#ifdef HORRIBLE_HACK - if (*isDefault++) - { - // Hack-to-work-around-backend-design-mess #23339: if it's a local folder and it's - // the server, then it's supposed to mean the default folder. But the backend - // doesn't deal with this properly. So append the path here. - CStr255 defaultFolderName; - if (UFolderDialogs::GetDefaultFolderName(kind, defaultFolderName)) - { - StrAllocCat(*p, "/"); - StrAllocCat(*p, (const char*)defaultFolderName); - } - } -#endif // HORRIBLE_HACK -#if DEBUG - if (kind == UFolderDialogs::news_fcc || kind == UFolderDialogs::mail_fcc) - { - Assert_(saveAsAlias == !onServer); - } - else - { - Assert_(!saveAsAlias); - } -#endif - if (saveAsAlias) - { - // For backward compatibility with 4.0x, we have to save this as a path, - // and not a URL in these two cases. - if (kind == UFolderDialogs::news_fcc || kind == UFolderDialogs::mail_fcc) - { - Boolean isURL = NET_URL_Type(*p) == MAILBOX_TYPE_URL; - Assert_(isURL); - if (isURL) - { - char* temp = NET_ParseURL(*p, GET_PATH_PART); - if (temp) - { - XP_FREE(*p); - *p = temp; - } - } - } - PREF_SetPathPref(prefName, *p, FALSE); - } - else - PREF_SetCharPref(prefName, *p); - } - } -} // CMailNewsOutgoingMediator::WritePrefs - -//---------------------------------------------------------------------------------------- -void CMailNewsOutgoingMediator::ListenToMessage(MessageT inMessage, void* ioParam) -//---------------------------------------------------------------------------------------- -{ - UFolderDialogs::FolderKind kind; - PaneIDT descriptionPaneID; // ID of the checkbox or caption corresponding to the button - const char* mailOrNews = nil; // substitution string for the caption prefname. - // We handle the four "choose folder" buttons here. - switch (inMessage) - { - case 'ChMF': - kind = UFolderDialogs::mail_fcc; - descriptionPaneID = 'DoMF'; // a checkbox - mailOrNews = "mail"; - break; - case 'ChNF': - kind = UFolderDialogs::news_fcc; - descriptionPaneID = 'DoNF'; // a checkbox - mailOrNews = "news"; - break; - case 'ChDF': - kind = UFolderDialogs::drafts; - descriptionPaneID = 'Drft'; // a caption - break; - case 'ChTF': - kind = UFolderDialogs::templates; - descriptionPaneID = 'Tmpl'; // a caption - break; - default: - Inherited::ListenToMessage(inMessage, ioParam); - return; - } - CMessageFolder curFolder; - const char* curURL = mFolderURL[kind]; - if (curURL) - curFolder.SetFolderInfo( - ::MSG_GetFolderInfoFromURL(CMailNewsContext::GetMailMaster(), curURL, false)); - CMessageFolder folder = UFolderDialogs::ConductSpecialFolderDialog(kind, curFolder); - if (folder.GetFolderInfo() != nil) - { - URL_Struct* ustruct = ::MSG_ConstructUrlForFolder(nil, folder); - // Set the cached URL string for this folder (used in WritePrefs), and update - // the text on the corresponding special folder checkbox. - if (ustruct) - { - char* newURL = XP_STRDUP(ustruct->address); - NET_FreeURLStruct(ustruct); -#ifdef HORRIBLE_HACK - if (folder.IsMailServer() && !folder.IsIMAPMailFolder()) - { - // Hack-to-work-around-backend-design-mess #23339: if it's a local folder and it's - // the server, then it's supposed to mean the default folder. But the backend - // doesn't deal with this properly. - mFolderIsDefault[kind] = true; // so we append the folder name when we write it out. - } -#endif // HORRIBLE_HACK - XP_FREEIF(mFolderURL[kind]); - mFolderURL[kind] = newURL; - - LPane* paneShowingFolderText = FindPaneByID(descriptionPaneID); - // If it's one of the fcc preferences, we have to make sure the caption is changed - // because the server/local cases are different. The checkbox will update to show - // the folder currently saved for that pref name. - if (mailOrNews) - FixCaptionNameForFCC(kind, mailOrNews, folder.IsIMAPMailFolder()); - // Then we have to update the checkbox caption to reflect the actual folder the - // user has just selected.. - UPrefControls::NoteSpecialFolderChanged(paneShowingFolderText, kind, folder); - } - } -} // CMailNewsOutgoingMediator::ListenToMessage - -#pragma mark - - -enum -{ - eMoreMailServerOptionsDialogResID = 12003 -, eMailServerUserNameField = 12901 -, eSMTPServerField = 12902 -//, eIncomingServerField = 12903 -//, eUsePOPRButton = 12904 -//, eLeaveOnServerBox = 12905 -//, eUseIMAPRButton = 12906 -//, eLocalCopiesBox = 12907 -//, eServerSSLBox = 12908 -//, eMailServerMoreButton = 12909 - -//, eIMAPMailDirEditField = 12911 -//, eOnRestartText = 12916 -//, eIMAPDeleteIsMoveToTrash = 12917 -}; - -enum -{ - eUnknownServerType = -1, - ePOPServer = 0, - eIMAPServer = 1 -}; - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::ClearList() -//---------------------------------------------------------------------------------------- -{ - TableIndexT rows, cols; - mServerTable->GetTableSize(rows, cols); - if (rows > 0) - mServerTable->RemoveRows(rows, 1, false); -} - -//---------------------------------------------------------------------------------------- -Boolean MServerListMediatorMixin::GetHostFromRow( - TableIndexT inRow, - CellContents& outCellData, - UInt32 inDataSize) const -//---------------------------------------------------------------------------------------- -{ - if (inRow == 0) - return false; - TableIndexT rowCount, colCount; - mServerTable->GetTableSize(rowCount, colCount); - if (inRow > rowCount) - return false; - STableCell cell(inRow, 1); - Uint32 cellDataSize = inDataSize; - mServerTable->GetCellData(cell, &outCellData, cellDataSize); - XP_ASSERT(cellDataSize >= inDataSize); - return true; -} // CMailNewsMailServerMediator::GetHostFromRow - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::SetHostDataForRow(TableIndexT inRow, const CellContents& inCellData, UInt32 inDataSize) const -//---------------------------------------------------------------------------------------- -{ - TableIndexT rowCount, colCount; - mServerTable->GetTableSize(rowCount, colCount); - Assert_(inRow >0 && inRow <= rowCount); - STableCell cell(inRow, 1); - Uint32 cellDataSize = inDataSize; - mServerTable->SetCellData(cell, &inCellData, cellDataSize); - Assert_(cellDataSize >= inDataSize); -} // CMailNewsMailServerMediator::GetHostFromRow - - -//---------------------------------------------------------------------------------------- -Boolean MServerListMediatorMixin::GetHostFromSelectedRow( - CellContents& outCellData, - UInt32 inDataSize) const -//---------------------------------------------------------------------------------------- -{ - STableCell currentCell = mServerTable->GetFirstSelectedCell(); - if (currentCell.row) - return GetHostFromRow(currentCell.row, outCellData, inDataSize); - return false; -} // CMailNewsMailServerMediator::GetHostFromRow - - -//---------------------------------------------------------------------------------------- -Boolean MServerListMediatorMixin::HostExistsElsewhereInTable(const CStr255& inHostName, TableIndexT &ioHostRow) const -//---------------------------------------------------------------------------------------- -{ - Boolean result = false; - - // Is this server name duplicated? - TableIndexT rows, cols; - mServerTable->GetTableSize(rows, cols); - - TableIndexT ignoreRow = ioHostRow; - - for (STableCell cell(1, 1); cell.row <= rows; ++cell.row) - { - if (cell.row == ignoreRow) - continue; - - CellContents contents; - Uint32 cellSize = sizeof(contents); - mServerTable->GetCellData(cell, &contents, cellSize); - - XP_ASSERT(sizeof(CellContents) <= cellSize); // size in PPob is too small! - - if ( inHostName == contents.description ) // we have a duplicate server name. - // Uses CStr == operator, which is case insensitive - { - result = true; - ioHostRow = cell.row; - break; - } - } - - return result; - -} // CMailNewsMailServerMediator::GetHostFromRow - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::DeleteSelectedRow(Boolean inRefresh) -//---------------------------------------------------------------------------------------- -{ - STableCell currentCell = mServerTable->GetFirstSelectedCell(); - if (currentCell.row) - mServerTable->RemoveRows(1, currentCell.row, inRefresh); - -} // CMailNewsMailServerMediator::GetHostFromRow - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::UpdateSelectedRow(const CellContents& inCellData, - Uint32 inDataSize, Boolean inRefresh) -//---------------------------------------------------------------------------------------- -{ - STableCell currentCell = mServerTable->GetFirstSelectedCell(); - if (currentCell.row) - SetHostDataForRow(currentCell.row, inCellData, inDataSize); - - if (inRefresh) - mServerTable->Refresh(); - -} // CMailNewsMailServerMediator::GetHostFromRow - - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::AppendNewRow(const CellContents& inCellData, - Uint32 inDataSize, Boolean inRefresh) -//---------------------------------------------------------------------------------------- -{ - mServerTable->InsertRows(1, LArray::index_Last, &inCellData, inDataSize, inRefresh); - -} // CMailNewsMailServerMediator::GetHostFromRow - -//---------------------------------------------------------------------------------------- -TableIndexT MServerListMediatorMixin::CountRows() -//---------------------------------------------------------------------------------------- -{ - TableIndexT numRows, numCols; - - mServerTable->GetTableSize(numRows, numCols); - - return numRows; - -} // CMailNewsMailServerMediator::GetHostFromRow - - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - mServerTable = (CDragOrderTextList*)mMediatorSelf->FindPaneByID('LIST'); - ThrowIfNil_(mServerTable); - mServerTable->AddListener(mMediatorSelf); - UpdateButtons(); -} - -//---------------------------------------------------------------------------------------- -void MServerListMediatorMixin::UpdateButtons() -//---------------------------------------------------------------------------------------- -{ - XP_ASSERT(mServerTable); - STableCell currentCell = mServerTable->GetFirstSelectedCell(); - LControl* deleteButton = (LControl*)mMediatorSelf->FindPaneByID('Dele'); - LControl* editButton = (LControl*)mMediatorSelf->FindPaneByID('Edit'); - LControl* addButton = (LControl*)mMediatorSelf->FindPaneByID('NewÉ'); - if (currentCell.row) - { - editButton->Enable(); - deleteButton->Enable(); - } - else - { - editButton->Disable(); - deleteButton->Disable(); - } - if (mServersLocked || CPrefsMediator::UseIC()) - { - addButton->Disable(); - deleteButton->Disable(); - mServerTable->LockOrder(); - } - else - addButton->Enable(); -} // MServerListMediatorMixin::UpdateButtons - -//---------------------------------------------------------------------------------------- -Boolean MServerListMediatorMixin::Listen(MessageT inMessage, void *ioParam) -//---------------------------------------------------------------------------------------- -{ - switch (inMessage) - { - case CDragOrderTextList::msg_ChangedOrder: - mServersDirty = true; - break; - case eSelectionChanged: - Assert_((CDragOrderTextList*)ioParam = mServerTable); - UpdateButtons(); - break; - case 'NewÉ': - AddButton(); - break; - case eDoubleClick: - case 'Edit': - EditButton(); - break; - case 'Dele': - DeleteButton(); - break; - default: - return false; - break; - } - return true; -} - -//---------------------------------------------------------------------------------------- -/*static */Boolean MServerListMediatorMixin::ServerIsInCommaSeparatedList( - const char *inServerName, const char *inServerList) -//---------------------------------------------------------------------------------------- -{ - char *listCopy; - char *curToken; - Boolean result = false; - - if (inServerList == NULL) return false; - - listCopy = XP_STRDUP(inServerList); // since strtok modifies it - ThrowIfNil_(listCopy); - - curToken = XP_STRTOK(listCopy, ","); - - while (curToken != NULL) - { - // skip white space - while (*curToken && *curToken == ' ') - curToken ++; - - if (XP_STRCMP(inServerName, curToken) == 0) - { - result = true; - break; - } - - curToken = XP_STRTOK(NULL, ","); - } - - XP_FREE(listCopy); - return result; -} - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CServerListMediator::CServerListMediator(PaneIDT inMainPaneID) -//---------------------------------------------------------------------------------------- -: CPrefsMediator(inMainPaneID) -, MServerListMediatorMixin(this) -{ -} - -//---------------------------------------------------------------------------------------- -void CServerListMediator::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - CPrefsMediator::LoadMainPane(); - MServerListMediatorMixin::LoadMainPane(); -} - -//---------------------------------------------------------------------------------------- -void CServerListMediator::ListenToMessage(MessageT inMessage, void *ioParam) -//---------------------------------------------------------------------------------------- -{ - if (!MServerListMediatorMixin::Listen(inMessage, ioParam)) - CPrefsMediator::ListenToMessage(inMessage, ioParam); -} - -#pragma mark - - -enum -{ - POP3_PORT = 110, /* the iana port for pop3 */ - IMAP4_PORT = 143, /* the iana port for imap4 */ - IMAP4_PORT_SSL_DEFAULT = 993 /* use a separate port for imap4 over ssl */ -}; - -//---------------------------------------------------------------------------------------- -CMailNewsMailServerMediator::CMailNewsMailServerMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CServerListMediator(class_ID) -, mServerType(eUnknownServerType) -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF -, mPOPServerName(nil) -#endif -{ -} // CMailNewsMailServerMediator::CMailNewsMailServerMediator - -//---------------------------------------------------------------------------------------- -CMailNewsMailServerMediator::~CMailNewsMailServerMediator() -//---------------------------------------------------------------------------------------- -{ -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - XP_FREEIF(mPOPServerName); -#endif -} - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::SetPOPServerName(const CStr255& inName) -//---------------------------------------------------------------------------------------- -{ -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - XP_FREEIF(mPOPServerName); - if (inName.Length() != 0) - mPOPServerName = XP_STRDUP(inName); -#else // Now: - LEditField* editField = dynamic_cast(FindPaneByID('SNAM')); - Assert_(editField); - if (editField) - editField->SetDescriptor(inName); -#endif -} // CMailNewsMailServerMediator::SetPOPServerName - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::GetPOPServerName(CStr255& outName) const -//---------------------------------------------------------------------------------------- -{ - outName[0] = 0; -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - if (mPOPServerName) - outName = mPOPServerName; -#else // Now: - LEditField* editField = dynamic_cast(FindPaneByID('SNAM')); - Assert_(editField); - if (!editField) - return; - editField->GetDescriptor(outName); -#endif -} // CMailNewsMailServerMediator::GetPOPServerName - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsMailServerMediator::NoAtSignValidationFunc(CValidEditField *noAtSign) -//---------------------------------------------------------------------------------------- -{ - CStr255 value; - noAtSign->GetDescriptor(value); - unsigned char atPos = value.Pos("@"); - if (atPos) - { - value.Delete(atPos, 256); // if there is an at sign delete it - noAtSign->SetDescriptor(value); // and anything after it - noAtSign->SelectAll(); - ErrorManager::PlainAlert(POP_USERNAME_ONLY); - return false; - } - return true; -} // CMailNewsMailServerMediator::NoAtSignValidationFunc - -//---------------------------------------------------------------------------------------- -/* static */ Boolean CMailNewsMailServerMediator::ValidateServerName(const CStr255& inServerName, - Boolean inNewServer, const CServerListMediator* inServerList) -//---------------------------------------------------------------------------------------- -{ - if (inServerName.IsEmpty()) - return false; - - const CMailNewsMailServerMediator *theMediator = dynamic_cast(inServerList); - ThrowIfNil_(theMediator); - - TableIndexT foundRow = LArray::index_Bad; - - // Is this server name duplicated? - if (!inNewServer) - { - STableCell currentCell = theMediator->mServerTable->GetFirstSelectedCell(); // this must be the server we are editing - foundRow = currentCell.row; - } - - return ! theMediator->HostExistsElsewhereInTable(inServerName, foundRow); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - Inherited::LoadMainPane(); - SetValidationFunction(eMailServerUserNameField, NoAtSignValidationFunc); -} // CMailNewsMailServerMediator::LoadMainPane - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ - // Check whether this is the first call on entry (we call LoadPrefs more than once). - if (mServerType == eUnknownServerType) - { - int32 serverType = eUnknownServerType; - int32 prefResult = PREF_GetIntPref("mail.server_type", &serverType); - ThrowIf_(prefResult != PREF_NOERROR); - mServerType = (ServerType)serverType; - } -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - if (mServerType == ePOPServer) - { - char* value = nil; - int32 prefResult = PREF_CopyCharPref("network.hosts.pop_server", &value); - if (prefResult == PREF_NOERROR && value) - if (*value) - mPOPServerName = value; - else - XP_FREE(value); - } -#endif - mServersLocked = PREF_PrefIsLocked("network.hosts.pop_server") - || PREF_PrefIsLocked("mail.server_type") - || PREF_PrefIsLocked("mail.server_type_on_restart"); - - // Make sure there's a default value - Boolean userNameLocked = PaneHasLockedPref(eMailServerUserNameField); - LEditField* popUserNameField = - dynamic_cast(FindPaneByID(eMailServerUserNameField)); - if (popUserNameField && !userNameLocked) - { - CStr255 username; - popUserNameField->GetDescriptor(username); - if (username.Length() == 0) - { - UGetInfo::GetDefaultUserName(username); - popUserNameField->SetDescriptor(username); - } - } - - LoadList(); -} // CMailNewsMailServerMediator::LoadPrefs - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -{ - WriteList(); -} // CMailNewsMailServerMediator::WritePrefs - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::UpdateFromIC() -//---------------------------------------------------------------------------------------- -{ - - SetEditFieldsWithICPref(kICSMTPHost, eSMTPServerField, true); - Boolean userNameLocked = PaneHasLockedPref(eMailServerUserNameField); - - LEditField* popUserNameField = (LEditField*)FindPaneByID(eMailServerUserNameField); - Assert_(popUserNameField); - - if ((userNameLocked && mServersLocked) || !UseIC()) - { - popUserNameField->Enable(); - return; - } - - Str255 s; - long port = POP3_PORT; // port is only returned if the user has a - // :port after the server name in IC. Use POP as default - CInternetConfigInterface::GetInternetConfigString( kICMailAccount, - s, - &port); - // parse as user@server - int i; - unsigned char* server = nil; - // Search the pascal string for '@' - unsigned char* cp = &s[1]; - for (i = 1; i <= s[0] && !server; ++i, ++cp) - { - if ('@' == (char)*cp) - server = cp; - } - // If found, poke in the length bytes to split s into two pascal strings user/server. - // Otherwise, assume s is the server only (and the user name is empty) - unsigned char* user = "\p"; - if (server) - { - server[0] = s[0] - i+1; - s[0] = i-2 ; - user = s; - } - else - server = s; - - if (!userNameLocked) - { - popUserNameField->SetDescriptor(user); - popUserNameField->SelectAll(); - } - - popUserNameField->Disable(); - - if (!mServersLocked) - { - -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - XP_FREEIF(mPOPServerName); -#endif - - if (port == POP3_PORT) - { -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - mPOPServerName = XP_STRDUP((const char*)(CStr255)server); -#endif - - // If there is just one server, and there is no inbox yet, - // then set up that server from IC - if (CountRows() <= 1 && CMailNewsContext::UserHasNoLocalInbox()) - { - SetPOPServerName(server); - mServerType = ePOPServer; - - CStr255 serverName(server); - CellContents cellData(serverName); - - if (CountRows() == 0) - AppendNewRow(cellData, sizeof(CellContents)); - else - SetHostDataForRow(1, cellData, sizeof(CellContents)); - } - - } - else - { - // Only change the IMAP server settings if this is a new profile - // Change the cell data to show the new server name, and refresh. - - if (CountRows() <= 1 && CMailNewsContext::UserHasNoLocalInbox()) - { - CStr255 serverName(server); - CellContents cellData(serverName); - - if (CountRows() == 0) - AppendNewRow(cellData, sizeof(CellContents)); - else - SetHostDataForRow(1, cellData, sizeof(CellContents)); - - mServerType = eIMAPServer; - } - - } - } -} // CMailNewsMailServerMediator::UpdateFromIC - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsMailServerMediator::UsingPop() const -//---------------------------------------------------------------------------------------- -{ - return (mServerType == ePOPServer); -} // CMailNewsMailServerMediator::UsingPop - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::AddButton() -// Create a brand new (empty) server and pop up a dialog to let the user edit it. The -// OK/Cancel is handled in ObeyCommand(). -//---------------------------------------------------------------------------------------- -{ - TableIndexT rows, cols; - mServerTable->GetTableSize(rows, cols); - if (UsingPop() && rows > 0) - { - // See allxpstr.h for the following string: - // "You cannot connect to more than one server, because you are using " - // "a POP server." // 25 - //::GetIndString(reason, 7099, 25); - ErrorManager::PlainAlert(GetPString(MK_POP3_ONLY_ONE + RES_OFFSET)); - return; - } - - CStr255 serverName; // constructor sets to empty string. - Boolean allowServerTypeEdit = CountRows() == 0; - Boolean usePop = CountRows() == 0; - - // Pass this in as the super commander, because we want to defer the destruction - // of the get info dialog. This is because we don't want to commit its prefs unless the - // user OKs the whole prefs dialog. - if (UGetInfo::ConductMailServerInfoDialog(serverName, usePop, true, true, - allowServerTypeEdit, UGetInfo::kSubDialogOfPrefs, ValidateServerName, this, this)) - { - NoteServerChanges(usePop, serverName); - - CellContents cellData(serverName); - AppendNewRow(cellData, sizeof(CellContents)); - } - -} // CMailNewsMailServerMediator::AddButton - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::NoteServerChanges(Boolean inPOP, const CStr255& inServerName) -//---------------------------------------------------------------------------------------- -{ - mServerType = inPOP ? ePOPServer : eIMAPServer; -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - // Since the server info dialog writes out the new stuff immediately, for consistency - // we should make these prefs take effect immediately also. This means that "cancel" - // doesn't, even more. - if (inPOP && inServerName.Length() > 0) - { - SetPOPServerName(inServerName); - int32 prefResult = PREF_SetCharPref("network.hosts.pop_server", inServerName); - ThrowIf_(prefResult < PREF_NOERROR); // PREF_VALUECHANGED = 1 is expected! - } - int32 prefResult = PREF_SetIntPref("mail.server_type_on_restart", mServerType); - ThrowIf_(prefResult < PREF_NOERROR); // PREF_VALUECHANGED = 1 is expected! - // In Nova, we are attempting to make "convert immediately" work! so here goes: - prefResult = PREF_SetIntPref("mail.server_type", mServerType); - ThrowIf_(prefResult < PREF_NOERROR); -#else - // Now. - // Because of historic XP code, you have to have a POP server name, even for IMAP. So - // we might as well always set it to be the same as the IMAP server name. - if (! inServerName.IsEmpty()) - SetPOPServerName(inServerName); // set the invisible server name field. -#endif -} - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::EditButton() -// Grab the selected item in the list, create a duplicate of the server associated with that -// item and pop up a dialog to edit this server. The OK/Cancel is handled in ObeyCommand(). -//---------------------------------------------------------------------------------------- -{ - CellContents contents; - GetHostFromSelectedRow(contents, sizeof(CellContents)); - Boolean usePOP = (mServerType == ePOPServer); - - // Allow them to edit the server name the first time through after setup. - // Use the doCreate parameter for this. - Boolean isNewServer = false; - Boolean allowServerNameEdit = (usePOP || CMailNewsContext::UserHasNoLocalInbox()); - Boolean allowServerTypeEdit = allowServerNameEdit || (CountRows() == 1); - - if (UGetInfo::ConductMailServerInfoDialog( - contents.description, - usePOP, - isNewServer, - allowServerNameEdit, - allowServerTypeEdit, - UGetInfo::kSubDialogOfPrefs, - (allowServerTypeEdit) ? ValidateServerName : nil, - (allowServerTypeEdit) ? this : nil, - this)) - { - NoteServerChanges(usePOP, contents.description); - } - - // Update the cell contents to save the handler - UpdateSelectedRow(contents, sizeof(CellContents)); - - -} // CMailNewsMailServerMediator::EditButton - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::DeleteButton() -//---------------------------------------------------------------------------------------- -{ - CellContents cellData; - UInt32 dataSize = sizeof(CellContents); - Boolean showWarning = false; - - GetHostFromSelectedRow(cellData, dataSize); - Assert_(dataSize <= sizeof(CellContents)); - if (! UsingPop()) - { - char *curServerList = nil; - PREF_CopyCharPref("network.hosts.imap_servers", &curServerList); - - showWarning = ServerIsInCommaSeparatedList(cellData.description, curServerList); - XP_FREEIF(curServerList); - } - - if (showWarning && !UStdDialogs::AskOkCancel(GetPString(MK_MSG_REMOVE_MAILHOST_CONFIRM + RES_OFFSET))) - return; - - if (UsingPop()) - SetPOPServerName("mail"); - - DeleteSelectedRow(); - - UpdateButtons(); - -} // CMailNewsMailServerMediator::DeleteButton - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::LoadList() -// This should only be called once when loading the prefs now -//---------------------------------------------------------------------------------------- -{ - ClearList(); - if (UsingPop()) - { - CStr255 serverName; - GetPOPServerName(serverName); - - // set empty server name to something useful - Assert_( ! serverName.IsEmpty() ); - - if (! serverName.IsEmpty()) - { - CellContents contents(serverName); - mServerTable->InsertRows( - 1, LArray::index_Last, - &contents, sizeof(CellContents), false); - } - } - else - { - char *serverList = nil; - PREF_CopyCharPref("network.hosts.imap_servers", &serverList); - if (serverList) - { - char *serverPtr = serverList; - while (serverPtr) - { - char *endPtr = XP_STRCHR(serverPtr, ','); - if (endPtr) - *endPtr++ = '\0'; - CellContents cell(serverPtr); - mServerTable->InsertRows(1, LArray::index_Last, &cell, sizeof(CellContents), false); - serverPtr = endPtr; - } - XP_FREE(serverList); - } - } - // Refreshing is redundant the first time, but necessary when called after a server info dlg. - mServerTable->Refresh(); -} // CMailNewsMailServerMediator::LoadList - -//---------------------------------------------------------------------------------------- -void CMailNewsMailServerMediator::WriteList() -//---------------------------------------------------------------------------------------- -{ - TableIndexT rows, cols; - mServerTable->GetTableSize(rows, cols); - if (mServersLocked) - return; - - StSpinningBeachBallCursor beachBall; // because making new servers can take some time - -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - if (mServerType == ePOPServer && mPOPServerName && *mPOPServerName) - CStr255 serverName; - GetPOPServerName(serverName); - NoteServerChanges(mServerType, serverName); -#endif -#if 0 - // There may be no need to do this. The back end updates the list after every - // add and delete. - char *serverList = nil; - for (STableCell cell(1, 1); cell.row <= rows; ++cell.row) - { - CellContents contents; - Uint32 cellSize = sizeof(contents); - mServerTable->GetCellData(cell, &contents, cellSize); - XP_ASSERT(sizeof(CellContents) == cellSize); - if (cell.row > 1) - StrAllocCat(serverList, ","); - StrAllocCat(serverList, (const char*)(CStr255)contents.description); - } - PREF_SetCharPref("network.hosts.imap_servers", serverList); -#endif // 0 - - - char *newServerList = XP_STRDUP(""); - char *oldServerList = nil; - PREF_CopyCharPref("network.hosts.imap_servers", &oldServerList); - - if ( UsingPop() ) - { - // the invisible POP server name field in the prefs dialog writes itself out, - // so we have nothing to do but to remove deleted IMAP servers - } - else // IMAP - { - // Here is where we actually write out the changed mail server prefs. - // The strategy is: Get the string of servers from the (old) prefs - // For each server in the string, see if it's in our list - // If not, delete it - // If yes, we need do nothing. - // Servers in our list which are not in the prefs are added. - -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - // nothing -#else - // Make sure the pop_server does not write out when using IMAP - MPreferenceBase::SetPaneWritePref(sWindow, 'SNAM', false); -#endif - - // The backend has a callback on mail.server_type, which will get called - // when we write out the temp prefs buffer on closing the prefs dialog. - // So, to avoid duplicate hosts being created by this callback, we need - // to set the mail.server_type pref here if necessary. - - if (!oldServerList || !*oldServerList) // no IMAP servers at the moment - { - int prefError = PREF_SetIntPref("mail.server_type", eIMAPServer); - Assert_(prefError == PREF_NOERROR || prefError == PREF_VALUECHANGED); - - // double check - PREF_CopyCharPref("network.hosts.imap_servers", &oldServerList); - } - - for (STableCell cell(1, 1); cell.row <= rows; ++cell.row) - { - CellContents contents; - Uint32 cellSize = sizeof(CellContents); - - mServerTable->GetCellData(cell, &contents, cellSize); - Assert_(sizeof(CellContents) <= cellSize); - - // skip cells with empty text - if (contents.description.Length() == 0) - continue; - - // If the host does not exist, create it - if ( ! ServerIsInCommaSeparatedList(contents.description, oldServerList) ) - { - const char* userNameString = XP_STRDUP(""); // its filled in when the prefs are saved - const char* serverNameString = XP_STRDUP(contents.description); - - // get user name from internet config if necessary - if (UseIC()) - { - CStr255 userAtHostString; - long port; - - CInternetConfigInterface::GetInternetConfigString( kICMailAccount, - userAtHostString, - &port); - if ( !userAtHostString.IsEmpty() ) - { - unsigned char atPos = userAtHostString.Pos("@"); - - if (atPos > 0) - { - userAtHostString[0] = atPos - 1; - - XP_FREEIF(const_cast(userNameString)); - userNameString = XP_STRDUP(userAtHostString); - } - } - } - - try - { - ThrowIfNil_(userNameString); - ThrowIfNil_(serverNameString); - - if (::MSG_GetIMAPHostByName(CMailNewsContext::GetMailMaster(), serverNameString)) - Assert_(false); - else - ::MSG_CreateIMAPHost( - CMailNewsContext::GetMailMaster(), - serverNameString, - false, // XP_Bool isSecure, - userNameString, // const char *userName, - false, // XP_Bool checkNewMail, - 0, // int biffInterval, - false, // XP_Bool rememberPassword, - true, // XP_Bool usingSubscription, - false, // XP_Bool overrideNamespaces, - nil, // const char *personalOnlineDir, - nil, // const char *publicOnlineDir, - nil // const char *otherUsersOnlineDir - ); - } - catch (...) - { - } - XP_FREEIF(const_cast(userNameString)); - XP_FREEIF(const_cast(serverNameString)); - } - - // save the name in the new servers list - if (cell.row > 1) - StrAllocCat(newServerList, ","); - - StrAllocCat(newServerList, (const char*)(CStr255)contents.description); - } - } // using IMAP - - // Now handle deleted servers, which are in the old list but not the new - if (oldServerList) - { - char *serverPtr = oldServerList; - while (serverPtr) - { - - char *endPtr = XP_STRCHR(serverPtr, ','); - if (endPtr) - *endPtr++ = '\0'; - - if ( (*newServerList == 0) || !ServerIsInCommaSeparatedList(serverPtr, newServerList) ) - { - // delete the server - ::MSG_DeleteIMAPHostByName(CMailNewsContext::GetMailMaster(), serverPtr); - } - - serverPtr = endPtr; - } - } - - XP_FREEIF(oldServerList); - XP_FREEIF(newServerList); - - // Did the user delete all their servers? Silly thing, let's make amends - if (rows == 0) - { - // set the pop server name back to the default - SetPOPServerName("mail"); - - // just to make damn sure - MPreferenceBase::SetPaneWritePref(sWindow, 'SNAM', true); - ::PREF_SetIntPref("mail.server_type", ePOPServer); - } - - -} // CMailNewsMailServerMediator::WriteList - -enum -{ -// eNewsServerEditText = 13001, -// eNewsServerPortIntText, -// eNewsServerSecureBox, - eNotifyLargeDownloadBox, - eNotifyLargeDownloadEditField -}; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CMailNewsNewsServerMediator::CMailNewsNewsServerMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CServerListMediator(class_ID) -, mNewsServerPortLocked(false) -{ -} - -#if 0 -//---------------------------------------------------------------------------------------- -Boolean CMailNewsNewsServerMediator::PortNumberValidationFunc(CValidEditField *portNumber) -//---------------------------------------------------------------------------------------- -{ - Boolean result; - Str255 currentValue; - portNumber->GetDescriptor(currentValue); - if (!currentValue[0]) - { - // If the user wipes out the port number field it is evaluated as zero, which - // is a valid port number, but it is not what we want to happen if the field - // is blank. - // We want to put in the Well Known port number, which depends on whether or - // not the server is secure. So we need to get the secure checkbox value. - // NNTP standard port = 119 - // NNTP secure (SSL) standard port = 563 - LView *superView = portNumber->GetSuperView(); - XP_ASSERT(superView); - LGACheckbox *checkbox = - (LGACheckbox *)superView->FindPaneByID(eNewsServerSecureBox); - XP_ASSERT(checkbox); - portNumber->SetValue(checkbox->GetValue() ? eNNTPSecurePort : eNNTPStandardPort); - portNumber->SelectAll(); - result = false; - } - else - { - result = ConstrainEditField(portNumber, 0, 32767); - } - if (!result) - { - StPrepareForDialog prepare; - ::StopAlert(1068, NULL); - } - return result; -} -#endif - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::UpdateFromIC() -//---------------------------------------------------------------------------------------- -{ - // Note: should we initialize the list from IC if there are no entries yet? - if (mServersLocked) - return; -#if 1 - if (UseIC()) - { - long port = eNNTPStandardPort; - CStr255 serverName; - CInternetConfigInterface::GetInternetConfigString(kICNNTPHost, serverName, &port); - - // Create or find the host - char* cserverName = XP_STRDUP(serverName); - if (cserverName) - { - MSG_NewsHost* host = ::MSG_CreateNewsHost( - CMailNewsContext::GetMailMaster(), - serverName, - port == eNNTPSecurePort, - port); - XP_FREE(cserverName); - } - // Stick it in the list by rebuilding the list - LoadList(); - } -#else - SetEditFieldsWithICPref(kICNNTPHost, - eNewsServerEditText, - true, - eNewsServerPortIntText, - mNewsServerPortLocked, - eNNTPStandardPort); -#endif // 1 -} - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::AddButton() -// Create a brand new (empty) server and pop up a dialog to let the user edit it. The -// OK/Cancel is handled in ObeyCommand(). -//---------------------------------------------------------------------------------------- -{ - // This creates the host in the BE straight away. This needs to be re-written so - // that host changes are only committed when the user OKs the prefs dialog - CNewsSubscriber::DoAddNewsHost(); - LoadPrefs(); - mServerTable->Refresh(); -} // CMailNewsNewsServerMediator::AddButton - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::EditButton() -// Grab the selected item in the list, create a duplicate of the server associated with that -// item and pop up a dialog to edit this server. The OK/Cancel is handled in ObeyCommand(). -//---------------------------------------------------------------------------------------- -{ - CellContents contents; - GetHostFromSelectedRow(contents, sizeof(CellContents)); - - StDialogHandler *dialogHandler = nil; - - if (UGetInfo::ConductNewsServerInfoDialog(contents.serverData, this)) - { - // Fix me. News server changes take place right away, so are not handled like - // the rest of the prefs. See CMailNewsMailServerMediator for the way it - // should work - } - -} // CMailNewsNewsServerMediator::EditButton - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::DeleteButton() -//---------------------------------------------------------------------------------------- -{ - CellContents contents; - GetHostFromSelectedRow(contents, sizeof(CellContents)); - - // This deletes the host in the BE straight away. This needs to be re-written so - // that host changes are only committed when the user OKs the prefs dialog - - ::MSG_DeleteNewsHost(CMailNewsContext::GetMailMaster(), - MSG_GetNewsHostFromMSGHost(contents.serverData)); - LoadList(); - UpdateButtons(); - -} // CMailNewsNewsServerMediator::DeleteButton - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ - mServersLocked = PREF_PrefIsLocked("network.hosts.nntp_server"); - LoadList(); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -{ - /* - mcmullen and andrewb 97/08/11 - - Fix for bug 80691. If no MSG_FolderPane has been created when we tweak - news.server_change_xaction then we will run into trouble when the user - opens up the Message Center. The new default news server will appear - twice in the Messsage Center. This is not only bad from a visual standpoint, - but if the user tries to delete one copy and then the second, they will - crash. - - This fix is a Good Kludge(tm) because it's localized to this little piece of - code right here, we clean up after ourselves and we incur no performance - penalty if the MSG_FolderPane has already been created since that is a unique - object that is reference counted. - */ -#ifdef DEFAULT_NEWS_SERVER_KLUDGE - MSG_Pane* pane = NULL; - CMailNewsContext* context = new CMailNewsContext(MWContextMailNewsProgress); - Assert_(context); -#ifdef DEBUG - if (context) -#endif - pane = ::MSG_CreateFolderPane(*context, CMailNewsContext::GetMailMaster()); -#endif - - // ### mwelch 97 July - // Since preferences are not transactionalized, and - // the preferences above need to trigger a single response in - // the back end, we set an additional preference with - // any different value, so that the back end callback - // will be called by the prefs API. (This is not an FE - // issue, merely an issue with the prefs API.) - int32 tempInt; - PREF_GetIntPref("news.server_change_xaction", &tempInt); - PREF_SetIntPref("news.server_change_xaction", ++tempInt); - -#ifdef DEFAULT_NEWS_SERVER_KLUDGE - if (context) - ::XP_InterruptContext((MWContext*)*context); - if (pane) - ::MSG_DestroyPane(pane); -#endif -} // CMailNewsNewsServerMediator::WritePrefs - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::LoadList() -//---------------------------------------------------------------------------------------- -{ - ClearList(); - const int32 kMaxLists = 32; - MSG_NewsHost* serverList[kMaxLists]; - int32 listSize = ::MSG_GetNewsHosts( - CMailNewsContext::GetMailMaster(), - (MSG_NewsHost**)serverList, - kMaxLists); - for (int i = 0; i < listSize; i++) - { - MSG_Host* host = ::MSG_GetMSGHostFromNewsHost(serverList[i]); - const char* name = ::MSG_GetHostName(host); - CellContents contents(name, host); - mServerTable->InsertRows(1, LArray::index_Last, &contents, sizeof(CellContents), false); - } - // Refreshing is redundant the first time, but necessary when called after a server info dlg. - mServerTable->Refresh(); -} // CMailNewsNewsServerMediator::LoadList - -//---------------------------------------------------------------------------------------- -void CMailNewsNewsServerMediator::WriteList() -//---------------------------------------------------------------------------------------- -{ -} // CMailNewsNewsServerMediator::WriteList - -enum -{ - eOKButton = 900, -// eServerTable = 13101, -// eNewDirectoryButton = 13104, -// eEditDirectoryButton, -// eDeleteDirectoryButton, - eFirstLastRButton = 13107, - eLastFirstRButton = 13108 -}; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CMailNewsDirectoryMediator::CMailNewsDirectoryMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CServerListMediator(class_ID) -, mDeletedServerList(nil) -{ -} - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::AddButton() -// Create a brand new (empty) server and pop up a dialog to let the user edit it. The -// OK/Cancel is handled in ObeyCommand(). -//---------------------------------------------------------------------------------------- -{ - DIR_Server *newServer = (DIR_Server *)XP_ALLOC(sizeof(DIR_Server)); - DIR_InitServer(newServer); - - CLDAPServerPropDialog* dialog = (CLDAPServerPropDialog*) - LWindow::CreateWindow ( CLDAPServerPropDialog::eLDAPServerPropertiesDialogResID, this ); - dialog->SetUpDialog( newServer, CLDAPServerPropDialog::eNewServer, IsPABServerSelected(newServer), - mServersLocked ); - -} // AddButton - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::EditButton() -// Grab the selected item in the list, create a duplicate of the server associated with that -// item and pop up a dialog to edit this server. The OK/Cancel is handled in ObeyCommand(). -//---------------------------------------------------------------------------------------- -{ - // get the data - STableCell currentCell; - CellContents cell; - - currentCell = mServerTable->GetFirstSelectedCell(); - XP_ASSERT(currentCell.row); - - Uint32 cellDataSize = sizeof(CellContents); - mServerTable->GetCellData(currentCell, &cell, cellDataSize); - XP_ASSERT(cellDataSize == sizeof(CellContents)); - - // copy it - DIR_Server* tempServer; - DIR_CopyServer(cell.serverData, &tempServer); - - // show dialog - CLDAPServerPropDialog* dialog = (CLDAPServerPropDialog*) - LWindow::CreateWindow ( CLDAPServerPropDialog::eLDAPServerPropertiesDialogResID, this ); - dialog->SetUpDialog( tempServer, CLDAPServerPropDialog::eEditServer, IsPABServerSelected(tempServer), - mServersLocked ); -} // EditButton - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::DeleteButton() -//---------------------------------------------------------------------------------------- -{ - STableCell currentCell; - currentCell = mServerTable->GetFirstSelectedCell(); - CellContents cell; - Uint32 cellDataSize = sizeof(CellContents); - mServerTable->GetCellData(currentCell, &cell, cellDataSize); - XP_ASSERT(cellDataSize == sizeof(CellContents)); - if (!mDeletedServerList) - mDeletedServerList = XP_ListNew(); - if (mDeletedServerList) - XP_ListAddObjectToEnd(mDeletedServerList, cell.serverData); -// DIR_DeleteServer(cell.serverData); - mServerTable->RemoveRows(1, currentCell.row, true); - UpdateButtons(); - mServersDirty = true; -} - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsDirectoryMediator::IsPABServerSelected(LTextColumn *serverTable) -//---------------------------------------------------------------------------------------- -{ - Boolean result = false; - STableCell currentCell; - currentCell = serverTable->GetFirstSelectedCell(); - if (currentCell.row) - { - if (!serverTable) - { - serverTable = mServerTable; - XP_ASSERT(serverTable); - } - CellContents cell; - Uint32 cellDataSize = sizeof(CellContents); - serverTable->GetCellData(currentCell, &cell, cellDataSize); - XP_ASSERT(cellDataSize == sizeof(CellContents)); - result = IsPABServerSelected(cell.serverData); - } - return result; -} - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsDirectoryMediator::IsPABServerSelected(DIR_Server *server) -//---------------------------------------------------------------------------------------- -{ - Boolean result = (PABDirectory == server->dirType); - return result; -} - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::UpdateButtons() -//---------------------------------------------------------------------------------------- -{ - MServerListMediatorMixin::UpdateButtons(); - STableCell currentCell = mServerTable->GetFirstSelectedCell(); - if (IsPABServerSelected(mServerTable)) - { - LControl* deleteButton = (LControl*)FindPaneByID('Dele'); - deleteButton->Disable(); - } -} - -//---------------------------------------------------------------------------------------- -Boolean CMailNewsDirectoryMediator::ObeyCommand( CommandT inCommand, void* ioParam ) -// Used to receive the commands passed along from the LDAPServerProperties dialog (the -// OK and Cancel messages). -//---------------------------------------------------------------------------------------- -{ - switch (inCommand) - { - // Handle cancel from the server properties dialog. All we have to do is dispose - // of the server previously allocated. - case CLDAPServerPropDialog::cmd_CancelButton: { - SDialogResponse* theResponse = (SDialogResponse*) ioParam; - Assert_ ( theResponse ); - CLDAPServerPropDialog* dialog = (CLDAPServerPropDialog*) theResponse->dialogBox; - Assert_ ( dialog ); - - DIR_DeleteServer ( dialog->GetServer() ); - UpdateButtons(); - delete dialog; - break; - } - - // Handle OK from the server properties dialog. If we're adding a new server, we - // have to add a row to the server table. If we're modifying an existing one, - // update the UI (name of server), delete the old one, and hold on to the new one. - // The data from the dialog fields has already been extracted into the server - // held by the dialog class. - case CLDAPServerPropDialog::cmd_OKButton: { - - mServersDirty = true; // flag that we need to write out prefs - - SDialogResponse* theResponse = (SDialogResponse*) ioParam; - Assert_ ( theResponse ); - CLDAPServerPropDialog* dialog = (CLDAPServerPropDialog*) theResponse->dialogBox; - Assert_ ( dialog ); - - // initialize some stuff for updating the server list - STableCell currentCell; - currentCell = mServerTable->GetFirstSelectedCell(); - if (!currentCell.row) // We want to add new servers at the end of the list - { // if there is no current selection. - TableIndexT rows, cols; - mServerTable->GetTableSize(rows, cols); - currentCell.row = rows; - } - - Uint32 cellDataSize = sizeof(CellContents); - DIR_Server* newServer = dialog->GetServer(); - if ( dialog->IsEditingNewServer() ) { - CellContents cell; - - // add the new server - LStr255 tempDescription(newServer->description); - LString::CopyPStr(tempDescription, cell.description); - cell.serverData = newServer; - mServerTable->InsertRows(1, currentCell.row, &cell, cellDataSize, true); - } - else { - CellContents cell; - - // delete the old one... - mServerTable->GetCellData(currentCell, &cell, cellDataSize); - DIR_DeleteServer(cell.serverData); - - // ...then add the new one - cell.description = newServer->description; - cell.serverData = newServer; - mServerTable->SetCellData(currentCell, &cell, cellDataSize); - } - UpdateButtons(); - delete dialog; - break; - } - - default: - LCommander::ObeyCommand( inCommand, ioParam ); - - } // switch on command - - return true; - -} // ObeyCommand - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - Inherited::LoadMainPane(); - mServersLocked = PREF_PrefIsLocked("ldap_1.number_of_directories"); -} // LoadMainPane - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::LoadList() -//---------------------------------------------------------------------------------------- -{ - ClearList(); - XP_List *directories = CAddressBookManager::GetDirServerList(); - if (XP_ListCount(directories)) - { - DIR_Server *server; - #pragma warn_possunwant off - while (server = (DIR_Server *)XP_ListNextObject(directories)) - #pragma warn_possunwant reset - { - if (server->description) - { - LStr255 description(server->description); - CellContents cell; - LString::CopyPStr(description, cell.description); - cell.serverData = (DIR_Server *)XP_ALLOC(sizeof(DIR_Server)); - DIR_InitServer(cell.serverData); - DIR_CopyServer(server, &cell.serverData); - TableIndexT rows, columns; - mServerTable->GetTableSize(rows, columns); - mServerTable->InsertRows(1, rows, &cell, sizeof(CellContents), false); - } - } - } -} - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::WriteList() -//---------------------------------------------------------------------------------------- -{ - if (mServersDirty) - { - XP_List *xpList = XP_ListNew(); - TableIndexT rows; - STableCell cellLocation; - mServerTable->GetTableSize(rows, cellLocation.col); - for (TableIndexT i = 1; i <= rows; ++i) - { - CellContents cell; - Uint32 cellSize = sizeof(cell); // it's an io parameter! jrm 97/03/19 - cellLocation.row = i; - mServerTable->GetCellData(cellLocation, &cell, cellSize); - XP_ASSERT(sizeof(cell) == cellSize); - XP_ListAddObjectToEnd(xpList, cell.serverData); - } - CAddressBookManager::SetDirServerList(xpList); // The CAddressBookMediator will - // even write out the prefs for us. - if (mDeletedServerList) - DIR_CleanUpServerPreferences(mDeletedServerList); // this call now owns the list - } -} // CMailNewsDirectoryMediator::WriteList - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ - LoadList(); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsDirectoryMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -{ - WriteList(); -} - -enum -{ - eUnreadOnlyBox = 13701, - eByDateBox, - eIncrementRButton, - eIncrementMenu, - eDaysRButton, - eDaysEditField, - eSelectMessageButton -// eSelectMessageFolderPopup -}; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -COfflineNewsMediator::COfflineNewsMediator(LStream*) -//---------------------------------------------------------------------------------------- -: CPrefsMediator(class_ID) -{ -} - -//---------------------------------------------------------------------------------------- -// static -Boolean COfflineNewsMediator::SinceDaysValidationFunc(CValidEditField *sinceDays) -//---------------------------------------------------------------------------------------- -{ - // If the checkbox or radio button isn't set then this value is really - // ignored, so I will only put up the alert if the checkbox - // is set, but I will force a valid value in any case. - - Boolean result = true; - - // force valid value - if (1 > sinceDays->GetValue()) - { - int32 newInterval = 30; - PREF_GetDefaultIntPref("offline.news.download.days", &newInterval); - sinceDays->SetValue(newInterval); - sinceDays->SelectAll(); - result = false; - } - if (!result) // if the value is within the range, who cares - { - // Check for the check box and radio button... - // We are assuming that the checkbox and radio button are subs of the - // field's superview. - LView *superView = sinceDays->GetSuperView(); - XP_ASSERT(superView); - LGACheckbox *checkbox = - (LGACheckbox *)superView->FindPaneByID(eByDateBox); - XP_ASSERT(checkbox); - LGARadioButton *radioButton = - (LGARadioButton *)superView->FindPaneByID(eDaysRButton); - XP_ASSERT(radioButton); - if (checkbox->GetValue() && radioButton->GetValue()) - { - StPrepareForDialog prepare; - ::StopAlert(1067, NULL); - } - else - { - result = true; // go ahead and let them switch (after correcting the value) - // if either the checkbox or radio button isn't set - } - } - return result; -} // COfflineNewsMediator::SinceDaysValidationFunc - -//---------------------------------------------------------------------------------------- -void COfflineNewsMediator::LoadMainPane() -//---------------------------------------------------------------------------------------- -{ - CPrefsMediator::LoadMainPane(); - SetValidationFunction(eDaysEditField, SinceDaysValidationFunc); -} - -//---------------------------------------------------------------------------------------- -//void COfflineNewsMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -//{ -// CSelectFolderMenu* selectPopup = -// (CSelectFolderMenu*)FindPaneByID(eSelectMessageFolderPopup); -// XP_ASSERT(selectPopup); -// selectPopup->CommitCurrentSelections(); -//} - -//---------------------------------------------------------------------------------------- -void COfflineNewsMediator::ListenToMessage(MessageT inMessage, void *ioParam) -//---------------------------------------------------------------------------------------- -{ - switch (inMessage) - { - case eSelectMessageButton: - COfflinePickerWindow::DisplayDialog(); - break; - - default: - Inherited::ListenToMessage(inMessage, ioParam); - break; - } -} - -#pragma mark - - -//---------------------------------------------------------------------------------------- -void CMailNewsAddressingMediator::LoadPrefs() -//---------------------------------------------------------------------------------------- -{ - - // Build popup menu and data - LGAPopup* popup = dynamic_cast(FindPaneByID( eDirectoryPopup ) ); - Assert_( popup ); - MenuHandle menu = popup->GetMacMenuH(); - mLDAPList = XP_ListNew(); - XP_List *directories = CAddressBookManager::GetDirServerList(); - - DIR_GetLdapServers( directories, mLDAPList ) ; - int16 selected = 0; - int32 i = 0; - if (XP_ListCount(mLDAPList)) - { - DIR_Server *server; - XP_List* listIterator = mLDAPList; - while ( (server = (DIR_Server *)XP_ListNextObject(listIterator) ) != 0 ) - { - - CStr255 description(server->description); - - Int16 index = UMenuUtils::AppendMenuItem( menu, description, true); - if( DIR_TestFlag( server, DIR_AUTO_COMPLETE_ENABLED) ) - selected = index; - } - } - popup->SetPopupMinMaxValues(); - popup->SetValue( selected ); -} - -//---------------------------------------------------------------------------------------- -void CMailNewsAddressingMediator::WritePrefs() -//---------------------------------------------------------------------------------------- -{ - LGAPopup* popup = dynamic_cast(FindPaneByID( eDirectoryPopup )); - Int32 index = popup->GetValue(); - DIR_Server* server = (DIR_Server*)XP_ListGetObjectNum( mLDAPList, index ); - if ( server ) - DIR_SetAutoCompleteEnabled( mLDAPList, server, true ); -} -#endif // MOZ_MAIL_NEWS diff --git a/mozilla/cmd/macfe/prefs/MailNewsMediators.h b/mozilla/cmd/macfe/prefs/MailNewsMediators.h deleted file mode 100644 index 61880060895..00000000000 --- a/mozilla/cmd/macfe/prefs/MailNewsMediators.h +++ /dev/null @@ -1,469 +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. - */ - -#pragma once - -#include "CPrefsMediator.h" - -#include "MPreference.h" -#include "UNewFolderDialog.h" - -#include - -class CTSMEditField; -class LGACheckbox; -class MSG_IMAPHost; -class MSG_Host; -class CDragOrderTextList; -class StDialogHandler; - - -//====================================== -#pragma mark -class CMailNewsIdentityMediator : public CPrefsMediator -//====================================== -{ - private: - typedef CPrefsMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_Identity }; - CMailNewsIdentityMediator(LStream*); - virtual ~CMailNewsIdentityMediator() {}; - - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - - virtual void UpdateFromIC(); - - virtual void LoadPrefs(); -}; - -#ifdef MOZ_MAIL_NEWS - -//====================================== -#pragma mark -class CMailNewsMessagesMediator : public CPrefsMediator -//====================================== -{ - private: - typedef CPrefsMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_Messages }; - CMailNewsMessagesMediator(LStream*); - virtual ~CMailNewsMessagesMediator() {} - - virtual void LoadMainPane(); - - static Boolean WrapLinesValidationFunc(CValidEditField *wrapLines); -}; - -//====================================== -#pragma mark -class CMailNewsOutgoingMediator : public CPrefsMediator -//====================================== -{ - private: - typedef CPrefsMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_Outgoing }; - CMailNewsOutgoingMediator(LStream*); - virtual ~CMailNewsOutgoingMediator(); - virtual void LoadPrefs(); - virtual void WritePrefs(); - virtual void ListenToMessage(MessageT inMessage, void* ioParam); - protected: - void FixCaptionNameForFCC(UFolderDialogs::FolderKind kind, const char* mailOrNews); - void FixCaptionNameForFCC(UFolderDialogs::FolderKind kind, const char* mailOrNews, - Boolean onServer); - - protected: - char* mFolderURL[UFolderDialogs::num_kinds]; - // indexed by UFolderDialogs::FolderKind -#ifdef HORRIBLE_HACK - Boolean mFolderIsDefault[UFolderDialogs::num_kinds]; // HACK -#endif // HORRIBLE_HACK -}; // class CMailNewsOutgoingMediator - -//====================================== -#pragma mark -class MServerListMediatorMixin -// Common code for a pane containing a list of servers -//====================================== -{ -protected: - MServerListMediatorMixin(CPrefsMediator* inMediatorSelf) - : mMediatorSelf(inMediatorSelf) - , mServerTable(nil) - , mServersLocked(false) - , mServersDirty(false) - {} - - // note that if you add members to this in inheriting classes, - // you need to change the constructor resources to increase the - // list data size - struct CellContents - { - CellContents(const char* inName = nil) - : description(inName) {} - - CStr255 description; - }; - - Boolean GetHostFromRow( - TableIndexT inRow, - CellContents& outCellData, - UInt32 inDataSize) const; - Boolean GetHostFromSelectedRow( - CellContents& outCellData, - UInt32 inDataSize) const; - Boolean HostExistsElsewhereInTable( - const CStr255& inHostName, - TableIndexT &outFoundRow) const; - void SetHostDataForRow( - TableIndexT inRow, - const CellContents& inCellData, - UInt32 inDataSize) const; - void AppendNewRow( - const CellContents &inCellData, - Uint32 inDataSize, - Boolean inRefresh = true); - void DeleteSelectedRow( - Boolean inRefresh = true); - void UpdateSelectedRow( - const CellContents &inCellData, - Uint32 inDataSize, - Boolean inRefresh = true); - - virtual TableIndexT CountRows(); - virtual void UpdateButtons(); - virtual void AddButton() = 0; - virtual void EditButton() = 0; - virtual void DeleteButton() = 0; - void ClearList(); - virtual void LoadList() = 0; - virtual void WriteList() = 0; - virtual Boolean Listen(MessageT inMessage, void *ioParam); - void LoadMainPane(); - - static Boolean ServerIsInCommaSeparatedList(const char *inServerName, const char *inServerList); - - CPrefsMediator* mMediatorSelf; - CDragOrderTextList* mServerTable; - Boolean mServersLocked; - Boolean mServersDirty; -}; // class MServerListMediatorMixin - -//====================================== -#pragma mark -class CServerListMediator -//====================================== -: public CPrefsMediator -, public MServerListMediatorMixin -{ - public: - CServerListMediator(PaneIDT inMainPaneID); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - virtual void LoadMainPane(); -}; - -//====================================== -#pragma mark -class CMailNewsMailServerMediator -//====================================== -: public CServerListMediator -{ - private: - typedef CServerListMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_MailServer }; - CMailNewsMailServerMediator(LStream*); - virtual ~CMailNewsMailServerMediator(); - - virtual void UpdateFromIC(); - virtual void LoadMainPane(); - virtual void LoadPrefs(); - virtual void WritePrefs(); - - static Boolean NoAtSignValidationFunc(CValidEditField *noAtSign); - static Boolean ValidateServerName(const CStr255& inServerName, Boolean inNewServer, const CServerListMediator* inServerList); - - private: - enum ServerType - { - eUnknownServerType = -1, - ePOPServer = 0, - eIMAPServer = 1 - }; - Boolean UsingPop() const; // Hope this goes away. - void NoteServerChanges(Boolean inPOP, const CStr255& inServerName); - void SetPOPServerName(const CStr255& inName); - void GetPOPServerName(CStr255& outName) const; - - // MServerListMediatorMixin overrides - struct CellContents : public MServerListMediatorMixin::CellContents - { - CellContents() {} - CellContents(const char* inName) - : MServerListMediatorMixin::CellContents(inName) {} - }; - virtual void AddButton(); - virtual void EditButton(); - virtual void DeleteButton(); - virtual void LoadList(); - virtual void WriteList(); - - // Data - protected: - ServerType mServerType; -#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF - char* mPopServerName; -#endif -}; // class CMailNewsMailServerMediator - -//====================================== -#pragma mark -class CMailNewsNewsServerMediator -//====================================== -: public CServerListMediator -{ - private: - typedef CServerListMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_NewsServer }; - CMailNewsNewsServerMediator(LStream*); - virtual ~CMailNewsNewsServerMediator() {}; - - virtual void UpdateFromIC(); - virtual void LoadPrefs(); - virtual void WritePrefs(); - static Boolean PortNumberValidationFunc(CValidEditField *portNumber); - - // MServerListMediatorMixin overrides - struct CellContents : public MServerListMediatorMixin::CellContents - { - CellContents() {} - CellContents(const char* inName, MSG_Host* inHost) - : MServerListMediatorMixin::CellContents(inName) - , serverData(inHost) {} - MSG_Host* serverData; - }; - virtual void AddButton(); - virtual void EditButton(); - virtual void DeleteButton(); - virtual void LoadList(); - virtual void WriteList(); - - enum - { - eNNTPStandardPort = 119, - eNNTPSecurePort = 563 - }; - - private: - Boolean mNewsServerPortLocked; -}; // class CMailNewsNewsServerMediator - -struct DIR_Server; -class LTextColumn; -//====================================== -#pragma mark -class CMailNewsDirectoryMediator -//====================================== -: public CServerListMediator -{ - private: - typedef CServerListMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_Directory }; - CMailNewsDirectoryMediator(LStream*); - virtual ~CMailNewsDirectoryMediator() {}; - - virtual void LoadMainPane(); - virtual void LoadPrefs(); - virtual void WritePrefs(); - - virtual Boolean ObeyCommand ( CommandT inCommand, void* ioParam ); - - private: - // MServerListMediatorMixin overrides - virtual void AddButton(); - virtual void EditButton(); - virtual void DeleteButton(); - virtual void LoadList(); // only call this once, on creating the list for the first time - virtual void WriteList(); - - virtual void UpdateButtons(); - Boolean IsPABServerSelected(LTextColumn *serverTable = nil); - Boolean IsPABServerSelected(DIR_Server *server); - struct CellContents : public MServerListMediatorMixin::CellContents - { - CellContents(const char* inName = nil) - : MServerListMediatorMixin::CellContents(inName) - , serverData(nil) {} - DIR_Server *serverData; - }; - XP_List *mDeletedServerList; -}; // class CMailNewsDirectoryMediator - -//====================================== -#pragma mark -class COfflineNewsMediator : public CPrefsMediator -//====================================== -{ - private: - typedef CPrefsMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eOffline_News }; - COfflineNewsMediator(LStream*); - virtual ~COfflineNewsMediator() {}; - - virtual void LoadMainPane(); -// virtual void WritePrefs(); - virtual void ListenToMessage( - MessageT inMessage, - void *ioParam); - - static Boolean SinceDaysValidationFunc(CValidEditField *sinceDays); -}; // class COfflineNewsMediator - -#ifdef MOZ_MAIL_NEWS -//====================================== -#pragma mark -class CMailNewsAddressingMediator -//====================================== -: public CPrefsMediator -{ - private: - typedef CPrefsMediator Inherited; - - public: - - enum { class_ID = PrefPaneID::eMailNews_Addressing, eDirectoryPopup = 'DrPu' }; - - CMailNewsAddressingMediator(LStream* ): CPrefsMediator( class_ID ), mLDAPList(NULL) {}; - - virtual ~CMailNewsAddressingMediator() - { - if( mLDAPList ) - XP_ListDestroy( mLDAPList ); - }; - virtual void LoadPrefs(); - virtual void WritePrefs(); - protected: - XP_List* mLDAPList; -}; -#endif // MOZ_MAIL_NEWS - - -//====================================== -class CLDAPServerPropDialog : public LGADialogBox -// This class brings up a dialog for editing the LDAP Server properties (duh). This has -// to be a derivative of LGADialogBox and not just a normal stack-based dialog because -// we want NetHelp to actually get the message to load the help URL while the dialog is up, -// not after you close it, and the stack-based dialogs never returned to the event loop -// to allow the url processing. -// -// The dialog passes the OK/Cancel messages through to the preference pane so the pane can -// handle doing the right thing and close out the dialog. They should be handled in -// ObeyCommand() -//====================================== -{ - typedef LGADialogBox Inherited; - - public: - - // PUBLIC CONSTANTS - - enum { - class_ID = 'LDSP', - eLDAPServerPropertiesDialogResID = 12002, - cmd_OKButton = -128, - cmd_CancelButton = -129, - cmd_HelpButton = 3 - }; - - enum { eEditServer = false, eNewServer = true } ; - - // PUBLIC METHODS - - CLDAPServerPropDialog ( LStream* inStream ); - virtual ~CLDAPServerPropDialog() ; - - virtual void FinishCreateSelf(); - virtual void ListenToMessage ( MessageT inMessage, void* ioParam ); - - void SetUpDialog( DIR_Server* inServer, Boolean inNew, Boolean inIsPAB, - Boolean inIsAllLocked ); - DIR_Server* GetServer ( ) { return mServer; } ; - Boolean IsEditingNewServer ( ) { return mNewServer; } ; - - protected: - - // Port ID's - enum { - eLDAPStandardPort = 389, - eLDAPSecurePort = 636 - }; - - // Pane ID's for dialog - enum { - eDescriptionEditField = 10, - eLDAPServerEditField, - eSearchRootEditField, - ePortNumberEditField, - eMaxHitsEditField, - eSecureBox = 20, - eSaveLDAPServerPasswordBox = 21, - eUpdateButton = 22, - eDownloadCheckBox = 23 - }; - - static Boolean MaxHitsValidationFunc(CValidEditField *maxHits) ; - static Boolean PortNumberValidationFunc(CValidEditField *portNumber) ; - - const char* mHelpTopic; // help string for NetHelp - DIR_Server* mServer; // the LDAP server - Boolean mNewServer; // true if a new entry, false if editing existing - Boolean mIsPAB; // ??? - - CTSMEditField* mDescription; // Items in dialog - LEditField* mLdapServer; - LEditField* mSearchRoot; - CValidEditField* mPortNumber; - CValidEditField* mMaxHits; - LGACheckbox* mSecureBox; - LGACheckbox* mSavePasswordBox; - LGACheckbox* mDownloadCheckBox; - -}; // class CLDAPServerPropDialog - -#endif // MOZ_MAIL_NEWS - \ No newline at end of file diff --git a/mozilla/cmd/macfe/prefs/MailNewsPrefPanes.cnst b/mozilla/cmd/macfe/prefs/MailNewsPrefPanes.cnst deleted file mode 100644 index c6da6774d8e..00000000000 Binary files a/mozilla/cmd/macfe/prefs/MailNewsPrefPanes.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/prefs/PrefsPaneIDs.h b/mozilla/cmd/macfe/prefs/PrefsPaneIDs.h deleted file mode 100644 index 021fa7a4bf8..00000000000 --- a/mozilla/cmd/macfe/prefs/PrefsPaneIDs.h +++ /dev/null @@ -1,83 +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. - */ - -#pragma once - -//====================================== -struct PrefPaneID -// Here are the IDs of the prefs panes. -// These ID's are used for -// (1) the class ID for the pane's mediator (used for creation of the mediator by URegistrar) -// (2) the resID of the pane, (used for reanimation of the pane) -// (3) the command that is stored in the menu that defines the prefs structure. -// For a given prefs pane, the code assumes that these numbers are all the same (and in the range -// 12000-12099. 99 panes should be enough. - -// The ordering is entirely determined from the menu hierarchy. In particular, unlike 4.0, -// you no longer have to follow a consecutive number scheme, with min and max ranges. -//====================================== -{ - enum ID { - eNoPaneSpecified = 0 // used in calls to DoPrefsWindow() - , eWindowPPob = 12000 - - , eAppearance_Main = 12050 - , eAppearance_Fonts = 12051 - , eAppearance_Colors = 12052 - - , eBrowser_Main = 12053 - , eBrowser_Languages = 12054 - , eBrowser_Applications = 12055 - - , eMailNews_Identity = 12057 - // Leave this in for Navigator only build to get email addr pref - , eMailNews_Main = 12056 - #ifdef MOZ_MAIL_NEWS - , eMailNews_Messages = 12058 - , eMailNews_HTMLFormatting = 12072 - , eMailNews_Outgoing = 12073 - , eMailNews_MailServer = 12059 - , eMailNews_NewsServer = 12060 - , eMailNews_Directory = 12061 - , eMailNews_Receipts = 12070 - , eMailNews_Addressing = 12071 - #endif // MOZ_MAIL_NEWS - - #ifdef EDITOR - , eEditor_Main = 12062 - , eEditor_Publish = 12063 - #endif // EDITOR - #ifdef MOZ_LOC_INDEP - , eLocationIndependence = 12074 - , eLocationIndependence_Server = 12075 - , eLocationIndependence_File = 12076 //<-¥¥¥ Current max. Please move as nec.! - #endif // MOZ_LOC_INDEP - - #ifdef MOZ_MAIL_NEWS - , eOffline_Main = 12064 - , eOffline_News = 12065 - #endif // MOZ_MAIL_NEWS - - , eAdvanced_Main = 12066 - , eAdvanced_Cache = 12067 - , eAdvanced_Proxies = 12068 - #ifdef MOZ_MAIL_NEWS - , eAdvanced_DiskSpace = 12069 - #endif // MOZ_MAIL_NEWS - }; -}; diff --git a/mozilla/cmd/macfe/prefs/PrefsPanes.cnst b/mozilla/cmd/macfe/prefs/PrefsPanes.cnst deleted file mode 100644 index aab438c74e9..00000000000 Binary files a/mozilla/cmd/macfe/prefs/PrefsPanes.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/projects/BuildList b/mozilla/cmd/macfe/projects/BuildList deleted file mode 100644 index 77a91c4ba84..00000000000 Binary files a/mozilla/cmd/macfe/projects/BuildList and /dev/null differ diff --git a/mozilla/cmd/macfe/projects/client/BuildMozPPCDebugList.txt b/mozilla/cmd/macfe/projects/client/BuildMozPPCDebugList.txt deleted file mode 100644 index c277964412a..00000000000 --- a/mozilla/cmd/macfe/projects/client/BuildMozPPCDebugList.txt +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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. -# - -DOLIBALIASES -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "Stub Library" -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "Stub Library" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Stub Library" - -:mozilla:lib:mac:NSRuntime:NSRuntime.mcp -:mozilla:cmd:macfe:restext:NavStringLibPPC.mcp -:mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.prj -:mozilla:nsprpub:macbuild:NSPR20PPCDebug.mcp -:mozilla:dbm:macbuild:DBMPPCDebug.mcp -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "PPC Shared Library (Debug)" -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "PPC Shared Library" -:mozilla:modules:security:freenav:macbuild:NoSecurity.mcp "PPC Shared Library (Debug)" -:mozilla:xpcom:macbuild:xpcomPPCDebug.mcp -:mozilla:lib:mac:PowerPlant:PowerPlant.mcp -:mozilla:modules:zlib:macbuild:zlib.mcp "PPC Shared Library (Debug)" -:mozilla:jpeg:macbuild:JPEG.mcp "PPC Shared Library (Debug)" -:mozilla:sun-java:stubs:macbuild:JavaStubs.mcp "PPC Shared Library (Debug)" -:mozilla:js:jsj:macbuild:JSJ_PPCDebug.mcp -:mozilla:js:macbuild:JavaScriptPPCDebug.mcp -:mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp "PPC Shared Library (Debug)" -:mozilla:modules:rdf:macbuild:RDF.mcp "PPC Shared Library +D -LDAP" -:mozilla:modules:xml:macbuild:XML.mcp "PPC Shared Library (Debug)" -:mozilla:modules:libfont:macbuild:FontBroker.mcp "PPC Library (Debug)" -:mozilla:modules:schedulr:macbuild:Schedulr.mcp "PPC Shared Library (Debug)" -:mozilla:network:macbuild:network.mcp "PPC Library (Debug Moz)" -:mozilla:cmd:macfe:Composer:build:Composer.mcp "PPC Library (Debug)" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Moz PPC App (Debug)" - diff --git a/mozilla/cmd/macfe/projects/client/BuildMozPPCList.txt b/mozilla/cmd/macfe/projects/client/BuildMozPPCList.txt deleted file mode 100644 index 991b92a3bdd..00000000000 --- a/mozilla/cmd/macfe/projects/client/BuildMozPPCList.txt +++ /dev/null @@ -1,47 +0,0 @@ -# -# 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. -# - -NOLIBALIASES -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "Stub Library" -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "Stub Library" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Stub Library" - -:mozilla:lib:mac:NSRuntime:NSRuntime.mcp -:mozilla:cmd:macfe:restext:NavStringLibPPC.mcp -:mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.prj -:mozilla:nsprpub:macbuild:NSPR20PPC.mcp -:mozilla:dbm:macbuild:DBMPPC.mcp -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "PPC Shared Library" -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "PPC Shared Library" -:mozilla:modules:security:freenav:macbuild:NoSecurity.mcp "PPC Shared Library" -:mozilla:xpcom:macbuild:xpcomPPC.mcp -:mozilla:lib:mac:PowerPlant:PowerPlant.mcp -:mozilla:modules:zlib:macbuild:zlib.mcp "PPC Shared Library" -:mozilla:jpeg:macbuild:JPEG.mcp "PPC Shared Library" -:mozilla:sun-java:stubs:macbuild:JavaStubs.mcp "PPC Shared Library" -:mozilla:js:jsj:macbuild:JSJ_PPC.mcp -:mozilla:js:macbuild:JavaScriptPPC.mcp -:mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp "PPC Shared Library" -:mozilla:modules:rdf:macbuild:RDF.mcp "PPC Shared Library -LDAP" -:mozilla:modules:xml:macbuild:XML.mcp "PPC Shared Library" -:mozilla:modules:libfont:macbuild:FontBroker.mcp "PPC Library" -:mozilla:modules:schedulr:macbuild:Schedulr.mcp "PPC Shared Library" -:mozilla:network:macbuild:network.mcp "PPC Library (Moz)" -:mozilla:cmd:macfe:Composer:build:Composer.mcp "PPC Library" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Moz PPC App" - - diff --git a/mozilla/cmd/macfe/projects/client/BuildNavPPCDebugList.txt b/mozilla/cmd/macfe/projects/client/BuildNavPPCDebugList.txt deleted file mode 100644 index a2531bc5ed1..00000000000 --- a/mozilla/cmd/macfe/projects/client/BuildNavPPCDebugList.txt +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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. -# - -DOLIBALIASES -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "Stub Library" -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "Stub Library" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Stub Library" - -:mozilla:lib:mac:NSRuntime:NSRuntime.mcp -:mozilla:cmd:macfe:restext:NavStringLibPPC.mcp -:mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.prj -:mozilla:nsprpub:macbuild:NSPR20PPCDebug.mcp -:mozilla:dbm:macbuild:DBMPPCDebug.mcp -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "PPC Shared Library (Debug)" -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "PPC Shared Library" -:mozilla:modules:security:freenav:macbuild:NoSecurity.mcp "PPC Shared Library (Debug)" -:mozilla:xpcom:macbuild:xpcomPPCDebug.mcp -:mozilla:lib:mac:PowerPlant:PowerPlant.mcp -:mozilla:modules:zlib:macbuild:zlib.mcp "PPC Shared Library (Debug)" -:mozilla:jpeg:macbuild:JPEG.mcp "PPC Shared Library (Debug)" -:mozilla:sun-java:stubs:macbuild:JavaStubs.mcp "PPC Shared Library (Debug)" -:mozilla:js:jsj:macbuild:JSJ_PPCDebug.mcp -:mozilla:js:macbuild:JavaScriptPPCDebug.mcp -:mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp "PPC Shared Library (Debug)" -:mozilla:modules:rdf:macbuild:RDF.mcp "PPC Shared Library +D -LDAP" -:mozilla:modules:xml:macbuild:XML.mcp "PPC Shared Library (Debug)" -:mozilla:modules:libfont:macbuild:FontBroker.mcp "PPC Library (Debug)" -:mozilla:modules:schedulr:macbuild:Schedulr.mcp "PPC Shared Library (Debug)" -:mozilla:network:macbuild:network.mcp "PPC Library (Debug Comm)" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Nav PPC App (Debug)" - diff --git a/mozilla/cmd/macfe/projects/client/BuildNavPPCList.txt b/mozilla/cmd/macfe/projects/client/BuildNavPPCList.txt deleted file mode 100644 index 49f493c37df..00000000000 --- a/mozilla/cmd/macfe/projects/client/BuildNavPPCList.txt +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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. -# - -DOLIBALIASES -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "Stub Library" -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "Stub Library" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Stub Library" - -:mozilla:lib:mac:NSRuntime:NSRuntime.mcp -:mozilla:cmd:macfe:restext:NavStringLibPPC.mcp -:mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.prj -:mozilla:nsprpub:macbuild:NSPR20PPC.mcp -:mozilla:dbm:macbuild:DBMPPC.mcp -:mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp "PPC Shared Library" -:mozilla:lib:mac:NSStdLib:NSStdLib.mcp "PPC Shared Library" -:mozilla:modules:security:freenav:macbuild:NoSecurity.mcp "PPC Shared Library" -:mozilla:xpcom:macbuild:xpcomPPC.mcp -:mozilla:lib:mac:PowerPlant:PowerPlant.mcp -:mozilla:modules:zlib:macbuild:zlib.mcp "PPC Shared Library" -:mozilla:jpeg:macbuild:JPEG.mcp "PPC Shared Library" -:mozilla:sun-java:stubs:macbuild:JavaStubs.mcp "PPC Shared Library" -:mozilla:js:jsj:macbuild:JSJ_PPC.mcp -:mozilla:js:macbuild:JavaScriptPPC.mcp -:mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp "PPC Shared Library" -:mozilla:modules:rdf:macbuild:RDF.mcp "PPC Shared Library -LDAP" -:mozilla:modules:xml:macbuild:XML.mcp "PPC Shared Library" -:mozilla:modules:libfont:macbuild:FontBroker.mcp "PPC Library" -:mozilla:modules:schedulr:macbuild:Schedulr.mcp "PPC Shared Library" -:mozilla:network:macbuild:network.mcp "PPC Library (Comm)" -:mozilla:cmd:macfe:projects:client:Navigator.mcp "Nav PPC App" diff --git a/mozilla/cmd/macfe/projects/client/Client.mcp b/mozilla/cmd/macfe/projects/client/Client.mcp deleted file mode 100644 index beb08e7925d..00000000000 Binary files a/mozilla/cmd/macfe/projects/client/Client.mcp and /dev/null differ diff --git a/mozilla/cmd/macfe/projects/client/Navigator.exp b/mozilla/cmd/macfe/projects/client/Navigator.exp deleted file mode 100644 index 2fe79fbbd27..00000000000 --- a/mozilla/cmd/macfe/projects/client/Navigator.exp +++ /dev/null @@ -1,15205 +0,0 @@ -### -### This file was generated by AnnotateExports (Monday, June 8, 1998 2:12:45 AM) from client.mcp.exp. -### -### [Un-]Comment-out (do not delete) symbols and annotate with #{code} and #{data} to control export. -### When brand new signatures are to be exported, regenerate this file as described in AnnotateExports. -### Warning: all comments MUST start in the left column, or else stubs will be built wrong. -### - - -### -### Symbols you may have to hand annotate with #{code} or #{data}... -### - -# AECopySubDescData -# AECountSubDescItems -# AEDescToSubDesc -# AEGetKeySubDesc -# AEGetNthSubDesc -# AEGetSubDescBasicType -# AEGetSubDescData -# AEGetSubDescType -# AEStream_Close -# AEStream_CloseDesc -# AEStream_CloseList -# AEStream_CloseRecord -# AEStream_CreateEvent -# AEStream_Open -# AEStream_OpenDesc -# AEStream_OpenEvent -# AEStream_OpenKeyDesc -# AEStream_OpenList -# AEStream_OpenRecord -# AEStream_OptionalParam -# AEStream_SetRecordType -# AEStream_WriteAEDesc -# AEStream_WriteData -# AEStream_WriteDesc -# AEStream_WriteKey -# AEStream_WriteKeyDesc -# AESubDescIsListOrRecord -# AESubDescToDesc -# ATOB_AsciiToData -# ATOB_Begin -# ATOB_ConvertAsciiToItem -# ATOB_DestroyContext -# ATOB_End -# ATOB_NewContext -# ATOB_Update -# AddNicknameToPermCert -# AddTempCertToSubjectList -# AddToList -# BTOA_Begin -# BTOA_ConvertItemToAscii -# BTOA_DataToAscii -# BTOA_DestroyContext -# BTOA_End -# BTOA_GetLength -# BTOA_NewContext -# BTOA_Update -# BVal_clear -# BVal_initialized -# BVal_readVal -# BVal_set -# BVal_value -# BannerInsecure -# BannerMixed -# BannerSecure -# CACHE_CloseAllOpenSARCache -CACHE_CloseCache -CACHE_EmptyCache -CACHE_FindURLInCache -CACHE_FlushCache -CACHE_GetCache -CACHE_GetCachePath -CACHE_GetCacheStruct -CACHE_GetManagedCacheList -# CACHE_OpenAllSARCache -CACHE_Put -CACHE_RemoveCache -# CACHE_SaveCacheInfoToDB -CACHE_UpdateCache -# CERTAltNameTemplate -# CERTAuthKeyIDTemplate -# CERTCRLDistributionPointsTemplate -# CERTSignedDataTemplate -# CERTValidityTemplate -# CERT_AddAVA -# CERT_AddCertToList -# CERT_AddExtension -# CERT_AddExtensionByOID -# CERT_AddNameConstraint -# CERT_AddNewCerts -# CERT_AddPermNickname -# CERT_AddRDN -# CERT_AddTempCertToPerm -# CERT_AsciiToName -# CERT_AttributeTemplate -# CERT_CertChainFromCert -# CERT_CertExtensionTemplate -# CERT_CertKeyTemplate -# CERT_CertPackageType -# CERT_CertTimesValid -# CERT_CertificatePoliciesTemplate -# CERT_CertificateRequestTemplate -# CERT_CertificateTemplate -# CERT_ChangeCertTrust -# CERT_ChangeCertTrustByUsage -# CERT_CheckCertUsage -# CERT_CheckCertValidTimes -# CERT_CheckForEvilCert -# CERT_ClosePermCertDB -# CERT_CompareAVA -# CERT_CompareCerts -# CERT_CompareCertsForRedirection -# CERT_CompareName -# CERT_CompareNameSpace -# CERT_CompareRDN -# CERT_ConvertAndDecodeCertificate -# CERT_CopyAVA -# CERT_CopyGeneralName -# CERT_CopyName -# CERT_CopyNameConstraint -# CERT_CopyRDN -# CERT_CopyValidity -# CERT_CreateAVA -# CERT_CreateCertificate -# CERT_CreateCertificateRequest -# CERT_CreateName -# CERT_CreateRDN -# CERT_CreateValidity -# CERT_CrlTemplate -# CERT_DecodeAVAValue -# CERT_DecodeAltNameExtension -# CERT_DecodeAuthKeyID -# CERT_DecodeBasicConstraintValue -# CERT_DecodeCRLDistributionPoints -# CERT_DecodeCertFromPackage -# CERT_DecodeCertPackage -# CERT_DecodeCertificatePoliciesExtension -# CERT_DecodeDERCertificate -# CERT_DecodeDERCrl -# CERT_DecodeNameConstraintsExtension -# CERT_DecodeOidSequence -# CERT_DecodeTrustString -# CERT_DecodeUserNotice -# CERT_DeleteTempCertificate -# CERT_DestroyCertArray -# CERT_DestroyCertList -# CERT_DestroyCertificate -# CERT_DestroyCertificateList -# CERT_DestroyCertificatePoliciesExtension -# CERT_DestroyCertificateRequest -# CERT_DestroyCrl -# CERT_DestroyName -# CERT_DestroyOidSequence -# CERT_DestroyUserNotice -# CERT_DestroyValidity -# CERT_DistNamesFromNicknames -# CERT_DupCertificate -# CERT_EncodeAltNameExtension -# CERT_EncodeAndAddBitStrExtension -# CERT_EncodeAndAddExtension -# CERT_EncodeAuthKeyID -# CERT_EncodeBasicConstraintValue -# CERT_EncodeCRLDistributionPoints -# CERT_EncodeIA5TypeExtension -# CERT_EncodeNameConstraintsExtension -# CERT_EncodePublicKeyUsagePeriod -# CERT_EncodeSubjectKeyID -# CERT_EncodeTrustString -# CERT_ExtractPublicKey -# CERT_FindAuthKeyIDExten -# CERT_FindBasicConstraintExten -# CERT_FindBitStringExtension -# CERT_FindCRLDistributionPoints -# CERT_FindCRLExtension -# CERT_FindCRLExtensionByOID -# CERT_FindCRLNumberExten -# CERT_FindCRLReasonExten -# CERT_FindCertByDERCert -# CERT_FindCertByEmailAddr -# CERT_FindCertByIssuerAndSN -# CERT_FindCertByKey -# CERT_FindCertByKeyID -# CERT_FindCertByName -# CERT_FindCertByNameString -# CERT_FindCertByNickname -# CERT_FindCertByNicknameOrEmailAddr -# CERT_FindCertByUsage -# CERT_FindCertExtension -# CERT_FindCertExtensionByOID -# CERT_FindCertIssuer -# CERT_FindCertURLExtension -# CERT_FindExpiredIssuer -# CERT_FindInvalidDateExten -# CERT_FindIssuerCertExtension -# CERT_FindKeyUsageExtension -# CERT_FindNSCertTypeExtension -# CERT_FindNSStringExtension -# CERT_FindSMimeProfile -# CERT_FindSubjectKeyIDExten -# CERT_FinishExtensions -# CERT_FixupEmailAddr -# CERT_FormatName -# CERT_FreeDistNames -# CERT_FreeNicknames -# CERT_GenTime2FormattedAscii -# CERT_GeneralNameTemplate -# CERT_GetAVATag -# CERT_GetCertCommentString -# CERT_GetCertEmailAddress -# CERT_GetCertIssuerAndSN -# CERT_GetCertKeyType -# CERT_GetCertNicknames -# CERT_GetCertTimes -# CERT_GetCertTrust -# CERT_GetCertUid -# CERT_GetCertificateEmailAddress -# CERT_GetCertificateNames -# CERT_GetCommonName -# CERT_GetCountryName -# CERT_GetDBContentVersion -# CERT_GetDefaultCertDB -# CERT_GetExtenCriticality -# CERT_GetGeneralNameByType -# CERT_GetLocalityName -# CERT_GetNameConstriantByType -# CERT_GetNameElement -# CERT_GetNamesLength -# CERT_GetNickName -# CERT_GetOrgName -# CERT_GetOrgUnitName -# CERT_GetSSLCACerts -# CERT_GetStateName -# CERT_GovtApprovedBitSet -# CERT_HTMLCertInfo -# CERT_Hexify -# CERT_ImportCAChain -# CERT_ImportCRL -# CERT_ImportCerts -# CERT_InitCertDB -# CERT_IsCACert -# CERT_IsCertRevoked -# CERT_IsNewer -# CERT_IssuerAndSNTemplate -# CERT_KMIDPublicKey -# CERT_KeyFromDERCert -# CERT_KeyFromDERCrl -# CERT_KeyFromIssuerAndSN -# CERT_MakeCANickname -# CERT_MatchUserCert -# CERT_NameConstraintSubtreeExcludedTemplate -# CERT_NameConstraintSubtreePermitedTemplate -# CERT_NameConstraintSubtreeSubTemplate -# CERT_NameFromDERCert -# CERT_NameTemplate -# CERT_NameToAscii -# CERT_NewCertList -# CERT_NewTempCertificate -# CERT_NextSubjectCert -# CERT_NoticeReferenceTemplate -# CERT_NumCertsForCertSubject -# CERT_NumPermCertsForCertSubject -# CERT_NumPermCertsForNickname -# CERT_NumPermCertsForSubject -# CERT_OidSeqTemplate -# CERT_OpenCertDB -# CERT_OpenCertDBFilename -# CERT_OpenVolatileCertDB -# CERT_ParseRFC1485AVA -# CERT_PolicyInfoTemplate -# CERT_PolicyQualifierTemplate -# CERT_PrevSubjectCert -# CERT_PublicKeyAndChallengeTemplate -# CERT_RDNTemplate -# CERT_RFC1485_EscapeAndQuote -# CERT_SaveImportedCert -# CERT_SaveSMimeProfile -# CERT_SequenceOfCertExtensionTemplate -# CERT_SetCAPolicyStringCallback -# CERT_SetDBContentVersion -# CERT_SetDefaultCertDB -# CERT_SetOfAttributeTemplate -# CERT_SetOfSignedCrlTemplate -# CERT_SignedDataTemplate -# CERT_StartCRLExtensions -# CERT_StartCertExtensions -# CERT_SubjectPublicKeyInfoTemplate -# CERT_TraverseCertsForSubject -# CERT_TraversePermCertsForNickname -# CERT_TraversePermCertsForSubject -# CERT_UTCTime2FormattedAscii -# CERT_UserNoticeTemplate -# CERT_ValidityTemplate -# CERT_VerifyCert -# CERT_VerifyCertChain -# CERT_VerifyCertName -# CERT_VerifyCertNow -# CERT_VerifySignedData -# CEditTimerCallback -# CL_AddLayerToGroup -# CL_ChangeLayerFlag -CL_CompositeNow -# CL_DestroyCompositor -# CL_DestroyDrawable -# CL_DestroyLayer -# CL_DestroyLayerGroup -# CL_DestroyLayerTree -# CL_DispatchEvent -# CL_DocumentToWindowRect -# CL_FindLayer -# CL_ForEachChildOfLayer -# CL_ForEachLayerInGroup -# CL_ForEachRectCoveringRegion -# CL_GetCompositorDrawable -# CL_GetCompositorEnabled -# CL_GetCompositorFrameRate -CL_GetCompositorOffscreenDrawing -# CL_GetCompositorRoot -# CL_GetCompositorWindowSize -# CL_GetCompositorXOffset -# CL_GetCompositorYOffset -# CL_GetDrawableBgColor -# CL_GetDrawableClientData -# CL_GetKeyEventGrabber -# CL_GetLayerAbove -# CL_GetLayerBbox -# CL_GetLayerBboxAbsolute -# CL_GetLayerBelow -# CL_GetLayerChildByIndex -# CL_GetLayerChildByName -# CL_GetLayerChildCount -# CL_GetLayerClientData -CL_GetLayerCompositor -# CL_GetLayerFlags -# CL_GetLayerHidden -# CL_GetLayerName -# CL_GetLayerOpaque -# CL_GetLayerParent -# CL_GetLayerSiblingAbove -# CL_GetLayerSiblingBelow -# CL_GetLayerVTable -# CL_GetLayerXOffset -# CL_GetLayerXOrigin -# CL_GetLayerYOffset -# CL_GetLayerYOrigin -# CL_GetLayerZIndex -# CL_GrabKeyEvents -# CL_GrabMouseEvents -# CL_HideLayerGroup -# CL_IncrementCompositorGeneration -# CL_InsertChild -# CL_InsertChildByZ -# CL_IsKeyEventGrabber -# CL_IsMouseEventGrabber -# CL_LayerToWindowRect -# CL_LayerToWindowRegion -# CL_MoveLayer -# CL_NewCompositor -# CL_NewDrawable -# CL_NewLayer -# CL_OffsetLayer -# CL_OffsetLayerGroup -# CL_RefreshWindowRect -# CL_RefreshWindowRegion -# CL_RegionEntropy -# CL_RemoveChild -# CL_RemoveLayerFromGroup -# CL_ResizeCompositorWindow -# CL_ResizeLayer -# CL_ScrollCompositorWindow -# CL_SetCompositorDrawable -# CL_SetCompositorDrawingMethod -# CL_SetCompositorEnabled -# CL_SetCompositorFrameRate -CL_SetCompositorOffscreenDrawing -# CL_SetCompositorRoot -# CL_SetKeyboardFocusPolicy -# CL_SetLayerBbox -# CL_SetLayerClientData -# CL_SetLayerHidden -# CL_SetLayerName -# CL_SetLayerOpaque -# CL_SetLayerUniformColor -# CL_SetLayerVTable -# CL_UnhideLayerGroup -CL_UpdateDocumentRect -CL_UpdateLayerRect -# CL_UpdateLayerRegion -# CL_WindowToDocumentRect -# CL_WindowToLayerRect -# CL_WindowToLayerRegion -# CMP_AbsDifference -# CMP_Add -# CMP_AddCMPWord -# CMP_AddInPlace -# CMP_AddInTrace -# CMP_AppendWord -# CMP_BitLengthOfCMPInt -# CMP_CMPIntToFixedLenOctetStr -# CMP_CMPIntToOctetString -# CMP_CMPIntToSignedOctetString -# CMP_CMPWordModularReduce -# CMP_CMPWordToCMPInt -# CMP_ClearBit -# CMP_Compare -# CMP_ComputeExtendedGCD -# CMP_ComputeGCD -# CMP_ComputeLogOfTableSize -# CMP_ComputeMontCoeff -# CMP_Constructor -# CMP_ConvertFromMont -# CMP_ConvertToMont -# CMP_DestructExponentTable -# CMP_Destructor -# CMP_DivOneAndHalfWordsByWord -# CMP_Divide -# CMP_DivideTwoWordsByWord -# CMP_EstimateMSWQuotient -# CMP_FullCMPWordModReduce -# CMP_GenerateNewExponent -# CMP_GetBit -# CMP_GetBitsFromCMPInt -# CMP_GetBitsFromWord -# CMP_GetMSBitFromWord -# CMP_GetOffsetOfMSB -# CMP_InitExponentTable -# CMP_ModAdd -# CMP_ModExp -# CMP_ModExpCRT -# CMP_ModInvert -# CMP_ModMultiply -# CMP_ModSubtract -# CMP_ModularReduce -# CMP_MontProduct -# CMP_MontSquare -# CMP_Move -# CMP_Multiply -# CMP_OctetLengthOfCMPInt -# CMP_OctetStringToCMPInt -# CMP_PowerOfTwo -# CMP_RecomputeLength -# CMP_SetBit -# CMP_ShiftLeftByBits -# CMP_ShiftLeftByCMPWords -# CMP_ShiftRightByBits -# CMP_ShiftRightByCMPWords -# CMP_Subtract -# CMP_SubtractCMPWord -# CMP_SubtractInPlace -# CMP_UpdateCoefficients -# CMP_VectorMultiply -# CMP_free -# CMP_realloc -# CMP_reallocNoCopy -# CSLabel_copy -# CSLabel_free -# CSLabel_getCSLLData -# CSLabel_getLabel -# CSLabel_getLabelError -# CSLabel_getLabelNumber -# CSLabel_getLabelOptions -# CSLabel_getLabelRating -# CSLabel_getLabelRatingRange -# CSLabel_getRatingName -# CSLabel_getRatingStr -# CSLabel_getServiceInfo -# CSLabel_getServiceName -# CSLabel_getSingleLabel -# CSLabel_iterateLabelRatings -# CSLabel_iterateLabels -# CSLabel_iterateServices -# CSLabel_iterateSingleLabels -# CSLabel_ratingsIncludeFVal -# CSLabel_ratingsIncludeRange -# CSLabel_ratingsIncludeRanges -# CSParse_delete -# CSParse_deleteLabel -# CSParse_getLabel -# CSParse_new -# CSParse_newLabel -# CSParse_parseChunk -# CSParse_targetParser -# CSS_ConvertToJS -# CSS_ConvertToJSCompatibleName -# CV_MakeMultipleDocumentStream -# CacheFilePrefix -# CancelSharedScript -# CheckIsRecord -# CheckSharedMenus -# ClassesConstructor -# Classes_ResolveName -# Classes_class -# ConvertImageElementToPICT -# CreateImageContext -# CreatePlainTextConversionContext -# Crypto -# DER_AsciiToTime -# DER_Decode -# DER_Encode -# DER_GeneralizedTimeToTime -# DER_GetInteger -# DER_GetUInteger -# DER_LengthLength -# DER_Lengths -# DER_SetInteger -# DER_SetUInteger -# DER_StoreHeader -# DER_TimeToGeneralizedTime -# DER_TimeToUTCTime -# DER_UTCDayToAscii -# DER_UTCTimeToAscii -# DER_UTCTimeToTime -# DES_CreateContext -# DES_Decrypt -# DES_DestroyContext -# DES_Encrypt -# DES_PadBuffer -# DIR_AreServersSame -# DIR_AttributeNameToId -# DIR_CleanUpServerPreferences -# DIR_ConvertServerFileName -# DIR_CopyServer -# DIR_DeleteServer -# DIR_DeleteServerList -# DIR_GetAttributeName -# DIR_GetAttributeStrings -# DIR_GetComposeNameCompletionAddressBook -# DIR_GetFilterString -DIR_GetFirstAttributeString -# DIR_GetHtmlServers -DIR_GetLdapServers -# DIR_GetPersonalAddressBook -# DIR_GetServerFileName -# DIR_GetServerPreferences -# DIR_GetTokenSeparators -# DIR_InitServer -# DIR_IsAttributeExcludedFromHtml -# DIR_IsDnAttribute -# DIR_IsEscapedAttribute -# DIR_ReorderLdapServers -# DIR_RepeatFilterForTokens -# DIR_SaveServerPreferences -# DIR_SetAuthDN -# DIR_SetPassword -# DIR_SetServerFileName -# DIR_SubstStarsForSpaces -# DIR_Unescape -# DIR_UseCustomAttribute -# DSAU_DecodeDerSig -# DSAU_EncodeDerSig -# DSA_CreateKeyGenContext -# DSA_CreateSignContext -# DSA_CreateVerifyContext -# DSA_DestroyKeyGenContext -# DSA_DestroySignContext -# DSA_DestroyVerifyContext -# DSA_KeyGen -# DSA_NewKey -# DSA_Presign -# DSA_Sign -# DSA_SignatureTemplate -# DSA_Verify -# DVal_clear -# DVal_compare -# DVal_initialized -# DVal_readVal -# DVal_value -# DaylightSaving -# DecodeBase64Buffer -# DecodeSoftUpJSArgs -# DefineCertObject -# DestroyDBEntry -# DestroyImageContext -# DetectUCS2 -# DisposePlainTextConversionContext -# DisposeSharedMenus -# EDT_AddToRelayoutTables -# EDT_BeginBatchChanges -# EDT_BeginOfDocument -# EDT_BeginOfLine -# EDT_CanConvertTextToTable -# EDT_CanCopy -# EDT_CanCut -# EDT_CanDropHREF -# EDT_CanPaste -# EDT_CanPasteStyle -# EDT_CanSetCharacterAttribute -# EDT_CanSetHREF -# EDT_CanSizeObject -# EDT_CanSplitTableCell -# EDT_CancelSizing -# EDT_ChangeTableSelection -# EDT_CheckPublishURL -# EDT_ClearCellSelectionIfNotInside -# EDT_ClearSelection -# EDT_ClearSpecialCellSelection -# EDT_ClearTableAndCellSelection -# EDT_ConvertCurrentDocToNewDoc -# EDT_ConvertTableToText -# EDT_ConvertTextToTable -# EDT_CopySelection -# EDT_CopyStyle -# EDT_CreateDocTempFilename -# EDT_CutSelection -# EDT_DecreaseFontSize -# EDT_DeleteChar -# EDT_DeleteLayer -# EDT_DeleteMetaData -# EDT_DeletePreviousChar -# EDT_DeleteSelectionAndPositionCaret -# EDT_DeleteTable -# EDT_DeleteTableCaption -# EDT_DeleteTableCells -# EDT_DeleteTableColumns -# EDT_DeleteTableRows -# EDT_DeleteTagChain -# EDT_DestroyEditBuffer -# EDT_DirtyFlag -# EDT_DisplaySource -# EDT_DoubleClick -# EDT_Down -# EDT_DropHREF -# EDT_DupHREFData -# EDT_EncryptReset -# EDT_EncryptSet -# EDT_EncryptState -# EDT_EncryptToggle -# EDT_EndBatchChanges -# EDT_EndOfDocument -# EDT_EndOfLine -# EDT_EndSelection -# EDT_EndSizing -# EDT_ExtendSelection -# EDT_ExtendTableCellSelection -# EDT_FinishedLayout -# EDT_FixupTableData -# EDT_FormatCharacter -# EDT_FreeCharacterData -# EDT_FreeHREFData -# EDT_FreeHorizRuleData -# EDT_FreeImageData -# EDT_FreeLayerData -# EDT_FreeListData -# EDT_FreeMetaData -# EDT_FreePageData -# EDT_FreeTableCaptionData -# EDT_FreeTableCellData -# EDT_FreeTableData -# EDT_FreeTableRowData -# EDT_GetAllDocumentFiles -# EDT_GetAllDocumentFilesSelected -# EDT_GetAllDocumentTargets -# EDT_GetAllDocumentTargetsInFile -# EDT_GetAutoSavePeriod -# EDT_GetBackgroundColor -# EDT_GetCharacterData -# EDT_GetCharacterFormatting -# EDT_GetCurrentElementType -# EDT_GetDefaultBorderWidth -# EDT_GetDefaultPublishURL -# EDT_GetDisplayParagraphMarks -# EDT_GetDisplayTables -# EDT_GetDocTempDir -# EDT_GetEditHistory -# EDT_GetEmptyDocumentString -# EDT_GetEncoderFileExtension -# EDT_GetEncoderFileType -# EDT_GetEncoderMenuHelp -# EDT_GetEncoderName -# EDT_GetEncoderNeedsQuantizedSource -# EDT_GetExtraColors -# EDT_GetExtraHTML_FromImage -# EDT_GetFilename -# EDT_GetFontColor -# EDT_GetFontFace -# EDT_GetFontFaceIndex -# EDT_GetFontFaceTags -# EDT_GetFontFaces -# EDT_GetFontPointSize -# EDT_GetFontSize -# EDT_GetHREF -# EDT_GetHREFData -# EDT_GetHREFText -# EDT_GetHorizRuleData -# EDT_GetImageData -# EDT_GetInsertPointOffset -# EDT_GetLayerData -# EDT_GetListData -# EDT_GetMatchingFontColorIndex -# EDT_GetMergeTableCellsType -# EDT_GetMetaData -# EDT_GetNSColor -# EDT_GetPageData -# EDT_GetPageTitleFromFilename -# EDT_GetParagraphAlign -# EDT_GetParagraphFormatting -# EDT_GetPluginCategoryName -# EDT_GetPluginMenuHelp -# EDT_GetPluginName -# EDT_GetPositionalText -# EDT_GetPublishingHistory -# EDT_GetRedoCommandID -# EDT_GetSelectedCellCount -# EDT_GetSelectedTableElement -# EDT_GetSelectionOffsets -# EDT_GetSizingRect -# EDT_GetTabDelimitedTextFromSelectedCells -# EDT_GetTableCaptionData -# EDT_GetTableCellData -# EDT_GetTableData -# EDT_GetTableHitRegion -# EDT_GetTableParentSize -# EDT_GetTableRowData -# EDT_GetTargetData -# EDT_GetTextBlock -# EDT_GetToggleListState -# EDT_GetUndoCommandID -# EDT_GetUnknownTagData -# EDT_HaveEditBuffer -# EDT_IgnoreMisspelledWord -# EDT_ImageLoadCancel -# EDT_IncreaseFontSize -# EDT_Indent -# EDT_InsertBreak -# EDT_InsertHorizRule -# EDT_InsertImage -# EDT_InsertLayer -# EDT_InsertNonbreakingSpace -# EDT_InsertTable -# EDT_InsertTableCaption -# EDT_InsertTableCells -# EDT_InsertTableColumns -# EDT_InsertTableRows -# EDT_InsertTarget -# EDT_InsertText -# EDT_InsertUnknownTag -# EDT_IsBlocked -# EDT_IsDraggingTable -# EDT_IsFileModified -# EDT_IsInsertPointInLayer -# EDT_IsInsertPointInNestedTable -# EDT_IsInsertPointInTable -# EDT_IsInsertPointInTableCaption -# EDT_IsInsertPointInTableCell -# EDT_IsInsertPointInTableRow -# EDT_IsJavaScript -# EDT_IsPluginActive -# EDT_IsSameURL -# EDT_IsSelected -# EDT_IsSizing -# EDT_IsTableSelected -# EDT_IsWritableBuffer -# EDT_KeyDown -# EDT_LayoutElementToOffset -# EDT_MergeTableCells -# EDT_MetaDataCount -# EDT_MorphContainer -# EDT_NetToTape -# EDT_NewCharacterData -# EDT_NewHREFData -# EDT_NewHorizRuleData -# EDT_NewImageData -# EDT_NewLayerData -# EDT_NewMetaData -# EDT_NewPageData -# EDT_NewTableCaptionData -# EDT_NewTableCellData -# EDT_NewTableData -# EDT_NewTableRowData -# EDT_NextChar -# EDT_NextTableCell -# EDT_NextWord -# EDT_NumberOfEncoders -# EDT_NumberOfPluginCategories -# EDT_NumberOfPlugins -# EDT_OffsetToLayoutElement -# EDT_Outdent -# EDT_PageDown -# EDT_PageUp -# EDT_ParseColorString -# EDT_PasteHREF -# EDT_PasteHTML -# EDT_PasteQuote -# EDT_PasteQuoteBegin -# EDT_PasteQuoteEnd -# EDT_PasteQuoteINTL -# EDT_PasteStyle -# EDT_PasteText -# EDT_PerformEvent -# EDT_PerformPlugin -# EDT_PerformPluginByClassName -# EDT_PositionCaret -# EDT_PositionDropCaret -# EDT_PreClose -# EDT_PreOpen -# EDT_PreviousChar -# EDT_PreviousTableCell -# EDT_PreviousWord -# EDT_ProcessTag -# EDT_PublishFile -# EDT_ReadFromBuffer -# EDT_Redo -# EDT_RefreshLayout -# EDT_RegisterPlugin -# EDT_RemoveList -# EDT_RemoveTempFile -# EDT_ReplaceFilename -# EDT_ReplaceMisspelledWord -# EDT_ReplaceText -# EDT_ResetLayoutElement -# EDT_ReturnKey -# EDT_ReturnKeyAndIndent -# EDT_SaveCancel -# EDT_SaveFile -# EDT_SaveFileTo -# EDT_SaveToBuffer -# EDT_SaveToTempFile -# EDT_SelectAll -# EDT_SelectFirstMisspelledWord -# EDT_SelectNextMisspelledWord -# EDT_SelectNextNonTextObject -# EDT_SelectObject -# EDT_SelectTable -# EDT_SelectTableCell -# EDT_SelectTableElement -# EDT_SelectionContainsLink -# EDT_SetAutoSavePeriod -# EDT_SetBackgroundColor -# EDT_SetCharacterData -# EDT_SetCharacterDataAtOffset -# EDT_SetDirtyFlag -# EDT_SetDisplayParagraphMarks -# EDT_SetDisplayTables -# EDT_SetEncoding -# EDT_SetFontColor -# EDT_SetFontFace -# EDT_SetFontPointSize -# EDT_SetFontSize -# EDT_SetHREF -# EDT_SetHREFData -# EDT_SetHorizRuleData -# EDT_SetImageAsBackground -# EDT_SetImageData -# EDT_SetImageInfo -# EDT_SetInsertPoint -# EDT_SetInsertPointToOffset -# EDT_SetLayerData -# EDT_SetLayoutElement -# EDT_SetListData -# EDT_SetMetaData -# EDT_SetPageData -# EDT_SetParagraphAlign -# EDT_SetRefresh -# EDT_SetTableAlign -# EDT_SetTableCaptionData -# EDT_SetTableCellData -# EDT_SetTableData -# EDT_SetTableRowData -# EDT_SetTargetData -# EDT_SetUnknownTagData -# EDT_SplitTableCell -# EDT_StartDragTable -# EDT_StartEncoder -# EDT_StartSelection -# EDT_StartSizing -# EDT_StartSpecialCellSelection -# EDT_StopDragTable -# EDT_StopEncoder -# EDT_StopPlugin -# EDT_SyncEditHistory -# EDT_SyncPublishingHistory -# EDT_TabKey -# EDT_TagCursorAtBreak -# EDT_TagCursorClearRelayoutState -# EDT_TagCursorClone -# EDT_TagCursorCurrentLine -# EDT_TagCursorDelete -# EDT_TagCursorGetNext -# EDT_TagCursorGetNextState -# EDT_TagString -# EDT_ToggleList -# EDT_TranslateToXPFontFace -# EDT_Undo -# EDT_Up -# EDT_ValidateTag -# EDT_WindowScrolled -# ET_ClearDecoderStream -# ET_ContinueProcessing -# ET_DestroyLayer -# ET_DocWriteAck -ET_EvaluateBuffer -ET_EvaluateScript -# ET_FinishMocha -# ET_FireTimeoutCallBack -# ET_GetSecurityStatus -# ET_HandlePref -ET_InitMoja -# ET_InterruptContext -# ET_InterruptImgCX -# ET_MakeHTMLAlert -# ET_MochaStreamAbort -# ET_MochaStreamComplete -# ET_NewLayerDocument -# ET_PostBackCommand -# ET_PostClearTimeout -# ET_PostClearView -# ET_PostCreateLayer -# ET_PostDestroyWindow -# ET_PostEvalAck -# ET_PostFindCommand -# ET_PostForwardCommand -# ET_PostFreeAnonImages -# ET_PostFreeImageContext -# ET_PostFreeImageElement -# ET_PostGetAvailScreenRect -# ET_PostGetColorDepth -# ET_PostGetScreenSize -# ET_PostGetSelectedText -# ET_PostGetUrl -# ET_PostHomeCommand -# ET_PostJsEventAck -# ET_PostManipulateForm -# ET_PostMessageBox -# ET_PostNewWindow -# ET_PostOpenFileCommand -# ET_PostPrintCommand -# ET_PostProgress -# ET_PostPrompt -# ET_PostQueryChrome -# ET_PostRestoreAck -# ET_PostScrollDocBy -# ET_PostScrollDocTo -# ET_PostSetTimeout -# ET_PostSignedAppletPrivileges -# ET_PostUpdateChrome -# ET_ReflectFormElement -# ET_ReflectObject -# ET_ReflectWindow -# ET_RegisterComponent -# ET_RegisterComponentMethod -# ET_RegisterComponentProp -# ET_ReleaseDocument -# ET_RemoveWindowContext -# ET_RestoreLayerState -# ET_SendEvent -# ET_SendImageEvent -ET_SendLoadEvent -# ET_SetActiveForm -# ET_SetActiveLayer -# ET_SetDecoderStream -# ET_SetNestingUrl -# ET_SetPluginWindow -# ET_SetVersion -ET_StartSoftUpdate -# ET_TweakLayer -# ET_fe_SubmitInputElement -# ET_il_GetImage -# ET_il_SetGroupObserver -# ET_lo_DiscardDocument -# ET_lo_DoDocWrite -# ET_lo_PrepareLayerForWriting -# ET_lo_ResetForm -# ET_moz_Abort -# ET_moz_CallAsyncAndSubEventLoop -ET_moz_CallFunction -# ET_moz_CallFunctionAsync -# ET_moz_CallFunctionBool -# ET_moz_CallFunctionInt -# ET_moz_CallFunctionString -# ET_moz_CompGetterFunction -# ET_moz_CompMethodFunction -# ET_moz_CompSetterFunction -# ET_moz_DocCacheConverter -# ET_moz_SetMochaWriteStream -# ET_moz_VerifyComponentFunction -# ET_net_CacheConverter -# ET_net_FindURLInCache -# ET_net_StreamBuilder -# ET_npl_RefreshPluginList -# EnableSharedMenus -# EncodeBase64Buffer -# ExternalURLTypeList -# FC_CancelFunction -# FC_CloseAllSessions -# FC_CloseSession -# FC_CopyObject -# FC_CreateObject -# FC_Decrypt -# FC_DecryptDigestUpdate -# FC_DecryptFinal -# FC_DecryptInit -# FC_DecryptUpdate -# FC_DecryptVerifyUpdate -# FC_DeriveKey -# FC_DestroyObject -# FC_Digest -# FC_DigestEncryptUpdate -# FC_DigestFinal -# FC_DigestInit -# FC_DigestKey -# FC_DigestUpdate -# FC_Encrypt -# FC_EncryptFinal -# FC_EncryptInit -# FC_EncryptUpdate -# FC_Finalize -# FC_FindObjects -# FC_FindObjectsFinal -# FC_FindObjectsInit -# FC_GenerateKey -# FC_GenerateKeyPair -# FC_GenerateRandom -# FC_GetAttributeValue -# FC_GetFunctionList -# FC_GetFunctionStatus -# FC_GetInfo -# FC_GetMechanismInfo -# FC_GetMechanismList -# FC_GetObjectSize -# FC_GetOperationState -# FC_GetSessionInfo -# FC_GetSlotInfo -# FC_GetSlotList -# FC_GetTokenInfo -# FC_InitPIN -# FC_InitToken -# FC_Initialize -# FC_Login -# FC_Logout -# FC_OpenSession -# FC_SeedRandom -# FC_SetAttributeValue -# FC_SetOperationState -# FC_SetPIN -# FC_Sign -# FC_SignEncryptUpdate -# FC_SignFinal -# FC_SignInit -# FC_SignRecover -# FC_SignRecoverInit -# FC_SignUpdate -# FC_UnwrapKey -# FC_Verify -# FC_VerifyFinal -# FC_VerifyInit -# FC_VerifyRecover -# FC_VerifyRecoverInit -# FC_VerifyUpdate -# FC_WaitForSlotEvent -# FC_WrapKey -# FE_AboutData -FE_Alert -# FE_AllocateMenuID -# FE_BackCommand -# FE_BlurInputElement -# FE_ChangeInputElement -# FE_CheckAndAutoSaveDocument -# FE_CheckConfirm -# FE_ClearConnectSelect -# FE_ClearFileReadSelect -# FE_ClearReadSelect -FE_ClearTimeout -# FE_ClickInputElement -# FE_ConnectToRemoteHost -# FE_CopyRegion -# FE_CreateRectRegion -# FE_CreateRegion -# FE_DefaultDocCharSetID -# FE_DestroyCaret -# FE_DestroyRegion -FE_DestroyWindow -# FE_DisplayGenericCaret -# FE_DisplayImageCaret -# FE_DisplayTextCaret -# FE_DocumentChanged -# FE_DoneMailTo -# FE_EditPreference -# FE_EditorDocumentLoaded -# FE_EmbedURLExit -# FE_FileType -# FE_FindCommand -# FE_FinishedSave -# FE_FocusInputElement -# FE_ForEachRectInRegion -# FE_ForwardCommand -# FE_FreeAboutData -# FE_FreeFormElement -# FE_FreeGridWindow -# FE_FreeSingleByteTable -# FE_GetAvailScreenRect -# FE_GetCaretPosition -# FE_GetContextID -# FE_GetDocAndWindowPosition -# FE_GetEdgeMinSize -# FE_GetFullWindowSize -# FE_GetInitContext -# FE_GetNetHelpContext -FE_GetNetHelpDir -# FE_GetPixelAndColorDepth -FE_GetRDFContext -# FE_GetRegionBoundingBox -FE_GetScreenSize -# FE_GetSingleByteTable -# FE_GetTempFileFor -FE_GetURL -# FE_GetWindowOffset -# FE_HandleEmbedEvent -# FE_HandleLayerEvent -# FE_HomeCommand -# FE_ImageLoadDialog -# FE_ImageLoadDialogDestroy -# FE_IntersectRegion -# FE_IsEmptyRegion -# FE_IsEqualRegion -# FE_IsNetcasterInstalled -# FE_IsNetcasterRunning -# FE_LoadGridCellFromHistory -# FE_LoadPlugin -# FE_MakeBlankWindow -# FE_MakeGridWindow -FE_MakeNewWindow -# FE_Message -# FE_MochaImageGroupObserver -# FE_OffsetRegion -# FE_PluginGetValue -# FE_PluginProgress -# FE_PrintCommand -FE_PromptForFileName -FE_QueryChrome -# FE_RaiseWindow -# FE_ReadScreen -# FE_RectInRegion -# FE_RegisterPlugins -# FE_RegisterWindow -# FE_ReleaseTextAttrFeData -# FE_RememberPopPassword -# FE_ResetRefreshURLTimer -# FE_RestructureGridWindow -# FE_RunNetcaster -# FE_SaveDialogCreate -# FE_SaveDialogDestroy -# FE_SaveDialogSetFilename -# FE_SaveFileExistsDialog -# FE_ScrollDocBy -# FE_ScrollDocTo -FE_SecurityDialog -# FE_Select -# FE_SelectInputElement -# FE_SetConnectSelect -# FE_SetFileReadSelect -# FE_SetNewDocumentProperties -FE_SetPasswordEnabled -# FE_SetReadSelect -# FE_SetRectRegion -# FE_SetRefreshURLTimer -FE_SetTimeout -# FE_SetWindowLoading -# FE_ShiftImage -# FE_ShowScrollBars -# FE_StartAsyncDNSLookup -# FE_StrColl -# FE_StrfTime -FE_SubmitInputElement -# FE_SubtractRegion -# FE_URLEcho -# FE_URLToLocalName -# FE_UnionRegion -# FE_UnloadPlugin -# FE_UnregisterWindow -# FE_UpdateChrome -# FE_UpdateStopState -# FE_UseExternalProtocolModule -# FE_UsersFromField -# FE_UsersFullName -# FE_UsersMailAddress -# FE_UsersOrganization -# FE_UsersSignature -# FSSpecFromPathname_CWrapper -# FVal_clear -# FVal_initialized -# FVal_isInfinite -# FVal_isZero -# FVal_minus -# FVal_nearerZero -# FVal_readVal -# FVal_set -# FVal_setInfinite -# FVal_toStr -# FVal_value -# FindCertSubjectNode -FindGutsFolder -# FindImagePart -FindJavaDownloadsFolder -FindNetscapeFolder -# FindSubjectList -# GH_CanRedo -# GH_CanUndo -# GH_CheckGlobalHistory -# GH_ClearGlobalHistory -# GH_CollectGarbage -GH_DeleteHistoryItem -# GH_DeleteRecord -# GH_FileSaveAsHTML -# GH_FreeGlobalHistory -# GH_GetContext -# GH_GetMRUPage -# GH_GetNumRecords -# GH_GetRecord -# GH_GetRecordNum -# GH_GetSortField -# GH_GetURContext -# GH_InitGlobalHistory -# GH_Redo -# GH_ReleaseContext -# GH_SaveGlobalHistory -# GH_SetGlobalHistoryTimeout -# GH_SupportUndoRedo -# GH_Undo -GH_UpdateGlobalHistory -# GH_UpdateURLTitle -# GMTDelta -# GetCString -# GetCertType -# GetDeepestDevice -# GetKeyAndRestart -# GetKeyID -# GetKeyUsage -# GetShiftTableFromCsid -GetTimeMac -# GetURLFromImageElement -# GetUnicodeTableSet -# HK_CallHook -# HK_GetFunctionName -# HK_Init -# HK_IsHook -# HK_JSErrorReporter -# HK_ReadHookFile -# HMAC_Begin -# HMAC_Clone -# HMAC_Create -# HMAC_Destroy -# HMAC_Finish -# HMAC_Update -# HOT_ChangeEntryType -# HOT_CopyEntry -# HOT_CreateEntry -# HOT_FoldHeader -# HOT_FreeEntry -# HOT_FreeHotlist -# HOT_GetDepth -# HOT_GetHotlist -# HOT_GetHotlistList -# HOT_GetIndex -# HOT_GetUnfoldedIndex -# HOT_IndexOf -# HOT_InsertItemAfter -# HOT_InsertItemBefore -# HOT_InsertItemInHeaderOrAfterItem -# HOT_IsDescendent -# HOT_Modified -# HOT_MoveObjectDown -# HOT_MoveObjectUp -# HOT_ObjectCanGoDown -# HOT_ObjectCanGoUp -# HOT_ReadHotlistFromDisk -# HOT_RemoveItem -# HOT_RemoveItemFromList -# HOT_SaveHotlist -# HOT_SearchHotlist -# HOT_SetModified -# HOT_UnfoldedIndexOf -# HOT_UpdateHotlistTime -# HTChunk_clear -# HTChunk_delete -# HTChunk_ensure -# HTChunk_fromCString -# HTChunk_new -# HTChunk_putb -# HTChunk_putc -# HTChunk_puts -# HTChunk_toCString -# HTList_addObject -# HTList_appendObject -# HTList_count -# HTList_delete -# HTList_firstObject -# HTList_indexOf -# HTList_new -# HTList_objectAt -# HTList_removeFirstObject -# HTList_removeLastObject -# HTList_removeObject -# HTMemory_calloc -# HTMemory_free -# HTMemory_malloc -# HTMemory_outofmem -# HTMemory_realloc -# HTStrCaseMatch -# HTStrMatch -# HTStrip -# HTTP_PrefChangedFunc -# HTTrace -# HTTrace_getCallback -# HTTrace_setCallback -# ICAddMapEntry -# ICBegin -# ICCAddMapEntry -# ICCBegin -# ICCChooseConfig -# ICCChooseNewConfig -# ICCCountMapEntries -# ICCCountPref -# ICCDefaultFileName -# ICCDeleteMapEntry -# ICCDeletePref -# ICCEditPreferences -# ICCEnd -# ICCFindConfigFile -# ICCFindPrefHandle -# ICCFindUserConfigFile -# ICCGeneralFindConfigFile -# ICCGetComponentInstance -# ICCGetConfigName -# ICCGetConfigReference -# ICCGetIndMapEntry -# ICCGetIndPref -# ICCGetMapEntry -# ICCGetPerm -# ICCGetPref -# ICCGetPrefHandle -# ICCGetSeed -# ICCLaunchURL -# ICCMapEntriesFilename -# ICCMapEntriesTypeCreator -# ICCMapFilename -# ICCMapTypeCreator -# ICCParseURL -# ICCSetConfigReference -# ICCSetMapEntry -# ICCSetPref -# ICCSetPrefHandle -# ICCSpecifyConfigFile -# ICCStart -# ICCStop -# ICChooseConfig -# ICChooseNewConfig -# ICCountMapEntries -# ICCountPref -# ICDefaultFileName -# ICDeleteMapEntry -# ICDeletePref -# ICEditPreferences -# ICEnd -# ICFindConfigFile -# ICFindPrefHandle -# ICFindUserConfigFile -# ICGeneralFindConfigFile -# ICGetComponentInstance -# ICGetConfigName -# ICGetConfigReference -# ICGetIndMapEntry -# ICGetIndPref -# ICGetMapEntry -# ICGetPerm -# ICGetPref -# ICGetPrefHandle -# ICGetSeed -# ICLaunchURL -# ICMapEntriesFilename -# ICMapEntriesTypeCreator -# ICMapFilename -# ICMapTypeCreator -# ICParseURL -# ICSetConfigReference -# ICSetMapEntry -# ICSetPref -# ICSetPrefHandle -# ICSpecifyConfigFile -# ICStart -# ICStop -# IL_AddColorToColorMap -# IL_AddGroupObserver -# IL_AddRefToColorSpace -# IL_AddReferer -# IL_CloneDummyNetContext -# IL_CreateGreyScaleColorSpace -# IL_CreatePseudoColorSpace -# IL_CreateTrueColorSpace -# IL_DestroyColorMap -# IL_DestroyDummyNetContext -# IL_DestroyGroupContext -# IL_DestroyImage -# IL_DestroyImageGroup -# IL_DisplayIcon -# IL_DisplayMemCacheInfoAsHTML -# IL_DisplaySubImage -# IL_FreeMemory -# IL_GetCacheSize -# IL_GetIconDimensions -# IL_GetImage -# IL_GetImagePixmap -# IL_GetMaskPixmap -# IL_GetNaturalDimensions -# IL_HTMLImageInfo -# IL_Init -# IL_InterruptContext -# IL_NewColorMap -# IL_NewCubeColorMap -# IL_NewDummyNetContext -# IL_NewGroupContext -# IL_NewOptimalColorMap -# IL_NewStream -# IL_PreferredStream -# IL_ReleaseColorSpace -# IL_ReloadImages -# IL_RemoveGroupObserver -# IL_ReorderColorMap -# IL_SetCacheSize -# IL_SetDisplayMode -# IL_ShrinkCache -# IL_Shutdown -# IL_Type -# IL_UnCache -# IL_ViewStream -# IMGCBFactory_Create -# IMGCBVtable -# IMGCB_ID -# INTL_CCCReportMetaCharsetTag -# INTL_CSICreate -# INTL_CSIDIteratorDestroy -# INTL_CSIDIteratorNext -# INTL_CSIDestroy -# INTL_CSIInitialize -# INTL_CSIReportMetaCharsetTag -# INTL_CSIReset -# INTL_CallCharCodeConverter -# INTL_CanAutoSelect -# INTL_CharClass -# INTL_CharLen -# INTL_CharSetDocInfo -# INTL_CharSetIDToJavaCharSetName -# INTL_CharSetIDToJavaName -# INTL_CharSetIDToName -INTL_CharSetNameToID -# INTL_ColumnWidth -# INTL_CompoundStrCat -# INTL_CompoundStrClone -INTL_CompoundStrDestroy -INTL_CompoundStrFirstStr -# INTL_CompoundStrFromStr -INTL_CompoundStrFromUnicode -INTL_CompoundStrNextStr -# INTL_ConvCharCode -INTL_ConvertLineWithoutAutoDetect -# INTL_CreateCharCodeConverter -# INTL_CreateDocumentCCC -# INTL_CsidToCharsetNamePt -# INTL_CsidToJavaCharsetNamePt -# INTL_DefaultDocCharSetID -# INTL_DefaultTextAttributeCharSetID -INTL_DefaultWinCharSetID -# INTL_DestroyCharCodeConverter -# INTL_DocToWinCharSetID -INTL_FreeSingleByteTable -# INTL_GetAcceptCharset -# INTL_GetAcceptLanguage -INTL_GetCharSetID -# INTL_GetCSIDocCSID -# INTL_GetCSIMetaDocCSID -# INTL_GetCSIMimeCharset -# INTL_GetCSIOverrideDocCSID -# INTL_GetCSIRelayoutFlag -INTL_GetCSIWinCSID -# INTL_GetCharCodeConverter -# INTL_GetDoubleByteToLowerMap -# INTL_GetNormalizeStr -INTL_GetSingleByteTable -# INTL_GetSingleByteToLowerMap -INTL_GetUnicodeCSIDList -# INTL_GetUnicodeCharsetList -# INTL_IsHalfWidth -# INTL_IsLeadByte -# INTL_KinsokuClass -# INTL_LockTable -# INTL_MatchOneCaseChar -# INTL_MatchOneChar -# INTL_MidTruncateString -# INTL_NextChar -# INTL_NextCharIdx -# INTL_NextCharIdxInText -# INTL_NonBreakingSpace -# INTL_NthByteOfChar -# INTL_NumUTF8Chars -# INTL_PrevCharIdx -# INTL_PrevCharIdxInText -# INTL_Relayout -# INTL_ReportFontCharSets -INTL_ResourceCharSet -# INTL_SetCSIDocCSID -# INTL_SetCSIHTTPDocCSID -# INTL_SetCSIMetaDocCSID -# INTL_SetCSIMimeCharset -# INTL_SetCSIOverrideDocCSID -# INTL_SetCSIRelayoutFlag -# INTL_SetCSIWinCSID -# INTL_SetUnicodeCSIDList -# INTL_StrBeginWith -# INTL_StrContains -# INTL_StrEndWith -# INTL_StrIs -INTL_StrToUnicode -# INTL_StrToUnicodeLen -# INTL_Strcasestr -# INTL_Strstr -INTL_TextByteCountToCharLen -INTL_TextCharLenToByteCount -INTL_TextToUnicode -INTL_TextToUnicodeLen -INTL_UCS2ToUTF8 -INTL_UTF8ToUCS2 -# INTL_UnicodeLen -INTL_UnicodeToEncodingStr -INTL_UnicodeToStr -# INTL_UnicodeToStrIterate -# INTL_UnicodeToStrIteratorCreate -# INTL_UnicodeToStrIteratorDestroy -INTL_UnicodeToStrLen -# INTL_ctime -# ImageGroupObserver -# InfoToShiftTable -# InitSharedMenus -# IsImageComplete -# IsSharedMenu -# JSCF_Cleanup -# JSCF_Execute -# JSS_ResolveDocName -# Java_netscape_net_SSLInputStream_socketRead_stub -# Java_netscape_net_SSLOutputStream_socketWrite_stub -# Java_netscape_net_SSLSocketImpl_forceHandshake_stub -# Java_netscape_net_SSLSocketImpl_getStatus_stub -# Java_netscape_net_SSLSocketImpl_redoHandshake_stub -# Java_netscape_net_SSLSocketImpl_resetHandshake_stub -# Java_netscape_net_SSLSocketImpl_socketAccept_stub -# Java_netscape_net_SSLSocketImpl_socketAvailable_stub -# Java_netscape_net_SSLSocketImpl_socketBind_stub -# Java_netscape_net_SSLSocketImpl_socketClose_stub -# Java_netscape_net_SSLSocketImpl_socketConnect_stub -# Java_netscape_net_SSLSocketImpl_socketCreate_stub -# Java_netscape_net_SSLSocketImpl_socketGetOption_stub -# Java_netscape_net_SSLSocketImpl_socketListen_stub -# Java_netscape_net_SSLSocketImpl_socketSetNeedClientAuth_stub -# Java_netscape_net_SSLSocketImpl_socketSetOptionIntVal_stub -# KEAPQGCompare -# LDefProc -# LM_AttemptLockJS -# LM_CanDoJS -# LM_ClearAttemptLockJS -# LM_DropSavedWindow -# LM_EvaluateAttribute -# LM_EvaluateBuffer -# LM_EventCaptureCheck -# LM_ExtractFromPrincipalsArchive -# LM_FinishMoja -LM_ForceJSEnabled -# LM_GetActiveLayer -# LM_GetBaseHrefTag -# LM_GetJSDebugActive -LM_GetJSPrincipalsFromJavaCaller -LM_GetMochaDecoder -LM_GetMochaEnabled -# LM_GetSourceURL -# LM_HandOffJSLock -# LM_InitMocha -# LM_InitMoja -# LM_IsActive -# LM_IsMojaInitialized -# LM_JSLockGetContext -# LM_JSLockSetContext -# LM_JamSourceIntoJSDebug -LM_LockJS -LM_NewJSPrincipals -LM_PutMochaDecoder -# LM_ReflectApplet -# LM_ReflectEmbed -# LM_ReflectForm -# LM_ReflectFormElement -# LM_ReflectImage -# LM_ReflectLayer -# LM_ReflectLink -# LM_ReflectNamedAnchor -# LM_RegisterPrincipals -# LM_ReleaseDocument -# LM_RemoveWindowContext -# LM_SendOnHelp -# LM_SendOnLocate -# LM_SendOnScroll -# LM_SetActiveLayer -# LM_SetDecoderStream -# LM_SetUntransformedSource -# LM_SkipWysiwygURLPrefix -# LM_StreamBuilder -# LM_StripWysiwygURLPrefix -LM_UnlockJS -# LM_WysiwygCacheConverter -# LO_AddEmbedData -# LO_AdjustSSUnits -# LO_BackInGrid -# LO_BeginOfLine -# LO_BlockedOnImage -# LO_CalcPrintArea -# LO_ChangeFontSize -# LO_CheckForContentHiding -# LO_CheckForUnload -# LO_CleanupGridHistory -# LO_ClearEmbedBlock -# LO_ClearSelection -# LO_Click -# LO_CloneFormData -# LO_CloseAllTags -# LO_ComputeNewPosition -# LO_CopySavedEmbedData -# LO_CreateNewLayer -# LO_CreateReblockTag -# LO_CreateStyleSheetDummyTag -# LO_DiscardDocument -# LO_DocumentInfo -# LO_DoubleClick -# LO_EditorReflow -# LO_EmptyRecyclingBin -# LO_EndOfLine -# LO_EndSelection -# LO_EnumerateApplets -# LO_EnumerateEmbeds -# LO_EnumerateFormElements -# LO_EnumerateForms -# LO_EnumerateImages -# LO_EnumerateLinks -# LO_EnumerateNamedAnchors -# LO_ExtendSelection -# LO_ExtendSelectionFromElement -# LO_FindGridText -# LO_FindText -# LO_FirstElementOnLine -# LO_FormRadioSet -# LO_ForwardInGrid -# LO_FreeDocumentEmbedListData -# LO_FreeDocumentFormListData -# LO_FreeDocumentGridData -# LO_FreeSubmitData -# LO_GetAppletByIndex -# LO_GetBaseURL -# LO_GetBookmarkIconURLForPage -LO_GetDocumentCharacterSetInfo -# LO_GetDocumentColor -# LO_GetDocumentMargins -# LO_GetEDBuffer -# LO_GetEffectiveCoordinates -# LO_GetEmbedByIndex -# LO_GetFormDataByID -# LO_GetFormElementByIndex -# LO_GetHeightFromStyleSheet -# LO_GetIdFromLayer -# LO_GetImageByIndex -# LO_GetLayerBackdropImage -# LO_GetLayerBackdropURL -# LO_GetLayerBgColor -# LO_GetLayerFromId -# LO_GetLayerMochaObjectFromId -# LO_GetLayerMochaObjectFromLayer -# LO_GetLayerScrollHeight -# LO_GetLayerScrollWidth -# LO_GetLayerType -# LO_GetLayerWrapWidth -# LO_GetLayerXOffset -# LO_GetLayerYOffset -# LO_GetLinkByIndex -# LO_GetNamedAnchorByIndex -# LO_GetNumberOfLayers -# LO_GetReloadMethod -# LO_GetScalingFactor -# LO_GetSelectionEndPoints -# LO_GetSelectionEndpoints -# LO_GetSelectionNewPoint -# LO_GetSelectionText -# LO_GetWidthFromStyleSheet -# LO_GridCanGoBackward -# LO_GridCanGoForward -# LO_HasBGImage -# LO_HaveSelection -# LO_HighlightAnchor -# LO_HighlightSelection -# LO_Hit -# LO_ImplicitPop -# LO_InvalidateFontData -# LO_IsEmptyCell -# LO_IsSelected -# LO_IsSelectionStarted -# LO_LayingOut -# LO_LocateNamedAnchor -LO_LockLayout -# LO_MapXYToAreaAnchor -# LO_MoveGridEdge -# LO_MoveLayer -# LO_NavigateChunk -# LO_NetlibComplete -# LO_NewImageElement -# LO_NewObjectStream -# LO_NextPosition -# LO_ParseRGB -# LO_ParseStyleSheetRGB -# LO_PopAllTagsAbove -# LO_PopStyleTag -# LO_PopStyleTagByIndex -# LO_PositionCaret -# LO_PositionCaretBounded -# LO_PrepareLayerForWriting -# LO_PreviousPosition -# LO_ProcessTag -# LO_PushTagOnStyleStack -# LO_QA_CreateProbe -# LO_QA_DestroyProbe -# LO_QA_GetElementHeight -# LO_QA_GetElementType -# LO_QA_GetElementWidth -# LO_QA_GetElementXPosition -# LO_QA_GetElementYPosition -# LO_QA_GetText -# LO_QA_GetURL -# LO_QA_GotoChildElement -# LO_QA_GotoFirstElement -# LO_QA_GotoNextElement -# LO_QA_GotoParentElement -# LO_QA_HasChild -# LO_QA_HasColor -# LO_QA_HasParent -# LO_QA_HasText -# LO_QA_HasURL -# LO_RedoFormElements -# LO_RefetchWindowDimensions -# LO_Reflow -# LO_RefreshAnchors -# LO_RefreshArea -# LO_Relayout -# LO_RelayoutFromElement -# LO_RelayoutOnResize -# LO_ResetForm -# LO_ResizeSelectOptions -# LO_ReturnNextFormElement -# LO_ReturnNextFormElementInTabGroup -# LO_ReturnPrevFormElement -# LO_SaveFormData -# LO_SelectAll -# LO_SelectElement -# LO_SelectObject -# LO_SelectRegion -# LO_SelectText -# LO_SetBackgroundImage -# LO_SetBaseURL -# LO_SetDefaultBackdrop -# LO_SetDefaultColor -# LO_SetDocBgColor -# LO_SetDocumentColor -# LO_SetDocumentDimensions -# LO_SetEmbedSize -# LO_SetEmbedType -# LO_SetForceLoadImage -# LO_SetImageInfo -# LO_SetImageURL -# LO_SetLayerBackdropURL -# LO_SetLayerBbox -# LO_SetLayerBgColor -# LO_SetLayerMochaObject -# LO_SetLayerScrollHeight -# LO_SetLayerScrollWidth -# LO_SetLayerSrc -# LO_SetStyleObjectRefs -# LO_SetUserOverride -# LO_StartSelection -# LO_StartSelectionFromElement -# LO_StyleSheetsEnabled -# LO_SubmitForm -# LO_SubmitImageForm -# LO_TextElementWidth -LO_UnlockLayout -# LO_UpDown -# LO_UpdateGridHistory -# LO_UpdateTextData -# LO_VerifyUnlockedLayout -# LO_WindowWidthInFixedChars -# LO_XYToElement -# LO_XYToNearestElement -# LO_findApointInArea -# LO_getFirstLastElement -# LO_getNextTabableElement -# LO_getTabableMapArea -# LO_isFormElementNeedTextTabFocus -# LO_isTabableElement -# LO_isTabableFormElement -# MB_Close -# MB_Open -# MB_Read -# MB_Stat -# MD2_Begin -# MD2_CloneContext -# MD2_DestroyContext -# MD2_End -# MD2_Flatten -# MD2_FlattenSize -# MD2_Hash -# MD2_NewContext -# MD2_Resurrect -# MD2_Update -# MD5_Begin -# MD5_CloneContext -# MD5_DestroyContext -# MD5_End -# MD5_Flatten -# MD5_FlattenSize -# MD5_Hash -# MD5_HashBuf -# MD5_NewContext -# MD5_Resurrect -# MD5_Update -# MDEF_CalcItemSize -# MDEF_DrawItem -# MDEF_DrawItemState -# MDEF_GetCopyright -# MDEF_GetVersion -# MDEF_IsCustomMenu -# MDEF_MenuKey -# MDEF_SetCallbackProc -# MDEF_SetKeyGraphicsPreference -# MDEF_SetMenuPrefs -# MDEF_SetSmallIconID -# MDEF_StripCustomData -# MIME_BuildMailtoURLAddress -# MIME_BuildNewspostURLAddress -# MIME_MakeFromField -# MISC_ValidateReturnAddress -# MISC_ValidateSignature -#{data} -MKLib_trace_flag -#{code} -# MK_PadEnabled -# MK_padPacURL -# MSG_MailDocument -# MSglobals -# Macctime -# Macgmtime -Maclocaltime -# Macmktime -Mactime -# Moja -# MojaLogModuleInit -# Moz_AddModule -# Moz_DeleteModule -# MyIconGetter -MyReadLocation -# NET_AddCoordinatesToURLStruct -# NET_AddExitCallback -# NET_AddExternalURLType -# NET_AddLOSubmitDataToURLStruct -# NET_AddToAllHeaders -# NET_AreThereActiveConnectionsForWindow -# NET_AreThereActiveConnectionsForWindowWithOtherActiveEntry -# NET_AreThereNonBusyActiveConnectionsForWindow -# NET_AskForAuthString -# NET_AskForProxyAuth -# NET_AssembleAllFilesInDirectory -# NET_AuthorizationRequired -# NET_BACat -NET_BACopy -# NET_BeginConnect -# NET_BlockingWrite -# NET_BufferedReadLine -# NET_BuildAuthString -# NET_BuildProxyAuthString -NET_CacheConverter -# NET_CacheInit -# NET_CacheStore -# NET_CacheTraceOn -# NET_CacheUseMethod -# NET_ChangeCacheFileLock -# NET_ChangeMaxNumberOfConnections -# NET_ChangeMaxNumberOfConnectionsPerContext -# NET_ChangeMemCacheLock -# NET_ChangeSocketBufferSize -# NET_CheckForTimeBomb -# NET_ChunkedDecoderStream -# NET_CleanupCache -# NET_CleanupCacheDirectory -# NET_CleanupFileFormat -# NET_CleanupTCP -# NET_ClearCallNetlibAllTheTime -# NET_ClearConnectPoll -# NET_ClearConnectSelect -# NET_ClearDNSSelect -# NET_ClearFileReadSelect -# NET_ClearReadPoll -# NET_ClearReadSelect -# NET_ClientProtocolInitialize -# NET_CloneWysiwygCacheFile -# NET_ContainsHTML -# NET_CookieBehaviorPrefChanged -# NET_CookieScriptPrefChanged -# NET_CookieWarningPrefChanged -# NET_CreateFileEntryInfoStruct -# NET_CreateMochaConverter -NET_CreateURLStruct -# NET_DNSExpirationPrefChanged -# NET_DelExternalURLType -NET_DeleteCookie -NET_DeregisterContentTypeConverter -# NET_DestroyCacheDirectory -# NET_DestroyEvidence -# NET_DisplayCacheInfoAsHTML -# NET_DisplayCookieInfoAsHTML -# NET_DisplayGlobalHistoryInfoAsHTML -# NET_DisplayMemCacheInfoAsHTML -# NET_DoFileSort -# NET_DoMarimbaApplication -# NET_DoSort -# NET_DontDiskCacheSSL -# NET_DumpDecoders -# NET_EnableUrlMatch -# NET_EnableUrlMatchPrefChanged -NET_Escape -# NET_EscapeBytes -# NET_EscapeHTML -# NET_EscapedSize -# NET_ExplainErrorDetails -# NET_FindProxyHostForUrl -NET_FindURLInCache -# NET_FindURLInExtCache -# NET_FindURLInMemCache -# NET_FinishConnect -# NET_FirstCacheObject -# NET_FirstMemCacheObject -# NET_FreeEntryInfoStruct -# NET_FreeTCPConData -NET_FreeURLStruct -# NET_GETDataObject -# NET_GetCookie -# NET_GetDiskCacheSize -# NET_GetHTMLHelpFileFromMapFile -# NET_GetJavaScriptConfigSource -# NET_GetMaxDiskCacheSize -# NET_GetMaxMemoryCacheSize -# NET_GetMemoryCacheSize -# NET_GetNoProxyFailover -# NET_GetProxyConfigSource -# NET_GetProxyStyle -# NET_GetRegConverterList -NET_GetURL -NET_GetURLQuick -# NET_GetUniqueIdString -# NET_GlobalAcLoaded -# NET_HTMLHelpMapToURL -# NET_HTTPIndexFormatToHTMLConverter -# NET_HTTPIndexParserFree -# NET_HTTPIndexParserGetBaseURL -# NET_HTTPIndexParserGetFileNum -# NET_HTTPIndexParserGetHTMLMessage -# NET_HTTPIndexParserGetTextMessage -# NET_HTTPIndexParserGetTotalFiles -# NET_HTTPIndexParserInit -# NET_HTTPIndexParserPut -# NET_HTTPIndexParserSort -# NET_HTTPNetRead -# NET_HTTPNetWrite -# NET_HasNetworkActivity -# NET_HaveConverterForMimeType -# NET_HoldURLStruct -# NET_HostName -# NET_InGetHostByName -# NET_InitAboutProtocol -# NET_InitAddressBookProtocol -# NET_InitDataURLProtocol -# NET_InitFTPProtocol -# NET_InitFileFormatTypes -# NET_InitFileProtocol -# NET_InitGopherProtocol -# NET_InitHTTPProtocol -# NET_InitMailtoProtocol -# NET_InitMarimbaProtocol -# NET_InitMemCacProtocol -# NET_InitMochaProtocol -# NET_InitNFSProtocol -# NET_InitNetLib -NET_InitRDFCookieResources -# NET_InitRemoteProtocol -# NET_InitURNProtocol -# NET_InitWAISProtocol -NET_InterruptSocket -# NET_InterruptStream -NET_InterruptWindow -# NET_IpString -# NET_IsCacheTraceOn -# NET_IsCallNetlibAllTheTimeSet -# NET_IsFQDNMailAddress -# NET_IsHTTP_URL -# NET_IsLocalFileURL -# NET_IsOldMimeTypes -# NET_IsPartialCacheFile -# NET_IsSafeForNewContext -NET_IsURLInDiskCache -NET_IsURLInMemCache -# NET_IsURLSecure -# NET_JavaScriptAutoConfig -# NET_JavascriptConfig -# NET_LoadJavaScriptConfig -# NET_LoadNetHelpTopic -# NET_LoadProxyConfig -# NET_LoadingPac -NET_MakeAbsoluteURL -# NET_MakeRelativeURL -# NET_MakeTargetURL -# NET_MakeUploadURL -# NET_MaxNumberOfOpenConnections -# NET_MaxNumberOfOpenConnectionsPerContext -# NET_MemCacheConverter -# NET_MimeEncodingConverter -# NET_MimeMakePartialEncodingConverterStream -# NET_MonthNo -NET_NewStream -# NET_NextCacheObject -# NET_NextMemCacheObject -# NET_NumberOfFilesInDiskCache -# NET_OpenExtCacheFAT -# NET_ParseContentTypeHeader -# NET_ParseDate -# NET_ParseMimeHeader -# NET_ParseNetHelpURL -NET_ParseURL -# NET_ParseUploadURL -# NET_PlainTextConverter -# NET_PlusToSpace -# NET_PollSockets -# NET_PrefChangedFunc -# NET_PrintDirectory -# NET_PrintFileType -# NET_PrintNetlibStatus -# NET_PrintRawToDisk -# NET_ProcessNet -# NET_Progress -# NET_ProxyAcLoaded -# NET_ProxyAutoConfig -# NET_PublishFiles -# NET_PublishFilesTo -# NET_ReadCacheFAT -# NET_ReadCookies -# NET_RefreshCacheFileExpiration -# NET_RegExpCaseSearch -# NET_RegExpMatch -# NET_RegExpSearch -# NET_RegExpValid -# NET_RegisterAllEncodingConverters -NET_RegisterContentTypeConverter -# NET_RegisterCookiePrefCallbacks -# NET_RegisterEnableUrlMatchCallback -NET_RegisterEncodingConverter -# NET_RegisterMIMEDecoders -# NET_RegisterPadPrefCallbacks -# NET_RegisterProtocolImplementation -# NET_RegisterUniversalEncodingConverter -# NET_ReloadProxyConfig -# NET_RemoteHostLoad -# NET_RemoveAllAuthorizations -# NET_RemoveAllCookies -# NET_RemoveDiskCacheObjects -# NET_RemoveLastDiskCacheObject -# NET_RemoveLastMemoryCacheObject -NET_RemoveURLFromCache -# NET_RemoveURLFromMemCache -NET_SACat -NET_SACopy -# NET_SanityCheckDNS -# NET_SaveCookies -# NET_ScanForURLs -# NET_ScanHTMLForURLs -# NET_SelectProxyStyle -# NET_SendEmailAddressAsFTPPassword -# NET_SetActiveEntryBusyStatus -# NET_SetCacheUseMethod -# NET_SetCallNetlibAllTheTime -# NET_SetConnectPoll -# NET_SetConnectSelect -# NET_SetCookieString -# NET_SetCookieStringFromHttp -# NET_SetDNSExpirationPref -# NET_SetDiskCacheSize -# NET_SetEnableUrlMatchPref -# NET_SetFileReadSelect -# NET_SetIdentifyMeType -# NET_SetMemoryCacheSize -# NET_SetNetlibSlowKickTimer -NET_SetNewContext -# NET_SetNoProxyFailover -# NET_SetPadPacURL -# NET_SetProxyServer -# NET_SetReadPoll -# NET_SetReadSelect -# NET_SetSendRefererHeader -# NET_SetSocksHost -# NET_SetTCPConnectTimeout -NET_SetURLIPAddressString -# NET_SetupPrefs -# NET_ShutdownNetLib -# NET_SilentInterruptWindow -# NET_SimpleStream -# NET_Socket_Buffer -# NET_Socket_Buffer_Size -# NET_SocksHost -# NET_SocksHostName -# NET_SocksPort -# NET_SortAdd -# NET_SortCount -# NET_SortFree -# NET_SortInit -# NET_SortInsert -# NET_SortRetrieveNumber -# NET_SortUnloadNext -# NET_SpaceToPlus -# NET_StartupTime -NET_StreamBuilder -# NET_ToggleTrace -# NET_TotalNumberOfOpenConnections -# NET_TotalNumberOfProcessingURLs -NET_URL_Type -# NET_UUEncode -NET_UnEscape -# NET_UnEscapeBytes -# NET_UnEscapeCnt -# NET_UnZipConverter -# NET_UsePASV -# NET_UsingPadPac -# NET_WarnOnMailtoPost -# NET_WriteCacheFAT -# NET_WritePostData -# NET_cdataAdd -# NET_cdataCommit -# NET_cdataCreate -# NET_cdataExist -# NET_cdataFree -# NET_cdataRemove -# NET_cinfo_find_enc -# NET_cinfo_find_ext -# NET_cinfo_find_info_by_type -# NET_cinfo_find_type -# NET_f_a_c -# NET_free_write_post_data_object -# NET_getInternetKeyword -# NF_AboutFonts -# NF_FontBrokerInitialize -# NF_GetRCNativeData -# NF_RegisterConverters -# NPL_Abort -# NPL_Complete -# NPL_DeleteFileAssociation -# NPL_DeleteSessionData -# NPL_EmbedCreate -# NPL_EmbedDelete -# NPL_EmbedSize -# NPL_EmbedStart -# NPL_EmbedURLExit -# NPL_EnablePlugin -# NPL_EnablePluginType -# NPL_FindPluginEnabledForType -# NPL_FindPluginsForType -# NPL_GetEmbedReferenceCount -# NPL_GetFileAssociation -# NPL_HandleEvent -# NPL_HandleURL -# NPL_Init -# NPL_IsEmbedWindowed -# NPL_IsLiveConnected -# NPL_IteratePluginFiles -# NPL_IteratePluginTypes -# NPL_LoadPluginByType -# NPL_NewEmbedStream -# NPL_NewFileAssociation -# NPL_NewPresentStream -# NPL_PreparePrint -# NPL_Print -# NPL_RefreshPluginList -# NPL_RegisterDefaultConverters -# NPL_RegisterFileAssociation -# NPL_RegisterPluginFile -# NPL_RegisterPluginType -# NPL_RemoveFileAssociation -# NPL_SameElement -# NPL_SamePage -# NPL_SetPluginWindow -# NPL_Shutdown -# NPL_URLExit -# NPL_Write -# NPL_WriteReady -# NR_RegAddKey -# NR_RegClose -# NR_RegDeleteEntry -# NR_RegDeleteKey -# NR_RegEnumEntries -# NR_RegEnumSubkeys -# NR_RegGetEntry -# NR_RegGetEntryInfo -# NR_RegGetEntryString -# NR_RegGetKey -# NR_RegGetUsername -# NR_RegOpen -# NR_RegPack -# NR_RegSetEntry -# NR_RegSetEntryString -# NR_RegSetUsername -# NR_ShutdownRegistry -# NR_StartupRegistry -# NSC_CancelFunction -# NSC_CloseAllSessions -# NSC_CloseSession -# NSC_CopyObject -# NSC_CreateObject -# NSC_Decrypt -# NSC_DecryptDigestUpdate -# NSC_DecryptFinal -# NSC_DecryptInit -# NSC_DecryptUpdate -# NSC_DecryptVerifyUpdate -# NSC_DeriveKey -# NSC_DestroyObject -# NSC_Digest -# NSC_DigestEncryptUpdate -# NSC_DigestFinal -# NSC_DigestInit -# NSC_DigestKey -# NSC_DigestUpdate -# NSC_Encrypt -# NSC_EncryptFinal -# NSC_EncryptInit -# NSC_EncryptUpdate -# NSC_Finalize -# NSC_FindObjects -# NSC_FindObjectsFinal -# NSC_FindObjectsInit -# NSC_GenerateKey -# NSC_GenerateKeyPair -# NSC_GenerateRandom -# NSC_GetAttributeValue -# NSC_GetFunctionList -# NSC_GetFunctionStatus -# NSC_GetInfo -# NSC_GetMechanismInfo -# NSC_GetMechanismList -# NSC_GetObjectSize -# NSC_GetOperationState -# NSC_GetSessionInfo -# NSC_GetSlotInfo -# NSC_GetSlotList -# NSC_GetTokenInfo -# NSC_InitPIN -# NSC_InitToken -# NSC_Initialize -# NSC_Login -# NSC_Logout -# NSC_OpenSession -# NSC_SeedRandom -# NSC_SetAttributeValue -# NSC_SetOperationState -# NSC_SetPIN -# NSC_Sign -# NSC_SignEncryptUpdate -# NSC_SignFinal -# NSC_SignInit -# NSC_SignRecover -# NSC_SignRecoverInit -# NSC_SignUpdate -# NSC_UnwrapKey -# NSC_Verify -# NSC_VerifyFinal -# NSC_VerifyInit -# NSC_VerifyRecover -# NSC_VerifyRecoverInit -# NSC_VerifyUpdate -# NSC_WaitForSlotEvent -# NSC_WrapKey -# NSColors -# NewCertObject -# NewSubjectList -# One2OneCCC -# P12MOZ_DetermineSlotAndImportBlob -# P12MOZ_DoPKCS12ImportErrors -# P12MOZ_ExportPKCS12Object -# P12MOZ_GetExportPassword -# P12MOZ_ImportPKCS12Object -# P12MOZ_NicknameCollisionCallback -# PA_BeginParseMDL -# PA_CloneMDLTag -# PA_DropDocData -# PA_FetchAllNameValues -PA_FetchParamValue -# PA_FetchRequestedNameValues -# PA_FreeOverflow -# PA_FreeTag -# PA_GetOverflowBuf -# PA_GetOverflowDepth -# PA_HasMocha -# PA_HoldDocData -# PA_MDLAbort -# PA_MDLComplete -# PA_ParseBlock -# PA_ParseStringToTags -# PA_ParserInit -# PA_PopOverflow -# PA_PushOverflow -# PA_TagHasParams -# PA_TagIndex -# PA_TagString -# PBE_CreateContext -# PBE_DestroyContext -# PBE_GenerateBits -# PBE_PK11ParamToAlgid -# PC_AddToNameValueArray -# PC_ArraySize -# PC_CharToNameValueArray -# PC_CheckForStoredPasswordArray -# PC_CheckForStoredPasswordData -# PC_DeleteNameFromNameValueArray -# PC_DeleteStoredPassword -# PC_DisplayPasswordCacheAsHTML -# PC_EnumerateNameValueArray -# PC_FindInNameValueArray -# PC_FreeNameValueArray -# PC_NewNameValueArray -# PC_Prompt -# PC_PromptPassword -# PC_PromptUsernameAndPassword -# PC_RegisterDataInterpretFunc -# PC_SerializeNameValueArray -# PC_Shutdown -# PC_StorePasswordNameValueArray -# PC_StoreSerializedPassword -# PE_CreateContext -# PE_CreateWriteContext -# PE_Decrypt -# PE_DestroyContext -# PE_Encrypt -# PICS_AreRatingsRequired -PICS_CanUserEnableAdditionalJavaCapabilities -# PICS_CheckForValidTreeRating -# PICS_CompareToUserSettings -# PICS_FreeRatingsStruct -# PICS_Init -# PICS_IsPICSEnabledByUser -# PICS_ParsePICSLable -# PICS_RStoURL -# PK11_AddMechanismEntry -# PK11_AddSlotToList -# PK11_AlgtagToMechanism -# PK11_Authenticate -# PK11_BlockData -# PK11_ChangePW -# PK11_CheckSSOPassword -# PK11_CheckUserPassword -# PK11_CipherOp -# PK11_ClearSlotList -# PK11_CloneContext -# PK11_ConfigureFIPS -# PK11_ConfigurePKCS11 -# PK11_CopyKey -# PK11_CreateContextByRawKey -# PK11_CreateContextBySymKey -# PK11_CreateDigestContext -# PK11_CreateNewObject -# PK11_CreatePBEAlgorithmID -# PK11_CreateSymKey -# PK11_DefaultArray -# PK11_DeleteSlotFromList -# PK11_Derive -# PK11_DestroyContext -# PK11_DestroyObject -# PK11_DestroySlot -# PK11_DestroyTokenObject -# PK11_DigestBegin -# PK11_DigestFinal -# PK11_DigestKey -# PK11_DigestOp -# PK11_DoPassword -# PK11_DoesMechanism -# PK11_EndAuthTransaction -# PK11_EnterContextMonitor -# PK11_EnterSlotMonitor -# PK11_ExitContextMonitor -# PK11_ExitSlotMonitor -# PK11_ExportEncryptedPrivateKeyInfo -# PK11_ExportPrivateKeyInfo -# PK11_ExtractKeyValue -# PK11_ExtractPublicKey -# PK11_Finalize -# PK11_FindBestKEAMatch -# PK11_FindCertAndKeyByRecipientList -# PK11_FindCertByIssuerAndSN -# PK11_FindCertFromDERCert -# PK11_FindCertFromDERSubjectAndNickname -# PK11_FindCertFromNickname -# PK11_FindCertInSlot -# PK11_FindFixedKey -# PK11_FindKeyByAnyCert -# PK11_FindKeyByDERCert -# PK11_FindKeyByKeyID -# PK11_FindObjectForCert -# PK11_FindObjectFromNickname -# PK11_FindPrivateKeyFromCert -# PK11_FindSlotByName -# PK11_FindSlotBySerial -# PK11_FindSlotElement -# PK11_FortezzaHasKEA -# PK11_FortezzaMapSig -# PK11_FreeSlot -# PK11_FreeSlotCerts -# PK11_FreeSlotList -# PK11_FreeSymKey -# PK11_GenerateFortezzaIV -# PK11_GenerateKeyPair -# PK11_GenerateNewParam -# PK11_GenerateRandom -# PK11_GetAllTokens -# PK11_GetAttributes -# PK11_GetBestKeyLength -# PK11_GetBestSlot -# PK11_GetBestSlotMultiple -# PK11_GetBestWrapMechanism -# PK11_GetBlockSize -# PK11_GetCertFromPrivateKey -# PK11_GetCurrentWrapIndex -# PK11_GetDefaultFlags -# PK11_GetDisabledReason -# PK11_GetFirstSafe -# PK11_GetIVLength -# PK11_GetInternalKeySlot -# PK11_GetInternalSlot -# PK11_GetKEAMatchedCerts -# PK11_GetKeyData -# PK11_GetKeyGen -# PK11_GetKeyLength -# PK11_GetKeyStrength -# PK11_GetKeyType -# PK11_GetMechanism -# PK11_GetMinimumPwdLength -# PK11_GetModInfo -# PK11_GetModule -# PK11_GetModuleID -# PK11_GetNextSafe -# PK11_GetPadMechanism -# PK11_GetPrivateKeyTokens -# PK11_GetPrivateModulusLen -# PK11_GetPubIndexKeyID -# PK11_GetRWSession -# PK11_GetSlotFromKey -# PK11_GetSlotID -# PK11_GetSlotInfo -# PK11_GetSlotList -# PK11_GetSlotName -# PK11_GetSlotPWValues -# PK11_GetSlotSeries -# PK11_GetTokenInfo -# PK11_GetTokenName -# PK11_GetWindow -# PK11_GetWrapKey -# PK11_HandlePasswordCheck -# PK11_HasAttributeSet -# PK11_HashBuf -# PK11_HashOK -# PK11_IVFromParam -# PK11_ImportCert -# PK11_ImportCertForKey -# PK11_ImportCertForKeyToSlot -# PK11_ImportEncryptedPrivateKeyInfo -# PK11_ImportPrivateKeyInfo -# PK11_ImportPublicKey -# PK11_ImportSymKey -# PK11_InitPin -# PK11_InitSlot -# PK11_InitSlotLists -# PK11_InitToken -# PK11_IsDisabled -# PK11_IsFIPS -# PK11_IsFriendly -# PK11_IsHW -# PK11_IsInternal -# PK11_IsLoggedIn -# PK11_IsPresent -# PK11_IsReadOnly -# PK11_IsUserCert -# PK11_KeyForCertExists -# PK11_KeyGen -# PK11_LoadSlotList -# PK11_Logout -# PK11_LogoutAll -# PK11_LowInitialize -# PK11_MakeCertFromHandle -# PK11_MakeIDFromPubKey -# PK11_MakeKEAPubKey -# PK11_MakePrivKey -# PK11_MakeString -# PK11_MapError -# PK11_MapPBEMechanismToCryptoMechanism -# PK11_MatchItem -# PK11_MoveListToList -# PK11_NeedLogin -# PK11_NeedPWInit -# PK11_NeedUserInit -# PK11_NewSlotInfo -# PK11_NewSlotList -# PK11_NumberCertsForCertSubject -# PK11_NumberObjectsFor -# PK11_PBEKeyGen -# PK11_ParamFromAlgid -# PK11_ParamFromIV -# PK11_ParamToAlgid -# PK11_PubDecryptRaw -# PK11_PubDerive -# PK11_PubEncryptRaw -# PK11_PubUnwrapSymKey -# PK11_PubWrapSymKey -# PK11_RWSessionHasLock -# PK11_ReadAttribute -# PK11_ReadMechanismList -# PK11_ReadSlotCerts -# PK11_ReferenceSlot -# PK11_ReferenceSymKey -# PK11_RestoreContext -# PK11_RestoreROSession -# PK11_SaveContext -# PK11_SetPasswordFunc -# PK11_SetSlotPWValues -# PK11_SetWrapKey -# PK11_Sign -# PK11_SignatureLen -# PK11_SlotDBUpdate -# PK11_SlotInit -# PK11_StartAuthTransaction -# PK11_SymKeyFromHandle -# PK11_TokenExists -# PK11_TraverseCertsForNicknameInSlot -# PK11_TraverseCertsForSubject -# PK11_TraverseCertsForSubjectInSlot -# PK11_TraverseSlot -# PK11_TraverseSlotCerts -# PK11_UnwrapPrivKey -# PK11_UnwrapSymKey -# PK11_UpdateSlotAttribute -# PK11_UserDisableSlot -# PK11_UserEnableSlot -# PK11_Verify -# PK11_VerifyKeyOK -# PK11_VerifyMechanism -# PK11_VerifyPW -# PK11_VerifyRecover -# PK11_VerifySlotMechanisms -# PK11_WrapSymKey -# PL_IOMakePushable -# PL_IOPopModule -# PORT_Alloc -# PORT_ArenaAlloc -# PORT_ArenaGrow -# PORT_ArenaMark -# PORT_ArenaRelease -# PORT_ArenaStrdup -# PORT_ArenaZAlloc -# PORT_Free -# PORT_FreeArena -# PORT_GetError -# PORT_NewArena -# PORT_Realloc -# PORT_RegExpCaseSearch -# PORT_RegExpMatch -# PORT_RegExpSearch -# PORT_RegExpValid -# PORT_SetError -# PORT_SetUCS2_ASCIIConversionFunction -# PORT_SetUCS2_UTF8ConversionFunction -# PORT_SetUCS4_UTF8ConversionFunction -# PORT_UCS2_ASCIIConversion -# PORT_UCS2_UTF8Conversion -# PORT_UCS4_UTF8Conversion -# PORT_ZAlloc -# PORT_ZFree -# PQG_CreateParamGenContext -# PQG_DestroyParamGenContext -# PQG_DestroyParams -# PQG_DupParams -# PQG_ParamGen -# PQG_VerifyParams -# PREF_AboutConfig -# PREF_Cleanup -# PREF_ClearLIPref -# PREF_ClearUserPref -# PREF_CopyBinaryPref -PREF_CopyCharPref -# PREF_CopyConfigString -# PREF_CopyDefaultBinaryPref -PREF_CopyDefaultCharPref -# PREF_CopyIndexConfigString -# PREF_CopyPathPref -# PREF_CreateChildList -# PREF_DeleteBranch -# PREF_EvaluateConfigScript -# PREF_EvaluateJSBuffer -# PREF_GetBinaryPref -PREF_GetBoolPref -PREF_GetCharPref -# PREF_GetColorPref -# PREF_GetColorPrefDWord -# PREF_GetConfigBool -PREF_GetConfigContext -# PREF_GetConfigInt -# PREF_GetConfigString -# PREF_GetDefaultBinaryPref -PREF_GetDefaultBoolPref -# PREF_GetDefaultCharPref -# PREF_GetDefaultColorPref -# PREF_GetDefaultColorPrefDWord -# PREF_GetDefaultIntPref -# PREF_GetDefaultRectPref -PREF_GetGlobalConfigObject -PREF_GetIntPref -# PREF_GetPrefConfigObject -# PREF_GetPrefType -# PREF_GetRectPref -# PREF_Init -# PREF_IsAutoAdminEnabled -# PREF_NextChild -# PREF_PrefIsLocked -# PREF_QuietEvaluateJSBuffer -# PREF_QuietEvaluateJSBufferWithGlobalScope -PREF_ReadLIJSFile -# PREF_ReadLockFile -# PREF_ReadUserJSFile -PREF_RegisterCallback -PREF_SaveLIPrefFile -PREF_SavePrefFile -# PREF_SavePrefFileAs -# PREF_SavePrefFileWith -# PREF_SetBinaryPref -PREF_SetBoolPref -PREF_SetCharPref -# PREF_SetColorPref -# PREF_SetColorPrefDWord -# PREF_SetDefaultBinaryPref -# PREF_SetDefaultBoolPref -PREF_SetDefaultCharPref -# PREF_SetDefaultColorPref -# PREF_SetDefaultIntPref -# PREF_SetDefaultRectPref -PREF_SetIntPref -# PREF_SetPathPref -# PREF_SetRectPref -PREF_UnregisterCallback -# PRE_AddToList -# PRE_Enable -# PRE_Fetch -# PSFE_Alert -# PSFE_ClearView -# PSFE_Confirm -# PSFE_Courier -# PSFE_Courier_Bold -# PSFE_Courier_BoldOblique -# PSFE_Courier_Oblique -# PSFE_CreateNewDocWindow -# PSFE_DisplayBuiltin -# PSFE_DisplayEdge -# PSFE_DisplaySubDoc -# PSFE_DrawJavaApp -# PSFE_EnableClicking -# PSFE_EraseBackground -# PSFE_FileSortMethod -# PSFE_FormTextIsSubmit -# PSFE_FreeBuiltinElement -# PSFE_FreeEdgeElement -# PSFE_FreeFormElement -# PSFE_FreeJavaAppElement -# PSFE_GetDocPosition -# PSFE_GetFormElementValue -# PSFE_GetJavaAppSize -# PSFE_GetTextFrame -# PSFE_GraphProgress -# PSFE_GraphProgressDestroy -# PSFE_GraphProgressInit -# PSFE_HandleClippingView -# PSFE_HideJavaAppElement -# PSFE_LoadFontResource -# PSFE_MaskToFI -# PSFE_Progress -# PSFE_Prompt -# PSFE_PromptUsernameAndPassword -# PSFE_PromptWithCaption -# PSFE_ResetFormElement -# PSFE_SetBackgroundColor -# PSFE_SetDocPosition -# PSFE_SetDrawable -# PSFE_SetFormElementToggle -# PSFE_SetProgressBarPercent -# PSFE_ShowAllNewsArticles -# PSFE_Times_Bold -# PSFE_Times_BoldItalic -# PSFE_Times_Italic -# PSFE_Times_Roman -# PSFE_UpdateStopState -# PSFE_UseFancyFTP -# PSFE_UseFancyNewsgroupListing -# ParseDebug -# PeekMetaCharsetTag -# Pkcs11 -# Pref_ShowCharacterBar -# Pref_ShowLocationBar -# Pref_ShowParagraphBar -# Pref_ShowPersonalToolbar -# Pref_ShowToolbar -# PrepareBitStringForEncoding -# ProhibitBegin_BIG5 -# ProhibitBegin_CNS -# ProhibitBegin_EUCJP -# ProhibitBegin_GB -# ProhibitBegin_KSC -# ProhibitBegin_SJIS -# ProhibitBegin_UTF8 -# ProhibitEnd_BIG5 -# ProhibitEnd_CNS -# ProhibitEnd_EUCJP -# ProhibitEnd_GB -# ProhibitEnd_KSC -# ProhibitEnd_SJIS -# ProhibitEnd_UTF8 -# ProxyChoice -# Punct_badDemark -# RC2_CreateContext -# RC2_Decrypt -# RC2_DestroyContext -# RC2_Encrypt -# RC4_CreateContext -# RC4_Decrypt -# RC4_DestroyContext -# RC4_DupContext -# RC4_Encrypt -# RC5_CreateContext -# RC5_Decrypt -# RC5_DestroyContext -# RC5_Encrypt -# RNG_CreateContext -# RNG_DestroyContext -# RNG_FileForRNG -# RNG_GenerateGlobalRandomBytes -# RNG_GenerateRandomBytes -# RNG_GetNoise -# RNG_Init -# RNG_RNGInit -# RNG_RandomUpdate -# RNG_Reseed -# RNG_ResetRandom -# RNG_SystemInfoForRNG -# RNG_Update -# RSA_CheckSign -# RSA_CheckSignRaw -# RSA_CheckSignRecover -# RSA_CheckSignRecoverRaw -# RSA_CreateKeyGenContext -# RSA_CreatePrivateContext -# RSA_CreatePublicContext -# RSA_DecodeOneBlock -# RSA_DecryptBlock -# RSA_DecryptRaw -# RSA_DestroyKeyGenContext -# RSA_DestroyPrivateContext -# RSA_DestroyPublicContext -# RSA_EncryptBlock -# RSA_EncryptRaw -# RSA_FormatBlock -# RSA_FormatOneBlock -# RSA_KeyGen -# RSA_NewKey -# RSA_PrivateEnd -# RSA_PrivateKeyOp -# RSA_PrivateUpdate -# RSA_PublicEnd -# RSA_PublicKeyOp -# RSA_PublicUpdate -# RSA_Sign -# RSA_SignRaw -# Range_gap -# Range_toStr -# RemovePermSubjectNode -# RemoveTempCertFromSubjectList -# RunSharedMenuItem -# SECAlgorithmIDTemplate -# SECAnyTemplate -# SECBitStringTemplate -# SECBooleanTemplate -# SECHashObjects -# SECIA5StringTemplate -# SECITEM_CompareItem -# SECITEM_CopyItem -# SECITEM_DupItem -# SECITEM_FreeItem -# SECITEM_ZfreeItem -# SECIntegerTemplate -# SECKEY_AttributeTemplate -# SECKEY_ChangeKeyDBPassword -# SECKEY_ChangeKeyDBPasswordAlg -# SECKEY_CheckKeyDBPassword -# SECKEY_CloseKeyDB -# SECKEY_ConvertAndDecodePublicKey -# SECKEY_ConvertAndDecodePublicKeyAndChallenge -# SECKEY_ConvertAndDecodeSubjectPublicKeyInfo -# SECKEY_ConvertToPublicKey -# SECKEY_CopyEncryptedPrivateKeyInfo -# SECKEY_CopyLowPrivateKey -# SECKEY_CopyPrivateKey -# SECKEY_CopyPrivateKeyInfo -# SECKEY_CopyPublicKey -# SECKEY_CopySubjectPublicKeyInfo -# SECKEY_CreateRSAPrivateKey -# SECKEY_CreateSubjectPublicKeyInfo -# SECKEY_DSADecodePQG -# SECKEY_DSAPrivateKeyExportTemplate -# SECKEY_DSAPrivateKeyTemplate -# SECKEY_DSAPublicKeyTemplate -# SECKEY_DecodeDERPublicKey -# SECKEY_DecodeDERSubjectPublicKeyInfo -# SECKEY_DecryptKey -# SECKEY_DeleteKey -# SECKEY_DestroyEncryptedPrivateKeyInfo -# SECKEY_DestroyPrivateKey -# SECKEY_DestroyPrivateKeyInfo -# SECKEY_DestroyPublicKey -# SECKEY_DestroySubjectPublicKeyInfo -# SECKEY_EncryptedPrivateKeyInfoTemplate -# SECKEY_FindKeyByCert -# SECKEY_FindKeyByPublicKey -# SECKEY_FortezzaAltPreParamTemplate -# SECKEY_FortezzaDecodeCertKey -# SECKEY_FortezzaDecodePQGtoOld -# SECKEY_FortezzaDiffParameterTemplate -# SECKEY_FortezzaParameterTemplate -# SECKEY_FortezzaPreParamTemplate -# SECKEY_GetDefaultKeyDB -# SECKEY_GetDefaultKeyDBAlg -# SECKEY_HasKeyDBPassword -# SECKEY_HashPassword -# SECKEY_KEAParamCompare -# SECKEY_KEAParamsTemplate -# SECKEY_KEAPublicKeyTemplate -# SECKEY_KEASetParams -# SECKEY_KeyForCertExists -# SECKEY_LowConvertToPublicKey -# SECKEY_LowDestroyPrivateKey -# SECKEY_LowDestroyPublicKey -# SECKEY_LowPrivateModulusLen -# SECKEY_LowPublicModulusLen -# SECKEY_OpenKeyDB -# SECKEY_OpenKeyDBFilename -# SECKEY_PQGParamsTemplate -# SECKEY_PointerToEncryptedPrivateKeyInfoTemplate -# SECKEY_PointerToPrivateKeyInfoTemplate -# SECKEY_PrivateKeyInfoTemplate -# SECKEY_PublicKeyStrength -# SECKEY_RSAPrivateKeyTemplate -# SECKEY_RSAPublicKeyTemplate -# SECKEY_SetDefaultKeyDB -# SECKEY_SetDefaultKeyDBAlg -# SECKEY_SetKeyDBPassword -# SECKEY_SetKeyDBPasswordAlg -# SECKEY_SetOfAttributeTemplate -# SECKEY_StoreKeyByPublicKey -# SECKEY_StoreKeyByPublicKeyAlg -# SECKEY_TraverseKeys -# SECKEY_UpdateCertPQG -# SECKEY_UpdateKeyDBPass1 -# SECKEY_UpdateKeyDBPass2 -# SECMIME_CreateEncrypted -# SECMIME_CreateSigned -# SECMIME_DecryptionAllowed -# SECMIME_EnableCipher -# SECMIME_SetPolicy -# SECMOD_AddList -# SECMOD_AddModule -# SECMOD_AddNewModule -# SECMOD_AddPermDB -# SECMOD_DeleteInternalModule -# SECMOD_DeleteModule -# SECMOD_DeletePermDB -# SECMOD_DestroyListLock -# SECMOD_DestroyModule -# SECMOD_DestroyModuleList -# SECMOD_DestroyModuleListElement -# SECMOD_DupModule -# SECMOD_FindModule -# SECMOD_FindModuleByID -# SECMOD_FindSlot -# SECMOD_GetDefaultModuleList -# SECMOD_GetDefaultModuleListLock -# SECMOD_GetFIPSInternal -# SECMOD_GetInternalModule -# SECMOD_GetReadLock -# SECMOD_GetWriteLock -# SECMOD_InitDB -# SECMOD_InternaltoPubCipherFlags -# SECMOD_InternaltoPubMechFlags -# SECMOD_IsModulePresent -# SECMOD_LoadModule -# SECMOD_LookupSlot -# SECMOD_NewInternal -# SECMOD_NewListLock -# SECMOD_NewModule -# SECMOD_NewModuleListElement -# SECMOD_PubCipherFlagstoInternal -# SECMOD_PubMechFlagstoInternal -# SECMOD_ReadPermDB -# SECMOD_ReferenceModule -# SECMOD_ReleaseReadLock -# SECMOD_ReleaseWriteLock -# SECMOD_RemoveList -# SECMOD_SlotDestroyModule -# SECMOD_UnloadModule -# SECMOD_init -# SECMOZ_MakeCertPolicyButtonString -# SECMOZ_MakeCertRevokeButtonString -# SECNAV_AdvisorRedraw -# SECNAV_AlgAllowed -# SECNAV_AlgOKToDo -# SECNAV_AlgPreferred -# SECNAV_AskPrefToPK11 -# SECNAV_BrowserSecInfoDialog -# SECNAV_CertFromSSLSocketStatus -# SECNAV_CertificateStream -# SECNAV_CloseStatusDialog -# SECNAV_CompareCertsForRedirection -# SECNAV_ComputeFortezzaProxyChallengeResponse -# SECNAV_ConfirmServerCert -# SECNAV_CopySSLSocketStatus -# SECNAV_CrlStream -# SECNAV_DefaultEmailCertInit -# SECNAV_DeleteEmailCertificate -# SECNAV_DeleteJavaPrincipal -# SECNAV_DeleteJavaPrivilege -# SECNAV_DeleteSecurityModule -# SECNAV_DeleteSiteCertificate -# SECNAV_DeleteUserCertificate -# SECNAV_DisplayCertDialog -# SECNAV_DisplayEmailCertDialog -# SECNAV_EarlyInit -# SECNAV_EditEmailCertificate -# SECNAV_EditJavaPrivileges -# SECNAV_EditModule -# SECNAV_EditSiteCertificate -# SECNAV_FindEnd -# SECNAV_FindInit -# SECNAV_FindNext -# SECNAV_FortezzaPresent -# SECNAV_GenKeyFromChoice -# SECNAV_GetCAPolicyString -# SECNAV_GetClientAuthData -# SECNAV_GetDefProxyCert -# SECNAV_GetDefUserCertList -# SECNAV_GetDefaultEMailCert -# SECNAV_GetDisabledReason -# SECNAV_GetHostFromURL -# SECNAV_GetKeyChoiceList -# SECNAV_GetKeyDBPassword -# SECNAV_GetKeyDBPasswordStatus -# SECNAV_GetPWSetupDialogVar -# SECNAV_GetPolicyNameString -# SECNAV_GetPolicyStringByName -# SECNAV_GetProtoDesc -# SECNAV_GetProtoName -# SECNAV_HTTPHead -# SECNAV_HandleBadCert -# SECNAV_HandleInternalSecURL -# SECNAV_Init -# SECNAV_InitConfigObject -# SECNAV_IsCRLPresent -# SECNAV_IsJavaPrinCert -# SECNAV_IsPreEncrypted -# SECNAV_Logout -# SECNAV_LogoutAllSecurityModules -# SECNAV_LogoutSecurityModule -# SECNAV_MailCertPrefChange -# SECNAV_MakeCADownloadPanel -# SECNAV_MakeCertButtonString -# SECNAV_MakeCiphersDialog -# SECNAV_MakeClientAuthDialog -# SECNAV_MakeDeleteCertCB -# SECNAV_MakeEmailCertDownloadDialog -# SECNAV_MakePWChangeDialog -# SECNAV_MakePWSetupDialog -# SECNAV_MakePreencryptedStream -# SECNAV_MakePreencryptedWriteStream -# SECNAV_MakeStatusDialog -# SECNAV_MakeUserCertDownloadDialog -# SECNAV_MungeString -# SECNAV_NewSecurityModule -# SECNAV_NewUserCertificate -# SECNAV_PolicyInit -# SECNAV_Posting -# SECNAV_PrefBoolUpdate -# SECNAV_PrefsRefresh -# SECNAV_PrettySecurityStatus -# SECNAV_PromptPassword -# SECNAV_RegisterNetlibMimeConverters -# SECNAV_RevocationStream -# SECNAV_RunInitialSecConfig -# SECNAV_SSLCapabilities -# SECNAV_SSLSocketCertString -# SECNAV_SSLSocketStatus -# SECNAV_SSLSocketStatusLength -# SECNAV_SecHandleSecurityAdvisorURL -# SECNAV_SecURLContentType -# SECNAV_SecURLData -# SECNAV_SecurityAdvisor -# SECNAV_SecurityDialog -# SECNAV_SecurityVersion -# SECNAV_SelectCert -# SECNAV_SetDefProxyCert -# SECNAV_SetDefUserCertList -# SECNAV_SetPasswordAskPrefs -# SECNAV_SetPreencryptedSocket -# SECNAV_SetupSecureSocket -# SECNAV_Shutdown -# SECNAV_UCS2_ASCIIConversion -# SECNAV_UCS2_UTF8Conversion -# SECNAV_UCS4_UTF8Conversion -# SECNAV_UnMungeString -# SECNAV_UnicodeConversion -# SECNAV_VerifyCertificate -# SECNAV_ViewCRLs -# SECNAV_ViewUserCertificate -# SECNAV_ZeroPassword -# SECNAV_getMaxKeyGenBits -# SECNAV_policyString -SECNAV_signedAppletPrivileges -# SECNAV_signedAppletPrivilegesOnMozillaThread -# SECNullTemplate -# SECOID_AddEntry -# SECOID_AlgorithmIDTemplate -# SECOID_CompareAlgorithmID -# SECOID_CopyAlgorithmID -# SECOID_DestroyAlgorithmID -# SECOID_FindOID -# SECOID_FindOIDByTag -# SECOID_FindOIDTag -# SECOID_FindOIDTagDescription -# SECOID_GetAlgorithmTag -# SECOID_KnownCertExtenOID -# SECOID_SetAlgorithmID -# SECObjectIDTemplate -# SECOctetStringTemplate -# SECPrintableStringTemplate -# SECRawHashObjects -# SECT61StringTemplate -# SECUTCTimeTemplate -# SEC_ASN1Decode -# SEC_ASN1DecodeItem -# SEC_ASN1DecoderClearFilterProc -# SEC_ASN1DecoderClearNotifyProc -# SEC_ASN1DecoderFinish -# SEC_ASN1DecoderSetFilterProc -# SEC_ASN1DecoderSetNotifyProc -# SEC_ASN1DecoderStart -# SEC_ASN1DecoderUpdate -# SEC_ASN1Encode -# SEC_ASN1EncodeEnumerated -# SEC_ASN1EncodeInteger -# SEC_ASN1EncodeItem -# SEC_ASN1EncodeUnsignedInteger -# SEC_ASN1EncoderClearNotifyProc -# SEC_ASN1EncoderClearStreaming -# SEC_ASN1EncoderClearTakeFromBuf -# SEC_ASN1EncoderFinish -# SEC_ASN1EncoderSetNotifyProc -# SEC_ASN1EncoderSetStreaming -# SEC_ASN1EncoderSetTakeFromBuf -# SEC_ASN1EncoderStart -# SEC_ASN1EncoderUpdate -# SEC_ASN1GetSubtemplate -# SEC_ASN1LengthLength -# SEC_AddPermCrlToTemp -# SEC_AddTempNickname -# SEC_AnyTemplate -# SEC_BMPStringTemplate -# SEC_BitStringTemplate -# SEC_BooleanTemplate -# SEC_CERTExtensionTemplate -# SEC_CertDBKeyConflict -# SEC_CertNicknameConflict -# SEC_CertSequenceTemplate -# SEC_CertSubjectTemplate -# SEC_CheckCRL -# SEC_CheckCrlTimes -# SEC_CheckKRL -# SEC_CrlIsNewer -# SEC_CrlReplaceUrl -# SEC_DeletePermCRL -# SEC_DeletePermCertificate -# SEC_DeleteTempCrl -# SEC_DeleteTempNickname -# SEC_DerSignData -# SEC_DestroyCrl -# SEC_EnumeratedTemplate -# SEC_FindCrlByDERCert -# SEC_FindCrlByKey -# SEC_FindCrlByName -# SEC_FindPermCertByKey -# SEC_FindPermCertByName -# SEC_FindPermCertByNickname -# SEC_GeneralizedTimeTemplate -# SEC_GetCrlTimes -# SEC_IA5StringTemplate -# SEC_Init -# SEC_IntegerTemplate -# SEC_LookupCrls -# SEC_MakeKeyGenDialog -# SEC_NewCrl -# SEC_NullTemplate -# SEC_ObjectIDTemplate -# SEC_OctetStringTemplate -# SEC_OpenPermCertDB -# SEC_PKCS12AddCert -# SEC_PKCS12AddCertAndKey -# SEC_PKCS12AddDERCertAndEncryptedKey -# SEC_PKCS12AddKeyForCert -# SEC_PKCS12AddPasswordIntegrity -# SEC_PKCS12AddPublicKeyIntegrity -# SEC_PKCS12AuthenticatedSafeTemplate -# SEC_PKCS12AuthenticatedSafeTemplate_OLD -# SEC_PKCS12BaggageItemTemplate -# SEC_PKCS12BaggageTemplate -# SEC_PKCS12BaggageTemplate_OLD -# SEC_PKCS12CertAndCRLBagTemplate -# SEC_PKCS12CertAndCRLBagTemplate_OLD -# SEC_PKCS12CertAndCRLTemplate -# SEC_PKCS12CertAndCRLTemplate_OLD -# SEC_PKCS12CodedCertAndCRLBagTemplate -# SEC_PKCS12CodedCertBagTemplate -# SEC_PKCS12CodedSafeBagTemplate -# SEC_PKCS12CreateExportContext -# SEC_PKCS12CreateNestedSafeContents -# SEC_PKCS12CreatePasswordPrivSafe -# SEC_PKCS12CreatePubKeyEncryptedSafe -# SEC_PKCS12CreateUnencryptedSafe -# SEC_PKCS12DecoderFinish -# SEC_PKCS12DecoderImportBags -# SEC_PKCS12DecoderStart -# SEC_PKCS12DecoderUpdate -# SEC_PKCS12DecoderValidateBags -# SEC_PKCS12DecoderVerify -# SEC_PKCS12DecryptionAllowed -# SEC_PKCS12DestroyExportContext -# SEC_PKCS12DestroyPFX -# SEC_PKCS12ESPVKItemTemplate -# SEC_PKCS12ESPVKItemTemplate_OLD -# SEC_PKCS12EnableCipher -# SEC_PKCS12Encode -# SEC_PKCS12ExportCertificateAndKeyUsingPassword -# SEC_PKCS12GetPreferredEncryptionAlgorithm -# SEC_PKCS12GetStrongestAllowedAlgorithm -# SEC_PKCS12IsEncryptionAllowed -# SEC_PKCS12MacDataTemplate -# SEC_PKCS12PFXItemTemplate -# SEC_PKCS12PFXItemTemplate_OLD -# SEC_PKCS12PVKAdditionalDataTemplate -# SEC_PKCS12PVKSupportingDataTemplate -# SEC_PKCS12PVKSupportingDataTemplate_OLD -# SEC_PKCS12PrivateKeyBagTemplate -# SEC_PKCS12PrivateKeyTemplate -# SEC_PKCS12PutPFX -# SEC_PKCS12SDSICertTemplate -# SEC_PKCS12SafeBagTemplate -# SEC_PKCS12SafeBagTemplate_OLD -# SEC_PKCS12SafeContentsTemplate -# SEC_PKCS12SafeContentsTemplate_OLD -# SEC_PKCS12SecretAdditionalTemplate -# SEC_PKCS12SecretBagTemplate -# SEC_PKCS12SecretItemTemplate -# SEC_PKCS12SecretTemplate -# SEC_PKCS12SetPreferredCipher -# SEC_PKCS12ValidData -# SEC_PKCS12X509CertCRLTemplate -# SEC_PKCS12X509CertCRLTemplate_OLD -# SEC_PKCS5CipherData -# SEC_PKCS5CreateAlgorithmID -# SEC_PKCS5DestroyPBEParameter -# SEC_PKCS5GetCryptoAlgorithm -# SEC_PKCS5GetIV -# SEC_PKCS5GetKey -# SEC_PKCS5GetKeyLength -# SEC_PKCS5GetPBEAlgorithm -# SEC_PKCS5GetPBEParameter -# SEC_PKCS5GetSalt -# SEC_PKCS5IsAlgorithmPBEAlg -# SEC_PKCS5PBEParameterTemplate -# SEC_PKCS7AddCertChain -# SEC_PKCS7AddCertificate -# SEC_PKCS7AddRecipient -# SEC_PKCS7AddSignedAttribute -# SEC_PKCS7AddSigningTime -# SEC_PKCS7ContainsCertsOrCrls -# SEC_PKCS7ContentIsEncrypted -# SEC_PKCS7ContentIsSigned -# SEC_PKCS7ContentType -# SEC_PKCS7CopyContentInfo -# SEC_PKCS7CreateCertsOnly -# SEC_PKCS7CreateData -# SEC_PKCS7CreateEncryptedData -# SEC_PKCS7CreateEnvelopedData -# SEC_PKCS7CreateSignedData -# SEC_PKCS7DecodeItem -# SEC_PKCS7DecoderFinish -# SEC_PKCS7DecoderStart -# SEC_PKCS7DecoderUpdate -# SEC_PKCS7DecryptContents -# SEC_PKCS7DestroyContentInfo -# SEC_PKCS7Encode -# SEC_PKCS7EncodeItem -# SEC_PKCS7EncoderFinish -# SEC_PKCS7EncoderStart -# SEC_PKCS7EncoderUpdate -# SEC_PKCS7EncryptContents -# SEC_PKCS7GetCertificateList -# SEC_PKCS7GetContent -# SEC_PKCS7GetEncryptionAlgorithm -# SEC_PKCS7GetKeyLength -# SEC_PKCS7GetSignerCommonName -# SEC_PKCS7GetSignerEmailAddress -# SEC_PKCS7GetSigningTime -# SEC_PKCS7IncludeCertChain -# SEC_PKCS7IsContentEmpty -# SEC_PKCS7PrepareForEncode -# SEC_PKCS7SetContent -# SEC_PKCS7VerifyDetachedSignature -# SEC_PKCS7VerifySignature -# SEC_PointerToAnyTemplate -# SEC_PointerToBitStringTemplate -# SEC_PointerToBooleanTemplate -# SEC_PointerToIA5StringTemplate -# SEC_PointerToIntegerTemplate -# SEC_PointerToNullTemplate -# SEC_PointerToObjectIDTemplate -# SEC_PointerToOctetStringTemplate -# SEC_PointerToPKCS12CertAndCRLBagTemplate -# SEC_PointerToPKCS12CertAndCRLBagTemplate_OLD -# SEC_PointerToPKCS12KeyBagTemplate -# SEC_PointerToPKCS12SDSICertTemplate -# SEC_PointerToPKCS12SecretBagTemplate -# SEC_PointerToPKCS12X509CertCRLTemplate -# SEC_PointerToPKCS12X509CertCRLTemplate_OLD -# SEC_PointerToPrintableStringTemplate -# SEC_PointerToT61StringTemplate -# SEC_PointerToUTCTimeTemplate -# SEC_PrintableStringTemplate -# SEC_ReadCertSequence -# SEC_ReadPKCS7Certs -# SEC_SMIMEKEAParamTemplateAllParams -# SEC_SMIMEKEAParamTemplateNoSkipjack -# SEC_SMIMEKEAParamTemplateSkipjack -# SEC_SetOfAnyTemplate -# SEC_SetOfBitStringTemplate -# SEC_SetOfBooleanTemplate -# SEC_SetOfIA5StringTemplate -# SEC_SetOfIntegerTemplate -# SEC_SetOfNullTemplate -# SEC_SetOfObjectIDTemplate -# SEC_SetOfOctetStringTemplate -# SEC_SetOfPrintableStringTemplate -# SEC_SetOfT61StringTemplate -# SEC_SetOfUTCTimeTemplate -# SEC_SignData -# SEC_SignFile -# SEC_SignedCertificateTemplate -# SEC_SkipTemplate -# SEC_T61StringTemplate -# SEC_TraverseDBEntries -# SEC_TraversePermCerts -# SEC_UTCTimeTemplate -# SEC_UniversalStringTemplate -# SEC_V2PKCS12PBEParameterTemplate -# SEC_VerifyFile -# SEC_VisibleStringTemplate -# SGNDigestInfoTemplate -# SGN_Begin -# SGN_CompareDigestInfo -# SGN_CopyDigestInfo -# SGN_CreateDigestInfo -# SGN_DecodeDigestInfo -# SGN_DestroyContext -# SGN_DestroyDigestInfo -# SGN_Digest -# SGN_EncodeDigestInfo -# SGN_End -# SGN_NewContext -# SGN_Update -SHA1_Begin -# SHA1_CloneContext -SHA1_DestroyContext -SHA1_End -# SHA1_Flatten -# SHA1_FlattenSize -# SHA1_Hash -# SHA1_HashBuf -SHA1_NewContext -# SHA1_Resurrect -SHA1_Update -# SHIST_AddDocument -# SHIST_CanGoBack -# SHIST_CanGoForward -# SHIST_CloneEntry -# SHIST_CopySession -# SHIST_CreateHistoryEntry -# SHIST_CreateURLStructFromHistoryEntry -# SHIST_CreateWysiwygURLStruct -# SHIST_CurrentHandlesPageServices -SHIST_EndSession -# SHIST_FreeHistoryEntry -SHIST_GetCurrent -# SHIST_GetCurrentPageServicesURL -# SHIST_GetEntry -# SHIST_GetIndex -# SHIST_GetList -# SHIST_GetNext -# SHIST_GetObjectNum -# SHIST_GetPrevious -# SHIST_HoldEntry -# SHIST_InitSession -# SHIST_SetCurrent -# SHIST_SetCurrentDocEmbedListData -# SHIST_SetCurrentDocFormListData -# SHIST_SetCurrentDocGridData -# SHIST_SetCurrentDocWindowData -# SHIST_SetPositionOfCurrentDoc -# SHIST_SetTitleOfCurrentDoc -# SHIST_StripProtocol -# SI_DisplaySignonInfoAsHTML -# SI_LoadSignonData -# SI_Prompt -# SI_PromptPassword -# SI_PromptUsernameAndPassword -# SI_RememberSignonData -# SI_RemoveAllSignonData -# SI_RemoveUser -# SI_RestoreOldSignonData -# SI_SaveSignonData -# SI_StartOfForm -# SML_Delete -# SML_FreeTagStruct -# SML_GetStyleByIndex -# SML_GetStyleByReverseIndex -# SML_GetTagByIndex -# SML_GetTagByReverseIndex -# SML_Init -# SML_IsSaveOn -# SML_NewTagStruct -# SML_PopTag -# SML_PopTagByIndex -# SML_Purge -# SML_PushTag -# SML_SetObjectRefs -# SML_SetSaveOn -# SML_StyleStack_Factory_Create -SOB_JAR_end_hash -# SOB_JAR_get_error -SOB_JAR_hash -SOB_JAR_list_certs -SOB_JAR_new_hash -SOB_JAR_sign_archive -SOB_JAR_validate_archive -SOB_calculate_digest -SOB_cert_attribute -# SOB_cert_html -# SOB_close_database -SOB_destroy -# SOB_destroy_signer -# SOB_digest_file -# SOB_extract -# SOB_fetch_cert -SOB_find -SOB_find_end -SOB_find_next -SOB_get_error -# SOB_get_filename -SOB_get_metainfo -SOB_get_url -SOB_new -# SOB_new_signer -# SOB_open_database -SOB_parse_manifest -SOB_pass_archive -SOB_set_callback -SOB_set_context -SOB_stash_cert -SOB_verified_extract -SOB_verify_digest -# SSL3_CleanupPeerCerts -# SSL3_ConstructV2CipherSpecsHack -# SSL3_CreateExportRSAKeys -# SSL3_EnableCipher -# SSL3_HandleAlert -# SSL3_HandleCertificate -# SSL3_HandleCertificateRequest -# SSL3_HandleClientHello -# SSL3_HandleClientKeyExchange -# SSL3_HandleFinished -# SSL3_HandleHandshake -# SSL3_HandleHelloRequest -# SSL3_HandleRecord -# SSL3_HandleServerHello -# SSL3_HandleServerHelloDone -# SSL3_HandleServerKeyExchange -# SSL3_HandleV2ClientHello -# SSL3_RedoHandshake -# SSL3_SendAlert -# SSL3_SendCertificateVerify -# SSL3_SendClientHello -# SSL3_SendClientKeyExchange -# SSL3_SendHelloRequest -# SSL3_SetFortezzaKeys -# SSL3_SetPolicy -# SSL_AuthCertificate -# SSL_AuthCertificateHook -# SSL_BadCertHook -# SSL_BindForSockd -# SSL_CheckDirectSock -# SSL_ClearSessionCache -# SSL_ConfigSecureServer -# SSL_ConfigSockd -SSL_DataPending -# SSL_Enable -# SSL_EnableCipher -# SSL_EnableDefault -# SSL_EncryptChallenge -# SSL_ForceHandshake -# SSL_GetClientAuthDataHook -# SSL_GetSessionID -# SSL_HandshakeCallback -# SSL_ImportFD -# SSL_InvalidateSession -# SSL_IsDomestic -# SSL_PeerCertificate -# SSL_PreencryptedFileToStream -# SSL_PreencryptedStreamToFile -# SSL_PushModule -# SSL_ReadSocksConfFile -# SSL_RedoHandshake -# SSL_ResetHandshake -# SSL_RestartHandshakeAfterCertReq -# SSL_RestartHandshakeAfterServerCert -# SSL_SecurityCapabilities -# SSL_SecurityStatus -# SSL_SendErrorMessage -# SSL_SetPKCS11PinArg -# SSL_SetPolicy -# SSL_SetSockPeerID -# SSL_SetURL -# SS_copySSNumber -# SS_count -# SS_delete -# SS_duplicate -# SS_freeSSNumber -# SS_getNumber -# SS_getString -# SS_newSSNumber -# SS_setNumber -# SS_setString -# SS_stringToSSNumber -# STYLESTRUCT_Factory_Create -# SVal_clear -# SVal_initialized -# SVal_readVal -# SVal_value -# SaveAsCompletionProc -# SetImageContextBackgroundColor -# SetMenusInserterCallback -# SetMenusRemoverCallback -# SharedMenuHit -# SharedScriptCancelled -# SharedScriptRunning -# SoftUpdate -# StyleAndTagStack_interface -# StyleStruct_interface -# TXFE_Alert -# TXFE_AllConnectionsComplete -# TXFE_BeginPreSection -# TXFE_ClearCallNetlibAllTheTime -# TXFE_ClearView -# TXFE_Confirm -# TXFE_CreateEmbedWindow -# TXFE_CreateNewDocWindow -# TXFE_CreateNewEditWindow -# TXFE_DestroyEmbedWindow -# TXFE_DisplayBorder -# TXFE_DisplayBuiltin -# TXFE_DisplayBullet -# TXFE_DisplayCell -# TXFE_DisplayEdge -# TXFE_DisplayEmbed -# TXFE_DisplayFeedback -# TXFE_DisplayFormElement -# TXFE_DisplayHR -# TXFE_DisplayJavaApp -# TXFE_DisplayLineFeed -# TXFE_DisplaySubDoc -# TXFE_DisplaySubtext -# TXFE_DisplayTable -# TXFE_DisplayText -# TXFE_DrawJavaApp -# TXFE_EnableClicking -# TXFE_EndPreSection -# TXFE_EraseBackground -# TXFE_FileSortMethod -# TXFE_FinishedLayout -# TXFE_FormTextIsSubmit -# TXFE_FreeBuiltinElement -# TXFE_FreeEdgeElement -# TXFE_FreeEmbedElement -# TXFE_FreeFormElement -# TXFE_FreeJavaAppElement -# TXFE_GetDocPosition -# TXFE_GetEmbedSize -# TXFE_GetFormElementInfo -# TXFE_GetFormElementValue -# TXFE_GetJavaAppSize -# TXFE_GetTextFrame -# TXFE_GetTextInfo -# TXFE_GraphProgress -# TXFE_GraphProgressDestroy -# TXFE_GraphProgressInit -# TXFE_HandleClippingView -# TXFE_HideJavaAppElement -# TXFE_LayoutNewDocument -# TXFE_LoadFontResource -# TXFE_Progress -# TXFE_Prompt -# TXFE_PromptPassword -# TXFE_PromptUsernameAndPassword -# TXFE_PromptWithCaption -# TXFE_ResetFormElement -# TXFE_RestoreEmbedWindow -# TXFE_SaveEmbedWindow -# TXFE_SetBackgroundColor -# TXFE_SetCallNetlibAllTheTime -# TXFE_SetDocDimension -# TXFE_SetDocPosition -# TXFE_SetDocTitle -# TXFE_SetDrawable -# TXFE_SetFormElementToggle -# TXFE_SetProgressBarPercent -# TXFE_ShowAllNewsArticles -# TXFE_TranslateISOText -# TXFE_UpdateStopState -# TXFE_UseFancyFTP -# TXFE_UseFancyNewsgroupListing -# TagConstructor -# Tag_BorderWidth -# Tag_GetProperty -# Tag_Margin -# Tag_Padding -# Tag_ResolveName -# Tag_SetProperty -# Tag_class -# TagsConstructor -# Tags_ResolveName -# Tags_class -# TheEarlManager -# Total -# UCS2_To_Other -# UNDO_CanRedo -# UNDO_CanUndo -# UNDO_Create -# UNDO_Destroy -# UNDO_DiscardAll -# UNDO_DoRedo -# UNDO_DoUndo -# UNDO_EndBatch -# UNDO_LogEvent -# UNDO_PeekRedoTag -# UNDO_PeekUndoTag -# UNDO_StartBatch -# UTCTimeToDateObject -# UserCertChoice -# UserOverride -# VFY_Begin -# VFY_CreateContext -# VFY_DestroyContext -# VFY_End -# VFY_Update -# VFY_VerifyData -# VFY_VerifyDigest -# VR_Close -# VR_CreateRegistry -# VR_Enum -# VR_EnumUninstall -# VR_GetDefaultDirectory -# VR_GetPath -# VR_GetRefCount -# VR_GetVersion -# VR_InRegistry -# VR_Install -# VR_PackRegistry -# VR_Remove -# VR_SetDefaultDirectory -# VR_SetRefCount -# VR_SetRegDirectory -# VR_StubOpen -# VR_UninstallAddFileToList -# VR_UninstallCreateNode -# VR_UninstallDeleteFileFromList -# VR_UninstallDeleteSharedFilesKey -# VR_UninstallDestroy -# VR_UninstallEnumSharedFiles -# VR_UninstallFileExistsInList -# VR_ValidateComponent -# VerifyDisplayContextColorSpace -# WF_fbc -# WF_fbp -# WF_fbu -WH_FileName -WH_FilePlatformName -WH_TempName -# WWWTrace -# WWW_TraceFlag -# XL_AbortTextTranslation -# XL_DisplayTextImage -# XL_GetTextImage -# XL_InitializeTextSetup -# XL_TranslateText -XP_AddContextToList -# XP_AddNavCenterSitemap -# XP_AddObserver -# XP_AllocStruct -# XP_AllocStructZero -# XP_AppCodeName -# XP_AppLanguage -# XP_AppName -# XP_AppPlatform -# XP_AppVersion -# XP_AppendStr -# XP_BackupFileName -XP_Cat -# XP_CheckElementSpan -# XP_CleanupPrintInfo -# XP_ClearCallNetlibAllTheTime -XP_CloseDir -# XP_Clrhash -# XP_ColorNameToRGB -# XP_ContextCount -# XP_ConvertUrlToLocalFile -XP_CopyDialogString -# XP_CopyRect -XP_DeleteContext -# XP_DestroyHTMLDialogWindow -# XP_DisableObserverNotification -# XP_DisposeObserverList -# XP_DockNavCenter -# XP_DrawForPrint -# XP_EnableObserverNotification -# XP_EqualRect -# XP_FileDuplicateResourceFork -# XP_FileIsFullPath -# XP_FileNameContainsBadChars -# XP_FileNumberOfFilesInDirectory -XP_FileOpen -XP_FileReadLine -XP_FileRemove -XP_FileRename -# XP_FileSpec -# XP_FileTruncate -# XP_FindContextOfType -# XP_FindNamedAnchor -XP_FindNamedContextInList -XP_FindSomeContext -XP_FindValueInArgs -# XP_FreeAllStructs -XP_FreeDialogStrings -# XP_FreeStruct -XP_GetDialogStrings -# XP_GetError -# XP_GetGlobalContextList -# XP_GetLastActiveContext -XP_GetNavCenterContext -XP_GetNonGridContext -# XP_GetObserverListObservable -XP_GetSecurityStatus -XP_GetString -# XP_GetStringForHTML -XP_GetURLForView -# XP_Gethash -# XP_HandleHTMLDialog -# XP_HandleHTMLPanel -# XP_HashListAddObject -# XP_HashListDestroy -# XP_HashListFindObject -# XP_HashListNew -# XP_HashListRemoveObject -# XP_HashTableDestroy -# XP_HashTableNew -# XP_InitAllocStructInfo -XP_InitializeContext -# XP_InitializePrintInfo -XP_InterruptContext -# XP_IntersectRect -# XP_IsChildContext -# XP_IsContextBusy -# XP_IsContextInList -# XP_IsContextStoppable -# XP_IsEmptyRect -# XP_IsNavCenterDocked -# XP_IsObserverNotificationEnabled -# XP_LayoutForPrint -XP_ListAddObject -XP_ListAddObjectToEnd -XP_ListCount -XP_ListDestroy -# XP_ListFindObject -# XP_ListGetEndObject -# XP_ListGetNumFromObject -XP_ListGetObjectNum -# XP_ListInsertObject -# XP_ListInsertObjectAfter -# XP_ListMoveTopToBottom -XP_ListNew -# XP_ListNextEncodingType -# XP_ListNextPresentationType -# XP_ListPeekTopObject -# XP_ListRemoveEndObject -XP_ListRemoveObject -XP_ListRemoveTopObject -# XP_LocalZoneOffset -# XP_MakeDirectory -XP_MakeDirectoryR -XP_MakeHTMLAlert -XP_MakeHTMLDialog -XP_MakeHTMLDialogWithChrome -XP_MakeHTMLPanel -XP_MakeRawHTMLDialog -# XP_MapRemhash -# XP_Maphash -# XP_Md5Binary -# XP_Md5PCPrintable -# XP_Message -# XP_MessageLen -# XP_NEW_DOC_NAME -# XP_NEW_DOC_URL -# XP_NetHelp -XP_NewContext -# XP_NewObserverList -# XP_NotifyObservers -# XP_OffsetRect -XP_OpenDir -XP_ParseTimeString -XP_PlatformFileToURL -# XP_PlatformPartialPathToXPPartialPath -# XP_PointInRect -# XP_PolicyVersion -# XP_PrettySecurityStatus -XP_ProgressText -# XP_PutDialogStringsTagToStream -# XP_PutDialogStringsToStream -# XP_Puthash -XP_QSORT -XP_ReadDir -# XP_RectContainsRect -# XP_RectsBbox -# XP_RectsOverlap -XP_RedrawRawHTMLDialog -# XP_RefreshAnchors -# XP_RegisterNavCenter -# XP_RegisterViewHTMLPane -# XP_Remhash -# XP_RemoveContextFromLastActiveStack -XP_RemoveContextFromList -# XP_RemoveDirectory -# XP_RemoveDirectoryRecursive -# XP_RemoveNavCenterInfo -# XP_RemoveObserver -XP_STRNCAT_SAFE -# XP_STRNCPY_SAFE -# XP_STRTOK_R -# XP_SecurityCapabilities -# XP_SecurityVersion -XP_SetDialogString -XP_SetError -# XP_SetLastActiveContext -# XP_SetNavCenterUrl -# XP_SetObserverListObservable -XP_Stat -# XP_StaticMessage -# XP_StrColl -# XP_StrfTime -# XP_StringHash -# XP_StringHash2 -XP_StripLine -XP_TempDirName -XP_Trace -# XP_Trace1 -# XP_TraceV -# XP_UndockNavCenter -# XP_UnregisterNavCenter -# XP_UpdateParentContext -# XP_WordWrap -# ZS_DestroyLink -# ZS_NewLink -# _IMGCB_ControlPixmapBits -# _IMGCB_DestroyPixmap -# _IMGCB_DisplayIcon -# _IMGCB_DisplayPixmap -# _IMGCB_GetIconDimensions -# _IMGCB_NewPixmap -# _IMGCB_UpdatePixmap -# _IMGCB_addRef -# _IMGCB_clone -# _IMGCB_equals -# _IMGCB_finalize -# _IMGCB_getBackwardCompatibleInterface -# _IMGCB_getInterface -# _IMGCB_hashCode -# _IMGCB_init -# _IMGCB_release -# _IMGCB_toString -# __initialize -# __ptmf_null -# __start -# __terminate -# _cdoer_Update -# _cdoer_addRef -# _cdoer_clone -# _cdoer_equals -# _cdoer_finalize -# _cdoer_getBackwardCompatibleInterface -# _cdoer_getInterface -# _cdoer_hashCode -# _cdoer_init -# _cdoer_release -# _cdoer_toString -# _cf_EnumerateSizes -# _cf_GetMatchInfo -# _cf_GetRcMajorType -# _cf_GetRcMinorType -# _cf_GetRenderableFont -# _cf_GetState -# _cf_addRef -# _cf_clone -# _cf_equals -# _cf_finalize -# _cf_getBackwardCompatibleInterface -# _cf_getInterface -# _cf_hashCode -# _cf_init -# _cf_release -# _cf_toString -# _cfb_CreateFontFromFile -# _cfb_CreateFontFromUrl -# _cfb_GetBaseFont -# _cfb_ListFonts -# _cfb_ListSizes -# _cfb_LookupFont -# _cfb_addRef -# _cfb_clone -# _cfb_equals -# _cfb_finalize -# _cfb_getBackwardCompatibleInterface -# _cfb_getInterface -# _cfb_hashCode -# _cfb_init -# _cfb_nffbp_CreateFontDisplayerFromDLM -# _cfb_nffbp_RegisterFontDisplayer -# _cfb_nffbp_RfDone -# _cfb_nffbp_ScanForFontDisplayers -# _cfb_nffbp_addRef -# _cfb_nffbp_clone -# _cfb_nffbp_equals -# _cfb_nffbp_finalize -# _cfb_nffbp_getInterface -# _cfb_nffbp_hashCode -# _cfb_nffbp_release -# _cfb_nffbp_toString -# _cfb_nffbu_CreateFontMatchInfo -# _cfb_nffbu_CreateFontObserver -# _cfb_nffbu_CreateRenderingContext -# _cfb_nffbu_DisableFontDisplayer -# _cfb_nffbu_DisableMimetype -# _cfb_nffbu_DisableWebfonts -# _cfb_nffbu_EnableFontDisplayer -# _cfb_nffbu_EnableMimetype -# _cfb_nffbu_EnableWebfonts -# _cfb_nffbu_FontDisplayerForMimetype -# _cfb_nffbu_IsFontDisplayerEnabled -# _cfb_nffbu_IsWebfontsEnabled -# _cfb_nffbu_ListFontDisplayers -# _cfb_nffbu_ListFontDisplayersForMimetype -# _cfb_nffbu_LoadCatalog -# _cfb_nffbu_LoadWebfont -# _cfb_nffbu_LookupFailed -# _cfb_nffbu_ReleaseWebfonts -# _cfb_nffbu_SaveCatalog -# _cfb_nffbu_ToUnicode -# _cfb_nffbu_UnicodeLen -# _cfb_nffbu_WebfontsNeedReload -# _cfb_nffbu_addRef -# _cfb_nffbu_clone -# _cfb_nffbu_equals -# _cfb_nffbu_finalize -# _cfb_nffbu_free -# _cfb_nffbu_getInterface -# _cfb_nffbu_hashCode -# _cfb_nffbu_malloc -# _cfb_nffbu_realloc -# _cfb_nffbu_release -# _cfb_nffbu_toString -# _cfb_release -# _cfb_toString -# _cfmi_GetValue -# _cfmi_IsEquivalent -# _cfmi_ListAttributes -# _cfmi_addRef -# _cfmi_clone -# _cfmi_equals -# _cfmi_finalize -# _cfmi_getBackwardCompatibleInterface -# _cfmi_getInterface -# _cfmi_hashCode -# _cfmi_init -# _cfmi_release -# _cfmi_toString -# _cinfo_parse_mcc -# _cinfo_parse_mimetypes -# _crc_GetMajorType -# _crc_GetMinorType -# _crc_GetPlatformData -# _crc_IsEquivalent -# _crc_SetPlatformData -# _crc_addRef -# _crc_clone -# _crc_equals -# _crc_finalize -# _crc_getBackwardCompatibleInterface -# _crc_getInterface -# _crc_hashCode -# _crc_init -# _crc_release -# _crc_toString -# _java_jsl_init -# active_cache_data_objects -# address_max_length -# algTable -# asd_Version -# asd_alert -# asd_conditional_update -# asd_get_version -# asd_platform -# asd_start_update -# autoJCCC -# autoKCCC -# barnames -# cDocInfoWindowContextName -# cViewSourceWindowContextName1 -# cViewSourceWindowContextName2 -# cache_DBDataToExtCacheDBInfoStruct -# cache_ExtCacheDBInfoStructToDBData -# cache_freeExtCacheDBInfoObj -# cdoerFactory_Create -# cdoerVtable -# cert_CombineConstraintsLists -# cert_CombineNamesLists -# cert_CompareNameWithConstraints -# cert_DBInsertCRL -# cert_DecodeGeneralName -# cert_DecodeGeneralNames -# cert_DecodeNameConstraint -# cert_DecodeNameConstraintSubTree -# cert_DecodeNameConstraints -# cert_DestroyGeneralNames -# cert_DynamicGenNameTemplate -# cert_EncodeGeneralName -# cert_EncodeGeneralNames -# cert_EncodeNameConstraint -# cert_EncodeNameConstraintSubTree -# cert_EncodeNameConstraints -# cert_FindExtension -# cert_FindExtensionByOID -# cert_HasCriticalExtension -# cert_HasUnknownCriticalExten -# cert_StartExtensions -# cert_check_crl_version -# cfFactory_Create -# cfVtable -# cfbFactory_Create -# cfbVtable -# cfmiFactory_Create -# cfmiVtable -# cgi_ConvertStringToArgVec -# cinfo_MasterListPointer -# ciphers_dialog_handler -# cl_CopyPixels -# cl_GetDrawableOrigin -# cl_InitDrawable -# cl_LayerAdded -# cl_LayerDestroyed -# cl_LayerMoved -# cl_LayerRemoved -# cl_LockDrawableForRead -# cl_LockDrawableForReadWrite -# cl_LockDrawableForWrite -# cl_ParentChanged -# cl_RelinquishDrawable -# cl_RestoreDrawableClip -# cl_SetCompositorRecursive -# cl_SetDrawableClip -# cl_SetDrawableDimensions -# cl_SetDrawableOrigin -# cl_UnlockDrawable -# cl_UpdateLayer -# cl_XorRegion -# cl_sanitize_bbox -# cl_start_compositor_timeouts -# cl_trace_level -# classPlugin -# class_hash -# collectCertStrings -# colorPopupMDEFProc -# compareNameToConstraint -# crcFactory_Create -# crcVtable -# crypto_finalize -# crypto_random -# cscvt_tbl -# csname2id_tbl -# css_FreeNode -# css_GetBuf -# css__create_buffer -# css__delete_buffer -# css__flush_buffer -# css__init_buffer -# css__load_buffer_state -# css__scan_buffer -# css__scan_bytes -# css__scan_string -# css__switch_to_buffer -# css_char -# css_error -# css_in -# css_leng -# css_lex -# css_lval -# css_nerrs -# css_out -# css_parse -# css_restart -# css_text -# css_tree_root -# css_wrap -# cursorTask -# cursorsH -# cx_AddChildContext -# cx_RemoveChildContext -# default_csid -# do_timer -# dum_NewTitleObserverList -# dum_TitleObserver -# edt_setAutoStartBody -# edt_setBlockFormat -# edt_setCharFormat -# edt_setContainerBreakConvert -# edt_setContainerHasLineAfter -# edt_setContainerSupportsAlign -# edt_setFormattedText -# edt_setHeadTags -# edt_setIgnoreBreakAfterClose -# edt_setIgnoreWhiteSpace -# edt_setList -# edt_setListContainer -# edt_setNoEndTag -# edt_setParagraphBreak -# edt_setRequireNewlineAfter -# edt_setSoloTags -# edt_setSuppressNewlineBefore -# edt_setTextContainer -# edt_setUnsupported -# edt_setWriteEndTag -# emptyQueues -# end_callback -# et_PutMochaDecoder -# et_SubEventLoop -# et_TopQueue -# exportKey -# exportPubKey -# fXlatList -# fc_getAttribute -# fd_set_size -# fieldID_netscape_net_SSLInputStream_eof -# fieldID_netscape_net_SSLInputStream_impl -# fieldID_netscape_net_SSLInputStream_temp -# fieldID_netscape_net_SSLOutputStream_impl -# fieldID_netscape_net_SSLOutputStream_temp -# fieldID_netscape_net_SSLSecurityStatus_STATUS_FORTEZZA -# fieldID_netscape_net_SSLSecurityStatus_STATUS_NOOPT -# fieldID_netscape_net_SSLSecurityStatus_STATUS_OFF -# fieldID_netscape_net_SSLSecurityStatus_STATUS_ON_HIGH -# fieldID_netscape_net_SSLSecurityStatus_STATUS_ON_LOW -# fieldID_netscape_net_SSLSecurityStatus_cipher -# fieldID_netscape_net_SSLSecurityStatus_issuer -# fieldID_netscape_net_SSLSecurityStatus_serialNumber -# fieldID_netscape_net_SSLSecurityStatus_sessionKeySize -# fieldID_netscape_net_SSLSecurityStatus_sessionSecretSize -# fieldID_netscape_net_SSLSecurityStatus_status -# fieldID_netscape_net_SSLSecurityStatus_subject -# fieldID_netscape_net_SSLSocketImpl_callbackNotifier -# fieldID_netscape_net_SSLSocketImpl_clientModeInitialized -# fieldID_netscape_net_SSLSocketImpl_handshakeListeners -# fieldID_netscape_net_SSLSocketImpl_requireClientAuth -# fieldID_netscape_net_SSLSocketImpl_socket -# fieldID_netscape_net_SSLSocketImpl_timeout -# fieldID_netscape_net_SSLSocketImpl_trustedForClientAuth -# fieldID_netscape_net_SSLSocketImpl_useClientMode -# fill_input_buffer -# filteredURLs -# fortezzaIsCA -# foundPADPAC -# freeHTMLDialogStream -# gAppleDoubleSpecList -# gCallNewText -# gColorSpaces -# gColorTables -# gOneBitTable -# gSaveAsPrompt -# gSaveAsType -# gUploadAsType -# getCertVarStrings -# getCryptoModuleStrings -# getDisplayName -# getJavaPrincipalStrings -# getStatusValues -# get_next_general_name -# get_next_name_constraint -# get_prev_general_name -# get_prev_name_constraint -# gh_link_expiration_changed -# hex_table_initialized -# hist_go -# hk_GetHookObject -# hk_HookObjectAddProperty -# hk_HookObjectDeleteProperty -# hk_HookObjectSetProperty -# hk_IsUnknownTagHook -# hk_NumKnownTags -# hk_SetFunctionExistence -# hk_SetHookObject -# hk_TagFunctionString -# hk_TagIndexToFunctionString -# hk_TagStringToIndex -# hot_GetIndexOf -# hot_GetUnfoldedIndexOf -# iFontFaceTags -# iFontFaces -# il_abort -# il_abort_reconnect -# il_add_client -# il_adjust_cache_fullness -# il_cache -# il_cache_return_notify -# il_create_alpha_mask -# il_debug -# il_delete_container -# il_destroy_image_transparent_pixel -# il_destroy_pixmap -# il_emit_row -# il_error_exit -# il_first_write -# il_flush_image_data -# il_frame_complete_notify -# il_free_quantize -# il_get_container -# il_gif_abort -# il_gif_complete -# il_gif_compute_percentage_complete -# il_gif_init -# il_gif_write -# il_gif_write_ready -# il_group_notify -# il_hash -# il_image_abort -# il_image_complete -# il_image_complete_notify -# il_image_destroyed_notify -# il_image_stopped -# il_init_image_transparent_pixel -# il_init_quantize -# il_jpeg_COM_handler -# il_jpeg_abort -# il_jpeg_complete -# il_jpeg_init -# il_jpeg_write -# il_load_image -# il_partial -# il_pixmap_update_notify -# il_png_abort -# il_png_complete -# il_png_init -# il_png_init_transparency -# il_png_write -# il_progress_notify -# il_quantize_fs_dither -# il_reconnect -# il_reduce_image_cache_size_to -# il_removefromcache -# il_reset_palette -# il_scour_container -# il_setup_color_space_converter -# il_setup_quantize -# il_size -# il_stream_complete -# il_write_ready -# il_xbm_abort -# il_xbm_complete -# il_xbm_init -# il_xbm_write -# importPKCS12Blob -# info_callback -# init_source -# intl_SetAcceptCharset -# intl_SetAcceptLanguage -# intl_detect_JCSID -# intl_detect_KCSID -# isotab -# jis2other -# js_content_type -# js_language_name -# jsacf_exit_routine -# jsl_nodl_tab -# jss_CompareStringsNoCase -# jss_Contextual -# jss_DestroyProperties -# jss_DestroyRules -# jss_DestroyTag -# jss_DestroyTags -# jss_EnumApplicableRules -# jss_FinalizeStyleObject -# jss_GetStyleForTopTag -# jss_HashStringNoCase -# jss_LookupRule -# jss_NewRule -# jss_NewTag -# kProfileNamePref -# layer_check_access -# layer_setBgColorProperty -# libnet_asyncIO -# lm_AddFormElement -# lm_AddObjectToArray -# lm_BranchCallback -# lm_CanAccessTarget -# lm_CanCaptureEvent -# lm_CheckContainerAccess -# lm_CheckPermissions -# lm_CheckSetParentSlot -# lm_CheckURL -# lm_CheckWindowName -# lm_CleanUpDocument -# lm_CleanUpDocumentRoots -# lm_ClearDecoderStream -# lm_ClearWindowTimeouts -# lm_CompileEventHandler -# lm_DefineBarClasses -# lm_DefineComponents -# lm_DefineCrypto -# lm_DefineDocument -# lm_DefineHardware -# lm_DefineHistory -# lm_DefineLocation -# lm_DefineNavigator -# lm_DefinePkcs11 -# lm_DefinePluginClasses -# lm_DefineScreen -# lm_DefineTriggers -# lm_DefineWindowProps -# lm_DestroyLayer -# lm_DestroyPrincipalsList -# lm_DestroyWindow -# lm_DocCacheConverter -# lm_DummyObject -# lm_ErrorReporter -# lm_EventName -# lm_ExitJSDebug -# lm_FindEventHandler -# lm_FindEventInMWContext -# lm_FixNewlines -# lm_FreeWindowContent -# lm_GetActiveContainer -# lm_GetAppletArray -# lm_GetCompilationPrincipals -# lm_GetContainerPrincipals -# lm_GetCrossOriginEnabled -# lm_GetDocumentFromLayerId -# lm_GetDocumentLayerArray -# lm_GetEmbedArray -# lm_GetEventNames -# lm_GetFormArray -# lm_GetFormElementByIndex -# lm_GetFormElementFromMapping -# lm_GetFormObjectByID -# lm_GetIdToObjectMap -# lm_GetImageArray -# lm_GetInnermostPrincipals -# lm_GetLayerOriginURL -# lm_GetLinkArray -# lm_GetNameArray -# lm_GetNamedLayer -# lm_GetObjectOriginURL -# lm_GetOuterObject -# lm_GetPrincipalsCompromise -# lm_GetPrincipalsFromStackFrame -# lm_GetSubjectOriginURL -# lm_GetURL -# lm_HandleEvent -# lm_InitAnchorClass -# lm_InitDocumentClass -# lm_InitEventClasses -# lm_InitImageClass -# lm_InitInputClasses -# lm_InitJSDebug -# lm_InitLayerClass -# lm_InitRectClass -# lm_InitWindowContent -# lm_InputEvent -# lm_InterpretQueue -# lm_InterpretThread -# lm_InvalidateCertPrincipals -# lm_JSEnv -# lm_KeyHash -# lm_KeyInputEvent -# lm_LocalEncodingToStr -# lm_MakeWysiwygUrl -# lm_MouseInputEvent -# lm_NewEventObject -# lm_NewImage -# lm_NewImageContext -# lm_NewLayerDocument -# lm_NewMIMETypeList -# lm_NewPluginList -# lm_NewSoftupObject -# lm_NewURL -# lm_NewWindow -# lm_PriorityQueue -# lm_ProcessImageEvent -# lm_ReflectRadioButtonArray -# lm_RegisterComponent -# lm_RegisterComponentMethod -# lm_RegisterComponentProp -# lm_ReplaceURL -# lm_ResolveBar -# lm_ResolveWindowProps -# lm_RestoreLayerState -# lm_RestoreWindowTimeouts -# lm_SaveParamString -# lm_SaveWindowTimeouts -# lm_SendEvent -# lm_SendLayerLoadEvent -# lm_SendLoadEvent -# lm_SendOnReset -# lm_SendOnSubmit -# lm_SetActiveForm -# lm_SetContainerPrincipals -# lm_SetDocumentDomain -# lm_SetExternalCapture -# lm_SetInputStream -# lm_SetLayerSourceURL -# lm_SetVersion -# lm_StrToLocalEncoding -# lm_anchor_array_class -# lm_anchor_class -# lm_anchors_str -# lm_applet_array_class -# lm_applets_str -# lm_argc_err_str -# lm_assign_str -# lm_background_str -# lm_bar_class -# lm_bgcolor_str -# lm_blur_str -# lm_bottom_str -# lm_click_str -# lm_clip_str -# lm_closed_str -# lm_component_array_class -# lm_component_class -# lm_components_str -# lm_crippled_context -# lm_crippled_decoder -# lm_disable_str -# lm_document_class -# lm_document_str -# lm_embed_array_class -# lm_embeds_str -# lm_enable_str -# lm_event_argv -# lm_event_class -# lm_event_str -# lm_focus_str -# lm_form_array_class -# lm_form_class -# lm_forms_str -# lm_getPrefix_str -# lm_hardware_class -# lm_hist_class -# lm_image_array_class -# lm_image_class -# lm_images_str -# lm_input_array_class -# lm_input_class -# lm_java_clasp -# lm_jsval_to_rgb -# lm_layer_array_class -# lm_layer_class -# lm_layers_str -# lm_left_str -# lm_length_str -# lm_link_array_class -# lm_links_str -# lm_location_class -# lm_location_str -# lm_methodArgc_str -# lm_methodArgv_str -# lm_methodPrefix_str -# lm_navigator_class -# lm_navigator_str -# lm_netcaster_str -# lm_onAbort_str -# lm_onBlur_str -# lm_onChange_str -# lm_onClick_str -# lm_onError_str -# lm_onFocus_str -# lm_onHelp_str -# lm_onLoad_str -# lm_onLocate_str -# lm_onMouseDown_str -# lm_onMouseOut_str -# lm_onMouseOver_str -# lm_onMouseUp_str -# lm_onReset_str -# lm_onScroll_str -# lm_onSelect_str -# lm_onSubmit_str -# lm_onUnload_str -# lm_opener_str -# lm_option_class -# lm_owner_mon -# lm_parentLayer_str -# lm_plugins_str -# lm_reload_str -# lm_replace_str -# lm_right_str -# lm_runtime -# lm_screen_class -# lm_scroll_str -# lm_select_str -# lm_setPrefix_str -lm_softup_class -# lm_src_str -# lm_toString_str -# lm_top_str -# lm_typePrefix_str -# lm_unknown_origin_str -# lm_url_class -# lm_visibility_str -# lm_wait_for_events -# lm_window_class -# lm_writing_context -# lm_zindex_str -# lo_ActivateImageLayer -# lo_AddEmbedData -# lo_AddLineListToLayer -# lo_AddMarginStack -# lo_AddNameList -# lo_AddToUrlList -# lo_AllCellsSelectedInColumnOrRow -# lo_AppendFloatInLineList -# lo_AppendLineFeed -# lo_AppendLineListToLineArray -# lo_AppendMultiColToLineList -# lo_AppendParamList -# lo_AppendTextToBlock -# lo_AppendToLineList -# lo_AppendZeroWidthAndHeightLF -# lo_AttachHTMLLayer -# lo_AutoloadPrefChangedFunc -# lo_BeginCaptionSubDoc -# lo_BeginCellSubDoc -# lo_BeginForm -# lo_BeginGrid -# lo_BeginGridCell -# lo_BeginLayer -# lo_BeginLayerTag -# lo_BeginMap -# lo_BeginMapArea -# lo_BeginMulticolumn -# lo_BeginOptionTag -# lo_BeginReflectForm -# lo_BeginSelectTag -# lo_BeginSubgrid -# lo_BeginTable -# lo_BeginTableAttributes -# lo_BeginTableCaption -# lo_BeginTableCell -# lo_BeginTableCellAttributes -# lo_BeginTableRow -# lo_BeginTableRowAttributes -# lo_BeginTextareaTag -# lo_BindNamedAnchorToElement -# lo_BlockLayerTag -# lo_BlockScriptTag -# lo_BlockTag -# lo_BlockedImageLayout -# lo_BodyBackground -# lo_BodyForeground -# lo_BodyMargins -# lo_BreakOldElement -# lo_BreakOldTextBlockElement -# lo_BumpEditablePosition -# lo_CalcAlignOffsets -# lo_CalcFixedColWidths -# lo_CalcTableWidthForPercentMode -# lo_CanUseBreakTable -# lo_CaptureLines -# lo_ChangeBodyTextFGColor -# lo_ChangeText -# lo_CheckNameList -# lo_CheckObjectBlockage -# lo_CleanFormElementData -# lo_CleanTextWhitespace -# lo_ClearObjectBlock -# lo_ClearToBothMargins -# lo_ClearToLeftMargin -# lo_ClearToRightMargin -# lo_ClipImage -# lo_ClipLines -# lo_CloneTagAndBlockLayout -# lo_CloseJavaApp -# lo_CloseMochaWriteStream -# lo_CloseOutLayout -# lo_CloseOutTable -# lo_CloseParagraph -# lo_CloseTable -# lo_ComputeTextMinWidth -# lo_ContextToCell -# lo_ConvertAllValues -# lo_ConvertInsertPointToSelectionEnd -# lo_ConvertMochaEntities -# lo_ConvertSelectionEndToInsertPoint -# lo_ConvertToFELinebreaks -# lo_CopyTextAttr -# lo_CreateBlinkLayer -# lo_CreateBlockLayer -# lo_CreateCellBackgroundLayer -# lo_CreateCellFromSubDoc -# lo_CreateDefaultLayers -# lo_CreateEmbeddedObjectLayer -# lo_CreateImageLayer -# lo_CurrentLayer -# lo_CurrentLayerId -# lo_CurrentLayerState -# lo_CurrentSubState -# lo_DecrementPosition -# lo_DefaultFont -# lo_DefaultList -# lo_DeleteDocLists -# lo_DeleteLayerStack -# lo_DeleteLayerState -# lo_DeleteObjectStack -# lo_DestroyAnchor -# lo_DestroyBlinkers -# lo_DestroyLayers -# lo_DestroyScriptData -# lo_DisplayBullet -# lo_DisplayCell -# lo_DisplayCellContents -# lo_DisplayEdge -# lo_DisplayElement -# lo_DisplayEmbed -# lo_DisplayFormElement -# lo_DisplayHR -# lo_DisplayImageWithoutCompositor -# lo_DisplayJavaApp -# lo_DisplayLineFeed -# lo_DisplaySubDoc -# lo_DisplaySubImageWithoutCompositor -# lo_DisplaySubtext -# lo_DisplayTable -# lo_DisplayText -# lo_EditableElement -# lo_EndCellSubDoc -# lo_EndForm -# lo_EndGrid -# lo_EndLayer -# lo_EndLayerTag -# lo_EndLayoutDuringReflow -# lo_EndMap -# lo_EndMulticolumn -# lo_EndOptionTag -# lo_EndReflectForm -# lo_EndSelectTag -# lo_EndSubgrid -# lo_EndTable -# lo_EndTableCaption -# lo_EndTableCell -# lo_EndTableRow -# lo_EndTextareaTag -# lo_EnsureEditableSearch -# lo_EnsureEditableSearch2 -# lo_EnsureEditableSearchNext -# lo_EnsureEditableSearchNext2 -# lo_EnsureEditableSearchPrev -# lo_EnsureEditableSearchPrev2 -# lo_EvalAlignParam -# lo_EvalCellAlignParam -# lo_EvalDivisionAlignParam -# lo_EvalStyleSheetAlignment -# lo_EvalTrueOrFalse -# lo_EvalVAlignParam -# lo_ExtendSelectionToPosition2 -# lo_FEToNetLinebreaks -# lo_FetchFontFace -# lo_FetchObjectData -# lo_FetchParamValue -# lo_FetchTextAttr -lo_FetchTopState -# lo_FillInEmbedGeometry -# lo_FillInHorizontalRuleGeometry -# lo_FillInImageGeometry -# lo_FillInJavaAppGeometry -# lo_FillInLineFeed -# lo_FilterTag -# lo_FindBestPositionInTable -# lo_FindBestPositionOnLine -# lo_FindBlockOffset -# lo_FindClosestUpDown_Cell -# lo_FindDocumentEdge -# lo_FindLineMargins -# lo_FindMochaExpr -# lo_FindNamedMap -# lo_FindReuseableElement -# lo_FindWord -# lo_FinishEmbed -# lo_FinishHorizontalRuleLayout -# lo_FinishImage -# lo_FinishJavaApp -# lo_FinishLayerLayout -# lo_FinishLayout -# lo_FinishLayout_OutOfMemory -# lo_FirstElementOfLine -# lo_FlushBlockage -# lo_FlushLineBuffer -# lo_FlushLineList -# lo_FlushTextBlock -# lo_FlushTextElement -# lo_FormatBullet -# lo_FormatBulletStr -# lo_FormatEmbed -# lo_FormatEmbedObject -# lo_FormatImage -# lo_FormatJavaApp -# lo_FormatJavaObject -# lo_FormatObject -# lo_FormatText -# lo_FreeDocumentEmbedListData -# lo_FreeDocumentFormListData -# lo_FreeDocumentGridData -# lo_FreeElement -# lo_FreeElementList -# lo_FreeFormElementData -# lo_FreeGridCellRec -# lo_FreeGridEdge -# lo_FreeGridRec -# lo_FreeImageAttributes -# lo_FreeLayoutData -# lo_FreeMap -# lo_FreeMemoryArena -# lo_FreePartialCell -# lo_FreePartialSubDoc -# lo_FreePartialTable -# lo_FreeRecycleList -# lo_FreshText -# lo_FullHitElement -# lo_FullSetSelection -# lo_GetAnchorData -# lo_GetAnchorPoint -# lo_GetCellBaseline -# lo_GetCellContainingElement -# lo_GetCellFromLayer -# lo_GetCellPadding -# lo_GetCellTagHeight -# lo_GetCellTagWidth -# lo_GetColSpan -# lo_GetCurrentDocLists -# lo_GetCurrentGridCellStatus -# lo_GetCurrentGridCellUrl -# lo_GetDocListsById -# lo_GetElementAnchor -# lo_GetElementBbox -# lo_GetElementEdge -# lo_GetElementFGColor -# lo_GetElementLength -# lo_GetElementTextAttr -# lo_GetEnclosingLayerHeight -# lo_GetEnclosingLayerWidth -# lo_GetExtensionPoint -# lo_GetFirstAndLastCellsInColumnOrRow -# lo_GetFirstAndLastCellsInTable -# lo_GetFirstCellInColumnOrRow -# lo_GetGridCellMargins -# lo_GetImage -# lo_GetLastCharBeginPosition -# lo_GetLastCharEndPosition -# lo_GetLastElementInList -# lo_GetLayerClipExpansionPolicy -# lo_GetLayerState -# lo_GetLayerXYShift -# lo_GetLineEnds -# lo_GetMaximumInsertPointPosition -# lo_GetMochaTopState -# lo_GetNeighbor -# lo_GetNumberOfCellsInTable -# lo_GetParentCell -# lo_GetParentTable -# lo_GetRecycleList -# lo_GetRowSpan -# lo_GetSubDocBaseline -# lo_GetTextAttrMask -# lo_GrowTextBlock -# lo_HardLineBreak -# lo_HardLineBreakWithClearType -# lo_HighlightSelect -# lo_HitLine -# lo_HitLine2 -# lo_HorizontalRule -# lo_ImageObserver -# lo_IncrementPosition -# lo_InheritParentColors -# lo_InheritParentState -# lo_InitDocLists -# lo_InitDocState -# lo_InitForBeginCell -# lo_InitSubDocForBeginCell -# lo_InitTableRecord -# lo_InitializeMemoryArena -# lo_InsertLineBreak -# lo_InsertWordBreak -# lo_InsideInflowLayer -# lo_InsideLayer -# lo_InternalDiscardDocument -# lo_IsAnchorInDoc -# lo_IsAnyCurrentAncestorDynamic -# lo_IsAnyCurrentAncestorSourced -# lo_IsCurrentLayerDynamic -# lo_IsDummyLayoutElement -# lo_IsEdgeOfDocument -# lo_IsEdgeOfDocument2 -# lo_IsEmptyTag -# lo_IsEndOfParagraph2 -# lo_IsTagInSourcedLayer -# lo_IsValidEditableInsertPoint2 -# lo_IsValidTarget -# lo_JumpCellWall -# lo_LayoutFloatEmbed -# lo_LayoutFloatImage -# lo_LayoutFloatJavaApp -# lo_LayoutFormattedText -# lo_LayoutInflowEmbed -# lo_LayoutInflowFormElement -# lo_LayoutInflowImage -# lo_LayoutInflowJavaApp -# lo_LayoutPreformattedText -# lo_LayoutSpacerElement -# lo_LayoutTag -# lo_LayoutTextBlock -# lo_MapXYToAnchorData -# lo_MemoryArenaAllocate -# lo_MergeStateMoveElement -# lo_NewAnchor -# lo_NewDocumentEmbedListData -# lo_NewDocumentFormListData -# lo_NewDocumentGridData -# lo_NewElement -# lo_NewImageObserverList -# lo_NewLayerState -# lo_NewLayout -# lo_NewLinefeed -# lo_NewTextBlock -# lo_NewTopState -# lo_NoMoreImages -# lo_NormalizeSelection -# lo_NormalizeSelectionEnd -# lo_NormalizeSelectionPoint -# lo_ObjectParam -# lo_ObjectURLExit -# lo_OffsetInflowLayer -# lo_ParseBackgroundAttribute -# lo_ParseStyleSheetURL -# lo_PartialFormatImage -# lo_PlaceBullet -# lo_PlaceBulletStr -# lo_PlaceQuoteMarker -# lo_PointToLine -# lo_PopAlignment -# lo_PopAllAnchors -# lo_PopFont -# lo_PopLayerState -# lo_PopLineHeight -# lo_PopList -# lo_PopObject -# lo_PopStateLevel -# lo_PositionDropCaret -# lo_PositionIsOffEndOfLine -# lo_PositionTableElement -# lo_PostLayoutTag -# lo_PreLayoutTag -# lo_PreformatedText -# lo_PrepareElementForReuse -# lo_ProcessAnchorClick -# lo_ProcessBlockQuoteElement -# lo_ProcessBodyTag -# lo_ProcessCenterElement -# lo_ProcessClick -# lo_ProcessContextEventHandlers -# lo_ProcessDescTextElement -# lo_ProcessDescTitleElement -# lo_ProcessDoubleClick -# lo_ProcessInputTag -# lo_ProcessIsIndexTag -# lo_ProcessKeygenTag -# lo_ProcessMulticolumnElement -# lo_ProcessObjectTag -# lo_ProcessParagraphElement -# lo_ProcessParamTag -# lo_ProcessScriptTag -# lo_ProcessSpacerTag -# lo_ProcessStyleAttribute -# lo_ProcessStyleTag -# lo_ProcessTag_OutOfMemory -# lo_PushAlignment -# lo_PushFont -# lo_PushLayerState -# lo_PushLineHeight -# lo_PushList -# lo_PushObject -# lo_PushStateLevel -# lo_RecreateGrid -# lo_RecycleElements -# lo_ReflectFormElement -# lo_ReflectImage -# lo_ReflectLink -# lo_ReflectNamedAnchor -# lo_RefreshDocumentArea -# lo_RefreshElement -# lo_RegionToLines -# lo_RelayoutCaptionSubdoc -# lo_RelayoutCell -# lo_RelayoutEmbed -# lo_RelayoutGridDocumentOnResize -# lo_RelayoutJavaApp -# lo_RelayoutTextBlock -# lo_RelayoutTextElements -# lo_RenumberCell -# lo_ResetFontStack -# lo_ResolveInputType -# lo_RestoreContextEventHandlers -# lo_SaveFormElementState -# lo_SaveFormElementStateInFormList -# lo_SaveSubdocTags -# lo_ScrapeElement -# lo_ScriptEvalExitFn -# lo_SelectAnchor -# lo_SetBaseUrl -# lo_SetDefaultFontAttr -# lo_SetElementFGColor -# lo_SetElementTextAttr -# lo_SetInsertPoint -# lo_SetLayerBackdropTileMode -# lo_SetLayerClipExpansionPolicy -# lo_SetLineArrayEntry -# lo_SetLineBreakState -# lo_SetNamedAnchor -# lo_SetSelect -# lo_SetSelection -# lo_SetSoftLineBreakState -# lo_SetStyleSheetLayerProperties -# lo_SetTableDimensions -# lo_SetupStateForBeginMulticol -# lo_SetupStateForList -# lo_ShiftCell -# lo_ShiftElementList -# lo_ShiftMarginsUp -# lo_SmallSquishSubDocToCell -# lo_SoftLineBreak -# lo_SquishSubDocToCell -# lo_StartHorizontalRuleLayout -# lo_StartMultiColInit -# lo_StartNewSelection -# lo_StoreTopState -# lo_StripTextNewlines -# lo_StripTextWhitespace -# lo_TeardownList -# lo_TopSubState -# lo_UnblockLayerTag -# lo_UnblockLayout -# lo_UpdateBlinkLayers -# lo_UpdateElementPosition -# lo_UpdateFEDocSize -# lo_UpdateFEProgressBar -# lo_UpdateStateAfterBeginTable -# lo_UpdateStateAfterBullet -# lo_UpdateStateAfterBulletStr -# lo_UpdateStateAfterEmbedLayout -# lo_UpdateStateAfterFlushingLine -# lo_UpdateStateAfterFormElement -# lo_UpdateStateAfterHorizontalRule -# lo_UpdateStateAfterImageLayout -# lo_UpdateStateAfterJavaAppLayout -# lo_UpdateStateAfterLineBreak -# lo_UpdateStateAfterList -# lo_UpdateStateWhileFlushingLine -# lo_UpdateTableStateForBeginRow -# lo_UseBreakTable -# lo_ValueOrPercent -# lo_ValueToAlpha -# lo_ValueToRoman -# lo_XYToCellElement -# lo_XYToDocumentElement -# lo_XYToDocumentElement2 -# lo_XYToGridEdge -# lo_XYToNearestCellElement -# lo_add_leading_bullets -# lo_alignStrings -# lo_align_cell -# lo_align_subdoc -# lo_append_to_layer_array -# lo_baseline_adjust -# lo_calc_push_right_for_justify -# lo_cell_has_elements -# lo_compute_text_basline_inc -# lo_correct_text_element_width -# lo_face_attribute -# lo_face_attribute_pref_callback -# lo_fillin_text_info -# lo_find_location_in_poly -# lo_free_layout_state_data -# lo_free_table_record -# lo_is_location_in_poly -# lo_list_bullet_type -# lo_master_colors -# lo_parse_coord_list -# lo_relayout_recycle -# lo_rl_AddBreakAndFlushLine -# lo_rl_AddSoftBreakAndFlushLine -# lo_rl_AppendLinefeedAndFlushLine -# lo_rl_CreateRelayoutState -# lo_rl_DestroyRelayoutState -# lo_rl_InitRelayoutState -# lo_rl_ReflowCell -# lo_rl_ReflowDocState -# lo_search_element_list_WideMatch -# lo_ss_enabled_changed -# lo_style_sheets_enabled -# lo_subdoc_has_elements -# lo_tv_GetFirstLayoutElement -# lo_tv_GetNextLayoutElement -# lo_use_default_doc_background -# lo_view_title -# longjmp -# lower_lookup -# lower_lookup_ascii -# m_AutoAdminLib -# m_GlobalConfigObject -# m_mochaContext -# m_mochaPrefObject -# m_mochaTaskState -# mailNewsReconnect -# main -# mem_active_cache_data_objects -# methodID_netscape_net_SSLInputStream_available -# methodID_netscape_net_SSLInputStream_close -# methodID_netscape_net_SSLInputStream_finalize -# methodID_netscape_net_SSLInputStream_new -# methodID_netscape_net_SSLInputStream_read -# methodID_netscape_net_SSLInputStream_read_1 -# methodID_netscape_net_SSLInputStream_read_2 -# methodID_netscape_net_SSLInputStream_skip -# methodID_netscape_net_SSLInputStream_socketRead -# methodID_netscape_net_SSLOutputStream_close -# methodID_netscape_net_SSLOutputStream_finalize -# methodID_netscape_net_SSLOutputStream_new -# methodID_netscape_net_SSLOutputStream_socketWrite -# methodID_netscape_net_SSLOutputStream_write -# methodID_netscape_net_SSLOutputStream_write_1 -# methodID_netscape_net_SSLOutputStream_write_2 -# methodID_netscape_net_SSLSecurityStatus_getCipher -# methodID_netscape_net_SSLSecurityStatus_getRemoteIssuer -# methodID_netscape_net_SSLSecurityStatus_getRemoteSubject -# methodID_netscape_net_SSLSecurityStatus_getSecurityStatus -# methodID_netscape_net_SSLSecurityStatus_getSerialNumber -# methodID_netscape_net_SSLSecurityStatus_getSessionKeySize -# methodID_netscape_net_SSLSecurityStatus_getSessionSecretSize -# methodID_netscape_net_SSLSecurityStatus_isSecurityOn -# methodID_netscape_net_SSLSecurityStatus_new -# methodID_netscape_net_SSLSecurityStatus_toString -# methodID_netscape_net_SSLSocketImpl__0003cclinit_0003e -# methodID_netscape_net_SSLSocketImpl_accept -# methodID_netscape_net_SSLSocketImpl_addHandshakeCompletedListener -# methodID_netscape_net_SSLSocketImpl_allowClientAuth -# methodID_netscape_net_SSLSocketImpl_available -# methodID_netscape_net_SSLSocketImpl_bind -# methodID_netscape_net_SSLSocketImpl_callHandshakeCompletedListeners -# methodID_netscape_net_SSLSocketImpl_close -# methodID_netscape_net_SSLSocketImpl_connect -# methodID_netscape_net_SSLSocketImpl_connectToAddress -# methodID_netscape_net_SSLSocketImpl_connect_1 -# methodID_netscape_net_SSLSocketImpl_create -# methodID_netscape_net_SSLSocketImpl_doCallHandshakeCompletedListeners -# methodID_netscape_net_SSLSocketImpl_doConnect -# methodID_netscape_net_SSLSocketImpl_finalize -# methodID_netscape_net_SSLSocketImpl_forceHandshake -# methodID_netscape_net_SSLSocketImpl_getFileDescriptor -# methodID_netscape_net_SSLSocketImpl_getInetAddress -# methodID_netscape_net_SSLSocketImpl_getInputStream -# methodID_netscape_net_SSLSocketImpl_getLocalPort -# methodID_netscape_net_SSLSocketImpl_getNeedClientAuth -# methodID_netscape_net_SSLSocketImpl_getOption -# methodID_netscape_net_SSLSocketImpl_getOutputStream -# methodID_netscape_net_SSLSocketImpl_getPort -# methodID_netscape_net_SSLSocketImpl_getStatus -# methodID_netscape_net_SSLSocketImpl_getUseClientMode -# methodID_netscape_net_SSLSocketImpl_isClientModeInitialized -# methodID_netscape_net_SSLSocketImpl_listen -# methodID_netscape_net_SSLSocketImpl_new -# methodID_netscape_net_SSLSocketImpl_new_1 -# methodID_netscape_net_SSLSocketImpl_redoHandshake -# methodID_netscape_net_SSLSocketImpl_removeHandshakeCompletedListener -# methodID_netscape_net_SSLSocketImpl_resetHandshake -# methodID_netscape_net_SSLSocketImpl_setNeedClientAuth -# methodID_netscape_net_SSLSocketImpl_setOption -# methodID_netscape_net_SSLSocketImpl_setUseClientMode -# methodID_netscape_net_SSLSocketImpl_socketAccept -# methodID_netscape_net_SSLSocketImpl_socketAvailable -# methodID_netscape_net_SSLSocketImpl_socketBind -# methodID_netscape_net_SSLSocketImpl_socketClose -# methodID_netscape_net_SSLSocketImpl_socketConnect -# methodID_netscape_net_SSLSocketImpl_socketCreate -# methodID_netscape_net_SSLSocketImpl_socketGetOption -# methodID_netscape_net_SSLSocketImpl_socketListen -# methodID_netscape_net_SSLSocketImpl_socketSetNeedClientAuth -# methodID_netscape_net_SSLSocketImpl_socketSetOptionIntVal -# methodID_netscape_net_SSLSocketImpl_usingSocks -# mfe_drawable_vtable -# mimetype_finalize -# mimetype_getProperty -# mimetypelist_enumerate -# mimetypelist_finalize -# mimetypelist_getProperty -# mimetypelist_resolve_name -# monnames -mozilla_event_queue -mozilla_thread -# mydestroy -# mz_euc2jis -# mz_euc2sjis -# mz_euckr2iso -# mz_imap4utf72utf8 -# mz_iso2euckr -# mz_sjis2euc -# mz_sjis2jis -# mz_ucs2utf7 -# mz_ucs2utf8 -# mz_utf72utf8 -# mz_utf82imap4utf7 -# mz_utf82ucs -# mz_utf82ucsswap -# mz_utf82utf7 -# native_netscape_net_SSLInputStream_socketRead -# native_netscape_net_SSLOutputStream_socketWrite -# native_netscape_net_SSLSocketImpl_forceHandshake -# native_netscape_net_SSLSocketImpl_getStatus -# native_netscape_net_SSLSocketImpl_redoHandshake -# native_netscape_net_SSLSocketImpl_resetHandshake -# native_netscape_net_SSLSocketImpl_socketAccept -# native_netscape_net_SSLSocketImpl_socketAvailable -# native_netscape_net_SSLSocketImpl_socketBind -# native_netscape_net_SSLSocketImpl_socketClose -# native_netscape_net_SSLSocketImpl_socketConnect -# native_netscape_net_SSLSocketImpl_socketCreate -# native_netscape_net_SSLSocketImpl_socketGetOption -# native_netscape_net_SSLSocketImpl_socketListen -# native_netscape_net_SSLSocketImpl_socketSetNeedClientAuth -# native_netscape_net_SSLSocketImpl_socketSetOptionIntVal -# nav_is_default -# nav_make_default -# net_AddCookiePermission -# net_AddressBookLoad -# net_CacheDBTDup -# net_CacheStructToDBData -# net_CleanupAddressBook -# net_CloneWysiwygLocalFile -# net_CloneWysiwygMemCacheEntry -# net_ColorHTMLStream -# net_DBDataToCacheStruct -# net_DisplayCookieDetailsAsHTML -# net_EnablePadPrefChanged -# net_Fast_DBDataToCacheStruct -# net_FreeCacheDBTdata -# net_GenCacheDBKey -# net_GetAddressFromCacheKey -# net_GetFilenameInCacheDBT -# net_GetInt32InCacheDBT -# net_GetPACUrl -# net_GetTimeInCacheDBT -# net_InSequence -# net_InterruptAddressBook -# net_IsBetterAuth -# net_IsValidCacheDBT -# net_MailtoLoad -# net_MochaLoad -# net_NoCharCodeConv -# net_PICSLabelFinderStream -# net_PadPacURLPrefChanged -# net_ProcessAddressBook -# net_SetPACUrl -# net_SetTimeInCacheDBT -# net_UsePadPac -# net_check_for_charset -# net_citation_style_changed -# net_freeCacheObj -# net_ftp_pref_changed -# net_get_protocol_impl -# net_http_password_data_interp -# net_process_net_timer_callback -# net_process_slow_net_timer_callback -# net_use_ssl_for_imap4_changed_func -# newHTMLDialogStream -# nfdlm_ID -# nfdoer_ID -# nff_ID -# nffbc_ID -# nffbpVtable -# nffbp_ID -# nffbuVtable -# nffbu_ID -# nffmi_ID -# nffp_ID -# nfrc_ID -# nfrf_ID -# nfstrm_ID -# np_FakeHTMLStream -# np_bindContext -# np_debug -# np_delete_instance -# np_deleteapp -# np_enablePluginType -# np_findPluginType -# np_geturlinternal -# np_newinstance -# np_newstream -# np_posturlinternal -# np_recover_mochaWindow -# np_streamAsFile -# np_switchHandlers -# np_unbindContext -# npn_allocateMenuID -# npn_destroystream -# npn_forceredraw -# npn_getJavaEnv -# npn_getJavaPeer -# npn_geturl -# npn_geturlnotify -# npn_getvalue -# npn_invalidaterect -# npn_invalidateregion -# npn_memalloc -# npn_memflush -# npn_memfree -# npn_newstream -# npn_posturl -# npn_posturlnotify -# npn_registerwindow -# npn_reloadplugins -# npn_requestread -# npn_setvalue -# npn_status -# npn_unregisterwindow -# npn_useragent -# npn_write -# npp_funcs -# nsn_stuberr_CERT_DestroyCertificate -# nsn_stuberr_PR_Accept -# nsn_stuberr_PR_Bind -# nsn_stuberr_PR_Close -# nsn_stuberr_PR_Connect -# nsn_stuberr_PR_GetPeerName -# nsn_stuberr_PR_GetSockName -# nsn_stuberr_PR_GetSocketOption -# nsn_stuberr_PR_Listen -# nsn_stuberr_PR_Read -# nsn_stuberr_PR_Recv -# nsn_stuberr_PR_Send -# nsn_stuberr_PR_SetSocketOption -# nsn_stuberr_PR_Shutdown -# nsn_stuberr_PR_Write -# nsn_stuberr_SECNAV_SetupSecureSocket -# nsn_stuberr_SSL_DataPending -# nsn_stuberr_SSL_Enable -# nsn_stuberr_SSL_ForceHandshake -# nsn_stuberr_SSL_GetClientAuthDataHook -# nsn_stuberr_SSL_HandshakeCallback -# nsn_stuberr_SSL_ImportFD -# nsn_stuberr_SSL_PeerCertificate -# nsn_stuberr_SSL_RedoHandshake -# nsn_stuberr_SSL_ResetHandshake -# nsn_stuberr_SSL_SecurityStatus -# num_pk11_default_mechanisms -# output_jpeg_scanlines -# p12moz_ValidateImportFile -# pa_CreateMDLTag -# pa_CreateTextTag -# pa_ExpandEscapes -# pa_FindMDLEndComment -# pa_FindMDLEndProcessInstruction -# pa_FindMDLEndTag -# pa_FindMDLTag -# pa_FlushOverflow -# pa_NumericCharacterReference -# pa_ParseWriteReady -# pa_PrintTagToken -# pa_TagEqual -# pa_tokenize_tag -# pacf_find_proxies_for_url -# pacf_get_proxy_addr -# parseErrorHandler -# pbeHashAlgorithmParams -# pc_interpret_funcs -# pics_disabled_for_this_session -# pics_java_capabilities_enabled -# pics_language_pref -# pics_nudity_pref -# pics_pages_must_be_rated_pref -# pics_pref_change -# pics_ratings_enabled -# pics_sexual_pref -# pics_tree_ratings -# pics_violence_pref -# pk11_AddAttributeType -# pk11_AddObject -# pk11_AddSlotObject -# pk11_Attribute2SSecItem -# pk11_Attribute2SecItem -# pk11_CheckDESKey -# pk11_CheckPassword -# pk11_CheckVerifyTest -# pk11_CopyObject -# pk11_CopyToSlot -# pk11_DeleteAttributeType -# pk11_DeleteObject -# pk11_DoCerts -# pk11_DoKeys -# pk11_Finalize -# pk11_FindAttribute -# pk11_FindObjectByTemplate -# pk11_FormatDESKey -# pk11_FreeAttribute -# pk11_FreeContext -# pk11_FreeObject -# pk11_FreeObjectList -# pk11_FreeObjectListElement -# pk11_FreeSearch -# pk11_FreeSession -# pk11_GetPrivKey -# pk11_GetPubKey -# pk11_ImportTokenPublicKey -# pk11_IsWeakKey -# pk11_NewObject -# pk11_NewSession -# pk11_ObjectFromHandle -# pk11_ReferenceObject -# pk11_ReturnContextByType -# pk11_SessionFromHandle -# pk11_SetContextByType -# pk11_SignedToUnsigned -# pk11_SlotFromID -# pk11_SlotFromSessionHandle -# pk11_defaultAttribute -# pk11_fastCert -# pk11_fipsPowerUpSelfTest -# pk11_forceAttribute -# pk11_getString -# pk11_getcerthandle -# pk11_handleObject -# pk11_hasAttribute -# pk11_hasNullPassword -# pk11_isID0 -# pk11_isSensitive -# pk11_isTrue -# pk11_loadPrivKey -# pk11_mapWrap -# pk11_mkcertKeyID -# pk11_modifyType -# pk11_notify -# pk11_nullAttribute -# pk11_objectMatch -# pk11_pbe_decode -# pk11_pbe_key_gen -# pk11_restoreContext -# pk11_saveContext -# pk11_searchObjectList -# pk11_update_all_states -# pk11_update_state -# pkcs11_addmodule -# pkcs11_deletemodule -# pl_DefAcceptread -# pl_DefAvailable -# pl_DefAvailable64 -# pl_DefBind -# pl_DefConnect -# pl_DefFileInfo -# pl_DefFileInfo64 -# pl_DefFsync -# pl_DefGetpeername -# pl_DefGetsocketoption -# pl_DefGetsockname -# pl_DefGetsockopt -# pl_DefListen -# pl_DefPoll -# pl_DefRead -# pl_DefRecv -# pl_DefRecvfrom -# pl_DefSeek -# pl_DefSeek64 -# pl_DefSend -# pl_DefSendto -# pl_DefSetsocketoption -# pl_DefSetsockopt -# pl_DefShutdown -# pl_DefTransmitfile -# pl_DefWrite -# pl_DefWritev -# pl_IOFindModule -# pl_IOPushModule -# pl_NewFD -# pl_TopAccept -# pl_TopClose -# pl_TopMethods -# pl_TopModule -# plugin_finalize -# plugin_getProperty -# plugin_resolve_name -# pluginlist_enumerate -# pluginlist_finalize -# pluginlist_getProperty -# pluginlist_refresh -# pluginlist_resolve_name -# png_IDAT -# png_IEND -# png_IHDR -# png_PLTE -# png_bKGD -# png_build_gamma_table -# png_build_grayscale_palette -# png_cHRM -# png_calculate_crc -# png_check_chunk_name -# png_check_keyword -# png_check_sig -# png_combine_row -# png_convert_from_struct_tm -# png_convert_from_time_t -# png_crc_error -# png_crc_finish -# png_crc_read -# png_create_info_struct -# png_create_read_struct -# png_create_struct -# png_create_write_struct -# png_destroy_info_struct -# png_destroy_read_struct -# png_destroy_struct -# png_destroy_write_struct -# png_do_bgr -# png_do_chop -# png_do_dither -# png_do_expand -# png_do_expand_palette -# png_do_gamma -# png_do_gray_to_rgb -# png_do_invert -# png_do_pack -# png_do_packswap -# png_do_read_filler -# png_do_read_interlace -# png_do_read_swap_alpha -# png_do_read_transformations -# png_do_shift -# png_do_strip_filler -# png_do_swap -# png_do_unpack -# png_do_unshift -# png_do_write_interlace -# png_do_write_swap_alpha -# png_do_write_transformations -# png_error -# png_flush -# png_free -# png_gAMA -# png_get_IHDR -# png_get_PLTE -# png_get_bKGD -# png_get_cHRM -# png_get_channels -# png_get_error_ptr -# png_get_gAMA -# png_get_hIST -# png_get_int_32 -# png_get_io_ptr -# png_get_oFFs -# png_get_pCAL -# png_get_pHYs -# png_get_progressive_ptr -# png_get_rowbytes -# png_get_sBIT -# png_get_signature -# png_get_tIME -# png_get_tRNS -# png_get_text -# png_get_uint_16 -# png_get_uint_32 -# png_get_valid -# png_hIST -# png_handle_IEND -# png_handle_IHDR -# png_handle_PLTE -# png_handle_bKGD -# png_handle_cHRM -# png_handle_gAMA -# png_handle_hIST -# png_handle_oFFs -# png_handle_pCAL -# png_handle_pHYs -# png_handle_sBIT -# png_handle_tEXt -# png_handle_tIME -# png_handle_tRNS -# png_handle_unknown -# png_handle_zTXt -# png_info_destroy -# png_info_init -# png_init_io -# png_init_read_transformations -# png_libpng_ver -# png_malloc -# png_oFFs -# png_pCAL -# png_pHYs -# png_pass_dsp_mask -# png_pass_inc -# png_pass_mask -# png_pass_start -# png_pass_yinc -# png_pass_ystart -# png_process_IDAT_data -# png_process_data -# png_process_some_data -# png_progressive_combine_row -# png_push_crc_finish -# png_push_crc_skip -# png_push_fill_buffer -# png_push_handle_tEXt -# png_push_handle_unknown -# png_push_handle_zTXt -# png_push_have_end -# png_push_have_info -# png_push_have_row -# png_push_process_row -# png_push_read_IDAT -# png_push_read_chunk -# png_push_read_sig -# png_push_read_tEXt -# png_push_read_zTXt -# png_push_restore_buffer -# png_push_save_buffer -# png_read_data -# png_read_destroy -# png_read_end -# png_read_filter_row -# png_read_finish_row -# png_read_image -# png_read_info -# png_read_init -# png_read_push_finish_row -# png_read_row -# png_read_rows -# png_read_start_row -# png_read_transform_info -# png_read_update_info -# png_reset_crc -# png_sBIT -# png_save_int_32 -# png_save_uint_16 -# png_save_uint_32 -# png_set_IHDR -# png_set_PLTE -# png_set_bKGD -# png_set_bgr -# png_set_cHRM -# png_set_compression_level -# png_set_compression_mem_level -# png_set_compression_method -# png_set_compression_strategy -# png_set_compression_window_bits -# png_set_crc_action -# png_set_dims -# png_set_dither -# png_set_error_fn -# png_set_expand -# png_set_filler -# png_set_filter -# png_set_filter_heuristics -# png_set_flush -# png_set_gAMA -# png_set_gamma -# png_set_gray_to_rgb -# png_set_hIST -# png_set_interlace_handling -# png_set_invert_mono -# png_set_oFFs -# png_set_pCAL -# png_set_pHYs -# png_set_packing -# png_set_packswap -# png_set_progressive_read_fn -# png_set_read_fn -# png_set_sBIT -# png_set_shift -# png_set_sig_bytes -# png_set_strip_16 -# png_set_swap -# png_set_swap_alpha -# png_set_tIME -# png_set_tRNS -# png_set_text -# png_set_write_fn -# png_sig -# png_sig_cmp -# png_start_read_image -# png_tEXt -# png_tIME -# png_tRNS -# png_warning -# png_write_IDAT -# png_write_IEND -# png_write_IHDR -# png_write_PLTE -# png_write_bKGD -# png_write_cHRM -# png_write_chunk -# png_write_chunk_data -# png_write_chunk_end -# png_write_chunk_start -# png_write_data -# png_write_destroy -# png_write_end -# png_write_filtered_row -# png_write_find_filter -# png_write_finish_row -# png_write_flush -# png_write_gAMA -# png_write_hIST -# png_write_image -# png_write_info -# png_write_init -# png_write_oFFs -# png_write_pCAL -# png_write_pHYs -# png_write_row -# png_write_rows -# png_write_sBIT -# png_write_sig -# png_write_start_row -# png_write_tEXt -# png_write_tIME -# png_write_tRNS -# png_write_zTXt -# png_zTXt -# png_zalloc -# png_zfree -# poll_desc_array -# pre_FreePrefetchURLStruct -# pref_Alert -# pref_AllocEntry -# pref_AllocTable -# pref_BranchCallback -# pref_CompareStrings -# pref_CopyCharPref -# pref_DeleteItem -# pref_DoCallback -# pref_ErrorReporter -# pref_FreeEntry -# pref_FreeTable -# pref_GetBoolPref -# pref_GetCharPref -# pref_GetIntPref -# pref_HashPref -# pref_InitInitialObjects -# pref_LoadAutoAdminLib -# pref_NativeDefaultPref -# pref_NativeGetLDAPAttr -# pref_NativeGetPref -# pref_NativeLIDefPref -# pref_NativeLILocalPref -# pref_NativeLIUserPref -# pref_NativeLockPref -# pref_NativeSetConfig -# pref_NativeUnlockPref -# pref_NativeUserPref -# pref_OpenFile -# pref_VerifyLockFile -# pref_addChild -# pref_printDebugInfo -# pref_saveLIPref -# pref_savePref -# prm_GeneratePrimeRoster -# prm_PrimeFind -# prm_PseudoPrime -# prm_RabinTest -# proxy_dateRange -# proxy_dnsDomainIs -# proxy_dnsDomainLevels -# proxy_dnsResolve -# proxy_isInNet -# proxy_isPlainHostName -# proxy_isResolvable -# proxy_localHostOrDomainIs -# proxy_myIpAddress -# proxy_regExpMatch -# proxy_timeRange -# proxy_weekdayRange -# putItemToStream -# pw_database -# reconnectHack -# register_netscape_net_SSLInputStream -# register_netscape_net_SSLOutputStream -# register_netscape_net_SSLSecurityStatus -# register_netscape_net_SSLSocketImpl -# release_webfonts -# row_callback -# sFlushableLayoutContextList -# sUnderlineLinksPref -# sec_PKCS12AddAttributeToBag -# sec_PKCS12AttributeTemplate -# sec_PKCS12AuthenticatedSafeTemplate -# sec_PKCS12CRLBagTemplate -# sec_PKCS12CertBagTemplate -# sec_PKCS12ConvertOldSafeToNew -# sec_PKCS12CreateSafeBag -# sec_PKCS12CreateSafeContents -# sec_PKCS12MacDataTemplate -# sec_PKCS12NestedSafeContentsDecodeTemplate -# sec_PKCS12NewCRLBag -# sec_PKCS12NewCertBag -# sec_PKCS12PFXItemTemplate -# sec_PKCS12PointerToCRLBagTemplate -# sec_PKCS12PointerToCertBagTemplate -# sec_PKCS12PointerToContentInfoTemplate -# sec_PKCS12PointerToSafeContentsTemplate -# sec_PKCS12PointerToSecretBagTemplate -# sec_PKCS12SafeBagTemplate -# sec_PKCS12SafeContentsDecodeTemplate -# sec_PKCS12SafeContentsTemplate -# sec_PKCS12SecretBagTemplate -# sec_PKCS12SequenceOfAnyTemplate -# sec_PKCS7AttributeValue -# sec_PKCS7ContentInfoTemplate -# sec_PKCS7CreateDecryptObject -# sec_PKCS7CreateEncryptObject -# sec_PKCS7Decrypt -# sec_PKCS7DecryptLength -# sec_PKCS7DestroyDecryptObject -# sec_PKCS7DestroyEncryptObject -# sec_PKCS7EncodeAttributes -# sec_PKCS7Encrypt -# sec_PKCS7EncryptLength -# sec_PKCS7FindAttribute -# sec_PKCS7ReorderAttributes -# sec_base_rng -# sec_pkcs12_append_bag -# sec_pkcs12_append_bag_to_safe_contents -# sec_pkcs12_append_shrouded_key -# sec_pkcs12_choose_bag_type -# sec_pkcs12_choose_bag_type_old -# sec_pkcs12_choose_cert_crl_type -# sec_pkcs12_choose_cert_crl_type_old -# sec_pkcs12_choose_shroud_type -# sec_pkcs12_compute_thumbprint -# sec_pkcs12_convert_item_to_unicode -# sec_pkcs12_create_baggage -# sec_pkcs12_create_external_bag -# sec_pkcs12_create_safe_contents -# sec_pkcs12_create_virtual_password -# sec_pkcs12_encoder_start_context -# sec_pkcs12_find_object -# sec_pkcs12_generate_key_from_password -# sec_pkcs12_generate_mac -# sec_pkcs12_generate_salt -# sec_pkcs12_new_asafe -# sec_pkcs12_new_pfx -# sec_pkcs7_get_kea_template -# seckey_create_rc4_key -# seckey_create_rc4_salt -# seckey_decrypt_private_key -# seckey_encrypt_private_key -# seckey_get_private_key -# seckey_get_private_key_algorithm -# seckey_put_private_key -# seckey_rc4_cipher -# secmodCreateMutext -# secmodDestroyMutext -# secmodLockMutext -# secmodUnlockMutext -# secmoz_CertToKeyString -# secmoz_GetCertSNString -# secmoz_SetPWEnabled -# secmoz_URLToCert -# selectSlot -# setInfoContext -# sgn_DigestInfoTemplate -# si_DisplayUserInfoAsHTML -# si_InSequence -# si_RegisterSignonPrefCallbacks -# si_SignonRememberingPrefChanged -# signText -# skip_input_data -# sml_GetJSSContext -# sml_expand_stack -# sml_free_TagAndStyleAssoc -# sml_free_stack -# sml_get_index -# sml_get_reverse_index -# sml_new_assoc -# sob_get_signer -# sob_moz_certkey -# sob_moz_dup -# sob_moz_encode -# sob_moz_issuer -# sob_moz_nickname -# sob_moz_perm -# sob_moz_verify -# socksFailure -# ss_add_to_array -# ss_add_to_stack -# ss_delete_pair -# ss_expand_array -# ss_find_pair -# ss_find_pair_index -# ss_free_pair_array -# ss_free_ss_pair -# ssl3_DestroySSL3Info -# ssl3_FortezzaAppendHandshake -# ssl3_GatherData -# ssl3_GatherHandshake -# ssl3_GatherRecord -# ssl3_SendApplicationData -# ssl3_StartHandshakeHash -# ssl3_cipherName -# ssl3_fortezza_server_ca_list -# ssl3_fortezza_server_cert_chain -# ssl3_global_policy_some_restricted -# ssl3_server_ca_list -# ssl3_sid_timeout -# ssl_Accept -# ssl_AcceptRead -# ssl_Available -# ssl_Available64 -# ssl_BeginClientHandshake -# ssl_BeginServerHandshake -# ssl_Bind -# ssl_ChooseProcs -# ssl_ChooseSessionIDProcs -# ssl_Close -# ssl_Connect -# ssl_CopySecurityInfo -# ssl_CopySocksInfo -# ssl_CreateSecurityInfo -# ssl_CreateSocksInfo -# ssl_DefBind -# ssl_DefClose -# ssl_DefConnect -# ssl_DefGetpeername -# ssl_DefGetsockname -# ssl_DefGetsockopt -# ssl_DefListen -# ssl_DefRead -# ssl_DefRecv -# ssl_DefSend -# ssl_DefSetsockopt -# ssl_DefShutdown -# ssl_DefWrite -# ssl_DestroyConnectInfo -# ssl_DestroyGather -# ssl_DestroySecurityInfo -# ssl_DestroySocksInfo -# ssl_DupSocket -# ssl_FSync -# ssl_FileInfo -# ssl_FileInfo64 -# ssl_FindSocket -# ssl_FindTop -# ssl_FreeSID -# ssl_FreeSocket -# ssl_GatherData -# ssl_GatherRecord -# ssl_GetPeerInfo -# ssl_GetPeerName -# ssl_GetPrivate -# ssl_GetSockName -# ssl_GrowBuf -# ssl_HandleClientHelloMessage -# ssl_HandleServerHelloMessage -# ssl_HandleV3Hello -# ssl_Listen -# ssl_LookupSID -# ssl_NewGather -# ssl_NewSocket -# ssl_Poll -# ssl_Read -# ssl_ReadHandshake -# ssl_Recv -# ssl_RecvFrom -# ssl_SaveWriteData -# ssl_SecureClose -# ssl_SecureConnect -# ssl_SecureRead -# ssl_SecureRecv -# ssl_SecureSend -# ssl_SecureSocksAccept -# ssl_SecureSocksConnect -# ssl_SecureWrite -# ssl_Seek -# ssl_Seek64 -# ssl_Send -# ssl_SendSavedWriteData -# ssl_SendTo -# ssl_Shutdown -# ssl_SocksAccept -# ssl_SocksBind -# ssl_SocksConnect -# ssl_SocksGetsockname -# ssl_SocksListen -# ssl_SocksRead -# ssl_SocksRecv -# ssl_SocksSend -# ssl_SocksWrite -# ssl_StartGatherBytes -# ssl_Time -# ssl_TransmitFile -# ssl_Write -# ssl_WriteHandshake -# ssl_WriteV -# ssl_cipherName -# ssl_debug -# ssl_default_ops -# ssl_extended_error -# ssl_fortezza_server_ca_list -# ssl_methods -# ssl_secure_ops -# ssl_secure_socks_ops -# ssl_sid_cache -# ssl_sid_lookup -# ssl_sid_timeout -# ssl_sid_uncache -# ssl_socks_ops -# ssl_trace -# ssl_version -startAsyncCursors -stopAsyncCursors -strcasecomp -strcasestr -# strchr_in_buf -strncasecomp -# strncasestr -# strnchr -# su_finalize -# su_getProperty -# targetCallback -# taskInstalled -# term_source -# thePluginManager -# uGenerate -# uMapCode -# uMapIterate -# uScan -# ucs2AsciiConvertFunc -# ucs2Utf8ConvertFunc -# ucs2_to_utf8_buffer -# ucs4Utf8ConvertFunc -# unregister_netscape_net_SSLInputStream -# unregister_netscape_net_SSLOutputStream -# unregister_netscape_net_SSLSecurityStatus -# unregister_netscape_net_SSLSocketImpl -# unuse_netscape_net_SSLInputStream -# unuse_netscape_net_SSLOutputStream -# unuse_netscape_net_SSLSecurityStatus -# unuse_netscape_net_SSLSocketImpl -# urlMatch -# use_netscape_net_SSLInputStream -# use_netscape_net_SSLOutputStream -# use_netscape_net_SSLSecurityStatus -# use_netscape_net_SSLSocketImpl -# utf8_to_local_encoding -# utf8_to_ucs2_buffer -# utf8_to_ucs2_char -# vr_monitor -# weekdays -# wfAbort -# wfComplete -# wfNewStream -# wfUrlExit -# wfWrite -# wfWriteReady -# wf_ObserverCallback -# wf_trace_flag -# wf_unloadTimer -# win_check_access -# win_open -# wrapMechanismCount -# wrapMechanismList -# xl_alldone -# xp_DrawHTMLDialog -# xp_FileName -# xp_FilePlatformName -# xp_FindNamedContextInChildren -# xp_InitChrome -# xp_MakeHTMLDialogPass1 -# xp_MakeHTMLDialogPass2 -# xp_MakeHTMLDialogWindow -# xp_TempName -xp_errno -# xp_gethtmlpane -# xp_removeviewassociation -# xp_tolower -# xp_toupper - - -### -### Symbols which do not require hand annotation... -### - -#{code} -# AbbrevWeekdayString__FR11DateTimeRecPUcPP8Intl1Rec -# AddWithoutOverflow__FUsUs -# ArithHighlight__FRC4RectRC8RGBColor -# BuildODOCEvent__FUl6FSSpecR6AEDesc -# BuildOpenSelectionEvent__FR6FSSpecR6AEDesc -# CalcCurrentSelected__FP31lo_FormElementSelectData_structUc -# CenterInRect__F5Point4Rect -# CleanUpLocationString__FR7CStr255 -# CleanUpTextToURL__FPc -# CmdPeriod__Fv -# ComputeBevelColor__FUc8RGBColorR8RGBColor -# ConstrainEditField__FP10LEditFieldll -# ConstrainTo__FRClRClRl -# ConvertCRtoLF__FR7CStr255 -# ConvertURLToSpec__FPCcP6FSSpecPCc25ConvertURLValidationFlags -# ConvertURLToSpec__FPCcP6FSSpecsUc -# CopyAlloc__FPPcPUc -# CopyString__FPCc -# CopyString__FPUcPCUc -# CopyString__FPUcPCc -# CopyString__FPcPCUc -# CopyString__FPcPCc -# CreateCache__FRPPcs -# CreateFinderAppleEvent__FUlslR6AEDesc -# CreateMenuString__FR7CStr255 -# CreateTelnetFile__FPcPcPc -# CreateTn3270File__FPcPcPc -# CreateUnknownMimeTypeMapper__FP11URL_Struct_ -# DefaultDocCharSetIDFromFrontWindow__Fv -# DeviceForWindow__FP7LWindow -# DragTargetWasTrash__FP19OpaqueDragReference -# DrawAntsRect__FR4Rects -# DrawArc__FRC8RGBColorRC4RectUc -# EDT_AlignString__F12ED_Alignment -# EDT_ComposerPluginCallback__FllP16java_lang_Object -# EDT_MakeEditBuffer__FP10MWContext_b -# EDT_UpperCase__FPc -# EarlManagerNetTicklerCallback__Fv -# EditorPluginManager_IsPluginActive__FPv -# EditorPluginManager_PluginsExist__Fv -# EditorPluginManager_delete__FPv -# EditorPluginManager_new__FP10MWContext_ -# EditorPrintingCallback__FPcPv -# EmbedDefault__FiPvP11URL_Struct_P10MWContext_ -# EscapeString__FPCcPCc -# FE_LowerWindow__FP10MWContext_ -# FM_SetFlushable__FP10MWContext_Uc -# FindDefaultPreferencesFolder__FR6FSSpecsUcUc -# FindPaneHitBy__FRC5Point -FindPluginFolder__FP6FSSpecUc -# FindProcessBySignature__FUlUlR19ProcessSerialNumberP6FSSpec -# FlushEventHierarchyRecursive__FP5LPane -# FlushEventHierarchy__FP5LView -# ForceWindowOnScreen__FP7LWindow -# FrameButton__FRC4RectUc -# FrameSubpaneSubtle__FP5LViewP5LPane -# GUI_AskForFileSpec__FR17StandardFileReply -# GetBookmarksPath__FR6FSSpecUc -# GetCaretPosition__FP10MWContext_P17LO_Element_structlPlPlPl -# GetCommonParent__FP12CEditElementP12CEditElement -# GetDateTimeString__FR7CStr255 -# GetDesktopIconSuiteFor__FUlUlsPPPPc -# GetDropLocationDirectory__FP6AEDescPlPs -# GetFreeSpaceInBytes__Fs -# GetHFSFlavorFromPromise__FP19OpaqueDragReferenceUlP9HFSFlavorUc -# GetItl0Resource__Fl -# GetItl1Resource__Fl -# GetPSNBySig__FUl -# GetPString__Fs -# GetPaneDescriptor__FP5LPane -# GetPluginDesc__FRC7CStr255 -# GetSubpaneRect__FP5LViewP5LPaneR4Rect -# GetSubpaneRgn__FP5LViewP5LPanePP6Region -# GetTextLengthInPixels__FP9LTextEdit -# GetUserWindowTitle__FsR7CStr255 -# GrowWindowToScreenHeight__FP7LWindow -# HandleModalDialog__FiPCUcPCUc -# HasAppleEventObjects__Fv -# HasDownloads__FP10MWContext_ -# HasEventHandler__FP10MWContext_Ul -# HasFTPUpload__FP15CBrowserContext -# HasFormWidget__FP27LO_FormElementStruct_struct -# HasKeyEventCapture__FP10MWContext_ -# HasProcess__FRC19ProcessSerialNumber -# HiliteRect__FRC4Rect -# HiliteRgn__FRCPP6Region -# ImageCacheMemoryFlusher__Fv -# InitUTearOffPalette__FP10LCommander -# IsDocInfoWindow__FPCc -IsFrontApplication__Fv -# IsFrontWindowModal__Fv -# IsInternalImage__FPCc -# IsInternalTypeLink__FPCc -# IsMailNewsReconnect__FPCc -# IsMailToLink__FPCc -# IsSpecialBrowserWindow__FPCc -# IsThisKeyDown__FUc -# IsViewSourceWindow__FPCc -# LaunchError__FsUlRA64_CUcs -# LaunchFile__FP17LFileBufferStream -# LaunchWithDoc__FR5FInfoR6FSSpecP17LFileBufferStream6FSSpec -# LayoutCacheMemoryFlusher__Fv -# LibNeoCacheMemoryFlusher__Fv -# MacFEMemoryFlusher__FUl -# MakeFrontApplication__Fv -# MakeNoProcessPSN__Fv -# MallocIsLowWarning__Fv -# Memory_DoneWithMemory__Fv -# Memory_InitializeMemory__Fv -# Memory_MaxApplMem__Fv -# Memory_MemoryIsLow__Fv -# MergeSizes__FRPdRiPd -# MiddleTruncationThatWorks__FPUcs -# MiddleTruncationThatWorks__FPcRss -# MochaAdjustCursorCallbackLayoutFree__FP10MWContext_P17LO_Element_structlPv13ETEventStatus -# MochaAdjustCursorCallback__FP10MWContext_P17LO_Element_structlPv13ETEventStatus -# MochaDoExecuteClickInLinkCallback__FP10MWContext_P17LO_Element_structlPv13ETEventStatus -# MochaDragDrop__FP10MWContext_P38CBrowserViewDoDragReceiveMochaCallback5Points -# MochaFormSubmitCallback__FP10MWContext_P17LO_Element_structlPv13ETEventStatus -# MochaImageFormSubmitCallback__FP10MWContext_P17LO_Element_structlPv13ETEventStatus -# MoveResourceMapBelowApp__Fv -# NetlibCacheMemoryFlusher__Fv -# NewFilePipe__FiPvP11URL_Struct_P10MWContext_ -# PA_strdup__FPc -# PROGRESS_GetUrl__FP11URL_Struct_iPC6FSSpecUc -# PR_GetEnv__FPCc -# PathURLFromProcessSignature__FUlUl -# PointsToPixels__Fss -# ProfilePrefChangedFunc__FPCcPv -# ReadBookmarksFile__FR24vector>R6FSSpec -# ReadVersionTag__FP7LStreaml -# RectFromTwoPoints__F5Point5Point -# RectInRect__FPC4RectPC4Rect -# RegisterAllBrowserClasses__Fv -# RegisterPluginsInFolder__F6FSSpec -# RestoreDefaultWindowState__FP7LWindow -# RevealInImage__FP5LView8SPoint328SPoint32 -# SafeGetFontInfo__Fs -# SafeSetCursor__Fs -# ScriptToEncoding__Fs -# SendODOCEvent__FUlP17LFileBufferStream -# SendOpenSelectionToFinder__FR6FSSpec -# SetCaptionDescriptor__FP8LCaptionRC7CStr255s -# SetEnable__FP5LPaneUc -# SetFE_Data__FP27LO_FormElementStruct_structP5LPaneP12LFormElementP10LCommander -# SetItemValue__FP8GrafPortss -# SetLGAPopupToNamedItem__FP8LGAPopupRC7CStr255 -# SetMenuItem__FlUc -# SetMenuSizeForLGAPopup__FP8LGAPopups -# SetMenuSize__FP13LStdPopupMenus -# SetPopupToNamedItem__FP13LStdPopupMenuRC7CStr255 -# ShowHelp__FPCc -# ShrinkToFitAlertDialog__FR7cstring -# ShrinkToFitYorNDialog__FR7cstring -# SimpleOpenDlog__FsPCUlP6FSSpec -# StaggerWindow__FP7LWindow -# StartDocInApp__F6FSSpec6FSSpec -# StoreDefaultWindowState__FP7LWindow -# StringParamText__FR7CStr255PCcPCcPCcPCc -# StringParamText__FR7CStr255llll -# StripChar__FR7CStr255c -# StripColons__FR6CStr31 -# StripDoubleCRs__FR7CStr255 -# StripNewline__FR7CStr255 -# StructCopy__FPCvUl -# SubWithoutUnderflow__FUsUs -# TargetOnEditField__FP10LEditFieldUc -# TextHandleToHardLineBreaks__FR15CSimpleTextView -# TooDifferent__FRC5PointRC5Point -# TrySetCursor__Fi -# TurnOn__FP8LControl -# ValidateCacheSize__FP15CValidEditField -# ValidateDaysTilExpire__FP15CValidEditField -# ValidateNumberConnections__FP15CValidEditField -# ValidateNumberNewsArticles__FP15CValidEditField -# ValidatePopID__FP15CValidEditField -# WaitForMouseAction__FRC5Pointll -# WinCharsetIDToScript__FUs -# WindowOnSingleDevice__FP7LWindow -# WriteCString__FP7LStreamPCc -# WriteChar__FP7LStreamc -# WriteVersionTag__FP7LStreaml -# __distance__FPCUlPCUlRl26random_access_iterator_tag -# __eq,12allocator>__FRC47basic_string,12allocator>PCc -# __ne<7CStr255>__FRC7CStr255RC7CStr255 -# __ne,12allocator>__FRC47basic_string,12allocator>PCc -# __pl__FPCcRC7CString -# __pl__FRC7CStringPCc -# __pl__FRC7CStringRC7CString -# construct<15CUserButtonInfo,15CUserButtonInfo>__FP15CUserButtonInfoRC15CUserButtonInfo -# construct<47basic_string,12allocator>,47basic_string,12allocator>>__FP47basic_string,12allocator>RC47basic_string,12allocator> -# construct__FPP20LO_EdgeStruct_structRCP20LO_EdgeStruct_struct -# construct__FPUlRCUl -# construct__FPUsRCUs -# construct__FPcRCc -# construct__FPlRCl -# copy__FPCUlPCUlPUl -# copy__FPP20LO_EdgeStruct_structPP20LO_EdgeStruct_structPP20LO_EdgeStruct_struct -# copy__FPUlPUlPUl -# copy_backward__FPP20LO_EdgeStruct_structPP20LO_EdgeStruct_structPP20LO_EdgeStruct_struct -# copy_backward__FPUlPUlPUl -# destroy<15CUserButtonInfo>__FP15CUserButtonInfo -# destroy<47basic_string,12allocator>>__FP47basic_string,12allocator> -# destroy__FP15CUserButtonInfoP15CUserButtonInfo -# destroy__FPP20LO_EdgeStruct_struct -# destroy,12allocator>>__FP47basic_string,12allocator>P47basic_string,12allocator> -# destroy__FPP20LO_EdgeStruct_structPP20LO_EdgeStruct_struct -# distance__FPCUlPCUl -# do_spellcheck__FP10MWContext_P9CEditViewP15CSimpleTextView -# edt_AddTag__FRP13PA_Tag_structRP13PA_Tag_structScbPc -# edt_AppendEndOfLine__FPc -# edt_CFileSaveObjectDone__FbPv -# edt_CopyFromHuge__FsPclPl -# edt_DupImageData__FP14_EDT_ImageData -# edt_FetchDimension__FP13PA_Tag_structPcPlPblbs -# edt_FetchParamAlignment__FP13PA_Tag_struct12ED_Alignmentbs -# edt_FetchParamBoolExist__FP13PA_Tag_structPcs -# edt_FetchParamColor2__FP13PA_Tag_structPcR8ED_Colors -# edt_FetchParamColor__FP13PA_Tag_structPcs -# edt_FetchParamExtras2__FP13PA_Tag_structPPcRPcs -# edt_FetchParamExtras__FP13PA_Tag_structPPcs -# edt_FetchParamInt__FP13PA_Tag_structPclls -# edt_FetchParamInt__FP13PA_Tag_structPcls -# edt_FetchParamString2__FP13PA_Tag_structPcRPcs -# edt_FetchParamString__FP13PA_Tag_structPcs -# edt_FreeImageData__FP14_EDT_ImageData -# edt_GetDocRelativeBaseURL__FP10MWContext_ -# edt_GetPathURL__FPc -# edt_GetTableElementFromLO_Element__FP17LO_Element_structs -# edt_InitBitArrays__Fv -# edt_InitEscapes__Fsb -# edt_LocalName__FPc -# edt_MakeDirectory__FPCc11XP_FileType -# edt_MakeLoColor__F8ED_Color -# edt_MakeParamString__FPc -# edt_NewImageData__Fv -# edt_OpenDir__FPCc11XP_FileType -# edt_PrintWithEscapes__FP11CPrintStatePcb -# edt_QuoteString__FPc -# edt_RemoveDirectoryR__FPc -# edt_RemoveDirectory__FPCc11XP_FileType -# edt_RemoveNBSP__FsPc -# edt_ReplaceParamValue__FP13PA_Tag_structPcPcs -# edt_SetLoColor__F8ED_ColorP15LO_Color_struct -# edt_SetTagData__FP13PA_Tag_structPc -# edt_StripAtHashOrQuestionMark__FPc -# edt_StripUsernamePassword__FPc -# edt_TagType2TextFormat__FSc -# edt_UpdateEditHistoryTitle__FP10MWContext_Pc -# edt_WorkBuf__Fi -# fe_FileNameFromContext__FP10MWContext_PCcR6CStr31 -# fill__FPUlPUlRCUl -# find,12allocator>,PCc>__FP47basic_string,12allocator>P47basic_string,12allocator>RCPCc -# find__FPP20LO_EdgeStruct_structPP20LO_EdgeStruct_structRCP20LO_EdgeStruct_struct -# find__FPcPcRCc -# free_fh_store__FP6wfListPv -# free_fmi_attr_store__FP6wfListPv -# max
    __FRCUlRCUl -# min
      __FRCUlRCUl -# min__FRClRCl -# myStringToNum__FRC7CStr255Pl -# np_FindHandleByType__FPCcPP10_np_handlePP12_np_mimetype -# npn_IsWindowless__FP10_np_handle -# npn_getJavaClass__FP10_np_handle -# pref_FindAutoAdminLib__FR6FSSpec -# uninitialized_copy__FPCUlPCUlPUl -# uninitialized_copy__FPP20LO_EdgeStruct_structPP20LO_EdgeStruct_structPP20LO_EdgeStruct_struct -# uninitialized_copy__FPUlPUlPUl -# uninitialized_fill_n__FP15CUserButtonInfoUlRC15CUserButtonInfo -# uninitialized_fill_n__FPUlUlRCUl -# uninitialized_fill_n__FPUsUlRCUs -# uninitialized_fill_n__FPcUlRCc -# wf_addToString__FPPcPiPiPCc -# wf_expandFilename__FPci -# wf_getExtension__FPCc -# wf_isFileDirectory__FPCc -# wf_isFileReadable__FPCc -# wf_releaseFmis__FPP5nffmi -# wf_scanToken__FPCcPciPci -# wf_scanVariableAndValue__FPciRPcRPc -# wf_skipSpaces__FPCc -# wf_strcasecmp__FPCcPCc -# wf_stringEndsWith__FPCcPCc -# wf_strncasecmp__FPCcPCci -# wf_trimSpaces__FPc - -### class AEUtilities -#{code} -# CreateAppleEvent__11AEUtilitiesFUlUlR6AEDesc19ProcessSerialNumber -# EventHasErrorReply__11AEUtilitiesFR6AEDesc - -### class AppearanceContain -#{code} -# FinishCreateSelf__17AppearanceContainFv -# ListenToMessage__17AppearanceContainFlPv -# UpdateTheWholeDamnDialogBox__17AppearanceContainFv -# __dt__17AppearanceContainFv -#{data} -# __vt__17AppearanceContain - -### class CAMSavvyBevelView -#{code} -# DrawBeveledFill__17CAMSavvyBevelViewFv -# DrawBeveledFrame__17CAMSavvyBevelViewFv -# DrawBeveledSub__17CAMSavvyBevelViewFRC9SSubBevel -# __ct__17CAMSavvyBevelViewFP7LStream -# __dt__17CAMSavvyBevelViewFv -#{data} -# __vt__17CAMSavvyBevelView - -### class CAdvancedCacheMediator -#{code} -# ClearDiskCacheNow__22CAdvancedCacheMediatorFv -# ListenToMessage__22CAdvancedCacheMediatorFlPv -# __ct__22CAdvancedCacheMediatorFP7LStream -# __dt__22CAdvancedCacheMediatorFv -#{data} -# __vt__22CAdvancedCacheMediator - -### class CAdvancedProxiesMediator -#{code} -# EditPrefs__Q224CAdvancedProxiesMediator11ManualProxyFv -# ListenToMessage__24CAdvancedProxiesMediatorFlPv -# LoadFromPref__Q224CAdvancedProxiesMediator8ProtocolFPCcPCc -# LoadPrefs__Q224CAdvancedProxiesMediator11ManualProxyFv -# PostEdit__Q224CAdvancedProxiesMediator8ProtocolFP5LViewss -# PreEdit__Q224CAdvancedProxiesMediator8ProtocolFP5LViewss -# WritePrefs__24CAdvancedProxiesMediatorFv -# WritePrefs__Q224CAdvancedProxiesMediator11ManualProxyFv -# WriteToPref__Q224CAdvancedProxiesMediator8ProtocolFPCcPCc -# __ct__24CAdvancedProxiesMediatorFP7LStream -# __ct__Q224CAdvancedProxiesMediator11ManualProxyFRCQ224CAdvancedProxiesMediator11ManualProxy -# __ct__Q224CAdvancedProxiesMediator11ManualProxyFv -# __ct__Q224CAdvancedProxiesMediator8ProtocolFRCQ224CAdvancedProxiesMediator8Protocol -# __ct__Q224CAdvancedProxiesMediator8ProtocolFv -# __dt__24CAdvancedProxiesMediatorFv -# __dt__Q224CAdvancedProxiesMediator11ManualProxyFv -# __dt__Q224CAdvancedProxiesMediator8ProtocolFv -#{data} -# __vt__24CAdvancedProxiesMediator - -### class CAppearanceColorsMediator -#{code} -# ListenToMessage__25CAppearanceColorsMediatorFlPv -# UseDefaults__25CAppearanceColorsMediatorFv -# __ct__25CAppearanceColorsMediatorFP7LStream -# __dt__25CAppearanceColorsMediatorFv -#{data} -# __vt__25CAppearanceColorsMediator - -### class CAppearanceFontsMediator -#{code} -# FontMenuChanged__24CAppearanceFontsMediatorFl -# GetFontSize__24CAppearanceFontsMediatorFP8LGAPopup -# GetSelectEncMenuItem__24CAppearanceFontsMediatorFv -# ListenToMessage__24CAppearanceFontsMediatorFlPv -# LoadEncodings__24CAppearanceFontsMediatorFv -# LoadPrefs__24CAppearanceFontsMediatorFv -# PopulateEncodingsMenus__24CAppearanceFontsMediatorFl -# ReadEncodings__24CAppearanceFontsMediatorFPPc -# SetEncodingWithPref__24CAppearanceFontsMediatorFRQ224CAppearanceFontsMediator8Encoding -# SetPrefWithEncoding__24CAppearanceFontsMediatorFRCQ224CAppearanceFontsMediator8Encoding -# SizeMenuChanged__24CAppearanceFontsMediatorFl -# UpdateEncoding__24CAppearanceFontsMediatorFl -# UpdateMenus__24CAppearanceFontsMediatorFv -# WriteEncodingPrefs__24CAppearanceFontsMediatorFv -# WritePrefs__24CAppearanceFontsMediatorFv -# __ct__24CAppearanceFontsMediatorFP7LStream -# __ct__Q224CAppearanceFontsMediator8EncodingFv -# __dt__24CAppearanceFontsMediatorFv -#{data} -# __vt__24CAppearanceFontsMediator - -### class CAppearanceMainMediator -#{code} -# LoadPrefs__23CAppearanceMainMediatorFv -# WritePrefs__23CAppearanceMainMediatorFv -# __ct__23CAppearanceMainMediatorFP7LStream -# __dt__23CAppearanceMainMediatorFv -#{data} -# __vt__23CAppearanceMainMediator - -### class CAppleEventHandler -#{code} -# GetAEProperty__18CAppleEventHandlerCFUlRC6AEDescR6AEDesc -# GetSubModelByUniqueID__18CAppleEventHandlerCFUlRC6AEDescR6AEDesc -# HandleAppleEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleCancelProgress__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleCommandEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleGetActiveProfileEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleGetURLEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleGetWDEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleGoEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleOpenAddressBookEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleOpenBookmarksEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleOpenComponentEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleOpenURLEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleParseAnchor__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleReadHelpFileEvent__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleShowFile__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleSpyActivate__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleSpyGetWindowInfo__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleSpyListWindows__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# HandleWindowRegistration__18CAppleEventHandlerFRC6AEDescR6AEDescR6AEDescl -# SetAEProperty__18CAppleEventHandlerFUlRC6AEDescR6AEDesc -# __ct__18CAppleEventHandlerFv -# __dt__18CAppleEventHandlerFv -#{data} -# __vt__18CAppleEventHandler -# sAppleEventHandler__18CAppleEventHandler - -### class CApplicationEventAttachment -#{code} -# CurrentEventHasModifiers__27CApplicationEventAttachmentFUs -# ExecuteSelf__27CApplicationEventAttachmentFlPv -# GetApplication__27CApplicationEventAttachmentFv -# GetCurrentEvent__27CApplicationEventAttachmentFv -# ProcessNextEvent__27CApplicationEventAttachmentFv -# __ct__27CApplicationEventAttachmentFv -# __dt__27CApplicationEventAttachmentFv -#{data} -# __vt__27CApplicationEventAttachment -# sApplication__27CApplicationEventAttachment -# sCurrentEvent__27CApplicationEventAttachment -# sFakeNullEventInitialized__27CApplicationEventAttachment -# sFakeNullEvent__27CApplicationEventAttachment - -### class CApplicationIconInfo -#{code} -# ClearDefaults__20CApplicationIconInfoFv -# GetFileTypeArraySize__20CApplicationIconInfoFv -# GetFileType__20CApplicationIconInfoFi -# InitializeDefaults__20CApplicationIconInfoFv -# __ct__20CApplicationIconInfoFUl -# __ct__20CApplicationIconInfoFUlPPcP6LArrayUc -# __dt__20CApplicationIconInfoFv -#{data} -# sDefaultAppIcon__20CApplicationIconInfo -# sDocumentIcons__20CApplicationIconInfo -# sHandlesAE__20CApplicationIconInfo - -### class CApplicationList -#{code} -# AppInfoFromFileSpec__16CApplicationListFUl6FSSpec -# CreateNewEntry__16CApplicationListFUlP11CMimeMapper -# GetAppInfo__16CApplicationListFUlP11CMimeMapper -# GetResourcePointers__16CApplicationListFPPcRP7BNDLIdsRP7BNDLIdsRsRs -# __ct__16CApplicationListFv -# __dt__16CApplicationListFv -#{data} -# __vt__16CApplicationList - -### class CAutoCompleteURLEditField -#{code} -# HandleKeyPress__25CAutoCompleteURLEditFieldFRC11EventRecord -# SpendTime__25CAutoCompleteURLEditFieldFRC11EventRecord -# __ct__25CAutoCompleteURLEditFieldFP7LStream -# __dt__25CAutoCompleteURLEditFieldFv -#{data} -# __vt__25CAutoCompleteURLEditField -# matchDelay__25CAutoCompleteURLEditField -#{code} -# __dt__27CAutoPtr<15CBrowserContext>Fv -# __dt__48CAutoPtrFv -# __dt__22CAutoPtr<10CNSContext>Fv -# __dt__28CAutoPtr<16CURLDispatchInfo>Fv -# __dt__26CAutoPtr<14CURLDispatcher>Fv -# __dt__27CAutoPtr<15CWindowMediator>Fv -# __dt__16CAutoPtr<5LMenu>Fv -# __dt__18CAutoPtr<7cstring>Fv -# __dt__13CAutoPtrXPFv - -### class CAutoSaveTimer -#{code} -# GetPeriod__14CAutoSaveTimerFv -# OnCallback__14CAutoSaveTimerFv -# Restart__14CAutoSaveTimerFv -# Resume__14CAutoSaveTimerFv -# SetEditBuffer__14CAutoSaveTimerFP11CEditBuffer -# SetPeriod__14CAutoSaveTimerFl -# Suspend__14CAutoSaveTimerFv -# __ct__14CAutoSaveTimerFv -# __dt__14CAutoSaveTimerFv -#{data} -# __vt__14CAutoSaveTimer - -### class CBevelButton -#{code} -# DrawButtonContent__12CBevelButtonFv -# DrawSelfDisabled__12CBevelButtonFv -# __ct__12CBevelButtonFP7LStream -# __dt__12CBevelButtonFv -#{data} -# __vt__12CBevelButton - -### class CBevelView -#{code} -# BevelGrowIcon__10CBevelViewFv -# CalcBevelMask__10CBevelViewFv -# CalcBevelRegion__10CBevelViewFv -# CalcSubpaneLocalRect__10CBevelViewFlR4Rect -# DontBevelGrowIcon__10CBevelViewFv -# DrawSelf__10CBevelViewFv -# FinishCreateSelf__10CBevelViewFv -# InvalMainFrame__10CBevelViewFv -# InvalSubFrames__10CBevelViewFv -# ResizeFrameBy__10CBevelViewFssUc -# SubPanesChanged__10CBevelViewFP5LPaneUc -# SubPanesChanged__10CBevelViewFUc -# __ct__10CBevelViewFP7LStream -# __dt__10CBevelViewFv -#{data} -# __vt__10CBevelView - -### class CBitArray -#{code} -# ClearAll__9CBitArrayFv -# SetSize__9CBitArrayFl -# __ct__9CBitArrayFlie - -### class CBookmarksAttachment -#{code} -# AddToBookmarks__20CBookmarksAttachmentFPCcRC7CStr255 -# ExecuteSelf__20CBookmarksAttachmentFlPv -# FillMenuFromList__20CBookmarksAttachmentFP18_HT_ResourceStructP5LMenuRii -# GetMenu__20CBookmarksAttachmentFv -# HandleNotification__20CBookmarksAttachmentFP22_HT_NotificationStructP18_HT_ResourceStructUl -# InitQuickfileView__20CBookmarksAttachmentFv -# InstallMenus__20CBookmarksAttachmentFv -# RemoveMenus__20CBookmarksAttachmentFv -# UpdateMenu__20CBookmarksAttachmentFv -# __ct__20CBookmarksAttachmentFv -# __dt__20CBookmarksAttachmentFv -#{data} -# __vt__20CBookmarksAttachment -# sInvalidMenu__20CBookmarksAttachment -# sMenu__20CBookmarksAttachment -# sMenusList__20CBookmarksAttachment -# sQuickfileView__20CBookmarksAttachment - -### class CBookmarksFindDialog -#{code} -# FinishCreateSelf__20CBookmarksFindDialogFv -# ListenToMessage__20CBookmarksFindDialogFlPv -# __ct__20CBookmarksFindDialogFP7LStream -# __dt__20CBookmarksFindDialogFv -#{data} -# __vt__20CBookmarksFindDialog -# sFindDialog__20CBookmarksFindDialog - -### class CBoolPrefRadio -#{code} -# FinishCreateSelf__14CBoolPrefRadioFv -# __dt__14CBoolPrefRadioFv -#{data} -# __vt__14CBoolPrefRadio - -### class CBrokeredView -#{code} -# GetPendingFrameLocation__13CBrokeredViewCFR8SPoint32 -# GetPendingFrameSize__13CBrokeredViewCFR12SDimension16 -# MoveBy__13CBrokeredViewFllUc -# ResizeFrameBy__13CBrokeredViewFssUc -# __ct__13CBrokeredViewFP7LStream -# __dt__13CBrokeredViewFv -#{data} -# __vt__13CBrokeredView - -### class CBrowserApplicationsMediator -#{code} -# DeleteMimeEntry__28CBrowserApplicationsMediatorFv -# EditMimeEntry__28CBrowserApplicationsMediatorFv -# ListenToMessage__28CBrowserApplicationsMediatorFlPv -# LoadMainPane__28CBrowserApplicationsMediatorFv -# NewMimeEntry__28CBrowserApplicationsMediatorFv -# WritePrefs__28CBrowserApplicationsMediatorFv -# __ct__28CBrowserApplicationsMediatorFP7LStream -# __dt__28CBrowserApplicationsMediatorFv -#{data} -# __vt__28CBrowserApplicationsMediator - -### class CBrowserContext -#{code} -# Alert__15CBrowserContextFPCc -# AllConnectionsComplete__15CBrowserContextFv -# CanGoBack__15CBrowserContextFv -# CanGoForward__15CBrowserContextFv -# ClearView__15CBrowserContextFi -# CompleteLoad__15CBrowserContextFP11URL_Struct_i -# Confirm__15CBrowserContextFPCc -# ConstructJSDialogTitle__15CBrowserContextFR7LStr255 -# CountGridChildren__15CBrowserContextCFv -# CreateEmbedWindow__15CBrowserContextFP14_NPEmbeddedApp -# CreateGridContext__15CBrowserContextFPvPvllllPcPcSc16NET_ReloadMethodb -# DestroyEmbedWindow__15CBrowserContextFP14_NPEmbeddedApp -# DisplayAddRowOrColBorder__15CBrowserContextFP8_XP_Rectb -# DisplayBorder__15CBrowserContextFiiiiiiP15LO_Color_struct12LO_LineStyle -# DisplayBullet__15CBrowserContextFiP22LO_BulletStruct_struct -# DisplayCell__15CBrowserContextFiP20LO_CellStruct_struct -# DisplayEdge__15CBrowserContextFiP20LO_EdgeStruct_struct -# DisplayEmbed__15CBrowserContextFiP21LO_EmbedStruct_struct -# DisplayFeedback__15CBrowserContextFiP17LO_Element_struct -# DisplayFormElement__15CBrowserContextFiP27LO_FormElementStruct_struct -# DisplayHR__15CBrowserContextFiP25LO_HorizRuleStruct_struct -# DisplayJavaApp__15CBrowserContextFiP23LO_JavaAppStruct_struct -# DisplayLineFeed__15CBrowserContextFiP24LO_LinefeedStruct_structb -# DisplaySubDoc__15CBrowserContextFiP22LO_SubDocStruct_struct -# DisplaySubtext__15CBrowserContextFiP20LO_TextStruct_structllb -# DisplayTable__15CBrowserContextFiP21LO_TableStruct_struct -# DisplayText__15CBrowserContextFiP20LO_TextStruct_structb -# DisposeGridChild__15CBrowserContextFP15CBrowserContext -# DisposeGridContext__15CBrowserContextFb -# DrawJavaApp__15CBrowserContextFiP23LO_JavaAppStruct_struct -# EraseBackground__15CBrowserContextFillUlUlP15LO_Color_struct -# FinishedLayout__15CBrowserContextFv -# FormTextIsSubmit__15CBrowserContextFP27LO_FormElementStruct_struct -# FreeEdgeElement__15CBrowserContextFP20LO_EdgeStruct_struct -# FreeEmbedElement__15CBrowserContextFP21LO_EmbedStruct_struct -# FreeJavaAppElement__15CBrowserContextFP12LJAppletData -# GetCompositor__15CBrowserContextCFv -# GetDefaultBackgroundColor__15CBrowserContextCFP15LO_Color_struct -# GetDocPosition__15CBrowserContextFiPlPl -# GetEmbedSize__15CBrowserContextFP21LO_EmbedStruct_struct16NET_ReloadMethod -# GetFormElementInfo__15CBrowserContextFP27LO_FormElementStruct_struct -# GetFormElementValue__15CBrowserContextFP27LO_FormElementStruct_structb -# GetFullGridSize__15CBrowserContextFRlRl -# GetJavaAppSize__15CBrowserContextFP23LO_JavaAppStruct_struct16NET_ReloadMethod -# GetNextHistoryEntry__15CBrowserContextFv -# GetPreviousHistoryEntry__15CBrowserContextFv -# GetSaveDialog__15CBrowserContextFv -# GetTextFrame__15CBrowserContextFP20LO_TextStruct_structllP8_XP_Rect -# GetTextInfo__15CBrowserContextFP20LO_TextStruct_structP18LO_TextInfo_struct -# GetTopContext__15CBrowserContextFv -# GoBackInGrid__15CBrowserContextFv -# GoBackOneHost__15CBrowserContextFv -# GoBack__15CBrowserContextFv -# GoForwardInGrid__15CBrowserContextFv -# GoForwardOneHost__15CBrowserContextFv -# GoForward__15CBrowserContextFv -# HandleClippingView__15CBrowserContextFP12LJAppletDataiiii -# HandleEmbedEvent__15CBrowserContextFP21LO_EmbedStruct_structP8CL_Event -# HandleLayerEvent__15CBrowserContextFP8CL_LayerP8CL_Event -# HasColorSpace__15CBrowserContextCFv -# HasCompositor__15CBrowserContextCFv -# HasFullPagePlugin__15CBrowserContextCFv -# HasGridChildren__15CBrowserContextFv -# HasGridParent__15CBrowserContextCFv -# HideJavaAppElement__15CBrowserContextFP12LJAppletData -# InitHistoryFromContext__15CBrowserContextFP15CBrowserContext -# InvalidateEntireTableOrCell__15CBrowserContextFP17LO_Element_struct -# IsContextLoopingRecurse__15CBrowserContextFv -# IsContextLooping__15CBrowserContextFv -# IsGridCell__15CBrowserContextFv -# IsGridChild__15CBrowserContextFv -# IsImageLoadingDelayed__15CBrowserContextCFv -# IsLoadImagesOverride__15CBrowserContextCFv -# IsRepaginating__15CBrowserContextCFv -# IsRepagintaitonPending__15CBrowserContextCFv -# IsRestrictedTarget__15CBrowserContextCFv -# IsRootDocInfoContext__15CBrowserContextFv -# IsSpecialBrowserContext__15CBrowserContextFv -# IsViewSourceContext__15CBrowserContextFv -# LayoutNewDocument__15CBrowserContextFP11URL_Struct_PlPlPlPl -# LoadHistoryEntry__15CBrowserContextFlUc -# MeasureText__15CBrowserContextFP20LO_TextStruct_structPs -# NoMoreUsers__15CBrowserContextFv -# Prompt__15CBrowserContextFPCcPCc -# ReloadGridFromHistory__15CBrowserContextFPv16NET_ReloadMethod -# RememberHistoryPosition__15CBrowserContextFll -# Repaginate__15CBrowserContextF16NET_ReloadMethod -# ResetFormElement__15CBrowserContextFP27LO_FormElementStruct_struct -# RestoreEmbedWindow__15CBrowserContextFP14_NPEmbeddedApp -# RestructureGridContext__15CBrowserContextFllll -# SaveEmbedWindow__15CBrowserContextFP14_NPEmbeddedApp -# SetBackgroundColor__15CBrowserContextFUcUcUc -# SetCloseCallback__15CBrowserContextFPFPv_vPv -# SetCompositor__15CBrowserContextFP19CSharableCompositor -# SetCurrentView__15CBrowserContextFP9CHTMLView -# SetDelayImages__15CBrowserContextFUc -# SetDocDimension__15CBrowserContextFill -# SetDocPosition__15CBrowserContextFill -# SetDocTitle__15CBrowserContextFPc -# SetDrawable__15CBrowserContextFP11CL_Drawable -# SetFormElementToggle__15CBrowserContextFP27LO_FormElementStruct_structb -# SetImagesDelayed__15CBrowserContextFUc -# SetImagesLoading__15CBrowserContextFUc -# SetImagesLooping__15CBrowserContextFUc -# SetLoadImagesOverride__15CBrowserContextFUc -# SetMochaImagesDelayed__15CBrowserContextFUc -# SetMochaImagesLoading__15CBrowserContextFUc -# SetMochaImagesLooping__15CBrowserContextFUc -# SetRestrictedTarget__15CBrowserContextFUc -# SetSaveDialog__15CBrowserContextFP13CSaveProgress -# SupportsPageServices__15CBrowserContextFv -# UpdateEnableStates__15CBrowserContextFv -# __ct__15CBrowserContextF13MWContextType -# __ct__15CBrowserContextFRC15CBrowserContext -# __ct__15CBrowserContextFv -# __dt__15CBrowserContextFv -#{data} -# __vt__15CBrowserContext - -### class CBrowserDragTask -#{code} -# AddFlavorBookmarkFile__16CBrowserDragTaskFUl -# AddFlavorBookmark__16CBrowserDragTaskFUlPCc -# AddFlavorURL__16CBrowserDragTaskFUl -# AddFlavors__16CBrowserDragTaskFP19OpaqueDragReference -# __ct__16CBrowserDragTaskFRC11EventRecord -# __dt__16CBrowserDragTaskFv -#{data} -# __vt__16CBrowserDragTask - -### class CBrowserLanguagesMediator -#{code} -# AppendLanguageCode__25CBrowserLanguagesMediatorFPCcPCc -# FillAddList__25CBrowserLanguagesMediatorFP11LTextColumn -# GetLanguageDisplayString__25CBrowserLanguagesMediatorFPCc -# GetNewLanguage__25CBrowserLanguagesMediatorFRPc -# GetNewUniqueLanguage__25CBrowserLanguagesMediatorFRPc -# ListenToMessage__25CBrowserLanguagesMediatorFlPv -# LoadBuiltInArrays__25CBrowserLanguagesMediatorFv -# LoadMainPane__25CBrowserLanguagesMediatorFv -# LoadPrefs__25CBrowserLanguagesMediatorFv -# SetLanguageListWithPref__25CBrowserLanguagesMediatorFPCclRUc -# SetPrefWithLanguageList__25CBrowserLanguagesMediatorFPCclUc -# UpdateButtons__25CBrowserLanguagesMediatorFP11LTextColumn -# WritePrefs__25CBrowserLanguagesMediatorFv -# __ct__25CBrowserLanguagesMediatorFP7LStream -# __dt__25CBrowserLanguagesMediatorFv -#{data} -# __vt__25CBrowserLanguagesMediator - -### class CBrowserMainMediator -#{code} -# ExpireDaysValidationFunc__20CBrowserMainMediatorFP15CValidEditField -# ExpireNow__20CBrowserMainMediatorFv -# ListenToMessage__20CBrowserMainMediatorFlPv -# LoadMainPane__20CBrowserMainMediatorFv -# LoadPrefs__20CBrowserMainMediatorFv -# URLChoosingButtons__20CBrowserMainMediatorFUc -# UpdateFromIC__20CBrowserMainMediatorFv -# WritePrefs__20CBrowserMainMediatorFv -# __ct__20CBrowserMainMediatorFP7LStream -# __dt__20CBrowserMainMediatorFv -#{data} -# __vt__20CBrowserMainMediator - -### class CBrowserSecurityButton -#{code} -# GetIconID__22CBrowserSecurityButtonF14ESecurityState -# NoteSecurityState__22CBrowserSecurityButtonF14ESecurityState -# __ct__22CBrowserSecurityButtonFP7LStream -# __dt__22CBrowserSecurityButtonFv -#{data} -# __vt__22CBrowserSecurityButton - -### class CBrowserView -#{code} -# BeTarget__12CBrowserViewFv -# DoDragReceiveCallback__12CBrowserViewFP8_XP_List -# DoDragReceive__12CBrowserViewFP19OpaqueDragReference -# DontBeTarget__12CBrowserViewFv -# DragIsAcceptable__12CBrowserViewFP19OpaqueDragReference -# FindCommandStatusForContextMenu__12CBrowserViewFlRUcRUcRUsPUc -# FindCommandStatus__12CBrowserViewFlRUcRUcRUsPUc -# ItemIsAcceptable__12CBrowserViewFP19OpaqueDragReferenceUl -# MoveBy__12CBrowserViewFllUc -# ObeyCommand__12CBrowserViewFlPv -# QueueFTPUpload__12CBrowserViewFRC6FSSpecP11URL_Struct_ -# __ct__12CBrowserViewFP7LStream -# __dt__12CBrowserViewFv -#{data} -# __vt__12CBrowserView - -### class CBrowserViewDoDragReceiveMochaCallback -#{code} -# Complete__38CBrowserViewDoDragReceiveMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__38CBrowserViewDoDragReceiveMochaCallbackFv -#{data} -# __vt__38CBrowserViewDoDragReceiveMochaCallback - -### class CBrowserWindow -#{code} -# ActivateSelf__14CBrowserWindowFv -# AttemptClose__14CBrowserWindowFv -# CalcStandardBoundsForScreen__14CBrowserWindowCFRC4RectR4Rect -# ClearSystemGrowIconBevel__14CBrowserWindowFv -# ClickInDrag__14CBrowserWindowFRC11EventRecord -# ClickInGrow__14CBrowserWindowFRC11EventRecord -# DefaultCSIDForNewWindow__14CBrowserWindowFv -# DoAEGo__14CBrowserWindowFUl -# DoClose__14CBrowserWindowFv -# DoDefaultPrefs__14CBrowserWindowFv -# DoSetBounds__14CBrowserWindowFRC4Rect -# DoSetPosition__14CBrowserWindowF5Point -# DoSetZoom__14CBrowserWindowFUc -# FindAndPrepareEmpty__14CBrowserWindowFUc -# FindAndShow__14CBrowserWindowFUc -# FindCommandStatus__14CBrowserWindowFlRUcRUcRUsPUc -# FinishCreateSelf__14CBrowserWindowFv -# GetAEProperty__14CBrowserWindowCFUlRC6AEDescR6AEDesc -# GetChromeInfo__14CBrowserWindowFP7_Chrome -# GetDefaultCSID__14CBrowserWindowCFv -# GetMenubarMode__14CBrowserWindowFv -# GetStatusResID__14CBrowserWindowCFv -# GetValidStatusVersion__14CBrowserWindowCFv -# GetWindowByID__14CBrowserWindowFl -# GetWindowContext__14CBrowserWindowCFv -# HandleAppleEvent__14CBrowserWindowFRC6AEDescR6AEDescR6AEDescl -# HandleGetURLEvent__14CBrowserWindowFRC6AEDescR6AEDescR6AEDescP14CBrowserWindow -# HandleKeyPress__14CBrowserWindowFRC11EventRecord -# HandleNetSearchCommand__14CBrowserWindowFv -# HandleOpenURLEvent__14CBrowserWindowFRC6AEDescR6AEDescR6AEDescP14CBrowserWindow -# IsRestrictedTarget__14CBrowserWindowFv -# ListenToMessage__14CBrowserWindowFlPv -# MakeNewBrowserWindow__14CBrowserWindowFUcUc -# NoteAllConnectionsComplete__14CBrowserWindowFv -# NoteBeginLayout__14CBrowserWindowFv -# NoteDocTitleChanged__14CBrowserWindowFPCc -# NoteFinishedLayout__14CBrowserWindowFv -# NoteInternetKeywordChanged__14CBrowserWindowFPCc -# ObeyCommand__14CBrowserWindowFlPv -# ReadWindowStatus__14CBrowserWindowFP7LStream -# Select__14CBrowserWindowFv -# SendAEGetURL__14CBrowserWindowFPCc -# SendAEGo__14CBrowserWindowFUl -# SendAESetPosition__14CBrowserWindowF5PointUc -# SetChromeInfo__14CBrowserWindowFP7_ChromeUcUc -# SetDefaultCSID__14CBrowserWindowFs -# SetSystemGrowIconBevel__14CBrowserWindowFv -# SetWindowContext__14CBrowserWindowFP15CBrowserContext -# ShowDragBars__14CBrowserWindowFUcUcUc -# ShowStatus__14CBrowserWindowFP7_Chrome -# WindowForContext__14CBrowserWindowFP15CBrowserContext -# WriteWindowStatus__14CBrowserWindowFP7LStream -# __ct__14CBrowserWindowFP7LStream -# __dt__14CBrowserWindowFv -#{data} -# __vt__14CBrowserWindow - -### class CButton -#{code} -# ActivateSelf__7CButtonFv -# CalcGraphicFrame__7CButtonFv -# CalcTitleFrame__7CButtonFv -# DeactivateSelf__7CButtonFv -# DisableSelf__7CButtonFv -# DrawButtonContent__7CButtonFv -# DrawButtonGraphic__7CButtonFv -# DrawButtonTitle__7CButtonFv -# DrawSelfDisabled__7CButtonFv -# DrawSelf__7CButtonFv -# Draw__7CButtonFPP6Region -# EnableSelf__7CButtonFv -# FinalizeDrawButton__7CButtonFv -# FinishCreateSelf__7CButtonFv -# GetDescriptor__7CButtonCFPUc -# GetGraphicID__7CButtonCFv -# HandleEnablingPolicy__7CButtonFv -# HotSpotAction__7CButtonFsUcUc -# HotSpotResult__7CButtonFs -# PrepareDrawButton__7CButtonFv -# SetDescriptor__7CButtonFPCUc -# SetGraphicID__7CButtonFs -# SetValue__7CButtonFl -# __ct__7CButtonFP7LStream -# __dt__7CButtonFv -#{data} -# __vt__7CButton - -### class CButtonEnablerReloadStop -#{code} -# ExecuteSelf__24CButtonEnablerReloadStopFlPv -# __ct__24CButtonEnablerReloadStopFP7LStream -# __dt__24CButtonEnablerReloadStopFv -#{data} -# __vt__24CButtonEnablerReloadStop - -### class CCaption -#{code} -# DisableSelf__8CCaptionFv -# DrawSelf__8CCaptionFv -# EnableSelf__8CCaptionFv -# __dt__8CCaptionFv -#{data} -# __vt__8CCaption - -### class CChameleonCaption -#{code} -# DrawSelf__17CChameleonCaptionFv -# SetColor__17CChameleonCaptionF8RGBColor8RGBColor -# __dt__17CChameleonCaptionFv -#{data} -# __vt__17CChameleonCaption - -### class CChameleonView -#{code} -# DrawSelf__14CChameleonViewFv -# SetColor__14CChameleonViewF8RGBColor -# __dt__14CChameleonViewFv -#{data} -# __vt__14CChameleonView - -### class CChangePageDataCommand -#{code} -# Redo__22CChangePageDataCommandFv -# Undo__22CChangePageDataCommandFv -# __ct__22CChangePageDataCommandFP11CEditBufferi -# __dt__22CChangePageDataCommandFv -#{data} -# __vt__22CChangePageDataCommand - -### class CClickTimer -#{code} -# NoteDoubleClick__11CClickTimerFv -# NoteSingleClick__11CClickTimerFv -# ReverseTheHilite__11CClickTimerFv -# SpendTime__11CClickTimerFRC11EventRecord -# __ct__11CClickTimerFP18CStandardFlexTableRC10STableCellRC15SMouseDownEvent -# __dt__11CClickTimerFv -#{data} -# __vt__11CClickTimer - -### class CCloseAllAttachment -#{code} -# ExecuteSelf__19CCloseAllAttachmentFlPv -# FindCommandStatus__19CCloseAllAttachmentFP14SCommandStatus -# ObeyCommand__19CCloseAllAttachmentFv -# __ct__19CCloseAllAttachmentFP7LStream -# __ct__19CCloseAllAttachmentFss -# __dt__19CCloseAllAttachmentFv -#{data} -# __vt__19CCloseAllAttachment - -### class CClusterView -#{code} -# CalcTitleFrame__12CClusterViewFv -# DrawSelf__12CClusterViewFv -# FinishCreateSelf__12CClusterViewFv -# GetDescriptor__12CClusterViewCFPUc -# SetDescriptor__12CClusterViewFPCUc -# __ct__12CClusterViewFP7LStream -# __dt__12CClusterViewFv -#{data} -# __vt__12CClusterView - -### class CColorButton -#{code} -# DrawGraphic__12CColorButtonFs -# HotSpotResult__12CColorButtonFs -# __ct__12CColorButtonFP7LStream -# __dt__12CColorButtonFv -#{data} -# __vt__12CColorButton - -### class CColorEraseAttachment -#{code} -# __ct__21CColorEraseAttachmentFP7LStream -# __dt__21CColorEraseAttachmentFv -#{data} -# __vt__21CColorEraseAttachment -# sDummyPenState__21CColorEraseAttachment - -### class CColorPopup -#{code} -# AdjustMenuContents__11CColorPopupFv -# DrawButtonContent__11CColorPopupFv -# DrawButtonGraphic__11CColorPopupFv -# DrawButtonTitle__11CColorPopupFv -# DrawPopupArrow__11CColorPopupFv -# FinishCreateSelf__11CColorPopupFv -# GetMenuItemFromRGBColor__11CColorPopupFP8RGBColor -# GetMenuItemRGBColor__11CColorPopupFsP8RGBColor -# HandleEnablingPolicy__11CColorPopupFv -# HandleNewValue__11CColorPopupFl -# HandlePopupMenuSelect__11CColorPopupF5PointsRsRs -# InitializeCurrentColor__11CColorPopupFv -# SetValue__11CColorPopupFl -# __ct__11CColorPopupFP7LStream -# __dt__11CColorPopupFv -#{data} -# __vt__11CColorPopup - -### class CCommandState -#{code} -# Flush__13CCommandStateFv -# GetID__13CCommandStateFv -# Record__13CCommandStateFP11CEditBuffer -# Restore__13CCommandStateFP11CEditBuffer -# SetID__13CCommandStateFi -# __ct__13CCommandStateFv -# __dt__13CCommandStateFv - -### class CComposeFindWindow -#{data} -# sLastReplace__18CComposeFindWindow - -### class CComposerAwareURLDragMixin -#{code} -# ReceiveDragItem__26CComposerAwareURLDragMixinFP19OpaqueDragReferenceUlUlR4RectR8SPoint32 -# __ct__26CComposerAwareURLDragMixinFv -# __dt__26CComposerAwareURLDragMixinFv -#{data} -# __vt__26CComposerAwareURLDragMixin - -### class CComposerDragTask -#{code} -# AddFlavors__17CComposerDragTaskFP19OpaqueDragReference -# MakeDragRegion__17CComposerDragTaskFP19OpaqueDragReferencePP6Region -# __ct__17CComposerDragTaskFRC11EventRecordRC4RectR9CHTMLView -# __dt__17CComposerDragTaskFv -#{data} -# __vt__17CComposerDragTask - -### class CConfigActiveScroller -#{code} -# HandleThumbScroll__21CConfigActiveScrollerFP11LStdControl -# ListenToMessage__21CConfigActiveScrollerFlPv -# __ct__21CConfigActiveScrollerFP7LStream -# __dt__21CConfigActiveScrollerFv -#{data} -# __vt__21CConfigActiveScroller - -### class CContextMenuAttachment -#{code} -# BuildMenu__22CContextMenuAttachmentFv -# ChangeCursor__22CContextMenuAttachmentFPC11EventRecord -# DoPopup__22CContextMenuAttachmentFRC15SMouseDownEventRQ222CContextMenuAttachment11EClickState -# ExecuteSelf__22CContextMenuAttachmentFlPv -# Execute__22CContextMenuAttachmentFlPv -# PruneMenu__22CContextMenuAttachmentFP5LMenu -# WaitMouseAction__22CContextMenuAttachmentFRC5Pointll -# __ct__22CContextMenuAttachmentFP7LStream -# __dt__22CContextMenuAttachmentFv -#{data} -# __vt__22CContextMenuAttachment - -### class CContextProgress -#{code} -# __ct__16CContextProgressFv -# __dt__16CContextProgressFv -#{data} -# __vt__16CContextProgress - -### class CControlExtension -#{code} -# ClickSelf__17CControlExtensionFRC15SMouseDownEvent -# FinishCreateSelf__17CControlExtensionFv -# __ct__17CControlExtensionFP7LStream -# __dt__17CControlExtensionFv -#{data} -# __vt__17CControlExtension - -### class CConvertCSIDStreamOut -#{code} -# ForgetStream__21CConvertCSIDStreamOutFv -# GetNewCSID__21CConvertCSIDStreamOutFv -# GetOldCSID__21CConvertCSIDStreamOutFv -# Write__21CConvertCSIDStreamOutFPcl -# __ct__21CConvertCSIDStreamOutFssP10IStreamOut -# __dt__21CConvertCSIDStreamOutFv -#{data} -# __vt__21CConvertCSIDStreamOut - -### class CCustomPageSetup -#{code} -# CustomStyleDialogInit__16CCustomPageSetupFPP6TPrint -#{data} -# CustomStyleDialogInit_info__16CCustomPageSetup -#{code} -# CustomStyleItems__16CCustomPageSetupFP8GrafPorts -#{data} -# CustomStyleItems_info__16CCustomPageSetup -#{code} -# GetControlValue__16CCustomPageSetupFl -# InitCustomPageSetup__16CCustomPageSetupFv -# OpenPageSetup__16CCustomPageSetupFPP6TPrint -#{data} -# fControls__16CCustomPageSetup -# sFirstItem__16CCustomPageSetup -# sItemProc__16CCustomPageSetup -# sPageSetupDialog__16CCustomPageSetup - -### class CDateArrowButton -#{code} -# DisableSelf__16CDateArrowButtonFv -# EnableSelf__16CDateArrowButtonFv -# HotSpotAction__16CDateArrowButtonFsUcUc -# HotSpotResult__16CDateArrowButtonFs -# SimulateHotSpotClick__16CDateArrowButtonFs -# TrackHotSpot__16CDateArrowButtonFs5Points -# __ct__16CDateArrowButtonFP7LStream -# __dt__16CDateArrowButtonFv -#{data} -# __vt__16CDateArrowButton - -### class CDateField -#{code} -# AdjustCursorSelf__10CDateFieldF5PointRC11EventRecord -# BeTarget__10CDateFieldFv -# ClickSelf__10CDateFieldFRC15SMouseDownEvent -# DontBeTarget__10CDateFieldFv -# FindCommandStatus__10CDateFieldFlRUcRUcRUsPUc -# HandleKeyPress__10CDateFieldFRC11EventRecord -# SetDescriptor__10CDateFieldFPCUc -# UserChangedText__10CDateFieldFv -# __ct__10CDateFieldFP7LStream -# __dt__10CDateFieldFv -#{data} -# __vt__10CDateField - -### class CDateView -#{code} -# ContainsTarget__9CDateViewFv -# CreateDateFields__9CDateViewFUcUcUc -# DateFieldFilter__9CDateViewFPP5TERecUsRUss -# DoClickArrow__9CDateViewFUc -# DoKeyArrow__9CDateViewFUc -# FinishCreateSelf__9CDateViewFv -# GetDate__9CDateViewFPsPUcPUc -# IsValidDate__9CDateViewFsUcUc -# ListenToMessage__9CDateViewFlPv -# RegisterDateClasses__9CDateViewFv -# SelectDateField__9CDateViewFs -# Select__9CDateViewFv -# SetDateString__9CDateViewFP10LEditFieldUcUc -# SetDate__9CDateViewFsUcUc -# SetToToday__9CDateViewFv -# ShowHideArrow__9CDateViewFP5LPaneUc -# ShowHideArrows__9CDateViewFUc -# __ct__9CDateViewFP7LStream -# __dt__9CDateViewFv -#{data} -# __vt__9CDateView - -### class CDebugPrefToolTipAttachment -#{code} -# CalcTipText__27CDebugPrefToolTipAttachmentFP7LWindowP5LPaneRC11EventRecordPUc -# __ct__27CDebugPrefToolTipAttachmentFP15MPreferenceBase -# __dt__27CDebugPrefToolTipAttachmentFv -#{data} -# __vt__27CDebugPrefToolTipAttachment - -### class CDeleteTableCaptionCommand -#{code} -# Do__26CDeleteTableCaptionCommandFv -# __ct__26CDeleteTableCaptionCommandFP11CEditBufferi -# __dt__26CDeleteTableCaptionCommandFv -#{data} -# __vt__26CDeleteTableCaptionCommand - -### class CDeleteTableCellCommand -#{code} -# Do__23CDeleteTableCellCommandFv -# __ct__23CDeleteTableCellCommandFP11CEditBufferii -# __dt__23CDeleteTableCellCommandFv -#{data} -# __vt__23CDeleteTableCellCommand - -### class CDeleteTableColumnCommand -#{code} -# Do__25CDeleteTableColumnCommandFv -# __ct__25CDeleteTableColumnCommandFP11CEditBufferii -# __dt__25CDeleteTableColumnCommandFv -#{data} -# __vt__25CDeleteTableColumnCommand - -### class CDeleteTableCommand -#{code} -# Do__19CDeleteTableCommandFv -# __ct__19CDeleteTableCommandFP11CEditBufferi -# __dt__19CDeleteTableCommandFv -#{data} -# __vt__19CDeleteTableCommand - -### class CDeleteTableRowCommand -#{code} -# Do__22CDeleteTableRowCommandFv -# __ct__22CDeleteTableRowCommandFP11CEditBufferii -# __dt__22CDeleteTableRowCommandFv -#{data} -# __vt__22CDeleteTableRowCommand - -### class CDeluxeBevelButton -#{code} -# DrawButtonContent__18CDeluxeBevelButtonFv -# __ct__18CDeluxeBevelButtonFP7LStream -# __dt__18CDeluxeBevelButtonFv -#{data} -# __vt__18CDeluxeBevelButton - -### class CDesktop -#{code} -# FetchNextRegular__8CDesktopFRC7LWindow -# FetchNextWindowWithThisAttribute__8CDesktopFRC7LWindowUl -# FindWindow__8CDesktopFs - -### class CDeviceLoop -#{code} -# ClipToIntersection__11CDeviceLoopFRC4Rect -# NextDepth__11CDeviceLoopFRs -# __ct__11CDeviceLoopFRC4RectRs -# __dt__11CDeviceLoopFv - -### class CDialogWizardHandler -#{code} -# AddListener__20CDialogWizardHandlerFP9LListener -# CurrentPaneNumber__20CDialogWizardHandlerFv -# CurrentPane__20CDialogWizardHandlerFv -# DisableNextButton__20CDialogWizardHandlerFv -# DoWizard__20CDialogWizardHandlerFv -# EnableNextButton__20CDialogWizardHandlerFv -# GetCheckboxValue__20CDialogWizardHandlerFl -# GetDialog__20CDialogWizardHandlerFv -# GetEditText__20CDialogWizardHandlerFlR7CString -# SetCheckboxValue__20CDialogWizardHandlerFlUc -# SetEditText__20CDialogWizardHandlerFlRC7CString -# ShowPane__20CDialogWizardHandlerFlP7LWindow -# TotalPanes__20CDialogWizardHandlerFv -# __ct__20CDialogWizardHandlerFsR6LArray -# __dt__20CDialogWizardHandlerFv - -### class CDividerData -#{code} -# ReadStatus__12CDividerDataFP7LStream -# WriteStatus__12CDividerDataFP7LStream -#{data} -# __vt__12CDividerData - -### class CDividerGrippyPane -#{code} -# AdjustCursorSelf__18CDividerGrippyPaneF5PointRC11EventRecord -# ClickSelf__18CDividerGrippyPaneFRC15SMouseDownEvent -# __ct__18CDividerGrippyPaneFP7LStream -# __dt__18CDividerGrippyPaneFv -#{data} -# __vt__18CDividerGrippyPane - -### class CDownloadProgressWindow -#{code} -# AttemptClose__23CDownloadProgressWindowFv -# DoClose__23CDownloadProgressWindowFv -# FindCommandStatus__23CDownloadProgressWindowFlRUcRUcRUsPUc -# FinishCreateSelf__23CDownloadProgressWindowFv -# GetStatusResID__23CDownloadProgressWindowCFv -# GetValidStatusVersion__23CDownloadProgressWindowCFv -# GetWindowContext__23CDownloadProgressWindowFv -# HandleKeyPress__23CDownloadProgressWindowFRC11EventRecord -# ListenToMessage__23CDownloadProgressWindowFlPv -# NoteProgressBegin__23CDownloadProgressWindowFRC16CContextProgress -# NoteProgressEnd__23CDownloadProgressWindowFRC16CContextProgress -# NoteProgressUpdate__23CDownloadProgressWindowFRC16CContextProgress -# ObeyCommand__23CDownloadProgressWindowFlPv -# SetWindowContext__23CDownloadProgressWindowFP10CNSContext -# __ct__23CDownloadProgressWindowFP7LStream -# __dt__23CDownloadProgressWindowFv -#{data} -# __vt__23CDownloadProgressWindow - -### class CDragBar -#{code} -# ClickDragSelf__8CDragBarFRC15SMouseDownEvent -# Click__8CDragBarFR15SMouseDownEvent -# Dock__8CDragBarFv -# DrawSelf__8CDragBarFv -# Draw__8CDragBarFPP6Region -# GetDescriptor__8CDragBarCFPUc -# IsAvailable__8CDragBarFv -# IsDocked__8CDragBarCFv -# SetAvailable__8CDragBarFUc -# SetDescriptor__8CDragBarFPCUc -# StartTracking__8CDragBarFv -# StopTracking__8CDragBarFv -# Undock__8CDragBarFv -# __ct__8CDragBarFP7LStream -# __dt__8CDragBarFv -#{data} -# __vt__8CDragBar - -### class CDragBarContainer -#{code} -# AdjustContainer__17CDragBarContainerFv -# AdjustDock__17CDragBarContainerFv -# EnterDropArea__17CDragBarContainerFP19OpaqueDragReferenceUc -# FinishCreateSelf__17CDragBarContainerFv -# HideBar__17CDragBarContainerFP8CDragBarUc -# InsideDropArea__17CDragBarContainerFP19OpaqueDragReference -# ItemIsAcceptable__17CDragBarContainerFP19OpaqueDragReferenceUl -# LeaveDropArea__17CDragBarContainerFP19OpaqueDragReference -# ListenToMessage__17CDragBarContainerFlPv -# NoteCollapseBar__17CDragBarContainerFP8CDragBar -# NoteExpandBar__17CDragBarContainerFP8CDragBar -# PointInDropArea__17CDragBarContainerF5Point -# ReceiveDragItem__17CDragBarContainerFP19OpaqueDragReferenceUlUlR4Rect -# RepositionBars__17CDragBarContainerFv -# RestorePlace__17CDragBarContainerFP7LStream -# SavePlace__17CDragBarContainerFP7LStream -# ShowBar__17CDragBarContainerFP8CDragBarUc -# SwapBars__17CDragBarContainerFP8CDragBarP8CDragBarUc -# __ct__17CDragBarContainerFP7LStream -# __dt__17CDragBarContainerFv -#{data} -# __vt__17CDragBarContainer - -### class CDragBarDockControl -#{code} -# AddBarToDock__19CDragBarDockControlFP8CDragBar -# CalcOneDockedBar__19CDragBarDockControlFP8CDragBarRC4Rect -# DrawOneDockedBar__19CDragBarDockControlFP8CDragBar -# DrawSelf__19CDragBarDockControlFv -# FindBarSpot__19CDragBarDockControlF5Point -# FindHotSpot__19CDragBarDockControlF5Point -# FindTooltipForMouseLocation__19CDragBarDockControlFRC11EventRecordPUc -# HasDockedBars__19CDragBarDockControlCFv -# HideBar__19CDragBarDockControlFP8CDragBar -# HotSpotAction__19CDragBarDockControlFsUcUc -# HotSpotResult__19CDragBarDockControlFs -# IsRecalcRequired__19CDragBarDockControlCFv -# MouseLeave__19CDragBarDockControlFv -# MouseWithin__19CDragBarDockControlF5PointRC11EventRecord -# PointInHotSpot__19CDragBarDockControlF5Points -# RecalcDock__19CDragBarDockControlFv -# RemoveBarFromDock__19CDragBarDockControlFP8CDragBar -# ResizeFrameBy__19CDragBarDockControlFssUc -# RestorePlace__19CDragBarDockControlFP7LStream -# SavePlace__19CDragBarDockControlFP7LStream -# SetNeedsRecalc__19CDragBarDockControlFUc -# ShowBar__19CDragBarDockControlFP8CDragBar -# __ct__19CDragBarDockControlFP7LStream -# __dt__19CDragBarDockControlFv -#{data} -# __vt__19CDragBarDockControl - -### class CDragBarDragTask -#{code} -# AddFlavors__16CDragBarDragTaskFP19OpaqueDragReference -# DoDrag__16CDragBarDragTaskFv -# DoNormalDrag__16CDragBarDragTaskFv -# DoTranslucentDrag__16CDragBarDragTaskFv -# MakeDragRegion__16CDragBarDragTaskFP19OpaqueDragReferencePP6Region -# __ct__16CDragBarDragTaskFP8CDragBarRC11EventRecord -# __dt__16CDragBarDragTaskFv -#{data} -# __vt__16CDragBarDragTask - -### class CDragOrderTextList -#{code} -# ClickCell__18CDragOrderTextListFRC10STableCellRC15SMouseDownEvent -# MoveRow__18CDragOrderTextListFUlUl -# __dt__18CDragOrderTextListFv -#{data} -# __vt__18CDragOrderTextList - -### class CDragURLTask -#{code} -# AddFlavors__12CDragURLTaskFP19OpaqueDragReference -# MakeDragRegion__12CDragURLTaskFP19OpaqueDragReferencePP6Region -# __ct__12CDragURLTaskFRC11EventRecordRC4RectR9CHTMLView -# __dt__12CDragURLTaskFv -#{data} -# __vt__12CDragURLTask - -### class CDrawable -#{code} -# CopyPixels__9CDrawableFP9CDrawablePv -# GetDrawableOffscreen__9CDrawableFv -# GetLayerClip__9CDrawableFv -# GetLayerOrigin__9CDrawableFPlPl -# HasClipChanged__9CDrawableFv -# InitDrawable__9CDrawableFP11CL_Drawable -# LockDrawable__9CDrawableFP11CL_Drawable16CL_DrawableState -# RelinquishDrawable__9CDrawableFP11CL_Drawable -# SetDimensions__9CDrawableFll -# SetLayerClip__9CDrawableFPv -# SetLayerOrigin__9CDrawableFll -# SetParent__9CDrawableFP9CDrawable -# __ct__9CDrawableFv -# __dt__9CDrawableFv -#{data} -# __vt__9CDrawable - -### class CDynamicTooltipMixin -#{code} -# __dt__20CDynamicTooltipMixinFv -#{data} -# __vt__20CDynamicTooltipMixin - -### class CDynamicTooltipPane -#{code} -# CalcFrameWithRespectTo__19CDynamicTooltipPaneFP7LWindowP5LPaneRC11EventRecordR4Rect -# CalcTipText__19CDynamicTooltipPaneFP7LWindowP5LPaneRC11EventRecordPUc -# __dt__19CDynamicTooltipPaneFv -#{data} -# __vt__19CDynamicTooltipPane - -### class CEDCharacterContain -#{code} -# AllFieldsOK__19CEDCharacterContainFv -# ControlsFromPref__19CEDCharacterContainFv -# FinishCreateSelf__19CEDCharacterContainFv -# Help__19CEDCharacterContainFv -# ListenToMessage__19CEDCharacterContainFlPv -# PrefsFromControls__19CEDCharacterContainFv -# __dt__19CEDCharacterContainFv -#{data} -# __vt__19CEDCharacterContain - -### class CEDDocAppearanceNoTab -#{code} -# DrawSelf__21CEDDocAppearanceNoTabFv -# __dt__21CEDDocAppearanceNoTabFv -#{data} -# __vt__21CEDDocAppearanceNoTab - -### class CEDDocPropAdvancedContain -#{code} -# AllFieldsOK__25CEDDocPropAdvancedContainFv -# BufferUnique__25CEDDocPropAdvancedContainFv -# ControlsFromPref__25CEDDocPropAdvancedContainFv -# FinishCreateSelf__25CEDDocPropAdvancedContainFv -# Help__25CEDDocPropAdvancedContainFv -# ListenToMessage__25CEDDocPropAdvancedContainFlPv -# PrefsFromControls__25CEDDocPropAdvancedContainFv -# PutStringsInBuffer__25CEDDocPropAdvancedContainFv -# __dt__25CEDDocPropAdvancedContainFv -#{data} -# __vt__25CEDDocPropAdvancedContain - -### class CEDDocPropAppearanceContain -#{code} -# AllFieldsOK__27CEDDocPropAppearanceContainFv -# ControlsFromPref__27CEDDocPropAppearanceContainFv -# Help__27CEDDocPropAppearanceContainFv -# PrefsFromControls__27CEDDocPropAppearanceContainFv -# __dt__27CEDDocPropAppearanceContainFv -#{data} -# __vt__27CEDDocPropAppearanceContain - -### class CEDDocPropGeneralContain -#{code} -# AddMeta__24CEDDocPropGeneralContainFPcP15CLargeEditField -# AllFieldsOK__24CEDDocPropGeneralContainFv -# ControlsFromPref__24CEDDocPropGeneralContainFv -# FinishCreateSelf__24CEDDocPropGeneralContainFv -# Help__24CEDDocPropGeneralContainFv -# PrefsFromControls__24CEDDocPropGeneralContainFv -# __dt__24CEDDocPropGeneralContainFv -#{data} -# __vt__24CEDDocPropGeneralContain - -### class CEDImageContain -#{code} -# AdjustEnable__15CEDImageContainFv -# AllFieldsOK__15CEDImageContainFv -# ControlsFromPref__15CEDImageContainFv -# FinishCreateSelf__15CEDImageContainFv -# Help__15CEDImageContainFv -# Hide__15CEDImageContainFv -# ImageDataFromControls__15CEDImageContainFv -# ListenToMessage__15CEDImageContainFlPv -# PrefsFromControls__15CEDImageContainFv -# Show__15CEDImageContainFv -# __ct__15CEDImageContainFP7LStream -# __dt__15CEDImageContainFv -#{data} -# __vt__15CEDImageContain - -### class CEDLinkContain -#{code} -# AllFieldsOK__14CEDLinkContainFv -# ControlsFromPref__14CEDLinkContainFv -# CurrentFileTargs__14CEDLinkContainFv -# FinishCreateSelf__14CEDLinkContainFv -# Help__14CEDLinkContainFv -# Hide__14CEDLinkContainFv -# ListenToMessage__14CEDLinkContainFlPv -# PrefsFromControls__14CEDLinkContainFv -# SelectedFileUpdate__14CEDLinkContainFv -# Show__14CEDLinkContainFv -# __dt__14CEDLinkContainFv -#{data} -# __vt__14CEDLinkContain - -### class CEDParagraphContain -#{code} -# AdjustPopupsVisibility__19CEDParagraphContainFv -# AllFieldsOK__19CEDParagraphContainFv -# ControlsFromPref__19CEDParagraphContainFv -# FinishCreateSelf__19CEDParagraphContainFv -# Help__19CEDParagraphContainFv -# ListenToMessage__19CEDParagraphContainFlPv -# PrefsFromControls__19CEDParagraphContainFv -# __dt__19CEDParagraphContainFv -#{data} -# __vt__19CEDParagraphContain - -### class CEDTableCellContain -#{code} -# AdjustEnable__19CEDTableCellContainFv -# AllFieldsOK__19CEDTableCellContainFv -# ControlsFromPref__19CEDTableCellContainFv -# FinishCreateSelf__19CEDTableCellContainFv -# Help__19CEDTableCellContainFv -# ListenToMessage__19CEDTableCellContainFlPv -# PrefsFromControls__19CEDTableCellContainFv -# __dt__19CEDTableCellContainFv -#{data} -# __vt__19CEDTableCellContain - -### class CEDTableContain -#{code} -# AdjustEnable__15CEDTableContainFv -# AllFieldsOK__15CEDTableContainFv -# ControlsFromPref__15CEDTableContainFv -# FinishCreateSelf__15CEDTableContainFv -# Help__15CEDTableContainFv -# ListenToMessage__15CEDTableContainFlPv -# PrefsFromControls__15CEDTableContainFv -# __dt__15CEDTableContainFv -#{data} -# __vt__15CEDTableContain - -### class CEditBreakElement -#{code} -# CausesBreakAfter__17CEditBreakElementFv -# GetElementType__17CEditBreakElementFv -# GetLOElementAndOffset__17CEditBreakElementFlbRP17LO_Element_structRi -# GetLayoutElement__17CEditBreakElementFv -# IsBreak__17CEditBreakElementFv -# PrintOpen__17CEditBreakElementFP11CPrintState -# ResetLayoutElement__17CEditBreakElementFiP17LO_Element_struct -# SetLayoutElement__17CEditBreakElementFiiP17LO_Element_struct -# StreamOut__17CEditBreakElementFP10IStreamOut -# __ct__17CEditBreakElementFP12CEditElementP13PA_Tag_structs -# __ct__17CEditBreakElementFP9IStreamInP11CEditBuffer -# __dt__17CEditBreakElementFv -#{data} -# __vt__17CEditBreakElement - -### class CEditBroadcaster -#{code} -# UserChangedText__16CEditBroadcasterFv -# __ct__16CEditBroadcasterFP7LStream -# __dt__16CEditBroadcasterFv -#{data} -# __vt__16CEditBroadcaster - -### class CEditBuffer -#{code} -# AdoptAndDo__11CEditBufferFP12CEditCommand -# AppendTitle__11CEditBufferFPc -# AutoSaveCallback__11CEditBufferFv -# BeginBatchChanges__11CEditBufferFi -# BeginSelection__11CEditBufferFbb -# CanConvertTextToTable__11CEditBufferFv -# CanCopy__11CEditBufferFR14CEditSelectionb -# CanCopy__11CEditBufferFb -# CanCut__11CEditBufferFR14CEditSelectionb -# CanCut__11CEditBufferFb -# CanMove__11CEditBufferFR16CEditInsertPointb -# CanMove__11CEditBufferFR26CPersistentEditInsertPointb -# CanPaste__11CEditBufferFR14CEditSelectionb -# CanPaste__11CEditBufferFb -# CanSetHREF__11CEditBufferFv -# CanSizeObject__11CEditBufferFP17LO_Element_structll -# CanSplitTableCell__11CEditBufferFv -# CancelSizing__11CEditBufferFv -# ChangeEncoding__11CEditBufferFs -# ChangeTableSelection__11CEditBufferF10ED_HitType14ED_MoveSelTypeP18_EDT_TableCellData -# CheckAndPrintComment2__11CEditBufferFRC16CEditInsertPointR14CEditSelectionb -# CheckAndPrintComment__11CEditBufferFP16CEditLeafElementR14CEditSelectionb -# ClearCellSelectionIfNotInside__11CEditBufferFv -# ClearMailQuote__11CEditBufferFv -# ClearMove__11CEditBufferFb -# ClearPhantomInsertPoint__11CEditBufferFv -# ClearSelectedCells__11CEditBufferFv -# ClearSelection__11CEditBufferFbb -# ClearSpecialCellSelection__11CEditBufferFv -# ClearTableAndCellSelection__11CEditBufferFv -# ClearTableIfContainsElement__11CEditBufferFP12CEditElement -# Compare__11CEditBufferFP12CEditElementiP12CEditElementi -# ConvertCurrentDocToNewDoc__11CEditBufferFv -# ConvertTableToText__11CEditBufferFv -# ConvertTextToTable__11CEditBufferFi -# CopyBetweenPoints__11CEditBufferFP12CEditElementP12CEditElementPPcPlPPcPl -# CopyEditText__11CEditBufferFR24CPersistentEditSelectionR9CEditText -# CopyEditText__11CEditBufferFR9CEditText -# CopySelectionContents__11CEditBufferFR14CEditSelectionPPcPl13EEditCopyType -# CopySelectionContents__11CEditBufferFR14CEditSelectionR10IStreamOut13EEditCopyType -# CopySelection__11CEditBufferFPPcPlPPcPl -# CopyStyle__11CEditBufferFv -# CountRowsAndColsInPasteText__11CEditBufferFPcPiPi -# CreateElement__11CEditBufferFP13PA_Tag_structP12CEditElement -# CutEditText__11CEditBufferFR9CEditText -# CutSelectionContents__11CEditBufferFR14CEditSelectionPPcPl -# CutSelection__11CEditBufferFPPcPlPPcPl -# DebugPrintTree__11CEditBufferFP12CEditElement -# DeleteBetweenPoints__11CEditBufferFP16CEditLeafElementP16CEditLeafElementb -# DeleteChar__11CEditBufferFbb -# DeleteLayer__11CEditBufferFv -# DeleteMetaData__11CEditBufferFP13_EDT_MetaData -# DeleteNextChar__11CEditBufferFv -# DeletePreviousChar__11CEditBufferFv -# DeleteSelectedCells__11CEditBufferFv -# DeleteSelectionAndPositionCaret__11CEditBufferFll -# DeleteSelection__11CEditBufferFR14CEditSelectionb -# DeleteSelection__11CEditBufferFb -# DeleteTableCaption__11CEditBufferFv -# DeleteTableCells__11CEditBufferFi -# DeleteTableColumns__11CEditBufferFi -# DeleteTableRows__11CEditBufferFi -# DeleteTable__11CEditBufferFv -# DisplaySource__11CEditBufferFv -# DisplaySpecialCellSelection__11CEditBufferFP21CEditTableCellElementP18_EDT_TableCellData -# DocumentStored__11CEditBufferFv -# DoneTyping__11CEditBufferFv -# DummyCharacterAddedDuringLoad__11CEditBufferFv -# EndBatchChanges__11CEditBufferFv -# EndSelection__11CEditBufferFll -# EndSelection__11CEditBufferFv -# EndSizing__11CEditBufferFv -# EphemeralToPersistent__11CEditBufferFR14CEditSelection -# EphemeralToPersistent__11CEditBufferFR16CEditInsertPoint -# ExtendSelectionElement__11CEditBufferFP16CEditLeafElementib -# ExtendSelection__11CEditBufferFll -# ExtendTableCellSelection__11CEditBufferFll -# FileFetchComplete__11CEditBufferF12ED_FileError -# FindMetaDataIndex__11CEditBufferFP13_EDT_MetaData -# FindMetaData__11CEditBufferFP13_EDT_MetaData -# FindMetaData__11CEditBufferFbPc -# FindNextMisspelledWord__11CEditBufferFbbPP16CEditLeafElement -# FindRelayoutStart__11CEditBufferFP12CEditElement -# FinishedLoad2__11CEditBufferFv -# FinishedLoad__11CEditBufferFv -# FirstElementOnLine__11CEditBufferFP17LO_Element_structPl -# FixupInsertPoint__11CEditBufferFR16CEditInsertPoint -# FixupInsertPoint__11CEditBufferFv -# FixupSpace__11CEditBufferFb -# FixupTableData__11CEditBufferFv -# ForceDocCharSetID__11CEditBufferFs -# FormatCharacterSelection__11CEditBufferFlR14CEditSelectionbi -# FormatCharacter__11CEditBufferFl -# FreeMetaData__11CEditBufferFP13_EDT_MetaData -# FreePageData__11CEditBufferFP13_EDT_PageData -# GetAllDocumentFiles__11CEditBufferFPPbb -# GetAllDocumentTargetsInFile__11CEditBufferFPc -# GetAllDocumentTargets__11CEditBufferFv -# GetAutoSavePeriod__11CEditBufferFv -# GetBackgroundColor__11CEditBufferFP15LO_Color_struct -# GetBaseTarget__11CEditBufferFv -# GetCharacterDataSelection__11CEditBufferFP18_EDT_CharacterDataR14CEditSelection -# GetCharacterData__11CEditBufferFv -# GetCharacterFormatting__11CEditBufferFv -# GetClipboardSignature__11CEditBufferFv -# GetClipboardVersion__11CEditBufferFv -# GetCommandHistoryLimit__11CEditBufferFv -# GetCurrentAlignment__11CEditBufferFv -# GetCurrentElementType__11CEditBufferFv -# GetCurrentLoTableElement__11CEditBufferF10ED_HitTypePlPl -# GetDefaultBorderWidth__11CEditBufferFv -# GetDesiredX__11CEditBufferFP16CEditLeafElementib -# GetDirtyFlag__11CEditBufferFv -# GetDisplayParagraphMarks__11CEditBufferFv -# GetDisplayTables__11CEditBufferFv -# GetDocCharSetID__11CEditBufferFv -# GetEffectiveCaretLOPosition__11CEditBufferFP12CEditElementib -# GetEffectiveDeleteSelection__11CEditBufferFv -# GetFileWriteTime__11CEditBufferFv -# GetFirstCellInCurrentColumn__11CEditBufferFv -# GetFirstCellInCurrentRow__11CEditBufferFv -# GetFirstCellSelection__11CEditBufferFR14CEditSelection -# GetFirstSelectedCell__11CEditBufferFv -# GetFontColor__11CEditBufferFv -# GetFontFaceIndex__11CEditBufferFv -# GetFontFace__11CEditBufferFv -# GetFontPointSize__11CEditBufferFv -# GetFontSize__11CEditBufferFv -# GetHREFData__11CEditBufferFP13_EDT_HREFData -# GetHREFLinkID__11CEditBufferFv -# GetHREFText__11CEditBufferFv -# GetHREF__11CEditBufferFv -# GetHorizRuleData__11CEditBufferFv -# GetImageData__11CEditBufferFv -# GetInsertPoint__11CEditBufferFPP16CEditLeafElementPlPb -# GetInsertPoint__11CEditBufferFR16CEditInsertPoint -# GetInsertPoint__11CEditBufferFR26CPersistentEditInsertPoint -# GetLOCaretPosition__11CEditBufferFP12CEditElementibRlRlRl -# GetLayerData__11CEditBufferFv -# GetListData__11CEditBufferFv -# GetLoCell__11CEditBufferFP12CEditElement -# GetMergeTableCellsType__11CEditBufferFv -# GetMetaData__11CEditBufferFi -# GetNextCellSelection__11CEditBufferFR14CEditSelection -# GetNextSelectedCell__11CEditBufferFPi -# GetNumberOfSelectedColumns__11CEditBufferFv -# GetNumberOfSelectedRows__11CEditBufferFv -# GetPageData__11CEditBufferFv -# GetParagraphAlign__11CEditBufferFv -# GetParagraphFormattingSelection__11CEditBufferFR14CEditSelection -# GetParagraphFormatting__11CEditBufferFv -# GetParseState__11CEditBufferFv -# GetPlugins__11CEditBufferFv -# GetPositionalText__11CEditBufferFv -# GetPropertyPoint__11CEditBufferFPP16CEditLeafElementPl -# GetRAMCharSetID__11CEditBufferFv -# GetRedoCommand__11CEditBufferFi -# GetSelection__11CEditBufferFR14CEditSelection -# GetSelection__11CEditBufferFR14CEditSelectionRP16CEditLeafElementRlRP16CEditLeafElementRlRb -# GetSelection__11CEditBufferFR24CPersistentEditSelection -# GetSelection__11CEditBufferFRP16CEditLeafElementRlRP16CEditLeafElementRlRb -# GetSetStateForCharacterSelection__11CEditBufferFlR14CEditSelection -# GetSizingRect__11CEditBufferFllbP8_XP_Rect -# GetTabDelimitedTextFromSelectedCells__11CEditBufferFv -# GetTableCaptionData__11CEditBufferFv -# GetTableCellData__11CEditBufferFv -# GetTableData__11CEditBufferFv -# GetTableDropRegion__11CEditBufferFPlPlPlPlPP17LO_Element_struct -# GetTableHitRegion__11CEditBufferFllPP17LO_Element_structb -# GetTableInsertPoint__11CEditBufferFR16CEditInsertPoint -# GetTableRowData__11CEditBufferFv -# GetTableSelectionType__11CEditBufferFv -# GetTargetData__11CEditBufferFv -# GetUndoCommand__11CEditBufferFi -# GetUnknownTagData__11CEditBufferFv -# HandleSelectionComment__11CEditBufferFP13PA_Tag_structRP12CEditElementRi -# HasEncoding__11CEditBufferFv -# IndentContainer__11CEditBufferFP21CEditContainerElementP16CEditListElement -# IndentSelection__11CEditBufferFR14CEditSelection -# Indent__11CEditBufferFv -# InitEscapes__11CEditBufferFv -# InitializePrefs__11CEditBufferFv -# InsertBreak__11CEditBufferF12ED_BreakTypeb -# InsertChar__11CEditBufferFib -# InsertChars__11CEditBufferFPcbb -# InsertHorizRule__11CEditBufferFP18_EDT_HorizRuleData -# InsertImage__11CEditBufferFP14_EDT_ImageData -# InsertLayer__11CEditBufferFP14_EDT_LayerData -# InsertLeaf__11CEditBufferFP16CEditLeafElement -# InsertNonLeaf__11CEditBufferFP12CEditElement -# InsertTableCaption__11CEditBufferFP21_EDT_TableCaptionData -# InsertTableCells__11CEditBufferFP18_EDT_TableCellDatabi -# InsertTableColumns__11CEditBufferFP18_EDT_TableCellDatabi -# InsertTableRows__11CEditBufferFP17_EDT_TableRowDatabi -# InsertTable__11CEditBufferFP14_EDT_TableData -# InsertTarget__11CEditBufferFPc -# InsertUnknownTag__11CEditBufferFPc -# InternalReturnKey__11CEditBufferFb -# InternalSetCaret__11CEditBufferFb -# IsAlive__11CEditBufferFP11CEditBuffer -# IsBodyTagRequired__11CEditBufferFv -# IsFileModified__11CEditBufferFv -# IsInsertPointInLayer__11CEditBufferFv -# IsInsertPointInNestedTable__11CEditBufferFv -# IsInsertPointInTableCaption__11CEditBufferFv -# IsInsertPointInTableCell__11CEditBufferFv -# IsInsertPointInTableRow__11CEditBufferFv -# IsInsertPointInTable__11CEditBufferFv -# IsPhantomInsertPoint__11CEditBufferFR16CEditInsertPoint -# IsPhantomInsertPoint__11CEditBufferFv -# IsReady__11CEditBufferFv -# IsSelectionComment__11CEditBufferFP13PA_Tag_struct -# IsWritable__11CEditBufferFv -# IterateMisspelledWords__11CEditBufferFQ211CEditBuffer9EMSW_FUNCPcPcb -# LoadImage__11CEditBufferFP14_EDT_ImageDatabb -# MakeMetaData__11CEditBufferFbPcPc -# MakeSelectionEndPoints__11CEditBufferFR14CEditSelectionRP16CEditLeafElementRP16CEditLeafElement -# MakeSelectionEndPoints__11CEditBufferFRP16CEditLeafElementRP16CEditLeafElement -# MergeTableCells__11CEditBufferFv -# MetaDataCount__11CEditBufferFv -# MorphContainerSelection__11CEditBufferFScR14CEditSelection -# MorphContainer__11CEditBufferFSc -# MorphListContainer2__11CEditBufferFScR14CEditSelection -# MorphListContainer__11CEditBufferFSc -# MoveAndHideCaretInTable__11CEditBufferFP17LO_Element_struct -# MoveToExistingCell__11CEditBufferFP17CEditTableElementll -# MoveToFirstSelectedCell__11CEditBufferFv -# MoveToLastSelectedCell__11CEditBufferFv -# Move__11CEditBufferFR16CEditInsertPointb -# Move__11CEditBufferFR26CPersistentEditInsertPointb -# NavigateChunk__11CEditBufferFbib -# NavigateDocument__11CEditBufferFbb -# NextChar__11CEditBufferFb -# NextPosition__11CEditBufferFP16CEditLeafElementlRP16CEditLeafElementRl -# NextTableCell__11CEditBufferFbbPi -# NormalizePreformatText__11CEditBufferFP17pa_DocData_structP13PA_Tag_structi -# NormalizeText__11CEditBufferFPc -# NormalizeTree__11CEditBufferFv -# OutdentContainer__11CEditBufferFP21CEditContainerElementP16CEditListElement -# OutdentSelection__11CEditBufferFR14CEditSelection -# Outdent__11CEditBufferFv -# PageUpDown__11CEditBufferFbb -# ParseBodyTag__11CEditBufferFP13PA_Tag_struct -# ParseEndTag__11CEditBufferFP13PA_Tag_struct -# ParseLinkFontDef__11CEditBufferFP13PA_Tag_structRP12CEditElementRi -# ParseLink__11CEditBufferFP13PA_Tag_structRP12CEditElementRi -# ParseMetaTag__11CEditBufferFP13PA_Tag_struct -# ParseOpenTag__11CEditBufferFP17pa_DocData_structP13PA_Tag_structi -# ParseTag__11CEditBufferFP17pa_DocData_structP13PA_Tag_structi -# ParseUnsupportedTag__11CEditBufferFP13PA_Tag_structRP12CEditElementRi -# PasteCellsIntoTable__11CEditBufferFR9IStreamIn13EEditCopyType -# PasteEditText__11CEditBufferFR9CEditText -# PasteHREF__11CEditBufferFPPcPPci -# PasteHTMLHook__11CEditBufferFP11CPrintState -# PasteHTML__11CEditBufferFPcb -# PasteHTML__11CEditBufferFR9IStreamInb -# PasteQuoteBegin__11CEditBufferFb -# PasteQuoteEnd__11CEditBufferFv -# PasteQuoteINTL__11CEditBufferFPcs -# PasteQuote__11CEditBufferFPc -# PasteStyle__11CEditBufferFb -# PasteTextAsNewTable__11CEditBufferFPcii -# PasteTextIntoTable__11CEditBufferFPcbii -# PasteText__11CEditBufferFPcbbbb -# PasteText__11CEditBufferFPcbbsbb -# PersistentToEphemeral__11CEditBufferFR24CPersistentEditSelection -# PersistentToEphemeral__11CEditBufferFR26CPersistentEditInsertPoint -# PopParseState__11CEditBufferFv -# PositionCaret__11CEditBufferFll -# PositionDropCaret__11CEditBufferFll -# PrefCallback__11CEditBufferFPCcPv -# PrevPosition__11CEditBufferFP16CEditLeafElementlRP16CEditLeafElementRl -# PreviousChar__11CEditBufferFb -# PrintDocumentEnd__11CEditBufferFP11CPrintState -# PrintDocumentHead__11CEditBufferFP11CPrintState -# PrintMetaData__11CEditBufferFP11CPrintState -# PrintMetaData__11CEditBufferFP11CPrintStatei -# PrintTree__11CEditBufferFP12CEditElement -# PublishFile__11CEditBufferF21ED_SaveFinishedOptionPcPPcPcPcPcbb -# PushParseState__11CEditBufferFv -# ReadFromBuffer__11CEditBufferFPc -# RecordJavaScriptAsUnknownTag__11CEditBufferFP16CStreamOutMemory -# RecordState__11CEditBufferFv -# RecordTag__11CEditBufferFP13PA_Tag_structb -# Redo__11CEditBufferFv -# Reduce__11CEditBufferFP12CEditElement -# Reflow__11CEditBufferFP12CEditElementiP12CEditElementi -# RefreshLayout__11CEditBufferFv -# RelayoutSelectedTable__11CEditBufferFv -# Relayout__11CEditBufferFP12CEditElementiP12CEditElementi -# RepairAndSet__11CEditBufferFR14CEditSelection -# ReplaceLoop__11CEditBufferFPcbPcbbb -# ReplaceOnce__11CEditBufferFPcbb -# ReplaceText__11CEditBufferFPcbPcbbb -# ResetParseStateStack__11CEditBufferFv -# ResizeTableCell__11CEditBufferFP17CEditTableElementbb -# ResizeTable__11CEditBufferFP17CEditTableElementbb -# RestoreState__11CEditBufferFP13CEditDocState -# ResumeAutoSave__11CEditBufferFv -# ReturnKey__11CEditBufferFbb -# RevealPosition__11CEditBufferFP12CEditElementib -# RevealSelection__11CEditBufferFv -# SaveFileReal__11CEditBufferFP13CEditSaveData -# SaveFile__11CEditBufferF21ED_SaveFinishedOptionPcP15ITapeFileSystembbbbPPcP19CEditSaveToTempData -# SelectAll__11CEditBufferFv -# SelectBlockOfCells__11CEditBufferFP20LO_CellStruct_struct -# SelectCellContents__11CEditBufferFP21CEditTableCellElement -# SelectCell__11CEditBufferFbP20LO_CellStruct_structP21CEditTableCellElement -# SelectCurrentElement__11CEditBufferFv -# SelectNextChar__11CEditBufferFv -# SelectNextNonTextObject__11CEditBufferFv -# SelectObject__11CEditBufferFll -# SelectPreviousChar__11CEditBufferFv -# SelectRegion__11CEditBufferFP16CEditLeafElementiP16CEditLeafElementibb -# SelectTableCell__11CEditBufferFv -# SelectTableElement__11CEditBufferFP21CEditTableCellElement10ED_HitType -# SelectTableElement__11CEditBufferFllP17LO_Element_struct10ED_HitTypebb -# SelectTable__11CEditBufferFbP21LO_TableStruct_structP17CEditTableElement -# SelectTable__11CEditBufferFv -# SetAutoSavePeriod__11CEditBufferFl -# SetBackgroundColor__11CEditBufferFP15LO_Color_struct -# SetBaseTarget__11CEditBufferFPc -# SetCaret__11CEditBufferFv -# SetCharacterDataAtOffset__11CEditBufferFP18_EDT_CharacterDatall -# SetCharacterDataSelection__11CEditBufferFP18_EDT_CharacterDataR14CEditSelectionb -# SetCharacterData__11CEditBufferFP18_EDT_CharacterData -# SetCommandHistoryLimit__11CEditBufferFi -# SetDisplayParagraphMarks__11CEditBufferFb -# SetDisplayTables__11CEditBufferFb -# SetEncoding__11CEditBufferFs -# SetFontColorSelection__11CEditBufferF8ED_ColorR14CEditSelectionb -# SetFontColor__11CEditBufferF8ED_Color -# SetFontPointSize__11CEditBufferFi -# SetFontSizeSelection__11CEditBufferFibR14CEditSelectionb -# SetFontSize__11CEditBufferFib -# SetHREFData__11CEditBufferFP13_EDT_HREFData -# SetHREFSelection__11CEditBufferFP7ED_Link -# SetHREF__11CEditBufferFPcPc -# SetHorizRuleData__11CEditBufferFP18_EDT_HorizRuleData -# SetImageAsBackground__11CEditBufferFv -# SetImageData__11CEditBufferFP14_EDT_ImageDatab -# SetInsertPoint__11CEditBufferFP16CEditLeafElementib -# SetInsertPoint__11CEditBufferFR16CEditInsertPoint -# SetInsertPoint__11CEditBufferFR26CPersistentEditInsertPoint -# SetLayerData__11CEditBufferFP14_EDT_LayerData -# SetListData__11CEditBufferFP13_EDT_ListData -# SetMetaData__11CEditBufferFP13_EDT_MetaData -# SetPageData__11CEditBufferFP13_EDT_PageData -# SetParagraphAlign__11CEditBufferF12ED_Alignment -# SetRefresh__11CEditBufferFb -# SetSelectionInNewDocument__11CEditBufferFv -# SetSelection__11CEditBufferFR14CEditSelection -# SetSelection__11CEditBufferFR24CPersistentEditSelection -# SetTableAlign__11CEditBufferF12ED_Alignment -# SetTableCaptionData__11CEditBufferFP21_EDT_TableCaptionData -# SetTableCellData__11CEditBufferFP18_EDT_TableCellData -# SetTableData__11CEditBufferFP14_EDT_TableData -# SetTableInsertPoint__11CEditBufferFP21CEditTableCellElementb -# SetTableRowData__11CEditBufferFP17_EDT_TableRowData -# SetTargetData__11CEditBufferFPc -# SetUnknownTagData__11CEditBufferFPc -# ShouldAutoStartBody__11CEditBufferFP13PA_Tag_structs -# SortSelectedCells__11CEditBufferFv -# SplitAtContainer__11CEditBufferFbbRP12CEditElement -# SplitTableCell__11CEditBufferFv -# StartDragTable__11CEditBufferFll -# StartSelection__11CEditBufferFllb -# StartSizing__11CEditBufferFP17LO_Element_structllbP8_XP_Rect -# StartSpecialCellSelection__11CEditBufferFP18_EDT_TableCellData -# StartTyping__11CEditBufferFb -# StopDragTable__11CEditBufferFv -# StreamToPositionalText__11CEditBufferFP12CEditElementP10IStreamOut -# SuspendAutoSave__11CEditBufferFv -# SyncCursor__11CEditBufferFP17CEditLayerElement -# TabKey__11CEditBufferFbb -# TerminateList__11CEditBufferFP21CEditContainerElement -# ToggleList2__11CEditBufferFiR14CEditSelection -# ToggleList__11CEditBufferFi -# Trim__11CEditBufferFv -# Undo__11CEditBufferFv -# UpDown__11CEditBufferFbb -# WindowScrolled__11CEditBufferFv -# WriteClosingScriptTag__11CEditBufferFv -# WriteToBuffer__11CEditBufferFPPcb -# WriteToFile__11CEditBufferFP5_FILE -# WriteToStream__11CEditBufferFP10IStreamOut -# Write__11CEditBufferFP16CStreamOutMemoryP10IStreamOut -# __ct__11CEditBufferFP10MWContext_b -# __dt__11CEditBufferFv -#{data} -# m_bAutoSaving__11CEditBuffer -# m_bEdtBufPrefInitialized__11CEditBuffer -# m_bMoveCursor__11CEditBuffer -# m_bNewCellHasSpace__11CEditBuffer -# m_pCopyStyleCharacterData__11CEditBuffer -# m_pDragTableData__11CEditBuffer - -### class CEditCaptionElement -#{code} -# FreeData__19CEditCaptionElementFP21_EDT_TableCaptionData -# GetData__19CEditCaptionElementFs -# GetData__19CEditCaptionElementFv -# GetElementType__19CEditCaptionElementFv -# IsCaption__19CEditCaptionElementFv -# NewData__19CEditCaptionElementFv -# ParseParams__19CEditCaptionElementFP13PA_Tag_structs -# SetData__19CEditCaptionElementFP21_EDT_TableCaptionData -# __ct__19CEditCaptionElementFP12CEditElementP13PA_Tag_structs -# __ct__19CEditCaptionElementFP9IStreamInP11CEditBuffer -# __ct__19CEditCaptionElementFv -# __dt__19CEditCaptionElementFv -#{data} -# __vt__19CEditCaptionElement - -### class CEditCommand -#{code} -# Do__12CEditCommandFv -# GetID__12CEditCommandFv -# Redo__12CEditCommandFv -# Undo__12CEditCommandFv -# __ct__12CEditCommandFP11CEditBufferi -# __dt__12CEditCommandFv -#{data} -# __vt__12CEditCommand - -### class CEditCommandGroup -#{code} -# AdoptAndDo__17CEditCommandGroupFP12CEditCommand -# GetNumberOfCommands__17CEditCommandGroupFv -# Redo__17CEditCommandGroupFv -# Undo__17CEditCommandGroupFv -# __ct__17CEditCommandGroupFP11CEditBufferi -# __dt__17CEditCommandGroupFv -#{data} -# __vt__17CEditCommandGroup - -### class CEditCommandLog -#{code} -# AdoptAndDo__15CEditCommandLogFP12CEditCommand -# BeginBatchChanges__15CEditCommandLogFi -# CreateDocTempFilename__15CEditCommandLogFPcPc -# DocumentStored__15CEditCommandLogFv -# EndBatchChanges__15CEditCommandLogFv -# EndTyping__15CEditCommandLogFv -# FinishBatchCommands__15CEditCommandLogFv -# GetAppTempDir__15CEditCommandLogFv -# GetCommandHistoryLimit__15CEditCommandLogFv -# GetDocTempDir__15CEditCommandLogFv -# GetNumberOfCommandsToRedo__15CEditCommandLogFv -# GetNumberOfCommandsToUndo__15CEditCommandLogFv -# GetPlugins__15CEditCommandLogFv -# GetRedoCommand__15CEditCommandLogFi -# GetStoredVersion__15CEditCommandLogFv -# GetUndoCommand__15CEditCommandLogFi -# GetVersion__15CEditCommandLogFv -# InReload__15CEditCommandLogFv -# InternalAdoptAndDo__15CEditCommandLogFP12CEditCommand -# InternalDo__15CEditCommandLogFi -# IsDirty__15CEditCommandLogFv -# Redo__15CEditCommandLogFv -# SetCommandHistoryLimit__15CEditCommandLogFi -# SetInReload__15CEditCommandLogFb -# SetVersion__15CEditCommandLogFl -# StartTyping__15CEditCommandLogFi -# Trim__15CEditCommandLogFv -# Undo__15CEditCommandLogFv -# __ct__15CEditCommandLogFv -# __dt__15CEditCommandLogFv -#{data} -# m_iDocTempDirNonce__15CEditCommandLog - -### class CEditContain -#{code} -# __dt__12CEditContainFv -#{data} -# __vt__12CEditContain - -### class CEditContainerElement -#{code} -# AdjustContainers__21CEditContainerElementFP11CEditBuffer -# AlignIfEmpty__21CEditContainerElementF12ED_Alignment -# Clone__21CEditContainerElementFP12CEditElement -# CopyAttributes__21CEditContainerElementFP21CEditContainerElement -# FinishedLoad__21CEditContainerElementFP11CEditBuffer -# ForcesDoubleSpacedNextLine__21CEditContainerElementFv -# FreeData__21CEditContainerElementFP18_EDT_ContainerData -# GetData__21CEditContainerElementFv -# GetElementType__21CEditContainerElementFv -# GetPersistentCount__21CEditContainerElementFv -# GetPseudoParagraphState__21CEditContainerElementFv -# GetText__21CEditContainerElementFv -# HasExtraData__21CEditContainerElementFv -# IsAcceptableChild__21CEditContainerElementFR12CEditElement -# IsContainerContainer__21CEditContainerElementFv -# IsContainer__21CEditContainerElementFv -# IsEmpty__21CEditContainerElementFv -# IsFirstContainer__21CEditContainerElementFv -# IsImplicitBreak__21CEditContainerElementFv -# IsPlainFirstContainer__21CEditContainerElementFv -# NewData__21CEditContainerElementFv -# NewDefaultContainer__21CEditContainerElementFP12CEditElement12ED_Alignment -# ParseParams__21CEditContainerElementFP13PA_Tag_structs -# PrintEnd__21CEditContainerElementFP11CPrintState -# PrintOpen__21CEditContainerElementFP11CPrintState -# SetAlignment__21CEditContainerElementF12ED_Alignment -# SetData__21CEditContainerElementFP18_EDT_ContainerData -# ShouldSkipTags__21CEditContainerElementFv -# ShouldStreamSelf__21CEditContainerElementFR14CEditSelectionR14CEditSelection -# StreamInChildren__21CEditContainerElementFP9IStreamInP11CEditBuffer -# StreamOut__21CEditContainerElementFP10IStreamOut -# StreamToPositionalText__21CEditContainerElementFP10IStreamOutb -# SupportsAlign__21CEditContainerElementFv -# TagEnd__21CEditContainerElementFv -# TagOpen__21CEditContainerElementFi -# __ct__21CEditContainerElementFP12CEditElementP13PA_Tag_structs12ED_Alignment -# __ct__21CEditContainerElementFP9IStreamInP11CEditBuffer -# __dt__21CEditContainerElementFv -#{data} -# __vt__21CEditContainerElement - -### class CEditDataSaver -#{code} -# DoBegin__14CEditDataSaverFR24CPersistentEditSelection -# DoEnd__14CEditDataSaverFR24CPersistentEditSelection -# Redo__14CEditDataSaverFv -# Undo__14CEditDataSaverFv -# __ct__14CEditDataSaverFP11CEditBuffer -# __dt__14CEditDataSaverFv - -### class CEditDialog -#{code} -# AllowSubRemoval__11CEditDialogFP10LCommander -# ChooseImageFile__11CEditDialogFP15CLargeEditField -# FindCommandStatus__11CEditDialogFlRUcRUcRUsPUc -# ListenToMessage__11CEditDialogFlPv -# Start__11CEditDialogFsP10MWContext_sUc -# __dt__11CEditDialogFv -#{data} -# __vt__11CEditDialog - -### class CEditDictionary -#{code} -# AddNewWord__15CEditDictionaryFv -# FinishCreateSelf__15CEditDictionaryFv -# GetISpellChecker__15CEditDictionaryFv -# ListenToMessage__15CEditDictionaryFlPv -# MakeDictionaryChangesPermanent__15CEditDictionaryFv -# RemoveSelectedWords__15CEditDictionaryFv -# ReplaceSelectedWord__15CEditDictionaryFv -# SetISpellChecker__15CEditDictionaryFP13ISpellChecker -# __ct__15CEditDictionaryFP7LStream -# __dt__15CEditDictionaryFv -#{data} -# __vt__15CEditDictionary - -### class CEditDictionaryTable -#{code} -# BeTarget__20CEditDictionaryTableFv -# DontBeTarget__20CEditDictionaryTableFv -# HiliteSelection__20CEditDictionaryTableFUcUc -# __dt__20CEditDictionaryTableFv -#{data} -# __vt__20CEditDictionaryTable - -### class CEditDivisionElement -#{code} -# Cast__20CEditDivisionElementFP12CEditElement -# ClearAlignment__20CEditDivisionElementFv -# FreeData__20CEditDivisionElementFP17_EDT_DivisionData -# GetAlignment__20CEditDivisionElementFv -# GetData__20CEditDivisionElementFv -# GetElementType__20CEditDivisionElementFv -# HasData__20CEditDivisionElementFv -# IsAcceptableChild__20CEditDivisionElementFR12CEditElement -# IsDivision__20CEditDivisionElementFv -# NewData__20CEditDivisionElementFv -# ParseParams__20CEditDivisionElementFP13PA_Tag_structs -# PrintEnd__20CEditDivisionElementFP11CPrintState -# PrintOpen__20CEditDivisionElementFP11CPrintState -# SetData__20CEditDivisionElementFP17_EDT_DivisionData -# __ct__20CEditDivisionElementFP12CEditElementP13PA_Tag_structs -# __ct__20CEditDivisionElementFP9IStreamInP11CEditBuffer -# __ct__20CEditDivisionElementFv -# __dt__20CEditDivisionElementFv -#{data} -# __vt__20CEditDivisionElement - -### class CEditDocState -#{code} -# __ct__13CEditDocStateFv -# __dt__13CEditDocStateFv -#{data} -# __vt__13CEditDocState - -### class CEditElement -#{code} -# AdjustContainers__12CEditElementFP11CEditBuffer -# AllowBothSidesOfGap__12CEditElementFv -# Break__12CEditElementFv -# CanReflow__12CEditElementFv -# Caption__12CEditElementFv -# CausesBreakAfter__12CEditElementFv -# CausesBreakBefore__12CEditElementFv -# ClipToMe__12CEditElementFR14CEditSelectionR14CEditSelection -# CloneFormatting__12CEditElementFSc -# Clone__12CEditElementFP12CEditElement -# CommonConstructor__12CEditElementFv -# Container__12CEditElementFv -# DeleteChildren__12CEditElementFv -# DeleteElement__12CEditElementFP12CEditElement -# Divide__12CEditElementFi -# Division__12CEditElementFv -# DownLeft__12CEditElementFM12CEditElementFPCvPvPv_bPvb -# DownRight__12CEditElementFM12CEditElementFPCvPvPv_bPvb -# EnsureSelectableSiblings__12CEditElementFP11CEditBuffer -# Finalize__12CEditElementFv -# FindContainerContainer__12CEditElementFv -# FindContainer__12CEditElementFPv -# FindContainer__12CEditElementFv -# FindEnclosingContainer__12CEditElementFv -# FindImage__12CEditElementFPv -# FindLeafAll__12CEditElementFPv -# FindLeaf__12CEditElementFPv -# FindList__12CEditElementFRP21CEditContainerElementRP16CEditListElement -# FindNextElement__12CEditElementFM12CEditElementFPCvPvPv_bPv -# FindPreviousElement__12CEditElementFM12CEditElementFPCvPvPv_bPv -# FindTableCell__12CEditElementFPv -# FindTableRow__12CEditElementFPv -# FindTable__12CEditElementFPv -# FindTarget__12CEditElementFPv -# FindTextAll__12CEditElementFPv -# FindText__12CEditElementFPv -# FindUnknownHTML__12CEditElementFPv -# FinishedLoad__12CEditElementFP11CEditBuffer -# GetAll__12CEditElementFR14CEditSelection -# GetCaptionIgnoreSubdoc__12CEditElementFv -# GetCaption__12CEditElementFv -# GetChildContaining__12CEditElementFP12CEditElement -# GetCommonAncestor__12CEditElementFP12CEditElement -# GetDefaultAlignment__12CEditElementFv -# GetDefaultFontSize__12CEditElementFv -# GetDefaultVAlignment__12CEditElementFv -# GetEditBuffer__12CEditElementFv -# GetElementIndexOf__12CEditElementFP12CEditElement -# GetElementIndex__12CEditElementFv -# GetElementType__12CEditElementFv -# GetFirstMostChild__12CEditElementFv -# GetHeight__12CEditElementFPbPl -# GetLastChild__12CEditElementFv -# GetLastMostChild__12CEditElementFv -# GetLayerIgnoreSubdoc__12CEditElementFv -# GetLayer__12CEditElementFv -# GetMailQuote__12CEditElementFv -# GetNextNonEmptyContainer__12CEditElementFv -# GetParentTableCell__12CEditElementFv -# GetParentTable__12CEditElementFv -# GetPersistentCount__12CEditElementFv -# GetPersistentInsertPoint__12CEditElementFl -# GetPreviousNonEmptyContainer__12CEditElementFv -# GetPreviousSibling__12CEditElementFv -# GetRootDoc__12CEditElementFv -# GetRoot__12CEditElementFv -# GetSubDocOrLayerSkipRoot__12CEditElementFv -# GetSubDocSkipRoot__12CEditElementFv -# GetSubDoc__12CEditElementFv -# GetTableCellIgnoreSubdoc__12CEditElementFv -# GetTableCell__12CEditElementFv -# GetTableIgnoreSubdoc__12CEditElementFv -# GetTableOrLayerIgnoreSubdoc__12CEditElementFv -# GetTableRowIgnoreSubdoc__12CEditElementFv -# GetTableRow__12CEditElementFv -# GetTable__12CEditElementFv -# GetTopmostTableOrLayer__12CEditElementFv -# GetWidth__12CEditElementFPbPl -# GetWinCSID__12CEditElementFv -# HorizRule__12CEditElementFv -# Icon__12CEditElementFv -# Image__12CEditElementFv -# InFormattedText__12CEditElementFv -# InMailQuote__12CEditElementFv -# InMungableMailQuote__12CEditElementFv -# IndexToInsertPoint__12CEditElementFlb -# InsertAfter__12CEditElementFP12CEditElement -# InsertAsFirstChild__12CEditElementFP12CEditElement -# InsertAsLastChild__12CEditElementFP12CEditElement -# InsertBefore__12CEditElementFP12CEditElement -# InternalPrintOpen__12CEditElementFP11CPrintStatePc -# IsAcceptableChild__12CEditElementFR12CEditElement -# IsBreak__12CEditElementFv -# IsCaption__12CEditElementFv -# IsContainerContainer__12CEditElementFv -# IsContainer__12CEditElementFv -# IsDivision__12CEditElementFv -# IsEndContainer__12CEditElementFv -# IsEndOfDocument__12CEditElementFv -# IsFirstInContainer__12CEditElementFv -# IsIcon__12CEditElementFv -# IsImage__12CEditElementFv -# IsLayer__12CEditElementFv -# IsLeaf__12CEditElementFv -# IsList__12CEditElementFv -# IsRootDoc__12CEditElementFv -# IsRoot__12CEditElementFv -# IsSelected__12CEditElementFv -# IsSubDoc__12CEditElementFv -# IsTableCell__12CEditElementFv -# IsTableRow__12CEditElementFv -# IsTable__12CEditElementFv -# IsText__12CEditElementFv -# Layer__12CEditElementFv -# LeafInContainerAfter__12CEditElementFv -# Leaf__12CEditElementFv -# List__12CEditElementFv -# Merge__12CEditElementFP12CEditElementb -# NextLeafAll__12CEditElementFb -# PartialStreamOut__12CEditElementFP10IStreamOutR14CEditSelection -# PreviousLeafInContainer__12CEditElementFv -# PreviousTextInContainer__12CEditElementFv -# PrintEnd__12CEditElementFP11CPrintState -# PrintOpen__12CEditElementFP11CPrintState -# Reduce__12CEditElementFP11CEditBuffer -# RootDoc__12CEditElementFv -# Root__12CEditElementFv -# SetChild__12CEditElementFP12CEditElement -# SetNextSibling__12CEditElementFP12CEditElement -# SetSize__12CEditElementFblbl -# SetTagData__12CEditElementFP13PA_Tag_structPc -# SetTagData__12CEditElementFPc -# ShouldStreamSelf__12CEditElementFR14CEditSelectionR14CEditSelection -# SplitContainerTest__12CEditElementFPv -# SplitFormattingTest__12CEditElementFPv -# Split__12CEditElementFP12CEditElementP12CEditElementM12CEditElementFPCvPvPv_bPv -# StreamCtorNoChildren__12CEditElementFP9IStreamInP11CEditBuffer -# StreamCtor__12CEditElementFP9IStreamInP11CEditBuffer -# StreamInChildren__12CEditElementFP9IStreamInP11CEditBuffer -# StreamOut__12CEditElementFP10IStreamOut -# StreamToPositionalText__12CEditElementFP10IStreamOutb -# SubDoc__12CEditElementFv -# TableCell__12CEditElementFv -# TableRow__12CEditElementFv -# Table__12CEditElementFv -# TagEnd__12CEditElementFv -# TagOpen__12CEditElementFi -# Target__12CEditElementFv -# TextInContainerAfter__12CEditElementFv -# Text__12CEditElementFv -# Unlink__12CEditElementFv -# UpLeft__12CEditElementFM12CEditElementFPCvPvPv_bPv -# UpRight__12CEditElementFM12CEditElementFPCvPvPv_bPv -# Within__12CEditElementFi -# __ct__12CEditElementFP12CEditElementP13PA_Tag_structs -# __ct__12CEditElementFP12CEditElementScPc -# __ct__12CEditElementFP9IStreamInP11CEditBuffer -# __dt__12CEditElementFv -#{data} -# __vt__12CEditElement - -### class CEditEndContainerElement -#{code} -# AdjustContainers__24CEditEndContainerElementFP11CEditBuffer -# IsAcceptableChild__24CEditEndContainerElementFR12CEditElement -# IsEndContainer__24CEditEndContainerElementFv -# PrintEnd__24CEditEndContainerElementFP11CPrintState -# PrintOpen__24CEditEndContainerElementFP11CPrintState -# ShouldStreamSelf__24CEditEndContainerElementFR14CEditSelectionR14CEditSelection -# StreamOut__24CEditEndContainerElementFP10IStreamOut -# __ct__24CEditEndContainerElementFP12CEditElement -# __dt__24CEditEndContainerElementFv -#{data} -# __vt__24CEditEndContainerElement - -### class CEditEndElement -#{code} -# GetElementType__15CEditEndElementFv -# PrintEnd__15CEditEndElementFP11CPrintState -# PrintOpen__15CEditEndElementFP11CPrintState -# SetLayoutElement__15CEditEndElementFiiP17LO_Element_struct -# ShouldStreamSelf__15CEditEndElementFR14CEditSelectionR14CEditSelection -# StreamOut__15CEditEndElementFP10IStreamOut -# __dt__15CEditEndElementFv -#{data} -# __vt__15CEditEndElement - -### class CEditFieldControl -#{code} -# UserChangedText__17CEditFieldControlFv -# __dt__17CEditFieldControlFv -#{data} -# __vt__17CEditFieldControl - -### class CEditHorizRuleElement -#{code} -# AllowBothSidesOfGap__21CEditHorizRuleElementFv -# CausesBreakAfter__21CEditHorizRuleElementFv -# CausesBreakBefore__21CEditHorizRuleElementFv -# FreeData__21CEditHorizRuleElementFP18_EDT_HorizRuleData -# GetData__21CEditHorizRuleElementFv -# GetElementType__21CEditHorizRuleElementFv -# GetLOElementAndOffset__21CEditHorizRuleElementFlbRP17LO_Element_structRi -# GetLayoutElement__21CEditHorizRuleElementFv -# NewData__21CEditHorizRuleElementFv -# ParseParams__21CEditHorizRuleElementFP13PA_Tag_structs -# ResetLayoutElement__21CEditHorizRuleElementFiP17LO_Element_struct -# SetData__21CEditHorizRuleElementFP18_EDT_HorizRuleData -# SetLayoutElement__21CEditHorizRuleElementFiiP17LO_Element_struct -# StreamOut__21CEditHorizRuleElementFP10IStreamOut -# __ct__21CEditHorizRuleElementFP12CEditElementP13PA_Tag_structs -# __ct__21CEditHorizRuleElementFP9IStreamInP11CEditBuffer -# __dt__21CEditHorizRuleElementFv -#{data} -# __vt__21CEditHorizRuleElement - -### class CEditIconElement -#{code} -# FreeLocalDataLists__16CEditIconElementFPPcPPci -# GetData__16CEditIconElementFv -# GetElementType__16CEditIconElementFv -# GetLOElementAndOffset__16CEditIconElementFlbRP17LO_Element_structRi -# GetLayoutElement__16CEditIconElementFv -# IsComment__16CEditIconElementFPc -# IsComment__16CEditIconElementFv -# IsIcon__16CEditIconElementFv -# IsUnknownHTML__16CEditIconElementFv -# MorphTag__16CEditIconElementFP13PA_Tag_struct -# ParseLocalData__16CEditIconElementFPPPcPPPc -# PrintEnd__16CEditIconElementFP11CPrintState -# PrintOpen__16CEditIconElementFP11CPrintState -# ReplaceParamValues__16CEditIconElementFPcPc -# ResetLayoutElement__16CEditIconElementFiP17LO_Element_struct -# SetData__16CEditIconElementFPc -# SetLayoutElement__16CEditIconElementFiiP17LO_Element_struct -# SetSize__16CEditIconElementFblbl -# SetSpoofData__16CEditIconElementFP13PA_Tag_struct -# SetSpoofData__16CEditIconElementFPc -# StreamOut__16CEditIconElementFP10IStreamOut -# TagOpen__16CEditIconElementFi -# ValidateTag__16CEditIconElementFPcb -# __ct__16CEditIconElementFP12CEditElementlP13PA_Tag_structs -# __ct__16CEditIconElementFP9IStreamInP11CEditBuffer -# __dt__16CEditIconElementFv -#{data} -# __vt__16CEditIconElement - -### class CEditImageElement -#{code} -# FinishedLoad__17CEditImageElementFP11CEditBuffer -# FormatParams__17CEditImageElementFP14_EDT_ImageDatab -# GetCharacterData__17CEditImageElementFv -# GetDefaultBorder__17CEditImageElementFv -# GetElementType__17CEditImageElementFv -# GetHREF__17CEditImageElementFv -# GetImageData__17CEditImageElementFv -# GetLOElementAndOffset__17CEditImageElementFlbRP17LO_Element_structRi -# GetLayoutElement__17CEditImageElementFv -# IsImage__17CEditImageElementFv -# MaskData__17CEditImageElementFRP18_EDT_CharacterData -# ParseParams__17CEditImageElementFP13PA_Tag_structs -# PrintOpen__17CEditImageElementFP11CPrintState -# ResetLayoutElement__17CEditImageElementFiP17LO_Element_struct -# SetHREF__17CEditImageElementFP7ED_Link -# SetImageData__17CEditImageElementFP14_EDT_ImageData -# SetLayoutElement__17CEditImageElementFiiP17LO_Element_struct -# SizeIsKnown__17CEditImageElementFv -# StreamOut__17CEditImageElementFP10IStreamOut -# TagOpen__17CEditImageElementFi -# __ct__17CEditImageElementFP12CEditElementP13PA_Tag_structsP7ED_Link -# __ct__17CEditImageElementFP9IStreamInP11CEditBuffer -# __dt__17CEditImageElementFv -#{data} -# __vt__17CEditImageElement - -### class CEditImageLoader -#{code} -# LoadImage__16CEditImageLoaderFv -# SetImageInfo__16CEditImageLoaderFlll -# __ct__16CEditImageLoaderFP11CEditBufferP14_EDT_ImageDatab -# __dt__16CEditImageLoaderFv - -### class CEditInsertPoint -#{code} -# Compare__16CEditInsertPointFRC16CEditInsertPoint -# FindNonEmptyElement__16CEditInsertPointFP12CEditElement -# GapWithBothSidesAllowed__16CEditInsertPointFv -# IsDenormalizedVersionOf__16CEditInsertPointFRC16CEditInsertPoint -# IsEndOfContainer__16CEditInsertPointFv -# IsEndOfDocument__16CEditInsertPointFv -# IsEndOfElement__16CEditInsertPointFv -# IsHardLineBreak__16CEditInsertPointFv -# IsLineBreak__16CEditInsertPointFv -# IsSoftLineBreak__16CEditInsertPointFv -# IsSpaceBeforeOrAfter__16CEditInsertPointFv -# IsSpace__16CEditInsertPointFv -# IsStartOfContainer__16CEditInsertPointFv -# IsStartOfDocument__16CEditInsertPointFv -# IsStartOfElement__16CEditInsertPointFv -# NextPosition__16CEditInsertPointFv -# PreviousPosition__16CEditInsertPointFv -# __ct__16CEditInsertPointFP12CEditElementl -# __ct__16CEditInsertPointFP12CEditElementlb -# __ct__16CEditInsertPointFP16CEditLeafElementl -# __ct__16CEditInsertPointFv -# __eq__16CEditInsertPointFRC16CEditInsertPoint -# __ge__16CEditInsertPointFRC16CEditInsertPoint -# __gt__16CEditInsertPointFRC16CEditInsertPoint -# __le__16CEditInsertPointFRC16CEditInsertPoint -# __lt__16CEditInsertPointFRC16CEditInsertPoint -# __ne__16CEditInsertPointFRC16CEditInsertPoint - -### class CEditInternalAnchorElement -#{code} -# GetElementType__26CEditInternalAnchorElementFv -# GetLOElementAndOffset__26CEditInternalAnchorElementFlbRP17LO_Element_structRi -# GetLayoutElement__26CEditInternalAnchorElementFv -# PrintEnd__26CEditInternalAnchorElementFP11CPrintState -# PrintOpen__26CEditInternalAnchorElementFP11CPrintState -# Reduce__26CEditInternalAnchorElementFP11CEditBuffer -# ResetLayoutElement__26CEditInternalAnchorElementFiP17LO_Element_struct -# SetLayoutElement__26CEditInternalAnchorElementFiiP17LO_Element_struct -# ShouldStreamSelf__26CEditInternalAnchorElementFR14CEditSelectionR14CEditSelection -# StreamOut__26CEditInternalAnchorElementFP10IStreamOut -# __ct__26CEditInternalAnchorElementFP12CEditElement -# __dt__26CEditInternalAnchorElementFv -#{data} -# __vt__26CEditInternalAnchorElement - -### class CEditLayerElement -#{code} -# FinishedLoad__17CEditLayerElementFP11CEditBuffer -# FreeData__17CEditLayerElementFP14_EDT_LayerData -# GetData__17CEditLayerElementFv -# GetElementType__17CEditLayerElementFv -# IsAcceptableChild__17CEditLayerElementFR12CEditElement -# IsLayer__17CEditLayerElementFv -# NewData__17CEditLayerElementFv -# ParseParams__17CEditLayerElementFP13PA_Tag_structs -# PrintEnd__17CEditLayerElementFP11CPrintState -# PrintOpen__17CEditLayerElementFP11CPrintState -# SetData__17CEditLayerElementFP14_EDT_LayerData -# __ct__17CEditLayerElementFP12CEditElementP13PA_Tag_structs -# __ct__17CEditLayerElementFP9IStreamInP11CEditBuffer -# __ct__17CEditLayerElementFv -# __dt__17CEditLayerElementFv -#{data} -# __vt__17CEditLayerElement - -### class CEditLeafElement -#{code} -# CopyEmptyText__16CEditLeafElementFP12CEditElement -# DeleteChar__16CEditLeafElementFP10MWContext_i -# DisconnectLayoutElements__16CEditLeafElementFP17LO_Element_struct -# Divide__16CEditLeafElementFi -# GetAll__16CEditLeafElementFR14CEditSelection -# GetHREF__16CEditLeafElementFv -# GetLen__16CEditLeafElementFv -# GetPersistentCount__16CEditLeafElementFv -# GetPersistentInsertPoint__16CEditLeafElementFl -# IsAcceptableChild__16CEditLeafElementFR12CEditElement -# IsComment__16CEditLeafElementFPc -# IsComment__16CEditLeafElementFv -# IsContainerContainer__16CEditLeafElementFv -# IsFirstInContainer__16CEditLeafElementFv -# IsLeaf__16CEditLeafElementFv -# IsMisspelled__16CEditLeafElementFv -# IsUnknownHTML__16CEditLeafElementFv -# NextPosition__16CEditLeafElementFlRP16CEditLeafElementRl -# PrevPosition__16CEditLeafElementFlRP16CEditLeafElementRl -# ResetLayoutElementHelper__16CEditLeafElementFPP17LO_Element_structiP17LO_Element_struct -# SetHREF__16CEditLeafElementFP7ED_Link -# SetLayoutElementHelper__16CEditLeafElementFiPP17LO_Element_structiiP17LO_Element_struct -# StreamToPositionalText__16CEditLeafElementFP10IStreamOutb -# TagOpen__16CEditLeafElementFi -# __dt__16CEditLeafElementFv -#{data} -# __vt__16CEditLeafElement - -### class CEditLinkManager -#{code} -# AddHREFUnique__16CEditLinkManagerFP23TXP_GrowableArray_pCharPc -# Add__16CEditLinkManagerFPcPc -# AdjustAllLinks__16CEditLinkManagerFPcPcP23TXP_GrowableArray_pChar -# AdjustLink__16CEditLinkManagerFPPcPcPcP23TXP_GrowableArray_pChar -# Free__16CEditLinkManagerFP7ED_Link -# MakeLink__16CEditLinkManagerFPcPci -# __ct__16CEditLinkManagerFv -# __dt__16CEditLinkManagerFv - -### class CEditListElement -#{code} -# Clone__16CEditListElementFP12CEditElement -# CopyData__16CEditListElementFP16CEditListElement -# FreeData__16CEditListElementFP13_EDT_ListData -# GetData__16CEditListElementFv -# GetElementType__16CEditListElementFv -# IsCompatableList__16CEditListElementFP12CEditElement -# IsList__16CEditListElementFv -# IsMailQuote__16CEditListElementFv -# NewData__16CEditListElementFv -# ParseParams__16CEditListElementFP13PA_Tag_structs -# SetData__16CEditListElementFP13_EDT_ListData -# TagOpen__16CEditListElementFi -# __ct__16CEditListElementFP12CEditElementP13PA_Tag_structs -# __ct__16CEditListElementFP9IStreamInP11CEditBuffer -# __dt__16CEditListElementFv -#{data} -# __vt__16CEditListElement - -### class CEditMIMEWindow -#{code} -# BuildFileTypeMenu__15CEditMIMEWindowFv -# BuildPluginList__15CEditMIMEWindowFv -# BuildPluginMenu__15CEditMIMEWindowFv -# DeletePluginList__15CEditMIMEWindowFv -# FinishCreateSelf__15CEditMIMEWindowFv -# ListenToMessage__15CEditMIMEWindowFlPv -# SetCellInfo__15CEditMIMEWindowFRQ213CMIMEListPane12PrefCellInfo -# SyncAllControls__15CEditMIMEWindowFv -# SyncApplicationControls__15CEditMIMEWindowFUc -# SyncInternalControl__15CEditMIMEWindowFv -# SyncPluginControls__15CEditMIMEWindowFUc -# SyncRadioControlValues__15CEditMIMEWindowFv -# SyncTextControls__15CEditMIMEWindowFv -# __ct__15CEditMIMEWindowFP7LStream -# __dt__15CEditMIMEWindowFv -#{data} -# __vt__15CEditMIMEWindow - -### class CEditPositionComparable -#{code} -# CalcPosition__23CEditPositionComparableFP23TXP_GrowableArray_int32P13CEditPosition -# Compare__23CEditPositionComparableFP13CEditPosition -# __dt__23CEditPositionComparableFv - -### class CEditRootDocElement -#{code} -# FinishedLoad__19CEditRootDocElementFP11CEditBuffer -# IsRoot__19CEditRootDocElementFv -# PrintEnd__19CEditRootDocElementFP11CPrintState -# PrintOpen__19CEditRootDocElementFP11CPrintState -# Reduce__19CEditRootDocElementFP11CEditBuffer -# ShouldStreamSelf__19CEditRootDocElementFR14CEditSelectionR14CEditSelection -# __dt__19CEditRootDocElementFv -#{data} -# __vt__19CEditRootDocElement - -### class CEditSaveData -#{code} -# __dt__13CEditSaveDataFv - -### class CEditSaveObject -#{code} -# AddAllFiles__15CEditSaveObjectFPPc -# CheckAddFile__15CEditSaveObjectFPcPcPPcb -# FileFetchComplete__15CEditSaveObjectFv -# FixupLink__15CEditSaveObjectFiPPcPcP23TXP_GrowableArray_pChar -# FixupLinks__15CEditSaveObjectFv -# FreeList__15CEditSaveObjectFPPc -# SaveFirstFile__15CEditSaveObjectFv -# URLInList__15CEditSaveObjectFPPcPc -# __ct__15CEditSaveObjectFP11CEditBuffer21ED_SaveFinishedOptionPcP15ITapeFileSystembbbbP19CEditSaveToTempData -# __dt__15CEditSaveObjectFv -#{data} -# __vt__15CEditSaveObject -# m_pFailedPublishUrl__15CEditSaveObject - -### class CEditSelection -#{code} -# AnyLeavesSelected__14CEditSelectionFv -# ClipTo__14CEditSelectionFR14CEditSelection -# ContainsEdge__14CEditSelectionFR14CEditSelectionb -# ContainsEnd__14CEditSelectionFR14CEditSelection -# ContainsLastDocumentContainerEnd__14CEditSelectionFv -# ContainsStart__14CEditSelectionFR14CEditSelection -# Contains__14CEditSelectionFR14CEditSelection -# Contains__14CEditSelectionFR16CEditInsertPoint -# CrossesOver__14CEditSelectionFR14CEditSelection -# CrossesSubDocBoundary__14CEditSelectionFv -# EndsAtStartOfContainer__14CEditSelectionFv -# EqualRange__14CEditSelectionFR14CEditSelection -# ExcludeLastDocumentContainerEnd__14CEditSelectionFv -# ExpandToBeCutable__14CEditSelectionFv -# ExpandToEncloseWholeContainers__14CEditSelectionFv -# ExpandToIncludeFragileSpaces__14CEditSelectionFv -# ExpandToNotCrossStructures__14CEditSelectionFv -# GetActiveEdge__14CEditSelectionFv -# GetAnchorEdge__14CEditSelectionFv -# GetClosedEndContainer__14CEditSelectionFv -# GetCommonAncestor__14CEditSelectionFv -# GetEdge__14CEditSelectionFb -# GetEffectiveSubDoc__14CEditSelectionFb -# GetStartContainer__14CEditSelectionFv -# Intersects__14CEditSelectionFR14CEditSelection -# IsContainerEnd__14CEditSelectionFv -# IsInsertPoint__14CEditSelectionFv -# StartsAtEndOfContainer__14CEditSelectionFv -# __ct__14CEditSelectionFP12CEditElementiP12CEditElementib -# __ct__14CEditSelectionFRC16CEditInsertPointRC16CEditInsertPointb -# __ct__14CEditSelectionFv -# __eq__14CEditSelectionFRC14CEditSelection -# __ne__14CEditSelectionFRC14CEditSelection - -### class CEditSubDocElement -#{code} -# FinishedLoad__18CEditSubDocElementFP11CEditBuffer -# IsAcceptableChild__18CEditSubDocElementFR12CEditElement -# IsSubDoc__18CEditSubDocElementFv -# Reduce__18CEditSubDocElementFP11CEditBuffer -# __ct__18CEditSubDocElementFP12CEditElementP13PA_Tag_structs -# __ct__18CEditSubDocElementFP12CEditElementiPc -# __ct__18CEditSubDocElementFP9IStreamInP11CEditBuffer -# __dt__18CEditSubDocElementFv -#{data} -# __vt__18CEditSubDocElement - -### class CEditTabSwitcher -#{code} -# DoPostLoad__16CEditTabSwitcherFP5LViewUc -# Help__16CEditTabSwitcherFv -# SetData__16CEditTabSwitcherFP10MWContext_Uc -# __ct__16CEditTabSwitcherFP7LStream -# __dt__16CEditTabSwitcherFv -#{data} -# __vt__16CEditTabSwitcher - -### class CEditTableCellElement -#{code} -# AllCellsInColumnAreSelected__21CEditTableCellElementFv -# AllCellsInRowAreSelected__21CEditTableCellElementFv -# CalcPercentHeight__21CEditTableCellElementFP18_EDT_TableCellData -# CalcPercentWidth__21CEditTableCellElementFP18_EDT_TableCellData -# CalcPixelHeight__21CEditTableCellElementFP18_EDT_TableCellData -# CalcPixelWidth__21CEditTableCellElementFP18_EDT_TableCellData -# DecreaseColSpan__21CEditTableCellElementFl -# DecreaseRowSpan__21CEditTableCellElementFl -# DeleteContents__21CEditTableCellElementFb -# FreeData__21CEditTableCellElementFP18_EDT_TableCellData -# GetBackgroundColor__21CEditTableCellElementFv -# GetBackgroundImage__21CEditTableCellElementFv -# GetData__21CEditTableCellElementFs -# GetDefaultAlignment__21CEditTableCellElementFv -# GetElementType__21CEditTableCellElementFv -# GetFirstCellInColumn__21CEditTableCellElementFlb -# GetFirstCellInRow__21CEditTableCellElementFlb -# GetFullHeight__21CEditTableCellElementFP17CEditTableElement -# GetFullWidth__21CEditTableCellElementFP17CEditTableElement -# GetLoCell__21CEditTableCellElementFv -# GetNextCellInColumn__21CEditTableCellElementFP21CEditTableCellElement -# GetNextCellInLogicalRow__21CEditTableCellElementFv -# GetNextCellInRow__21CEditTableCellElementFP21CEditTableCellElement -# GetNextCellInTable__21CEditTableCellElementFPi -# GetParentHeight__21CEditTableCellElementFv -# GetParentWidth__21CEditTableCellElementFv -# GetPreviousCellInTable__21CEditTableCellElementFPi -# GetText__21CEditTableCellElementFb -# IncreaseColSpan__21CEditTableCellElementFl -# IncreaseRowSpan__21CEditTableCellElementFl -# IsEmpty__21CEditTableCellElementFv -# IsSelected__21CEditTableCellElementFv -# IsTableCell__21CEditTableCellElementFv -# IsTableData__21CEditTableCellElementFv -# MaskData__21CEditTableCellElementFP18_EDT_TableCellData -# MergeCells__21CEditTableCellElementFP21CEditTableCellElement -# NewData__21CEditTableCellElementFv -# ParseParams__21CEditTableCellElementFP13PA_Tag_structs -# RestoreLinkage__21CEditTableCellElementFv -# RestoreSizeMode__21CEditTableCellElementFll -# SaveSizeMode__21CEditTableCellElementFbb -# SetBackgroundColor__21CEditTableCellElementF8ED_Color -# SetBackgroundImage__21CEditTableCellElementFPc -# SetColumnWidthLeft__21CEditTableCellElementFP17CEditTableElementP21CEditTableCellElementP18_EDT_TableCellData -# SetColumnWidthRight__21CEditTableCellElementFP17CEditTableElementP17LO_Element_structP18_EDT_TableCellData -# SetData__21CEditTableCellElementFP18_EDT_TableCellData -# SetHeight__21CEditTableCellElementFbbl -# SetRowHeightBottom__21CEditTableCellElementFP17CEditTableElementP17LO_Element_structP18_EDT_TableCellData -# SetRowHeightTop__21CEditTableCellElementFP17CEditTableElementP21CEditTableCellElementP18_EDT_TableCellData -# SetWidth__21CEditTableCellElementFbbl -# StreamOut__21CEditTableCellElementFP10IStreamOut -# SwitchLinkage__21CEditTableCellElementFP20CEditTableRowElement -# __ct__21CEditTableCellElementFP12CEditElementP13PA_Tag_structs -# __ct__21CEditTableCellElementFP9IStreamInP11CEditBuffer -# __ct__21CEditTableCellElementFb -# __ct__21CEditTableCellElementFv -# __dt__21CEditTableCellElementFv -#{data} -# __vt__21CEditTableCellElement - -### class CEditTableElement -#{code} -# AddLayoutData__17CEditTableElementFP21CEditTableCellElementP17LO_Element_struct -# AdjustCaption__17CEditTableElementFv -# CountColumns__17CEditTableElementFv -# CountRows__17CEditTableElementFv -# CreateTagData__17CEditTableElementFP14_EDT_TableDatab -# DeleteCaption__17CEditTableElementFv -# DeleteColumns__17CEditTableElementFliP17CEditTableElement -# DeleteLayoutData__17CEditTableElementFv -# DeleteRows__17CEditTableElementFli -# FindRow__17CEditTableElementFi -# FinishedLoad__17CEditTableElementFP11CEditBuffer -# FirstRowHasColSpan__17CEditTableElementFv -# FixupColumnsAndRows__17CEditTableElementFv -# FreeData__17CEditTableElementFP14_EDT_TableData -# GetBackgroundColor__17CEditTableElementFv -# GetBackgroundImage__17CEditTableElementFv -# GetCaption__17CEditTableElementFv -# GetColumnIndex__17CEditTableElementFl -# GetColumnX__17CEditTableElementFi -# GetColumnsSpanned__17CEditTableElementFll -# GetData__17CEditTableElementFv -# GetElementType__17CEditTableElementFv -# GetFirstCellAtColumnIndex__17CEditTableElementFi -# GetFirstCellAtRowIndex__17CEditTableElementFi -# GetFirstCellInColumn__17CEditTableElementFP21CEditTableCellElementb -# GetFirstCellInColumn__17CEditTableElementFlb -# GetFirstCellInNextColumn__17CEditTableElementFl -# GetFirstCellInNextRow__17CEditTableElementFl -# GetFirstCellInRow__17CEditTableElementFP21CEditTableCellElementb -# GetFirstCellInRow__17CEditTableElementFlb -# GetFirstCell__17CEditTableElementFv -# GetFirstRow__17CEditTableElementFv -# GetLastCellInColumn__17CEditTableElementFP21CEditTableCellElement -# GetLastCellInRow__17CEditTableElementFP21CEditTableCellElement -# GetLoTable__17CEditTableElementFv -# GetNextCellInColumn__17CEditTableElementFP21CEditTableCellElement -# GetNextCellInRow__17CEditTableElementFP21CEditTableCellElement -# GetNextCellInTable__17CEditTableElementFPi -# GetParentSize__17CEditTableElementFP10MWContext_PlPlP21LO_TableStruct_struct -# GetPreviousCellInColumn__17CEditTableElementFP21CEditTableCellElement -# GetPreviousCellInRow__17CEditTableElementFP21CEditTableCellElement -# GetRowIndex__17CEditTableElementFl -# GetRowY__17CEditTableElementFi -# GetRow__17CEditTableElementFlPi -# InsertColumns__17CEditTableElementFlliP17CEditTableElement -# InsertRows__17CEditTableElementFlliP17CEditTableElement -# InternalTagOpen__17CEditTableElementFib -# IsAcceptableChild__17CEditTableElementFR12CEditElement -# IsTable__17CEditTableElementFv -# NewData__17CEditTableElementFv -# ParseParams__17CEditTableElementFP13PA_Tag_structs -# PrintEnd__17CEditTableElementFP11CPrintState -# PrintOpen__17CEditTableElementFP11CPrintState -# RestoreSizeMode__17CEditTableElementFP10MWContext_ -# SetBackgroundColor__17CEditTableElementF8ED_Color -# SetBackgroundImage__17CEditTableElementFPc -# SetCaption__17CEditTableElementFP19CEditCaptionElement -# SetData__17CEditTableElementFP14_EDT_TableData -# SetSizeMode__17CEditTableElementFP10MWContext_i -# StreamOut__17CEditTableElementFP10IStreamOut -# TagEnd__17CEditTableElementFv -# TagOpen__17CEditTableElementFi -# __ct__17CEditTableElementFP12CEditElementP13PA_Tag_structs12ED_Alignment -# __ct__17CEditTableElementFP9IStreamInP11CEditBuffer -# __ct__17CEditTableElementFii -# __dt__17CEditTableElementFv -#{data} -# __vt__17CEditTableElement - -### class CEditTableRowElement -#{code} -# AppendRow__20CEditTableRowElementFP20CEditTableRowElementb -# DeleteCells__20CEditTableRowElementFliP20CEditTableRowElement -# FindCell__20CEditTableRowElementFlb -# FinishedLoad__20CEditTableRowElementFP11CEditBuffer -# FreeData__20CEditTableRowElementFP17_EDT_TableRowData -# GetBackgroundColor__20CEditTableRowElementFv -# GetBackgroundImage__20CEditTableRowElementFv -# GetCells__20CEditTableRowElementFv -# GetData__20CEditTableRowElementFv -# GetElementType__20CEditTableRowElementFv -# GetFirstCell__20CEditTableRowElementFv -# GetNextRow__20CEditTableRowElementFv -# InsertCells__20CEditTableRowElementFlliP20CEditTableRowElement -# IsAcceptableChild__20CEditTableRowElementFR12CEditElement -# IsTableRow__20CEditTableRowElementFv -# NewData__20CEditTableRowElementFv -# PadRowWithEmptyCells__20CEditTableRowElementFi -# ParseParams__20CEditTableRowElementFP13PA_Tag_structs -# SetBackgroundColor__20CEditTableRowElementF8ED_Color -# SetBackgroundImage__20CEditTableRowElementFPc -# SetData__20CEditTableRowElementFP17_EDT_TableRowData -# __ct__20CEditTableRowElementFP12CEditElementP13PA_Tag_structs -# __ct__20CEditTableRowElementFP9IStreamInP11CEditBuffer -# __ct__20CEditTableRowElementFi -# __ct__20CEditTableRowElementFv -# __dt__20CEditTableRowElementFv -#{data} -# __vt__20CEditTableRowElement - -### class CEditTagCursor -#{code} -# AtBreak__14CEditTagCursorFPb -# Clone__14CEditTagCursorFv -# CurrentLine__14CEditTagCursorFv -# GetNextTagState__14CEditTagCursorFv -# GetNextTag__14CEditTagCursorFv -# __ct__14CEditTagCursorFP11CEditBufferP12CEditElementiP12CEditElement -# __dt__14CEditTagCursorFv - -### class CEditTargetElement -#{code} -# FreeTargetData__18CEditTargetElementFP15_EDT_TargetData -# GetData__18CEditTargetElementFs -# GetData__18CEditTargetElementFv -# GetElementType__18CEditTargetElementFv -# GetName__18CEditTargetElementFv -# NewTargetData__18CEditTargetElementFv -# ParseParams__18CEditTargetElementFP13PA_Tag_structs -# SetData__18CEditTargetElementFP15_EDT_TargetData -# SetName__18CEditTargetElementFPcs -# StreamOut__18CEditTargetElementFP10IStreamOut -# TagOpen__18CEditTargetElementFi -# __ct__18CEditTargetElementFP12CEditElementP13PA_Tag_structs -# __ct__18CEditTargetElementFP9IStreamInP11CEditBuffer -# __dt__18CEditTargetElementFv -#{data} -# __vt__18CEditTargetElement - -### class CEditText -#{code} -# Clear__9CEditTextFv -# GetChars__9CEditTextFv -# GetPChars__9CEditTextFv -# GetPLength__9CEditTextFv -# Length__9CEditTextFv -# __ct__9CEditTextFv -# __dt__9CEditTextFv - -### class CEditTextElement -#{code} -# CanReflow__16CEditTextElementFv -# ClearFormatting__16CEditTextElementFv -# ComputeDifference__16CEditTextElementFP16CEditTextElementlRlRl -# CopyEmptyText__16CEditTextElementFP12CEditElement -# DebugFormat__16CEditTextElementFv -# DeleteChar__16CEditTextElementFP10MWContext_i -# DeleteText__16CEditTextElementFv -# FormatCloseTags__16CEditTextElementFRP13PA_Tag_structRP13PA_Tag_struct -# FormatOpenTags__16CEditTextElementFRP13PA_Tag_structRP13PA_Tag_struct -# FormatTransitionTags__16CEditTextElementFP16CEditTextElementRP13PA_Tag_structRP13PA_Tag_struct -# GetData__16CEditTextElementFv -# GetElementType__16CEditTextElementFv -# GetFontFace__16CEditTextElementFv -# GetFontPointSize__16CEditTextElementFv -# GetFontSize__16CEditTextElementFv -# GetFontWeight__16CEditTextElementFv -# GetHREF__16CEditTextElementFv -# GetLOElementAndOffset__16CEditTextElementFlbRP17LO_Element_structRi -# GetLOTextAndOffset__16CEditTextElementFlbRP20LO_TextStruct_structRi -# GetLOText__16CEditTextElementFi -# GetLayoutElement__16CEditTextElementFv -# GetLen__16CEditTextElementFv -# GetScriptExtra__16CEditTextElementFv -# GetTextBlock__16CEditTextElementFv -# GetTextWithConvertedSpaces__16CEditTextElementFv -# InsertChar__16CEditTextElementFii -# InsertChars__16CEditTextElementFiPc -# IsText__16CEditTextElementFv -# MaskData__16CEditTextElementFRP18_EDT_CharacterData -# PartialStreamOut__16CEditTextElementFP10IStreamOutR14CEditSelection -# PrintFormatClose__16CEditTextElementFP11CPrintState -# PrintFormatDifference__16CEditTextElementFP11CPrintStatel -# PrintFormat__16CEditTextElementFP11CPrintStateP16CEditTextElementl -# PrintLiteral__16CEditTextElementFP11CPrintState -# PrintOpen2__16CEditTextElementFP11CPrintStateb -# PrintOpen__16CEditTextElementFP11CPrintState -# PrintPopFormat__16CEditTextElementFP11CPrintStatei -# PrintRange__16CEditTextElementFP11CPrintStatell -# PrintTagClose__16CEditTextElementFP11CPrintStateSc -# PrintTagOpen__16CEditTextElementFP11CPrintStateSclPc -# PrintWithEscapes__16CEditTextElementFP11CPrintStateb -# Reduce__16CEditTextElementFP11CEditBuffer -# ResetLayoutElement__16CEditTextElementFiP17LO_Element_struct -# SameAttributes__16CEditTextElementFP16CEditTextElement -# SetColor__16CEditTextElementF8ED_Color -# SetData__16CEditTextElementFP18_EDT_CharacterData -# SetFontFace__16CEditTextElementFPc -# SetFontPointSize__16CEditTextElementFs -# SetFontSize__16CEditTextElementFib -# SetFontWeight__16CEditTextElementFs -# SetHREF__16CEditTextElementFP7ED_Link -# SetLayoutElement__16CEditTextElementFiiP17LO_Element_struct -# SetScriptExtra__16CEditTextElementFPc -# SetText__16CEditTextElementFPcbs -# SplitText__16CEditTextElementFi -# StreamOut__16CEditTextElementFP10IStreamOut -# StreamToPositionalText__16CEditTextElementFP10IStreamOutb -# TagOpen__16CEditTextElementFi -# __ct__16CEditTextElementFP12CEditElementPc -# __ct__16CEditTextElementFP9IStreamInP11CEditBuffer -# __dt__16CEditTextElementFv -#{data} -# __vt__16CEditTextElement - -### class CEditTimer -#{code} -# Callback__10CEditTimerFv -# Cancel__10CEditTimerFv -# OnCallback__10CEditTimerFv -# SetTimeout__10CEditTimerFUl -# __ct__10CEditTimerFv -# __dt__10CEditTimerFv -#{data} -# __vt__10CEditTimer - -### class CEditView -#{code} -# ActivateSelf__9CEditViewFv -# AdaptToSuperFrameSize__9CEditViewFllUc -# AdjustCursorSelf__9CEditViewF5PointRC11EventRecord -# BeTarget__9CEditViewFv -# CanUseCharFormatting__9CEditViewFv -# ClickSelf__9CEditViewFRC15SMouseDownEvent -# ClickTrackSelection__9CEditViewFRC15SMouseDownEventR16CHTMLClickRecord -# CreateFindWindow__9CEditViewFv -# DeactivateSelf__9CEditViewFv -# DisplayAddRowOrColBorder__9CEditViewFP8_XP_Rectb -# DisplayCell__9CEditViewFiP20LO_CellStruct_struct -# DisplayFeedback__9CEditViewFiP17LO_Element_struct -# DisplayGenericCaret__9CEditViewFP10MWContext_P17LO_Element_struct22ED_CaretObjectPosition -# DisplayHR__9CEditViewFiP25LO_HorizRuleStruct_struct -# DisplayLineFeed__9CEditViewFiP24LO_LinefeedStruct_structb -# DisplaySelectionFeedback__9CEditViewFUsRC4Rect -# DisplaySubtext__9CEditViewFiP20LO_TextStruct_structllb -# DisplayTable__9CEditViewFiP21LO_TableStruct_struct -# DoDragSendData__9CEditViewFUlUlP19OpaqueDragReference -# DoReload__9CEditViewFv -# DocumentChanged__9CEditViewFll -# DontBeTarget__9CEditViewFv -# DrawCaret__9CEditViewFUc -# DrawSelf__9CEditViewFv -# EnterDropArea__9CEditViewFP19OpaqueDragReferenceUc -# EraseBackground__9CEditViewFillUlUlP15LO_Color_struct -# EraseCaret__9CEditViewFv -# FindCommandStatusForContextMenu__9CEditViewFlRUcRUcRUsPUc -# FindCommandStatus__9CEditViewFlRUcRUcRUsPUc -# FindQueuedKeys__9CEditViewFPc -# FinishCreateSelf__9CEditViewFv -# GetDefaultBackgroundColor__9CEditViewCFP15LO_Color_struct -# GetDocAndWindowPosition__9CEditViewFR8SPoint32R8SPoint32R12SDimension16 -# GetURLForPrinting__9CEditViewFRUcP10MWContext_ -# HandleCopy__9CEditViewFv -# HandleCut__9CEditViewFv -# HandleDropOfComposerFlavor__9CEditViewFPCcbR8SPoint32 -# HandleDropOfHTResource__9CEditViewFP18_HT_ResourceStruct -# HandleDropOfLocalFile__9CEditViewFPCcPCcRC9HFSFlavor -# HandleDropOfPageProxy__9CEditViewFPCcPCc -# HandleDropOfText__9CEditViewFPCc -# HandleKeyPress__9CEditViewFRC11EventRecord -# HandlePaste__9CEditViewFv -# InsertDefaultLine__9CEditViewFv -# InsideDropArea__9CEditViewFP19OpaqueDragReference -# InvalidateEntireTableOrCell__9CEditViewFP17LO_Element_struct -# IsGrowCachingEnabled__9CEditViewCFv -# IsMouseInSelection__9CEditViewF8SPoint32P8CL_LayerR4Rect -# IsPastable__9CEditViewFUs -# ItemIsAcceptable__9CEditViewFP19OpaqueDragReferenceUl -# LayoutNewDocument__9CEditViewFP11URL_Struct_PlPlPlPl -# ListenToMessage__9CEditViewFlPv -# NoteEditorRepagination__9CEditViewFv -# ObeyCommand__9CEditViewFlPv -# PlaceCaret__9CEditViewFlll -# PtInSelectedRegion__9CEditViewF8SPoint32 -# PutOnDuty__9CEditViewFP10LCommander -# ReceiveDragItem__9CEditViewFP19OpaqueDragReferenceUlUlR4Rect -# RemoveCaret__9CEditViewFv -# SaveDocumentAs__9CEditViewFv -# SaveDocument__9CEditViewFv -# SetContext__9CEditViewFP15CBrowserContext -# SetDefaultCSID__9CEditViewFs -# SetDocPosition__9CEditViewFillUc -# SpendTime__9CEditViewFRC11EventRecord -# TakeOffDuty__9CEditViewFv -# ToFromList__9CEditViewFi11ED_ListType -# UpdateEnableStates__9CEditViewFv -# VerifySaveUpToDate__9CEditViewFv -# __ct__9CEditViewFP7LStream -# __dt__9CEditViewFv -# __dt__Q29CEditView24StUseCharFormattingCacheFv -#{data} -# __vt__9CEditView - -### class CEditorMainMediator -#{code} -# ListenToMessage__19CEditorMainMediatorFlPv -# LoadMainPane__19CEditorMainMediatorFv -# RestoreDefaultURL__19CEditorMainMediatorFv -# SaveIntervalValidationFunc__19CEditorMainMediatorFP15CValidEditField -# __ct__19CEditorMainMediatorFP7LStream -# __dt__19CEditorMainMediatorFv -#{data} -# __vt__19CEditorMainMediator - -### class CEditorPluginInterface -#{code} -# Composer__22CEditorPluginInterfaceFv -# DocumentIsTooLarge__22CEditorPluginInterfaceFli -# Env__22CEditorPluginInterfaceFv -# GetBaseURL__22CEditorPluginInterfaceFv -# GetBuffer__22CEditorPluginInterfaceFv -# GetCategoryName__22CEditorPluginInterfaceFl -# GetDocument__22CEditorPluginInterfaceFv -# GetEncoderFileExtension__22CEditorPluginInterfaceFl -# GetEncoderFileType__22CEditorPluginInterfaceFl -# GetEncoderHint__22CEditorPluginInterfaceFl -# GetEncoderName__22CEditorPluginInterfaceFl -# GetEncoderNeedsQuantizedSource__22CEditorPluginInterfaceFl -# GetNumberOfCategories__22CEditorPluginInterfaceFv -# GetNumberOfEncoders__22CEditorPluginInterfaceFv -# GetNumberOfPlugins__22CEditorPluginInterfaceFl -# GetPluginHint__22CEditorPluginInterfaceFll -# GetPluginName__22CEditorPluginInterfaceFll -# GetWorkDirectoryAndURL__22CEditorPluginInterfaceFRP16java_lang_StringRP16java_lang_String -# ImageEncoderFinished__22CEditorPluginInterfaceFUc -# IsPluginActive__22CEditorPluginInterfaceFv -# IsValidInterface__22CEditorPluginInterfaceFP22CEditorPluginInterface -# Manager__22CEditorPluginInterfaceFv -# NewText__22CEditorPluginInterfaceFP16java_lang_String -# Perform2__22CEditorPluginInterfaceFPcllbbPFUcPv_vPvP28netscape_javascript_JSObject -# Perform__22CEditorPluginInterfaceFPcPFUcPv_vPvP28netscape_javascript_JSObject -# Perform__22CEditorPluginInterfaceFPcPcbbPFUcPv_vPvP28netscape_javascript_JSObject -# Perform__22CEditorPluginInterfaceFllPFUcPv_vPvP28netscape_javascript_JSObject -# PluginCallback__22CEditorPluginInterfaceFlP16java_lang_Object -# PluginFailed__22CEditorPluginInterfaceFP16java_lang_String -# PluginSucceeded__22CEditorPluginInterfaceFv -# PluginsExist__22CEditorPluginInterfaceFv -# Register__22CEditorPluginInterfaceFPc -# StartEncoder__22CEditorPluginInterfaceFlllPPcPcPFUcPv_vPv -# StopPlugin__22CEditorPluginInterfaceFv -# __ct__22CEditorPluginInterfaceFP10MWContext_PFllP16java_lang_Object_v -# __dt__22CEditorPluginInterfaceFv -#{data} -# g_Interface__22CEditorPluginInterface -# g_Plugin__22CEditorPluginInterface -# g_bJavaInitialized__22CEditorPluginInterface -# g_pEnv__22CEditorPluginInterface -# g_pManager__22CEditorPluginInterface - -### class CEditorPrefContain -#{code} -# DrawSelf__18CEditorPrefContainFv -# FinishCreateSelf__18CEditorPrefContainFv -# ListenToMessage__18CEditorPrefContainFlPv -# __dt__18CEditorPrefContainFv -#{data} -# __vt__18CEditorPrefContain - -### class CEditorWindow -#{code} -# AttemptQuitSelf__13CEditorWindowFl -# CreateEditorWindowStage2__13CEditorWindowFP20EditorCreationStruct -# FindCommandStatus__13CEditorWindowFlRUcRUcRUsPUc -# FinishCreateSelf__13CEditorWindowFv -# GetStatusResID__13CEditorWindowCFv -# ListenToMessage__13CEditorWindowFlPv -# MakeEditWindowFromBrowser__13CEditorWindowFP10MWContext_ -# MakeEditWindow__13CEditorWindowFP10MWContext_P11URL_Struct_ -# NoteDocTitleChanged__13CEditorWindowFPCc -# ObeyCommand__13CEditorWindowFlPv -# RegisterViewTypes__13CEditorWindowFv -# SetPluginDoneClosing__13CEditorWindowFv -# SetWindowContext__13CEditorWindowFP15CBrowserContext -# __ct__13CEditorWindowFP7LStream -# __dt__13CEditorWindowFv -#{data} -# __vt__13CEditorWindow - -### class CEnvironment -#{code} -# SetAllFeatures__12CEnvironmentFv - -### class CExpandable -#{code} -# ReadStatus__11CExpandableFP7LStream -# RecallCurrentDimensions__11CExpandableFv -# RecallOtherDimensions__11CExpandableFv -# StoreCurrentDimensions__11CExpandableFv -# WriteStatus__11CExpandableFP7LStream -# __ct__11CExpandableFP14CExpansionDataP14CExpansionData -#{data} -# __vt__11CExpandable - -### class CExpandoDivider -#{code} -# AdjustCursorSelf__15CExpandoDividerF5PointRC11EventRecord -# ChangeDividerPosition__15CExpandoDividerFs -# ChangeTwistiePosition__15CExpandoDividerFs -# ClickSelf__15CExpandoDividerFRC15SMouseDownEvent -# FinishCreateSelf__15CExpandoDividerFv -# RecallDimensions__15CExpandoDividerFRC14CExpansionData -# ResizeFrameBy__15CExpandoDividerFssUc -# SetExpandState__15CExpandoDividerFUc -# SetStickToBottom__15CExpandoDividerFP5LPaneUc -# SetStickToBottom__15CExpandoDividerFUc -# StoreDimensions__15CExpandoDividerFR14CExpansionData -# __ct__15CExpandoDividerFP7LStream -# __dt__15CExpandoDividerFv -#{data} -# __vt__15CExpandoDivider - -### class CExpandoListener -#{code} -# ListenToMessage__16CExpandoListenerFlPv -# __dt__16CExpandoListenerFv -#{data} -# __vt__16CExpandoListener - -### class CExpansionData -#{data} -# __vt__14CExpansionData - -### class CFileBackup -#{code} -# BeginTransaction__11CFileBackupFPc -# Commit__11CFileBackupFv -# Reset__11CFileBackupFv -# Rollback__11CFileBackupFv - -### class CFileIter -#{code} -# Next__9CFileIterFR6FSSpecR5FInfoRUc -# __ct__9CFileIterFRC6FSSpec -# __dt__9CFileIterFv - -### class CFileMgr -#{code} -# CancelAndDelete__8CFileMgrFP17LFileBufferStream -# CancelRegister__8CFileMgrFP17LFileBufferStream -# CopyFSSpec__8CFileMgrFRC6FSSpecR6FSSpec -# CopyFile__8CFileMgrFRC6FSSpecRC6FSSpecRC7CStr255 -# CreateFolderInFolder__8CFileMgrFslRC7CStr255PsPl -# DeleteFolder__8CFileMgrFRC6FSSpec -# EncodeMacPath__8CFileMgrFPcUc -# EncodedPathNameFromFSSpec__8CFileMgrFRC6FSSpecUc -FSSpecFromLocalUnixPath__8CFileMgrFPCcP6FSSpecUc -# FSSpecFromPathname__8CFileMgrFPcP6FSSpec -# FileExists__8CFileMgrFRC6FSSpec -# FileHasDataFork__8CFileMgrFRC6FSSpec -# FileHasResourceFork__8CFileMgrFRC6FSSpec -# FileNameFromURL__8CFileMgrFPCc -FileSetComment__8CFileMgrFRC6FSSpecRC7CStr255 -# FindAppOnVolume__8CFileMgrFUlsR6FSSpec -# FindApplication__8CFileMgrFUlR6FSSpec -# FindWFolderInFolder__8CFileMgrFslRC7CStr255PsPl -FolderSpecFromFolderID__8CFileMgrFslR6FSSpec -# GetFolderID__8CFileMgrFR6FSSpecRl -# GetIndVolume__8CFileMgrFsRs -# GetSysVolume__8CFileMgrFRs -GetURLFromFileSpec__8CFileMgrFRC6FSSpec -# HandleFindURLEvent__8CFileMgrFRC6AEDescR6AEDescR6AEDescl -# IsFolder__8CFileMgrFRC6FSSpec -# MacPathFromUnixPath__8CFileMgrFPCc -# MakeAliasFile__8CFileMgrFRC6FSSpecRC6FSSpec -# NewFileSpecFromURLStruct__8CFileMgrFPCcRC6FSSpecR6FSSpec -PathNameFromFSSpec__8CFileMgrFRC6FSSpecUc -# RegisterFile__8CFileMgrFP17LFileBufferStream -# SetFileFinderFlag__8CFileMgrFRC6FSSpecUsUc -# SetFileTypeCreator__8CFileMgrFUlUlPC6FSSpec -UniqueFileSpec__8CFileMgrFRC6FSSpecRC6CStr31R6FSSpec -# UpdateFinderDisplay__8CFileMgrFRC6FSSpec -# VolHasDesktopDB__8CFileMgrFsRUc -# __dt__8CFileMgrFv -#{data} -# __vt__8CFileMgr -# sFileManager__8CFileMgr -# sMungeNum__8CFileMgr - -### class CFilePicker -#{code} -# DirectoryHook__11CFilePickerFsP8GrafPortPv -#{data} -# DirectoryHook_info__11CFilePicker -#{code} -# DoCustomGetFile__11CFilePickerFR17StandardFileReplyQ211CFilePicker8PickEnumUc -# DoCustomPutFile__11CFilePickerFR17StandardFileReplyRC7CStr255Uc -# FSSpecToPathName__11CFilePickerFRC6FSSpec -# FinishCreateSelf__11CFilePickerFv -# IsMailFileFilter__11CFilePickerFP10CInfoPBRecPv -#{data} -# IsMailFileFilter_info__11CFilePicker -#{code} -# ListenToMessage__11CFilePickerFlPv -# OnlyFoldersFileFilter__11CFilePickerFP10CInfoPBRecPv -#{data} -# OnlyFoldersFileFilter_info__11CFilePicker -#{code} -# SetButtonTitle__11CFilePickerFPPcR7CStr255RC4Rect -# SetCaptionForPath__11CFilePickerFP8LCaptionRC6FSSpec -# SetCurrDirHook__11CFilePickerFsP8GrafPortPv -#{data} -# SetCurrDirHook_info__11CFilePicker -#{code} -# SetFSSpec__11CFilePickerFRC6FSSpecUc -# __ct__11CFilePickerFP7LStream -# __dt__11CFilePickerFv -#{data} -# __vt__11CFilePicker -# sPrevName__11CFilePicker -# sResult__11CFilePicker -# sUseDefault__11CFilePicker - -### class CFileSaveObject -#{code} -# AddFile__15CFileSaveObjectFPcPcs -# Cancel__15CFileSaveObjectFv -# CheckFinishedSave__15CFileSaveObjectFi12ED_FileError -# CopyURLInfo__15CFileSaveObjectFPC11URL_Struct_ -# FetchNextFile__15CFileSaveObjectFv -# FileFetchComplete__15CFileSaveObjectFv -# GetDestAbsoluteURL__15CFileSaveObjectFi -# GetDestName__15CFileSaveObjectFi -# GetSrcName__15CFileSaveObjectFi -# NetFetchDone__15CFileSaveObjectFP11URL_Struct_iP10MWContext_ -# NetStreamWrite__15CFileSaveObjectFPCcl -# OpenOutputFile__15CFileSaveObjectFv -# SaveErrorContinueDialog__15CFileSaveObjectF12ED_FileError -# SaveFiles__15CFileSaveObjectFv -# SaveFirstFile__15CFileSaveObjectFv -# __ct__15CFileSaveObjectFP10MWContext_PcP15ITapeFileSystembP19CEditSaveToTempData -# __dt__15CFileSaveObjectFv -#{data} -# __vt__15CFileSaveObject - -### class CFileType -#{code} -# ClearDefaults__9CFileTypeFv -# InitializeDefaults__9CFileTypeFv -# __ct__9CFileTypeFUl -# __dt__9CFileTypeFv -#{data} -# sDefaultDocIcon__9CFileType - -### class CFindWindow -#{code} -# CanFindAgain__11CFindWindowFv -# DoFind__11CFindWindowFP9CHTMLView -# DoSetBounds__11CFindWindowFRC4Rect -# FindCommandStatus__11CFindWindowFlRUcRUcRUsPUc -# FinishCreateSelf__11CFindWindowFv -# GetDialogValues__11CFindWindowFv -# ListenToMessage__11CFindWindowFlPv -# RegisterViewTypes__11CFindWindowFv -# RestorePlace__11CFindWindowFP7LStream -# SavePlace__11CFindWindowFP7LStream -# SetDialogValues__11CFindWindowFv -# SetTextTraitsID__11CFindWindowFs -# __ct__11CFindWindowFP7LStream -# __dt__11CFindWindowFv -#{data} -# __vt__11CFindWindow -# sBackward__11CFindWindow -# sCaseless__11CFindWindow -# sFindWindow__11CFindWindow -# sLastSearch__11CFindWindow -# sViewBeingSearched__11CFindWindow -# sWrap__11CFindWindow - -### class CFinishLoadTimer -#{code} -# FinishedLoad__16CFinishLoadTimerFP11CEditBuffer -# OnCallback__16CFinishLoadTimerFv -# __ct__16CFinishLoadTimerFv -# __dt__16CFinishLoadTimerFv -#{data} -# __vt__16CFinishLoadTimer - -### class CFolderSpec -#{code} -# Exists__11CFolderSpecFv -# SetFolderSpec__11CFolderSpecF6FSSpeci -# __ct__11CFolderSpecFv - -### class CFontMenuAttachment -#{code} -# ExecuteSelf__19CFontMenuAttachmentFlPv -# GetMenu__19CFontMenuAttachmentFv -# GetTopWindowContext__19CFontMenuAttachmentFv -# InstallMenus__19CFontMenuAttachmentFv -# RemoveMenus__19CFontMenuAttachmentFv -# UpdateMenu__19CFontMenuAttachmentFv -# __ct__19CFontMenuAttachmentFv -# __dt__19CFontMenuAttachmentFv -#{data} -# __vt__19CFontMenuAttachment -# sMenu__19CFontMenuAttachment - -### class CFontMenuPopup -#{code} -# FinishCreateSelf__14CFontMenuPopupFv -# __ct__14CFontMenuPopupFP7LStream -# __dt__14CFontMenuPopupFv -#{data} -# __vt__14CFontMenuPopup - -### class CFontReference -#{code} -# GetFontReference__14CFontReferenceFPC8CCharSetP18LO_TextAttr_structP10MWContext_Uc -# GetScaledTextSize__14CFontReferenceFss -# __ct__14CFontReferenceFPC8CCharSetPC18LO_TextAttr_struct -# __dt__14CFontReferenceFv -#{data} -# __vt__14CFontReference - -### class CFormBigText -#{code} -# BeTarget__12CFormBigTextFv -# ClickSelf__12CFormBigTextFRC15SMouseDownEvent -# DontBeTarget__12CFormBigTextFv -# DrawSelf__12CFormBigTextFv -# FocusDraw__12CFormBigTextFP5LPane -# HandleKeyPress__12CFormBigTextFRC11EventRecord -# ObeyCommand__12CFormBigTextFlPv -# UserChangedText__12CFormBigTextFv -# __ct__12CFormBigTextFP7LStream -# __dt__12CFormBigTextFv -#{data} -# __vt__12CFormBigText - -### class CFormButton -#{code} -# BroadcastValueMessage__11CFormButtonFv -# ClickSelfLayer__11CFormButtonFRC15SMouseDownEvent -# DrawSelf__11CFormButtonFv -# DrawTitle__11CFormButtonFv -# EventMouseUp__11CFormButtonFRC11EventRecord -# HotSpotAction__11CFormButtonFsUcUc -# HotSpotResultCallback__11CFormButtonFs -# HotSpotResult__11CFormButtonFs -# SetDescriptor__11CFormButtonFPCUc -# TrackHotSpot__11CFormButtonFs5Points -# __ct__11CFormButtonFP7LStream -# __dt__11CFormButtonFv -#{data} -# __vt__11CFormButton - -### class CFormButtonHotSpotResultMochaCallback -#{code} -# Complete__37CFormButtonHotSpotResultMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__37CFormButtonHotSpotResultMochaCallbackFv -#{data} -# __vt__37CFormButtonHotSpotResultMochaCallback - -### class CFormCheckbox -#{code} -# ClickSelfLayer__13CFormCheckboxFRC15SMouseDownEvent -# DrawSelf__13CFormCheckboxFv -# EventMouseUp__13CFormCheckboxFRC11EventRecord -# HotSpotResultCallback__13CFormCheckboxFss -# HotSpotResult__13CFormCheckboxFs -# SetValue__13CFormCheckboxFl -# SetupClip__13CFormCheckboxFv -# TrackHotSpot__13CFormCheckboxFs5Points -# __ct__13CFormCheckboxFP7LStream -# __dt__13CFormCheckboxFv -#{data} -# __vt__13CFormCheckbox -# sCheckboxRgn__13CFormCheckbox - -### class CFormCheckboxHotSpotResultMochaCallback -#{code} -# Complete__39CFormCheckboxHotSpotResultMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__39CFormCheckboxHotSpotResultMochaCallbackFv -#{data} -# __vt__39CFormCheckboxHotSpotResultMochaCallback - -### class CFormFile -#{code} -# FinishCreateSelf__9CFormFileFv -# GetFileSpec__9CFormFileFR6FSSpec -# GetFontInfo__9CFormFileFRlRlRl -# ListenToMessage__9CFormFileFlPv -# SetFileSpec__9CFormFileFR6FSSpec -# SetVisibleChars__9CFormFileFs -# __ct__9CFormFileFP7LStream -# __dt__9CFormFileFv -#{data} -# __vt__9CFormFile - -### class CFormFileEditField -#{code} -# ClickSelf__18CFormFileEditFieldFRC15SMouseDownEvent -# DrawSelf__18CFormFileEditFieldFv -# FindCommandStatus__18CFormFileEditFieldFlRUcRUcRUsPUc -# HandleKeyPress__18CFormFileEditFieldFRC11EventRecord -# SpendTime__18CFormFileEditFieldFRC11EventRecord -# UserChangedText__18CFormFileEditFieldFv -# __ct__18CFormFileEditFieldFP7LStream -# __dt__18CFormFileEditFieldFv -#{data} -# __vt__18CFormFileEditField - -### class CFormList -#{code} -# ActivateSelf__9CFormListFv -# AddItem__9CFormListFRC7cstrings -# BeTarget__9CFormListFv -# CheckSelection__9CFormListFR6LArray -# ClickSelf__9CFormListFRC15SMouseDownEvent -# DeactivateSelf__9CFormListFv -# DontBeTarget__9CFormListFv -# DrawElementSelf__9CFormListFPC4RectPCvs -# DrawElement__9CFormListFsUcPC4RectPCvs -# DrawSelf__9CFormListFv -# FocusDraw__9CFormListFP5LPane -# HandleKeyPress__9CFormListFRC11EventRecord -# IsSelected__9CFormListFi -# MakeSelection__9CFormListFR6LArray -# SelectNone__9CFormListFv -# SetSelectMultiple__9CFormListFUc -# SetSelect__9CFormListFiUc -# SetTextTraits__9CFormListFv -# ShrinkToFit__9CFormListFl -# SyncRows__9CFormListFUs -# __ct__9CFormListFP7LStream -# __dt__9CFormListFv -#{data} -# __vt__9CFormList -# callerLDEFUPP__9CFormList - -### class CFormLittleText -#{code} -# BeTarget__15CFormLittleTextFv -# BroadcastValueMessage__15CFormLittleTextFv -# FindCommandStatus__15CFormLittleTextFlRUcRUcRUsPUc -# GetDescriptor__15CFormLittleTextCFPUc -# HandleKeyPress__15CFormLittleTextFRC11EventRecord -# SetDescriptor__15CFormLittleTextFPCUc -# SetVisibleChars__15CFormLittleTextFs -# __ct__15CFormLittleTextFP7LStream -# __dt__15CFormLittleTextFv -#{data} -# __vt__15CFormLittleText - -### class CFormRadio -#{code} -# ClickSelfLayer__10CFormRadioFRC15SMouseDownEvent -# DrawSelf__10CFormRadioFv -# EventMouseUp__10CFormRadioFRC11EventRecord -# HotSpotResultCallback__10CFormRadioFsP27LO_FormElementStruct_structsP10MWContext_ -# HotSpotResult__10CFormRadioFs -# SetValue__10CFormRadioFl -# SetupClip__10CFormRadioFv -# TrackHotSpot__10CFormRadioFs5Points -# __ct__10CFormRadioFP7LStream -# __dt__10CFormRadioFv -#{data} -# __vt__10CFormRadio -# sRadioRgn__10CFormRadio - -### class CFormRadioHotSpotResultMochaCallback -#{code} -# Complete__36CFormRadioHotSpotResultMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__36CFormRadioHotSpotResultMochaCallbackFv -#{data} -# __vt__36CFormRadioHotSpotResultMochaCallback - -### class CFormatMsgColorAndImageDlog -#{code} -# CommitChanges__27CFormatMsgColorAndImageDlogFUc -# Help__27CFormatMsgColorAndImageDlogFv -# InitializeDialogControls__27CFormatMsgColorAndImageDlogFv -# __dt__27CFormatMsgColorAndImageDlogFv -#{data} -# __vt__27CFormatMsgColorAndImageDlog - -### class CFormattingToolBar -#{code} -# FinishCreateSelf__18CFormattingToolBarFv -# ListenToMessage__18CFormattingToolBarFlPv -# __ct__18CFormattingToolBarFP7LStream -# __dt__18CFormattingToolBarFv -#{data} -# __vt__18CFormattingToolBar - -### class CFrontApp -#{code} -# AdjustCursor__9CFrontAppFRC11EventRecord -# AgreedToLicense__9CFrontAppFP6FSSpecs -# BuildConfigurableMenu__9CFrontAppFPP8MenuInfoPCcs -# ChooseDocument__9CFrontAppFv -# ClickMenuBar__9CFrontAppFRC11EventRecord -# CreateAccountSetupSpec__9CFrontAppFv -# CreateStartupEnvironment__9CFrontAppFUc -# DestroySplashScreen__9CFrontAppFv -# DispatchEvent__9CFrontAppFRC11EventRecord -# DoGetURL__9CFrontAppFRC7cstring -# DoHelpMenuItem__9CFrontAppFs -# DoOpenDirectoryURL__9CFrontAppFl -# DoOpenDoc__9CFrontAppFP6FSSpecs -# DoOpenLogoURL__9CFrontAppFl -# DoOpenURLDialogInEditor__9CFrontAppFv -# DoOpenURLDialog__9CFrontAppFv -# DoQuit__9CFrontAppFl -# DoWindowsMenu__9CFrontAppFl -# EventKeyDown__9CFrontAppFRC11EventRecord -# EventKeyUp__9CFrontAppFRC11EventRecord -# EventResume__9CFrontAppFRC11EventRecord -# EventSuspend__9CFrontAppFRC11EventRecord -# Find3270Applet__9CFrontAppFR6FSSpec -# FindCommandStatus__9CFrontAppFlRUcRUcRUsPUc -# GetAEProperty__9CFrontAppCFUlRC6AEDescR6AEDesc -GetApplication__9CFrontAppFv -# GetNetcasterContext__9CFrontAppFv -# HandleAppleEvent__9CFrontAppFRC6AEDescR6AEDescR6AEDescl -# InitBookmarks__9CFrontAppFv -# Initialize__9CFrontAppFv -# InstallMenus__9CFrontAppFv -# Launch3270Applet__9CFrontAppFv -# LaunchAccountSetup__9CFrontAppFv -# LaunchExternalApp__9CFrontAppFUls -# LaunchNetcaster__9CFrontAppFv -# ListenToMessage__9CFrontAppFlPv -# MakeNewDocument__9CFrontAppFv -# MemoryIsLow__9CFrontAppFv -# ObeyCommand__9CFrontAppFlPv -# OpenBookmarksFile__9CFrontAppFP6FSSpecP14CBrowserWindowUc -# OpenDocument__9CFrontAppFP6FSSpec -# OpenLocalURL__9CFrontAppFP6FSSpecP14CBrowserWindowPcUc -# PrintDocument__9CFrontAppFP6FSSpec -# ProcessCommandStatus__9CFrontAppFlRUcRUcRUsPUc -# ProcessNextEvent__9CFrontAppFv -# ProperStartup__9CFrontAppFP6FSSpecs -# RegisterMimeType__9CFrontAppFP11CMimeMapper -# SetAEProperty__9CFrontAppFUlRC6AEDescR6AEDesc -# SetBooleanWithPref__9CFrontAppFPCcPv -# SetMenubar__9CFrontAppFsUc -# SetNetcasterContext__9CFrontAppFP10MWContext_ -# SetupPage__9CFrontAppFv -# ShowAboutBox__9CFrontAppFv -# ShowSplashScreen__9CFrontAppFv -# SplashProgress__9CFrontAppF7CStr255 -# StartUp__9CFrontAppFv -# UpdateHierarchicalMenus__9CFrontAppFv -# UpdateMenusSelf__9CFrontAppFv -# UpdateMenus__9CFrontAppFv -# __ct__9CFrontAppFv -# __dt__9CFrontAppFv -#{data} -# __vt__9CFrontApp -# sApplication__9CFrontApp -# sCommandsToUpdateBeforeSelectingMenu__9CFrontApp -# sHRes__9CFrontApp -# sHelpMenuItemCount__9CFrontApp -# sHelpMenuOrigLength__9CFrontApp -# sRDFContext__9CFrontApp -# sVRes__9CFrontApp - -### class CGABorderPane -#{code} -# DrawSelf__13CGABorderPaneFv -# __ct__13CGABorderPaneFP7LStream -# __dt__13CGABorderPaneFv -#{data} -# __vt__13CGABorderPane - -### class CGAEditBroadcaster -#{code} -# BroadcastValueMessage__18CGAEditBroadcasterFv -# UserChangedText__18CGAEditBroadcasterFv -# __ct__18CGAEditBroadcasterFP7LStream -# __dt__18CGAEditBroadcasterFv -#{data} -# __vt__18CGAEditBroadcaster - -### class CGAFormCheckbox -#{code} -# ClickSelfLayer__15CGAFormCheckboxFRC15SMouseDownEvent -# DrawSelf__15CGAFormCheckboxFv -# EventMouseUp__15CGAFormCheckboxFRC11EventRecord -# HotSpotResultCallback__15CGAFormCheckboxFss -# HotSpotResult__15CGAFormCheckboxFs -# SetValue__15CGAFormCheckboxFl -# TrackHotSpot__15CGAFormCheckboxFs5Points -# __ct__15CGAFormCheckboxFP7LStream -# __dt__15CGAFormCheckboxFv -#{data} -# __vt__15CGAFormCheckbox - -### class CGAFormCheckboxHotSpotResultMochaCallback -#{code} -# Complete__41CGAFormCheckboxHotSpotResultMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__41CGAFormCheckboxHotSpotResultMochaCallbackFv -#{data} -# __vt__41CGAFormCheckboxHotSpotResultMochaCallback - -### class CGAFormPushButton -#{code} -# BroadcastValueMessage__17CGAFormPushButtonFv -# ClickSelfLayer__17CGAFormPushButtonFRC15SMouseDownEvent -# DrawButtonTitle__17CGAFormPushButtonFs -# EventMouseUp__17CGAFormPushButtonFRC11EventRecord -# HotSpotResultCallback__17CGAFormPushButtonFs -# HotSpotResult__17CGAFormPushButtonFs -# SetDescriptor__17CGAFormPushButtonFPCUc -# __ct__17CGAFormPushButtonFP7LStream -# __dt__17CGAFormPushButtonFv -#{data} -# __vt__17CGAFormPushButton - -### class CGAFormPushButtonHotSpotResultMochaCallback -#{code} -# Complete__43CGAFormPushButtonHotSpotResultMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__43CGAFormPushButtonHotSpotResultMochaCallbackFv -#{data} -# __vt__43CGAFormPushButtonHotSpotResultMochaCallback - -### class CGAFormRadio -#{code} -# ClickSelfLayer__12CGAFormRadioFRC15SMouseDownEvent -# DrawSelf__12CGAFormRadioFv -# EventMouseUp__12CGAFormRadioFRC11EventRecord -# HotSpotResultCallback__12CGAFormRadioFsP27LO_FormElementStruct_structsP10MWContext_ -# HotSpotResult__12CGAFormRadioFs -# SetValue__12CGAFormRadioFl -# TrackHotSpot__12CGAFormRadioFs5Points -# __ct__12CGAFormRadioFP7LStream -# __dt__12CGAFormRadioFv -#{data} -# __vt__12CGAFormRadio - -### class CGAFormRadioHotSpotResultMochaCallback -#{code} -# Complete__38CGAFormRadioHotSpotResultMochaCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# __dt__38CGAFormRadioHotSpotResultMochaCallbackFv -#{data} -# __vt__38CGAFormRadioHotSpotResultMochaCallback - -### class CGAIconPopup -#{code} -# CalcLabelRect__12CGAIconPopupFR4Rect -# CalcTitleRect__12CGAIconPopupFR4Rect -# DrawPopupTitle__12CGAIconPopupFv -# GetTitleIconID__12CGAIconPopupFv -# RefreshMenu__12CGAIconPopupFv -# __dt__12CGAIconPopupFv -#{data} -# __vt__12CGAIconPopup - -### class CGAPopupMenu -#{code} -# CalcTitleRect__12CGAPopupMenuFR4Rect -# DrawPopupTitle__12CGAPopupMenuFv -# HandlePopupMenuSelect__12CGAPopupMenuF5PointsRsRs -# __ct__12CGAPopupMenuFP7LStream -# __dt__12CGAPopupMenuFv -#{data} -# __vt__12CGAPopupMenu - -### class CGAStatusBar -#{code} -# CalcBorderRect__12CGAStatusBarFR4Rect -# CalcContentRect__12CGAStatusBarFR4Rect -# CalcTitleRect__12CGAStatusBarFR4Rect -# DrawBlackAndWhiteBorder__12CGAStatusBarFRC4Rect14EGABorderStyle -# DrawBoxTitle__12CGAStatusBarFv -# DrawColorBorder__12CGAStatusBarFRC4Rect14EGABorderStyle -# DrawProgressBar__12CGAStatusBarFRC4RectUc -# GetDescriptor__12CGAStatusBarCFPUc -# GetValue__12CGAStatusBarCFv -# SetDescriptor__12CGAStatusBarFPCUc -# SetValue__12CGAStatusBarFl -# __ct__12CGAStatusBarFP7LStream -# __dt__12CGAStatusBarFv -#{data} -# __vt__12CGAStatusBar - -### class CGATabBox -#{code} -# CalcBorderRect__9CGATabBoxFR4Rect -# CalcCurrentTabRect__9CGATabBoxFR4Rect -# DrawBoxBorder__9CGATabBoxFv -# FindTabGroup__9CGATabBoxFv -# FinishCreateSelf__9CGATabBoxFv -# GetTab__9CGATabBoxFl -# ListenToMessage__9CGATabBoxFlPv -# RegisterTabBoxClasses__9CGATabBoxFv -# RestoreLatentTabCommander__9CGATabBoxFP5LView -# SetCurrentTabID__9CGATabBoxFl -# SetupTabs__9CGATabBoxFv -# StoreLatentTabCommander__9CGATabBoxFP5LView -# __ct__9CGATabBoxFP7LStream -# __dt__9CGATabBoxFv -#{data} -# __vt__9CGATabBox - -### class CGATabBoxTab -#{code} -# BroadcastValueMessage__12CGATabBoxTabFv -# CalcTitleRect__12CGATabBoxTabFR4Rect -# ClickSelf__12CGATabBoxTabFRC15SMouseDownEvent -# DrawButtonNormalColor__12CGATabBoxTabFv -# DrawSelf__12CGATabBoxTabFv -# RefreshHiddenBottom__12CGATabBoxTabFv -# __dt__12CGATabBoxTabFv -#{data} -# __vt__12CGATabBoxTab - -### class CGWorld -#{code} -# AdjustGWorld__7CGWorldFRC4Rect -# BeginDrawing__7CGWorldFv -# CopyImage__7CGWorldFP8GrafPortRC4RectsPP6Region -# EndDrawing__7CGWorldFv -# SetBounds__7CGWorldFRC4Rect -# UpdateBounds__7CGWorldFRC4Rect -# UpdateOrigin__7CGWorldFRC5Point -# __ct__7CGWorldFRC4RectsUlPP10ColorTablePP7GDevice -# __ct__7CGWorldFv -# __dt__7CGWorldFv -#{data} -# __vt__7CGWorld - -### class CGlobalHistoryGroup -#{code} -# CreateLog__19CGlobalHistoryGroupFP11CEditBuffer -# DeleteLog__19CGlobalHistoryGroupFP11CEditBuffer -# GetGlobalHistoryGroup__19CGlobalHistoryGroupFv -# GetLog__19CGlobalHistoryGroupFP11CEditBuffer -# IgnoreNextDeleteOf__19CGlobalHistoryGroupFP11CEditBuffer -# IsReload__19CGlobalHistoryGroupFP11CEditBuffer -# __ct__19CGlobalHistoryGroupFv -# __dt__19CGlobalHistoryGroupFv -#{data} -# g_pGlobalHistoryGroup__19CGlobalHistoryGroup - -### class CGrayBevelView -#{code} -# DrawBeveledFill__14CGrayBevelViewFv -# DrawBeveledFrame__14CGrayBevelViewFv -# DrawBeveledSub__14CGrayBevelViewFRC9SSubBevel -# __ct__14CGrayBevelViewFP7LStream -# __dt__14CGrayBevelViewFv -#{data} -# __vt__14CGrayBevelView - -### class CGuidePopupMenu -#{code} -# AdoptMenu__15CGuidePopupMenuFP5LMenu -# EliminatePreviousMenu__15CGuidePopupMenuFv -# FinishCreateSelf__15CGuidePopupMenuFv -# GetItem__15CGuidePopupMenuCFRC47basic_string,12allocator> -# GetMenu__15CGuidePopupMenuCFv -# GetURL__15CGuidePopupMenuCFs -# HandleNewValue__15CGuidePopupMenuFl -# MakeNewMenu__15CGuidePopupMenuFv -# OwnsMenu__15CGuidePopupMenuCFv -# SetMenu__15CGuidePopupMenuFP5LMenu -# SetupMenu__15CGuidePopupMenuFv -# __ct__15CGuidePopupMenuFP7LStream -# __dt__15CGuidePopupMenuFv -#{data} -# __vt__15CGuidePopupMenu -# sMenuIsSetup__15CGuidePopupMenu -# sMenu__15CGuidePopupMenu -# sOwnsMenu__15CGuidePopupMenu -# sURLs__15CGuidePopupMenu - -### class CHTAwareURLDragMixin -#{code} -# ReceiveDragItem__20CHTAwareURLDragMixinFP19OpaqueDragReferenceUlUlR4Rect -# __ct__20CHTAwareURLDragMixinFv -# __dt__20CHTAwareURLDragMixinFv -#{data} -# __vt__20CHTAwareURLDragMixin - -### class CHTMLClickRecord -#{code} -# CalcEdgeClick__16CHTMLClickRecordFv -# CalcImageClick__16CHTMLClickRecordFv -# CalcTextClick__16CHTMLClickRecordFv -# CalculatePosition__16CHTMLClickRecordFv -# IsAnchor__16CHTMLClickRecordFv -# IsClickOnAnchor__16CHTMLClickRecordCFv -# IsClickOnEdge__16CHTMLClickRecordCFv -# IsEdge__16CHTMLClickRecordFv -# PixelReallyInElement__16CHTMLClickRecordFRC8SPoint32P17LO_Element_struct -# Recalc__16CHTMLClickRecordFv -# WaitForMouseAction__16CHTMLClickRecordFRC15SMouseDownEventP11LAttachablelUc -# WaitForMouseAction__16CHTMLClickRecordFRC5Pointll -# __ct__16CHTMLClickRecordF5PointRC8SPoint32P10CNSContextP17LO_Element_structP8CL_Layer -# __dt__16CHTMLClickRecordFv - -### class CHTMLPrintout -#{code} -# BeginPrint__13CHTMLPrintoutFPP6TPrintP9CHTMLView -# CapturePositions__13CHTMLPrintoutFv -# DoProgress__13CHTMLPrintoutFPCci -# FinishCreateSelf__13CHTMLPrintoutFv -# ListenToMessage__13CHTMLPrintoutFlPv -# LoadPageForPrint__13CHTMLPrintoutFP11URL_Struct_P10MWContext_P10MWContext_ -# Paginate__13CHTMLPrintoutFv -# StashPrintRecord__13CHTMLPrintoutFPP6TPrint -# __ct__13CHTMLPrintoutFP7LStream -# __dt__13CHTMLPrintoutFv -#{data} -# __vt__13CHTMLPrintout -# sHTMLPrintout__13CHTMLPrintout - -### class CHTMLView -#{code} -# AdaptToSuperFrameSize__9CHTMLViewFllUc -# AdjustCursorSelfForLayer__9CHTMLViewF5PointRC11EventRecordP8CL_Layer8SPoint32 -# AdjustCursorSelf__9CHTMLViewF5PointRC11EventRecord -# AdjustScrollBars__9CHTMLViewFv -# BeTarget__9CHTMLViewFv -# CalcAbsoluteElementPosition__9CHTMLViewFP17LO_Element_structR8_XP_Rect -# CalcElementPosition__9CHTMLViewFP17LO_Element_structR4Rect -# CalcFrameFocusMask__9CHTMLViewFPP6Region -# CalcPluginMask__9CHTMLViewFPP6Region -# CalcStandardSizeForWindowForScreen__9CHTMLViewFP9CHTMLViewRC7LWindowRC4RectR12SDimension16 -# CanPrint__9CHTMLViewCFv -# ClearBackground__9CHTMLViewFv -# ClearDeferredImageQueue__9CHTMLViewFv -# ClearTimerURL__9CHTMLViewFv -# ClearView__9CHTMLViewFi -# ClickDragLink__9CHTMLViewFRC15SMouseDownEventP17LO_Element_struct -# ClickSelfLayer__9CHTMLViewFRC15SMouseDownEventP8CL_Layer8SPoint32 -# ClickSelfLink__9CHTMLViewFRC15SMouseDownEventR16CHTMLClickRecordUc -# ClickSelf__9CHTMLViewFRC15SMouseDownEvent -# ClickTrackEdge__9CHTMLViewFRC15SMouseDownEventR16CHTMLClickRecord -# ClickTrackSelection__9CHTMLViewFRC15SMouseDownEventR16CHTMLClickRecord -# Click__9CHTMLViewFR15SMouseDownEvent -# ContextMenuPopupsEnabled__9CHTMLViewFv -# CopyPixels__9CHTMLViewFP9CDrawablePv -# CreateEmbedWindow__9CHTMLViewFP14_NPEmbeddedApp -# CreateFindWindow__9CHTMLViewFv -# CreateGridView__9CHTMLViewFP15CBrowserContextllllScb -# CropFrameToContainer__9CHTMLViewCFllllR4Rect -# DefaultCSIDForNewWindow__9CHTMLViewFv -# DestroyEmbedWindow__9CHTMLViewFP14_NPEmbeddedApp -# DisableSelf__9CHTMLViewFv -# DispatchURL__9CHTMLViewFP11URL_Struct_P10CNSContextUcUci -# DispatchURL__9CHTMLViewFP16CURLDispatchInfo -# DisplayAddRowOrColBorder__9CHTMLViewFP8_XP_Rectb -# DisplayBevelBorder__9CHTMLViewFRC4RectRC8RGBColorUcllll -# DisplayBorder__9CHTMLViewFiiiiiiP15LO_Color_struct12LO_LineStyle -# DisplayBullet__9CHTMLViewFiP22LO_BulletStruct_struct -# DisplayCell__9CHTMLViewFiP20LO_CellStruct_struct -# DisplayEdge__9CHTMLViewFiP20LO_EdgeStruct_struct -# DisplayEmbed__9CHTMLViewFiP21LO_EmbedStruct_struct -# DisplayFeedback__9CHTMLViewFiP17LO_Element_struct -# DisplayFormElement__9CHTMLViewFiP27LO_FormElementStruct_struct -# DisplayGrooveRidgeBorder__9CHTMLViewFRC4RectRC8RGBColorUcllll -# DisplayHR__9CHTMLViewFiP25LO_HorizRuleStruct_struct -# DisplayJavaApp__9CHTMLViewFiP23LO_JavaAppStruct_struct -# DisplayLineFeed__9CHTMLViewFiP24LO_LinefeedStruct_structb -# DisplaySolidBorder__9CHTMLViewFRC4RectRC8RGBColorllll -# DisplaySubtext__9CHTMLViewFiP20LO_TextStruct_structllb -# DisplayTable__9CHTMLViewFiP21LO_TableStruct_struct -# DisplayText__9CHTMLViewFiP20LO_TextStruct_structb -# DoDragSendData__9CHTMLViewFUlUlP19OpaqueDragReference -# DoFind__9CHTMLViewFv -# DoPrintCommand__9CHTMLViewFl -# DrawBackgroundSelf__9CHTMLViewFRC4RectP21LO_ImageStruct_struct -# DrawBackground__9CHTMLViewFRC4RectP21LO_ImageStruct_struct -# DrawFrameFocus__9CHTMLViewFv -# DrawGridEdges__9CHTMLViewFPP6Region -# DrawJavaApp__9CHTMLViewFiP23LO_JavaAppStruct_struct -# DrawSelf__9CHTMLViewFv -# EnableSelf__9CHTMLViewFv -# EraseBackground__9CHTMLViewFillUlUlP15LO_Color_struct -# EstablishPort__9CHTMLViewFv -# EventMouseUp__9CHTMLViewFRC11EventRecord -# FindCommandStatus__9CHTMLViewFlRUcRUcRUsPUc -# FinishCreateSelf__9CHTMLViewFv -# FlushPendingDocResize__9CHTMLViewFv -# FocusDraw__9CHTMLViewFP5LPane -# FreeEdgeElement__9CHTMLViewFP20LO_EdgeStruct_struct -# FreeEmbedElement__9CHTMLViewFP21LO_EmbedStruct_struct -# FreeJavaAppElement__9CHTMLViewFP12LJAppletData -# GetCurrentPort__9CHTMLViewFR5Point -# GetDefaultBackgroundColor__9CHTMLViewCFP15LO_Color_struct -# GetDefaultFileNameForSaveAs__9CHTMLViewFP11URL_Struct_R6CStr31 -# GetDocPosition__9CHTMLViewFiPlPl -# GetEmbedSize__9CHTMLViewFP21LO_EmbedStruct_struct16NET_ReloadMethod -# GetFormElemBaseModel__9CHTMLViewFv -# GetFormElementInfo__9CHTMLViewFP27LO_FormElementStruct_struct -# GetFullGridSize__9CHTMLViewFRlRl -# GetJavaAppSize__9CHTMLViewFP23LO_JavaAppStruct_struct16NET_ReloadMethod -# GetLayerOrigin__9CHTMLViewFPlPl -# GetRepaginate__9CHTMLViewFv -# GetScrollMode__9CHTMLViewCFv -# GetSuperHTMLView__9CHTMLViewFv -# GetTextFrame__9CHTMLViewFP20LO_TextStruct_structllP8_XP_Rect -# GetTextInfo__9CHTMLViewFP20LO_TextStruct_structP18LO_TextInfo_struct -# GetURLForPrinting__9CHTMLViewFRUcP10MWContext_ -GetWinCSID__9CHTMLViewCFv -# HandleClippingView__9CHTMLViewFP12LJAppletDataiiii -# HandleEmbedEvent__9CHTMLViewFP21LO_EmbedStruct_structP8CL_Event -# HandleImageIconClick__9CHTMLViewFR16CHTMLClickRecord -# HandleKeyPressLayer__9CHTMLViewFRC11EventRecordP8CL_Layer8SPoint32 -# HandleKeyPress__9CHTMLViewFRC11EventRecord -# HandleLayerEvent__9CHTMLViewFP8CL_LayerP8CL_Event -# HideJavaAppElement__9CHTMLViewFP12LJAppletData -# ImageToAvailScreenPoint__9CHTMLViewCFRC8SPoint32R5Point -# InstallBackgroundColor__9CHTMLViewFv -# InvalFocusArea__9CHTMLViewFv -# InvalidateEntireTableOrCell__9CHTMLViewFP17LO_Element_struct -# IsBorderless__9CHTMLViewCFv -# IsFocusedFrame__9CHTMLViewCFv -# IsGrowCachingEnabled__9CHTMLViewCFv -# IsImageInDeferredQueue__9CHTMLViewCFPCc -# IsRootHTMLView__9CHTMLViewCFv -# LayoutNewDocument__9CHTMLViewFP11URL_Struct_PlPlPlPl -# ListenToMessage__9CHTMLViewFlPv -# MeasureText__9CHTMLViewFP20LO_TextStruct_structPs -# NoteAllConnectionsComplete__9CHTMLViewFv -# NoteConfirmLoadNewURL__9CHTMLViewFRUc -# NoteEmptyRepagination__9CHTMLViewFv -# NoteFinishedLayout__9CHTMLViewFv -# NoteGridContextDisposed__9CHTMLViewFv -# NoteGridContextPreDispose__9CHTMLViewFUc -# NoteStartLoadURL__9CHTMLViewFv -# NoteStartRepagination__9CHTMLViewFv -# ObeyCommand__9CHTMLViewFlPv -# PostDeferredImage__9CHTMLViewFPCc -# PostProcessClickSelfLink__9CHTMLViewFRC15SMouseDownEventR16CHTMLClickRecordUcUcUc -# PrefInvalidateCachedPreference__9CHTMLViewFPCcPv -# PrefUpdateCallback__9CHTMLViewFPCcPv -# PutOnDuty__9CHTMLViewFP10LCommander -# RegisterCallBackCalls__9CHTMLViewFv -# ResetBackgroundColor__9CHTMLViewCFv -# ResetFormElementData__9CHTMLViewFP27LO_FormElementStruct_structUcUc -# ResetScrollMode__9CHTMLViewFUc -# ResetToDefaultScrollMode__9CHTMLViewFv -# ResizeFrameBy__9CHTMLViewFssUc -# RestoreEmbedWindow__9CHTMLViewFP14_NPEmbeddedApp -# RestructureGridView__9CHTMLViewFllll -# SaveEmbedWindow__9CHTMLViewFP14_NPEmbeddedApp -# ScrollImageBy__9CHTMLViewFllUc -# SetBackgroundColor__9CHTMLViewFUcUcUc -# SetBackgroundImage__9CHTMLViewFP21LO_ImageStruct_structUc -# SetColormap__9CHTMLViewFP8_NI_IRGBi -# SetContext__9CHTMLViewFP15CBrowserContext -# SetCurrentDrawable__9CHTMLViewFP9CDrawable -# SetDefaultCSID__9CHTMLViewFs -# SetDocDimension__9CHTMLViewFill -# SetDocPosition__9CHTMLViewFillUc -# SetFontInfo__9CHTMLViewFv -# SetFormElemBaseModel__9CHTMLViewFP12LModelObject -# SetLayerClip__9CHTMLViewFPv -# SetLayerOrigin__9CHTMLViewFll -# SetRepaginate__9CHTMLViewFUc -# SetScrollMode__9CHTMLViewFScUc -# SetSuperHTMLView__9CHTMLViewFP9CHTMLView -# SetTimerURL__9CHTMLViewFUlPCc -# SetWindowBackgroundColor__9CHTMLViewFv -# ShowView__9CHTMLViewFR5LPane -# SpendTime__9CHTMLViewFRC11EventRecord -# TakeOffDuty__9CHTMLViewFv -# UnregisterCallBackCalls__9CHTMLViewFv -# UpdateEnableStates__9CHTMLViewFv -# __ct__9CHTMLViewFP7LStream -# __dt__9CHTMLViewFv -#{data} -# __vt__9CHTMLView -# sCachedAlwaysLoadImages__9CHTMLView -# sLastFormKeyPressDispatchTime__9CHTMLView - -### class CHistoryMenu -#{code} -# GetFirstSyntheticCommandID__12CHistoryMenuFv -# IsHistoryMenuSyntheticCommandID__12CHistoryMenuFl -# SyncMenuToHistory__12CHistoryMenuFP10CNSContext -# Update__12CHistoryMenuFv -# __ct__12CHistoryMenuFs -# __dt__12CHistoryMenuFv -#{data} -# __vt__12CHistoryMenu -# sHistoryMenu__12CHistoryMenu - -### class CHyperScroller -#{code} -# ActivateSelf__14CHyperScrollerFv -# AdjustHyperViewBounds__14CHyperScrollerFv -# AdjustScrollBars__14CHyperScrollerFv -# CalcDummySizeBox__14CHyperScrollerFv -# ClickSelf__14CHyperScrollerFRC15SMouseDownEvent -# DrawDummySizeBox__14CHyperScrollerFv -# DrawEmptyScroller__14CHyperScrollerFP11LStdControl -# DrawSelf__14CHyperScrollerFv -# ExpandBottom__14CHyperScrollerFv -# ExpandLeft__14CHyperScrollerFv -# ExpandRight__14CHyperScrollerFv -# ExpandTop__14CHyperScrollerFv -# FinishCreateSelf__14CHyperScrollerFv -# RefreshSelf__14CHyperScrollerFv -# ResetExpansion__14CHyperScrollerFv -# ShowScrollbars__14CHyperScrollerFUcUc -# __ct__14CHyperScrollerFP7LStream -# __dt__14CHyperScrollerFv -#{data} -# __vt__14CHyperScroller - -### class CHyperTreeFlexTable -#{code} -# AdjustCursorSelf__19CHyperTreeFlexTableF5PointRC11EventRecord -# CanDoInlineEditing__19CHyperTreeFlexTableFv -# CellHasDropFlag__19CHyperTreeFlexTableCFRC10STableCellRUc -# CellInitiatesDrag__19CHyperTreeFlexTableCFRC10STableCell -# CellSelects__19CHyperTreeFlexTableCFRC10STableCell -# ChangeSort__19CHyperTreeFlexTableFPCQ212LTableHeader10SortChange -# CollapseNode__19CHyperTreeFlexTableFP18_HT_ResourceStruct -# DeleteSelectionByDragToTrash__19CHyperTreeFlexTableFR6LArray -# DeleteSelection__19CHyperTreeFlexTableFv -# DoDragSendData__19CHyperTreeFlexTableFUlUlP19OpaqueDragReference -# DoHiliteRect__19CHyperTreeFlexTableCFRC4Rect -# DoHiliteRgn__19CHyperTreeFlexTableCFPP6Region -# DragSelection__19CHyperTreeFlexTableFRC10STableCellRC15SMouseDownEvent -# DrawCellContents__19CHyperTreeFlexTableFRC10STableCellRC4Rect -# ExpandNode__19CHyperTreeFlexTableFP18_HT_ResourceStruct -# FindCommandStatus__19CHyperTreeFlexTableFlRUcRUcRUsPUc -# FindTitleColumnID__19CHyperTreeFlexTableCFv -# FindTooltipForMouseLocation__19CHyperTreeFlexTableFRC11EventRecordPUc -# GetHiliteColumn__19CHyperTreeFlexTableCFv -# GetHiliteTextRect__19CHyperTreeFlexTableCFUlR4Rect -# GetIconID__19CHyperTreeFlexTableCFUl -# GetMainRowText__19CHyperTreeFlexTableCFUlPcUs -# GetNestedLevel__19CHyperTreeFlexTableCFUl -# HandleDropOfHTResource__19CHyperTreeFlexTableFP18_HT_ResourceStruct -# HandleDropOfLocalFile__19CHyperTreeFlexTableFPCcPCcRC9HFSFlavor -# HandleDropOfPageProxy__19CHyperTreeFlexTableFPCcPCc -# HandleDropOfText__19CHyperTreeFlexTableFPCc -# HiliteDropRow__19CHyperTreeFlexTableFUlUc -# HiliteSelection__19CHyperTreeFlexTableFUcUc -# InlineEditorDone__19CHyperTreeFlexTableFv -# ItemIsAcceptable__19CHyperTreeFlexTableFP19OpaqueDragReferenceUl -# MouseLeave__19CHyperTreeFlexTableFv -# MouseWithin__19CHyperTreeFlexTableF5PointRC11EventRecord -# NodeCanAcceptDrop__19CHyperTreeFlexTableFP19OpaqueDragReferenceP18_HT_ResourceStruct -# OpenRow__19CHyperTreeFlexTableFUl -# OpenView__19CHyperTreeFlexTableFP14_HT_ViewStruct -# ReceiveDragItem__19CHyperTreeFlexTableFP19OpaqueDragReferenceUlUlR4Rect -# RowCanAcceptDropBetweenAbove__19CHyperTreeFlexTableFP19OpaqueDragReferenceUl -# RowCanAcceptDrop__19CHyperTreeFlexTableFP19OpaqueDragReferenceUl -# RowIsContainer__19CHyperTreeFlexTableCFRCUl -# SetCellExpansion__19CHyperTreeFlexTableFRC10STableCellUc -# SetUpTableHelpers__19CHyperTreeFlexTableFv -# SyncSelectionWithHT__19CHyperTreeFlexTableFv -# __ct__19CHyperTreeFlexTableFP7LStream -# __dt__19CHyperTreeFlexTableFv -#{data} -# __vt__19CHyperTreeFlexTable - -### class CHyperTreeHeader -#{code} -# GetColumnInfo__16CHyperTreeHeaderFUl -# SetUpColumns__16CHyperTreeHeaderFP16_HT_CursorStruct -# __ct__16CHyperTreeHeaderFP7LStream -# __dt__16CHyperTreeHeaderFv -#{data} -# __vt__16CHyperTreeHeader - -### class CHyperTreeSelector -#{code} -# CellIsSelected__18CHyperTreeSelectorCFRC10STableCell -# DoSelect__18CHyperTreeSelectorFUlUcUcUc -# SyncSelectorWithHT__18CHyperTreeSelectorFv -# __dt__18CHyperTreeSelectorFv -#{data} -# __vt__18CHyperTreeSelector - -### class CIconFamily -#{code} -# CalcBestSize__11CIconFamilyFRC4Rect -# Plot__11CIconFamilyFRC4Rectss -# Plot__11CIconFamilyFss -# __ct__11CIconFamilyFs -# __ct__11CIconFamilyFv -# __dt__11CIconFamilyFv - -### class CIconList -#{code} -# GetIconSuite__9CIconListFs -# GetIcon__9CIconListFs -# ReturnIconSuite__9CIconListFPPc -# ReturnIcon__9CIconListFPP5CIcon -# __ct__9CIconListFv -# __dt__9CIconListFv -#{data} -# __vt__9CIconList -# sIconList__9CIconList -# sIconSuiteList__9CIconList - -### class CIconTabInstance -#{code} -# DrawTitle__16CIconTabInstanceFP12CTabInstances -# __ct__16CIconTabInstanceFRC14STabDescriptor -# __dt__16CIconTabInstanceFv -#{data} -# __vt__16CIconTabInstance - -### class CIconTextDragTask -#{code} -# AddDragItem__17CIconTextDragTaskFPC14CIconTextSuite -# AddFlavorForItem__17CIconTextDragTaskFP19OpaqueDragReferenceUlPC14CIconTextSuite -# AddFlavorHTNode__17CIconTextDragTaskFUlP18_HT_ResourceStruct -# AddFlavors__17CIconTextDragTaskFP19OpaqueDragReference -# DoDrag__17CIconTextDragTaskFv -# DoNormalDrag__17CIconTextDragTaskFv -# DoTranslucentDrag__17CIconTextDragTaskFv -# MakeDragRegion__17CIconTextDragTaskFP19OpaqueDragReferencePP6Region -# __ct__17CIconTextDragTaskFRC11EventRecordPC14CIconTextSuiteRC4Rect -# __ct__17CIconTextDragTaskFRC11EventRecordRC4Rect -# __ct__17CIconTextDragTaskFRC11EventRecordRC6LArrayRC4Rect -# __dt__17CIconTextDragTaskFv -#{data} -# __vt__17CIconTextDragTask - -### class CIconTextSuite -#{code} -# BoundingRect__14CIconTextSuiteCFv -# DrawIcon__14CIconTextSuiteCFv -# DrawText__14CIconTextSuiteCFv -# IconRectGlobal__14CIconTextSuiteCFv -# IconRectLocal__14CIconTextSuiteCFv -# TextRectGlobal__14CIconTextSuiteCFv -# TextRectLocal__14CIconTextSuiteCFv -# __ct__14CIconTextSuiteFP5LViewRC4RectsRC47basic_string,12allocator>P18_HT_ResourceStruct -# __ct__14CIconTextSuiteFRC14CIconTextSuite -# __ct__14CIconTextSuiteFv -# __dt__14CIconTextSuiteFv -#{data} -# __vt__14CIconTextSuite - -### class CIconToolbarPopup -#{code} -# ActivateSelf__17CIconToolbarPopupFv -# DeactivateSelf__17CIconToolbarPopupFv -# DrawPopupTitle__17CIconToolbarPopupFv -# DrawSelf__17CIconToolbarPopupFv -# __ct__17CIconToolbarPopupFP7LStream -# __dt__17CIconToolbarPopupFv -#{data} -# __vt__17CIconToolbarPopup - -### class CIncludeView -#{code} -# FinishCreateSelf__12CIncludeViewFv -# InstallPane__12CIncludeViewFP5LPane -# __ct__12CIncludeViewFP7LStream -# __dt__12CIncludeViewFv -#{data} -# __vt__12CIncludeView - -### class CInlineEditField -#{code} -# AdjustFrameWidthToText__16CInlineEditFieldFv -# DontBeTarget__16CInlineEditFieldFv -# FinishCreateSelf__16CInlineEditFieldFv -# GetGrowableBorder__16CInlineEditFieldFv -# HandleKeyPress__16CInlineEditFieldFRC11EventRecord -# HideSelf__16CInlineEditFieldFv -# ResizeFrameBy__16CInlineEditFieldFssUc -# SetDescriptor__16CInlineEditFieldFPCUc -# SetGrowableBorder__16CInlineEditFieldFUc -# TakeOffDuty__16CInlineEditFieldFv -# UpdateEdit__16CInlineEditFieldFPCUcPC8SPoint32P15SMouseDownEvent -# UserChangedText__16CInlineEditFieldFv -# __dt__16CInlineEditFieldFv -#{data} -# __vt__16CInlineEditField - -### class CInlineEditorListener -#{code} -# ListenToMessage__21CInlineEditorListenerFlPv -# __dt__21CInlineEditorListenerFv -#{data} -# __vt__21CInlineEditorListener - -### class CInsertTableCaptionCommand -#{code} -# Do__26CInsertTableCaptionCommandFv -# __ct__26CInsertTableCaptionCommandFP11CEditBufferP21_EDT_TableCaptionDatai -# __dt__26CInsertTableCaptionCommandFv -#{data} -# __vt__26CInsertTableCaptionCommand - -### class CInsertTableCellCommand -#{code} -# Do__23CInsertTableCellCommandFv -# __ct__23CInsertTableCellCommandFP11CEditBufferbii -# __dt__23CInsertTableCellCommandFv -#{data} -# __vt__23CInsertTableCellCommand - -### class CInsertTableColumnCommand -#{code} -# Do__25CInsertTableColumnCommandFv -# __ct__25CInsertTableColumnCommandFP11CEditBufferP18_EDT_TableCellDatabii -# __dt__25CInsertTableColumnCommandFv -#{data} -# __vt__25CInsertTableColumnCommand - -### class CInsertTableRowCommand -#{code} -# Do__22CInsertTableRowCommandFv -# __ct__22CInsertTableRowCommandFP11CEditBufferP17_EDT_TableRowDatabii -# __dt__22CInsertTableRowCommandFv -#{data} -# __vt__22CInsertTableRowCommand - -### class CIntPrefPopup -#{code} -# FinishCreateSelf__13CIntPrefPopupFv -# GetPaneValue__13CIntPrefPopupCFv -# SetPaneValue__13CIntPrefPopupFl -# __dt__13CIntPrefPopupFv -#{data} -# __vt__13CIntPrefPopup - -### class CIntPrefRadio -#{code} -# FinishCreateSelf__13CIntPrefRadioFv -# __dt__13CIntPrefRadioFv -#{data} -# __vt__13CIntPrefRadio - -### class CIntPrefTextEdit -#{code} -# FinishCreateSelf__16CIntPrefTextEditFv -# __dt__16CIntPrefTextEditFv -#{data} -# __vt__16CIntPrefTextEdit - -### class CInternetConfig -#{code} -# Connect__15CInternetConfigFv -# CurrentlyUsingIC__15CInternetConfigFv -# Disconnect__15CInternetConfigFv -# GetICFileMapping__15CInternetConfigFUlUlPCUcP10ICMapEntry -# GetICString__15CInternetConfigFPCUcPUcPl -# GetInternetConfigFileMapping__15CInternetConfigFUlUlPCUcP10ICMapEntry -# GetInternetConfigString__15CInternetConfigFPCUcPUcPl -# HaveICInstance__15CInternetConfigFv -# LaunchICApplication__15CInternetConfigFPCUc -# LaunchInternetConfigApplication__15CInternetConfigFPCUc -# ResumeEvent__15CInternetConfigFv -# SendICURL__15CInternetConfigFPc -# SendInternetConfigURL__15CInternetConfigFPc -# SynchFromIC__15CInternetConfigFv -# SynchIf__15CInternetConfigFv -# SynchSplitStringFromIC__15CInternetConfigFPCUccQ26CPrefs8PrefEnumQ26CPrefs8PrefEnumUc -# SynchStringFromIC__15CInternetConfigFPCUcQ26CPrefs8PrefEnumUcPCcl -# UseICPrefCallback__15CInternetConfigFPCcPv -# __ct__15CInternetConfigFv -# __dt__15CInternetConfigFv -#{data} -# sInternetConfigConnection__15CInternetConfig - -### class CInternetConfigInterface -#{code} -# ConnectToInternetConfig__24CInternetConfigInterfaceFv -# CurrentlyUsingIC__24CInternetConfigInterfaceFv -# DisconnectFromInternetConfig__24CInternetConfigInterfaceFv -# GetInternetConfigFileMapping__24CInternetConfigInterfaceFUlUlPCUcP10ICMapEntry -# GetInternetConfigString__24CInternetConfigInterfaceFPCUcPUcPl -# LaunchInternetConfigApplication__24CInternetConfigInterfaceFPCUc -# ResumeEvent__24CInternetConfigInterfaceFv -# SendInternetConfigURL__24CInternetConfigInterfaceFPc - -### class CInternetKeywordTooltipPane -#{code} -# CalcFrameWithRespectTo__27CInternetKeywordTooltipPaneFP7LWindowP5LPaneRC11EventRecordR4Rect -# CalcTipText__27CInternetKeywordTooltipPaneFP7LWindowP5LPaneRC11EventRecordPUc -# CreateInternetKeywordTooltipPaneStream__27CInternetKeywordTooltipPaneFP7LStream -# __dt__27CInternetKeywordTooltipPaneFv -#{data} -# __vt__27CInternetKeywordTooltipPane - -### class CKeyScrollAttachment -#{code} -# ExecuteSelf__20CKeyScrollAttachmentFlPv -# __ct__20CKeyScrollAttachmentFP7LStream -# __dt__20CKeyScrollAttachmentFv -#{data} -# __vt__20CKeyScrollAttachment - -### class CLargeEditField -#{code} -# GetLongDescriptor__15CLargeEditFieldFv -# SetLongDescriptor__15CLargeEditFieldFPc -# __dt__15CLargeEditFieldFv -#{data} -# __vt__15CLargeEditField - -### class CLargeEditFieldBroadcast -#{code} -# UserChangedText__24CLargeEditFieldBroadcastFv -# __dt__24CLargeEditFieldBroadcastFv -#{data} -# __vt__24CLargeEditFieldBroadcast - -### class CLayerClickCallbackMixin -#{data} -# __vt__24CLayerClickCallbackMixin - -### class CLayerClickDispatchAttachment -#{code} -# ExecuteSelf__29CLayerClickDispatchAttachmentFlPv -# MouseDown__29CLayerClickDispatchAttachmentFRC15SMouseDownEvent -# __ct__29CLayerClickDispatchAttachmentFv -# __dt__29CLayerClickDispatchAttachmentFv -#{data} -# __vt__29CLayerClickDispatchAttachment - -### class CLayerKeyPressDispatchAttachment -#{code} -# ExecuteSelf__32CLayerKeyPressDispatchAttachmentFlPv -# KeyPress__32CLayerKeyPressDispatchAttachmentFRC11EventRecord -# __ct__32CLayerKeyPressDispatchAttachmentFv -# __dt__32CLayerKeyPressDispatchAttachmentFv -#{data} -# __vt__32CLayerKeyPressDispatchAttachment - -### class CLineProp -#{code} -# CommitChanges__9CLinePropFUc -# FinishCreateSelf__9CLinePropFv -# Help__9CLinePropFv -# InitializeDialogControls__9CLinePropFv -# __ct__9CLinePropFP7LStream -# __dt__9CLinePropFv -#{data} -# __vt__9CLineProp - -### class CListenerCaption -#{code} -# ChangeText__16CListenerCaptionFRCl -# GetLabelNum__16CListenerCaptionCFv -# Init__16CListenerCaptionFsRCl -# ListenToMessage__16CListenerCaptionFlPv -# SetLabelNum__16CListenerCaptionFRCl -# __ct__16CListenerCaptionFP7LStream -# __dt__16CListenerCaptionFv -#{data} -# __vt__16CListenerCaption - -### class CMIMEListPane -#{code} -# ActivateSelf__13CMIMEListPaneFv -# BindCellToApplication__13CMIMEListPaneFUlP11CMimeMapper -# ClickCell__13CMIMEListPaneFRC10TableCellTRC15SMouseDownEvent -# DrawCell__13CMIMEListPaneFRC10TableCellT -# DrawSelf__13CMIMEListPaneFv -# FinishCreateSelf__13CMIMEListPaneFv -# FreeMappers__13CMIMEListPaneFv -# GetAppInfo__13CMIMEListPaneFP11CMimeMapper -# GetCellInfo__13CMIMEListPaneFRQ213CMIMEListPane12PrefCellInfoi -# HandleKeyPress__13CMIMEListPaneFRC11EventRecord -# HiliteCell__13CMIMEListPaneFRC10TableCellT -# MimeTypeExists__13CMIMEListPaneFP11CMimeMapper -# ScrollCellIntoFrame__13CMIMEListPaneFRC10TableCellT -# SelectCell__13CMIMEListPaneFRC10TableCellT -# UnhiliteCell__13CMIMEListPaneFRC10TableCellT -# __ct__13CMIMEListPaneFP7LStream -# __ct__Q213CMIMEListPane12PrefCellInfoFP11CMimeMapperP20CApplicationIconInfo -# __ct__Q213CMIMEListPane12PrefCellInfoFv -# __dt__13CMIMEListPaneFv -#{data} -# __vt__13CMIMEListPane - -### class CMacSpellChecker -#{code} -# ClearReplacementWord__16CMacSpellCheckerFP10LEditFieldP10CTextTable -# GetAlternativesForWord__16CMacSpellCheckerFP10LEditFieldP10CTextTableP10LCommander -# GetNextMisspelledWord__16CMacSpellCheckerFUc -# GetSelection__16CMacSpellCheckerFRlRl -# GetTextBuffer__16CMacSpellCheckerFv -# IgnoreHilitedText__16CMacSpellCheckerFUc -# ReplaceHilitedText__16CMacSpellCheckerFPcUc -# SetNextMisspelledWord__16CMacSpellCheckerFPcP10LEditFieldP10CTextTableP10LCommander -# ShowDialog__16CMacSpellCheckerFPc -# StartProcessing__16CMacSpellCheckerFUc -# __ct__16CMacSpellCheckerFP10MWContext_P9CEditViewP15CSimpleTextView - -### class CMediatedWindow -#{code} -# ActivateSelf__15CMediatedWindowFv -# DeactivateSelf__15CMediatedWindowFv -# DefaultCSIDForNewWindow__15CMediatedWindowFv -# GetWindowType__15CMediatedWindowCFv -# NoteWindowMenubarModeChanged__15CMediatedWindowFv -# SetDescriptor__15CMediatedWindowFPCUc -# SetWindowType__15CMediatedWindowFl -# __ct__15CMediatedWindowFP7LStreaml -# __dt__15CMediatedWindowFv -#{data} -# __vt__15CMediatedWindow - -### class CMenuTable -#{code} -# AddTableLabels__10CMenuTableFRUlsUc -# ClickSelf__10CMenuTableFRC15SMouseDownEvent -# DrawCell__10CMenuTableFRC10STableCellRC4Rect -# FindMessage__10CMenuTableFl -# FinishCreate__10CMenuTableFv -# GetHiliteRgn__10CMenuTableFPP6Region -# GetSelectedMessage__10CMenuTableFv -# HiliteCellActively__10CMenuTableFRC10STableCellUc -# HiliteCellInactively__10CMenuTableFRC10STableCellUc -# HiliteSelection__10CMenuTableFUcUc -# SelectionChanged__10CMenuTableFv -# __ct__10CMenuTableFP7LStream -# __dt__10CMenuTableFv -#{data} -# __vt__10CMenuTable - -### class CMimeList -#{code} -# DeleteAll__9CMimeListFUc -# FindBasePref__9CMimeListFPCc -# FindCreator__9CMimeListFUl -# FindMimeType__9CMimeListFPc -# FindMimeType__9CMimeListFQ29CMimeList7BuiltIn -# FindMimeType__9CMimeListFRC6FSSpec -# HandleRegisterViewerEvent__9CMimeListFRC6AEDescR6AEDescR6AEDescl -# HandleUnregisterViewerEvent__9CMimeListFRC6AEDescR6AEDescR6AEDescl -# InsertItemsAt__9CMimeListFUllPCvUl -# __ct__9CMimeListFv -# __dt__9CMimeListFv -#{data} -# __vt__9CMimeList - -### class CMimeMapper -#{code} -# CreateMapperForRes__11CMimeMapperFPPc -# CreateMapperFor__11CMimeMapperFPCcUc -# GetFileSpec__11CMimeMapperFP11URL_Struct_R6FSSpec -# InitMapper__11CMimeMapperFv -# LaunchFile__11CMimeMapperFP17LFileBufferStreamP11URL_Struct_l -# MakeSpyEvent__11CMimeMapperFR6AEDescP11URL_Struct_UlUl -# NetscapeCanHandle__11CMimeMapperFR7CStr255 -# PrintableChars__11CMimeMapperFPCvl -# ReadMimePrefs__11CMimeMapperFv -# RegisterViewer__11CMimeMapperFUlUl -# SetAppName__11CMimeMapperFRC7CStr255 -# SetAppSig__11CMimeMapperFR6FSSpec -# SetAppSig__11CMimeMapperFUl -# SetDefaultDescription__11CMimeMapperFv -# SetDocType__11CMimeMapperFUl -# SetExtensions__11CMimeMapperFRC7CStr255 -# SetLatentPlugin__11CMimeMapperFv -# SetLoadAction__11CMimeMapperFQ211CMimeMapper10LoadAction -# SetMimeType__11CMimeMapperFRC7CStr255 -# SyncNetlib__11CMimeMapperFv -# UnregisterViewer__11CMimeMapperFv -# WriteMimePrefs__11CMimeMapperFUc -# __as__11CMimeMapperFRC11CMimeMapper -# __ct__11CMimeMapperFPCc -# __ct__11CMimeMapperFPPc -# __ct__11CMimeMapperFQ211CMimeMapper10LoadActionRC7CStr255RC7CStr255RC7CStr255UlUl -# __ct__11CMimeMapperFRC11CMimeMapper -# __dt__11CMimeMapperFv - -### class CMimeTable -#{code} -# BindCellToApplication__10CMimeTableFUlP11CMimeMapper -# DrawCell__10CMimeTableFRC10TableCellT -# DrawSelf__10CMimeTableFv -# FinishCreateSelf__10CMimeTableFv -# FreeMappers__10CMimeTableFv -# GetAppInfo__10CMimeTableFP11CMimeMapper -# GetCellInfo__10CMimeTableFR12PrefCellInfoi -# HandleKeyPress__10CMimeTableFRC11EventRecord -# HiliteCell__10CMimeTableFRC10TableCellT -# ScrollCellIntoFrame__10CMimeTableFRC10TableCellT -# UnhiliteCell__10CMimeTableFRC10TableCellT -# __ct__10CMimeTableFP7LStream -# __dt__10CMimeTableFv -#{data} -# __vt__10CMimeTable - -### class CMiniSecurityButton -#{code} -# DrawButtonContent__19CMiniSecurityButtonFv -# DrawButtonGraphic__19CMiniSecurityButtonFv -# GetIconID__19CMiniSecurityButtonF14ESecurityState -# __ct__19CMiniSecurityButtonFP7LStream -# __dt__19CMiniSecurityButtonFv -#{data} -# __vt__19CMiniSecurityButton - -### class CMochaEventCallback -#{code} -# Complete__19CMochaEventCallbackFP10MWContext_P17LO_Element_structl13ETEventStatus -# MochaCallback__19CMochaEventCallbackFP10MWContext_P17LO_Element_structlPv13ETEventStatus -# SendEvent__19CMochaEventCallbackFP10MWContext_P17LO_Element_structlP8CL_Layer8SPoint32 -# SendEvent__19CMochaEventCallbackFP10MWContext_P20LO_AnchorData_structlP8CL_Layer8SPoint32 -# __ct__19CMochaEventCallbackFv -# __dt__19CMochaEventCallbackFv -#{data} -# __vt__19CMochaEventCallback - -### class CMochaHacks -#{code} -# AddDependent__11CMochaHacksFP10MWContext_P10MWContext_ -# IsDependent__11CMochaHacksFP10MWContext_ -# MochaModifiersFromKeyboard__11CMochaHacksFv -# MochaModifiers__11CMochaHacksFUs -# RemoveDependents__11CMochaHacksFP10MWContext_ -# ResetMochaMouse__11CMochaHacksFv -# SendEvent__11CMochaHacksFP10MWContext_lP17LO_Element_struct -# SendMoveEvent__11CMochaHacksFP10MWContext_ll -# SendOutOfElementEvent__11CMochaHacksFP10MWContext_P8CL_Layer8SPoint32 -# SendOutOfMapAreaEvent__11CMochaHacksFP10MWContext_P8CL_Layer8SPoint32 -#{data} -# sMouseOverElementContext__11CMochaHacks -# sMouseOverElement__11CMochaHacks -# sMouseOverMapArea__11CMochaHacks - -### class CMouseDispatcher -#{code} -# ExecuteSelf__16CMouseDispatcherFlPv -# __ct__16CMouseDispatcherFv -# __dt__16CMouseDispatcherFv -#{data} -# __vt__16CMouseDispatcher - -### class CMouseDragger -#{code} -# AboutToScrollView__13CMouseDraggerFPC8SPoint32PC8SPoint32 -# BeginTracking__13CMouseDraggerFPC8SPoint32 -# CanScrollView__13CMouseDraggerFP5LView5PointPC4Rect -# DoTrackMouse__13CMouseDraggerFP5LViewPC8SPoint32PC10LImageRectss -# DoneScrollingView__13CMouseDraggerFPC8SPoint32PC8SPoint32 -# DrawDragRegion__13CMouseDraggerFPC8SPoint32PC8SPoint32Q213CMouseDragger16EDrawRegionState -# EndTracking__13CMouseDraggerFPC8SPoint32PC8SPoint32 -# GlobalToImagePt__13CMouseDraggerFP5LView5PointP8SPoint32 -# ImageToLocalRect__13CMouseDraggerFP5LViewP10LImageRectP4Rect -# ImageToPortPt__13CMouseDraggerFP5LViewPC8SPoint32P5Point -# KeepTracking__13CMouseDraggerFPC8SPoint32PC8SPoint32PC8SPoint32 -# PortToImagePt__13CMouseDraggerFP5LView5PointP8SPoint32 -# PortToImageRect__13CMouseDraggerFP5LViewPC4RectP10LImageRect -# __dt__13CMouseDraggerFv -#{data} -# __vt__13CMouseDragger - -### class CMouseTrackAttachment -#{code} -# EnsureOwningPane__21CMouseTrackAttachmentFv -# ExecuteSelf__21CMouseTrackAttachmentFlPv -# __ct__21CMouseTrackAttachmentFP7LStream -# __ct__21CMouseTrackAttachmentFv -# __dt__21CMouseTrackAttachmentFv -#{data} -# __vt__21CMouseTrackAttachment - -### class CMozillaToolbarPrefsProxy -#{code} -# GetToolbarPref__25CMozillaToolbarPrefsProxyFRl -# __ct__25CMozillaToolbarPrefsProxyFv -# __dt__25CMozillaToolbarPrefsProxyFv -#{data} -# __vt__25CMozillaToolbarPrefsProxy - -### class CNSContext -#{code} -# Alert__10CNSContextFPCc -# AllConnectionsComplete__10CNSContextFv -# BeginPreSection__10CNSContextFv -# ClearCallNetlibAllTheTime__10CNSContextFv -# ClearDefaultStatus__10CNSContextFv -# ClearMWContextViewPtr__10CNSContextFv -# ClearView__10CNSContextFi -# CompleteLoad__10CNSContextFP11URL_Struct_i -# Confirm__10CNSContextFPCc -# CopyListenersToContext__10CNSContextFP10CNSContext -# CreateEmbedWindow__10CNSContextFP14_NPEmbeddedApp -# CreateNewDocWindow__10CNSContextFP11URL_Struct_ -# DestroyEmbedWindow__10CNSContextFP14_NPEmbeddedApp -# DisplayAddRowOrColBorder__10CNSContextFP8_XP_Rectb -# DisplayBorder__10CNSContextFiiiiiiP15LO_Color_struct12LO_LineStyle -# DisplayBullet__10CNSContextFiP22LO_BulletStruct_struct -# DisplayCell__10CNSContextFiP20LO_CellStruct_struct -# DisplayEdge__10CNSContextFiP20LO_EdgeStruct_struct -# DisplayEmbed__10CNSContextFiP21LO_EmbedStruct_struct -# DisplayFeedback__10CNSContextFiP17LO_Element_struct -# DisplayFormElement__10CNSContextFiP27LO_FormElementStruct_struct -# DisplayHR__10CNSContextFiP25LO_HorizRuleStruct_struct -# DisplayJavaApp__10CNSContextFiP23LO_JavaAppStruct_struct -# DisplayLineFeed__10CNSContextFiP24LO_LinefeedStruct_structb -# DisplaySubDoc__10CNSContextFiP22LO_SubDocStruct_struct -# DisplaySubtext__10CNSContextFiP20LO_TextStruct_structllb -# DisplayTable__10CNSContextFiP21LO_TableStruct_struct -# DisplayText__10CNSContextFiP20LO_TextStruct_structb -# DrawJavaApp__10CNSContextFiP23LO_JavaAppStruct_struct -# EnableClicking__10CNSContextFv -# EndPreSection__10CNSContextFv -# EnsureContextProgress__10CNSContextFv -# EraseBackground__10CNSContextFillUlUlP15LO_Color_struct -# FileSortMethod__10CNSContextFv -# FinishedLayout__10CNSContextFv -# FormTextIsSubmit__10CNSContextFP27LO_FormElementStruct_struct -# FreeEdgeElement__10CNSContextFP20LO_EdgeStruct_struct -# FreeEmbedElement__10CNSContextFP21LO_EmbedStruct_struct -# FreeJavaAppElement__10CNSContextFP12LJAppletData -# GetContextProgress__10CNSContextFv -# GetCurrentHistoryEntry__10CNSContextFv -# GetCurrentProgressStats__10CNSContextFv -# GetCurrentURL__10CNSContextFv -# GetDefaultBackgroundColor__10CNSContextCFP15LO_Color_struct -# GetDefaultCSID__10CNSContextCFv -# GetDefaultStatus__10CNSContextCFv -# GetDescriptor__10CNSContextCFv -# GetDocCSID__10CNSContextCFv -# GetDocPosition__10CNSContextFiPlPl -# GetEmbedSize__10CNSContextFP21LO_EmbedStruct_struct16NET_ReloadMethod -# GetFormElementInfo__10CNSContextFP27LO_FormElementStruct_struct -# GetFormElementValue__10CNSContextFP27LO_FormElementStruct_structb -# GetHistoryEntryTitleByIndex__10CNSContextFl -# GetHistoryListCount__10CNSContextFv -# GetHistoryURLByIndex__10CNSContextFR7cstringl -# GetIndexOfCurrentHistoryEntry__10CNSContextFv -# GetJavaAppSize__10CNSContextFP23LO_JavaAppStruct_struct16NET_ReloadMethod -# GetTextFrame__10CNSContextFP20LO_TextStruct_structllP8_XP_Rect -# GetTextInfo__10CNSContextFP20LO_TextStruct_structP18LO_TextInfo_struct -# GetWCSIDFromDocCSID__10CNSContextFs -# GetWinCSID__10CNSContextCFv -# GraphProgressDestroy__10CNSContextFP11URL_Struct_ll -# GraphProgressInit__10CNSContextFP11URL_Struct_l -# GraphProgress__10CNSContextFP11URL_Struct_lll -# HandleClippingView__10CNSContextFP12LJAppletDataiiii -# HideJavaAppElement__10CNSContextFP12LJAppletData -# ImmediateLoadURL__10CNSContextFP11URL_Struct_i -# InitDefaultCSID__10CNSContextFv -# InvalidateEntireTableOrCell__10CNSContextFP17LO_Element_struct -# IsCloneRequired__10CNSContextCFv -# LayoutNewDocument__10CNSContextFP11URL_Struct_PlPlPlPl -# MeasureText__10CNSContextFP20LO_TextStruct_structPs -# NoMoreUsers__10CNSContextFv -# Progress__10CNSContextFPCc -# PromptPassword__10CNSContextFPCc -# PromptUsernameAndPassword__10CNSContextFPCcPPcPPc -# PromptWithCaption__10CNSContextFPCcPCcPCc -# Prompt__10CNSContextFPCcPCc -# ResetFormElement__10CNSContextFP27LO_FormElementStruct_struct -# RestoreEmbedWindow__10CNSContextFP14_NPEmbeddedApp -# SaveEmbedWindow__10CNSContextFP14_NPEmbeddedApp -# SetBackgroundColor__10CNSContextFUcUcUc -# SetCallNetlibAllTheTime__10CNSContextFv -# SetContextProgress__10CNSContextFP16CContextProgress -# SetDefaultCSID__10CNSContextFs -# SetDescriptor__10CNSContextFPCc -# SetDocCSID__10CNSContextFs -# SetDocDimension__10CNSContextFill -# SetDocPosition__10CNSContextFill -# SetDocTitle__10CNSContextFPc -# SetDrawable__10CNSContextFP11CL_Drawable -# SetFormElementToggle__10CNSContextFP27LO_FormElementStruct_structb -# SetProgressBarPercent__10CNSContextFl -# SetRequiresClone__10CNSContextFUc -# SetStatus__10CNSContextFPCc -# SetWinCSID__10CNSContextFs -# ShowAllNewsArticles__10CNSContextFv -# SwitchLoadURL__10CNSContextFP11URL_Struct_i -# TranslateISOText__10CNSContextFiPc -# UpdateCurrentProgressStats__10CNSContextFv -# UpdateEnableStates__10CNSContextFv -# UseFancyFTP__10CNSContextFv -# UseFancyNewsgroupListing__10CNSContextFv -# WaitWhileBusy__10CNSContextFv -# __ct__10CNSContextF13MWContextType -# __ct__10CNSContextFRC10CNSContext -# __dt__10CNSContextFv -#{data} -# __vt__10CNSContext -# sNSCWindowID__10CNSContext - -### class CNSContextCallbacks -#{code} -# Alert__19CNSContextCallbacksFP10MWContext_PCc -# AllConnectionsComplete__19CNSContextCallbacksFP10MWContext_ -# BeginPreSection__19CNSContextCallbacksFP10MWContext_ -# ClearCallNetlibAllTheTime__19CNSContextCallbacksFP10MWContext_ -# ClearView__19CNSContextCallbacksFP10MWContext_i -# Confirm__19CNSContextCallbacksFP10MWContext_PCc -# CreateEmbedWindow__19CNSContextCallbacksFP10MWContext_P14_NPEmbeddedApp -# CreateNewDocWindow__19CNSContextCallbacksFP10MWContext_P11URL_Struct_ -# DestroyEmbedWindow__19CNSContextCallbacksFP10MWContext_P14_NPEmbeddedApp -# DisplayAddRowOrColBorder__19CNSContextCallbacksFP10MWContext_P8_XP_Rectb -# DisplayBorder__19CNSContextCallbacksFP10MWContext_iiiiiiP15LO_Color_struct12LO_LineStyle -# DisplayBullet__19CNSContextCallbacksFP10MWContext_iP22LO_BulletStruct_struct -# DisplayCell__19CNSContextCallbacksFP10MWContext_iP20LO_CellStruct_struct -# DisplayEdge__19CNSContextCallbacksFP10MWContext_iP20LO_EdgeStruct_struct -# DisplayEmbed__19CNSContextCallbacksFP10MWContext_iP21LO_EmbedStruct_struct -# DisplayFeedback__19CNSContextCallbacksFP10MWContext_iP17LO_Element_struct -# DisplayFormElement__19CNSContextCallbacksFP10MWContext_iP27LO_FormElementStruct_struct -# DisplayHR__19CNSContextCallbacksFP10MWContext_iP25LO_HorizRuleStruct_struct -# DisplayJavaApp__19CNSContextCallbacksFP10MWContext_iP23LO_JavaAppStruct_struct -# DisplayLineFeed__19CNSContextCallbacksFP10MWContext_iP24LO_LinefeedStruct_structb -# DisplaySubDoc__19CNSContextCallbacksFP10MWContext_iP22LO_SubDocStruct_struct -# DisplaySubtext__19CNSContextCallbacksFP10MWContext_iP20LO_TextStruct_structllb -# DisplayTable__19CNSContextCallbacksFP10MWContext_iP21LO_TableStruct_struct -# DisplayText__19CNSContextCallbacksFP10MWContext_iP20LO_TextStruct_structb -# DrawJavaApp__19CNSContextCallbacksFP10MWContext_iP23LO_JavaAppStruct_struct -# EnableClicking__19CNSContextCallbacksFP10MWContext_ -# EndPreSection__19CNSContextCallbacksFP10MWContext_ -# EraseBackground__19CNSContextCallbacksFP10MWContext_illUlUlP15LO_Color_struct -# FileSortMethod__19CNSContextCallbacksFP10MWContext_ -# FinishedLayout__19CNSContextCallbacksFP10MWContext_ -# FormTextIsSubmit__19CNSContextCallbacksFP10MWContext_P27LO_FormElementStruct_struct -# FreeEdgeElement__19CNSContextCallbacksFP10MWContext_P20LO_EdgeStruct_struct -# FreeEmbedElement__19CNSContextCallbacksFP10MWContext_P21LO_EmbedStruct_struct -# FreeJavaAppElement__19CNSContextCallbacksFP10MWContext_P12LJAppletData -# GetDefaultBackgroundColor__19CNSContextCallbacksFP10MWContext_P15LO_Color_struct -# GetDocPosition__19CNSContextCallbacksFP10MWContext_iPlPl -# GetEmbedSize__19CNSContextCallbacksFP10MWContext_P21LO_EmbedStruct_struct16NET_ReloadMethod -# GetFormElementInfo__19CNSContextCallbacksFP10MWContext_P27LO_FormElementStruct_struct -# GetFormElementValue__19CNSContextCallbacksFP10MWContext_P27LO_FormElementStruct_structb -# GetJavaAppSize__19CNSContextCallbacksFP10MWContext_P23LO_JavaAppStruct_struct16NET_ReloadMethod -# GetTextFrame__19CNSContextCallbacksFP10MWContext_P20LO_TextStruct_structllP8_XP_Rect -# GetTextInfo__19CNSContextCallbacksFP10MWContext_P20LO_TextStruct_structP18LO_TextInfo_struct -# GraphProgressDestroy__19CNSContextCallbacksFP10MWContext_P11URL_Struct_ll -# GraphProgressInit__19CNSContextCallbacksFP10MWContext_P11URL_Struct_l -# GraphProgress__19CNSContextCallbacksFP10MWContext_P11URL_Struct_lll -# HandleClippingView__19CNSContextCallbacksFP10MWContext_P12LJAppletDataiiii -# HideJavaAppElement__19CNSContextCallbacksFP10MWContext_P12LJAppletData -# InvalidateEntireTableOrCell__19CNSContextCallbacksFP10MWContext_P17LO_Element_struct -# LayoutNewDocument__19CNSContextCallbacksFP10MWContext_P11URL_Struct_PlPlPlPl -# MeasureText__19CNSContextCallbacksFP10MWContext_P20LO_TextStruct_structPs -# Progress__19CNSContextCallbacksFP10MWContext_PCc -# PromptPassword__19CNSContextCallbacksFP10MWContext_PCc -# PromptUsernameAndPassword__19CNSContextCallbacksFP10MWContext_PCcPPcPPc -# PromptWithCaption__19CNSContextCallbacksFP10MWContext_PCcPCcPCc -# Prompt__19CNSContextCallbacksFP10MWContext_PCcPCc -# ResetFormElement__19CNSContextCallbacksFP10MWContext_P27LO_FormElementStruct_struct -# RestoreEmbedWindow__19CNSContextCallbacksFP10MWContext_P14_NPEmbeddedApp -# SaveEmbedWindow__19CNSContextCallbacksFP10MWContext_P14_NPEmbeddedApp -# SetBackgroundColor__19CNSContextCallbacksFP10MWContext_UcUcUc -# SetCallNetlibAllTheTime__19CNSContextCallbacksFP10MWContext_ -# SetDocDimension__19CNSContextCallbacksFP10MWContext_ill -# SetDocPosition__19CNSContextCallbacksFP10MWContext_ill -# SetDocTitle__19CNSContextCallbacksFP10MWContext_Pc -# SetDrawable__19CNSContextCallbacksFP10MWContext_P11CL_Drawable -# SetFormElementToggle__19CNSContextCallbacksFP10MWContext_P27LO_FormElementStruct_structb -# SetProgressBarPercent__19CNSContextCallbacksFP10MWContext_l -# ShowAllNewsArticles__19CNSContextCallbacksFP10MWContext_ -# TranslateISOText__19CNSContextCallbacksFP10MWContext_iPc -# UpdateEnableStates__19CNSContextCallbacksFP10MWContext_ -# UseFancyFTP__19CNSContextCallbacksFP10MWContext_ -# UseFancyNewsgroupListing__19CNSContextCallbacksFP10MWContext_ -# __ct__19CNSContextCallbacksFv -# __dt__19CNSContextCallbacksFv -#{data} -# __vt__19CNSContextCallbacks -# sContextCallbacks__19CNSContextCallbacks - -### class CNSMenuBarManager -#{code} -# ListenToMessage__17CNSMenuBarManagerFlPv -# MapWindowTypeToMBARResID__17CNSMenuBarManagerFUlP15CMediatedWindow -# SwitchMenuBar__17CNSMenuBarManagerFs -# __ct__17CNSMenuBarManagerFP15CWindowMediator -# __dt__17CNSMenuBarManagerFv -#{data} -# __vt__17CNSMenuBarManager -# sManager__17CNSMenuBarManager - -### class CNativeFontReference -#{code} -# Apply__20CNativeFontReferenceFv -# DrawText__20CNativeFontReferenceFiiPcii -# GetFontInfo__20CNativeFontReferenceFP8FontInfo -# LookupGenericFont__20CNativeFontReferenceFPcPC8CCharSetPC18LO_TextAttr_structUc -# LookupNativeFont__20CNativeFontReferenceFPcPC8CCharSetPC18LO_TextAttr_structUc -# MeasureText__20CNativeFontReferenceFPciiPs -# SynchToPort__20CNativeFontReferenceFP8GrafPort -# TextWidth__20CNativeFontReferenceFPcii -# __ct__20CNativeFontReferenceFsPC8CCharSetPC18LO_TextAttr_structUc -# __dt__20CNativeFontReferenceFv -#{data} -# __vt__20CNativeFontReference - -### class CNavCenterContextMenuAttachment -#{code} -# BuildMenu__31CNavCenterContextMenuAttachmentFv -# ConvertHTCommandToPPCommand__31CNavCenterContextMenuAttachmentF11_HT_MenuCmd -# NewHTContextMenuCursor__31CNavCenterContextMenuAttachmentFv -# PruneMenu__31CNavCenterContextMenuAttachmentFP5LMenu -# __dt__31CNavCenterContextMenuAttachmentFv -#{data} -# __vt__31CNavCenterContextMenuAttachment - -### class CNavCenterSelectorContextMenuAttachment -#{code} -# NewHTContextMenuCursor__39CNavCenterSelectorContextMenuAttachmentFv -# __dt__39CNavCenterSelectorContextMenuAttachmentFv -#{data} -# __vt__39CNavCenterSelectorContextMenuAttachment - -### class CNavCenterSelectorPane -#{code} -# AdjustCursorSelf__22CNavCenterSelectorPaneF5PointRC11EventRecord -# ClickSelf__22CNavCenterSelectorPaneFRC15SMouseDownEvent -# CycleCurrentWorkspace__22CNavCenterSelectorPaneFv -# DrawDividingLine__22CNavCenterSelectorPaneFUlQ222CNavCenterSelectorPane13EDropLocation -# DrawSelf__22CNavCenterSelectorPaneFv -# EnterDropArea__22CNavCenterSelectorPaneFP19OpaqueDragReferenceUc -# FindCommandStatus__22CNavCenterSelectorPaneFlRUcRUcRUsPUc -# FindIndexForPoint__22CNavCenterSelectorPaneCFRC5Point -# FindIndexForPoint__22CNavCenterSelectorPaneCFRC5PointRQ222CNavCenterSelectorPane13EDropLocation -# FindSelectorForPoint__22CNavCenterSelectorPaneCFRC5Point -# FindSelectorForPoint__22CNavCenterSelectorPaneCFRC5PointRQ222CNavCenterSelectorPane13EDropLocationRUl -# FindTooltipForMouseLocation__22CNavCenterSelectorPaneFRC11EventRecordPUc -# HandleDropOfHTResource__22CNavCenterSelectorPaneFP18_HT_ResourceStruct -# HandleDropOfLocalFile__22CNavCenterSelectorPaneFPCcPCcRC9HFSFlavor -# HandleDropOfPageProxy__22CNavCenterSelectorPaneFPCcPCc -# HandleDropOfText__22CNavCenterSelectorPaneFPCc -# InsideDropArea__22CNavCenterSelectorPaneFP19OpaqueDragReference -# ItemIsAcceptable__22CNavCenterSelectorPaneFP19OpaqueDragReferenceUl -# LeaveDropArea__22CNavCenterSelectorPaneFP19OpaqueDragReference -# MouseLeave__22CNavCenterSelectorPaneFv -# MouseWithin__22CNavCenterSelectorPaneF5PointRC11EventRecord -# NoticeActiveWorkspaceChanged__22CNavCenterSelectorPaneFP14_HT_ViewStruct -# ReceiveDragItem__22CNavCenterSelectorPaneFP19OpaqueDragReferenceUlUlR4Rect -# SetActiveWorkspace__22CNavCenterSelectorPaneFP14_HT_ViewStruct -# __ct__22CNavCenterSelectorPaneFP7LStream -# __dt__22CNavCenterSelectorPaneFv -#{data} -# __vt__22CNavCenterSelectorPane - -### class CNavCenterTitle -#{code} -# FinishCreateSelf__15CNavCenterTitleFv -# ListenToMessage__15CNavCenterTitleFlPv -# __ct__15CNavCenterTitleFP7LStream -# __dt__15CNavCenterTitleFv -#{data} -# __vt__15CNavCenterTitle - -### class CNavCenterWindow -#{code} -# AttemptClose__16CNavCenterWindowFv -# BringPaneToFront__16CNavCenterWindowF12_HT_ViewType -# DoClose__16CNavCenterWindowFv -# DoDefaultPrefs__16CNavCenterWindowFv -# FinishCreateSelf__16CNavCenterWindowFv -# GetStatusResID__16CNavCenterWindowCFv -# GetValidStatusVersion__16CNavCenterWindowCFv -# GetWindowContext__16CNavCenterWindowCFv -# __ct__16CNavCenterWindowFP7LStream -# __dt__16CNavCenterWindowFv -#{data} -# __vt__16CNavCenterWindow - -### class CNavigationButtonPopup -#{code} -# AdjustMenuContents__22CNavigationButtonPopupFv -# AssertPreconditions__22CNavigationButtonPopupFv -# HandleNewValue__22CNavigationButtonPopupFl -# InsertHistoryItemIntoMenu__22CNavigationButtonPopupFls -# __ct__22CNavigationButtonPopupFP7LStream -# __dt__22CNavigationButtonPopupFv -#{data} -# __vt__22CNavigationButtonPopup - -### class CNetStreamToTapeFS -#{code} -# __ct__18CNetStreamToTapeFSFP10MWContext_P15ITapeFileSystem -# __dt__18CNetStreamToTapeFSFv -#{data} -# __vt__18CNetStreamToTapeFS - -### class CNetscapeWindow -#{code} -# CreateExtraFlavorAdder__15CNetscapeWindowCFv -# CreateURLForProxyDrag__15CNetscapeWindowFPc -# DisplayStatusMessageInAllWindows__15CNetscapeWindowFPCUc -# ObeyCommand__15CNetscapeWindowFlPv -# ShowOneDragBar__15CNetscapeWindowFlUc -# ToggleDragBar__15CNetscapeWindowFliPCc -# __ct__15CNetscapeWindowFP7LStreaml -# __dt__15CNetscapeWindowFv -#{data} -# __vt__15CNetscapeWindow - -### class CNotificationAttachment -#{code} -# ExecuteSelf__23CNotificationAttachmentFlPv -# Post__23CNotificationAttachmentFv -# Remove__23CNotificationAttachmentFv -# __ct__23CNotificationAttachmentFv -# __dt__23CNotificationAttachmentFv -#{data} -# __vt__23CNotificationAttachment -# sCurrentNotifier__23CNotificationAttachment - -### class CNotifierRegistry -#{code} -# HandleAppleEvent__17CNotifierRegistryFRC6AEDescR6AEDescR6AEDescl -# HandleRegisterProtocol__17CNotifierRegistryFRC6AEDescR6AEDescR6AEDescl -# HandleRegisterURLEcho__17CNotifierRegistryFRC6AEDescR6AEDescR6AEDescl -# HandleUnregisterProtocol__17CNotifierRegistryFRC6AEDescR6AEDescR6AEDescl -# HandleUnregisterURLEcho__17CNotifierRegistryFRC6AEDescR6AEDescR6AEDescl -# ReadProtocolHandlers__17CNotifierRegistryFv -# WriteProtocolHandlers__17CNotifierRegistryFv - -### class COffscreenCaption -#{code} -# DrawSelf__17COffscreenCaptionFv -# Draw__17COffscreenCaptionFPP6Region -# SetDescriptor__17COffscreenCaptionFPCUc -# SetDescriptor__17COffscreenCaptionFPCc -# SetEraseColor__17COffscreenCaptionFs -# __ct__17COffscreenCaptionFP7LStream -# __ct__17COffscreenCaptionFRC9SPaneInfoPCUcs -# __dt__17COffscreenCaptionFv -#{data} -# __vt__17COffscreenCaption - -### class COffscreenDrawable -#{code} -# AllocateOffscreen__18COffscreenDrawableFv -# LockDrawable__18COffscreenDrawableFP11CL_Drawable16CL_DrawableState -# RelinquishDrawable__18COffscreenDrawableFP11CL_Drawable -# SetDimensions__18COffscreenDrawableFll -# __ct__18COffscreenDrawableFv -# __dt__18COffscreenDrawableFv -#{data} -# __vt__18COffscreenDrawable -#{code} -# delete_offscreen__18COffscreenDrawableFv -#{data} -# mOffscreenDrawable__18COffscreenDrawable - -### class COnscreenDrawable -#{code} -# __ct__17COnscreenDrawableFv -# __dt__17COnscreenDrawableFv -#{data} -# __vt__17COnscreenDrawable - -### class COpenRecentlyEditedPopup -#{code} -# AdjustMenuContents__24COpenRecentlyEditedPopupFv -# AssertPreconditions__24COpenRecentlyEditedPopupFv -# CreateOpenRecentlyEditedPopupStream__24COpenRecentlyEditedPopupFP7LStream -# HandleNewValue__24COpenRecentlyEditedPopupFl -# InsertItemIntoMenu__24COpenRecentlyEditedPopupFPcs -# __ct__24COpenRecentlyEditedPopupFP7LStream -# __dt__24COpenRecentlyEditedPopupFv -#{data} -# __vt__24COpenRecentlyEditedPopup - -### class COtherSizeDialog -#{code} -# FinishCreateSelf__16COtherSizeDialogFv -# GetValue__16COtherSizeDialogCFv -# ListenToMessage__16COtherSizeDialogFlPv -# SetReference__16COtherSizeDialogFP8LControl -# SetValue__16COtherSizeDialogFl -# __ct__16COtherSizeDialogFP7LStream -# __dt__16COtherSizeDialogFv -#{data} -# __vt__16COtherSizeDialog - -### class CPaneEnabler -#{code} -# ExecuteSelf__12CPaneEnablerFlPv -# UpdatePanes__12CPaneEnablerFv -# __ct__12CPaneEnablerFP7LStream -# __dt__12CPaneEnablerFv -#{data} -# __vt__12CPaneEnabler - -### class CPaneMaster -#{code} -# __ct__11CPaneMasterFv -# __dt__11CPaneMasterFv -#{data} -# __vt__11CPaneMaster -# sPaneMaster__11CPaneMaster - -### class CParseState -#{code} -# EndBody__11CParseStateFv -# Free__11CParseStateFRP16CStreamOutMemory -# GetStream__11CParseStateFv -# InBody__11CParseStateFv -# Reset__11CParseStateFv -# StartBody__11CParseStateFv -# __ct__11CParseStateFv -# __dt__11CParseStateFv - -### class CPasteActionSnooper -#{code} -# DoDelete__19CPasteActionSnooperFc -# DoFilter__19CPasteActionSnooperFc -# DoReplace__19CPasteActionSnooperFcc -# StripLeading__19CPasteActionSnooperFc -# __ct__19CPasteActionSnooperFPP5TERecP10LCommanderP5LPanePcPc -# __dt__19CPasteActionSnooperFv -#{data} -# __vt__19CPasteActionSnooper - -### class CPasteSnooper -#{code} -# ExecuteSelf__13CPasteSnooperFlPv -# __ct__13CPasteSnooperFPcPc -# __dt__13CPasteSnooperFv -#{data} -# __vt__13CPasteSnooper - -### class CPatternBevelView -#{code} -# DrawBeveledFill__17CPatternBevelViewFv -# DrawBeveledFrame__17CPatternBevelViewFv -# DrawBeveledSub__17CPatternBevelViewFRC9SSubBevel -# __ct__17CPatternBevelViewFP7LStream -# __dt__17CPatternBevelViewFv -#{data} -# __vt__17CPatternBevelView - -### class CPatternButton -#{code} -# CalcOrientationPoint__14CPatternButtonFR5Point -# DrawButtonContent__14CPatternButtonFv -# DrawButtonGraphic__14CPatternButtonFv -# DrawButtonHilited__14CPatternButtonFv -# DrawButtonNormal__14CPatternButtonFv -# DrawButtonTitle__14CPatternButtonFv -# MouseEnter__14CPatternButtonF5PointRC11EventRecord -# MouseLeave__14CPatternButtonFv -# MouseWithin__14CPatternButtonF5PointRC11EventRecord -# __ct__14CPatternButtonFP7LStream -# __dt__14CPatternButtonFv -#{data} -# __vt__14CPatternButton - -### class CPatternButtonPopup -#{code} -# AdjustMenuContents__19CPatternButtonPopupFv -# AdoptMenu__19CPatternButtonPopupFP5LMenu -# BroadcastValueMessage__19CPatternButtonPopupFv -# EliminatePreviousMenu__19CPatternButtonPopupFv -# FinishCreateSelf__19CPatternButtonPopupFv -# GetMenu__19CPatternButtonPopupCFv -# GetPopupMenuPosition__19CPatternButtonPopupFR5Point -# HandleEnablingPolicy__19CPatternButtonPopupFv -# HandleNewValue__19CPatternButtonPopupFl -# HandlePopupMenuSelect__19CPatternButtonPopupF5PointsRsRs -# HandleQuickClick__19CPatternButtonPopupFv -# HotSpotResult__19CPatternButtonPopupFs -# MakeNewMenu__19CPatternButtonPopupFv -# OKToSendCommand__19CPatternButtonPopupFl -# OwnsMenu__19CPatternButtonPopupCFv -# SetMenu__19CPatternButtonPopupFP5LMenu -# SetPopupMinMaxValues__19CPatternButtonPopupFv -# SetValue__19CPatternButtonPopupFl -# SetupCurrentMenuItem__19CPatternButtonPopupFPP8MenuInfos -# TrackHotSpot__19CPatternButtonPopupFs5Points -# __ct__19CPatternButtonPopupFP7LStream -# __dt__19CPatternButtonPopupFv -#{data} -# __vt__19CPatternButtonPopup - -### class CPatternButtonPopupText -#{code} -# DrawButtonContent__23CPatternButtonPopupTextFv -# DrawButtonTitle__23CPatternButtonPopupTextFv -# DrawPopupArrow__23CPatternButtonPopupTextFv -# HandleEnablingPolicy__23CPatternButtonPopupTextFv -# HandleNewValue__23CPatternButtonPopupTextFl -# __ct__23CPatternButtonPopupTextFP7LStream -# __dt__23CPatternButtonPopupTextFv -#{data} -# __vt__23CPatternButtonPopupText - -### class CPatternPane -#{code} -# ActivateSelf__12CPatternPaneFv -# AdornWithBevel__12CPatternPaneFRC4Rect -# DeactivateSelf__12CPatternPaneFv -# DrawSelf__12CPatternPaneFv -# __ct__12CPatternPaneFP7LStream -# __dt__12CPatternPaneFv -#{data} -# __vt__12CPatternPane - -### class CPatternProgressBar -#{code} -# ActivateSelf__19CPatternProgressBarFv -# DeactivateSelf__19CPatternProgressBarFv -# DrawIndefiniteBar__19CPatternProgressBarFRC4Rect -# DrawPercentageBar__19CPatternProgressBarFRC4Rect -# DrawSeamlessBar__19CPatternProgressBarFRC4Rect -# DrawSelf__19CPatternProgressBarFv -# Draw__19CPatternProgressBarFPP6Region -# FinishCreateSelf__19CPatternProgressBarFv -# GetValue__19CPatternProgressBarCFv -# RecalcPoleMasks__19CPatternProgressBarFv -# ResizeFrameBy__19CPatternProgressBarFssUc -# SetSeamless__19CPatternProgressBarFv -# SetToIndefinite__19CPatternProgressBarFv -# SetValueRange__19CPatternProgressBarFUl -# SetValue__19CPatternProgressBarFl -# __ct__19CPatternProgressBarFP7LStream -# __dt__19CPatternProgressBarFv -#{data} -# __vt__19CPatternProgressBar - -### class CPatternProgressCaption -#{code} -# DrawSelf__23CPatternProgressCaptionFv -# GetDescriptor__23CPatternProgressCaptionCFPUc -# SetDescriptor__23CPatternProgressCaptionFPCUc -# SetDescriptor__23CPatternProgressCaptionFPCc -# __ct__23CPatternProgressCaptionFP7LStream -# __dt__23CPatternProgressCaptionFv -#{data} -# __vt__23CPatternProgressCaption - -### class CPatternTabControl -#{code} -# DrawCurrentTabSideClip__18CPatternTabControlFPP6Region -# DrawOneTabBackground__18CPatternTabControlFPP6RegionUc -# DrawOneTabFrame__18CPatternTabControlFPP6RegionUc -# __ct__18CPatternTabControlFP7LStream -# __dt__18CPatternTabControlFv -#{data} -# __vt__18CPatternTabControl - -### class CPatternedGrippyPane -#{code} -# DrawSelf__20CPatternedGrippyPaneFv -# MouseEnter__20CPatternedGrippyPaneF5PointRC11EventRecord -# MouseLeave__20CPatternedGrippyPaneFv -# __ct__20CPatternedGrippyPaneFP7LStream -# __dt__20CPatternedGrippyPaneFv -#{data} -# __vt__20CPatternedGrippyPane - -### class CPersistentEditInsertPoint -#{code} -# AddRelative__26CPersistentEditInsertPointFR26CPersistentEditInsertPointR26CPersistentEditInsertPoint -# ComputeDifference__26CPersistentEditInsertPointFR26CPersistentEditInsertPointR26CPersistentEditInsertPoint -# IsEqualUI__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint -# __ct__26CPersistentEditInsertPointFl -# __ct__26CPersistentEditInsertPointFlb -# __ct__26CPersistentEditInsertPointFv -# __eq__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint -# __ge__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint -# __gt__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint -# __le__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint -# __lt__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint -# __ne__26CPersistentEditInsertPointFRC26CPersistentEditInsertPoint - -### class CPersistentEditSelection -#{code} -# GetCount__24CPersistentEditSelectionFv -# GetEdge__24CPersistentEditSelectionFb -# IsInsertPoint__24CPersistentEditSelectionFv -# Map__24CPersistentEditSelectionFR24CPersistentEditSelectionR24CPersistentEditSelection -# SelectedRangeEqual__24CPersistentEditSelectionFRC24CPersistentEditSelection -# __ct__24CPersistentEditSelectionFRC26CPersistentEditInsertPointRC26CPersistentEditInsertPoint -# __ct__24CPersistentEditSelectionFv -# __eq__24CPersistentEditSelectionFRC24CPersistentEditSelection -# __ne__24CPersistentEditSelectionFRC24CPersistentEditSelection - -### class CPersonalToolbarTable -#{code} -# AddButton__21CPersonalToolbarTableFP18_HT_ResourceStructUl -# AddButton__21CPersonalToolbarTableFRC47basic_string,12allocator>RC47basic_string,12allocator>Ul -# ClickCell__21CPersonalToolbarTableFRC10STableCellRC15SMouseDownEvent -# ClickSelect__21CPersonalToolbarTableFRC10STableCellRC15SMouseDownEvent -# Click__21CPersonalToolbarTableFR15SMouseDownEvent -# ComputeFolderDropAreas__21CPersonalToolbarTableFRC4RectR4RectR4Rect -# ComputeItemDropAreas__21CPersonalToolbarTableFRC4RectR4RectR4Rect -# ComputeTextRect__21CPersonalToolbarTableFRC13SIconTableRecRC4Rect -# DoDragSendData__21CPersonalToolbarTableFUlUlP19OpaqueDragReference -# DrawCell__21CPersonalToolbarTableFRC10STableCellRC4Rect -# DrawDividingLine__21CPersonalToolbarTableFUl -# FillInToolbar__21CPersonalToolbarTableFv -# FindTooltipForMouseLocation__21CPersonalToolbarTableFRC11EventRecordPUc -# FinishCreateSelf__21CPersonalToolbarTableFv -# HandleDropOfHTResource__21CPersonalToolbarTableFP18_HT_ResourceStruct -# HandleDropOfLocalFile__21CPersonalToolbarTableFPCcPCcRC9HFSFlavor -# HandleDropOfPageProxy__21CPersonalToolbarTableFPCcPCc -# HandleDropOfText__21CPersonalToolbarTableFPCc -# HandleNotification__21CPersonalToolbarTableFP22_HT_NotificationStructP18_HT_ResourceStructUl -# HiliteDropArea__21CPersonalToolbarTableFP19OpaqueDragReference -# HiliteSelection__21CPersonalToolbarTableFUcUc -# InitializeButtonInfo__21CPersonalToolbarTableFv -# InsideDropArea__21CPersonalToolbarTableFP19OpaqueDragReference -# ItemIsAcceptable__21CPersonalToolbarTableFP19OpaqueDragReferenceUl -# LeaveDropArea__21CPersonalToolbarTableFP19OpaqueDragReference -# MouseLeave__21CPersonalToolbarTableFv -# MouseWithin__21CPersonalToolbarTableF5PointRC11EventRecord -# ReceiveDragItem__21CPersonalToolbarTableFP19OpaqueDragReferenceUlUlR4Rect -# RedrawCellWithHilite__21CPersonalToolbarTableF10STableCellb -# RedrawCellWithTextClipping__21CPersonalToolbarTableFRC10STableCell -# RemoveButton__21CPersonalToolbarTableFUl -# ResizeFrameBy__21CPersonalToolbarTableFssUc -# ToolbarChanged__21CPersonalToolbarTableFv -# __ct__21CPersonalToolbarTableFP7LStream -# __dt__21CPersonalToolbarTableFv -#{data} -# __vt__21CPersonalToolbarTable -# kMaxButtonCharsPref__21CPersonalToolbarTable -# kMinButtonCharsPref__21CPersonalToolbarTable -# mMaxToolbarButtonChars__21CPersonalToolbarTable -# mMinToolbarButtonChars__21CPersonalToolbarTable -# sSendDataUPP__21CPersonalToolbarTable - -### class CPlaceHolderView -#{code} -# AcquirePane__16CPlaceHolderViewFv -# FinishCreateSelf__16CPlaceHolderViewFv -# HideSelf__16CPlaceHolderViewFv -# InstallPane__16CPlaceHolderViewFP5LPane -# ReturnPane__16CPlaceHolderViewFv -# ShowSelf__16CPlaceHolderViewFv -# __ct__16CPlaceHolderViewFP7LStream -# __dt__16CPlaceHolderViewFv -#{data} -# __vt__16CPlaceHolderView - -### class CPlainTextConversionContext -#{code} -# Alert__27CPlainTextConversionContextFPCc -# AllConnectionsComplete__27CPlainTextConversionContextFv -# Confirm__27CPlainTextConversionContextFPCc -# DisplayBullet__27CPlainTextConversionContextFiP22LO_BulletStruct_struct -# DisplayHR__27CPlainTextConversionContextFiP25LO_HorizRuleStruct_struct -# DisplayLineFeed__27CPlainTextConversionContextFiP24LO_LinefeedStruct_structb -# DisplaySubDoc__27CPlainTextConversionContextFiP22LO_SubDocStruct_struct -# DisplaySubtext__27CPlainTextConversionContextFiP20LO_TextStruct_structllb -# DisplayTable__27CPlainTextConversionContextFiP21LO_TableStruct_struct -# DisplayText__27CPlainTextConversionContextFiP20LO_TextStruct_structb -# FinishedLayout__27CPlainTextConversionContextFv -# GetTextInfo__27CPlainTextConversionContextFP20LO_TextStruct_structP18LO_TextInfo_struct -# GraphProgressDestroy__27CPlainTextConversionContextFP11URL_Struct_ll -# GraphProgressInit__27CPlainTextConversionContextFP11URL_Struct_l -# GraphProgress__27CPlainTextConversionContextFP11URL_Struct_lll -# LayoutNewDocument__27CPlainTextConversionContextFP11URL_Struct_PlPlPlPl -# MeasureText__27CPlainTextConversionContextFP20LO_TextStruct_structPs -# Progress__27CPlainTextConversionContextFPCc -# PromptPassword__27CPlainTextConversionContextFPCc -# PromptUsernameAndPassword__27CPlainTextConversionContextFPCcPPcPPc -# Prompt__27CPlainTextConversionContextFPCcPCc -# TranslateISOText__27CPlainTextConversionContextFiPc -# __ct__27CPlainTextConversionContextFP10MWContext_ -# __dt__27CPlainTextConversionContextFv -#{data} -# __vt__27CPlainTextConversionContext - -### class CPluginHandler -#{code} -# CheckExistingHandlers__14CPluginHandlerFR6FSSpec -# CloseCodeResource__14CPluginHandlerFv -# FindHandlerForPlugin__14CPluginHandlerFRC7CStr255 -# InitCodeResource__14CPluginHandlerFP16_NPNetscapeFuncsP10_np_handle -# LoadPlugin__14CPluginHandlerFP16_NPNetscapeFuncsP10_np_handle -# OpenPluginResourceFork__14CPluginHandlerFs -# ResetPlugFuncTable__14CPluginHandlerFv -# __ct__14CPluginHandlerFR6FSSpec -# __dt__14CPluginHandlerFv -#{data} -# sHandlerList__14CPluginHandler - -### class CPluginView -#{code} -ActivateSelf__11CPluginViewFv -AdaptToNewSurroundings__11CPluginViewFv -AdaptToSuperFrameSize__11CPluginViewFllUc -AdjustCursorSelf__11CPluginViewF5PointRC11EventRecord -# AllocateMenuID__11CPluginViewFUc -BeTarget__11CPluginViewFv -# BroadcastPluginEvent__11CPluginViewFRC11EventRecord -# ClickSelf__11CPluginViewFRC15SMouseDownEvent -DeactivateSelf__11CPluginViewFv -DontBeTarget__11CPluginViewFv -DragIsAcceptable__11CPluginViewFP19OpaqueDragReference -# DrawBroken__11CPluginViewFUc -DrawSelf__11CPluginViewFv -# EmbedCreate__11CPluginViewFP10MWContext_P21LO_EmbedStruct_struct -# EmbedDisplay__11CPluginViewFP21LO_EmbedStruct_structUc -# EmbedFree__11CPluginViewFP10MWContext_P21LO_EmbedStruct_struct -# EmbedSize__11CPluginViewFP21LO_EmbedStruct_struct12SDimension16 -EventMouseUp__11CPluginViewFRC11EventRecord -# FindPlugin__11CPluginViewFP8GrafPort -HandleEmbedEvent__11CPluginViewFP8CL_Event -HandleKeyPress__11CPluginViewFRC11EventRecord -HiliteDropArea__11CPluginViewFP19OpaqueDragReference -# IsPluginCommand__11CPluginViewFl -MoveBy__11CPluginViewFllUc -ObeyCommand__11CPluginViewFlPv -# PassEvent__11CPluginViewFR11EventRecord -# PassWindowEvent__11CPluginViewFR11EventRecordP8GrafPort -# PluginWindowEvent__11CPluginViewFRC11EventRecord -# PrintEmbedded__11CPluginViewFv -# PrintFullScreen__11CPluginViewFUcPP6TPrint -# RegisterWindow__11CPluginViewFPv -# ResetDrawRect__11CPluginViewFv -# SetBrokenPlugin__11CPluginViewFv -SpendTime__11CPluginViewFRC11EventRecord -UnhiliteDropArea__11CPluginViewFP19OpaqueDragReference -# UnregisterWindow__11CPluginViewFPv -__ct__11CPluginViewFP7LStream -__dt__11CPluginViewFv -#{data} -# __vt__11CPluginView -# sPluginList__11CPluginView -# sPluginTarget__11CPluginView - -### class CPluginWindow -#{code} -# ActivateSelf__13CPluginWindowFv -# AdjustCursorSelf__13CPluginWindowF5PointRC11EventRecord -# DeactivateSelf__13CPluginWindowFv -# DrawSelf__13CPluginWindowFv -# EventMouseUp__13CPluginWindowFRC11EventRecord -# HandleClick__13CPluginWindowFRC11EventRecords -# HandleKeyPress__13CPluginWindowFRC11EventRecord -# ObeyCommand__13CPluginWindowFlPv -# SpendTime__13CPluginWindowFRC11EventRecord -# __ct__13CPluginWindowFP11CPluginViewP8GrafPort -# __dt__13CPluginWindowFv -#{data} -# __vt__13CPluginWindow - -### class CPrefCheckbox -#{code} -# FinishCreateSelf__13CPrefCheckboxFv -# __dt__13CPrefCheckboxFv -#{data} -# __vt__13CPrefCheckbox - -### class CPrefColorButton -#{code} -# FinishCreateSelf__16CPrefColorButtonFv -# __dt__16CPrefColorButtonFv -#{data} -# __vt__16CPrefColorButton - -### class CPrefFilePicker -#{code} -# Changed__15CPrefFilePickerCFv -# FinishCreateSelf__15CPrefFilePickerFv -# InitializeUsing__15CPrefFilePickerFPFPCcPPvPi_i -# ReadDefaultSelf__15CPrefFilePickerFv -# ReadSelf__15CPrefFilePickerFv -# __dt__15CPrefFilePickerFv -#{data} -# __vt__15CPrefFilePicker - -### class CPrefTextEdit -#{code} -# FinishCreateSelf__13CPrefTextEditFv -# __dt__13CPrefTextEditFv -#{data} -# __vt__13CPrefTextEdit - -### class CPrefs -#{code} -# CmdNumToDocCsid__6CPrefsFl -# CmdNumToWinCsid__6CPrefsFl -# ColorPrefCallback__6CPrefsFPCcPv -# Concat__6CPrefsFPCcPCc -# CreateDefaultAppMapper__6CPrefsFR6FSSpecPCcUc -# CreateDefaultUnknownMapper__6CPrefsFRC7CStr255Uc -CsidToScript__6CPrefsFs -# DoRead__6CPrefsFP5LFiles -# DoWrite__6CPrefsFv -# FSSpecPrefCallback__6CPrefsFPCcPv -# FindRequiredGutsFolder__6CPrefsFUc -# GetBoolean__6CPrefsFQ26CPrefs8PrefEnum -GetButtonFontTextResIDs__6CPrefsFUs -# GetCachePath__6CPrefsFv -# GetCharPtr__6CPrefsFQ26CPrefs8PrefEnum -# GetColor__6CPrefsFQ26CPrefs8PrefEnum -# GetFilePrototype__6CPrefsFQ26CPrefs8PrefEnum -GetFixFont__6CPrefsFUs -GetFolderSpec__6CPrefsFQ26CPrefs8PrefEnum -# GetFontAtIndex__6CPrefsFUlP8CCharSet -# GetFont__6CPrefsFUsP8CCharSet -# GetLong__6CPrefsFQ26CPrefs8PrefEnum -# GetPrintRecord__6CPrefsFv -GetProportionalFont__6CPrefsFUs -# GetStaticString__6CPrefsFv -# GetString__6CPrefsFQ26CPrefs8PrefEnum -# GetTempFilePrototype__6CPrefsFv -GetTextFieldTextResIDs__6CPrefsFUs -# HasCoBrand__6CPrefsFv -# InitPrefsFolder__6CPrefsFs -# InitializeUnsavedPref__6CPrefsFs -# Initialize__6CPrefsFv -# IsLocked__6CPrefsFQ26CPrefs8PrefEnum -# OpenAnimationFile__6CPrefsFR6FSSpecR6FSSpec -# PostInitializePref__6CPrefsFQ26CPrefs8PrefEnumUc -# Read1MimeTypes__6CPrefsFv -# ReadAllPreferences__6CPrefsFv -# ReadCharacterEncodings__6CPrefsFv -# ReadMimeTypes__6CPrefsFv -# ReadPreference__6CPrefsFs -# ReadWindowData__6CPrefsFs -# ReadXPFont__6CPrefsFsP8CCharSet -# RegisterPrefCallbacks__6CPrefsFv -# SetBoolean__6CPrefsFUcQ26CPrefs8PrefEnum -# SetColor__6CPrefsFRC8RGBColorQ26CPrefs8PrefEnum -# SetFolderSpec__6CPrefsFRC6FSSpecQ26CPrefs8PrefEnum -# SetFont__6CPrefsFRC7CStr255RC7CStr255RC7CStr255UsUsUsUsUsUs -# SetLong__6CPrefsFlQ26CPrefs8PrefEnum -# SetModified__6CPrefsFv -# SetString__6CPrefsFPCcQ26CPrefs8PrefEnum -# SubscribeToPrefChanges__6CPrefsFP9LListener -# UnsubscribeToPrefChanges__6CPrefsFP9LListener -# UseApplicationResFile__6CPrefsFv -# UsePreferencesResFile__6CPrefsFv -# WinCsidToCmdNum__6CPrefsFs -# WriteAllPreferences__6CPrefsFv -# WritePreference__6CPrefsFs -# WriteWindowData__6CPrefsFPPcs -#{data} -# fCharSetFonts__6CPrefs -# fDefaultFont__6CPrefs -# sCachePath__6CPrefs -# sColors__6CPrefs -# sFileIDs__6CPrefs -# sMimeTypes__6CPrefs -# sPrefFileVersion__6CPrefs -# sPrintRec__6CPrefs -# sRealTemporaryFolder__6CPrefs -# sTemporaryFolder__6CPrefs -# sViewSourceInline__6CPrefs - -### class CPrefsDialog -#{code} -# AllowTargetSwitch__12CPrefsDialogFP10LCommander -# DoPrefsWindow__12CPrefsDialogFQ212CPrefsDialog8Expand_TQ210PrefPaneID2IDQ212CPrefsDialog11Selection_T -# EditPrefs__12CPrefsDialogFQ212CPrefsDialog8Expand_TQ210PrefPaneID2IDQ212CPrefsDialog11Selection_T -# FindCommandStatus__12CPrefsDialogFlRUcRUcRUsPUc -# FindMediator__12CPrefsDialogFs -# Finished__12CPrefsDialogFv -# GetMediator__12CPrefsDialogFs -# ListenToMessage__12CPrefsDialogFlPv -# LoadICDependent__12CPrefsDialogFv -# RegisterViewClasses__12CPrefsDialogFv -# __ct__12CPrefsDialogFv -# __dt__12CPrefsDialogFv -#{data} -# __vt__12CPrefsDialog -# sThis__12CPrefsDialog - -### class CPrefsMediator -#{code} -# ActivateHelp__14CPrefsMediatorFv -# CanSwitch__14CPrefsMediatorFP10LCommander -# Canceled__14CPrefsMediatorFv -# ChangePrefName__14CPrefsMediatorFlPCc -# GetPreferenceObject__14CPrefsMediatorCFl -# ListenToMessage__14CPrefsMediatorFlPv -# LoadMainPane__14CPrefsMediatorFv -# LoadPanes__14CPrefsMediatorFv -# LoadPrefs__14CPrefsMediatorFv -# PaneHasLockedPref__14CPrefsMediatorCFl -# ReadDefaultPref__14CPrefsMediatorFl -# RegisterViewClasses__14CPrefsMediatorFv -# SelectFirstEnabledEditField__14CPrefsMediatorFv -# SetEditFieldWithLocalFileURL__14CPrefsMediatorFlUc -# SetEditFieldsWithICPref__14CPrefsMediatorFPCUclUclUcl -# SetFontSizePopupWithIntPref__14CPrefsMediatorFPCclRUci -# SetIntPrefWithFontSizePopup__14CPrefsMediatorFPCclUc -# SetValidationFunction__14CPrefsMediatorCFlPFP15CValidEditField_Uc -# StepAside__14CPrefsMediatorFv -# StepForward__14CPrefsMediatorFP10LCommander -# UpdateFromIC__14CPrefsMediatorFv -# WritePrefs__14CPrefsMediatorFv -# __ct__14CPrefsMediatorFl -# __dt__14CPrefsMediatorFv -#{data} -# __vt__14CPrefsMediator -# sInitialSelection__14CPrefsMediator -# sPanel__14CPrefsMediator -# sUseIC__14CPrefsMediator -# sWindow__14CPrefsMediator - -### class CPrintContext -#{code} -# __ct__13CPrintContextFv -# __dt__13CPrintContextFv -#{data} -# __vt__13CPrintContext - -### class CPrintHTMLView -#{code} -# AdaptToSuperFrameSize__14CPrintHTMLViewFllUc -# BelongsOnPage__14CPrintHTMLViewFP17LO_Element_struct -# BelongsOnPage__14CPrintHTMLViewFP27LO_FormElementStruct_struct -# CalculatePageBreaks__14CPrintHTMLViewFv -# CapturePosition__14CPrintHTMLViewFP17LO_Element_struct -# CopyCharacteristicsFrom__14CPrintHTMLViewFPC9CHTMLView -# CountPanels__14CPrintHTMLViewFRUlRUl -# CreateGridView__14CPrintHTMLViewFP15CBrowserContextllllScb -# DisplayBullet__14CPrintHTMLViewFiP22LO_BulletStruct_struct -# DisplayCell__14CPrintHTMLViewFiP20LO_CellStruct_struct -# DisplayEdge__14CPrintHTMLViewFiP20LO_EdgeStruct_struct -# DisplayEmbed__14CPrintHTMLViewFiP21LO_EmbedStruct_struct -# DisplayFormElement__14CPrintHTMLViewFiP27LO_FormElementStruct_struct -# DisplayHR__14CPrintHTMLViewFiP25LO_HorizRuleStruct_struct -# DisplayLineFeed__14CPrintHTMLViewFiP24LO_LinefeedStruct_structb -# DisplaySubtext__14CPrintHTMLViewFiP20LO_TextStruct_structllb -# DisplayTable__14CPrintHTMLViewFiP21LO_TableStruct_struct -# DisplayText__14CPrintHTMLViewFiP20LO_TextStruct_structb -# DrawBackground__14CPrintHTMLViewFRC4RectP21LO_ImageStruct_struct -# DrawFrameFocus__14CPrintHTMLViewFv -# EraseBackground__14CPrintHTMLViewFillUlUlP15LO_Color_struct -# FinishCreateSelf__14CPrintHTMLViewFv -# GetFullGridSize__14CPrintHTMLViewFRlRl -# InitializeCapture__14CPrintHTMLViewFv -# InstallBackgroundColor__14CPrintHTMLViewFv -# ResetBackgroundColor__14CPrintHTMLViewCFv -# ScrollToPanel__14CPrintHTMLViewFRC9PanelSpec -# __ct__14CPrintHTMLViewFP7LStream -# __dt__14CPrintHTMLViewFv -#{data} -# __vt__14CPrintHTMLView - -### class CPrintHeaderCaption -#{code} -# CreateString__19CPrintHeaderCaptionFlR7CStr255RC9PanelSpec -# PrintPanelSelf__19CPrintHeaderCaptionFRC9PanelSpec -# __ct__19CPrintHeaderCaptionFP7LStream -# __dt__19CPrintHeaderCaptionFv -#{data} -# __vt__19CPrintHeaderCaption -# sContext__19CPrintHeaderCaption -# sIsTemporaryFile__19CPrintHeaderCaption - -### class CPrintState -#{code} -# PrintSelectionComment__11CPrintStateFbb -# Reset__11CPrintStateFP10IStreamOutP11CEditBuffer -# ShouldPrintSelectionComment__11CPrintStateFP16CEditLeafElementb -# ShouldPrintSelectionComments__11CPrintStateFP16CEditLeafElement -# __dt__11CPrintStateFv - -### class CPrintingCleanupTimer -#{code} -# QueueCleanup__21CPrintingCleanupTimerFv -# SpendTime__21CPrintingCleanupTimerFRC11EventRecord -# __ct__21CPrintingCleanupTimerFv -# __dt__21CPrintingCleanupTimerFv -#{data} -# __vt__21CPrintingCleanupTimer -# sTheTimer__21CPrintingCleanupTimer - -### class CProfilePaneMonitor -#{code} -# ListenToMessage__19CProfilePaneMonitorFlPv -# __ct__19CProfilePaneMonitorFP20CDialogWizardHandler -# __dt__19CProfilePaneMonitorFv -#{data} -# __vt__19CProfilePaneMonitor - -### class CProgressBar -#{code} -# ActivateSelf__12CProgressBarFv -# DeactivateSelf__12CProgressBarFv -# DrawIndefiniteBar__12CProgressBarFR4Rect -# DrawPercentageBar__12CProgressBarFR4RectRC8RGBColorRC8RGBColor -# DrawSelf__12CProgressBarFv -# FinishCreateSelf__12CProgressBarFv -# GetActiveColors__12CProgressBarCFR8RGBColorR8RGBColorR8RGBColor -# GetValue__12CProgressBarCFv -# SetToIndefinite__12CProgressBarFv -# SetValue__12CProgressBarFl -# __ct__12CProgressBarFP7LStream -# __dt__12CProgressBarFv -#{data} -# __vt__12CProgressBar - -### class CProgressCaption -#{code} -# DrawSelf__16CProgressCaptionFv -# Draw__16CProgressCaptionFPP6Region -# GetActiveColors__16CProgressCaptionCFR8RGBColorR8RGBColorR8RGBColor -# GetDescriptor__16CProgressCaptionCFPUc -# SetDescriptor__16CProgressCaptionFPCUc -# SetDescriptor__16CProgressCaptionFPCc -# SetEraseColor__16CProgressCaptionFs -# SetHidden__16CProgressCaptionFv -# __ct__16CProgressCaptionFP7LStream -# __dt__16CProgressCaptionFv -#{data} -# __vt__16CProgressCaption - -### class CProgressListener -#{code} -# ListenToMessage__17CProgressListenerFlPv -# SetLaziness__17CProgressListenerFQ217CProgressListener19ProgressBarLaziness -# __ct__17CProgressListenerFP5LViewP12LBroadcaster -# __dt__17CProgressListenerFv -#{data} -# __vt__17CProgressListener - -### class CProtocolHelper -#{code} -# AddNewHelper__15CProtocolHelperFP15CProtocolHelper -# AttemptLaunch__15CProtocolHelperFP11URL_Struct_P10MWContext_ -# EqualTo__15CProtocolHelperFPcUl -# __ct__15CProtocolHelperFPcUl -# __dt__15CProtocolHelperFv -# __eq__15CProtocolHelperFP15CProtocolHelper -#{data} -# __vt__15CProtocolHelper - -### class CProxyCaption -#{code} -# DrawSelf__13CProxyCaptionFv -# DrawText__13CProxyCaptionFPclRC4Rect -# FinishCreateSelf__13CProxyCaptionFv -# SetDescriptor__13CProxyCaptionFPCUc -# __ct__13CProxyCaptionFP7LStream -# __dt__13CProxyCaptionFv -#{data} -# __vt__13CProxyCaption - -### class CProxyDragTask -#{code} -# AddFlavors__14CProxyDragTaskFP19OpaqueDragReference -# DoDrag__14CProxyDragTaskFv -# DoNormalDrag__14CProxyDragTaskFv -# DoTranslucentDrag__14CProxyDragTaskFv -# MakeDragRegion__14CProxyDragTaskFP19OpaqueDragReferencePP6Region -# __ct__14CProxyDragTaskFR5LViewR10CProxyPaneR8LCaptionRC11EventRecordP17CExtraFlavorAdder -# __dt__14CProxyDragTaskFv -#{data} -# __vt__14CProxyDragTask - -### class CProxyPane -#{code} -# ActivateSelf__10CProxyPaneFv -# ClickSelf__10CProxyPaneFRC15SMouseDownEvent -# Click__10CProxyPaneFR15SMouseDownEvent -# DeactivateSelf__10CProxyPaneFv -# DoDragSendData__10CProxyPaneFUlUlP19OpaqueDragReference -# FinishCreateSelf__10CProxyPaneFv -# HandleEnablingPolicy__10CProxyPaneFv -# ListenToMessage__10CProxyPaneFlPv -# MouseEnter__10CProxyPaneF5PointRC11EventRecord -# MouseLeave__10CProxyPaneFv -# ToggleIconSelected__10CProxyPaneFUc -# ToggleIcon__10CProxyPaneFs -# __ct__10CProxyPaneFP7LStream -# __dt__10CProxyPaneFv -# __dt__Q210CProxyPane20StToggleIconSelectedFv -#{data} -# __vt__10CProxyPane - -### class CPublish -#{code} -# CommitChanges__8CPublishFUc -# DocName__8CPublishFv -# FinishCreateSelf__8CPublishFv -# Help__8CPublishFv -# InitializeDialogControls__8CPublishFv -# ListenToMessage__8CPublishFlPv -# __ct__8CPublishFP7LStream -# __dt__8CPublishFv -#{data} -# __vt__8CPublish - -### class CPublishHistory -#{code} -# AddPublishHistoryEntry__15CPublishHistoryFPc -# GetPublishHistoryCharPtr__15CPublishHistoryFs -# IsTherePublishHistory__15CPublishHistoryFv -# SetPublishHistoryCharPtr__15CPublishHistoryFPcs - -### class CRDFCoordinator -#{code} -# CollapseNode__15CRDFCoordinatorFP18_HT_ResourceStruct -# ExpandNode__15CRDFCoordinatorFP18_HT_ResourceStruct -# FinishCreateSelf__15CRDFCoordinatorFv -# HandleKeyPress__15CRDFCoordinatorFRC11EventRecord -# HandleNotification__15CRDFCoordinatorFP22_HT_NotificationStructP18_HT_ResourceStructUl -# ListenToMessage__15CRDFCoordinatorFlPv -# ObeyCommand__15CRDFCoordinatorFlPv -#{data} -# Pref_EditWorkspace__15CRDFCoordinator -# Pref_ShowNavCenterSelector__15CRDFCoordinator -# Pref_ShowNavCenterShelf__15CRDFCoordinator -#{code} -# RegisterNavCenter__15CRDFCoordinatorFP10MWContext_ -# RestorePlace__15CRDFCoordinatorFP7LStream -# SavePlace__15CRDFCoordinatorFP7LStream -# SelectView__15CRDFCoordinatorF12_HT_ViewType -# SelectView__15CRDFCoordinatorFP14_HT_ViewStruct -# UnregisterNavCenter__15CRDFCoordinatorFv -# __ct__15CRDFCoordinatorFP7LStream -# __dt__15CRDFCoordinatorFv -#{data} -# __vt__15CRDFCoordinator - -### class CRDFNotificationHandler -#{code} -# CreateHTPane__23CRDFNotificationHandlerFv -# CreateNotificationStruct__23CRDFNotificationHandlerFv -#{data} -# __vt__23CRDFNotificationHandler -#{code} -# rdfNotifyProc__23CRDFNotificationHandlerFP22_HT_NotificationStructP18_HT_ResourceStructUl - -### class CRecentEditMenuAttachment -#{code} -# ExecuteSelf__25CRecentEditMenuAttachmentFlPv -# GetMenu__25CRecentEditMenuAttachmentFv -# GetTopWindowContext__25CRecentEditMenuAttachmentFv -# InstallMenus__25CRecentEditMenuAttachmentFv -# RemoveMenus__25CRecentEditMenuAttachmentFv -# UpdateMenu__25CRecentEditMenuAttachmentFv -# __ct__25CRecentEditMenuAttachmentFv -# __dt__25CRecentEditMenuAttachmentFv -#{data} -# __vt__25CRecentEditMenuAttachment -# sMenu__25CRecentEditMenuAttachment - -### class CRelayoutTimer -#{code} -# Flush__14CRelayoutTimerFv -# OnCallback__14CRelayoutTimerFv -# Relayout__14CRelayoutTimerFP12CEditElementi -# SetEditBuffer__14CRelayoutTimerFP11CEditBuffer -# __ct__14CRelayoutTimerFv -# __dt__14CRelayoutTimerFv -#{data} -# __vt__14CRelayoutTimer - -### class CResPicture -#{code} -# DrawSelf__11CResPictureFv -# __ct__11CResPictureFP7LStream -# __dt__11CResPictureFv -#{data} -# __vt__11CResPicture - -### class CResumeEventAttachment -#{code} -# ExecuteSelf__22CResumeEventAttachmentFlPv -# __dt__22CResumeEventAttachmentFv -#{data} -# __vt__22CResumeEventAttachment - -### class CRouterDrawable -#{code} -# CopyPixels__15CRouterDrawableFP9CDrawablePv -# GetLayerClip__15CRouterDrawableFv -# GetLayerOrigin__15CRouterDrawableFPlPl -# HasClipChanged__15CRouterDrawableFv -# SetLayerClip__15CRouterDrawableFPv -# SetLayerOrigin__15CRouterDrawableFll -# __ct__15CRouterDrawableFv -#{data} -# __vt__15CRouterDrawable - -### class CSaveProgress -#{code} -# FinishCreateSelf__13CSaveProgressFv -# ListenToMessage__13CSaveProgressFlPv -# SetFilename__13CSaveProgressFPc -# __dt__13CSaveProgressFv -#{data} -# __vt__13CSaveProgress - -### class CSaveWindowStatus -#{code} -# AttemptCloseWindow__17CSaveWindowStatusFv -# CreateWindow__17CSaveWindowStatusFsP10LCommander -# FinishCreateWindow__17CSaveWindowStatusFP17CSaveWindowStatus -# FinishCreateWindow__17CSaveWindowStatusFv -# GetPaneGlobalBounds__17CSaveWindowStatusFP5LPaneP4Rect -# MoveWindowToAlertPosition__17CSaveWindowStatusFP7LWindow -# MoveWindowTo__17CSaveWindowStatusFP7LWindow5Point -# ReadWindowStatus__17CSaveWindowStatusFP7LStream -# SaveStatusInfo__17CSaveWindowStatusFv -# VerifyWindowBounds__17CSaveWindowStatusFP7LWindowP4Rect -# WriteWindowStatus__17CSaveWindowStatusFP7LStream -#{data} -# __vt__17CSaveWindowStatus - -### class CScrollArrowControl -#{code} -# DrawSelf__19CScrollArrowControlFv -# HotSpotAction__19CScrollArrowControlFsUcUc -# __ct__19CScrollArrowControlFP7LStream -# __ct__19CScrollArrowControlFRC9SPaneInfoRC12SControlInfos -# __dt__19CScrollArrowControlFv -#{data} -# __vt__19CScrollArrowControl - -### class CScrollerWithArrows -#{code} -# ActivateSelf__19CScrollerWithArrowsFv -# AdjustScrollArrows__19CScrollerWithArrowsFv -# DeactivateSelf__19CScrollerWithArrowsFv -# ExpandSubPane__19CScrollerWithArrowsFP5LPaneUcUc -# FinishCreateSelf__19CScrollerWithArrowsFv -# InstallView__19CScrollerWithArrowsFP5LView -# ListenToMessage__19CScrollerWithArrowsFlPv -# MakeOneScrollArrow__19CScrollerWithArrowsFRC9SPaneInfoQ219CScrollerWithArrows9ScrollDir -# MakeScrollArrows__19CScrollerWithArrowsFssss -# ResizeFrameBy__19CScrollerWithArrowsFssUc -# SubImageChanged__19CScrollerWithArrowsFP5LView -# __ct__19CScrollerWithArrowsFP7LStream -# __ct__19CScrollerWithArrowsFv -# __dt__19CScrollerWithArrowsFv -#{data} -# __vt__19CScrollerWithArrows - -### class CSecureAttachment -#{code} -# ExecuteSelf__17CSecureAttachmentFlPv -# __ct__17CSecureAttachmentFv -# __dt__17CSecureAttachmentFv -#{data} -# __vt__17CSecureAttachment - -### class CSecurityStateListener -#{code} -# ListenToMessage__22CSecurityStateListenerFlPv -# __ct__22CSecurityStateListenerFv -# __dt__22CSecurityStateListenerFv -#{data} -# __vt__22CSecurityStateListener - -### class CSetListDataCommand -#{code} -# Do__19CSetListDataCommandFv -# Redo__19CSetListDataCommandFv -# Undo__19CSetListDataCommandFv -# __ct__19CSetListDataCommandFP11CEditBufferR13_EDT_ListDatai -# __dt__19CSetListDataCommandFv -#{data} -# __vt__19CSetListDataCommand - -### class CSetMetaDataCommand -#{code} -# Redo__19CSetMetaDataCommandFv -# Undo__19CSetMetaDataCommandFv -# __ct__19CSetMetaDataCommandFP11CEditBufferP13_EDT_MetaDatabi -# __dt__19CSetMetaDataCommandFv -#{data} -# __vt__19CSetMetaDataCommand - -### class CSetSelectionCommand -#{code} -# Do__20CSetSelectionCommandFv -# Redo__20CSetSelectionCommandFv -# Undo__20CSetSelectionCommandFv -# __ct__20CSetSelectionCommandFP11CEditBufferR14CEditSelectioni -# __dt__20CSetSelectionCommandFv -#{data} -# __vt__20CSetSelectionCommand - -### class CSetTableCaptionDataCommand -#{code} -# Redo__27CSetTableCaptionDataCommandFv -# Undo__27CSetTableCaptionDataCommandFv -# __ct__27CSetTableCaptionDataCommandFP11CEditBufferP21_EDT_TableCaptionDatai -# __dt__27CSetTableCaptionDataCommandFv -#{data} -# __vt__27CSetTableCaptionDataCommand - -### class CSetTableCellDataCommand -#{code} -# Redo__24CSetTableCellDataCommandFv -# Undo__24CSetTableCellDataCommandFv -# __ct__24CSetTableCellDataCommandFP11CEditBufferP18_EDT_TableCellDatai -# __dt__24CSetTableCellDataCommandFv -#{data} -# __vt__24CSetTableCellDataCommand - -### class CSetTableDataCommand -#{code} -# Redo__20CSetTableDataCommandFv -# Undo__20CSetTableDataCommandFv -# __ct__20CSetTableDataCommandFP11CEditBufferP14_EDT_TableDatai -# __dt__20CSetTableDataCommandFv -#{data} -# __vt__20CSetTableDataCommand - -### class CSetTableRowDataCommand -#{code} -# Redo__23CSetTableRowDataCommandFv -# Undo__23CSetTableRowDataCommandFv -# __ct__23CSetTableRowDataCommandFP11CEditBufferP17_EDT_TableRowDatai -# __dt__23CSetTableRowDataCommandFv -#{data} -# __vt__23CSetTableRowDataCommand - -### class CSharableCompositor -#{code} -# __dt__19CSharableCompositorFv -#{data} -# __vt__19CSharableCompositor - -### class CSharedPatternWorld -#{code} -# CalcRelativePoint__19CSharedPatternWorldFP5LPaneQ219CSharedPatternWorld19EPatternOrientationR5Point -# CreateSharedPatternWorld__19CSharedPatternWorldFs -# FillDeep__19CSharedPatternWorldFP9CGrafPortRC4Rect5Point -# FillShallow__19CSharedPatternWorldFP9CGrafPortRC4Rect5Point -# Fill__19CSharedPatternWorldFP9CGrafPortPP6Region5Point -# Fill__19CSharedPatternWorldFP9CGrafPortRC4Rect5Point -# __ct__19CSharedPatternWorldFs -# __dt__19CSharedPatternWorldFv -#{data} -# __vt__19CSharedPatternWorld -# sPatterns__19CSharedPatternWorld -# sUseUtilityPattern__19CSharedPatternWorld - -### class CSharedToolTipAttachment -#{code} -# CalcTipText__24CSharedToolTipAttachmentFP7LWindowP5LPaneRC11EventRecordPUc -# __ct__24CSharedToolTipAttachmentFP7LStream -# __dt__24CSharedToolTipAttachmentFv -#{data} -# __vt__24CSharedToolTipAttachment - -### class CSharedWorld -#{code} -# __ct__12CSharedWorldFRC4RectsUl -# __dt__12CSharedWorldFv -#{data} -# __vt__12CSharedWorld - -### class CShelf -#{code} -# IsShelfOpen__6CShelfFv -# SetShelfState__6CShelfFbb -# ToggleShelf__6CShelfFb -# __ct__6CShelfFP12LDividedViewPCc -# __dt__6CShelfFv -#{data} -# __vt__6CShelf - -### class CSicn -#{code} -# CopyImage__5CSicnFRC4Rects -# LoadSicnData__5CSicnFss -# Plot__5CSicnFRC4Rects -# Plot__5CSicnFs -# __ct__5CSicnFss -# __ct__5CSicnFv - -### class CSimpleDividedView -#{code} -# AdaptToSuperFrameSize__18CSimpleDividedViewFllUc -# AdjustCursorSelf__18CSimpleDividedViewF5PointRC11EventRecord -# ClickSelf__18CSimpleDividedViewFRC15SMouseDownEvent -# FinishCreateSelf__18CSimpleDividedViewFv -# GetViewRects__18CSimpleDividedViewFR4RectR4Rect -# ReadjustConstraints__18CSimpleDividedViewFv -# RepositionView__18CSimpleDividedViewFv -# __ct__18CSimpleDividedViewFP7LStream -# __dt__18CSimpleDividedViewFv -#{data} -# __vt__18CSimpleDividedView - -### class CSimpleTextView -#{code} -# BeTarget__15CSimpleTextViewFv -# ClickSelf__15CSimpleTextViewFRC15SMouseDownEvent -# DontBeTarget__15CSimpleTextViewFv -# FindCommandStatus__15CSimpleTextViewFlRUcRUcRUsPUc -# FinishCreateSelf__15CSimpleTextViewFv -# Initialize__15CSimpleTextViewFv -# IsReadOnly__15CSimpleTextViewFv -# ObeyCommand__15CSimpleTextViewFlPv -# Save__15CSimpleTextViewFRC6FSSpec -# SetInitialText__15CSimpleTextViewFs -# SetInitialTraits__15CSimpleTextViewFs -# SetReadOnly__15CSimpleTextViewFUc -# TSMPreUpdate__15CSimpleTextViewFP17OpaqueWEReference -# __ct__15CSimpleTextViewFP7LStream -# __ct__15CSimpleTextViewFv -# __dt__15CSimpleTextViewFv -#{data} -# __vt__15CSimpleTextView -# sHasTSM__15CSimpleTextView -# sInitialized__15CSimpleTextView -# sPreUpdateUPP__15CSimpleTextView -# sTargetView__15CSimpleTextView - -### class CSingleTextColumn -#{code} -# ClickCell__17CSingleTextColumnFRC10STableCellRC15SMouseDownEvent -# ClickSelf__17CSingleTextColumnFRC15SMouseDownEvent -# DrawCell__17CSingleTextColumnFRC10STableCellRC4Rect -# DrawSelf__17CSingleTextColumnFv -# InitSingleTextColumn__17CSingleTextColumnFv -# __ct__17CSingleTextColumnFP7LStream -# __dt__17CSingleTextColumnFv -#{data} -# __vt__17CSingleTextColumn - -### class CSizeBox -#{code} -# ActivateSelf__8CSizeBoxFv -# ClickSelf__8CSizeBoxFRC15SMouseDownEvent -# DeactivateSelf__8CSizeBoxFv -# DrawSelf__8CSizeBoxFv -# __dt__8CSizeBoxFv -#{data} -# __vt__8CSizeBox - -### class CSizePopup -#{code} -# DrawPopupArrow__10CSizePopupFv -# DrawPopupTitle__10CSizePopupFv -# GetFontSizeFromMenuItem__10CSizePopupCFl -# GetMenuSize__10CSizePopupCFv -# MarkRealFontSizes__10CSizePopupFP8LGAPopup -# MarkRealFontSizes__10CSizePopupFs -# SetFontSize__10CSizePopupFl -# SetUpCurrentMenuItem__10CSizePopupFPP8MenuInfos -# SetValue__10CSizePopupFl -# TrackHotSpot__10CSizePopupFs5Points -# __ct__10CSizePopupFP7LStream -# __dt__10CSizePopupFv -#{data} -# __vt__10CSizePopup - -### class CSizingObject -#{code} -# Create__13CSizingObjectFP11CEditBufferP17LO_Element_structillbP8_XP_Rect -# EraseAddRowsOrCols__13CSizingObjectFv -# GetSizingRect__13CSizingObjectFllbP8_XP_Rect -# ResizeObject__13CSizingObjectFv -# __ct__13CSizingObjectFv -# __dt__13CSizingObjectFv - -### class CSlaveEnabler -#{code} -# ExecuteSelf__13CSlaveEnablerFlPv -# ListenToMessage__13CSlaveEnablerFlPv -# Update__13CSlaveEnablerFl -# __ct__13CSlaveEnablerFP7LStream -# __dt__13CSlaveEnablerFv -#{data} -# __vt__13CSlaveEnabler - -### class CSpecialTableView -#{code} -# SetNotifyOnSelectionChange__17CSpecialTableViewFUc -# __dt__17CSpecialTableViewFv -#{data} -# __vt__17CSpecialTableView - -### class CSpinningN -#{code} -# ActivateSelf__10CSpinningNFv -# AdaptToSuperFrameSize__10CSpinningNFllUc -# CalcAnimationMode__10CSpinningNFv -# ChangeMode__10CSpinningNFScR12SDimension16 -# DeactivateSelf__10CSpinningNFv -# DisableSelf__10CSpinningNFv -# DrawButtonContent__10CSpinningNFv -# DrawButtonGraphic__10CSpinningNFv -# DrawSelfDisabled__10CSpinningNFv -# DrawSelf__10CSpinningNFv -# EnableSelf__10CSpinningNFv -# FinishCreateSelf__10CSpinningNFv -# GetLargeIconFrameSize__10CSpinningNFR12SDimension16 -# GetSmallIconFrameSize__10CSpinningNFR12SDimension16 -# ListenToMessage__10CSpinningNFlPv -# RepositionSelf__10CSpinningNFP12SDimension16 -# SpendTime__10CSpinningNFRC11EventRecord -# StartRepeating__10CSpinningNFv -# StopRepeating__10CSpinningNFv -# StopSpinningNow__10CSpinningNFv -# __ct__10CSpinningNFP7LStream -# __dt__10CSpinningNFv -#{data} -# __vt__10CSpinningN -# mAnimResFile__10CSpinningN - -### class CSplashScreen -#{code} -# FinishCreateSelf__13CSplashScreenFv -# SetDescriptor__13CSplashScreenFPCUc -# __ct__13CSplashScreenFP7LStream -# __dt__13CSplashScreenFv -#{data} -# __vt__13CSplashScreen - -### class CStLayerOriginSetter -#{code} -# __ct__20CStLayerOriginSetterFP9CHTMLViewP8CL_Layer -# __dt__20CStLayerOriginSetterFv - -### class CStandardFlexTable -#{code} -# AddAttachmentFirst__18CStandardFlexTableFP11LAttachmentUc -# AddRowDataToDrag__18CStandardFlexTableFUlP19OpaqueDragReference -# AddSelectionToDrag__18CStandardFlexTableFP19OpaqueDragReferencePP6Region -# ApplyTextStyle__18CStandardFlexTableCFUl -# BeTarget__18CStandardFlexTableFv -# CanDoInlineEditing__18CStandardFlexTableFv -# CellHasDropFlag__18CStandardFlexTableCFRC10STableCellRUc -# CellInitiatesDrag__18CStandardFlexTableCFRC10STableCell -# CellSelects__18CStandardFlexTableCFRC10STableCell -# CellWantsClick__18CStandardFlexTableCFRC10STableCell -# ChangeSort__18CStandardFlexTableFPCQ212LTableHeader10SortChange -# ClickDropFlag__18CStandardFlexTableFRC10STableCellRC15SMouseDownEvent -# ClickSelect__18CStandardFlexTableFRC10STableCellRC15SMouseDownEvent -# ClickSelf__18CStandardFlexTableFRC15SMouseDownEvent -# Click__18CStandardFlexTableFR15SMouseDownEvent -# ComputeFolderDropAreas__18CStandardFlexTableFRC4RectR4RectR4Rect -# ComputeItemDropAreas__18CStandardFlexTableFRC4RectR4RectR4Rect -# CountExtraRowsControlledByCell__18CStandardFlexTableCFRC10STableCell -# DoHiliteRect__18CStandardFlexTableCFRC4Rect -# DoHiliteRgn__18CStandardFlexTableCFPP6Region -# DoInlineEditing__18CStandardFlexTableFRC10STableCell -# DoInlineEditing__18CStandardFlexTableFRC10STableCellR4Rect -# DontBeTarget__18CStandardFlexTableFv -# DragSelection__18CStandardFlexTableFRC10STableCellRC15SMouseDownEvent -# DrawCellContents__18CStandardFlexTableFRC10STableCellRC4Rect -# DrawCell__18CStandardFlexTableFRC10STableCellRC4Rect -# DrawIconFamily__18CStandardFlexTableFssssRC4Rect -# DrawIconsSelf__18CStandardFlexTableCFRC10STableCellsRC4Rect -# DrawIcons__18CStandardFlexTableCFRC10STableCellRC4Rect -# DrawSelf__18CStandardFlexTableFv -# DrawTextString__18CStandardFlexTableFPCcPC8FontInfosRC4RectsUcs -# EnterDropArea__18CStandardFlexTableFP19OpaqueDragReferenceUc -# FindCommandStatus__18CStandardFlexTableFlRUcRUcRUsPUc -# FinishCreateSelf__18CStandardFlexTableFv -# GetCellDataType__18CStandardFlexTableCFRC10STableCell -# GetDropFlagRect__18CStandardFlexTableCFRC4RectR4Rect -# GetHiliteColumn__18CStandardFlexTableCFv -# GetHiliteRgn__18CStandardFlexTableFPP6Region -# GetHiliteTextRect__18CStandardFlexTableCFUlR4Rect -# GetHiliteText__18CStandardFlexTableCFUlPcUsP4Rect -# GetIconID__18CStandardFlexTableCFUl -# GetIconRect__18CStandardFlexTableCFRC10STableCellRC4RectR4Rect -# GetInfo__18CStandardFlexTableFv -# GetLastSelectedRow__18CStandardFlexTableCFRUl -# GetMainRowText__18CStandardFlexTableCFUlPcUs -# GetNestedLevel__18CStandardFlexTableCFUl -# GetNextSelectedRow__18CStandardFlexTableCFRUl -# GetNotifyOnSelectionChange__18CStandardFlexTableFv -# GetRowDragRgn__18CStandardFlexTableCFUlPP6Region -# GetRowHiliteRgn__18CStandardFlexTableCFUlPP6Region -# GetSelectedRowCount__18CStandardFlexTableCFv -# GetSortedColumn__18CStandardFlexTableCFv -# GetUpdatedSelectionList__18CStandardFlexTableFRUl -# HandleKeyPress__18CStandardFlexTableFRC11EventRecord -# HandleSelectionTracking__18CStandardFlexTableFRC15SMouseDownEvent -# HiliteDropRow__18CStandardFlexTableFUlUc -# HiliteRow__18CStandardFlexTableFUlUc -# HitCellHotSpot__18CStandardFlexTableFRC10STableCellRC4Rect -# InlineEditorDone__18CStandardFlexTableFv -# InlineEditorTextChanged__18CStandardFlexTableFv -# InsideDropArea__18CStandardFlexTableFP19OpaqueDragReference -# IsColumnVisible__18CStandardFlexTableFl -# IsSortedBackwards__18CStandardFlexTableCFv -# LeaveDropArea__18CStandardFlexTableFP19OpaqueDragReference -# ObeyCommand__18CStandardFlexTableFlPv -# OpenRow__18CStandardFlexTableFUl -# OpenSelection__18CStandardFlexTableFv -# PointInDropArea__18CStandardFlexTableF5Point -# RefreshCellRange__18CStandardFlexTableFRC10STableCellRC10STableCell -# RowCanAcceptDropBetweenAbove__18CStandardFlexTableFP19OpaqueDragReferenceUl -# RowCanAcceptDrop__18CStandardFlexTableFP19OpaqueDragReferenceUl -# RowIsContainer__18CStandardFlexTableCFRCUl -# ScrollImageBy__18CStandardFlexTableFllUc -# ScrollRowIntoFrame__18CStandardFlexTableFUl -# ScrollSelectionIntoFrame__18CStandardFlexTableFv -# SelectRow__18CStandardFlexTableFUl -# SelectionChanged__18CStandardFlexTableFv -# SetCellExpansion__18CStandardFlexTableFRC10STableCellUc -# SetNotifyOnSelectionChange__18CStandardFlexTableFUc -# SetRightmostVisibleColumn__18CStandardFlexTableFUs -# SetTextTraits__18CStandardFlexTableFs -# SetUpTableHelpers__18CStandardFlexTableFv -# SynchronizeColumnsWithHeader__18CStandardFlexTableFv -# TableDesiresSelectionTracking__18CStandardFlexTableFv -# TrackSelection__18CStandardFlexTableFRC15SMouseDownEvent -# UnselectCellsNotInSelectionOutline__18CStandardFlexTableFRC4Rect -# __ct__18CStandardFlexTableFP7LStream -# __dt__18CStandardFlexTableFv -#{data} -# __vt__18CStandardFlexTable - -### class CStr255 -#{code} -# Copy__7CStr255Fss -# __apl__7CStr255FPCc -# __apl__7CStr255FRC7CString -# __apl__7CStr255Fc -# __as__7CStr255FPCc -# __ct__7CStr255FPCc -# __ct__7CStr255Fl -#{data} -# sEmptyString__7CStr255 - -### class CStr31 -#{code} -# Copy__6CStr31Fss -# __apl__6CStr31FPCc -# __apl__6CStr31FRC7CString -# __apl__6CStr31Fc -# __as__6CStr31FPCUc -# __as__6CStr31FPCc -# __as__6CStr31FRC7CString -__ct__6CStr31FPCc -# __ct__6CStr31Fl - -### class CStr32 -#{code} -# Copy__6CStr32Fss -# __apl__6CStr32FPCc -# __apl__6CStr32FRC7CString -# __apl__6CStr32Fc -# __ct__6CStr32FPCc -# __ct__6CStr32Fl - -### class CStr63 -#{code} -# Copy__6CStr63Fss -# __apl__6CStr63FPCc -# __apl__6CStr63FRC7CString -# __apl__6CStr63Fc -# __ct__6CStr63FPCc -# __ct__6CStr63Fl - -### class CStreamInMemory -#{code} -# Read__15CStreamInMemoryFPcl -# __dt__15CStreamInMemoryFv -#{data} -# __vt__15CStreamInMemory - -### class CStreamOutAnyNet -#{code} -# __ct__16CStreamOutAnyNetFP10MWContext_P11URL_Struct_i -# __dt__16CStreamOutAnyNetFv -#{data} -# __vt__16CStreamOutAnyNet - -### class CStreamOutFile -#{code} -# Status__14CStreamOutFileFv -# Write__14CStreamOutFileFPcl -# __ct__14CStreamOutFileFP5_FILEb -# __dt__14CStreamOutFileFv -#{data} -# __vt__14CStreamOutFile - -### class CStreamOutMemory -#{code} -# Write__16CStreamOutMemoryFPcl -# __ct__16CStreamOutMemoryFv -# __dt__16CStreamOutMemoryFv -#{data} -# __vt__16CStreamOutMemory - -### class CStreamOutNet -#{code} -# SetStream__13CStreamOutNetFP16_NET_StreamClass -# Status__13CStreamOutNetFv -# Write__13CStreamOutNetFPcl -# __ct__13CStreamOutNetFP10MWContext_ -# __ct__13CStreamOutNetFv -# __dt__13CStreamOutNetFv -#{data} -# __vt__13CStreamOutNet - -### class CStretchBuffer -#{code} -# Add__14CStretchBufferFPc -# Contains__14CStretchBufferFPcPi -# __ct__14CStretchBufferFv -# __dt__14CStretchBufferFv - -### class CString -#{code} -# Delete__7CStringFss -# InsertHelper__7CStringFPCcss -# InsertHelper__7CStringFRC7CStringss -# Pos__7CStringFPCcUc -# Pos__7CStringFRC7CStringUc -# __opPCUc__7CStringCFv -# __opPc__7CStringCFv -# __opl__7CStringCFv - -### class CStringListRsrc -#{code} -# AppendString__15CStringListRsrcFRC7CStr255 -# ClearAll__15CStringListRsrcFv -# CountStrings__15CStringListRsrcCFv -# FindString__15CStringListRsrcFRC7CStr255Uc -# GetListName__15CStringListRsrcFR7CStr255 -# GetString__15CStringListRsrcCFsR7CStr255 -# RemoveAt__15CStringListRsrcFs -# ReplaceAt__15CStringListRsrcFRC7CStr255s - -### class CStringListToolTipPane -#{code} -# CalcTipText__22CStringListToolTipPaneFP7LWindowP5LPaneRC11EventRecordPUc -# __ct__22CStringListToolTipPaneFP7LStream -# __dt__22CStringListToolTipPaneFv -#{data} -# __vt__22CStringListToolTipPane - -### class CSuspenderResumer -#{code} -# ResumeSelf__17CSuspenderResumerFv -# Resume__17CSuspenderResumerFv -# SuspendSelf__17CSuspenderResumerFv -# Suspend__17CSuspenderResumerFv -# __ct__17CSuspenderResumerFv -# __dt__17CSuspenderResumerFv -#{data} -# __vt__17CSuspenderResumer -# sIsSuspended__17CSuspenderResumer -# sSuspendersAndResumers__17CSuspenderResumer - -### class CSwatchBrokerView -#{code} -# AdaptToBrokeredViewMove__17CSwatchBrokerViewFP13CBrokeredViewRC8SPoint32Uc -# AdaptToBrokeredViewResize__17CSwatchBrokerViewFP13CBrokeredView12SDimension16Uc -# AdaptToSuperFrameSize__17CSwatchBrokerViewFllUc -# FinishCreateSelf__17CSwatchBrokerViewFv -# ListenToMessage__17CSwatchBrokerViewFlPv -# __ct__17CSwatchBrokerViewFP7LStream -# __dt__17CSwatchBrokerViewFv -#{data} -# __vt__17CSwatchBrokerView - -### class CTSMEditField -#{code} -# BeTarget__13CTSMEditFieldFv -# DontBeTarget__13CTSMEditFieldFv -# Initialize__13CTSMEditFieldFv -# PostUpdate__13CTSMEditFieldFPP5TERecllllll -# PreUpdate__13CTSMEditFieldFPP5TERecl -# __ct__13CTSMEditFieldFP7LStream -# __ct__13CTSMEditFieldFRC9SPaneInfoPUcssUcPFPP5TERecUsRUss_10EKeyStatusP10LCommander -# __ct__13CTSMEditFieldFv -# __dt__13CTSMEditFieldFv -#{data} -# __vt__13CTSMEditField -# sHasTSM__13CTSMEditField -# sInitialized__13CTSMEditField -# sPostUpdateUPP__13CTSMEditField -# sPreUpdateUPP__13CTSMEditField - -### class CTabControl -#{code} -# ActivateSelf__11CTabControlFv -# BroadcastValueMessage__11CTabControlFv -# CalcTabMask__11CTabControlFRC4RectRC4RectPP6Region -# DeactivateSelf__11CTabControlFv -# DoLoadTabs__11CTabControlFs -# DrawBottomBevel__11CTabControlFP12CTabInstanceUc -# DrawCurrentTabSideClip__11CTabControlFPP6Region -# DrawOneTabBackground__11CTabControlFPP6RegionUc -# DrawOneTabFrame__11CTabControlFPP6RegionUc -# DrawOneTab__11CTabControlFP12CTabInstance -# DrawSelf__11CTabControlFv -# DrawSides__11CTabControlFv -# DrawTopBevel__11CTabControlFP12CTabInstance -# Draw__11CTabControlFPP6Region -# FindHotSpot__11CTabControlCF5Point -# FinishCreateSelf__11CTabControlFv -# GetMessageForValue__11CTabControlFl -# GetMinumumSize__11CTabControlFv -# HotSpotAction__11CTabControlFsUcUc -# HotSpotResult__11CTabControlFs -# PointInHotSpot__11CTabControlCF5Points -# Recalc__11CTabControlFv -# ResizeFrameBy__11CTabControlFssUc -# SetClipForDrawingSides__11CTabControlFv -# SetValue__11CTabControlFl -# __ct__11CTabControlFP7LStream -# __dt__11CTabControlFv -#{data} -# __vt__11CTabControl - -### class CTabInstance -#{code} -# __ct__12CTabInstanceFv -# __dt__12CTabInstanceFv -#{data} -# __vt__12CTabInstance - -### class CTabSwitcher -#{code} -# DoPostLoad__12CTabSwitcherFP5LViewUc -# DoPreDispose__12CTabSwitcherFP5LViewUc -# FetchPageFromCache__12CTabSwitcherFs -# FindPageByID__12CTabSwitcherFs -# FinishCreateSelf__12CTabSwitcherFv -# FlushCachedPages__12CTabSwitcherFv -# GetCurrentPage__12CTabSwitcherCFv -# ListenToMessage__12CTabSwitcherFlPv -# RemovePageFromCache__12CTabSwitcherFP5LView -# SwitchToPage__12CTabSwitcherFs -# __ct__12CTabSwitcherFP7LStream -# __dt__12CTabSwitcherFv -#{data} -# __vt__12CTabSwitcher - -### class CTabbedDialog -#{code} -# CommitChanges__13CTabbedDialogFUc -# FinishCreateSelf__13CTabbedDialogFv -# Help__13CTabbedDialogFv -# InitializeDialogControls__13CTabbedDialogFv -# RegisterViewTypes__13CTabbedDialogFv -# RestorePlace__13CTabbedDialogFP7LStream -# SavePlace__13CTabbedDialogFP7LStream -# __ct__13CTabbedDialogFP7LStream -# __dt__13CTabbedDialogFv -#{data} -# __vt__13CTabbedDialog - -### class CTableHeaderListener -#{code} -# ListenToMessage__20CTableHeaderListenerFlPv -# __dt__20CTableHeaderListenerFv -#{data} -# __vt__20CTableHeaderListener - -### class CTableInsertDialog -#{code} -# AdjustEnable__18CTableInsertDialogFv -# CommitChanges__18CTableInsertDialogFUc -# FinishCreateSelf__18CTableInsertDialogFv -# Help__18CTableInsertDialogFv -# InitializeDialogControls__18CTableInsertDialogFv -# ListenToMessage__18CTableInsertDialogFlPv -# __ct__18CTableInsertDialogFP7LStream -# __dt__18CTableInsertDialogFv -#{data} -# __vt__18CTableInsertDialog - -### class CTableKeyAttachment -#{code} -# ExecuteSelf__19CTableKeyAttachmentFlPv -# SelectCell__19CTableKeyAttachmentFRC10STableCellUc -# __ct__19CTableKeyAttachmentFP17CSpecialTableView -# __dt__19CTableKeyAttachmentFv -#{data} -# __vt__19CTableKeyAttachment - -### class CTableKeySingleSelector -#{code} -# DownArrow__23CTableKeySingleSelectorFv -# ExecuteSelf__23CTableKeySingleSelectorFlPv -# HandleKeyEvent__23CTableKeySingleSelectorFPC11EventRecord -# ScrollRowIntoFrame__23CTableKeySingleSelectorFUl -# UpArrow__23CTableKeySingleSelectorFv -# __ct__23CTableKeySingleSelectorFP10LTableView -# __ct__23CTableKeySingleSelectorFP7LStream -# __dt__23CTableKeySingleSelectorFv -#{data} -# __vt__23CTableKeySingleSelector - -### class CTableRowDragger -#{code} -# BeginTracking__16CTableRowDraggerFPC8SPoint32 -# CalcArrowRects__16CTableRowDraggerFsP4RectP4RectUc -# DrawDragRegion__16CTableRowDraggerFPC8SPoint32PC8SPoint32Q213CMouseDragger16EDrawRegionState -# EndTracking__16CTableRowDraggerFPC8SPoint32PC8SPoint32 -# UpdateInsertionPoint__16CTableRowDraggerFPC10LImageRectP10LTableViewQ213CMouseDragger16EDrawRegionState -# __dt__16CTableRowDraggerFv -#{data} -# __vt__16CTableRowDragger - -### class CTapeFSFile -#{code} -# AddFile__11CTapeFSFileFPcPcs -# CloseStream__11CTapeFSFileFi -# Complete__11CTapeFSFileFbPFbPv_vPv -# CopyURLInfo__11CTapeFSFileFiPC11URL_Struct_ -# FileExists__11CTapeFSFileFi -# GetDestAbsURL__11CTapeFSFileFv -# GetDestPathURL__11CTapeFSFileFv -# GetDestURL__11CTapeFSFileFi -# GetHumanName__11CTapeFSFileFi -# GetNumFiles__11CTapeFSFileFv -# GetSourceURL__11CTapeFSFileFi -# GetType__11CTapeFSFileFv -# IsLocalPersistentFile__11CTapeFSFileFi -# OpenStream__11CTapeFSFileFi -# SetSourceBaseURL__11CTapeFSFileFPc -# __ct__11CTapeFSFileFPcPc -# __dt__11CTapeFSFileFv -#{data} -# __vt__11CTapeFSFile - -### class CTapeFSPublish -#{code} -# AddFile__14CTapeFSPublishFPcPcs -# CloseStream__14CTapeFSPublishFi -# Complete__14CTapeFSPublishFbPFbPv_vPv -# CopyURLInfo__14CTapeFSPublishFiPC11URL_Struct_ -# FileExists__14CTapeFSPublishFi -# GetDestAbsURL__14CTapeFSPublishFv -# GetDestPathURL__14CTapeFSPublishFv -# GetDestURL__14CTapeFSPublishFi -# GetHumanName__14CTapeFSPublishFi -# GetNumFiles__14CTapeFSPublishFv -# GetPassword__14CTapeFSPublishFv -# GetSourceURL__14CTapeFSPublishFi -# GetType__14CTapeFSPublishFv -# GetUsername__14CTapeFSPublishFv -# IsLocalPersistentFile__14CTapeFSPublishFi -# OpenStream__14CTapeFSPublishFi -# SetSourceBaseURL__14CTapeFSPublishFPc -# __ct__14CTapeFSPublishFP10MWContext_PcPcPcPc -# __dt__14CTapeFSPublishFv -#{data} -# __vt__14CTapeFSPublish -# iVerifierKey__14CTapeFSPublish -#{code} -# makeLocal__14CTapeFSPublishFPcPc - -### class CTarget -#{code} -# AlreadyExistsInDocument__7CTargetFPc -# CleanUpTargetString__7CTargetFPc -# CommitChanges__7CTargetFUc -# Help__7CTargetFv -# InitializeDialogControls__7CTargetFv -# __ct__7CTargetFP7LStream -# __dt__7CTargetFv -#{data} -# __vt__7CTarget - -### class CTargetFramer -#{code} -# CalcBorderRegion__13CTargetFramerFPP6Region -# ExecuteSelf__13CTargetFramerFlPv -# InvertBorder__13CTargetFramerFv -# SetOwnerHost__13CTargetFramerFP11LAttachable -# __ct__13CTargetFramerFP7LStream -# __ct__13CTargetFramerFv -# __dt__13CTargetFramerFv -#{data} -# __vt__13CTargetFramer - -### class CTargetedUpdateMenuRegistry -#{code} -# CommandInRegistry__27CTargetedUpdateMenuRegistryFl -# SetCommands__27CTargetedUpdateMenuRegistryFRC22list> -# UpdateMenus__27CTargetedUpdateMenuRegistryFv -#{data} -# sCommands__27CTargetedUpdateMenuRegistry -# sUseRegistryToUpdateMenus__27CTargetedUpdateMenuRegistry - -### class CTaskBarListener -#{code} -# GetToggleTaskBarWindowMenuItemName__16CTaskBarListenerFRA256_Uc -# ToggleTaskBarWindow__16CTaskBarListenerFv -# __dt__16CTaskBarListenerFv -#{data} -# __vt__16CTaskBarListener - -### class CTaskBarView -#{code} -# Click__12CTaskBarViewFR15SMouseDownEvent -# __ct__12CTaskBarViewFP7LStream -# __dt__12CTaskBarViewFv -#{data} -# __vt__12CTaskBarView - -### class CTearOffBar -#{code} -# ActivateSelf__11CTearOffBarFv -# AddListener__11CTearOffBarFP9LListener -# ClickSelf__11CTearOffBarFRC15SMouseDownEvent -# Click__11CTearOffBarFR15SMouseDownEvent -# DeactivateSelf__11CTearOffBarFv -# FinishCreateSelf__11CTearOffBarFv -# HidePalette__11CTearOffBarFv -# ListenToMessage__11CTearOffBarFlPv -# ShowPalette__11CTearOffBarFv -# __ct__11CTearOffBarFP7LStream -# __dt__11CTearOffBarFv -#{data} -# __vt__11CTearOffBar - -### class CTearOffManager -#{code} -# AssertBarWindowExists__15CTearOffManagerFP11CTearOffBar -# AssertBarWindowExists__15CTearOffManagerFsUcUcRA256_Uc -# BarActivated__15CTearOffManagerFP11CTearOffBar -# BarDeactivated__15CTearOffManagerFP11CTearOffBar -# BarReceivedMessage__15CTearOffManagerFP11CTearOffBarlPv -# CloseFloatingWindow__15CTearOffManagerFs -# CompareToKey__Q215CTearOffManager21CPaletteBarComparatorCFPCvUlPCv -# CompareToKey__Q215CTearOffManager24CPaletteWindowComparatorCFPCvUlPCv -# Compare__Q215CTearOffManager21CPaletteBarComparatorCFPCvPCvUlUl -# Compare__Q215CTearOffManager24CPaletteWindowComparatorCFPCvPCvUlUl -# DragBar__15CTearOffManagerFP11CTearOffBarssUc -# IsFloatingWindow__15CTearOffManagerFs -# ListenToMessage__15CTearOffManagerFlPv -# OpenFloatingWindow__15CTearOffManagerFs5PointUcUcRA256_Uc -# RegisterBar__15CTearOffManagerFP11CTearOffBar -# RegisterListener__15CTearOffManagerFP11CTearOffBarP9LListener -# RemoveBarsView__15CTearOffManagerFP11CTearOffBarl -# SetBarsView__15CTearOffManagerFP11CTearOffBarP5LView -# UnregisterBar__15CTearOffManagerFP11CTearOffBar -# UnregisterWindow__15CTearOffManagerFP14CTearOffWindow -# WindowReceivedMessage__15CTearOffManagerFP14CTearOffWindowlPv -# __ct__15CTearOffManagerFP10LCommander -# __dt__15CTearOffManagerFv -# __dt__Q215CTearOffManager21CPaletteBarComparatorFv -# __dt__Q215CTearOffManager24CPaletteWindowComparatorFv -#{data} -# __vt__15CTearOffManager -# __vt__Q215CTearOffManager21CPaletteBarComparator -# __vt__Q215CTearOffManager24CPaletteWindowComparator -# sDefaultFloatManager__15CTearOffManager - -### class CTearOffWindow -#{code} -# AdjustWindowSizeBy__14CTearOffWindowFR12SDimension16 -# AttemptClose__14CTearOffWindowFv -# DoClose__14CTearOffWindowFv -# DoSetZoom__14CTearOffWindowFUc -# FinishCreateSelf__14CTearOffWindowFv -# GetStatusResID__14CTearOffWindowCFv -# GetValidStatusVersion__14CTearOffWindowCFv -# HandleModeChange__14CTearOffWindowFSc -# ListenToMessage__14CTearOffWindowFlPv -# __ct__14CTearOffWindowFP7LStream -# __dt__14CTearOffWindowFv -#{data} -# __vt__14CTearOffWindow - -### class CTextEdit -#{code} -# UserChangedText__9CTextEditFv -# __ct__9CTextEditFP7LStream -# __dt__9CTextEditFv -#{data} -# __vt__9CTextEdit - -### class CTextPrefPopup -#{code} -# FinishCreateSelf__14CTextPrefPopupFv -# __dt__14CTextPrefPopupFv -#{data} -# __vt__14CTextPrefPopup - -### class CTextTabInstance -#{code} -# DrawTitle__16CTextTabInstanceFP12CTabInstances -# __ct__16CTextTabInstanceFRC14STabDescriptor -# __dt__16CTextTabInstanceFv -#{data} -# __vt__16CTextTabInstance - -### class CTextTable -#{code} -# BeTarget__10CTextTableFv -# ClickSelf__10CTextTableFRC15SMouseDownEvent -# DontBeTarget__10CTextTableFv -# ObeyCommand__10CTextTableFlPv -# __ct__10CTextTableFP7LStream -# __dt__10CTextTableFv -#{data} -# __vt__10CTextTable - -### class CToolTipAttachment -#{code} -# CalcTipText__18CToolTipAttachmentFP7LWindowP5LPaneRC11EventRecordPUc -# ExecuteSelf__18CToolTipAttachmentFlPv -# HideToolTip__18CToolTipAttachmentFv -# IsTipCancellingEvent__18CToolTipAttachmentCFRC11EventRecord -# MouseEnter__18CToolTipAttachmentF5PointRC11EventRecord -# MouseLeave__18CToolTipAttachmentFv -# MouseWithin__18CToolTipAttachmentF5PointRC11EventRecord -# NoteTipDied__18CToolTipAttachmentFP12CToolTipPane -# ShowToolTip__18CToolTipAttachmentFRC11EventRecord -# __ct__18CToolTipAttachmentFP7LStream -# __ct__18CToolTipAttachmentFUls -# __dt__18CToolTipAttachmentFv -#{data} -# __vt__18CToolTipAttachment -# sActiveTip__18CToolTipAttachment -# sTipsEnabled__18CToolTipAttachment - -### class CToolTipPane -#{code} -# CalcFrameWithRespectTo__12CToolTipPaneFP7LWindowP5LPaneRC11EventRecordR4Rect -# CalcTipText__12CToolTipPaneFP7LWindowP5LPaneRC11EventRecordPUc -# DrawSelf__12CToolTipPaneFv -# ForceInPortFrame__12CToolTipPaneFP7LWindowR4Rect -# SetDescriptor__12CToolTipPaneFPCUc -# SetParent__12CToolTipPaneFP18CToolTipAttachment -# __ct__12CToolTipPaneFP7LStream -# __dt__12CToolTipPaneFv -#{data} -# __vt__12CToolTipPane - -### class CToolbarBevelButton -#{code} -# ChangeMode__19CToolbarBevelButtonFScR12SDimension16 -# FinishCreateSelf__19CToolbarBevelButtonFv -# RestoreTitle__19CToolbarBevelButtonFv -# SaveTitle__19CToolbarBevelButtonFv -# __ct__19CToolbarBevelButtonFP7LStream -# __dt__19CToolbarBevelButtonFv -#{data} -# __vt__19CToolbarBevelButton - -### class CToolbarButton -#{code} -# CalcTitleFrame__14CToolbarButtonFv -# ChangeMode__14CToolbarButtonFScR12SDimension16 -# DrawButtonTitle__14CToolbarButtonFv -# DrawSelf__14CToolbarButtonFv -# FinishCreateSelf__14CToolbarButtonFv -# __ct__14CToolbarButtonFP7LStream -# __dt__14CToolbarButtonFv -#{data} -# __vt__14CToolbarButton - -### class CToolbarButtonContainer -#{code} -# __dt__23CToolbarButtonContainerFv -#{data} -# __vt__23CToolbarButtonContainer - -### class CToolbarDragBar -#{code} -# FinishCreateSelf__15CToolbarDragBarFv -# HandleModeChange__15CToolbarDragBarFSc -# __ct__15CToolbarDragBarFP7LStream -# __dt__15CToolbarDragBarFv -#{data} -# __vt__15CToolbarDragBar - -### class CToolbarModeChangeListener -#{code} -# ListenToMessage__26CToolbarModeChangeListenerFlPv -# __ct__26CToolbarModeChangeListenerFv -# __dt__26CToolbarModeChangeListenerFv -#{data} -# __vt__26CToolbarModeChangeListener - -### class CToolbarModeManager -#{code} -# AddToolbarModeListener__19CToolbarModeManagerFP9LListener -# BroadcastToolbarModeChange__19CToolbarModeManagerFPCcPv -# GetToolbarPref__19CToolbarModeManagerFRl -#{data} -# sBroadcaster__19CToolbarModeManager -# sPrefsProxy__19CToolbarModeManager - -### class CToolbarPatternBevelView -#{code} -# CalcArrangement__24CToolbarPatternBevelViewFUcScR12SDimension16 -# FocusDraw__24CToolbarPatternBevelViewFP5LPane -# HandleModeChange__24CToolbarPatternBevelViewFScR12SDimension16 -# RotateArrangement__24CToolbarPatternBevelViewFR12SDimension16 -# __ct__24CToolbarPatternBevelViewFP7LStream -# __dt__24CToolbarPatternBevelViewFv -#{data} -# __vt__24CToolbarPatternBevelView - -### class CToolbarPopup -#{code} -# ActivateSelf__13CToolbarPopupFv -# DeactivateSelf__13CToolbarPopupFv -# DrawSelf__13CToolbarPopupFv -# __ct__13CToolbarPopupFP7LStream -# __dt__13CToolbarPopupFv -#{data} -# __vt__13CToolbarPopup - -### class CToolbarPrefsProxy -#{code} -# GetToolbarPref__18CToolbarPrefsProxyFRl -# __dt__18CToolbarPrefsProxyFv -#{data} -# __vt__18CToolbarPrefsProxy - -### class CToolsAttachment -#{code} -# ExecuteSelf__16CToolsAttachmentFlPv -# FillMenu__16CToolsAttachmentFlP5LMenuRii -# GetMenu__16CToolsAttachmentFv -# GetTopWindowContext__16CToolsAttachmentFv -# InstallMenus__16CToolsAttachmentFv -# RemoveMenus__16CToolsAttachmentFv -# UpdateMenu__16CToolsAttachmentFv -# __ct__16CToolsAttachmentFv -# __dt__16CToolsAttachmentFv -#{data} -# __vt__16CToolsAttachment -# sInvalidMenu__16CToolsAttachment -# sMenu__16CToolsAttachment -# sMenusList__16CToolsAttachment - -### class CTriStateTableHeader -#{code} -# CycleSortDirection__20CTriStateTableHeaderFRUs -# __ct__20CTriStateTableHeaderFP7LStream -# __dt__20CTriStateTableHeaderFv -#{data} -# __vt__20CTriStateTableHeader - -### class CURLCaption -#{code} -# ListenToMessage__11CURLCaptionFlPv -# __ct__11CURLCaptionFP7LStream -# __dt__11CURLCaptionFv -#{data} -# __vt__11CURLCaption - -### class CURLDispatchInfo -#{code} -# GetURL__16CURLDispatchInfoFv -# ReleaseURLStruct__16CURLDispatchInfoFv -# SetFileSpec__16CURLDispatchInfoFRC6FSSpec -# __ct__16CURLDispatchInfoFP11URL_Struct_P10CNSContextiUcUcUcsUcUc -# __ct__16CURLDispatchInfoFPCcP10CNSContexti16NET_ReloadMethodUcUcUcsUc -# __ct__16CURLDispatchInfoFv -# __dt__16CURLDispatchInfoFv -#{data} -# __vt__16CURLDispatchInfo - -### class CURLDispatcher -#{code} -# CreateNewBrowserWindow__14CURLDispatcherFsUc -# DispatchMailboxURL__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToBrowserWindow__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToDiskAsText__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToDisk__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToLibNet__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToMailNewsWindow__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToNewBrowserWindow__14CURLDispatcherFP16CURLDispatchInfo -# DispatchToStorage__14CURLDispatcherFP11URL_Struct_RC6FSSpeciUc -# DispatchToStorage__14CURLDispatcherFP16CURLDispatchInfo -# DispatchURL__14CURLDispatcherFP11URL_Struct_P10CNSContextUcUcsUciUc -# DispatchURL__14CURLDispatcherFP16CURLDispatchInfo -# DispatchURL__14CURLDispatcherFPCcP10CNSContextUcUcsUci16NET_ReloadMethod -# GetURLDispatcher__14CURLDispatcherFv -# ListenToMessage__14CURLDispatcherFlPv -# PostPendingDispatch__14CURLDispatcherFP16CURLDispatchInfo -# ProcessPendingDispatch__14CURLDispatcherFv -# SpendTime__14CURLDispatcherFRC11EventRecord -# UpdatePendingDispatch__14CURLDispatcherFP10CNSContext -# __ct__14CURLDispatcherFv -# __dt__14CURLDispatcherFv -#{data} -# __vt__14CURLDispatcher -# sDispatchContext__14CURLDispatcher -# sDispatcher__14CURLDispatcher -# sLastBrowserWindowCreated__14CURLDispatcher - -### class CURLDragHelper -#{code} -# DoDragSendData__14CURLDragHelperFPCcPcUlUlP19OpaqueDragReference -# MakeIconTextValid__14CURLDragHelperFPCc - -### class CURLDragMixin -#{code} -# FindBestFlavor__13CURLDragMixinFP19OpaqueDragReferenceUlRUl -# ReceiveDragItem__13CURLDragMixinFP19OpaqueDragReferenceUlUlR4Rect -# __ct__13CURLDragMixinFv -# __dt__13CURLDragMixinFv -#{data} -# __vt__13CURLDragMixin - -### class CURLEditField -#{code} -# BeTarget__13CURLEditFieldFv -# ClickSelf__13CURLEditFieldFRC15SMouseDownEvent -# DisplayURL__13CURLEditFieldFR7CStr255 -# DrawSelf__13CURLEditFieldFv -# HandleKeyPress__13CURLEditFieldFRC11EventRecord -# ListenToMessage__13CURLEditFieldFlPv -# ObeyCommand__13CURLEditFieldFlPv -# __ct__13CURLEditFieldFP7LStream -# __dt__13CURLEditFieldFv -#{data} -# __vt__13CURLEditField - -### class CUnknownTag -#{code} -# CommitChanges__11CUnknownTagFUc -# FinishCreateSelf__11CUnknownTagFv -# Help__11CUnknownTagFv -# InitializeDialogControls__11CUnknownTagFv -# ListenToMessage__11CUnknownTagFlPv -# __ct__11CUnknownTagFP7LStream -# __dt__11CUnknownTagFv -#{data} -# __vt__11CUnknownTag - -### class CUserButtonInfo -#{code} -# __ct__15CUserButtonInfoFRC47basic_string,12allocator>RC47basic_string,12allocator>UlUlbP18_HT_ResourceStruct -# __ct__15CUserButtonInfoFv -# __dt__15CUserButtonInfoFv - -### class CUserProfile -#{code} -# CloseConfigPlugin__12CUserProfileFv -# CreateDefaultProfileFolder__12CUserProfileFRC6FSSpec -# CreateNetProfile__12CUserProfileF6FSSpecR6FSSpec -# DeleteMagicProfile__12CUserProfileFR6FSSpec -# DeleteProfile__12CUserProfileFsR14CUserProfileDBRPP7ListRec -# DoNetExtendedProfileDialog__12CUserProfileFP10LCommander -# DoNetProfileDialog__12CUserProfileFv -# GetUniqueFolderName__12CUserProfileFR6FSSpec -# GetUserProfile__12CUserProfileFRC6FSSpecR6FSSpecUcs -# HandleProfileDialog__12CUserProfileFR6FSSpecR14CUserProfileDBR6FSSpecRssUc -# HandleUpgrade__12CUserProfileFR6FSSpecPC6FSSpec -# InitUserProfiles__12CUserProfileFv -# LoadConfigPlugin__12CUserProfileFv -# MakeDesktopIcons__12CUserProfileFRC6CStr31UcUc -# NewProfileWizard__12CUserProfileFQ212CUserProfile11UpgradeEnumR6CStr31RC6FSSpecR6FSSpecRUc -# NewUserProfile__12CUserProfileFRC6FSSpecR6FSSpecR6CStr31Q212CUserProfile11UpgradeEnumPC6FSSpec -# PopulateListBox__12CUserProfileFRPP7ListRecR14CUserProfileDBs -# ReflectToPreferences__12CUserProfileFRC6CStr31RC6FSSpecs -# RenameProfile__12CUserProfileFsR14CUserProfileDBR5PointRPP7ListRec -# SendMessageToPlugin__12CUserProfileFlPv -#{data} -# mConfigPluginID__12CUserProfile -# mHasConfigPlugin__12CUserProfile -# mPluginLoaded__12CUserProfile -# sCurrentProfileID__12CUserProfile - -### class CUserProfileDB -#{code} -# AddNewProfile__14CUserProfileDBFsRC6CStr31RC6FSSpec -# CountProfiles__14CUserProfileDBFv -# DeleteProfile__14CUserProfileDBFs -# GetDBResource__14CUserProfileDBFUls -# GetLastProfileID__14CUserProfileDBFv -# GetNextProfileID__14CUserProfileDBFv -# GetProfileAlias__14CUserProfileDBFsR6FSSpecUc -# GetProfileIDByEmail__14CUserProfileDBFRC7CString -# GetProfileIDByUsername__14CUserProfileDBFRC7CString -# GetProfileName__14CUserProfileDBFsR6CStr31 -# SetLastProfileID__14CUserProfileDBFs -# SetProfileData__14CUserProfileDBFs -# SetProfileName__14CUserProfileDBFsRC6CStr31 -# __ct__14CUserProfileDBFR6FSSpecUc -# __dt__14CUserProfileDBFv - -### class CValidEditField -#{code} -# AllowTargetSwitch__15CValidEditFieldFP10LCommander -# SetValidationFunction__15CValidEditFieldFPFP15CValidEditField_Uc -# __ct__15CValidEditFieldFP7LStream -# __dt__15CValidEditFieldFv -#{data} -# __vt__15CValidEditField - -### class CViewUtils -#{code} -# GetTopMostSuperView__10CViewUtilsFP5LPane -# ImageToLocalRect__10CViewUtilsFP5LViewRC7SRect32P4Rect -# LocalToImageRect__10CViewUtilsFP5LViewRC4RectP7SRect32 -# SetRect32__10CViewUtilsFP7SRect32llll - -### class CWASTEEdit -#{code} -# CalText__10CWASTEEditCFv -# ContinuousStyle__10CWASTEEditCFPUsP9TextStyle -# CopyRange__10CWASTEEditCFllPPcPP9StScrpRecPPc -# CountLines__10CWASTEEditCFv -# FeatureFlag__10CWASTEEditCFss -# FindLine__10CWASTEEditCFlcPlPl -# FindWord__10CWASTEEditCFlcPlPl -# GetAlignment__10CWASTEEditCFv -# GetChar__10CWASTEEditCFl -# GetHeight__10CWASTEEditCFll -# GetInfo__10CWASTEEditCFUlPv -# GetOffset__10CWASTEEditFPC6LongPtPSc -# GetPoint__10CWASTEEditCFlsP6LongPtPs -# GetRunInfo__10CWASTEEditCFlP9WERunInfo -# GetSelection__10CWASTEEditCFPlPl -# GetTextLength__10CWASTEEditCFv -# OffsetToLine__10CWASTEEditCFl -# SelView__10CWASTEEditCFv -# SetInfo__10CWASTEEditCFUlPCv - -### class CWebFontReference -#{code} -# Apply__17CWebFontReferenceFv -# DrawText__17CWebFontReferenceFiiPcii -# Finish__17CWebFontReferenceFv -# GetCachedRenderingContext__17CWebFontReferenceFP8GrafPort -# GetFontInfo__17CWebFontReferenceFP8FontInfo -# Init__17CWebFontReferenceFv -# LookupWebFont__17CWebFontReferenceFPcPC8CCharSetPC18LO_TextAttr_structP10MWContext_Uc -# PortCompFunction__17CWebFontReferenceFPCvPCv -# PortHash__17CWebFontReferenceFPCv -# SynchToPort__17CWebFontReferenceFP8GrafPort -# TextWidth__17CWebFontReferenceFPcii -# __ct__17CWebFontReferenceFP3nffPC8CCharSetPC18LO_TextAttr_struct -# __dt__17CWebFontReferenceFv -#{data} -# __vt__17CWebFontReference -# sBroker__17CWebFontReference -# sCatalogPath__17CWebFontReference -# sPortHash__17CWebFontReference -# sUtility__17CWebFontReference - -### class CWhiteEditField -#{code} -# BeTarget__15CWhiteEditFieldFv -# ClickSelf__15CWhiteEditFieldFRC15SMouseDownEvent -# DontBeTarget__15CWhiteEditFieldFv -# DrawSelf__15CWhiteEditFieldFv -# HandleKeyPress__15CWhiteEditFieldFRC11EventRecord -# UserChangedText__15CWhiteEditFieldFv -# __ct__15CWhiteEditFieldFP7LStream -# __dt__15CWhiteEditFieldFv -#{data} -# __vt__15CWhiteEditField - -### class CWhiteScroller -#{code} -# DrawSelf__14CWhiteScrollerFv -# FocusDraw__14CWhiteScrollerFP5LPane -# __ct__14CWhiteScrollerFP7LStream -# __dt__14CWhiteScrollerFv -#{data} -# __vt__14CWhiteScroller - -### class CWindowIterator -#{code} -# Next__15CWindowIteratorFRP15CMediatedWindow -# __ct__15CWindowIteratorFl - -### class CWindowMediator -#{code} -# CloseAllWindows__15CWindowMediatorFl -# CountOpenWindows__15CWindowMediatorFl -# CountOpenWindows__15CWindowMediatorFl9LayerTypeUc -# FetchBottomWindow__15CWindowMediatorFUc -# FetchTopWindow__15CWindowMediatorF9LayerType -# FetchTopWindow__15CWindowMediatorFl -# FetchTopWindow__15CWindowMediatorFl9LayerType -# FetchTopWindow__15CWindowMediatorFl9LayerTypeUc -# GetWindowMediator__15CWindowMediatorFv -# NoteWindowActivated__15CWindowMediatorFP15CMediatedWindow -# NoteWindowCreated__15CWindowMediatorFP15CMediatedWindow -# NoteWindowDeactivated__15CWindowMediatorFP15CMediatedWindow -# NoteWindowDescriptorChanged__15CWindowMediatorFP15CMediatedWindow -# NoteWindowDisposed__15CWindowMediatorFP15CMediatedWindow -# NoteWindowMenubarModeChanged__15CWindowMediatorFP15CMediatedWindow -# __ct__15CWindowMediatorFv -# __dt__15CWindowMediatorFv -#{data} -# __vt__15CWindowMediator -# sMediator__15CWindowMediator - -### class CWindowMenu -#{code} -# AddWindow__11CWindowMenuFPC15CMediatedWindow -# ListenToMessage__11CWindowMenuFlPv -# ObeyWindowCommand__11CWindowMenuFl -# ObeyWindowCommand__11CWindowMenuFss -# RemoveCommand__11CWindowMenuFl -# RemoveWindow__11CWindowMenuFPC15CMediatedWindow -# UpdateSelf__11CWindowMenuFv -# Update__11CWindowMenuFv -# __ct__11CWindowMenuFs -# __dt__11CWindowMenuFv -#{data} -# __vt__11CWindowMenu -# sWindowMenu__11CWindowMenu - -### class DownloadFilePipe -#{code} -# Abort__16DownloadFilePipeFi -# Complete__16DownloadFilePipeFv -# GetFileSpec__16DownloadFilePipeFv -# GetSilentFileSpec__16DownloadFilePipeFv -# GetUserFileSpec__16DownloadFilePipeFv -# LaunchWhenDone__16DownloadFilePipeFv -# Open__16DownloadFilePipeFv -# Write__16DownloadFilePipeFPCci -# __ct__16DownloadFilePipeFP10CNSContextP11URL_Struct_ -# __dt__16DownloadFilePipeFv -#{data} -# __vt__16DownloadFilePipe - -### class ED_Color -#{code} -# Blue__8ED_ColorFv -# GetAsLong__8ED_ColorFv -# GetLOColor__8ED_ColorFv -# GetUndefined__8ED_ColorFv -# Green__8ED_ColorFv -# IsDefined__8ED_ColorFv -# Red__8ED_ColorFv -# SetUndefined__8ED_ColorFv -# __ct__8ED_ColorFP15LO_Color_struct -# __ct__8ED_ColorFR15LO_Color_struct -# __ct__8ED_ColorFiii -# __ct__8ED_ColorFl -# __ct__8ED_ColorFv -# __eq__8ED_ColorCFRC8ED_Color -# __ne__8ED_ColorCFRC8ED_Color - -### class ED_Link -#{code} -# GetData__7ED_LinkFv - -### class EarlManager -#{code} -# DispatchFinishLoadURL__11EarlManagerFP11URL_Struct_iP10MWContext_ -# DoCancelLoad__11EarlManagerFP10MWContext_ -# FinishLoadURL__11EarlManagerFP11URL_Struct_iP10MWContext_ -# InterruptThis__11EarlManagerFP10MWContext_ -# SpendTime__11EarlManagerFRC11EventRecord -# StartLoadURL__11EarlManagerFP11URL_Struct_P10MWContext_i -# __ct__11EarlManagerFv -# __dt__11EarlManagerFv -#{data} -# __vt__11EarlManager - -### class ErrorManager -#{code} -# ErrorNotify__12ErrorManagerFsRC7CStr255 -# OSNumToStr__12ErrorManagerFs -# PlainAlert__12ErrorManagerFRC7CStr255PCcPCcPCc -# PlainAlert__12ErrorManagerFs -# PlainConfirm__12ErrorManagerFPCcPCcPCcPCc -# PrepareToInteract__12ErrorManagerFv -# TryToInteract__12ErrorManagerFl -#{data} -# sAlertApp__12ErrorManager - -### class EudoraSuite -#{code} -# CreateObjSpecifier__11EudoraSuiteFUl6AEDescUl6AEDescUcP6AEDesc -# MakeCurrentMsgSpec__11EudoraSuiteFP6AEDesc -# MakeEvent__11EudoraSuiteFUlUlP6AEDesc -# MakeNullDesc__11EudoraSuiteFP6AEDesc -# MakeStringDesc__11EudoraSuiteFPUcP6AEDesc -# SendEvent__11EudoraSuiteFP6AEDesc -# SendMessage__11EudoraSuiteFPcPcPcPcPclP6FSSpec -# SendSetData__11EudoraSuiteFPUcPcl -# Set_Eudora_Priority__11EudoraSuiteFl - -### class FileIconsLister -#{code} -# GetCount__15FileIconsListerFv -# GetText__15FileIconsListerFs -# SetIconList__15FileIconsListerFP20CApplicationIconInfo -# __ct__15FileIconsListerFP12CGAPopupMenu -# __dt__15FileIconsListerFv -#{data} -# __vt__15FileIconsLister - -### class FontBrokerObject -#{code} -# CreateFontDisplayerFromDLM__16FontBrokerObjectFPCc -# CreateFontFromFile__16FontBrokerObjectFP4nfrcPCcPCcPCc -# CreateFontFromUrl__16FontBrokerObjectFP4nfrcPCcPCclP6nfdoerP10MWContext_ -# CreateFontMatchInfo__16FontBrokerObjectFPCcPCcPCclllllll -# CreateFontObserver__16FontBrokerObjectFPFP3nffPv_vPv -# CreateRenderingContext__16FontBrokerObjectFllPPvl -# DisableFontDisplayer__16FontBrokerObjectFPCc -# DisableMimetype__16FontBrokerObjectFPCcPCc -# DisableWebfonts__16FontBrokerObjectFv -# EnableFontDisplayer__16FontBrokerObjectFPCc -# EnableMimetype__16FontBrokerObjectFPCcPCc -# EnableWebfonts__16FontBrokerObjectFv -# FontDisplayerForMimetype__16FontBrokerObjectFPCc -# GetBaseFont__16FontBrokerObjectFP4nfrf -# GetMimetype__16FontBrokerObjectFPCcPCc -# IsFontDisplayerEnabled__16FontBrokerObjectFPCc -# IsWebfontsEnabled__16FontBrokerObjectFv -# ListFontDisplayersForMimetype__16FontBrokerObjectFPCc -# ListFontDisplayers__16FontBrokerObjectFv -# ListFonts__16FontBrokerObjectFP4nfrcP5nffmi -# ListSizes__16FontBrokerObjectFP4nfrcP5nffmi -# LoadCatalog__16FontBrokerObjectFPCc -# LookupFont__16FontBrokerObjectFP4nfrcP5nffmiPCc -# RegisterFontDisplayer__16FontBrokerObjectFP4nffp -# RfDone__16FontBrokerObjectFP4nfrf -# SaveCatalog__16FontBrokerObjectFPCc -# ScanForFontDisplayers__16FontBrokerObjectFPCc -# __ct__16FontBrokerObjectFv -# __dt__16FontBrokerObjectFv -# findDisplayer__16FontBrokerObjectFPCc -# merge__16FontBrokerObjectFRPP5nffmiRiPP5nffmi -# registerDisplayer__16FontBrokerObjectFP23FontDisplayerPeerObject -# scanDisplayersFromDir__16FontBrokerObjectFPCc - -### class FontCatalogFile -#{code} -# __ct__15FontCatalogFileFPCci -# __dt__15FontCatalogFileFv -# indentIn__15FontCatalogFileFv -# indentOut__15FontCatalogFileFv -# isEof__15FontCatalogFileFv -# output__15FontCatalogFileFPCc -# output__15FontCatalogFileFPCcPCc -# output__15FontCatalogFileFPCci -# readline__15FontCatalogFileFPci -# status__15FontCatalogFileFv - -### class FontDisplayerCatalogObject -#{code} -# __ct__26FontDisplayerCatalogObjectFPCc -# __dt__26FontDisplayerCatalogObjectFv -# addFmi__26FontDisplayerCatalogObjectFP13catalog_storeP5nffmi -# addFmi__26FontDisplayerCatalogObjectFllP5nffmi -# copyFmis__26FontDisplayerCatalogObjectFP13catalog_storePP5nffmi -# describe__26FontDisplayerCatalogObjectFR15FontCatalogFile -# finalize__26FontDisplayerCatalogObjectFv -# isInitialized__26FontDisplayerCatalogObjectFP4nfrc -# reconstruct__26FontDisplayerCatalogObjectFR15FontCatalogFile -# supportsFmi__26FontDisplayerCatalogObjectFP4nfrcP5nffmi -# update__26FontDisplayerCatalogObjectFP4nfrcPP5nffmi - -### class FontDisplayerPeerObject -#{code} -# CreateFontFromFile__23FontDisplayerPeerObjectFP4nfrcPCcPCcPCc -# CreateFontStreamHandler__23FontDisplayerPeerObjectFP4nfrcPCc -# CreateRenderableFont__23FontDisplayerPeerObjectFP4nfrcPvd -# EnumerateSizes__23FontDisplayerPeerObjectFP4nfrcPv -# FontHandleCreated__23FontDisplayerPeerObjectFPv -# FontHandleDone__23FontDisplayerPeerObjectFPv -# GetMatchInfo__23FontDisplayerPeerObjectFPv -# ListFonts__23FontDisplayerPeerObjectFP4nfrcP5nffmi -# ListSizes__23FontDisplayerPeerObjectFP4nfrcP5nffmi -# LookupFont__23FontDisplayerPeerObjectFP4nfrcP5nffmiPCc -# ReleaseFontHandle__23FontDisplayerPeerObjectFPv -# StreamCreated__23FontDisplayerPeerObjectFP6nfstrm -# StreamDone__23FontDisplayerPeerObjectFP6nfstrm -# __ct__23FontDisplayerPeerObjectFP4nffp -# __ct__23FontDisplayerPeerObjectFPCc -# __ct__23FontDisplayerPeerObjectFR15FontCatalogFile -# __dt__23FontDisplayerPeerObjectFv -# aboutData__23FontDisplayerPeerObjectFv -# countMimetypes__23FontDisplayerPeerObjectFv -# decideToUnload__23FontDisplayerPeerObjectFv -# describe__23FontDisplayerPeerObjectFR15FontCatalogFile -# disableDisplayer__23FontDisplayerPeerObjectFv -# disableMimetype__23FontDisplayerPeerObjectFPCc -# dlmChanged__23FontDisplayerPeerObjectFPCc -# enableDisplayer__23FontDisplayerPeerObjectFv -# enableMimetype__23FontDisplayerPeerObjectFPCc -# finalizeExceptDlmAndDisabled__23FontDisplayerPeerObjectFv -# finalize__23FontDisplayerPeerObjectFv -# getMimetypeFromExtension__23FontDisplayerPeerObjectFPCc -# isDeleted__23FontDisplayerPeerObjectFv -# isDisplayerEnabled__23FontDisplayerPeerObjectFv -# isLoaded__23FontDisplayerPeerObjectFv -# isMimetypeEnabled__23FontDisplayerPeerObjectFPCc -# isNative__23FontDisplayerPeerObjectFv -# load__23FontDisplayerPeerObjectFv -# name__23FontDisplayerPeerObjectFv -# queryCatalog__23FontDisplayerPeerObjectFP4nfrcP5nffmi -# reconstruct__23FontDisplayerPeerObjectFR15FontCatalogFile -# registerConverters__23FontDisplayerPeerObjectFv -# resync__23FontDisplayerPeerObjectFv -# unload__23FontDisplayerPeerObjectFv - -### class FontMatchInfoObject -#{code} -# GetValue__19FontMatchInfoObjectFPCc -# IsEquivalent__19FontMatchInfoObjectFP5nffmi -# ListAttributes__19FontMatchInfoObjectFv -# __ct__19FontMatchInfoObjectFPCc -# __ct__19FontMatchInfoObjectFPCcPCcPCclllllll -# __dt__19FontMatchInfoObjectFv -# addAttribute__19FontMatchInfoObjectFPCcPCc -# addAttribute__19FontMatchInfoObjectFPCcl -# addToString__19FontMatchInfoObjectFRPCcRiRiP14fmi_attr_store -# addToString__19FontMatchInfoObjectFRPCcRiRiPCc -# addToString__19FontMatchInfoObjectFRPCcRiRic -# describe__19FontMatchInfoObjectFv -# isEqual__19FontMatchInfoObjectFP19FontMatchInfoObject -# reconstruct__19FontMatchInfoObjectFPCc -# releaseStringRepresentation__19FontMatchInfoObjectFv -# scanFontpart__19FontMatchInfoObjectFPCcPcRPCcRPCc - -### class FontObject -#{code} -# EnumerateSizes__10FontObjectFP4nfrc -# GC__10FontObjectFv -# GetMatchInfo__10FontObjectFP4nfrcd -# GetRcMajorType__10FontObjectFv -# GetRcMinorType__10FontObjectFv -# GetRenderableFont__10FontObjectFP4nfrcd -# GetState__10FontObjectFv -# __ct__10FontObjectFP3nffP4nfrcPCc -# __dt__10FontObjectFv -# addFontHandle__10FontObjectFP23FontDisplayerPeerObjectPv -# computeSizes__10FontObjectFP4nfrcP8fh_store -# isRfExist__10FontObjectFP4nfrf -# isShared__10FontObjectFv -# isWebFont__10FontObjectFv -# releaseRf__10FontObjectFP4nfrf -# setShared__10FontObjectFi -# setState__10FontObjectFi -# url__10FontObjectFv - -### class FormFEData -#{code} -# __ct__10FormFEDataFv -# __dt__10FormFEDataFv - -### class FormsPopup -#{code} -# DrawTruncTextBox__10FormsPopupF7CStr255RC4Rect -# ExecuteSelf__10FormsPopupFlPv -# GetCount__10FormsPopupFv -# GetText__10FormsPopupFs -# NeedCustomPopup__10FormsPopupCFv -# NeedDrawTextInOurOwn__10FormsPopupCFv -# PostMochaFocusCallback__10FormsPopupFv -# SetMenuItemText__10FormsPopupFPP8MenuInfoiR7CStr255 -# __ct__10FormsPopupFP12CGAPopupMenuP31lo_FormElementSelectData_struct -# __dt__10FormsPopupFv -#{data} -# __vt__10FormsPopup - -### class HTMLInlineTSMProxy -#{code} -# AEHandlerTSM__18HTMLInlineTSMProxyFPC6AEDescP6AEDescl -# Activate__18HTMLInlineTSMProxyFv -# Deactivate__18HTMLInlineTSMProxyFv -# FlushInput__18HTMLInlineTSMProxyFv -# InstallTSMHandlers__18HTMLInlineTSMProxyFv -# RemoveTSMHandlers__18HTMLInlineTSMProxyFv -# __ct__18HTMLInlineTSMProxyFR9CEditView -# __dt__18HTMLInlineTSMProxyFv -#{data} -# __vt__18HTMLInlineTSMProxy -# sAEHandler__18HTMLInlineTSMProxy -# sCurrentProxy__18HTMLInlineTSMProxy - -### class HoldUpdatesProxy -#{code} -# DocumentChanged__16HoldUpdatesProxyFll -# __ct__16HoldUpdatesProxyFR9CEditView -# __dt__16HoldUpdatesProxyFv - -### class HyperStyle -#{code} -# DrawText__10HyperStyleF5PointPcii -# FinishHyperStyle__10HyperStyleFv -# GetFontInfo__10HyperStyleFv -# InitHyperStyle__10HyperStyleFv -# InvalBackground__10HyperStyleF5PointPciiUc -# SetUnderlineLinks__10HyperStyleFPCcPv -# TextWidth__10HyperStyleFPcii -# __ct__10HyperStyleFP10MWContext_PC8CCharSetP18LO_TextAttr_structUcP20LO_TextStruct_struct -# __dt__10HyperStyleFv -#{data} -# sFontHash__10HyperStyle -# sUnderlineLinks__10HyperStyle - -### class IStreamIn -#{code} -# ReadZString__9IStreamInFv -# __dt__9IStreamInFv -#{data} -# __vt__9IStreamIn - -### class IStreamOut -#{code} -# Printf__10IStreamOutFPce -# Status__10IStreamOutFv -# WritePartialZString__10IStreamOutFPcll -# WriteZString__10IStreamOutFPc -# __ct__10IStreamOutFv -# __dt__10IStreamOutFv -#{data} -# __vt__10IStreamOut - -### class ITapeFileSystem -#{data} -# __vt__15ITapeFileSystem - -### class LArray -#{code} -# GetItemSize__6LArrayCFl -# GrabItemRangeSize__6LArrayCFll -# GrabItemSize__6LArrayCFl - -### class LArrowControl -#{code} -# DrawSelf__13LArrowControlFv -# FindHotSpot__13LArrowControlF5Point -# HiliteControl__13LArrowControlFsUc -# HotSpotAction__13LArrowControlFsUcUc -# HotSpotResult__13LArrowControlFs -# PointInHotSpot__13LArrowControlF5Points -# __ct__13LArrowControlFRC9SPaneInfol -# __dt__13LArrowControlFv -#{data} -# __vt__13LArrowControl -# fDelay__13LArrowControl -# fHits__13LArrowControl -# fLastTicks__13LArrowControl - -### class LArrowGroup -#{code} -# BuildControls__11LArrowGroupFv -# GetValue__11LArrowGroupCFv -# ListenToMessage__11LArrowGroupFlPv -# SetMaxValue__11LArrowGroupFl -# SetMinValue__11LArrowGroupFl -# SetStringID__11LArrowGroupFs -# SetValue__11LArrowGroupFl -# __ct__11LArrowGroupFP7LStream -# __dt__11LArrowGroupFv -#{data} -# __vt__11LArrowGroup - -### class LColorEraseAttachment -#{code} -# __dt__21LColorEraseAttachmentFv - -### class LCustomizeFontMenu -#{code} -# Choose__18LCustomizeFontMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# DrawItemText__18LCustomizeFontMenuFR4RectPUc -# Draw__18LCustomizeFontMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# SetupFont__18LCustomizeFontMenuFv -# Size__18LCustomizeFontMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# __ct__18LCustomizeFontMenuFs -#{data} -# __vt__18LCustomizeFontMenu - -### class LCustomizeMenu -#{code} -# Choose__14LCustomizeMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# DrawItemCommand__14LCustomizeMenuFR4Rects -# DrawItemDisable__14LCustomizeMenuFR4Rect -# DrawItemIcon__14LCustomizeMenuFR4Rects -# DrawItemMark__14LCustomizeMenuFR4Rects -# DrawItemSeperator__14LCustomizeMenuFR4Rect -# DrawItemSubmenuIndicator__14LCustomizeMenuFR4Rect -# DrawItemText__14LCustomizeMenuFR4RectPUc -# DrawItem__14LCustomizeMenuFPP8MenuInfoiR4Rect -# Draw__14LCustomizeMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# GetItemRect__14LCustomizeMenuFiP4RectR4Rect -# HaveCommand__14LCustomizeMenuFs -# HaveIcon__14LCustomizeMenuFss -# HaveMark__14LCustomizeMenuFss -# HaveSubmenu__14LCustomizeMenuFs -# InvertItem__14LCustomizeMenuFPP8MenuInfoiP4RectUc -# ItemEnable__14LCustomizeMenuFPP8MenuInfoi -# MeasureItemCommand__14LCustomizeMenuFs -# MeasureItemSlop__14LCustomizeMenuFv -# MeasureItemSubmenuIndicator__14LCustomizeMenuFv -# MeasureItemText__14LCustomizeMenuFPUc -# MeasureItem__14LCustomizeMenuFPP8MenuInfoi -# MoveToItemCommandPosition__14LCustomizeMenuFR4Rect -# MoveToItemMarkPosition__14LCustomizeMenuFR4Rect -# MoveToItemTextPosition__14LCustomizeMenuFR4Rect -# Size__14LCustomizeMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# __ct__14LCustomizeMenuFv -#{data} -# __vt__14LCustomizeMenu - -### class LDividedView -#{code} -# AdjustCursorSelf__12LDividedViewF5PointRC11EventRecord -# CalcDividerRect__12LDividedViewFR4Rect -# CalcLimitRect__12LDividedViewFR4Rect -# CalcRectBetweenPanes__12LDividedViewFR4Rect -# CalcSlopRect__12LDividedViewFR4Rect -# ChangeDividerPosition__12LDividedViewFs -# ClickSelf__12LDividedViewFRC15SMouseDownEvent -# FinishCreateSelf__12LDividedViewFv -# GetDividerPosition__12LDividedViewCFv -# GetZapButton__12LDividedViewFv -# ListenToMessage__12LDividedViewFlPv -# PlaySound__12LDividedViewFs -# PositionViews__12LDividedViewFUc -# PositionZapButton__12LDividedViewFv -# ResizeFrameBy__12LDividedViewFssUc -# RestorePlace__12LDividedViewFP7LStream -# SavePlace__12LDividedViewFP7LStream -# SetSlidesHorizontally__12LDividedViewFUc -# SyncFrameBindings__12LDividedViewFv -# ToggleFirstPane__12LDividedViewFv -# __ct__12LDividedViewFP7LStream -# __dt__12LDividedViewFv -#{data} -# __vt__12LDividedView - -### class LDragAndDrop -#{code} -# __dt__12LDragAndDropFv - -### class LDragFinderTask -#{code} -# AddFlavors__15LDragFinderTaskFP19OpaqueDragReference -# MakeDragRegion__15LDragFinderTaskFP19OpaqueDragReferencePP6Region -# ScrollingTracker__15LDragFinderTaskFsP8GrafPortPvP19OpaqueDragReference -# __ct__15LDragFinderTaskFRC11EventRecordP11LFinderView -# __dt__15LDragFinderTaskFv -#{data} -# __vt__15LDragFinderTask - -### class LFileBufferStream -#{code} -# CloseDataFork__17LFileBufferStreamFv -# DoUseBuffer__17LFileBufferStreamFv -# FlushBuffer__17LFileBufferStreamFUc -# ReadData__17LFileBufferStreamFPvl -# WriteData__17LFileBufferStreamFPCvl -# __ct__17LFileBufferStreamFR6FSSpec -# __dt__17LFileBufferStreamFv -#{data} -# __vt__17LFileBufferStream - -### class LFinderHeader -#{code} -# AdjustCursorSelf__13LFinderHeaderF5PointRC11EventRecord -# ClickSelf__13LFinderHeaderFRC15SMouseDownEvent -# DrawColumn__13LFinderHeaderFUs -# DrawSelf__13LFinderHeaderFv -# SetFinderView__13LFinderHeaderFP11LFinderView -# TrackReorderColumns__13LFinderHeaderFRC15SMouseDownEventUs -# __ct__13LFinderHeaderFP7LStream -# __dt__13LFinderHeaderFv -#{data} -# __vt__13LFinderHeader - -### class LFinderView -#{code} -# ActivateSelf__11LFinderViewFv -# AddFlavors__11LFinderViewFP19OpaqueDragReference -# AdjustCursorSelf__11LFinderViewF5PointRC11EventRecord -# CaculateFontRect__11LFinderViewFv -# CanDrawHierarchy__11LFinderViewFUl -# CellIcon__11LFinderViewFl -# CellIndentLevel__11LFinderViewFl -# CellTextStyle__11LFinderViewFl -# CellText__11LFinderViewFlR7CStr255 -# ClearSelection__11LFinderViewFv -# ClickSelf__11LFinderViewFRC15SMouseDownEvent -# ColumnTextStyle__11LFinderViewFUs -# ColumnText__11LFinderViewFUlUsR7CStr255 -# ColumnTruncationStyle__11LFinderViewFUs -# DeactivateSelf__11LFinderViewFv -# DispatchClick__11LFinderViewFRC15SMouseDownEventUls -# DoDoubleClick__11LFinderViewFUlRC11EventRecord -# DoDragSendData__11LFinderViewFUlUlP19OpaqueDragReference -# DoResizeColumn__11LFinderViewFssUc -# DragScroll__11LFinderViewFP19OpaqueDragReference -# DrawCellAt__11LFinderViewFUl -# DrawCellColumn__11LFinderViewFUlUs -# DrawHierarchy__11LFinderViewFUl -# DrawIcon__11LFinderViewFPPcUcRC4Rect -# DrawSelf__11LFinderViewFv -# DrawText__11LFinderViewFRCUcRC7CStr255RC4RectRCs -# DrawText__11LFinderViewFRCUcRC7CStr255RC4RectRCsss -# FetchCellAt__11LFinderViewFR8SPoint32 -# FinishCreateSelf__11LFinderViewFv -# FirstSelectedCell__11LFinderViewFv -# FocusDraw__11LFinderViewFP5LPane -# FoldHeader__11LFinderViewFUlUcUcUc -# GetCellData__11LFinderViewFUl -# GetCellRect__11LFinderViewFUlR4Rect -# GetClickKind__11LFinderViewFRC15SMouseDownEventUlRUc -# GetColumnHeight__11LFinderViewFv -# GetColumnRect__11LFinderViewFUlUsR4Rect -# GetColumnTitle__11LFinderViewFUsR7CStr255 -# GetIconRect__11LFinderViewFUlR4Rect -# GetNumberOfColumns__11LFinderViewFv -# GetTextRect__11LFinderViewFUlR4Rect -# GetVisibleCells__11LFinderViewFRUlRUl -# GetVisibleCount__11LFinderViewFv -# GetWiglyRect__11LFinderViewFUlR4Rect -# HandleKeyPress__11LFinderViewFRC11EventRecord -# HighlightCell__11LFinderViewFUl -# HighlightDropLocation__11LFinderViewFUc -# HiliteDropArea__11LFinderViewFP19OpaqueDragReference -# InColumn__11LFinderViewF5Point -# InResizableColumnBar__11LFinderViewF5Point -# InsertColumn__11LFinderViewFUsUsUs -# InsideDropArea__11LFinderViewFP19OpaqueDragReference -# IsCellHeader__11LFinderViewFl -# IsCellSelected__11LFinderViewFl -# IsHeaderFolded__11LFinderViewFl -# ItemIsAcceptable__11LFinderViewFP19OpaqueDragReferenceUl -# KeyDown__11LFinderViewFRC11EventRecord -# KeyEnd__11LFinderViewFRC11EventRecord -# KeyEnter__11LFinderViewFRC11EventRecord -# KeyHome__11LFinderViewFRC11EventRecord -# KeyPageDown__11LFinderViewFRC11EventRecord -# KeyPageUp__11LFinderViewFRC11EventRecord -# KeyUp__11LFinderViewFRC11EventRecord -# LeaveDropArea__11LFinderViewFP19OpaqueDragReference -# LocalToGlobalRect__11LFinderViewFR4Rect -# MakeDragRegion__11LFinderViewFP19OpaqueDragReferencePP6Region -# MakeDragTask__11LFinderViewFRC15SMouseDownEvent -# ObeyCommand__11LFinderViewFlPv -# PutOnDuty__11LFinderViewFP10LCommander -# ReceiveDragItem__11LFinderViewFP19OpaqueDragReferenceUlUlR4Rect -# RefreshCells__11LFinderViewFllUc -# RefreshHeader__11LFinderViewFv -# RefreshSelectedCells__11LFinderViewFv -# RemoveColumn__11LFinderViewFUs -# ResizeFrameBy__11LFinderViewFssUc -# ResizeTo__11LFinderViewFUlUl -# RestorePlace__11LFinderViewFP7LStream -# RevealCell__11LFinderViewFUl -# SavePlace__11LFinderViewFP7LStream -# SectCellRect__11LFinderViewFUl4Rect -# SelectItem__11LFinderViewFRC11EventRecordUlUc -# SetBackColor__11LFinderViewFRC8RGBColor -# SetForeColor__11LFinderViewFRC8RGBColor -# SortByColumnNumber__11LFinderViewFUsUc -# SwapColumns__11LFinderViewFUsUs -# SyncDisplay__11LFinderViewFUl -# TakeOffDuty__11LFinderViewFv -# TrackCell__11LFinderViewFRC15SMouseDownEventUl -# TrackHeader__11LFinderViewFRC15SMouseDownEventUs -# TrackMark__11LFinderViewFUsRC15SMouseDownEventUlUsUs -# TrackResizeColumn__11LFinderViewFRC15SMouseDownEventUls -# TrackSpace__11LFinderViewFRC15SMouseDownEventUl -# TrackWigly__11LFinderViewFRC15SMouseDownEventUl -# __ct__11LFinderViewFP7LStream -# __dt__11LFinderViewFv -#{data} -# __vt__11LFinderView - -### class LFlexTableGeometry -#{code} -# CountRows__18LFlexTableGeometryCFv -# GetColHitBy__18LFlexTableGeometryCFRC8SPoint32 -# GetColWidth__18LFlexTableGeometryCFUl -# GetImageCellBounds__18LFlexTableGeometryCFRC10STableCellRlRlRlRl -# GetRowHeight__18LFlexTableGeometryCFUl -# GetRowHitBy__18LFlexTableGeometryCFRC8SPoint32 -# GetTableDimensions__18LFlexTableGeometryCFRUlRUl -# InsertRows__18LFlexTableGeometryFUlUl -# RemoveRows__18LFlexTableGeometryFUlUl -# SetColWidth__18LFlexTableGeometryFUsUlUl -# SetRowHeight__18LFlexTableGeometryFUsUlUl -# __ct__18LFlexTableGeometryFP10LTableViewP12LTableHeader -# __dt__18LFlexTableGeometryFv -#{data} -# __vt__18LFlexTableGeometry - -### class LFocusEditField -#{code} -# BeTarget__15LFocusEditFieldFv -# DontBeTarget__15LFocusEditFieldFv -# GetFocusBox__15LFocusEditFieldFv -# HandleKeyPress__15LFocusEditFieldFRC11EventRecord -# SetReturnMessage__15LFocusEditFieldFs -# __ct__15LFocusEditFieldFP7LStream -# __ct__15LFocusEditFieldFRC15LFocusEditField -# __dt__15LFocusEditFieldFv -#{data} -# __vt__15LFocusEditField - -### class LFormElement -#{code} -# GetWinCSID__12LFormElementCFv -# InitFormElement__12LFormElementFP10MWContext_P27LO_FormElementStruct_struct -# MarkForDeath__12LFormElementFv -# MochaChanged__12LFormElementFv -# MochaFocus__12LFormElementFUcUc -# MochaSelect__12LFormElementFv -# MochaSubmit__12LFormElementFv -# PostMochaFocusCallback__12LFormElementFv -# ReflectData__12LFormElementFv -# SetFEData__12LFormElementFP10FormFEData -# __ct__12LFormElementFv -# __dt__12LFormElementFv -#{data} -# __vt__12LFormElement -# sTargetedFormElement__12LFormElement - -### class LGABox -#{code} -# GetBorderStyle__6LGABoxCFv -# GetContentOffset__6LGABoxCFv -# GetTitlePosition__6LGABoxCFv -# HasBorder__6LGABoxCFv - -### class LGABox_fixes -#{code} -# Disable__12LGABox_fixesFv -# Enable__12LGABox_fixesFv -# RefreshBoxBorder__12LGABox_fixesFv -# RefreshBoxTitle__12LGABox_fixesFv -# ResizeFrameBy__12LGABox_fixesFssUc -# __dt__12LGABox_fixesFv -#{data} -# __vt__12LGABox_fixes - -### class LGACheckbox -#{code} -# IsHilited__11LGACheckboxCFv -# IsMixedState__11LGACheckboxCFv -# IsSelected__11LGACheckboxCFv - -### class LGAIconButton -#{code} -# GetBevelWidth__13LGAIconButtonCFv -# GetControlMode__13LGAIconButtonCFv -# IsHilited__13LGAIconButtonCFv -# IsSelected__13LGAIconButtonCFv - -### class LGAIconMixin -#{code} -# GetClickInIcon__12LGAIconMixinCFv -# GetEdgeOffset__12LGAIconMixinCFv -# GetHiliteIcon__12LGAIconMixinCFv -# GetIconPosition__12LGAIconMixinCFv -# GetIconResourceID__12LGAIconMixinCFv -# GetIconSize__12LGAIconMixinCFv -# GetIconSuiteH__12LGAIconMixinCFv -# GetIconTransform__12LGAIconMixinCFv -# GetOffsetIconOnHilite__12LGAIconMixinCFv - -### class LGAPopup -#{code} -# GetLabelJust__8LGAPopupCFv -# GetLabelStyle__8LGAPopupCFv -# GetLabelWidth__8LGAPopupCFv -# GetMacMenuH__8LGAPopupFv -# GetPopupMenuResID__8LGAPopupCFv -# GetResourceMenuType__8LGAPopupCFv -# IsArrowOnly__8LGAPopupCFv -# IsHilited__8LGAPopupCFv -# IsPulldownMenu__8LGAPopupCFv -# UseResourceMenu__8LGAPopupCFv - -### class LGAPushButton -#{code} -# IsDefaultButton__13LGAPushButtonCFv -# IsHilited__13LGAPushButtonCFv - -### class LGARadioButton -#{code} -# IsHilited__14LGARadioButtonCFv -# IsMixedState__14LGARadioButtonCFv -# IsSelected__14LGARadioButtonCFv - -### class LGATitleMixin -#{code} -# GetHiliteTitle__13LGATitleMixinCFv -# GetTextTraitsID__13LGATitleMixinCFv -# GetTitleHiliteColor__13LGATitleMixinCFv - -### class LKeyScrollAttachment -#{code} -# __dt__20LKeyScrollAttachmentFv - -### class LLowMallocWarningPeriodical -#{code} -# SpendTime__27LLowMallocWarningPeriodicalFRC11EventRecord -# __ct__27LLowMallocWarningPeriodicalFv -# __dt__27LLowMallocWarningPeriodicalFv -#{data} -# __vt__27LLowMallocWarningPeriodical - -### class LMailNewsFindWindow -#{data} -# sFindInHeaders__19LMailNewsFindWindow - -### class LMallocFlusherPeriodical -#{code} -# SpendTime__24LMallocFlusherPeriodicalFRC11EventRecord -# __ct__24LMallocFlusherPeriodicalFv -# __dt__24LMallocFlusherPeriodicalFv -#{data} -# __vt__24LMallocFlusherPeriodical - -### class LMemoryFlusherListener -#{code} -# ListenToMessage__22LMemoryFlusherListenerFlPv -# __ct__22LMemoryFlusherListenerFv -# __dt__22LMemoryFlusherListenerFv -#{data} -# __vt__22LMemoryFlusherListener - -### class LMenuSharingAttachment -#{code} -# AllocatePluginMenuID__22LMenuSharingAttachmentFUc -# ExecuteSelf__22LMenuSharingAttachmentFlPv -# __ct__22LMenuSharingAttachmentFlUcs -# __dt__22LMenuSharingAttachmentFv -#{data} -# __vt__22LMenuSharingAttachment -# sInsertAfterMenuID__22LMenuSharingAttachment -# sNextPluginMenuID__22LMenuSharingAttachment - -### class LMultiFontTextMenu -#{code} -# DrawItemText__18LMultiFontTextMenuFR4RectPUc -# MeasureItemText__18LMultiFontTextMenuFPUc -# __ct__18LMultiFontTextMenuFP21UMultiFontTextHandlerP13UFontSwitcher -#{data} -# __vt__18LMultiFontTextMenu - -### class LPatchedMenu -#{code} -# Choose__12LPatchedMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# Draw__12LPatchedMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# PopUp__12LPatchedMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -# Size__12LPatchedMenuFPP8MenuInfoPP17RoutineDescriptorP4Rect5PointPs -#{data} -# __vt__12LPatchedMenu - -### class LStdButton -#{code} -# __dt__10LStdButtonFv - -### class LStdCheckBox -#{code} -# __dt__12LStdCheckBoxFv - -### class LStdRadioButton -#{code} -# __dt__15LStdRadioButtonFv - -### class LTSMSupport -#{code} -# BeginTextServices__11LTSMSupportFv -# CheckForTextServices__11LTSMSupportFv -# DoQuit__11LTSMSupportFl -# EndFontScriptLimit__11LTSMSupportFv -# GetDefaultTSMTEPostUpdateUPP__11LTSMSupportFv -# GetDefaultTSMTEPreUpdateUPP__11LTSMSupportFv -# HasTSMTE__11LTSMSupportFv -# HasTextServices__11LTSMSupportFv -# Initialize__11LTSMSupportFv -# SetTSMCursor__11LTSMSupportF5Point -# StartFontScriptLimit__11LTSMSupportFs -# StartFontScriptLimit__11LTSMSupportFv -# TSMEvent__11LTSMSupportFRC11EventRecord -# TSMTENewUPP__11LTSMSupportFv - -### class LTableGeometry -#{code} -# InsertCols__14LTableGeometryFUlUl -# InsertRows__14LTableGeometryFUlUl -# RemoveCols__14LTableGeometryFUlUl -# RemoveRows__14LTableGeometryFUlUl -# __dt__14LTableGeometryFv -#{data} -# __vt__14LTableGeometry - -### class LTableHeader -#{code} -# AdjustCursor__12LTableHeaderF5PointRC11EventRecord -# CanColumnResize__12LTableHeaderCFUs -# CanColumnSort__12LTableHeaderCFUs -# CanHideColumns__12LTableHeaderCFv -# Click__12LTableHeaderFR15SMouseDownEvent -# ColumnFromID__12LTableHeaderCFl -# ComputeColumnDragRect__12LTableHeaderFUsR4Rect -# ComputeColumnPositions__12LTableHeaderFv -# ComputeResizeDragRect__12LTableHeaderFUsR4Rect -# ConvertWidthsToAbsolute__12LTableHeaderFv -# CycleSortDirection__12LTableHeaderFRUs -# DrawColumnBackground__12LTableHeaderFRC4RectUc -# DrawSelf__12LTableHeaderFv -# FindColumn__12LTableHeaderCF5Point -# FinishCreateSelf__12LTableHeaderFv -# GetColumnPane__12LTableHeaderFUs -# GetColumnPosition__12LTableHeaderCFUs -# GetColumnWidth__12LTableHeaderCFUs -# GetFixedWidthInRange__12LTableHeaderFUsUs -# GetHeaderWidth__12LTableHeaderCFv -# GetMinWidthOfRange__12LTableHeaderCFUsUs -# GetSortedColumn__12LTableHeaderCFRl -# GetWidthOfRange__12LTableHeaderCFUsUs -# InvalColumn__12LTableHeaderFUs -# IsInHorizontalSizeArea__12LTableHeaderF5PointRUs -# LocateColumn__12LTableHeaderCFUsR4Rect -# MoveColumn__12LTableHeaderFUsUs -# PositionColumnHeaders__12LTableHeaderFUc -# PositionOneColumnHeader__12LTableHeaderFUsUc -# ReadColumnState__12LTableHeaderFP7LStreamUc -# RedistributeSpace__12LTableHeaderFUsUsss -# RedrawColumns__12LTableHeaderFUsUs -# ResizeColumn__12LTableHeaderFUss -# ResizeFrameBy__12LTableHeaderFssUc -# SetRightmostVisibleColumn__12LTableHeaderFUs -# SetSortOrder__12LTableHeaderFUc -# SetSortedColumn__12LTableHeaderFUsUcUc -# SetWithoutSort__12LTableHeaderFUsUcUc -# ShowHideRightmostColumn__12LTableHeaderFUc -# SimulateClick__12LTableHeaderFl -# SumOfVisibleResizableWidths__12LTableHeaderCFv -# TrackColumnDrag__12LTableHeaderFRC15SMouseDownEventUs -# TrackColumnResize__12LTableHeaderFRC15SMouseDownEventUs -# WriteColumnState__12LTableHeaderFP7LStream -# __ct__12LTableHeaderFP7LStream -# __dt__12LTableHeaderFv -#{data} -# __vt__12LTableHeader - -### class LTableRowSelector -#{code} -# CellIsSelected__17LTableRowSelectorCFRC10STableCell -# ClickSelect__17LTableRowSelectorFRC10STableCellRC15SMouseDownEvent -# DoSelectAll__17LTableRowSelectorFUcUc -# DoSelectRange__17LTableRowSelectorFUlUlUcUc -# DoSelect__17LTableRowSelectorFUlUcUcUc -# DragSelect__17LTableRowSelectorFRC10STableCellRC15SMouseDownEvent -# ExtendSelection__17LTableRowSelectorFUl -# GetFirstSelectedCell__17LTableRowSelectorCFv -# GetFirstSelectedRow__17LTableRowSelectorCFv -# InsertRows__17LTableRowSelectorFUlUl -# RemoveRows__17LTableRowSelectorFUlUl -# SelectAllCells__17LTableRowSelectorFv -# SelectCell__17LTableRowSelectorFRC10STableCell -# UnselectAllCells__17LTableRowSelectorFv -# UnselectCell__17LTableRowSelectorFRC10STableCell -# __ct__17LTableRowSelectorFP10LTableViewUc -# __dt__17LTableRowSelectorFv -#{data} -# __vt__17LTableRowSelector - -### class LTableSelector -#{code} -# InsertCols__14LTableSelectorFUlUl -# InsertRows__14LTableSelectorFUlUl -# RemoveCols__14LTableSelectorFUlUl -# RemoveRows__14LTableSelectorFUlUl -# __dt__14LTableSelectorFv -#{data} -# __vt__14LTableSelector - -### class LTableViewHeader -#{code} -# ChangeIconOfColumn__16LTableViewHeaderFls -# ComputeColumnDragRect__16LTableViewHeaderFUsR4Rect -# ComputeResizeDragRect__16LTableViewHeaderFUsR4Rect -# FinishCreateSelf__16LTableViewHeaderFv -# GetGlobalBottomOfTable__16LTableViewHeaderCFv -# ReadColumnState__16LTableViewHeaderFP7LStreamUc -# RedrawColumns__16LTableViewHeaderFUsUs -# ResizeImageBy__16LTableViewHeaderFllUc -# ShowHideRightmostColumn__16LTableViewHeaderFUc -# __ct__16LTableViewHeaderFP7LStream -# __dt__16LTableViewHeaderFv -#{data} -# __vt__16LTableViewHeader - -### class LTimerCallback -#{code} -# SpendTime__14LTimerCallbackFRC11EventRecord -# __ct__14LTimerCallbackFPFPv_vPvUl -# __dt__14LTimerCallbackFv -#{data} -# __vt__14LTimerCallback -# sTimerList__14LTimerCallback - -### class LWhiteListBox -#{code} -# DrawSelf__13LWhiteListBoxFv -# FocusDraw__13LWhiteListBoxFP5LPane -# __ct__13LWhiteListBoxFP7LStream -# __dt__13LWhiteListBoxFv -#{data} -# __vt__13LWhiteListBox - -### class MPaneEnablerPolicy -#{data} -# __vt__18MPaneEnablerPolicy -#{code} -# Changed__37MPreference<12CColorButton,8RGBColor>CFv -# GetPaneValue__37MPreference<12CColorButton,8RGBColor>CFv -# GetPrefValue__37MPreference<12CColorButton,8RGBColor>CFv -# InitializeUsing__37MPreference<12CColorButton,8RGBColor>FPFPCcP8RGBColor_i -# ReadDefaultSelf__37MPreference<12CColorButton,8RGBColor>Fv -# ReadLockState__37MPreference<12CColorButton,8RGBColor>Fv -# ReadSelf__37MPreference<12CColorButton,8RGBColor>Fv -# SetPaneValue__37MPreference<12CColorButton,8RGBColor>F8RGBColor -# ShouldWrite__37MPreference<12CColorButton,8RGBColor>CFv -# WriteSelf__37MPreference<12CColorButton,8RGBColor>Fv -# __ct__37MPreference<12CColorButton,8RGBColor>FP5LPaneP7LStream -# __dt__37MPreference<12CColorButton,8RGBColor>Fv -#{data} -# __vt__37MPreference<12CColorButton,8RGBColor> -#{code} -# Changed__24MPreference<8LControl,b>CFv -# GetPaneValue__24MPreference<8LControl,b>CFv -# GetPrefValue__24MPreference<8LControl,b>CFv -# InitializeUsing__24MPreference<8LControl,b>FPFPCcPb_i -# ReadDefaultSelf__24MPreference<8LControl,b>Fv -# ReadLockState__24MPreference<8LControl,b>Fv -# ReadSelf__24MPreference<8LControl,b>Fv -# SetPaneValue__24MPreference<8LControl,b>Fb -# ShouldWrite__24MPreference<8LControl,b>CFv -# WriteSelf__24MPreference<8LControl,b>Fv -# __ct__24MPreference<8LControl,b>FP5LPaneP7LStream -# __dt__24MPreference<8LControl,b>Fv -#{data} -# __vt__24MPreference<8LControl,b> -#{code} -# Changed__24MPreference<8LControl,l>CFv -# GetPaneValue__24MPreference<8LControl,l>CFv -# GetPrefValue__24MPreference<8LControl,l>CFv -# InitializeUsing__24MPreference<8LControl,l>FPFPCcPl_i -# ReadDefaultSelf__24MPreference<8LControl,l>Fv -# ReadLockState__24MPreference<8LControl,l>Fv -# ReadSelf__24MPreference<8LControl,l>Fv -# SetPaneValue__24MPreference<8LControl,l>Fl -# ShouldWrite__24MPreference<8LControl,l>CFv -# WriteSelf__24MPreference<8LControl,l>Fv -# __ct__24MPreference<8LControl,l>FP5LPaneP7LStream -# __dt__24MPreference<8LControl,l>Fv -#{data} -# __vt__24MPreference<8LControl,l> -#{code} -# Changed__25MPreference<8LGAPopup,Pc>CFv -# GetPaneValue__25MPreference<8LGAPopup,Pc>CFv -# GetPrefValue__25MPreference<8LGAPopup,Pc>CFv -# InitializeUsing__25MPreference<8LGAPopup,Pc>FPFPCcPPc_i -# ReadDefaultSelf__25MPreference<8LGAPopup,Pc>Fv -# ReadLockState__25MPreference<8LGAPopup,Pc>Fv -# ReadSelf__25MPreference<8LGAPopup,Pc>Fv -# SetPaneValue__25MPreference<8LGAPopup,Pc>FPc -# ShouldWrite__25MPreference<8LGAPopup,Pc>CFv -# WriteSelf__25MPreference<8LGAPopup,Pc>Fv -# __ct__25MPreference<8LGAPopup,Pc>FP5LPaneP7LStream -# __dt__25MPreference<8LGAPopup,Pc>Fv -#{data} -# __vt__25MPreference<8LGAPopup,Pc> -#{code} -# Changed__22MPreference<5LPane,Pc>CFv -# GetPaneValue__22MPreference<5LPane,Pc>CFv -# GetPrefValue__22MPreference<5LPane,Pc>CFv -# InitializeUsing__22MPreference<5LPane,Pc>FPFPCcPPc_i -# ReadDefaultSelf__22MPreference<5LPane,Pc>Fv -# ReadLockState__22MPreference<5LPane,Pc>Fv -# ReadSelf__22MPreference<5LPane,Pc>Fv -# SetPaneValue__22MPreference<5LPane,Pc>FPc -# ShouldWrite__22MPreference<5LPane,Pc>CFv -# WriteSelf__22MPreference<5LPane,Pc>Fv -# __ct__22MPreference<5LPane,Pc>FP5LPaneP7LStream -# __dt__22MPreference<5LPane,Pc>Fv -#{data} -# __vt__22MPreference<5LPane,Pc> -#{code} -# Changed__26MPreference<9LTextEdit,Pc>CFv -# GetPaneValue__26MPreference<9LTextEdit,Pc>CFv -# GetPrefValue__26MPreference<9LTextEdit,Pc>CFv -# InitializeUsing__26MPreference<9LTextEdit,Pc>FPFPCcPPc_i -# ReadDefaultSelf__26MPreference<9LTextEdit,Pc>Fv -# ReadLockState__26MPreference<9LTextEdit,Pc>Fv -# ReadSelf__26MPreference<9LTextEdit,Pc>Fv -# SetPaneValue__26MPreference<9LTextEdit,Pc>FPc -# ShouldWrite__26MPreference<9LTextEdit,Pc>CFv -# WriteSelf__26MPreference<9LTextEdit,Pc>Fv -# __ct__26MPreference<9LTextEdit,Pc>FP5LPaneP7LStream -# __dt__26MPreference<9LTextEdit,Pc>Fv -#{data} -# __vt__26MPreference<9LTextEdit,Pc> -#{code} -# Changed__25MPreference<9LTextEdit,l>CFv -# GetPaneValue__25MPreference<9LTextEdit,l>CFv -# GetPrefValue__25MPreference<9LTextEdit,l>CFv -# InitializeUsing__25MPreference<9LTextEdit,l>FPFPCcPl_i -# ReadDefaultSelf__25MPreference<9LTextEdit,l>Fv -# ReadLockState__25MPreference<9LTextEdit,l>Fv -# ReadSelf__25MPreference<9LTextEdit,l>Fv -# SetPaneValue__25MPreference<9LTextEdit,l>Fl -# ShouldWrite__25MPreference<9LTextEdit,l>CFv -# WriteSelf__25MPreference<9LTextEdit,l>Fv -# __ct__25MPreference<9LTextEdit,l>FP5LPaneP7LStream -# __dt__25MPreference<9LTextEdit,l>Fv -#{data} -# __vt__25MPreference<9LTextEdit,l> - -### class MPreferenceBase -#{code} -# ChangePrefName__15MPreferenceBaseFP5LViewlPCc -# FinishCreate__15MPreferenceBaseFv -# GetPrefName__15MPreferenceBaseCFv -# GetPrefName__15MPreferenceBaseFP5LViewl -# ReadLockState__15MPreferenceBaseFv -# SetPrefName__15MPreferenceBaseFPCcUc -# ShouldWrite__15MPreferenceBaseCFv -# __ct__15MPreferenceBaseFP5LPaneP7LStream -# __dt__15MPreferenceBaseFv -#{data} -# __vt__15MPreferenceBase -# sReplacementString__15MPreferenceBase -# sWriteOnDestroy__15MPreferenceBase - -### class MoreExtractFromAEDesc -#{code} -# DispatchURLDirectly__21MoreExtractFromAEDescFRC6AEDesc -# DisplayErrorReply__21MoreExtractFromAEDescFR6AEDesc -# ExtractAESender__21MoreExtractFromAEDescFRC6AEDesc -# GetCString__21MoreExtractFromAEDescFRC6AEDescUlRPc -# MakeErrorReturn__21MoreExtractFromAEDescFR6AEDescRC7CStr255s -# TheCString__21MoreExtractFromAEDescFRC6AEDescRPc - -### class MultipleSelectionSingleColumn -#{code} -# AddItem__29MultipleSelectionSingleColumnFPcUc -# DeselectAll__29MultipleSelectionSingleColumnFv -# GetItem__29MultipleSelectionSingleColumnCFPUcl -# IsSelected__29MultipleSelectionSingleColumnFl -# NumItems__29MultipleSelectionSingleColumnFv -# RemoveAllItems__29MultipleSelectionSingleColumnFv -# SelectAll__29MultipleSelectionSingleColumnFv -# __ct__29MultipleSelectionSingleColumnFP7LStream -# __dt__29MultipleSelectionSingleColumnFv -#{data} -# __vt__29MultipleSelectionSingleColumn - -### class NPILiveConnectPluginInstancePeer -#{data} -# __vt__32NPILiveConnectPluginInstancePeer - -### class NPIPluginInstancePeer -#{data} -# __vt__21NPIPluginInstancePeer - -### class NPIPluginManager -#{data} -# __vt__16NPIPluginManager - -### class NPIPluginManagerStream -#{data} -# __vt__22NPIPluginManagerStream - -### class NPIPluginStreamPeer -#{data} -# __vt__19NPIPluginStreamPeer - -### class NPISeekablePluginStreamPeer -#{data} -# __vt__27NPISeekablePluginStreamPeer - -### class NPIStream -#{data} -# __vt__9NPIStream - -### class NameList -#{code} -# Current__8NameListFv -# Empty__8NameListFv -# Next__8NameListFv -# __ct__8NameListFPc -# __dt__8NameListFv - -### class OneClickLListBox -#{code} -# ClickSelf__16OneClickLListBoxFRC15SMouseDownEvent -# SetSingleClickMessage__16OneClickLListBoxFs -# __ct__16OneClickLListBoxFP7LStream -# __dt__16OneClickLListBoxFv -#{data} -# __vt__16OneClickLListBox - -### class OneRowLListBox -#{code} -# AddRow__14OneRowLListBoxFlPcs -# GetCell__14OneRowLListBoxFlPcPs -# GetRows__14OneRowLListBoxFv -# HandleKeyPress__14OneRowLListBoxFRC11EventRecord -# RemoveRow__14OneRowLListBoxFl -# SetCell__14OneRowLListBoxFlPcs -# __ct__14OneRowLListBoxFP7LStream -# __dt__14OneRowLListBoxFv -#{data} -# __vt__14OneRowLListBox - -### class Pipe -#{code} -# Abort__4PipeFi -# Complete__4PipeFv -# HandleAbort__4PipeFP16_NET_StreamClassi -# HandleComplete__4PipeFP16_NET_StreamClass -# HandleProcess__4PipeFP16_NET_StreamClassPCcl -# HandleWriteReady__4PipeFP16_NET_StreamClass -# MakeStreamObject__4PipeFPcP10MWContext_ -# Open__4PipeFv -# Write__4PipeFPCci -# __ct__4PipeFv -# __dt__4PipeFv -#{data} -# __vt__4Pipe - -### class PrefCellInfo -#{code} -# __ct__12PrefCellInfoFP11CMimeMapperP20CApplicationIconInfo -# __ct__12PrefCellInfoFv - -### class PrefsChangeListener -#{code} -# ListenToMessage__19PrefsChangeListenerFlPv -# PrefHasChanged__19PrefsChangeListenerFv -# __ct__19PrefsChangeListenerFQ26CPrefs8PrefEnum -# __dt__19PrefsChangeListenerFv -#{data} -# __vt__19PrefsChangeListener - -### class RenderingContextObject -#{code} -# GetMajorType__22RenderingContextObjectFv -# GetMinorType__22RenderingContextObjectFv -# GetPlatformData__22RenderingContextObjectFv -# IsEquivalent__22RenderingContextObjectFll -# SetPlatformData__22RenderingContextObjectFP7rc_data -# __ct__22RenderingContextObjectFllPPvl -# __dt__22RenderingContextObjectFv - -### class SelectorData -#{code} -# __ct__12SelectorDataFP14_HT_ViewStruct -# __dt__12SelectorDataFv - -### class SelectorImage -#{code} -# __dt__13SelectorImageFv -#{data} -# __vt__13SelectorImage - -### class StAlertHandler -#{code} -# SetAlertIcon__14StAlertHandlerF10EAlertType -# __ct__14StAlertHandlerFPCUc10EAlertTypeP10LCommander -# __ct__14StAlertHandlerFss10EAlertTypeP10LCommander -# __dt__14StAlertHandlerFv -#{data} -# __vt__14StAlertHandler - -### class StAutoSizingDialog -#{code} -# SetInitialDialogSize__18StAutoSizingDialogFv -# __ct__18StAutoSizingDialogFsRC7CStringRC7CStringP10LCommander -# __dt__18StAutoSizingDialogFv -#{data} -# __vt__18StAutoSizingDialog - -### class StBlockingDialogHandler -#{code} -# ExecuteAttachments__23StBlockingDialogHandlerFlPv -# FindCommandStatus__23StBlockingDialogHandlerFlRUcRUcRUsPUc -# __ct__23StBlockingDialogHandlerFsP10LCommander -# __dt__23StBlockingDialogHandlerFv -#{data} -# __vt__23StBlockingDialogHandler - -### class StCaptureView -#{code} -# Capture__13StCaptureViewFR7CGWorld -# EstablishPort__13StCaptureViewFv -# GetMacPort__13StCaptureViewCFv -# Init__13StCaptureViewFv -# __ct__13StCaptureViewFR5LView -# __ct__13StCaptureViewFR5LViewRC4Rect -# __dt__13StCaptureViewFv -#{data} -# __vt__13StCaptureView - -### class StCurrentPort -#{code} -# __dt__13StCurrentPortFv - -### class StExcludeVisibleRgn -#{code} -# __ct__19StExcludeVisibleRgnFP5LPane -# __dt__19StExcludeVisibleRgnFv - -### class StMercutioMDEFTextState -#{code} -# Restore__23StMercutioMDEFTextStateFv -# SetUpForMercurtioMDEF__23StMercutioMDEFTextStateFv -# __ct__23StMercutioMDEFTextStateFv -# __dt__23StMercutioMDEFTextStateFv - -### class StModifyPPob -#{code} -# __ct__12StModifyPPobFsssUc -# __dt__12StModifyPPobFv - -### class StOpenResFile -#{code} -# __ct__13StOpenResFileFP5LFiles -# __dt__13StOpenResFileFv - -### class StPrepareForDialog -#{code} -# __ct__18StPrepareForDialogFv -# __dt__18StPrepareForDialogFv - -### class StRegionHandle -#{code} -# __dt__14StRegionHandleFv - -### class StSetBroadcasting -#{code} -# __dt__17StSetBroadcastingFv - -### class StSetResAttrs -#{code} -# __ct__13StSetResAttrsFPPcsUc -# __dt__13StSetResAttrsFv - -### class StSetupFormDrawing -#{code} -# __ct__18StSetupFormDrawingFP5LPane -# __dt__18StSetupFormDrawingFv - -### class StSpinningBeachBallCursor -#{code} -# __ct__25StSpinningBeachBallCursorFv -# __dt__25StSpinningBeachBallCursorFv - -### class StStdDialogHandler -#{code} -# CalcDialogPlacement__18StStdDialogHandlerFv -# CalcDialogTargetBounds__18StStdDialogHandlerFsP7LWindowR4Rect -# DisablePane__18StStdDialogHandlerFl -# EnablePane__18StStdDialogHandlerFl -# GetBoolean__18StStdDialogHandlerFl -# GetNumberText__18StStdDialogHandlerFl -# GetPane__18StStdDialogHandlerFl -# GetText__18StStdDialogHandlerFlPUc -# GetValue__18StStdDialogHandlerFl -# HidePane__18StStdDialogHandlerFl -# SetBoolean__18StStdDialogHandlerFlUc -# SetCaption__18StStdDialogHandlerFPCUc -# SetInitialDialogPosition__18StStdDialogHandlerFP7LWindow -# SetNumberText__18StStdDialogHandlerFll -# SetText__18StStdDialogHandlerFlPCUc -# SetValue__18StStdDialogHandlerFll -# ShowPane__18StStdDialogHandlerFl -# WaitUserResponse__18StStdDialogHandlerFv -# __ct__18StStdDialogHandlerFsP10LCommander -# __dt__18StStdDialogHandlerFv -#{data} -# __vt__18StStdDialogHandler - -### class StSysFontState -#{code} -# Restore__14StSysFontStateFv -# Save__14StSysFontStateFv -# SetTextTraits__14StSysFontStateFs -# __ct__14StSysFontStateFv -# __dt__14StSysFontStateFv - -### class StTempClipRgn -#{code} -# __ct__13StTempClipRgnFPP6Region -# __dt__13StTempClipRgnFv -#{data} -# sMergedNewClip__13StTempClipRgn -# sOldClip__13StTempClipRgn - -### class StTempFormBlur -#{code} -# __ct__14StTempFormBlurFv -# __dt__14StTempFormBlurFv - -### class StUseResFile -#{code} -# __ct__12StUseResFileFs -# __dt__12StUseResFileFv -# __dt__30StValueChanger<12EDebugAction>Fv -# __dt__36StValueChangerFv -# __dt__17StValueChangerFv -# __dt__18StValueChangerFv - -### class StWatchCursor -#{code} -# __ct__13StWatchCursorFv -# __dt__13StWatchCursorFv - -### class StdPopup -#{code} -# CalcMaxWidth__8StdPopupFPP8MenuInfo -# CalcTargetFrame__8StdPopupFRs -# DirtyMenu__8StdPopupFv -# DrawTruncTextBox__8StdPopupF7CStr255RC4Rect -# DrawWidget__8StdPopupFPP8MenuInfoRC4Rect -# ExecuteSelf__8StdPopupFlPv -# GetCount__8StdPopupFv -# GetTextTraits__8StdPopupCFv -# GetText__8StdPopupFs -# NeedCustomPopup__8StdPopupCFv -# PopUpMenuSelect__8StdPopupFPP8MenuInfosss -# SetMenuItemText__8StdPopupFPP8MenuInfoiR7CStr255 -# SyncMenu__8StdPopupFPP8MenuInfo -# __ct__8StdPopupFP12CGAPopupMenu -# __dt__8StdPopupFv -#{data} -# __vt__8StdPopup -#{code} -# __dt__9TArrayFv -#{data} -# __vt__9TArray -#{code} -# CreateFromStream__36TRegistrar<22CAdvancedCacheMediator>FP7LStream -# CreateFromStream__38TRegistrar<24CAdvancedProxiesMediator>FP7LStream -# CreateFromStream__39TRegistrar<25CAppearanceColorsMediator>FP7LStream -# CreateFromStream__38TRegistrar<24CAppearanceFontsMediator>FP7LStream -# CreateFromStream__37TRegistrar<23CAppearanceMainMediator>FP7LStream -# CreateFromStream__39TRegistrar<25CAutoCompleteURLEditField>FP7LStream -# CreateFromStream__26TRegistrar<12CBevelButton>FP7LStream -# CreateFromStream__34TRegistrar<20CBookmarksFindDialog>FP7LStream -# CreateFromStream__28TRegistrar<14CBoolPrefRadio>FP7LStream -# CreateFromStream__27TRegistrar<13CBrokeredView>FP7LStream -# CreateFromStream__42TRegistrar<28CBrowserApplicationsMediator>FP7LStream -# CreateFromStream__39TRegistrar<25CBrowserLanguagesMediator>FP7LStream -# CreateFromStream__34TRegistrar<20CBrowserMainMediator>FP7LStream -# CreateFromStream__36TRegistrar<22CBrowserSecurityButton>FP7LStream -# CreateFromStream__26TRegistrar<12CBrowserView>FP7LStream -# CreateFromStream__28TRegistrar<14CBrowserWindow>FP7LStream -# CreateFromStream__38TRegistrar<24CButtonEnablerReloadStop>FP7LStream -# CreateFromStream__21TRegistrar<8CCaption>FP7LStream -# CreateFromStream__31TRegistrar<17CChameleonCaption>FP7LStream -# CreateFromStream__28TRegistrar<14CChameleonView>FP7LStream -# CreateFromStream__33TRegistrar<19CCloseAllAttachment>FP7LStream -# CreateFromStream__26TRegistrar<12CClusterView>FP7LStream -# CreateFromStream__26TRegistrar<12CColorButton>FP7LStream -# CreateFromStream__35TRegistrar<21CColorEraseAttachment>FP7LStream -# CreateFromStream__25TRegistrar<11CColorPopup>FP7LStream -# CreateFromStream__35TRegistrar<21CConfigActiveScroller>FP7LStream -# CreateFromStream__36TRegistrar<22CContextMenuAttachment>FP7LStream -# CreateFromStream__31TRegistrar<17CControlExtension>FP7LStream -# CreateFromStream__30TRegistrar<16CDateArrowButton>FP7LStream -# CreateFromStream__24TRegistrar<10CDateField>FP7LStream -# CreateFromStream__22TRegistrar<9CDateView>FP7LStream -# CreateFromStream__32TRegistrar<18CDeluxeBevelButton>FP7LStream -# CreateFromStream__32TRegistrar<18CDividerGrippyPane>FP7LStream -# CreateFromStream__37TRegistrar<23CDownloadProgressWindow>FP7LStream -# CreateFromStream__21TRegistrar<8CDragBar>FP7LStream -# CreateFromStream__31TRegistrar<17CDragBarContainer>FP7LStream -# CreateFromStream__33TRegistrar<19CDragBarDockControl>FP7LStream -# CreateFromStream__32TRegistrar<18CDragOrderTextList>FP7LStream -# CreateFromStream__33TRegistrar<19CDynamicTooltipPane>FP7LStream -# CreateFromStream__33TRegistrar<19CEDCharacterContain>FP7LStream -# CreateFromStream__35TRegistrar<21CEDDocAppearanceNoTab>FP7LStream -# CreateFromStream__39TRegistrar<25CEDDocPropAdvancedContain>FP7LStream -# CreateFromStream__41TRegistrar<27CEDDocPropAppearanceContain>FP7LStream -# CreateFromStream__38TRegistrar<24CEDDocPropGeneralContain>FP7LStream -# CreateFromStream__29TRegistrar<15CEDImageContain>FP7LStream -# CreateFromStream__28TRegistrar<14CEDLinkContain>FP7LStream -# CreateFromStream__33TRegistrar<19CEDParagraphContain>FP7LStream -# CreateFromStream__33TRegistrar<19CEDTableCellContain>FP7LStream -# CreateFromStream__29TRegistrar<15CEDTableContain>FP7LStream -# CreateFromStream__30TRegistrar<16CEditBroadcaster>FP7LStream -# CreateFromStream__29TRegistrar<15CEditDictionary>FP7LStream -# CreateFromStream__34TRegistrar<20CEditDictionaryTable>FP7LStream -# CreateFromStream__31TRegistrar<17CEditFieldControl>FP7LStream -# CreateFromStream__29TRegistrar<15CEditMIMEWindow>FP7LStream -# CreateFromStream__30TRegistrar<16CEditTabSwitcher>FP7LStream -# CreateFromStream__22TRegistrar<9CEditView>FP7LStream -# CreateFromStream__33TRegistrar<19CEditorMainMediator>FP7LStream -# CreateFromStream__27TRegistrar<13CEditorWindow>FP7LStream -# CreateFromStream__25TRegistrar<11CFilePicker>FP7LStream -# CreateFromStream__25TRegistrar<11CFindWindow>FP7LStream -# CreateFromStream__28TRegistrar<14CFontMenuPopup>FP7LStream -# CreateFromStream__26TRegistrar<12CFormBigText>FP7LStream -# CreateFromStream__25TRegistrar<11CFormButton>FP7LStream -# CreateFromStream__27TRegistrar<13CFormCheckbox>FP7LStream -# CreateFromStream__22TRegistrar<9CFormFile>FP7LStream -# CreateFromStream__32TRegistrar<18CFormFileEditField>FP7LStream -# CreateFromStream__22TRegistrar<9CFormList>FP7LStream -# CreateFromStream__29TRegistrar<15CFormLittleText>FP7LStream -# CreateFromStream__24TRegistrar<10CFormRadio>FP7LStream -# CreateFromStream__41TRegistrar<27CFormatMsgColorAndImageDlog>FP7LStream -# CreateFromStream__32TRegistrar<18CFormattingToolBar>FP7LStream -# CreateFromStream__27TRegistrar<13CGABorderPane>FP7LStream -# CreateFromStream__32TRegistrar<18CGAEditBroadcaster>FP7LStream -# CreateFromStream__29TRegistrar<15CGAFormCheckbox>FP7LStream -# CreateFromStream__31TRegistrar<17CGAFormPushButton>FP7LStream -# CreateFromStream__26TRegistrar<12CGAFormRadio>FP7LStream -# CreateFromStream__26TRegistrar<12CGAPopupMenu>FP7LStream -# CreateFromStream__22TRegistrar<9CGATabBox>FP7LStream -# CreateFromStream__26TRegistrar<12CGATabBoxTab>FP7LStream -# CreateFromStream__28TRegistrar<14CGrayBevelView>FP7LStream -# CreateFromStream__29TRegistrar<15CGuidePopupMenu>FP7LStream -# CreateFromStream__27TRegistrar<13CHTMLPrintout>FP7LStream -# CreateFromStream__22TRegistrar<9CHTMLView>FP7LStream -# CreateFromStream__28TRegistrar<14CHyperScroller>FP7LStream -# CreateFromStream__33TRegistrar<19CHyperTreeFlexTable>FP7LStream -# CreateFromStream__30TRegistrar<16CHyperTreeHeader>FP7LStream -# CreateFromStream__31TRegistrar<17CIconToolbarPopup>FP7LStream -# CreateFromStream__26TRegistrar<12CIncludeView>FP7LStream -# CreateFromStream__30TRegistrar<16CInlineEditField>FP7LStream -# CreateFromStream__27TRegistrar<13CIntPrefPopup>FP7LStream -# CreateFromStream__27TRegistrar<13CIntPrefRadio>FP7LStream -# CreateFromStream__30TRegistrar<16CIntPrefTextEdit>FP7LStream -# CreateFromStream__22TRegistrar<9CJavaView>FP7LStream -# CreateFromStream__34TRegistrar<20CKeyScrollAttachment>FP7LStream -# CreateFromStream__29TRegistrar<15CLargeEditField>FP7LStream -# CreateFromStream__38TRegistrar<24CLargeEditFieldBroadcast>FP7LStream -# CreateFromStream__22TRegistrar<9CLineProp>FP7LStream -# CreateFromStream__27TRegistrar<13CMIMEListPane>FP7LStream -# CreateFromStream__24TRegistrar<10CMenuTable>FP7LStream -# CreateFromStream__33TRegistrar<19CMiniSecurityButton>FP7LStream -# CreateFromStream__45TRegistrar<31CNavCenterContextMenuAttachment>FP7LStream -# CreateFromStream__53TRegistrar<39CNavCenterSelectorContextMenuAttachment>FP7LStream -# CreateFromStream__36TRegistrar<22CNavCenterSelectorPane>FP7LStream -# CreateFromStream__29TRegistrar<15CNavCenterTitle>FP7LStream -# CreateFromStream__30TRegistrar<16CNavCenterWindow>FP7LStream -# CreateFromStream__36TRegistrar<22CNavigationButtonPopup>FP7LStream -# CreateFromStream__31TRegistrar<17COffscreenCaption>FP7LStream -# CreateFromStream__38TRegistrar<24COpenRecentlyEditedPopup>FP7LStream -# CreateFromStream__30TRegistrar<16COtherSizeDialog>FP7LStream -# CreateFromStream__26TRegistrar<12CPaneEnabler>FP7LStream -# CreateFromStream__31TRegistrar<17CPatternBevelView>FP7LStream -# CreateFromStream__28TRegistrar<14CPatternButton>FP7LStream -# CreateFromStream__33TRegistrar<19CPatternButtonPopup>FP7LStream -# CreateFromStream__37TRegistrar<23CPatternButtonPopupText>FP7LStream -# CreateFromStream__26TRegistrar<12CPatternPane>FP7LStream -# CreateFromStream__33TRegistrar<19CPatternProgressBar>FP7LStream -# CreateFromStream__37TRegistrar<23CPatternProgressCaption>FP7LStream -# CreateFromStream__32TRegistrar<18CPatternTabControl>FP7LStream -# CreateFromStream__34TRegistrar<20CPatternedGrippyPane>FP7LStream -# CreateFromStream__35TRegistrar<21CPersonalToolbarTable>FP7LStream -# CreateFromStream__30TRegistrar<16CPlaceHolderView>FP7LStream -# CreateFromStream__25TRegistrar<11CPluginView>FP7LStream -# CreateFromStream__27TRegistrar<13CPrefCheckbox>FP7LStream -# CreateFromStream__30TRegistrar<16CPrefColorButton>FP7LStream -# CreateFromStream__29TRegistrar<15CPrefFilePicker>FP7LStream -# CreateFromStream__27TRegistrar<13CPrefTextEdit>FP7LStream -# CreateFromStream__28TRegistrar<14CPrintHTMLView>FP7LStream -# CreateFromStream__33TRegistrar<19CPrintHeaderCaption>FP7LStream -# CreateFromStream__26TRegistrar<12CProgressBar>FP7LStream -# CreateFromStream__27TRegistrar<13CProxyCaption>FP7LStream -# CreateFromStream__24TRegistrar<10CProxyPane>FP7LStream -# CreateFromStream__21TRegistrar<8CPublish>FP7LStream -# CreateFromStream__29TRegistrar<15CRDFCoordinator>FP7LStream -# CreateFromStream__25TRegistrar<11CResPicture>FP7LStream -# CreateFromStream__27TRegistrar<13CSaveProgress>FP7LStream -# CreateFromStream__33TRegistrar<19CScrollArrowControl>FP7LStream -# CreateFromStream__33TRegistrar<19CScrollerWithArrows>FP7LStream -# CreateFromStream__38TRegistrar<24CSharedToolTipAttachment>FP7LStream -# CreateFromStream__32TRegistrar<18CSimpleDividedView>FP7LStream -# CreateFromStream__24TRegistrar<10CSizePopup>FP7LStream -# CreateFromStream__27TRegistrar<13CSlaveEnabler>FP7LStream -# CreateFromStream__24TRegistrar<10CSpinningN>FP7LStream -# CreateFromStream__27TRegistrar<13CSplashScreen>FP7LStream -# CreateFromStream__36TRegistrar<22CStringListToolTipPane>FP7LStream -# CreateFromStream__31TRegistrar<17CSwatchBrokerView>FP7LStream -# CreateFromStream__27TRegistrar<13CTSMEditField>FP7LStream -# CreateFromStream__25TRegistrar<11CTabControl>FP7LStream -# CreateFromStream__26TRegistrar<12CTabSwitcher>FP7LStream -# CreateFromStream__27TRegistrar<13CTabbedDialog>FP7LStream -# CreateFromStream__32TRegistrar<18CTableInsertDialog>FP7LStream -# CreateFromStream__37TRegistrar<23CTableKeySingleSelector>FP7LStream -# CreateFromStream__20TRegistrar<7CTarget>FP7LStream -# CreateFromStream__26TRegistrar<12CTaskBarView>FP7LStream -# CreateFromStream__25TRegistrar<11CTearOffBar>FP7LStream -# CreateFromStream__28TRegistrar<14CTearOffWindow>FP7LStream -# CreateFromStream__22TRegistrar<9CTextEdit>FP7LStream -# CreateFromStream__28TRegistrar<14CTextPrefPopup>FP7LStream -# CreateFromStream__24TRegistrar<10CTextTable>FP7LStream -# CreateFromStream__32TRegistrar<18CToolTipAttachment>FP7LStream -# CreateFromStream__26TRegistrar<12CToolTipPane>FP7LStream -# CreateFromStream__29TRegistrar<15CToolbarDragBar>FP7LStream -# CreateFromStream__38TRegistrar<24CToolbarPatternBevelView>FP7LStream -# CreateFromStream__27TRegistrar<13CToolbarPopup>FP7LStream -# CreateFromStream__25TRegistrar<11CURLCaption>FP7LStream -# CreateFromStream__27TRegistrar<13CURLEditField>FP7LStream -# CreateFromStream__25TRegistrar<11CUnknownTag>FP7LStream -# CreateFromStream__29TRegistrar<15CValidEditField>FP7LStream -# CreateFromStream__28TRegistrar<14CWhiteScroller>FP7LStream -# CreateFromStream__29TRegistrar<15LActiveScroller>FP7LStream -# CreateFromStream__20TRegistrar<7LButton>FP7LStream -# CreateFromStream__21TRegistrar<8LCaption>FP7LStream -# CreateFromStream__25TRegistrar<11LCicnButton>FP7LStream -# CreateFromStream__24TRegistrar<10LDialogBox>FP7LStream -# CreateFromStream__26TRegistrar<12LDividedView>FP7LStream -# CreateFromStream__24TRegistrar<10LEditField>FP7LStream -# CreateFromStream__22TRegistrar<9LGroupBox>FP7LStream -# CreateFromStream__22TRegistrar<9LIconPane>FP7LStream -# CreateFromStream__21TRegistrar<8LListBox>FP7LStream -# CreateFromStream__28TRegistrar<14LOffscreenView>FP7LStream -# CreateFromStream__18TRegistrar<5LPane>FP7LStream -# CreateFromStream__21TRegistrar<8LPicture>FP7LStream -# CreateFromStream__26TRegistrar<12LPlaceHolder>FP7LStream -# CreateFromStream__22TRegistrar<9LPrintout>FP7LStream -# CreateFromStream__25TRegistrar<11LRadioGroup>FP7LStream -# CreateFromStream__22TRegistrar<9LScroller>FP7LStream -# CreateFromStream__24TRegistrar<10LStdButton>FP7LStream -# CreateFromStream__26TRegistrar<12LStdCheckBox>FP7LStream -# CreateFromStream__25TRegistrar<11LStdControl>FP7LStream -# CreateFromStream__27TRegistrar<13LStdPopupMenu>FP7LStream -# CreateFromStream__29TRegistrar<15LStdRadioButton>FP7LStream -# CreateFromStream__29TRegistrar<15LSubOverlapView>FP7LStream -# CreateFromStream__22TRegistrar<9LTabGroup>FP7LStream -# CreateFromStream__19TRegistrar<6LTable>FP7LStream -# CreateFromStream__26TRegistrar<12LTableHeader>FP7LStream -# CreateFromStream__30TRegistrar<16LTableViewHeader>FP7LStream -# CreateFromStream__25TRegistrar<11LTextColumn>FP7LStream -# CreateFromStream__22TRegistrar<9LTextEdit>FP7LStream -# CreateFromStream__27TRegistrar<13LToggleButton>FP7LStream -# CreateFromStream__18TRegistrar<5LView>FP7LStream -# CreateFromStream__27TRegistrar<13LWhiteListBox>FP7LStream -# CreateFromStream__20TRegistrar<7LWindow>FP7LStream -# CreateFromStream__43TRegistrar<29MultipleSelectionSingleColumn>FP7LStream -# CreateFromStream__28TRegistrar<14OneRowLListBox>FP7LStream - -### class TXP_GrowableArray_CEditTableCellElement -#{code} -# __dt__39TXP_GrowableArray_CEditTableCellElementFv - -### class TXP_GrowableArray_CEditorPluginInterface -#{code} -# __dt__40TXP_GrowableArray_CEditorPluginInterfaceFv - -### class TXP_GrowableArray_CFileBackup -#{code} -# __dt__29TXP_GrowableArray_CFileBackupFv - -### class TXP_GrowableArray_CStreamOutFile -#{code} -# __dt__32TXP_GrowableArray_CStreamOutFileFv - -### class TXP_GrowableArray_EDT_CellLayoutData -#{code} -# __dt__36TXP_GrowableArray_EDT_CellLayoutDataFv - -### class TXP_GrowableArray_EDT_MetaData -#{code} -# __dt__30TXP_GrowableArray_EDT_MetaDataFv - -### class TXP_GrowableArray_LO_CellStruct -#{code} -# __dt__31TXP_GrowableArray_LO_CellStructFv - -### class TXP_GrowableArray_LO_TableStruct -#{code} -# __dt__32TXP_GrowableArray_LO_TableStructFv - -### class TXP_GrowableArray_char -#{code} -# __dt__22TXP_GrowableArray_charFv - -### class TXP_GrowableArray_int32 -#{code} -# __dt__23TXP_GrowableArray_int32Fv - -### class TXP_GrowableArray_pChar -#{code} -# __dt__23TXP_GrowableArray_pCharFv - -### class TXP_PtrStack_CEditTextElement -#{code} -# __dt__29TXP_PtrStack_CEditTextElementFv - -### class TXP_PtrStack_CParseState -#{code} -# __dt__24TXP_PtrStack_CParseStateFv - -### class TXP_PtrStack_ED_Alignment -#{code} -# __dt__25TXP_PtrStack_ED_AlignmentFv - -### class TXP_PtrStack_ED_TextFormat -#{code} -# __dt__26TXP_PtrStack_ED_TextFormatFv - -### class TXP_PtrStack_TagType -#{code} -# __dt__20TXP_PtrStack_TagTypeFv - -### class TitleImage -#{code} -# DrawInCurrentView__10TitleImageCFRC4RectUl -# __ct__10TitleImageFRC7LStr255s -# __dt__10TitleImageFv -#{data} -# __vt__10TitleImage - -### class UAssortedPrefMediators -#{code} -# RegisterViewClasses__22UAssortedPrefMediatorsFv - -### class UCustomizePopUp -#{code} -# MDEF__15UCustomizePopUpFsPP8MenuInfoP4Rect5PointPs -# PopUpMenuSelect__15UCustomizePopUpFPP8MenuInfoP14LCustomizeMenusss -#{data} -# fCustomize__15UCustomizePopUp -# fMyMenuDefUPP__15UCustomizePopUp -# fOrigMenuDefUPP__15UCustomizePopUp - -### class UFixedFontSwitcher -#{code} -# EncodingTextFont__18UFixedFontSwitcherFUs -# Instance__18UFixedFontSwitcherFv -#{data} -# __vt__18UFixedFontSwitcher -# fTheOnlyInstance__18UFixedFontSwitcher - -### class UFontSwitcher -#{code} -# TextFontDingbats__13UFontSwitcherFv -# TextFontSymbol__13UFontSwitcherFv -#{data} -# __vt__13UFontSwitcher - -### class UFormElementFactory -#{code} -# DisplayFormElement__19UFormElementFactoryFP10CNSContextP27LO_FormElementStruct_struct -# FormTextIsSubmit__19UFormElementFactoryFP27LO_FormElementStruct_struct -# FreeFormElement__19UFormElementFactoryFP25LO_FormElementData_struct -# GetFormElementValue__19UFormElementFactoryFP27LO_FormElementStruct_structUc -# HideFormElement__19UFormElementFactoryFP27LO_FormElementStruct_struct -# MakeButton__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakeFilePicker__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakeFormElem__19UFormElementFactoryFP9CHTMLViewP10CNSContextP27LO_FormElementStruct_struct -# MakeList__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakePopup__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakeReadOnlyFormElem__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakeTextArea__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakeTextFormElem__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# MakeToggle__19UFormElementFactoryFP9CHTMLViewP10CNSContextRlRlRlP27LO_FormElementStruct_struct -# RegisterFormTypes__19UFormElementFactoryFv -# ResetFormElementData__19UFormElementFactoryFP27LO_FormElementStruct_structUcUcUc -# ResetFormElement__19UFormElementFactoryFP27LO_FormElementStruct_structUcUc -# SetFormElementToggle__19UFormElementFactoryFP27LO_FormElementStruct_structUc - -### class UGAAppearance -#{code} -# DrawGAButtonBevelTint__13UGAAppearanceFRC4Rect -# DrawGAButtonDimmedBevelTint__13UGAAppearanceFRC4Rect -# DrawGAButtonPressedBevelTint__13UGAAppearanceFRC4Rect -# DrawGAPopupBevelTint__13UGAAppearanceFRC4Rect -# DrawGAPopupDimmedBevelTint__13UGAAppearanceFRC4Rect -# DrawGAPopupPressedBevelTint__13UGAAppearanceFRC4Rect -#{data} -# sGAFiveGrayLevels__13UGAAppearance -# sGAFourGrayLevels__13UGAAppearance -# sGAHiliteContentTint__13UGAAppearance -# sGAOneGrayLevel__13UGAAppearance -# sGASevenGrayLevels__13UGAAppearance -# sGASixGrayLevels__13UGAAppearance -# sGAThreeGrayLevels__13UGAAppearance -# sGATwoGrayLevels__13UGAAppearance - -### class UGraphicGizmos -#{code} -# AlignRectOnRect__14UGraphicGizmosFR4RectRC4RectUs -# BevelPartialRect__14UGraphicGizmosFRC4RectsRC8RGBColorRC8RGBColorRC12SBooleanRect -# BevelPartialRect__14UGraphicGizmosFRC4RectsssRC12SBooleanRect -# BevelRectAGA__14UGraphicGizmosFRC4RectsRC8RGBColorRC8RGBColor -# BevelRect__14UGraphicGizmosFRC4RectsRC8RGBColorRC8RGBColor -BevelRect__14UGraphicGizmosFRC4Rectsss -# BevelTintLine__14UGraphicGizmosFssssUsUc -# BevelTintPartialRect__14UGraphicGizmosFRC4RectsUsUsRC12SBooleanRect -# BevelTintPixel__14UGraphicGizmosFssUsUc -# BevelTintRect__14UGraphicGizmosFRC4RectsUsUs -# BevelTintRoundRect__14UGraphicGizmosFRC4RectssUsUc -# CalcStringPosition__14UGraphicGizmosFRC4RectsssPC8FontInfo -# CalcWindowTingeColors__14UGraphicGizmosFP8GrafPortR8RGBColorR8RGBColor -# CenterRectOnRect__14UGraphicGizmosFR4RectRC4Rect -# CenterStringInRect__14UGraphicGizmosFPUcRC4Rect -# DrawArithPattern__14UGraphicGizmosFRC4RectRC7PatternUsUc -# DrawPopupArrow__14UGraphicGizmosFRC4RectUcUcUc -# FindInColorTable__14UGraphicGizmosFPP10ColorTables -# GetTingeColorsFromColorTable__14UGraphicGizmosFPP10ColorTableR8RGBColorR8RGBColor -# LoadBevelTraits__14UGraphicGizmosFsR15SBevelColorDesc -# LowerColorVolume__14UGraphicGizmosFRC4RectUs -# LowerRoundRectColorVolume__14UGraphicGizmosFRC4RectssUs -# MixColor__14UGraphicGizmosFRC8RGBColorRC8RGBColors -# PadAlignedRect__14UGraphicGizmosFR4RectUsUs -# PaintDisabledRect__14UGraphicGizmosFRC4RectUsUc -# PlaceStringInRect__14UGraphicGizmosFPUcRC4RectssPC8FontInfo -# PlaceTextInRect__14UGraphicGizmosFPCcUlRC4RectssPC8FontInfoUcs -# RaiseColorVolume__14UGraphicGizmosFRC4RectUs -#{data} -# sDarker__14UGraphicGizmos -# sLighter__14UGraphicGizmos - -### class UGraphics -#{code} -# DarkenRect__9UGraphicsFRC4Rect -# DrawLine__9UGraphicsFssssQ26CPrefs8PrefEnum -# FrameCircleShaded__9UGraphicsFRC4RectUc -# FrameEraseRect__9UGraphicsFRC4RectsUc -# FrameRectBevel__9UGraphicsFRC4RectUcRC8RGBColorRC8RGBColor -# FrameRectMotif__9UGraphicsFRC4RectUc -# FrameRectShaded__9UGraphicsFRC4RectUc -# FrameRectSubtle__9UGraphicsFRC4RectUc -# FrameTopLeftShaded__9UGraphicsFRC4RectsRC8RGBColor -# GetTempRegion__9UGraphicsFv -# HorizLineAtWidth__9UGraphicsFiiiQ26CPrefs8PrefEnum -# Initialize__9UGraphicsFv -# IsColorPort__9UGraphicsFP8GrafPort -# PointInBigRect__9UGraphicsF8SPoint3212SDimension168SPoint32 -# ReleaseTempRegion__9UGraphicsFPP6Region -# SetBack__9UGraphicsFQ26CPrefs8PrefEnum -# SetFore__9UGraphicsFQ26CPrefs8PrefEnum -# SetWindowColor__9UGraphicsFP8GrafPortsRC8RGBColor -# SetWindowColors__9UGraphicsFP7LWindow -# VertLine__9UGraphicsFiiiQ26CPrefs8PrefEnum -#{data} -# sRegionsUsed__9UGraphics -# sTempRegions__9UGraphics - -### class UHTMLPrinting -#{code} -# BeginPrint__13UHTMLPrintingFPP6TPrintP9CHTMLView -# InitCustomPageSetup__13UHTMLPrintingFv -# OpenPageSetup__13UHTMLPrintingFPP6TPrint -# RegisterHTMLPrintClasses__13UHTMLPrintingFv - -### class UMenuUtils -#{code} -# AdjustStringForMenuTitle__10UMenuUtilsFR7cstring -# AppendMenuItem__10UMenuUtilsFPP8MenuInfoPCUcUc -# AppendSeparator__10UMenuUtilsFPP8MenuInfo -# ConvertToIconMenu__10UMenuUtilsFPP8MenuInfos -# GetMenuBarWidth__10UMenuUtilsFv -# InsertMenuItem__10UMenuUtilsFPP8MenuInfoPCUcsUc -# PopupWithTraits__10UMenuUtilsFPP8MenuInfo5Pointss -# PurgeMenuItems__10UMenuUtilsFPP8MenuInfos -#{data} -# sDisabledDummy__10UMenuUtils -# sDisabledSep__10UMenuUtils -# sEnabledDummy__10UMenuUtils - -### class UMultiFontTextHandler -#{data} -# __vt__21UMultiFontTextHandler - -### class UPrefControls -#{code} -# RegisterPrefControlViews__13UPrefControlsFv - -### class UProcessUtils -#{code} -# ApplicationRunning__13UProcessUtilsFUlR19ProcessSerialNumber -# IsFrontProcess__13UProcessUtilsFRC19ProcessSerialNumber -# LaunchApplication__13UProcessUtilsFR6FSSpecUsR19ProcessSerialNumber -# LocateApplication__13UProcessUtilsFUlR6FSSpec -# PullAppToFront__13UProcessUtilsFRC19ProcessSerialNumber - -### class UPropFontSwitcher -#{code} -# EncodingTextFont__17UPropFontSwitcherFUs -# Instance__17UPropFontSwitcherFv -#{data} -# __vt__17UPropFontSwitcher -# fTheOnlyInstance__17UPropFontSwitcher - -### class URDFUtilities -#{code} -# GetContainerSize__13URDFUtilitiesFP18_HT_ResourceStruct -# ShutdownRDF__13URDFUtilitiesFv -# StartupRDF__13URDFUtilitiesFv -# __ct__Q213URDFUtilities16StHTEventMaskingFP14_HT_PaneStructUl -# __dt__Q213URDFUtilities16StHTEventMaskingFv -#{data} -# sIsInited__13URDFUtilities - -### class URobustCreateWindow -#{code} -# CreateWindow__19URobustCreateWindowFsP10LCommander -# ObjectsFromStream__19URobustCreateWindowFP7LStreamPPv -# ReadObjects__19URobustCreateWindowFUlsPPvPs - -### class UStdDialogs -#{code} -# Alert__11UStdDialogsFPCUc10EAlertTypeP7LWindowP10LCommanderP7LStr255 -# AskForNameAndPassword__11UStdDialogsFRC7CStringR7CStringR7CStringP7LWindowP10LCommander -# AskForPassword__11UStdDialogsFRC7CStringR7CStringP7LWindowP10LCommander -# AskOkCancel__11UStdDialogsFPCUcP7LWindowP10LCommanderP7LStr255 -# AskSaveAsSource__11UStdDialogsFR17StandardFileReplyRC7CStringRs -# AskSaveAsTextOrSource__11UStdDialogsFR17StandardFileReplyRC7CStringRs -# AskStandardTextPrompt__11UStdDialogsFRC7CStr255RC7CStr255R7CStringP7LWindowP10LCommanderl -# AskUploadAsDataOrMacBin__11UStdDialogsFR17StandardFileReplyRs -# AskWithCustomButtons__11UStdDialogsFPCUcPCUcPCUcP7LWindowP10LCommanderP7LStr255 -# SaveAsHook__11UStdDialogsFsP8GrafPortPv -# TryToInteract__11UStdDialogsFl -# UploadAsHook__11UStdDialogsFsP8GrafPortPv - -### class UTextBox -#{code} -# DrawTextBox__8UTextBoxFPcUlP4Rectss -# DrawTextBox__8UTextBoxFPcUlP4RectssPsPs -# TBDraw__8UTextBoxFScPclP4Rectsss -# TBLineHeight__8UTextBoxFPcUlP4RectsPs -# TextBoxDialogHeight__8UTextBoxFPcUlP4Rectss - -### class UUTF8TextHandler -#{code} -# DrawString__16UUTF8TextHandlerFP13UFontSwitcherPUc -# DrawText__16UUTF8TextHandlerFP13UFontSwitcherPci -# GetFontInfo__16UUTF8TextHandlerFP13UFontSwitcherP8FontInfo -# Instance__16UUTF8TextHandlerFv -# StringWidth__16UUTF8TextHandlerFP13UFontSwitcherPUc -# TextWidth__16UUTF8TextHandlerFP13UFontSwitcherPci -# UTF8ToUCS2__16UUTF8TextHandlerFPUciPUsUl -#{data} -# __vt__16UUTF8TextHandler -# fTheOnlyInstance__16UUTF8TextHandler - -### class UUnicodeTextHandler -#{code} -# DrawString__19UUnicodeTextHandlerFP13UFontSwitcherPUc -# DrawText__19UUnicodeTextHandlerFP13UFontSwitcherPci -# DrawUnicode__19UUnicodeTextHandlerFP13UFontSwitcherPUsi -# GetFontInfo__19UUnicodeTextHandlerFP13UFontSwitcherP8FontInfo -# Instance__19UUnicodeTextHandlerFv -# StringWidth__19UUnicodeTextHandlerFP13UFontSwitcherPUc -# TextWidth__19UUnicodeTextHandlerFP13UFontSwitcherPci -# UnicodeWidth__19UUnicodeTextHandlerFP13UFontSwitcherPUsi -#{data} -# __vt__19UUnicodeTextHandler -# fTheOnlyInstance__19UUnicodeTextHandler -#{code} -# __dt__43allocatorFv -# __dt__31allocatorFv -# __dt__28allocator<15CUserButtonInfo>Fv -# __dt__34allocatorFv -# __dt__40allocatorFv -# __dt__60allocator<47basic_string,12allocator>>Fv -# __dt__64allocator<51basic_string_ref,12allocator>>Fv -# __dt__12allocatorFv -# __dt__85allocator>9list_node>Fv -# __dt__47allocator>9list_node>Fv -# __dt__12allocatorFv -# __dt__13allocator
        Fv -# __dt__13allocatorFv -# __as__47basic_string,12allocator>FRC47basic_string,12allocator> -# __ct__47basic_string,12allocator>FPCcRC12allocator -# __ct__47basic_string,12allocator>FPCcUlRC12allocator -# __ct__47basic_string,12allocator>FRC12allocator -# __ct__47basic_string,12allocator>FRC47basic_string,12allocator>UlUl -# __dt__47basic_string,12allocator>Fv -# __vc__47basic_string,12allocator>CFUl -# append__47basic_string,12allocator>FRC47basic_string,12allocator> -# append__47basic_string,12allocator>FRC47basic_string,12allocator>UlUl -# c_str__47basic_string,12allocator>CFv -# capacity__47basic_string,12allocator>CFv -# cleanup__47basic_string,12allocator>Fv -# compare__47basic_string,12allocator>CFPCc -# compare__47basic_string,12allocator>CFRC47basic_string,12allocator> -#{data} -# npos__47basic_string,12allocator> -#{code} -# size__47basic_string,12allocator>CFv -# __ct__51basic_string_ref,12allocator>FPCcRC12allocator -# __ct__51basic_string_ref,12allocator>FPCcUlRC12allocator -# __ct__51basic_string_ref,12allocator>FPCcUlUlRC12allocator -# __ct__51basic_string_ref,12allocator>FRC12allocator -# __ct__51basic_string_ref,12allocator>FRC47basic_string,12allocator>UlUlRC12allocator -# __dt__51basic_string_ref,12allocator>Fv -# cleanup__51basic_string_ref,12allocator>Fv -# throwlength__51basic_string_ref,12allocator>Fv -# throwrange__51basic_string_ref,12allocator>Fv -# construct__FPQ212LTableHeader11SColumnDataRCQ212LTableHeader11SColumnData -# construct__FPQ216CHyperTreeHeader10ColumnInfoRCQ216CHyperTreeHeader10ColumnInfo -# copy__FPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfo -# copy_backward__FPQ212LTableHeader11SColumnDataPQ212LTableHeader11SColumnDataPQ212LTableHeader11SColumnData -# copy_backward__FPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfo - -### class cstring -#{code} -# __apl__7cstringFPCc -# __dt__7cstringFv -# assign__7cstringFPCvi -# reserve__7cstringFiUc -# truncAt__7cstringFc -# destroy__FPQ212LTableHeader11SColumnDataPQ212LTableHeader11SColumnData -# destroy__FPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfo -# destroy__FPQ212LTableHeader11SColumnData -# destroy__FPQ216CHyperTreeHeader10ColumnInfo -# destroy>9list_node>__FPQ222list>9list_node -# find>8iterator,l>__FQ222list>8iteratorQ222list>8iteratorRCl -# find_if__FPUlPUlQ213CURLDragMixin40FindBestFlavor_imp$2074CURLDragHelper_cp -# __dt__60list>Fv -# __dt__Q260list>8iteratorFv -# __dt__22list>Fv -# __dt__Q222list>14const_iteratorFv -# __dt__Q222list>8iteratorFv - -### class nsISupports -#{data} -# __vt__11nsISupports - -### class nsPluginInstancePeer -#{code} -# AddRef__20nsPluginInstancePeerFv -# AddRef__Q220nsPluginInstancePeer8InternalFv -# AggregatedQueryInterface__20nsPluginInstancePeerFRC4nsIDPPv -# AllocateMenuID__20nsPluginInstancePeerFi -# ForceRedraw__20nsPluginInstancePeerFv -# GetAttribute__20nsPluginInstancePeerFPCc -# GetAttributes__20nsPluginInstancePeerFRUsRPCPCcRPCPCc -# GetClass__20nsPluginInstancePeerFv -# GetJavaPeer__20nsPluginInstancePeerFv -# GetMIMEType__20nsPluginInstancePeerFv -# GetMode__20nsPluginInstancePeerFv -# GetParameter__20nsPluginInstancePeerFPCc -# GetParameters__20nsPluginInstancePeerFRUsRPCPCcRPCPCc -# GetPluginManager__20nsPluginInstancePeerFv -# GetTagText__20nsPluginInstancePeerFv -# GetTagType__20nsPluginInstancePeerFv -# GetURL__20nsPluginInstancePeerFPCcPCcPvPCcPCci -# GetValue__20nsPluginInstancePeerF23NPPluginManagerVariablePv -# InvalidateRect__20nsPluginInstancePeerFP6nsRect -# InvalidateRegion__20nsPluginInstancePeerFPP6Region -# NewStream__20nsPluginInstancePeerFPCcPCcPP22NPIPluginManagerStream -# PostURL__20nsPluginInstancePeerFPCcPCcUiPCciPvPCcPCciUiPCc -# QueryInterface__20nsPluginInstancePeerFRC4nsIDPPv -# QueryInterface__Q220nsPluginInstancePeer8InternalFRC4nsIDPPv -# RegisterWindow__20nsPluginInstancePeerFPv -# Release__20nsPluginInstancePeerFv -# Release__Q220nsPluginInstancePeer8InternalFv -# SetValue__20nsPluginInstancePeerF16NPPluginVariablePv -# ShowStatus__20nsPluginInstancePeerFPCc -# UnregisterWindow__20nsPluginInstancePeerFPv -# UserAgent__20nsPluginInstancePeerFv -# __ct__20nsPluginInstancePeerFP4_NPP -# __dt__20nsPluginInstancePeerFv -#{data} -# __vt__20nsPluginInstancePeer -# __vt__Q220nsPluginInstancePeer8Internal - -### class nsPluginManager -#{code} -# AddRef__15nsPluginManagerFv -# AddRef__Q215nsPluginManager8InternalFv -# AggregatedQueryInterface__15nsPluginManagerFRC4nsIDPPv -# Create__15nsPluginManagerFP11nsISupportsRC4nsIDPPv -# GetJVMMgr__15nsPluginManagerFRC4nsID -# MemAlloc__15nsPluginManagerFUi -# MemFlush__15nsPluginManagerFUi -# MemFree__15nsPluginManagerFPv -# QueryInterface__15nsPluginManagerFRC4nsIDPPv -# QueryInterface__Q215nsPluginManager8InternalFRC4nsIDPPv -# Release__15nsPluginManagerFv -# Release__Q215nsPluginManager8InternalFv -# ReloadPlugins__15nsPluginManagerFi -# __ct__15nsPluginManagerFP11nsISupports -# __dt__15nsPluginManagerFv -#{data} -# __vt__15nsPluginManager -# __vt__Q215nsPluginManager8Internal - -### class nsPluginManagerStream -#{code} -# AddRef__21nsPluginManagerStreamFv -# GetEnd__21nsPluginManagerStreamFv -# GetLastModified__21nsPluginManagerStreamFv -# GetNotifyData__21nsPluginManagerStreamFv -# GetURL__21nsPluginManagerStreamFv -# QueryInterface__21nsPluginManagerStreamFRC4nsIDPPv -# Release__21nsPluginManagerStreamFv -# WriteReady__21nsPluginManagerStreamFv -# Write__21nsPluginManagerStreamFiPCc -# __ct__21nsPluginManagerStreamFP4_NPPP9_NPStream -# __dt__21nsPluginManagerStreamFv -#{data} -# __vt__21nsPluginManagerStream - -### class nsPluginStreamPeer -#{code} -# AddRef__18nsPluginStreamPeerFv -# GetContentLength__18nsPluginStreamPeerFv -# GetEnd__18nsPluginStreamPeerFv -# GetHeaderFieldCount__18nsPluginStreamPeerFv -# GetHeaderFieldKey__18nsPluginStreamPeerFUi -# GetHeaderField__18nsPluginStreamPeerFUi -# GetLastModified__18nsPluginStreamPeerFv -# GetMIMEType__18nsPluginStreamPeerFv -# GetNotifyData__18nsPluginStreamPeerFv -# GetReason__18nsPluginStreamPeerFv -# GetURL__18nsPluginStreamPeerFv -# QueryInterface__18nsPluginStreamPeerFRC4nsIDPPv -# Release__18nsPluginStreamPeerFv -# RequestRead__18nsPluginStreamPeerFP11nsByteRange -# __ct__18nsPluginStreamPeerFP11URL_Struct_P10_np_stream -# __dt__18nsPluginStreamPeerFv -#{data} -# __vt__18nsPluginStreamPeer -#{code} -# uninitialized_copy__FPQ212LTableHeader11SColumnDataPQ212LTableHeader11SColumnDataPQ212LTableHeader11SColumnData -# uninitialized_copy__FPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfo -# __dt__86vector>Fv -# erase__86vector>FPQ216CHyperTreeHeader10ColumnInfoPQ216CHyperTreeHeader10ColumnInfo -# insert_aux__86vector>FPQ216CHyperTreeHeader10ColumnInfoRCQ216CHyperTreeHeader10ColumnInfo -# push_back__86vector>FRCQ216CHyperTreeHeader10ColumnInfo -# __ct__56vector<15CUserButtonInfo,28allocator<15CUserButtonInfo>>FUlRC15CUserButtonInfoRC28allocator<15CUserButtonInfo> -# __dt__56vector<15CUserButtonInfo,28allocator<15CUserButtonInfo>>Fv -# __dt__68vector>Fv -# erase__68vector>FPP20LO_EdgeStruct_struct -# insert_aux__68vector>FPP20LO_EdgeStruct_structRCP20LO_EdgeStruct_struct -# push_back__68vector>FRCP20LO_EdgeStruct_struct -# __dt__80vector>Fv -# insert_aux__80vector>FPQ212LTableHeader11SColumnDataRCQ212LTableHeader11SColumnData -# push_back__80vector>FRCQ212LTableHeader11SColumnData -# __dt__120vector<47basic_string,12allocator>,60allocator<47basic_string,12allocator>>>Fv -# erase__120vector<47basic_string,12allocator>,60allocator<47basic_string,12allocator>>>FP47basic_string,12allocator>P47basic_string,12allocator> -# insert_aux__120vector<47basic_string,12allocator>,60allocator<47basic_string,12allocator>>>FP47basic_string,12allocator>RC47basic_string,12allocator> -# push_back__120vector<47basic_string,12allocator>,60allocator<47basic_string,12allocator>>>FRC47basic_string,12allocator> -# __ct__24vector>FUlRCcRC12allocator -# __dt__24vector>Fv -# __ct__26vector>FUlRCUlRC13allocator
          -# __dt__26vector>Fv -# erase__26vector>FPUlPUl -# insert__26vector>FPUlPCUlPCUl -# insert__26vector>FPUlUlRCUl -# __ct__26vector>FUlRCUsRC13allocator -# __dt__26vector>Fv - -### class wfDlm -#{code} -# __ct__5wfDlmFPCcPCc -# __dt__5wfDlmFv -# createDisplayerObject__5wfDlmFP5nffbp -# describe__5wfDlmFv -# filename__5wfDlmFv -# finalize__5wfDlmFv -# findSymbol__5wfDlmFPCc -# isChanged__5wfDlmFv -# isEmpty__5wfDlmFPCc -# load__5wfDlmFv -# reconstruct__5wfDlmFPCc -# status__5wfDlmFv -# sync__5wfDlmFv -# unload__5wfDlmFi - -### class wfFontObjectCache -#{code} -# RcFmi2Font__17wfFontObjectCacheFP4nfrcP5nffmi -# Rf2Font__17wfFontObjectCacheFP4nfrf -# __ct__17wfFontObjectCacheFv -# __dt__17wfFontObjectCacheFv -# add__17wfFontObjectCacheFP5nffmiP3nff -# releaseFont__17wfFontObjectCacheFP3nff -# releaseRf__17wfFontObjectCacheFP4nfrf - -### class wfList -#{code} -# __ct__6wfListFPFP6wfListPv_v -# __dt__6wfListFv -# add__6wfListFPv -# count__6wfListFv -# find__6wfListFPv -# isEmpty__6wfListFv -# isExist__6wfListFPv -# iterate__6wfListFPFPv_Q26wfList10ERROR_CODE -# listAdd__6wfListFP13wfListElement -# listDeleteItem__6wfListFPv -# listRemove__6wfListFP13wfListElement -# removeAll__6wfListFv -# remove__6wfListFPv - -### class wfMimeList -#{code} -# __ct__10wfMimeListFPCc -# __dt__10wfMimeListFv -# describe__10wfMimeListFv -# finalize__10wfMimeListFv -# find__10wfMimeListFPCc -# getMimetypeFromExtension__10wfMimeListFPCc -# isEnabled__10wfMimeListFPCc -# reconstruct__10wfMimeListFPCc -# setEnabledStatus__10wfMimeListFPCci - -### class wfSizesList -#{code} -# __ct__11wfSizesListFv -# __dt__11wfSizesListFv -# addRf__11wfSizesListFP4nfrf -# addSizes__11wfSizesListFPd -# freeSizes__11wfSizesListFv -# getRfCount__11wfSizesListFv -# getRf__11wfSizesListFd -# getSizes__11wfSizesListFv -# initialized__11wfSizesListFv -# isRfExist__11wfSizesListFP4nfrf -# removeRf__11wfSizesListFP4nfrf -# removeSize__11wfSizesListFd -# supportsSize__11wfSizesListFd - -### class xlateRefCountList -#{code} -# Dec__17xlateRefCountListFPPc -# Inc__17xlateRefCountListFl -# init__17xlateRefCountListFv - - -### -### Symbols which are not present, but you wanted to export anyway (i.e., either re-exports or mistakes)... -### - -#{code} -dbopen -qd diff --git a/mozilla/cmd/macfe/projects/client/Navigator.exp_MakeStubs b/mozilla/cmd/macfe/projects/client/Navigator.exp_MakeStubs deleted file mode 100644 index 96a1866cdd8..00000000000 --- a/mozilla/cmd/macfe/projects/client/Navigator.exp_MakeStubs +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/) - -MakeStub "{{SourceFile}}" -o "{{¨0}}NavigatorStubs" ¶ - -fragname Navigator ¶ - -vercur 400 -verdef 400 -verimp 400 diff --git a/mozilla/cmd/macfe/projects/client/Navigator.exp_TS b/mozilla/cmd/macfe/projects/client/Navigator.exp_TS deleted file mode 100644 index 063b2886a23..00000000000 --- a/mozilla/cmd/macfe/projects/client/Navigator.exp_TS +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/) - -MakeStub "{{SourceFile}}" -o "{{¨0}}::::dist:client_stubs:NavigatorStubs" ¶ - -fragname Navigator ¶ - -vercur 400 -verdef 400 -verimp 400 diff --git a/mozilla/cmd/macfe/projects/client/NavigatorDebugExtras.exp b/mozilla/cmd/macfe/projects/client/NavigatorDebugExtras.exp deleted file mode 100644 index 934fae50e36..00000000000 --- a/mozilla/cmd/macfe/projects/client/NavigatorDebugExtras.exp +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -# export debugging functions -#{code} -NOT_NULL -XP_TraceInit -FE_Trace diff --git a/mozilla/cmd/macfe/projects/client/NavigatorDebugExtras.exp_TS b/mozilla/cmd/macfe/projects/client/NavigatorDebugExtras.exp_TS deleted file mode 100644 index d66e6a10766..00000000000 --- a/mozilla/cmd/macfe/projects/client/NavigatorDebugExtras.exp_TS +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/) - -MakeStub "{{SourceFile}}" -o "{{¨0}}::::dist:client_stubs:NavigatorDebugExtras" ¶ - -fragname Navigator ¶ - -vercur 400 -verdef 400 -verimp 400 diff --git a/mozilla/cmd/macfe/projects/dummies/MakeDummies.mcp b/mozilla/cmd/macfe/projects/dummies/MakeDummies.mcp deleted file mode 100644 index 76467bb1c36..00000000000 Binary files a/mozilla/cmd/macfe/projects/dummies/MakeDummies.mcp and /dev/null differ diff --git a/mozilla/cmd/macfe/projects/dummies/dummy.c b/mozilla/cmd/macfe/projects/dummies/dummy.c deleted file mode 100644 index eb6d0caf7d1..00000000000 --- a/mozilla/cmd/macfe/projects/dummies/dummy.c +++ /dev/null @@ -1,33 +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. - */ - -/* - The one and only job of this project is to provide dummy - libraries for the main project, when you are doing a build - with some components turned off. - - For example, if you compile MOZ_LITE, there is no editor. - But to avoid having to have multiple targets in the final - project, we just provide a stub library from here, to - keep the IDE happy. - - There will be one target for each dummy library that we - need. -*/ - -void NuthinToDo(void) {} diff --git a/mozilla/cmd/macfe/projects/interfaceLib/Interface.mcp b/mozilla/cmd/macfe/projects/interfaceLib/Interface.mcp deleted file mode 100644 index 1b511d0be4e..00000000000 Binary files a/mozilla/cmd/macfe/projects/interfaceLib/Interface.mcp and /dev/null differ diff --git a/mozilla/cmd/macfe/rdfui/CHyperTreeFlexTable.cp b/mozilla/cmd/macfe/rdfui/CHyperTreeFlexTable.cp deleted file mode 100644 index 71befbf159a..00000000000 --- a/mozilla/cmd/macfe/rdfui/CHyperTreeFlexTable.cp +++ /dev/null @@ -1,1753 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Subclass of CStandardFlexTable to handle working with XP RDF Hyper Trees -// - -#include "CHyperTreeFlexTable.h" - -// PowerPlant -#include -#include -#include - -#include "CHyperTreeHeader.h" -#include "URDFUtilities.h" -#include "uapp.h" -#include "CURLDragHelper.h" -#include "CIconTextDragTask.h" -#include "CNetscapeWindow.h" -#include "resgui.h" -#include "macutil.h" -#include "ufilemgr.h" -#include "CInlineEditField.h" -#include "CContextMenuAttachment.h" -#include "libi18n.h" -#include -#include - - -extern RDF_NCVocab gNavCenter; // RDF vocab struct for NavCenter - - -const ResIDT cFolderIconID = kGenericFolderIconResource; -const ResIDT cItemIconID = 15313; -const ResIDT cFileIconID = kGenericDocumentIconResource; - - -#pragma mark -- class CHyperTreeFlexTable -- - - - -// ------------------------------------------------------------ -// Construction, Destruction -// ------------------------------------------------------------ - -CHyperTreeFlexTable::CHyperTreeFlexTable(LStream* inStream) - : CStandardFlexTable(inStream), - mHTView(NULL), - mHTNotificationData(NULL), - mViewBeforeDrag(NULL) -{ - mSendDataUPP = NewDragSendDataProc(LDropArea::HandleDragSendData); - ThrowIfNil_(mSendDataUPP); - - // turn on spring-loading of folders during d&d - mAllowAutoExpand = true; - mTextDrawingStuff.encoding = TextDrawingStuff::eUTF8; -} - - -CHyperTreeFlexTable::~CHyperTreeFlexTable() -{ -} - - - - -// ------------------------------------------------------------ -// CStandardFlexTable overrides -// ------------------------------------------------------------ -ResIDT CHyperTreeFlexTable::GetIconID(TableIndexT inRow) const -{ - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inRow) ); - if (node) { - if ( HT_IsContainer(node) ) - return cFolderIconID; - else { - char* url = HT_GetNodeURL(node); - if ( url && *url == 'f' ) // is it a file url? - return cFileIconID; - else - return cItemIconID; - } - } - return cItemIconID; -} - - -// -// SetUpTableHelpers -// -// Call the inherited version to do most of the work but replace the -// selector with our own version to track the selection in the HT_API -// -void -CHyperTreeFlexTable :: SetUpTableHelpers() -{ - CStandardFlexTable::SetUpTableHelpers(); - - // replace selector.... - SetTableSelector( new CHyperTreeSelector(this) ); - -} // SetupTableHelpers - - -// -// GetHiliteTextRect -// -// Find out what rectangle to draw selected in the currently selected row. This is -// based on the item title. -// -Boolean -CHyperTreeFlexTable::GetHiliteTextRect ( TableIndexT inRow, Boolean /*inOkIfRowHidden*/, Rect& outRect) const -{ - STableCell cell(inRow, GetHiliteColumn()); - if (!GetLocalCellRect(cell, outRect)) - return false; - Rect iconRect; - GetIconRect(cell, outRect, iconRect); - outRect.left = iconRect.right; - - // Get cell data for first column - char buffer[1000]; - GetHiliteText(inRow, buffer, 1000, false, &outRect); - - return true; - -} // GetHiliteTextRect - - -// -// GetMainRowText -// -// Returns the text of the title of the item. -// -void -CHyperTreeFlexTable :: GetMainRowText( TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const -{ - if (!outText || inMaxBufferLength == 0) - return; - - void* data; - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header != NULL); - CHyperTreeHeader::ColumnInfo info = header->GetColumnInfo(FindTitleColumnID()-1); // GCI() is 0-based - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inRow) ); - if ( node && HT_GetNodeData(node, info.token, info.tokenType, &data) ) { - char* title = static_cast(data); - strcpy ( outText, title ); - } - else - *outText = NULL; - -} // GetMainRowText -//---------------------------------------------------------------------------------------- -void CHyperTreeFlexTable::SetEditParam(int w, int h, char* utf8, SPoint32& ImagePoint) - -{ - mNameEditor->ResizeFrameTo(w, h, true); - char* editText = (char*) INTL_ConvertLineWithoutAutoDetect( - CS_UTF8, INTL_GetCharSetID(INTL_DefaultTextWidgetCsidSel), - (unsigned char*)utf8, strlen(utf8)); - mNameEditor->UpdateEdit(CStr255(editText), &ImagePoint, nil); - XP_FREEIF(editText); -} // SetEditParam -// -// FindTitleColumnID -// -// Returns the index of the column that contains the item title and icon. This will search out the -// correct column by looking at the column headers. -// -// NOTE: THERE IS CURRENTLY NO BACKEND SUPPORT FOR REORDERING COLUMNS, SO WE MAKE AN EXPLICIT -// ASSUMPTION THAT THE FIRST COLUMN IS THE TITLE COLUMN. AT LEAST THIS SHOULD BE THE ONLY -// ROUTINE THAT HAS TO CHANGE WHEN THAT ASSUMPTION CHANGES. -// -Uint32 -CHyperTreeFlexTable :: FindTitleColumnID ( ) const -{ - return 1; // for now.... - -} // FindTitleColumnID - - -// -// CellInitiatesDrag -// -// Determines if a cell is allowed to start a drag. We disallow this for any cell except for the -// cell with the title and icon. Also disallow d&d when selection is not allowed in this view -// (simple tree). -// -Boolean -CHyperTreeFlexTable :: CellInitiatesDrag ( const STableCell& inCell ) const -{ -#ifdef USE_SELECTION_PROP - return inCell.col == FindTitleColumnID() && - URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->useSelection, true) == true - ? true : false; -#else - return inCell.col == FindTitleColumnID(); -#endif - -} // CellInitiatesDrag - - -// -// CellSelects -// -// Determines if a cell is allowed to select the row. We disallow this for any cell except for the -// cell with the title and icon. Also disallow selection when selection is not allowed in this view -// (simple tree). -// -Boolean -CHyperTreeFlexTable :: CellSelects ( const STableCell& inCell ) const -{ -#ifdef USE_SELECTION_PROP - return inCell.col == FindTitleColumnID() && - URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->useSelection, true) == true - ? true : false; -#else - return inCell.col == FindTitleColumnID(); -#endif - -} // CellSelects - - -#ifdef USE_SELECTION_PROP -// (pinkerton) -// This stuff is not needed if we allow the table to always select things. CStdFlexTable -// will try to open the selection automatically if the click count is set correctly, which -// we know it is. Just leaving in this code until we make up our collective minds on if -// selection should always be enabled on tree views. - -// -// CellWantsClick -// -// This is used in the flex table to allow the cell a chance at the click even if it is not -// supposed to select anything. This is the case when the tree is in single-click mode because -// we still want to respond to clicks even though the cell does not select. -// -Boolean -CHyperTreeFlexTable :: CellWantsClick( const STableCell & inCell ) const -{ - return true; - -} // CellWantsClick - - -// -// ClickCell -// -// If we're in single-click mode, do an open. -// -void -CHyperTreeFlexTable :: ClickCell ( const STableCell & inCell, const SMouseDownEvent & inMouse ) -{ - if ( inCell.col == FindTitleColumnID() && ClickCountToOpen() == 1 ) { - if ( ! ::WaitMouseMoved(inMouse.macEvent.where) ) - OpenRow ( inCell.row ); - } - else - CStandardFlexTable::ClickCell ( inCell, inMouse ); - -} // ClickCell - -#endif - - -// -// DoHiliteRgn -// -// Override to not use the hilite color, since that would be confusing with in-place editing. -// This is called when the user clicks on a row in the table to hilite that particular row. -// The routine below is called when updating the window. -// -void -CHyperTreeFlexTable :: DoHiliteRgn ( RgnHandle inHiliteRgn ) const -{ - ::InvertRgn ( inHiliteRgn ); - -} // DoHiliteRgn - - -// -// DoHiliteRect -// -// Override not to use hilite color, since it doesn't draw very well over the gray background. -// -void -CHyperTreeFlexTable :: DoHiliteRect ( const Rect & inHiliteRect ) const -{ - ::InvertRect ( &inHiliteRect ); - -} // DoHiliteRect - - -// -// HiliteSelection -// -// Overload the LTableView class' version of this routine to hilite the selected items -// without setting the hilite bit before drawing. This is called when the window is updating -// to redraw the selected items. -// -void -CHyperTreeFlexTable :: HiliteSelection( Boolean inActively, Boolean /*inHilite*/) -{ - if (FocusExposed()) { - StRegion hiliteRgn; - GetHiliteRgn(hiliteRgn); - StColorPenState saveColorPen; // Preserve color & pen state - StColorPenState::Normalize(); - - if (inActively) - ::InvertRgn(hiliteRgn); - else { - ::PenMode(srcXor); - ::FrameRgn(hiliteRgn); - } - } - -} // HiliteSelection - - -// -// SyncSelectionWithHT -// -// The selection has somehow changed by the backend's decree. Make sure that we are in -// sync with that. -// -void -CHyperTreeFlexTable :: SyncSelectionWithHT ( ) -{ - CHyperTreeSelector* sel = dynamic_cast(GetTableSelector()); - Assert_( sel != NULL); - - sel->SyncSelectorWithHT(); - - SelectionChanged(); - ScrollSelectionIntoFrame(); - -} // SyncSelectionWithHT - - -// -// ImageIsReady -// -// Called when the bg image is done loading. Just refresh and we'll pick it up. -// -void -CHyperTreeFlexTable :: ImageIsReady ( ) -{ - Refresh(); - -} // ListenToMessage - - -// -// DrawStandby -// -// Draw something reasonable when the background image has not yet been loaded or if the bg image -// cannot be found -// -void -CHyperTreeFlexTable :: DrawStandby ( const Point & /*inTopLeft*/, const IconTransformType /*inTransform*/ ) const -{ - EraseTableBackground(); - -} // DrawStandby - - -// -// EraseTableBackground -// -// Erase the background of the table with the specified color from HT or with the appropriate -// AppearanceManager colors -// -void -CHyperTreeFlexTable :: EraseTableBackground ( ) const -{ - // draw the unsorted column color all the way down. The sort column can redraw it cell by cell - size_t viewHeight = max(mImageSize.height, static_cast(mFrameSize.height)); - Rect backRect = { 0, 0, viewHeight, mImageSize.width }; - - URDFUtilities::SetupBackgroundColor ( TopNode(), gNavCenter->viewBGColor, kThemeListViewBackgroundBrush ); - ::EraseRect(&backRect); - -} // EraseTableBackground - - -void -CHyperTreeFlexTable :: DrawIconsSelf( const STableCell& inCell, IconTransformType inTransformType, - const Rect& inIconRect) const -{ - HT_Resource cellNode = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inCell.row) ); - - // draw the gif if specified, otherwise draw the normal way. - char* url = NULL; - PRBool success = HT_GetNodeData ( cellNode, gNavCenter->RDF_smallIcon, HT_COLUMN_STRING, &url ); - if ( success && url ) { - - // extract the image drawing class out of the HT node. If one is not there yet, - // create it. - CTreeIcon* icon = static_cast(HT_GetNodeFEData(cellNode)); - if ( !icon ) { - icon = new CTreeIcon(url, const_cast(this), cellNode); - if ( !icon ) - return; - HT_SetNodeFEData(cellNode, icon); - } - - // setup where we should draw - Point topLeft; - topLeft.h = inIconRect.left; topLeft.v = inIconRect.top; - uint16 width = inIconRect.right - inIconRect.left; - uint16 height = inIconRect.bottom - inIconRect.top; - - // draw - icon->SetImageURL ( url ); - icon->DrawImage ( topLeft, kTransformNone, width, height ); - } - else { - // use the "open state" transform if container is open, but only if the triggers are hidden. - // The Finder doesn't use the open state in list view because it uses the triangles - // to show that. However, if they aren't being shown, we need another way to indicate - // an open container to the user. - if ( HT_IsContainerOpen(cellNode) && - URDFUtilities::PropertyValueBool( TopNode(), gNavCenter->showTreeConnections, true) == false ) - inTransformType |= kTransformOpen; - CStandardFlexTable::DrawIconsSelf(inCell, inTransformType, inIconRect); - } - -} // DrawIconsSelf - - -// -// DrawSelf -// -// Overridden to draw the background image, if one is present on the current view -// -void -CHyperTreeFlexTable :: DrawSelf ( ) -{ - mHasBackgroundImage = false; - Point topLeft = { 0, 0 }; - HT_Resource topNode = TopNode(); - size_t viewHeight = max(mImageSize.height, static_cast(mFrameSize.height)); - if ( topNode ) { - char* url = NULL; - PRBool success = HT_GetNodeData ( topNode, gNavCenter->viewBGURL, HT_COLUMN_STRING, &url ); - if ( success && url ) { - // draw the background image tiled to fill the whole pane - mHasBackgroundImage = true; - SetImageURL ( url ); - DrawImage ( topLeft, kTransformNone, mImageSize.width, viewHeight ); - FocusDraw(); - } - else - EraseTableBackground(); - - CStandardFlexTable::DrawSelf(); - } - -} // DrawSelf - - -// -// RedrawRow -// -// Redraw the row corresponding to the given HT node -// -void -CHyperTreeFlexTable :: RedrawRow ( HT_Resource inNode ) const -{ - TableIndexT row = URDFUtilities::HTRowToPPRow(HT_GetNodeIndex(HT_GetView(inNode), inNode)); - RefreshRowRange( row, row ); - -} // RedrawRow - - -// -// EraseCellBackground -// -// Make the backdrop of the cell look like the Finder in OS8 or whatever the user has explicitly -// set via HT properties. If there is a background image, of course, don't draw the background. The -// default list background has already been painted, so only do something if there is a difference. -// -void -CHyperTreeFlexTable :: EraseCellBackground ( const STableCell& inCell, const Rect& inLocalRect ) -{ - StColorPenState saved; - - if ( !mHasBackgroundImage ) - { - PaneIDT columnPane; - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header != NULL); - - // only need to draw if this column in sorted - if ( inCell.col == header->GetSortedColumn(columnPane) ) { - Rect backRect = inLocalRect; - backRect.bottom--; // leave a one pixel line on the bottom as separator - backRect.right++; // cover up vertical dividing line on right side - - URDFUtilities::SetupBackgroundColor ( TopNode(), gNavCenter->sortColumnBGColor, - kThemeListViewSortColumnBackgroundBrush ); - ::EraseRect(&backRect); - } // if this column is sorted - } // if no bg image - - // draw the separator line if HT says to. This will draw it even if there is a bg image. - if ( URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->showDivider, true) ) { - URDFUtilities::SetupBackgroundColor ( TopNode(), gNavCenter->dividerColor, - kThemeListViewSeparatorBrush ); - Rect divider = { inLocalRect.bottom - 1, inLocalRect.left, inLocalRect.bottom, inLocalRect.right }; - ::EraseRect ( ÷r ); - } - -} // EraseCellBackground - - -// -// DrawCellContents -// -// Draw what goes inside each cell, naturally -// -void -CHyperTreeFlexTable::DrawCellContents( const STableCell& inCell, const Rect& inLocalRect) -{ - PaneIDT cellType = GetCellDataType(inCell); - - // Get info for column - PaneIDT columnPane; - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header != NULL); - CHyperTreeHeader::ColumnInfo info = header->GetColumnInfo(inCell.col - 1); - - // Get cell data - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inCell.row) ); - if (node) { - if ( HT_IsSeparator(node) ) { - - Uint16 left = inLocalRect.left; - - if ( inCell.col == FindTitleColumnID() ) { - left = DrawIcons(inCell, inLocalRect); - left += CStandardFlexTable::kDistanceFromIconToText; - } - - // setup the color based on if this cell is in the sorted column. Note that while - // HT has the concept of a different fg color for sorted columns, AM does not. - StColorPenState saved; - if ( inCell.col == header->GetSortedColumn(columnPane) ) - URDFUtilities::SetupForegroundColor ( TopNode(), gNavCenter->sortColumnFGColor, - kThemeListViewTextColor ); - else - URDFUtilities::SetupForegroundColor ( TopNode(), gNavCenter->viewFGColor, - kThemeListViewTextColor ); - - ::MoveTo ( left, - inLocalRect.top + ((inLocalRect.bottom - inLocalRect.top) / 2) ); - ::PenSize ( 2, 2 ); - ::PenPat ( &qd.gray ); - ::Line ( inLocalRect.right - left, 0 ); - } // if is a separator - else { - void* data; - char* str; - Rect localRect = inLocalRect; - if (HT_GetNodeData(node, info.token, info.tokenType, &data) && data) - { - switch (info.tokenType) { - case HT_COLUMN_STRING: - case HT_COLUMN_DATE_STRING: - str = static_cast(data); - if (inCell.col == FindTitleColumnID()) - { - localRect.left = DrawIcons(inCell, localRect); - localRect.left += CStandardFlexTable::kDistanceFromIconToText; - } - break; - - case HT_COLUMN_DATE_INT: - case HT_COLUMN_INT: - char intStr[32]; - sprintf(intStr, "%d", (int)data); - str = intStr; - break; - } - - // setup the text color based on if this cell is in the sorted column. Note that while - // HT has the concept of a different fg color for sorted columns, AM does not. - StColorPenState saved; - if ( inCell.col == header->GetSortedColumn(columnPane) ) - URDFUtilities::SetupForegroundTextColor ( TopNode(), gNavCenter->sortColumnFGColor, - kThemeListViewTextColor ); - else - URDFUtilities::SetupForegroundTextColor ( TopNode(), gNavCenter->viewFGColor, - kThemeListViewTextColor ); - DrawTextString(str, mTextDrawingStuff, 0, localRect); - } - } // else a normal item - } // if node valid - -} // DrawCellContents - - -Boolean CHyperTreeFlexTable::CellHasDropFlag(const STableCell& inCell, Boolean& outIsExpanded) const -{ - // bail quickly if this cell isn't a title column or tree connections are turned off - if ( FindTitleColumnID() != inCell.col || - URDFUtilities::PropertyValueBool( TopNode(), gNavCenter->showTreeConnections, true) == false ) - return false; - - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inCell.row) ); - if (node) - { - PRBool result = HT_IsContainer(node); - if (result) - { - PRBool openState; - HT_Error err = HT_GetOpenState(node, &openState); - if (err == HT_NoErr) - outIsExpanded = openState; - } - else - outIsExpanded = false; - return result; - } - return false; - -} // CellHasDropFlag - - -UInt16 CHyperTreeFlexTable::GetNestedLevel(TableIndexT inRow) const -{ - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inRow) ); - if (node) - { - // subtract one because root node as indentation of 1 - return (HT_GetItemIndentation(node) - 1); - } - return CStandardFlexTable::GetNestedLevel(inRow); -} - - -// -// SetCellExpansion -// -// User clicked on the disclosure triangle, tell HT to open/close the container. This call -// may fail if the user has password protected the folder and they get the password wrong. -// If that is the case, redraw the drop flag to its correct state. -// -void CHyperTreeFlexTable::SetCellExpansion( - const STableCell& inCell, - Boolean inExpand) -{ - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inCell.row) ); - if (node) - { - if ( HT_SetOpenState(node, (PRBool)inExpand) != noErr ) - RefreshCell(inCell); - } -} - - -// -// SetupColumns -// -// Build columns from HT. Simply pitches existing columns and rebuilds from scratch. -// -void -CHyperTreeFlexTable :: SetupColumns ( ) -{ - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - if ( !header ) - return; - - header->SetUpColumns( GetHTView() ); - SynchronizeColumnsWithHeader(); - -} // SetupColumns - - -// ------------------------------------------------------------ -// HT Operations -// ------------------------------------------------------------ - - -// -// OpenView -// -// opens up the given view in the navCenter (such as bookmarks). Make sure the selector for this -// table knows about new view, sync the number of rows in the table with the -// number of rows in the HT and setup the columns. -// -// This routine is called as a result of the HT notification mechanism (not directly from any -// FE events like clicks). That means that the shelf may not be open yet. -// -void -CHyperTreeFlexTable::OpenView( HT_View inHTView ) -{ - // Hide the inline editor. This will send us a message that the name changed and attempt - // to redraw the entire window. We don't want this because is causes an ugly flash as it - // redraws the old view then draws the new view. Setting the visRgn to empty prevents - // the redraw of the old view. - if ( mNameEditor && mNameEditor->IsVisible() ) { - StVisRgn saved(GetMacPort()); - mNameEditor->UpdateEdit(nil, nil, nil); - } - - // save existing column information for the next time the user comes back to this - // view. Note we do not reflect any of this into HT, so it will be lost when the user - // quits or opens a new window (I think). We currently save which columns are visible, - // their widths, and sort state. - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header != NULL); - TableIndexT visColumns = header->CountVisibleColumns(); - if ( visColumns ) { - //¥¥¥ implement this. Recall that currently the FE data is used to store the - //¥¥¥ SelectorData stuff. We'll have to create a new structure that wraps both - //¥¥¥ this info and that. - } - - mHTView = mViewBeforeDrag = inHTView; - CHyperTreeSelector* sel = dynamic_cast(GetTableSelector()); - Assert_( sel != NULL); - sel->TreeView ( inHTView ); - - // Rebuild the column headers based on the new view contents and which columns the - // user had visible last time. - SetupColumns(); - -//¥¥¥hack until rjc gets the columns to remember visibility across pane deletions -//¥¥¥this should not go in the shipping product! (pinkerton) - header->SetRightmostVisibleColumn(1); - - Uint32 count = HT_GetItemListCount(inHTView); - if (mRows != count) - { - if (count > mRows) - InsertRows(count - mRows, 0, NULL, 0, false); - else - RemoveRows(mRows - count, 0, true); - } - - SyncSelectionWithHT(); - - // redraw the table. If the mouse is down, we're probably in the middle of a - // drag and drop so we want to redraw NOW (not when we get an update event after - // the mouse has been released). - if ( ::StillDown() ) { - UnselectAllCells(); - FocusDraw(); - Rect localRect; - CalcLocalFrameRect(localRect); - localRect.left++; - ::EraseRect(&localRect); - GetSuperView()->Draw(nil); // redraw NOW to get the # of visible rows correct - } - else - Refresh(); - - // make sure the number of clicks to open a row is correct - if ( URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->useSingleClick, false) == true ) - mClickCountToOpen = 1; - -} - -void CHyperTreeFlexTable::ExpandNode(HT_Resource inHTNode) -{ - Int32 index = HT_GetNodeIndex(GetHTView(), inHTNode); - - Uint32 count = HT_GetCountVisibleChildren(inHTNode); - if (count > 0) - InsertRows(count, index + 1, NULL, 0, true); -} - -void CHyperTreeFlexTable::CollapseNode(HT_Resource inHTNode) -{ - Int32 index = HT_GetNodeIndex(GetHTView(), inHTNode); - - Uint32 count = HT_GetCountVisibleChildren(inHTNode); - if (count > 0) - RemoveRows(count, index + 2, true); -} - -//----------------------------------- -// Commands -//----------------------------------- - -// -// FindCommandStatus -// -void -CHyperTreeFlexTable :: FindCommandStatus ( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) -{ - // safety check - if ( ! mHTView ) - return; - - HT_Pane thePane = HT_GetPane(mHTView); - - outUsesMark = false; - - if ( inCommand >= cmd_NavCenterBase && inCommand <= cmd_NavCenterCap ) { - outEnabled = HT_IsMenuCmdEnabled(thePane, (HT_MenuCmd)(inCommand - cmd_NavCenterBase)); - return; - } - - // process the regular menus... - switch ( inCommand ) { - - // - // handle commands that we have to share with other parts of the UI - // - case cmd_Cut: - outEnabled = HT_IsMenuCmdEnabled(thePane, HT_CMD_CUT ); - break; - case cmd_Copy: - outEnabled = HT_IsMenuCmdEnabled(thePane, HT_CMD_COPY ); - break; - case cmd_Paste: - outEnabled = HT_IsMenuCmdEnabled(thePane, HT_CMD_PASTE ); - break; - case cmd_Clear: - outEnabled = HT_IsMenuCmdEnabled(thePane, HT_CMD_DELETE_FILE ); - break; - - default: - LCommander::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); - break; - - } // case of command - -} // FindCommandStatus - - -// -// DeleteSelection -// -// Delete the selection in the given view. This is called when the user hits backspace -// in the current view, so we don't need to worry (as below) about the view switching -// during a drag and drop. -// -void -CHyperTreeFlexTable::DeleteSelection ( const EventRecord& /*inEvent*/ ) -{ - HT_Pane pane = HT_GetPane(mHTView); - if ( HT_IsMenuCmdEnabled(pane, HT_CMD_CUT) ) //¥¥¥ these should be HT_CMD_CLEAR - HT_DoMenuCmd ( pane, HT_CMD_CUT ); - -} // DeleteSelection - - -// -// DeleteSelectionByDragToTrash -// -// Called when the user drags some stuff in the pane into the trash can to delete -// it. We don't rely on the current view or the PowerPlant selection because it -// may have been wiped out by a temporary drag over another workspace pane on -// the way to the trash. -// -void -CHyperTreeFlexTable :: DeleteSelectionByDragToTrash ( LArray & inItems ) -{ - //¥¥¥ return if we're not allowed to delete these objects!!! - - CIconTextSuite* curr = NULL; - LArrayIterator it ( inItems ); - while ( it.Next(&curr) ) { - HT_Resource node = curr->GetHTNodeData(); - HT_Resource parent = HT_GetParent(node); - Assert_( node != NULL && parent != NULL ); - HT_RemoveChild ( parent, node ); - } - -} // DeleteSelectionByDragToTrash - - -// -// OpenRow -// -// Called to tell us when the user has clicked on a row in such a way that it should -// open. Whether this is by single click or double click is left up to parameters to -// the CStandardFlexTable, however if triggers (drop flags) are hidden and the click -// is on a container, open the container. -// -void -CHyperTreeFlexTable :: OpenRow ( TableIndexT inRow ) -{ - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inRow) ); - if (node) { - if ( !HT_IsContainer(node) ) { - // click is not in a container. If HT doesn't want it (and it's not - // a separator), launch the url - if ( !HT_IsSeparator(node) && !URDFUtilities::LaunchNode(node) ) - CFrontApp::DoGetURL( HT_GetNodeURL(node), NULL, GetTargetFrame() ); - } - else { - // we are a container. If tree connections hidden, open up the folder otherwise - // ignore. - if ( URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->showTreeConnections, true) == false ) { - PRBool openState = false; - HT_GetOpenState(node, &openState); - SetCellExpansion(STableCell(inRow, FindTitleColumnID()), !openState); - } - // redraw the container to get the new icon state - RefreshRowRange( inRow, inRow ); - } - } // if valid node - -} // OpenRow - - -// -// RowCanAcceptDrop -// -// Check if the given row can accept any of the items dropped on it. We iterate over each item -// being dropped and ask the backend if that item is ok. If any item can be dropped, the entire -// lot can be dropped. -// -Boolean -CHyperTreeFlexTable::RowCanAcceptDrop ( DragReference inDragRef, TableIndexT inDropRow ) -{ - if ( inDropRow > mRows ) - return false; - - HT_Resource targetNode = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inDropRow) ); - return NodeCanAcceptDrop ( inDragRef, targetNode ); - -} // CStandardFlexTable::RowCanAcceptDrop - - -// -// RowCanAcceptDropBetweenAbove -// -// Check if the item can be dropped above the current node. This means we need to ask the parent -// of the node for this row if it can be dropped on. -// -Boolean -CHyperTreeFlexTable::RowCanAcceptDropBetweenAbove( DragReference inDragRef, TableIndexT inDropRow ) -{ - if ( inDropRow > mRows ) - return NodeCanAcceptDrop ( inDragRef, TopNode() ); - - HT_Resource rowNode = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inDropRow)); - HT_Resource targetNode = HT_GetParent(rowNode); - return NodeCanAcceptDrop ( inDragRef, targetNode ); - -} // CStandardFlexTable::RowCanAcceptDropBetweenAbove - - -// -// RowIsContainer -// -// Is this row a folder or a leaf? HT will tell us! -// -Boolean -CHyperTreeFlexTable :: RowIsContainer ( const TableIndexT & inRow ) const -{ - if ( inRow > mRows ) - return false; - - return HT_IsContainer ( HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inRow)) ); - -} // RowIsContainer - - -// -// RowIsContainer -// -// Same as above, but also tells us if the container is open. -// -Boolean -CHyperTreeFlexTable :: RowIsContainer( const TableIndexT & inRow, Boolean* outIsExpanded ) const -{ - Assert_(outIsExpanded != NULL); - if ( outIsExpanded ) - *outIsExpanded = false; - else - return false; - - if ( RowIsContainer(inRow) ) { - HT_Resource node = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(inRow) ); - if ( node ) { - PRBool openState; - if ( HT_GetOpenState(node, &openState) == HT_NoErr ) - *outIsExpanded = openState; - } - return true; - } - else - return false; - -} // RowIsContainer - - -// -// HiliteDropRow -// -// Override to handle drawing the "insertion bar" for every row to always indicate to the -// user exactly where the drop will occur. The inherited version of this class only draws -// the insertion bar when the mouse is between two cells, and I really don't like that. -// -void -CHyperTreeFlexTable :: HiliteDropRow ( TableIndexT inRow, Boolean inDrawBarAbove ) -{ - if (inRow == LArray::index_Bad) - return; - - StColorState savedPen; - StColorState::Normalize(); - - STableCell cell(inRow, GetHiliteColumn()); - if ( mIsInternalDrop && CellIsSelected(cell) ) - return; // Don't show hiliting feedback for a drag when over the selection. - - Rect insertionBar, cellRect; - GetLocalCellRect(cell, cellRect); - insertionBar = cellRect; - - // when the mouse is over a cell, there are several possibilities: - // - if the cell is a container, hilite the container and draw the insertion bar - // below the last visible child of the container. The left edge should be indented - // from the left edge of the container. - // - if the cell is a normal row, draw the bar directly above the row at - // the same horizontal indent as the row. - // - if the cell is a container but the mouse is between rows, treat it like - // a normal row and draw the bar directly above at the same level and do not - // hilite the container. - // - if the mouse is off the end, draw the bar directly below the last row - // at the same indent as the 1st row (since they should be siblings). - // The only problem with the behavior occurs when you want to drop something - // directly at the end of an open container. Moving the mouse to where you think - // would do it ends up dropping the item after the parent container at the - // same level as the parent, not as the last item in the container. As a result, - // the only way to add something to the end of a container is to drop it on the - // container itself. The drag feedback illustrates that this will happen when you - // drag on top of a container. - - const Uint32 kInsertionBarLength = 35; - Rect iconRect; - GetIconRect ( cell, insertionBar, iconRect ); - mDropNode = HT_GetNthItem( GetHTView(), URDFUtilities::PPRowToHTRow(cell.row) ); - if ( mDropNode && HT_IsContainer(mDropNode) && !inDrawBarAbove ) { - - // place the insertion bar below the last visible row at the appropriate - // indent level for its children - Uint32 children = HT_GetCountVisibleChildren(mDropNode); - Uint32 rowHeight = GetRowHeight(inRow); - insertionBar.bottom = insertionBar.top + rowHeight + 1; - insertionBar.bottom += (children * GetRowHeight(inRow)); - insertionBar.left = iconRect.left + kIndentPerLevel; // one indentation - insertionBar.right = insertionBar.left + kInsertionBarLength; - insertionBar.top = insertionBar.bottom - 2; - - // hilite the container - DrawIcons(cell, cellRect); - StRegion hiliteRgn; - GetRowHiliteRgn(inRow, hiliteRgn); - ::InvertRgn(hiliteRgn); - - } // if drop on container - else { - - // setup insertion bar rectangle. When we're dropping at the end of the list, use - // the indent of the 1st item in the list, as they will be siblings. - if ( inRow <= mRows ) { - insertionBar.left = iconRect.left - 5; - insertionBar.right = insertionBar.left + kInsertionBarLength; - insertionBar.bottom = insertionBar.top + 1; - insertionBar.top -= 1; - } - else { - // compute the icon rect for the 1st row - Rect iconRect, cellRect; - STableCell firstCell(1, GetHiliteColumn()); - GetLocalCellRect ( firstCell, cellRect ); - GetIconRect ( firstCell, cellRect, iconRect ); - - // use the last row to compute where the bar should go vertically - Rect lastRowRect; - GetLocalCellRect ( STableCell(mRows, GetHiliteColumn()), lastRowRect ); - - insertionBar.left = iconRect.left; - insertionBar.right = insertionBar.left + kInsertionBarLength; - insertionBar.top = lastRowRect.bottom + 1; - insertionBar.bottom = insertionBar.top + 2; - } - - } // else drop on item or between rows - - DoHiliteRect ( insertionBar ); - -} // HiliteDropRow - - -// -// ItemIsAcceptable -// -// Determine if the current item can be dropped in this pane. Just always say "yes" for now -// if the flavor is acceptable to us. It will be verified for real in RowCanAcceptDrop*() routines. -// -Boolean -CHyperTreeFlexTable :: ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) -{ - FlavorType ignored; - bool acceptableFlavorFound = FindBestFlavor ( inDragRef, inItemRef, ignored ); - return acceptableFlavorFound; - -} // ItemIsAcceptable - - -// -// DragSelection -// -// Overridden to use our own version of the drag task... -// -OSErr -CHyperTreeFlexTable :: DragSelection( - const STableCell& inCell, - const SMouseDownEvent& inMouseDown ) -{ - FocusDraw(); - mViewBeforeDrag = GetHTView(); - Assert_(mViewBeforeDrag != NULL); - - // add the members of the selection to a list we will pass to the drag task. - LArray selection; - STableCell cell(0, 1); - while (GetNextSelectedRow(cell.row)) { - Rect bounds, iconBounds; - GetLocalCellRect(cell, bounds); - GetIconRect ( cell, bounds, iconBounds ); - bounds.left = iconBounds.left; - - HT_Resource node = HT_GetNthItem(mViewBeforeDrag, URDFUtilities::PPRowToHTRow(cell.row) ); - string finalCaption = CURLDragHelper::MakeIconTextValid ( HT_GetNodeName(node) ); - CIconTextSuite* suite = new CIconTextSuite( this, bounds, GetIconID(cell.row), finalCaption, node ); - selection.InsertItemsAt ( 1, LArray::index_Last, &suite ); - } - - // There is a problem with the HT backend that if you tell it to do something with - // both the parent and a child of that parent (say the container is open and the user - // grabs both of them), it will die. Iterate over each item, and for each node, if - // we find any children in the list, remove them. LArrayIterator should be - // smart enough to handle deletions while iterating.... - LArrayIterator it(selection); - CIconTextSuite* curr = NULL; - while ( it.Next(&curr) ) { - HT_Resource currentNode = curr->GetHTNodeData(); - CIconTextSuite* possibleChildSuite = NULL; - LArrayIterator inner(selection); - Uint32 counter = 1; // LArray counts from 1 - while ( inner.Next(&possibleChildSuite) ) { - HT_Resource possibleChild = possibleChildSuite->GetHTNodeData(); - if ( HT_GetParent(possibleChild) == currentNode ) - selection.RemoveItemsAt(1, counter); // child found, delete it - else - counter++; - } - } - - // create the drag task - Rect cellBoundsOfClick; - GetLocalCellRect(inCell, cellBoundsOfClick); - CIconTextDragTask theTask(inMouseDown.macEvent, selection, cellBoundsOfClick); - - // setup our special data transfer proc called upon drag completion - OSErr theErr = ::SetDragSendProc ( theTask.GetDragReference(), mSendDataUPP, (LDropArea*) this ); - ThrowIfOSErr_(theErr); - - theTask.DoDrag(); - - // remove the items if they went into the trash - if ( theTask.DropLocationIsFinderTrash() ) - DeleteSelectionByDragToTrash(selection); - - UnselectAllCells(); - - // cleanup after ourselves - LArrayIterator it2(selection); - curr = NULL; - while ( it.Next(&curr) ) - delete curr; - - mViewBeforeDrag = GetHTView(); - return noErr; -} // DragSelection - - -// -// DoDragSendData -// -// Called when this window is the originator of the drag, after the drop has succeeded. Since we -// were the ones who created the drag task, we know that one of the flavors is emHTNodeDrag, which -// contains as its data the HT_Resource representing this drag item. Use that resource to get -// the url and title. -// -void -CHyperTreeFlexTable :: DoDragSendData( FlavorType inFlavor, ItemReference inItemRef, - DragReference inDragRef) -{ - CNetscapeWindow* theWindow = dynamic_cast(LWindow::FetchWindowObject(GetMacPort())); - ThrowIfNil_(theWindow); - - HT_Resource node = NULL; - Size dataSize = sizeof(HT_Resource); - OSErr err = ::GetFlavorData(inDragRef, inItemRef, emHTNodeDrag, &node, &dataSize, 0); - if ( node && !err ) - CURLDragHelper::DoDragSendData ( HT_GetNodeURL(node), HT_GetNodeName(node), - inFlavor, inItemRef, inDragRef ); - else - DebugStr("\pFlavor data does not contain a valid HT_Resource structure"); - -} // DoDragSendData - - -// -// ReceiveDragItem -// -// Pass this along to the implementation in CURLDragMixin. -// -void -CHyperTreeFlexTable :: ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs, - ItemReference inItemRef, Rect & inItemBounds ) -{ - CHTAwareURLDragMixin::ReceiveDragItem(inDragRef, inDragAttrs, inItemRef, inItemBounds ); - -} // ReceiveDragItem - - -// -// HandleDropOfPageProxy -// -// Called when the user drops the page proxy icon in the NavCenter. The page proxy flavor data -// consists of the url and title, separated by a return. Extract the components and create a -// new node. -// -void -CHyperTreeFlexTable :: HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) -{ - // cast away constness for HT - char* url = const_cast(inURL); - char* title = const_cast(inTitle); - - // Extract the node where the drop will occur. If the drop is on a container, put - // it in the container, unless the mouse is actually between the rows which means the - // user wants to put it at the same level as the container. Otherwise just put it - // above (and at the same level) as the item it is dropped on. - bool dropAtEnd = mDropNode == NULL; - if ( dropAtEnd ) { - mDropNode = HT_GetNthItem( GetHTView(), URDFUtilities::PPRowToHTRow(mRows) ); - if ( !mDropNode ) { - // the view is empty, do drop on and bail - HT_DropURLAndTitleOn ( TopNode(), url, title ); - return; - } - } - if ( HT_IsContainer(mDropNode) && !mIsDropBetweenRows ) - HT_DropURLAndTitleOn ( mDropNode, url, title ); - else - HT_DropURLAndTitleAtPos ( mDropNode, url, title, dropAtEnd ? PR_FALSE : PR_TRUE ); - -} // HandleDropOfPageProxy - - -// -// HandleDropOfHTResource -// -// Called when the user drops something from one RDF-savvy location (navcenter, personal toolbar) -// to another. This may result in a move or a copy, so do the right thing for each. -// -void -CHyperTreeFlexTable :: HandleDropOfHTResource ( HT_Resource dropNode ) -{ - // Extract the node where the drop will occur. If the drop is on a container, put - // it in the container, unless the mouse is actually between the rows which means the - // user wants to put it at the same level as the container. Otherwise just put it - // above (and at the same level) as the item it is dropped on. - bool dropAtEnd = mDropNode == NULL; - if ( dropAtEnd ) { - mDropNode = HT_GetNthItem( GetHTView(), URDFUtilities::PPRowToHTRow(mRows) ); - if ( !mDropNode ) { - // the view is empty, do drop on and bail - HT_DropHTROn ( TopNode(), dropNode ); - return; - } - } // if we're dropping at end - if ( HT_IsContainer(mDropNode) && !mIsDropBetweenRows ) - HT_DropHTROn ( mDropNode, dropNode ); - else - HT_DropHTRAtPos ( mDropNode, dropNode, dropAtEnd ? PR_FALSE : PR_TRUE ); - -} // HandleDropOfHTResource - - -// -// HandleDropOfLocalFile -// -// Called when the user drops something from the Finder into the navCenter. Create a -// bookmark with a file URL for that file. This assumes aliases have already been -// resolved -// -void -CHyperTreeFlexTable :: HandleDropOfLocalFile ( const char* inFileURL, const char* inFileName, - const HFSFlavor & /*inFileData*/ ) -{ - // Extract the node where the drop will occur. If the drop is on a container, put - // it in the container, unless the mouse is actually between the rows which means the - // user wants to put it at the same level as the container. Otherwise just put it - // above (and at the same level) as the item it is dropped on. - bool dropAtEnd = mDropNode == NULL; - if ( dropAtEnd ) { - mDropNode = HT_GetNthItem( GetHTView(), URDFUtilities::PPRowToHTRow(mRows) ); - if ( !mDropNode ) { - // the view is empty, do drop on and bail - HT_DropURLAndTitleOn ( TopNode(), - const_cast(inFileURL), const_cast(inFileName) ); - return; - } - } - if ( HT_IsContainer(mDropNode) && !mIsDropBetweenRows ) - HT_DropURLAndTitleOn ( mDropNode, const_cast(inFileURL), const_cast(inFileName) ); - else - HT_DropURLAndTitleAtPos ( mDropNode, const_cast(inFileURL), const_cast(inFileName), - dropAtEnd ? PR_FALSE : PR_TRUE ); - -} // HandleDropOfLocalFile - - -// -// HandleDropOfText -// -// Called when user drops a text clipping onto the navCenter. Do nothing for now. -// -void -CHyperTreeFlexTable :: HandleDropOfText ( const char* /*inTextData*/ ) -{ - DebugStr("\pDropping TEXT here not implemented"); - -} // HandleDropOfText - - -// -// InlineEditorDone -// -// Called when the user hits return/enter or clicks outside of the inline editor. Tell RDF about the -// change and update the table. -// -void -CHyperTreeFlexTable :: InlineEditorDone ( ) -{ - Str255 newName; - mNameEditor->GetDescriptor(newName); - // we need to convert to UTF8 here.... - unsigned char* utfText = INTL_ConvertLineWithoutAutoDetect( - INTL_GetCharSetID(INTL_DefaultTextWidgetCsidSel), CS_UTF8, newName+1, newName[0]); - cstring nameAsCString( (char*) utfText); - XP_FREEIF(utfText); - - HT_Resource editedNode = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(mRowBeingEdited) ); - HT_SetNodeName ( editedNode, nameAsCString ); - -} // InlineEditorDone - - -// -// CanDoInlineEditing -// -// While we normally want to be able to do inline editing, we have to turn it off for panes -// that don't allow editing (like History). HT also has the chance to turn it off for the -// current view. Assumes mRowBeingEdited is correctly set. -// -Boolean -CHyperTreeFlexTable :: CanDoInlineEditing ( ) const -{ - if ( URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->useInlineEditing, true) ) { - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header); - CHyperTreeHeader::ColumnInfo info = header->GetColumnInfo ( FindTitleColumnID() - 1 ); - - HT_Resource item = HT_GetNthItem( GetHTView(), URDFUtilities::PPRowToHTRow(mRowBeingEdited) ); - return HT_IsNodeDataEditable ( item, info.token, info.tokenType ); - } - - return false; - -} // CanDoInlineEditing - - -// -// TableDesiresSelectionTracking -// -// Disable marquee selection if HT doesn't want it -// -Boolean -CHyperTreeFlexTable :: TableDesiresSelectionTracking( ) const -{ -#ifdef USE_SELECTION_PROP - return URDFUtilities::PropertyValueBool(TopNode(), gNavCenter->useSelection, true) == true; -#else - return true; -#endif - -} // TableDesiresSelectionTracking - - -// -// ChangeSort -// -// called when the user clicks in one of the column headings to change the sort column or -// to change the sort order of the given column. -// -void -CHyperTreeFlexTable :: ChangeSort ( const LTableHeader::SortChange* inSortChange ) -{ - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header); - - // CHyperTreeHeader::GetColumnInfo() is zero-based and PP is one-based. - if ( inSortChange->sortColumn >= 1 ) { - CHyperTreeHeader::ColumnInfo info = header->GetColumnInfo ( inSortChange->sortColumn - 1 ); - HT_SetSortColumn ( GetHTView(), info.token, info.tokenType, inSortChange->reverseSort ? PR_TRUE : PR_FALSE ); - } - else - HT_SetSortColumn ( GetHTView(), NULL, 0, PR_FALSE ); // return to natural order - - Refresh(); - -} // ChangeSort - - -// -// AdjustCursorSelf -// -// Handle changing cursor to contextual menu cursor if cmd key is down -// -void -CHyperTreeFlexTable::AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) -{ - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenuCursor, - static_cast(const_cast(&inEvent))); - -} - - -// -// TableSupportsNaturalOrderSort -// -// Ask HT if this view does natural order sorting now (can the user drop in the -// middle of the table). -// -Boolean -CHyperTreeFlexTable :: TableSupportsNaturalOrderSort ( ) const -{ - return HT_ContainerSupportsNaturalOrderSort(TopNode()); - -} // TableSupportsNaturalOrderSort - - -// -// SetTargetFrame -// -// Set the new target to where url's are dispatched when clicked on -// -void -CHyperTreeFlexTable :: SetTargetFrame ( const char* inFrame ) -{ - mTargetFrame = inFrame; - -} // SetTargetFrame - - -const char* -CHyperTreeFlexTable :: GetTargetFrame ( ) const -{ - if ( mTargetFrame.length() ) - return mTargetFrame.c_str(); - else - return NULL; -} - - -// -// CalcToolTipText -// -// Used with the CTableToolTipPane/Attachment to provide a better tooltip experience -// for the table. Will only show the tip when the text is truncated. -// -void -CHyperTreeFlexTable :: CalcToolTipText( const STableCell& inCell, - StringPtr outText, - TextDrawingStuff& outStuff, - Boolean& outTruncationOnly) -{ - outText[0] = 0; - outTruncationOnly = true; // Only show tip if truncated. - - // never show the tip while inline editing is alive - if ( mRowBeingEdited != LArray::index_Bad ) - return; - - outStuff = GetTextStyle(inCell.row); - - if ( inCell.row <= mRows ) { - CHyperTreeHeader* header = dynamic_cast(mTableHeader); - Assert_(header != NULL); - CHyperTreeHeader::ColumnInfo info = header->GetColumnInfo(inCell.col - 1); - - HT_Resource node = HT_GetNthItem( GetHTView(), URDFUtilities::PPRowToHTRow(inCell.row) ); - void* data; - if ( HT_GetNodeData(node, info.token, info.tokenType, &data) && data ) { - switch (info.tokenType) { - case HT_COLUMN_STRING: - if ( ! HT_IsSeparator(node) ) { - const char* str = static_cast(data); - if ( str ) { - outText[0] = strlen(str); - strcpy ( (char*) &outText[1], str ); - } - else - outText[0] = 0; - } - else - outText[0] = 0; - break; - - default: - outText[0] = 0; // don't display tooltip for other data types - - } // case of column data type - } // if data is valid - } // if row has data - else { - // supply a useful message when the mouse is over some part of the table that - // isn't a real row. I'd like to make it display only if the pane is editable, - // but this is not possible to determine given the current HT APIs =(. - outTruncationOnly = false; // always show this message - ::GetIndString ( outText, 10506, 16); - } // else row is empty - -} // CalcToolTipText - - -#pragma mark -- class CHyperTreeSelector -- - -// -// DoSelect -// -// We need to make sure that the HTView's concept of the selection is in sync with what PP -// believes to be the current selection. Since all modifications to the selection are -// channeled through this method, we just override it to also tell HT about the selection -// change. This also picks up SelectCell() and UnselectCell() calls since the LTableRowSelector -// routes those calls here -// -void -CHyperTreeSelector :: DoSelect( const TableIndexT inRow, - Boolean inSelect, - Boolean inHilite, - Boolean inNotify ) -{ - HT_Resource node = HT_GetNthItem( mTreeView, URDFUtilities::PPRowToHTRow(inRow) ); - if (node) { - // when we update the HT selection, we'll get an update event. We don't want - // this because we know we're updating it. - HT_NotificationMask oldMask; - HT_Pane pane = HT_GetPane ( mTreeView ); - HT_GetNotificationMask ( pane, &oldMask ); - HT_SetNotificationMask ( pane, 0L ); - HT_SetSelectedState ( node, inSelect ? PR_TRUE : PR_FALSE ); - HT_SetNotificationMask ( pane, oldMask ); - } - LTableRowSelector::DoSelect(inRow, inSelect, inHilite, inNotify); - -} // DoSelect - - -// -// CellIsSelected -// -// Just let HT tell us about what is selected and what isn't. -// -Boolean -CHyperTreeSelector :: CellIsSelected ( const STableCell &inCell ) const -{ - HT_Resource node = HT_GetNthItem( mTreeView, URDFUtilities::PPRowToHTRow(inCell.row) ); - return HT_IsSelected(node); - -} // CellIsSelected - - -// -// SyncSelectorWithHT -// -// Since HT is the one that retains the selection for the view, when a new view is -// displayed, we will be out of sync. This methods gets us back in sync. -// -// This routine is called a lot (during refresh, when nodes are added, whenever js -// affects the selection, etc) so we want it to be fast when the size of the list is -// large. I had some cool ideas this morning in the shower, but when I came in to -// implement them, I realized that all of them boiled down to having to iterate over -// every element of the list because of the way LTableRowSelector finds which cells are -// selected. Since that class probably won't be changing any time soon, just do the -// stupid thing since it works out to the same in the end. (Note that HT_GetNthItem is O(1)). -// -// A valid wimpout? Doubtful, but at least you know what's going on here when we find -// how slow it is ;) -// -void -CHyperTreeSelector :: SyncSelectorWithHT ( ) -{ - const char notSelected = 0; - for ( int PPRow = 1; PPRow <= GetCount(); PPRow++ ) { - // get the corresponding row in HT. Set the value in the selector accordingly. - HT_Resource curr = HT_GetNthItem ( mTreeView, URDFUtilities::PPRowToHTRow(PPRow) ); - if ( curr ) { - PRBool isSelected = HT_IsSelected ( curr ); - LTableRowSelector::DoSelect ( PPRow, isSelected, true, false ); - } - } - -} // SyncSelectorWithHT - - -#pragma mark - - -HT_Pane CPopdownFlexTable :: sPaneOriginatingDragAndDrop = NULL; - - -CPopdownFlexTable :: CPopdownFlexTable ( LStream* inStream ) - : CHyperTreeFlexTable(inStream) -{ - -} - - -CPopdownFlexTable :: ~CPopdownFlexTable ( ) -{ -} - - -// -// OpenRow -// -// Do the normal thing, but close up the tree afterwards. -// -void -CPopdownFlexTable :: OpenRow ( TableIndexT inRow ) -{ - CHyperTreeFlexTable::OpenRow(inRow); - if ( ! RowIsContainer(inRow) ) - BroadcastMessage ( msg_ClosePopdownTree, NULL ); - -} // OpenRow - - -// -// OpenSelection -// -// The inherited version of this routine iterates over the selection and opens each row in -// turn. Obviously, we only care about the first one in this case because it is meaningless -// to open multiple urls in one window. -// -void -CPopdownFlexTable :: OpenSelection() -{ - TableIndexT selectedRow = 0; - if ( GetNextSelectedRow(selectedRow) && !CmdPeriod() ) - OpenRow(selectedRow); -} - - -// -// DragSelection -// -// Wraps the inherited version to save the HT_Pane from where the drag originated so -// that when you drag to other popdowns, it doesn't go away. -// -OSErr -CPopdownFlexTable :: DragSelection( - const STableCell& inCell, - const SMouseDownEvent& inMouseDown ) -{ - sPaneOriginatingDragAndDrop = HT_GetPane(mHTView); - - OSErr retVal = CHyperTreeFlexTable::DragSelection ( inCell, inMouseDown ); - - // If this tree is visible, then the drop was constrained to this tree (or the - // drop went somewhere other than another popdown). Therefore, don't delete the - // pane. If it is invisible, get rid of it so we don't leak the pane. - if ( !IsVisible() && sPaneOriginatingDragAndDrop ) - HT_DeletePane ( sPaneOriginatingDragAndDrop ); - sPaneOriginatingDragAndDrop = NULL; - - return retVal; - -} // DragSelection - - -#pragma mark - - -CTreeIcon :: CTreeIcon ( const string & inURL, const CHyperTreeFlexTable* inParent, HT_Resource inNode ) - : CImageIconMixin(inURL), mTree(inParent), mNode(inNode) -{ -} - -CTreeIcon :: ~CTreeIcon ( ) -{ -} - - -// -// ImageIsReady -// -// Tell the tree view to redraw the cell representing this node -// -void -CTreeIcon :: ImageIsReady ( ) -{ - mTree->RedrawRow(mNode); -} - -void -CTreeIcon :: DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const -{ - Rect where; - where.top = inTopLeft.v; where.left = inTopLeft.h; - where.right = where.left + 16; where.bottom = where.top + 16; - - TableIndexT row = URDFUtilities::HTRowToPPRow(HT_GetNodeIndex(HT_GetView(mNode), mNode)); - mTree->CStandardFlexTable::DrawIconsSelf(STableCell(row, mTree->FindTitleColumnID()), - inTransform, where); - -} // DrawStandby diff --git a/mozilla/cmd/macfe/rdfui/CHyperTreeFlexTable.h b/mozilla/cmd/macfe/rdfui/CHyperTreeFlexTable.h deleted file mode 100644 index 840a6576f7d..00000000000 --- a/mozilla/cmd/macfe/rdfui/CHyperTreeFlexTable.h +++ /dev/null @@ -1,268 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Contains: -// -// ¥ÊCHyperTreeFlexTable -// A subclass of CStandardFlexTable to handle working with XP RDF Hyper Trees -// -// ¥ CHyperTreeSelector -// Modifies the selection model used by PP to also consult HT to see if a row is -// selected -// - -#pragma once - -#include "CStandardFlexTable.h" -#include "LTableRowSelector.h" -#include "CDynamicTooltips.h" -#include "CURLDragHelper.h" -#include "CImageIconMixin.h" - -// STL Headers -#include - -#pragma mark -- class CHyperTreeFlexTable -- - - -class CHyperTreeFlexTable : - public CStandardFlexTable, public CHTAwareURLDragMixin, public CTiledImageMixin -{ -public: - enum { - class_ID = 'htFT', - nameColumn = 'NCnC' - }; - friend class CTreeIcon; - - CHyperTreeFlexTable(LStream *inStream); - ~CHyperTreeFlexTable(); - - virtual void ChangeSort ( const LTableHeader::SortChange* inSortChange ) ; - - virtual void OpenView(HT_View inHTView); - virtual void ExpandNode(HT_Resource inHTNode); - virtual void CollapseNode(HT_Resource inHTNode); - virtual void SyncSelectionWithHT ( ) ; - - HT_View GetHTView() const { return mHTView; } - - bool IsViewSameAsBeforeDrag() const { return mViewBeforeDrag == mHTView; } - - // get/set the frame to which urls are dispatched. It's ok not to set - // this as the default will be the top-most HTML view. - virtual void SetTargetFrame ( const char* inFrame ) ; - virtual const char* GetTargetFrame ( ) const ; - - virtual void RedrawRow ( HT_Resource ) const ; - - virtual void SetupColumns ( ) ; - -protected: - - // Background image tiling stuff - virtual void DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const; - virtual void DrawSelf ( ) ; - virtual void ImageIsReady ( ) ; - virtual void EraseTableBackground ( ) const; - - // CStandardFlexTable Overrides - virtual void OpenRow ( TableIndexT inRow ) ; - virtual Boolean CellInitiatesDrag(const STableCell&) const; - virtual Boolean CellSelects ( const STableCell& inCell ) const; - virtual Boolean RowCanAcceptDrop ( DragReference inDragRef, TableIndexT inDropRow ) ; - virtual Boolean RowCanAcceptDropBetweenAbove( DragReference inDragRef, TableIndexT inDropRow ) ; - virtual void HiliteDropRow ( TableIndexT inRow, Boolean inDrawBarAbove ) ; - virtual Boolean RowIsContainer ( const TableIndexT & inRow ) const ; - virtual Boolean RowIsContainer ( const TableIndexT & inRow, Boolean* outIsExpanded ) const ; - virtual void DrawCellContents( const STableCell &inCell, const Rect &inLocalRect); - virtual void EraseCellBackground( const STableCell& inCell, const Rect& inLocalRect); - virtual ResIDT GetIconID(TableIndexT inRow) const; - virtual void DrawIconsSelf( const STableCell& inCell, IconTransformType inTransformType, - const Rect& inIconRect) const ; - virtual UInt16 GetNestedLevel(TableIndexT inRow) const; - virtual void SetCellExpansion( const STableCell& inCell, Boolean inExpand); - virtual Boolean CellHasDropFlag(const STableCell& inCell, Boolean& outIsExpanded) const; - virtual Boolean TableSupportsNaturalOrderSort ( ) const ; -#ifdef USE_SELECTION_PROP - virtual Boolean CellWantsClick( const STableCell & /*inCell*/ ) const ; - virtual void ClickCell ( const STableCell & inCell, const SMouseDownEvent & inMouse ) ; -#endif - - // Stuff related to hiliting - virtual TableIndexT GetHiliteColumn() const { return FindTitleColumnID(); } ; - virtual Boolean GetHiliteTextRect ( TableIndexT inRow, Boolean inOkIfRowHidden, Rect& outRect) const ; - virtual void GetMainRowText( TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const ; - virtual void DoHiliteRgn ( RgnHandle inHiliteRgn ) const; - virtual void DoHiliteRect ( const Rect & inHiliteRect ) const; - virtual void HiliteSelection( Boolean inActively, Boolean inHilite) ; - - virtual void SetUpTableHelpers() ; - - virtual Uint32 FindTitleColumnID ( ) const ; - - // Handle drag and drop - virtual OSErr DragSelection(const STableCell& inCell, const SMouseDownEvent &inMouseDown); - virtual void DoDragSendData ( FlavorType inFlavor, ItemReference inItemRef, DragReference inDragRef) ; - virtual Boolean ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) ; - virtual void HandleDropOfHTResource ( HT_Resource node ) ; - virtual void HandleDropOfPageProxy ( const char* inURL, const char* inTitle ) ; - virtual void HandleDropOfLocalFile ( const char* inFileURL, const char* fileName, - const HFSFlavor & /*inFileData*/ ) ; - virtual void HandleDropOfText ( const char* inTextData ) ; - virtual void DeleteSelectionByDragToTrash ( LArray & inItems ) ; - virtual void ReceiveDragItem ( DragReference inDragRef, DragAttributes /*inDragAttrs*/, - ItemReference inItemRef, Rect & /*inItemBounds*/ ) ; - - // for dynamic tooltip tracking and mouse cursor tracking - virtual void AdjustCursorSelf ( Point /*inPoint*/, const EventRecord& inEvent ) ; - virtual void CalcToolTipText( const STableCell& inCell, - StringPtr outText, - TextDrawingStuff& outStuff, - Boolean& outTruncationOnly); - - // Tree behavior properties - virtual Boolean CanDoInlineEditing ( ) const; - virtual Boolean TableDesiresSelectionTracking( ) const; - - // for inline editing - virtual void InlineEditorDone ( ) ; - - // command stuff - virtual void DeleteSelection ( const EventRecord& inEvent ); - virtual void FindCommandStatus ( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) ; - virtual void SetEditParam(int w, int h, char* str, SPoint32& ImagePoint); - - HT_Resource TopNode ( ) const { return HT_TopNode(GetHTView()); } - -//----------------------------------- -// Data -//----------------------------------- - HT_View mHTView; - HT_Notification mHTNotificationData; - DragSendDataUPP mSendDataUPP; - HT_View mViewBeforeDrag; - HT_Resource mDropNode; // the HT node that corresponds to mDropRow - - STableCell mTooltipCell; // tracks where mouse is for tooltips - - bool mHasBackgroundImage; // is there a background image to be drawn? - - string mTargetFrame; // which frame are urls dispatched to? - -}; // class CHyperTreeFlexTable - - -#pragma mark -- class CHyperTreeSelector -- - - -// -// class CHyperTreeSelector -// -// A replacement for the standard selector class used by LTableView to sync the -// selection with the backend HT_API -// - -class CHyperTreeSelector : public LTableRowSelector -{ -public: - - CHyperTreeSelector ( LTableView *inTableView, Boolean inAllowMultiple=true ) - : LTableRowSelector ( inTableView, inAllowMultiple ), mTreeView(NULL) { } ; - - // overridden to ask HT if row is selected - virtual Boolean CellIsSelected ( const STableCell &inCell ) const; - - // keep us in sync with HT when a new view is opened - virtual void SyncSelectorWithHT ( ) ; - - void TreeView ( HT_View inNewView ) { mTreeView = inNewView; } ; - -protected: - - virtual void DoSelect ( const TableIndexT inRow, Boolean inSelect, Boolean inHilite, - Boolean inNotify ) ; - - HT_View mTreeView; - -}; // class CHyperTreeSelector - - -#pragma mark -- class CPopdownFlexTable -- - - -// -// class CPopdownFlexTable -// -// The flex table used by the popdown view. It needs to broadcast some messages to the -// coordinator (such as when to close up) and do funny things to handle closing when -// items are opened. -// - -class CPopdownFlexTable : public CHyperTreeFlexTable -{ -public: - enum { class_ID = 'pdFT' }; - enum { msg_ClosePopdownTree = 'clos' }; - - CPopdownFlexTable(LStream *inStream); - ~CPopdownFlexTable(); - - static HT_Pane HTPaneOriginatingDragAndDrop ( ) { return sPaneOriginatingDragAndDrop; } - -private: - - void OpenSelection(); - void OpenRow ( TableIndexT inRow ) ; - OSErr DragSelection(const STableCell& inCell, const SMouseDownEvent &inMouseDown); - - // this is a holder for the pane that originates the drag and drop so that when - // a drop is done on a different popdown tree, the HT_Resources still have a valid pane. - // This will be deleted once the d&d finishes. - static HT_Pane sPaneOriginatingDragAndDrop; - -}; // class CPopdownFlexTable - - -#pragma mark -- class CTreeIcon -- - - -// -// class CTreeIcon -// -// A very simple class that knows how to draw gifs as icons. -// - -class CTreeIcon : public CImageIconMixin -{ -public: - CTreeIcon ( const string & inURL, const CHyperTreeFlexTable* inTree, HT_Resource inNode ) ; - ~CTreeIcon ( ) ; - -private: - void ImageIsReady ( ) ; - void DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const; - - const CHyperTreeFlexTable* mTree; - HT_Resource mNode; - -}; // class CTreeIcon \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/CHyperTreeHeader.cp b/mozilla/cmd/macfe/rdfui/CHyperTreeHeader.cp deleted file mode 100644 index 1032eea5005..00000000000 --- a/mozilla/cmd/macfe/rdfui/CHyperTreeHeader.cp +++ /dev/null @@ -1,209 +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. - */ - -#include "CHyperTreeHeader.h" - -#include -#include - -CHyperTreeHeader::CHyperTreeHeader(LStream* inStream) -: CTriStateTableHeader(inStream), - mHTView(NULL) -{ -} - -CHyperTreeHeader::~CHyperTreeHeader() -{ -} - -void -CHyperTreeHeader::SetUpColumns ( HT_View inView ) -{ - LTableHeader::SColumnData columnData; - ColumnInfo columnInfo; - PaneIDT columnPaneID = 1; - void *columnToken; - Uint32 columnWidth, columnTokenType; - SPaneInfo paneInfo; - char *columnName; - vector dataVector; - - // link up with HT. We don't own the view, so don't dispose it later. - mHTView = inView; - if ( !inView ) - return; - - // initialize SPaneInfo fields that don't change - paneInfo.width = 50; - paneInfo.height = 12; - paneInfo.visible = false; - paneInfo.enabled = false; - paneInfo.bindings.left = false; - paneInfo.bindings.top = false; - paneInfo.bindings.right = false; - paneInfo.bindings.bottom = false; - paneInfo.left = 0; - paneInfo.top = 0; - paneInfo.userCon = NULL; - paneInfo.superView = this; - - DeleteAllSubPanes(); - mColumnInfo.clear(); - - // initialize LTableHeader::SColumnData fields that don't change - columnData.columnPosition = 0; - columnData.flags = 0; - - HT_Cursor columnCursor = HT_NewColumnCursor(inView); - - // get column data from cursor - bool foundHiddenColumn = false; - while (HT_GetNextColumn(columnCursor, &columnName, &columnWidth, &columnToken, &columnTokenType)) - { - LStr255 name(columnName); - - paneInfo.paneID = columnPaneID; - - LCaption* columnCaption = new LCaption(paneInfo, name, columnTextTraits_ID); - - columnData.paneID = columnPaneID; - columnData.columnWidth = columnWidth; - - dataVector.push_back(columnData); - - columnInfo.token = columnToken; - columnInfo.tokenType = columnTokenType; - - mColumnInfo.push_back(columnInfo); - - columnCaption->Enable(); - columnCaption->Show(); - - // once we find a column that is hidden, all the rest are hidden to, so set - // the column before to be the last visible. - if ( !foundHiddenColumn ) { - if ( HT_GetColumnVisibility(inView, columnToken, columnTokenType) == false ) { - mLastVisibleColumn = columnPaneID - 1; - foundHiddenColumn = true; - } - } - - ++columnPaneID; - } - - // LTableHeader expects its mColumnData member to be a mac Handle; - // therefore, create the Handle from dataVector. - Handle handle = ::NewHandle(sizeof(LTableHeader::SColumnData) * dataVector.size()); - // I have no clue who is going to catch this, but if we can't allocate the - // Handle, we're up the creek without a paddle and with a very leaky canoe. - ThrowIfMemFail_(handle); - LHandleStream dataStream(handle); - vector::iterator iter = dataVector.begin(); - while (iter != dataVector.end()) - { - Int32 byteCount = sizeof(LTableHeader::SColumnData); - dataStream.PutBytes(&(*iter), byteCount); - ++iter; - } - if (mColumnData) - ::DisposeHandle(reinterpret_cast(mColumnData)); - mColumnData = reinterpret_cast(dataStream.DetachDataHandle()); - - // now initialize LTableHeader data members and have it sync itself up. If we didn't - // find a hidden column above, then all columns are visible. - mColumnCount = dataVector.size(); - if ( !foundHiddenColumn ) - mLastVisibleColumn = mColumnCount; - mLastShowableColumn = mColumnCount; - if ( mLastVisibleColumn <= 0 ) // mLastVisibleColumn MUST NOT BE 0 or heap corruption will occur - mLastVisibleColumn = 1; - - ConvertWidthsToAbsolute(); - ComputeColumnPositions(); - PositionColumnHeaders(true); - - HT_DeleteColumnCursor(columnCursor); -} - - -// -// GetColumnInfo -// -// Returns the HT-specific info about a column. -// IMPORTANT: This method is 0-based NOT 1-based (like most PowerPlant stuff). -// -CHyperTreeHeader::ColumnInfo& -CHyperTreeHeader::GetColumnInfo(Uint32 inColumnKey) -{ - vector::iterator iter = mColumnInfo.begin(); - return *(iter + inColumnKey); -} // GetColumnInfo - - -// -// ShowHideRightmostColumn -// -// Tell HT about the new visibility on the rightmost column -// -void -CHyperTreeHeader :: ShowHideRightmostColumn ( Boolean inShow ) -{ - ColumnIndexT savedLastVisibleColumn = mLastVisibleColumn; - - CTriStateTableHeader::ShowHideRightmostColumn ( inShow ); - - ColumnInfo lastColumnInfo = GetColumnInfo ( savedLastVisibleColumn - 1 ); // GCI() is 0-based - HT_SetColumnVisibility ( mHTView, lastColumnInfo.token, lastColumnInfo.tokenType, - inShow ? PR_FALSE : PR_TRUE ); - // logic is backwards between this method and the last param to HT_SCV() - -} // ShowHideRightmostColumn - - -// -// MoveColumn -// -// Tell HT about the new location of a column -// -void -CHyperTreeHeader :: MoveColumn ( ColumnIndexT inColumn, ColumnIndexT inMoveTo ) -{ - if ( inColumn == inMoveTo ) - return; - - ColumnIndexT adjustedColumn = inColumn - 1; // adjust for dealing with 0-based things - ColumnIndexT adjustedMoveTo = inMoveTo - 1; - - ColumnInfo movingColumn = GetColumnInfo ( adjustedColumn ); // copy movingColumn for later readding - ColumnInfo & destColumn = GetColumnInfo ( adjustedMoveTo ); - HT_SetColumnOrder ( mHTView, movingColumn.token, destColumn.token, false ); - - // rearrange columns in vector list. We do this by deleting the column data from the vector and - // reinserting at its new location (which is why we needed a copy above, not just a ref). If - // the column is being moved towards the end, decrement the destination to compensate for the - // column data being deleted in front of it. - vector::iterator it = mColumnInfo.begin() + adjustedColumn; - mColumnInfo.erase ( it ); - if ( adjustedMoveTo > adjustedColumn ) - --adjustedMoveTo; // move it back to compensate - it = mColumnInfo.begin() + adjustedMoveTo; - mColumnInfo.insert ( it, movingColumn ); - - CTriStateTableHeader::MoveColumn ( inColumn, inMoveTo ) ; - -} // MoveColumn diff --git a/mozilla/cmd/macfe/rdfui/CHyperTreeHeader.h b/mozilla/cmd/macfe/rdfui/CHyperTreeHeader.h deleted file mode 100644 index 8c658573dd3..00000000000 --- a/mozilla/cmd/macfe/rdfui/CHyperTreeHeader.h +++ /dev/null @@ -1,58 +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. - */ - -#pragma once - -#include "CTriStateTableHeader.h" - -#include - -#include - -#include "htrdf.h" - -class CHyperTreeHeader : public CTriStateTableHeader -{ -public: - enum { - class_ID = 'hhdr' - , columnTextTraits_ID = 130 - }; - - struct ColumnInfo { - void* token; - Uint32 tokenType; - }; - - CHyperTreeHeader(LStream* inStream); - virtual ~CHyperTreeHeader(); - - void SetUpColumns ( HT_View inView ); - - // NOTE: inColumnKey should be zero-based. - ColumnInfo& GetColumnInfo(Uint32 inColumnKey); - -protected: - - // overridden to talk to HT - virtual void ShowHideRightmostColumn(Boolean inShow); - virtual void MoveColumn(ColumnIndexT inColumn, ColumnIndexT inMoveTo); - - HT_View mHTView; - vector mColumnInfo; -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/CNavCenterContextMenuAtt.cp b/mozilla/cmd/macfe/rdfui/CNavCenterContextMenuAtt.cp deleted file mode 100644 index 9834be59fe1..00000000000 --- a/mozilla/cmd/macfe/rdfui/CNavCenterContextMenuAtt.cp +++ /dev/null @@ -1,195 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// A version of the contextual menu attachment that generates the menu from -// the RDF backend. -// - -#include "CNavCenterContextMenuAtt.h" -#include "CHyperTreeFlexTable.h" -#include "Netscape_constants.h" -#include "URDFUtilities.h" -#include "CRDFToolbarItem.h" -#include "CRDFToolbar.h" - - -extern RDF_NCVocab gNavCenter; // RDF vocab struct for NavCenter - - -// -// ConvertHTCommandToPPCommand -// -// The HyperTree has its own constants that represent the commands supplied by the -// backend. In order to make the HT commands live in a powerplant world, we have to -// convert them. This (simply) involves adding a base constant to the HT command to make the -// appropriate PP command. -// -CommandT -CNavCenterContextMenuAttachment :: ConvertHTCommandToPPCommand ( HT_MenuCmd inCmd ) -{ - return inCmd + cmd_NavCenterBase; - -} // ConvertHTCommandToPPCommand - - -// -// BuildMenu -// -// Overridden to create the menu from the RDF backend instead of from a resource. -// -LMenu* -CNavCenterContextMenuAttachment :: BuildMenu ( ) -{ - LMenu* menu = new LMenu(32001); // load empty menu to fill in - HT_Cursor curs = NewHTContextMenuCursor(); - - if ( !curs || !menu ) - return NULL; - - HT_MenuCmd menuItem; - short after = 0; - while ( HT_NextContextMenuItem(curs, &menuItem) ) { - LStr255 itemName; - if ( menuItem == HT_CMD_SEPARATOR ) - itemName = "\p-"; - else - itemName = HT_GetMenuCmdName(menuItem); - menu->InsertCommand ( itemName, ConvertHTCommandToPPCommand(menuItem), - after ); - after++; - } - HT_DeleteContextMenuCursor ( curs ); - - return menu; - -} // BuildMenu - - - -// -// PruneMenu -// -// Override to not do anything, since HT already prunes the list for us. The return -// value is used as the default item, and we don't care about a default (as long as -// this value is > 0). -// -UInt16 -CNavCenterContextMenuAttachment :: PruneMenu ( LMenu* /*inMenu*/ ) -{ - return 1; - -} // PruneMenu - - -#pragma mark - - - -// -// NewHTContextMenuCursor -// -// Create the HT context menu cursor that is appropriate for this tree view -// -HT_Cursor -CTreeViewContextMenuAttachment :: NewHTContextMenuCursor ( ) -{ - PRBool clickInBackground = PR_TRUE; - CHyperTreeFlexTable* table = dynamic_cast(mOwnerHost); - Assert_(table != NULL); - if ( table ) { - TableIndexT selectedRow = 0; - if ( table->GetNextSelectedRow(selectedRow) ) - clickInBackground = PR_FALSE; - -#if 0 -// This will cause a crash if we return NULL because the context menu code assumes a menu will -// be created. Not sure what the right fix is right now, but leaving context menus on is not -// that bad (pinkerton) - // only allow context menu if the "useSelection" flag is true for the current view - if ( URDFUtilities::PropertyValueBool(HT_TopNode(table->GetHTView()), gNavCenter->useSelection, true) == false) - return NULL; -#endif - - } - - return HT_NewContextualMenuCursor ( table->GetHTView(), PR_FALSE, clickInBackground ); - -} // NewHTContextMenuCursor - - -#pragma mark - - - -// -// NewHTContextMenuCursor -// -// Create the HT context menu cursor that is appropriate for this button. HT uses the -// selection to provide the correct context menu, so even though it sounds totally weird -// and is a hack, set the selection of the view to the button clicked on. -// -HT_Cursor -CToolbarButtonContextMenuAttachment :: NewHTContextMenuCursor ( ) -{ - HT_Resource buttonNode = NULL; - HT_View buttonView = NULL; - CRDFToolbarItem* button = dynamic_cast(mOwnerHost); - Assert_(button != NULL); - if ( button ) { - buttonNode = button->HTNode(); - buttonView = HT_GetView(buttonNode); - Assert_(buttonView != NULL); - - URDFUtilities::StHTEventMasking noEvents(HT_GetPane(buttonView), HT_EVENT_NO_NOTIFICATION_MASK); - HT_SetSelectedView(HT_GetPane(buttonView), buttonView); - HT_SetSelection(buttonNode); - } - - return HT_NewContextualMenuCursor ( buttonView, PR_FALSE, PR_FALSE ); - -} // NewHTContextMenuCursor - - -#pragma mark - - - -// -// NewHTContextMenuCursor -// -// Create the HT context menu cursor that is appropriate for this toolbar. We -// have to make sure the selection is empty so HT gives us the right context menu. -// -HT_Cursor -CToolbarContextMenuAttachment :: NewHTContextMenuCursor ( ) -{ - HT_View toolbarView = NULL; - CRDFToolbar* bar = dynamic_cast(mOwnerHost); - Assert_(bar != NULL); - if ( bar ) { - toolbarView = bar->HTView(); - Assert_(toolbarView != NULL); - - URDFUtilities::StHTEventMasking noEvents(HT_GetPane(toolbarView), HT_EVENT_NO_NOTIFICATION_MASK); - HT_SetSelectedView(HT_GetPane(toolbarView), toolbarView); - HT_SetSelectionAll(toolbarView, PR_FALSE); - } - - return HT_NewContextualMenuCursor ( toolbarView, PR_FALSE, PR_TRUE ); - -} // NewHTContextMenuCursor diff --git a/mozilla/cmd/macfe/rdfui/CNavCenterContextMenuAtt.h b/mozilla/cmd/macfe/rdfui/CNavCenterContextMenuAtt.h deleted file mode 100644 index 09de33773d8..00000000000 --- a/mozilla/cmd/macfe/rdfui/CNavCenterContextMenuAtt.h +++ /dev/null @@ -1,98 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Contains: -// -// ¥ CNavCenterContextMenuAttachment -// A version of the contextual menu attachment that generates the menu from the -// RDF backend. This class is virtual. -// ¥ CTreeViewContextMenuAttchment -// Generates the menu assuming the parent is a CHyperTreeFlexTable (tree view) -// ¥ CToolbarButtonContetxMenuAttachment -// Generates the menu assuming the parent is a toolbar button -// ¥ CToolbarContetxMenuAttachment -// Generates the menu assuming the parent is a toolbar -// - -#pragma once - -#include "htrdf.h" -#include "CContextMenuAttachment.h" - - -class CNavCenterContextMenuAttachment : public CContextMenuAttachment -{ -public: - CNavCenterContextMenuAttachment(LStream* inStream) : CContextMenuAttachment(inStream) { } - CNavCenterContextMenuAttachment(ResIDT inMenuID, ResIDT inTextTraitsID) - : CContextMenuAttachment(inMenuID, inTextTraitsID) { } - virtual ~CNavCenterContextMenuAttachment() { }; - -protected: - - virtual HT_Cursor NewHTContextMenuCursor ( ) = 0; - virtual CommandT ConvertHTCommandToPPCommand ( HT_MenuCmd inCmd ) ; - virtual LMenu* BuildMenu ( ) ; - virtual UInt16 PruneMenu ( LMenu* inMenu ) ; - -}; // CNavCenterContextMenuAttachment - - -class CTreeViewContextMenuAttachment : public CNavCenterContextMenuAttachment -{ -public: - enum { class_ID = 'NCxM' } ; // exact naming due to historical reasons. - - CTreeViewContextMenuAttachment(LStream* inStream) : CNavCenterContextMenuAttachment(inStream) { }; - virtual ~CTreeViewContextMenuAttachment() { }; - -protected: - virtual HT_Cursor NewHTContextMenuCursor ( ) ; - -}; // CTreeViewContextMenuAttachment - - -class CToolbarButtonContextMenuAttachment : public CNavCenterContextMenuAttachment -{ -public: - enum { class_ID = 'TBxM' } ; - - CToolbarButtonContextMenuAttachment() : CNavCenterContextMenuAttachment(5000, 0) { } - virtual ~CToolbarButtonContextMenuAttachment() { }; - -protected: - virtual HT_Cursor NewHTContextMenuCursor ( ) ; - -}; // CToolbarButtonContextMenuAttachment - - -class CToolbarContextMenuAttachment : public CNavCenterContextMenuAttachment -{ -public: - enum { class_ID = 'TlxM' } ; - - CToolbarContextMenuAttachment() : CNavCenterContextMenuAttachment(5000, 0) { } - virtual ~CToolbarContextMenuAttachment() { }; - -protected: - virtual HT_Cursor NewHTContextMenuCursor ( ) ; - -}; // CToolbarContextMenuAttachment \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/CNavCenterScroller.cp b/mozilla/cmd/macfe/rdfui/CNavCenterScroller.cp deleted file mode 100644 index 4f965e3c8fd..00000000000 --- a/mozilla/cmd/macfe/rdfui/CNavCenterScroller.cp +++ /dev/null @@ -1,59 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Subclass of LActiveScroller to handle resizing the vertical scrollbar -// when the column headers appear or disappear. -// - -#include "CNavCenterScroller.h" -#include - - -CNavCenterScroller :: CNavCenterScroller ( LStream* inStream ) - : LScrollerView(inStream) -{ -} - - -// -// ColumnHeadersChangedVisibility -// -// Adjust the vertical scrollbar when the column headers appear or disappear. -// If they are being hidden (probably the most common case since they appear by default -// in the PPob), move the top of the scrollbar up and stretch it by the size of the -// column headers. The only tricky part is that we move and resize by opposingly signed -// amounts. -// -void -CNavCenterScroller :: ColumnHeadersChangedVisibility ( bool inNowVisible, Uint16 inHeaderHeight ) -{ - Int16 delta = inNowVisible ? inHeaderHeight : -inHeaderHeight; - - mVerticalBar->MoveBy ( 0, delta, false ); - mVerticalBar->ResizeFrameBy ( 0, -delta, true ); - // why do we need to refresh the scrollbar? if we mode-switch on the fly while the - // window is open (which we probably won't ever do...BUT), the scrollbar is the only - // part that doesn't get redrawn by the coordinator. As a result, we need to make sure - // it is done here. If the window is not visible, PowerPlant is smart enough not to - // redraw it, so we don't get any overhead in the normal case. Wow, 11 lines of comments - // for 3 lines of obivous code. You gotta love that! - -} // ColumnHeadesrChangedVisibility \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/CNavCenterScroller.h b/mozilla/cmd/macfe/rdfui/CNavCenterScroller.h deleted file mode 100644 index 10dc8df0793..00000000000 --- a/mozilla/cmd/macfe/rdfui/CNavCenterScroller.h +++ /dev/null @@ -1,40 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Subclass of LActiveScroller to handle resizing the vertical scrollbar -// when the column headers appear or disappear. -// - -#pragma once - -#include - - -class CNavCenterScroller : public LScrollerView -{ -public: - enum { class_ID = 'NCSc' }; - - CNavCenterScroller ( LStream *inStream ); - - virtual void ColumnHeadersChangedVisibility ( bool inNowVisible, Uint16 inHeaderHeight ) ; - -}; // class CNavCenterScroller \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/CNavCenterTitle.cp b/mozilla/cmd/macfe/rdfui/CNavCenterTitle.cp deleted file mode 100644 index eb8a970291b..00000000000 --- a/mozilla/cmd/macfe/rdfui/CNavCenterTitle.cp +++ /dev/null @@ -1,327 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Class that draws the header area for the nav center which shows the title -// of the currently selected view as well as harboring the closebox for -// an easy way to close up the navCenter shelf. -// - -#include "CNavCenterTitle.h" -#include "URDFUtilities.h" -#include "CContextMenuAttachment.h" -#include "CRDFCoordinator.h" -#include "UGraphicGizmos.h" - -CNavCenterCaption :: CNavCenterCaption ( LStream *inStream ) - : CChameleonCaption(inStream) -{ -} -void CNavCenterCaption::DrawText(Rect frame, Int16 inJust) -{ - UGraphicGizmos::PlaceUTF8TextInRect((char*)&mText[1], - mText[0], - frame, - inJust); -} - - -CNavCenterStrip :: CNavCenterStrip ( LStream *inStream ) - : CGrayBevelView (inStream), - mView(NULL) -{ - -} - - -CNavCenterStrip :: ~CNavCenterStrip() -{ - // nothing to do -} - - -// -// FindCommandStatus -// -// Respond to commands from the context menu for Aurora popup-location. -// -void -CNavCenterStrip :: FindCommandStatus ( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) -{ - outEnabled = true; - outUsesMark = false; //¥¥¥ expand later to mark the current state - -} // FindCommandStatus - - -// -// ClickSelf -// -// Handle context-clicks by passing them off to the attachement (if present) -// -void -CNavCenterStrip :: ClickSelf ( const SMouseDownEvent & inMouseDown ) -{ - CContextMenuAttachment::SExecuteParams params; - params.inMouseDown = &inMouseDown; - - ExecuteAttachments ( CContextMenuAttachment::msg_ContextMenu, (void*)¶ms ); - -} // ClickSelf - - -// -// ListenToMessage -// -// We want to know when the selected workspace changes so that we can update the -// title string, etc. The RDFCoordinator sets us up as a listener which will broadcast, -// when things change. -// -void -CNavCenterStrip :: ListenToMessage ( MessageT inMessage, void* ioParam ) -{ - switch ( inMessage ) { - - case CRDFCoordinator::msg_ActiveSelectorChanged: - { - mView = reinterpret_cast(ioParam); - if ( mView ) - SetView(mView); - - // if we're in the middle of a drag and drop, draw NOW, not - // when we get a refresh event. - if ( ::StillDown() ) { - FocusDraw(); - Draw(nil); - } - } - - default: - CTiledImageMixin::ListenToMessage ( inMessage, ioParam ); - - } // case of which message - -} // ListenToMessage - - -// -// AdjustCursorSelf -// -// Handle changing cursor to contextual menu cursor if cmd key is down -// -void -CNavCenterStrip :: AdjustCursorSelf( Point /*inPoint*/, const EventRecord& inEvent ) -{ - ExecuteAttachments(CContextMenuAttachment::msg_ContextMenuCursor, - static_cast(const_cast(&inEvent))); - -} // AdjustCursorSelf - - -// -// DrawBeveledFill -// -// If the HT_View currently has a bg image specified, draw it (or at least kick off the load) -// otherwise try to erase with the specified bg color. -// -void -CNavCenterStrip :: DrawBeveledFill ( ) -{ - StColorState saved; - - if ( mView ) { - HT_Resource topNode = HT_TopNode(GetView()); - if ( topNode ) { - char* url = NULL; - PRBool success = HT_GetTemplateData ( topNode, BackgroundURLProperty(), HT_COLUMN_STRING, &url ); - if ( success && url ) { - // draw the background image tiled to fill the whole pane - Point topLeft = { 0, 0 }; - SetImageURL ( url ); - DrawImage ( topLeft, kTransformNone, mFrameSize.width, mFrameSize.height ); - FocusDraw(); - } - else - EraseBackground(topNode); - } - else - EraseBackground(NULL); - } - else - EraseBackground(NULL); - -} // DrawBeveledFill - - -// -// ImageIsReady -// -// Called when the bg image is done loading and is ready to draw. Force a redraw and -// we'll pick it up -// -void -CNavCenterStrip :: ImageIsReady ( ) -{ - Refresh(); - -} // ImageIsReady - - -// -// DrawStandby -// -// Draw correctly when the image has yet to load. -// -void -CNavCenterStrip :: DrawStandby ( const Point & /*inTopLeft*/, - IconTransformType /*inTransform*/ ) const -{ - // we're just waiting for the image to come in, who cares if we don't use - // HT's color? - EraseBackground(NULL); - -} // DrawStandby - - -// -// EraseBackground -// -// Fill in the bg with either the correct HT color (from a property on |inTopNode|, the -// correct AM color, or the default GA implementation (if we are before AM 1.1). -// -void -CNavCenterStrip :: EraseBackground ( HT_Resource inTopNode ) const -{ - // when we can get the right AM bg color (in AM 1.1), use that but for now just ignore it - if ( !inTopNode || ! URDFUtilities::SetupBackgroundColor(inTopNode, BackgroundColorProperty(), - kThemeListViewSortColumnBackgroundBrush) ) { - CNavCenterStrip* self = const_cast(this); // hack - self->CGrayBevelView::DrawBeveledFill(); - } - else { - // use HT's color - Rect bounds; - CalcLocalFrameRect(bounds); - ::EraseRect(&bounds); - } -} // EraseBackground - - -#pragma mark - - - -CNavCenterTitle :: CNavCenterTitle ( LStream *inStream ) - : CNavCenterStrip (inStream), - mTitle(NULL) -{ - -} - - -CNavCenterTitle :: ~CNavCenterTitle() -{ - // nothing to do -} - - -// -// FinishCreateSelf -// -// Last minute setup stuff.... -// -void -CNavCenterTitle :: FinishCreateSelf ( ) -{ - mTitle = dynamic_cast(FindPaneByID(kTitlePaneID)); - Assert_(mTitle != NULL); - -} // FinishCreateSelf - - - -// -// SetView -// -// Set the caption to the title of the current view -// -void -CNavCenterTitle :: SetView ( HT_View inView ) -{ - // do not delete |buffer| - const char* buffer = HT_GetViewName ( GetView() ); - TitleCaption().SetDescriptor(LStr255(buffer)); - - RGBColor textColor; - if ( URDFUtilities::GetColor(HT_TopNode(GetView()), ForegroundColorProperty(), &textColor) ) - TitleCaption().SetColor ( textColor ); - -} // SetView - - -#pragma mark - - - -CNavCenterCommandStrip :: CNavCenterCommandStrip ( LStream *inStream ) - : CNavCenterStrip (inStream), - mAddPage(NULL), mManage(NULL), mClose(NULL) -{ - -} - - -CNavCenterCommandStrip :: ~CNavCenterCommandStrip() -{ - // nothing to do -} - - -// -// FinishCreateSelf -// -// Last minute setup stuff.... -// -void -CNavCenterCommandStrip :: FinishCreateSelf ( ) -{ - // none of these are always present - mClose = dynamic_cast(FindPaneByID(kClosePaneID)); - mAddPage = dynamic_cast(FindPaneByID(kAddPagePaneID)); - mManage = dynamic_cast(FindPaneByID(kManagePaneID)); - -} // FinishCreateSelf - - -// -// SetView -// -// Update the text colors to those of the current view -// -void -CNavCenterCommandStrip :: SetView ( HT_View inView ) -{ - RGBColor textColor; - if ( URDFUtilities::GetColor(HT_TopNode(GetView()), ForegroundColorProperty(), &textColor) ) { - if ( mClose ) mClose->SetColor ( textColor ); - if ( mAddPage ) mAddPage->SetColor ( textColor ); - if ( mManage ) mManage->SetColor ( textColor ); - } - -} // SetView \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/CNavCenterTitle.h b/mozilla/cmd/macfe/rdfui/CNavCenterTitle.h deleted file mode 100644 index 99ac687df41..00000000000 --- a/mozilla/cmd/macfe/rdfui/CNavCenterTitle.h +++ /dev/null @@ -1,132 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// Class that draws the header area for the nav center which shows the title -// of the currently selected view as well as harboring the closebox for -// an easy way to close up the navCenter shelf. -// - -#include "htrdf.h" -#include "CGrayBevelView.h" -#include "CImageIconMixin.h" -#include "CColorCaption.h" - -extern RDF_NCVocab gNavCenter; // RDF vocab struct for NavCenter - - -class CNavCenterStrip - : public CGrayBevelView, public CTiledImageMixin, public LCommander -{ - // Construction, Destruction - CNavCenterStrip(LStream *inStream); - ~CNavCenterStrip(); - -protected: - - // override to use various RDF properties - virtual void* BackgroundURLProperty ( ) const = 0; - virtual void* BackgroundColorProperty ( ) const = 0; - virtual void* ForegroundColorProperty ( ) const = 0; - - // override to change properties based on a new view - virtual void SetView ( HT_View inView ) = 0; - virtual HT_View GetView ( ) const { return mView; } - - // PowerPlant overrides - virtual void ListenToMessage ( MessageT inMessage, void* ioParam ) ; - virtual void AdjustCursorSelf( Point inPoint, const EventRecord& inEvent ) ; - virtual void FindCommandStatus ( CommandT inCommand, Boolean &outEnabled, - Boolean &outUsesMark, Char16 &outMark, Str255 outName) ; - virtual void ClickSelf ( const SMouseDownEvent & inMouseDown ) ; - - virtual void DrawBeveledFill ( ) ; - virtual void DrawStandby ( const Point & inTopLeft, IconTransformType inTransform ) const; - virtual void EraseBackground ( HT_Resource inTopNode ) const ; - virtual void ImageIsReady ( ) ; - -private: - - HT_View mView; // ref back to current view for custom drawing - -}; // class CNavCenterTitle - - -class CNavCenterCaption : public CChameleonCaption { -public: - enum { class_ID = 'ccp8' }; - CNavCenterCaption(LStream *inStream); -protected: - virtual void DrawText(Rect frame, Int16 inJust); -}; - -class CNavCenterTitle : public CNavCenterStrip -{ -public: - enum { class_ID = 'hbar', kTitlePaneID = 'titl' }; - - CNavCenterTitle(LStream *inStream); - ~CNavCenterTitle(); - - // Provide access to the LCaption that displays the title - CChameleonCaption& TitleCaption ( ) { return *mTitle; } - const CChameleonCaption& TitleCaption ( ) const { return *mTitle; } - -protected: - - virtual void SetView ( HT_View inView ) ; - virtual void FinishCreateSelf ( ) ; - - virtual void* BackgroundURLProperty ( ) const { return gNavCenter->titleBarBGURL; } - virtual void* BackgroundColorProperty ( ) const { return gNavCenter->titleBarBGColor; } - virtual void* ForegroundColorProperty ( ) const { return gNavCenter->titleBarFGColor; } - -private: - - CChameleonCaption* mTitle; - -}; // class CNavCenterTitle - - - -class CNavCenterCommandStrip : public CNavCenterStrip -{ -public: - enum { class_ID = 'tcmd', kAddPagePaneID = 'addp', kManagePaneID = 'edit', kClosePaneID = 'clos' } ; - enum { msg_CloseShelfNow = 'clos', msg_AddPage = 'addp', msg_Manage = 'edit' } ; - - // Construction, Destruction - CNavCenterCommandStrip(LStream *inStream); - ~CNavCenterCommandStrip(); - -private: - - virtual void SetView ( HT_View inView ) ; - virtual void FinishCreateSelf ( ) ; - - virtual void* BackgroundURLProperty ( ) const { return gNavCenter->controlStripBGURL; } - virtual void* BackgroundColorProperty ( ) const { return gNavCenter->controlStripBGColor; } - virtual void* ForegroundColorProperty ( ) const { return gNavCenter->controlStripFGColor; } - - CChameleonCaption* mAddPage; - CChameleonCaption* mManage; - CChameleonCaption* mClose; - -}; // class CNavCenterCommandStrip diff --git a/mozilla/cmd/macfe/rdfui/CRDFCoordinator.cp b/mozilla/cmd/macfe/rdfui/CRDFCoordinator.cp deleted file mode 100644 index b2769710631..00000000000 --- a/mozilla/cmd/macfe/rdfui/CRDFCoordinator.cp +++ /dev/null @@ -1,1100 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// <> -// -// The RDFCoordiator suite of classes handles interactions between HT (the HyperTree interface -// to RDF) and the front end. The Coordinator's big job is funneling HT events to the right UI -// element (tree, title bar, etc). Right now, there are 4 basic types of Coordiators: -// - CDockedRDFCoordinator -// Tree is docked in the left of the window (handles opening/closing/etc of shelf) -// - CShackRDFCoordinator -// Tree is embedded in HTML content -// - CWindowRDFCoordinator -// Tree is in a standalone window -// - CPopupRDFCoordinator -// Tree is popped up from a container on the toolbar -// - -#include "CRDFCoordinator.h" - -#include "CHyperTreeFlexTable.h" -#include "CNavCenterScroller.h" -#include "CNavCenterTitle.h" -#include "UGraphicGizmos.h" - - -// XP headers -#include "xp_str.h" -#include "htrdf.h" -#include "xp_ncent.h" - -// MacFE specific headers -#include "URDFUtilities.h" -#include "Netscape_Constants.h" -#include "URobustCreateWindow.h" -#include "BookmarksDialogs.h" -#include "divview.h" -#include "LGAIconSuiteControl.h" -#include "CBrowserView.h" -#include "CBrowserContext.h" - - -#if 0 -ViewFEData :: ViewFEData ( ) - : mSelector(NULL) -{ -} - - -ViewFEData :: ViewFEData ( SelectorData* inSelector ) - : mSelector(inSelector) -{ -} - - -ViewFEData :: ~ViewFEData ( ) -{ - delete mSelector; -} -#endif - -#pragma mark - - -CRDFCoordinator::CRDFCoordinator(LStream* inStream) -: LView(inStream), - mTreePane(NULL), - mHTPane(NULL), - mColumnHeaders(NULL), - mTitleStrip(NULL), - mTitleCommandArea(NULL) -{ - *inStream >> mTreePaneID; - *inStream >> mColumnHeaderID; - *inStream >> mTitleStripID; - *inStream >> mTitleCommandID; - -} // constructor - - -CRDFCoordinator::~CRDFCoordinator() -{ - // if we don't do this, the LCommander destructor will try to clear the selection and - // of course, the HTPane won't be around anymore to update the selection....boom.... - SwitchTarget(nil); - - if ( HTPane() ) { - UnregisterNavCenter(); - // ...no need to destroy the HTPane, auto_ptr does that for us... - } - -} // destructor - - -void -CRDFCoordinator::FinishCreateSelf() -{ - // receive notifications from the tree view - mTreePane = dynamic_cast(FindPaneByID(mTreePaneID)); - Assert_( mTreePane != NULL ); - if (mTreePane) - mTreePane->AddListener(this); - - mColumnHeaders = dynamic_cast(FindPaneByID(mColumnHeaderID)); - Assert_( mColumnHeaders != NULL ); - - // Register the title strip as a listener so we can update it when the view - // changes. - // NOTE: There is no guarantee that the title strip will be there. - mTitleStrip = dynamic_cast(FindPaneByID(mTitleStripID)); - if ( mTitleStrip ) - AddListener(mTitleStrip); - - // Register the title command area as a listener so we can update it when the view - // changes - // NOTE: There is no guarantee that the command strip will be there. - mTitleCommandArea = dynamic_cast(FindPaneByID(mTitleCommandID)); - if ( mTitleCommandArea ) { - AddListener(mTitleCommandArea); - - // If the "add page" caption is there, register this class as a listener so we get the - // add page message - LBroadcaster* addPage = - dynamic_cast(FindPaneByID(CNavCenterCommandStrip::kAddPagePaneID)); - if ( addPage ) - addPage->AddListener(this); - - // If the "manage" caption is there, register this class as a listener so we get the - // tree management message - LBroadcaster* manage = - dynamic_cast(FindPaneByID(CNavCenterCommandStrip::kManagePaneID)); - if ( manage ) - manage->AddListener(this); - } - -} // FinishCreateSelf - - -// -// ShowOrHideColumnHeaders -// -// Wrapper that checks the HT property to determine if we need to show or hide -// the column headers. -// -void -CRDFCoordinator :: ShowOrHideColumnHeaders ( ) -{ - if ( !mColumnHeaders || !HTPane() ) - return; - - HT_Resource topNode = HT_TopNode(HT_GetSelectedView(HTPane())); - bool shouldShowHeaders = URDFUtilities::PropertyValueBool(topNode, gNavCenter->showColumnHeaders, true); - if ( shouldShowHeaders && mColumnHeaders->GetVisibleState() == triState_Off ) - ShowColumnHeaders(); - else if ( !shouldShowHeaders && mColumnHeaders->GetVisibleState() != triState_Off ) - HideColumnHeaders(); - -} // ShowOrHideColumnHeaders - - -// -// ShowColumnHeaders -// -// Make the column headers visible. Assumes they are invisible. -// -void -CRDFCoordinator :: ShowColumnHeaders ( ) -{ - SDimension16 columnHeaderFrame; - mColumnHeaders->GetFrameSize ( columnHeaderFrame ); - mColumnHeaders->Show(); - - mTreePane->MoveBy ( 0, columnHeaderFrame.height, false ); - mTreePane->ResizeFrameBy ( 0, -columnHeaderFrame.height, false ); - - CNavCenterScroller* scroller = dynamic_cast(FindPaneByID(kScrollerPaneID)); - if ( scroller ) - scroller->ColumnHeadersChangedVisibility ( true, columnHeaderFrame.height ); - -} // ShowColumnHeaders - - -// -// HideColumnHeaders -// -// Make the column headers invisible. Assumes they are visible. -// -void -CRDFCoordinator :: HideColumnHeaders ( ) -{ - SDimension16 columnHeaderFrame; - mColumnHeaders->GetFrameSize ( columnHeaderFrame ); - mColumnHeaders->Hide(); - - mTreePane->MoveBy ( 0, -columnHeaderFrame.height, false ); - mTreePane->ResizeFrameBy ( 0, columnHeaderFrame.height, false ); - - CNavCenterScroller* scroller = dynamic_cast(FindPaneByID(kScrollerPaneID)); - if ( scroller ) - scroller->ColumnHeadersChangedVisibility ( false, columnHeaderFrame.height ); - -} // HideColumnHeaders - - -// -// HandleNotification -// -// Process notification events from HT. Things like nodes being added or deleted, etc come -// here and then are farmed out to the appropriate subview. -// -void CRDFCoordinator::HandleNotification( - HT_Notification /*notifyStruct*/, - HT_Resource node, - HT_Event event, - void *token, - uint32 tokenType) -{ - PRBool isOpen; - HT_Error err; - - HT_View view = HT_GetView(node); // everyone needs this, more or less - - switch (event) - { - case HT_EVENT_VIEW_MODECHANGED: - - ShowOrHideColumnHeaders(); - - // redraw the tree with new colors, etc - if ( view == mTreePane->GetHTView() ) { -#if 0 -// Per pinkerton - remove completely once verified as unneeded - // if the new mode doesn't want selection, make sure there isn't one - if ( URDFUtilities::PropertyValueBool(node, gNavCenter->useSelection, true) == false ) - mTreePane->UnselectAllCells(); -#endif - if ( mTitleStrip ) - mTitleStrip->Refresh(); - mTreePane->Refresh(); - - // make sure the tree knows the right number of clicks to open up a row. It may - // have changed with the mode switch - Uint8 clicksToOpen = 2; - if ( URDFUtilities::PropertyValueBool(node, gNavCenter->useSingleClick, false) == true ) - clicksToOpen = 1; - mTreePane->ClickCountToOpen(clicksToOpen); - } - - break; - - case HT_EVENT_NODE_ADDED: - { - if ( view == mTreePane->GetHTView() ) { - // HT_GetNodeIndex() will return the row where this new item should go - // in a zero-based world. This translates, in a 1-based world of PP, to be - // the node after which this new row will go. Conveniently, that is what - // we want for InsertRows() so we don't have to add 1 like we normally do - // when coverting between HT and PP. - TableIndexT index = HT_GetNodeIndex(view, node); - mTreePane->InsertRows(1, index, NULL, 0, true); - mTreePane->SyncSelectionWithHT(); - } - break; - } - - case HT_EVENT_VIEW_SELECTED: - { - // if the current view is changed by HT (not interactively by the user), this - // is the only place in the call chain where we will get notification. Make sure - // the shelf is open/closed accordingly and the titlebar is updated. - SelectView(view); - - bool openShelf = (view != NULL); - ListenToMessage ( CDockedRDFCoordinator::msg_ShelfStateShouldChange, &openShelf ); - BroadcastMessage ( CRDFCoordinator::msg_ActiveSelectorChanged, view ); - break; - } - - // - // we get this event before the node opens/closes. This is useful for closing so - // we can compute the number of visible children of the node being closed before - // all that info goes away. - // - case HT_EVENT_NODE_OPENCLOSE_CHANGING: - err = HT_GetOpenState(node, &isOpen); - if (isOpen) - CollapseNode(node); - break; - - // - // we get this event after the node has finished opening/closing. - // - case HT_EVENT_NODE_OPENCLOSE_CHANGED: - err = HT_GetOpenState(node, &isOpen); - if (isOpen) - ExpandNode(node); - break; - - case HT_EVENT_NODE_DELETED_DATA: - case HT_EVENT_NODE_DELETED_NODATA: - { - // delete the FE data for a node (will be a CTreeIcon*) - void* data = HT_GetNodeFEData ( node ); - delete data; - break; - } - - // - // we get this event when a new node is created and is to be put in "inline edit" mode. - // - case HT_EVENT_NODE_EDIT: - { - //¥¥¥ There are currently some problems with redraw here because of the way that - // the drawing code and the inline editing code interact. You can uncomment the - // line below and see that the cell does not draw correctly because it never gets - // a drawCellContents() called on it (since it is the cell being edited). This - // needs some work..... - if ( view == mTreePane->GetHTView() ) { - TableIndexT rowToEdit = URDFUtilities::HTRowToPPRow( HT_GetNodeIndex(view, node) ); - mTreePane->DoInlineEditing( rowToEdit ); - } - break; - } - - case HT_EVENT_NODE_VPROP_CHANGED: - { - if ( node == HT_TopNode(mTreePane->GetHTView()) ) - mTreePane->Refresh(); - else - mTreePane->RedrawRow(node); - break; - } - - case HT_EVENT_NODE_SELECTION_CHANGED: - mTreePane->SyncSelectionWithHT(); - break; - - // scroll the given node into view. Currently uses (more or less) the LTableView - // implementation which tries to scroll as little as possible and isn't very smart - // about centering the node. We should change that at some point (pinkerton). - case HT_EVENT_NODE_SCROLLTO: - TableIndexT index = HT_GetNodeIndex(view, node); -// mTreePane->ScrollRowIntoFrame(index); - break; - - case HT_EVENT_VIEW_REFRESH: - { - // only update if current view - // - // ¥¥¥ There are some fairly noticable redraw problems here. For example, when - // nodes are deleted or added, the entire view is redrawn (and flashes). We - // need some help from HT to prevent this. - if ( view == mTreePane->GetHTView() ) { - uint32 newRowsInView = HT_GetItemListCount ( view ); - TableIndexT numRows, numCols; - mTreePane->GetTableSize ( numRows, numCols ); - - int32 delta = newRowsInView - numRows; - if ( delta > 0 ) - mTreePane->InsertRows ( delta, 1 ); - else - mTreePane->RemoveRows ( abs(delta), 1, false ); - mTreePane->SyncSelectionWithHT(); - mTreePane->Refresh(); - } // if refresh for current view - break; - } - - case HT_EVENT_COLUMN_ADD: - // just wipe everything out and start over... - if ( view == mTreePane->GetHTView() ) - mTreePane->SetupColumns(); - break; - - case HT_EVENT_COLUMN_DELETE: - // delete any FE data here, but since we don't have any... - break; - - case HT_EVENT_COLUMN_SIZETO: - case HT_EVENT_COLUMN_REORDER: - case HT_EVENT_COLUMN_SHOW: - case HT_EVENT_COLUMN_HIDE: - //¥¥¥ not implemented - break; - - case HT_EVENT_VIEW_WORKSPACE_REFRESH: - case HT_EVENT_VIEW_ADDED: - case HT_EVENT_VIEW_DELETED: - break; - - } // case of which HT event - -} // HandleNotification - - -// -// SelectView -// -// Make the given view the current view. -// -void CRDFCoordinator::SelectView(HT_View view) -{ - if ( view ) { - mTreePane->OpenView(view); - BroadcastMessage ( CRDFCoordinator::msg_ActiveSelectorChanged, view ); - } - -} // SelectView - - -// -// SelectView -// -// Make the given type of view the current view and (by calling the above routine) -// ensure that the selector widget is up to date. HT_SetSelectedView() will send -// us a notification event to open the given view, so we don't have to do it here. -// -void CRDFCoordinator::SelectView ( HT_ViewType inPane ) -{ - HT_View view = HT_GetViewType ( HTPane(), inPane ); - HT_SetSelectedView ( HTPane(), view ); - -} // SelectView - - - -void CRDFCoordinator::ExpandNode(HT_Resource node) -{ - mTreePane->ExpandNode(node); -} - -void CRDFCoordinator::CollapseNode(HT_Resource node) -{ - mTreePane->CollapseNode(node); -} - - -// -// ListenToMessage -// -// Process the various messages we get from the FE, such as requests to open/close the tree shelf -// or change which workspace is currently selected. -void -CRDFCoordinator::ListenToMessage ( MessageT inMessage, void *ioParam ) -{ - switch (inMessage) { - - case CNavCenterCommandStrip::msg_AddPage: - LCommander::GetTarget()->ProcessCommand(cmd_AddToBookmarks, NULL ); - break; - - case CNavCenterCommandStrip::msg_Manage: - HT_Resource topNode = HT_TopNode ( HT_GetSelectedView(HTPane()) ); - LCommander::GetTopCommander()->ProcessCommand(cmd_NCOpenNewWindow, topNode ); - break; - -#if 0 -//¥¥¥ This might be useful, depending on how the command pane works out... - // the user clicked in the selector pane to change the selected workspace. Tell - // the backend about it, but before we do that, turn off HT events so we don't actually - // get the notification back -- we don't need it because the view change was caused - // by the FE. - case msg_ActiveSelectorChanged: - { - HT_View newView = reinterpret_cast(ioParam); - URDFUtilities::StHTEventMasking saveMask(mHTPane, HT_EVENT_NO_NOTIFICATION_MASK); - HT_SetSelectedView(mHTPane, newView); - SelectView(newView); - break; - } -#endif - - } // case of which message - -} // ListenToMessage - - -// -// ObeyCommand -// -// Do what PowerPlant tells us. =) -// -Boolean -CRDFCoordinator :: ObeyCommand ( CommandT inCommand, void* ioParam ) -{ - Boolean cmdHandled = false; - - if ( inCommand >= cmd_NavCenterBase && inCommand <= cmd_NavCenterCap ) { - // ¥make sure nav center is open??? - HT_Error err = HT_DoMenuCmd ( HTPane(), (HT_MenuCmd)(inCommand - cmd_NavCenterBase) ); - Assert_( err == HT_NoErr ); - return true; - } - - switch ( inCommand ) { - - // - // handle commands that we have to share with other parts of the UI - // - case cmd_Cut: - HT_DoMenuCmd(HTPane(), HT_CMD_CUT ); - cmdHandled = true; - break; - case cmd_Copy: - HT_DoMenuCmd(HTPane(), HT_CMD_COPY ); - cmdHandled = true; - break; - case cmd_Paste: - HT_DoMenuCmd(HTPane(), HT_CMD_PASTE ); - cmdHandled = true; - break; - case cmd_Clear: - HT_DoMenuCmd(HTPane(), HT_CMD_DELETE_FILE ); - cmdHandled = true; - break; - - case cmd_NCFind: - URobustCreateWindow::CreateWindow ( CBookmarksFindDialog::res_ID, nil ); - cmdHandled = true; - break; - - case msg_TabSelect: - // don't accept focus switching to this view - cmdHandled = false; - break; - - default: - cmdHandled = LCommander::ObeyCommand ( inCommand, ioParam ); - break; - - } // case on command - - return cmdHandled; - -} // ObeyCommand - - -// -// RegisterNavCenter -// -// Tell XP about this navCenter & context for site map stuff -// -void -CRDFCoordinator :: RegisterNavCenter ( const MWContext* inContext ) const -{ - if ( HTPane() ) - XP_RegisterNavCenter ( HTPane(), const_cast(inContext) ); - -} // RegisterNavCenter - - -// -// UnregisterNavCenter -// -// Tell XP this window is going away. -// -void -CRDFCoordinator :: UnregisterNavCenter ( ) const -{ - if ( HTPane() ) - XP_UnregisterNavCenter ( HTPane() ); - -} // UnregisterNavCenter - - -// -// SetTargetFrame -// -// Pass-through to the tree to tell it which pane to target when items (url's) are -// double-clicked. -// -void -CRDFCoordinator :: SetTargetFrame ( const char* inFrame ) -{ - mTreePane->SetTargetFrame ( inFrame ); - -} // SetTargetFrame - - -#pragma mark - - -CDockedRDFCoordinator :: CDockedRDFCoordinator(LStream* inStream) - : CRDFCoordinator(inStream), mNavCenter(NULL), mAdSpace(NULL), mAdSpaceView(NULL) -{ - // don't create the HT_pane until we actually need it (someone opens a node - // and they want it to be docked). -} - - -CDockedRDFCoordinator :: ~CDockedRDFCoordinator() -{ - // don't need to clean up the html area, the CHTMLView destructor will do that for us - // when the pane goes away. - - // clean up the shelves - delete mNavCenter; - delete mAdSpace; -} - - -// -// FinishCreateSelf -// -// Setup stuff related to when this thing is embedded in a browser window -// -void -CDockedRDFCoordinator :: FinishCreateSelf ( ) -{ - CRDFCoordinator::FinishCreateSelf(); - - // initialize the navCenter shelf. If we are a standalone window, we won't have - // a LDividedView so no expando-collapso stuff happens. - LDividedView* navCenter = dynamic_cast(FindPaneByID('ExCt')); - Assert_( navCenter != NULL ); - if ( navCenter ) - mNavCenter = new CShelf ( navCenter, NULL, - (LDividedView::FeatureFlags)(LDividedView::eZapClosesFirst | LDividedView::eNoOpenByDragging) ); - - // initialize the shelf holding the ad space & the tree - LDividedView* adSpace = dynamic_cast(FindPaneByID('guts')); - Assert_( adSpace != NULL ); - if ( adSpace ) - mAdSpace = new CShelf ( adSpace, NULL, - (LDividedView::FeatureFlags)(LDividedView::eZapClosesSecond | LDividedView::eNoOpenByDragging) ); - - // If the close caption is there, register this class as a listener so we get the - // close message - LBroadcaster* closeCaption = - dynamic_cast(FindPaneByID(CNavCenterCommandStrip::kClosePaneID)); - if ( closeCaption ) - closeCaption->AddListener(this); - - // init the embedded html area. There is no point showing or hiding the adSpace here - // because it will be usurped by RestorePlace(). It is done at the browser window level. - mAdSpaceView = dynamic_cast(FindPaneByID(adSpacePane_ID)); - Assert_(mAdSpaceView != NULL); - if ( mAdSpaceView ) { - CBrowserContext* theContext = new CBrowserContext(); - mAdSpaceView->SetContext ( theContext ); - } - -} // FinishCreateSelf - - -// -// SavePlace -// -// Pass through to the tree view so it can save the shelf width -// -void -CDockedRDFCoordinator :: SavePlace ( LStream* outStreamData ) -{ - if ( !outStreamData ) - return; - - if ( mNavCenter ) - NavCenterShelf().GetShelf()->SavePlace(outStreamData); - if ( mAdSpace ) - AdSpaceShelf().GetShelf()->SavePlace(outStreamData); - -} // SavePlace - - -// -// RestorePlace -// -// Pass through to the tree view so it can restore the shelf width -// -void -CDockedRDFCoordinator :: RestorePlace ( LStream* inStreamData ) -{ - if ( !inStreamData ) // if reading from new/empty prefs, the stream will be null - return; - - if ( mNavCenter ) - NavCenterShelf().GetShelf()->RestorePlace(inStreamData); - if ( mAdSpace ) - AdSpaceShelf().GetShelf()->RestorePlace(inStreamData); - -} // RestorePlace - - -// -// ListenToMessages -// -// Respond to "shelf-related" messages. If it's not one of those, pass it to the base class. -// -void -CDockedRDFCoordinator :: ListenToMessage ( MessageT inMessage, void *ioParam ) -{ - switch (inMessage) { - - // expand/collapse the shelf to the state pointed to by |ioParam|. If we don't - // switch the target, we run into the problem where we are still the active - // commander and get called on to handle the menus. Since there will be no - // view, HT will barf. - case CDockedRDFCoordinator::msg_ShelfStateShouldChange: - if ( mNavCenter ) { - bool nowOpen = *(reinterpret_cast(ioParam)); - mNavCenter->SetShelfState ( nowOpen ); - if ( nowOpen ) { - mTreePane->SetRightmostVisibleColumn(1); //¥¥Êavoid annoying columns - SwitchTarget(this); - } - else - SwitchTarget(GetSuperCommander()); - } - break; - - // similar to above, but can cut out the crap because we are closing things - // down explicitly. - case CNavCenterCommandStrip::msg_CloseShelfNow: - if ( mNavCenter ) { - mNavCenter->SetShelfState ( false ); - SwitchTarget(GetSuperCommander()); - } - break; - - default: - CRDFCoordinator::ListenToMessage ( inMessage, ioParam ); - - } // case of which message - -} // ListenToMessage - - -// -// HandleNotification -// -// Override to understand events about the html area appearing and disappearing. -// -void -CDockedRDFCoordinator :: HandleNotification ( HT_Notification notifyStruct, HT_Resource node, - HT_Event event, void *token, uint32 tokenType ) -{ - switch ( event ) { - - case HT_EVENT_VIEW_HTML_ADD: - ShowAdSpace(); - break; - - case HT_EVENT_VIEW_HTML_REMOVE: - AdSpaceShelf().SetShelfState ( false ); // make sure people don't see the html area - break; - - default: - CRDFCoordinator::HandleNotification ( notifyStruct, node, event, token, tokenType ); - - } - -} // HandleNotification - - -// -// BuildHTPane -// -// Create a new pane with |inNode| as the root. Delete the old pane if it exists -// -void -CDockedRDFCoordinator :: BuildHTPane ( HT_Resource inNode, MWContext* inContext ) -{ - // are we already displaying this one? If so, bail. - HT_View currView = mTreePane->GetHTView(); - if ( currView && inNode == HT_TopNode(currView) ) - return; - - // out with the old - if ( HTPane() ) { - UnregisterNavCenter(); - // no need to delete the pane, auto_ptr does that for us - } - - // in with the new - HTPane ( CreateHTPane(inNode) ); - if ( HTPane() ) { - // tell HT we're a docked view - HT_SetWindowType ( HTPane(), HT_DOCKED_WINDOW ); - - ShowOrHideColumnHeaders(); - - // we don't get a view selected event like other trees, so setup the tree - // view to point to the already selected view in HT and broadcast to tell - // the title bar to update the title. - HT_View currView = HT_GetSelectedView(HTPane()); - SelectView ( currView ); - - // show or hide the shelf containing the HTML pane. We want to do this - // before we register to show the content so that we don't cause the html - // to have to resize. - if ( HT_HasHTMLPane(currView) ) - ShowAdSpace(); - else - AdSpaceShelf().SetShelfState(false); - - // register us for sitemaps and the html area notifications - RegisterNavCenter ( inContext ); - if ( mAdSpaceView ) - XP_RegisterViewHTMLPane ( currView, *(mAdSpaceView->GetContext()) ); - - } // if valid pane - -} // BuildHTPane - - -// -// ShowAdSpace -// -// Handles opening and sizing the HTML AdSpace. -// -void -CDockedRDFCoordinator :: ShowAdSpace ( ) -{ - HT_View currView = HT_GetSelectedView(HTPane()); - AdSpaceShelf().SetShelfState ( true ); // unnecessary, except to set the pref (if we still care) - - SetAdSpaceToCorrectSize(currView); - -} // ShowAdSpace - - -// -// SetAdSpaceToCorrectSize -// -// Sets the shelf to the appropriate size -// -void -CDockedRDFCoordinator :: SetAdSpaceToCorrectSize ( HT_View inView ) -{ - const kDefaultHeight = 100; - Int32 adSpaceHeight = kDefaultHeight; - - SDimension16 size; - GetFrameSize(size); - - // get the html area size property, convert it from % to pixel value and - // set the size of the pane accordingly. - string height = HT_HTMLPaneHeight(inView); - string::iterator percent = find ( height.begin(), height.end(), '%' ); - if ( percent != height.end() ) { - // we know it is a percentage now, not a fixed height. Cut off string at - // the '%' and use it as a percentage of the total height. - *percent = NULL; - adSpaceHeight = size.height * ((double)abs(atoi(height.c_str())) / (double)100); - if ( ! adSpaceHeight ) - adSpaceHeight = kDefaultHeight; // sanity check - } - else { - // it's either a number or it's not specified so we need to make it the default - adSpaceHeight = abs ( atoi(height.c_str()) ); - if ( ! adSpaceHeight ) - adSpaceHeight = kDefaultHeight; - } - - Uint32 desiredPosition = size.height - adSpaceHeight; - - LDividedView* divView = AdSpaceShelf().GetShelf(); - Int32 delta = desiredPosition - divView->GetDividerPosition(); - divView->ChangeDividerPosition(delta); - -} // SetAdSpaceToCorrectSize - - -#pragma mark - - - -CShackRDFCoordinator :: CShackRDFCoordinator ( LStream* inStream ) - : CRDFCoordinator ( inStream ) -{ - // don't create a default HT_Pane, it has to be done later -} - - -CShackRDFCoordinator :: ~CShackRDFCoordinator ( ) -{ - -} - - -void -CShackRDFCoordinator :: BuildHTPane ( const char* inURL, unsigned int inCount, - char** inParamNames, char** inParamValues ) -{ - HTPane ( CreateHTPane(inURL, inCount, inParamNames, inParamValues) ); - if ( HTPane() ) { - // tell HT we're a shack view - HT_SetWindowType ( HTPane(), HT_EMBEDDED_WINDOW ); - - ShowOrHideColumnHeaders(); - - // we don't get a view selected event like other trees, so setup the tree - // view to point to the already selected view in HT and broadcast to tell - // the title bar to update the title. - HT_View view = HT_GetSelectedView(HTPane()); - SelectView ( view ); - } - -} // BuildHTPane - - -#pragma mark - - - -CWindowRDFCoordinator :: CWindowRDFCoordinator ( LStream* inStream ) - : CRDFCoordinator ( inStream ) -{ -} - -CWindowRDFCoordinator :: ~CWindowRDFCoordinator ( ) -{ -} - - -void -CWindowRDFCoordinator :: FinishCreateSelf ( ) -{ - CRDFCoordinator::FinishCreateSelf(); - -} // FinishCreateSelf - - -void -CWindowRDFCoordinator :: BuildHTPane ( HT_Resource inNode ) -{ - HTPane ( CreateHTPane(inNode) ); - if ( HTPane() ) { - // tell HT we're a standalone window - HT_SetWindowType ( HTPane(), HT_STANDALONE_WINDOW ); - - ShowOrHideColumnHeaders(); - - // we don't get a view selected event like other trees, so setup the tree - // view to point to the already selected view in HT and broadcast to tell - // the title bar to update the title. - SelectView ( HT_GetSelectedView(HTPane()) ); - } - -} // BuildHTPane - -void -CWindowRDFCoordinator :: BuildHTPane ( RDF_Resource inNode ) -{ - HTPane ( CreateHTPane(inNode) ); - if ( HTPane() ) { - // tell HT we're a standalone window - HT_SetWindowType ( HTPane(), HT_STANDALONE_WINDOW ); - - ShowOrHideColumnHeaders(); - - // we don't get a view selected event like other trees, so setup the tree - // view to point to the already selected view in HT and broadcast to tell - // the title bar to update the title. - SelectView ( HT_GetSelectedView(HTPane()) ); - } - -} // BuildHTPane - - -#pragma mark - - - -CPopdownRDFCoordinator :: CPopdownRDFCoordinator ( LStream* inStream ) - : CRDFCoordinator ( inStream ) -{ -} - -CPopdownRDFCoordinator :: ~CPopdownRDFCoordinator ( ) -{ -} - - -// -// BuildHTPane -// -// Creates a new HT Pane rooted at the given resource. This can (and should) be called -// to switch the HT_Pane of a popdown that has already been created. It will correctly -// clean up after itself before making the new pane. -// -void -CPopdownRDFCoordinator :: BuildHTPane ( HT_Resource inNode, MWContext* inContext ) -{ - // out with the old, but only if it is not the pane originating d&d. - if ( HTPane() != CPopdownFlexTable::HTPaneOriginatingDragAndDrop() ) { - UnregisterNavCenter(); - // no need to delete the pane, auto_ptr takes care of that for us - } - - // in with the new - HTPane ( CreateHTPane(inNode) ); - if ( HTPane() ) { - // tell HT we're a standalone window - HT_SetWindowType ( HTPane(), HT_POPUP_WINDOW ); - - ShowOrHideColumnHeaders(); - - // we don't get a view selected event like other trees, so setup the tree - // view to point to the already selected view in HT and broadcast to tell - // the title bar to update the title. - SelectView ( HT_GetSelectedView(HTPane()) ); - - // register so things like What's Related will work. - RegisterNavCenter ( inContext ); - } - -} // BuildHTPane - - -// -// FinishCreateSelf -// -// Setup ourselves as a listener for the "close" button so we can pass along the -// message to the browser window. -// -void -CPopdownRDFCoordinator :: FinishCreateSelf ( ) -{ - CRDFCoordinator::FinishCreateSelf(); - - // If the close caption is there, register this class as a listener so we get the - // close message - LBroadcaster* closeCaption = - dynamic_cast(FindPaneByID(CNavCenterCommandStrip::kClosePaneID)); - if ( closeCaption ) - closeCaption->AddListener(this); - -} // FinishCreateSelf - - -// -// FindCommandStatus -// -// All menu commands, etc should be disabled. -// -void -CPopdownRDFCoordinator :: FindCommandStatus ( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName) -{ - outEnabled = false; - outUsesMark = false; - -} // FindCommandStatus - - -// -// ListenToMessage -// -// Handle the message to close up the tree. -// -void -CPopdownRDFCoordinator :: ListenToMessage ( MessageT inMessage, void *ioParam ) -{ - // pass through the message up to the browser window that can actually do - // something about closing this popdown - if ( inMessage == CPopdownFlexTable::msg_ClosePopdownTree || - inMessage == CNavCenterCommandStrip::msg_CloseShelfNow ) { - BroadcastMessage ( msg_ClosePopdownTree ); - } - else - CRDFCoordinator::ListenToMessage ( inMessage, ioParam ); - -} // ListenToMessage - - -// -// DrawSelf -// -// Draw a sunken bevel frame so that we look like we are a drop target -// -void -CPopdownRDFCoordinator :: DrawSelf ( ) -{ - Rect localRect; - CalcLocalFrameRect(localRect); - - UGraphicGizmos::BevelTintRect ( localRect, -2, 0x6000, 0x6000 ); - -} // DrawSelf - diff --git a/mozilla/cmd/macfe/rdfui/CRDFCoordinator.h b/mozilla/cmd/macfe/rdfui/CRDFCoordinator.h deleted file mode 100644 index 12935847535..00000000000 --- a/mozilla/cmd/macfe/rdfui/CRDFCoordinator.h +++ /dev/null @@ -1,330 +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. - */ - -// -// Mike Pinkerton, Netscape Communications -// -// The RDFCoordiator suite of classes handles interactions between HT (the HyperTree interface -// to RDF) and the front end. The Coordinator's big job is funneling HT events to the right UI -// element (tree, title bar, etc). Right now, there are 4 basic types of Coordiators: -// - CDockedRDFCoordinator -// Tree is docked in the left of the window (handles opening/closing/etc of shelf) -// - CShackRDFCoordinator -// Tree is embedded in HTML content -// - CWindowRDFCoordinator -// Tree is in a standalone window -// - CPopupRDFCoordinator -// Tree is popped up from a container on the toolbar -// - -#pragma once - -#include -#include -#include -#include "auto_HT_Pane.h" - -#include "CRDFNotificationHandler.h" -#include "CShelfMixin.h" - - -class CHyperTreeFlexTable; -class CNavCenterTitle; -class CNavCenterCommandStrip; -class CBrowserView; -class CBrowserContext; - - -// -// class ViewFEData -// -// Contains all the FE-specific data stuffed into an HT_View. This holds stuff about the icon on -// the selector bar for the view, columns associated with the view, etc... -// -#if 0 -struct ViewFEData { - ViewFEData ( ); - ViewFEData ( SelectorData* inSelector ); - ~ViewFEData ( ) ; - - SelectorData* mSelector; - // ColumnData* mColumnInfo; // to come later... -}; -#endif - - -#pragma mark class CRDFCoordinator - -// -// class CRDFCoordinator -// -// The base-class of all coordinators. Don't instantiate one of these, only one of it's -// subclasses. The creation of the HT_Pane is left up to each subclass since they all vary -// in how the pane is initialized (url, HT_Resource, or nothing). -// - -class CRDFCoordinator : public LView, - public LListener, public LCommander, public LBroadcaster, - public CRDFNotificationHandler -{ -protected: - // protected to prevent anyone from instantiating one of these by itself. - CRDFCoordinator(LStream* inStream); - virtual ~CRDFCoordinator(); - -public: - enum { class_ID = 'RCoo' }; - enum { - msg_ActiveSelectorChanged = 'selc' // broadcast when selector changes - }; - - // Set the current workspace to a particular kind of workspace - virtual void SelectView ( HT_ViewType inPane ) ; - - // register/unregister this NavCenter for SiteMap updates, etc - void RegisterNavCenter ( const MWContext* inContext ) const ; - void UnregisterNavCenter ( ) const ; - - // because sometimes you just need to get to the top-level HT pane.... - const HT_Pane HTPane ( ) const { return mHTPane.get(); } - HT_Pane HTPane ( ) { return mHTPane.get(); } - void HTPane ( auto_ptr<_HT_PaneStruct> inNewPane ) { mHTPane = inNewPane; } - - // get/set the frame to which urls are dispatched. It's ok not to set - // this as the default will be the top-most HTML view. - virtual void SetTargetFrame ( const char* inFrame ) ; - -protected: - enum { - kScrollerPaneID = 'HyTC' // pane id of the scroller containing tree/headers/etc - }; - - // handle showing/hiding column headers. Should be called after the HT_Pane has - // been created. - virtual void ShowOrHideColumnHeaders ( ) ; - virtual void ShowColumnHeaders ( ) ; - virtual void HideColumnHeaders ( ) ; - - // PowerPlant overrides - virtual void FinishCreateSelf(); - virtual Boolean ObeyCommand ( CommandT inCommand, void* ioParam ); - - // change the currently selected workspace - virtual void SelectView(HT_View view); - - virtual void ExpandNode(HT_Resource node); - virtual void CollapseNode(HT_Resource node); - - // messaging and notifications - virtual void HandleNotification( HT_Notification notifyStruct, HT_Resource node, HT_Event event, void *token, uint32 tokenType); - virtual void ListenToMessage( MessageT inMessage, void *ioParam); - - PaneIDT mTreePaneID; // hyperTree pane - PaneIDT mColumnHeaderID; // column header pane - PaneIDT mTitleStripID; // title strip pane - PaneIDT mTitleCommandID; // title command pane - - CHyperTreeFlexTable* mTreePane; - LPane* mColumnHeaders; - CNavCenterTitle* mTitleStrip; - CNavCenterCommandStrip* mTitleCommandArea; - -private: - - auto_ptr<_HT_PaneStruct> mHTPane; // the HT pane containing all the workspaces - - // pass-by-value not allowed for a coordinator because it corresponds 1-to-1 - // with an element in the UI. - CRDFCoordinator( const CRDFCoordinator& ); // DON'T IMPLEMENT - CRDFCoordinator& operator=( const CRDFCoordinator& ); // DON'T IMPLEMENT - -}; // CRDFCoordinator - - -#pragma mark class CDockedRDFCoordinator - - -// -// class CDockedRDFCoordinator -// -// Handles everything involved with having the tree docked in the browser window on the left, -// especially opening/closing the spring-open shelf. -// - -class CDockedRDFCoordinator : public CRDFCoordinator -{ -public: - enum { class_ID = 'RCoE', pane_ID = 'RCoE', adSpacePane_ID = 'spam', mainHTMLPane_ID = 'html' }; - enum { - msg_ShelfStateShouldChange = 'shlf' // broadcast when shelf should open/close - }; - - CDockedRDFCoordinator(LStream* inStream); - virtual ~CDockedRDFCoordinator(); - - // save/restore user preferences - virtual void SavePlace ( LStream* outStreamData ) ; - virtual void RestorePlace ( LStream* outStreamData ) ; - - // access to the shelf that comprised the NavCenter. This wrapper class - // allows you to easily slide in/out the shelf or check if it is open. - CShelf& NavCenterShelf() { return *mNavCenter; } ; - const CShelf& NavCenterShelf() const { return *mNavCenter; } ; - - // access to the shelf comprising the HTML ad space - CShelf& AdSpaceShelf() { return *mAdSpace; } ; - const CShelf& AdSpaceShelf() const { return *mAdSpace; } ; - - // create the pane with |inNode| as the root of the view an can be fed info from |inContext| - virtual void BuildHTPane ( HT_Resource inNode, MWContext* inContext ) ; - -protected: - - virtual void FinishCreateSelf ( ) ; - virtual void ListenToMessage( MessageT inMessage, void *ioParam); - -private: - - virtual void HandleNotification( HT_Notification notifyStruct, HT_Resource node, HT_Event event, void *token, uint32 tokenType); - - void SetAdSpaceToCorrectSize ( HT_View inView ) ; - void ShowAdSpace ( ) ; - - CShelf* mNavCenter; - CShelf* mAdSpace; - - CBrowserView* mAdSpaceView; - - // pass-by-value not allowed for a coordinator because it corresponds 1-to-1 - // with an element in the UI. - CDockedRDFCoordinator( const CDockedRDFCoordinator& ); // DON'T IMPLEMENT - CDockedRDFCoordinator& operator=( const CDockedRDFCoordinator& ); // DON'T IMPLEMENT - -}; // CDockedRDFCoordinator - - -#pragma mark class CShackRDFCoordinator - - -// -// class CShackRDFCoordinator -// -// Use this when the tree is to be embedded in the HTML content area (code name: Shack). -// Really the only difference here is that it creates its HT_Pane from a url provided in -// the HTML data. -// - -class CShackRDFCoordinator : public CRDFCoordinator -{ -public: - enum { class_ID = 'RCoS', pane_ID = 'RCoS' }; - enum { res_ID = 9503 } ; - - CShackRDFCoordinator(LStream* inStream); - virtual ~CShackRDFCoordinator(); - - void BuildHTPane ( const char* inURL, unsigned int inCount, - char** inParamNames, char** inParamValues ) ; - -private: - // pass-by-value not allowed for a coordinator because it corresponds 1-to-1 - // with an element in the UI. - CShackRDFCoordinator( const CShackRDFCoordinator& ); // DON'T IMPLEMENT - CShackRDFCoordinator& operator=( const CShackRDFCoordinator& ); // DON'T IMPLEMENT - -}; // CShackRDFCoordinator - - -#pragma mark class CWindowRDFCoordinator - - -// -// class CWindowRDFCoordinator -// -// Use this when the tree is in a standalone window. All this does differently than the -// default is create the HT_Pane w/out any special arguments. It's not really specific to -// being in a window, but until there are other things that init this way as well, the -// name is descriptive enough. -// - -class CWindowRDFCoordinator : public CRDFCoordinator -{ -public: - enum { class_ID = 'RCoW', pane_ID = 'RCoW' }; - - CWindowRDFCoordinator(LStream* inStream); - virtual ~CWindowRDFCoordinator(); - - void BuildHTPane ( HT_Resource inNode ) ; - void BuildHTPane ( RDF_Resource inNode ) ; - -protected: - - void FinishCreateSelf ( ) ; - -private: - // pass-by-value not allowed for a coordinator because it corresponds 1-to-1 - // with an element in the UI. - CWindowRDFCoordinator( const CWindowRDFCoordinator& ); // DON'T IMPLEMENT - CWindowRDFCoordinator& operator=( const CWindowRDFCoordinator& ); // DON'T IMPLEMENT - -}; // CWindowRDFCoordinator - - -#pragma mark class CWindowRDFCoordinator - - -// -// class CPopdownRDFCoordinator -// -// Use this when the tree is popped down from a container on the toolbars. This knows -// how to create itself from an HT_Resource. -// - -class CPopdownRDFCoordinator : public CRDFCoordinator -{ -public: - enum { class_ID = 'RCoP', pane_ID = 'RCoP' }; - enum { res_ID = 9504 } ; - enum { msg_ClosePopdownTree = 'clos' }; - - CPopdownRDFCoordinator(LStream* inStream); - virtual ~CPopdownRDFCoordinator(); - - // create the pane with |inNode| as the root of the view an can be fed info from |inContext| - virtual void BuildHTPane ( HT_Resource inNode, MWContext* inContext ) ; - -protected: - - virtual void DrawSelf(); - virtual void FinishCreateSelf(); - virtual void ListenToMessage( MessageT inMessage, void *ioParam); - virtual void FindCommandStatus( - CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - Char16 &outMark, - Str255 outName); - -private: - // pass-by-value not allowed for a coordinator because it corresponds 1-to-1 - // with an element in the UI. - CPopdownRDFCoordinator( const CPopdownRDFCoordinator& ); // DON'T IMPLEMENT - CPopdownRDFCoordinator& operator=( const CPopdownRDFCoordinator& ); // DON'T IMPLEMENT - -}; // CPopdownRDFCoordinator diff --git a/mozilla/cmd/macfe/rdfui/CRDFNotificationHandler.cp b/mozilla/cmd/macfe/rdfui/CRDFNotificationHandler.cp deleted file mode 100644 index 7d66f3c6cea..00000000000 --- a/mozilla/cmd/macfe/rdfui/CRDFNotificationHandler.cp +++ /dev/null @@ -1,82 +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. - */ - -#include "CRDFNotificationHandler.h" - -HT_Notification -CRDFNotificationHandler::CreateNotificationStruct() -{ - HT_Notification notifyStruct = new HT_NotificationStruct; - memset(notifyStruct, 0x00, sizeof(notifyStruct)); - - notifyStruct->notifyProc = CRDFNotificationHandler::rdfNotifyProc; - notifyStruct->data = (void *)this; - - return notifyStruct; -} - -auto_ptr<_HT_PaneStruct> -CRDFNotificationHandler::CreateHTPane() -{ - HT_Notification notifyStruct = CreateNotificationStruct(); - if (notifyStruct) - return auto_ptr<_HT_PaneStruct>(HT_NewPane(notifyStruct)); - else - return auto_ptr<_HT_PaneStruct>(); -} - -auto_ptr<_HT_PaneStruct> -CRDFNotificationHandler::CreateHTPane ( HT_Resource inResource ) -{ - return auto_ptr<_HT_PaneStruct>(CreateHTPane(HT_GetRDFResource(inResource))); -} - -auto_ptr<_HT_PaneStruct> -CRDFNotificationHandler::CreateHTPane ( RDF_Resource inResource ) -{ - HT_Notification notifyStruct = CreateNotificationStruct(); - if (notifyStruct) - return auto_ptr<_HT_PaneStruct>(HT_PaneFromResource(inResource, notifyStruct, false, true, true)); - else - return auto_ptr<_HT_PaneStruct>(); -} - -auto_ptr<_HT_PaneStruct> -CRDFNotificationHandler::CreateHTPane ( const char* inURL, unsigned int inCount, - char** inParamNames, char** inParamValues ) -{ - HT_Notification notifyStruct = CreateNotificationStruct(); - if (notifyStruct) - return auto_ptr<_HT_PaneStruct>(HT_PaneFromURL(NULL, const_cast(inURL), NULL, notifyStruct, false, inCount, - inParamNames, inParamValues)); - else - return auto_ptr<_HT_PaneStruct>(); -} - -void -CRDFNotificationHandler::rdfNotifyProc( - HT_Notification notifyStruct, - HT_Resource node, - HT_Event event, - void *token, - uint32 tokenType) -{ - CRDFNotificationHandler* handler = - reinterpret_cast(notifyStruct->data); - handler->HandleNotification(notifyStruct, node, event, token, tokenType); -} diff --git a/mozilla/cmd/macfe/rdfui/CRDFNotificationHandler.h b/mozilla/cmd/macfe/rdfui/CRDFNotificationHandler.h deleted file mode 100644 index 3b2afbf5022..00000000000 --- a/mozilla/cmd/macfe/rdfui/CRDFNotificationHandler.h +++ /dev/null @@ -1,57 +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. - */ - -// -// Mixin class that handles RDF notifcation handling -// -// How to use it: -// Mix this class into inheritance hierarchy and implement the HandleNotification() method. -// Then, when your class starts up, call CreateHTPane() to get a hold of the RDF "pane." -// - -#pragma once - -#include "htrdf.h" -#include "auto_HT_pane.h" - -class CRDFNotificationHandler -{ -protected: - - virtual auto_ptr<_HT_PaneStruct> CreateHTPane ( HT_Resource inResource ) ; - virtual auto_ptr<_HT_PaneStruct> CreateHTPane ( RDF_Resource inResource ) ; - virtual auto_ptr<_HT_PaneStruct> CreateHTPane ( const char* inURL, unsigned int inCount, - char** inParamNames, char** inParamValues ) ; - virtual auto_ptr<_HT_PaneStruct> CreateHTPane(); - - virtual HT_Notification CreateNotificationStruct(); - - virtual void HandleNotification( - HT_Notification notifyStruct, - HT_Resource node, - HT_Event event, - void *token, - uint32 tokenType) = 0; - - static void rdfNotifyProc( - HT_Notification notifyStruct, - HT_Resource node, - HT_Event event, - void *token, - uint32 tokenType); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/rdfui/URDFUtilities.cp b/mozilla/cmd/macfe/rdfui/URDFUtilities.cp deleted file mode 100644 index 68e919d2b74..00000000000 --- a/mozilla/cmd/macfe/rdfui/URDFUtilities.cp +++ /dev/null @@ -1,318 +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. - */ - -// -// Miscellaneous RDF utility methods -// - -#include "URDFUtilities.h" - -#include "xp_mem.h" -#include "xp_rgb.h" -#include "ufilemgr.h" // for CFileMgr::GetURLFromFileSpec -#include "uprefd.h" // for CPrefs::GetFolderSpec & globHistoryName -#include "PascalString.h" // for CStr255 -#include "macgui.h" - -#include "CBrowserWindow.h" -#include "CNSContext.h" - - -Boolean URDFUtilities::sIsInited = false; - - -// -// StartupRDF -// -// Initialize RDF if it has not already been initialized. This method can be -// called over and over again without bad side effects because it protects the init -// code with a static variable. -// -void URDFUtilities::StartupRDF() -{ - if (!sIsInited) - { - // Point RDF to user's "Navigator Ä" preference folder and turn the FSSpec into - // a URL - FSSpec prefFolder = CPrefs::GetFolderSpec(CPrefs::MainFolder); - char* url = CFileMgr::GetURLFromFileSpec(prefFolder); - CStr255 urlStr(url); - XP_FREE(url); - - // fill in RDF params structure with appropriate file paths - CStr255 str; - RDF_InitParamsStruct initParams; - initParams.profileURL = (char*)urlStr; - ::GetIndString(str, 300, bookmarkFile); - initParams.bookmarksURL = (char*)(urlStr + "/" + str); - ::GetIndString(str, 300, globHistoryName); - initParams.globalHistoryURL = (char*)(urlStr + "/" + str); - -// url = NET_UnEscape(url); - RDF_Init(&initParams); - sIsInited = true; - } -} - - -// -// ShutdownRDF -// -// Opposite of above routine. Again, can be called multiple times w/out bad side -// effects. -// -void URDFUtilities::ShutdownRDF() -{ - if (sIsInited) - { - RDF_Shutdown(); - sIsInited = false; - } -} - -Uint32 URDFUtilities::GetContainerSize(HT_Resource container) -{ - Uint32 result = 0; - // trust but verify... - if (HT_IsContainer(container)) - { - HT_Cursor cursor = HT_NewCursor(container); - if (cursor) - { - HT_Resource node = HT_GetNextItem(cursor); - while (node != NULL) - { - ++result; - if (HT_IsContainer(node) && HT_IsContainerOpen(node)) - result += GetContainerSize(node); - - node = HT_GetNextItem(cursor); - } - } - } - return result; -} - - -// -// SetupBackgroundColor -// -// Given a HT token for a particular color and an AppearanceManager theme brush, set the -// background color to the appropriate color (using HT color first, and AM color as a fallback). -// -bool -URDFUtilities :: SetupBackgroundColor ( HT_Resource inNode, void* inHTToken, ThemeBrush inBrush ) -{ - RGBColor theBackground; - bool usingHTColor = GetColor(inNode, inHTToken, &theBackground); - if ( usingHTColor ) - ::RGBBackColor ( &theBackground ); - else - ::SetThemeBackground ( inBrush, 8, false ); - - return usingHTColor; - -} // SetupBackgroundColor - - -// -// SetupForegroundColor -// -// Given a HT token for a particular color and an AppearanceManager theme brush, set the -// foreground color to the appropriate color (using HT color first, and AM color as a fallback). -// -bool -URDFUtilities :: SetupForegroundColor ( HT_Resource inNode, void* inHTToken, ThemeBrush inBrush ) -{ - RGBColor theForeground; - bool usingHTColor = GetColor(inNode, inHTToken, &theForeground); - if ( usingHTColor ) - ::RGBForeColor ( &theForeground ); - else - ::SetThemePen ( inBrush, 8, false ); - - return usingHTColor; - -} // SetupForegroundColor - - -// -// SetupForegroundTextColor -// -// Given a HT token for a particular color and an AppearanceManager theme brush, set the -// foreground color to the appropriate color (using HT color first, and AM color as a fallback). -// -bool -URDFUtilities :: SetupForegroundTextColor ( HT_Resource inNode, void* inHTToken, ThemeTextColor inBrush ) -{ - RGBColor theForeground; - bool usingHTColor = GetColor(inNode, inHTToken, &theForeground); - if ( usingHTColor ) - ::RGBForeColor ( &theForeground ); - else - ::SetThemeTextColor ( inBrush, 8, false ); - - return usingHTColor; - -} // SetupForegroundTextColor - - -// -// GetColor -// -// Given a node and a property (that should be a color name), returns if this node has -// that property set and if so, make an RGBColor out of it. |outColor| is not modified -// unless this function returns true. -// -bool -URDFUtilities :: GetColor ( HT_Resource inNode, void* inHTToken, RGBColor* outColor ) -{ - Assert_(inNode != NULL); - Assert_(inHTToken != NULL); - - bool usingHTColor = false; - - if ( inNode && inHTToken ) { - char* color = NULL; - PRBool success = HT_GetTemplateData ( inNode, inHTToken, HT_COLUMN_STRING, &color ); - if ( success && color ) { - uint8 red, green, blue; - if ( LO_ParseRGB(color, &red, &green, &blue) ) { - *outColor = UGraphics::MakeRGBColor(red, green, blue); - usingHTColor = true; - } - } - } - - return usingHTColor; - -} // GetColor - - -// -// PropertyValueBool -// -// Gets the value of the given token and determines if it is "[Y|y]es" or "[N|n]o" based -// on the first character. Returns the appropriate boolean value (yes = true). If the -// property is not specified (or not specified correctly) return the default value. -// -bool -URDFUtilities :: PropertyValueBool ( HT_Resource inNode, void* inHTToken, bool inDefaultValue ) -{ - bool retVal = inDefaultValue; - - if ( inNode && inHTToken ) { - char* value = NULL; - - PRBool success = HT_GetTemplateData ( inNode, inHTToken, HT_COLUMN_STRING, &value ); - if ( success && value ) { - switch ( *value ) { - case 'Y': case 'y': - retVal = true; - break; - case 'N': case 'n': - retVal = false; - } - } - } - - return retVal; - -} // PropertyValueBool - - -// -// LaunchNode -// LaunchURL -// -// Passes the node/url to HT which will try to handle loading it -// - -bool -URDFUtilities :: LaunchNode ( HT_Resource inNode ) -{ - MWContext* topContext = FindBrowserContext(); - return HT_Launch ( inNode, topContext ); - -} // LaunchNode - -bool -URDFUtilities :: LaunchURL ( const char* inURL, CBrowserWindow* inBrowser ) -{ - MWContext* currentContext = NULL; - HT_Pane paneToDisplayThings = NULL; - - // if no browser is passed in, try to find the topmost one - if ( !inBrowser ) { - CWindowMediator* theMediator = CWindowMediator::GetWindowMediator(); - inBrowser = dynamic_cast(theMediator->FetchTopWindow(WindowType_Browser, regularLayerType, false)); - } - - // Even though we looked, there may not be a browser open. If we have one, extract - // the relevants bits from it. - if ( inBrowser ) { - paneToDisplayThings = inBrowser->HTPane(); - currentContext = *(inBrowser->GetWindowContext()); - } - - return HT_LaunchURL ( paneToDisplayThings, const_cast(inURL), currentContext ) ; - -} // LaunchURL - - -// -// FindBrowserContext -// -// Tries to find a top-level context that is a browser window. If one cannot be found, -// returns NULL -// -MWContext* -URDFUtilities :: FindBrowserContext ( ) -{ - MWContext* currentContext = NULL; - CWindowMediator* theMediator = CWindowMediator::GetWindowMediator(); - CNetscapeWindow* theTopWindow = - dynamic_cast(theMediator->FetchTopWindow(WindowType_Browser, regularLayerType, false)); - if (theTopWindow) - return *(theTopWindow->GetWindowContext()); - - return NULL; - -} // FindBrowserContext - - -// -// StHTEventMasking -// -// Change HT's event masking in the given pane for the lifetime of this class. This is -// meant to be used as a stack-based class. The new notification mask is set in the contsructor -// and is reset to the original mask in the destructor. -// - -URDFUtilities::StHTEventMasking :: StHTEventMasking ( HT_Pane inPane, HT_NotificationMask inNewMask ) - : mPane(inPane) -{ - HT_GetNotificationMask ( mPane, &mOldMask ); - HT_SetNotificationMask ( mPane, inNewMask ); -} - - -URDFUtilities::StHTEventMasking :: ~StHTEventMasking ( ) -{ - HT_SetNotificationMask ( mPane, mOldMask ); -} diff --git a/mozilla/cmd/macfe/rdfui/URDFUtilities.h b/mozilla/cmd/macfe/rdfui/URDFUtilities.h deleted file mode 100644 index 286a256d14d..00000000000 --- a/mozilla/cmd/macfe/rdfui/URDFUtilities.h +++ /dev/null @@ -1,80 +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. - */ - -// Miscellaneous RDF utility methods - -#pragma once - -#include "rdf.h" -#include "htrdf.h" - -#include - -class CBrowserWindow; - - -class URDFUtilities -{ - public: - static void StartupRDF(); - static void ShutdownRDF(); - - static Uint32 GetContainerSize(HT_Resource container); - - // PowerPlant tables are "1-based" whereas the HT view is "0-based". Convert - // one index to the other... - static Uint32 PPRowToHTRow ( TableIndexT inPPRow ) - { return inPPRow - 1; } - static Uint32 HTRowToPPRow ( TableIndexT inHTRow ) - { return inHTRow + 1; } - - // set fg/bg/text fg colors based on the presence of assertions in HT for a node. Use - // AM color as a fallback if no color specified in HT. Returns true if the HT color - // is used. - static bool SetupBackgroundColor ( HT_Resource inNode, void* inHTToken, ThemeBrush inBrush ) ; - static bool SetupForegroundColor ( HT_Resource inNode, void* inHTToken, ThemeBrush inBrush ) ; - static bool SetupForegroundTextColor ( HT_Resource inNode, void* inHTToken, ThemeTextColor inBrush ) ; - static bool GetColor ( HT_Resource inNode, void* inHTToken, RGBColor * outColor ) ; - - // true if property is "yes", false if value is "no", and the default if the property is - // not (or incorrectly) specified - static bool PropertyValueBool ( HT_Resource inNode, void* inHTToken, bool inDefaultValue ); - - // call these before starting to load any URLs. HT may know how to handle them mo-better. - static bool LaunchNode ( HT_Resource inNode ) ; - static bool LaunchURL ( const char* inURL, CBrowserWindow* inBrowser = NULL ) ; - - // Change HT's event masking for the lifetime of this class - class StHTEventMasking - { - public: - StHTEventMasking ( HT_Pane inPane, HT_NotificationMask inNewMask ); - ~StHTEventMasking ( ) ; - - private: - HT_NotificationMask mOldMask; - HT_Pane mPane; - }; - - protected: - - static MWContext* FindBrowserContext ( ) ; - - static Boolean sIsInited; - -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/restext/8859_4.r b/mozilla/cmd/macfe/restext/8859_4.r deleted file mode 100644 index 398dff2978d..00000000000 --- a/mozilla/cmd/macfe/restext/8859_4.r +++ /dev/null @@ -1,182 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_CE_TO_8859_4, "MAC_CE -> 8859_4",purgeable){ -/* Translation CENTEURO.TXT -> 8859-4.TXT */ -/* 10 is unmap !!! */ -/* 8C is unmap !!! C */ -/* 8D is unmap !!! c */ -/* 8F is unmap !!! Z */ -/* 90 is unmap !!! z */ -/* 91 is unmap !!! D */ -/* 93 is unmap !!! d */ -/* 97 is unmap !!! o */ -/* 9D is unmap !!! E */ -/* 9E is unmap !!! e */ -/* A0 is unmap !!! + */ -/* A3 is unmap !!! */ -/* A5 is unmap !!! * */ -/* A6 is unmap !!! */ -/* A8 is unmap !!! (R)*/ -/* A9 is unmap !!! (C) */ -/* AA is unmap !!! [TM] */ -/* AD is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* B8 is unmap !!! l */ -/* BB is unmap !!! L */ -/* BC is unmap !!! l */ -/* BD is unmap !!! L */ -/* BE is unmap !!! l */ -/* C1 is unmap !!! N */ -/* C2 is unmap !!! ! */ -/* C3 is unmap !!! */ -/* C4 is unmap !!! n */ -/* C5 is unmap !!! N */ -/* C6 is unmap !!! ^ */ -/* C7 is unmap !!! < */ -/* C8 is unmap !!! > */ -/* C9 is unmap !!! . */ -/* CB is unmap !!! n */ -/* CC is unmap !!! O */ -/* CE is unmap !!! o */ -/* D0 is unmap !!! - */ -/* D1 is unmap !!! - */ -/* D2 is unmap !!! " */ -/* D3 is unmap !!! " */ -/* D4 is unmap !!! ` */ -/* D5 is unmap !!! ' */ -/* D7 is unmap !!! */ -/* D9 is unmap !!! R */ -/* DA is unmap !!! r */ -/* DB is unmap !!! R */ -/* DC is unmap !!! < */ -/* DD is unmap !!! > */ -/* DE is unmap !!! r */ -/* E2 is unmap !!! , */ -/* E3 is unmap !!! " */ -/* E5 is unmap !!! S */ -/* E6 is unmap !!! s */ -/* E8 is unmap !!! T */ -/* E9 is unmap !!! t */ -/* EE is unmap !!! O */ -/* F1 is unmap !!! U */ -/* F3 is unmap !!! u */ -/* F4 is unmap !!! U */ -/* F5 is unmap !!! u */ -/* F8 is unmap !!! Y */ -/* F9 is unmap !!! y */ -/* FB is unmap !!! Z */ -/* FC is unmap !!! L */ -/* FD is unmap !!! z */ -/* There are total 68 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C4C0 E0C9 A1D6 DCE1 B1C8 E4E8 4363 E95A" -/*9x*/ $"7A44 ED64 AABA CC6F ECF4 F6F5 FA45 65FC" -/*Ax*/ $"2BB0 CAA3 A72A A6DF 5243 AAEA A8AD BBC7" -/*Bx*/ $"E7CF B2B3 EFD3 B6B7 6CA6 B64C 6C4C 6CD1" -/*Cx*/ $"F14E 21C3 6E4E 5E3C 3E2E A06E 4FD5 6FD2" -/*Dx*/ $"2D2D 2223 6027 F7D7 F252 72DB 3C3E 72A3" -/*Ex*/ $"B3A9 2C22 B953 73C1 5474 CDAE BEDE 4FD4" -/*Fx*/ $"FE55 DA75 5575 D9F9 5979 F35A 4CFD 7AB7" -}; - -data 'xlat' ( xlat_8859_4_TO_MAC_CE, "8859_4 -> MAC_CE",purgeable){ -/* Translation 8859-4.TXT -> CENTEURO.TXT */ -/* 10 is unmap !!! */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 92 is unmap !!! */ -/* 93 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 96 is unmap !!! */ -/* 97 is unmap !!! */ -/* 98 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9B is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A2 is unmap !!! */ -/* A4 is unmap !!! */ -/* A5 is unmap !!! */ -/* AC is unmap !!! */ -/* AD is unmap !!! */ -/* AF is unmap !!! */ -/* B2 is unmap !!! */ -/* B4 is unmap !!! */ -/* B5 is unmap !!! */ -/* B8 is unmap !!! */ -/* BC is unmap !!! */ -/* BD is unmap !!! */ -/* BF is unmap !!! */ -/* C2 is unmap !!! */ -/* C3 is unmap !!! */ -/* C5 is unmap !!! */ -/* C6 is unmap !!! */ -/* CB is unmap !!! */ -/* CE is unmap !!! */ -/* D0 is unmap !!! */ -/* D7 is unmap !!! */ -/* D8 is unmap !!! */ -/* DB is unmap !!! */ -/* DD is unmap !!! */ -/* E2 is unmap !!! */ -/* E3 is unmap !!! */ -/* E5 is unmap !!! */ -/* E6 is unmap !!! */ -/* EB is unmap !!! */ -/* EE is unmap !!! */ -/* F0 is unmap !!! */ -/* F8 is unmap !!! */ -/* FB is unmap !!! */ -/* FD is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 68 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*9x*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" -/*Ax*/ $"CA84 A2DF A4A5 B9A4 ACE1 94FE ACAD EBAF" -/*Bx*/ $"A188 B2E0 B4B5 BAFF B8E4 95AE BCBD ECBF" -/*Cx*/ $"81E7 C2C3 80C5 C6AF 8983 A2CB 96EA CEB1" -/*Dx*/ $"D0BF CFB5 EFCD 85D7 D8F6 F2DB 86DD EDA7" -/*Ex*/ $"8287 E2E3 8AE5 E6B0 8B8E ABEB 9892 EEB4" -/*Fx*/ $"F0C0 D8FA 999B 9AD6 F8F7 9CFB 9FFD F0FF" -}; - diff --git a/mozilla/cmd/macfe/restext/8859_5.r b/mozilla/cmd/macfe/restext/8859_5.r deleted file mode 100644 index 4431da880d6..00000000000 --- a/mozilla/cmd/macfe/restext/8859_5.r +++ /dev/null @@ -1,112 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_CYRILLIC_TO_8859_5, "MAC_CYRILLIC -> 8859_5",purgeable){ -/* Translation MacOS_Cyrillic.txt -> 8859-5.txt */ -/* A0 is unmap !!! */ -/* A1 is unmap !!! */ -/* A2 is unmap !!! */ -/* A3 is unmap !!! */ -/* A5 is unmap !!! */ -/* A6 is unmap !!! */ -/* A8 is unmap !!! */ -/* A9 is unmap !!! */ -/* AA is unmap !!! */ -/* AD is unmap !!! */ -/* B0 is unmap !!! */ -/* B1 is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B5 is unmap !!! */ -/* B6 is unmap !!! */ -/* C2 is unmap !!! */ -/* C3 is unmap !!! */ -/* C4 is unmap !!! */ -/* C5 is unmap !!! */ -/* C6 is unmap !!! */ -/* C7 is unmap !!! */ -/* C8 is unmap !!! */ -/* C9 is unmap !!! */ -/* D0 is unmap !!! */ -/* D1 is unmap !!! */ -/* D2 is unmap !!! */ -/* D3 is unmap !!! */ -/* D4 is unmap !!! */ -/* D5 is unmap !!! */ -/* D6 is unmap !!! */ -/* D7 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 33 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"B0B1 B2B3 B4B5 B6B7 B8B9 BABB BCBD BEBF" -/*9x*/ $"C0C1 C2C3 C4C5 C6C7 C8C9 CACB CCCD CECF" -/*Ax*/ $"A0A1 A2A3 FDA5 A6A6 A8A9 AAA2 F2AD A3F3" -/*Bx*/ $"B0B1 B2B3 F6B5 B6A8 A4F4 A7F7 A9F9 AAFA" -/*Cx*/ $"F8A5 C2C3 C4C5 C6C7 C8C9 A0AB FBAC FCF5" -/*Dx*/ $"D0D1 D2D3 D4D5 D6D7 AEFE AFFF F0A1 F1EF" -/*Ex*/ $"D0D1 D2D3 D4D5 D6D7 D8D9 DADB DCDD DEDF" -/*Fx*/ $"E0E1 E2E3 E4E5 E6E7 E8E9 EAEB ECED EEFF" -}; - -data 'xlat' ( xlat_8859_5_TO_MAC_CYRILLIC, "8859_5 -> MAC_CYRILLIC",purgeable){ -/* Translation 8859-5.txt -> MacOS_Cyrillic.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 92 is unmap !!! */ -/* 93 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 96 is unmap !!! */ -/* 97 is unmap !!! */ -/* 98 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9B is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* AD is unmap !!! */ -/* There are total 33 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*9x*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" -/*Ax*/ $"CADD ABAE B8C1 A7BA B7BC BECB CDAD D8DA" -/*Bx*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*Cx*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" -/*Dx*/ $"E0E1 E2E3 E4E5 E6E7 E8E9 EAEB ECED EEEF" -/*Ex*/ $"F0F1 F2F3 F4F5 F6F7 F8F9 FAFB FCFD FEDF" -/*Fx*/ $"DCDE ACAF B9CF B4BB C0BD BFCC CEA4 D9DB" -}; - diff --git a/mozilla/cmd/macfe/restext/8859_7.r b/mozilla/cmd/macfe/restext/8859_7.r deleted file mode 100644 index 6599e13cc30..00000000000 --- a/mozilla/cmd/macfe/restext/8859_7.r +++ /dev/null @@ -1,212 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_GREEK_TO_8859_7, "MAC_GREEK -> 8859_7",purgeable){ -/* Translation MacOS_Greek.txt -> 8859-7.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 83 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 93 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 96 is unmap !!! */ -/* 98 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A0 is unmap !!! */ -/* A7 is unmap !!! */ -/* A8 is unmap !!! */ -/* AD is unmap !!! */ -/* AF is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B4 is unmap !!! */ -/* C5 is unmap !!! */ -/* C9 is unmap !!! */ -/* CF is unmap !!! */ -/* D0 is unmap !!! */ -/* D2 is unmap !!! */ -/* D3 is unmap !!! */ -/* D4 is unmap !!! */ -/* D5 is unmap !!! */ -/* D6 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 41 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 B283 B385 86B5 8889 8AB4 A88D 8E8F" -/*9x*/ $"9091 A393 9495 B7BD 9899 9AA6 AD9D 9E9F" -/*Ax*/ $"A0C3 C4C8 CBCE D0A7 A8A9 D3DA A7AD B0AF" -/*Bx*/ $"C1B1 B2B3 B4C2 C5C6 C7C9 CACC D6DB D8D9" -/*Cx*/ $"DCCD ACCF D1C5 D4AB BBC9 A0D5 D7B6 B8CF" -/*Dx*/ $"D0AF D2D3 A1A2 D6B9 BABC BEDD DEDF FCBF" -/*Ex*/ $"FDE1 E2F8 E4E5 F6E3 E7E9 EEEA EBEC EDEF" -/*Fx*/ $"F0FE F1F3 F4E8 F9F2 F7F5 E6FA FBC0 E0FF" -}; - -data 'xlat' ( xlat_8859_7_TO_MAC_GREEK, "8859_7 -> MAC_GREEK",purgeable){ -/* Translation 8859-7.txt -> MacOS_Greek.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 92 is unmap !!! */ -/* 93 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 96 is unmap !!! */ -/* 97 is unmap !!! */ -/* 98 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9B is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A1 is unmap !!! */ -/* A2 is unmap !!! */ -/* A4 is unmap !!! */ -/* A5 is unmap !!! */ -/* AA is unmap !!! */ -/* AE is unmap !!! */ -/* B7 is unmap !!! */ -/* D2 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 41 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*9x*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" -/*Ax*/ $"CAD4 D592 A4A5 9BAC 8CA9 AAC7 C29C AED1" -/*Bx*/ $"AEB1 8284 8B87 CD96 CED7 D8C8 D997 DADF" -/*Cx*/ $"FDB0 B5A1 A2B6 B7B8 A3B9 BAA4 BBC1 A5C3" -/*Dx*/ $"A6C4 D2AA C6CB BCCC BEBF ABBD C0DB DCDD" -/*Ex*/ $"FEE1 E2E7 E4E5 FAE8 F5E9 EBEC EDEE EAEF" -/*Fx*/ $"F0F2 F7F3 F4F9 E6F8 E3F6 FBFC DEE0 F1FF" -}; -data 'xlat' ( xlat_MAC_GREEK_TO_CP_1253, "MAC_GREEK -> CP_1253",purgeable){ -/* Translation ../fromftp/MacOS_Greek.txt -> ../fromftp/cp1253.x */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 83 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A7 is unmap !!! */ -/* AD is unmap !!! */ -/* AF is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* C5 is unmap !!! */ -/* CF is unmap !!! */ -/* D6 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 29 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 B283 B385 86A1 8889 8AB4 A88D 8E8F" -/*9x*/ $"9091 A399 9495 95BD 8999 9AA6 AD9D 9E9F" -/*Ax*/ $"86C3 C4C8 CBCE D0A7 AEA9 D3DA A7AD B0AF" -/*Bx*/ $"C1B1 B2B3 A5C2 C5C6 C7C9 CACC D6DB D8D9" -/*Cx*/ $"DCCD ACCF D1C5 D4AB BB85 A0D5 D7A2 B8CF" -/*Dx*/ $"96AF 9394 9192 D6B9 BABC BEDD DEDF FCBF" -/*Ex*/ $"FDE1 E2F8 E4E5 F6E3 E7E9 EEEA EBEC EDEF" -/*Fx*/ $"F0FE F1F3 F4E8 F9F2 F7F5 E6FA FBC0 E0FF" -}; - -data 'xlat' ( xlat_CP_1253_TO_MAC_GREEK, "CP_1253 -> MAC_GREEK",purgeable){ -/* Translation ../fromftp/cp1253.x -> ../fromftp/MacOS_Greek.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 97 is unmap !!! */ -/* 98 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9B is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A4 is unmap !!! */ -/* AA is unmap !!! */ -/* B5 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* D2 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 29 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 84C9 A087 8898 8A8B 8C8D 8E8F" -/*9x*/ $"90D4 D5D2 D396 D0D1 9893 9A9B 9C9D 9E9F" -/*Ax*/ $"CA87 CD92 A4B4 9BAC 8CA9 AAC7 C29C A8D1" -/*Bx*/ $"AEB1 8284 8BB5 B696 CED7 D8C8 D997 DADF" -/*Cx*/ $"FDB0 B5A1 A2B6 B7B8 A3B9 BAA4 BBC1 A5C3" -/*Dx*/ $"A6C4 D2AA C6CB BCCC BEBF ABBD C0DB DCDD" -/*Ex*/ $"FEE1 E2E7 E4E5 FAE8 F5E9 EBEC EDEE EAEF" -/*Fx*/ $"F0F2 F7F3 F4F9 E6F8 E3F6 FBFC DEE0 F1FF" -}; diff --git a/mozilla/cmd/macfe/restext/8859_9.r b/mozilla/cmd/macfe/restext/8859_9.r deleted file mode 100644 index 5e2d074f11f..00000000000 --- a/mozilla/cmd/macfe/restext/8859_9.r +++ /dev/null @@ -1,130 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_TURKISH_TO_8859_9, "MAC_TURKISH -> 8859_9",purgeable){ -/* Translation MacOS_Turkish.txt -> 8859-9.txt */ -/* A0 is unmap !!! */ -/* A5 is unmap !!! */ -/* AA is unmap !!! */ -/* AD is unmap !!! */ -/* B0 is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* B8 is unmap !!! */ -/* B9 is unmap !!! */ -/* BA is unmap !!! */ -/* BD is unmap !!! */ -/* C3 is unmap !!! */ -/* C4 is unmap !!! */ -/* C5 is unmap !!! */ -/* C6 is unmap !!! */ -/* C9 is unmap !!! */ -/* CE is unmap !!! */ -/* CF is unmap !!! */ -/* D0 is unmap !!! */ -/* D1 is unmap !!! */ -/* D2 is unmap !!! */ -/* D3 is unmap !!! */ -/* D4 is unmap !!! */ -/* D5 is unmap !!! */ -/* D7 is unmap !!! */ -/* D9 is unmap !!! */ -/* E0 is unmap !!! */ -/* E2 is unmap !!! */ -/* E3 is unmap !!! */ -/* E4 is unmap !!! */ -/* F0 is unmap !!! */ -/* F5 is unmap !!! */ -/* F6 is unmap !!! */ -/* F7 is unmap !!! */ -/* F9 is unmap !!! */ -/* FA is unmap !!! */ -/* FB is unmap !!! */ -/* FD is unmap !!! */ -/* FE is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 42 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C4C5 C7C9 D1D6 DCE1 E0E2 E4E3 E5E7 E9E8" -/*9x*/ $"EAEB EDEC EEEF F1F3 F2F4 F6F5 FAF9 FBFC" -/*Ax*/ $"A0B0 A2A3 A7A5 B6DF AEA9 AAB4 A8AD C6D8" -/*Bx*/ $"B0B1 B2B3 A5B5 B6B7 B8B9 BAAA BABD E6F8" -/*Cx*/ $"BFA1 ACC3 C4C5 C6AB BBC9 A0C0 C3D5 CECF" -/*Dx*/ $"D0D1 D2D3 D4D5 F7D7 FFD9 D0F0 DDFD DEFE" -/*Ex*/ $"E0B7 E2E3 E4C2 CAC1 CBC8 CDCE CFCC D3D4" -/*Fx*/ $"F0D2 DADB D9F5 F6F7 AFF9 FAFB B8FD FEFF" -}; - -data 'xlat' ( xlat_8859_9_TO_MAC_TURKISH, "8859_9 -> MAC_TURKISH",purgeable){ -/* Translation 8859-9.txt -> MacOS_Turkish.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 92 is unmap !!! */ -/* 93 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 96 is unmap !!! */ -/* 97 is unmap !!! */ -/* 98 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9B is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A4 is unmap !!! */ -/* A6 is unmap !!! */ -/* AD is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B9 is unmap !!! */ -/* BC is unmap !!! */ -/* BD is unmap !!! */ -/* BE is unmap !!! */ -/* D7 is unmap !!! */ -/* There are total 42 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*9x*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" -/*Ax*/ $"CAC1 A2A3 A4B4 A6A4 ACA9 BBC7 C2AD A8F8" -/*Bx*/ $"A1B1 B2B3 ABB5 A6E1 FCB9 BCC8 BCBD BEC0" -/*Cx*/ $"CBE7 E5CC 8081 AE82 E983 E6E8 EDEA EBEC" -/*Dx*/ $"DA84 F1EE EFCD 85D7 AFF4 F2F3 86DC DEA7" -/*Ex*/ $"8887 898B 8A8C BE8D 8F8E 9091 9392 9495" -/*Fx*/ $"DB96 9897 999B 9AD6 BF9D 9C9E 9FDD DFD8" -}; - diff --git a/mozilla/cmd/macfe/restext/MacSTR.r b/mozilla/cmd/macfe/restext/MacSTR.r deleted file mode 100644 index 54ce7e30cdf..00000000000 --- a/mozilla/cmd/macfe/restext/MacSTR.r +++ /dev/null @@ -1,1312 +0,0 @@ - /* - * 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 "Types.r" -#include "resgui.h" // main window constants - -include "::rsrc:communicator:Communicator.rsrc"; - -#define USE_RESOURCE_NAMES 0 - - // central/mailmac.cp user messages - resource 'STR ' ( MAIL_WIN_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Create mail window error" -#else - "" -#endif - , purgeable ) { - "Unexpected error while creating Message window" - }; - resource 'STR ' ( MAIL_TOO_LONG_RESID + 0, -#if USE_RESOURCE_NAMES - "Mail text too long" -#else - "" -#endif - , purgeable ) { - "Included text is too long.\rIt has been truncated." - }; - resource 'STR ' ( MAIL_TMP_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Mail tmp file error" -#else - "" -#endif - , purgeable ) { - "Could not create a temporary mail file" - }; - resource 'STR ' ( NO_EMAIL_ADDR_RESID + 0, -#if USE_RESOURCE_NAMES - "No email address1" -#else - "" -#endif - , purgeable ) { - "You have not set your email address in \"Preferences\"." - }; - resource 'STR ' ( NO_EMAIL_ADDR_RESID + 1, -#if USE_RESOURCE_NAMES - "No email address2" -#else - "" -#endif - , purgeable ) { - " The recipient of your message will not be able to reply" - }; - resource 'STR ' ( NO_EMAIL_ADDR_RESID + 2, -#if USE_RESOURCE_NAMES - "No email address3" -#else - "" -#endif - , purgeable ) { - " to your mail without it. Please do so before mailing." - }; - resource 'STR ' ( NO_SRVR_ADDR_RESID + 0, -#if USE_RESOURCE_NAMES - "Create Mail Tmp File1" -#else - "" -#endif - , purgeable ) { - "You have not set mail server address in \"Preferences\"." - }; - resource 'STR ' ( NO_SRVR_ADDR_RESID + 1, -#if USE_RESOURCE_NAMES - "Create Mail Tmp File2" -#else - "" -#endif - , purgeable ) { - " You cannot send mail without it.\n" - }; - resource 'STR ' ( NO_SRVR_ADDR_RESID + 2, -#if USE_RESOURCE_NAMES - "Create Mail Tmp File3" -#else - "" -#endif - , purgeable ) { - " Please set it before mailing." - }; - resource 'STR ' ( MAIL_SUCCESS_RESID + 0, -#if USE_RESOURCE_NAMES - "Mail succeeded" -#else - "" -#endif - , purgeable ) { - "Mail was successful" - }; - resource 'STR ' ( MAIL_NOT_SENT_RESID + 0, -#if USE_RESOURCE_NAMES - "Mail not sent" -#else - "" -#endif - , purgeable ) { - "Mail was not sent" - }; - resource 'STR ' ( MAIL_SENDING_RESID + 0, -#if USE_RESOURCE_NAMES - "Mail sending" -#else - "" -#endif - , purgeable ) { - "Sending mailÉ" - }; - resource 'STR ' ( NEWS_POST_RESID + 0, -#if USE_RESOURCE_NAMES - "News post" -#else - "" -#endif - , purgeable ) { - "newspost:" - }; - resource 'STR ' ( MAIL_SEND_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Sending mail error" -#else - "" -#endif - , purgeable ) { - "Unexpected error while sending mail" - }; - resource 'STR ' ( MAIL_DELIVERY_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Mail delivery error" -#else - "" -#endif - , purgeable ) { - "Mail delivery failed" - }; - resource 'STR ' ( DISCARD_MAIL_RESID + 0, -#if USE_RESOURCE_NAMES - "Discard mail?" -#else - "" -#endif - , purgeable ) { - "Mail has not been sent yet.\rAre you sure that you want to discard your mail message?" - }; - resource 'STR ' ( SECURITY_LEVEL_RESID + 0, -#if USE_RESOURCE_NAMES - "Security level" -#else - "" -#endif - , purgeable ) { - "This version supports %s security with %s." - }; - resource 'STR ' ( NO_MEM_LOAD_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "No memory on load" -#else - "" -#endif - , purgeable ) { - "Load has been interrupted because "PROGRAM_NAME" has run out of memory. You might want to increase its memory partition, or quit other applications to alleviate this problem." - }; - resource 'STR ' ( EXT_PROGRESS_RESID + 0, -#if USE_RESOURCE_NAMES - "Progress via ext app" -#else - "" -#endif - , purgeable ) { - "Progress displayed in external application" - }; - resource 'STR ' ( REVERT_PROGRESS_RESID + 0, -#if USE_RESOURCE_NAMES - "Revert progress to "PROGRAM_NAME -#else - "" -#endif - , purgeable ) { - "Reverting progress to "PROGRAM_NAME - }; - resource 'STR ' ( START_LOAD_RESID + 0, -#if USE_RESOURCE_NAMES - "Start load" -#else - "" -#endif - , purgeable ) { - "Start loading" - }; - resource 'STR ' ( NO_XACTION_RESID + 0, -#if USE_RESOURCE_NAMES - "No transaction ID" -#else - "" -#endif - , purgeable ) { - "Did not get the transaction ID: " - }; - resource 'STR ' ( LAUNCH_TELNET_RESID + 0, -#if USE_RESOURCE_NAMES - "Launch telnet" -#else - "" -#endif - , purgeable ) { - "Launching Telnet application" - }; - resource 'STR ' ( LAUNCH_TN3720_RESID + 0, -#if USE_RESOURCE_NAMES - "Launch TN3720" -#else - "" -#endif - , purgeable ) { - "Launching TN3270 application" - }; - resource 'STR ' ( TELNET_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Telnet launch error" -#else - "" -#endif - , purgeable ) { - "Telnet launch failed" - }; - resource 'STR ' ( SAVE_AS_RESID + 0, -#if USE_RESOURCE_NAMES - "Save as" -#else - "" -#endif - , purgeable ) { - "Save this document as:" - }; - resource 'STR ' ( NETSITE_RESID + 0, -#if USE_RESOURCE_NAMES - "Netsite:" -#else - "" -#endif - , purgeable ) { - "Netsite:" - }; - resource 'STR ' ( LOCATION_RESID + 0, -#if USE_RESOURCE_NAMES - "Location:" -#else - "" -#endif - , purgeable ) { - "Location:" - }; - resource 'STR ' ( GOTO_RESID + 0, -#if USE_RESOURCE_NAMES - "Go To:" -#else - "" -#endif - , purgeable ) { - "Go To:" - }; - resource 'STR ' ( DOCUMENT_DONE_RESID + 0, -#if USE_RESOURCE_NAMES - "Document done" -#else - "" -#endif - , purgeable ) { - "Document: Done." - }; - resource 'STR ' ( LAYOUT_COMPLETE_RESID + 0, -#if USE_RESOURCE_NAMES - "Layout complete" -#else - "" -#endif - , purgeable ) { - "Layout: Complete." - }; - resource 'STR ' ( CONFORM_ABORT_RESID + 0, -#if USE_RESOURCE_NAMES - "Confirm abort" -#else - "" -#endif - , purgeable ) { - "Are you sure that you want to abort the current download?" - }; - resource 'STR ' ( SUBMIT_FORM_RESID + 0, -#if USE_RESOURCE_NAMES - "Submit form" -#else - "" -#endif - , purgeable ) { - "Submit form:%d,%d" - }; - resource 'STR ' ( SAVE_IMAGE_RESID + 0, -#if USE_RESOURCE_NAMES - "Save image as" -#else - "" -#endif - , purgeable ) { - "Save Image as:" - }; - resource 'STR ' ( SAVE_QUOTE_RESID + 0, -#if USE_RESOURCE_NAMES - "SaveÉ" -#else - "" -#endif - , purgeable ) { - "Save Ò" - }; - resource 'STR ' ( WILL_OPEN_WITH_RESID + 0, -#if USE_RESOURCE_NAMES - "Will open withÉ" -#else - "" -#endif - , purgeable ) { - "Will open with Ò" - }; - resource 'STR ' ( WILL_OPEN_TERM_RESID + 0, -#if USE_RESOURCE_NAMES - "Will open terminator" -#else - "" -#endif - , purgeable ) { - "Ó." - }; - resource 'STR ' ( SAVE_AS_A_RESID + 0, -#if USE_RESOURCE_NAMES - "Save as aÉ" -#else - "" -#endif - , purgeable ) { - "Saving as a Ò" - }; - resource 'STR ' ( FILE_RESID + 0, -#if USE_RESOURCE_NAMES - "file" -#else - "" -#endif - , purgeable ) { - "Ó file." - }; - resource 'STR ' ( COULD_NOT_SAVE_RESID + 0, -#if USE_RESOURCE_NAMES - "Could not save" -#else - "" -#endif - , purgeable ) { - "Could not save " - }; - resource 'STR ' ( DISK_FULL_RESID + 0, -#if USE_RESOURCE_NAMES - "Disk full" -#else - "" -#endif - , purgeable ) { - " because the disk is full." - }; - resource 'STR ' ( DISK_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Disk error" -#else - "" -#endif - , purgeable ) { - " because of a disk error." - }; - resource 'STR ' ( BOOKMARKS_RESID + 0, -#if USE_RESOURCE_NAMES - "Bookmarks" -#else - "" -#endif - , purgeable ) { - "Bookmarks" - }; - resource 'STR ' ( NOT_VISITED_RESID + 0, -#if USE_RESOURCE_NAMES - "Not visited" -#else - "" -#endif - , purgeable ) { - "Not visited" - }; - resource 'STR ' ( NO_FORM2HOTLIST_RESID + 0, -#if USE_RESOURCE_NAMES - "No add form to hotlist" -#else - "" -#endif - , purgeable ) { - "Cannot add the result of a form submission to the hotlist" - }; - resource 'STR ' ( NEW_ITEM_RESID + 0, -#if USE_RESOURCE_NAMES - "New item" -#else - "" -#endif - , purgeable ) { - "New Item" - }; - resource 'STR ' ( NEW_HEADER_RESID + 0, -#if USE_RESOURCE_NAMES - "New Folder" -#else - "" -#endif - , purgeable ) { - "New Folder" - }; - resource 'STR ' ( CONFIRM_RM_HDR_RESID + 0, -#if USE_RESOURCE_NAMES - "Confirm Remove Folder" -#else - "" -#endif - , purgeable ) { - "Are you sure that you want to remove the folder \"" - }; - resource 'STR ' ( AND_ITEMS_RESID + 0, -#if USE_RESOURCE_NAMES - "Add items" -#else - "" -#endif - , purgeable ) { - "\" and its items?" - }; - resource 'STR ' ( SAVE_BKMKS_AS_RESID + 0, -#if USE_RESOURCE_NAMES - "Save bookmark as" -#else - "" -#endif - , purgeable ) { - "Save bookmarks as:" - }; - resource 'STR ' ( END_LIST_RESID + 0, -#if USE_RESOURCE_NAMES - "End of list" -#else - "" -#endif - , purgeable ) { - "End of List" - }; - resource 'STR ' ( ENTIRE_LIST_RESID + 0, -#if USE_RESOURCE_NAMES - "Entire list" -#else - "" -#endif - , purgeable ) { - "Entire List" - }; - resource 'STR ' ( NEW_RESID + 0, -#if USE_RESOURCE_NAMES - "new" -#else - "" -#endif - , purgeable ) { - "new" - }; - resource 'STR ' ( OTHER_RESID + 0, -#if USE_RESOURCE_NAMES - "Other" -#else - "" -#endif - , purgeable ) { - "Other" - }; - resource 'STR ' ( MEM_AVAIL_RESID + 0, -#if USE_RESOURCE_NAMES - "Memory available" -#else - "" -#endif - , purgeable ) { - "M available" - }; - resource 'STR ' ( SAVE_RESID + 0, -#if USE_RESOURCE_NAMES - "Save" -#else - "" -#endif - , purgeable ) { - "Save to disk" - }; - resource 'STR ' ( LAUNCH_RESID + 0, -#if USE_RESOURCE_NAMES - "Launch" -#else - "" -#endif - , purgeable ) { - "Launch" - }; - resource 'STR ' ( INTERNAL_RESID + 0, -#if USE_RESOURCE_NAMES - "Internal" -#else - "" -#endif - , purgeable ) { - PROGRAM_NAME" (internal)" - }; - resource 'STR ' ( UNKNOWN_RESID + 0, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Unknown: Prompt user" - }; - resource 'STR ' ( MEGA_RESID + 0, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "M" - }; - resource 'STR ' ( KILO_RESID + 0, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "K" - }; - - resource 'STR ' ( PICK_COLOR_RESID + 0, -#if USE_RESOURCE_NAMES - "Pick color" -#else - "" -#endif - , purgeable ) { - "Pick a color" - }; - resource 'STR ' ( BAD_APP_LOCATION_RESID + 0, -#if USE_RESOURCE_NAMES - "Bad app location" -#else - "" -#endif - , purgeable ) { - "Finder desktop database reported improper location of the application \"", - }; - resource 'STR ' ( REBUILD_DESKTOP_RESID + 0, -#if USE_RESOURCE_NAMES - "Rebuild desktop" -#else - "" -#endif - , purgeable ) { - "\" to "PROGRAM_NAME". Next time you start up, please rebuild your desktop." - }; - resource 'STR ' ( UNTITLED_RESID + 0, -#if USE_RESOURCE_NAMES - "Untitled" -#else - "" -#endif - , purgeable ) { - "(untitled)" - }; - resource 'STR ' ( REG_EVENT_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Reg. Event Handling Err" -#else - "" -#endif - , purgeable ) { - "Error in handling RegisterEvent" - }; - resource 'STR ' ( APP_NOT_REG_RESID + 0, -#if USE_RESOURCE_NAMES - "App not registered" -#else - "" -#endif - , purgeable ) { - "This app was not registered" - }; - resource 'STR ' ( UNREG_EVENT_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "Unreg. Event Handling Err" -#else - "" -#endif - , purgeable ) { - "Error in handling UnregisterEvent" - }; - resource 'STR ' ( BOOKMARK_HTML_RESID + 0, -#if USE_RESOURCE_NAMES - "Bookmarks HTML" -#else - "" -#endif - , purgeable ) { - "MCOM-bookmarks.html" - }; - resource 'STR ' ( NO_DISKCACHE_DIR_RESID + 0, -#if USE_RESOURCE_NAMES - "No disk cache folder" -#else - "" -#endif - , purgeable ) { - "Preset disk cache folder could not be found.\r Default folder in Preferences will be used." - }; - resource 'STR ' ( NO_SIGFILE_RESID + 0, -#if USE_RESOURCE_NAMES - "No signature file" -#else - "" -#endif - , purgeable ) { - "The signature file specified in your preferences could not be found." - }; - resource 'STR ' ( NO_BACKDROP_RESID + 0, -#if USE_RESOURCE_NAMES - "No backdrop for prefs" -#else - "" -#endif - , purgeable ) { - "The backdrop file specified in your preferences could not be found." - }; - resource 'STR ' ( SELECT_RESID + 0, -#if USE_RESOURCE_NAMES - "Select" -#else - "" -#endif - , purgeable ) { - "Select " - }; - resource 'STR ' ( AE_ERR_RESID + 0, -#if USE_RESOURCE_NAMES - "AE error reply" -#else - "" -#endif - , purgeable ) { - PROGRAM_NAME" received AppleEvent error reply: " - }; - resource 'STR ' ( CHARSET_RESID, -#if USE_RESOURCE_NAMES - "Message Charset" -#else - "" -#endif - , purgeable ) { - "x-mac-roman" - }; - resource 'STR ' ( BROWSE_RESID, -#if USE_RESOURCE_NAMES - "Browse" -#else - "" -#endif - , purgeable ) { - "ChooseÉ" - }; - - resource 'STR ' ( ENCODING_CAPTION_RESID, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Encoding For " - }; - - resource 'STR ' ( NO_TWO_NETSCAPES_RESID, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "You cannot run two versions of "PROGRAM_NAME" at once. " - "This copy will quit now." - }; - -resource 'STR ' ( PG_NUM_FORM_RESID, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Page: %d" -}; - -resource 'STR ' ( REPLY_FORM_RESID, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Re: %s" -}; - -resource 'STR ' ( MENU_SEND_NOW, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Send Mail Now" -}; - -resource 'STR ' ( QUERY_SEND_OUTBOX, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Your Outbox folder contains %d unsent messages. Send them now ?" -}; - -resource 'STR ' ( QUERY_SEND_OUTBOX_SINGLE, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Your Outbox folder contains an unsent message. Send it now ?" -}; - -resource 'STR ' ( MENU_SEND_LATER, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Send Mail Later" -}; - -resource 'STR ' ( MENU_SAVE_AS, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Save asÉ" -}; -resource 'STR ' ( MENU_SAVE_FRAME_AS, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Save Frame asÉ" -}; -resource 'STR ' ( MENU_PRINT, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "PrintÉ" -}; -resource 'STR ' ( MENU_PRINT_FRAME, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Print FrameÉ" -}; -resource 'STR ' ( MENU_RELOAD, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Reload" -}; -resource 'STR ' ( MENU_SUPER_RELOAD, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Super Reload" -}; -resource 'STR ' ( MAC_PROGRESS_NET, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Initializing networkÉ" -}; -resource 'STR ' ( MAC_PROGRESS_PREFS, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Reading PreferencesÉ" -}; -resource 'STR ' ( MAC_PROGRESS_BOOKMARK, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Reading BookmarksÉ" -}; -resource 'STR ' ( MAC_PROGRESS_ADDRESS, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Reading Address BookÉ" -}; -resource 'STR ' ( MAC_PROGRESS_JAVAINIT, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Initializing JavaÉ" -}; -resource 'STR ' ( MAC_UPLOAD_TO_FTP, -#if USE_RESOURCE_NAMES - "MAC_UPLOAD_TO_FTP" -#else - "" -#endif - , purgeable ) { - "Are you sure that you want to upload the dragged files to the FTP server?" -}; /* JJE */ -resource 'STR ' ( POP_USERNAME_ONLY, -#if USE_RESOURCE_NAMES - "POP_USERNAME_ONLY" -#else - "" -#endif - , purgeable ) { - "Your POP User Name is just your user name (e.g. user), not your full POP address (e.g. user@internet.com)." -}; /* JJE */ -resource 'STR ' ( MAC_PLUGIN, -#if USE_RESOURCE_NAMES - "MAC_PLUGIN" -#else - "" -#endif - , purgeable ) { - "Plug-in:" -}; /* JJE */ -resource 'STR ' ( MAC_NO_PLUGIN, -#if USE_RESOURCE_NAMES - "MAC_NO_PLUGIN" -#else - "" -#endif - , purgeable ) { - "No plug-ins" -}; /* JJE */ -resource 'STR ' ( MAC_REGISTER_PLUGINS, -#if USE_RESOURCE_NAMES - "MAC_REGISTER_PLUGINS" -#else - "" -#endif - , purgeable ) { - "Registering plug-ins" -}; /* JJE */ -resource 'STR ' ( DOWNLD_CONT_IN_NEW_WIND, -#if USE_RESOURCE_NAMES - "DOWNLD_CONT_IN_NEW_WIND" -#else - "" -#endif - , purgeable ) { - "Download continued in a new window." -}; /* JJE */ -resource 'STR ' ( ATTACH_NEWS_MESSAGE, -#if USE_RESOURCE_NAMES - "ATTACH_NEWS_MESSAGE" -#else - "" -#endif - , purgeable ) { - "News message" -}; /* JJE */ -resource 'STR ' ( ATTACH_MAIL_MESSAGE, -#if USE_RESOURCE_NAMES - "ATTACH_MAIL_MESSAGE" -#else - "" -#endif - , purgeable ) { - "Mail message" -}; /* JJE */ -resource 'STR ' ( MBOOK_NEW_ENTRY, -#if USE_RESOURCE_NAMES - "MBOOK_NEW_ENTRY" -#else - "" -#endif - , purgeable ) { - "New entry" -}; /* JJE */ -resource 'STR ' ( MCLICK_BACK_IN_FRAME, -#if USE_RESOURCE_NAMES - "MCLICK_BACK_IN_FRAME" -#else - "" -#endif - , purgeable ) { - "Back in Frame" -}; /* JJE */ -resource 'STR ' ( MCLICK_BACK, -#if USE_RESOURCE_NAMES - "MCLICK_BACK" -#else - "" -#endif - , purgeable ) { - "Back" -}; /* JJE */ -resource 'STR ' ( MCLICK_FWRD_IN_FRAME, -#if USE_RESOURCE_NAMES - "MCLICK_FWRD_IN_FRAME" -#else - "" -#endif - , purgeable ) { - "Forward in Frame" -}; /* JJE */ -resource 'STR ' ( MCLICK_FORWARD, -#if USE_RESOURCE_NAMES - "MCLICK_FORWARD" -#else - "" -#endif - , purgeable ) { - "Forward" -}; /* JJE */ -resource 'STR ' ( MCLICK_SAVE_IMG_AS, -#if USE_RESOURCE_NAMES - "MCLICK_SAVE_IMG_AS" -#else - "" -#endif - , purgeable ) { - "Save Image as:" -}; /* JJE */ -resource 'STR ' ( SUBMIT_FILE_WITH_DATA_FK, -#if USE_RESOURCE_NAMES - "SUBMIT_FILE_WITH_DATA_FK" -#else - "" -#endif - , purgeable ) { - "You can only submit a file that has a data fork." -}; /* JJE */ -resource 'STR ' ( ABORT_CURR_DOWNLOAD, -#if USE_RESOURCE_NAMES - "ABORT_CURR_DOWNLOAD" -#else - "" -#endif - , purgeable ) { - "Are you sure that you want to abort the current download?" -}; /* JJE */ -resource 'STR ' ( MACDLG_SAVE_AS, -#if USE_RESOURCE_NAMES - "MACDLG_SAVE_AS" -#else - "" -#endif - , purgeable ) { - "Save as: " -}; /* JJE */ -resource 'STR ' ( THE_ERROR_WAS, -#if USE_RESOURCE_NAMES - "THE_ERROR_WAS" -#else - "" -#endif - , purgeable ) { - "The error was: " -}; /* JJE */ -resource 'STR ' ( MBOOK_NEW_BOOKMARK, -#if USE_RESOURCE_NAMES - "MBOOK_NEW_BOOKMARK" -#else - "" -#endif - , purgeable ) { - "New Bookmark" -}; /* JJE */ - -resource 'STR ' ( MENU_MAIL_DOCUMENT, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Mail DocumentÉ" -}; - -resource 'STR ' ( MENU_MAIL_FRAME, -#if USE_RESOURCE_NAMES - "" -#else - "" -#endif - , purgeable ) { - "Mail FrameÉ" -}; - -/* Bookmark Seperate string, For Japanese, please change to something like ---- */ -resource 'STR ' ( MBOOK_SEPARATOR_STR, -#if USE_RESOURCE_NAMES - "MBOOK_SEPARATOR_STR" -#else - "" -#endif - , purgeable ) { - "ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ" -}; - -resource 'STR ' ( RECIPIENT, "", purgeable ) { - "Recipient" -}; - -resource 'STR ' ( DELETE_MIMETYPE, "", purgeable ) { - "Are you sure you want to delete this type? "PROGRAM_NAME" will not be able to display information of this type if you proceed." -}; - -/* mail attachments are given a content-description string, - like "Microsoft Word Document". This suffix comes after - the application name */ - -resource 'STR ' ( DOCUMENT_SUFFIX, "", purgeable ) { - "Document" -}; - -resource 'STR ' ( PASSWORD_CHANGE_STRING, "", purgeable ) { - "Change Password" -}; - -resource 'STR ' ( PASSWORD_SET_STRING, "", purgeable ) { - "Set Password" -}; - -resource 'STR ' ( IMAGE_SUBMIT_FORM, "", purgeable ) { - "Submit form:%d,%d" -}; - -resource 'STR ' ( OTHER_FONT_SIZE, "Other Font Size", purgeable ) { - "Other (^0)É" -}; - -resource 'STR ' ( FILE_NAME_NONE, "File Name None", purgeable ) { - "" -}; - -resource 'STR ' ( MENU_BACK, "Back", purgeable ) { - "Back" -}; - -resource 'STR ' ( MENU_BACK_ONE_HOST, "Back One Site", purgeable ) { - "Back One Site" -}; - -resource 'STR ' ( MENU_FORWARD, "Forward", purgeable ) { - "Forward" -}; - -resource 'STR ' ( MENU_FORWARD_ONE_HOST, "Forward One Site", purgeable ) { - "Forward One Site" -}; - - -resource 'STR ' ( MEMORY_ERROR_LAUNCH, "", purgeable ) { - "There is not enough memory to open ^0. Try quitting some other applications." -}; - -resource 'STR ' ( FNF_ERROR_LAUNCH, "", purgeable ) { - "^0 could not be opened because the application could not be found." -}; - -resource 'STR ' ( MISC_ERROR_LAUNCH, "", purgeable ) { - "An unknown error occurred trying to open ^0." -}; - -/* -resource 'STR ' ( ERROR_LAUNCH_IBM3270, "", purgeable ) { - "Could not launch IBM Host-on-Demand because the file " IBM3270_FILE " in the folder " IBM3270_FOLDER " could not be found."; -}; -*/ - -resource 'STR ' ( ERROR_OPEN_PROFILE_MANAGER, "", purgeable ) { - "Please quit "PROGRAM_NAME" before opening the Profile Manager."; -}; - -resource 'STR ' ( CALENDAR_APP_NAME, -#if USE_RESOURCE_NAMES - "Netscape Calendar" -#else - "" -#endif - , purgeable ) { - "Netscape Calendar"; -}; - -resource 'STR ' ( IMPORT_APP_NAME, -#if USE_RESOURCE_NAMES - "Netscape Import" -#else - "" -#endif - , purgeable ) { - "Netscape Import"; -}; - -resource 'STR ' ( AIM_APP_NAME, -#if USE_RESOURCE_NAMES - "AOL Instant Messenger" -#else - "" -#endif - , purgeable ) { - "AOL Instant Messenger"; -}; - -#if 0 -resource 'STR ' ( CONFERENCE_APP_NAME, -#if USE_RESOURCE_NAMES - "Netscape Conference" -#else - "" -#endif - , purgeable ) { - "Netscape Conference"; -}; -#endif - -resource 'STR ' ( NETSCAPE_TELNET, -#if USE_RESOURCE_NAMES - "Netscape Telnet" -#else - "" -#endif - , purgeable ) { - "Netscape Telnet"; -}; - -resource 'STR ' ( NETSCAPE_TELNET_NAME_ARG, -#if USE_RESOURCE_NAMES - "name= \"" -#else - "" -#endif - , purgeable ) { - "name= \""; -}; - -resource 'STR ' ( NETSCAPE_TELNET_HOST_ARG, -#if USE_RESOURCE_NAMES - "host= \"" -#else - "" -#endif - , purgeable ) { - "host= \""; -}; - -resource 'STR ' ( NETSCAPE_TELNET_PORT_ARG, -#if USE_RESOURCE_NAMES - "port= " -#else - "" -#endif - , purgeable ) { - "port= "; -}; - -resource 'STR ' ( NETSCAPE_TN3270, -#if USE_RESOURCE_NAMES - "Netscape Tn3270" -#else - "" -#endif - , purgeable ) { - "Netscape Tn3270"; -}; - -resource 'STR ' ( CLOSE_WINDOW, -#if USE_RESOURCE_NAMES - "Close" -#else - "" -#endif - , purgeable ) { - "Close"; -}; - -resource 'STR ' ( CLOSE_ALL_WINDOWS, -#if USE_RESOURCE_NAMES - "Close All" -#else - "" -#endif - , purgeable ) { - "Close All"; -}; - -resource 'STR ' ( NO_PRINTER_RESID, -#if USE_RESOURCE_NAMES - "No printer" -#else - "" -#endif - , purgeable ) { - "Your print request could not be completed because no printer has been " - "selected. Please use the Chooser to select a printer."; -}; - -resource 'STR ' ( MALLOC_HEAP_LOW_RESID, -#if USE_RESOURCE_NAMES - "Malloc Heap Low" -#else - "" -#endif - , purgeable ) { - PROGRAM_NAME" is running out of memory.Ê It is recommended that you quit " - "other running applications or close "PROGRAM_NAME" windows to continue running " - "this program."; -}; - -resource 'STR ' ( JAVA_DISABLED_RESID, -#if USE_RESOURCE_NAMES - "Java Disabled" -#else - "" -#endif - , purgeable ) { - "Java has been disabled as "PROGRAM_NAME" is low on memory.."; -}; diff --git a/mozilla/cmd/macfe/restext/MacXPStrings.c b/mozilla/cmd/macfe/restext/MacXPStrings.c deleted file mode 100644 index 8ff65209b79..00000000000 --- a/mozilla/cmd/macfe/restext/MacXPStrings.c +++ /dev/null @@ -1,51 +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. - */ - - -/* BEGIN NEW_STRING_LIB */ -/* See the long commend in xpstring.xps for how this whole thing works */ - -/*#include */ - -/* Manually include the prefix file, so that MWCPPC picks it up */ -#include "MacConfigInclude.h" - -/*END NEW NEW_STRING_LIB*/ - -/* the prefix file should have already defined OTUNIXERRORS at this stage */ -#define OTUNIXERRORS 1 -#include "OpenTransport.h" - - -/* BEGIN NEW_STRING_LIB */ -#define RESOURCE_STR 1 -/*END NEW NEW_STRING_LIB*/ - -#pragma export on - -#include "allxpstr.h" - -/* - * We need this function as certain mac roms (9500/150) seem to have a bug in CFM where - * they crash when loading fragments that have no code... - */ -void MacintoshForever( void ); -void MacintoshForever( void ) -{ - -} diff --git a/mozilla/cmd/macfe/restext/MozillaEvents.r b/mozilla/cmd/macfe/restext/MozillaEvents.r deleted file mode 100644 index b7ccf87e7a1..00000000000 --- a/mozilla/cmd/macfe/restext/MozillaEvents.r +++ /dev/null @@ -1,157 +0,0 @@ - /* - * 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. - */ - -/*---------------------------------------------------------------------------- - The Apple Events Template resource 'aedt' (found in Types.r) - is used to associate an Event Class and Event ID with a - unique integer value. These integer values are private to the - application processing the events. - - restriction: PowerPlant uses integer valuse below 4000 - All data for aetds is now centrally located in resae.h -----------------------------------------------------------------------------*/ - - -#include "types.r" -// #include "AEUserTermTypes.r" -#include "resae.h" // Provides AE Types, IDs, and AE_RefNums - -/*--------------------------------------------------------------------------*/ -/* ----- World Wide Web - Spyglass Suite ----- */ -/*--------------------------------------------------------------------------*/ - -resource 'aedt' (kSpyGlass_aedtResID, "World-Wide-Web Suite (Spyglass spec)") { - { - AE_spy_receive_suite, AE_spy_openURL, AE_OpenURL, // WWW! OURL - AE_spy_receive_suite, AE_spy_registerViewer, AE_RegisterViewer, // WWW! RGVW - AE_spy_receive_suite, AE_spy_unregisterViewer, AE_UnregisterViewer, // WWW! UNRV - AE_spy_receive_suite, AE_spy_showFile, AE_ShowFile, // WWW! SHWF - AE_spy_receive_suite, AE_spy_parse, AE_ParseAnchor, // WWW! PRSA - AE_spy_receive_suite, AE_spy_registerURLecho, AE_RegisterURLEcho, // WWW! RGUE - AE_spy_receive_suite, AE_spy_unregisterURLecho, AE_UnregisterURLEcho, // WWW! UNRU - AE_spy_receive_suite, AE_spy_activate, AE_SpyActivate, // WWW! ACTV - AE_spy_receive_suite, AE_spy_listwindows, AE_SpyListWindows, // WWW! LSTW - AE_spy_receive_suite, AE_spy_getwindowinfo, AE_GetWindowInfo, // WWW! WNFO - AE_spy_receive_suite, AE_spy_registerWinClose, AE_RegisterWinClose, // WWW! RGWC - AE_spy_receive_suite, AE_spy_unregisterWinClose, AE_UnregisterWinClose, // WWW! UNRC - AE_spy_receive_suite, AE_spy_register_protocol, AE_RegisterProtocol, // WWW! RGPR - AE_spy_receive_suite, AE_spy_unregister_protocol, AE_UnregisterProtocol, // WWW! UNRP - AE_spy_receive_suite, AE_spy_CancelProgress, AE_CancelProgress, // WWW! CNCL - AE_spy_receive_suite, AE_spy_findURL, AE_FindURL // WWW! FURL - } -}; - -/*--------------------------------------------------------------------------*/ -/* ----- Mozilla and Macintosh Std URL Suites ----- */ -/*--------------------------------------------------------------------------*/ - -resource 'aedt' (kURLSuite_aedtResID, "Mozilla & URL suite") { - { - AE_www_suite, AE_www_workingURL, AE_GetWD, // MOSS wurl - AE_www_suite, AE_www_openBookmark, AE_OpenBookmark, // MOSS book - AE_www_suite, AE_www_ReadHelpFile, AE_ReadHelpFile, // MOSS help - AE_www_suite, AE_www_go, AE_Go, // MOSS gogo - AE_url_suite, AE_url_getURL, AE_GetURL, // GURL GURL - AE_www_suite, AE_www_ProfileManager, AE_OpenProfileManager, // MOSS prfl - AE_www_suite, AE_www_openAddressBook, AE_OpenAddressBook, // MOSS addr - AE_www_suite, AE_www_openComponent, AE_OpenComponent, // MOSS cpnt - AE_www_suite, AE_www_getActiveProfile, AE_GetActiveProfile, // MOSS upro - AE_www_suite, AE_www_handleCommand, AE_HandleCommand, // MOSS hcmd - AE_www_suite, AE_www_getImportData, AE_GetProfileImportData // MOSS Impt - } -}; - -/*--------------------------------------------------------------------------*/ -/* Required Suite, we will leave this hard wired for now */ -/*--------------------------------------------------------------------------*/ - -resource 'aedt' (kRequired_aedtResID, "Required Suite") { - { - 'aevt', 'oapp', 1001, - 'aevt', 'odoc', 1002, - 'aevt', 'pdoc', 1003, - 'aevt', 'quit', 1004 - } -}; - -/*--------------------------------------------------------------------------*/ -/* Core Suite, we will leave this hard wired for now */ -/*--------------------------------------------------------------------------*/ - -resource 'aedt' (kCore_aedtResID, "Core Suite") { - { - - 'core', 'clon', 2001, - 'core', 'clos', 2002, - 'core', 'cnte', 2003, - 'core', 'crel', 2004, - 'core', 'delo', 2005, - 'core', 'doex', 2006, - 'core', 'qobj', 2007, - 'core', 'getd', 2008, - 'core', 'dsiz', 2009, - 'core', 'gtei', 2010, - 'core', 'move', 2011, - 'core', 'save', 2012, - 'core', 'setd', 2013 - } -}; - -/*--------------------------------------------------------------------------*/ -/* Misc Standards, we will leave this hard wired for now */ -/*--------------------------------------------------------------------------*/ - -resource 'aedt' (kMisc_aedtResID, "Misc Standards") { - { - 'aevt', 'obit', 3001, - 'misc', 'begi', 3002, - 'misc', 'copy', 3003, - 'misc', 'cpub', 3004, - 'misc', 'cut ', 3005, - 'misc', 'dosc', 3006, - 'misc', 'edit', 3007, - 'misc', 'endt', 3008, - 'misc', 'imgr', 3009, - 'misc', 'isun', 3010, - 'misc', 'mvis', 3011, - 'misc', 'past', 3012, - 'misc', 'redo', 3013, - 'misc', 'rvrt', 3014, - 'misc', 'ttrm', 3015, - 'misc', 'undo', 3016 - } -}; - -/*--------------------------------------------------------------------------*/ -/* PowerPlant Suite, we will leave this hard wired for now */ -/*--------------------------------------------------------------------------*/ - -resource 'aedt' (kPowerPlant_aedtResID, "PowerPlant") { - { - 'misc', 'slct', 3017, - 'ppnt', 'sttg', 3018, - 'aevt', 'rec1', 1098, - 'aevt', 'rec0', 1099 - } -}; - - - - - - - diff --git a/mozilla/cmd/macfe/restext/RatMakeXPStrings.txt b/mozilla/cmd/macfe/restext/RatMakeXPStrings.txt deleted file mode 100644 index f04c709175c..00000000000 --- a/mozilla/cmd/macfe/restext/RatMakeXPStrings.txt +++ /dev/null @@ -1,45 +0,0 @@ -# -*- Mode: Text -*- -# -# 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. - -# -# MakeXPStrings for Navigator (#define MOZ_LITE) - -Set ns "::::" # project folder relative -Set ResourceDir "{ns}cmd:macfe:restext:" -Set TargetDir "{ns}cmd:macfe:projects:client:" - -Export ResourceDir - -MWCPPC -nodefaults -i- -D MOZ_LITE -e2 -D _XP_Core_ -D XP_MAC {IncludeFiles} "{SourceFile}" ¶ - > "{ResourceDir}Temp_XPStrings.r" - -if {status} == 0 - If "`Exists -d "{TargetDir}Essential Files:"`" == "" - NewFolder "{TargetDir}Essential Files" - End - Directory "{ResourceDir}" # set to the correct folder - perl resdef.pl Temp_XPStrings.r - delete Temp_XPStrings.r - Rez -t 'NSPL' -c MOSS -i "{RIncludes}" ¶ - -o "{TargetDir}Essential Files:Netscape Resources" ¶ - xpstring.r - delete xpstring.r - Rez -append -d MOZ_LITE -i "{RIncludes}" -i "{ns}cmd:macfe:include:" ¶ - -o "{TargetDir}Essential Files:Netscape Resources" ¶ - MacSTR.r -end - diff --git a/mozilla/cmd/macfe/restext/StringLib.mcp b/mozilla/cmd/macfe/restext/StringLib.mcp deleted file mode 100644 index 854016da050..00000000000 Binary files a/mozilla/cmd/macfe/restext/StringLib.mcp and /dev/null differ diff --git a/mozilla/cmd/macfe/restext/cp1250.r b/mozilla/cmd/macfe/restext/cp1250.r deleted file mode 100644 index 164eba03efb..00000000000 --- a/mozilla/cmd/macfe/restext/cp1250.r +++ /dev/null @@ -1,120 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_CE_TO_CP_1250, "MAC_CE -> CP_1250",purgeable){ -/* Translation MacOS_CentralEuro.txt -> cp1250.x */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 96 is unmap !!! */ -/* 98 is unmap !!! */ -/* 9B is unmap !!! */ -/* A3 is unmap !!! */ -/* AD is unmap !!! */ -/* AE is unmap !!! */ -/* AF is unmap !!! */ -/* B0 is unmap !!! */ -/* B1 is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B4 is unmap !!! */ -/* B5 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* B9 is unmap !!! */ -/* BA is unmap !!! */ -/* BF is unmap !!! */ -/* C0 is unmap !!! */ -/* C3 is unmap !!! */ -/* C6 is unmap !!! */ -/* CD is unmap !!! */ -/* CF is unmap !!! */ -/* D7 is unmap !!! */ -/* D8 is unmap !!! */ -/* DF is unmap !!! */ -/* E0 is unmap !!! */ -/* ED is unmap !!! */ -/* F0 is unmap !!! */ -/* F6 is unmap !!! */ -/* F7 is unmap !!! */ -/* FA is unmap !!! */ -/* FE is unmap !!! */ -/* There are total 37 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C481 82C9 A5D6 DCE1 B9C8 E4E8 C6E6 E98F" -/*9x*/ $"9FCF EDEF 9495 96F3 98F4 F69B FACC ECFC" -/*Ax*/ $"86B0 CAA3 A795 B6DF AEA9 99EA A8AD AEAF" -/*Bx*/ $"B0B1 B2B3 B4B5 B6B7 B3B9 BABC BEC5 E5BF" -/*Cx*/ $"C0D1 ACC3 F1D2 C6AB BB85 A0F2 D5CD F5CF" -/*Dx*/ $"9697 9394 9192 F7D7 D8C0 E0D8 8B9B F8DF" -/*Ex*/ $"E08A 8284 9A8C 9CC1 8D9D CD8E 9EED D3D4" -/*Fx*/ $"F0D9 DAF9 DBFB F6F7 DDFD FAAF A3BF FEA1" -}; - -data 'xlat' ( xlat_CP_1250_TO_MAC_CE, "CP_1250 -> MAC_CE",purgeable){ -/* Translation cp1250.x -> MacOS_CentralEuro.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 83 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 90 is unmap !!! */ -/* 98 is unmap !!! */ -/* A2 is unmap !!! */ -/* A4 is unmap !!! */ -/* A6 is unmap !!! */ -/* AA is unmap !!! */ -/* AD is unmap !!! */ -/* B1 is unmap !!! */ -/* B2 is unmap !!! */ -/* B4 is unmap !!! */ -/* B5 is unmap !!! */ -/* B7 is unmap !!! */ -/* B8 is unmap !!! */ -/* BA is unmap !!! */ -/* BD is unmap !!! */ -/* C2 is unmap !!! */ -/* C3 is unmap !!! */ -/* C7 is unmap !!! */ -/* CB is unmap !!! */ -/* CE is unmap !!! */ -/* D0 is unmap !!! */ -/* D7 is unmap !!! */ -/* DE is unmap !!! */ -/* E2 is unmap !!! */ -/* E3 is unmap !!! */ -/* E7 is unmap !!! */ -/* EB is unmap !!! */ -/* EE is unmap !!! */ -/* F0 is unmap !!! */ -/* FE is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 37 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 E283 E3C9 A087 8889 E1DC E5E8 EB8F" -/*9x*/ $"90D4 D5D2 D3A5 D0D1 98AA E4DD E6E9 EC90" -/*Ax*/ $"CAFF A2FC A484 A6A4 ACA9 AAC7 C2AD A8FB" -/*Bx*/ $"A1B1 B2B8 B4B5 A6B7 B888 BAC8 BBBD BCFD" -/*Cx*/ $"D9E7 C2C3 80BD 8CC7 8983 A2CB 9DEA CE91" -/*Dx*/ $"D0C1 C5EE EFCC 85D7 DBF1 F2F4 86F8 DEA7" -/*Ex*/ $"DA87 E2E3 8ABE 8DE7 8B8E ABEB 9E92 EE93" -/*Fx*/ $"F0C4 CB97 99CE 9AD6 DEF3 9CF5 9FF9 FEFF" -}; - diff --git a/mozilla/cmd/macfe/restext/cp1251.r b/mozilla/cmd/macfe/restext/cp1251.r deleted file mode 100644 index 8a4997131ee..00000000000 --- a/mozilla/cmd/macfe/restext/cp1251.r +++ /dev/null @@ -1,70 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_CYRILLIC_TO_CP_1251, "MAC_CYRILLIC -> CP_1251",purgeable){ -/* Translation MacOS_Cyrillic.txt -> cp1251.x */ -/* A2 is unmap !!! */ -/* A3 is unmap !!! */ -/* AD is unmap !!! */ -/* B0 is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B6 is unmap !!! */ -/* C3 is unmap !!! */ -/* C4 is unmap !!! */ -/* C5 is unmap !!! */ -/* C6 is unmap !!! */ -/* D6 is unmap !!! */ -/* There are total 12 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C0C1 C2C3 C4C5 C6C7 C8C9 CACB CCCD CECF" -/*9x*/ $"D0D1 D2D3 D4D5 D6D7 D8D9 DADB DCDD DEDF" -/*Ax*/ $"86B0 A2A3 A795 B6B2 AEA9 9980 90AD 8183" -/*Bx*/ $"B0B1 B2B3 B3B5 B6A3 AABA AFBF 8A9A 8C9C" -/*Cx*/ $"BCBD ACC3 C4C5 C6AB BB85 A08E 9E8D 9DBE" -/*Dx*/ $"9697 9394 9192 D684 A1A2 8F9F B9A8 B8FF" -/*Ex*/ $"E0E1 E2E3 E4E5 E6E7 E8E9 EAEB ECED EEEF" -/*Fx*/ $"F0F1 F2F3 F4F5 F6F7 F8F9 FAFB FCFD FEA4" -}; - -data 'xlat' ( xlat_CP_1251_TO_MAC_CYRILLIC, "CP_1251 -> MAC_CYRILLIC",purgeable){ -/* Translation cp1251.x -> MacOS_Cyrillic.txt */ -/* 82 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8B is unmap !!! */ -/* 98 is unmap !!! */ -/* 9B is unmap !!! */ -/* A5 is unmap !!! */ -/* A6 is unmap !!! */ -/* AD is unmap !!! */ -/* B4 is unmap !!! */ -/* B7 is unmap !!! */ -/* There are total 12 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"ABAE 82AF D7C9 A087 8889 BC8B BECD CBDA" -/*9x*/ $"ACD4 D5D2 D3A5 D0D1 98AA BD9B BFCE CCDB" -/*Ax*/ $"CAD8 D9B7 FFA5 A6A4 DDA9 B8C7 C2AD A8BA" -/*Bx*/ $"A1B1 A7B4 B4B5 A6B7 DEDC B9C8 C0C1 CFBB" -/*Cx*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*Dx*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" -/*Ex*/ $"E0E1 E2E3 E4E5 E6E7 E8E9 EAEB ECED EEEF" -/*Fx*/ $"F0F1 F2F3 F4F5 F6F7 F8F9 FAFB FCFD FEDF" -}; - diff --git a/mozilla/cmd/macfe/restext/cp1253.r b/mozilla/cmd/macfe/restext/cp1253.r deleted file mode 100644 index 39051e97400..00000000000 --- a/mozilla/cmd/macfe/restext/cp1253.r +++ /dev/null @@ -1,104 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_GREEK_TO_CP_1253, "MAC_GREEK -> CP_1253",purgeable){ -/* Translation MacOS_Greek.txt -> cp1253.x */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 83 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A7 is unmap !!! */ -/* AD is unmap !!! */ -/* AF is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* C5 is unmap !!! */ -/* CF is unmap !!! */ -/* D6 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 29 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 B283 B385 86A1 8889 8AB4 A88D 8E8F" -/*9x*/ $"9091 A399 9495 95BD 8999 9AA6 AD9D 9E9F" -/*Ax*/ $"86C3 C4C8 CBCE D0A7 AEA9 D3DA A7AD B0AF" -/*Bx*/ $"C1B1 B2B3 A5C2 C5C6 C7C9 CACC D6DB D8D9" -/*Cx*/ $"DCCD ACCF D1C5 D4AB BB85 A0D5 D7A2 B8CF" -/*Dx*/ $"96AF 9394 9192 D6B9 BABC BEDD DEDF FCBF" -/*Ex*/ $"FDE1 E2F8 E4E5 F6E3 E7E9 EEEA EBEC EDEF" -/*Fx*/ $"F0FE F1F3 F4E8 F9F2 F7F5 E6FA FBC0 E0FF" -}; - -data 'xlat' ( xlat_CP_1253_TO_MAC_GREEK, "CP_1253 -> MAC_GREEK",purgeable){ -/* Translation cp1253.x -> MacOS_Greek.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 97 is unmap !!! */ -/* 98 is unmap !!! */ -/* 9A is unmap !!! */ -/* 9B is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A4 is unmap !!! */ -/* AA is unmap !!! */ -/* B5 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* D2 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 29 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 84C9 A087 8898 8A8B 8C8D 8E8F" -/*9x*/ $"90D4 D5D2 D396 D097 9893 9A9B 9C9D 9E9F" -/*Ax*/ $"CA87 CD92 A4B4 9BAC 8CA9 AAC7 C29C A8D1" -/*Bx*/ $"AEB1 8284 8BB5 B6B7 CED7 D8C8 D997 DADF" -/*Cx*/ $"FDB0 B5A1 A2B6 B7B8 A3B9 BAA4 BBC1 A5C3" -/*Dx*/ $"A6C4 D2AA C6CB BCCC BEBF ABBD C0DB DCDD" -/*Ex*/ $"FEE1 E2E7 E4E5 FAE8 F5E9 EBEC EDEE EAEF" -/*Fx*/ $"F0F2 F7F3 F4F9 E6F8 E3F6 FBFC DEE0 F1FF" -}; - diff --git a/mozilla/cmd/macfe/restext/cp1257.r b/mozilla/cmd/macfe/restext/cp1257.r deleted file mode 100644 index 1529752a3e6..00000000000 --- a/mozilla/cmd/macfe/restext/cp1257.r +++ /dev/null @@ -1,123 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_MAC_CE_TO_CP_1257, "MAC_CE -> CP_1257",purgeable){ -/* Translation CENTEURO.TXT -> CP1257.TXT */ -/* 10 is unmap !!! */ -/* 87 is unmap !!! */ -/* 91 is unmap !!! */ -/* 92 is unmap !!! */ -/* 93 is unmap !!! */ -/* 99 is unmap !!! */ -/* 9C is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* AD is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* BB is unmap !!! */ -/* BC is unmap !!! */ -/* BD is unmap !!! */ -/* BE is unmap !!! */ -/* C3 is unmap !!! */ -/* C5 is unmap !!! */ -/* C6 is unmap !!! */ -/* CB is unmap !!! */ -/* CC is unmap !!! */ -/* CE is unmap !!! */ -/* D7 is unmap !!! */ -/* D9 is unmap !!! */ -/* DA is unmap !!! */ -/* DB is unmap !!! */ -/* DE is unmap !!! */ -/* E7 is unmap !!! */ -/* E8 is unmap !!! */ -/* E9 is unmap !!! */ -/* EA is unmap !!! */ -/* EF is unmap !!! */ -/* F1 is unmap !!! */ -/* F2 is unmap !!! */ -/* F3 is unmap !!! */ -/* F4 is unmap !!! */ -/* F5 is unmap !!! */ -/* F8 is unmap !!! */ -/* F9 is unmap !!! */ -/* There are total 41 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C4C2 E2C9 C0D6 DC87 E0C8 E4E8 C3E3 E9CA" -/*9x*/ $"EA91 9293 C7E7 CBF3 EB99 F6F5 9C9D 9EFC" -/*Ax*/ $"86B0 C6A3 A795 B6DF AEA9 99E6 8DAD ECC1" -/*Bx*/ $"E1CE B2B3 EECD B6B7 F9CF EFBB BCBD BED2" -/*Cx*/ $"F2D1 ACC3 F1C5 C6AB BB85 A0CB CCD5 CED4" -/*Dx*/ $"9697 9394 9192 F7D7 F4D9 DADB 8B9B DEAA" -/*Ex*/ $"BAD0 8284 F0DA FAE7 E8E9 EADE FEDB D3EF" -/*Fx*/ $"FBF1 F2F3 F4F5 D8F8 F8F9 EDDD D9FD CC8E" -}; - -data 'xlat' ( xlat_CP_1257_TO_MAC_CE, "CP_1257 -> MAC_CE",purgeable){ -/* Translation CP1257.TXT -> CENTEURO.TXT */ -/* 10 is unmap !!! */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* 9F is unmap !!! */ -/* A1 is actually unmap " */ -/* A2 is unmap !!! */ -/* A4 is unmap !!! */ -/* A5 is unmap !!! " */ -/* A6 is unmap !!! */ -/* A8 is unmap !!! */ -/* AD is unmap !!! */ -/* AF is unmap !!! */ -/* B1 is unmap !!! */ -/* B2 is unmap !!! */ -/* B3 is unmap !!! */ -/* B4 is unmap !!! */ -/* B5 is unmap !!! */ -/* B7 is unmap !!! */ -/* B8 is unmap !!! */ -/* B9 is unmap !!! */ -/* BC is unmap !!! */ -/* BD is unmap !!! */ -/* BE is unmap !!! */ -/* BF is unmap !!! */ -/* C5 is unmap !!! */ -/* D7 is unmap !!! */ -/* E5 is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 35 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 E2E2 E3C9 A087 8889 8ADC DCAC FF8F" -/*9x*/ $"90D4 D5D2 D3A5 D0D1 D1AA AADD DD9D 9E9F" -/*Ax*/ $"CA22 A2A3 A422 A6A4 A8A9 DFC7 C2AD A8AF" -/*Bx*/ $"A1B1 B2B3 B4B5 A6B7 B8B9 E0C8 BCBD BEBF" -/*Cx*/ $"84AF 818C 80C5 A294 8983 8F96 FEB5 B1B9" -/*Dx*/ $"E1C1 BFEE CFCD 85D7 F6FC E5ED 86FB EBA7" -/*Ex*/ $"88B0 828D 8AE5 AB95 8B8E 9098 AEFA B4BA" -/*Fx*/ $"E4C4 C097 D89B 9AD6 F7B8 E6F0 9FFD ECFF" -}; - diff --git a/mozilla/cmd/macfe/restext/csid.r b/mozilla/cmd/macfe/restext/csid.r deleted file mode 100644 index 690814238cf..00000000000 --- a/mozilla/cmd/macfe/restext/csid.r +++ /dev/null @@ -1,66 +0,0 @@ - /* - * 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. - */ -/* - File: csid.r - - Contains: Type Declarations for Rez and DeRez - - Copyright: © 1986-1994 by Netscape Communication, Inc. - All Fights Reserved. -*/ - -#ifndef __CSID_R__ -#define __CSID_R__ - -/* Duplicate from i18nlib.h */ -#define SINGLEBYTE 0x0000 /* 0000 0000 0000 0000 */ -#define MULTIBYTE 0x0100 /* 0000 0001 0000 0000 */ -#define STATEFUL 0x0200 /* 0000 0010 0000 0000 */ -#define WIDECHAR 0x0300 /* 0000 0011 0000 0000 */ - -/* line-break on spaces */ -#define CS_SPACE 0x0400 /* 0000 0100 0000 0000 */ - -/* Auto Detect Mode */ -#define CS_AUTO 0x0800 /* 0000 1000 0000 0000 */ - - -/* Code Set IDs */ -/* CS_DEFAULT: used if no charset param in header */ -/* CS_UNKNOWN: used for unrecognized charset */ - - /* type id */ -#define CS_DEFAULT (SINGLEBYTE | 0) -#define CS_ASCII (SINGLEBYTE | 1) -#define CS_LATIN1 (SINGLEBYTE | 2) -#define CS_JIS (STATEFUL | 3) -#define CS_SJIS (MULTIBYTE | 4) -#define CS_EUCJP (MULTIBYTE | 5) -#define CS_JIS_AUTO (CS_AUTO|STATEFUL | 3) -#define CS_SJIS_AUTO (CS_AUTO|MULTIBYTE | 4) -#define CS_EUCJP_AUTO (CS_AUTO|MULTIBYTE | 5) -#define CS_MAC_ROMAN (SINGLEBYTE | 6) -#define CS_BIG5 (MULTIBYTE | 7) -#define CS_GB_8BIT (MULTIBYTE | 8) -#define CS_CNS_8BIT (MULTIBYTE | 9) -#define CS_LATIN2 (SINGLEBYTE | 10) -#define CS_MAC_CE (SINGLEBYTE | 11) -#define CS_KSC_8BIT (MULTIBYTE|CS_SPACE | 12) -#define CS_2022_KR (MULTIBYTE | 13) -#define CS_UNKNOWN (SINGLEBYTE | 255) - -#endif diff --git a/mozilla/cmd/macfe/restext/custom.r b/mozilla/cmd/macfe/restext/custom.r deleted file mode 100644 index fec4fe268b1..00000000000 --- a/mozilla/cmd/macfe/restext/custom.r +++ /dev/null @@ -1,354 +0,0 @@ - /* - * 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. - */ -#undef BETA -#undef ALPHA -#include "SysTypes.r" - -#define APPLICATION_NAME "Mozilla" -#define TRADEMARK_NAME APPLICATION_NAME "ª " - -#define VERSION_CORP_STR "Mozilla.Org" - -#define APPLICATION_LANGUAGE "en" - -#define VERSION_MAJOR_STR "5.0a1 Development" -#define VERSION_MINOR_STR "" -#define VERSION_STRING VERSION_MAJOR_STR VERSION_MINOR_STR -#define VERSION_LANG "en" // e.g. en, ja, de, fr -#define VERSION_COUNTRY "_US" // e.g., _JP, _DE, _FR, _US -#define VERSION_LOCALE VERSION_LANG VERSION_COUNTRY -#define VERSION_MAJOR 5 -#define VERSION_MINOR 0 // Actually minor and bug rev in BCD format -#define VERSION_MICRO 0 // Actually internal non release rev # -#define VERSION_KIND development -#define COPYRIGHT_STRING ", © Netscape Communications Corporation 1995-8" - - -//#define GETINFO_DESC TRADEMARK_NAME VERSION_STRING -#define GETINFO_DESC VERSION_CORP_STR - -#define GETINFO_VERSION VERSION_STRING COPYRIGHT_STRING - -#ifdef MOZ_NAV_BUILD_PREFIX -#define USER_AGENT_PPC_STRING "(Macintosh; %s; PPC, Nav)" -#define USER_AGENT_68K_STRING "(Macintosh; %s; 68K, Nav)" -#else -#define USER_AGENT_PPC_STRING "(Macintosh; %s; PPC)" -#define USER_AGENT_68K_STRING "(Macintosh; %s; 68K)" -#endif - -#define USER_AGENT_NAME "Mozilla" - -#ifdef powerc -#define USER_AGENT_VERSION VERSION_STRING " [" VERSION_LOCALE "] " USER_AGENT_PPC_STRING -#else -#define USER_AGENT_VERSION VERSION_STRING " [" VERSION_LOCALE "] " USER_AGENT_68K_STRING -#endif - -/*----------------------------------------------------------------------------- - Version Numbers ------------------------------------------------------------------------------*/ - -resource 'vers' (1, "Program") { - VERSION_MAJOR, - VERSION_MINOR, - VERSION_KIND, - VERSION_MICRO, - verUS, - USER_AGENT_VERSION, - GETINFO_VERSION -}; - -resource 'vers' (2, "Suite") { - VERSION_MAJOR, - VERSION_MINOR, - VERSION_KIND, - VERSION_MICRO, - verUS, - USER_AGENT_VERSION, - GETINFO_DESC -}; - -resource 'STR#' ( ID_STRINGS, "IDs", purgeable) {{ - APPLICATION_NAME -, VERSION_MAJOR_STR // Actually the user agent string - was VERSION_STRING -, USER_AGENT_NAME -, USER_AGENT_68K_STRING -, USER_AGENT_PPC_STRING -, APPLICATION_LANGUAGE -}}; - -#define NETSCAPE_LOCATION "http://www.netscape.com" -#define CGI_LOCATION "http://cgi.netscape.com/" -#define ENG_LOCATION NETSCAPE_LOCATION "eng/mozilla/" VERSION_MAJOR_STR "/" -#define HOME_LOCATION NETSCAPE_LOCATION "home/" - -#define WELCOME_LOCATION "welcome.html" - -#define WHATSNEW_LOCATION HOME_LOCATION "whats-new.html" -#define WHATSCOOL_LOCATION HOME_LOCATION "whats-cool.html" -#define NEWSRC_LOCATION "news:" -#define MARKETPLACE_LOCATION HOME_LOCATION "netscape-galleria.html" -#define DIRECTORY_LOCATION HOME_LOCATION "internet-directory.html" -#define SEARCH_LOCATION HOME_LOCATION "internet-search.html" -#define WHITEPAGES_LOCATION HOME_LOCATION "internet-white-pages.html" -#define ABOUTINTERNET_LOCATION HOME_LOCATION "about-the-internet.html" - -#define ABOUT_LOCATION "about:" -#define ABOUT_PLUGINS_LOCATIONS "about:plugins" -#define REGISTRATION_LOCATION CGI_LOCATION "cgi-bin/reginfo.cgi" -#define MANUAL_LOCATION ENG_LOCATION "handbook/" -#define ESCAPES_LOCATION NETSCAPE_LOCATION "escapes/index.html" -#define VERSION_LOCATION ENG_LOCATION "relnotes/mac-" VERSION_STRING ".html" -#define FAQ_LOCATION "http://help.netscape.com/faqs.html" -#define HELPONSEC_LOCATION NETSCAPE_LOCATION "info/security-doc.html" -#define HELPONNEWS_LOCATION ENG_LOCATION "news/news.html" -#define FEEDBACK_LOCATION "http://cgi.netscape.com/cgi-bin/auto_bug.cgi" -#define SUPPORT_LOCATION "http://help.netscape.com" -#define WEBSERVICES_LOCATION HOME_LOCATION "how-to-create-web-services.html" -#define SOFTWARE_LOCATION NETSCAPE_LOCATION "comprod/upgrades/index.html" - -// Note: moved NEWDOC_TEMPLATE_LOCATION and WIZARD_LOCATION to config.js - -#define ABOUT_PLUGINS_LOCATION "about:plugins" -#define ABOUT_SOFTWARE_LOCATION NETSCAPE_LOCATION "comprod/upgrades/index.html" -#define WEB_PAGE_STARTER_LOCATION HOME_LOCATION "starter.html" - -#define ESSENTIALS_FOLDER "Essential Files" -#define CONFIG_FILENAME "mozilla.cfg" - -// Note: moved DIR_BUTTON_BASE and DIR_MENU_BASE lists of directory URLs to config.js - -resource 'STR ' ( LOGO_BUTTON_URL_RESID, "Logo Button URL", purgeable ) { - NETSCAPE_LOCATION -}; - -resource 'STR#' ( 300, "Pref file names", purgeable ) {{ - PREFS_FOLDER_NAME; // 1 - PREFS_FILE_NAME; // 2 - "Global History"; // 3 Global history - "Cache Ä"; // 4 Cache folder name - "CCache log"; // 5 Cache file allocation table name - "newsrc"; // 6 Subscribed Newsgroups - "Bookmarks.html"; // 7 Bookmarks - ""; // 8 MIME types, not used - "MagicCookie"; // 9 Magic cookie file - "socks.conf"; // 10 SOCKS file, inside preferences - "Newsgroups"; // 11 Newsgroup listings - "NewsFAT"; // 12 Mappings of newsrc files - "Certificates"; // 13 Certificates - "Certificate Index"; // 14 Certificate index - "Mail"; // 15 Mail folder - "News"; // 16 News folder - "Security"; // 17 Security folder - ".snm"; // 18 Mail index extension - "Filter Rules"; // 19 aka Mail sort file - "Pop State"; // 20 Mail pop state - "Proxy Config"; // 21 Proxy configuration - "Key Database"; // 22 Key db - "Headers cache"; // 23 Headers xover cache - "abook.nab"; // 24 Address Book - "Sent"; // 25 Sent mail - "Sent"; // 26 Posted news articles - "External Cache"; // 27 External cache FAT - ".sbd"; // 28 Subdirectory extension - "News Host DB"; // 29 News Host DB (really.) - CONFIG_FILENAME; // 30 Local config/lock file - "User Profiles"; // 31 User profiles database - "Mail Filter Log"; // 32 Mail Filter Log - "Navigator Registry"; // 33 Netscape registry - ESSENTIALS_FOLDER; // 34 Essential files (where java stuff is, and other required stuff) - "archive"; // 35 - "archive.fat"; // 36 - ""; // 37 IBM 3270 folder (unused) - ""; // 38 IBM 3270 file (unused) - "addressbook.html"; // 39 - ".vcf"; // 40 Extension for vcard files. - ".ldi"; // 41 Extension for LDIF files. - ".ldif"; // 42 Another extension for LDIFF files. - "Security Modules"; // 43 secModuleDb - "Navigator Users"; // 44 Folder containing user profiles - "Unknown"; // 45 App name for unknown mime type - "Account Setup"; // 46 Name of the magic "Account Setup" launcher - "NetHelp"; // 47 Folder containing nethelp files - "Folder Cache"; // 48 Cache of last known folder pane state - "Defaults"; // 49 Template folder for new profiles - "moz40p3"; // 50 Cryptographic policy file - "SignedAppletDB"; // 51 Signed applet file - "Cookie Permissions"; // 52 Cookie permission file - "Single Signons"; // 53 Single Signon file - "failover.jsc"; // 54 jsConfig - Cached failover of .jsc startup file (AutoAdmin) -}}; - -resource 'STR#' ( BUTTON_STRINGS_RESID, "Button Names", purgeable ) {{ - "Back"; // 1 Main - "Forward"; // 2 Main - "Home"; // 3 Main - "Reload"; // 4 Main - "Images"; // 5 Main - "Open"; // 6 Main - "Print"; // 7 Main - "Find"; // 8 Main - "Stop"; // 9 Main - "WhatÕs New?"; // 10 Directory button - "WhatÕs Cool?"; // 11 Directory button - "Destinations"; // 12 Directory button - "Net Search"; // 13 Directory button - "People"; // 14 Directory button - "Software"; // 15 Directory button - "Get Mail"; // 16 Mail: Get New Mail - "To: Mail"; // 17 Mail: Mail New - "Delete"; // 18 Mail: Delete Message - "Re: Mail"; // 19 Mail: Reply to Sender - "Re: All"; // 20 Mail: Reply to All - "Forward"; // 21 Mail and News: Forward Message - "Previous"; // 22 Mail and News: Previous Unread Message - "Next"; // 23 Mail and News: Next Unread Message - "New"; // 24 (not used) - "Read"; // 25 (not used) - "Send Now"; // 26 Compose: Send Now - "Attach"; // 27 Compose: Attach - "Address"; // 28 Compose: Bring up Address Book - "Send Later"; // 29 Compose: Send Later - "Quote"; // 30 Compose: Quote Original Message - "To: News"; // 31 News: Post to News - "To: Mail"; // 32 News: Send Mail - "Re: Mail"; // 33 News: Reply via Mail - "Re: News"; // 34 News: Reply via News - "Re: Both"; // 35 News: Reply via Mail and News - "Thread"; // 36 News: Mark Thread Read - "Group"; // 37 News: Mark Group Read - "Mozilla"; // 38 Main: Co-brand button - "New"; // 39 Editor; File/Edit: New Document - "Open"; // 40 Editor; File/Edit: Open - "Save"; // 41 Editor; File/Edit: Save - "Browse"; // 42 Editor; File/Edit: Browse Document - "Cut"; // 43 Editor; File/Edit: Cut - "Copy"; // 44 Editor; File/Edit: Copy - "Paste"; // 45 Editor; File/Edit: Paste - "Print"; // 46 Editor; File/Edit: Print - "Find"; // 47 Editor; File/Edit: Find - "Edit"; // 48 Edit - "Publish"; // 49 Editor; File/Edit: Publish - ""; // 50 Editor; Decrease font size - ""; // 51 Editor; Increase font size - ""; // 52 Editor; Bold - ""; // 53 Editor; Italic - ""; // 54 Editor; Fixed Width - ""; // 55 Editor; Font Color - ""; // 56 Editor; Make Link - ""; // 57 Editor; Clear All Styles - ""; // 58 Editor; Insert Target (Named Anchor) - ""; // 59 Editor; Insert Image - ""; // 60 Editor; Insert Horiz. Line - ""; // 61 Editor; Table - ""; // 62 Editor; Object Properties - ""; // 63 Editor; Bullet List - ""; // 64 Editor; Numbered List - ""; // 65 Editor; Decrease Indent - ""; // 66 Editor; Increase Indent - ""; // 67 Editor; Align Left - ""; // 68 Editor; Center - ""; // 69 Editor; Align Right -}}; - -#if 0 /* these have moved elsewhere */ -resource 'STR#' ( BUTTON_TOOLTIPS_RESID, "", purgeable ) {{ - "Back"; // 1 Main - "Forward"; // 2 Main - "Go To Home Page"; // 3 Main - "Reload Page"; // 4 Main - "Load Images"; // 5 Main - "Open Location"; // 6 Main - "Print"; // 7 Main - "Find Text On Page"; // 8 Main - "Stop Loading"; // 9 Main - ""; // 10 What's New ? - ""; // 11 Directory button - ""; // 12 Handbook - ""; // 13 Net Search - ""; // 14 Net Directory - ""; // 15 Software - "Get New Mail"; // 16 Mail: Get New Mail - "Compose New Mail Message"; // 17 Mail: Mail New - "Delete Selected Messages"; // 18 Mail: Delete Message - "Reply To Sender"; // 19 Mail: Reply to Sender - "Reply To All"; // 20 Mail: Reply to All - "Forward Message"; // 21 Mail and News: Forward Message - "Previous Unread Message"; // 22 Mail and News: Previous Unread Message - "Next Unread Message"; // 23 Mail and News: Next Unread Message - ""; // 24 (not used) - ""; // 25 (not used) - "Send Mail Now"; // 26 Compose: Send Now - "Attach"; // 27 Compose: Attach - "Open Address Book"; // 28 Compose: Bring up Address Book - "Place Message In Outbox"; // 29 Compose: Send Later - "Quote Original Message"; // 30 Compose: Quote Original Message - "Post News Message"; // 31 News: Post to News - "Compose New Mail Message"; // 32 News: Send Mail - "Reply via Mail"; // 33 News: Reply via Mail - "Reply via News"; // 34 News: Reply via News - "Reply via Mail and News"; // 35 News: Reply via Mail and News - "Mark Thread Read"; // 36 News: Mark Thread Read - "Mark Group Read"; // 37 News: Mark Group Read - ""; // 38 Main: Co-brand button - "New Document"; // 39 Editor; File/Edit: New Document - "Open File To Edit"; // 40 Editor; File/Edit: Open - "Save"; // 41 Editor; File/Edit: Save - "View in Browser"; // 42 Editor; File/Edit: Browse Document - "Cut"; // 43 Editor; File/Edit: Cut - "Copy"; // 44 Editor; File/Edit: Copy - "Paste"; // 45 Editor; File/Edit: Paste - "Print"; // 46 Editor; File/Edit: Print - "Find"; // 47 Editor; File/Edit: Find - "Edit"; // 48 Edit - "Publish"; // 49 Editor; File/Edit: Publish - "Decrease font size"; // 50 Editor; Decrease font size - "Increase font size"; // 51 Editor; Increase font size - "Bold"; // 52 Editor; Bold - "Italic"; // 53 Editor; Italic - "Fixed Width"; // 54 Editor; Fixed Width - "Font Color"; // 55 Editor; Font Color - "Make Link"; // 56 Editor; Make Link - "Clear All Styles"; // 57 Editor; Clear All Styles - "Insert Target (Named Anchor)"; // 58 Editor; Insert Target (Named Anchor) - "Insert Image"; // 59 Editor; Insert Image - "Insert Horiz. Line"; // 60 Editor; Insert Horiz. Line - "Table"; // 61 Editor; Table - "Object Properties"; // 62 Editor; Object Properties - "Bullet List"; // 63 Editor; Bullet List - "Numbered List"; // 64 Editor; Numbered List - "Decrease Indent"; // 65 Editor; Decrease Indent - "Increase Indent"; // 66 Editor; Increase Indent - "Align Left"; // 67 Editor; Align Left - "Center"; // 68 Editor; Center - "Align Right"; // 69 Editor; Align Right -}}; -#endif 0 - -/****************************************************************** - * PREFERENCES - ******************************************************************/ - -/* -- 4.0 xp prefs -- - * Default string/int/bool values have been removed from here - * and moved to xp initializers in libpref/src/init/all.js - * To add or edit default values, edit all.js and make sure - * your prefs have corresponding xp keys in uprefd.cp. - */ - - diff --git a/mozilla/cmd/macfe/restext/editor.r b/mozilla/cmd/macfe/restext/editor.r deleted file mode 100644 index 72a793f70c2..00000000000 --- a/mozilla/cmd/macfe/restext/editor.r +++ /dev/null @@ -1,78 +0,0 @@ - /* - * 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 "Types.r" -#include "resgui.h" // main window constants - -resource 'STR ' ( NO_SRC_EDITOR_PREF_SET + 0, "", purgeable ) { -"You have not set a default application to use when opening HTML files. Please choose an application to use." -}; - -resource 'STR ' ( NO_IMG_EDITOR_PREF_SET + 0, "", purgeable ) { -"You have not set a default application to use when opening graphics files. Please choose an application to use." -}; - -resource 'STR ' ( INVALID_PUBLISH_LOC + 0, "", purgeable ) { -"The URL of the location you want to publish to must begin with Òftp://Ó or Òhttp://Ó." -}; - -resource 'STR ' ( NO_DICTIONARY_FOUND + 0, "", purgeable ) { -"The dictionary for the spelling checker is not installed." -}; - -resource 'STR ' ( NO_SPELL_SHLB_FOUND + 0, "", purgeable ) { -"The Spelling Checker tool (NSSpellChecker) is not installed." -}; - -resource 'STR ' ( CLOSE_STR_RESID + 0, "", purgeable ) { -"Close" -}; - -resource 'STR ' ( DUPLICATE_TARGET + 0, "", purgeable ) { -"That target name already exists. " -}; - -resource 'STR ' ( DUPLICATE_TARGET + 1, "", purgeable ) { -"Please choose another one." -}; - -resource 'STR ' ( CUT_ACROSS_CELLS + 0, "", purgeable ) { -"You have selected more than one cell. " -}; - -resource 'STR ' ( CUT_ACROSS_CELLS + 1, "", purgeable ) { -"You canÕt change the contents of multiple cells at once. Change your selection to include only one cell and repeat this action." -}; - -resource 'STR ' ( NOT_HTML + 0, "", purgeable ) { -"Page Composer canÕt edit this kind of file." -}; - -resource 'STR ' ( BAD_TAG + 0, "", purgeable ) { -"You need to enclose HTML tags in angle brackets: ." -}; - -resource 'STR ' ( EDITOR_ERROR_EDIT_REMOTE_IMAGE + 0, "", purgeable ) { -"The image you are trying to edit is not on your hard disk. You need to save this image to your hard disk before you can edit it." -}; - -resource 'STR ' ( EDITOR_PERCENT_WINDOW, "", purgeable ) { -"% of window" -}; - -resource 'STR ' ( EDITOR_PERCENT_PARENT_CELL, "", purgeable ) { -"% of current cell" -}; diff --git a/mozilla/cmd/macfe/restext/exception_str.r b/mozilla/cmd/macfe/restext/exception_str.r deleted file mode 100644 index b8ebf991879..00000000000 --- a/mozilla/cmd/macfe/restext/exception_str.r +++ /dev/null @@ -1,57 +0,0 @@ - /* - * 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. - */ -//////////////////////////////////////////////////////////////////////////////////////// -// -// exception_str.r -// -// This file contains the strings used by our exception system. Each -// string has a corresponding code associated with it in the file "exception_codes.h". -// These two files should always be in synch. -// -// These strings are used in an alert where the default text is : -// "Your last command could not be completed because ^0. Error number ^1". -// The strings are substituted for the first argument ( ^0 ). -// -////////////////////////////////////////////////////////////////////////// -// -// When Who What -// ----- ---- ----- -// -// 1/6/97 piro Genesis -// -////////////////////////////////////////////////////////////////////////// - -#include "Types.r" -#include "SysTypes.r" -#include "exception_codes.h" - -// ¥Êgeneric exceptions -resource 'STR#' ( genericExStringsID, "Generic exceptions" ) {{ - "of an unknown error", // 1 - "a missing resource" // 2 -}}; - -// ¥Êbrowser exceptions -resource 'STR#' ( browserExStringsID, "Browser exceptions" ) {{ - "of an unknown browser error" // 1 -}}; - -// ¥Êmail exceptions -resource 'STR#' ( mailExStringsID, "Mail exceptions" ) {{ - "of an unknown mail error", // 1 - "the preference is missing" // 2 -}}; diff --git a/mozilla/cmd/macfe/restext/java.r b/mozilla/cmd/macfe/restext/java.r deleted file mode 100644 index 1b9be74f4f7..00000000000 --- a/mozilla/cmd/macfe/restext/java.r +++ /dev/null @@ -1,473 +0,0 @@ - /* - * 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. - */ -data 'WIND' (2050, "Default AWT Frame (Not Secure)") { - $"002A 0004 0162 01AC 0004 0000 01FF 0000" /* .*...b.¬.....ÿ.. */ - $"0000 0855 6E74 6974 6C65 6400 0000" /* ...Untitled... */ -}; - -data 'WIND' (2051, "Default AWT Frame (Grow, Not Secure)") { - $"002A 0004 0162 01AC 0000 0000 01FF 0000" /* .*...b.¬.....ÿ.. */ - $"0000 0855 6E74 6974 6C65 6400 0000" /* ...Untitled... */ -}; - -data 'WIND' (2054, "Default AWT Window (Not Secure)") { - $"002A 0004 0162 01AC 0003 0000 0000 0000" /* .*...b.¬........ */ - $"0000 0855 6E74 6974 6C65 6400 300A" /* ...Untitled.0. */ -}; - -data 'WIND' (2055, "Default AWT Window (Grow, Not Secure)") { - $"002A 0004 0162 01AC 0003 0000 0000 0000" /* .*...b.¬........ */ - $"0000 0855 6E74 6974 6C65 6400 300A" /* ...Untitled.0. */ -}; - -data 'WIND' (2058, "Default AWT Dialog (Not Secure)") { - $"002A 0004 0162 01AC 0005 0000 0000 0000" /* .*...b.¬........ */ - $"0000 0855 6E74 6974 6C65 6400 300A" /* ...Untitled.0. */ -}; - -data 'WIND' (2059, "Default AWT Dialog (Grow, Not Secure)") { - $"002A 0004 0162 01AC 0005 0000 0000 0000" /* .*...b.¬........ */ - $"0000 0855 6E74 6974 6C65 6400 300A" /* ...Untitled.0. */ -}; - -data 'PPob' (2050, "Default AWT Frame (Not Secure)") { - $"0002 646F 706C 4D77 696E 6F62 6A64 0000" /* ..doplMwinobjd.. */ - $"001C 7769 6E64 0802 0002 1860 0000 0000" /* ..wind.....`.... */ - $"0000 FFFF FFFF FFFF FFFF 0000 0000 6265" /* ..ÿÿÿÿÿÿÿÿ....be */ - $"6773 646F 706C 754A 706E 6F62 6A64 0000" /* gsdopluJpnobjd.. */ - $"0022 7061 6E65 754A 706E 01A8 000F 0101" /* ."paneuJpn.¨.... */ - $"0100 0101 0000 0000 0000 0129 0000 0000" /* ...........).... */ - $"FFFF FFFF 646F 706C 4D66 7072 6F62 6A64" /* ÿÿÿÿdoplMfprobjd */ - $"0000 003C 7669 6577 6A61 7661 01A8 0129" /* ...ÌÌ33™™ */ - $"003F CCCC 3333 6666 0040 CCCC 3333 3333" /* .?ÌÌ33ff.@ÌÌ3333 */ - $"0041 CCCC 3333 0000 0042 CCCC 0000 FFFF" /* .AÌÌ33...BÌÌ..ÿÿ */ - $"0043 CCCC 0000 CCCC 0044 CCCC 0000 9999" /* .CÌÌ..ÌÌ.DÌÌ..™™ */ - $"0045 CCCC 0000 6666 0046 CCCC 0000 3333" /* .EÌÌ..ff.FÌÌ..33 */ - $"0047 CCCC 0000 0000 0048 9999 FFFF FFFF" /* .GÌÌ.....H™™ÿÿÿÿ */ - $"0049 9999 FFFF CCCC 004A 9999 FFFF 9999" /* .I™™ÿÿÌÌ.J™™ÿÿ™™ */ - $"004B 9999 FFFF 6666 004C 9999 FFFF 3333" /* .K™™ÿÿff.L™™ÿÿ33 */ - $"004D 9999 FFFF 0000 004E 9999 CCCC FFFF" /* .M™™ÿÿ...N™™ÌÌÿÿ */ - $"004F 9999 CCCC CCCC 0050 9999 CCCC 9999" /* .O™™ÌÌÌÌ.P™™ÌÌ™™ */ - $"0051 9999 CCCC 6666 0052 9999 CCCC 3333" /* .Q™™ÌÌff.R™™ÌÌ33 */ - $"0053 9999 CCCC 0000 0054 9999 9999 FFFF" /* .S™™ÌÌ...T™™™™ÿÿ */ - $"0055 9999 9999 CCCC 0056 9999 9999 9999" /* .U™™™™ÌÌ.V™™™™™™ */ - $"0057 9999 9999 6666 0058 9999 9999 3333" /* .W™™™™ff.X™™™™33 */ - $"0059 9999 9999 0000 005A 9999 6666 FFFF" /* .Y™™™™...Z™™ffÿÿ */ - $"005B 9999 6666 CCCC 005C 9999 6666 9999" /* .[™™ffÌÌ.\™™ff™™ */ - $"005D 9999 6666 6666 005E 9999 6666 3333" /* .]™™ffff.^™™ff33 */ - $"005F 9999 6666 0000 0060 9999 3333 FFFF" /* ._™™ff...`™™33ÿÿ */ - $"0061 9999 3333 CCCC 0062 9999 3333 9999" /* .a™™33ÌÌ.b™™33™™ */ - $"0063 9999 3333 6666 0064 9999 3333 3333" /* .c™™33ff.d™™3333 */ - $"0065 9999 3333 0000 0066 9999 0000 FFFF" /* .e™™33...f™™..ÿÿ */ - $"0067 9999 0000 CCCC 0068 9999 0000 9999" /* .g™™..ÌÌ.h™™..™™ */ - $"0069 9999 0000 6666 006A 9999 0000 3333" /* .i™™..ff.j™™..33 */ - $"006B 9999 0000 0000 006C 6666 FFFF FFFF" /* .k™™.....lffÿÿÿÿ */ - $"006D 6666 FFFF CCCC 006E 6666 FFFF 9999" /* .mffÿÿÌÌ.nffÿÿ™™ */ - $"006F 6666 FFFF 6666 0070 6666 FFFF 3333" /* .offÿÿff.pffÿÿ33 */ - $"0071 6666 FFFF 0000 0072 6666 CCCC FFFF" /* .qffÿÿ...rffÌÌÿÿ */ - $"0073 6666 CCCC CCCC 0074 6666 CCCC 9999" /* .sffÌÌÌÌ.tffÌÌ™™ */ - $"0075 6666 CCCC 6666 0076 6666 CCCC 3333" /* .uffÌÌff.vffÌÌ33 */ - $"0077 6666 CCCC 0000 0078 6666 9999 FFFF" /* .wffÌÌ...xff™™ÿÿ */ - $"0079 6666 9999 CCCC 007A 6666 9999 9999" /* .yff™™ÌÌ.zff™™™™ */ - $"007B 6666 9999 6666 007C 6666 9999 3333" /* .{ff™™ff.|ff™™33 */ - $"007D 6666 9999 0000 007E 6666 6666 FFFF" /* .}ff™™...~ffffÿÿ */ - $"007F 6666 6666 CCCC 0080 6666 6666 9999" /* ..ffffÌÌ.€ffff™™ */ - $"0081 6666 6666 6666 0082 6666 6666 3333" /* .ffffff.‚ffff33 */ - $"0083 6666 6666 0000 0084 6666 3333 FFFF" /* .ƒffff...„ff33ÿÿ */ - $"0085 6666 3333 CCCC 0086 6666 3333 9999" /* .…ff33ÌÌ.†ff33™™ */ - $"0087 6666 3333 6666 0088 6666 3333 3333" /* .‡ff33ff.ˆff3333 */ - $"0089 6666 3333 0000 008A 6666 0000 FFFF" /* .‰ff33...Šff..ÿÿ */ - $"008B 6666 0000 CCCC 008C 6666 0000 9999" /* .‹ff..ÌÌ.Œff..™™ */ - $"008D 6666 0000 6666 008E 6666 0000 3333" /* .ff..ff.Žff..33 */ - $"008F 6666 0000 0000 0090 3333 FFFF FFFF" /* .ff.....33ÿÿÿÿ */ - $"0091 3333 FFFF CCCC 0092 3333 FFFF 9999" /* .‘33ÿÿÌÌ.’33ÿÿ™™ */ - $"0093 3333 FFFF 6666 0094 3333 FFFF 3333" /* .“33ÿÿff.”33ÿÿ33 */ - $"0095 3333 FFFF 0000 0096 3333 CCCC FFFF" /* .•33ÿÿ...–33ÌÌÿÿ */ - $"0097 3333 CCCC CCCC 0098 3333 CCCC 9999" /* .—33ÌÌÌÌ.˜33ÌÌ™™ */ - $"0099 3333 CCCC 6666 009A 3333 CCCC 3333" /* .™33ÌÌff.š33ÌÌ33 */ - $"009B 3333 CCCC 0000 009C 3333 9999 FFFF" /* .›33ÌÌ...œ33™™ÿÿ */ - $"009D 3333 9999 CCCC 009E 3333 9999 9999" /* .33™™ÌÌ.ž33™™™™ */ - $"009F 3333 9999 6666 00A0 3333 9999 3333" /* .Ÿ33™™ff. 33™™33 */ - $"00A1 3333 9999 0000 00A2 3333 6666 FFFF" /* .¡33™™...¢33ffÿÿ */ - $"00A3 3333 6666 CCCC 00A4 3333 6666 9999" /* .£33ffÌÌ.¤33ff™™ */ - $"00A5 3333 6666 6666 00A6 3333 6666 3333" /* .¥33ffff.¦33ff33 */ - $"00A7 3333 6666 0000 00A8 3333 3333 FFFF" /* .§33ff...¨3333ÿÿ */ - $"00A9 3333 3333 CCCC 00AA 3333 3333 9999" /* .©3333ÌÌ.ª3333™™ */ - $"00AB 3333 3333 6666 00AC 3333 3333 3333" /* .«3333ff.¬333333 */ - $"00AD 3333 3333 0000 00AE 3333 0000 FFFF" /* .­3333...®33..ÿÿ */ - $"00AF 3333 0000 CCCC 00B0 3333 0000 9999" /* .¯33..ÌÌ.°33..™™ */ - $"00B1 3333 0000 6666 00B2 3333 0000 3333" /* .±33..ff.²33..33 */ - $"00B3 3333 0000 0000 00B4 0000 FFFF FFFF" /* .³33.....´..ÿÿÿÿ */ - $"00B5 0000 FFFF CCCC 00B6 0000 FFFF 9999" /* .µ..ÿÿÌÌ.¶..ÿÿ™™ */ - $"00B7 0000 FFFF 6666 00B8 0000 FFFF 3333" /* .·..ÿÿff.¸..ÿÿ33 */ - $"00B9 0000 FFFF 0000 00BA 0000 CCCC FFFF" /* .¹..ÿÿ...º..ÌÌÿÿ */ - $"00BB 0000 CCCC CCCC 00BC 0000 CCCC 9999" /* .»..ÌÌÌÌ.¼..ÌÌ™™ */ - $"00BD 0000 CCCC 6666 00BE 0000 CCCC 3333" /* .½..ÌÌff.¾..ÌÌ33 */ - $"00BF 0000 CCCC 0000 00C0 0000 9999 FFFF" /* .¿..ÌÌ...À..™™ÿÿ */ - $"00C1 0000 9999 CCCC 00C2 0000 9999 9999" /* .Á..™™ÌÌ.Â..™™™™ */ - $"00C3 0000 9999 6666 00C4 0000 9999 3333" /* .Ã..™™ff.Ä..™™33 */ - $"00C5 0000 9999 0000 00C6 0000 6666 FFFF" /* .Å..™™...Æ..ffÿÿ */ - $"00C7 0000 6666 CCCC 00C8 0000 6666 9999" /* .Ç..ffÌÌ.È..ff™™ */ - $"00C9 0000 6666 6666 00CA 0000 6666 3333" /* .É..ffff.Ê..ff33 */ - $"00CB 0000 6666 0000 00CC 0000 3333 FFFF" /* .Ë..ff...Ì..33ÿÿ */ - $"00CD 0000 3333 CCCC 00CE 0000 3333 9999" /* .Í..33ÌÌ.Î..33™™ */ - $"00CF 0000 3333 6666 00D0 0000 3333 3333" /* .Ï..33ff.Ð..3333 */ - $"00D1 0000 3333 0000 00D2 0000 0000 FFFF" /* .Ñ..33...Ò....ÿÿ */ - $"00D3 0000 0000 CCCC 00D4 0000 0000 9999" /* .Ó....ÌÌ.Ô....™™ */ - $"00D5 0000 0000 6666 00D6 0000 0000 3333" /* .Õ....ff.Ö....33 */ - $"00D7 EEEE 0000 0000 00D8 DDDD 0000 0000" /* .×îî.....ØÝÝ.... */ - $"00D9 BBBB 0000 0000 00DA AAAA 0000 0000" /* .Ù»».....Úªª.... */ - $"00DB 8888 0000 0000 00DC 7777 0000 0000" /* .Ûˆˆ.....Üww.... */ - $"00DD 5555 0000 0000 00DE 4444 0000 0000" /* .ÝUU.....ÞDD.... */ - $"00DF 2222 0000 0000 00E0 1111 0000 0000" /* .ß"".....à...... */ - $"00E1 0000 EEEE 0000 00E2 0000 DDDD 0000" /* .á..îî...â..ÝÝ.. */ - $"00E3 0000 BBBB 0000 00E4 0000 AAAA 0000" /* .ã..»»...ä..ªª.. */ - $"00E5 0000 8888 0000 00E6 0000 7777 0000" /* .å..ˆˆ...æ..ww.. */ - $"00E7 0000 5555 0000 00E8 0000 4444 0000" /* .ç..UU...è..DD.. */ - $"00E9 0000 2222 0000 00EA 0000 1111 0000" /* .é..""...ê...... */ - $"00EB 0000 0000 EEEE 00EC 0000 0000 DDDD" /* .ë....îî.ì....ÝÝ */ - $"00ED 0000 0000 BBBB 00EE 0000 0000 AAAA" /* .í....»».î....ªª */ - $"00EF 0000 0000 8888 00F0 0000 0000 7777" /* .ï....ˆˆ.ð....ww */ - $"00F1 0000 0000 5555 00F2 0000 0000 4444" /* .ñ....UU.ò....DD */ - $"00F3 0000 0000 2222 00F4 0000 0000 1111" /* .ó...."".ô...... */ - $"00F5 EEEE EEEE EEEE 00F6 DDDD DDDD DDDD" /* .õîîîîîî.öÝÝÝÝÝÝ */ - $"00F7 BBBB BBBB BBBB 00F8 AAAA AAAA AAAA" /* .÷»»»»»».øªªªªªª */ - $"00F9 8888 8888 8888 00FA 7777 7777 7777" /* .ùˆˆˆˆˆˆ.úwwwwww */ - $"00FB 5555 5555 5555 00FC 4444 4444 4444" /* .ûUUUUUU.üDDDDDD */ - $"00FD 2222 2222 2222 00FE 1111 1111 1111" /* .ý"""""".þ...... */ - $"00FF 0000 0000 0000" /* .ÿ...... */ -}; - -data 'ALRT' (-5668) { - $"006F 0048 00D2 019C E9DC 5555 300A" /* .o.H.Ò.œéÜUU0. */ -}; - -data 'ALRT' (-5669) { - $"006F 0048 00D2 019C E9DB 5555 300A" /* .o.H.Ò.œéÛUU0. */ -}; - -data 'DITL' (-5668) { - $"0002 0000 0000 0046 010E 005A 0148 0402" /* .......F...Z.H.. */ - $"4F4B 0000 0000 0009 003C 003E 014A 8856" /* OK.....Æ.<.>.JˆV */ - $"4A61 7661 2063 616E 6E6F 7420 6265 2069" /* Java cannot be i */ - $"6E69 7469 616C 697A 6564 2062 6563 6175" /* nitialized becau */ - $"7365 2074 6865 2077 726F 6E67 2076 6572" /* se the wrong ver */ - $"7369 6F6E 206F 6620 7468 6520 6A61 7661" /* sion of the java */ - $"5F33 3020 6669 6C65 2069 7320 696E 7374" /* _30 file is inst */ - $"616C 6C65 642E 0000 0000 000B 000A 002B" /* alled..........+ */ - $"002A A002 0002" /* .* ... */ -}; - -data 'DITL' (-5669) { - $"0002 0000 0000 0046 010E 005A 0148 0402" /* .......F...Z.H.. */ - $"4F4B 0000 0000 0009 003C 003E 014A 884F" /* OK.....Æ.<.>.JˆO */ - $"4A61 7661 2063 616E 6E6F 7420 6265 2069" /* Java cannot be i */ - $"6E69 7469 616C 697A 6564 2062 6563 6175" /* nitialized becau */ - $"7365 2074 6865 206A 6176 615F 3330 2066" /* se the java_30 f */ - $"696C 6520 6973 206E 6F74 2069 6E73 7461" /* ile is not insta */ - $"6C6C 6564 2063 6F72 7265 6374 6C79 2E00" /* lled correctly.. */ - $"0000 0000 000B 000A 002B 002A A002 0002" /* .........+.* ... */ -}; - -data 'Envi' (128) { - $"434F 4E53 4F4C 455F 4C4F 475F 4E41 4D45" /* CONSOLE_LOG_NAME */ - $"3D43 6F6E 736F 6C65 204C 6F67 0D43 4C41" /* =Console LogÂCLA */ - $"5353 5041 5448 3D2F 7573 722F 6C6F 6361" /* SSPATH=/usr/loca */ - $"6C2F 6E65 7473 6361 7065 2F6A 6176 612F" /* l/netscape/java/ */ - $"4C69 622F 6A61 7661 5F33 303A 2F75 7372" /* Lib/java_30:/usr */ - $"2F6C 6F63 616C 2F6E 6574 7363 6170 652F" /* /local/netscape/ */ - $"6A61 7661 2F4C 6962 2F6A 6176 6163 2E7A" /* java/Lib/javac.z */ - $"6970 3A2F 7573 722F 6C6F 6361 6C2F 6E65" /* ip:/usr/local/ne */ - $"7473 6361 7065 2F6A 6176 612F 6E65 7473" /* tscape/java/nets */ - $"6361 7065 2D63 6C61 7373 6573 3A0D 4445" /* cape-classes:ÂDE */ - $"4641 554C 5443 4C41 5353 5041 5448 3D2F" /* FAULTCLASSPATH=/ */ - $"7573 722F 6C6F 6361 6C2F 6E65 7473 6361" /* usr/local/netsca */ - $"7065 2F6A 6176 612F 4C69 622F 6A61 7661" /* pe/java/Lib/java */ - $"5F33 303A 2F75 7372 2F6C 6F63 616C 2F6E" /* _30:/usr/local/n */ - $"6574 7363 6170 652F 6A61 7661 2F4E 5350" /* etscape/java/NSP */ - $"525F 4C4F 475F 4D4F 4455 4C45 533D 5448" /* R_LOG_MODULES=TH */ - $"5245 4144 3D30 2C4D 4F4E 4954 4F52 3D30" /* READ=0,MONITOR=0 */ - $"2C53 4348 4544 3D30 2C43 4C4F 434B 3D30" /* ,SCHED=0,CLOCK=0 */ - $"2C47 433D 302C 494F 3D30 2C4E 4554 4C49" /* ,GC=0,IO=0,NETLI */ - $"423D 302C 4E53 4A41 5641 3D30 2C4D 4554" /* B=0,NSJAVA=0,MET */ - $"484F 4453 3D30 2C0D 4E53 5F45 4E41 424C" /* HODS=0,ÂNS_ENABL */ - $"455F 4D4F 4A41 3D31 0D2F 2F4E 535F 454E" /* E_MOJA=1Â//NS_EN */ - $"4142 4C45 5F54 4149 4E54 3D31 0D" /* ABLE_TAINT=1 */ -}; - -data 'µMWC' (32000) { -}; - diff --git a/mozilla/cmd/macfe/restext/koi8r.r b/mozilla/cmd/macfe/restext/koi8r.r deleted file mode 100644 index 7ed147a7921..00000000000 --- a/mozilla/cmd/macfe/restext/koi8r.r +++ /dev/null @@ -1,154 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" -data 'xlat' ( xlat_KOI8_R_TO_MAC_CYRILLIC, "KOI8_R -> MAC_CYRILLIC",purgeable){ -/* Translation koi8r.txt -> MacOS_Cyrillic.txt */ -/* 80 is unmap !!! */ -/* 81 is unmap !!! */ -/* 82 is unmap !!! */ -/* 83 is unmap !!! */ -/* 84 is unmap !!! */ -/* 85 is unmap !!! */ -/* 86 is unmap !!! */ -/* 87 is unmap !!! */ -/* 88 is unmap !!! */ -/* 89 is unmap !!! */ -/* 8A is unmap !!! */ -/* 8B is unmap !!! */ -/* 8C is unmap !!! */ -/* 8D is unmap !!! */ -/* 8E is unmap !!! */ -/* 8F is unmap !!! */ -/* 90 is unmap !!! */ -/* 91 is unmap !!! */ -/* 92 is unmap !!! */ -/* 93 is unmap !!! */ -/* 94 is unmap !!! */ -/* 95 is unmap !!! */ -/* 9B is unmap !!! */ -/* 9D is unmap !!! */ -/* 9E is unmap !!! */ -/* A0 is unmap !!! */ -/* A1 is unmap !!! */ -/* A2 is unmap !!! */ -/* A4 is unmap !!! */ -/* A5 is unmap !!! */ -/* A6 is unmap !!! */ -/* A7 is unmap !!! */ -/* A8 is unmap !!! */ -/* A9 is unmap !!! */ -/* AA is unmap !!! */ -/* AB is unmap !!! */ -/* AC is unmap !!! */ -/* AD is unmap !!! */ -/* AE is unmap !!! */ -/* AF is unmap !!! */ -/* B0 is unmap !!! */ -/* B1 is unmap !!! */ -/* B2 is unmap !!! */ -/* B4 is unmap !!! */ -/* B5 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* B8 is unmap !!! */ -/* B9 is unmap !!! */ -/* BA is unmap !!! */ -/* BB is unmap !!! */ -/* BC is unmap !!! */ -/* BD is unmap !!! */ -/* BE is unmap !!! */ -/* There are total 54 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" -/*9x*/ $"9091 9293 9495 C3C5 B2B3 CA9B A19D 9ED6" -/*Ax*/ $"A0A1 A2DE A4A5 A6A7 A8A9 AAAB ACAD AEAF" -/*Bx*/ $"B0B1 B2DD B4B5 B6B7 B8B9 BABB BCBD BEA9" -/*Cx*/ $"FEE0 E1F6 E4E5 F4E3 F5E8 E9EA EBEC EDEE" -/*Dx*/ $"EFDF F0F1 F2F3 E6E2 FCFB E7F8 FDF9 F7FA" -/*Ex*/ $"9E80 8196 8485 9483 9588 898A 8B8C 8D8E" -/*Fx*/ $"8F9F 9091 9293 8682 9C9B 8798 9D99 979A" -}; - -data 'xlat' ( xlat_MAC_CYRILLIC_TO_KOI8_R, "MAC_CYRILLIC -> KOI8_R",purgeable){ -/* Translation MacOS_Cyrillic.txt -> koi8r.txt */ -/* A0 is unmap !!! */ -/* A2 is unmap !!! */ -/* A3 is unmap !!! */ -/* A4 is unmap !!! */ -/* A5 is unmap !!! */ -/* A6 is unmap !!! */ -/* A7 is unmap !!! */ -/* A8 is unmap !!! */ -/* AA is unmap !!! */ -/* AB is unmap !!! */ -/* AC is unmap !!! */ -/* AD is unmap !!! */ -/* AE is unmap !!! */ -/* AF is unmap !!! */ -/* B0 is unmap !!! */ -/* B1 is unmap !!! */ -/* B4 is unmap !!! */ -/* B5 is unmap !!! */ -/* B6 is unmap !!! */ -/* B7 is unmap !!! */ -/* B8 is unmap !!! */ -/* B9 is unmap !!! */ -/* BA is unmap !!! */ -/* BB is unmap !!! */ -/* BC is unmap !!! */ -/* BD is unmap !!! */ -/* BE is unmap !!! */ -/* BF is unmap !!! */ -/* C0 is unmap !!! */ -/* C1 is unmap !!! */ -/* C2 is unmap !!! */ -/* C4 is unmap !!! */ -/* C6 is unmap !!! */ -/* C7 is unmap !!! */ -/* C8 is unmap !!! */ -/* C9 is unmap !!! */ -/* CB is unmap !!! */ -/* CC is unmap !!! */ -/* CD is unmap !!! */ -/* CE is unmap !!! */ -/* CF is unmap !!! */ -/* D0 is unmap !!! */ -/* D1 is unmap !!! */ -/* D2 is unmap !!! */ -/* D3 is unmap !!! */ -/* D4 is unmap !!! */ -/* D5 is unmap !!! */ -/* D7 is unmap !!! */ -/* D8 is unmap !!! */ -/* D9 is unmap !!! */ -/* DA is unmap !!! */ -/* DB is unmap !!! */ -/* DC is unmap !!! */ -/* FF is unmap !!! */ -/* There are total 54 character unmap !! */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"E1E2 F7E7 E4E5 F6FA E9EA EBEC EDEE EFF0" -/*9x*/ $"F2F3 F4F5 E6E8 E3FE FBFD FFF9 F8FC E0F1" -/*Ax*/ $"A09C A2A3 A4A5 A6A7 A8BF AAAB ACAD AEAF" -/*Bx*/ $"B0B1 9899 B4B5 B6B7 B8B9 BABB BCBD BEBF" -/*Cx*/ $"C0C1 C296 C497 C6C7 C8C9 9ACB CCCD CECF" -/*Dx*/ $"D0D1 D2D3 D4D5 9FD7 D8D9 DADB DCB3 A3D1" -/*Ex*/ $"C1C2 D7C7 C4C5 D6DA C9CA CBCC CDCE CFD0" -/*Fx*/ $"D2D3 D4D5 C6C8 C3DE DBDD DFD9 D8DC C0FF" -}; - diff --git a/mozilla/cmd/macfe/restext/lang.r b/mozilla/cmd/macfe/restext/lang.r deleted file mode 100644 index d27cb2eb113..00000000000 --- a/mozilla/cmd/macfe/restext/lang.r +++ /dev/null @@ -1,162 +0,0 @@ - /* - * 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 -#undef BETA -#undef ALPHA -#include -#include "csid.h" - -/* STR# 5028 and STR# 5029 should have the same sequence */ -/* We need to localize 5028, but not 5029 */ -resource 'STR#' (5028, "Language/Region in Human Readable Form", purgeable) {{ - "English", - "English/United States", - "English/United Kingdom", - "French", - "French/France", - "French/Canada", - "French/Belgium", - "French/Switzerland", - "German", - "German/Germany", - "German/Austria", - "German/Switzerland", - "Japanese", - "Chinese", - "Chinese/China", - "Chinese/Taiwan", - "Korean", - "Italian", - "Spanish", - "Spanish/Spain", - "Spanish/Argentina", - "Spanish/Colombia", - "Spanish/Mexico", - "Portuguese", - "Portuguese/Brazil", - "Afrikaans", - "Albanian", - "Basque", - "Catalan", - "Danish", - "Dutch", - "Dutch/Belgium", - "Faeroese", - "Finnish", - "Galician", - "Icelandic", - "Indonesian", - "Irish", - "Scots Gaelic", - "Norwegian", - "Swedish", - "Croatian", - "Czech", - "Hungarian", - "Polish", - "Romanian", - "Slovak", - "Slovenian", - "Bulgarian", - "Byelorussian", - "Macedonian", - "Russian", - "Serbian", - "Ukrainian", - "Greek", - "Turkish" - -}}; -resource 'STR#' (5029, "Language/Region in ISO639-ISO3166 code", purgeable) {{ - "en", - "en-US", - "en-GB", - "fr", - "fr-FR", - "fr-CA", - "fr-BE", - "fr-CH", - "de", - "de-DE", - "de-AU", - "de-CH", - "ja", - "zh", - "zh-CN", - "zh-TW", - "ko", - "it", - "es", - "es-ES", - "es-AR", - "es-CO", - "es-MX", - "pt", - "pt-BR", - "af", - "sq", - "eu", - "ca", - "da", - "nl", - "nl-BE", - "fo", - "fi", - "gl", - "is", - "id", - "ga", - "gd", - "no", - "sv", - "hr", - "cs", - "hu", - "pl", - "ro", - "sk", - "sl", - "bg", - "be", - "mk", - "ru", - "sr", - "uk", - "el", - "tr" - -}}; - -/* CSID List for Unicode Font */ -type 'UCSL' { - integer = $$CountOf(table); - wide array table { - unsigned integer; /* Just an int16 */ - }; -}; - -resource 'UCSL' (0, "CSID List for Unicode Font", purgeable) {{ - CS_MAC_ROMAN, - CS_SJIS, - CS_BIG5, - CS_GB_8BIT, - CS_CNS_8BIT, - CS_KSC_8BIT, - CS_MAC_CE, - CS_SYMBOL, - CS_DINGBATS -}}; diff --git a/mozilla/cmd/macfe/restext/license.r b/mozilla/cmd/macfe/restext/license.r deleted file mode 100644 index 2d84c319f3d..00000000000 --- a/mozilla/cmd/macfe/restext/license.r +++ /dev/null @@ -1,46 +0,0 @@ - /* - * 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 "resgui.h" // main window constants - -#ifdef ALPHA -// read 'TEXT' (ABOUT_LICENSE, "Export License", purgeable, protected ) "::xp:LICENSE-alpha"; - -#elif defined (BETA) - - #ifdef EXPORT_VERSION -// read 'TEXT' (ABOUT_LICENSE, "Export License", purgeable, protected ) "::xp:LICENSE-export-beta"; - #else -// read 'TEXT' (ABOUT_LICENSE, "U.S. License", purgeable, protected ) "::xp:LICENSE-us-beta"; - #endif - -#else /* Final release */ - - #ifdef NET - #ifdef EXPORT_VERSION -// read 'TEXT' (ABOUT_LICENSE, "Export License", purgeable, protected ) "::xp:LICENSE-export-net"; - #else -// read 'TEXT' (ABOUT_LICENSE, "U.S. License", purgeable, protected ) "::xp:LICENSE-us-net"; - #endif - #else /* RETAIL */ - #ifdef EXPORT_VERSION -// read 'TEXT' (ABOUT_LICENSE, "Export License", purgeable, protected ) "::xp:LICENSE-export"; - #else -// read 'TEXT' (ABOUT_LICENSE, "U.S. License", purgeable, protected ) "::xp:LICENSE-us"; - #endif - #endif -#endif diff --git a/mozilla/cmd/macfe/restext/macfe.r b/mozilla/cmd/macfe/restext/macfe.r deleted file mode 100644 index abce705f1c2..00000000000 --- a/mozilla/cmd/macfe/restext/macfe.r +++ /dev/null @@ -1,469 +0,0 @@ - /* - * 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 "PowerPlant.r" -#include "Types.r" -#undef ALPHA -#undef BETA -#include "SysTypes.r" - -#include "resae.h" // Apple event constants -#include "resgui.h" // main window constants -#include "mversion.h" // version numbers, application name, etc -#include "csid.h" - -// Use the Mercutio MDEF -#define nsMenuProc 19999 - -resource 'MENU' ( 666, "Mercutio Menu" ) -{ - 666, nsMenuProc, 0, 0, "View", {} -}; - - -type 'LONG' { - array LongEntries { - longint; /* Just an int32 */ - }; -}; - -// contain boolean values -type 'BOOL' { - array BooleanEntries { - byte; /* boolean values */ - }; -}; - -type 'MIME' { - literal longint; /* Application signature */ - literal longint; /* File type */ - byte; /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - pstring; /* Application name */ - pstring; /* Mime type */ - pstring; /* extension */ -}; - -type 'SMIM' { - literal longint; /* Application signature */ - literal longint; /* File Type */ - byte; /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - pstring; /* Application name */ - pstring; /* Mime type */ - pstring; /* extension */ -}; - - - -type 'Fnec' { - integer = $$CountOf(FnecEntries); - wide array FnecEntries { - pstring[31]; /* Language Group Name */ - pstring[31]; /* proportional font name */ - pstring[31]; /* fixed font name */ - unsigned integer; /* proportional font size */ - unsigned integer; /* fixed font size */ - unsigned integer; /* character set encoding ID */ - integer Script; /* script id of font fallback */ - unsigned integer; /* res id for Txtr Button */ - unsigned integer; /* res id for Txtr Text Field */ - }; -}; - -/* maps command numbers to cs id's */ -type 'Csid' { - integer = $$CountOf(table); - wide array table { - unsigned integer; /* win_csid */ - unsigned integer; /* doc_csid */ - longint; /* CmdNum */ - }; -}; - - - -#include "custom.r" - -/*----------------------------------------------------------------------------- - These are all standard PowerPlant resources which we are modifying. - Anything which we add which is not a replacement is in a different file. ------------------------------------------------------------------------------*/ - -resource 'STR#' (200, "Standards", purgeable) {{ - APPLICATION_NAME, // used in Alert boxes - "Save File As:", - "CanÕt Undo" -}}; - - -// ¥ÊOther stuff - -// -- These are the FIXED items in the Help menu. Items that -// may be configured by the Admin Kit are defined in config.js -resource 'STR#' ( HELP_URLS_MENU_STRINGS, "Help URL Menu Entries", purgeable ) {{ - "-", -#ifndef MOZ_COMMUNICATOR_ABOUT - "About Navigator", -#else - "About Communicator", -#endif -}}; - -resource 'STR#' ( HELP_URLS_RESID, "Help URLs", purgeable ) {{ - "", // separator - ABOUT_LOCATION, -}}; - - -resource 'STR#' ( STOP_STRING_LIST, "Stop Strings", purgeable ) {{ - "Stop Loading", - "Stop Animations", -}}; - -resource 'STR#' ( WINDOW_TITLES_RESID, "" ) {{ - "Mail", - "Newsgroups", - "Composer", - "Address Book for ^0", // filled in with profile name - "Bookmarks for ^0", - "Preferences for ^0", -}}; - -// ¥ Note: NEW_DOCUMENT_URL_RESID and DEFAULT_PLUGIN_URL moved to config.js - -resource 'STR#' ( HELPFILES_NAMES_RESID, "" ) {{ - "Navigator Gold Help", // help file name - "Navigator Gold Help Media", // media file name -}}; - -// Generic font family names -resource 'STR#' ( GENERIC_FONT_NAMES_RESID, "Generic Font Names", purgeable ) {{ - "Times", // serif - "Helvetica", // san-serif - "Zapf Chancery", // cursive - "New Century Schlbk", // fantasy (??) - "Courier", // monospace -}}; - -// ¥Ênews group column headers (i18n) -resource 'STR#' ( 4010, "" ) {{ - "Groups Server", - "#3080", // subscribed icon - "Unread", - "Total", -}}; - -// ¥ news and mail article column headers (i18n) -resource 'STR#' ( 4011, "" ) {{ - "Subject", - "#3082", // flag icon - "#3079", // read icon - "Sender", - "Date", - "Recipient", -}}; - -// ¥Êmail folder column headers (i18n) -resource 'STR#' ( 6010, "" ) {{ - "Folder", - "", - "Unread", - "Total", -}}; - -// Miscellaneous JRM-perpetrated strings -resource 'STR#' ( 7099, "" ) {{ - // Terms for the first parameter of the thread window name (Mozilla %s %s) - "Folder" -, "Newsgroup" - // Notification alert -, PROGRAM_NAME" requires your attention at this time." -, "%2.1fMB" // format string for Megabytes -, "%ldK" // format string for Kilobytes -, "%ld" // format string for bytes - // setup not done when trying to create a mail window -, "The command could not be completed, because you have not set up your ^0 preferences." - " Would you like to set up those preferences now?" -, "Message counts unavailable" - // Used by FE_ShowPropertySheetFor() when backend wants to add new entry -, "Create a new card for ^0 in personal address book?" -, "" -, "Message Center for ^0" -, "^0 ^1" // Given name, family name. -, "Not encrypted" -, "Encrypted" -, "Moving Messages" // 15 -, "Loading Folder" // 16 -, "Open Selected Items" -, "Preparing window ^0 of ^1É" // 18 -, "Copying Messages" //19 -, "Bookmark Added" // 20, shown in status bar when dbl-click page proxy. -, "Mail Server" // 21, shown in string #7 above -, "Groups Server" // 22 '' '' '' -, "Identity" // 23 '' '' '' -, "Mail & Groups" // 24 '' '' '' -, "You have changed the mail server type. You must quit and restart Communicator " - "for this to take effect." // 25 -, "Directories" // 26 shown in Offline Picker -}}; - -resource 'STR#' ( 7098, "" ) {{ -// Command could not be completed because ^0. - "there was not enough memory" // 1 -, "of an unknown error" // 2 -, "the disk is full" // 3 -, "a file could not be found" // 4 -, "there is no such folder" // 5 -, "there is no disk by that name" // 6 -, "a file name was too long or contained bad characters" // 7 -, "the disk is locked" // 8 -, "a file was busy and could not be written to" // 9 -, "a file by that name already exists" // 10 -, "a file was already open for writing" // 11 -, "you do not have the correct permission" // 12 -}}; - -// ¥ÊMulti-user profile dialog strings -resource 'STR#' ( 900, "", purgeable ) {{ - "Enter a new name for the profile:", - "Do you want to delete this profile? No files will be removed from your disk.", - "Error reading user profiles: ", - "Error creating profile: ", - "Default Profile", - "The folder for profile Ò^0Ó could not be found. Do you want to locate it?", - "Quit", - "Done", - "Next >", - "The required configuration file Ò" CONFIG_FILENAME "Ó could not be found in " ESSENTIALS_FOLDER ". Please reinstall the software or contact your administrator.", - "The configuration file Ò" CONFIG_FILENAME "Ó is invalid. Please reinstall the software or contact your administrator.", - "Account Setup", - "Create Profile", -}}; - -// ¥ÊBoolean operators and search menu items -resource 'STR#' ( 901, "", purgeable ) {{ - "and", // 1 - "or", // 2 - "CustomizeÉ" // 3 -}}; - -/*----------------------------------------------------------------------------- - Common Stuff ------------------------------------------------------------------------------*/ -/* -#define Script smRoman=0, smJapanese, smTradChinese, smKorean, \ - smArabic, smHebrew, smGreek, smCyrillic, smRSymbol, \ - smDevanagari, smGurmukhi, smGujarati, smOriya, \ - smBengali, smTamil, smTelugu, smKannada, \ - smMalayalam, smSinhalese, smBurmese, smKhmer, \ - smThai, smLaotian, smGeorgian, smArmenian, \ - smSimpChinese, smTibetan, smMongolian, smGeez, \ - smSlavic, smVietnamese, smExtArabic, smUninterp \ -*/ -/* Language Group Proportional Fixed ProportionalFixed Character ScriptID for Txtr Txtr */ -/* Name Font Name Font Name Size Size Set ID Font Fallback ButtonID TextFieldID */ - -resource 'Fnec' (FNEC_RESID, "Font definitation for every encoding", purgeable) { - { - "Western", "Times", "Courier", 12, 10, CS_MAC_ROMAN, smRoman, 4002, 4001; - "Central European", "Times CE", "Courier CE", 12, 10, CS_MAC_CE, smSlavic, 4006, 4005; - "Japanese", "×–¾’©‘Ì", "Osaka|“™•", 12, 12, CS_SJIS, smJapanese, 4004, 4003; - "Traditional Chinese", "Apple LiSung Light", "Taipei", 16, 12, CS_BIG5, smTradChinese, 4008, 4007; - "Simplified Chinese", "Song", "*Beijing*", 16, 12, CS_GB_8BIT, smSimpChinese, 4010, 4009; - "Korean", "AppleGothic", "Seoul", 12, 12, CS_KSC_8BIT, smKorean, 4012, 4011; - "Cyrillic", "ðßìîé ðîï", "ðßìîé", 12, 12, CS_MAC_CYRILLIC, smCyrillic, 4016, 4015; - "Greek", "GrTimes", "GrCourier", 12, 12, CS_MAC_GREEK, smRoman, 4018, 4017; - "Turkish", "Times", "Courier", 12, 10, CS_MAC_TURKISH, smRoman, 4020, 4019; - "Unicode", "Times", "Courier", 12, 10, CS_UTF8, smRoman, 4024, 4023; - "User-Defined", "Times", "Courier", 12, 10, CS_USER_DEFINED_ENCODING, smRoman, 4014, 4013; - } -}; - - -resource 'Csid' (cmd2csid_tbl_ResID, "csIDs", purgeable) { - { - /* win_csid doc_csid cmdNumber */ - CS_MAC_ROMAN, CS_ASCII, cmd_ASCII, - CS_MAC_ROMAN, CS_LATIN1, cmd_LATIN1, - CS_SJIS, CS_JIS, cmd_JIS, - CS_SJIS, CS_SJIS, cmd_SJIS, - CS_SJIS, CS_EUCJP, cmd_EUCJP, - CS_SJIS, CS_SJIS_AUTO, cmd_SJIS_AUTO, - CS_MAC_ROMAN, CS_MAC_ROMAN, cmd_MAC_ROMAN, - CS_MAC_CE, CS_LATIN2, cmd_LATIN2, - CS_MAC_CE, CS_MAC_CE, cmd_MAC_CE, - CS_MAC_CE, CS_CP_1250, cmd_CP1250, - CS_BIG5, CS_BIG5, cmd_BIG5, - CS_BIG5, CS_CNS_8BIT, cmd_CNS_8BIT, - CS_GB_8BIT, CS_GB_8BIT, cmd_GB_8BIT, - CS_KSC_8BIT, CS_KSC_8BIT_AUTO, cmd_KSC_8BIT, - CS_KSC_8BIT, CS_2022_KR, cmd_2022_KR, - - CS_MAC_CYRILLIC, CS_MAC_CYRILLIC, cmd_MAC_CYRILLIC, - CS_MAC_CYRILLIC, CS_8859_5, cmd_8859_5, - CS_MAC_CYRILLIC, CS_CP_1251, cmd_CP1251, - CS_KOI8_R, CS_KOI8_R, cmd_KOI8R, - CS_MAC_GREEK, CS_MAC_GREEK, cmd_MAC_GREEK, - CS_MAC_GREEK, CS_8859_7, cmd_8859_7, - CS_MAC_GREEK, CS_CP_1253, cmd_CP1253, - CS_MAC_TURKISH, CS_MAC_TURKISH, cmd_MAC_TURKISH, - CS_MAC_TURKISH, CS_8859_9, cmd_8859_9, - CS_UTF8, CS_UTF8, cmd_UTF8, - CS_UTF8, CS_UTF7, cmd_UTF7, - CS_USER_DEFINED_ENCODING,CS_USER_DEFINED_ENCODING, cmd_USER_DEFINED_ENCODING - - } -}; - - -/* -- 4.0 xp prefs -- - * Default mime types have been removed from here and - * moved to xp initializers in libpref/src/init/all.js - */ - -resource 'STR ' ( mPREFS_UNSPECIFIED_ERR_ALERT, "Unspecified Error", purgeable ) { - "There was an error. Preferences will not be saved."; -}; - -resource 'STR ' ( mPREFS_CANNOT_OPEN_SECOND_ALERT, "Cant Open Second Prefs File", purgeable ) { - "You cannot open a second preferences file."; -}; - -resource 'STR ' ( mPREFS_CANNOT_OPEN_SECOND_ALERT + 1, "-", purgeable ) { - "Quit "PROGRAM_NAME" and launch by double-clicking on the preferences file you wish to use."; -}; - -resource 'STR ' ( mPREFS_CANNOT_CREATE, "Cant Create Prefs File", purgeable ) { - "The preferences file cannot be created. "PROGRAM_NAME" will use the defaults."; -}; - -resource 'STR ' ( mPREFS_CANNOT_CREATE_PREFS_FOLDER, "Cant Create Prefs Folder", purgeable ) { - "The preferences folder could not be created. "PROGRAM_NAME" will use the defaults."; -}; - -resource 'STR ' ( mPREFS_CANNOT_READ, "Cant Read Preferences", purgeable ) { - "The preferences file cannot be read. "PROGRAM_NAME" will use the defaults."; -}; - -resource 'STR ' ( mPREFS_CANNOT_WRITE, "Cant Write Preferences", purgeable ) { - "There was an error writing the preferences. They will not be saved."; -}; - -resource 'STR ' ( mPREFS_DUPLICATE_MIME, "Duplicate mimetype", purgeable ) { - "The specified MIME type already exists."; -}; - - -// TRANSLATION RESOURCES -/* les tables pour ISO 8859-1 : A. Pirard (ULg) - mai 1992 */ - -data 'xlat' (128, "ISO1 -> MACR", purgeable) { -/* translation ISO 8859-1 -> Macintosh */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"DB2A E2C4 E3C9 A0E0 F6E4 53DC CE2A 2A2A" -/*9x*/ $"2AD4 D5D2 D3A5 D0D1 F7AA 73DD CF2A 2AD9" -/*Ax*/ $"CAC1 A2A3 DBB4 7CA4 ACA9 BBC7 C2D0 A8F8" -/*Bx*/ $"A1B1 3233 ABB5 A6E1 FC31 BCC8 2A2A 2AC0" -/*Cx*/ $"CBE7 E5CC 8081 AE82 E983 E6E8 EDEA EBEC" -/*Dx*/ $"DC84 F1EE EFCD 8578 AFF4 F2F3 86A0 DEA7" -/*Ex*/ $"8887 898B 8A8C BE8D 8F8E 9091 9392 9495" -/*Fx*/ $"DD96 9897 999B 9AD6 BF9D 9C9E 9FE0 DFD8" -}; - - -data 'xlat' (129, "MACR -> ISO1", purgeable) { -/* translation Macintosh -> ISO 8859-1 */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C4C5 C7C9 D1D6 DCE1 E0E2 E4E3 E5E7 E9E8" -/*9x*/ $"EAEB EDEC EEEF F1F3 F2F4 F6F5 FAF9 FBFC" -/*Ax*/ $"DDB0 A2A3 A795 B6DF AEA9 99B4 A82A C6D8" -/*Bx*/ $"2AB1 2A2A A5B5 2A2A 2A2A 2AAA BA2A E6F8" -/*Cx*/ $"BFA1 AC2A 833D 2AAB BB85 A0C0 C3D5 8C9C" -/*Dx*/ $"9697 9394 9192 F72A FF9F 2F80 D0F0 DEFE" -/*Ex*/ $"FDB7 8284 89C2 CAC1 CBC8 CDCE CFCC D3D4" -/*Fx*/ $"2AD2 DADB D969 8898 AF2A B7B0 B82A 2A2A" -}; - - -data 'xlat' (130, "ISO2 -> MACCE", purgeable) { -/* translation 8859-2 -> MacCEuro */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" /* ................ */ -/*9x*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" /* ................ */ -/*Ax*/ $"CA84 FFFC A4BB E5A4 ACE1 53E8 8F2D EBFB" /*  ¡.£.¥¦§¨©.«¬.®¯ */ -/*Bx*/ $"A188 B2B8 27BC E6FF B8E4 73E9 90BD ECFD" /* °±.³.µ¶·.¹.»¼.¾¿ */ -/*Cx*/ $"D9E7 4141 80BD 8C43 8983 A245 9DEA 4991" /* ÀÁ..ÄÅÆ.ÈÉÊ.ÌÍ.Ï */ -/*Dx*/ $"44C1 C5EE EFCC 8578 DBF1 F2F4 86F8 54A7" /* .ÑÒÓÔÕÖ.ØÙÚÛÜÝ.ß */ -/*Ex*/ $"DA87 6161 8ABE 8D63 8B8E AB65 9E92 6993" /* àá..äåæ.èéê.ìí.ï */ -/*Fx*/ $"64C4 CB97 99CE 9AD6 DEF3 9CF5 9FF9 74A1" /* .ñòóôõö÷øùúûüý.. */ -}; - -data 'xlat' (131, "MACCE -> ISO2", purgeable) { -/* translation MacCEuro -> 8859-2 */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C441 61C9 A1D6 DCE1 B1C8 E4E8 C6E6 E9AC" /* €..ƒ„…†‡ˆ‰Š‹ŒŽ */ -/*9x*/ $"BCCF EDEF 4565 45F3 65F4 F66F FACC ECFC" /* ‘’“...—.™š.œžŸ */ -/*Ax*/ $"A0B0 CA4C A72A A6DF 5263 54EA A8AD 6749" /* .¡¢.¤..§...«¬... */ -/*Bx*/ $"6949 B2B3 694B 6445 B34C 6CA5 B5C5 E54E" /* ........¸..»¼½¾. */ -/*Cx*/ $"6ED1 2DC3 F1D2 C63D 3FC9 A0F2 D54F F54F" /* .Á..ÄÅ....ÊËÌ.Î. */ -/*Dx*/ $"2D2D 2222 2727 F7D7 6FC0 E0D8 3D3F F852" /* ......Ö..ÙÚÛ..Þ. */ -/*Ex*/ $"72A9 2C2C B9A6 B6C1 ABBB CDAE BE55 D3D4" /* .á..äåæçèéêëì.îï */ -/*Fx*/ $"75D9 DAF9 DBFB 5575 DDFD 6BAF A3BF 47B7" /* .ñòóôõ..øù.ûüý.ÿ */ -}; - - -/* -read 'Tang' ( ABOUT_BIGLOGO_TANG, "biglogo.gif", purgeable) "biglogo.gif"; // Was splash.gif -read 'Tang' ( ABOUT_JAVALOGO_TANG, "javalogo.gif", purgeable) "javalogo.gif"; -read 'Tang' ( ABOUT_RSALOGO_TANG, "rsalogo.gif", purgeable ) "rsalogo.gif"; -read 'Tang' ( ABOUT_HYPE_TANG, "hype.au", purgeable ) "hype.au"; -read 'Tang' ( ABOUT_QTLOGO_TANG, "qtlogo.gif", purgeable) "qt_logo.gif"; - -read 'Tang' ( ABOUT_INSOLOGO_TANG, "insologo.gif", purgeable) "insologo.gif"; -read 'Tang' ( ABOUT_LITRONIC_TANG, "litronic.gif", purgeable) "litronic.gif"; -read 'Tang' ( ABOUT_MCLOGO_TANG, "mclogo.gif", purgeable) "mclogo.gif"; -read 'Tang' ( ABOUT_MMLOGO_TANG, "mmlogo.gif", purgeable) "mmlogo.gif"; -read 'Tang' ( ABOUT_NCCLOGO_TANG, "ncclogo.gif", purgeable) "ncclogo.gif"; -read 'Tang' ( ABOUT_ODILOGO_TANG, "odilogo.gif", purgeable) "odilogo.gif"; -read 'Tang' ( ABOUT_SYMLOGO_TANG, "symlogo.gif", purgeable) "symlogo.gif"; -read 'Tang' ( ABOUT_TDLOGO_TANG, "tdlogo.gif", purgeable) "tdlogo.gif"; -read 'Tang' ( ABOUT_VISILOGO_TANG, "visilogo.gif", purgeable) "visilogo.gif"; -read 'Tang' ( ABOUT_COSLOGO_TANG, "coslogo.jpg", purgeable) "coslogo.jpg"; -*/ - - -/* NavCenter gifs */ -read 'Tang' ( ABOUT_HISTORYGIF_TANG, "history.gif", purgeable) ":::modules:rdf:images:history.gif"; -read 'Tang' ( ABOUT_PERSONALGIF_TANG, "personal.gif", purgeable) ":::modules:rdf:images:personal.gif"; -read 'Tang' ( ABOUT_SEARCHGIF_TANG, "search.gif", purgeable) ":::modules:rdf:images:search.gif"; -read 'Tang' ( ABOUT_SITEMAPGIF_TANG, "sitemap.gif", purgeable) ":::modules:rdf:images:sitemap.gif"; -read 'Tang' ( ABOUT_FILESGIF_TANG, "file.gif", purgeable) ":::modules:rdf:images:file.gif"; -read 'Tang' ( ABOUT_GUIDEGIF_TANG, "guide.gif", purgeable) ":::modules:rdf:images:guide.gif"; - - -read 'Tang' ( ABOUT_MOZILLA_FLAME, "flamer.gif", purgeable) "flamer.gif"; -read 'TEXT' ( ABOUT_ABOUTPAGE_TEXT, "about-all.html", purgeable ) "about-all.html"; -/* -read 'TEXT' ( ABOUT_AUTHORS_TEXT, "authors.html", purgeable ) "authors2.html"; -*/ -read 'TEXT' ( ABOUT_MOZILLA_TEXT, "mozilla.html", purgeable ) "mozilla.html"; -read 'TEXT' ( ABOUT_PLUGINS_TEXT, "aboutplg.html", purgeable ) "aboutplg.html"; -read 'TEXT' ( ABOUT_MAIL_TEXT, "mail.msg", purgeable ) "mail.msg"; - - -data 'TEXT' ( ABOUT_BLANK_TEXT, purgeable ) -{ - " " -}; // Gone is the glorious "Homey don't play dat!" diff --git a/mozilla/cmd/macfe/restext/mailnewsfe.r b/mozilla/cmd/macfe/restext/mailnewsfe.r deleted file mode 100644 index d55f66a27a3..00000000000 --- a/mozilla/cmd/macfe/restext/mailnewsfe.r +++ /dev/null @@ -1,1048 +0,0 @@ - /* - * 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 -#undef BETA -#undef ALPHA -#include - -#include "resae.h" // Apple event constants -#include "resgui.h" // main window constants -#include "mversion.h" // version numbers, application name, etc -#include "csid.h" - -#include "PowerPlant.r" - -// Use the Mercutio MDEF -#define nsMenuProc 19999 - -resource 'MENU' ( 666, "Mercutio Menu" ) -{ - 666, nsMenuProc, 0, 0, "View", {} -}; - - -type 'LONG' { - array LongEntries { - longint; /* Just an int32 */ - }; -}; - -// contain boolean values -type 'BOOL' { - array BooleanEntries { - byte; /* boolean values */ - }; -}; - -type 'MIME' { - literal longint; /* Application signature */ - literal longint; /* File type */ - byte; /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - pstring; /* Application name */ - pstring; /* Mime type */ - pstring; /* extension */ -}; - -type 'SMIM' { - literal longint; /* Application signature */ - literal longint; /* File Type */ - byte; /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - pstring; /* Application name */ - pstring; /* Mime type */ - pstring; /* extension */ -}; - - - -type 'Fnec' { - integer = $$CountOf(FnecEntries); - wide array FnecEntries { - pstring[31]; /* Language Group Name */ - pstring[31]; /* proportional font name */ - pstring[31]; /* fixed font name */ - unsigned integer; /* proportional font size */ - unsigned integer; /* fixed font size */ - unsigned integer; /* character set encoding ID */ - integer Script; /* script id of font fallback */ - unsigned integer; /* res id for Txtr Button */ - unsigned integer; /* res id for Txtr Text Field */ - }; -}; - -/* maps command numbers to cs id's */ -type 'Csid' { - integer = $$CountOf(table); - wide array table { - unsigned integer; /* win_csid */ - unsigned integer; /* doc_csid */ - longint; /* CmdNum */ - }; -}; - - - -#include "custom.r" - -/*----------------------------------------------------------------------------- - These are all standard PowerPlant resources which we are modifying. - Anything which we add which is not a replacement is in a different file. ------------------------------------------------------------------------------*/ - -resource 'STR#' (200, "Standards", purgeable) {{ - APPLICATION_NAME, // used in Alert boxes - "Save File As:", - "CanÕt Undo" -}}; - - -// ¥ÊOther stuff -resource 'STR#' ( HELP_URLS_MENU_STRINGS, "Help URL Menu Entries", purgeable ) {{ - "About Netscape", - "About Plugins", - "Registration Information", - "(-", - "Handbook", - "Release Notes", - "Frequently Asked Questions", - "On Security", - "(-", - "How to Give Feedback", - "How to Get Support", - "How to Create Web Services", -}}; - -resource 'STR#' ( HELP_URLS_RESID, "Help URLs", purgeable ) {{ - ABOUT_LOCATION, - ABOUT_PLUGINS_LOCATION, - REGISTRATION_LOCATION, - "", - MANUAL_LOCATION, // - VERSION_LOCATION, // release notes - FAQ_LOCATION, // FAQ - HELPONSEC_LOCATION, - "", - FEEDBACK_LOCATION, // FEEDBACK - SUPPORT_LOCATION, - WEBSERVICES_LOCATION, -}}; - -resource 'STR#' ( WINDOW_TITLES_RESID, "" ) {{ - "Mail", - "News", - "Editor", -}}; - -// ¥Ênews group column headers (i18n) -resource 'STR#' ( 4010, "" ) {{ - "News Server", - "#3080", // subscribed icon - "Unread", - "Total", -}}; - -// ¥ news and mail article column headers (i18n) -resource 'STR#' ( 4011, "" ) {{ - "Subject", - "#3082", // flag icon - "#3079", // read icon - "Sender", - "Date", - "Recipient", -}}; - -// ¥Êmail folder column headers (i18n) -resource 'STR#' ( 6010, "" ) {{ - "Folder", - "", - "Unread", - "Total", -}}; - - // central/mailmac.cp user messages - resource 'STR ' ( MAIL_WIN_ERR_RESID + 0, "Create mail window error", purgeable ) { - "Unexpected error while creating Mail/News window" - }; - resource 'STR ' ( MAIL_TOO_LONG_RESID + 0, "Mail text too long", purgeable ) { - "Included text is too long.\rIt has been truncated." - }; - resource 'STR ' ( MAIL_TMP_ERR_RESID + 0, "Mail tmp file error", purgeable ) { - "Could not create a temporary mail file" - }; - resource 'STR ' ( NO_EMAIL_ADDR_RESID + 0, "No email address1", purgeable ) { - "You have not set your email address in \"Preferences\"." - }; - resource 'STR ' ( NO_EMAIL_ADDR_RESID + 1, "No email address2", purgeable ) { - " The recipient of your message will not be able to reply" - }; - resource 'STR ' ( NO_EMAIL_ADDR_RESID + 2, "No email address3", purgeable ) { - " to your mail without it. Please do so before mailing." - }; - resource 'STR ' ( NO_SRVR_ADDR_RESID + 0, "Create Mail Tmp File1", purgeable ) { - "You have not set mail server address in \"Preferences\"." - }; - resource 'STR ' ( NO_SRVR_ADDR_RESID + 1, "Create Mail Tmp File2", purgeable ) { - " You cannot send mail without it.\n" - }; - resource 'STR ' ( NO_SRVR_ADDR_RESID + 2, "Create Mail Tmp File3", purgeable ) { - " Please set it before mailing." - }; - resource 'STR ' ( MAIL_SUCCESS_RESID + 0, "Mail succeeded", purgeable ) { - "Mail was successful" - }; - resource 'STR ' ( MAIL_NOT_SENT_RESID + 0, "Mail not sent", purgeable ) { - "Mail was not sent" - }; - resource 'STR ' ( MAIL_SENDING_RESID + 0, "Mail sending", purgeable ) { - "Sending mailÉ" - }; - resource 'STR ' ( NEWS_POST_RESID + 0, "News post", purgeable ) { - "newspost:" - }; - resource 'STR ' ( MAIL_SEND_ERR_RESID + 0, "Sending mail error", purgeable ) { - "Unexpected error while sending mail" - }; - resource 'STR ' ( MAIL_DELIVERY_ERR_RESID + 0, "Mail delivery error", purgeable ) { - "Mail delivery failed" - }; - resource 'STR ' ( DISCARD_MAIL_RESID + 0, "Discard mail?", purgeable ) { - "Mail has not been sent yet.\rAre you sure that you want to discard your mail message?" - }; - resource 'STR ' ( SECURITY_LEVEL_RESID + 0, "Security level", purgeable ) { - "This version supports %s security with %s." - }; - resource 'STR ' ( NO_MEM_LOAD_ERR_RESID + 0, "No memory on load", purgeable ) { - "Load has been interrupted because Netscape has run out of memory. You might want to increase its memory partition, or quit other applications to alleviate this problem." - }; - resource 'STR ' ( EXT_PROGRESS_RESID + 0, "Progress via ext app", purgeable ) { - "Progress displayed in external application" - }; - resource 'STR ' ( REVERT_PROGRESS_RESID + 0, "Revert progress to Netscape", purgeable ) { - "Reverting progress to Netscape" - }; - resource 'STR ' ( START_LOAD_RESID + 0, "Start load", purgeable ) { - "Start loading" - }; - resource 'STR ' ( NO_XACTION_RESID + 0, "No transaction ID", purgeable ) { - "Did not get the transaction ID: " - }; - resource 'STR ' ( LAUNCH_TELNET_RESID + 0, "Launch telnet", purgeable ) { - "Launching Telnet application" - }; - resource 'STR ' ( LAUNCH_TN3720_RESID + 0, "Launch TN3720", purgeable ) { - "Launching TN3270 application" - }; - resource 'STR ' ( TELNET_ERR_RESID + 0, "Telnet launch error", purgeable ) { - "Telnet launch failed" - }; - resource 'STR ' ( SAVE_AS_RESID + 0, "Save as", purgeable ) { - "Save this document as:" - }; - resource 'STR ' ( NETSITE_RESID + 0, "Netsite:", purgeable ) { - "Netsite:" - }; - resource 'STR ' ( LOCATION_RESID + 0, "Location:", purgeable ) { - "Location:" - }; - resource 'STR ' ( GOTO_RESID + 0, "Go To:", purgeable ) { - "Go To:" - }; - resource 'STR ' ( DOCUMENT_DONE_RESID + 0, "Document done", purgeable ) { - "Document: Done." - }; - resource 'STR ' ( LAYOUT_COMPLETE_RESID + 0, "Layout complete", purgeable ) { - "Layout: Complete." - }; - resource 'STR ' ( CONFORM_ABORT_RESID + 0, "Confirm abort", purgeable ) { - "Are you sure that you want to abort the current download?" - }; - resource 'STR ' ( SUBMIT_FORM_RESID + 0, "Submit form", purgeable ) { - "Submit form:%d,%d" - }; - resource 'STR ' ( SAVE_IMAGE_RESID + 0, "Save image as", purgeable ) { - "Save Image as:" - }; - resource 'STR ' ( SAVE_QUOTE_RESID + 0, "SaveÉ", purgeable ) { - "Save Ò" - }; - resource 'STR ' ( WILL_OPEN_WITH_RESID + 0, "Will open withÉ", purgeable ) { - "Will open with Ò" - }; - resource 'STR ' ( SAVE_AS_A_RESID + 0, "Save as aÉ", purgeable ) { - "Saving as a Ò" - }; - resource 'STR ' ( FILE_RESID + 0, "file", purgeable ) { - "Ó file." - }; - resource 'STR ' ( COULD_NOT_SAVE_RESID + 0, "Could not save", purgeable ) { - "Could not save " - }; - resource 'STR ' ( DISK_FULL_RESID + 0, "Disk full", purgeable ) { - " because the disk is full." - }; - resource 'STR ' ( DISK_ERR_RESID + 0, "Disk error", purgeable ) { - " because of a disk error." - }; - resource 'STR ' ( BOOKMARKS_RESID + 0, "Bookmarks", purgeable ) { - "Bookmarks" - }; - resource 'STR ' ( NOT_VISITED_RESID + 0, "Not visited", purgeable ) { - "Not visited" - }; - resource 'STR ' ( NO_FORM2HOTLIST_RESID + 0, "No add form to hotlist", purgeable ) { - "Cannot add the result of a form submission to the hotlist" - }; - resource 'STR ' ( NEW_ITEM_RESID + 0, "New item", purgeable ) { - "New Item" - }; - resource 'STR ' ( NEW_HEADER_RESID + 0, "New Folder", purgeable ) { - "New Folder" - }; - resource 'STR ' ( CONFIRM_RM_HDR_RESID + 0, "Confirm Remove Folder", purgeable ) { - "Are you sure that you want to remove the folder \"" - }; - resource 'STR ' ( AND_ITEMS_RESID + 0, "Add items", purgeable ) { - "\" and its items?" - }; - resource 'STR ' ( SAVE_BKMKS_AS_RESID + 0, "Save bookmark as", purgeable ) { - "Save bookmarks as:" - }; - resource 'STR ' ( END_LIST_RESID + 0, "End of list", purgeable ) { - "End of List" - }; - resource 'STR ' ( ENTIRE_LIST_RESID + 0, "Entire list", purgeable ) { - "Entire List" - }; - resource 'STR ' ( NEW_RESID + 0, "new", purgeable ) { - "new" - }; - resource 'STR ' ( OTHER_RESID + 0, "Other", purgeable ) { - "Other" - }; - resource 'STR ' ( MEM_AVAIL_RESID + 0, "Memory available", purgeable ) { - "M available" - }; - resource 'STR ' ( SAVE_RESID + 0, "Save", purgeable ) { - "Save to disk" - }; - resource 'STR ' ( LAUNCH_RESID + 0, "Launch", purgeable ) { - "Launch" - }; - resource 'STR ' ( INTERNAL_RESID + 0, "Internal", purgeable ) { - "Netscape (internal)" - }; - resource 'STR ' ( UNKNOWN_RESID + 0, "", purgeable ) { - "Unknown: Prompt user" - }; - resource 'STR ' ( MEGA_RESID + 0, "", purgeable ) { - "M" - }; - resource 'STR ' ( KILO_RESID + 0, "", purgeable ) { - "K" - }; - - resource 'STR ' ( PICK_COLOR_RESID + 0, "Pick color", purgeable ) { - "Pick a color" - }; - resource 'STR ' ( BAD_APP_LOCATION_RESID + 0, "Bad app location", purgeable ) { - "Finder desktop database reported improper location of the application \"", - }; - resource 'STR ' ( REBUILD_DESKTOP_RESID + 0, "Rebuild desktop", purgeable ) { - "\" to Netscape. Next time you start up, please rebuild your desktop." - }; - resource 'STR ' ( UNTITLED_RESID + 0, "Untitled", purgeable ) { - "(untitled)" - }; - resource 'STR ' ( REG_EVENT_ERR_RESID + 0, "Reg. Event Handling Err", purgeable ) { - "Error in handling RegisterEvent" - }; - resource 'STR ' ( APP_NOT_REG_RESID + 0, "App not registered", purgeable ) { - "This app was not registered" - }; - resource 'STR ' ( UNREG_EVENT_ERR_RESID + 0, "Unreg. Event Handling Err", purgeable ) { - "Error in handling UnregisterEvent" - }; - resource 'STR ' ( BOOKMARK_HTML_RESID + 0, "Bookmarks HTML", purgeable ) { - "MCOM-bookmarks.html" - }; - resource 'STR ' ( NO_DISKCACHE_DIR_RESID + 0, "No disk cache folder", purgeable ) { - "Preset disk cache folder could not be found.\r Default folder in Preferences will be used." - }; - resource 'STR ' ( NO_SIGFILE_RESID + 0, "No signature file", purgeable ) { - "The signature file specified in your preferences could not be found." - }; - resource 'STR ' ( NO_BACKDROP_RESID + 0, "No backdrop for prefs", purgeable ) { - "The backdrop file specified in your preferences could not be found." - }; - resource 'STR ' ( SELECT_RESID + 0, "Select", purgeable ) { - "Select " - }; - resource 'STR ' ( AE_ERR_RESID + 0, "AE error reply", purgeable ) { - "Netscape received AppleEvent error reply: " - }; - resource 'STR ' ( CHARSET_RESID, "Message Charset", purgeable ) { - "x-mac-roman" - }; - resource 'STR ' ( BROWSE_RESID, "Browse", purgeable ) { - "BrowseÉ" - }; - - resource 'STR ' ( ENCODING_CAPTION_RESID, "", purgeable ) { - "Encoding For " - }; - - resource 'STR ' ( NO_TWO_NETSCAPES_RESID, "", purgeable ) { - "You cannot run two versions of Netscape at once. " - "This copy will quit now." - }; - -resource 'STR ' ( PG_NUM_FORM_RESID, "", purgeable ) { - "Page: %d" -}; - -resource 'STR ' ( REPLY_FORM_RESID, "", purgeable ) { - "Re: " -}; - -resource 'STR ' ( MENU_SEND_NOW, "", purgeable ) { - "Send Mail Now" -}; - -resource 'STR ' ( QUERY_SEND_OUTBOX, "", purgeable ) { - "Your Outbox folder contains %d unsent messages. Send them now ?" -}; - -resource 'STR ' ( QUERY_SEND_OUTBOX_SINGLE, "", purgeable ) { - "Your Outbox folder contains an unsent message. Send it now ?" -}; - -resource 'STR ' ( MENU_SEND_LATER, "", purgeable ) { - "Send Mail Later" -}; - -resource 'STR ' ( MENU_SAVE_AS, "", purgeable ) { - "Save asÉ" -}; -resource 'STR ' ( MENU_SAVE_FRAME_AS, "", purgeable ) { - "Save Frame asÉ" -}; -resource 'STR ' ( MENU_PRINT, "", purgeable ) { - "PrintÉ" -}; -resource 'STR ' ( MENU_PRINT_FRAME, "", purgeable ) { - "Print FrameÉ" -}; -resource 'STR ' ( MENU_RELOAD, "", purgeable ) { - "Reload" -}; -resource 'STR ' ( MENU_SUPER_RELOAD, "", purgeable ) { - "Super Reload" -}; -resource 'STR ' ( MAC_PROGRESS_NET, "", purgeable ) { - "Initializing networkÉ" -}; -resource 'STR ' ( MAC_PROGRESS_PREFS, "", purgeable ) { - "Reading PreferencesÉ" -}; -resource 'STR ' ( MAC_PROGRESS_BOOKMARK, "", purgeable ) { - "Reading BookmarksÉ" -}; -resource 'STR ' ( MAC_PROGRESS_ADDRESS, "", purgeable ) { - "Reading Address BookÉ" -}; -resource 'STR ' ( MAC_PROGRESS_JAVAINIT, "", purgeable ) { - "Initializing JavaÉ" -}; -resource 'STR ' ( MAC_UPLOAD_TO_FTP, "MAC_UPLOAD_TO_FTP", purgeable ) { - "Are you sure that want to upload the dragged files to the FTP server?" -}; /* JJE */ -resource 'STR ' ( POP_USERNAME_ONLY, "POP_USERNAME_ONLY", purgeable ) { - "Your POP User Name is just your user name (e.g. user), not your full POP address (e.g. user@internet.com)." -}; /* JJE */ -resource 'STR ' ( MAC_PLUGIN, "MAC_PLUGIN", purgeable ) { - "Plugin:" -}; /* JJE */ -resource 'STR ' ( MAC_NO_PLUGIN, "MAC_NO_PLUGIN", purgeable ) { - "No plugins" -}; /* JJE */ -resource 'STR ' ( MAC_REGISTER_PLUGINS, "MAC_REGISTER_PLUGINS", purgeable ) { - "Registering plugins" -}; /* JJE */ -resource 'STR ' ( DOWNLD_CONT_IN_NEW_WIND, "DOWNLD_CONT_IN_NEW_WIND", purgeable ) { - "Download continued in a new window." -}; /* JJE */ -resource 'STR ' ( ATTACH_NEWS_MESSAGE, "ATTACH_NEWS_MESSAGE", purgeable ) { - "News message" -}; /* JJE */ -resource 'STR ' ( ATTACH_MAIL_MESSAGE, "ATTACH_MAIL_MESSAGE", purgeable ) { - "Mail message" -}; /* JJE */ -resource 'STR ' ( MBOOK_NEW_ENTRY, "MBOOK_NEW_ENTRY", purgeable ) { - "New entry" -}; /* JJE */ -resource 'STR ' ( MCLICK_BACK_IN_FRAME, "MCLICK_BACK_IN_FRAME", purgeable ) { - "Back in Frame" -}; /* JJE */ -resource 'STR ' ( MCLICK_BACK, "MCLICK_BACK", purgeable ) { - "Back" -}; /* JJE */ -resource 'STR ' ( MCLICK_FWRD_IN_FRAME, "MCLICK_FWRD_IN_FRAME", purgeable ) { - "Forward in Frame" -}; /* JJE */ -resource 'STR ' ( MCLICK_FORWARD, "MCLICK_FORWARD", purgeable ) { - "Forward" -}; /* JJE */ -resource 'STR ' ( MCLICK_SAVE_IMG_AS, "MCLICK_SAVE_IMG_AS", purgeable ) { - "Save Image as:" -}; /* JJE */ -resource 'STR ' ( SUBMIT_FILE_WITH_DATA_FK, "SUBMIT_FILE_WITH_DATA_FK", purgeable ) { - "You can only submit a file that has a data fork." -}; /* JJE */ -resource 'STR ' ( ABORT_CURR_DOWNLOAD, "ABORT_CURR_DOWNLOAD", purgeable ) { - "Are you sure that you want to abort the current download?" -}; /* JJE */ -resource 'STR ' ( MACDLG_SAVE_AS, "MACDLG_SAVE_AS", purgeable ) { - "Save as: " -}; /* JJE */ -resource 'STR ' ( THE_ERROR_WAS, "THE_ERROR_WAS", purgeable ) { - "The error was:" -}; /* JJE */ -resource 'STR ' ( MBOOK_NEW_BOOKMARK, "MBOOK_NEW_BOOKMARK", purgeable ) { - "New Bookmark" -}; /* JJE */ - -resource 'STR ' ( MENU_MAIL_DOCUMENT, "", purgeable ) { - "Mail DocumentÉ" -}; - -resource 'STR ' ( MENU_MAIL_FRAME, "", purgeable ) { - "Mail FrameÉ" -}; - -resource 'STR ' ( DEFAULT_PLUGIN_URL, "", purgeable ) { - "http://cgi.netscape.com/eng/mozilla/2.0/extensions/info.cgi" -}; - -/* Bookmark Seperate string, For Japanese, please change to something like ---- */ -resource 'STR ' ( MBOOK_SEPARATOR_STR, "MBOOK_SEPARATOR_STR", purgeable ) { - "ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ" -}; - -resource 'STR ' ( RECIPIENT, "", purgeable ) { - "Recipient" -}; - -resource 'STR ' ( DELETE_MIMETYPE, "", purgeable ) { - "Are you sure you want to delete this type? Netscape will not be able to display information of this type if you proceed." -}; - -/* mail attachments are given a content-description string, - like "Microsoft Word Document". This suffix comes after - the application name */ - -resource 'STR ' ( DOCUMENT_SUFFIX, "", purgeable ) { - "Document" -}; - -resource 'STR ' ( PASSWORD_CHANGE_STRING, "", purgeable ) { - "Change Password" -}; - -resource 'STR ' ( PASSWORD_SET_STRING, "", purgeable ) { - "Set Password" -}; - - -/*----------------------------------------------------------------------------- - Common Stuff ------------------------------------------------------------------------------*/ -/* -#define Script smRoman=0, smJapanese, smTradChinese, smKorean, \ - smArabic, smHebrew, smGreek, smCyrillic, smRSymbol, \ - smDevanagari, smGurmukhi, smGujarati, smOriya, \ - smBengali, smTamil, smTelugu, smKannada, \ - smMalayalam, smSinhalese, smBurmese, smKhmer, \ - smThai, smLaotian, smGeorgian, smArmenian, \ - smSimpChinese, smTibetan, smMongolian, smGeez, \ - smSlavic, smVietnamese, smExtArabic, smUninterp \ -*/ -/* Language Group Proportional Fixed ProportionalFixed Character ScriptID for Txtr Txtr */ -/* Name Font Name Font Name Size Size Set ID Font Fallback ButtonID TextFieldID */ - -resource 'Fnec' (FNEC_RESID, "Font definitation for every encoding", purgeable) { - { - "Western", "Times", "Courier", 12, 10, CS_MAC_ROMAN, smRoman, 4002, 4001; - "Japanese", "×–¾’©‘Ì", "Osaka|“™•", 12, 12, CS_SJIS, smJapanese, 4004, 4003; - "Central European", "Times CE", "Courier CE", 12, 10, CS_MAC_CE, smSlavic, 4006, 4005; - "Traditional Chinese", "Apple LiSung Light", "Taipei", 16, 12, CS_BIG5, smTradChinese, 4008, 4007; - "Simplified Chinese", "Song", "*Beijing*", 16, 12, CS_GB_8BIT, smSimpChinese, 4010, 4009; - "Korean", "AppleGothic", "Seoul", 12, 12, CS_KSC_8BIT, smKorean, 4012, 4011; - "Cyrillic", "ðßìîé ðîï", "ðßìîé", 12, 12, CS_MAC_CYRILLIC, smCyrillic, 4016, 4015; - "Greek", "GrTimes", "GrCourier", 12, 12, CS_MAC_GREEK, smRoman, 4018, 4017; - "Turkish", "Times", "Courier", 12, 10, CS_MAC_TURKISH, smRoman, 4020, 4019; - "User-Defined", "Times", "Courier", 12, 10, CS_USER_DEFINED_ENCODING, smRoman, 4014, 4013; - } -}; - - -resource 'Csid' (cmd2csid_tbl_ResID, "csIDs", purgeable) { - { - /* win_csid doc_csid cmdNumber */ - CS_MAC_ROMAN, CS_ASCII, cmd_ASCII, - CS_MAC_ROMAN, CS_LATIN1, cmd_LATIN1, - CS_SJIS, CS_JIS, cmd_JIS, - CS_SJIS, CS_SJIS, cmd_SJIS, - CS_SJIS, CS_EUCJP, cmd_EUCJP, - CS_SJIS, CS_SJIS_AUTO, cmd_SJIS_AUTO, - CS_MAC_ROMAN, CS_MAC_ROMAN, cmd_MAC_ROMAN, - CS_MAC_CE, CS_LATIN2, cmd_LATIN2, - CS_MAC_CE, CS_MAC_CE, cmd_MAC_CE, - CS_MAC_CE, CS_CP_1250, cmd_CP1250, - CS_BIG5, CS_BIG5, cmd_BIG5, - CS_BIG5, CS_CNS_8BIT, cmd_CNS_8BIT, - CS_GB_8BIT, CS_GB_8BIT, cmd_GB_8BIT, - CS_KSC_8BIT, CS_KSC_8BIT, cmd_KSC_8BIT, - CS_KSC_8BIT, CS_2022_KR, cmd_2022_KR, - - CS_MAC_CYRILLIC, CS_MAC_CYRILLIC, cmd_MAC_CYRILLIC, - CS_MAC_CYRILLIC, CS_8859_5, cmd_8859_5, - CS_MAC_CYRILLIC, CS_CP_1251, cmd_CP1251, - CS_MAC_CYRILLIC, CS_KOI8_R, cmd_KOI8R, - CS_MAC_GREEK, CS_MAC_GREEK, cmd_MAC_GREEK, - CS_MAC_GREEK, CS_8859_7, cmd_8859_7, - CS_MAC_TURKISH, CS_MAC_TURKISH, cmd_MAC_TURKISH, - CS_MAC_TURKISH, CS_8859_9, cmd_8859_9, - CS_USER_DEFINED_ENCODING,CS_USER_DEFINED_ENCODING, cmd_USER_DEFINED_ENCODING - - } -}; - - -resource 'MIME' ( MIME_PREFS_FIRST_RESID, "image/gif", purgeable ) { - 'JVWR', - 'GIFf', - 2, - "JPEGView", - "image/gif", - "gif" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 1, "image/jpeg", purgeable ) { - 'JVWR', - 'JPEG', - 2, /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - "JPEGView", - "image/jpeg", - "jpg,jpeg,jpe" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 2, "image/pict", purgeable ) { - 'ttxt', - 'PICT', - 1, /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - "TeachText", - "image/pict", - "pic,pict" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 3, "image/tiff", purgeable ) { - 'JVWR', - 'TIFF', - 1, /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - "JPEGView", - "image/tiff", - "tif,tiff" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 4, "image/x-xbitmap", purgeable ) { - '????', - 'ttxt', - 2, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-xbitmap", - "xbm" -}; - - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 5, "audio/basic", purgeable ) { - 'SNDM', - 'ULAW', - 1, /* User action - Save = 0, Launch = 1, Internal = 2, Unknown = 3 */ - "Sound Machine", - "audio/basic", - "au,snd" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 6, "audio/aiff", purgeable ) { - 'SNDM', - 'AIFF', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Sound Machine", - "audio/aiff", - "aiff,aif" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 7, "audio/x-wav", purgeable ) { - 'SCPL', - 'WAVE', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "SoundApp", - "audio/x-wav", - "wav" -}; - - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 8, "video/quicktime", purgeable ) { - 'TVOD', - 'MooV', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Simple Player", - "video/quicktime", - "qt,mov" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 9, "video/mpeg", purgeable ) { - 'mMPG', - 'MPEG', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Sparkle", - "video/mpeg", - "mpg,mpeg,mpe" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 10, "video/x-msvideo", purgeable ) { - 'AVIC', - '????', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "AVI to QT Utility", - "video/x-msvideo", - "avi" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 11, "video/x-qtc", purgeable ) { - 'mtwh', - '.qtc', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Conferencing Helper Application", - "video/x-qtc", - "qtc" -}; - - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 12, "application/mac-binhex40", purgeable ) { - 'SITx', - 'TEXT', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Stuffit Expander", - "application/mac-binhex40", - "hqx" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 13, "application/x-stuffit", purgeable ) { - 'SITx', - 'SITD', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Stuffit Expander", - "application/x-stuffit", - "sit" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 14, "application/x-macbinary", purgeable ) { - 'MB2P', - 'TEXT', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Mac BinaryII+", - "application/x-macbinary", - "bin" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 15, "application/zip", purgeable ) { - 'ZIP ', - 'ZIP ', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "ZipIt", - "application/x-zip", - "z,zip" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 16, "application/gzip", purgeable ) { - 'Gzip', - 'Gzip', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "MacGzip", - "application/x-gzip", - "gz" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 17, "application/msword", purgeable ) { - 'MSWD', - 'WDBN', - 0, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "MS Word", - "application/msword", - "doc" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + 18, "application/x-excel", purgeable ) { - 'XCEL', - 'XLS5', - 0, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "MS Excel", - "application/x-excel", - "xls" -}; - - -/* Crappy mimes are those mime types that will never ever be seen by the user */ -#define CRAPPY_MIME 19 - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME, "application/octet-stream", purgeable ) { - 'ttxt', - 'TEXT', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "TeachText", - "application/octet-stream", - "exe" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+1, "application/postscript", purgeable ) { - 'ttxt', - 'TEXT', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "TeachText", - "application/postscript", - "ai,eps,ps" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+2, "application/rtf", purgeable ) { - 'MSWD', - 'TEXT', - 0, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "MS Word", - "application/rtf", - "rtf" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+3, "application/x-compressed", purgeable ) { - 'LZIV', - 'ZIVM', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "MacCompress", - "application/x-compress", - ".Z" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+4, "application/x-tar", purgeable ) { - 'TAR ', - 'TARF', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "tar", - "application/x-tar", - "tar" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+5, "image/x-cmu-raster", purgeable ) { - '????', - 'ttxt', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-cmu-raster", - "ras" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+6, "image/x-portable-anymap", purgeable ) { - '????', - 'ttxt', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-portable-anymap", - "pnm" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+7, "image/x-portable-anymap", purgeable ) { - '????', - 'ttxt', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-portable-bitmap", - "pbm" -}; - - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+8, "image/x-portable-bitmap", purgeable ) { - '????', - 'ttxt', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-portable-graymap", - "pgm" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+9, "image/x-portable-graymap", purgeable ) { - '????', - 'ttxt', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-portable-graymap", - "pgm" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+10, "image/x-rgb", purgeable ) { - '????', - 'ttxt', - 3, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-rgb", - "rgb" -}; - -resource 'MIME' ( MIME_PREFS_FIRST_RESID + CRAPPY_MIME+11, "image/x-xpixmap", purgeable ) { - '????', - 'ttxt', - 2, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Unknown", - "image/x-xpixmap", - "xpm" -}; - - -resource 'SMIM' ( 1, "Netscape/Source", purgeable ) { - 'ttxt', - 'TEXT', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "Teach Text", - PREF_SOURCE, - "" -}; - -resource 'SMIM' ( 2, "Netscape/Telnet", purgeable ) { - 'NCSA', - 'CONF', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "NCSA Telnet", - TELNET_APPLICATION_MIME_TYPE, - "", -}; - -resource 'SMIM' ( 3, "Netscape/tn3270", purgeable ) { - 'GFTM', - 'GFTS', - 1, /* User action - Save = 0, Launch = 1, Internal =2, Unknown=3 */ - "tn3270", - TN3270_VIEWER_APPLICATION_MIME_TYPE, - "" -}; - -resource 'STR ' ( mPREFS_UNSPECIFIED_ERR_ALERT, "Unspecified Error", purgeable ) { - "There was an error. Preferences will not be saved."; -}; - -resource 'STR ' ( mPREFS_CANNOT_OPEN_SECOND_ALERT, "Cant Open Second Prefs File", purgeable ) { - "You cannot open a second preferences file."; -}; - -resource 'STR ' ( mPREFS_CANNOT_OPEN_SECOND_ALERT + 1, "-", purgeable ) { - "Quit Netscape and launch by double-clicking on the preferences file you wish to use."; -}; - -resource 'STR ' ( mPREFS_CANNOT_CREATE, "Cant Create Prefs File", purgeable ) { - "The preferences file cannot be created. Netscape will use the defaults."; -}; - -resource 'STR ' ( mPREFS_CANNOT_CREATE_PREFS_FOLDER, "Cant Create Prefs Folder", purgeable ) { - "The preferences folder could not be created. Netscape will use the defaults."; -}; - -resource 'STR ' ( mPREFS_CANNOT_READ, "Cant Read Preferences", purgeable ) { - "The preferences file cannot be read. Netscape will use the defaults."; -}; - -resource 'STR ' ( mPREFS_CANNOT_WRITE, "Cant Write Preferences", purgeable ) { - "There was an error writing the preferences. They will not be saved."; -}; - - - -// TRANSLATION RESOURCES -/* les tables pour ISO 8859-1 : A. Pirard (ULg) - mai 1992 */ - -data 'xlat' (128, "ISO1 -> MACR", purgeable) { -/* translation ISO 8859-1 -> Macintosh */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"A5AA E2C4 E3C9 A0E0 F6E4 C9DC CED9 DAB6" /* ¥ª­°³·º½ÃÅÉÑÔÙÚ¶ */ -/*9x*/ $"C6D4 D5D2 D3A5 D0D1 F7AA FBDD CFFF F5D9" /* ÆÎâãäðö÷ùúûýþÿõÄ */ -/*Ax*/ $"CAC1 A2A3 DBB4 7CA4 ACA9 BBC7 C2D0 A8F8" /* ÊÁ¢£Û´Ï¤¬©»ÇÂШø */ -/*Bx*/ $"A1B1 3233 ABB5 A6E1 FC31 BCC8 B9B8 B2C0" /* ¡±ÓÒ«µ¦áüռȹ¸²À */ -/*Cx*/ $"CBE7 E5CC 8081 AE82 E983 E6E8 EDEA EBEC" /* ËçåÌ€®‚éƒæèíêëì */ -/*Dx*/ $"DC84 F1EE EFCD 8578 AFF4 F2F3 86A0 DEA7" /* Ü„ñîïͅׯôòó† Þ§ */ -/*Ex*/ $"8887 898B 8A8C BE8D 8F8E 9091 9392 9495" /* ˆ‡‰‹ŠŒ¾Ž‘“’”• */ -/*Fx*/ $"DD96 9897 999B 9AD6 BF9D 9C9E 9FE0 DFD8" /* Ý–˜—™›šÖ¿œžŸàߨ */ -}; - -data 'xlat' (129, "MACR -> ISO1", purgeable) { -/* translation Macintosh -> ISO 8859-1 */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C4C5 C7C9 D1D6 DCE1 E0E2 E4E3 E5E7 E9E8" /* €‚ƒ„…†‡ˆ‰Š‹ŒŽ */ -/*9x*/ $"EAEB EDEC EEEF F1F3 F2F4 F6F5 FAF9 FBFC" /* ‘’“”•–—˜™š›œžŸ */ -/*Ax*/ $"DDB0 A2A3 A780 B6DF AEA9 99B4 A882 C6D8" /*  ¡¢£¤¥¦§¨©ª«¬­®¯ */ -/*Bx*/ $"83B1 BE84 A5B5 8F85 BDBC 86AA BA87 E6F8" /* °±²³´µ¶·¸¹º»¼½¾¿ */ -/*Cx*/ $"BFA1 AC88 9F89 90AB BB8A A0C0 C3D5 91A6" /* ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ */ -/*Dx*/ $"AD8B B3B2 8CB9 F7D7 FF8D 8EA4 D0F0 DEFE" /* ÐÑÒÓÔÕÖרÙÚÛÜÝÞß */ -/*Ex*/ $"FDB7 9293 94C2 CAC1 CBC8 CDCE CFCC D3D4" /* àáâãäåæçèéêëìíîï */ -/*Fx*/ $"95D2 DADB D99E 9697 AF98 999A B89B 9C9D" /* ðñòóôõö÷øùúûüýþÿ */ -}; - - -data 'xlat' (130, "ISO2 -> MACCE", purgeable) { -/* translation 8859-2 -> MacCEuro */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"8081 8283 8485 8687 8889 8A8B 8C8D 8E8F" /* ................ */ -/*9x*/ $"9091 9293 9495 9697 9899 9A9B 9C9D 9E9F" /* ................ */ -/*Ax*/ $"CA84 FFFC A4BB E5A4 ACE1 53E8 8F2D EBFB" /*  ¡.£.¥¦§¨©.«¬.®¯ */ -/*Bx*/ $"A188 B2B8 27BC E6FF B8E4 73E9 90BD ECFD" /* °±.³.µ¶·.¹.»¼.¾¿ */ -/*Cx*/ $"D9E7 4141 80BD 8C43 8983 A245 9DEA 4991" /* ÀÁ..ÄÅÆ.ÈÉÊ.ÌÍ.Ï */ -/*Dx*/ $"44C1 C5EE EFCC 8578 DBF1 F2F4 86F8 54A7" /* .ÑÒÓÔÕÖ.ØÙÚÛÜÝ.ß */ -/*Ex*/ $"DA87 6161 8ABE 8D63 8B8E AB65 9E92 6993" /* àá..äåæ.èéê.ìí.ï */ -/*Fx*/ $"64C4 CB97 99CE 9AD6 DEF3 9CF5 9FF9 74A1" /* .ñòóôõö÷øùúûüý.. */ -}; - -data 'xlat' (131, "MACCE -> ISO2", purgeable) { -/* translation MacCEuro -> 8859-2 */ -/* x0x1 x2x3 x4x5 x6x7 x8x9 xAxB xCxD xExF */ -/*8x*/ $"C441 61C9 A1D6 DCE1 B1C8 E4E8 C6E6 E9AC" /* €..ƒ„…†‡ˆ‰Š‹ŒŽ */ -/*9x*/ $"BCCF EDEF 4565 45F3 65F4 F66F FACC ECFC" /* ‘’“...—.™š.œžŸ */ -/*Ax*/ $"A0B0 CA4C A72A A6DF 5263 54EA A8AD 6749" /* .¡¢.¤..§...«¬... */ -/*Bx*/ $"6949 B2B3 694B 6445 B34C 6CA5 B5C5 E54E" /* ........¸..»¼½¾. */ -/*Cx*/ $"6ED1 2DC3 F1D2 C63D 3FC9 A0F2 D54F F54F" /* .Á..ÄÅ....ÊËÌ.Î. */ -/*Dx*/ $"2D2D 2222 2727 F7D7 6FC0 E0D8 3D3F F852" /* ......Ö..ÙÚÛ..Þ. */ -/*Ex*/ $"72A9 2C2C B9A6 B6C1 ABBB CDAE BE55 D3D4" /* .á..äåæçèéêëì.îï */ -/*Fx*/ $"75D9 DAF9 DBFB 5575 DDFD 6BAF A3BF 47B7" /* .ñòóôõ..øù.ûüý.ÿ */ -}; - - -read 'Tang' ( ABOUT_BIGLOGO_TANG, "biglogo.gif", purgeable) "biglogo.gif"; // Was splash.gif -read 'Tang' ( ABOUT_JAVALOGO_TANG, "javalogo.gif", purgeable) "javalogo.gif"; -read 'Tang' ( ABOUT_RSALOGO_TANG, "rsalogo.gif", purgeable ) "rsalogo.gif"; -read 'Tang' ( ABOUT_HYPE_TANG, "hype.au", purgeable ) "hype.au"; -read 'Tang' ( ABOUT_QTLOGO_TANG, "qtlogo.gif", purgeable) "qt_logo.gif"; - -read 'TEXT' ( ABOUT_ABOUTPAGE_TEXT, "about-all.html", purgeable ) "about-all.html"; -read 'TEXT' ( ABOUT_AUTHORS_TEXT, "authors.html", purgeable ) "authors.html"; -read 'TEXT' ( ABOUT_MAIL_TEXT, "mail.msg", purgeable ) "mail.msg"; -read 'TEXT' ( ABOUT_MOZILLA_TEXT, "mozilla.html", purgeable ) "mozilla.html"; -read 'TEXT' ( ABOUT_PLUGINS_TEXT, "aboutplg.html", purgeable ) "aboutplg.html"; - - diff --git a/mozilla/cmd/macfe/restext/resdef.pl b/mozilla/cmd/macfe/restext/resdef.pl deleted file mode 100644 index 2a3b23cd01e..00000000000 --- a/mozilla/cmd/macfe/restext/resdef.pl +++ /dev/null @@ -1,49 +0,0 @@ -#! /usr/local/bin/perl - -# -# 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. -# - -# This script reads a series of lines of the form: -# resource 'STR ' ( id+100, "name", purgeable)(NAME, ID, "STRING") -# and generates stuff like: - -open(OUT, ">xpstring.r"); -print OUT "// This is a generated file, do not edit it\n"; -print OUT "#include \"Types.r\"\n"; -while (<>) { - ($enum, $eid) = - /[ ]*([A-Za-z0-9_]+)[ ]*\=[ ]*([A-Za-z_x0-9]+),/; - if ($enum ne "") { - print OUT "#define $enum $eid \n"; - } - ($name, $id, $string) = - /ResDef[ ]*\([ ]*([A-Za-z0-9_]+)[ ]*,[ ]*([\(\)0-9A-Za-z_x\-+ ]+)[ \01]*,[ ]*(".*")[ ]*\)/; - if ($name ne "") { -# print OUT "resource 'STR ' (($id)+7000, \"$name\", purgeable)\n{\n\t"; - print OUT "resource 'STR ' (($id)+4000, \"\", purgeable)\n{\n\t"; # RES_OFFSET = 4000 - - $_ = $string; - s/([^.:])\\n/$1 /g; - s/(\\n) /$1/g; - print OUT "$_"; - - print OUT ";\n};\n"; - } -} -close(OUT); - - diff --git a/mozilla/cmd/macfe/restext/ufrm.r b/mozilla/cmd/macfe/restext/ufrm.r deleted file mode 100644 index 1887bbc7e55..00000000000 --- a/mozilla/cmd/macfe/restext/ufrm.r +++ /dev/null @@ -1,192 +0,0 @@ - /* - * 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 "csid.h" -#include "resgui.h" - -/* Conversion Table That Convert From Unicode to Script Text */ -type 'UFRM' { - array uint { - unsigned integer; /* Just an uint16 */ - }; -}; -/* Conversion Table That Convert From Script Text to Unicode */ -type 'UTO ' { - array uint { - unsigned integer; /* Just an uint16 */ - }; -}; - - -/* a Priorized List of csid that will be used to render unicode */ -type CSIDLIST_RESTYPE { - integer = $$CountOf(table); - wide array table { - unsigned integer; /* csid */ - }; -}; - -#define RES_CS_MAC_ICELANDIC (CS_MAC_ROMAN | 0x1000) /* ftang- fix me after 4.0 */ - -resource 'UFRM' ( RES_CS_MAC_ICELANDIC, "macicela.uf- RES_CS_MAC_ICELANDIC", purgeable) {{ -#include "macicela.uf" -}}; -resource 'UFRM' ( CS_MAC_ROMAN, "macroman.uf- CS_MAC_ROMAN", purgeable) {{ -#include "macroman.uf" -}}; -resource 'UFRM' ( CS_SJIS, "sjis.uf- CS_LATIN1", purgeable) {{ -#include "sjis.uf" -}}; -resource 'UFRM' ( CS_MAC_CE, "macce.uf- CS_MAC_CE", purgeable) {{ -#include "macce.uf" -}}; -resource 'UFRM' ( CS_BIG5, "big5.uf- CS_BIG5", purgeable) {{ -#include "big5.uf" -}}; -resource 'UFRM' ( CS_GB_8BIT, "gb2312.uf- CS_GB_8BIT", purgeable) {{ -#include "gb2312.uf" -}}; -resource 'UFRM' ( CS_KSC_8BIT, "ksc5601.uf- CS_KSC_8BIT", purgeable) {{ -#include "u20kscgl.uf" -}}; -resource 'UFRM' ( CS_DINGBATS, "macdingb.uf- CS_DINGBATS", purgeable) {{ -#include "macdingb.uf" -}}; -resource 'UFRM' ( CS_SYMBOL, "macsymbo.uf- CS_SYMBOL", purgeable) {{ -#include "macsymbo.uf" -}}; -resource 'UFRM' ( CS_MAC_CYRILLIC, "maccyril.uf- CS_MAC_CYRILLIC", purgeable) {{ -#include "maccyril.uf" -}}; -resource 'UFRM' ( CS_MAC_GREEK, "macgreek.uf- CS_MAC_GREEK", purgeable) {{ -#include "macgreek.uf" -}}; -resource 'UFRM' ( CS_MAC_TURKISH, "macturki.uf- CS_MAC_TURKISH", purgeable) {{ -#include "macturki.uf" -}}; -resource 'UFRM' ( CS_LATIN1, "8859-1.uf- CS_LATIN1", purgeable) {{ -#include "8859-1.uf" -}}; -resource 'UFRM' ( CS_T61, "t61.uf- CS_T61", purgeable) {{ -#include "t61.uf" -}}; -resource 'UFRM' ( CS_TIS620, "macthai.uf- CS_TIS620", purgeable) {{ -#include "macthai.uf" -}}; - - -resource 'UTO ' ( RES_CS_MAC_ICELANDIC, "macicela.ut- RES_CS_MAC_ICELANDIC", purgeable) {{ -#include "macicela.ut" -}}; -resource 'UTO ' ( CS_MAC_ROMAN, "macroman.ut- CS_MAC_ROMAN", purgeable) {{ -#include "macroman.ut" -}}; -resource 'UTO ' ( CS_SJIS, "sjis.ut- CS_LATIN1", purgeable) {{ -#include "sjis.ut" -}}; -resource 'UTO ' ( CS_MAC_CE, "macce.ut- CS_MAC_CE", purgeable) {{ -#include "macce.ut" -}}; -resource 'UTO ' ( CS_BIG5, "big5.ut- CS_BIG5", purgeable) {{ -#include "big5.ut" -}}; -resource 'UTO ' ( CS_GB_8BIT, "gb2312.ut- CS_GB_8BIT", purgeable) {{ -#include "gb2312.ut" -}}; -resource 'UTO ' ( CS_KSC_8BIT, "ksc5601.ut- CS_KSC_8BIT", purgeable) {{ -#include "u20kscgl.ut" -}}; -resource 'UTO ' ( CS_DINGBATS, "macdingb.ut- CS_DINGBATS", purgeable) {{ -#include "macdingb.ut" -}}; -resource 'UTO ' ( CS_SYMBOL, "macsymbo.ut- CS_SYMBOL", purgeable) {{ -#include "macsymbo.ut" -}}; -resource 'UTO ' ( CS_MAC_CYRILLIC, "maccyril.ut- CS_MAC_CYRILLIC", purgeable) {{ -#include "maccyril.ut" -}}; -resource 'UTO ' ( CS_MAC_GREEK, "macgreek.ut- CS_MAC_GREEK", purgeable) {{ -#include "macgreek.ut" -}}; -resource 'UTO ' ( CS_MAC_TURKISH, "macturki.ut- CS_MAC_TURKISH", purgeable) {{ -#include "macturki.ut" -}}; -resource 'UTO ' ( CS_LATIN1, "8859-1.ut- CS_LATIN1", purgeable) {{ -#include "8859-1.ut" -}}; -resource 'UTO ' ( CS_T61, "t61.ut- CS_T61", purgeable) {{ -#include "t61.ut" -}}; -resource 'UTO ' ( CS_TIS620, "macthai.ut- CS_TIS620", purgeable) {{ -#include "macthai.ut" -}}; - -resource CSIDLIST_RESTYPE (CSIDLIST_RESID, "Roman/CE/Cy/Gr/J/TC/SC/K/Symbol/Dingbats/Tr", purgeable) {{ - CS_MAC_ROMAN, - CS_MAC_CE, - CS_MAC_CYRILLIC, - CS_MAC_GREEK, - CS_SJIS, - CS_BIG5, - CS_GB_8BIT, - CS_KSC_8BIT, - CS_TIS620, - CS_SYMBOL, - CS_DINGBATS, - CS_MAC_TURKISH -}}; -resource CSIDLIST_RESTYPE (CSIDLIST_RESID+1, "Roman/CE/Cy/Gr/TC/SC/K/J/Symbol/Dingbats/Tr", purgeable) {{ - CS_MAC_ROMAN, - CS_MAC_CE, - CS_MAC_CYRILLIC, - CS_MAC_GREEK, - CS_BIG5, - CS_GB_8BIT, - CS_KSC_8BIT, - CS_SJIS, - CS_TIS620, - CS_SYMBOL, - CS_DINGBATS, - CS_MAC_TURKISH -}}; -resource CSIDLIST_RESTYPE (CSIDLIST_RESID+2, "Roman/CE/Cy/Gr/SC/K/J/TC/Symbol/Dingbats/Tr", purgeable) {{ - CS_MAC_ROMAN, - CS_MAC_CE, - CS_MAC_CYRILLIC, - CS_MAC_GREEK, - CS_GB_8BIT, - CS_KSC_8BIT, - CS_SJIS, - CS_BIG5, - CS_TIS620, - CS_SYMBOL, - CS_DINGBATS, - CS_MAC_TURKISH -}}; -resource CSIDLIST_RESTYPE (CSIDLIST_RESID+3, "Roman/CE/Cy/Gr/K/J/TC/SC/Symbol/Dingbats/Tr", purgeable) {{ - CS_MAC_ROMAN, - CS_MAC_CE, - CS_MAC_CYRILLIC, - CS_MAC_GREEK, - CS_KSC_8BIT, - CS_SJIS, - CS_BIG5, - CS_GB_8BIT, - CS_TIS620, - CS_SYMBOL, - CS_DINGBATS, - CS_MAC_TURKISH -}}; diff --git a/mozilla/cmd/macfe/restext/xpstring.xps b/mozilla/cmd/macfe/restext/xpstring.xps deleted file mode 100644 index 04c460feb68..00000000000 --- a/mozilla/cmd/macfe/restext/xpstring.xps +++ /dev/null @@ -1,102 +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. - */ - -/* - This project is rather, um, creative in the way it works. Here's why. - - There are two goals here (which should probably be separated out): - - 1. Make a shared library which exports a bunch of symbols which are - IDs of error strings: - - MacXPStrings.c is preprocessed and compiled in the normal way - for a C file, and ends up simple assigning numerical values to - lots of exported ints, e.g. "int MK_BAD_CONNECT = (-205)". These - ints are exported by name from the shared library. - - The dummy function MacintoshForever() is there because there - is apparently a CFM bug that causes a crash loading shared - libraries with no exported code symbols. - - 2. Make a file called "Mozilla resources" which contains a bunch - of 'STR ' resources containing the strings defined in allxpstr.h, - and some other resources. - - This is achieved by the .xps file which, if you look at the - File Mapping prefs, is processed by ToolFrontEnd. The - ToolFrontEnd prefs panel specifies that the following command: - - Execute "{{SourceFile}}_Make" - - is send to ToolServer, so xpstring.xps_Make will get executed. - xpstring.xps_Make preprocesses this file (xpstrings.xps) with the - MWCPPC tool, outputting the result to a .r file Temp_XPStrings.r: - - MWCPPC -nodefaults -i- -e2 -D _XP_Core_ {IncludeFiles} "{{SourceFile}}" ¶ - > "{{ResourceDir}}Temp_XPStrings.r" - - Temp_XPStrings.r is then Perlized by resdef.pl to create xpstring.r: - - perl resdef.pl Temp_XPStrings.r - - xpstring.r is then Rez'd to create Mozilla Resources: - - Rez -t 'NSPL' -c MOZZ -i "{RIncludes}" ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - xpstring.r - - We then Rez MacSTR.r, which itself includes all the other .r files here: - - Rez -append -i "{RIncludes}" -i "{{mozilla}}cmd:macfe:include:" ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - MacSTR.r - - That's basically it. Phew! - - Some things to be careful of: - - MacXPStrings.c is preprocessed by the IDE, so in prefix file - specified in the prefs is included. - - When this file is preprocessed by MWCPPC, the prefix file is - ignored so we include "MacCommonPrefix.h" ourselves. -*/ - - -#define RESOURCE_STR - -/* Manually include the prefix file, so that MWCPPC picks it up */ -#include "MacConfigInclude.h" - -/* the prefix file should have already defined OTUNIXERRORS at this stage */ -#include "OpenTransport.h" - -/* allxpstr.h have to be in the last one */ -#include "allxpstr.h" /* The real stuff is here... */ - - -#ifdef rez - -/* -** These are included here to force CodeWarrior to rebuild if they change. The -** include should not actually happen during the build phase, only when the #include -** scanner is doing its thing. -*/ -#include "MacSTR.r" -#include "::rsrc:communicator:Communicator.rsrc" /* sounds of nail-biting */ -#endif diff --git a/mozilla/cmd/macfe/restext/xpstring.xps_Make b/mozilla/cmd/macfe/restext/xpstring.xps_Make deleted file mode 100644 index 0857f6cafbf..00000000000 --- a/mozilla/cmd/macfe/restext/xpstring.xps_Make +++ /dev/null @@ -1,62 +0,0 @@ -# -*- Mode: Fundamental -*- -# -# 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. - -# -# MakeXPStrings - -set echo 1 - -Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/) -Directory "{{¨0}}" - -Set mozilla "::::" # project folder relative -Set -e ResourceDir "{{mozilla}}cmd:macfe:restext:" -Set TargetDir "{{mozilla}}dist:client_debug:" - -if {DEBUG} - Set TargetDir "{{mozilla}}dist:client_debug:" -else - Set TargetDir "{{mozilla}}dist:client:" -end if - -# Set RIncludes "{{mozilla}}lib:mac:MW:Headers:Rez_Headers:" - -MWCPPC -nodefaults -i- -e2 -D _XP_Core_ {IncludeFiles} "{{SourceFile}}" ¶ - > "{{ResourceDir}}Temp_XPStrings.r" - -if {status} != 0 - Exit 1 -end if - -If "`Exists -d "{TargetDir}Essential Files:"`" == "" - NewFolder "{{TargetDir}}Essential Files" -End -Directory "{{ResourceDir}}" # set to the correct folder -perl resdef.pl Temp_XPStrings.r -delete Temp_XPStrings.r -Rez -t 'NSPL' -c MOZZ {IncludeFiles} ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - xpstring.r -delete xpstring.r -Rez -append {IncludeFiles} -i "{{mozilla}}cmd:macfe:include:" ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - MacSTR.r -Rez -append {IncludeFiles} -i "{{mozilla}}cmd:macfe:include:" ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - exception_str.r - -Quit # get rid of ToolServer diff --git a/mozilla/cmd/macfe/restext/xpstring.xps_NavMake b/mozilla/cmd/macfe/restext/xpstring.xps_NavMake deleted file mode 100644 index 014d51151ca..00000000000 --- a/mozilla/cmd/macfe/restext/xpstring.xps_NavMake +++ /dev/null @@ -1,50 +0,0 @@ -# -*- Mode: Fundamental -*- -# -# 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. - -# MakeXPStrings - -Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/) -Directory "{{¨0}}" - -Set ns "::::" # project folder relative -Set -e ResourceDir "{{ns}}cmd:macfe:restext:" -Set TargetDir "{{ns}}cmd:macfe:projects:client:" -#Set RIncludes "{{ns}}lib:mac:MW:Headers:Rez_Headers:" - -MWCPPC -nodefaults -i- -D MOZ_LITE -e2 -D _XP_Core_ -D XP_MAC {IncludeFiles} "{{SourceFile}}" ¶ - > "{{ResourceDir}}Temp_XPStrings.r" - -if {status} != 0 - Exit 1 -end if - -If "`Exists -d "{TargetDir}Essential Files:"`" == "" - NewFolder "{{TargetDir}}Essential Files" -End -Directory "{{ResourceDir}}" # set to the correct folder -perl resdef.pl Temp_XPStrings.r -delete Temp_XPStrings.r -Rez -t 'NSPL' -c MOSS {IncludeFiles} #-i "{RIncludes}" ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - xpstring.r -delete xpstring.r -Rez -append {IncludeFiles} #-i "{RIncludes}" ¶ - -i "{{ns}}cmd:macfe:include:" ¶ - -o "{{TargetDir}}Essential Files:Mozilla Resources" ¶ - MacSTR.r - -Quit # Get rid of ToolServer diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/CSimpleTextView.CTYP b/mozilla/cmd/macfe/rsrc/CrossProduct/CSimpleTextView.CTYP deleted file mode 100644 index 2427fa7ddff..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/CSimpleTextView.CTYP and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/LTableHeader.rsrc b/mozilla/cmd/macfe/rsrc/CrossProduct/LTableHeader.rsrc deleted file mode 100644 index cee0cdda575..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/LTableHeader.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/Mozilla_Custom_CPPbs b/mozilla/cmd/macfe/rsrc/CrossProduct/Mozilla_Custom_CPPbs deleted file mode 100644 index d240135d2c2..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/Mozilla_Custom_CPPbs and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/Mozilla_Custom_TMPLs b/mozilla/cmd/macfe/rsrc/CrossProduct/Mozilla_Custom_TMPLs deleted file mode 100644 index a3f6216ecb7..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/Mozilla_Custom_TMPLs and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/Other_Comm_TMPLS.rsrc b/mozilla/cmd/macfe/rsrc/CrossProduct/Other_Comm_TMPLS.rsrc deleted file mode 100644 index b874f5839f5..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/Other_Comm_TMPLS.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/UStdDialogs.cnst b/mozilla/cmd/macfe/rsrc/CrossProduct/UStdDialogs.cnst deleted file mode 100644 index 7cf733f90fb..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/UStdDialogs.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/CrossProduct/UStdDialogs.rsrc b/mozilla/cmd/macfe/rsrc/CrossProduct/UStdDialogs.rsrc deleted file mode 100644 index 192a4840480..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/CrossProduct/UStdDialogs.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/AddressWindow.rsrc b/mozilla/cmd/macfe/rsrc/communicator/AddressWindow.rsrc deleted file mode 100644 index cf9161bc043..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/AddressWindow.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/AddressesWindow.cnst b/mozilla/cmd/macfe/rsrc/communicator/AddressesWindow.cnst deleted file mode 100644 index d7fea4026bb..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/AddressesWindow.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Animation.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Animation.rsrc deleted file mode 100644 index fc9d74e4181..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Animation.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/AppleEvents.rsrc b/mozilla/cmd/macfe/rsrc/communicator/AppleEvents.rsrc deleted file mode 100644 index 2c03e31b58e..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/AppleEvents.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Artwork.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Artwork.rsrc deleted file mode 100644 index e2be558a2bc..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Artwork.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Bookmark.cnst b/mozilla/cmd/macfe/rsrc/communicator/Bookmark.cnst deleted file mode 100644 index 984348086bf..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Bookmark.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Bootstrap.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Bootstrap.rsrc deleted file mode 100644 index 46ee0816608..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Bootstrap.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Browser.cnst b/mozilla/cmd/macfe/rsrc/communicator/Browser.cnst deleted file mode 100644 index f5ab0094dcc..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Browser.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Browser.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Browser.rsrc deleted file mode 100644 index a2fafa469a2..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Browser.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/CDateView.rsrc b/mozilla/cmd/macfe/rsrc/communicator/CDateView.rsrc deleted file mode 100644 index ccb568835dc..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/CDateView.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/CDateViewCppbs.cnst b/mozilla/cmd/macfe/rsrc/communicator/CDateViewCppbs.cnst deleted file mode 100644 index b50e504fd27..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/CDateViewCppbs.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/CSizeBox.rsrc b/mozilla/cmd/macfe/rsrc/communicator/CSizeBox.rsrc deleted file mode 100644 index 09f7fa1d0ae..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/CSizeBox.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/CallerLDEF.rsrc b/mozilla/cmd/macfe/rsrc/communicator/CallerLDEF.rsrc deleted file mode 100644 index af6f3be530e..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/CallerLDEF.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/CommonWindowBottom.cnst b/mozilla/cmd/macfe/rsrc/communicator/CommonWindowBottom.cnst deleted file mode 100644 index 1c9bf7e1543..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/CommonWindowBottom.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/CommonWindowBottom.rsrc b/mozilla/cmd/macfe/rsrc/communicator/CommonWindowBottom.rsrc deleted file mode 100644 index b9a07a780da..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/CommonWindowBottom.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Communicator.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Communicator.rsrc deleted file mode 100644 index 43e5d142a20..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Communicator.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Editor.cnst b/mozilla/cmd/macfe/rsrc/communicator/Editor.cnst deleted file mode 100644 index 5820545a405..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Editor.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/FolderThreadMessage.cnst b/mozilla/cmd/macfe/rsrc/communicator/FolderThreadMessage.cnst deleted file mode 100644 index 690a31117c7..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/FolderThreadMessage.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/FolderThreadMessage.rsrc b/mozilla/cmd/macfe/rsrc/communicator/FolderThreadMessage.rsrc deleted file mode 100644 index 6dfbb0eea82..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/FolderThreadMessage.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Forms.cnst b/mozilla/cmd/macfe/rsrc/communicator/Forms.cnst deleted file mode 100644 index 4d2eeea79fe..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Forms.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Java.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Java.rsrc deleted file mode 100644 index 4541ea1dc8d..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Java.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MacDialogs.rsrc b/mozilla/cmd/macfe/rsrc/communicator/MacDialogs.rsrc deleted file mode 100644 index 70db57c5180..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MacDialogs.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailComposeWindow.cnst b/mozilla/cmd/macfe/rsrc/communicator/MailComposeWindow.cnst deleted file mode 100644 index ecb9b4c95b7..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailComposeWindow.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailComposeWindow.rsrc b/mozilla/cmd/macfe/rsrc/communicator/MailComposeWindow.rsrc deleted file mode 100644 index 180d0ea7a45..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailComposeWindow.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailFolderMenus.rsrc b/mozilla/cmd/macfe/rsrc/communicator/MailFolderMenus.rsrc deleted file mode 100644 index 46af01f486e..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailFolderMenus.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailMessageWindow.cnst b/mozilla/cmd/macfe/rsrc/communicator/MailMessageWindow.cnst deleted file mode 100644 index 5d10ccb9034..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailMessageWindow.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailMessageWindow.rsrc b/mozilla/cmd/macfe/rsrc/communicator/MailMessageWindow.rsrc deleted file mode 100644 index a54bf6b2cc4..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailMessageWindow.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailNewsAddressBook.cnst b/mozilla/cmd/macfe/rsrc/communicator/MailNewsAddressBook.cnst deleted file mode 100644 index d48ebaa0f72..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailNewsAddressBook.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailNewsCppbs.cnst b/mozilla/cmd/macfe/rsrc/communicator/MailNewsCppbs.cnst deleted file mode 100644 index a376acf4779..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailNewsCppbs.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailNewsSearch.cnst b/mozilla/cmd/macfe/rsrc/communicator/MailNewsSearch.cnst deleted file mode 100644 index 18a2281bf2e..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailNewsSearch.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/MailNewsSearch.rsrc b/mozilla/cmd/macfe/rsrc/communicator/MailNewsSearch.rsrc deleted file mode 100644 index 97b9bea8ce7..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/MailNewsSearch.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Menus.cnst b/mozilla/cmd/macfe/rsrc/communicator/Menus.cnst deleted file mode 100644 index 3bf9810f69b..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Menus.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/NavCenter.cnst b/mozilla/cmd/macfe/rsrc/communicator/NavCenter.cnst deleted file mode 100644 index 1441a67f73b..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/NavCenter.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/NavCenter.rsrc b/mozilla/cmd/macfe/rsrc/communicator/NavCenter.rsrc deleted file mode 100644 index ad9b1a61934..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/NavCenter.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Obsolete.cnst b/mozilla/cmd/macfe/rsrc/communicator/Obsolete.cnst deleted file mode 100644 index cde183b6c47..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Obsolete.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Offline.cnst b/mozilla/cmd/macfe/rsrc/communicator/Offline.cnst deleted file mode 100644 index 320651c8a97..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Offline.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Offline.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Offline.rsrc deleted file mode 100644 index 3336e27dbfe..00000000000 --- a/mozilla/cmd/macfe/rsrc/communicator/Offline.rsrc +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/mozilla/cmd/macfe/rsrc/communicator/PPSemanticActions.rsrc b/mozilla/cmd/macfe/rsrc/communicator/PPSemanticActions.rsrc deleted file mode 100644 index ce7ef2b41b7..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/PPSemanticActions.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Polaris.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Polaris.rsrc deleted file mode 100644 index c30b96dbd97..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Polaris.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/PowerPlantResources.rsrc b/mozilla/cmd/macfe/rsrc/communicator/PowerPlantResources.rsrc deleted file mode 100644 index f3bd4e85c48..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/PowerPlantResources.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Profile.cnst b/mozilla/cmd/macfe/rsrc/communicator/Profile.cnst deleted file mode 100644 index e622b8b4a6a..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Profile.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/PropertiesDialogs.cnst b/mozilla/cmd/macfe/rsrc/communicator/PropertiesDialogs.cnst deleted file mode 100644 index 1db7c98fb2f..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/PropertiesDialogs.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Subscribe.cnst b/mozilla/cmd/macfe/rsrc/communicator/Subscribe.cnst deleted file mode 100644 index e91b906134f..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Subscribe.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/Subscribe.rsrc b/mozilla/cmd/macfe/rsrc/communicator/Subscribe.rsrc deleted file mode 100644 index 85e25fb3b7a..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/Subscribe.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/TaskBar.cnst b/mozilla/cmd/macfe/rsrc/communicator/TaskBar.cnst deleted file mode 100644 index 0f63b7308a3..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/TaskBar.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/TextTraits.cnst b/mozilla/cmd/macfe/rsrc/communicator/TextTraits.cnst deleted file mode 100644 index d30583afd10..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/TextTraits.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/ToolTips.cnst b/mozilla/cmd/macfe/rsrc/communicator/ToolTips.cnst deleted file mode 100644 index 3ba303c08dc..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/ToolTips.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/ToolTips.rsrc b/mozilla/cmd/macfe/rsrc/communicator/ToolTips.rsrc deleted file mode 100644 index 6d56c88644b..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/ToolTips.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/communicator/edtprop.rsrc b/mozilla/cmd/macfe/rsrc/communicator/edtprop.rsrc deleted file mode 100644 index e6f10ba09ce..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/communicator/edtprop.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/ArtworkRat.rsrc b/mozilla/cmd/macfe/rsrc/navigator/ArtworkRat.rsrc deleted file mode 100644 index 84c104106ae..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/ArtworkRat.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/BrowserRat.cnst b/mozilla/cmd/macfe/rsrc/navigator/BrowserRat.cnst deleted file mode 100644 index f2f4ba48d2f..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/BrowserRat.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/BrowserRat.rsrc b/mozilla/cmd/macfe/rsrc/navigator/BrowserRat.rsrc deleted file mode 100644 index 98342121246..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/BrowserRat.rsrc and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/MenusRat.cnst b/mozilla/cmd/macfe/rsrc/navigator/MenusRat.cnst deleted file mode 100644 index dcc3f0ef9c9..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/MenusRat.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/MozCommonWindowBottom.cnst b/mozilla/cmd/macfe/rsrc/navigator/MozCommonWindowBottom.cnst deleted file mode 100644 index d11e5f7b770..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/MozCommonWindowBottom.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/PrefsWindowRat.cnst b/mozilla/cmd/macfe/rsrc/navigator/PrefsWindowRat.cnst deleted file mode 100644 index 4621050e044..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/PrefsWindowRat.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/rsrc/navigator/ProfileRat.cnst b/mozilla/cmd/macfe/rsrc/navigator/ProfileRat.cnst deleted file mode 100644 index 74e25466bb9..00000000000 Binary files a/mozilla/cmd/macfe/rsrc/navigator/ProfileRat.cnst and /dev/null differ diff --git a/mozilla/cmd/macfe/sharemnu/LMenuSharing.cp b/mozilla/cmd/macfe/sharemnu/LMenuSharing.cp deleted file mode 100644 index cc4d2ea888c..00000000000 --- a/mozilla/cmd/macfe/sharemnu/LMenuSharing.cp +++ /dev/null @@ -1,182 +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. - */ - -#include "LMenuSharing.h" // ALWAYS put the .h file first. This ensures that it compiles. - -#include "MenuSharing.h" // This is the UserLand header. -#include "uapp.h" -#include "uerrmgr.h" -#include "PascalString.h" -#include -//#include "MercutioAPI.h" - -#include "CTargetedUpdateMenuRegistry.h" - -// Menu sharing callbacks -static pascal void ErrorDialog (Str255 s); -static pascal void EventFilter (EventRecord *ev); - -static pascal void ErrorDialog (Str255 s) -{ - ErrorManager::PlainAlert(s, NULL, NULL, NULL); -} - -static pascal void EventFilter (EventRecord *ev) -{ - (CFrontApp::GetApplication())->DispatchEvent(*ev); -} - -// =========================================================================== -// LMenuSharing.cp -// =========================================================================== -// MenuSharing class. Based upon Frontier and draper@usis.com code - -Int16 LMenuSharingAttachment::sInsertAfterMenuID = 0; -Int16 LMenuSharingAttachment::sNextPluginMenuID = 20000; - -LMenuSharingAttachment::LMenuSharingAttachment( - MessageT inMessage, - Boolean inExecuteHost,Int16 resIDofLastMenu) - : LAttachment(inMessage, inExecuteHost) -{ - mCanMenuShare = ::InitSharedMenus (ErrorDialog, EventFilter); - sInsertAfterMenuID = resIDofLastMenu + 1; -} - -Int16 LMenuSharingAttachment::AllocatePluginMenuID(Boolean isSubmenu) -{ - // force the menus to be recreated. - DisposeSharedMenus(); - if (isSubmenu) { - // this needs to take a menu ID out of the space used by MenuSharing. - return sInsertAfterMenuID++; - } else { - // these can come out of a different range, because they aren't hierarchical. - return sNextPluginMenuID++; - } -} - -void LMenuSharingAttachment::ExecuteSelf( MessageT inMessage, void* ioParam) -{ - if (!mCanMenuShare) - return; // Don't bother if we can't menu share... - mExecuteHost = true; - switch (inMessage) - { - case msg_Event: - - EventRecord * ev = (EventRecord*)ioParam; - ResIDT menuId; - Int16 menuItem; - MenuHandle menuH; - CommandT command; - LMenuBar* menubar; - WindowPtr w; - Int16 part; - LCommander* commander; - - CheckSharedMenus(sInsertAfterMenuID); - - if (ev->what== mouseDown) - { - part = FindWindow (ev->where, &w); - if (part == inMenuBar) - { - // (CFrontApp::GetApplication())->UpdateMenus(); - // myoung: Do this instead. - CTargetedUpdateMenuRegistry::SetCommands(CFrontApp::GetCommandsToUpdateBeforeSelectingMenu()); - CTargetedUpdateMenuRegistry::UpdateMenus(); - - menubar = LMenuBar::GetCurrentMenuBar(); - - Int32 theMenuChoice; - command = menubar->MenuCommandSelection(*ev, theMenuChoice); - - menubar->FindMenuItem(command,menuId,menuH,menuItem); - mExecuteHost = false; - if (command != cmd_Nothing) - { - if (LCommander::IsSyntheticCommand(command, menuId, menuItem)) - { - if (SharedMenuHit (menuId, menuItem)) - { - HiliteMenu(0); - break; - } - } - commander = LCommander::GetTarget(); - commander->ProcessCommand(command, nil); - mExecuteHost = false; - } - HiliteMenu(0); - } - break; - } - else if (ev->what!=keyDown) //On keyDown, just drop through the attachments - break; - case msg_KeyPress: - - ev = (EventRecord*)ioParam; - char ch; - - mExecuteHost = true; - command = cmd_Nothing; - ch = (*ev).message & charCodeMask; - menubar = LMenuBar::GetCurrentMenuBar(); - - if (menubar->CouldBeKeyCommand(*ev)) - { - // I moved this in here so it is only called when the command key is down. - // It was making editing unusable. Also, we only need the menu stuff, not - // the side effects (like button updates), so call the base class method. - // --- 97/01/21 jrm - - // (CFrontApp::GetApplication())->LApplication::UpdateMenus(); - // myoung: Don't do this here. - - // MacOS8 can do the weird key combos for us w/out Mercutio. - SInt32 unused; - LAppearanceMBAR* amMenuBar = dynamic_cast(menubar); - if ( amMenuBar ) - command = amMenuBar->FindKeyCommand ( *ev, unused ); - - if ( command ) { - if (LCommander::IsSyntheticCommand(command,menuId, menuItem)) - { - if (SharedMenuHit (menuId, menuItem))// someone is running a script from a commandKey - { - HiliteMenu(0); - mExecuteHost = false; - break; - } - } - } - if (ch == '.') - { - if (SharedScriptRunning ()) /*cmd-period terminates the script*/ - CancelSharedScript (); /*cancel the shared menu script*/ - } - } - break; - default: - break; - } -} - - - diff --git a/mozilla/cmd/macfe/sharemnu/LMenuSharing.h b/mozilla/cmd/macfe/sharemnu/LMenuSharing.h deleted file mode 100644 index 5f863edc0c4..00000000000 --- a/mozilla/cmd/macfe/sharemnu/LMenuSharing.h +++ /dev/null @@ -1,42 +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. - */ - -#pragma once - -#include -// =========================================================================== -// ¥ LMenuSharingAttachment -// =========================================================================== - - -class LMenuSharingAttachment : public LAttachment { -public: - LMenuSharingAttachment(MessageT inMessage, - Boolean inExecuteHost, - Int16 resIDofLastMenu); - // resIDofLastMenu is the id of the menu that shared menus will - // will be inserted after. - - static Int16 AllocatePluginMenuID(Boolean isSubmenu); - -protected: - virtual void ExecuteSelf(MessageT inMessage, void *ioParam); - Boolean mCanMenuShare; - static Int16 sInsertAfterMenuID; - static Int16 sNextPluginMenuID; -}; diff --git a/mozilla/cmd/macfe/tools/AnnotateExports b/mozilla/cmd/macfe/tools/AnnotateExports deleted file mode 100644 index c6dfcf513bf..00000000000 --- a/mozilla/cmd/macfe/tools/AnnotateExports +++ /dev/null @@ -1,284 +0,0 @@ -# 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. - - -# -# AnnotateExports exp_file [old_exp_file] -# -# Original Author: scc (Scott Collins) - - -# ...munge a .exp file generated by CodeWarrior into a form fit for humans and MakeStub as well as CodeWarrior -# itself. When the optional second .exp file is given, it determines which symbols from the first file will be -# exported (other symbols will be present but commented out), and overrides the symbol kind (code or data) for -# those symbols from the first file for which CW did not tell us the kind. This makes it easy to generate a new -# .exp that lists all the up-to-date symbols in project, but exports nothing new: - -# 1. Make the .exp file that you want to bring up-to-date writable; and remove it from its project. -# 2. Re-link the project so that CodeWarrior will generate a fresh .exp file listing all exportable symbols. -# 3. Use this script to munge the new .exp file, filtering with the old: -# AnnotateExports new.exp old.exp | Catenate > old.exp -# 4. Add the old .exp file (with its new contents) back into the project; and re-link. - -# If you're adding new symbols, then before re-linking in step 4, un-comment their signatures in the re-added .exp file. -# Usually radical updates like this won't even be necessary. It will often suffice to simply comment or un-comment an -# existing symbol in the .exp file. - -# Warning: When you run this script with the optional `old' .exp file, symbols exported by the `old' .exp file, -# but not found in the new one will be listed in a special section at the end of the generated file. They may -# be `re-exports', i.e., symbols defined in a shared library your project includes, and re-exported by you. -# _Or_ (more likely) they could be old signatures that you no longer implement and should be deleted. So, when -# you regenerate a .exp file SCROLL TO THE END AND SEE IF YOU NEED TO DELETE SOME OF THESE ENTRIES. - -# Warning: MakeStub is very picky about comments. To be ignored, they must start in the left-most column. -# Warning: this script may need to be adjusted when CodeWarrior supports namespaces. - - - - # - # Emit a comment to go at the top of the generated .exp file - # - -Evaluate %=("{{0}}" =~ /Å:(Å)¨0/) # {¨0} is the leaf name of this script, for use in the generated comment below -Evaluate %=("{{1}}" =~ /Å:(Å)¨1/) # {¨1} is the leaf name of the new .exp file, for use in the generated comment below - -Echo '###' -Echo "### This file was generated by {{¨0}} (`Date`) from {{¨1}}." -Echo '###' -Echo '### [Un-]Comment-out (do not delete) symbols and annotate with #{code} and #{data} to control export.' -Echo "### When brand new signatures are to be exported, regenerate this file as described in {{¨0}}." -Echo '### Warning: all comments MUST start in the left column, or else stubs will be built wrong.' -Echo '###' - - - - # - # Sort the raw input file (and perform some eliding) before sending it into the Perl script - # - - # Strip out all '@#@' symbols (out-of-line inlines which will never be imported) -(Search -q -r /¥@[0-9]+@/ "{{1}}" || Echo -n) > "{{TempFolder}}non_inline_symbols" - # Copy and sort all lines not containing "::" into a temporary file. This comprises all non-member symbols. -(Search -q -r /¶:¶:/ "{{TempFolder}}non_inline_symbols" || Echo -n) | Sort -unique > "{{TempFolder}}global_symbols" - - - # The file we're passing into the Perl script is sorted such that... -Begin - Search -q -r /¶#/ "{{TempFolder}}global_symbols" || Set Status 0 # non-member symbols without comments come first (the ones we can't between code and data without help) - Search -q /¶#/ "{{TempFolder}}global_symbols" || Set Status 0 # followed by non-member symbols with comments (we know absolutely whether they are code or data) - (Search -q /¶:¶:/ "{{TempFolder}}non_inline_symbols" || Echo -n) | Sort -unique -fs "¶#:" -f 2,1 - # followed by member symbols, sorted first by classname, and within a class by member name -End > "{{TempFolder}}sorted_symbols" - - - - # - # Call the Perl (part of this) script to do the complicated munging... - # - - # The Perl script takes two arguments. Neither is optional. - # If we're not given the (optional) list of symbols to allow the .exp file to export... -If ( Not "{{2}}" ) - Set 2 "{{TempFolder}}sorted_symbols" # ...then use the file itself as the list of what to allow, i.e., allowing everything. -End - - # Tell Perl to find a Perl script within this file, and run it with two parameters... -Perl -S -x "{{0}}" "{{TempFolder}}sorted_symbols" "{{2}}" - - - - # - # Clean up... - # - -Delete -i "{{TempFolder}}non_inline_symbols" "{{TempFolder}}global_symbols" "{{TempFolder}}sorted_symbols" -Exit 0 - - - - # - # The Perl (part of this) script... - # - -#!perl - -# -# Inputs: -# (0) sorted `new' .exp file with CodeWarrior generated comments -# (1) `old' .exp file, possibly annotated with #{code} and #{data} - -# Constants: - -$codeKind = "#\{code\}\n"; -$dataKind = "#\{data\}\n"; -$defaultKind = $codeKind; - - - - # - # parse the old .exp file, and remember each exported symbol and its kind (i.e., unknown, code, or data) - # - -open OLD_EXP_FILE, "<$ARGV[1]" or die "couldn\'t open \"$ARGV[1]\""; -$symbol_kind = $defaultKind; -while ( $_ = ) - { - if ( $_ =~ /^(\#\{(code|data)\})/ ) # if the line is a #{code} or #{data} directive... - { - $symbol_kind = "$1\n"; # ...subsequent symbols will be of that kind - } - elsif ( $_ =~ /^([^\s\#]+)/ ) # else, if there is an exported symbol on this line... - { - $previously_exported{$1} = $symbol_kind; # ...put it in the table of exported symbols, along with its kind. - } - } -close OLD_EXP_FILE; - - - - # - # parse the new .exp file which must contain CodeWarrior generated .exp comments - # - -open NEW_EXP_FILE, "<$ARGV[0]" or die "couldn\'t open \"$ARGV[0]\""; - -$symbol_classname = ""; -$last_printed_classname = $symbol_classname; - -$symbol_kind = $defaultKind; -$last_printed_kind = $symbol_kind; - -$seen_any_commented_symbol = 0; - -print "\n\n###\n### Symbols you may have to hand annotate with #\{code\} or #\{data\}...\n###\n\n"; - -while ( $_ = ) - { - $ending_hand_annotated_symbols = 0; - - - if ( $_ =~ /^#\s*(\S+)/ ) - { - # if someone already commented out the entire line (CodeWarrior doesn't currently do this), they must mean `don't export this symbol' - $_ = "$1$'"; - delete $previously_exported{$1}; - } - - # If the current line contains a comment... - - if ( $_ =~ /#/ ) - { - if ( ! $seen_any_commented_symbol ) - { - print "\n\n###\n### Symbols which do not require hand annotation...\n###\n\n"; - $seen_any_commented_symbol = 1; - $ending_hand_annotated_symbols = 1; - } - - # '::' appears on a line if and only if CodeWarrior added a comment giving a symbols unmangled classname::membername - # WARNING: when CodeWarrior supports namespaces, this may need to be changed. - if ( $_ =~ /# (\w+)::/ ) - { - $symbol_classname = $1; - } - - - $symbol_kind_unknown = 0; # Since there was a comment, the symbol kind (i.e., code or data), is definitely known. - - # Parentheses appear on a line if and only if CodeWarrior added a comment giving a symbols function prototype. - if ( $_ =~ /\(/ ) - { - $symbol_kind = $codeKind; # ...therefore, this symbol is a function. - } - else - { - $symbol_kind = $dataKind; # ...else, it is data (since a CodeWarrior generated .exp file lists only code and - # data, and only comments symbols that it knows whether they are code or data, and - # since this item is not code and has a comment). - } - } - else - { - $symbol_kind = $defaultKind; - $symbol_kind_unknown = 1; - } - - - - # If the current line contains an exported symbol... - - if ( $_ =~ /^(\S+)/ ) - { - $symbol = $1; - $symbol_was_previously_exported = exists( $previously_exported{$symbol} ); - - # If we don't know the kind of this symbol (code or data), get it from the table we built from the old .exp file. - if ( $symbol_kind_unknown && $symbol_was_previously_exported ) - { - $symbol_kind = $previously_exported{$symbol}; - } - - $starting_new_class = ($symbol_classname ne $last_printed_classname); - $starting_new_kind = ($symbol_kind ne $last_printed_kind) || $starting_new_class || $ending_hand_annotated_symbols; # ...also forces #{code} and #{data} to be self-contained per class - - if ( $starting_new_class ) - { - print "\n### class $symbol_classname\n"; - $last_printed_classname = $symbol_classname; - } - - if ( $starting_new_kind ) - { - print $symbol_kind; - $last_printed_kind = $symbol_kind; - } - - - if ( $symbol_was_previously_exported ) - { - delete $previously_exported{$symbol}; - } - else - { - print '# '; - } - print "$symbol\n"; # ...and emit the symbol name. - } - - } -close NEW_EXP_FILE; - - # - # - # - - -$header = "\n\n###\n### Symbols which are not present, but you wanted to export anyway (i.e., either re-exports or mistakes)...\n###\n\n"; - -$last_printed_kind = ""; -foreach $symbol ( sort(keys %previously_exported) ) - { - print $header; - $header = ""; - - $symbol_kind = $previously_exported{$symbol}; - $starting_new_kind = ($symbol_kind ne $last_printed_kind); - if ( $starting_new_kind ) - { - print $symbol_kind; - $last_printed_kind = $symbol_kind; - } - print "$symbol\n"; - } diff --git a/mozilla/cmd/macfe/utility/CAutoPtr.h b/mozilla/cmd/macfe/utility/CAutoPtr.h deleted file mode 100644 index 5d411f63bb2..00000000000 --- a/mozilla/cmd/macfe/utility/CAutoPtr.h +++ /dev/null @@ -1,65 +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. - */ - -/* CAutoPtr.h */ - - -#ifndef CAutoPtr_H -#define CAutoPtr_H -#pragma once - -template -class CAutoPtr -{ - public: - CAutoPtr(T* p = 0) : p_(p) { } - - CAutoPtr(const CAutoPtr& r) : p_(r.release()) { } - - ~CAutoPtr() { delete p_; } - - CAutoPtr& operator = (const CAutoPtr& r) { - if ((void *)&r != (void *) this) { - delete p_; - p_ = r.release(); - } - return *this; - } - - T& operator*(void) const{ return *p_; } - - T* operator->(void) const { return p_; } - - T* get(void) const { return p_; } - - void reset(T* p = 0) { - delete p_; - p_ = p; - } - - T* release(void) const { - T* old = p_; - const_cast(this)->p_ = 0; - return old; - } - - private: - T* p_; -}; - -#endif \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/CAutoPtrXP.h b/mozilla/cmd/macfe/utility/CAutoPtrXP.h deleted file mode 100644 index d4a1017503b..00000000000 --- a/mozilla/cmd/macfe/utility/CAutoPtrXP.h +++ /dev/null @@ -1,77 +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. - */ - -/* CAutoPtrXP.h */ - -#ifndef CAutoPtrXP_H -#define CAutoPtrXP_H -#pragma once - -#include "xp_mem.h" - -template -class CAutoPtrXP -{ - public: - CAutoPtrXP(T* p = 0) : p_(p) { } - - CAutoPtrXP(const CAutoPtrXP& r) : p_(r.release()) { } - - ~CAutoPtrXP() { - if (p_) - { - XP_FREE(p_); - } - } - - CAutoPtrXP& operator = (const CAutoPtrXP& r) { - if ((void *)&r != (void *) this) { - if (p_) - { - XP_FREE(p_); - } - p_ = r.release(); - } - return *this; - } - - T& operator*(void) const{ return *p_; } - - T* operator->(void) const { return p_; } - - T* get(void) const { return p_; } - - void reset(T* p = 0) { - if (p_) - { - XP_FREE(p_); - } - p_ = p; - } - - T* release() const { - T* old = p_; - const_cast(this)->p_ = 0; - return old; - } - - private: - T* p_; -}; - -#endif \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/CDefaultFontFontSwitcher.cp b/mozilla/cmd/macfe/utility/CDefaultFontFontSwitcher.cp deleted file mode 100644 index be67fa2b192..00000000000 --- a/mozilla/cmd/macfe/utility/CDefaultFontFontSwitcher.cp +++ /dev/null @@ -1,47 +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. - */ - -// =========================================================================== -// CDefaultFontFontSwitcher.cp -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -#include "CDefaultFontFontSwitcher.h" -#include "uintl.h" - -INTL_Encoding_ID CDefaultFontFontSwitcher::gEncodingOfDefaultFont = 0; - -CDefaultFontFontSwitcher::CDefaultFontFontSwitcher(UFontSwitcher* delegate) -{ - GrafPtr port; - ::GetPort(&port); - mDefaultFont = port->txFont; - if(0 == gEncodingOfDefaultFont) - { - gEncodingOfDefaultFont = ScriptToEncoding(::GetScriptManagerVariable( smSysScript ) ); - } - mDelegate = delegate; - -} -void CDefaultFontFontSwitcher::EncodingTextFont(INTL_Encoding_ID encoding) -{ - if(gEncodingOfDefaultFont == encoding) - ::TextFont(mDefaultFont); - else - mDelegate->EncodingTextFont(encoding); -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/CDefaultFontFontSwitcher.h b/mozilla/cmd/macfe/utility/CDefaultFontFontSwitcher.h deleted file mode 100644 index 85da7ea40bb..00000000000 --- a/mozilla/cmd/macfe/utility/CDefaultFontFontSwitcher.h +++ /dev/null @@ -1,42 +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. - */ - -// =========================================================================== -// CDefaultFontFontSwitcher.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com - -/*----------------------------------------------------------------------------- - CDefaultFontFontSwitcher - Class know how to switch font depend on CPrefs:CCharSet - */ -#pragma once -#include "UPropFontSwitcher.h" - -class CDefaultFontFontSwitcher : public UFontSwitcher { - - public: - virtual void EncodingTextFont(INTL_Encoding_ID encoding); - CDefaultFontFontSwitcher(UFontSwitcher* delegate); - void RestoreDefaultFont() {::TextFont(mDefaultFont); } - private: - static INTL_Encoding_ID gEncodingOfDefaultFont; - UFontSwitcher* mDelegate; - short mDefaultFont; -}; diff --git a/mozilla/cmd/macfe/utility/CLibMsgPeriodical.cp b/mozilla/cmd/macfe/utility/CLibMsgPeriodical.cp deleted file mode 100644 index bf4a96deec9..00000000000 --- a/mozilla/cmd/macfe/utility/CLibMsgPeriodical.cp +++ /dev/null @@ -1,50 +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. - */ - -// CLibMsgPeriodical.cp - -#include "CLibMsgPeriodical.h" -#include "msgcom.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥¥¥ -// ¥ Class CLibMsgPeriodical -// ¥¥¥ -// -// This is a subclass of LPeriodical which calls the new libmsg init, exit, -// and idle routines. -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CLibMsgPeriodical::CLibMsgPeriodical() : -LPeriodical() -{ - MSG_InitMsgLib(); - - /* use less memory! */ - MSG_SetDBCacheSize ( 512 * 1024L ); -} - -CLibMsgPeriodical::~CLibMsgPeriodical() -{ - MSG_ShutdownMsgLib(); -} - -void CLibMsgPeriodical::SpendTime(const EventRecord& /* inMacEvent */) -{ - MSG_OnIdle(); -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/CLibMsgPeriodical.h b/mozilla/cmd/macfe/utility/CLibMsgPeriodical.h deleted file mode 100644 index 84240da0c0a..00000000000 --- a/mozilla/cmd/macfe/utility/CLibMsgPeriodical.h +++ /dev/null @@ -1,43 +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. - */ - -// CLibMsgPeriodical.h - -#pragma once - -#include - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥¥¥ -// ¥ Class CLibMsgPeriodical -// ¥¥¥ -// -// This is a subclass of LThread which calls the new libmsg init, exit, and -// idle routines. Since we have to call an idle time routine, it seems like -// this would be a good candidate to be in a thread -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CLibMsgPeriodical : public LPeriodical -{ - public: - CLibMsgPeriodical(); - virtual ~CLibMsgPeriodical(); - - protected: - virtual void SpendTime(const EventRecord& inMacEvent); -}; diff --git a/mozilla/cmd/macfe/utility/CLibMsgThread.cp b/mozilla/cmd/macfe/utility/CLibMsgThread.cp deleted file mode 100644 index cb389ace2ae..00000000000 --- a/mozilla/cmd/macfe/utility/CLibMsgThread.cp +++ /dev/null @@ -1,54 +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. - */ - -// CLibMsgThread.cp - - -#include "CLibMsgThread.h" -#include "msgcom.h" - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥¥¥ -// ¥ Class CLibMsgThread -// ¥¥¥ -// -// This is a subclass of LThread which calls the new libmsg init, exit, and -// idle routines. Since we have to call an idle time routine, it seems like -// this would be a good candidate as any to be in a thread -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -CLibMsgThread::CLibMsgThread() : -LThread(false) -{ - MSG_InitMsgLib(); -} - -CLibMsgThread::~CLibMsgThread() -{ - MSG_ShutdownMsgLib(); -} - -void *CLibMsgThread::Run() -{ - while(true) { - LThread::Yield(); - MSG_OnIdle(); - LThread::Yield(); - } - return NULL; -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/CLibMsgThread.h b/mozilla/cmd/macfe/utility/CLibMsgThread.h deleted file mode 100644 index 0d0fd1f378f..00000000000 --- a/mozilla/cmd/macfe/utility/CLibMsgThread.h +++ /dev/null @@ -1,44 +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. - */ - -// CLibMsgThread.h - - -#pragma once - -#include - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥¥¥ -// ¥ Class CLibMsgThread -// ¥¥¥ -// -// This is a subclass of LThread which calls the new libmsg init, exit, and -// idle routines. Since we have to call an idle time routine, it seems like -// this would be a good candidate to be in a thread -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -class CLibMsgThread : public LThread -{ - public: - CLibMsgThread(); - virtual ~CLibMsgThread(); - - protected: - virtual void* Run(); -}; diff --git a/mozilla/cmd/macfe/utility/CSaveWindowStatus.cp b/mozilla/cmd/macfe/utility/CSaveWindowStatus.cp deleted file mode 100644 index 7259c8b1055..00000000000 --- a/mozilla/cmd/macfe/utility/CSaveWindowStatus.cp +++ /dev/null @@ -1,388 +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. - */ - -/*====================================================================================== - AUTHOR: Ted Morris - 08 NOV 96 - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "CSaveWindowStatus.h" - -#include "uprefd.h" -#include "macutil.h" - - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - -/*====================================================================================== - Find the global bounds for the pane. -======================================================================================*/ - -void CSaveWindowStatus::GetPaneGlobalBounds(LPane *inPane, Rect *outBounds) { - - inPane->CalcPortFrameRect(*outBounds); - inPane->PortToGlobalPoint(topLeft(*outBounds)); - inPane->PortToGlobalPoint(botRight(*outBounds)); -} - - -/*====================================================================================== - Move this window to an alert position on the main screen. -======================================================================================*/ - -void CSaveWindowStatus::MoveWindowToAlertPosition(LWindow *inWindow) { - - Rect bounds; - - GetPaneGlobalBounds(inWindow, &bounds); - - GDHandle dominantDevice; - LWindow *frontWindowP = UDesktop::FetchTopRegular(); - - if ( frontWindowP ) { - dominantDevice = UWindows::FindDominantDevice( - UWindows::GetWindowStructureRect(frontWindowP->GetMacPort())); - } else { - dominantDevice = ::GetMainDevice(); - } - - Rect screenRect = (**dominantDevice).gdRect; - if ( dominantDevice == ::GetMainDevice() ) { - screenRect.top += GetMBarHeight(); - } - - ::OffsetRect(&bounds, screenRect.left + ((screenRect.right - screenRect.left - (bounds.right - bounds.left)) / 2) - bounds.left, - screenRect.top + ((screenRect.bottom - screenRect.top - (bounds.bottom - bounds.top)) / 3) - bounds.top); - - inWindow->DoSetBounds(bounds); -} - - -/*====================================================================================== - Move this window to a new position on the main screen. -======================================================================================*/ - -void CSaveWindowStatus::MoveWindowTo(LWindow *inWindow, Point inGlobalTopLeft) { - - Rect bounds; - GetPaneGlobalBounds(inWindow, &bounds); - - ::OffsetRect(&bounds, inGlobalTopLeft.h - bounds.left, - inGlobalTopLeft.v - bounds.top); - - VerifyWindowBounds(inWindow, &bounds); - inWindow->DoSetBounds(bounds); -} - - -/*====================================================================================== - Verify the specified bounds against the window min/max sizes and the desktop - bounds. -======================================================================================*/ -static -inline -Int16 -pin( const Int16& lo, const Int16& x, const Int16& hi ) - { - return (xGetMacPort()); - Rect contentRect = UWindows::GetWindowContentRect(inWindow->GetMacPort()); - - Int16 topPadding = contentRect.top - structureRect.top; - Int16 bottomPadding = structureRect.bottom - contentRect.bottom; - Int16 leftPadding = contentRect.left - structureRect.left; - Int16 rightPadding = structureRect.right - contentRect.right; - - // ...and shrink |desktopRect| accordingly (so it is relative to our content rect, instead of our structure rect). - desktopRect.top += cWindowDesktopMargin + topPadding; - desktopRect.bottom -= cWindowDesktopMargin + bottomPadding; - desktopRect.left += cWindowDesktopMargin + leftPadding; - desktopRect.right -= cWindowDesktopMargin + rightPadding; - - desktopMinTop = desktopRect.top; // windows content rect top must not be above this this - desktopMaxBottom = desktopRect.bottom; // ...nor its bottom below this - desktopMaxHeight = desktopMaxBottom - desktopMinTop; // ...nor its height greater than this - - desktopMinLeft = desktopRect.left; // ... - desktopMaxRight = desktopRect.right; - desktopMaxWidth = desktopMaxRight - desktopMinLeft; - } - - /* - Second, calculate the minimum and maximum size of the window based on its own min/max settings - and the limits imposed by the screen. - */ - Int16 minHeight, maxHeight, minWidth, maxWidth; - { - Rect windowLimits; - inWindow->GetMinMaxSize(windowLimits); - - minHeight = pin(0, windowLimits.top, desktopMaxHeight); - maxHeight = pin(minHeight, windowLimits.bottom, desktopMaxHeight); - minWidth = pin(0, windowLimits.left, desktopMaxWidth); - maxWidth = pin(minWidth, windowLimits.right, desktopMaxWidth); - } - - /* - Third, pin the windows size to its calculated limits. - */ - Int16 height = pin(minHeight, ioGlobalBounds->bottom-ioGlobalBounds->top, maxHeight); - Int16 width = pin(minWidth, ioGlobalBounds->right-ioGlobalBounds->left, maxWidth); - - - /* - Fourth (and finally), now that we know its size, pin its location onto the screen, and - stuff the calculated results back into |ioGlobalBounds|. - */ - ioGlobalBounds->top = pin(desktopMinTop, ioGlobalBounds->top, desktopMaxBottom - height); - ioGlobalBounds->left = pin(desktopMinLeft, ioGlobalBounds->left, desktopMaxRight - width); - - ioGlobalBounds->bottom = ioGlobalBounds->top + height; - ioGlobalBounds->right = ioGlobalBounds->left + width; -} - - -/*====================================================================================== - Better create window with saved status ID. -======================================================================================*/ - -LWindow *CSaveWindowStatus::CreateWindow(ResIDT inWindowID, LCommander *inSuperCommander) { - - LCommander::SetDefaultCommander(inSuperCommander); - LAttachable::SetDefaultAttachable(nil); - - LWindow *theWindow = (LWindow *) UReanimator::ReadObjects('PPob', inWindowID); - - try - { - FailNIL_(theWindow); - theWindow->FinishCreate(); - if ( theWindow->HasAttribute(windAttr_ShowNew) ) { - theWindow->Show(); - } - } - catch(...) - { - delete theWindow; - throw; - } - return theWindow; -} - -/*====================================================================================== - Do basic initialization of the window. Should be called from the window's - FinishCreateSelf(). -======================================================================================*/ - -void CSaveWindowStatus::FinishCreateWindow() -{ - Handle statusInfoH = CPrefs::ReadWindowData(GetStatusResID()); - Boolean doAdjustNIL = true; - - try { - - // Validate stored state info - if ( statusInfoH ) { - LHandleStream statusStream(statusInfoH); - UInt16 bogusVersion, version; - // As of 97/10/13, we are writing out zero as the first version data, - // because Communicator 4.0x was checking version >= GetValidStatusVersion(), - // and thus trying to decode future versions of the status, and crashing. - statusStream >> bogusVersion; // and discard this zero. - statusStream >> version; - if ( bogusVersion == 0 && version == GetValidStatusVersion() ) { - doAdjustNIL = false; - ReadWindowStatus(&statusStream); - } - } - } - catch ( ExceptionCode inErr) { - - Assert_(false); // Just catch it, don't do anything! - } - catch ( OSErr inErr ) { } // probably bad status version. Again, do nothing - - if ( doAdjustNIL ) ReadWindowStatus(nil); -} - -void CSaveWindowStatus::FinishCreateWindow(CSaveWindowStatus* inTemplateWindow) -{ - ThrowIfNot_(inTemplateWindow->GetStatusResID() == GetStatusResID()); - ThrowIfNot_(inTemplateWindow->GetValidStatusVersion() == GetValidStatusVersion()); - LHandleStream statusStream; - inTemplateWindow->WriteWindowStatus(&statusStream); - statusStream.SetMarker(0, streamFrom_Start); - this->ReadWindowStatus(&statusStream); - // Stagger. - Rect bounds; - GetPaneGlobalBounds(mWindowSelf, &bounds); - OffsetRect(&bounds, 20, 20); - VerifyWindowBounds(mWindowSelf, &bounds); - mWindowSelf->DoSetBounds(bounds); -} - -/*====================================================================================== - Try to close a Window as a result of direct user action. Save window status. Should - be called from the window's AttemptClose() or DoClose() method as follows: - - virtual void AttemptClose() { - AttemptCloseWindow(); - inherited::AttemptClose(); - } - virtual void DoClose() { - AttemptCloseWindow(); - inherited::DoClose(); - } -======================================================================================*/ - -void CSaveWindowStatus::AttemptCloseWindow() { - - Assert_(mWindowSelf->GetSuperCommander() != nil); - - if ( mWindowSelf->GetSuperCommander()->AllowSubRemoval(mWindowSelf) ) { - SaveStatusInfo(); - } -} - - -/*====================================================================================== - Adjust the window to stored preferences. This method should be overriden in subclasses to - read data from the stream as stored preferences. Make sure to call this method - first. -======================================================================================*/ - -void CSaveWindowStatus::ReadWindowStatus(LStream *inStatusData) -{ - if ( inStatusData != nil ) - { - mHasSavedStatus = true; - - Rect bounds; - *inStatusData >> bounds; - VerifyWindowBounds(mWindowSelf, &bounds); - mWindowSelf->DoSetBounds(bounds); - } - // Don't center the window in the default case, because not all clients - // want this. -} - - -/*====================================================================================== - Get window stored preferences. This method should be overriden in subclasses to - write data to the stream that needs to be stored. Make sure to call this method - first. -======================================================================================*/ - -void CSaveWindowStatus::WriteWindowStatus(LStream *outStatusData) -{ - mHasSavedStatus = true; - - Rect bounds; - GetPaneGlobalBounds(mWindowSelf, &bounds); - - *outStatusData << bounds; -} - - -/*====================================================================================== - Store window preferences. -======================================================================================*/ - -void CSaveWindowStatus::SaveStatusInfo() -{ - if ( !mCanSaveStatus ) return; - - try - { - LHandleStream statusStream; - UInt16 bogusVersion = 0; // so that Communicator 4.0x will not use the data. - statusStream << bogusVersion; - statusStream << GetValidStatusVersion(); - - WriteWindowStatus(&statusStream); - - CPrefs::WriteWindowData(statusStream.GetDataHandle(), GetStatusResID()); - } - catch(...) - { - - Assert_(false); // Just catch it, don't do anything! - } -} - - diff --git a/mozilla/cmd/macfe/utility/CSaveWindowStatus.h b/mozilla/cmd/macfe/utility/CSaveWindowStatus.h deleted file mode 100644 index 300b3a9b856..00000000000 --- a/mozilla/cmd/macfe/utility/CSaveWindowStatus.h +++ /dev/null @@ -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 __H_CSaveWindowStatus -#define __H_CSaveWindowStatus -#pragma once - -/*====================================================================================== - AUTHOR: Ted Morris - 08 NOV 96 - - DESCRIPTION: Defines a mix-in class for saving a window's status to the preferences - file. - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -class LWindow; -class LStream; - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class CSaveWindowStatus { - -public: - - CSaveWindowStatus(LWindow *inWindow) { - mWindowSelf = inWindow; - mCanSaveStatus = true; - mHasSavedStatus = false; - Assert_(mWindowSelf != nil); - } - - Boolean CanSaveStatus() { - return mCanSaveStatus; - } - void SetCanSaveStatus(Boolean inCanSave) { - mCanSaveStatus = inCanSave; - } - - enum { - cWindowDesktopMargin = 4 - , cMinSavedStatusSize = sizeof(Int16) + sizeof(Rect) - }; - - static void GetPaneGlobalBounds(LPane *inPane, Rect *outBounds); - static void MoveWindowToAlertPosition(LWindow *inWindow); - static void MoveWindowTo(LWindow *inWindow, Point inGlobalTopLeft); - static void VerifyWindowBounds(LWindow *inWindow, Rect *ioGlobalBounds); - static LWindow *CreateWindow(ResIDT inWindowID, LCommander *inSuperCommander); - -protected: - - void FinishCreateWindow(); // from disk - void FinishCreateWindow(CSaveWindowStatus* templateStatus); - void AttemptCloseWindow(); - void SaveStatusInfo(); - - // It is only valid to call HasSavedStatus() after - // the window has been properly created (i.e. after - // calling FinishCreateWindow() ). - - Boolean HasSavedStatus() - { - return mHasSavedStatus; - } - - virtual ResIDT GetStatusResID() const = 0; // client must provide! - virtual UInt16 GetValidStatusVersion() const = 0; // client must provide! - virtual void ReadWindowStatus(LStream *inStatusData); - virtual void WriteWindowStatus(LStream *outStatusData); - - LWindow *mWindowSelf; - Boolean mCanSaveStatus; - -private: - Boolean mHasSavedStatus; -}; -#endif // __H_CSaveWindowStatus - diff --git a/mozilla/cmd/macfe/utility/CStLayerOriginSetter.cp b/mozilla/cmd/macfe/utility/CStLayerOriginSetter.cp deleted file mode 100644 index dffc7bfff3f..00000000000 --- a/mozilla/cmd/macfe/utility/CStLayerOriginSetter.cp +++ /dev/null @@ -1,39 +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. - */ - -#include "CStLayerOriginSetter.h" - -// See header file for documentation - -CStLayerOriginSetter::CStLayerOriginSetter(CHTMLView *viewToSet, CL_Layer *the_layer) - : mShouldChange(false) { - - mViewToSet = viewToSet; - if (the_layer && mViewToSet) { - mViewToSet->GetLayerOrigin(&mOldx, &mOldy); - mViewToSet->SetLayerOrigin(CL_GetLayerXOrigin(the_layer), CL_GetLayerYOrigin(the_layer)); - mShouldChange = true; - } -} - -CStLayerOriginSetter::~CStLayerOriginSetter() { - - if (mShouldChange && mViewToSet) - mViewToSet->SetLayerOrigin(mOldx, mOldy); - -} \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/CStLayerOriginSetter.h b/mozilla/cmd/macfe/utility/CStLayerOriginSetter.h deleted file mode 100644 index 065f8dacc41..00000000000 --- a/mozilla/cmd/macfe/utility/CStLayerOriginSetter.h +++ /dev/null @@ -1,55 +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. - */ - -/* -CStLayerOriginSetter - -This class is used to set the layer origin temporarily. For example, if you are dragging and -dropping and want the origin to be changed to the item you're dragging, you would do (in -CHTMLView): - - -do stuff with old origin -{ - CStOriginSetter setLayerOrigin(this, in_layer); - do your dragging stuff with new origin -} -do other stuff with old origin - -This class thus handles any exceptions, etc. that are done while doing stuff with the new -origin. - -NOTE: This class should never be subclassed. -*/ - -#pragma once - -#include "CHTMLView.h" - -class CStLayerOriginSetter { - - public: - CStLayerOriginSetter(CHTMLView *viewToSet, CL_Layer *the_layer); - ~CStLayerOriginSetter(); - - private: - Int32 mOldx; - Int32 mOldy; - CHTMLView *mViewToSet; - Boolean mShouldChange; -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/MANIFEST b/mozilla/cmd/macfe/utility/MANIFEST deleted file mode 100644 index 1206e103a98..00000000000 --- a/mozilla/cmd/macfe/utility/MANIFEST +++ /dev/null @@ -1 +0,0 @@ -xp_file_mac.h \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/MPreference.cp b/mozilla/cmd/macfe/utility/MPreference.cp deleted file mode 100644 index 3f056630599..00000000000 --- a/mozilla/cmd/macfe/utility/MPreference.cp +++ /dev/null @@ -1,981 +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. - */ - -#include "MPreference.h" - -#include "PascalString.h" - -#include -#include -#include - -#include "xp_mcom.h" -#include "prefapi.h" -#include "macutil.h" // for StringParamText -#include "prefwutil.h" // for CColorButton - -#include "StSetBroadcasting.h" -#include "CTooltipAttachment.h" - -Boolean MPreferenceBase::sWriteOnDestroy = false; // must be one for all instantiations of the template. -Boolean MPreferenceBase::sUseTempPrefPrefix = false; // must be one for all instantiations of the template. -char* MPreferenceBase::sReplacementString = nil; - -const char * kTempPrefPrefix = "temp_pref_mac"; // prepended to the prefs string - -//======================================================================================== -class CDebugPrefToolTipAttachment : public CToolTipAttachment -//======================================================================================== -{ - public: - enum { class_ID = 'X%W@' }; - - CDebugPrefToolTipAttachment(MPreferenceBase* b); - protected: - virtual void CalcTipText( - LWindow* inOwningWindow, - LPane* inOwningPane, - const EventRecord& inMacEvent, - StringPtr outTipText); - MPreferenceBase* mPreferenceBase; -}; // class CDebugPrefToolTipAttachment - -//---------------------------------------------------------------------------------------- -CDebugPrefToolTipAttachment::CDebugPrefToolTipAttachment(MPreferenceBase* b) -//---------------------------------------------------------------------------------------- - : CToolTipAttachment(60, 11507) - , mPreferenceBase(b) -{ -} - -//---------------------------------------------------------------------------------------- -void CDebugPrefToolTipAttachment::CalcTipText( -//---------------------------------------------------------------------------------------- - LWindow* /* inOwningWindow */, - LPane* /* inOwningPane */, - const EventRecord& /* inMacEvent */, - StringPtr outTipText) -{ - *(CStr255*)outTipText = mPreferenceBase->mName; -} - -#pragma mark - -//---------------------------------------------------------------------------------------- -MPreferenceBase::MPreferenceBase( - LPane* inPane -, LStream* inStream) -//---------------------------------------------------------------------------------------- -: mName(nil) -, mSubstitutedName(nil) -, mLocked(false) -, mWritePref(true) -, mPaneSelf(inPane) -{ - CStr255 text; - inStream->ReadPString(text); - SetPrefName((const char*)text, false); - *inStream >> mOrdinal; -} // MPreferenceBase::MPreferenceBase - -//---------------------------------------------------------------------------------------- -MPreferenceBase::~MPreferenceBase() -//---------------------------------------------------------------------------------------- -{ - XP_FREEIF(const_cast(mSubstitutedName)); - mSubstitutedName = nil; - XP_FREEIF(const_cast(mName)); - mName = nil; -} // MPreferenceBase::~MPreferenceBase - -//---------------------------------------------------------------------------------------- -void MPreferenceBase::SetPrefName(const char* inNewName, Boolean inReread) -//---------------------------------------------------------------------------------------- -{ - /* - const char* oldName = mName; // so that inNewName == mName works - CStr255 text(inNewName); - if (sReplacementString && *sReplacementString) - ::StringParamText(text, sReplacementString); - - if (sUseTempPrefPrefix) - { - mName = XP_STRDUP(kTempPrefPrefix); - StrAllocCat(mName, text); - } - else - mName = XP_STRDUP((const char*)text); - */ - XP_FREEIF(const_cast(mName)); - mName = XP_STRDUP(inNewName); - - if (inReread) - { - ReadLockState(); - ReadSelf(); - } -} // MPreferenceBase::ReadLockState - -//---------------------------------------------------------------------------------------- -/*static*/ void MPreferenceBase::SetReplacementString(const char* s) -//---------------------------------------------------------------------------------------- -{ - XP_FREEIF(sReplacementString); - sReplacementString = (s != nil) ? XP_STRDUP(s) : nil; -} - -//---------------------------------------------------------------------------------------- -/*static*/ void MPreferenceBase::ChangePrefName(LView* inSuperView, PaneIDT inPaneID, const char* inNewName) -//---------------------------------------------------------------------------------------- -{ - LPane* p = inSuperView->FindPaneByID(inPaneID); - MPreferenceBase* pb = dynamic_cast(p); - SignalIf_(!pb); - if (pb) - pb->SetPrefName(inNewName); -} - -//---------------------------------------------------------------------------------------- -/*static*/ void MPreferenceBase::SetPaneWritePref(LView* inSuperView, PaneIDT inPaneID, Boolean inWritePref) -//---------------------------------------------------------------------------------------- -{ - LPane* p = inSuperView->FindPaneByID(inPaneID); - MPreferenceBase* pb = dynamic_cast(p); - SignalIf_(!pb); - if (pb) - pb->SetWritePref(inWritePref); -} - -//---------------------------------------------------------------------------------------- -/*static*/ const char* MPreferenceBase::GetPanePrefName(LView* inSuperView, PaneIDT inPaneID) -//---------------------------------------------------------------------------------------- -{ - LPane* p = inSuperView->FindPaneByID(inPaneID); - MPreferenceBase* pb = dynamic_cast(p); - SignalIf_(!pb); - if (pb) - return XP_STRDUP(pb->GetPrefName()); - return nil; -} - -//---------------------------------------------------------------------------------------- -/*static*/ const char* MPreferenceBase::GetPaneUnsubstitutedPrefName(LView* inSuperView, PaneIDT inPaneID) -//---------------------------------------------------------------------------------------- -{ - LPane* p = inSuperView->FindPaneByID(inPaneID); - MPreferenceBase* pb = dynamic_cast(p); - SignalIf_(!pb); - if (pb) - return XP_STRDUP(pb->mName); - return nil; -} - -//---------------------------------------------------------------------------------------- -const char* MPreferenceBase::GetPrefName() -//---------------------------------------------------------------------------------------- -{ - CStr255 subName(mName); - - if (sReplacementString && *sReplacementString) - ::StringParamText(subName, sReplacementString); - - XP_FREEIF(const_cast(mSubstitutedName)); - - if (sUseTempPrefPrefix) - { - CStr255 newName(kTempPrefPrefix); - newName += "."; - newName += subName; - - mSubstitutedName = XP_STRDUP(newName); - } - else - mSubstitutedName = XP_STRDUP(subName); - - return mSubstitutedName; -} - -//---------------------------------------------------------------------------------------- -const char* MPreferenceBase::GetValidPrefName() -// Get the pref name, with or without the prefix depending on whether the prefixed -// preference exists or not. -//---------------------------------------------------------------------------------------- -{ - CStr255 subName(mName); - - if (sReplacementString && *sReplacementString) - ::StringParamText(subName, sReplacementString); - - XP_FREEIF(const_cast(mSubstitutedName)); - - if (sUseTempPrefPrefix) - { - CStr255 newName(kTempPrefPrefix); - newName += "."; - newName += subName; - - if (PREF_GetPrefType(newName) == PREF_ERROR) - mSubstitutedName = XP_STRDUP(subName); // the prefixed pref does not exist. - else - mSubstitutedName = XP_STRDUP(newName); - } - else - mSubstitutedName = XP_STRDUP(subName); - - return mSubstitutedName; -} - - -//---------------------------------------------------------------------------------------- -const char* MPreferenceBase::GetUnsubstitutedPrefName() -//---------------------------------------------------------------------------------------- -{ - return XP_STRDUP(mName); -} - -//---------------------------------------------------------------------------------------- -void MPreferenceBase::ReadLockState() -//---------------------------------------------------------------------------------------- -{ - mLocked = PREF_PrefIsLocked(GetPrefName()); - if (mLocked) - mPaneSelf->Disable(); -} // MPreferenceBase::ReadLockState - -//---------------------------------------------------------------------------------------- -void MPreferenceBase::FinishCreate() -//---------------------------------------------------------------------------------------- -{ - ReadLockState(); - ReadSelf(); -#ifdef DEBUG - LAttachable::SetDefaultAttachable(mPaneSelf); - CDebugPrefToolTipAttachment* a = new CDebugPrefToolTipAttachment(this); - mPaneSelf->AddAttachment(a); -#endif -} // MPreferenceBase::FinishCreate - - -//---------------------------------------------------------------------------------------- -Boolean MPreferenceBase::ShouldWrite() const -//---------------------------------------------------------------------------------------- -{ - if (!sWriteOnDestroy || mLocked || !mWritePref) - return false; - -/* - if (strstr(mName, "^0") != nil) // yow! unreplaced strings - { - // Check if a replacement has become possible - Assert_(sReplacementString && *sReplacementString); - if (!sReplacementString || !*sReplacementString) - return false; - const_cast(this)->SetPrefName(mName, false); // don't read - } -*/ - return true; - // Note: don't worry about testing Changed(), since preflib does that. -} // MPreferenceBase::ShouldWrite - - -//---------------------------------------------------------------------------------------- -/*static*/ void MPreferenceBase::InitTempPrefCache() -//---------------------------------------------------------------------------------------- -{ - // delete the temp pref tree - PREF_DeleteBranch(kTempPrefPrefix); -} - -//---------------------------------------------------------------------------------------- -/*static*/ void MPreferenceBase::CopyCachedPrefsToMainPrefs() -//---------------------------------------------------------------------------------------- -{ - int result; - - result = PREF_CopyPrefsTree(kTempPrefPrefix, ""); - Assert_(result == PREF_NOERROR); - - result = PREF_DeleteBranch(kTempPrefPrefix); - Assert_(result == PREF_NOERROR); -} - - -#pragma mark - -//---------------------------------------------------------------------------------------- -template MPreference::MPreference( - LPane* inPane, - LStream* inStream) -//---------------------------------------------------------------------------------------- -: MPreferenceBase(inPane, inStream) -{ -} // MPreference::MPreference - -//---------------------------------------------------------------------------------------- -template MPreference::~MPreference() -//---------------------------------------------------------------------------------------- -{ -} // MPreference::~MPreference - -#pragma mark - - -enum // what the ordinal means in this case: -{ - kOrdinalXORBit = 1<<0 -, kOrdinalIntBit = 1<<1 -}; - -//---------------------------------------------------------------------------------------- -XP_Bool MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - return ((LControl*)mPaneSelf)->GetValue(); -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(XP_Bool inData) -//---------------------------------------------------------------------------------------- -{ - ((LControl*)mPaneSelf)->SetValue(inData); -} // MPreference::SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue() != mInitialControlValue; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - XP_Bool value; - int prefResult; - if (mOrdinal & kOrdinalIntBit) - { - int32 intValue; - typedef int (*IntPrefReadFunc)(const char*, int32*); - prefResult = ((IntPrefReadFunc)inFunc)(GetValidPrefName(), &intValue); - value = intValue; - } - else - prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - SetPaneValue(value ^ (mOrdinal & kOrdinalXORBit)); -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - if (mOrdinal & kOrdinalIntBit) // this bit indicates it's an int conversion - InitializeUsing((PrefReadFunc)PREF_GetIntPref); - else - InitializeUsing(PREF_GetBoolPref); - mInitialControlValue = GetPaneValue(); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - if (mOrdinal & kOrdinalIntBit) // this bit indicates it's an int conversion - InitializeUsing((PrefReadFunc)PREF_GetDefaultIntPref); - else - InitializeUsing(PREF_GetDefaultBoolPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ - if (ShouldWrite()) - { - if (mOrdinal & kOrdinalIntBit) // this bit indicates it's an int conversion - PREF_SetIntPref(GetPrefName(), GetPrefValue()); - else - PREF_SetBoolPref(GetPrefName(), GetPrefValue()); - } -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -XP_Bool MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - // xor the boolean value with the low-order bit of the ordinal - return (XP_Bool)(mPaneSelf->GetValue() ^ (mOrdinal & kOrdinalXORBit)); -} // MPreference::GetPrefValue - -template class MPreference; - -#pragma mark - - -// Why the heck would we want a prefcontrol that is just a caption? Only for the use of the -// resource template to supply an extra string which initially holds the pref name. -// CSpecialFolderCaption is derived from this. - -//---------------------------------------------------------------------------------------- -XP_Bool MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - return false; -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(XP_Bool) -//---------------------------------------------------------------------------------------- -{ -} // MPreference::SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - return false; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc) -//---------------------------------------------------------------------------------------- -{ -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing(PREF_GetBoolPref); - mInitialControlValue = false; -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing(PREF_GetDefaultBoolPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -XP_Bool MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return false; -} // MPreference::GetPrefValue - -template class MPreference; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -int32 MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - return ((LControl*)mPaneSelf)->GetValue(); -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(int32 inData) -//---------------------------------------------------------------------------------------- -{ - ((LControl*)mPaneSelf)->SetValue(inData); -} // MPreference::SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue() != mInitialControlValue; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - int32 value; - int prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - { - if (value == mOrdinal) - SetPaneValue(1); // tab group will turn others off. - } -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing(PREF_GetIntPref); - mInitialControlValue = GetPaneValue(); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing(PREF_GetDefaultIntPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ - if (ShouldWrite()) - PREF_SetIntPref(GetPrefName(), mOrdinal); -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -int32 MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return mOrdinal; -} // MPreference::GetPrefValue - -template class MPreference; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -#pragma mark -MPreference::~MPreference() -//---------------------------------------------------------------------------------------- -{ - XP_FREEIF(mInitialControlValue); -} // MPreference::CleanUpData - -//---------------------------------------------------------------------------------------- -char* MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - CStr255 value; - mPaneSelf->GetDescriptor(value); - return (char*)value; -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(char* inData) -//---------------------------------------------------------------------------------------- -{ - ((LTextEditView*)mPaneSelf)->SetDescriptor(CStr255(inData)); -} // MPreference:SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - char* value = GetPaneValue(); - if (value && *value) - return (strcmp(value, mInitialControlValue) != 0); - return true; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - char* value; - int prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - { - SetPaneValue(value); - XP_FREEIF(value); - } -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing(PREF_CopyCharPref); - mInitialControlValue = XP_STRDUP(GetPaneValue()); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing(PREF_CopyDefaultCharPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ - if (ShouldWrite()) - PREF_SetCharPref(GetPrefName(), GetPaneValue()); -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -char* MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue(); -} // MPreference::GetPrefValue - -template class MPreference; - -// This is used for captions, and for mixing in with another pref control (eg, to -// control the descriptor of a checkbox). - -#pragma mark - - -//---------------------------------------------------------------------------------------- -#pragma mark -MPreference::~MPreference() -//---------------------------------------------------------------------------------------- -{ - XP_FREEIF(mInitialControlValue); -} // MPreference::CleanUpData - -//---------------------------------------------------------------------------------------- -char* MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - CStr255 value; - mPaneSelf->GetDescriptor(value); - return (char*)value; -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(char* inData) -//---------------------------------------------------------------------------------------- -{ - ((LPane*)mPaneSelf)->SetDescriptor(CStr255(inData)); -} // MPreference:SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - char* value = GetPaneValue(); - if (value && *value) - return (strcmp(value, mInitialControlValue) != 0); - return true; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - char* value; - int prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - { - SetPaneValue(value); - XP_FREEIF(value); - } -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing(PREF_CopyCharPref); - mInitialControlValue = XP_STRDUP(GetPaneValue()); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing(PREF_CopyDefaultCharPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -char* MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue(); -} // MPreference::GetPrefValue - -template class MPreference; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -#pragma mark -MPreference::~MPreference() -//---------------------------------------------------------------------------------------- -{ - XP_FREEIF(mInitialControlValue); -} // MPreference::CleanUpData - -//---------------------------------------------------------------------------------------- -char* MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - Int32 itemNumber = ((LGAPopup*)mPaneSelf)->GetValue(); - CStr255 itemString; - if (itemNumber > 0) - { - MenuHandle menuH = ((LGAPopup*)mPaneSelf)->GetMacMenuH(); - ::GetMenuItemText(menuH, itemNumber, itemString); - } - return (char*)itemString; -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(char* inData) -//---------------------------------------------------------------------------------------- -{ - if (!inData || !*inData) - return; - MenuHandle menuH = ((LGAPopup*)mPaneSelf)->GetMacMenuH(); - short menuSize = ::CountMItems(menuH); - CStr255 itemString; - for (short menuItem = 1; menuItem <= menuSize; ++menuItem) - { - ::GetMenuItemText(menuH, menuItem, itemString); - if (itemString == inData) - { - StSetBroadcasting dontBroadcast((LGAPopup*)mPaneSelf, false); - ((LGAPopup*)mPaneSelf)->SetValue(menuItem); - return; - } - } -} // MPreference:SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - char* value = GetPaneValue(); - if (value && *value) - return (strcmp(value, mInitialControlValue) != 0); - return true; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - char* value; - int prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - { - SetPaneValue(value); - XP_FREEIF(value); - } -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing(PREF_CopyCharPref); - mInitialControlValue = XP_STRDUP(GetPaneValue()); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing(PREF_CopyDefaultCharPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ - if (ShouldWrite()) - PREF_SetCharPref(GetPrefName(), GetPaneValue()); -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -char* MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue(); -} // MPreference::GetPrefValue - -template class MPreference; - -#pragma mark - - -//---------------------------------------------------------------------------------------- -MPreference::~MPreference() -//---------------------------------------------------------------------------------------- -{ -} // MPreference::CleanUpData - -//---------------------------------------------------------------------------------------- -int32 MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - return ((LTextEditView*)mPaneSelf)->GetValue(); -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(int32 inData) -//---------------------------------------------------------------------------------------- -{ - ((LTextEditView*)mPaneSelf)->SetValue(inData); -} // MPreference:SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue() != mInitialControlValue; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - int32 value; - int prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - SetPaneValue(value); -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing(PREF_GetIntPref); - mInitialControlValue = GetPaneValue(); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing(PREF_GetDefaultIntPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ - if (ShouldWrite()) - PREF_SetIntPref(GetPrefName(), GetPaneValue()); -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -int32 MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue(); -} // MPreference::GetPrefValue - -template class MPreference; - -#pragma mark - - -// The function signature for reading colors is not like the other types. Here is -// its prototype, which we use to cast back and forth. -typedef int (*ColorReadFunc)(const char*, uint8*, uint8*, uint8*); - -//---------------------------------------------------------------------------------------- -MPreference::~MPreference() -//---------------------------------------------------------------------------------------- -{ -} // MPreference::CleanUpData - -//---------------------------------------------------------------------------------------- -RGBColor MPreference::GetPaneValue() const -//---------------------------------------------------------------------------------------- -{ - return ((CColorButton*)mPaneSelf)->GetColor(); -} // MPreference::GetPaneValue - -//---------------------------------------------------------------------------------------- -void MPreference::SetPaneValue(RGBColor inData) -//---------------------------------------------------------------------------------------- -{ - ((CColorButton*)mPaneSelf)->SetColor(inData); - mPaneSelf->Refresh(); -} // MPreference:SetPaneValue - -//---------------------------------------------------------------------------------------- -Boolean MPreference::Changed() const -//---------------------------------------------------------------------------------------- -{ - return memcmp(&GetPaneValue(), &mInitialControlValue, sizeof(RGBColor)) == 0; -} // MPreference::Changed - -//---------------------------------------------------------------------------------------- -void MPreference::InitializeUsing(PrefReadFunc inFunc) -//---------------------------------------------------------------------------------------- -{ - RGBColor value; - uint8 red = 0, green = 0, blue = 0; - int prefResult = ((ColorReadFunc)inFunc)(GetValidPrefName(), &red, &green, &blue); - if (prefResult == PREF_NOERROR) - { - value.red = red << 8; - value.green = green << 8; - value.blue = blue << 8; - SetPaneValue(value); - } -} // MPreference::InitializeUsing - -//---------------------------------------------------------------------------------------- -void MPreference::ReadSelf() -//---------------------------------------------------------------------------------------- -{ - InitializeUsing((PrefReadFunc)PREF_GetColorPref); - mInitialControlValue = GetPaneValue(); -} // MPreference::ReadSelf - -//---------------------------------------------------------------------------------------- -void MPreference::ReadDefaultSelf() -//---------------------------------------------------------------------------------------- -{ - if (!IsLocked()) - InitializeUsing((PrefReadFunc)PREF_GetDefaultColorPref); -} // MPreference::ReadDefaultSelf - -//---------------------------------------------------------------------------------------- -void MPreference::WriteSelf() -//---------------------------------------------------------------------------------------- -{ - if (ShouldWrite()) - { - RGBColor value = GetPaneValue(); - PREF_SetColorPref(GetPrefName(), value.red >> 8, value.green >> 8, value.blue >> 8); - } -} // MPreference::WriteSelf - -//---------------------------------------------------------------------------------------- -RGBColor MPreference::GetPrefValue() const -//---------------------------------------------------------------------------------------- -{ - return GetPaneValue(); -} // MPreference::GetPrefValue - -template class MPreference; - diff --git a/mozilla/cmd/macfe/utility/MPreference.h b/mozilla/cmd/macfe/utility/MPreference.h deleted file mode 100644 index d17a1181845..00000000000 --- a/mozilla/cmd/macfe/utility/MPreference.h +++ /dev/null @@ -1,204 +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. - */ - -#pragma once - -class LControl; -class LStream; - -//---------------------------------------------------------------------------------------- -// MPreferenceBase is the base class for all the prefs controls and edit fields -// in the prefs dialog, and properties dialogs. It allows preference panels to be -// easily extended with additional pref controls with just Constructor changes, -// as the controls know which pref they represent, and initialize themselves and -// write themselves out to the prefs accordingly. -// -// There are two additional mechanisms that are used in sub-dialogs of the preferences -// dialog, to permit the following: -// -// 1. Sub-dialogs can control the pref for a given server (e.g. IMAP server). -// -// This is achivieved by a ParamText-type mechanism. Controls in these sub-dialogs -// contain pref strings like: "mail.imap.server.^0.username". These controls -// construct the real prefs string ("mail.imap.server.nsmail-1.username") on the -// fly when reading and writing prefs, e.g. in MPreferenceBase::GetPrefName(). -// -// The stack-based class StReplacementString() allows you to set this replacement -// string temporarily, e.g. while showing properties for a mail server. -// -// 2. Sub-dialogs can write their preferences out to a temporary sub-tree of the -// main preferences, the values in which are then copied over to the real -// prefs at some later time (e.g. when the user OKs the main prefs dialog -// -// This is achived by prepending a prefix to the prefs name that is stored -// in the PPob. Controls then attempt to read their values first from the -// prefs cache (with the prefix), then from the main prefs (without the prefix) -// [see GetValidPrefName()]. They then write their values to the temporary prefs -// cache if the prefix is in force when the dialog is destroyed. -// -// The stack-based class StUseTempPrefCache enables this functionality; typically -// you'd create one in scope around a call to conduct the sub-dialog , since -// the prefix string needs to be in place both when the controls are constructed -// and destroyed. -// -// To copy these cached preference values over to the main prefs tree, call -// CopyCachedPrefsToMainPrefs(), say when the user OKs the main prefs dialog. -// -//---------------------------------------------------------------------------------------- - -//====================================== -class MPreferenceBase -//====================================== -{ -protected: - - MPreferenceBase( - LPane* inPane, - LStream* inStream); - virtual ~MPreferenceBase(); - -public: - Boolean IsLocked() const { return mLocked; } - virtual void ReadDefaultSelf() = 0; // Reset factory default - virtual Boolean Changed() const = 0; - virtual void SetPrefName(const char* inNewName, Boolean inReread = true); - virtual const char* GetPrefName(); - virtual const char* GetValidPrefName(); - virtual const char* GetUnsubstitutedPrefName(); - virtual void SetWritePref(Boolean inWritePref) { mWritePref = inWritePref; } - virtual Boolean GetWritePref() const { return mWritePref; } - - static void ChangePrefName(LView* inSuperView, PaneIDT inPaneID, const char* inNewName); - static const char* GetPanePrefName(LView* inSuperView, PaneIDT inPaneID); - static const char* GetPaneUnsubstitutedPrefName(LView* inSuperView, PaneIDT inPaneID); - - static void SetWriteOnDestroy(Boolean inWrite) { sWriteOnDestroy = inWrite; } - static Boolean GetWriteOnDestroy() { return sWriteOnDestroy; } - - static void SetPaneWritePref(LView* inSuperView, PaneIDT inPaneID, Boolean inWritePref); - - static void InitTempPrefCache(); - static void SetUseTempPrefCache(Boolean inUseTempPrefPrefix) { sUseTempPrefPrefix = inUseTempPrefPrefix ; } - static Boolean GetUseTempPrefCache() { return sUseTempPrefPrefix; } - - static void CopyCachedPrefsToMainPrefs(); - static void SetReplacementString(const char* s); - - struct StReplacementString // temporarily set and then clear the static string - { - StReplacementString(const char* s) - { - MPreferenceBase::SetReplacementString(s); - } - ~StReplacementString() - { - MPreferenceBase::SetReplacementString(nil); - } - }; - - struct StUseTempPrefCache // temporarily set and then restore the static flag - { - StUseTempPrefCache(Boolean inTempValue) - : mSavedValue(MPreferenceBase::sUseTempPrefPrefix) - { - MPreferenceBase::sUseTempPrefPrefix = inTempValue; - } - ~StUseTempPrefCache() - { - MPreferenceBase::sUseTempPrefPrefix = mSavedValue; - } - Boolean mSavedValue; - }; - - struct StWriteOnDestroy // temporarily set and then restore the static flag - { - StWriteOnDestroy(Boolean inTempValue) - : mSavedValue(MPreferenceBase::sWriteOnDestroy) - { - MPreferenceBase::sWriteOnDestroy = inTempValue; - } - ~StWriteOnDestroy() - { - MPreferenceBase::sWriteOnDestroy = mSavedValue; - } - Boolean mSavedValue; - }; - -protected: - void FinishCreate(); - virtual void ReadSelf() = 0; // Call this from FinishCreateSelf! - Boolean ShouldWrite() const; - void ReadLockState(); -// data: -protected: - // From the resource stream: - Int16 mOrdinal; - // For a boolean pref, this is xored with the value after read and before write. - // For an int pref, this represents the value to be saved if the control is on. - // From the prefs db - Boolean mLocked; - Boolean mWritePref; // set to false to tell the control not to write out the pref - LPane* mPaneSelf; // Control/edit field that we're mixed in with. - - const char* mSubstitutedName; // name after substitution. Freed on destroy. -private: - const char* mName; // the prefs name format string - - // Implementation -private: - friend class CDebugPrefToolTipAttachment; - friend class StReplacementString; - friend class StWriteOnDestroy; - friend class StUseTempPrefCache; - static Boolean sWriteOnDestroy; // one for all instantiations of the template. - static Boolean sUseTempPrefPrefix; // one for all instantiations of the template. - static char* sReplacementString; // for pref name magic names with ^0 in them. - // This must only be manipulated using the StReplacementString class. -}; // class MPreferenceBase - - -//====================================== -template class MPreference -// This is a mixin class that gets added to the pref control types. -//====================================== -: public MPreferenceBase -{ -public: - MPreference( - LPane* inControl, - LStream* inStream); - virtual ~MPreference(); -public: - virtual void ReadSelf(); // Call this from FinishCreateSelf! - virtual void ReadDefaultSelf(); - virtual void WriteSelf(); - virtual TData GetPrefValue() const; - virtual TData GetPaneValue() const; - virtual void SetPaneValue(TData); - virtual Boolean Changed() const; -protected: - typedef int (*PrefReadFunc)(const char*, TData*); - virtual Boolean ShouldWrite() const { return MPreferenceBase::ShouldWrite(); } - virtual void ReadLockState() { MPreferenceBase::ReadLockState(); } - virtual void InitializeUsing(PrefReadFunc inFunc); // used by ReadSelf, ReadDefaultSelf. -// data: -protected: - // From the constructor: - TData mInitialControlValue; -}; // template class MPreference - diff --git a/mozilla/cmd/macfe/utility/PrefControls.cp b/mozilla/cmd/macfe/utility/PrefControls.cp deleted file mode 100644 index f7867bb1810..00000000000 --- a/mozilla/cmd/macfe/utility/PrefControls.cp +++ /dev/null @@ -1,636 +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. - */ - -#include "PrefControls.h" - -#include "MPreference.h" -#include "CValidEditField.h" - -#include "prefwutil.h" -#include "prefapi.h" -#include "ufilemgr.h" -#include "StSetBroadcasting.h" - -#include "xp_mcom.h" - -#include -#include -#include -#include - -// Note. We can do java-style 'inline' virtual functions here, because these classes -// all have file scope. If you ever move these declarations to a header, you -// should non-inline 'em. - -#pragma mark ---CPrefCheckbox--- -//====================================== -class CPrefCheckbox -//====================================== -: public LGACheckbox -, public MPreference -{ -public: - CPrefCheckbox(LStream* inStream) - : LGACheckbox(inStream) - , MPreference(this, inStream) - { - } - virtual ~CPrefCheckbox() - { - WriteSelf(); - // checkbox always writes its pane value ^ its ordinal. - // Thus: if mOrdinal == 1, the checkbox reverses the sense of the pref. - } - enum { class_ID = 'Pchk' }; - virtual void FinishCreateSelf() - { - LGACheckbox::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } -}; // class CPrefCheckbox - -#pragma mark ---CBoolPrefRadio--- -//====================================== -class CBoolPrefRadio -// Actually, because of the writing-out policy, only the zero-ordinal radio button -// needs to be a CBoolPrefRadio. The other one can be just a LGARadioButton. -//====================================== -: public LGARadioButton -, public MPreference -{ -public: - CBoolPrefRadio(LStream* inStream) - : LGARadioButton(inStream) - , MPreference(this, inStream) - { - } - virtual ~CBoolPrefRadio() - { - // Only the radio button with a zero ordinal writes its value out. - // It writes out its pane value. - if (mOrdinal == 0) - WriteSelf(); - } - enum { class_ID = 'Brad' }; - virtual void FinishCreateSelf() - { - LGARadioButton::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } -}; // class CBoolPrefRadio - -#pragma mark ---CIntPrefRadio--- -//====================================== -class CIntPrefRadio -//====================================== -: public LGARadioButton -, public MPreference -{ -public: - CIntPrefRadio(LStream* inStream) - : LGARadioButton(inStream) - , MPreference(this, inStream) - { - } - virtual ~CIntPrefRadio() - { - // Only the radio button with an ON value writes its value out. - // An int preference writes out its ordinal. - if (mPaneSelf->GetValue() != 0) - WriteSelf(); - } - enum { class_ID = 'Irad' }; - virtual void FinishCreateSelf() - { - LGARadioButton::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } -}; // class CIntPrefRadio - -#pragma mark ---CPrefColorButton--- -//====================================== -class CPrefColorButton -//====================================== -: public CColorButton -, public MPreference -{ -public: - enum { class_ID = 'Pcol' }; - CPrefColorButton(LStream* inStream) - : CColorButton(inStream) - , MPreference((CColorButton*)this, inStream) - { - } - virtual ~CPrefColorButton() - { - WriteSelf(); - } - virtual void FinishCreateSelf() - { - CColorButton::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } -}; // class CPrefColorButton - -#pragma mark ---CIntPrefPopup--- -//====================================== -class CIntPrefPopup -// NOTE: There are two modes of operation: command mode and item mode. -// Command mode happens if mNumCommands > 0, otherwise item mode obtains. -// In item mode, unlike the base class LGAPopup, the values are zero based. I.e., the -// first menu item represents a pref value of zero. -// In command mode, the command numbers of the items are used for the pref values, -// allowing the menu items to represent non-consecutive pref values, or reordered -// pref values. -//====================================== -: public LGAPopup -, public MPreference -{ -public: - CIntPrefPopup(LStream* inStream) - : LGAPopup(inStream) - , MPreference(this, inStream) - { - } - virtual ~CIntPrefPopup() - { - WriteSelf(); - } - enum { class_ID = 'Ppop' }; - virtual void FinishCreateSelf() - { - LGAPopup::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } - virtual int32 GetPaneValue() const - { - Int32 itemNumber = LGAPopup::GetValue(); - // Use the command nums, if provided. - if (mNumCommands > 0) - return (*mCommandNums)[itemNumber - 1]; - // Otherwise, use the menu item number - 1 (it's zero based). - return itemNumber - 1; - } - virtual void SetPaneValue(int32 inData) - { - if (mNumCommands == 0) - { - // Item mode. - LGAPopup::SetValue(inData + 1); // first item's value is zero. - } - else - { - // Command mode. - CommandT* cur = *mCommandNums; - for (int item = 1; item <= mNumCommands; item++, cur++) - { - if (*cur == inData) - { - SetValue(item); - break; - } - } - } - } - virtual int32 GetPrefValue() const - { - return GetPaneValue(); - } - virtual void InitializeUsing(PrefReadFunc inFunc) - { - int32 value; - int prefResult = inFunc(GetValidPrefName(), &value); - if (prefResult == PREF_NOERROR) - SetPaneValue(value); - } - virtual void ReadSelf() - { - InitializeUsing(PREF_GetIntPref); - } - virtual void ReadDefaultSelf() - { - if (!IsLocked()) - InitializeUsing(PREF_GetDefaultIntPref); - } - virtual void WriteSelf() - { - if (ShouldWrite()) - PREF_SetIntPref(GetPrefName(), GetPaneValue()); - } - -}; // class CIntPrefPopup - -#pragma mark ---CTextPrefPopup--- -//====================================== -class CTextPrefPopup -//====================================== -: public LGAPopup -, public MPreference -{ -public: - CTextPrefPopup(LStream* inStream) - : LGAPopup(inStream) - , MPreference(this, inStream) - { - } - virtual ~CTextPrefPopup() - { - WriteSelf(); - } - enum { class_ID = 'Tpop' }; - virtual void FinishCreateSelf() - { - LGAPopup::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } -}; // class CTextPrefPopup - -#pragma mark ---CPrefEditText--- -//====================================== -class CPrefTextEdit -//====================================== -: public CValidEditField -, public MPreference -{ -public: - CPrefTextEdit(LStream* inStream) - : CValidEditField(inStream) - , MPreference((LTextEditView*)this, inStream) - { - } - virtual ~CPrefTextEdit() - { - // A textedit field always writes its value out. - WriteSelf(); - } - enum { class_ID = 'Pedt' }; - virtual void FinishCreateSelf() - { - CValidEditField::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - // The edit field with mOrdinal == 1 should become target: - if (mOrdinal == 1) - ((CValidEditField*)mPaneSelf)->GetSuperCommander()->SetLatentSub(this); - } -}; // class CPrefTextEdit - -#pragma mark ---CIntPrefTextEdit--- -//====================================== -class CIntPrefTextEdit -// // Note: use CPrefTextEdit template in constructor, just change the class ID to 'Iedt'. -//====================================== -: public CValidEditField -, public MPreference -{ -public: - enum { class_ID = 'Iedt' }; - CIntPrefTextEdit(LStream* inStream) - : CValidEditField(inStream) - , MPreference((LTextEditView*)this, inStream) - { - } - virtual ~CIntPrefTextEdit() - { - // A textedit field always writes its value out. - WriteSelf(); - } - virtual void FinishCreateSelf() - { - CValidEditField::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - // The edit field with mOrdinal == 1 should become target: - if (mOrdinal == 1) - ((CValidEditField*)mPaneSelf)->GetSuperCommander()->SetLatentSub(this); - } -}; // class CIntPrefTextEdit - -#pragma mark ---CPrefFilePicker--- -//====================================== -class CPrefFilePicker -// mOrdinal determines the PickEnum. -//====================================== -: public CFilePicker -, public MPreferenceBase // binary data -{ -public: - enum { class_ID = 'Pfpk' }; - typedef int (*PrefReadFunc)(const char*, void**, int*); - CPrefFilePicker(LStream* inStream) - : CFilePicker(inStream) - , MPreferenceBase((CFilePicker*)this, inStream) - { - CFilePicker::SetPickType((PickEnum)mOrdinal); - } - virtual ~CPrefFilePicker() - { - if (ShouldWrite()) - { - if (CFilePicker::WasSet()) - { - FSSpec fileSpec = CFilePicker::GetFSSpec(); - AliasHandle a = NULL; - OSErr iErr = NewAlias(nil, &fileSpec, &a); - if (!iErr) - { - Size iByteCnt = GetHandleSize((Handle)a); - HLock((Handle)a); - PREF_SetBinaryPref(GetPrefName(), *a, iByteCnt); - DisposeHandle((Handle)a); - } - } - } - } - virtual Boolean Changed() const - { - return CFilePicker::WasSet(); - } - virtual void FinishCreateSelf() - { - CFilePicker::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - } - virtual void InitializeUsing(PrefReadFunc inFunc) - { - // Read old alias pref from resource - // XP prefs: Read alias as binary type - AliasHandle alias = nil; - int size; - void* a; - if (inFunc(GetValidPrefName(), &a, &size ) == 0) - { - PtrToHand(a, &(Handle)alias, size); - XP_FREE(a); - } - if (alias && *alias) - { - FSSpec fileSpec; - fileSpec.vRefNum = fileSpec.parID = -1; - fileSpec.name[0] = '\0'; - - Boolean ignore; - OSErr err = ::ResolveAlias(NULL, alias, &fileSpec, &ignore); - if (err != noErr) - fileSpec.vRefNum = fileSpec.parID = -1; - if (CFileMgr::FileExists(fileSpec)) - { - StSetBroadcasting dontBroadcast((CFilePicker*)this, false); - CFilePicker::SetFSSpec(fileSpec); - } - } - if (alias) - DisposeHandle((Handle)alias); - } - virtual void ReadSelf() - { - InitializeUsing(PREF_CopyBinaryPref); - } - virtual void ReadDefaultSelf() - { - if (!IsLocked()) - InitializeUsing(PREF_CopyDefaultBinaryPref); - } -}; // class CPrefFilePicker - -#ifdef MOZ_MAIL_NEWS -#include "macutil.h" -#include "UNewFolderDialog.h" -#include "CMessageFolder.h" - -#pragma mark ---MSpecialFolderMixin--- -//====================================== -class MSpecialFolderMixin -// Like a pref checkbox, but the descriptor is derived from a second, text preference. -// The second pref name is obtained from the main (boolean) one by replacing the substring -// "use" by the substring "default", eg -// mail.use_fcc -> mail.default_fcc -// This conversion allows us to share the constructor resource template. This guy can just have -// a different class ID. -//====================================== -{ -public: - MSpecialFolderMixin(LPane* inPane, const char* inPrefName); - virtual ~MSpecialFolderMixin(); - void FinishCreateSelf(); - void SetTitleUsing(const CStr255& folderName, const CStr255& serverName); - const char* GetCaptionPrefName() const - { - return mCaptionPrefName; - } - void SetCaptionPrefName(const char* inCaptionPrefName) - { - XP_FREEIF(mCaptionPrefName); - mCaptionPrefName = XP_STRDUP(inCaptionPrefName); - } - -protected: - LPane* mPane; - char* mCaptionPrefName; - char* mFormatString; -}; // class MSpecialFolderMixin - -//----------------------------------- -MSpecialFolderMixin::MSpecialFolderMixin(LPane* inPane, const char* inPrefName) -//----------------------------------- -: mPane(inPane) -, mCaptionPrefName(nil) -, mFormatString(nil) -{ - LStr255 originalName = inPrefName; - UInt8 position = originalName.Find(".use_", 1); - originalName.Replace(position, strlen(".use_"), ".default_", strlen(".default_")); - SetCaptionPrefName((const char*)CStr255(ConstStringPtr(originalName))); - // The initial descriptor is the format string. - CStr255 text; - mPane->GetDescriptor(text); - mFormatString = XP_STRDUP((char*)text); -} - -//----------------------------------- -MSpecialFolderMixin::~MSpecialFolderMixin() -//----------------------------------- -{ - XP_FREEIF(mCaptionPrefName); - XP_FREEIF(mFormatString); -} - -//----------------------------------- -void MSpecialFolderMixin::FinishCreateSelf() -//----------------------------------- -{ - CStr255 folderName; - CMessageFolder folder, server; - UFolderDialogs::GetFolderAndServerNames( - mCaptionPrefName, - folder, - folderName, - server); - - SetTitleUsing(folderName, server.GetName()); -} - -//----------------------------------- -void MSpecialFolderMixin::SetTitleUsing( - const CStr255& folderName, - const CStr255& serverName) -//----------------------------------- -{ - CStr255 title(mFormatString); - StringParamText(title, folderName, serverName); - mPane->SetDescriptor(title); -} - -#pragma mark ---CSpecialFolderCheckbox--- -//====================================== -class CSpecialFolderCheckbox -// Like a pref checkbox, but the descriptor is derived from a second, text preference. -// The second pref name is obtained from the main (boolean) one by replacing the substring -// "use" by the substring "default", eg -// mail.use_fcc -> mail.default_fcc -// This conversion allows us to share the constructor resource template. This guy can just have -// a different class ID. -//====================================== -: public CPrefCheckbox -, public MSpecialFolderMixin -{ -private: - typedef CPrefCheckbox Inherited; -public: - enum { class_ID = 'FLck' }; - CSpecialFolderCheckbox(LStream* inStream); - virtual void FinishCreateSelf(); -}; // class CSpecialFolderCheckbox - -//----------------------------------- -CSpecialFolderCheckbox::CSpecialFolderCheckbox(LStream* inStream) -//----------------------------------- -: CPrefCheckbox(inStream) -, MSpecialFolderMixin((LPane*)this, GetValidPrefName()) -{ -} - -//----------------------------------- -void CSpecialFolderCheckbox::FinishCreateSelf() -//----------------------------------- -{ - Inherited::FinishCreateSelf(); - MSpecialFolderMixin::FinishCreateSelf(); -} - -#pragma mark ---CSpecialFolderCaption--- -//====================================== -class CSpecialFolderCaption -// See comments for CSpecialFolderCheckbox. This differs only in that there is no checkbox -// there. -//====================================== -: public LGACaption -, public MPreference -, public MSpecialFolderMixin -{ -private: - typedef LGACaption Inherited; -public: - enum { class_ID = 'FLcp' }; - CSpecialFolderCaption(LStream* inStream); - virtual void FinishCreateSelf(); -}; // class CSpecialFolderCaption - -//----------------------------------- -CSpecialFolderCaption::CSpecialFolderCaption(LStream* inStream) -//----------------------------------- -: LGACaption(inStream) -, MPreference(this, inStream) -, MSpecialFolderMixin((LPane*)this, GetValidPrefName()) -{ -} - -//----------------------------------- -void CSpecialFolderCaption::FinishCreateSelf() -//----------------------------------- -{ - Inherited::FinishCreateSelf(); - MPreferenceBase::FinishCreate(); - MSpecialFolderMixin::FinishCreateSelf(); -} - -//----------------------------------- -void UPrefControls::NoteSpecialFolderChanged( - LPane* inDescriptionPane, - int inKind, - const CMessageFolder& inFolder) -// The control is a checkbox displaying (e.g.) "Sent Mail on FooServer". This routine updates -// the title after the choice of folder or server has changed. -//----------------------------------- -{ - MSpecialFolderMixin* cb = dynamic_cast(inDescriptionPane); - if (cb) - { - CStr255 folderName; - CMessageFolder server; - UFolderDialogs::GetFolderAndServerNames( - inFolder, - (UFolderDialogs::FolderKind)inKind, - folderName, - server); - cb->SetTitleUsing(folderName, server.GetName()); - } -} - -//----------------------------------- -void UPrefControls::NoteSpecialFolderChanged( - LPane* inDescriptionPane, - const char* inNewCaptionPrefName) -// The control is a checkbox displaying (e.g.) "Sent Mail on FooServer". This routine updates -// the title after the choice of folder or server has changed. -//----------------------------------- -{ - MSpecialFolderMixin* cb = dynamic_cast(inDescriptionPane); - if (cb && XP_STRCMP(cb->GetCaptionPrefName(), inNewCaptionPrefName) != 0) - { - cb->SetCaptionPrefName(inNewCaptionPrefName); - CStr255 folderName; - CMessageFolder folder, server; - UFolderDialogs::GetFolderAndServerNames( - inNewCaptionPrefName, - folder, - folderName, - server); - - cb->SetTitleUsing(folderName, server.GetName()); - } -} - -#endif // MOZ_MAIL_NEWS - -//----------------------------------- -void UPrefControls::RegisterPrefControlViews() -//----------------------------------- -{ - RegisterClass_(CPrefCheckbox); - RegisterClass_(CIntPrefRadio); - RegisterClass_(CBoolPrefRadio); - RegisterClass_(CPrefTextEdit); - RegisterClass_(CIntPrefTextEdit); - RegisterClass_(CIntPrefPopup); - RegisterClass_(CTextPrefPopup); - RegisterClass_(CPrefFilePicker); - RegisterClass_(CPrefColorButton); -#ifdef MOZ_MAIL_NEWS - RegisterClass_(CSpecialFolderCheckbox); - RegisterClass_(CSpecialFolderCaption); -#endif // MOZ_MAIL_NEWS -} diff --git a/mozilla/cmd/macfe/utility/PrefControls.h b/mozilla/cmd/macfe/utility/PrefControls.h deleted file mode 100644 index 8e2cc4e32aa..00000000000 --- a/mozilla/cmd/macfe/utility/PrefControls.h +++ /dev/null @@ -1,67 +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. - */ - -#pragma once - -#ifdef MOZ_MAIL_NEWS -class CMessageFolder; -#endif // MOZ_MAIL_NEWS - -//====================================== -class UPrefControls -// The control classes themselves are all private. That's the point. They know what -// they're doing. - -// So far, the family includes -// CPrefTextEdit, CPrefCheckbox, CIntPrefRadio, and CBoolPrefRadio. Each of these -// has a custom constructor template. -// -// These can be added to any window (not just the preferences dialog). You add the -// control to your window in constructor, put in the pref name (eg -// "browser.foo.bar.mumble") and a number called "mOrdinal". -// -// In most cases, no code will be required. The control initializes itself by querying -// the pref value during FinishCreate(), and updates the associated preference when -// destroyed. The latter behavior is determined by a static function call that you -// should make if the user hits a "cancel" button. -// -// The meaning of mOrdinal varies with the type of pane. For a checkbox, mOrdinal -// is xored with the value when converting between the pref and the control value, -// allowing a checkbox to be worded in the same or the opposite sense to the pref's -// semantic. For a boolean radio button group, the one with mOrdinal == 0 corresponds -// to the pref value and updates its corresponding pref, while the other one must have -// mOrdinal == 1. For an int radio button group, the one whose ordinal matches the -// value of the pref gets turned on initially and on destruction, only the one that's -// on updates its corresponding pref to the value of its mOrdinal field. -// -// Future directions might include a popup menu control associated with an int -// value, an RGAColor pref control, etc. Well, the future is here. It's done. -//====================================== -{ -public: - static void RegisterPrefControlViews(); -#ifdef MOZ_MAIL_NEWS - static void NoteSpecialFolderChanged( - LPane* inDescriptionPane, - int inKind, /* actually UFolderDialogs::FolderKind */ - const CMessageFolder& inFolder); - static void NoteSpecialFolderChanged( - LPane* inDescriptionPane, - const char* inNewCaptionPrefName); -#endif // MOZ_MAIL_NEWS -}; diff --git a/mozilla/cmd/macfe/utility/QAP_Assist.h b/mozilla/cmd/macfe/utility/QAP_Assist.h deleted file mode 100644 index 6ac05bd4b19..00000000000 --- a/mozilla/cmd/macfe/utility/QAP_Assist.h +++ /dev/null @@ -1,273 +0,0 @@ -// ============================================================================ -// ¥¥¥ QAP_Assist.h -// ============================================================================ -// QA Partner/Macintosh Driver Assistance Hook Header -// -// Copyright © 1993-1997 Segue Software, Inc. -// All Rights Reserved. -// -// QA PARTNER RELEASE VERSION 4.0 BETA 1 -// THIS IS A BETA RELEASE. THIS SOFTWARE MAY HAVE BUGS. THIS SOFTWARE MAY CHANGE BEFORE FINAL RELEASE. - - - - -#ifndef _MAC //¥NETSCAPE: added these lines -#define _MAC -#include -#endif - -#ifndef __QAP_ASSIST_H__ -#define __QAP_ASSIST_H__ - -#include - - -//¥NETSCAPE: added this definition -#define QAP_BUILD - -// The internal name of the QA Partner 4.0 driver -#define QAP_DRIVER_NAME "\p.QAP40" - -// The PBControl code to send the driver to set the assist hook -#define QAP_SET_ASSIST_HOOK 200 - -// The return value you can use if you're not ready to assist the driver -#define QAP_CALL_ME_BACK -1 - -// Special "index" values for kQAPGetListContents -#define QAP_INDEX_ALL -1 -#define QAP_INDEX_SELECTED -2 - -// Prototype for the assist hook function which you must supply -#ifdef __cplusplus -extern "C" { -#endif - pascal short QAP_AssistHook (short selector, long handle, void *buffer, short val, long l_appA5); -#ifdef __cplusplus -} -#endif - -typedef pascal short (*QAPAssistHookPtr)(short, long, void *, short, long); - -// Mixed-Mode junk for QAP_AssistHook -#if GENERATINGPOWERPC || defined(powerc) || defined(__powerc) || defined (_MPPC_) - enum - { - uppQAPAssistHookInfo = kPascalStackBased - | RESULT_SIZE(SIZE_CODE(sizeof(short))) - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long))) - }; - - typedef UniversalProcPtr QAPAssistHookUPP; - #define CallQAPAssistHook(userRoutine, selector, handle, buffer, val, appA5) \ - CallUniversalProc((UniversalProcPtr)(userRoutine), uppQAPAssistHookInfo, (short)(selector), (long)(handle), (void *)(buffer), (short)(val), (long)(appA5)) - #define NewQAPAssistHook(userRoutine) \ - (QAPAssistHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppQAPAssistHookInfo, GetCurrentISA()) -#else - typedef QAPAssistHookPtr QAPAssistHookUPP; - #define CallQAPAssistHook(userRoutine, selector, handle, buffer, val, appA5) \ - (*(userRoutine))((short)(selector), (long)(handle), (void *)(buffer), (short)(val), (long)(appA5)) - #define NewQAPAssistHook(userRoutine) \ - (QAPAssistHookUPP)(userRoutine) -#endif - -// The selectors for the assist hook callback function -enum -{ -// selector handle buffer val return -// -------- ------ --- --- ------ - kQAPGetWindowContents, // WindowPtr wcinfo array ptr max array elements number of items returned - kQAPGetTextInfo, // from wcinfo textinfo struct ptr 1 0 if no error - kQAPGetStaticText, // from wcinfo buffer ptr (Str255) buffer size 0 if no erro - kQAPGetListInfo, // from wcinfo listinfo struct ptr 1 0 if no erro - kQAPGetListContents, // from wcinfo buffer ptr index 0 if no error - kQAPGetCustomItemName, // from wcinfo buffer ptr (Str255) 0 0 if no error - kQAPGetCustomItemValue, // from wcinfo buffer ptr (long *) 0 - kQAPAppToForeground, // NULL NULL 0 0 if no error - kQAPAppToBackground, // NULL NULL 0 0 if no error - kQAPGetScrollbarInfo, - kQAPWin32Service // HWND ptr to paramblock win32 Service Selector - }; - - // Selectors for win32 services - -enum -{ - kQAP_CB_GetContents, - kQAP_CB_GetAttr, - kQAP_CB_GetInfo, - kQAP_CB_GetItemText, - kQAP_CB_GetText, - kQAP_CB_IsSelected, - kQAP_CB_SelectText, - - kQAP_LB_GetContents, - kQAP_LB_GetAtPoint, - kQAP_LB_GetAttr, - kQAP_LB_GetInfo, - kQAP_LB_GetItemInfo, - kQAP_LB_GetItemText, - kQAP_LB_IsSelected, - - kQAP_LV_GetContents, - kQAP_LV_GetAttr, - kQAP_LV_GetInfo, - kQAP_LV_GetItemInfo, - kQAP_LV_GetItemText, - kQAP_LV_IsSelected, - kQAP_LV_MakeVisible, - - kQAP_PGL_GetContents, - kQAP_PGL_GetInfo, - kQAP_PGL_GetItemRect, - kQAP_PGL_GetItemText, - kQAP_PGL_IsSelected, - - kQAP_SCL_GetLayout, - kQAP_SCL_GetValues, - - kQAP_TV_GetContents, - kQAP_TV_GetAtPoint, - kQAP_TV_GetAttr, - kQAP_TV_GetInfo, - kQAP_TV_GetItemInfo, - kQAP_TV_GetItemText, - kQAP_TV_IsSelected, - - kQAP_UD_GetLayout, - kQAP_UD_GetValues -}; - -enum -{ - // Window type codes for the WCINFO 'type' field - WT_COMPLETE = 0, // marker for end of window item list (QAP will not add other items) - WT_INCOMPLETE, // marker for end of assist item list (QAP will add other items too) - WT_CONTROL, // Apple Control Manager control - WT_TEXT_FIELD, // Apple TextEdit Manager Text Field - WT_LIST_BOX, // Apple List Manager List Box - WT_ASSIST_ITEM, // Custom control (type indicated in 'cls' field) - WT_IGNORE, // Internal use - - // Window class codes for the WCINFO 'cls' field (only used for WT_ASSIST_ITEM items) - - WC_STATIC_TEXT = 256, - WC_TEXT_FIELD, - WC_LIST_BOX, - WC_POPUP_LIST, - WC_OWNER_DRAW, - WC_ICON, - WC_PICTURE, - WC_CUSTOM, - WC_PUSH_BUTTON, - WC_CHECK_BOX, - WC_RADIO_BUTTON, - WC_COMBO_BOX, - WC_LIST_VIEW, - WC_NULL, - WC_PAGE_LIST, - WC_TRACK_BAR, - WC_TREE_VIEW, - WC_UP_DOWN, - WC_SCROLL_BAR, - WC_WINDOW // Internal use -}; - -// Values for the 'flags' field of wcinfo -#define WCF_DISABLED 0x01 -#define WCF_NOCONTROL 0x02 - - -#if PRAGMA_ALIGN_SUPPORTED -# pragma options align = power -#endif - -// The structure to be filled in for each control when the assist hook -// is called with the kQAPGetWindowContents selector - -#define MAC_NAME_SIZE 32 - -typedef struct wcinfo -{ - Handle handle; - Rect rect; - short type; - short cls; - short flags; - short pad; - char str[MAC_NAME_SIZE]; -} WCINFO, *PWCINFO, **PPWCINFO; - -// The structure to be filled for the given item when the assist hook -// is called with the kQAPGetTextInfo selector - -typedef struct textinfo -{ - Handle handle; // handle to the text if you want me to unlock it - TEHandle hTE; // handle to the TE associated with the text (for dialog items) - Ptr ptr; // pointer to the actual text (locked if a handle, please) - short len; // length of the actual text - Boolean hasFocus; // TRUE if typing right now would go to the text field - char state; // value for HSetState if is not NULL - char buf[256]; // buffer to copy text into if you need a fixed place -} TEXTINFO, *PTEXTINFO, **PPTEXTINFO; - -// The structure to be filled for the given item when the assist hook -// is called with the kQAPGetListInfo selector - -typedef struct listinfo -{ - short itemCount; // total number of items in the listbox - short topIndex; // 1-based index of top visible item in list - short itemHeight; // height of each list item, in pixels - short visibleCount; // count of visible list items - ControlHandle vScroll; // ListBox's vertical scrollbar, or NULL - Boolean isMultiSel; // TRUE if cmd-click selects multiple items - Boolean isExtendSel; // TRUE if shift-click extends the selection range - Boolean hasText; // TRUE if the list items are textual - Boolean reserved; -} QAPLISTINFO, *PQAPLISTINFO, **PPQAPLISTINFO; - -typedef struct scrollbarinfo -{ - long lPos; - long lMin; - long lMax; - long lPageSize; - long lIncrement; - long lVertical; - long lHasThumb; - Point ptIncrArrow; - Point ptDecrArrow; - Point ptIncrPage; - Point ptDecrPage; - Point ptMinThumb; - Point ptMaxThumb; -} QAPSCROLLBARINFO, *PQAPSCROLLBARINFO, **PPQAPSCROLLBARINFO; - -#if PRAGMA_ALIGN_SUPPORTED -# pragma options align = reset -#endif - -//¥NETSCAPE --- begin -class CQAPartnerTableMixin -{ -public: - CQAPartnerTableMixin(LTableView *inView) ; - virtual ~CQAPartnerTableMixin() ; - - virtual void QapGetListInfo (PQAPLISTINFO pInfo) = 0; - virtual Ptr QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell) = 0; - virtual short QapGetListContents(Ptr pBuf, short index); - -protected: - LTableView * mTableView; -}; -//¥NETSCAPE --- end - -#endif // __QAP_ASSIST_H__ \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/QAP_AssistPP.cp b/mozilla/cmd/macfe/utility/QAP_AssistPP.cp deleted file mode 100644 index 3fb3042200b..00000000000 --- a/mozilla/cmd/macfe/utility/QAP_AssistPP.cp +++ /dev/null @@ -1,818 +0,0 @@ -// ============================================================================ -// ¥¥¥ QAP_AssistPP.cp -// ============================================================================ -// QA Partner/Macintosh Driver Assistance Hook for -// PowerPlant Class Library applications -// -// Copyright © 1993-1997 Segue Software, Inc. -// All Rights Reserved. -// -// QA PARTNER RELEASE VERSION 4.0 BETA 1 -// THIS IS A BETA RELEASE. THIS SOFTWARE MAY HAVE BUGS. THIS SOFTWARE MAY CHANGE BEFORE FINAL RELEASE. - -/* - -To use this assistance hook with your PowerPlant application, do the following: - -1. #include "QAP_Assist.h" in the source file(s) in which you do steps 2 and 3 below. - -2. In your main () function, add calls to the QAP_AssistHook before and after your - application's "Run" method, as follows - - ... - QAP_AssistHook (kQAPAppToForeground, 0, NULL, 0, 0); - YourApplication->Run(); - QAP_AssistHook (kQAPAppToBackground, 0, NULL, 0, 0); - ... - -3. Sub-class LCommander::PutOnDuty and LCommander::TakeOffDuty (if you havn't already), - and add the following to them: - - void CYourApplication::PutOnDuty () - { - QAP_AssistHook (kQAPAppToForeground, 0, NULL, 0, 0); - LCommander::PutOnDuty (); - } - - void CYourApplication::TakeOffDuty () - { - LCommander::TakeOffDuty (); - QAP_AssistHook (kQAPAppToBackground, 0, NULL, 0, 0); - } - -4. The assist hook now uses RTTI to resolve class id at runtime. Make sure RTTI - is enabled in your compiler preferences. Also, ensure that the LView static - class variable LView::sInFocusView and the instance variable LView::mSubPanes - are visible by tweaking 'LView.h' to declare them public. - -5. Add QAP_AssistPP.cp to your project and rebuild. - -*/ - -#include "QAP_Assist.h" -#ifdef QAP_BUILD -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include //¥NETSCAPE: was LListIterator.h -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef PARTNER // Segue internal use -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#ifdef PARTNER // Segue internal use -# include "ZButton.h" -#endif - -#include "CButton.h" //¥NETSCAPE: custom classes -#include "CPatternButtonPopup.h" - -#ifndef FALSE //¥NETSCAPE: duh? -#define FALSE 0 -#endif - - //¥NETSCAPE: - // When the driver calls back QAP_AssistHook with the - // 'kQAPGetListContents' selector, it sets a wrong - // LPane* in 'l_handle'. This enables a workaround: -#define QAP_V4_DRIVER_WORKAROUND - -#pragma segment main - -static short SetAssistHook (QAPAssistHookUPP assistHookUPP); -static void AddViewItem (LPane * lpanep, PWCINFO wcp, short * sp_count, short s_type, short s_cls, Handle h); -static short GetWindowContents (WindowPtr winp, PWCINFO wcp, short s_max); -static short GetListInfo (LPane * lpanep, PQAPLISTINFO p_buffer); //¥NETSCAPE: added -static short GetListContents (LPane * lpanep, Ptr p_buffer, short s_val); //¥NETSCAPE: added -static short LPaneGetContents (LPane * lpanep, PWCINFO wcp, short * sp_count, short s_max); -static short LPaneGetTextInfo (LPane * lpanep, PTEXTINFO textInfop); -static short LPaneGetCustomItemName (LPane * lpanep, char * cp_buf); -static short LPaneGetCustomItemValue (LPane * lpanep, long * l_value); - -// NOTE: assumes that is automatically included - -// ---------------------------------------------------------------------------- -// ¥ QAP_AssistHook -// ---------------------------------------------------------------------------- -// QAP_AssistHook is the actual assistance hook callback. -// -//¥NETSCAPE: -// - The kQAPGetListInfo and kQAPGetListContents cases were out-commented. -// - A5 was set/restored on each individual case and the GrafPort was not saved at all. -// We now do that at the beginning and the end of the function. Saving the GrafPort -// is necessary because of LPaneGetContents() => AddViewItem() => LPane::FocusDraw(). - -pascal short QAP_AssistHook (short s_selector, long l_handle, void * p_buffer, short s_val, long l_inAppA5) -{ - short s_result; - long l_saveA5; - GrafPtr savePort; - - // Set my A5 and grafport - if (l_inAppA5 != nil) - { - l_saveA5 = SetA5 (l_inAppA5); // line order... - ::GetPort(&savePort); // ...does matter - } - - /* Dispatch to the appropiate function and return the result. */ - - switch (s_selector) - { - case kQAPAppToForeground: - s_result = SetAssistHook (NewQAPAssistHook (QAP_AssistHook)); - break; - - case kQAPAppToBackground: - s_result = SetAssistHook (NULL); - break; - - case kQAPGetWindowContents: - s_result = GetWindowContents ((WindowPtr) l_handle, (PWCINFO) p_buffer, s_val); - break; - -/* - case kQAPGetCustomItemName: - LPaneGetCustomItemName ((LPane *) l_handle, (char *) p_buffer); - break; -*/ - case kQAPGetCustomItemValue: - LPaneGetCustomItemValue ((LPane *) l_handle, (long *) p_buffer); - break; - - case kQAPGetTextInfo: - s_result = LPaneGetTextInfo ((LPane *) l_handle, (PTEXTINFO) p_buffer); - break; - - case kQAPGetListInfo: - // PowerPlant LListBox uses the Mac Toolbox ListManager, so QAP gets - // the information it needs from the ListHandle. If you use custom - // ListBoxes, this selector would be called to retrieve information about the ListBox. - s_result = GetListInfo ((LPane *) l_handle, (PQAPLISTINFO) p_buffer); - break; - - case kQAPGetListContents: - // PowerPlant LListBox uses the Mac Toolbox ListManager, so QAP gets - // the information it needs from the ListHandle. If you use custom - // ListBoxes, this selector would be called to retrieve the contents the ListBox. - s_result = GetListContents ((LPane *) l_handle, (Ptr) p_buffer, s_val); - break; - - default: - s_result = 0; - break; - } - - // restore A5 and grafport - if (l_inAppA5 != nil) - { - ::SetPort(savePort); // line order... - l_saveA5 = SetA5 (l_saveA5); // ...does matter - } - - return s_result; -} - -// ---------------------------------------------------------------------------- -// ¥ SetAssistHook -// ---------------------------------------------------------------------------- -// SetAssistHook makes the appropriate PBControl call to the QA Partner driver to install -// the assistance hook callback - -static short SetAssistHook (QAPAssistHookUPP assistHookUPP) -{ - CntrlParam cp; - OSErr osErr; - - if ((osErr = OpenDriver (QAP_DRIVER_NAME, &cp.ioCRefNum)) != 0) - return osErr; - - cp.ioNamePtr = NULL; - cp.ioVRefNum = 0; - cp.csCode = QAP_SET_ASSIST_HOOK; - * (QAPAssistHookUPP *) & cp.csParam[0] = assistHookUPP; - * (long *) & cp.csParam[2] = (long) SetCurrentA5 (); - - if ((osErr = PBControlSync ((ParmBlkPtr) & cp)) != 0) - return osErr; - - return 0; -} - -// ---------------------------------------------------------------------------- -// ¥ AddViewItem -// ---------------------------------------------------------------------------- -// AddViewItem adds a given item to the window contents list. - -static void AddViewItem (LPane * lpanep, PWCINFO wcp, short * sp_count, short s_type, short s_cls, char * cp_name, Handle h) -{ - wcp += * sp_count; - ++ * sp_count; - wcp->type = s_type; - wcp->cls = s_cls; - wcp->handle = h; - - if (cp_name) - strncpy (wcp->str, cp_name, MAC_NAME_SIZE-1); - - if (lpanep) - { - lpanep->FocusDraw (); - lpanep->CalcPortFrameRect (wcp->rect); - wcp->flags = (lpanep->IsEnabled () ? 0 : WCF_DISABLED); - } -} - -// ---------------------------------------------------------------------------- -// ¥ GetWindowContents -// ---------------------------------------------------------------------------- -// GetWindowContents is called by the assistance hook to fill in the -// window contents structures for all the relevant views in a given window. - -static short GetWindowContents (WindowPtr winp, PWCINFO wcp, short s_max) -{ - LWindow * lwindowp; - short s_count = 0; - LView * lviewp_saveFocus; - - lviewp_saveFocus = LView::GetInFocusView(); //¥NETSCAPE: was LView::sInFocusView; - - lwindowp = LWindow::FetchWindowObject (winp); - - if (lwindowp != nil) - LPaneGetContents (lwindowp, wcp, & s_count, s_max); - - // The following call tells the QAP Agent that the list provided is incomplete. - // The Agent will go ahead and perform its usual traversal of toolbox data structures. - // If you do not want to perform this search, comment this line out. - - AddViewItem (0, wcp, & s_count, WT_INCOMPLETE, 0, NULL, 0); - - if (lviewp_saveFocus) - lviewp_saveFocus->FocusDraw (); - - return s_count; -} - -// ---------------------------------------------------------------------------- -// ¥ GetListInfo //¥NETSCAPE: added -// ---------------------------------------------------------------------------- -static short GetListInfo (LPane * lpanep, PQAPLISTINFO p_buffer) -{ -#ifdef QAP_V4_DRIVER_WORKAROUND - lpanep = (LPane *)(((long*)lpanep)[4]); -#endif //QAP_V4_DRIVER_WORKAROUND - CQAPartnerTableMixin* qaTable = dynamic_cast (lpanep); - if (qaTable != NULL) - qaTable->QapGetListInfo(p_buffer); - return 0; -} - -// ---------------------------------------------------------------------------- -// ¥ GetListContents //¥NETSCAPE: added -// ---------------------------------------------------------------------------- -static short GetListContents (LPane * lpanep, Ptr p_buffer, short s_val) -{ -#ifdef QAP_V4_DRIVER_WORKAROUND - lpanep = (LPane *)(((long*)lpanep)[4]); -#endif //QAP_V4_DRIVER_WORKAROUND - CQAPartnerTableMixin* qaTable = dynamic_cast (lpanep); - if (qaTable != NULL) - return (qaTable->QapGetListContents(p_buffer, s_val)); - return 0; -} - - -// ---------------------------------------------------------------------------- -// ¥ LPaneGetContents -// ---------------------------------------------------------------------------- -// LPaneGetContents is called by GetWindowContents -// and recursively by itself to fill in some window contents structures -// for a given LPane. - -static short LPaneGetContents (LPane * lpanep, PWCINFO wcp, short * sp_count, short s_max) -{ - LView * lviewp; - LEditField * leditFieldp; - LListBox * llistBoxp; - LStdControl * lstdControlp; - LTextEditView * LTextEditViewp; - PaneIDT id; - Str255 str; - char str_name[MAC_NAME_SIZE]; - - if (* sp_count == s_max) - return 0; - - if ((llistBoxp = dynamic_cast (lpanep)) != NULL) - { - AddViewItem (lpanep, wcp, sp_count, WT_LIST_BOX, 0, NULL, (Handle) llistBoxp->GetMacListH ()); - // Adjust bounding rect to exclude the scrollbars. - Rect r_adjusted = wcp [*sp_count-1].rect; - if ((** llistBoxp->GetMacListH ()).vScroll != NULL) - r_adjusted.right -= 15; - if ((** llistBoxp->GetMacListH ()).hScroll != NULL) - r_adjusted.bottom -= 15; - wcp [*sp_count-1].rect = r_adjusted; - goto Done; - } - - if ((lstdControlp = dynamic_cast (lpanep)) != NULL) - { - ((LCaption *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_CONTROL, 0, (char *) str, (Handle) lstdControlp->GetMacControl ()); - goto Done; - } - - if ((leditFieldp = dynamic_cast (lpanep)) != NULL) - { - AddViewItem (lpanep, wcp, sp_count, WT_TEXT_FIELD, 0, NULL, (Handle) leditFieldp->GetMacTEH ()); - goto Done; - } - - if ((LTextEditViewp = dynamic_cast (lpanep)) != NULL) - { - AddViewItem (lpanep, wcp, sp_count, WT_TEXT_FIELD, 0, NULL, (Handle) LTextEditViewp->GetMacTEH ()); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - ((LGroupBox *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_STATIC_TEXT, (char *) str, (Handle) lpanep); - // Change bounding rect to textbox frame. To do this, you need to change the access modifier of - // LGroupBox::CalcTextBoxFrame() from protected to public. -// ((LGroupBox *) lpanep)->CalcTextBoxFrame (wcp [*sp_count-1].rect); - - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - ((LCaption *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_STATIC_TEXT, (char *) str, (Handle) lpanep); - goto Done; - } - -#ifdef PARTNER - if (dynamic_cast (lpanep) != NULL) - { - // For in-house use, call the ZButton method - ((ZButton *) lpanep)->GetCDescriptor (str_name); - if (strcmp (str_name, "") == 0) - { - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - } - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_PUSH_BUTTON, str_name, (Handle) lpanep); - goto Done; - } -#endif - if ((dynamic_cast (lpanep) != NULL) || - (dynamic_cast (lpanep) != NULL)) - { - // Return the pane id as control name - - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - // Modify or override this to return window class WC_PUSH_BUTTON, - // WC_CHECK_BOX or WC_RADIO_BUTTON as appropriate for your use of LButton. - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_PUSH_BUTTON, str_name, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - ((LCaption *) lpanep)->GetDescriptor (str); - p2cstr (str); - // According to doc, LTextButton's default behaviour is that of a radio button. - // If this is not your case, change window class below as appropriate. - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_RADIO_BUTTON, (char *) str, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - // LToggleButton is essentially a fancy check box. - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_CHECK_BOX, str_name, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_ICON, str_name, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_CUSTOM, str_name, (Handle) lpanep); - goto Done; - } - -#ifndef PARTNER - if (dynamic_cast (lpanep) != NULL) - { - ((LGACheckbox *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_CHECK_BOX, (char *) str, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_CHECK_BOX, str_name /*¥NETSCAPE: was NULL*/, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - ((LGAPopup *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_POPUP_LIST, (char *) str, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_POPUP_LIST, str_name /*¥NETSCAPE: was NULL*/, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - - switch (((LGAIconButton *) lpanep)->GetControlMode ()) - { - case controlMode_Button: - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_PUSH_BUTTON, (char *) str_name /*¥NETSCAPE: was str*/, (Handle) lpanep); - break; - case controlMode_RadioButton: - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_RADIO_BUTTON, (char *) str_name /*¥NETSCAPE: was str*/, (Handle) lpanep); - break; - case controlMode_Switch: - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_CHECK_BOX, (char *) str_name /*¥NETSCAPE: was str*/, (Handle) lpanep); - break; - } - goto Done; - } - - if ((dynamic_cast (lpanep) != NULL) || - (dynamic_cast (lpanep) != NULL)) - { - ((LGAPopup *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_PUSH_BUTTON, (char *) str, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - ((LGAPopup *) lpanep)->GetDescriptor (str); - p2cstr (str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_RADIO_BUTTON, (char *) str, (Handle) lpanep); - goto Done; - } -#endif - - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_PICTURE, str_name, (Handle) lpanep); - // LPicture is subclassed from LView, and can have subViews. Don't exit. - } - - //¥ NETSCAPE --- begin - if (dynamic_cast (lpanep) != NULL) - { - // Return the pane id as control name - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_POPUP_LIST, str_name, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - ((CButton *)lpanep)->GetDescriptor(str); - p2cstr(str); - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_PUSH_BUTTON, (char *) str, (Handle) lpanep); - goto Done; - - short s_type = WC_PUSH_BUTTON; - if (((CButton *)lpanep)->IsBehaviourRadio()) - s_type = WC_RADIO_BUTTON; - else - if (((CButton *)lpanep)->IsBehaviourToggle()) - s_type = WC_CHECK_BOX; - - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, s_type, (char *) str, (Handle) lpanep); - goto Done; - } - - if (dynamic_cast (lpanep) != NULL) - { - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_LIST_BOX, (char *) str_name, (Handle) lpanep); - goto Done; - } - //¥ NETSCAPE --- end - - - //¥ NETSCAPE: below is the generic LView handler - put your custom types above - if ((lviewp = dynamic_cast (lpanep)) != NULL) - { - LArrayIterator iterator (lviewp->GetSubPanes (), LArrayIterator::from_Start); - LPane * lpanep_sub; - - while (iterator.Next (& lpanep_sub)) - { - if (lpanep_sub->IsVisible ()) - LPaneGetContents (lpanep_sub, wcp, sp_count, s_max); - if (* sp_count == s_max) - break; - } - goto Done; - } - -/* - The following is a catch-all which will return any other LPane as a CustomWin, including - "cosmetic" LPanes with no functionality. If you don't want this to happen, - comment the next four lines out. -*/ -/* - id = lpanep->GetPaneID (); - * (long *) str_name = id; - str_name[4] = 0; - AddViewItem (lpanep, wcp, sp_count, WT_ASSIST_ITEM, WC_CUSTOM, str_name, (Handle) lpanep); -*/ -Done: - return * sp_count; -} - -// ---------------------------------------------------------------------------- -// ¥ LPaneGetTextInfo -// ---------------------------------------------------------------------------- - -static short LPaneGetTextInfo (LPane * lpanep, PTEXTINFO textInfop) -{ - LCaption * lcaptionp; - LGroupBox * lgroupBoxp; - - memset (textInfop, 0, sizeof (TEXTINFO)); - - if ((lcaptionp = dynamic_cast (lpanep)) != NULL) - { - lcaptionp->GetDescriptor ((unsigned char *) textInfop->buf); - textInfop->hTE = NULL; - textInfop->hasFocus = FALSE; - textInfop->len = textInfop->buf[0]; - textInfop->handle = NULL; - textInfop->state = FALSE; - textInfop->ptr = (char *) & textInfop->buf[1]; - } - - if ((lgroupBoxp = dynamic_cast (lpanep)) != NULL) - { - lgroupBoxp->GetDescriptor ((unsigned char *) textInfop->buf); - textInfop->hTE = NULL; - textInfop->hasFocus = FALSE; - textInfop->len = textInfop->buf[0]; - textInfop->handle = NULL; - textInfop->state = FALSE; - textInfop->ptr = (char *) & textInfop->buf[1]; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// ¥ LPaneGetCustomItemName -// ---------------------------------------------------------------------------- -// If you want the assist hook to return the name of a GUI object, to -// be used as the tag, make sure this function returns what you need.xxx -// Name must be a NULL terminated c-string, shorter than 256 characters. -/* -static short LPaneGetCustomItemName (LPane * lpanep, char * cp_buf) -{ - - * cp_buf = 0; - - // For classes without obvious descriptor, by default we use the 4 character PaneID for tag. - // Change this if you want to return a different descriptor. - LButton * lbuttonp; - LCicnButton * lcicnButtonp; - LTextButton * ltextButtonp; - LToggleButton * ltoggleButtonp; - LPicture * lpicturep; - LIconPane * liconPanep; - - PaneIDT id; - - if ((lbuttonp = dynamic_cast (lpanep)) != NULL) - { - id = lbuttonp->GetPaneID (); - * (long *) cp_buf = id; - cp_buf[4] = 0; - goto Done; - } - - if ((lcicnButtonp = dynamic_cast (lpanep)) != NULL) - { - id = lbuttonp->GetPaneID (); - * (long *) cp_buf = id; - cp_buf[4] = 0; - goto Done; - } - - if ((ltextButtonp = dynamic_cast (lpanep)) != NULL) - { - ltextButtonp->GetDescriptor ((unsigned char *) cp_buf); - p2cstr ((StringPtr) cp_buf); - goto Done; - } - - if ((ltoggleButtonp = dynamic_cast (lpanep)) != NULL) - { - id = ltoggleButtonp->GetPaneID (); - * (long *) cp_buf = id; - cp_buf[4] = 0; - goto Done; - } - - if ((lpicturep = dynamic_cast (lpanep)) != NULL) - { - id = lpicturep->GetPaneID (); - * (long *) cp_buf = id; - cp_buf[4] = 0; - goto Done; - } - - if ((liconPanep = dynamic_cast (lpanep)) != NULL) - { - id = liconPanep->GetPaneID (); - * (long *) cp_buf = id; - cp_buf[4] = 0; - goto Done; - } - - -Done: - return 0; -} -*/ -// ---------------------------------------------------------------------------- -// ¥ LPaneGetCustomItemValue -// ---------------------------------------------------------------------------- -static short LPaneGetCustomItemValue (LPane * lpanep, long * l_value) -{ - - * l_value = 0; - - LControl * lcontrolp; - - if ((lcontrolp = dynamic_cast (lpanep)) != NULL) - { - * l_value = lcontrolp->GetValue (); - goto Done; - } - -Done: - return 0; -} - -// ---------------------------------------------------------------------------- -// ¥ CQAPartnerTableMixin //¥NETSCAPE: added -// ---------------------------------------------------------------------------- -CQAPartnerTableMixin::CQAPartnerTableMixin(LTableView * inTable) - : mTableView(inTable) -{ -} - -CQAPartnerTableMixin::~CQAPartnerTableMixin() -{ -} - -short CQAPartnerTableMixin::QapGetListContents(Ptr pBuf, short index) -{ - STableCell sTblCell; - short count = 0; - Ptr pLimit; - - if (pBuf == NULL || mTableView == NULL) - return 0; - - pLimit = pBuf + *(long *)pBuf; - - TableIndexT outRows, outCols; - mTableView->GetTableSize(outRows, outCols); - - switch (index) - { - case QAP_INDEX_ALL: - mTableView->IndexToCell(1, sTblCell); - if (mTableView->IsValidCell(sTblCell)) - { - do - { - if ((pBuf = QapAddCellToBuf(pBuf, pLimit, sTblCell)) != NULL) - { - count ++; - sTblCell.SetCell(sTblCell.row, outCols); - } - else - break; - } - while (mTableView->GetNextCell(sTblCell)); - } - break; - - case QAP_INDEX_SELECTED: - sTblCell = mTableView->GetFirstSelectedCell(); - if (mTableView->IsValidCell(sTblCell)) - { - do - { - if ((pBuf = QapAddCellToBuf(pBuf, pLimit, sTblCell)) != NULL) - { - count ++; - sTblCell.SetCell(sTblCell.row, outCols); - } - else - break; - } - while (mTableView->GetNextSelectedCell(sTblCell)); - } - break; - - default: - sTblCell.row = index + 1; - sTblCell.col = 1; - if (mTableView->IsValidCell(sTblCell)) - { - if ((pBuf = QapAddCellToBuf(pBuf, pLimit, sTblCell)) != NULL) - count ++; - } - break; - } - return count; -} - -#endif // QAP_BUILD diff --git a/mozilla/cmd/macfe/utility/StRegionHandle.h b/mozilla/cmd/macfe/utility/StRegionHandle.h deleted file mode 100644 index fa93056886d..00000000000 --- a/mozilla/cmd/macfe/utility/StRegionHandle.h +++ /dev/null @@ -1,104 +0,0 @@ -////////////////////////////////// - -// -// StRegionHandle.h -// -// by Drew Thaler, athaler@umich.edu -// released 9/21/96 -// -// This source code is public domain. -// - -////////////////////////////////// - -// MGY: renamed to StRegionHandle (from StRegion) to avoid conflict with -// existing StRegion. - -#ifndef _StRegionHandle_H_ -#define _StRegionHandle_H_ - - -#pragma mark -- StRegionHandle -- - -// ------------------------------------------------------------------------- -// ¥ StRegionHandle -// ------------------------------------------------------------------------- -// -// This class is an abstraction of the Macintosh Region data structure, -// implemented entirely with inline functions. It's meant to provide an -// easy-to-use interface to most of the standard region operations -- copying, -// adding, subtracting, xor'ing, intersecting, converting to/from rectangles, -// etc -- while using the magic of C++ to protect the user from the gory details. -// -// Benefits: ¥ Automatic memory management -- say goodbye to NewRgn, DisposeRgn, etc! -// ¥ Standard operators like +=, -=, &=, ==, etc for both Rects and RgnHandles -// ¥ Automatic coercion operators, can use directly in Toolbox calls -// ¥ No extra function calls: feels like C++, generates code like C. -// - - -class StRegionHandle -{ - -public: - StRegionHandle() { mRegion = ::NewRgn(); } - StRegionHandle(const RgnHandle fromRgn) { mRegion = ::NewRgn(); ::CopyRgn( fromRgn, mRegion ); } - StRegionHandle(const Rect &fromRect) { mRegion = ::NewRgn(); ::RectRgn( mRegion, &fromRect ); } - ~StRegionHandle() { if (mRegion) ::DisposeRgn(mRegion); } - - Rect bbox() const { return (**mRegion).rgnBBox; } - void GetBounds(Rect &outRect) const { outRect = (**mRegion).rgnBBox; } - void Clear() { ::SetEmptyRgn(mRegion); } - Boolean IsEmpty() const { return ::EmptyRgn(mRegion); } - RgnHandle Detach() { RgnHandle oldRegion = mRegion; mRegion = ::NewRgn(); return oldRegion; } - - Boolean IsValid() { return (mRegion!=nil); } - - operator RgnHandle() const { return mRegion; } - operator Handle() const { return (Handle)mRegion; } - - RgnHandle & operator += ( RgnHandle r ) { ::UnionRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator -= ( RgnHandle r ) { ::DiffRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator |= ( RgnHandle r ) { ::UnionRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator &= ( RgnHandle r ) { ::SectRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator ^= ( RgnHandle r ) { ::XorRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator = ( RgnHandle r ) { ::CopyRgn(r,mRegion); return mRegion; } - - RgnHandle & operator += ( Rect & rect ) { StRegionHandle r(rect); ::UnionRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator -= ( Rect & rect ) { StRegionHandle r(rect); ::DiffRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator |= ( Rect & rect ) { StRegionHandle r(rect); ::UnionRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator &= ( Rect & rect ) { StRegionHandle r(rect); ::SectRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator ^= ( Rect & rect ) { StRegionHandle r(rect); ::XorRgn(mRegion,r,mRegion); return mRegion; } - RgnHandle & operator = ( Rect &r ) { ::RectRgn(mRegion,&r); return mRegion; } - - Boolean operator == ( RgnHandle r ) { return ::EqualRgn(r,mRegion); } - Boolean operator != ( RgnHandle r ) { return !::EqualRgn(r,mRegion); } - - Boolean operator == ( Rect & rect ) { StRegionHandle r(rect); return ::EqualRgn(r,mRegion); } - Boolean operator != ( Rect & rect ) { StRegionHandle r(rect); return !::EqualRgn(r,mRegion); } - - // why not, so you can do "if rgn == 0", right? - RgnHandle & operator = ( int x ) { ::SetEmptyRgn(mRegion); return mRegion; } - Boolean operator == ( int x ) { return ( (x==0) && ::EmptyRgn(mRegion) ); } - Boolean operator != ( int x ) { return ( (x!=0) || !::EmptyRgn(mRegion) ); } - - -private: - RgnHandle mRegion; -}; - - -////////////////////////////////// - - -#pragma mark -- StTempRegion -- - -typedef class StRegionHandle StTempRegion; - - - - - - -#endif // _StRegionHandle_H_ - diff --git a/mozilla/cmd/macfe/utility/UDeferredTask.cp b/mozilla/cmd/macfe/utility/UDeferredTask.cp deleted file mode 100644 index d8bb1258c11..00000000000 --- a/mozilla/cmd/macfe/utility/UDeferredTask.cp +++ /dev/null @@ -1,531 +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. - */ - -#include "UDeferredTask.h" - -#include -#include - -#include "CWindowMenu.h" -#include "CNetscapeWindow.h" -#include - -CDeferredTaskManager* CDeferredTaskManager::sManager = nil; - -//---------------------------------------------------------------------------------------- -CDeferredTaskManager::CDeferredTaskManager() -//---------------------------------------------------------------------------------------- -: mQueueList(nil) -{ - sManager = this; - StartIdling(); -} // CDeferredTaskManager::CDeferredTaskManager - -//---------------------------------------------------------------------------------------- -CDeferredTaskManager::~CDeferredTaskManager() -//---------------------------------------------------------------------------------------- -{ - sManager = nil; -} // CDeferredTaskManager::CDeferredTaskManager - -//---------------------------------------------------------------------------------------- -/*static*/ void CDeferredTaskManager::DoQuit(Int32 /*inSaveOption*/) -// Called from uapp.cp. Allow any pending tasks to complete before quitting. -//---------------------------------------------------------------------------------------- -{ - // Allow all the close tasks to finish. When the last task is done, sManager should - // be set to null. - EventRecord stupidNullEvent = {0}; - for (int timeOutCounter = 0; sManager && timeOutCounter < 500; timeOutCounter++) - { - sManager->DoExecuteTasks(); // netlib might be needed. - DevoteTimeToRepeaters(stupidNullEvent); - } - Assert_(!sManager); // ow! we ran 500 times and the manager is still alive! -} // CDeferredTaskManager::DoQuit - -//---------------------------------------------------------------------------------------- -/* static */ void CDeferredTaskManager::Post(CDeferredTask* inTask, LPane* inPane, bool inUnique) -//---------------------------------------------------------------------------------------- -{ - if (!inTask) - return; - try - { - // If this is the first post, we'll make a new manager - if (!sManager) - new CDeferredTaskManager; - sManager->DoPost(inTask, inPane, inUnique); - } - catch(...) - { - } -} // CDeferredTaskManager::Post - - -//---------------------------------------------------------------------------------------- -/* static */ void CDeferredTaskManager::Remove(CDeferredTask*& inTask, LPane* inPane) -//---------------------------------------------------------------------------------------- -{ - Assert_(sManager); - if (sManager) - sManager->DoRemove(inTask, inPane); - // Task may already have executed and been removed. Always zero the caller's stale - // pointer. - inTask = nil; -} // CDeferredTaskManager::Remove - -//---------------------------------------------------------------------------------------- -/* static */ void CDeferredTaskManager::ClearQueue(LPane* inPane) -//---------------------------------------------------------------------------------------- -{ - // If there's no sManager, then there are no queues, so there's nothing to do. - if (!sManager) - return; - sManager->DoClearQueue(inPane); -} // CDeferredTaskManager::Remove - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::DoPost(CDeferredTask* inTask, LPane* inPane, Boolean inUnique) -//---------------------------------------------------------------------------------------- -{ - LWindow* window = nil; - if (inPane) - window = LWindow::FetchWindowObject(inPane->GetMacPort()); - - // Try to find a queue matching this window: - CDeferredTaskQueue* q = mQueueList; - while (q) - { - if (q->mQueueWindow == window) - break; - q = q->mNext; - } - if (!q) - { - // no queue for this window yet. Make one, insert it at front of list. - try - { - q = new CDeferredTaskQueue(window); - q->mNext = mQueueList; - mQueueList = q; - } - catch(...) - { - return; - } - } - // Got a queue. Post the task to it. If it's a unique ("Post1") operation, remove - // all tasks of the same type first. - if (inUnique) - q->DoRemoveType(inTask); - q->DoPost(inTask); -} // CDeferredTaskManager::DoPost - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::DoRemove(CDeferredTask*& inTask, LPane* inPane) -//---------------------------------------------------------------------------------------- -{ - if (!inTask) - return; - LWindow* window = nil; - if (inPane) - window = LWindow::FetchWindowObject(inPane->GetMacPort()); - if (window) - DoRemove(inTask, window); -} - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::DoRemove(CDeferredTask*& inTask, LWindow* inWindow) -// A nil window is OK (and represents the global "nil" queue). -//---------------------------------------------------------------------------------------- -{ - if (!inTask) - return; - - // Try to find a queue matching the specified window. - // Note to those who follow: the window pointed to by inWindow may be deleted, but - // the pointer is still usable as an identifier for the task's queue. - CDeferredTaskQueue* q = mQueueList; - CDeferredTaskQueue* prev = nil; - while (q) - { - if (q->mQueueWindow == inWindow) - { - q->DoRemove(inTask); - break; - } - prev = q; - q = q->mNext; - } - - // If the queue for this window is empty, delete it from the queue list. - if (q && q->mFrontTask == nil) - RemoveNextQueueAfter(prev); - - // If there are no more queues, die. Life is not worth living if there are no more - // queues for me to manage. - if (!mQueueList) - delete this; -} // CDeferredTaskManager::DoRemove - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::RemoveNextQueueAfter(CDeferredTaskQueue* inPreviousQueue) -// Remove the queue following the inPreviousQueue. If inPreviousQueue is nil, remove -// first queue. -//---------------------------------------------------------------------------------------- -{ - CDeferredTaskQueue* q = inPreviousQueue ? inPreviousQueue->mNext : mQueueList; - CDeferredTaskQueue* next = q->mNext; - delete q; - if (inPreviousQueue) - inPreviousQueue->mNext = next; - else - mQueueList = next; -} // CDeferredTaskManager::RemoveNextQueueAfter - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::DoClearQueue(LPane* inPane) -//---------------------------------------------------------------------------------------- -{ - LWindow* window = nil; - if (inPane) - window = LWindow::FetchWindowObject(inPane->GetMacPort()); - if (window) - DoClearQueue(window); -} // CDeferredTaskManager::DoClearQueue - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::DoClearQueue(LWindow* inWindow) -// A nil window is OK (and represents the global "nil" queue). -//---------------------------------------------------------------------------------------- -{ - // Try to find a queue matching the specified window. - // Note to those who follow: the window pointed to by inWindow may be deleted, but - // the pointer is still usable as an identifier for the task's queue. - CDeferredTaskQueue* q = mQueueList; - CDeferredTaskQueue* prev = nil; - while (q) - { - if (q->mQueueWindow == inWindow) - { - q->DoClearSelf(); - break; - } - prev = q; - q = q->mNext; - } - - // If the queue for this window is empty, delete it from the queue list. - if (q && q->mFrontTask == nil) - RemoveNextQueueAfter(prev); - - // If there are no more queues, die. Life is not worth living if there are no more - // queues for me to manage. - if (!mQueueList) - delete this; -} // CDeferredTaskManager::DoClearQueue - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::DoExecuteTasks() -//---------------------------------------------------------------------------------------- -{ - // Try to execute the first task in each window's queue. - CDeferredTaskQueue* q = mQueueList; - while (q) - { - CDeferredTask* frontTask = q->mFrontTask; - CDeferredTaskQueue* nextQueue = q->mNext; - if (frontTask) - { - CDeferredTask::ExecuteResult result = frontTask->Execute(); - if (result == CDeferredTask::eDoneDelete) - { - DoRemove(frontTask, q->mQueueWindow); - // Note to those who follow: the window may be deleted here, but - // the pointer is still usable as an identifier for the task's queue. - } - else if (result == CDeferredTask::eWaitStepBack) - { - // front task didn't complete its work, and wants to yield to the second - // task (if any) on the next go round. - CDeferredTask* nextTask = frontTask->mNext; - if (nextTask) - { - q->mFrontTask = nextTask; - frontTask->mNext = nextTask->mNext; - nextTask->mNext = frontTask; - } - } - // The third case (eWaitStayFront) is handled by just passing on to the next - // queue. - } - q = nextQueue; - } -} // CDeferredTaskManager::ExecuteTasks - -//---------------------------------------------------------------------------------------- -void CDeferredTaskManager::SpendTime(const EventRecord&) -//---------------------------------------------------------------------------------------- -{ - DoExecuteTasks(); -} // CDeferredTaskManager::SpendTime - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CDeferredTaskQueue::CDeferredTaskQueue(LWindow* inWindow) -// A nil window is OK (and represents the global "nil" queue). -//---------------------------------------------------------------------------------------- -: mFrontTask(nil) -, mQueueWindow(inWindow) -, mNext(nil) -{ -} // CDeferredTaskQueue::CDeferredTaskQueue - -//---------------------------------------------------------------------------------------- -CDeferredTaskQueue::~CDeferredTaskQueue() -//---------------------------------------------------------------------------------------- -{ -} // CDeferredTaskQueue::CDeferredTaskQueue - -//---------------------------------------------------------------------------------------- -void CDeferredTaskQueue::DoPost(CDeferredTask* inTask) -//---------------------------------------------------------------------------------------- -{ - CDeferredTask* cur = mFrontTask; - CDeferredTask* prev = nil; - while (cur) - { - prev = cur; - cur = cur->mNext; - } - if (prev) - prev->mNext = inTask; - else - mFrontTask = inTask; -} // CDeferredTaskQueue::DoPost - -//---------------------------------------------------------------------------------------- -void CDeferredTaskQueue::DoRemove(CDeferredTask*& inTask) -//---------------------------------------------------------------------------------------- -{ - if (!inTask) - return; - CDeferredTask* cur = mFrontTask; - CDeferredTask* prev = nil; - while (cur) - { - if (cur == inTask) - { - // Found the task in the queue, remove it. - CDeferredTask* next = inTask->mNext; - delete inTask; - inTask = nil; // that's why it's a reference. - // Note that possibly inTask == mFrontTask - if (prev) - prev->mNext = next; - else - mFrontTask = next; - break; - } - prev = cur; - cur = cur->mNext; - } -} // CDeferredTaskQueue::DoRemove - -//---------------------------------------------------------------------------------------- -void CDeferredTaskQueue::DoRemoveType(CDeferredTask* inTask) -// Remove all tasks whose class type is the same as inTask. Used in Post1() calls before -// posting the new class. -//---------------------------------------------------------------------------------------- -{ - if (!inTask) - return; - CDeferredTask* cur = mFrontTask; - CDeferredTask* prev = nil; - while (cur) - { - CDeferredTask* next = cur->mNext; - if (typeid(*cur) == typeid(*inTask)) - { - // Found a matching task in the queue, remove it. - delete cur; - if (prev) - prev->mNext = next; - else - mFrontTask = next; - } - else - { - prev = cur; - } - cur = next; - } -} // CDeferredTaskQueue::DoRemove - -//---------------------------------------------------------------------------------------- -void CDeferredTaskQueue::DoClearSelf() -// Remove all tasks whose class type is the same as inTask. Used in Post1() calls before -// posting the new class. -//---------------------------------------------------------------------------------------- -{ - while (mFrontTask) - { - CDeferredTask* dead = mFrontTask; - mFrontTask = dead->mNext; - delete dead; - } -} // CDeferredTaskQueue::ClearSelf - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CDeferredTask::CDeferredTask() -//---------------------------------------------------------------------------------------- -: mNext(nil) -, mExecuting(false) -#if DEBUG -, mExecuteAttemptCount(0) -#endif -{ -} // CDeferredTask::CDeferredTask - -//---------------------------------------------------------------------------------------- -CDeferredTask::~CDeferredTask() -//---------------------------------------------------------------------------------------- -{ -} // CDeferredTask::~CDeferredTask - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredTask::Execute() -//---------------------------------------------------------------------------------------- -{ - if (mExecuting) - return eWaitStayFront; -#if DEBUG - mExecuteAttemptCount++; - Assert_((mExecuteAttemptCount & 0x000003FF) != 0); // assert every 1024 attempts. -#endif - mExecuting = true; - ExecuteResult result = eWaitStayFront; - try - { - result = ExecuteSelf(); - } - catch(...) - { - result = eDoneDelete; // if threw exception, delete task so it won't execute again. - } - mExecuting = false; - return result; -} // CDeferredTask::Execute - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CDeferredCommand::CDeferredCommand( - LCommander* inCommander, - CommandT inCommand, - void* ioParam) -//---------------------------------------------------------------------------------------- -: mCommander(inCommander) -, mCommand(inCommand) -, mParam(ioParam) -{ -} // CDeferredCommand::CDeferredCommand - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredCommand::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (mCommander && !mCommander->ObeyCommand(mCommand, mParam)) - return eWaitStayFront; - return eDoneDelete; -} // CDeferredCommand::ExecuteSelf - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CDeferredMessage::CDeferredMessage( - LListener* inListener, - MessageT inMessage, - void* ioParam) -//---------------------------------------------------------------------------------------- -: mListener(inListener) -, mMessage(inMessage) -, mParam(ioParam) -{ -} // CDeferredMessage::CDeferredMessage - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredMessage::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (mListener) - mListener->ListenToMessage(mMessage, mParam); - return eDoneDelete; -} // CDeferredMessage::ExecuteSelf - -#pragma mark - - -//---------------------------------------------------------------------------------------- -CDeferredCloseTask::CDeferredCloseTask( - LPane* inPane) -//---------------------------------------------------------------------------------------- -: mWindow(nil) -{ - if (inPane) - mWindow = dynamic_cast - (LWindow::FetchWindowObject(inPane->GetMacPort())); - if (mWindow) - { - mWindow->StopAllContexts(); // This can reshow the window, so do it first. - mWindow->Hide(); - // Make sure there are no other load tasks and such. - CDeferredTaskManager::ClearQueue(mWindow); - } -} // CDeferredCloseTask::CDeferredCloseTask - -//---------------------------------------------------------------------------------------- -CDeferredTask::ExecuteResult CDeferredCloseTask::ExecuteSelf() -//---------------------------------------------------------------------------------------- -{ - if (!mWindow) - return eDoneDelete; - // Allow the double-click timer in the thread window to time out and delete itself - // probably unnecessary to wait - safer? - if (mWindow->ClickTimesAreClose(::TickCount())) - return eWaitStayFront; - // Wait till any pending URLs are finished - if (mWindow->IsAnyContextBusy()) - return eWaitStayFront; - if (mWindow) - mWindow->DoClose(); - return eDoneDelete; -} // CDeferredCloseTask::ExecuteSelf - -//---------------------------------------------------------------------------------------- -/* static */ CDeferredCloseTask* CDeferredCloseTask::DeferredClose(LPane* inPane) -//---------------------------------------------------------------------------------------- -{ - CDeferredCloseTask* task = new CDeferredCloseTask(inPane); - CDeferredTaskManager::Post(task, inPane); - return task; -} - diff --git a/mozilla/cmd/macfe/utility/UDeferredTask.h b/mozilla/cmd/macfe/utility/UDeferredTask.h deleted file mode 100644 index aa84f525391..00000000000 --- a/mozilla/cmd/macfe/utility/UDeferredTask.h +++ /dev/null @@ -1,206 +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. - */ - -#pragma once - -//======================================================================================== -// This file contains a suite of classes that allow posting and deferred execution -// of tasks in any powerplant application (except for CDeferredCloseTask, which is -// specific to Communicator). - -// CDeferredTaskManager: A singleton class, manages each per-window queue of tasks, -// together with one global "nil" queue. It is created only when -// a task is first posted, and is deleted as soon as no more -// tasks exist. -// CDeferredTaskQueue: A queue of tasks. Each task belongs to a window (except that -// one global "nil" queue is allowed), and tasks for -// different windows are in different queues. A queue is created -// only when needed and is deleted immediately it becomes empty. - -// CDeferredTask: The abstract base class for tasks that can be posted. -// CDeferredCommand This is an example of a deferred task object. Its ExecuteSelf() -// method calls ObeyCommand -// CDeferredMessage This is another example, but calls ListenToMessage instead. -// CDeferredCloseTask Another example. Closes a window when it's safe. -//======================================================================================== - -#include - -class CDeferredTaskQueue; // forward. -class CDeferredTask; // forward. - -//======================================================================================== -class CDeferredTaskManager -// On each idle, the task manager will walk the queue list. For each queue, it will -// take the following action: -// Tell the first task to execute. If the task returns true, the task is then -// deleted. If it returns false, it is left in the queue to be tried on the next idle. -// There are only a few public entry points: Post and Remove. Each of these has -// an LPane* parameter that is used to work out which window, and hence which queue, the -// task belongs to. When posting, a new queue will be opened for the window in question, -// if none exists. When removing, the queue is deleted if no more tasks remain in it. -//======================================================================================== -: public LPeriodical -{ - public: // ---------- BEGIN PUBLIC API ------------- // - static void Post(CDeferredTask* inTask, LPane* inPane, - bool inUnique = false); - // Post a task to the end of the queue. If - // inUnique is true all others of the same - // type will be removed. - static void Remove(CDeferredTask*& inTask, LPane* inPane); - // Remove task. - static void ClearQueue(LPane* inPane); - // Remove all tasks from this queue. - static void DoQuit(Int32 inSaveOption); - // Finish all the close tasks. - // ---------- END PUBLIC API ------------- // - protected: - CDeferredTaskManager(); - ~CDeferredTaskManager(); - virtual void SpendTime(const EventRecord&); - void DoExecuteTasks(); - void DoPost( - CDeferredTask* inTask, - LPane* inPane, - Boolean inUnique); - void DoRemove( - CDeferredTask*& inTask, - LPane* inPane); - void DoRemove( - CDeferredTask*& inTask, - LWindow* inWindow); - void DoClearQueue(LPane* inPane); - void DoClearQueue(LWindow* inWindow); - void RemoveNextQueueAfter( - CDeferredTaskQueue* inPreviousQueue); -// data - protected: - CDeferredTaskQueue* mQueueList; - static CDeferredTaskManager* sManager; -}; // class CDeferredTaskManager - -//======================================================================================== -class CDeferredTaskQueue -// There is one queue per window, and optionally one global one (with mQueueWindow -// == nil). The first task in each queue "blocks" any subsequent tasks in the same queue. -// FIFO order is thus guaranteed. -//======================================================================================== -{ - friend class CDeferredTaskManager; - protected: - CDeferredTaskQueue(LWindow* inWindow); - ~CDeferredTaskQueue(); - void DoPost(CDeferredTask* inTask); - void DoRemove(CDeferredTask*& inTask); - void DoRemoveType(CDeferredTask* inTask); - void DoClearSelf(); -// data - protected: - LWindow* mQueueWindow; - CDeferredTaskQueue* mNext; - CDeferredTask* mFrontTask; -}; // class CDeferredWindowTaskQueue - -//======================================================================================== -class CDeferredTask -// Base class for various useful types of deferred tasks. Derived classes must implement -// ExecuteSelf(), returning an ExecuteResult value of: -// eWaitStayFront task is to be tried again, and wishes to remain blocking the queue -// eWaitDoneDelete task has done its work and is to be deleted -// eWaitStepBack task is to be tried again, but willing to step back in the queue -// to give the next task a chance. (background, low priority) -//======================================================================================== -{ - protected: - enum ExecuteResult { eWaitStayFront, eDoneDelete, eWaitStepBack }; - CDeferredTask(); - virtual ~CDeferredTask(); - virtual ExecuteResult ExecuteSelf() = 0; - private: - ExecuteResult Execute(); - // data - protected: - friend class CDeferredTaskManager; - friend class CDeferredTaskQueue; - CDeferredTask* mNext; - Boolean mExecuting; // reentrancy protection. -#if DEBUG - UInt32 mExecuteAttemptCount; -#endif -}; // class CDeferredTask - -class LCommander; - -//======================================================================================== -class CDeferredCommand -// This is an example of a CDeferredTask. This one calls ObeyCommand on a commander. -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredCommand( - LCommander* inCommander, - CommandT inCommand, - void* ioParam); - virtual ExecuteResult ExecuteSelf(); - // data - LCommander* mCommander; - CommandT mCommand; - void* mParam; -}; // class CDeferredCommand - -class LListener; - -//======================================================================================== -class CDeferredMessage -// This is an example of a CDeferredTask. This one calls ListenToMessage on a listener. -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredMessage( - LListener* inListener, - MessageT inMessage, - void* ioParam); - virtual ExecuteResult ExecuteSelf(); - // data - LListener* mListener; - MessageT mMessage; - void* mParam; -}; // class CDeferredMessage - -class CNetscapeWindow; - -//======================================================================================== -class CDeferredCloseTask -// This guy closes a window at a later, safer time. The parameter to the constructor is -// any pane (usually the calling pane), from which the window object is deduced. This -// only works for CNetscapeWindows -//======================================================================================== -: public CDeferredTask -{ - public: - CDeferredCloseTask(LPane* inPane); - static CDeferredCloseTask* DeferredClose(LPane* inPane); - protected: - virtual ExecuteResult ExecuteSelf(); -// data - protected: - CNetscapeWindow* mWindow; -}; // class CDeferredCloseTask diff --git a/mozilla/cmd/macfe/utility/UFixedFontSwitcher.cp b/mozilla/cmd/macfe/utility/UFixedFontSwitcher.cp deleted file mode 100644 index da2e850e26c..00000000000 --- a/mozilla/cmd/macfe/utility/UFixedFontSwitcher.cp +++ /dev/null @@ -1,60 +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. - */ - -// =========================================================================== -// UFixedFontSwitcher.cp -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com - -#include "UFixedFontSwitcher.h" -#include "uprefd.h" -/*----------------------------------------------------------------------------- - UFixedFontSwitcher - Class know how to switch font depend on CPrefs:CCharSet - It use Singleton (See Design Patterns by Erich Gamma ) ------------------------------------------------------------------------------*/ - - -UFixedFontSwitcher* UFixedFontSwitcher::fTheOnlyInstance = NULL; -UFixedFontSwitcher* UFixedFontSwitcher::Instance() -{ - if(fTheOnlyInstance == NULL) - fTheOnlyInstance = new UFixedFontSwitcher(); - return fTheOnlyInstance; -} -void UFixedFontSwitcher::EncodingTextFont(INTL_Encoding_ID encoding) -{ - switch(encoding) - { - case CS_DINGBATS: - TextFontDingbats(); - break; - case CS_SYMBOL: - TextFontSymbol(); - break; - default: - { - CCharSet charset; - Boolean gotFont = CPrefs::GetFont(encoding, &charset); - - Assert_(gotFont); - ::TextFont(charset.fFixedFontNum); - } - } -} diff --git a/mozilla/cmd/macfe/utility/UFixedFontSwitcher.h b/mozilla/cmd/macfe/utility/UFixedFontSwitcher.h deleted file mode 100644 index e78105e8c2d..00000000000 --- a/mozilla/cmd/macfe/utility/UFixedFontSwitcher.h +++ /dev/null @@ -1,40 +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. - */ - -// =========================================================================== -// UFixedFontSwitcher.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com - -#pragma once -#include "libi18n.h" -#include "UFontSwitcher.h" -/*----------------------------------------------------------------------------- - UFixedFontSwitcher - Class know how to switch font depend on CPrefs:CCharSet - It use Singleton (See Design Patterns by Erich Gamma ) ------------------------------------------------------------------------------*/ -class UFixedFontSwitcher : public UFontSwitcher{ -public: - UFixedFontSwitcher() {}; - static UFixedFontSwitcher* Instance(); - virtual void EncodingTextFont(INTL_Encoding_ID encoding); -private: - static UFixedFontSwitcher* fTheOnlyInstance; -}; diff --git a/mozilla/cmd/macfe/utility/UFontSwitcher.cp b/mozilla/cmd/macfe/utility/UFontSwitcher.cp deleted file mode 100644 index 4c4f7949fca..00000000000 --- a/mozilla/cmd/macfe/utility/UFontSwitcher.cp +++ /dev/null @@ -1,37 +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. - */ - -// =========================================================================== -// UFontSwitcher.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -#include "UFontSwitcher.h" - -void UFontSwitcher::TextFontSymbol() -{ - short family; - ::GetFNum("\pSymbol", &family); - ::TextFont(family); -} -void UFontSwitcher::TextFontDingbats() -{ - short family; - ::GetFNum("\pZapf Dingbats", &family); - ::TextFont(family); -} diff --git a/mozilla/cmd/macfe/utility/UFontSwitcher.h b/mozilla/cmd/macfe/utility/UFontSwitcher.h deleted file mode 100644 index 1fcd9c0d2cc..00000000000 --- a/mozilla/cmd/macfe/utility/UFontSwitcher.h +++ /dev/null @@ -1,35 +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. - */ - -// =========================================================================== -// UFontSwitcher.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -#pragma once -#include"libi18n.h" -/*----------------------------------------------------------------------------- - UFontSwitcher - Abstract class which know how to switch font for different encoding ------------------------------------------------------------------------------*/ -class UFontSwitcher { -public: - virtual void EncodingTextFont(INTL_Encoding_ID encoding) = 0; - virtual void TextFontSymbol(); - virtual void TextFontDingbats(); -}; diff --git a/mozilla/cmd/macfe/utility/UMailFolderMenus.cp b/mozilla/cmd/macfe/utility/UMailFolderMenus.cp deleted file mode 100644 index 46d76858931..00000000000 --- a/mozilla/cmd/macfe/utility/UMailFolderMenus.cp +++ /dev/null @@ -1,1344 +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. - */ - - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "UMailFolderMenus.h" -#include "CMailNewsContext.h" -#include "PascalString.h" -#include "CMessageFolderView.h" -#include "CMailFolderButtonPopup.h" - -#include "StSetBroadcasting.h" -#include "miconutils.h" -#include "MercutioAPI.h" -#include "UMenuUtils.h" -#include "CMessageFolder.h" - -#pragma mark - -/*====================================================================================*/ - #pragma mark TYPEDEFS -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -static const UInt16 cFolderPopupFlags = MSG_FOLDER_FLAG_MAIL; -static const UInt8 cSpaceFolderMenuChar = 0x09; -static const ResIDT cMenuIconIDDiff = 256; -static const Int16 cItemIdentWidth = 16; - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL FUNCTION PROTOTYPES -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark INTERNAL CLASS DECLARATIONS -/*====================================================================================*/ - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -// Static class members - -LArray CMailFolderMixin::sMailFolderMixinRegisterList; -Boolean CMailFolderMixin::sMustRebuild = true; -void* CMailFolderMixin::sMercutioCallback = nil; - -//----------------------------------- -CMailFolderMixin::CMailFolderMixin(Boolean inIncludeFolderIcons) -: mFolderArray(sizeof(CMessageFolder)) -, mDesiredFolderFlags((FolderChoices)(eWantPOP + eWantIMAP)) -, mInitialMenuCount(0) -//----------------------------------- -{ - - mUseFolderIcons = inIncludeFolderIcons; - RegisterMailFolderMixin(this); -} // CMailFolderMixin::CMailFolderMixin - -//----------------------------------- -CMailFolderMixin::~CMailFolderMixin() -//----------------------------------- -{ - UnregisterMailFolderMixin(this); - // Delete all the CMessageFolder objects, or else we'll leak the cache! - for (ArrayIndexT i = 1; i <= mFolderArray.GetCount(); i++) - { - CMessageFolder* f = (CMessageFolder*)mFolderArray.GetItemPtr(i); - if (f) - (*(CMessageFolder*)mFolderArray.GetItemPtr(i)).CMessageFolder::~CMessageFolder(); - } -} // CMailFolderMixin::~CMailFolderMixin - -//----------------------------------- -void CMailFolderMixin::UpdateMailFolderMixins() -//----------------------------------- -{ - sMustRebuild = true; - LCommander::SetUpdateCommandStatus(true); -} // CMailFolderMixin::UpdateMailFolderMixins - -//----------------------------------- -void CMailFolderMixin::UpdateMailFolderMixinsNow(CMailFolderMixin *inSingleMailFolderMixin) -// Notify all registered CMailFolderMixin objects that the mail folder list has changed. -// This method should be called whenever the list changes, fo example, when the user -// adds, moves, or deletes mail folders in the Folder View window. -// -// If inSingleMailFolderMixin is not nil, only that specific CMailFolderMixin is -// notified of the change, NOT all CMailFolderMixin objects. -// -// IMPORTANT NOTE: CMailFolderMixin::UpdateMailFolderMixinsNow(this) needs to be called -// for all subclasses after initialization is complete. -//----------------------------------- -{ - - if (!sMustRebuild && inSingleMailFolderMixin == nil) - return; - if (sMailFolderMixinRegisterList.GetCount() == 0 && inSingleMailFolderMixin == nil) - return; // No reason to do anything! - - MSG_Master *master = CMailNewsContext::GetMailMaster(); - FailNIL_(master); - - // Get a list and count of all current mail folders. You can only ask for one flag - // at a time (ALL bits must match for positive test in this call). - Int32 numFoldersMail = ::MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_MAIL, nil, 0); - Assert_(numFoldersMail > 0); // Should have at least some permanent mail folders! - Int32 numNewsgroups = 0; - Int32 numNewsHosts = 0; - if ( - !inSingleMailFolderMixin - || (inSingleMailFolderMixin->mDesiredFolderFlags & (eWantNews|eWantHosts)) - == (eWantNews|eWantHosts) - ) - numNewsHosts = ::MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_NEWS_HOST, nil, 0); - if (!inSingleMailFolderMixin - || (inSingleMailFolderMixin->mDesiredFolderFlags & eWantNews) != 0) - numNewsgroups = ::MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_SUBSCRIBED, nil, 0); - - Int32 numFolders = numFoldersMail + numNewsgroups + numNewsHosts; - StPointerBlock folderInfoData(sizeof(MSG_FolderInfo *) * numFolders); - MSG_FolderInfo **folderInfo = (MSG_FolderInfo **) folderInfoData.mPtr; - - Int32 numFolders2 = ::MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_MAIL, folderInfo, numFoldersMail); - Assert_(numFolders2 > 0); // Should have at least some permanent mail folders! - Assert_(numFolders2 == numFoldersMail); - - // Handle the news hosts and groups, filling in the remaining pointers in the array. - MSG_FolderInfo** currentInfo = folderInfo + numFoldersMail; - if (numNewsHosts && numNewsgroups) - { - // The difficult case. - // Get the list of hosts and the list of groups into separate lists. - StPointerBlock newsHostInfoData(sizeof(MSG_FolderInfo *) * numNewsHosts); - MSG_FolderInfo **newsHostInfo = (MSG_FolderInfo **) newsHostInfoData.mPtr; - numFolders2 = ::MSG_GetFoldersWithFlag( - master, - MSG_FOLDER_FLAG_NEWS_HOST, - newsHostInfo, - numNewsHosts); - Assert_(numFolders2 == numNewsHosts); - - StPointerBlock newsgroupInfoData(sizeof(MSG_FolderInfo *) * numNewsgroups); - MSG_FolderInfo **newsgroupInfo = (MSG_FolderInfo **) newsgroupInfoData.mPtr; - numFolders2 = ::MSG_GetFoldersWithFlag( - master, - MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_SUBSCRIBED, - newsgroupInfo, - numNewsgroups); - Assert_(numFolders2 == numNewsgroups); - - // Loop over the hosts, copying one host, then all its groups - if (numNewsHosts) - { - for (int i = 0; i < numNewsHosts; i++) - { - // Copy over all the news groups for this host - *currentInfo++ = newsHostInfo[i]; - for (int j = 0; j < numNewsgroups; j++) - { - // Are the two hosts the same? - if (::MSG_GetHostForFolder(newsgroupInfo[j]) - == ::MSG_GetHostForFolder(newsHostInfo[i])) - { - *currentInfo++ = newsgroupInfo[j]; - } - } // inner loop - } // outer loop - } - } - else if (numNewsgroups) - { - numFolders2 = ::MSG_GetFoldersWithFlag( - master, - MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_SUBSCRIBED, - currentInfo, - numNewsgroups); - } - else if (numNewsHosts) - { - numFolders2 = ::MSG_GetFoldersWithFlag( - master, - MSG_FOLDER_FLAG_NEWS_HOST, - currentInfo, - numNewsHosts); - } - // Notify all registered CMailFolderMixin objects, or only the specified object - if ( inSingleMailFolderMixin == nil ) - { - LArrayIterator iterator(sMailFolderMixinRegisterList); - while ( iterator.Next(&inSingleMailFolderMixin) ) - inSingleMailFolderMixin->MPopulateWithFolders(folderInfo, numFolders); - sMustRebuild = false; - } - else - inSingleMailFolderMixin->MPopulateWithFolders(folderInfo, numFolders); -} // CMailFolderMixin::UpdateMailFolderMixinsNow - -//----------------------------------- -Boolean CMailFolderMixin::MSetSelectedFolderName( - const char *inName, - Boolean inDoBroadcast) -// Set the currently selected item in the menu to the item represented by inName. If -// inName is nil, empty, or cannot be found, the value of the menu is set to 0. -// Return true if the specified folder name was found in the menu. -//----------------------------------- -{ - const ArrayIndexT numItems = mFolderArray.GetCount(); - ArrayIndexT curIndex; - if ( !inName || !*inName) - curIndex = numItems + 1; - else - { - for (curIndex = 1; curIndex <= numItems; ++curIndex) - { - const char* itemPath = MGetFolderName(curIndex); - if ( ::strcasecomp(inName, itemPath) == 0 ) - break; - } - } - - if ( curIndex <= numItems ) - { - MSetSelectedMenuItem(curIndex, inDoBroadcast); - return true; - } - else - { - MSetSelectedMenuItem(0, inDoBroadcast); - return false; - } -} - -//----------------------------------- -Boolean CMailFolderMixin::MSetSelectedFolder( - const CMessageFolder& inFolder, - Boolean /*inDoBroadcast*/) -//----------------------------------- -{ - return MSetSelectedFolder(inFolder.GetFolderInfo()); -} - -//----------------------------------- -Boolean CMailFolderMixin::MSetSelectedFolder( - const MSG_FolderInfo* inInfo, - Boolean inDoBroadcast) -//----------------------------------- -{ - const ArrayIndexT numItems = mFolderArray.GetCount(); - Assert_(mFolderArray.GetCount() == (MGetNumMenuItems() - mInitialMenuCount)); - // Not synced otherwise - ArrayIndexT curIndex; - if (inInfo == nil) - curIndex = numItems + 1; - else - { - mFolderArray.Lock(); - for (curIndex = 1; curIndex <= numItems; ++curIndex) - { - CMessageFolder* curFolder = (CMessageFolder*)mFolderArray.GetItemPtr(curIndex); - if (inInfo == curFolder->GetFolderInfo()) - break; - } - mFolderArray.Unlock(); - } - - if ( curIndex <= numItems ) - { - MSetSelectedMenuItem(curIndex, inDoBroadcast); - return true; - } - else - { - MSetSelectedMenuItem(0, inDoBroadcast); - return false; - } -} - -//----------------------------------- -const char* CMailFolderMixin::MGetFolderName(ArrayIndexT inItemNumber) -// Get the currently selected folder name in the menu. Return a reference to head of -// the returned c-string. -//----------------------------------- -{ - CMessageFolder folder = MGetFolder(inItemNumber); - MSG_FolderInfo* info = folder.GetFolderInfo(); - if (info) - { - const char * str = ::MSG_GetFolderNameFromID(info); - - // Make sure that the name is fully escaped - static char escapedName[256]; - XP_STRCPY(escapedName, str); - NET_UnEscape(escapedName); - char * temp = NET_Escape(escapedName, URL_PATH); - if (temp) - { - XP_STRCPY(escapedName, temp); - XP_FREE(temp); - } - return escapedName; - } - return nil; -} - - -//----------------------------------- -const char* CMailFolderMixin::MGetSelectedFolderName() -// Get the currently selected folder name in the menu. Return a reference to head of -// the returned c-string. -//----------------------------------- -{ - ArrayIndexT index = MGetSelectedMenuItem(); - if (index) - return MGetFolderName(index); - return nil; -} - -//----------------------------------- -CMessageFolder CMailFolderMixin::MGetFolder(ArrayIndexT inItemNumber) -//----------------------------------- -{ - CMessageFolder result(nil); - Assert_(mFolderArray.GetCount() == (MGetNumMenuItems() - mInitialMenuCount)); // Not synced otherwise - if ( (mFolderArray.GetCount() > 0) && (inItemNumber > 0) ) - { - if ( mFolderArray.ValidIndex(inItemNumber) ) - { - mFolderArray.Lock(); - result = *(CMessageFolder*) mFolderArray.GetItemPtr(inItemNumber); - mFolderArray.Unlock(); - } - } - return result; -} - -//----------------------------------- -CMessageFolder CMailFolderMixin::MGetFolderFromMenuItem(ArrayIndexT inItemNumber) -//----------------------------------- -{ - // convert the menu item number in to an index into the folder array - CMessageFolder result(nil); - if (inItemNumber - mInitialMenuCount > 0) - { // If (inItemNumber - mInitialMenuCount) is 0 or less then we are trying to - // find folder info on a previously existing menu item. - result = MGetFolder(inItemNumber - mInitialMenuCount); - } - return result; -} - - -//----------------------------------- -CMessageFolder CMailFolderMixin::MGetSelectedFolder() -//----------------------------------- -{ - return MGetFolder(MGetSelectedMenuItem()); -} - -//----------------------------------- -ResIDT CMailFolderMixin::GetMailFolderIconID(UInt16 inFlags) -//----------------------------------- -{ - - if ((inFlags & MSG_FOLDER_FLAG_MAIL) != 0) - return 0; - UInt16 folderType = inFlags & ( - MSG_FOLDER_FLAG_TRASH | MSG_FOLDER_FLAG_SENTMAIL | - MSG_FOLDER_FLAG_DRAFTS | MSG_FOLDER_FLAG_QUEUE | - MSG_FOLDER_FLAG_INBOX - ); - switch ( folderType ) - { - case MSG_FOLDER_FLAG_TRASH: return 286; - case MSG_FOLDER_FLAG_SENTMAIL: return 284; - case MSG_FOLDER_FLAG_DRAFTS: return 285; - case MSG_FOLDER_FLAG_QUEUE: return 283; - case MSG_FOLDER_FLAG_INBOX: return 282; - default: - if ( inFlags & MSG_FOLDER_FLAG_IMAPBOX ) - return 287; // Online folder? - return 281; - } -} - -/*====================================================================================== - Register the specified inMailFolderMixin so that it is automatically notified - when changes are made to the mail folder list. The specified inMailFolderMixin - is only added to the list if it is not already there. -======================================================================================*/ - -void CMailFolderMixin::RegisterMailFolderMixin(CMailFolderMixin *inMailFolderMixin) { - - Assert_(inMailFolderMixin != nil); - - if ( sMailFolderMixinRegisterList.FetchIndexOf(&inMailFolderMixin) == LArray::index_Bad ) { - sMailFolderMixinRegisterList.InsertItemsAt(1, LArray::index_Last, &inMailFolderMixin); - } -} - - - -/*====================================================================================== - Unregister the specified inMailFolderMixin so that it is no longer notified - when changes are made to the mail folder list. If the specified inMailFolderMixin - is not in the list, this method does nothing. -======================================================================================*/ - -void CMailFolderMixin::UnregisterMailFolderMixin(CMailFolderMixin *inMailFolderMixin) { - - sMailFolderMixinRegisterList.Remove(&inMailFolderMixin); -} - -//----------------------------------- -void CMailFolderMixin::MGetCurrentMenuItemName(Str255 outItemName) -// Get the name of the menu item that is currently selected, minus any indentation. -//----------------------------------- -{ - outItemName[0] = 0; - MGetMenuItemName(MGetSelectedMenuItem(), outItemName); - if ( outItemName[0] != 0 ) - { - UInt8 *curChar = &outItemName[1], *endChar = curChar + outItemName[0]; - do - { - if ( *curChar != cSpaceFolderMenuChar ) break; - } while ( ++curChar < endChar ); - - Int8 numLeading = curChar - (&outItemName[1]); - - if ( numLeading != 0 ) - { - outItemName[0] -= numLeading; - if ( outItemName[0] != 0 ) - { - ::BlockMoveData(&outItemName[numLeading + 1], &outItemName[1], outItemName[0]); - } - } - } -} // CMailFolderMixin::MGetCurrentMenuItemName - -//----------------------------------- -Boolean CMailFolderMixin::FolderFilter(const CMessageFolder& folder) -// Return true iff you want this folder included in the list. This function should -// handle all known cases, but we may want to make this virtual and override it in the -// future. -//----------------------------------- -{ - Boolean result; - - if (folder.GetLevel() > 1) - { - UInt32 folderFlags = folder.GetFolderFlags(); - Boolean isPOP, isIMAP, isNews, isInbox, isPublicFolder; - - isNews = folderFlags & MSG_FOLDER_FLAG_NEWSGROUP ? true: false; - isIMAP = folderFlags & MSG_FOLDER_FLAG_IMAPBOX ? true: false; - isPOP = (!isIMAP && (folderFlags & MSG_FOLDER_FLAG_MAIL)) ? true: false; - isInbox = folderFlags& MSG_FOLDER_FLAG_INBOX ? true : false; - isPublicFolder = ( isIMAP&& ( folderFlags& MSG_GROUPNAME_FLAG_IMAP_PUBLIC ) ) ? true : false; - - if (isPOP && (mDesiredFolderFlags & eWantPOP)) - { - result = true; - } - else if (isIMAP && (mDesiredFolderFlags & eWantIMAP)) - { - result = true; - } - else if (isNews && (mDesiredFolderFlags & eWantNews)) - { - result = true; - } - else if ( isInbox && (mDesiredFolderFlags & eWantInbox) ) - { - result = true; - } - else if ( isPublicFolder && (mDesiredFolderFlags & eWantPublicFolder) ) - { - result = true; - } - else - { - result = false; - } - } - else - { - // level <= 1, we are filtering a host/ server. - result = (mDesiredFolderFlags & eWantHosts) != 0; - } - - return result; -} // CMailFolderMixin::FolderFilter - -//----------------------------------- -pascal void MyMercutioCallback( - Int16 menuID, - Int16 /*previousModifiers*/, - RichItemDataYadaYada& inItemData) -//----------------------------------- -{ - // This function is called continuously when the user clicks the - // folder popup in a Thread window. Static variables have been added - // for performance reasons. - - RichItemData& itemData = (RichItemData&)inItemData; - itemData.flags &= ~kChangedByCallback; // clear bit - - // Find the mixin object, if any, belonging to this menu - CMailFolderMixin* mixin = nil; - Boolean found = false; - - static Int16 prevMenuID = 0; - static MenuRef prevMenuH = nil; - static UInt32 prevTicks = 0; - MenuRef menuh; - - Boolean sameMenuAsBefore = (menuID == prevMenuID - && prevMenuH != nil - && (::TickCount() - prevTicks < 30)); - // Don't reuse the same menu after a short delay because we can't tell - // whether the user is still clicking the same popup as before: he may - // have selected another window since the last time (and unfortunately, - // all the folder popups in the different windows have the same ID). - prevTicks = ::TickCount(); - - if (sameMenuAsBefore) - menuh = prevMenuH; - else - { - menuh = ::GetMenuHandle(menuID); - prevMenuH = menuh; - prevMenuID = menuID; - } - - if (menuh) - { - LArrayIterator iterator(CMailFolderMixin::sMailFolderMixinRegisterList); - while (iterator.Next(&mixin)) - { - if (mixin->MGetSystemMenuHandle() == menuh) - { - found = true; - break; - } - } - } - if (!found || !mixin || !mixin->mUseFolderIcons) - return; - - static ArrayIndexT prevItemID = 0; - static CMessageFolder prevFolder(nil); - CMessageFolder currentFolder(nil); - if (sameMenuAsBefore && itemData.itemID == prevItemID && prevFolder.GetFolderInfo() != nil) - currentFolder = prevFolder; - else - { - currentFolder = mixin->MGetFolderFromMenuItem(itemData.itemID); - prevFolder = currentFolder; - prevItemID = itemData.itemID; - } - if (currentFolder.GetFolderInfo() == NULL) - return; - - switch (itemData.cbMsg) - { - case cbBasicDataOnlyMsg: - itemData.flags |= - (ksameAlternateAsLastTime|kIconIsSmall|kHasIcon/*|kChangedByCallback*/|kdontDisposeIcon); - itemData.flags &= ~(kIsDynamic); - - return; - - case cbIconOnlyMsg: - break; // look out below! - - default: - return; - } - - // OK, calculate the icon and check whether it's changed. - - static ResIDT prevIconID = 0; - static Handle prevIconSuite = nil; - ResIDT iconID = currentFolder.GetIconID(); - Handle newIconSuite; - if (iconID == prevIconID && prevIconSuite != nil) - newIconSuite = prevIconSuite; - else - { - newIconSuite = CIconList::GetIconSuite(iconID); - prevIconSuite = newIconSuite; - prevIconID = iconID; - } - if (newIconSuite && newIconSuite != itemData.hIcon) - { - // It's changed. Modify the data record for Mercutio. - itemData.hIcon = newIconSuite; - itemData.iconType = 'suit'; - if (::LMGetSysFontFam() != systemFont) // no bold for Chicago - it sucketh - { - if (currentFolder.CountUnseen() > 0 ) - itemData.textStyle.s |= bold; - else - itemData.textStyle.s &= ~bold; - } -// itemData.flags |= kChangedByCallback; // set bit - - // indent the item by shifting the left side - const Int16 baseLevel - = (mixin->mDesiredFolderFlags & CMailFolderMixin::eWantHosts) - ? kRootLevel : kRootLevel + 1; - itemData.itemRect.left - = itemData.itemRect.right - - (*menuh)->menuWidth - + ((currentFolder.GetLevel() - baseLevel) * cItemIdentWidth); - } -} // MyMercutioCallback - -//----------------------------------- -void CMailFolderMixin::GetFolderNameForDisplay(char * inName, CMessageFolder& folder) -//----------------------------------- -{ - const char* geekName = (char*)folder.GetName(); - const char* prettyName = (char*)folder.GetPrettyName(); - Boolean isNewsFolder = ((folder.GetFolderType() & (MSG_FOLDER_FLAG_NEWSGROUP | MSG_FOLDER_FLAG_NEWS_HOST)) != 0); - - if (isNewsFolder && prettyName != nil && *prettyName != '\0') - { -#if 0 -// sprintf(inName, "%s (%s)", geekName, prettyName); - Int16 strLen = ::strlen(geekName); - ::strcpy(inName, geekName); - inName[strLen ++] = ' '; - inName[strLen ++] = '('; - ::strcpy(&inName[strLen], prettyName); - strLen += ::strlen(prettyName); - inName[strLen ++] = ')'; - inName[strLen ++] = '\0'; -#endif - ::strcpy(inName, prettyName); - } - else - ::strcpy(inName, geekName); -} // GetFolderNameForDisplay - -inline void *operator new(size_t,void *p) { return p; } - -//----------------------------------- -Boolean CMailFolderMixin::MPopulateWithFolders(const MSG_FolderInfo **inFolderInfoArray, - Int32 inNumFolders) -// Populate the folder menu popup with the specified list of mail folders. This method -// can be called at anytime after object creation; it does the right thing. -// -// The inFolderInfoArray contains a list of (MSG_FolderInfo *) pointer representing -// the current list of mail folders. inNumFolders is the number of items in the -// array, 0 if none. -// -// This method tries to keep the currently selected folder, but if changed, sets the -// menu value to 0. -//----------------------------------- -{ - MSG_Master *master = CMailNewsContext::GetMailMaster(); - FailNIL_(master); - - MenuRef menuh = MGetSystemMenuHandle(); - - const Int16 startNumItems = MGetNumMenuItems() - mInitialMenuCount; - Assert_(mFolderArray.GetCount() == startNumItems); // Should be equal - - Boolean didChange = false; - - Int16 addedItems = 0; - - // Store the currently selected folder - - CMessageFolder selectedFolder = MGetSelectedFolder(); - - // Set menu items - MSG_FolderInfo** curInfo = (MSG_FolderInfo**)inFolderInfoArray; - const Int16 baseLevel = (mDesiredFolderFlags & eWantHosts) ? kRootLevel : kRootLevel + 1; - const Int16 spacesPerFolderLevel = (cItemIdentWidth / ::CharWidth(cSpaceFolderMenuChar)) + 1; - CMessageFolder folder(nil); - for (Int16 curItem = 0; curItem < inNumFolders; curItem++, curInfo++) - { - CMessageFolder previousFolder = folder; - folder = CMessageFolder(*curInfo); - if (FolderFilter(folder)) - { - - // Insert a gray line in the menu for host-level stuff we're not inserting. - if (addedItems && previousFolder.GetLevel() == 1 && !(mDesiredFolderFlags & eWantHosts)) - { - if ( ++addedItems <= startNumItems ) - { - if ( MUpdateMenuItem(addedItems + mInitialMenuCount, "\p-", /*iconID*/0) ) - didChange = true; - new (mFolderArray.GetItemPtr(addedItems)) CMessageFolder(nil); - } - else - { - didChange = true; - MAppendMenuItem("\p-", /*iconID*/0); - mFolderArray.InsertItemsAt(1, addedItems, &folder); - // Now we have to store it again, this time properly, using the copy - // constructor. Otherwise, the refcount of CCachedFolderLine is not incremented - // because the previous line just does a bitwise copy. - new (mFolderArray.GetItemPtr(addedItems)) CMessageFolder(nil); - } - // Ask for a callback so we can set the icon - if (mUseFolderIcons && MDEF_IsCustomMenu(menuh)) - ::SetItemStyle(menuh, addedItems + mInitialMenuCount, condense); - } - - // add spaces at the end of the name to make the menu larger - // and reserve some room for the identation - char tempString[cMaxMailFolderNameLength + 1]; - GetFolderNameForDisplay(tempString, folder); - - Int16 nameLen = ::strlen(tempString); - Int16 numSpaces = ((folder.GetLevel() - baseLevel) * spacesPerFolderLevel); - if ( numSpaces > (sizeof(tempString) - nameLen) ) - numSpaces = sizeof(tempString) - nameLen; - if ( numSpaces > 0 ) - ::memset(tempString + nameLen, cSpaceFolderMenuChar, numSpaces); - tempString[nameLen + numSpaces] = '\0'; - NET_UnEscape(tempString); - - CStr255 menuString(tempString); - - // Update or append the current menu item - if ( ++addedItems <= startNumItems ) - { - if ( MUpdateMenuItem(addedItems + mInitialMenuCount, menuString, /*iconID*/0) ) - didChange = true; - (*(CMessageFolder*)mFolderArray.GetItemPtr(addedItems)).CMessageFolder::~CMessageFolder(); - new (mFolderArray.GetItemPtr(addedItems)) CMessageFolder(folder); - } - else - { - didChange = true; - MAppendMenuItem(menuString, /*iconID*/0); - mFolderArray.InsertItemsAt(1, addedItems, &folder); - // Now we have to store it again, this time properly, using the copy - // constructor. Otherwise, the refcount of CCachedFolderLine is not incremented - // because the previous line just does a bitwise copy. - new (mFolderArray.GetItemPtr(addedItems)) CMessageFolder(folder); - } - // Ask for a callback so we can set the icon - if (mUseFolderIcons && MDEF_IsCustomMenu(menuh)) - ::SetItemStyle(menuh, addedItems + mInitialMenuCount, condense); - } // if (FolderFilter(folder)) - } // for - - // Get rid of any remaining menu items - if (addedItems < startNumItems) - { - didChange = true; - MClipMenuItems(addedItems + 1 + mInitialMenuCount); - for (ArrayIndexT i = addedItems + 1; i <= mFolderArray.GetCount(); i++) - { - CMessageFolder* f = (CMessageFolder*)mFolderArray.GetItemPtr(i); - if (f) - (*(CMessageFolder*)mFolderArray.GetItemPtr(i)).CMessageFolder::~CMessageFolder(); - } - mFolderArray.RemoveItemsAt(LArray::index_Last, addedItems + 1); - } - - // Set the originally selected item (try to keep original folder), - // or 0 if the folder was deleted - if (didChange && inNumFolders > 0 ) - { - // Don't broadcast anything here - if ( !MSetSelectedFolder(selectedFolder, false) ) - MSetSelectedMenuItem(0, false); - } - - // Set up for callback so we can set the icon - if (mUseFolderIcons && MDEF_IsCustomMenu(menuh)) - { - if (!sMercutioCallback) - sMercutioCallback = NewMercutioCallback(MyMercutioCallback); - FailNIL_(sMercutioCallback); - MDEF_SetCallbackProc(menuh, (MercutioCallbackUPP)sMercutioCallback); - MenuPrefsRec myPrefs; - ::memset(&myPrefs, 0, sizeof(myPrefs)); - myPrefs.useCallbackFlag.s = condense; - MDEF_SetMenuPrefs(menuh, &myPrefs); - } - - // Refresh on change - if (didChange) - MRefreshMenu(); - return didChange; -} // MPopulateWithFolders - - -#pragma mark - - -/*====================================================================================== - Get the number of menu items. -======================================================================================*/ - -Int16 CMailFolderPopupMixin::MGetNumMenuItems(void) -{ - return MGetControl()->GetMaxValue(); -} - - -/*====================================================================================== - Get the selected menu item. -======================================================================================*/ - -Int16 CMailFolderPopupMixin::MGetSelectedMenuItem(void) -{ - return MGetControl()->GetValue(); -} - - -/*====================================================================================== - Set the selected menu item. Refresh the menu if the selection changes. -======================================================================================*/ - -void CMailFolderPopupMixin::MSetSelectedMenuItem(Int16 inIndex, Boolean inDoBroadcast) -{ - - StSetBroadcasting setBroadcasting( - MGetControl(), - inDoBroadcast && MGetControl()->IsBroadcasting() - ); - MGetControl()->SetValue(inIndex); -} - - -/*====================================================================================== - Update the current menu item. If any of the input parameters are different from - the current menu item parameters, return true and reset the menu item; otherwise, - return false and don't modify the menu. If inIconID is non-zero, set the icon for - the menu item to that resource. Don't refresh the menu display in anyway. -======================================================================================*/ - -Boolean CMailFolderPopupMixin::MUpdateMenuItem(Int16 inMenuItem, ConstStr255Param inName, - ResIDT inIconID) -{ - LControl *theControl = MGetControl(); -// StEmptyVisRgn emptyRgn(theControl->GetMacPort()); // Make changes invisible - - Boolean changed = false; - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Assert_((inIconID > cMenuIconIDDiff) || (inIconID == 0)); - - Assert_(::CountMItems(menuH) == MGetNumMenuItems()); - Assert_((inMenuItem > 0) && (inMenuItem <= MGetNumMenuItems())); - - Str255 currentText; - ::GetMenuItemText(menuH, inMenuItem, currentText); - - changed = !::EqualString(currentText, inName, true, true); - if ( changed ) ::SetMenuItemText(menuH, inMenuItem, inName); - - if ( inIconID ) inIconID -= cMenuIconIDDiff; - Int16 iconID; - ::GetItemIcon(menuH, inMenuItem, &iconID); - if ( iconID != inIconID ) { - changed = true; - ::SetItemIcon(menuH, inMenuItem, inIconID); - } - - return changed; -} - - -/*====================================================================================== - Append the specified menu item to the end of the menu. If inIconID is non-zero, set - the icon for the menu item to that resource. Don't refresh the menu display in - anyway. -======================================================================================*/ - -void CMailFolderPopupMixin::MAppendMenuItem(ConstStr255Param inName, ResIDT inIconID) { - - LControl *theControl = MGetControl(); -// StEmptyVisRgn emptyRgn(theControl->GetMacPort()); // Make changes invisible - - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Assert_((inIconID > cMenuIconIDDiff) || (inIconID == 0)); - Int16 numMenuItems = MGetNumMenuItems() + 1; - - Assert_(::CountMItems(menuH) == MGetNumMenuItems()); - - UMenuUtils::AppendMenuItem(menuH, inName); - - if ( inIconID ) { - ::SetItemIcon(menuH, numMenuItems, inIconID - cMenuIconIDDiff); - } - theControl->SetMaxValue(numMenuItems); -} - - -/*====================================================================================== - Remove menu items from the end of the current menu, beginning with the item at - inStartClipItem. Don't refresh the menu display in anyway. -======================================================================================*/ - -void CMailFolderPopupMixin::MClipMenuItems(Int16 inStartClipItem) { - - LControl *theControl = MGetControl(); -// StEmptyVisRgn emptyRgn(theControl->GetMacPort()); // Make changes invisible - - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Int16 numMenuItems = MGetNumMenuItems(); - - Assert_(::CountMItems(menuH) == numMenuItems); - Assert_((inStartClipItem > 0) && (inStartClipItem <= numMenuItems)); - - while ( numMenuItems >= inStartClipItem ) { - ::DeleteMenuItem(menuH, numMenuItems--); - } - inStartClipItem -= 1; - - if ( MGetSelectedMenuItem() > inStartClipItem ) theControl->SetValue(inStartClipItem); - theControl->SetMaxValue(inStartClipItem); -} - - -/*====================================================================================== - Get the current menu text for the specified item. -======================================================================================*/ - -void CMailFolderPopupMixin::MGetMenuItemName(Int16 inMenuItem, Str255 outItemName) { - - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Assert_(::CountMItems(menuH) == MGetNumMenuItems()); - Assert_((inMenuItem > 0) && (inMenuItem <= MGetNumMenuItems())); - - ::GetMenuItemText(menuH, inMenuItem, outItemName); -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CMailFolderPopupMixin::MRefreshMenu(void) { - - MGetControl()->Refresh(); -} - - -#pragma mark - - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CGAIconPopupFolderMixin::MGetSystemMenuHandle(void) { - - return MGetControl()->GetMacMenuH(); -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CGAIconPopupFolderMixin::MRefreshMenu(void) { - - MGetControl()->RefreshMenu(); -} - - -#pragma mark - - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CGAPopupFolderMixin::MGetSystemMenuHandle(void) { - - return MGetControl()->GetMacMenuH(); -} - - -#pragma mark - - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CGAIconButtonPopupFolderMixin::MGetSystemMenuHandle(void) { - - return MGetControl()->GetMacMenuH(); -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CGAIconButtonPopupFolderMixin::MRefreshMenu(void) { - - // Don't need to do anything since the menu is not visible unless the user has clicked - // on it. For a displayed name alongside the button, override in descended class. -} - - -#pragma mark - - -/*====================================================================================== - Get the number of menu items. -======================================================================================*/ - -Int16 CMenuMailFolderMixin::MGetNumMenuItems(void) { - - MenuHandle menuH = MGetSystemMenuHandle(); - return ::CountMItems(menuH); -} - - -/*====================================================================================== - Get the selected menu item. -======================================================================================*/ - -Int16 CMenuMailFolderMixin::MGetSelectedMenuItem(void) { - - MenuHandle menuH = MGetSystemMenuHandle(); - Int16 numMenuItems = MGetNumMenuItems(); - - for (Int16 i = 1; i <= numMenuItems; ++i) { - short mark; - ::GetItemMark(menuH, i, &mark); - if ( mark ) return i; - } - - return 0; // No item selected -} - - -/*====================================================================================== - Set the selected menu item. Refresh the menu if the selection changes. -======================================================================================*/ - -void CMenuMailFolderMixin::MSetSelectedMenuItem(Int16 inIndex, Boolean) -{ - - Int16 selectedItem = MGetSelectedMenuItem(); - if ( selectedItem != inIndex ) { - MenuHandle menuH = MGetSystemMenuHandle(); - if ( selectedItem > 0 ) ::SetItemMark(menuH, selectedItem, noMark); - if ( inIndex > 0 ) ::SetItemMark(menuH, inIndex, checkMark); - } -} - - -/*====================================================================================== - Update the current menu item. If any of the input parameters are different from - the current menu item parameters, return true and reset the menu item; otherwise, - return false and don't modify the menu. If inIconID is non-zero, set the icon for - the menu item to that resource. Don't refresh the menu display in anyway. -======================================================================================*/ - -Boolean CMenuMailFolderMixin::MUpdateMenuItem(Int16 inMenuItem, ConstStr255Param inName, - ResIDT inIconID) { - - Boolean changed = false; - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Assert_((inIconID > cMenuIconIDDiff) || (inIconID == 0)); - - Assert_(::CountMItems(menuH) == MGetNumMenuItems()); - Assert_((inMenuItem > 0) && (inMenuItem <= MGetNumMenuItems())); - - Str255 currentText; - ::GetMenuItemText(menuH, inMenuItem, currentText); - - changed = !::EqualString(currentText, inName, true, true); - if ( changed ) ::SetMenuItemText(menuH, inMenuItem, inName); - - if ( inIconID ) inIconID -= cMenuIconIDDiff; - Int16 iconID; - ::GetItemIcon(menuH, inMenuItem, &iconID); - if ( iconID != inIconID ) { - changed = true; - ::SetItemIcon(menuH, inMenuItem, inIconID); - } - - return changed; -} - - -/*====================================================================================== - Append the specified menu item to the end of the menu. If inIconID is non-zero, set - the icon for the menu item to that resource. Don't refresh the menu display in - anyway. -======================================================================================*/ - -void CMenuMailFolderMixin::MAppendMenuItem(ConstStr255Param inName, ResIDT inIconID) { - - LMenu *theMenu = MGetMenu(); - - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Assert_((inIconID > cMenuIconIDDiff) || (inIconID == 0)); - Int16 numMenuItems = MGetNumMenuItems(); - - Assert_(::CountMItems(menuH) == MGetNumMenuItems()); - - theMenu->InsertCommand(inName, mMenuCommand, numMenuItems); - - if ( inIconID ) { - ::SetItemIcon(menuH, numMenuItems + 1, inIconID - cMenuIconIDDiff); - } -} - - -/*====================================================================================== - Remove menu items from the end of the current menu, beginning with the item at - inStartClipItem. Don't refresh the menu display in anyway. -======================================================================================*/ - -void CMenuMailFolderMixin::MClipMenuItems(Int16 inStartClipItem) { - - LMenu *theMenu = MGetMenu(); - - Int16 numMenuItems = MGetNumMenuItems(); - - Assert_((inStartClipItem > 0) && (inStartClipItem <= numMenuItems)); - - while ( numMenuItems >= inStartClipItem ) { - theMenu->RemoveItem(numMenuItems--); - } -} - - -/*====================================================================================== - Get the current menu text for the specified item. -======================================================================================*/ - -void CMenuMailFolderMixin::MGetMenuItemName(Int16 inMenuItem, Str255 outItemName) { - - MenuHandle menuH = MGetSystemMenuHandle(); - Assert_(menuH != nil); - Assert_(::CountMItems(menuH) == MGetNumMenuItems()); - Assert_((inMenuItem > 0) && (inMenuItem <= MGetNumMenuItems())); - - ::GetMenuItemText(menuH, inMenuItem, outItemName); -} - - -/*====================================================================================== - Refresh the menu display. -======================================================================================*/ - -void CMenuMailFolderMixin::MRefreshMenu(void) { - - // Don't need to do anything since the menu is not visible unless the user has clicked - // on it. -} - - -/*====================================================================================== - Get a handle to the Mac menu associated with this object. -======================================================================================*/ - -MenuHandle CMenuMailFolderMixin::MGetSystemMenuHandle(void) { - - return MGetMenu()->GetMacMenuH(); -} - - -#pragma mark - - -static const Char16 gsPopup_SmallMark = '¥'; // Mark used for small font popups -static const Int16 gsPopup_ArrowButtonWidth = 22; // Width used in drawing the arrow only - -enum -{ - eSelectAll = 1, - eUnselectAll = 2 -}; - -CSelectFolderMenu::CSelectFolderMenu(LStream *inStream): -LGAPopup(inStream), -mSelectedItemCount(0), -mTotalItemCount(0), -mMenuWidth(0) -{ - mDesiredFolderFlags = (FolderChoices)(eWantIMAP + eWantNews); -} - -CSelectFolderMenu::~CSelectFolderMenu() -{ - -} - -void CSelectFolderMenu::FinishCreateSelf() -{ - LGAPopup::FinishCreateSelf(); - mInitialMenuCount = CountMItems(GetMacMenuH()); - CMailFolderMixin::UpdateMailFolderMixinsNow(this); -// SetArrowOnly(true); - mTotalItemCount = MGetNumMenuItems() - mInitialMenuCount; - for (int i = 1; i <= mTotalItemCount; ++i) - { - UInt32 folderPrefFlag = MGetFolder(i).GetFolderPrefFlags(); - if (folderPrefFlag & MSG_FOLDER_PREF_OFFLINE) - { - mSelectedItemCount++; - Char16 mark = GetMenuFontSize () < 12 ? gsPopup_SmallMark : checkMark; - ::SetItemMark(GetMacMenuH(), i + mInitialMenuCount, mark); - } - } - UpdateCommandMarks(); -} - -void -CSelectFolderMenu::SetupCurrentMenuItem( MenuHandle /*inMenuH*/, - Int16 /*inCurrentItem*/) -{ - // Don't muck around with our marks! -} - -void -CSelectFolderMenu::UpdateCommandMarks() -{ - short mark; - if (mSelectedItemCount == mTotalItemCount && mTotalItemCount) - { - // Mark the SelectAllCommand. - mark = GetMenuFontSize () < 12 ? gsPopup_SmallMark : checkMark; - } - else - { - // Unmark the SelectAllCommand. - mark = 0; - } - ::SetItemMark(GetMacMenuH(), eSelectAll, mark); - if (!mSelectedItemCount && mTotalItemCount) - { - // Mark the UnselectAllCommand. - mark = GetMenuFontSize () < 12 ? gsPopup_SmallMark : checkMark; - } - else - { - // Unmark the UnselectAllCommand. - mark = 0; - } - ::SetItemMark(GetMacMenuH(), eUnselectAll, mark); - if (!mTotalItemCount) - { - ::DisableItem(GetMacMenuH(), eSelectAll); - ::DisableItem(GetMacMenuH(), eUnselectAll); - } - else - { - ::EnableItem(GetMacMenuH(), eSelectAll); - ::EnableItem(GetMacMenuH(), eUnselectAll); - } -} - -void -CSelectFolderMenu::CommitCurrentSelections() -{ - for (int i = 1; i <= mTotalItemCount; ++i) - { - CMessageFolder currentFolder = MGetFolder(i); - UInt32 folderPrefFlag = currentFolder.GetFolderPrefFlags(); - short mark; - ::GetItemMark(GetMacMenuH(), i + mInitialMenuCount, &mark); - folderPrefFlag = mark? folderPrefFlag | MSG_FOLDER_PREF_OFFLINE: - folderPrefFlag & ~MSG_FOLDER_PREF_OFFLINE; - ::MSG_SetFolderPrefFlags(currentFolder.GetFolderInfo(), folderPrefFlag); - } -} - -void -CSelectFolderMenu::SetValue(Int32 inValue) -{ - short mark; - if (inValue > eUnselectAll) - { - ::GetItemMark(GetMacMenuH(), inValue, &mark); - if (mark) - { - mSelectedItemCount--; - mark = 0; - } - else - { - mSelectedItemCount++; - mark = GetMenuFontSize () < 12 ? gsPopup_SmallMark : checkMark; - } - ::SetItemMark(GetMacMenuH(), inValue, mark); - } - else - { - // Optimization if this option is already checked, then don't do anything - if (inValue == eUnselectAll) - { - mark = 0; - mSelectedItemCount = 0; - } - if (inValue == eSelectAll) - { - mark = GetMenuFontSize () < 12 ? gsPopup_SmallMark : checkMark; - mSelectedItemCount = mTotalItemCount; - } - for (int i = 1; i <= mTotalItemCount; ++i) - { - ::SetItemMark(GetMacMenuH(), i + mInitialMenuCount, mark); - } - } - UpdateCommandMarks(); -} diff --git a/mozilla/cmd/macfe/utility/UMailFolderMenus.h b/mozilla/cmd/macfe/utility/UMailFolderMenus.h deleted file mode 100644 index 73126a6b812..00000000000 --- a/mozilla/cmd/macfe/utility/UMailFolderMenus.h +++ /dev/null @@ -1,366 +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 __H_UMailFolderMenus -#define __H_UMailFolderMenus -#pragma once -/*====================================================================================== - AUTHOR: Ted Morris - 12 DEC 96 - - DESCRIPTION: Mixin classes for displaying a UI menu containing a list of current - mail folders. - -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include - -#include "LStdControl.h" -#include "CGAIconPopup.h" -#include "LGAIconButtonPopup.h" - -#include "msgcom.h" - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CONSTANTS -/*====================================================================================*/ - -const Int16 cMaxMailFolderNameLength = 511; - -#pragma mark - -/*====================================================================================*/ - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class CMessageFolder; -class RichItemDataYadaYada; - -//====================================== -class CMailFolderMixin -// Abstract class for use with basic menu population and management -//====================================== -{ - friend pascal void MyMercutioCallback( - Int16 menuID, Int16 previousModifiers, RichItemDataYadaYada& itemData); - -public: - - // Public interface - - // Static public method for updating all CMailFolderMixin objects - static void UpdateMailFolderMixins(); - static void UpdateMailFolderMixinsNow(CMailFolderMixin *inSingleMailFolderMixin = nil); - static void GetFolderNameForDisplay(char * inName, CMessageFolder& folder); - - enum { eUseFolderIcons = true, eNoFolderIcons = false }; - CMailFolderMixin(Boolean inIncludeFolderIcons = eUseFolderIcons); - virtual ~CMailFolderMixin(void); - - // Following two deliberately return by value. CMessageFolder is only 4 bytes, and - // is reference counted. The first indexes only into the folder list. The second - // takes account of any initial non-folder items that might be in the menu. - virtual CMessageFolder MGetFolder(ArrayIndexT inItemNumber); - virtual CMessageFolder MGetFolderFromMenuItem(ArrayIndexT inItemNumber); - - virtual const char* MGetFolderName(ArrayIndexT inItemNumber); - ResIDT GetMailFolderIconID(UInt16 inFlags); - - // Get the currently selected folder name - virtual const char* MGetSelectedFolderName(); - virtual CMessageFolder MGetSelectedFolder(); - - virtual Boolean MSetSelectedFolder(const CMessageFolder&, Boolean inDoBroadcast = true); - virtual Boolean MSetSelectedFolder(const MSG_FolderInfo*, Boolean inDoBroadcast = true); - virtual Boolean MSetSelectedFolderName(const char* inName, Boolean inDoBroadcast = true); - // Needed only by filters. - - enum FolderChoices - { - eWantPOP = 1 << 0, - eWantIMAP = 1 << 1, - eWantNews = 1 << 2, - eWantHosts = 1 << 3, - eWantDividers = 1 << 4, - eWantInbox = 1<<5, - eWantPublicFolder= 1<<6 - }; - void MSetFolderChoices(FolderChoices inChoices) { mDesiredFolderFlags = inChoices; } - -protected: - - // These two methods are called by automatically by CMailFolderMixins - // when they are created and destroyed - static void RegisterMailFolderMixin(CMailFolderMixin *inMailFolderMixin); - static void UnregisterMailFolderMixin(CMailFolderMixin *inMailFolderMixin); - - void MGetCurrentMenuItemName(Str255 outItemName); - virtual Boolean FolderFilter(const CMessageFolder &folder); - - // Populate the menu with current mail folders - virtual Boolean MPopulateWithFolders(const MSG_FolderInfo **inFolderInfoArray, - const Int32 inNumFolders); - -// Pure virtual methods - - virtual Int16 MGetNumMenuItems(void) = 0; - virtual Int16 MGetSelectedMenuItem(void) = 0; - virtual void MSetSelectedMenuItem(Int16 inIndex, Boolean inDoBroadcast = true) = 0; - virtual Boolean MUpdateMenuItem(Int16 inMenuItem, ConstStr255Param inName, - ResIDT inIconID = 0) = 0; - virtual void MAppendMenuItem(ConstStr255Param inName, ResIDT inIconID = 0) = 0; - virtual void MClipMenuItems(Int16 inStartClipItem) = 0; - virtual void MGetMenuItemName(Int16 inIndex, Str255 outItemName) = 0; - virtual MenuHandle MGetSystemMenuHandle(void) = 0; - virtual void MRefreshMenu(void) = 0; - -// Instance variables - - LArray mFolderArray; // ... or must we? jrm 97/03/18 - Boolean mUseFolderIcons; // Use icons in the menu? - - static LArray sMailFolderMixinRegisterList; // List of registered CMailFolderMixins - FolderChoices mDesiredFolderFlags; - static Boolean sMustRebuild; - static void* sMercutioCallback; - Int32 mInitialMenuCount; -}; - - -// Abstract class for use with control popup menus -class CMailFolderPopupMixin : public CMailFolderMixin { - -public: - - CMailFolderPopupMixin(void) { - } - -protected: - - virtual Int16 MGetNumMenuItems(void); - virtual Int16 MGetSelectedMenuItem(void); - virtual void MSetSelectedMenuItem(Int16 inIndex, Boolean inDoBroadcast = true); - virtual Boolean MUpdateMenuItem(Int16 inMenuItem, ConstStr255Param inName, - ResIDT inIconID = 0); - virtual void MAppendMenuItem(ConstStr255Param inName, ResIDT inIconID = 0); - virtual void MClipMenuItems(Int16 inStartClipItem); - virtual void MGetMenuItemName(Int16 inMenuItem, Str255 outItemName); - virtual void MRefreshMenu(void); - - LControl *MGetControl(void) { - LControl *theControl = dynamic_cast(this); - Assert_(theControl != nil); - return theControl; - } -}; - - -/*====================================================================================== - Mixin with a CGAIconPopup class or descendent. - - Use as follows: - - class MyPopup : public CGAIconPopup, - public CGAIconPopupFolderMixin { - - ... Methods - } - - Make sure to call CMailFolderMixin::UpdateMailFolderMixins(this) from - MyPopup::FinishCreateSelf(). -======================================================================================*/ - -class CGAIconPopupFolderMixin : public CMailFolderPopupMixin { - -public: - - CGAIconPopupFolderMixin(void) { - } - -protected: - - virtual MenuHandle MGetSystemMenuHandle(void); - virtual void MRefreshMenu(void); - - CGAIconPopup *MGetControl(void) { - CGAIconPopup *theControl = dynamic_cast(this); - Assert_(theControl != nil); - return theControl; - } -}; - - -/*====================================================================================== - Mixin with a LStdPopupMenu class or descendent. - - Use as follows: - - class MyPopup : public LGAPopup, - public CGAdPopupFolderMixin { - - ... Methods - } - - Make sure to call CMailFolderMixin::UpdateMailFolderMixins(this) from - MyPopup::FinishCreateSelf(). -======================================================================================*/ - -class CGAPopupFolderMixin : public CMailFolderPopupMixin { - -public: - - CGAPopupFolderMixin(void) - { - } - -protected: - - virtual MenuHandle MGetSystemMenuHandle(void); - - LGAPopup *MGetControl(void) { - LGAPopup *theControl = dynamic_cast(this); - Assert_(theControl != nil); - return theControl; - } -}; - - -/*====================================================================================== - Mixin with a LGAIconButtonPopup class or descendent. - - Use as follows: - - class MyPopup : public LGAIconButtonPopup, - public CGAIconButtonPopupFolderMixin { - - ... Methods - } - - Make sure to call CMailFolderMixin::UpdateMailFolderMixins(this) from - MyPopup::FinishCreateSelf(). -======================================================================================*/ - -class CGAIconButtonPopupFolderMixin : public CMailFolderPopupMixin { - -public: - - CGAIconButtonPopupFolderMixin(void) { - } - -protected: - - virtual MenuHandle MGetSystemMenuHandle(void); - virtual void MRefreshMenu(void); - - LGAIconButtonPopup *MGetControl(void) { - LGAIconButtonPopup *theControl = dynamic_cast(this); - Assert_(theControl != nil); - return theControl; - } -}; - - -/*====================================================================================== - Mixin with a LMenu class or descendent. - - Use as follows: - - class MyPopup : public LMenu, - public CMenuMailFolderMixin { - - ... Methods - } - - After creating the menu, it should be added to the menu bar using the - LMenuBar::InstallMenu() method. - - For each menu item (i.e. folder) a synthetic command ID is created. - - Make sure to call CMailFolderMixin::UpdateMailFolderMixins(this) after constructing - the object. -======================================================================================*/ - -class CMenuMailFolderMixin : public CMailFolderMixin { - -public: - - CMenuMailFolderMixin(CommandT inMenuCommand = cmd_UseMenuItem) { - mMenuCommand = inMenuCommand; - } - -protected: - - virtual Int16 MGetNumMenuItems(void); - virtual Int16 MGetSelectedMenuItem(void); - virtual void MSetSelectedMenuItem(Int16 inIndex, Boolean inDoBroadcast = true); - virtual Boolean MUpdateMenuItem(Int16 inMenuItem, ConstStr255Param inName, - ResIDT inIconID = 0); - virtual void MAppendMenuItem(ConstStr255Param inName, ResIDT inIconID = 0); - virtual void MClipMenuItems(Int16 inStartClipItem); - virtual void MGetMenuItemName(Int16 inMenuItem, Str255 outItemName); - virtual void MRefreshMenu(void); - virtual MenuHandle MGetSystemMenuHandle(void); - - LMenu *MGetMenu(void) { - LMenu *theMenu = dynamic_cast(this); - Assert_(theMenu != nil); - return theMenu; - } - - // Instance variables - - CommandT mMenuCommand; -}; - - -#pragma mark -class CSelectFolderMenu : public LGAPopup, public CGAPopupFolderMixin -{ - public: - enum - { - class_ID = 'SelF' - }; - - CSelectFolderMenu(LStream *inStream); - virtual ~CSelectFolderMenu(); - virtual void FinishCreateSelf(); - virtual void SetupCurrentMenuItem(MenuHandle inMenuH, Int16 inCurrentItem); - virtual void SetValue(Int32 inValue); - - void CommitCurrentSelections(); - - private: - void UpdateCommandMarks(); - - Int16 mSelectedItemCount; - Int16 mTotalItemCount; - Int16 mMenuWidth; -}; - -#endif // __H_UMailFolderMenus - diff --git a/mozilla/cmd/macfe/utility/UMultiFontTextHandler.h b/mozilla/cmd/macfe/utility/UMultiFontTextHandler.h deleted file mode 100644 index e7291bce3ba..00000000000 --- a/mozilla/cmd/macfe/utility/UMultiFontTextHandler.h +++ /dev/null @@ -1,40 +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. - */ - -// =========================================================================== -// UMultiFontTextHandler.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -/*----------------------------------------------------------------------------- - UMultiFontTextHandler - Abstract class for the concrete class which draw/measre text base one multile font ------------------------------------------------------------------------------*/ -#pragma once -#include "UFontSwitcher.h" - -class UMultiFontTextHandler { -public: - UMultiFontTextHandler() {}; - virtual void DrawString (UFontSwitcher* fs, Str255 str) = 0; - virtual short StringWidth (UFontSwitcher* fs, Str255 str) = 0; - virtual void DrawText (UFontSwitcher* fs, char* text, int len) = 0; - virtual short TextWidth (UFontSwitcher* fs, char* text, int len) = 0; - virtual void GetFontInfo (UFontSwitcher* fs, FontInfo* fi) = 0; - -}; diff --git a/mozilla/cmd/macfe/utility/UProcessUtils.cp b/mozilla/cmd/macfe/utility/UProcessUtils.cp deleted file mode 100644 index 9867473381e..00000000000 --- a/mozilla/cmd/macfe/utility/UProcessUtils.cp +++ /dev/null @@ -1,172 +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. - */ - -// UProcessUtils.cp - - -#ifdef PowerPlant_PCH -#include PowerPlant_PCH -#endif - -#include -#include "UProcessUtils.h" - -#ifndef _STRING -#include -#endif - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ LocateApplication -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean UProcessUtils::LocateApplication(OSType inSignature, FSSpec &outSpec) -{ - Boolean bAppFound = false; - FSSpec theMostRecentSpec; - Uint32 theMostRecentDate = 0; - TString theAppName; - Int16 theIndex = 0; - - HParamBlockRec hpb; - - do { - DTPBRec dpb; - CInfoPBRec cpb; - - memset(&hpb, 0, sizeof(HParamBlockRec)); - memset(&dpb, 0, sizeof(DTPBRec)); - - hpb.volumeParam.ioVolIndex = ++theIndex; - if (PBHGetVInfoSync(&hpb) != noErr) - break; - - dpb.ioVRefNum = hpb.volumeParam.ioVRefNum; - if (PBDTGetPath(&dpb) == noErr) - { - dpb.ioFileCreator = inSignature; - dpb.ioNamePtr = theAppName; - - if (PBDTGetAPPLSync(&dpb) == noErr) - { - memset(&cpb, 0, sizeof(CInfoPBRec)); - cpb.hFileInfo.ioNamePtr = theAppName; - cpb.hFileInfo.ioVRefNum = dpb.ioVRefNum; - cpb.hFileInfo.ioDirID = dpb.ioAPPLParID; - - if ((PBGetCatInfoSync(&cpb) == noErr) && (cpb.hFileInfo.ioFlMdDat > theMostRecentDate)) - { - theMostRecentSpec.vRefNum = dpb.ioVRefNum; - theMostRecentSpec.parID = dpb.ioAPPLParID; - ::BlockMoveData(&theAppName[0], theMostRecentSpec.name, theAppName.Length() + 1); - theMostRecentDate = cpb.hFileInfo.ioFlMdDat; - } - - bAppFound = true; - } - } - } - while (!hpb.volumeParam.ioResult); - - if (bAppFound) - outSpec = theMostRecentSpec; - - return bAppFound; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ ApplicationRunning -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean UProcessUtils::ApplicationRunning( - OSType inSignature, - ProcessSerialNumber &outPSN) -{ - Boolean bRunning = false; - // spin through the process list to determine whether there's a - // process with our desired signature. - outPSN.highLongOfPSN = 0; - outPSN.lowLongOfPSN = 0; - - ProcessInfoRec info; // information from the process list. - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = nil; - info.processAppSpec = nil; - - while ((GetNextProcess(&outPSN) == noErr) && (GetProcessInformation(&outPSN, &info) == noErr)) - { - if (info.processSignature == inSignature) - { - bRunning = true; - break; - } - } - - return bRunning; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ LaunchApplication -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -OSErr UProcessUtils::LaunchApplication( - FSSpec& inSpec, - Uint16 inLaunchFlags, - ProcessSerialNumber& outPSN) -{ - LaunchParamBlockRec lpb; - - lpb.launchBlockID = extendedBlock; - lpb.launchEPBLength = extendedBlockLen; - lpb.launchFileFlags = 0; - lpb.launchControlFlags = inLaunchFlags; - lpb.launchAppSpec = &inSpec; - lpb.launchAppParameters = 0L; - - OSErr theResult = ::LaunchApplication(&lpb); - outPSN = lpb.launchProcessSN; - return theResult; -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ PullAppToFront -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -void UProcessUtils::PullAppToFront(const ProcessSerialNumber& inWhichProcess) -{ - EventRecord scratch; - - // SetFrontProcess(), then call EventAvail so that it actually happens. - ::SetFrontProcess(&inWhichProcess); - ::EventAvail(nullEvent, &scratch); -} - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ IsFrontProcess -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ - -Boolean UProcessUtils::IsFrontProcess(const ProcessSerialNumber& inWhichProcess) -{ - ProcessSerialNumber theFrontProcess; - ::GetFrontProcess(&theFrontProcess); - - Boolean isInFront; - ::SameProcess(&theFrontProcess, &inWhichProcess, &isInFront); - - return isInFront; -} - diff --git a/mozilla/cmd/macfe/utility/UProcessUtils.h b/mozilla/cmd/macfe/utility/UProcessUtils.h deleted file mode 100644 index da761c4f081..00000000000 --- a/mozilla/cmd/macfe/utility/UProcessUtils.h +++ /dev/null @@ -1,46 +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. - */ - -// UProcessUtils.h - - -#pragma once - -#include - -class UProcessUtils -{ - public: - - static Boolean LocateApplication( - OSType inSignature, - FSSpec& outSpec); - - static Boolean ApplicationRunning( - OSType inSignature, - ProcessSerialNumber& outPSN); - - static OSErr LaunchApplication( - FSSpec& inSpec, - Uint16 inLaunchFlags, - ProcessSerialNumber& outPSN); - - static void PullAppToFront(const ProcessSerialNumber& inWhichProcess); - - static Boolean IsFrontProcess(const ProcessSerialNumber& inWhichProcess); -}; \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/UPropFontSwitcher.cp b/mozilla/cmd/macfe/utility/UPropFontSwitcher.cp deleted file mode 100644 index 0c0dd92f79b..00000000000 --- a/mozilla/cmd/macfe/utility/UPropFontSwitcher.cp +++ /dev/null @@ -1,56 +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. - */ - -// =========================================================================== -// UPropFontSwitcher.cp -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -#include "UPropFontSwitcher.h" -#include "uprefd.h" -/*----------------------------------------------------------------------------- - UPropFontSwitcher ------------------------------------------------------------------------------*/ - -UPropFontSwitcher* UPropFontSwitcher::fTheOnlyInstance = NULL; -UPropFontSwitcher* UPropFontSwitcher::Instance() -{ - if(fTheOnlyInstance == NULL) - fTheOnlyInstance = new UPropFontSwitcher(); - return fTheOnlyInstance; -} -void UPropFontSwitcher::EncodingTextFont(INTL_Encoding_ID encoding) -{ - switch(encoding) - { - case CS_DINGBATS: - TextFontDingbats(); - break; - case CS_SYMBOL: - TextFontSymbol(); - break; - default: - { - CCharSet charset; - Boolean gotFont = CPrefs::GetFont(encoding, &charset); - - Assert_(gotFont); - ::TextFont(charset.fPropFontNum); - } - } -} diff --git a/mozilla/cmd/macfe/utility/UPropFontSwitcher.h b/mozilla/cmd/macfe/utility/UPropFontSwitcher.h deleted file mode 100644 index 45e45b2855e..00000000000 --- a/mozilla/cmd/macfe/utility/UPropFontSwitcher.h +++ /dev/null @@ -1,39 +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. - */ - -// =========================================================================== -// UPropFontSwitcher.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com - -/*----------------------------------------------------------------------------- - UPropFontSwitcher - Class know how to switch font depend on CPrefs:CCharSet - It use Singleton (See Design Patterns by Erich Gamma ) ------------------------------------------------------------------------------*/ -#pragma once -#include "UFontSwitcher.h" -class UPropFontSwitcher : public UFontSwitcher{ -public: - UPropFontSwitcher() {}; - static UPropFontSwitcher* Instance(); - virtual void EncodingTextFont(INTL_Encoding_ID encoding); -private: - static UPropFontSwitcher* fTheOnlyInstance; -}; diff --git a/mozilla/cmd/macfe/utility/URobustCreateWindow.cp b/mozilla/cmd/macfe/utility/URobustCreateWindow.cp deleted file mode 100644 index 95efc5ace33..00000000000 --- a/mozilla/cmd/macfe/utility/URobustCreateWindow.cp +++ /dev/null @@ -1,265 +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. - */ - -/*====================================================================================== - AUTHOR: Ted Morris - 12 DEC 96 - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -#include "URobustCreateWindow.h" - -#include -#include -#include -#include -#include -#include - -#include "fredmem.h" - -// Necessary stuff from - -typedef Int32 TagID; - -enum { - tag_ObjectData = 'objd', - tag_BeginSubs = 'begs', - tag_EndSubs = 'ends', - tag_Include = 'incl', - tag_UserObject = 'user', - tag_ClassAlias = 'dopl', - tag_Comment = 'comm', - tag_End = 'end.', - - object_Null = 'null' -}; - -#pragma options align=mac68k - -typedef struct { - Int16 numberOfItems; - PaneIDT itemID[1]; -} SResList, *SResListP; - -#pragma options align=reset - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS IMPLEMENTATIONS -/*====================================================================================*/ - -#pragma mark - -/*====================================================================================== - Return a newly created Window object initialized from a PPob resource. Raise an - exception if the window cannot be created. If no exception is raised, this method - will ALWAYS return a valid LWindow object. -======================================================================================*/ - -LWindow *URobustCreateWindow::CreateWindow(ResIDT inWindowID, LCommander *inSuperCommander) -{ - ThrowIf_(Memory_MemoryIsLow()); - LCommander::SetDefaultCommander(inSuperCommander); - LAttachable::SetDefaultAttachable(nil); - LWindow *theWindow = nil; - OSErr error = noErr; - - URobustCreateWindow::ReadObjects('PPob', inWindowID, &theWindow, &error); - ThrowIfOSErr_(error); // theWindow not valid yet, don't bother trying to delete it. - - theWindow->FinishCreate(); - if ( theWindow->HasAttribute(windAttr_ShowNew) ) - theWindow->Show(); - - return theWindow; -} - - -/*====================================================================================== - Much more robust object creation. Create new objects from the data resource. - Return a pointer to the first object created, or nil if no objects were created. - If a non-nil value is returned, check the outErr value to see if the object - is valid (i.e. no exceptions were thrown during creation); if outErr returns something - other than noErr, the object is invalid (which means don't try to delete it). -======================================================================================*/ - -void URobustCreateWindow::ReadObjects(OSType inResType, ResIDT inResID, void **outFirstObject, - OSErr *outErr) { - - *outFirstObject = nil; - *outErr = noErr; - - Try_ { - StResource objectRes(inResType, inResID); - ::HLockHi(objectRes.mResourceH); - - LDataStream objectStream(*objectRes.mResourceH, ::GetHandleSize(objectRes.mResourceH)); - - Int16 ppobVersion; - objectStream.ReadData(&ppobVersion, sizeof(Int16)); - - ThrowIf_(ppobVersion != 2); - - URobustCreateWindow::ObjectsFromStream(&objectStream, outFirstObject); - } - Catch_(inErr) { - *outErr = inErr; - // No throw, catch the exception and return error - } - EndCatch_ -} - - -/*====================================================================================== - Same as the UReanimator::ObjectsFromStream(), but returns the first object, if it - is created. -======================================================================================*/ - -void *URobustCreateWindow::ObjectsFromStream(LStream *inStream, void **outFirstObject) { - - void *firstObject = nil; - ClassIDT aliasClassID = 'null'; - - // Save current defaults - LCommander *defaultCommander = LCommander::GetDefaultCommander(); - LView *defaultView = LPane::GetDefaultView(); - - Boolean readingTags = true; - do { - void *currentObject = nil; // Object created by current tag - TagID theTag = tag_End; - inStream->ReadData(&theTag, sizeof(TagID)); - - switch (theTag) { - - case tag_ObjectData: { - // Restore default Commander and View - LCommander::SetDefaultCommander(defaultCommander); - LPane::SetDefaultView(defaultView); - - // Object data consists of a byte length, class ID, - // and then the data for the object. We use the - // byte length to manually set the stream marker - // after creating the object just in case the - // object constructor doesn't read all the data. - - Int32 dataLength; - inStream->ReadData(&dataLength, sizeof(Int32)); - Int32 dataStart = inStream->GetMarker(); - ClassIDT classID; - inStream->ReadData(&classID, sizeof(ClassIDT)); - - if (aliasClassID != 'null') { - // The previous tag specified an Alias for - // the ID of this Class - classID = aliasClassID; - } - - currentObject = URegistrar::CreateObject(classID, inStream); - inStream->SetMarker(dataStart + dataLength, streamFrom_Start); - - aliasClassID = 'null'; // Alias is no longer in effect - - #ifdef Debug_Signal - if (currentObject == nil && classID != 'null') { - LStr255 msg("\pUnregistered ClassID: "); - msg.Append(&classID, sizeof(classID)); - SignalPStr_(msg); - } - #endif - break; - } - - case tag_BeginSubs: - currentObject = URobustCreateWindow::ObjectsFromStream(inStream, outFirstObject); - break; - - case tag_EndSubs: - case tag_End: - readingTags = false; - break; - - case tag_UserObject: { - - // The UserObject tag is only needed for the Constructor - // view editing program. It tells Constructor to treat - // the following object as if it were an object of the - // specified superclass (which must be a PowerPlant - // class that Constructor knows about). We don't need - // this information here, so we just read and ignore - // the superclass ID. - - ClassIDT superClassID; - inStream->ReadData(&superClassID, sizeof(ClassIDT)); - break; - } - - case tag_ClassAlias: - - // The ClassAlias tag defines the ClassID the for - // the next object in the Stream. This allows you - // to define an object which belongs to a subclass - // of another class, but has the same data as that - // other class. - - inStream->ReadData(&aliasClassID, sizeof(ClassIDT)); - break; - - case tag_Comment: { - - // The Comment tag denotes data used by PPob editors - // that PowerPlant ignores. Format is a long word - // byte count followed by arbitrary hex data. - - Int32 commentLength; - inStream->ReadData(&commentLength, sizeof(commentLength)); - inStream->SetMarker(commentLength, streamFrom_Marker); - break; - } - - default: - SignalPStr_("\pUnrecognized Tag"); - readingTags = false; - break; - } - - if (firstObject == nil) { - firstObject = currentObject; - if ( *outFirstObject == nil ) { // This if statement if the only modified code in - // this method from the UReanimator::ObjectsFromStream() - // method. - *outFirstObject = firstObject; // Store the first created object in case an - // exception is thrown - } - } - - } while (readingTags); - - return firstObject; -} - - diff --git a/mozilla/cmd/macfe/utility/URobustCreateWindow.h b/mozilla/cmd/macfe/utility/URobustCreateWindow.h deleted file mode 100644 index f03d62322af..00000000000 --- a/mozilla/cmd/macfe/utility/URobustCreateWindow.h +++ /dev/null @@ -1,66 +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 __H_URobustCreateWindow -#define __H_URobustCreateWindow -#pragma once - -/*====================================================================================== - AUTHOR: Ted Morris - 12 DEC 96 - - DESCRIPTION: Improves upon LWindow::CreateWindow() by making it much more robust - in the face of exceptions thrown when creating a window. - - URobustCreateWindow::CreateWindow() should be used in all places - where you would normally use the LWindow::CreateWindow() method. - - MODIFICATIONS: - - Date Person Description - ---- ------ ----------- -======================================================================================*/ - - -/*====================================================================================*/ - #pragma mark INCLUDE FILES -/*====================================================================================*/ - -class LWindow; -class LCommander; - - -#pragma mark - -/*====================================================================================*/ - #pragma mark CLASS DECLARATIONS -/*====================================================================================*/ - -class URobustCreateWindow { - -public: - - static LWindow *CreateWindow(ResIDT inWindowID, LCommander *inSuperCommander); - static void ReadObjects(OSType inResType, ResIDT inResID, void **outFirstObject, - OSErr *outErr); - -private: - - static void *ObjectsFromStream(LStream *inStream, void **outFirstObject); - -}; -#endif // __H_URobustCreateWindow - diff --git a/mozilla/cmd/macfe/utility/UTextBox.cp b/mozilla/cmd/macfe/utility/UTextBox.cp deleted file mode 100644 index eb0d5002aa6..00000000000 --- a/mozilla/cmd/macfe/utility/UTextBox.cp +++ /dev/null @@ -1,363 +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. - */ - -// UTextBox.cp - -// Based on "The TextBox You've Always Wanted" by Bryan K. Ressler (Beaker) in develop #9 - -#ifdef PowerPlant_PCH - #include PowerPlant_PCH -#endif - -#include "UTextBox.h" - -#include -#include -#include - -// --------------------------------------------------------------------------- -// ¥ UTextBox -// --------------------------------------------------------------------------- -// Constructor - -/* -void -UTextBox::UTextBox( void ) -{ - long gestResult; - - ::Gestalt( gestaltFontMgrAttr, &gestResult ); - hasTrueType = ( gestResult & gestaltOutlineFonts ); -} -*/ - -// --------------------------------------------------------------------------- -// ¥ TBLineHeight -// --------------------------------------------------------------------------- -// Figures line height -// -// Input: theText the entire text that was given to the DrawTextBox call -// textLen the length in bytes of the text -// lhCode the line height code that was passed to DrawTextBox -// startY VAR - we return the starting vertical pen location here -// -// Output: returns the line height to use -// - -unsigned short -UTextBox::TBLineHeight( Ptr theText, unsigned long textLen, - Rect *wrapBox, short lhCode, short *startY ) -{ - short asc,desc; /* Used in the OutlineMetrics calls */ - FontInfo fInfo; /* The old-style font information record */ - Point frac; /* The fraction for the TrueType calls */ - unsigned short lineHeight; /* The return value */ - Boolean hasTrueType; - long gestResult; - - ::Gestalt( gestaltFontMgrAttr, &gestResult ); - hasTrueType = ( gestResult & gestaltOutlineFonts ); - - ::GetFontInfo( &fInfo ); - if (lhCode < 0) { - frac.h = frac.v = 1; - if ( hasTrueType && ::IsOutline(frac, frac) ) { - ::OutlineMetrics( (short)textLen, theText, frac, frac, &asc, &desc, - nil, nil, nil ); - lineHeight = MAXOF(fInfo.ascent, asc) + MAXOF(fInfo. descent,-desc) + - fInfo.leading; - *startY = wrapBox->top + MAXOF(fInfo.ascent, asc); - *startY += fInfo.leading; - } else { - lineHeight = fInfo.ascent + fInfo.descent + fInfo.leading; - *startY = wrapBox->top + fInfo.ascent + fInfo.leading; - } - } else if (lhCode == 0) { - lineHeight = fInfo.ascent + fInfo.descent + fInfo.leading; - *startY = wrapBox->top + fInfo.ascent + fInfo.leading; - } else { - lineHeight = lhCode; - *startY = wrapBox->top + lhCode + fInfo.leading; - } - - return(lineHeight); -} - -// --------------------------------------------------------------------------- -// ¥ TBDraw -// --------------------------------------------------------------------------- -// Draws a line with appropriate justification -// -// Input: breakCode the break code that was returned from StyledLineBreak -// lineStart pointer to the beginning of the text for the current line -// lineBytes the length in bytes of the the text for this line -// wrapBox the box within which we're wrapping -// align the text alignment as specified by the user -// curY our current vertical pen coordinate -// boxWidth the width of wrapBox (since DrawTextBox already calculated it) -// -// Output: none (draws on the screen) -// - -void -UTextBox::TBDraw( StyledLineBreakCode breakCode, Ptr lineStart, - long lineBytes, Rect *wrapBox, short align, short curY, short boxWidth ) -{ - unsigned long blackLen; /* Length of non-white characters */ - short slop; /* Number of pixels of slop for full just */ - - blackLen = ::VisibleLength( (Ptr)lineStart, lineBytes); - - if (align == ntbJustFull) { - slop = boxWidth - ::TextWidth(lineStart, 0, blackLen); - ::MoveTo(wrapBox->left, curY); - if (breakCode == smBreakOverflow || - *(lineStart + (lineBytes - 1)) == kReturnChar) - align = ::GetSysDirection(); - else - ::DrawJust( (Ptr)lineStart, blackLen, slop ); - } - - switch(align) { - case teForceLeft: - case teJustLeft: - ::MoveTo(wrapBox->left, curY); - break; - case teJustRight: - ::MoveTo(wrapBox->right - TextWidth(lineStart, 0, blackLen), curY); - break; - case teJustCenter: - ::MoveTo(wrapBox->left + (boxWidth - ::TextWidth(lineStart, 0, blackLen)) / 2, - curY); - break; - } - if (align != ntbJustFull) - ::DrawText(lineStart, 0, lineBytes); -} - -// --------------------------------------------------------------------------- -// ¥ DrawTextBox -// --------------------------------------------------------------------------- -// Word-wraps text inside a given box -// -// Input: theText the text we need to wrap -// textLen the length in bytes of the text -// wrapBox the box within which we're wrapping -// align the text alignment -// teForceLeft, teFlushLeft left justified -// teJustCenter, teCenter center justified -// teJustRight, teFlushRight right justified -// ntbJustFull full justified -// teJustLeft, teFlushDefault system justified -// lhCode the line height code that was passed to DrawTextBox -// < 0 variable - based on tallest character -// 0 default - based on GetFontInfo -// > 0 fixed - use lhCode as the line height -// endY VAR - if non-nil, the vertical coord of the last line -// lhUsed VAR - if non-nil, the line height used to draw the text -// -// Output: returns the number of line drawn total (even if they drew outside of -// the boundries of wrapBox) -// - -short -UTextBox::DrawTextBox( Ptr theText, unsigned long textLen, Rect *wrapBox, - short align, short lhCode, short *endY, short *lhUsed) -{ - StyledLineBreakCode breakCode; /* Returned code from StyledLineBreak */ - Fixed fixedMax; /* boxWidth converted to fixed point */ - Fixed wrapWid; /* Width to wrap to */ - short boxWidth; /* Width of the wrapBox */ - long lineBytes; /* Number of bytes in one line */ - unsigned short lineHeight; /* Calculated line height */ - short curY; /* Current vertical pen location */ - unsigned short lineCount; /* Number of lines we've drawn */ - long textLeft; /* Pointer to remaining bytes of text */ - Ptr lineStart; /* Pointer to beginning of a line */ - Ptr textEnd; /* Pointer to the end of input text */ - - boxWidth = wrapBox->right - wrapBox->left; - fixedMax = ::Long2Fix((long)boxWidth); - if (align == teFlushDefault) - align = ::GetSysDirection(); - - lineHeight = UTextBox::TBLineHeight(theText, textLen, wrapBox, lhCode, &curY); - lineCount = 0; - lineStart = theText; - textEnd = theText + textLen; - textLeft = textLen; - - do { - lineBytes = 1; - wrapWid = fixedMax; - - breakCode = ::StyledLineBreak( (Ptr)lineStart, textLeft, 0, textLeft, 0, - &wrapWid, &lineBytes ); - - UTextBox::TBDraw(breakCode, lineStart, lineBytes, wrapBox, align, curY, boxWidth); - curY += lineHeight; - lineStart += lineBytes; - textLeft -= lineBytes; - lineCount++; - - } while (lineStart < textEnd); - - if (endY) - *endY = curY - lineHeight; - if (lhUsed) - *lhUsed = lineHeight; - - return(lineCount); -} - -// --------------------------------------------------------------------------- -// ¥ DrawTextBox -// --------------------------------------------------------------------------- -// Word-wraps text inside a given box -// -// Input: theText the text we need to wrap -// textLen the length in bytes of the text -// wrapBox the box within which we're wrapping -// align the text alignment -// teForceLeft, teFlushLeft left justified -// teJustCenter, teCenter center justified -// teJustRight, teFlushRight right justified -// ntbJustFull full justified -// teJustLeft, teFlushDefault system justified -// lhCode the line height code that was passed to DrawTextBox -// < 0 variable - based on tallest character -// 0 default - based on GetFontInfo -// > 0 fixed - use lhCode as the line height -// -// - -void -UTextBox::DrawTextBox( Ptr theText, unsigned long textLen, Rect *wrapBox, - short align, short lhCode ) -{ - RgnHandle oldClip; /* Saved clipping region */ - StyledLineBreakCode breakCode; /* Returned code from StyledLineBreak */ - Fixed fixedMax; /* boxWidth converted to fixed point */ - Fixed wrapWid; /* Width to wrap to */ - short boxWidth; /* Width of the wrapBox */ - long lineBytes; /* Number of bytes in one line */ - unsigned short lineHeight; /* Calculated line height */ - short curY; /* Current vertical pen location */ - unsigned short lineCount; /* Number of lines we've drawn */ - long textLeft; /* Pointer to remaining bytes of text */ - Ptr lineStart; /* Pointer to beginning of a line */ - Ptr textEnd; /* Pointer to the end of input text */ - - ::GetClip((oldClip = ::NewRgn())); - ::ClipRect(wrapBox); - boxWidth = wrapBox->right - wrapBox->left; - fixedMax = ::Long2Fix((long)boxWidth); - if (align == teFlushDefault) - align = ::GetSysDirection(); - - lineHeight = UTextBox::TBLineHeight(theText, textLen, wrapBox, lhCode, &curY); - lineCount = 0; - lineStart = theText; - textEnd = theText + textLen; - textLeft = textLen; - - do { - lineBytes = 1; - wrapWid = fixedMax; - - breakCode = ::StyledLineBreak( (Ptr)lineStart, textLeft, 0, textLeft, 0, - &wrapWid, &lineBytes ); - - UTextBox::TBDraw(breakCode, lineStart, lineBytes, wrapBox, align, curY, boxWidth); - - curY += lineHeight; - lineStart += lineBytes; - textLeft -= lineBytes; - lineCount++; - - } while ((lineStart < textEnd) & ( curY <= (wrapBox->bottom + lineHeight) )); - - ::SetClip(oldClip); - ::DisposeRgn(oldClip); - -} - -// Hacked up, copied version of DrawTextBox. Returns the height needed for the lines -// DESTROYS THE ORIGINAL STRING -// pkc (6/6/96) added scan for '\n' to determine line breaks since StyledLineBreak doesn't -// consider '\n' to be a line break. -short UTextBox::TextBoxDialogHeight( Ptr theText, unsigned long textLen, Rect *wrapBox, - short align, short lhCode) -{ - StyledLineBreakCode breakCode; /* Returned code from StyledLineBreak */ - Fixed fixedMax; /* boxWidth converted to fixed point */ - Fixed wrapWid; /* Width to wrap to */ - short boxWidth; /* Width of the wrapBox */ - long lineBytes; /* Number of bytes in one line */ - unsigned short lineHeight; /* Calculated line height */ - short curY; /* Current vertical pen location */ - unsigned short lineCount; /* Number of lines we've drawn */ - long textLeft; /* Pointer to remaining bytes of text */ - Ptr lineStart; /* Pointer to beginning of a line */ - Ptr textEnd; /* Pointer to the end of input text */ - Ptr scanner; /* Pointer to scan for '\n' */ - - boxWidth = wrapBox->right - wrapBox->left; - fixedMax = ::Long2Fix((long)boxWidth); - if (align == teFlushDefault) - align = ::GetSysDirection(); - - lineHeight = UTextBox::TBLineHeight(theText, textLen, wrapBox, lhCode, &curY); - lineCount = 0; - lineStart = theText; - textEnd = theText + textLen; - textLeft = textLen; - - // ¥¥¥ HACK - - for (int i=0; i< textLen; i++) - { - if (theText[i] == '/') - theText[i] = 'w'; - } - do { - lineBytes = 1; - wrapWid = fixedMax; - - breakCode = ::StyledLineBreak( (Ptr)lineStart, textLeft, 0, textLeft, 0, - &wrapWid, &lineBytes ); - // pkc (6/6/96) now scan for '\n' because StyledLineBreak doesn't take '\n' into account - scanner = lineStart; - while( *scanner != '\n' && scanner < textEnd ) - ++scanner; - // pkc (6/6/96) move past '\n' - ++scanner; - // pkc (6/6/96) if there is a '\n' before where StyledLineBreak says that there should be - // a break, we should break at the '\n' - if( scanner < textEnd && scanner - lineStart < lineBytes ) - lineBytes = scanner - lineStart; - curY += lineHeight; - lineStart += lineBytes; - textLeft -= lineBytes; - lineCount++; - - } while (lineStart < textEnd); - - - return(lineCount * lineHeight); -} diff --git a/mozilla/cmd/macfe/utility/UTextBox.h b/mozilla/cmd/macfe/utility/UTextBox.h deleted file mode 100644 index 53ad43ab494..00000000000 --- a/mozilla/cmd/macfe/utility/UTextBox.h +++ /dev/null @@ -1,60 +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. - */ - -// UTextBox.h - -// Based on "The TextBox You've Always Wanted" by Bryan K. Ressler (Beaker) in develop #9 - -#pragma once - -#ifndef __TEXTEDIT__ -#include -#endif - -// DEFINES -#define ntbJustFull 128 /* Full justification */ -#define kReturnChar 0x0d /* Carriage return character */ - -// MACROS -#define MAXOF(a,b) (((a) > (b)) ? (a) : (b)) - -class UTextBox -{ -public: - - static void DrawTextBox( Ptr theText, unsigned long textLen, - Rect *box, short just, short htCode ); - - static short DrawTextBox( Ptr theText, unsigned long textLen, - Rect *box, short just, short htCode, short *endY, - short *lhUsed ); - - // This added by aleks. Used to resize alert boxes in errmgr - static short TextBoxDialogHeight(Ptr theText, unsigned long textLen, - Rect *box, short just, short htCode); - -private: - static unsigned short TBLineHeight( Ptr theText, unsigned long textLen, - Rect *wrapBox, short lhCode, short *startY ); - - static void TBDraw( StyledLineBreakCode breakCode, Ptr lineStart, - long lineBytes, Rect *wrapBox, short align, - short curY, short boxWidth ); - -}; - \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/UUTF8TextHandler.cp b/mozilla/cmd/macfe/utility/UUTF8TextHandler.cp deleted file mode 100644 index 33a2c69e8dd..00000000000 --- a/mozilla/cmd/macfe/utility/UUTF8TextHandler.cp +++ /dev/null @@ -1,119 +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. - */ - -// =========================================================================== -// UUTF8TextHandler.cp -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -#include "UUTF8TextHandler.h" -#include "UUnicodeTextHandler.h" - -UUTF8TextHandler* UUTF8TextHandler::fTheOnlyInstance = NULL; -UUTF8TextHandler* UUTF8TextHandler::Instance() -{ - if(fTheOnlyInstance == NULL) - fTheOnlyInstance = new UUTF8TextHandler(); - return fTheOnlyInstance; -} - -#define MXS(c,x,s) (((c) - (x)) << (s)) -#define M80S(c,s) MXS(c,0x80,s) -#define UTF8_1_to_UCS2(in) ((uint16) (in)[0]) -#define UTF8_2_to_UCS2(in) ((uint16) (MXS((in)[0],0xC0, 6) | M80S((in)[1], 0))) -#define UTF8_3_to_UCS2(in) ((uint16) (MXS((in)[0],0xE0,12) | M80S((in)[1], 6) | M80S((in)[2], 0) )) -uint32 UUTF8TextHandler::UTF8ToUCS2(unsigned char* text, int length, INTL_Unicode *ucs2, uint32 ubuflen) -{ - unsigned char* p = text; - unsigned char* last = text + length; - uint32 ul; - for(p = text, ul = 0; (p < last) && (ul < ubuflen) ; ) - { - if( (*p) < 0x80) - { - ucs2[ul++] = UTF8_1_to_UCS2(p); - p += 1; - } - else if( (*p) < 0xc0 ) - { - Assert_( (*p) ); // Invalid UTF8 First Byte - ucs2[ul++] = '?'; - p += 1; - } - else if( (*p) < 0xe0) - { - ucs2[ul++] = UTF8_2_to_UCS2(p); - p += 2; - } - else if( (*p) < 0xf0) - { - ucs2[ul++] = UTF8_3_to_UCS2(p); - p += 3; - } - else if( (*p) < 0xf8) - { - ucs2[ul++] = '?'; - p += 4; - } - else if( (*p) < 0xfc) - { - ucs2[ul++] = '?'; - p += 5; - } - else if( (*p) < 0xfe) - { - ucs2[ul++] = '?'; - p += 6; - } - else - { - Assert_( (*p) ); // Invalid UTF8 First Byte - ucs2[ul++] = '?'; - p += 1; - } - } - return ul; -} -void UUTF8TextHandler::DrawText(UFontSwitcher* fs, char* text, int len) -{ - if(text[0] != 0) - { - uint32 ucs2len; - INTL_Unicode ucs2buf[512]; - ucs2len = UTF8ToUCS2((unsigned char*)text, len, ucs2buf, 512); - // redirect to the UUnicodeTextHandler - UUnicodeTextHandler::Instance()->DrawUnicode(fs, ucs2buf, ucs2len); - } -} -short UUTF8TextHandler::TextWidth(UFontSwitcher* fs, char* text, int len) -{ - if(text[0] != 0) - { - uint32 ucs2len; - INTL_Unicode ucs2buf[512]; - // redirect to the UUnicodeTextHandler - ucs2len = UTF8ToUCS2((unsigned char*)text, len, ucs2buf, 512 ); - return UUnicodeTextHandler::Instance()->UnicodeWidth(fs, ucs2buf, ucs2len); - } - return 0; -} -void UUTF8TextHandler::GetFontInfo (UFontSwitcher* fs, FontInfo* fi) -{ - // redirect to the UUnicodeTextHandler - UUnicodeTextHandler::Instance()->GetFontInfo(fs, fi); -} diff --git a/mozilla/cmd/macfe/utility/UUTF8TextHandler.h b/mozilla/cmd/macfe/utility/UUTF8TextHandler.h deleted file mode 100644 index 915273c7efd..00000000000 --- a/mozilla/cmd/macfe/utility/UUTF8TextHandler.h +++ /dev/null @@ -1,48 +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. - */ - -// =========================================================================== -// UUTF8TextHandler.h -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com -#pragma once -#include "UMultiFontTextHandler.h" -/*----------------------------------------------------------------------------- - UUTF8TextHandler - Switch font to draw UTF8 - It use Singleton (See Design Patterns by Erich Gamma ) ------------------------------------------------------------------------------*/ -class UUTF8TextHandler : public UMultiFontTextHandler { -public: - static UUTF8TextHandler* Instance(); - UUTF8TextHandler() {}; - virtual void DrawText (UFontSwitcher* fs, char* text, int len); - virtual short TextWidth (UFontSwitcher* fs, char* text, int len); - - virtual void DrawString (UFontSwitcher* fs, Str255 str) - { DrawText(fs, (char*)(str + 1), str[0]); }; - - virtual short StringWidth(UFontSwitcher* fs, Str255 str) - { return TextWidth(fs, (char*)(str + 1), str[0]); }; - virtual void GetFontInfo (UFontSwitcher* fs, FontInfo* fi); - - uint32 UTF8ToUCS2(unsigned char* text, int length, INTL_Unicode *ucs2, uint32 ubuflen); -private: - static UUTF8TextHandler* fTheOnlyInstance; -}; diff --git a/mozilla/cmd/macfe/utility/UUnicodeTextHandler.cp b/mozilla/cmd/macfe/utility/UUnicodeTextHandler.cp deleted file mode 100644 index 28154fea58e..00000000000 --- a/mozilla/cmd/macfe/utility/UUnicodeTextHandler.cp +++ /dev/null @@ -1,99 +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. - */ - -// =========================================================================== -// UUnicodeTextHandler.cp -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com - -/*----------------------------------------------------------------------------- - UUnicodeTextHandler - Switch font to draw Unicode (UCS2) - It use Singleton (See Design Patterns by Erich Gamma ) ------------------------------------------------------------------------------*/ -#include "UUnicodeTextHandler.h" - -UUnicodeTextHandler* UUnicodeTextHandler::fTheOnlyInstance = NULL; -UUnicodeTextHandler* UUnicodeTextHandler::Instance() -{ - if(fTheOnlyInstance == NULL) - fTheOnlyInstance = new UUnicodeTextHandler(); - return fTheOnlyInstance; -} -void UUnicodeTextHandler::DrawUnicode(UFontSwitcher* fs, INTL_Unicode* unicode, int len) -{ - INTL_CompoundStr* cs = INTL_CompoundStrFromUnicode(unicode, len); - if(cs) - { - INTL_Encoding_ID encoding; - unsigned char* outtext; - INTL_CompoundStrIterator iter; - for(iter = INTL_CompoundStrFirstStr((INTL_CompoundStrIterator)cs, &encoding , &outtext); - iter != NULL; - iter = INTL_CompoundStrNextStr(iter, &encoding, &outtext)) - { - if((outtext) && (*outtext)) - { - fs->EncodingTextFont(encoding); - ::DrawText(outtext, 0, XP_STRLEN((char*)outtext)); - } - } - INTL_CompoundStrDestroy(cs); - } -} -short UUnicodeTextHandler::UnicodeWidth(UFontSwitcher* fs, INTL_Unicode* unicode, int len) -{ - short width = 0; - INTL_CompoundStr* cs = INTL_CompoundStrFromUnicode(unicode, len); - if(cs) - { - INTL_Encoding_ID encoding; - unsigned char* outtext; - INTL_CompoundStrIterator iter; - for(iter = INTL_CompoundStrFirstStr((INTL_CompoundStrIterator)cs, &encoding , &outtext); - iter != NULL; - iter = INTL_CompoundStrNextStr(iter, &encoding, &outtext)) - { - if((outtext) && (*outtext)) - { - fs->EncodingTextFont(encoding); - width += ::TextWidth(outtext, 0, XP_STRLEN((char*)outtext)); - } - } - INTL_CompoundStrDestroy(cs); - } - return width; -} -void UUnicodeTextHandler::GetFontInfo (UFontSwitcher* fs, FontInfo* fi) -{ - FontInfo cur; - int16 *list; - int16 num; - list = INTL_GetUnicodeCSIDList(&num); - fi->ascent = fi->descent = fi->widMax = fi->leading = 0; - for(int i = 0; i < num; i++) - { - fs->EncodingTextFont(list[i]); - ::GetFontInfo(&cur); - if(fi->ascent < cur.ascent) fi->ascent = cur.ascent; - if(fi->descent < cur.descent) fi->descent = cur.descent; - if(fi->widMax < cur.widMax) fi->widMax = cur.widMax; - if(fi->leading < cur.leading) fi->leading = cur.leading; - } -} diff --git a/mozilla/cmd/macfe/utility/UUnicodeTextHandler.h b/mozilla/cmd/macfe/utility/UUnicodeTextHandler.h deleted file mode 100644 index 18df14f6ade..00000000000 --- a/mozilla/cmd/macfe/utility/UUnicodeTextHandler.h +++ /dev/null @@ -1,55 +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. - */ - -// =========================================================================== -// UUnicodeTextHandler.cp -// =========================================================================== -// -// Authror: Frank Tang ftang@netscape.com - -#pragma once -#include "UMultiFontTextHandler.h" -/*----------------------------------------------------------------------------- - UUnicodeTextHandler - Switch font to draw Unicode (UCS2) - It use Singleton (See Design Patterns by Erich Gamma ) ------------------------------------------------------------------------------*/ - -class UUnicodeTextHandler : public UMultiFontTextHandler{ -public: - static UUnicodeTextHandler* Instance(); - UUnicodeTextHandler() {}; - virtual void DrawUnicode(UFontSwitcher* fs, INTL_Unicode* text, int len); - virtual short UnicodeWidth(UFontSwitcher* fs, INTL_Unicode* text, int len); - - virtual void DrawString (UFontSwitcher* fs, Str255 str) - { DrawUnicode(fs, (INTL_Unicode*)str+2, ((str[0] - 1 )/ 2)); }; - - virtual void DrawText (UFontSwitcher* fs, char* text, int len) - { DrawUnicode(fs, (INTL_Unicode*) text, (len / 2)); }; - - virtual short StringWidth(UFontSwitcher* fs, Str255 str) - { return UnicodeWidth(fs, (INTL_Unicode*)str+2, ((str[0] - 1 )/ 2)); }; - - virtual short TextWidth(UFontSwitcher* fs, char* text, int len) - { return UnicodeWidth(fs, (INTL_Unicode*) text, (len / 2)); }; - virtual void GetFontInfo (UFontSwitcher* fs, FontInfo* fi); - -private: - static UUnicodeTextHandler* fTheOnlyInstance; -}; diff --git a/mozilla/cmd/macfe/utility/cstring.cp b/mozilla/cmd/macfe/utility/cstring.cp deleted file mode 100644 index de44d41575a..00000000000 --- a/mozilla/cmd/macfe/utility/cstring.cp +++ /dev/null @@ -1,83 +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. - */ - -#include "cstring.h" - -#include "xpassert.h" - -void -cstring::operator+= (const char *s) -{ - if (s != NULL && s[0] != '\0') - { - int newLength = length() + strlen(s); - reserve (newLength+1, true); - strcat (data(), s); - } -} - -void -cstring::truncAt (char c) -{ - char *cc = strchr (data(), c); - if (cc) { - *cc = 0; - reserve (length()+1, true); - } -} - -char* -cstring::reserve (int len, Boolean preserve) -{ - char *dest = space.internal; - if (haveExternalSpace) - if (len > cstringMaxInternalLen) // can reuse space - dest = space.external = (char*) realloc (space.external, len); - else { // don't need external space - char *oldExternal = space.external; - if (preserve) { // can't guarantee preservation since it's shrinking - memcpy (oldExternal, space.internal, cstringMaxInternalLen); - dest[cstringMaxInternalLen] = 0; - } - free (oldExternal); - haveExternalSpace = false; - } - else - if (len > cstringMaxInternalLen) { // need new space - dest= (char*) malloc (len); - if (preserve) - memcpy (dest, space.internal, cstringMaxInternalLen); - space.external = dest; - haveExternalSpace = true; - } - return dest; -} - -void -cstring::assign (const void *sd, int len) -{ - XP_ASSERT(sd != NULL || len == 0); - char *dest = reserve (len+1, false); - - if (sd != NULL) - memcpy (dest, sd, len); - - dest[len] = 0; -} - - diff --git a/mozilla/cmd/macfe/utility/cstring.h b/mozilla/cmd/macfe/utility/cstring.h deleted file mode 100644 index 102f4ef737a..00000000000 --- a/mozilla/cmd/macfe/utility/cstring.h +++ /dev/null @@ -1,108 +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. - */ - -#pragma once - -#include "fredmem.h" - -#define cstringMaxInternalLen 30 - -class cstring -{ -public: - inline cstring () - { haveExternalSpace = false; space.internal[0] = 0; } - inline cstring (const char *s) - { haveExternalSpace = false; assign (s); } - inline cstring (const unsigned char *ps) - { haveExternalSpace = false; assign (ps+1, ps[0]); } - inline cstring (const cstring& s) - { haveExternalSpace = false; assign (s.data(), s.length() ); } - inline cstring( void* ptr, long len ) - { haveExternalSpace = false; assign( ptr, len ); } - inline ~cstring () { reserve (0, false); } - char& operator[] (int i) { return data()[i]; } - inline void operator= (const char *s); - inline void operator= (const unsigned char *ps); - inline void operator= (const cstring& s); - void operator+= (const char *s); - void truncAt (char c); - // comparison - inline int operator== (const cstring& s); - inline int operator== (const char *s); - inline int operator!= (const cstring& s); - inline int operator!= (const char *s); - // query - inline const char* data() const { return haveExternalSpace? space.external: space.internal; } - inline operator const char* () const { return data(); } -/* This is not a bug because - inline operator char* () { return data(); } -cannot convert a "const cstring" to "char *" -This can be avoided by adding: - inline operator const char* () const { return data(); } -*/ - inline char* data() { return haveExternalSpace? space.external: space.internal; } - inline operator char* () { return data(); } - inline int length() const { return strlen (data()); } - char* reserve (int len, Boolean preserve = false); -private: - void assign (const char *s) { assign (s, s? strlen (s): 0); } - void assign (const void *sd, int len); - union { - char* external; - char internal [cstringMaxInternalLen+1]; - } space; - int haveExternalSpace; -}; - -inline void -cstring::operator= (const char *s) { - assign (s); -} - -inline void -cstring::operator= (const unsigned char *ps) { - assign (ps+1, ps[0]); -} - -inline void -cstring::operator= (const cstring& s) { - assign (s.data(), s.length() ); -} - -inline int -cstring::operator== (const cstring& s) { - return !strcmp (data(), s.data()); -} - -inline int -cstring::operator== (const char *s) { - return !strcmp (data(), s); -} - -inline int -cstring::operator!= (const cstring& s) { - return strcmp (data(), s.data()); -} - -inline int -cstring::operator!= (const char *s) { - return strcmp (data(), s); -} - - diff --git a/mozilla/cmd/macfe/utility/fredmem.cp b/mozilla/cmd/macfe/utility/fredmem.cp deleted file mode 100644 index 77324cae497..00000000000 --- a/mozilla/cmd/macfe/utility/fredmem.cp +++ /dev/null @@ -1,273 +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. - */ - -#include "fredmem.h" - -#include "shist.h" -#include "shistele.h" -#include "lo_ele.h" -#include "proto.h" -#include "net.h" -#include "libimg.h" -#include "fe_proto.h" -#include "uerrmgr.h" -#include "PascalString.h" -#include "resgui.h" -#include "MacMemAllocator.h" - -//#include "MToolkit.h" - -enum { - kEmergencyMemoryFundSize = 64 * 1024 -}; - - -class LMallocFlusherPeriodical : public LPeriodical { - public: - LMallocFlusherPeriodical(); - virtual void SpendTime(const EventRecord &inMacEvent); - void FlushMemory ( void ) { mFlushMemory = true; } - - private: - Boolean mFlushMemory; -}; - - -class LLowMallocWarningPeriodical : public LPeriodical { - public: - LLowMallocWarningPeriodical(); - virtual void SpendTime(const EventRecord &inMacEvent); - void WarnUserMallocLow ( void ) { mWarnUser = true; } - - private: - Boolean mWarnUser; -}; - - -unsigned char MacFEMemoryFlusher ( size_t bytesNeeded ); -void ImageCacheMemoryFlusher(void); -void LayoutCacheMemoryFlusher(void); -void NetlibCacheMemoryFlusher(void); -void LibNeoCacheMemoryFlusher(void); - -void MallocIsLowWarning(void); - -static LMallocFlusherPeriodical gMallocFlusher; -static LLowMallocWarningPeriodical gMallocWarner; - -void Memory_InitializeMemory() -{ - new LGrowZone(kEmergencyMemoryFundSize); - new LMemoryFlusherListener(); - - InstallMemoryCacheFlusher(&MacFEMemoryFlusher); - - // install our low memory (malloc heap) warning proc - InstallMallocHeapLowProc ( &MallocIsLowWarning ); -} - -void Memory_DoneWithMemory() -{ - // No cleanup necessary -} - -size_t Memory_MaxApplMem() -{ - return 0; -} - -Boolean Memory_MemoryIsLow() -{ - return (LGrowZone::GetGrowZone())->MemoryIsLow(); -} - -//############################################################################## -//############################################################################## -#pragma mark MAC FE MEMORY FLUSH PROC -unsigned char MacFEMemoryFlusher ( size_t bytesNeeded ) -{ - /* signal the flusher to do it's thing. I would rather start the idler here */ - /* but that involves allocating memory (and so could be reentrant)... */ - gMallocFlusher.FlushMemory(); - - return 0; -} - -//############################################################################## -//############################################################################## -#pragma mark LAYOUT CACHE FLUSHING - -LArray sFlushableLayoutContextList; - -void FM_SetFlushable(MWContext* context, Boolean canFlush) -{ - if (canFlush) { - if (sFlushableLayoutContextList.FetchIndexOf(&context) == 0) - sFlushableLayoutContextList.InsertItemsAt(1, LArray::index_Last, &context); - } - - else { - sFlushableLayoutContextList.Remove(&context); - } -} - -void LayoutCacheMemoryFlusher(void) -{ - MWContext *currentContext = NULL; - SInt32 bytesFreed = 0; - - LArrayIterator iter(sFlushableLayoutContextList); - - // go ahead and empty all the recycling bins - while ( iter.Previous(¤tContext) ) - { - bytesFreed += LO_EmptyRecyclingBin(currentContext); - sFlushableLayoutContextList.RemoveItemsAt( 1, 1 ); - } -} - -//############################################################################## -//############################################################################## -#pragma mark LIBNEO CACHE FLUSHING - -void LibNeoCacheMemoryFlusher(void) -{ - // don't do this yet until we really understand how safe it is -#if 0 - // we don't really know how much was freed here - NeoOutOfMemHandler(); -#endif -} - -//############################################################################## -//############################################################################## -#pragma mark NETLIB CACHE FLUSHING - -void NetlibCacheMemoryFlusher(void) -{ - size_t newCacheSize; - size_t lastCacheSize; - - newCacheSize = NET_GetMemoryCacheSize(); - - // shrink as much as we can - do { - lastCacheSize = newCacheSize; - newCacheSize = NET_RemoveLastMemoryCacheObject(); - } - while ( newCacheSize != lastCacheSize ); -} - - -//############################################################################## -//############################################################################## -#pragma mark IMAGE CACHE FLUSHING - -void ImageCacheMemoryFlusher(void) -{ - size_t newCacheSize; - size_t lastCacheSize; - - newCacheSize = IL_GetCacheSize(); - - // shrink as much as we can - do { - lastCacheSize = newCacheSize; - newCacheSize = IL_ShrinkCache(); - } - while ( newCacheSize != lastCacheSize ); -} - - -//############################################################################## -//############################################################################## -#pragma mark MALLOC HEAP LOW USER WARNING - -void MallocIsLowWarning(void) -{ - gMallocWarner.WarnUserMallocLow(); -} - -//############################################################################## -//############################################################################## -#pragma mark GROW ZONE LISTENER - -LMemoryFlusherListener:: -LMemoryFlusherListener():LListener() -{ - (LGrowZone::GetGrowZone())->AddListener(this); -} - - -void -LMemoryFlusherListener::ListenToMessage(MessageT inMessage, void *ioParam) -{ - Int32 *bytesToFree = (Int32 *)ioParam; - if (inMessage == msg_GrowZone) { - UInt8 successfulFlush = false; - - /* we don't do anything here yet */ - if (!successfulFlush) - *bytesToFree = 0; - } -} - -//############################################################################## -//############################################################################## -#pragma mark MEMORY PERIODICAL - -LLowMallocWarningPeriodical::LLowMallocWarningPeriodical() : LPeriodical() -{ - mWarnUser = false; - - StartIdling(); -} - - -void -LLowMallocWarningPeriodical::SpendTime(const EventRecord &inMacEvent) -{ - if ( mWarnUser ) - { - StopIdling(); - FE_Alert( NULL, GetPString ( MALLOC_HEAP_LOW_RESID ) ); - } -} - - -LMallocFlusherPeriodical::LMallocFlusherPeriodical() : LPeriodical() -{ - mFlushMemory = false; - - StartIdling(); -} - -void -LMallocFlusherPeriodical::SpendTime(const EventRecord &inMacEvent) -{ - if ( mFlushMemory ) - { - ImageCacheMemoryFlusher(); - LayoutCacheMemoryFlusher(); - NetlibCacheMemoryFlusher(); - LibNeoCacheMemoryFlusher(); - - mFlushMemory = false; - } - -} diff --git a/mozilla/cmd/macfe/utility/fredmem.h b/mozilla/cmd/macfe/utility/fredmem.h deleted file mode 100644 index 422c49bcf35..00000000000 --- a/mozilla/cmd/macfe/utility/fredmem.h +++ /dev/null @@ -1,57 +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. - */ - -#pragma once -#include "FlushAllocator.h" -#include "prtypes.h" -#include -#include -#include - -/*----------------------------------------------------------------------------- - Cache Flushing - Layout - Free the layout element recycle list for no-priority allocations. ------------------------------------------------------------------------------*/ -typedef struct MWContext_ MWContext; - -extern void FM_SetFlushable( MWContext* context, Boolean canFlush ); - -void Memory_InitializeMemory(); -size_t Memory_MaxApplMem(); -void Memory_DoneWithMemory(); -Boolean Memory_MemoryIsLow(); - -inline void* operator new( size_t size, char* /*file*/, int /*line*/, char* /*kind*/ ) -{ - void* mem = Flush_Allocate( size, FALSE ); - ThrowIfNil_( mem ); - return mem; -} - -inline void operator delete( void* block, char* /* file */, int /* line */ ) -{ - Flush_Free( block ); -} - -class LMemoryFlusherListener : public LListener { - - public: - LMemoryFlusherListener(); - virtual void ListenToMessage(MessageT inMessage, void *ioParam); - -}; diff --git a/mozilla/cmd/macfe/utility/locale.cp b/mozilla/cmd/macfe/utility/locale.cp deleted file mode 100644 index cbb5313a9db..00000000000 --- a/mozilla/cmd/macfe/utility/locale.cp +++ /dev/null @@ -1,368 +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. - */ - -/* locale.h - * FE support for xp_locale stuff - */ - - -#include "xplocale.h" -#include "macutil.h" -#include -#include "uprefd.h" -#include "xpassert.h" -#include "csid.h" -#include "structs.h" -#include "intl_csi.h" - -long WinCharsetIDToScript(UInt16 wincsid); -Intl1Hndl GetItl1Resource(long scriptcode); -Intl0Hndl GetItl0Resource(long scriptcode); -void AbbrevWeekdayString(DateTimeRec &dateTime, Str255 weekdayString, Intl1Hndl Itl1RecordHandle ); - -/* FE_StrColl - * -1, 0, 1 return guaranteed - */ - -int FE_StrColl(const char* s1, const char* s2) - - - { - long scriptcode; - // get system script code - scriptcode = ::GetScriptManagerVariable(smSysScript); - - // get itlb of the system script - ItlbRecord **ItlbRecordHandle; - ItlbRecordHandle = (ItlbRecord **)::GetResource('itlb', scriptcode); - - // get itl2 number of current system script from itlb if possible - // otherwise, try script manager (Script manager won't update - // itl2 number when the change on the fly ) - long itl2num; - if(ItlbRecordHandle != NULL) - { - if(*ItlbRecordHandle == NULL) - ::LoadResource((Handle)ItlbRecordHandle); - - if(*ItlbRecordHandle != NULL) - itl2num = (*ItlbRecordHandle)->itlbSort; - else - itl2num = ::GetScriptVariable(scriptcode, smScriptSort); - } else { /* Use this as fallback */ - itl2num = ::GetScriptVariable(scriptcode, smScriptSort); - } - // get itl2 resource - Handle itl2Handle; - itl2Handle = ::GetResource('itl2', itl2num); - - // call CompareText with itl2Handle - // We don't need to check itl2Handle here. CompareText will use - // default system sorting if itl2Handle is null - return( (int) CompareText(s1, s2, - strlen(s1), strlen(s2), itl2Handle)); -} - -long WinCharsetIDToScript(UInt16 wincsid) -{ - CCharSet font; - if(CPrefs::GetFont((wincsid & ~ CS_AUTO), &font )) - return font.fFallbackFontScriptID; - else - return smRoman; -} - -Intl1Hndl GetItl1Resource(long scriptcode) -{ - // get itlb from currenty system script - ItlbRecord **ItlbRecordHandle; - ItlbRecordHandle = (ItlbRecord **)::GetResource('itlb', scriptcode); - - // get itl1 number from itlb resource, if possible - // otherwise, use the one return from script manager, - // (Script manager won't update itl1 number when the change on the fly ) - long itl1num; - if(ItlbRecordHandle != NULL) - { - if(*ItlbRecordHandle == NULL) - ::LoadResource((Handle)ItlbRecordHandle); - - if(*ItlbRecordHandle != NULL) - itl1num = (*ItlbRecordHandle)->itlbDate; - else - itl1num = ::GetScriptVariable(scriptcode, smScriptDate); - } else { // Use this as fallback - itl1num = ::GetScriptVariable(scriptcode, smScriptDate); - } - - // get itl1 resource - Intl1Hndl Itl1RecordHandle; - Itl1RecordHandle = (Intl1Hndl)::GetResource('itl1', itl1num); - return Itl1RecordHandle; -} - -Intl0Hndl GetItl0Resource(long scriptcode) -{ - // get itlb from currenty system script - ItlbRecord **ItlbRecordHandle; - ItlbRecordHandle = (ItlbRecord **)::GetResource('itlb', scriptcode); - - // get itl0 number from itlb resource, if possible - // otherwise, use the one return from script manager, - // (Script manager won't update itl1 number when the change on the fly ) - long itl0num; - if(ItlbRecordHandle != NULL) - { - if(*ItlbRecordHandle == NULL) - ::LoadResource((Handle)ItlbRecordHandle); - - if(*ItlbRecordHandle != NULL) - itl0num = (*ItlbRecordHandle)->itlbNumber; - else - itl0num = ::GetScriptVariable(scriptcode, smScriptNumber); - } else { // Use this as fallback - itl0num = ::GetScriptVariable(scriptcode, smScriptNumber); - } - - // get itl1 resource - Intl0Hndl Itl0RecordHandle; - Itl0RecordHandle = (Intl0Hndl)::GetResource('itl0', itl0num); - return Itl0RecordHandle; -} - - -void AbbrevWeekdayString(DateTimeRec &dateTime, Str255 weekdayString, Intl1Hndl Itl1RecordHandle ) -{ - Boolean gotit = false; - - // If we can get itl1Resource, exam it. - if(Itl1RecordHandle != NULL ) - { - if(*Itl1RecordHandle == NULL) - ::LoadResource((Handle)Itl1RecordHandle); - - if(*Itl1RecordHandle == NULL) - { - weekdayString[0] = 0; - return; - } - // if itl1 resource is in the itl1ExtRec format - // look at the additional table - // See IM-Text Appendix B for details - if((unsigned short)((*Itl1RecordHandle)->localRtn[0]) == 0xA89F) - { // use itl1ExtRect - Itl1ExtRec **Itl1ExtRecHandle; - Itl1ExtRecHandle = (Itl1ExtRec **) Itl1RecordHandle; - - // check abbrevDaysTableLength and abbrevDaysTableOffset - if(((*Itl1ExtRecHandle)->abbrevDaysTableLength != 0) && - ((*Itl1ExtRecHandle)->abbrevDaysTableOffset != 0)) - { - // use the additional table for abbreviation weekday name - // Japanese use it. - // Start Pointer access to Handle, no HLock since we don't - // call any API here. - // Be careful when you debug- don't move memory :) - Ptr abTablePt; - short itemlen; - - // Ok, change it back to range [0-6] - short weekday = dateTime.dayOfWeek - 1; - - abTablePt = (Ptr)(*Itl1ExtRecHandle); - abTablePt += (*Itl1ExtRecHandle)->abbrevDaysTableOffset; - - // first 2 byte in the table should be the count. - itemlen = (short) *((short*)abTablePt); - abTablePt += 2; - - if(weekday < itemlen) - { - unsigned char len; - short i; - // iterate till we hit the weekday name we want - for(i = 0 ; i < weekday ; i++) - { - len = *abTablePt; - // shift to the next one. don't forget the len byte itself. - abTablePt += len + 1; - } - // Ok, we got it, let's copy it. - len = *abTablePt; - ::BlockMoveData(abTablePt,&weekdayString[0] ,len+1); - gotit = true; - } - } - } - - // didn't get it. Either it is not in itl1ExtRect format or it don't have - // additional abbreviation table. - // use itl1Rect instead. - if(! gotit) - { - // get abbreviation length - // not the length is not always 3. Some country use longer (say 4) - // abbreviation. - short abbrLen = (*Itl1RecordHandle)->abbrLen; - // Fix Traditional Chinese problem - if(((((*Itl1RecordHandle)->intl1Vers) >> 8) == verTaiwan ) && - (abbrLen == 4) && - ((*Itl1RecordHandle)->days[0][0] == 6) && - ((*Itl1RecordHandle)->days[1][0] == 6) && - ((*Itl1RecordHandle)->days[2][0] == 6) && - ((*Itl1RecordHandle)->days[3][0] == 6) && - ((*Itl1RecordHandle)->days[4][0] == 6) && - ((*Itl1RecordHandle)->days[5][0] == 6) && - ((*Itl1RecordHandle)->days[6][0] == 6)) - { - abbrLen = 6; - } - weekdayString[0] = abbrLen; - // copy the weekday name with that abbreviation length - ::BlockMoveData(&((*Itl1RecordHandle)->days[dateTime.dayOfWeek-1][1]), - &weekdayString[1] , abbrLen); - gotit = true; - } - } - else - { // cannot get itl1 resource, return with null string. - weekdayString[0] = 0; - } -} - - -size_t FE_StrfTime(MWContext* context, char *result, size_t maxsize, int format, - const struct tm *timeptr) - -{ - - Str255 timeString; - int32 dateTime; - DateTimeRec macDateTime; - - // convert struct tm to input format of mac toolbox call - - XP_ASSERT(timeptr->tm_year >= 0); - XP_ASSERT(timeptr->tm_mon >= 0); - XP_ASSERT(timeptr->tm_mday >= 0); - XP_ASSERT(timeptr->tm_hour >= 0); - XP_ASSERT(timeptr->tm_min >= 0); - XP_ASSERT(timeptr->tm_sec >= 0); - XP_ASSERT(timeptr->tm_wday >= 0); - - // Mac need a number from 1904 to 2040 - // tm only provide the last two digit of the year */ - macDateTime.year = timeptr->tm_year + 1900; - - // Mac use 1 for Jan and 12 for Dec - // tm use 0 for Jan and 11 for Dec - macDateTime.month = timeptr->tm_mon + 1; - macDateTime.day = timeptr->tm_mday; - macDateTime.hour = timeptr->tm_hour; - macDateTime.minute = timeptr->tm_min; - macDateTime.second = timeptr->tm_sec; - - // Mac use 1 for sunday 7 for saturday - // tm use 0 for sunday 6 for saturday - macDateTime.dayOfWeek = timeptr->tm_wday +1 ; - - ::DateToSeconds( &macDateTime, (unsigned long *) &dateTime); - INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(context); - long scriptcode = WinCharsetIDToScript(INTL_GetCSIWinCSID(c)); - Handle itl1Handle = (Handle) GetItl1Resource(scriptcode); - Handle itl0Handle = (Handle) GetItl0Resource(scriptcode); - - // get time string - if(format == XP_LONG_DATE_TIME_FORMAT) - ::TimeString(dateTime, TRUE, timeString, itl0Handle); - else - ::TimeString(dateTime, FALSE, timeString, itl0Handle); - switch(format) - { - case XP_TIME_FORMAT: - { - if (timeString[0] >= maxsize) { - result[0] = '\0'; - return(0); - } - // just copy the time string - if(timeString[0] > 0) - ::BlockMoveData(&timeString[1], result , timeString[0]); - result[ timeString[0]] = '\0'; - return ( timeString[0] ); - } - case XP_LONG_DATE_TIME_FORMAT: - case XP_WEEKDAY_TIME_FORMAT: - case XP_DATE_TIME_FORMAT: - { - Str255 dateString; - switch(format) - { - case XP_LONG_DATE_TIME_FORMAT: - ::DateString(dateTime, abbrevDate, dateString, itl1Handle); - break; - case XP_DATE_TIME_FORMAT: - ::DateString(dateTime, shortDate, dateString, itl0Handle); - break; - case XP_WEEKDAY_TIME_FORMAT: - AbbrevWeekdayString(macDateTime, dateString, (Intl1Hndl)itl1Handle); - // try fallback if it return with null string. - if(dateString[0] == 0) - { // cannot get weekdayString from itl1 , try fallback - dateString[0] = strftime((char*)&dateString[1],254,"%a",timeptr); - } - break; - } - // Append the date string and time string tother. seperate with " " - if((dateString[0]+timeString[0] + 1) >= maxsize) { - // try put dateString only - if(dateString[0] >= maxsize) - { - result[0] = '\0'; - return(0); - } - else - { // we don't have space for Date and Time . So , just put date there - if(dateString[0] > 0) - ::BlockMoveData(&dateString[1], result , dateString[0]); - result[ dateString[0]] = '\0'; - return ( dateString[0] ); - } - } else { - int dlen; // we need to rescan the datestring because a bug in Cyrillic itl1 - for(dlen=0;(dlen < dateString[0]) && (dateString[dlen+1] != '\0'); dlen++) - ; - // just incase dateString got a null string - if(dlen > 0) - ::BlockMoveData(&dateString[1], result , dlen); - result[ dlen] = ' '; - // just incase timeString got a null string - if(timeString[0] > 0) - ::BlockMoveData(&timeString[1], &result[dlen+1] , timeString[0]); - result[ dlen+timeString[0] + 1] = '\0'; - return ( dlen+timeString[0] + 1); - } - } - break; - default: - result[0] = '\0'; - return(0); - break; - } -} - diff --git a/mozilla/cmd/macfe/utility/macregion.c b/mozilla/cmd/macfe/utility/macregion.c deleted file mode 100644 index 2fbe5ff7757..00000000000 --- a/mozilla/cmd/macfe/utility/macregion.c +++ /dev/null @@ -1,286 +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. - */ - -// macregion.c - -// FE specific region operations - - // Netscape -#include "client.h" -#include "fe_rgn.h" - // system -#include - -#ifdef LAYERS - -FE_Region FE_CreateRegion() -{ - RgnHandle rgnH = NewRgn(); - - // BUGBUG What's the right thing to do for memory/allocation errors. - // Assertions are not the right way to go. - XP_ASSERT(rgnH != nil); - - return (FE_Region)rgnH; -} - -/* Creates a region from a rectangle. Returns */ -/* NULL if region can't be created. */ -FE_Region -FE_CreateRectRegion(XP_Rect *rect) -{ - RgnHandle rgnH; - - XP_ASSERT(rect != nil); - - rgnH = NewRgn(); - - XP_ASSERT(rgnH != nil); - - SetRectRgn(rgnH, rect->left, rect->top, rect->right, rect->bottom); - - return (FE_Region)rgnH; -} - -/* Destroys region. */ -void -FE_DestroyRegion(FE_Region region) -{ - DisposeRgn((RgnHandle)region); -} - -/* Makes a copy of a region. If dst is NULL, creates a new region */ -FE_Region -FE_CopyRegion(FE_Region src, FE_Region dst) -{ - RgnHandle copyRgnH; - - XP_ASSERT(src); - - if (dst != nil) - copyRgnH = (RgnHandle)dst; - else { - copyRgnH = NewRgn(); - XP_ASSERT(copyRgnH != nil); - } - - CopyRgn((RgnHandle)src, copyRgnH); - - return (FE_Region)copyRgnH; -} - -/* Set an existing region to a rectangle */ -FE_Region -FE_SetRectRegion(FE_Region region, XP_Rect *rect) -{ - XP_ASSERT(region); - XP_ASSERT(rect); - - SetRectRgn((RgnHandle)region, rect->left, rect->top, rect->right, rect->bottom); - - return region; -} - -/* dst = src1 intersect sr2 */ -/* dst can be one of src1 or src2 */ -void -FE_IntersectRegion(FE_Region src1, FE_Region src2, FE_Region dst) -{ - XP_ASSERT(src1); - XP_ASSERT(src2); - XP_ASSERT(dst); - - SectRgn((RgnHandle)src1, (RgnHandle)src2, (RgnHandle)dst); -} - -/* dst = src1 union src2 */ -/* dst can be one of src1 or src2 */ -void FE_UnionRegion(FE_Region src1, FE_Region src2, FE_Region dst) -{ - XP_ASSERT(src1); - XP_ASSERT(src2); - XP_ASSERT(dst); - - UnionRgn((RgnHandle)src1, (RgnHandle)src2, (RgnHandle)dst); -} - -/* dst = src1 - src2 */ -/* dst can be one of src1 or src2 */ -void FE_SubtractRegion(FE_Region src1, FE_Region src2, FE_Region dst) -{ - XP_ASSERT(src1); - XP_ASSERT(src2); - XP_ASSERT(dst); - - DiffRgn((RgnHandle)src1, (RgnHandle)src2, (RgnHandle)dst); -} - -/* Returns TRUE if the region contains no pixels */ -XP_Bool -FE_IsEmptyRegion(FE_Region region) -{ - XP_ASSERT(region); - - return (XP_Bool)EmptyRgn((RgnHandle)region); -} - -/* Returns the bounding rectangle of the region */ -void -FE_GetRegionBoundingBox(FE_Region region, XP_Rect *bbox) -{ - RgnHandle rgnH = (RgnHandle)region; - - XP_ASSERT(region); - XP_ASSERT(bbox); - - bbox->left = (**rgnH).rgnBBox.left; - bbox->top = (**rgnH).rgnBBox.top; - bbox->right = (**rgnH).rgnBBox.right; - bbox->bottom = (**rgnH).rgnBBox.bottom; -} - -/* TRUE if rgn1 == rgn2 */ -XP_Bool -FE_IsEqualRegion(FE_Region rgn1, FE_Region rgn2) -{ - XP_ASSERT(rgn1); - XP_ASSERT(rgn2); - - return (XP_Bool)EqualRgn((RgnHandle)rgn1, (RgnHandle)rgn2); -} - -/* Moves a region by the specified offsets */ -void -FE_OffsetRegion(FE_Region region, int32 xOffset, int32 yOffset) -{ - XP_ASSERT(region); - - OffsetRgn((RgnHandle)region, xOffset, yOffset); -} - -/* Is any part of the rectangle in the specified region */ -XP_Bool -FE_RectInRegion(FE_Region region, XP_Rect *rect) -{ - Rect macRect; - - XP_ASSERT(region); - XP_ASSERT(rect); - - macRect.left = rect->left; - macRect.top = rect->top; - macRect.right = rect->right; - macRect.bottom = rect->bottom; - - return (XP_Bool)RectInRgn(&macRect, (RgnHandle)region); -} - -/* For each rectangle that makes up this region, call the func */ -/* This is a minor adaptation of code written by Hugh Fisher - and published in the RegionToRectangles example in the InfoMac archives. -*/ -void -FE_ForEachRectInRegion(FE_Region rgn, FE_RectInRegionFunc func, void *closure) -{ -#define EndMark 32767 -#define MaxY 32767 -#define StackMax 1024 - - typedef struct { - short size; - Rect bbox; - short data[]; - } ** Internal; - - Internal region; - short width, xAdjust, y, index, x1, x2, x; - XP_Rect box; - short stackStorage[1024]; - short * buffer; - RgnHandle r = (RgnHandle)rgn; - - region = (Internal)r; - - /* Check for plain rectangle */ - if ((**region).size == 10) { - box.left = (**region).bbox.left; - box.top = (**region).bbox.top; - box.right = (**region).bbox.right; - box.bottom = (**region).bbox.bottom; - func(closure, &box); - return; - } - /* Got to scale x coordinates into range 0..something */ - xAdjust = (**region).bbox.left; - width = (**region).bbox.right - xAdjust; - /* Most regions will be less than 1024 pixels wide */ - if (width < StackMax) - buffer = stackStorage; - else { - buffer = (short *)NewPtr(width * 2); - if (buffer == NULL) - /* Truly humungous region or very low on memory. - Quietly doing nothing seems to be the - traditional Quickdraw response. */ - return; - } - /* Initialise scan line list to bottom edges */ - for (x = (**region).bbox.left; x < (**region).bbox.right; x++) - buffer[x - xAdjust] = MaxY; - index = 0; - /* Loop until we hit an empty scan line */ - while ((**region).data[index] != EndMark) { - y = (**region).data[index]; - index ++; - /* Loop through horizontal runs on this line */ - while ((**region).data[index] != EndMark) { - x1 = (**region).data[index]; - index ++; - x2 = (**region).data[index]; - index ++; - x = x1; - while (x < x2) { - if (buffer[x - xAdjust] < y) { - /* We have a bottom edge - how long for? */ - box.left = x; - box.top = buffer[x - xAdjust]; - while (x < x2 && buffer[x - xAdjust] == box.top) { - buffer[x - xAdjust] = MaxY; - x ++; - } - /* Pass to client proc */ - box.right = x; - box.bottom = y; - func(closure, &box); - } else { - /* This becomes a top edge */ - buffer[x - xAdjust] = y; - x ++; - } - } - } - index ++; - } - /* Clean up after ourselves */ - if (width >= StackMax) - DisposePtr((Ptr)buffer); -#undef EndMark -#undef MaxY -#undef StackMax -} -#endif diff --git a/mozilla/cmd/macfe/utility/miconutils.cp b/mozilla/cmd/macfe/utility/miconutils.cp deleted file mode 100644 index d5515c1706c..00000000000 --- a/mozilla/cmd/macfe/utility/miconutils.cp +++ /dev/null @@ -1,424 +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. - */ - -// miconutlis.cp - -// icon utilities - -#include "miconutils.h" -#include "prtypes.h" -#include "xp_mcom.h" -#include "net.h" -#include "umimemap.h" -#include "uprefd.h" - -#include "MoreDesktopMgr.h" - -struct IconRecord { - Int16 fId; - Handle fIcon; // CIconHandle for IconSuites - Int16 fRefCount; -}; - -CIconList CIconList::sIconList; -CIconList CIconList::sIconSuiteList; - -CIconList::CIconList() : LArray(sizeof(IconRecord)) {} - -CIconList::~CIconList() {} - -CIconHandle CIconList::GetIcon(Int16 iconID) -{ - IconRecord theIcon; - LArrayIterator iter(sIconList); - while (iter.Next(&theIcon)) - if (theIcon.fId == iconID) - { - Int32 where = sIconList.FetchIndexOf(&theIcon); // Increase the refcount by - // doing a replace - sIconList.RemoveItemsAt(1, where); - theIcon.fRefCount += 1; - sIconList.InsertItemsAt(1, 1, &theIcon); - return (CIconHandle)theIcon.fIcon; - } - // Did not find the icon. Create new one - theIcon.fId = iconID; - theIcon.fIcon = (Handle)::GetCIcon (iconID); - if (theIcon.fIcon == nil) - return nil; - theIcon.fRefCount = 1; - sIconList.InsertItemsAt(1, 1, &theIcon); - return (CIconHandle)theIcon.fIcon; -} - -void CIconList::ReturnIcon(CIconHandle iconH) -{ - IconRecord theIcon; - LArrayIterator iter(sIconList); - while (iter.Next(&theIcon)) - if (theIcon.fIcon == (Handle)iconH) - { - Int32 where = sIconList.FetchIndexOf(&theIcon); // Increase the refcount by - // doing a replace - theIcon.fRefCount -= 1; - sIconList.RemoveItemsAt(1, where); - if (theIcon.fRefCount == 0) - DisposeCIcon(iconH); - else - sIconList.InsertItemsAt(1, 1, &theIcon); - } -} - -Handle CIconList::GetIconSuite(Int16 iconID) -{ - IconRecord theIcon; - LArrayIterator iter(sIconSuiteList); - while (iter.Next(&theIcon)) - if (theIcon.fId == iconID) - { - Int32 where = sIconSuiteList.FetchIndexOf(&theIcon); // Increase the refcount by - // doing a replace - sIconSuiteList.RemoveItemsAt(1, where); - theIcon.fRefCount += 1; - sIconSuiteList.InsertItemsAt(1, 1, &theIcon); - return theIcon.fIcon; - } - // Did not find the icon. Create new one - theIcon.fId = iconID; - OSErr err = ::GetIconSuite(&theIcon.fIcon, iconID, svAllAvailableData); - if (err != noErr) - return nil; - theIcon.fRefCount = 1; - sIconSuiteList.InsertItemsAt(1, 1, &theIcon); - return theIcon.fIcon; -} - -void CIconList::ReturnIconSuite(Handle iconH) -{ - IconRecord theIcon; - LArrayIterator iter(sIconSuiteList); - while (iter.Next(&theIcon)) - if (theIcon.fIcon == iconH) - { - Int32 where = sIconSuiteList.FetchIndexOf(&theIcon); // Increase the refcount by - // doing a replace - theIcon.fRefCount -= 1; - sIconSuiteList.RemoveItemsAt(1, where); - if (theIcon.fRefCount == 0) - DisposeIconSuite(iconH, TRUE); - else - sIconSuiteList.InsertItemsAt(1, 1, &theIcon); - } -} - - -#pragma mark - - - -/* ------------------------------------------------------------------ - Find_desktop_database Find the reference number of a - desktop database containing icons - for a specified creator code. - The search begins on a specified volume, but covers all volumes. - - returns true if found - - ------------------------------------------------------------------ */ -Boolean CIconUtils::FindDesktopDatabase(short *ioVolumeRefNum, const OSType inFileCreator) -{ - VolumeParam vpb = {0}; - short dtRefNum = 0; - - if ( InOneDesktop( ioVolumeRefNum, inFileCreator, &dtRefNum ) ) - return true; - - for (vpb.ioVolIndex = 1; PBGetVInfoSync((ParmBlkPtr )&vpb) == noErr; ++vpb.ioVolIndex) - { - if (vpb.ioVRefNum == *ioVolumeRefNum) - continue; - - short foundVolRefNum = vpb.ioVRefNum; - - if ( InOneDesktop( &foundVolRefNum, inFileCreator, &dtRefNum) ) - { - *ioVolumeRefNum = foundVolRefNum; - return true; - } - } - - return false; -} - - -/* ------------------------------------------------------------------ - InOneDesktop Determine whether the desktop database for - one particular volume contains icons for - a given creator code, and if so, return its - reference number. - ------------------------------------------------------------------ -*/ -Boolean CIconUtils::InOneDesktop(short *ioVolumeRefNum, const OSType inFileCreator, short *outDtRefNum) -{ - OSErr err; - DTPBRec deskRec = {0}; - HParamBlockRec hParams = {0}; - GetVolParmsInfoBuffer volInfoBuffer = {0}; - - // check to make sure we've got a database first: - hParams.ioParam.ioNamePtr = (StringPtr)nil; - hParams.ioParam.ioVRefNum = *ioVolumeRefNum; - hParams.ioParam.ioBuffer = (Ptr)&volInfoBuffer; - hParams.ioParam.ioReqCount = sizeof(volInfoBuffer); - - if ( ((err = PBHGetVolParmsSync(&hParams))!=noErr) || ((volInfoBuffer.vMAttrib&(1L << bHasDesktopMgr))==0) ) - return false; - - deskRec.ioVRefNum = hParams.ioParam.ioVRefNum; - err = PBDTGetPath( &deskRec ); - if (err != noErr) - return false; - - /* We want to ignore any non-icon data, such as the 'paul' - item that is used for drag-and-drop. */ - deskRec.ioFileCreator = inFileCreator; - deskRec.ioIndex = 1; - do - { - deskRec.ioTagInfo = 0; - err = PBDTGetIconInfoSync( &deskRec ); - deskRec.ioIndex += 1; - } while( (err == noErr) && (deskRec.ioIconType <= 0) ); - - if (err == noErr) - { - *ioVolumeRefNum = deskRec.ioVRefNum; - *outDtRefNum = deskRec.ioDTRefNum; - return true; - } - - return false; -} - - - -void CIconUtils::GetDesktopIconSuite( const OSType inFileCreator, const OSType inFileType, const short inSize, Handle* outHandle ) -{ - Assert_( inSize == kLargeIcon || inSize == kSmallIcon ); - Assert_( *outHandle == nil); // check for possible memory leak - - *outHandle = nil; - - Handle suiteHand = nil; - OSErr err = noErr; - - if (inFileCreator && inFileType ) - { - Handle thisIconHandle = nil; - short theVolRefNum = 0; - Boolean gotOne = false; - - // first, find a desktop database containing the creator's data - if ( FindDesktopDatabase( &theVolRefNum, inFileCreator) ) - { - err = ::NewIconSuite(&suiteHand); - if (err != noErr) return; - - short i; - short iconSizeType = inSize; - - for ( i = 0; i < 3; i++ ) // iterate through the sizes. This is a nasty hack, hardly justified by the Assert above - { - err = ::DTGetIcon( nil /* vol name */, theVolRefNum, iconSizeType , inFileCreator, inFileType, &thisIconHandle); - - if ( err == noErr ) - err = ::AddIconToSuite(thisIconHandle, suiteHand, ::DTIconToResIcon( iconSizeType ) ); - - iconSizeType++; - gotOne |= (err == noErr); - - // only break on really bad errors - if ( err != noErr && err != afpItemNotFound ) - break; - } - - if ( !gotOne ) // Didn't find at least the B&W icon - { - ::DisposeIconSuite(suiteHand, true); - suiteHand = nil; - } - } - } - - if ( suiteHand == nil ) - { - ResIDT iconID = (inFileType == 'APPL') ? kGenericApplicationIconResource : kGenericDocumentIconResource; - err = ::GetIconSuite(&suiteHand, iconID, inSize == kLargeIcon ? kSelectorAllLargeData : kSelectorAllSmallData ); - if (err != noErr) - suiteHand = nil; - } - - *outHandle = suiteHand; -} - -#pragma mark - - - -CAttachmentIcon::CAttachmentIcon() -: mIconSuiteHandle(nil) -{ -} - - -CAttachmentIcon::CAttachmentIcon(const OSType inFileCreator, const OSType inFileType, const Int16 inIconSize) -: mIconSuiteHandle(nil) -{ - CIconUtils::GetDesktopIconSuite(inFileCreator, inFileType, inIconSize, &mIconSuiteHandle); -} - - -CAttachmentIcon::CAttachmentIcon(const ResID inIconResID, const Int16 inIconSize) -: mIconSuiteHandle(nil) -{ - IconSelectorValue theSelector = (inIconSize == kIconSizeLarge) ? kSelectorAllLargeData : kSelectorAllSmallData; - - OSErr err = ::GetIconSuite(&mIconSuiteHandle, inIconResID, theSelector); - if (err != noErr) - mIconSuiteHandle = nil; -} - -// attachmentRealType can be NULL -CAttachmentIcon::CAttachmentIcon(const char* attachmentRealType, const Int16 inIconSize) -: mIconSuiteHandle(nil) -{ - ResID iconID = kGenericDocumentIconResource; - - if (attachmentRealType != NULL) - { - // get an icon ID based on the real type (text/html etc) - if (XP_STRNCMP(TEXT_HTML, attachmentRealType, XP_STRLEN(TEXT_HTML)) == 0) - { - iconID = 129; //netscape html - } - else if (XP_STRNCMP(TEXT_PLAIN, attachmentRealType, XP_STRLEN(TEXT_PLAIN)) == 0) - { - iconID = 133; //netscape text - } - else if (XP_STRNCMP(MESSAGE_RFC822, attachmentRealType, XP_STRLEN(MESSAGE_RFC822)) == 0) - { - iconID = 15474; //message - } - else if (XP_STRNCMP(TEXT_VCARD, attachmentRealType, XP_STRLEN(attachmentRealType)) == 0) - { - iconID = 15476; //vcard icon - } - else if (XP_STRNCMP("application/", attachmentRealType, 12) == 0) - { - CMimeMapper *thisMapper = CPrefs::sMimeTypes.FindMimeType( (char *)attachmentRealType ); - - if (thisMapper) - { - CIconUtils::GetDesktopIconSuite(thisMapper->GetAppSig(), thisMapper->GetDocType(), - (inIconSize == kIconSizeLarge) ? kLargeIcon : kSmallIcon, &mIconSuiteHandle); - if (mIconSuiteHandle) - return; //our work here is done - } - } - // add more if you can find the icons - } - - IconSelectorValue theSelector = (inIconSize == kIconSizeLarge) ? kSelectorAllLargeData : kSelectorAllSmallData; - - OSErr err = ::GetIconSuite(&mIconSuiteHandle, iconID, theSelector); - if (err != noErr) - mIconSuiteHandle = nil; -} - - -static pascal OSErr IconDuplicateAction(ResType theType, Handle theIconData, void *refCon) -{ - Handle newIconSuite = (Handle)refCon; - OSErr err = HandToHand(&theIconData); // copy the data - if (err != noErr) return err; - return ::AddIconToSuite(theIconData, newIconSuite, theType); -} - -// copy constructor -CAttachmentIcon::CAttachmentIcon( const CAttachmentIcon& inOriginal) -{ - if (inOriginal.mIconSuiteHandle == nil) { - mIconSuiteHandle = nil; - return; - } - - OSErr err = noErr; - Handle newIconSuite = nil; - - err = ::NewIconSuite(&newIconSuite); - if (err != noErr) return; - - IconActionUPP iconActionProc = NewIconActionProc(IconDuplicateAction); - - // Duplicate the icon data. This is quite horrid, but the only way (AFAIK) - err = ::ForEachIconDo(inOriginal.mIconSuiteHandle, svAllAvailableData, iconActionProc, (void *)newIconSuite); - Assert_(err == noErr); - ::DisposeRoutineDescriptor(iconActionProc); - - mIconSuiteHandle = newIconSuite; -} - -CAttachmentIcon::~CAttachmentIcon() -{ - if (mIconSuiteHandle) - { - OSErr err = ::DisposeIconSuite( mIconSuiteHandle, true ); - Assert_(err == noErr); - } -} - - -void CAttachmentIcon::PlotIcon(const Rect& inIconFrame, IconAlignmentType inIconAlign, IconTransformType inIconTransform) -{ - if (mIconSuiteHandle) - { - ::PlotIconSuite(&inIconFrame, inIconAlign, inIconTransform, mIconSuiteHandle); - } -} - - -// the RgnHandle must have already been allocated -void CAttachmentIcon::AddIconOutlineToRegion( RgnHandle inRgnHandle, const Int16 inIconSize ) -{ - Rect iconRect; - StRegion tempRgn; - - if (! mIconSuiteHandle) return; - - if (inIconSize == kIconSizeSmall) - SetRect(&iconRect, 0, 0, 16, 16); - else - SetRect(&iconRect, 0, 0, 32, 32); - - OSErr err = ::IconSuiteToRgn( tempRgn, &iconRect, kAlignNone, mIconSuiteHandle ); - Assert_(err == noErr); - - ::UnionRgn(tempRgn, inRgnHandle, inRgnHandle); -} - - - - diff --git a/mozilla/cmd/macfe/utility/miconutils.h b/mozilla/cmd/macfe/utility/miconutils.h deleted file mode 100644 index 8ddabf9c84c..00000000000 --- a/mozilla/cmd/macfe/utility/miconutils.h +++ /dev/null @@ -1,87 +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. - */ - -// miconutils.h - -// Retreival/disposal of icons - -// Holds the icons -// disposes if they are not referenced - -#include - -class CIconList : public LArray { -public: -// ¥¥ icon interface - - static CIconHandle GetIcon(ResIDT iconID); - static void ReturnIcon(CIconHandle icon); - static Handle GetIconSuite(ResIDT iconID); - static void ReturnIconSuite(Handle icon); - -private: - CIconList(); - virtual ~CIconList(); - static CIconList sIconList; - static CIconList sIconSuiteList; -}; - - - -class CIconUtils -{ -public: - - static void GetDesktopIconSuite( const OSType inFileCreator, const OSType inFileType, - const short inIconSize, Handle* outHandle ); - -private: - static Boolean FindDesktopDatabase(short *ioVolumeRefNum, const OSType inFileCreator); - static Boolean InOneDesktop(short *ioVolumeRefNum, const OSType inFileCreator, short *outDtRefNum); -}; - - -class CAttachmentIcon -{ -public: - enum { - kIconSizeSmall = kSmallIcon, - kIconSizeLarge = kLargeIcon - }; - - CAttachmentIcon(); - CAttachmentIcon(const OSType inFileCreator, const OSType inFileType, const Int16 inIconSize = kIconSizeLarge); - CAttachmentIcon(const ResID inIconResID, const Int16 inIconSize = kIconSizeLarge); - CAttachmentIcon(const char* attachmentRealType, const Int16 inIconSize = kIconSizeLarge); - CAttachmentIcon( const CAttachmentIcon& inOriginal); //copy constructor - - ~CAttachmentIcon(); - - Handle GetSuiteHandle() { return mIconSuiteHandle; } - - void PlotIcon(const Rect& inIconFrame, IconAlignmentType inIconAlign = kAlignNone, - IconTransformType inIconTransform = kTransformNone); - - void AddIconOutlineToRegion( RgnHandle inRgnHandle, const Int16 inIconSize = kIconSizeLarge); - -protected: - -private: - Handle mIconSuiteHandle; - -}; diff --git a/mozilla/cmd/macfe/utility/uintl.cp b/mozilla/cmd/macfe/utility/uintl.cp deleted file mode 100644 index 27ab1969dcc..00000000000 --- a/mozilla/cmd/macfe/utility/uintl.cp +++ /dev/null @@ -1,117 +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. - */ - -#include "uintl.h" -#include "resgui.h" -#include "uprefd.h" -#include "intl_csi.h" -#include "intlpriv.h" -INTL_Encoding_ID ScriptToEncoding(ScriptCode script) -{ - switch(script) - { - case smRoman: return CS_MAC_ROMAN; // = 0, /*Roman*/ - case smJapanese: return CS_SJIS; // = 1, /*Japanese*/ - case smTradChinese: return CS_BIG5; // = 2, /*Traditional Chinese*/ - case smKorean: return CS_KSC_8BIT; // = 3, /*Korean*/ -// case smArabic: // = 4, /*Arabic*/ -// case smHebrew: // = 5, /*Hebrew*/ - case smGreek: return CS_MAC_GREEK; // = 6, /*Greek*/ - case smCyrillic: return CS_MAC_CYRILLIC; // = 7, /*Cyrillic*/ -// case smRSymbol: // = 8, /*Right-left symbol*/ -// case smDevanagari: // = 9, /*Devanagari*/ -// case smGurmukhi: // = 10, /*Gurmukhi*/ -// case smGujarati: // = 11, /*Gujarati*/ -// case smOriya: // = 12, /*Oriya*/ -// case smBengali: // = 13, /*Bengali*/ -// case smTamil: // = 14, /*Tamil*/ -// case smTelugu: // = 15, /*Telugu*/ -// case smKannada: // = 16, /*Kannada/Kanarese*/ -// case smMalayalam: // = 17 /*Malayalam*/ -// case smSinhalese: // = 18, /*Sinhalese*/ -// case smBurmese: // = 19, /*Burmese*/ -// case smKhmer: // = 20, /*Khmer/Cambodian*/ -// case smThai: // = 21, /*Thai*/ -// case smLaotian: // = 22, /*Laotian*/ -// case smGeorgian: // = 23, /*Georgian*/ -// case smArmenian: // = 24, /*Armenian*/ - case smSimpChinese: return CS_GB_8BIT; // = 25, /*Simplified Chinese*/ -// case smTibetan: // = 26, /*Tibetan*/ -// case smMongolian: // = 27, /*Mongolian*/ -// case smGeez: // = 28, /*Geez/Ethiopic*/ -// case smEthiopic: // = 28, /*Synonym for smGeez*/ - case smEastEurRoman: return CS_MAC_CE; // = 29, /*Synonym for smSlavic*/ -// case smVietnamese: // = 30, /*Vietnamese*/ -// case smExtArabic: // = 31, /*extended Arabic*/ -// case smUninterp: // = 32, /*uninterpreted symbols, e.g. palette symbols*/ - default: return CS_MAC_ROMAN; - } -} - -// Returns default document csid which is the current -// selection of the encoding menu. -// -uint16 FE_DefaultDocCharSetID(iDocumentContext context) -{ -#pragma unused(context) - - uint16 csid; - CommandT iCommand; - ResIDT outMENUid; - MenuHandle outMenuHandle; - Int16 outItem; - CharParameter markChar; - - for (csid = CS_DEFAULT, iCommand = ENCODING_BASE; iCommand <= ENCODING_CEILING; iCommand++) - { - LMenuBar::GetCurrentMenuBar()->FindMenuItem(iCommand, outMENUid, outMenuHandle, outItem); - ::GetItemMark (outMenuHandle, outItem, &markChar); - if (checkMark == markChar) - { - csid = (uint16) CPrefs::CmdNumToDocCsid(iCommand); - break; - } - } - XP_ASSERT(csid != CS_DEFAULT); // no check mark in the encoding menu - - return csid; -} - - -INTLCharSetID FE_GetCharSetID(INTL_CharSetID_Selector selector) -{ - INTLCharSetID charsetID = CS_DEFAULT; - - switch (selector) - { - case INTL_FileNameCsidSel: - charsetID = (INTLCharSetID) ScriptToEncoding(GetScriptManagerVariable(smSysScript)); - break; - case INTL_OldBookmarkCsidSel: - case INTL_DefaultTextWidgetCsidSel: - case INTL_MenuCsidSel: - charsetID = (INTLCharSetID) ScriptToEncoding(FontToScript(applFont)); - break; - default: - break; - } - - XP_ASSERT(charsetID != CS_DEFAULT); - - return charsetID; - } \ No newline at end of file diff --git a/mozilla/cmd/macfe/utility/uintl.h b/mozilla/cmd/macfe/utility/uintl.h deleted file mode 100644 index c2663527fbb..00000000000 --- a/mozilla/cmd/macfe/utility/uintl.h +++ /dev/null @@ -1,22 +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. - */ - -#include -#include "libi18n.h" - -INTL_Encoding_ID ScriptToEncoding(ScriptCode script); diff --git a/mozilla/cmd/macfe/utility/xp_file_mac.cp b/mozilla/cmd/macfe/utility/xp_file_mac.cp deleted file mode 100644 index c0aa77bbd85..00000000000 --- a/mozilla/cmd/macfe/utility/xp_file_mac.cp +++ /dev/null @@ -1,1342 +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. - */ - -/* xp_file_mac.h - * Mac-only xp_file functions - */ - #include "xp_file_mac.h" - - /* macfe */ -#include "resgui.h" -#include "ufilemgr.h" -#include "uprefd.h" - - /* utilities */ -#include "MoreFilesExtras.h" -#include "FSpCompat.h" -#include "FileCopy.h" -#include "PascalString.h" -#include -#include -#include -#include "cstring.h" - -// validation flags for overloaded ConvertURLToSpec -enum ConvertURLValidationFlags { - validateValFlag = 0x00000001, - stripValFlag = 0x00000002, - appendValFlag = 0x00000004, - stripAndAppendValFlag = (stripValFlag | appendValFlag) }; - -// Prototypes -OSErr ConvertURLToSpec - (const char* inName, - FSSpec* outSpec, - ResIDT resid = 0, - Boolean validate = false); -OSErr ConvertURLToSpec( - const char* inName, - FSSpec* outSpec, - const char* suffix = nil, - ConvertURLValidationFlags validate = validateValFlag); - -/************************************************************************************** - * See xp_file.h for full documentation. BE SURE TO READ THAT FILE. - **************************************************************************************/ - -//----------------------------------- -OSErr ConvertURLToSpec(const char* inName, FSSpec* outSpec, ResIDT resid, Boolean validate) -// Returns a file spec given a name (URL form), and resid of an extension to add. -// If ResID is zero, just convert. -// If resid is nonzero and validate is true, check the input name and return an error -// if the name does NOT have the suffix. -// If resid is nonzero and validate is false, append the suffix to the input name -//----------------------------------- -{ - if (!inName) - return bdNamErr; -#ifdef DEBUG - if (XP_STRCHR(inName, ':')) - XP_ASSERT(0); // Are they passing us a Mac path? -#endif - - OSErr err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - if (err && err != fnfErr) /* fnfErr is OK */ - return err; - if (resid) - { - CStr255 extension; - ::GetIndString(extension, 300, resid); - if (validate) - { - SInt32 suffixPosition = (XP_STRLEN(inName) - XP_STRLEN(extension)); - if (suffixPosition < 0) - return bdNamErr; - if (XP_STRCASECMP(extension, inName + suffixPosition) != 0) - return bdNamErr; - } - else - *(CStr63*)(outSpec->name) += extension; - } - return noErr; -} // ConvertURLToSpec - -//----------------------------------- -OSErr ConvertURLToSpec(const char* inName, FSSpec* outSpec, const char* suffix, - ConvertURLValidationFlags validate) -// Returns a file spec given a name (URL form), and resid of an extension to add. -// If ResID is zero, just convert. -// If resid is nonzero and validate is true, check the input name and return an error -// if the name does NOT have the suffix. -// If resid is nonzero and validate is false, append the suffix to the input name -//----------------------------------- -{ - if (!inName) - return bdNamErr; -#ifdef DEBUG - if (XP_STRCHR(inName, ':')) - XP_ASSERT(0); // Are they passing us a Mac path? -#endif - - if(validate & stripValFlag) { - char *dot = XP_STRRCHR(inName, '.'); - if(dot) - { - *dot = '\0'; - } - } - - OSErr err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - if (err && err != fnfErr) /* fnfErr is OK */ - return err; - if (validate & validateValFlag) - { - if (suffix) - { - CStr255 extension = suffix; - SInt32 suffixPosition = (XP_STRLEN(inName) - XP_STRLEN(extension)); - if (suffixPosition < 0) - return bdNamErr; - if (XP_STRCASECMP(extension, inName + suffixPosition) != 0) - return bdNamErr; - } - } - if(validate & appendValFlag) - { - if (suffix) - { - CStr31 extension = suffix; - CStr63& specName = *(CStr63*)(outSpec->name); - /* If the total length is greater than 31, we want to - * truncate the filename on the right-hand side by the - * appropriate amount. - */ - if(specName.Length() + extension.Length() > 31) - { - specName.Length() = 31 - extension.Length(); - } - specName += extension; - } else { - XP_ASSERT(0); - } - } - - return noErr; -} // ConvertURLToSpec - -const char* CacheFilePrefix = "cache"; - -extern long _fcreator, _ftype; /* Creator and Type for files created by the open function */ - -//----------------------------------- -OSErr XP_FileSpec(const char *inName, XP_FileType type, FSSpec* outSpec) -// For the Mac, get the Mac specs first -//----------------------------------- -{ - CStr255 tempName(inName); - OSErr err = noErr; - _fcreator = emSignature; - switch (type) { -/* MAIN FOLDER */ - case xpUserPrefs: /* Ignored by MacFE */ - err = fnfErr; - break; - case xpGlobalHistory: /* Simple */ - _ftype = emGlobalHistory; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, globHistoryName); - break; -#ifdef MOZ_MAIL_NEWS - case xpImapRootDirectory: - _ftype = emMailSubdirectory; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = "\pIMAPmail"; - break; - case xpImapServerDirectory: - _ftype = emMailSubdirectory; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = "\pIMAPmail"; - - FSSpec tempSpec; - OSErr getInfoErr = FSMakeFSSpec( - outSpec->vRefNum, - outSpec->parID, - outSpec->name, - &tempSpec); - if (getInfoErr == fnfErr) - { - // We have to make the root imap directory ourselves. - long ignored; - err = FSpDirCreate(outSpec, smSystemScript, &ignored); - if (err) - break; - } - CInfoPBRec infoRecord; - XP_MEMSET(&infoRecord, 0, sizeof(infoRecord)); - infoRecord.dirInfo.ioDrDirID = outSpec->parID; - infoRecord.dirInfo.ioVRefNum = outSpec->vRefNum; - infoRecord.dirInfo.ioNamePtr = outSpec->name; - getInfoErr = PBGetCatInfoSync(&infoRecord); - if (getInfoErr == noErr) - { - /* any error here is handled by the caller */ - /* fnfErr is in fact ok for XP_Stat */ - FSMakeFSSpec( - outSpec->vRefNum, - infoRecord.dirInfo.ioDrDirID, - tempName, - outSpec); - } - - break; -#endif - case xpBookmarks: - _ftype = emTextType; - err = ConvertURLToSpec(inName, outSpec, (ResIDT)0); - break; -/* MISC */ - case xpTemporary: - _ftype = emTextType; - XP_ASSERT(tempName[0] != '/'); - *outSpec = CPrefs::GetTempFilePrototype(); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpFileToPost: - _ftype = emTextType; - err = ConvertURLToSpec(inName, outSpec, (ResIDT)0); - break; - case xpURL: - case xpExtCache: - // This does not work if file name contains %. - // The problem is that netlib hex-decodes the file names before - // passing them to XP_File, while other libraries do not - // Windows has the same bug. atotic - _ftype = emTextType; - err = CFileMgr::FSSpecFromLocalUnixPath( inName, outSpec); - break; - case xpMimeTypes: - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, mimeTypes); - break; - case xpHTTPCookie: - _ftype = emMagicCookie; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, magicCookie); - break; -#ifdef CookieManagement - case xpHTTPCookiePermission: - _ftype = emMagicCookie; // is this right? - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, cookiePermissions); - break; -#endif - case xpJSCookieFilters: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = ":cookies.js"; - break; -#ifdef SingleSignon - case xpHTTPSingleSignon: - _ftype = emMagicCookie; // is this right? - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, singleSignons); - break; -#endif - case xpProxyConfig: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, proxyConfig); - break; - case xpJSConfig: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, jsConfig); - break; - - - - - case xpSocksConfig: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, socksConfig); - break; - case xpSignature: - _ftype = emTextType; - *outSpec = CPrefs::GetFolderSpec( CPrefs::SignatureFile ); - break; - case xpHTMLAddressBook: - _ftype = emTextType; // irrelevant - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, htmlAddressBook); - break; -#ifdef MOZ_MAIL_NEWS - case xpAddrBookNew: - case xpAddrBook: - _ftype = emAddressBookDB; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; -#endif - case xpRegistry: - _ftype = emRegistry; - err = FindFolder( kOnSystemDisk, kPreferencesFolderType, TRUE, &outSpec->vRefNum, &outSpec->parID); - GetIndString(outSpec->name, 300, theRegistry); - break; - -/* SECURITY */ - case xpKeyChain: /* Should probably be the default name instead */ - _ftype = emKeyChain; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCertDB: - _ftype = emCertificates; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, certDB); - if (inName != NULL) - tempName += inName; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCertDBNameIDX: - _ftype = emCertIndex; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(outSpec->name, 300, certDBNameIDX); - break; - case xpKeyDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, keyDb); - if (inName != NULL) - tempName += inName; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpSecModuleDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, secModuleDb); - break; - case xpSignedAppletDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, signedAppletDb); - if (inName != NULL) - tempName += inName; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCryptoPolicy: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::RequiredGutsFolder); - GetIndString(outSpec->name, 300, cryptoPolicy); - break; -/* CACHE */ - case xpCache: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::DiskCacheFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCacheFAT: - _ftype = emCacheFat; - *outSpec = CPrefs::GetFilePrototype( CPrefs::DiskCacheFolder ); - GetIndString(outSpec->name, 300, cacheLog); - break; - case xpExtCacheIndex: - _ftype = emExtCache; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, extCacheFile); - break; - case xpSARCache: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SARCacheFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpSARCacheIndex: - _ftype = emExtCache; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SARCacheFolder ); - GetIndString(outSpec->name, 300, sarCacheIndex); - break; -/* NEWS */ - case xpNewsRC: - case xpSNewsRC: -#ifdef MOZ_MAIL_NEWS - _ftype = emNewsrcFile; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - if ( (inName == NULL) || (*inName == 0)) - { - GetIndString( tempName, 300, newsrc ); - NET_RegisterNewsrcFile( tempName, inName, type == xpSNewsRC, FALSE ); - } - else - { - tempName = NET_MapNewsrcHostToFilename( (char*)inName, type == xpSNewsRC, FALSE ); - if ( tempName.IsEmpty() ) - { - // 3.0 -> 4.02 conversion hack: - // The missing newsrc file from 3.0 probably is "newsrc" - // If we're looking for a file that's not there, try it with "newsrc". - // That's because if "foo" is the default host for 3.0, then these things - // are true: - // (1) When 4.0 is first launched, there is no is no entry in the host - // NewsFAT for foo, and hence no entry in the mapping table for foo. - // (2) The entry that SHOULD be in the table for foo is "newsrc". - // (3) The entry that 4.0 WOULD make, if the user hadn't run 3.0, is - // newsrc-foo. - tempName = "newsrc"; - *(CStr63*)(outSpec->name) = tempName; - FInfo fndrInfo; - if (::FSpGetFInfo(outSpec, &fndrInfo) == fnfErr) - { - char * cstr = CStr255(inName); // when we have , - char* macptr = XP_STRCHR(cstr, ':'); // ...replace ':' with '.' - if (macptr) *macptr = '.'; - - CFileMgr::UniqueFileSpec( *outSpec, cstr, *outSpec ); - tempName = outSpec->name; - } - NET_RegisterNewsrcFile( tempName, (char*)inName, type == xpSNewsRC, FALSE ); - } - } - *(CStr63*)(outSpec->name) = tempName; - break; - case xpNewsgroups: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - tempName = NET_MapNewsrcHostToFilename((char*)inName, FALSE, TRUE ); - if ( tempName.IsEmpty() ) - { - CStr63 newName( "groups-" ); - newName += inName; - tempName = newName; - CFileMgr::UniqueFileSpec( *outSpec, CStr31( tempName ), *outSpec ); - tempName = outSpec->name; - NET_RegisterNewsrcFile( tempName, (char*)inName, FALSE, TRUE ); - } - *(CStr63*)(outSpec->name) = tempName; - break; - case xpSNewsgroups: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - tempName = NET_MapNewsrcHostToFilename((char*)inName, TRUE, TRUE ); - if ( tempName.IsEmpty() ) - { - CStr63 newName( "sgroups-" ); - newName += inName; - tempName = newName; - CFileMgr::UniqueFileSpec( *outSpec, CStr31( tempName ), *outSpec ); - tempName = outSpec->name; - NET_RegisterNewsrcFile( tempName, (char*)inName, TRUE, TRUE ); - } - *(CStr63*)(outSpec->name) = tempName; - break; - case xpTemporaryNewsRC: - _ftype = emNewsrcFile; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - tempName = "temp newsrc"; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpNewsrcFileMap: - _ftype = emNewsrcDatabase; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - GetIndString(outSpec->name, 300, newsFileMap); - break; - case xpXoverCache: - _ftype = emNewsXoverCache; - *outSpec = CPrefs::GetFilePrototype(CPrefs::NewsFolder); -// Boolean isDirectory; -// long dirID; -// // Convert the outSpec of the news folder to a dir ID -// err = FSpGetDirectoryID(outSpec, &dirID, &isDirectory); - if (!err) - { -// Assert_(isDirectory); -// outSpec->parID = dirID; - // Name can contain a slash, so be prepared - - err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - -// // name is now a native partial path -// err = FSMakeFSSpec( -// outSpec->vRefNum, -// outSpec->parID, -// tempName, -// outSpec); - if (err == fnfErr) err = noErr; - } - break; - case xpNewsSort: - _ftype = emMailFilterRules; - *outSpec = CPrefs::GetFilePrototype(CPrefs::NewsFolder); - err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - if (err == fnfErr) err = noErr; - break; - case xpNewsHostDatabase: - _ftype = emNewsHostDatabase; - *outSpec = CPrefs::GetFilePrototype(CPrefs::NewsFolder); - GetIndString(outSpec->name, 300, newsHostDatabase); - break; - - case xpJSMailFilters: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - if (inName && *inName) - { - // Make sure there are no colons in the server name - char* cp = (char*)&tempName[1]; - for (int i = 1; i < tempName[0]; i++,cp++) - if (*cp == ':') *cp = '.'; - *(CStr63*)(outSpec->name) += (":" + tempName + ".filters.js"); // in parent of mail folder. - } - else - *(CStr63*)(outSpec->name) = ":filters.js"; // in parent of mail folder. - break; - case xpMailSort: // normal filters - { - _ftype = emMailFilterRules; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - if (inName && *inName) - { - // In 5.0, there are rules for each server. - // Make sure there are no colons in the server name - char* cp = (char*)&tempName[1]; - for (int i = 1; i < tempName[0]; i++,cp++) - if (*cp == ':') *cp = '.'; - *(CStr63*)(outSpec->name) = (":" + tempName + " Rules"); // in parent of mail folder. - } - else - GetIndString(outSpec->name, 300, mailFilterFile);// in parent of mail folder. - break; - } - case xpMailFilterLog: - _ftype = emMailFilterLog; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - GetIndString(outSpec->name, 300, mailFilterLog);// in parent of mail folder. - break; - case xpMailFolder: - _ftype = emTextType; - err = ConvertURLToSpec(inName, outSpec, (ResIDT)0); - break; - case xpMailFolderSummary: - _ftype = emMailFolderSummary; - err = ConvertURLToSpec(inName, outSpec, mailBoxExt); - break; - case xpMailPopState: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - GetIndString(outSpec->name, 300, mailPopState); - break; - case xpMailSubdirectory: - _ftype = emMailSubdirectory; - err = ConvertURLToSpec(inName, outSpec, subdirExt); - break; - case xpVCardFile: - _ftype = emTextType; - // We are required to check for a '.vcf' - err = ConvertURLToSpec(inName, outSpec, vCardExt, true); - break; - case xpLDIFFile: - _ftype = emTextType; - // We are required to check for a '.ldi', '.ldif' - err = ConvertURLToSpec(inName, outSpec, ldifExt1, true); - if (err == bdNamErr) - err = ConvertURLToSpec(inName, outSpec, ldifExt2, true); - if ( err == bdNamErr ) - { - ConvertURLToSpec(inName, outSpec, 0, false); - short refNum; - err = ::FSpOpenDF( outSpec, fsRdPerm, &refNum); - FSClose( refNum ); - if (err == fnfErr) - err = ConvertURLToSpec(inName, outSpec, ".ldif", stripAndAppendValFlag); - else - err = bdNamErr; - } - break; - case xpPKCS12File: - _ftype = emTextType; - // We are required to check for a '.ldi', '.ldif' - err = ConvertURLToSpec(inName, outSpec, ".p12", stripAndAppendValFlag); - break; - case xpFolderCache: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - GetIndString(outSpec->name, 300, mailFolderCache); - break; - case xpLIClientDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = "LIClientdb.dat"; - break; - case xpLIPrefs: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - *(CStr63*)(outSpec->name) = "liprefs.js"; - break; -#endif // ifdef MOZ_MAILNEWS - - default: - XP_ASSERT( false ); // Whoever added the enum, it is time to implement it on the Mac - err = bdNamErr; - break; - } - if ( (err == fnfErr) ) - err = noErr; - //XP_ASSERT( err == noErr); - // Don't assert, sometimes normal flow of control involves an err here. - return err; -} // XP_FileSpec - -//----------------------------------- -char* xp_FileName( const char* name, XP_FileType type, char* buf, char* /* unixConfigBuf */ ) -//----------------------------------- -{ - FSSpec macSpec; - OSErr err = noErr; - - if ( ( type == xpCache ) && name) - { - char * cachePath = CPrefs::GetCachePath(); - if (cachePath == NULL) - err = fnfErr; - else - { - XP_STRCPY(buf, cachePath); - XP_STRCAT(buf, name); - } - } - -#ifdef _XP_TMP_FILENAME_FOR_LDAP_ - /* this is for address book to have a way of getting a temp file - * name for each ldap server, yet preserve the temp file name for - * later use on the same ldap server. we expect name to be unique - * to each ldap server and the return would be a temp file name - * associated with the ldap server - benjie - */ - else if ( ( type == xpAddrBook ) && name) - { - return FE_GetFileName(name, type); - } -#endif - - else - { - char* path = NULL; - - err = XP_FileSpec( name, type, &macSpec ); - - if (err != noErr) - return NULL; - - path = CFileMgr::PathNameFromFSSpec( macSpec, TRUE ); - - if ( !path ) - return NULL; - - if ((strlen(path) > 1000) ) - { - XP_ASSERT(FALSE); - XP_FREE( path ); - return NULL; - } - - XP_STRCPY( buf, path ); - XP_FREE( path ); - } - if ( err != noErr ) - return NULL; - return buf; -} // XP_FileSpec - -//----------------------------------- -char* XP_TempDirName(void) -//----------------------------------- -{ - FSSpec spec = CPrefs::GetTempFilePrototype(); - char* path = CFileMgr::PathNameFromFSSpec(spec, TRUE); - if (strlen(path) > 1000) - { - XP_ASSERT(FALSE); - return NULL; - } - return path; -} - -//----------------------------------- -char * xp_FilePlatformName(const char * name, char* path) -//----------------------------------- -{ - FSSpec spec; - OSErr err; - char * fullPath; - - if (name == NULL) - return NULL; - - // Initialize spec, because FSSpecFromLocalUnixPath might use it. - spec.vRefNum = 0; - spec.parID = 0; - err = CFileMgr::FSSpecFromLocalUnixPath(name, &spec); - // ¥¥¥NOTE: rjc, pchen, and pinkerton changed the behavior of this so that it will no - // longer return NULL when the file does not exist. If this is a problem, come tell us - // because we need to change other code. - if (err != noErr && err != fnfErr && err != dirNFErr ) - return NULL; - fullPath = CFileMgr::PathNameFromFSSpec( spec, TRUE ); - if (fullPath && (XP_STRLEN(fullPath) < 300)) - XP_STRCPY(path, fullPath); - else - return NULL; - if (fullPath) - XP_FREE(fullPath); - return path; -} - - -//----------------------------------- -char *XP_PlatformFileToURL(const char * inName) -//----------------------------------- -{ - char *retVal = NULL; - const char *prefix = "file://"; - /* The inName parameter MUST be a native path, ie colons, spaces, etc. - ** This assert will help us fix all the various "doubly-encoded path" - ** bugs - jrm 97/02/10 */ -#ifdef DEBUG - FSSpec tempSpec; - OSErr err = ::FSMakeFSSpec(0, 0, CStr255(inName), &tempSpec); - Boolean nativeMacPath = (err == noErr || err == fnfErr || err == dirNFErr); - Assert_(nativeMacPath); -#endif - char *duplicatedName = XP_STRDUP(inName); - if (duplicatedName) - { /* YUCK! duplicatedName deleted by CFileMgr::EncodeMacPath */ - char *xp_path = CFileMgr::EncodeMacPath(duplicatedName); - retVal = (char *) XP_ALLOC (XP_STRLEN(xp_path) + XP_STRLEN(prefix) + 1); - if (retVal) - { - XP_STRCPY (retVal, prefix); - XP_STRCAT (retVal, xp_path); - } - if (xp_path) - XP_FREE(xp_path); - } - return retVal; -} - -char *XP_PlatformPartialPathToXPPartialPath(const char *sourceStringWithSpaces) -{ - // convert spaces back to %20 quote char - int numberOfSpaces = 0; - const char *currentSpace = XP_STRSTR(sourceStringWithSpaces, " "); - while (currentSpace) - { - numberOfSpaces++; - currentSpace = XP_STRSTR(currentSpace + 1, " "); - } - - char *escapedReturnString = (char *) XP_ALLOC(XP_STRLEN(sourceStringWithSpaces) + (numberOfSpaces*2) + 1); - if (escapedReturnString) - { - XP_STRCPY(escapedReturnString, sourceStringWithSpaces); - if (numberOfSpaces) - { - char *currentSpace = XP_STRSTR(escapedReturnString, " "); - while (currentSpace) - { - XP_MEMMOVE(currentSpace+3,currentSpace+1,XP_STRLEN(currentSpace+1) + 1); - *currentSpace++ = '%'; - *currentSpace++ = '2'; - *currentSpace++ = '0'; - currentSpace = XP_STRSTR(currentSpace, " "); - } - } - } - - return escapedReturnString; -} - -/* Needs to deal with both CR, CRLF, and LF end-of-line */ -extern char * XP_FileReadLine(char * dest, int32 bufferSize, XP_File file) -{ - char * retBuf = fgets(dest, bufferSize, file); - if (retBuf == NULL) /* EOF */ - return NULL; - char * LFoccurence = (char *)strchr(retBuf, LF); - if (LFoccurence != NULL) /* We have hit LF before CR, */ - { - fseek(file, -(strlen(retBuf) - (LFoccurence - retBuf))+1, SEEK_CUR); - LFoccurence[1] = 0; - } - else /* We have CR, check if the next character is LF */ - { - int c; - - c = fgetc(file); - - if (c == EOF) - ; /* Do nothing, end of file */ - else if (c == LF) /* Swallow CR/LF */ - { - int len = strlen(retBuf); - if (len < bufferSize) /* Append LF to our buffer if we can */ - { - retBuf[len++] = LF; - retBuf[len] = 0; - } - } - else /* No LF, just clean up the seek */ - { - fseek(file, -1, SEEK_CUR); - } - } - return retBuf; -} - -static counter = 1; /* temporary name suffix */ - -/* Returns a temp name given a path - */ -char * xp_TempName(XP_FileType type, const char * prefix, char* buf, char* /* buf2 */, unsigned int * /* count */) -{ - FSSpec tempSpec; - CStr255 defaultName(prefix); - OSErr err = noErr; - - switch (type) { - case xpTemporaryNewsRC: - defaultName = "temp newsrc"; - break; - break; - case xpCache: - defaultName = CacheFilePrefix; - CStr255 dateString; - ::NumToString (::TickCount(), dateString); - defaultName += dateString; - break; - case xpBookmarks: - defaultName += ".bak"; - break; - case xpJPEGFile: - defaultName += ".jpeg"; - break; - case xpMailFolder: /* Ugly. MailFolder callers for temporary names pass in the full path */ - case xpMailFolderSummary: /* Ugly. MailFolder callers for temporary names pass in the full path */ - { - FSSpec temp; - err = XP_FileSpec(prefix, xpMailFolder, &temp); - if (err == noErr) - defaultName = temp.name; - } - case xpFileToPost: /* Temporary files to post return the full path */ - - case xpTemporary: - default: - if ( (type == xpURL) && prefix ) - { - if ( XP_STRRCHR(prefix, '/') ) - { - XP_StatStruct st; - if (XP_Stat (defaultName, &st, xpURL)) - XP_MakeDirectoryR (defaultName, xpURL); - defaultName += "su"; - } - } - - if (defaultName.IsEmpty()) - defaultName = "nstemp"; - CStr255 counterS; - ::NumToString(counter++, counterS); - defaultName += counterS; /* Need counter to guarantee uniqueness if called several times in a row */ - break; - } - if (type == xpFileToPost || type == xpMailFolder || type == xpMailFolderSummary || ((type == xpURL) && !prefix)) - { - if (defaultName.Length() > 30) // Someone has passed in something weird as a prefix - { - XP_ASSERT(false); - defaultName.Delete(30, 1000); - } - err = XP_FileSpec(defaultName, xpTemporary, &tempSpec); - } - else - err = XP_FileSpec(defaultName, type, &tempSpec); - - if (err && err != fnfErr) - return NULL; - - FSSpec finalSpec; - err = CFileMgr::UniqueFileSpec(tempSpec, tempSpec.name, finalSpec); - if (err != noErr) - { - XP_ASSERT(FALSE); - return NULL; - } - if ((type == xpFileToPost) || - (type == xpBookmarks) || - (type == xpMailFolder) || - (type == xpURL) || - (type == xpMailFolderSummary)) - /* These files needs full pathname */ - { - char* tempPath = CFileMgr::PathNameFromFSSpec( finalSpec, TRUE ); - tempPath = CFileMgr::EncodeMacPath(tempPath); - if (tempPath == NULL) - return NULL; - else if (XP_STRLEN(tempPath) > 500) /* Buffer overflow check */ - { - XP_FREE(tempPath); - return NULL; - } - XP_STRCPY(buf, tempPath); - XP_FREE(tempPath); - } - else - XP_STRCPY(buf, CStr63(finalSpec.name)); - return buf; -} /* xp_TempName */ - - - -/* XP_OpenDir is not handling different directories yet. */ -XP_Dir XP_OpenDir( const char* name, XP_FileType type ) -{ - CInfoPBRec pb; - OSErr err; - DirInfo* dipb; - struct dirstruct * dir = XP_NEW(struct dirstruct); - - if (dir == NULL) - return NULL; - - XP_TRACE(( "opening file: %s", name )); - dir->type = type; - - err = XP_FileSpec( name, type, &dir->dirSpecs ); - if ( err != noErr ) - { - XP_DELETE(dir); - return NULL; - } - - dipb = (DirInfo*)&pb; - - pb.hFileInfo.ioNamePtr = dir->dirSpecs.name; - pb.hFileInfo.ioVRefNum = dir->dirSpecs.vRefNum; - pb.hFileInfo.ioDirID = dir->dirSpecs.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - - err = PBGetCatInfoSync( &pb ); - - /* test that we have gotten a directory back, not a file */ - if ( (err != noErr ) || !( dipb->ioFlAttrib & 0x0010 ) ) - { - XP_DELETE( dir ); - return NULL; - } - dir->dirSpecs.parID = pb.hFileInfo.ioDirID; - dir->index = pb.dirInfo.ioDrNmFls; - - return (XP_Dir)dir; -} - -void XP_CloseDir( XP_Dir dir ) -{ - if ( dir ) - XP_DELETE(dir); -} - -int XP_FileNumberOfFilesInDirectory(const char * dir_name, XP_FileType type) -{ - FSSpec spec; - OSErr err = XP_FileSpec(dir_name, type, &spec); - if ((err != noErr) && (err != fnfErr)) - goto loser; - CInfoPBRec pb; - pb.hFileInfo.ioNamePtr = spec.name; - pb.hFileInfo.ioVRefNum = spec.vRefNum; - pb.hFileInfo.ioDirID = spec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - err = PBGetCatInfoSync(&pb); - if (err != noErr) - goto loser; - return pb.dirInfo.ioDrNmFls; -loser: - return 10000; /* ???? */ -} - -XP_DirEntryStruct * XP_ReadDir(XP_Dir dir) -{ -tryagain: - if (dir->index <= 0) - return NULL; - CInfoPBRec cipb; - DirInfo *dipb=(DirInfo *)&cipb; - dipb->ioCompletion = NULL; - dipb->ioFDirIndex = dir->index; - dipb->ioVRefNum = dir->dirSpecs.vRefNum; /* Might need to use vRefNum, not sure*/ - dipb->ioDrDirID = dir->dirSpecs.parID; - dipb->ioNamePtr = (StringPtr)&dir->dirent.d_name; - OSErr err = PBGetCatInfoSync (&cipb); - /* We are traversing the directory backwards */ - if (err != noErr) - { - if (dir->index > 1) - { - dir->index--; - goto tryagain; - } - else - return NULL; - } - p2cstr((StringPtr)&dir->dirent.d_name); - - /* Mail folders are treated in a special way */ - - if ((dir->type == xpMailFolder) || - (dir->type == xpMailFolderSummary) || - (dir->type == xpMailSubdirectory) ) - { - char * newName = XP_STRDUP(dir->dirent.d_name); - newName = CFileMgr::EncodeMacPath(newName); - if (newName) - { - XP_STRCPY(dir->dirent.d_name, newName); - XP_FREE(newName); - } - } - - dir->index--; - return &dir->dirent; -} - -int XP_MakeDirectory(const char* name, XP_FileType type) -{ - FSSpec spec; - OSErr err = XP_FileSpec(name, type, &spec); - if ((err != noErr) && (err != fnfErr)) /* Should not happen */ - return -1; - short refNum; - long dirID; - err = CFileMgr::CreateFolderInFolder( - spec.vRefNum, spec.parID, spec.name, /* Name of the new folder */ - &refNum, &dirID); - if (err != noErr) - return -1; - return 0; -} - -/* Recursively create all the directories - */ -int XP_MakeDirectoryR(const char* name, XP_FileType type) -{ - char separator; - int result = 0; - XP_FILE_NATIVE_PATH finalNameNative = NULL; - XP_FILE_URL_PATH finalName = NULL; - char * dirPath = NULL; - separator = '/'; - - if ( type == xpURL) - finalNameNative = CFileMgr::MacPathFromUnixPath(name); - else - finalNameNative = WH_FileName(name, type); - - if ( finalNameNative == NULL ) - { - result = -1; - goto done; - } - finalName = XP_PlatformFileToURL(finalNameNative); - if ( finalName ) - { - char * currentEnd; - int err = 0; - XP_StatStruct s; - dirPath = XP_STRDUP( &finalName[7] ); // Skip the file:// - if (dirPath == NULL) - { - result = -1; - goto done; - } - - currentEnd = XP_STRCHR(dirPath, separator); - if (currentEnd) - currentEnd = XP_STRCHR(¤tEnd[1], separator); - /* Loop through every part of the directory path */ - while (currentEnd != 0) - { - char savedChar; - savedChar = currentEnd[1]; - currentEnd[1] = 0; - if ( XP_Stat(dirPath, &s, xpURL ) != 0) - err = XP_MakeDirectory(dirPath, xpURL); - if ( err != 0) - { - XP_ASSERT( FALSE ); /* Could not create the directory? */ - break; - } - currentEnd[1] = savedChar; - currentEnd = XP_STRCHR( ¤tEnd[1], separator); - } - if ( err == 0 ) - /* If the path is not terminated with / */ - { - if ( dirPath[XP_STRLEN( dirPath) - 1] != separator ) - if ( XP_Stat(dirPath, &s, xpURL ) != 0) - err = XP_MakeDirectory(dirPath, xpURL); - } - if ( 0 != err ) - result = err; - } - else - result = -1; -done: - XP_FREEIF(finalName); - XP_FREEIF(finalNameNative); - XP_FREEIF(dirPath); - XP_ASSERT( result == 0 ); /* For debugging only */ - return result; -} - -int XP_RemoveDirectory (const char* name, XP_FileType type) -{ - FSSpec spec; - OSErr err = XP_FileSpec(name, type, &spec); - if ((err != noErr) && (err != fnfErr)) - return -1; - err = ::FSpDelete(&spec); - if (err != noErr) - return -1; - return 0; -} - -// Removes the directory and its contents. -int XP_RemoveDirectoryRecursive(const char *name, XP_FileType type) -{ - OSErr err; - FSSpec dirSpec; - - err = XP_FileSpec(name, type, &dirSpec); - if ((err != noErr) && (err != fnfErr)) - return -1; - err = DeleteDirectory(dirSpec.vRefNum, dirSpec.parID, dirSpec.name); - return (err == noErr) ? 0 : -1; -} - -int XP_FileRename( const char* from, XP_FileType fromtype, - const char* to, XP_FileType totype ) -{ - OSErr err = noErr; - - char* fromName = WH_FileName( from, fromtype ); - char* toName = WH_FileName( to, totype ); - - if ( fromName && toName ) - { - FSSpec toSpec; - err = CFileMgr::FSSpecFromPathname( toName, &toSpec ); - if (err == noErr || err == fnfErr) - { - FSSpec fromSpec; - err = CFileMgr::FSSpecFromPathname( fromName, &fromSpec ); - if (err == noErr || err == fnfErr) - { - - if (fromSpec.vRefNum == toSpec.vRefNum) - /* Same volume */ - { - /* But, er, is it the same file (jrm 97/08/20)? */ - if (fromSpec.parID == toSpec.parID - && *(CStr63*)fromSpec.name == *(CStr63*)toSpec.name) - goto Cleanup; // YOW! Don't delete it! - - /* Delete the file */ - ::FSpDelete( &toSpec ); /* ignore error if not there */ - if (fromSpec.parID == toSpec.parID) - { - /* this is a flat node rename use ::FSpRename */ - err = ::FSpRename(&fromSpec, toSpec.name); - } - else - { - /* we are moving a file between dirs so use HMoveRenameCompat */ - err = ::HMoveRenameCompat( - fromSpec.vRefNum, - fromSpec.parID, (ConstStr255Param)fromSpec.name, - toSpec.parID, nil, (StringPtr)toSpec.name); - } - } - else - /* Different volumes */ - { - FSSpec toDir; - err = CFileMgr::FolderSpecFromFolderID(toSpec.vRefNum, toSpec.parID, toDir); - if (err == noErr) - { - ::FSpDelete( &toSpec ); - err = FSpFileCopy( &fromSpec, &toDir, toSpec.name, NULL, 0, true ); - if ( err == noErr) - ::FSpDelete( &fromSpec ); - } - } - } - } - - } - else - err = -1; -Cleanup: - if ( fromName ) - XP_FREE( fromName ); - if ( toName ) - XP_FREE( toName ); - if (err != noErr) - return -1; - return 0; -} - -int XP_FileRemove( const char* name, XP_FileType type ) -{ - FSSpec spec; - OSErr err; - - err = XP_FileSpec( name, type, &spec); - - if ( err == noErr ) - { - err = ::FSpDelete( &spec ); -#ifdef MOZ_MAIL_NEWS - if ( type == xpNewsRC || type == xpNewsgroups ) - NET_UnregisterNewsHost( name, FALSE ); - else if ( type == xpSNewsRC || type == xpSNewsgroups) - NET_UnregisterNewsHost( name, TRUE ); -#endif - } - - if ( err == noErr ) - return 0; - return -1; -} - -int XP_FileTruncate( const char* name, XP_FileType type, int32 len ) -{ - FSSpec spec; - OSErr err, err2; - short refNum; - - if (len < 0) - return EINVAL; - - err = XP_FileSpec( name, type, &spec); - if (err != noErr) - return EINVAL; - - err = FSpOpenDF(&spec, fsRdWrPerm, &refNum); - if (err != noErr) - return EACCES; - - err = SetEOF(refNum, len); - - err2 = FSClose(refNum); - if ((err != noErr) || (err2 != noErr)) - return EIO; - return 0; -} - - -int XP_FileDuplicateResourceFork( const char* oldFilePath, XP_FileType oldType, - const char* newFilePath, XP_FileType newType ) -{ - OSErr err; - FSSpec oldfs, newfs; - err = XP_FileSpec( oldFilePath, oldType, &oldfs); - if (err != noErr) - return EINVAL; - - err = XP_FileSpec( newFilePath, newType, &newfs); - if (err != noErr) - return EINVAL; - - short oldFileRefNum = -1, newFileRefNum = -1; - oldFileRefNum = FSpOpenResFileCompat( &oldfs, fsCurPerm ); - err = ResError(); - if ( err || ( oldFileRefNum == -1 ) ) - { - return EACCES; - } - - // assume we need to create the new resource fork - // (may not be valid assumption for other uses of this function) - FSpCreateResFileCompat( &newfs, emSignature, emTextType, smSystemScript ); - err = ResError(); - - newFileRefNum = FSpOpenResFileCompat( &newfs, fsRdWrPerm ); - err = ResError(); - if ( err || ( newFileRefNum == -1 ) ) - { - err = FSClose( oldFileRefNum ); - XP_ASSERT(0); - return EACCES; - } - - long buffsize = 1024; - char buff[ 1024 ]; - err = CopyFork( oldFileRefNum, newFileRefNum, buff, buffsize); - - FSClose( oldFileRefNum ); - FSClose( newFileRefNum ); - - if ( err ) - return EIO; - - return 0; -} - -//====================================== -// I put these stubs here. They can go away when we move to MSL. -//====================================== - -#include "prenv.h" /* For PR_GetEnv */ -extern "C" { - char* getenv(const char *var); -} - -char* getenv(const char *var) -{ - return PR_GetEnv(var); -} - diff --git a/mozilla/cmd/macfe/utility/xp_file_mac.h b/mozilla/cmd/macfe/utility/xp_file_mac.h deleted file mode 100644 index 3311aaf9cb5..00000000000 --- a/mozilla/cmd/macfe/utility/xp_file_mac.h +++ /dev/null @@ -1,48 +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. - */ - -/* xp_file_mac.h - * Mac-only xp_file functions - */ - -#pragma once - -#include "client.h" -#include "xp_file.h" - -XP_BEGIN_PROTOS -char* xp_FileName( const char* name, XP_FileType type, char* buf, char* configBuf ); -char * xp_FilePlatformName(const char * name, char* path); -char * xp_TempName(XP_FileType type, const char * prefix, char* buf, char* buf2, unsigned int *count); - -/* general Name->FSSpec conversion */ -OSErr XP_FileSpec(const char *name, XP_FileType type, FSSpec* spec); - -int xp_MacToUnixErr( OSErr err ); - -/* This function is only implemented on the mac (because it can only be - implemented efficiently there.) Implementing on the other platforms - to just return some magic value would lead to weird, rare bugs in the - cache cleanup code; so simply don't call this on the other platforms. - */ -extern int XP_FileNumberOfFilesInDirectory(const char * dir_name, - XP_FileType type); - -int XP_FileDuplicateResourceFork( const char* oldFilePath, XP_FileType oldType, - const char* newFilePath, XP_FileType newType ); -XP_END_PROTOS \ No newline at end of file