зеркало из https://github.com/mozilla/pjs.git
Removing ifdefs for TARGET_CARBON code. Using inline functions in Universal Headers and nsCarbonHeaders.h.
This commit is contained in:
Родитель
1b1155e2f6
Коммит
1d26b9e828
|
@ -23,6 +23,8 @@
|
|||
#include "nsComboBox.h"
|
||||
#include "nsMenu.h"
|
||||
#include <StringCompare.h>
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
#if TARGET_CARBON
|
||||
#include <ControlDefinitions.h>
|
||||
#endif
|
||||
|
@ -88,19 +90,7 @@ NS_IMETHODIMP nsComboBox::Create(nsIWidget *aParent,
|
|||
{
|
||||
StartDraw();
|
||||
::InsertMenu(mMenuHandle, hierMenu);
|
||||
// ::SetControlData(mControl, kControlNoPart, kControlPopupButtonMenuHandleTag, sizeof(mMenuHandle), (Ptr)&mMenuHandle);
|
||||
// ::SetControlData(mControl, kControlNoPart, kControlPopupButtonMenuIDTag, sizeof(mMenuID), (Ptr)&mMenuID);
|
||||
#if TARGET_CARBON
|
||||
::SetControlPopupMenuHandle ( mControl, mMenuHandle );
|
||||
::SetControlPopupMenuID ( mControl, mMenuID );
|
||||
#else
|
||||
PopupPrivateData* popupData = (PopupPrivateData*)*((*mControl)->contrlData);
|
||||
if (popupData)
|
||||
{
|
||||
popupData->mHandle = mMenuHandle;
|
||||
popupData->mID = mMenuID;
|
||||
}
|
||||
#endif
|
||||
SetControlPopupMenuStuff ( mControl, mMenuHandle, mMenuID );
|
||||
::SetControlMinimum(mControl, 0);
|
||||
::SetControlMaximum(mControl, 0);
|
||||
::SetControlValue(mControl, 0);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <StandardFile.h>
|
||||
#include <ICAPI.h>
|
||||
#include "nsMacControl.h"
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
|
@ -302,13 +303,8 @@ nsFileWidget :: PutFile ( Str255 & inTitle, Str255 & inDefaultName, FSSpec* outS
|
|||
} // if user clicked OK
|
||||
} // if can get dialog options
|
||||
|
||||
if ( eventProc ) {
|
||||
#if TARGET_CARBON
|
||||
if ( eventProc )
|
||||
::DisposeNavEventUPP(eventProc);
|
||||
#else
|
||||
::DisposeRoutineDescriptor(eventProc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
|
@ -376,13 +372,8 @@ nsFileWidget :: GetFile ( Str255 & inTitle, /* filter list here later */ FSSpec*
|
|||
} // if user clicked OK
|
||||
} // if can get dialog options
|
||||
|
||||
if ( eventProc ) {
|
||||
#if TARGET_CARBON
|
||||
if ( eventProc )
|
||||
::DisposeNavEventUPP(eventProc);
|
||||
#else
|
||||
::DisposeRoutineDescriptor(eventProc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
|
@ -447,13 +438,8 @@ nsFileWidget :: GetFolder ( Str255 & inTitle, FSSpec* outSpec )
|
|||
} // if user clicked OK
|
||||
} // if can get dialog options
|
||||
|
||||
if ( eventProc ) {
|
||||
#if TARGET_CARBON
|
||||
if ( eventProc )
|
||||
::DisposeNavEventUPP(eventProc);
|
||||
#else
|
||||
::DisposeRoutineDescriptor(eventProc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
*/
|
||||
|
||||
#include "nsLookAndFeel.h"
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
|
||||
|
@ -82,12 +84,7 @@ NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
|
|||
if (thePort)
|
||||
{
|
||||
RGBColor macColor;
|
||||
#if TARGET_CARBON
|
||||
GetPortHiliteColor(thePort,&macColor);
|
||||
#else
|
||||
GrafVars** grafVars = (GrafVars**)((CGrafPtr)thePort)->grafVars;
|
||||
macColor = (*grafVars)->rgbHiliteColor;
|
||||
#endif
|
||||
::GetPortHiliteColor(thePort,&macColor);
|
||||
aColor = NS_RGB(macColor.red>>8, macColor.green>>8, macColor.blue>>8);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -172,11 +172,7 @@ PRBool nsMacControl::OnPaint(nsPaintEvent &aEvent)
|
|||
nsRect bounds = mBounds;
|
||||
bounds.x = bounds. y = 0;
|
||||
nsRectToMacRect(bounds, macRect);
|
||||
#if TARGET_CARBON
|
||||
::ValidWindowRect(mWindowPtr, &macRect);
|
||||
#else
|
||||
::ValidRect(&macRect);
|
||||
#endif
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
#include <TextServices.h>
|
||||
#include <UnicodeConverter.h>
|
||||
#include <Script.h>
|
||||
#include "nsCarbonHelpers.h"
|
||||
#include "nsIRollupListener.h"
|
||||
|
||||
|
||||
//#define DEBUG_TSM
|
||||
extern nsIRollupListener * gRollupListener;
|
||||
extern nsIWidget * gRollupWidget;
|
||||
|
@ -415,16 +418,10 @@ PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal,
|
|||
// convert the mouse to local coordinates. We have to do all the funny port origin
|
||||
// stuff just in case it has been changed.
|
||||
Point hitPointLocal = aMouseGlobal;
|
||||
#if TARGET_CARBON
|
||||
GrafPtr grafPort = reinterpret_cast<GrafPtr>(mTopLevelWidget->GetNativeData(NS_NATIVE_GRAPHIC));
|
||||
::SetPort(grafPort);
|
||||
WindowRef wind = reinterpret_cast<WindowRef>(mTopLevelWidget->GetNativeData(NS_NATIVE_DISPLAY));
|
||||
::SetPortWindowPort(wind);
|
||||
Rect savePortRect;
|
||||
::GetPortBounds(grafPort, &savePortRect);
|
||||
#else
|
||||
GrafPtr grafPort = static_cast<GrafPort*>(mTopLevelWidget->GetNativeData(NS_NATIVE_GRAPHIC));
|
||||
::SetPort(grafPort);
|
||||
Rect savePortRect = grafPort->portRect;
|
||||
#endif
|
||||
::GetWindowPortBounds(wind, &savePortRect);
|
||||
::SetOrigin(0, 0);
|
||||
::GlobalToLocal(&hitPointLocal);
|
||||
::SetOrigin(savePortRect.left, savePortRect.top);
|
||||
|
@ -1050,13 +1047,9 @@ PRBool nsMacEventHandler::HandleMouseDownEvent(
|
|||
case inDrag:
|
||||
{
|
||||
Point macPoint;
|
||||
#if TARGET_CARBON
|
||||
Rect portRect;
|
||||
::GetPortBounds(GetWindowPort(whichWindow), &portRect);
|
||||
::GetWindowPortBounds(whichWindow, &portRect);
|
||||
macPoint = topLeft(portRect);
|
||||
#else
|
||||
macPoint = topLeft(whichWindow->portRect);
|
||||
#endif
|
||||
::LocalToGlobal(&macPoint);
|
||||
mTopLevelWidget->MoveToGlobalPoint(macPoint.h, macPoint.v);
|
||||
if (nsnull != gRollupListener && (nsnull != gRollupWidget) ) {
|
||||
|
@ -1067,12 +1060,8 @@ PRBool nsMacEventHandler::HandleMouseDownEvent(
|
|||
|
||||
case inGrow:
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
Rect macRect;
|
||||
::GetWindowPortBounds ( whichWindow, &macRect );
|
||||
#else
|
||||
Rect macRect = whichWindow->portRect;
|
||||
#endif
|
||||
::LocalToGlobal(&topLeft(macRect));
|
||||
::LocalToGlobal(&botRight(macRect));
|
||||
mTopLevelWidget->Resize(macRect.right - macRect.left + 1, macRect.bottom - macRect.top + 1, PR_FALSE);
|
||||
|
@ -1139,12 +1128,8 @@ PRBool nsMacEventHandler::HandleMouseDownEvent(
|
|||
// Now that we have found the partcode it is ok to actually zoom the window
|
||||
ZoomWindow(whichWindow, partCode, (whichWindow == FrontWindow()));
|
||||
|
||||
#if TARGET_CARBON
|
||||
Rect macRect;
|
||||
::GetWindowPortBounds(whichWindow, &macRect);
|
||||
#else
|
||||
Rect macRect = whichWindow->portRect;
|
||||
#endif
|
||||
::LocalToGlobal(&topLeft(macRect));
|
||||
::LocalToGlobal(&botRight(macRect));
|
||||
mTopLevelWidget->Resize(macRect.right - macRect.left, macRect.bottom - macRect.top, PR_FALSE);
|
||||
|
@ -1290,16 +1275,10 @@ void nsMacEventHandler::ConvertOSEventToMouseEvent(
|
|||
|
||||
// get the widget hit and the hit point inside that widget
|
||||
Point hitPoint = aOSEvent.where;
|
||||
#if TARGET_CARBON
|
||||
GrafPtr grafPort = reinterpret_cast<GrafPtr>(mTopLevelWidget->GetNativeData(NS_NATIVE_GRAPHIC));
|
||||
::SetPort(grafPort);
|
||||
WindowRef wind = reinterpret_cast<WindowRef>(mTopLevelWidget->GetNativeData(NS_NATIVE_DISPLAY));
|
||||
::SetPortWindowPort(wind);
|
||||
Rect savePortRect;
|
||||
::GetPortBounds(grafPort, &savePortRect);
|
||||
#else
|
||||
GrafPtr grafPort = static_cast<GrafPort*>(mTopLevelWidget->GetNativeData(NS_NATIVE_GRAPHIC));
|
||||
::SetPort(grafPort);
|
||||
Rect savePortRect = grafPort->portRect;
|
||||
#endif
|
||||
::GetWindowPortBounds(wind, &savePortRect);
|
||||
::SetOrigin(0, 0);
|
||||
::GlobalToLocal(&hitPoint);
|
||||
::SetOrigin(savePortRect.left, savePortRect.top);
|
||||
|
@ -1380,16 +1359,10 @@ nsresult nsMacEventHandler::HandleOffsetToPosition(long offset,Point* thePoint)
|
|||
thePoint->v = mIMEPos.y;
|
||||
thePoint->h = mIMEPos.x;
|
||||
printf("local (x,y) = (%d, %d)\n", thePoint->h, thePoint->v);
|
||||
#if TARGET_CARBON
|
||||
GrafPtr grafPort = reinterpret_cast<GrafPtr>(mTopLevelWidget->GetNativeData(NS_NATIVE_GRAPHIC));
|
||||
::SetPort(grafPort);
|
||||
WindowRef wind = reinterpret_cast<WindowRef>(mTopLevelWidget->GetNativeData(NS_NATIVE_DISPLAY));
|
||||
::SetPortWindowPort(wind);
|
||||
Rect savePortRect;
|
||||
::GetPortBounds(grafPort, &savePortRect);
|
||||
#else
|
||||
GrafPtr grafPort = static_cast<GrafPort*>(mTopLevelWidget->GetNativeData(NS_NATIVE_GRAPHIC));
|
||||
::SetPort(grafPort);
|
||||
Rect savePortRect = grafPort->portRect;
|
||||
#endif
|
||||
::GetWindowPortBounds(wind, &savePortRect);
|
||||
::LocalToGlobal(thePoint);
|
||||
printf("global (x,y) = (%d, %d)\n", thePoint->h, thePoint->v);
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include <LowMem.h>
|
||||
#include <Devices.h>
|
||||
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
#ifndef topLeft
|
||||
#define topLeft(r) (((Point *) &(r))[0])
|
||||
#endif
|
||||
|
@ -351,11 +353,7 @@ void nsMacMessagePump::DoUpdate(EventRecord &anEvent)
|
|||
WindowPtr whichWindow = reinterpret_cast<WindowPtr>(anEvent.message) ;
|
||||
GrafPtr savePort;
|
||||
::GetPort(&savePort);
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
#else
|
||||
::SetPort(whichWindow);
|
||||
#endif
|
||||
::BeginUpdate(whichWindow);
|
||||
// The app can do its own updates here
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
|
@ -395,11 +393,7 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
|
||||
case inContent:
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
#else
|
||||
::SetPort(whichWindow);
|
||||
#endif
|
||||
if (IsWindowHilited(whichWindow))
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
else
|
||||
|
@ -409,19 +403,11 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
|
||||
case inDrag:
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
#else
|
||||
::SetPort(whichWindow);
|
||||
#endif
|
||||
if (!(anEvent.modifiers & cmdKey))
|
||||
::SelectWindow(whichWindow);
|
||||
#if TARGET_CARBON
|
||||
Rect screenRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &screenRect);
|
||||
#else
|
||||
Rect screenRect = (**::GetGrayRgn()).rgnBBox;
|
||||
#endif
|
||||
::DragWindow(whichWindow, anEvent.where, &screenRect);
|
||||
|
||||
// Dispatch the event because some windows may want to know that they have been moved.
|
||||
|
@ -431,18 +417,12 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
::GetMouse(&anEvent.where);
|
||||
::LocalToGlobal(&anEvent.where);
|
||||
#else
|
||||
#if TARGET_CARBON
|
||||
RgnHandle strucRgn = NewRgn();
|
||||
::GetWindowRegion ( whichWindow, kWindowStructureRgn, strucRgn );
|
||||
Rect strucRect;
|
||||
::GetRegionBounds(strucRgn, &strucRect);
|
||||
::SetPt(&anEvent.where, strucRect.left, strucRect.top);
|
||||
::DisposeRgn ( strucRgn );
|
||||
#else
|
||||
RgnHandle strucRgn = ((WindowPeek)whichWindow)->strucRgn;
|
||||
Rect* strucRect = &(*strucRgn)->rgnBBox;
|
||||
::SetPt(&anEvent.where, strucRect->left, strucRect->top);
|
||||
#endif
|
||||
#endif
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
break;
|
||||
|
@ -450,11 +430,7 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
|
||||
case inGrow:
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
#else
|
||||
::SetPort(whichWindow);
|
||||
#endif
|
||||
|
||||
// use the cmd-key to do the opposite of the DRAW_ON_RESIZE setting.
|
||||
Boolean cmdKeyDown = (anEvent.modifiers & cmdKey) != 0;
|
||||
|
@ -473,12 +449,9 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
::LocalToGlobal(&newPt);
|
||||
if (::DeltaPoint(oldPt, newPt))
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
Rect portRect;
|
||||
::GetWindowPortBounds(whichWindow, &portRect);
|
||||
#else
|
||||
Rect portRect = whichWindow->portRect;
|
||||
#endif
|
||||
|
||||
short width = newPt.h - origin.h;
|
||||
short height = newPt.v - origin.v;
|
||||
if (width < kMinWindowWidth)
|
||||
|
@ -509,24 +482,17 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
Rect sizeRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &sizeRect);
|
||||
#else
|
||||
Rect sizeRect = (**::GetGrayRgn()).rgnBBox;
|
||||
#endif
|
||||
|
||||
sizeRect.top = kMinWindowHeight;
|
||||
sizeRect.left = kMinWindowWidth;
|
||||
long newSize = ::GrowWindow(whichWindow, anEvent.where, &sizeRect);
|
||||
if (newSize != 0)
|
||||
::SizeWindow(whichWindow, newSize & 0x0FFFF, (newSize >> 16) & 0x0FFFF, true);
|
||||
::DrawGrowIcon(whichWindow);
|
||||
#if TARGET_CARBON
|
||||
Rect portRect;
|
||||
Point newPt = botRight(*::GetWindowPortBounds(whichWindow, &portRect));
|
||||
#else
|
||||
Point newPt = botRight(whichWindow->portRect);
|
||||
#endif
|
||||
::LocalToGlobal(&newPt);
|
||||
anEvent.where = newPt; // important!
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
|
@ -536,11 +502,7 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
|
||||
case inGoAway:
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
#else
|
||||
::SetPort(whichWindow);
|
||||
#endif
|
||||
if (::TrackGoAway(whichWindow, anEvent.where))
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
break;
|
||||
|
@ -560,33 +522,22 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
Boolean sectFlag;
|
||||
|
||||
GetPort(&savePort);
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
Rect windRect;
|
||||
::GetWindowPortBounds(whichWindow, &windRect);
|
||||
::EraseRect(&windRect);
|
||||
#else
|
||||
SetPort(whichWindow);
|
||||
EraseRect(&whichWindow->portRect);
|
||||
#endif
|
||||
|
||||
if (partCode == inZoomOut) {
|
||||
#if !TARGET_CARBON
|
||||
WindowPeek wPeek = (WindowPeek)whichWindow;
|
||||
Rect windRect = whichWindow->portRect;
|
||||
#endif
|
||||
LocalToGlobal((Point *)&windRect.top);
|
||||
LocalToGlobal((Point *)&windRect.bottom);
|
||||
#if TARGET_CARBON
|
||||
|
||||
RgnHandle structRgn = ::NewRgn();
|
||||
::GetWindowRegion ( whichWindow, kWindowStructureRgn, structRgn );
|
||||
Rect structRgnBounds;
|
||||
::GetRegionBounds ( structRgn, &structRgnBounds );
|
||||
wTitleHeight = windRect.top - 1 - structRgnBounds.top;
|
||||
::DisposeRgn ( structRgn );
|
||||
#else
|
||||
wTitleHeight = windRect.top - 1 - (*(wPeek->strucRgn))->rgnBBox.top;
|
||||
#endif
|
||||
|
||||
windRect.top -= wTitleHeight;
|
||||
gdNthDevice = GetDeviceList();
|
||||
while (gdNthDevice)
|
||||
|
@ -612,11 +563,7 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
|
|||
tempRect.top + wTitleHeight + 3,
|
||||
tempRect.right - 64,
|
||||
tempRect.bottom - 3);
|
||||
#if TARGET_CARBON
|
||||
::SetWindowStandardState ( whichWindow, &zoomRect );
|
||||
#else
|
||||
(**(WStateDataHandle)(wPeek->dataHandle)).stdState = zoomRect;
|
||||
#endif
|
||||
}
|
||||
|
||||
SetPort(savePort);
|
||||
|
@ -782,11 +729,7 @@ extern const PRInt16 kAppleMenuID; // Danger Will Robinson!!! - this currently r
|
|||
void nsMacMessagePump::DoActivate(EventRecord &anEvent)
|
||||
{
|
||||
WindowPtr whichWindow = (WindowPtr)anEvent.message;
|
||||
#if TARGET_CARBON
|
||||
::SetPortWindowPort(whichWindow);
|
||||
#else
|
||||
::SetPort(whichWindow);
|
||||
#endif
|
||||
if (anEvent.modifiers & activeFlag)
|
||||
{
|
||||
::BringToFront(whichWindow);
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <Script.h>
|
||||
#include <TextServices.h>
|
||||
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -80,15 +82,9 @@ nsMacTSMMessagePump::~nsMacTSMMessagePump()
|
|||
err = AERemoveEventHandler(kTextServiceClass,kUpdateActiveInputArea,mUpdateUPP,false);
|
||||
NS_ASSERTION(err==noErr,"nsMacTSMMessagePump::InstallTSMAEHandlers: AEInstallEventHandlers[Update] failed");
|
||||
|
||||
#if TARGET_CARBON
|
||||
(void)DisposeAEEventHandlerUPP(mPos2OffsetUPP);
|
||||
(void)DisposeAEEventHandlerUPP(mOffset2PosUPP);
|
||||
(void)DisposeAEEventHandlerUPP(mUpdateUPP);
|
||||
#else
|
||||
(void)DisposeRoutineDescriptor(mPos2OffsetUPP);
|
||||
(void)DisposeRoutineDescriptor(mOffset2PosUPP);
|
||||
(void)DisposeRoutineDescriptor(mUpdateUPP);
|
||||
#endif
|
||||
::DisposeAEEventHandlerUPP(mPos2OffsetUPP);
|
||||
::DisposeAEEventHandlerUPP(mOffset2PosUPP);
|
||||
::DisposeAEEventHandlerUPP(mUpdateUPP);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -280,7 +276,7 @@ pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent,
|
|||
}
|
||||
|
||||
#if TARGET_CARBON
|
||||
// ¥¥¥ Fix Me !!!!!
|
||||
// ¥¥¥ Fix Me! Can't access |text.dataHandle| under Carbon!!!!!
|
||||
res = eventHandler->HandleUpdateInputArea((char*)textPtr,textScript,fixLength,hiliteRangePtr);
|
||||
#else
|
||||
nsCAutoString mbcsText;
|
||||
|
@ -304,6 +300,7 @@ pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent,
|
|||
// clean up
|
||||
//
|
||||
#if !TARGET_CARBON
|
||||
// Can't access |hiliteRangeArray.dataHandle| under Carbon!!!!!
|
||||
if(hiliteRangePtr)
|
||||
::HUnlock(hiliteRangeArray.dataHandle);
|
||||
#endif
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
#include "nsIDragSession.h"
|
||||
#include "nsIDragSessionMac.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
#include <LowMem.h>
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
|
||||
// Define Class IDs -- i hate having to do this
|
||||
|
@ -278,11 +277,7 @@ nsMacWindow::~nsMacWindow()
|
|||
if (mWindowPtr)
|
||||
{
|
||||
if (mWindowMadeHere)
|
||||
#if TARGET_CARBON
|
||||
::DisposeWindow(mWindowPtr);
|
||||
#else
|
||||
::CloseWindow(mWindowPtr);
|
||||
#endif
|
||||
|
||||
// clean up DragManager stuff
|
||||
::RemoveTrackingHandler ( sDragTrackingHandlerUPP, mWindowPtr );
|
||||
|
@ -411,29 +406,15 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
|||
wRect.right --;
|
||||
wRect.bottom --;
|
||||
#endif
|
||||
#if TARGET_CARBON
|
||||
::OffsetRect(&wRect, hOffset, vOffset + ::GetMBarHeight());
|
||||
#else
|
||||
if (eWindowType_popup != mWindowType)
|
||||
::OffsetRect(&wRect, hOffset, vOffset + ::LMGetMBarHeight());
|
||||
::OffsetRect(&wRect, hOffset, vOffset + ::GetMBarHeight());
|
||||
else
|
||||
::OffsetRect(&wRect, hOffset, vOffset);
|
||||
#endif
|
||||
|
||||
// HACK!!!!! This really should be part of the window manager
|
||||
// Make sure window bottom of window doesn't exceed max monitor size
|
||||
#if TARGET_CARBON
|
||||
Rect tempRect;
|
||||
GetRegionBounds(GetGrayRgn(), &tempRect);
|
||||
#else
|
||||
RgnHandle theGrayRegion = GetGrayRgn();
|
||||
Rect tempRect;
|
||||
SetRect(&tempRect,
|
||||
(**theGrayRegion).rgnBBox.left,
|
||||
(**theGrayRegion).rgnBBox.top,
|
||||
(**theGrayRegion).rgnBBox.right,
|
||||
(**theGrayRegion).rgnBBox.bottom);
|
||||
#endif
|
||||
::GetRegionBounds(::GetGrayRgn(), &tempRect);
|
||||
|
||||
if (wRect.bottom > tempRect.bottom)
|
||||
{
|
||||
|
@ -441,11 +422,7 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
|||
wRect.bottom -= bottomPinDelta;
|
||||
}
|
||||
|
||||
#if TARGET_CARBON
|
||||
mWindowPtr = ::NewCWindow(nil, &wRect, "\p", false, wDefProcID, (WindowRef)-1, goAwayFlag, (long)nsnull);
|
||||
#else
|
||||
mWindowPtr = ::NewCWindow(nil, &wRect, "\p", false, wDefProcID, (GrafPort*)-1, goAwayFlag, (long)nsnull);
|
||||
#endif
|
||||
mWindowMadeHere = PR_TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -523,12 +500,14 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
|
|||
{
|
||||
if ( mAcceptsActivation )
|
||||
{
|
||||
Rect windowrect;
|
||||
Point topleft,botright;
|
||||
|
||||
::ShowWindow(mWindowPtr);
|
||||
::SelectWindow(mWindowPtr);
|
||||
windowrect = (**((WindowPeek)mWindowPtr)->contRgn).rgnBBox;
|
||||
RgnHandle contentRgn = NewRgn();
|
||||
::GetWindowRegion ( mWindowPtr, kWindowContentRgn, contentRgn );
|
||||
Rect windowrect;
|
||||
::GetRegionBounds(contentRgn, &windowrect);
|
||||
|
||||
// on some windows (with pop ups) the ::ShowWindow will not invalidate the parent
|
||||
// properly
|
||||
|
@ -598,17 +577,12 @@ NS_IMETHODIMP nsMacWindow::Move(PRInt32 aX, PRInt32 aY)
|
|||
return NS_OK;
|
||||
} else if (mWindowMadeHere){
|
||||
// make sure the window stays visible
|
||||
#if TARGET_CARBON
|
||||
Rect screenRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &screenRect);
|
||||
|
||||
Rect portBounds;
|
||||
::GetWindowPortBounds(mWindowPtr, &portBounds);
|
||||
short windowWidth = portBounds.right - portBounds.left;
|
||||
#else
|
||||
Rect screenRect = (**::GetGrayRgn()).rgnBBox;
|
||||
short windowWidth = mWindowPtr->portRect.right - mWindowPtr->portRect.left;
|
||||
#endif
|
||||
if (((PRInt32)aX) < screenRect.left - windowWidth)
|
||||
aX = screenRect.left - windowWidth;
|
||||
else if (((PRInt32)aX) > screenRect.right)
|
||||
|
@ -632,12 +606,7 @@ NS_IMETHODIMP nsMacWindow::Move(PRInt32 aX, PRInt32 aY)
|
|||
|
||||
// move the window if it has not been moved yet
|
||||
// (ie. if this function isn't called in response to a DragWindow event)
|
||||
#if TARGET_CARBON
|
||||
Point macPoint = topLeft(portBounds);
|
||||
#else
|
||||
Point macPoint;
|
||||
macPoint = topLeft(mWindowPtr->portRect);
|
||||
#endif
|
||||
::LocalToGlobal(&macPoint);
|
||||
if (macPoint.h != aX || macPoint.v != aY)
|
||||
::MoveWindow(mWindowPtr, aX, aY, false);
|
||||
|
@ -664,12 +633,8 @@ NS_IMETHODIMP nsMacWindow::Move(PRInt32 aX, PRInt32 aY)
|
|||
//-------------------------------------------------------------------------
|
||||
void nsMacWindow::MoveToGlobalPoint(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
Rect screenRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &screenRect);
|
||||
#else
|
||||
Rect screenRect = (**::GetGrayRgn()).rgnBBox;
|
||||
#endif
|
||||
|
||||
if (mIsDialog) {
|
||||
aX -= kDialogMarginWidth;
|
||||
|
@ -690,12 +655,8 @@ NS_IMETHODIMP nsMacWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepai
|
|||
{
|
||||
if (mWindowMadeHere)
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
Rect macRect;
|
||||
::GetWindowPortBounds ( mWindowPtr, &macRect );
|
||||
#else
|
||||
Rect macRect = mWindowPtr->portRect;
|
||||
#endif
|
||||
#ifdef WINDOW_SIZE_TWEAKING
|
||||
macRect.right ++;
|
||||
macRect.bottom ++;
|
||||
|
@ -716,12 +677,8 @@ NS_IMETHODIMP nsMacWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepai
|
|||
|
||||
NS_IMETHODIMP nsMacWindow::GetScreenBounds(nsRect &aRect) {
|
||||
|
||||
#if TARGET_CARBON
|
||||
Rect screenRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &screenRect);
|
||||
#else
|
||||
Rect screenRect = (**::GetGrayRgn()).rgnBBox;
|
||||
#endif
|
||||
Rect screenRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &screenRect);
|
||||
|
||||
nsRect localBounds;
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "nsRegionMac.h"
|
||||
#include "nsIRollupListener.h"
|
||||
|
||||
#include "nsCarbonHelpers.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
nsIRollupListener * gRollupListener = nsnull;
|
||||
|
@ -66,31 +68,6 @@ static void blinkRect(Rect* r);
|
|||
static void blinkRgn(RgnHandle rgn);
|
||||
#endif
|
||||
|
||||
#if !TARGET_CARBON
|
||||
|
||||
// for non-carbon builds, provide various accessors to keep the code below free of ifdefs.
|
||||
inline void GetRegionBounds(RgnHandle region, Rect* rect)
|
||||
{
|
||||
*rect = (**region).rgnBBox;
|
||||
}
|
||||
|
||||
inline Boolean IsRegionComplex(RgnHandle region)
|
||||
{
|
||||
return (**region).rgnSize != sizeof(MacRegion);
|
||||
}
|
||||
|
||||
inline void GetWindowPortBounds(WindowRef window, Rect* rect)
|
||||
{
|
||||
*rect = window->portRect;
|
||||
}
|
||||
|
||||
inline void GetPortVisibleRegion(GrafPtr port, RgnHandle visRgn)
|
||||
{
|
||||
::CopyRgn(port->visRgn, visRgn);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -332,11 +309,7 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
|
|||
// Windows and GrafPorts are VERY different under Carbon, and we can no
|
||||
// longer pass them interchagably. When we ask for a GrafPort, we cannot
|
||||
// return a window or vice versa.
|
||||
#if TARGET_CARBON
|
||||
retVal = (void*)::GetWindowPort(mWindowPtr);
|
||||
#else
|
||||
retVal = (void*)mWindowPtr;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case NS_NATIVE_DISPLAY:
|
||||
|
@ -374,11 +347,7 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
|
|||
|
||||
// for compatibility with 4.X, this origin is what you'd pass
|
||||
// to SetOrigin.
|
||||
#if TARGET_CARBON
|
||||
mPluginPort->port = ::GetWindowPort(mWindowPtr);
|
||||
#else
|
||||
mPluginPort->port = CGrafPtr(mWindowPtr);
|
||||
#endif
|
||||
mPluginPort->portx = -point.x;
|
||||
mPluginPort->porty = -point.y;
|
||||
|
||||
|
@ -991,31 +960,6 @@ void nsWindow::EndDraw()
|
|||
NS_RELEASE(mTempRenderingContext);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsWindow::OnPaint(nsPaintEvent &event)
|
||||
{
|
||||
#ifdef NOTNOW
|
||||
if (debug_WantPaintFlashing() && event.rect ) {
|
||||
Rect flashRect;
|
||||
::SetRect ( &flashRect, event.rect->x, event.rect->y, event.rect->x + event.rect->width,
|
||||
event.rect->y + event.rect->height );
|
||||
::InvertRect ( &flashRect );
|
||||
for (int x = 0; x < 1000000; x++) ;
|
||||
::InvertRect ( &flashRect );
|
||||
for (int x = 0; x < 1000000; x++) ;
|
||||
::InvertRect ( &flashRect );
|
||||
for (int x = 0; x < 1000000; x++) ;
|
||||
::InvertRect ( &flashRect );
|
||||
for (int x = 0; x < 1000000; x++) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
// override this
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -1024,10 +968,8 @@ PRBool nsWindow::OnPaint(nsPaintEvent &event)
|
|||
void
|
||||
nsWindow::Flash(nsPaintEvent &aEvent)
|
||||
{
|
||||
Rect flashRect;
|
||||
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
Rect flashRect;
|
||||
if (debug_WantPaintFlashing() && aEvent.rect ) {
|
||||
::SetRect ( &flashRect, aEvent.rect->x, aEvent.rect->y, aEvent.rect->x + aEvent.rect->width,
|
||||
aEvent.rect->y + aEvent.rect->height );
|
||||
|
@ -1071,14 +1013,10 @@ NS_IMETHODIMP nsWindow::Update()
|
|||
if (!saveUpdateRgn)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if(mWindowPtr)
|
||||
#if TARGET_CARBON
|
||||
::GetWindowRegion(mWindowPtr, kWindowUpdateRgn, saveUpdateRgn);
|
||||
#else
|
||||
::CopyRgn(((WindowRecord*)mWindowPtr)->updateRgn, saveUpdateRgn);
|
||||
#endif
|
||||
GetWindowUpdateRegion ( mWindowPtr, saveUpdateRgn );
|
||||
|
||||
// draw the widget
|
||||
StPortSetter portSetter(mWindowPtr);
|
||||
StPortSetter portSetter(mWindowPtr);
|
||||
|
||||
::BeginUpdate(mWindowPtr);
|
||||
HandleUpdateEvent();
|
||||
|
@ -1098,11 +1036,8 @@ NS_IMETHODIMP nsWindow::Update()
|
|||
LocalToWindowCoordinate(bounds);
|
||||
Rect macRect;
|
||||
nsRectToMacRect(bounds, macRect);
|
||||
#if TARGET_CARBON
|
||||
|
||||
::ValidWindowRect(mWindowPtr, &macRect);
|
||||
#else
|
||||
::ValidRect(&macRect);
|
||||
#endif
|
||||
|
||||
reentrant = PR_FALSE;
|
||||
}
|
||||
|
@ -1225,13 +1160,10 @@ void nsWindow::UpdateWidget(nsRect& aRect, nsIRenderingContext* aContext)
|
|||
|
||||
// draw the widget
|
||||
StartDraw(aContext);
|
||||
if (OnPaint(paintEvent)){ // DC flashing support Support
|
||||
nsEventStatus eventStatus;
|
||||
DispatchWindowEvent(paintEvent,eventStatus);
|
||||
if(eventStatus != nsEventStatus_eIgnore){
|
||||
Flash(paintEvent);
|
||||
}
|
||||
}
|
||||
nsEventStatus eventStatus;
|
||||
DispatchWindowEvent(paintEvent,eventStatus);
|
||||
if(eventStatus != nsEventStatus_eIgnore)
|
||||
Flash(paintEvent);
|
||||
EndDraw();
|
||||
|
||||
// beard: Since we clip so aggressively, drawing from front to back should work,
|
||||
|
@ -1368,11 +1300,7 @@ nsWindow :: ScrollBits ( Rect & inRectToScroll, PRInt32 inLeftDelta, PRInt32 inT
|
|||
::UnionRgn(nonVisableRgn, updateRgn, updateRgn);
|
||||
}
|
||||
|
||||
#if TARGET_CARBON
|
||||
::InvalWindowRgn(mWindowPtr, updateRgn);
|
||||
#else
|
||||
::InvalRgn(updateRgn);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -152,7 +152,6 @@ public:
|
|||
|
||||
virtual void StartDraw(nsIRenderingContext* aRenderingContext = nsnull);
|
||||
virtual void EndDraw();
|
||||
virtual PRBool OnPaint(nsPaintEvent &event);
|
||||
NS_IMETHOD Update();
|
||||
virtual void UpdateWidget(nsRect& aRect, nsIRenderingContext* aContext);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче