Index: aqua/inc/VCLApplication.h =================================================================== RCS file: aqua/inc/VCLApplication.h diff -N aqua/inc/VCLApplication.h --- aqua/inc/VCLApplication.h 9 Sep 2005 10:30:10 -0000 1.10 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLAPPLICATION_H -#define _SV_VCLAPPLICATION_H - -#ifndef _SV_SV_H -#include -#endif - -#ifndef __cplusplus - -#include -#import -#include - -// ------------------ -// - VCLApplication - -// ------------------ - -@interface VCLApplication : NSApplication -- (MacOSBOOL)applicationShouldTerminate: (NSApplication *)sender; -- (void)sendEvent: (NSEvent *)anEvent; -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Invokes [VCLApplication sharedApplication] -void VCLApplication_SharedApplication(); - -// Invokes [VCLApplication run] -void VCLApplication_Run( BOOL bWait ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLAPPLICATION_H Index: aqua/inc/VCLAutoreleasePool.h =================================================================== RCS file: aqua/inc/VCLAutoreleasePool.h diff -N aqua/inc/VCLAutoreleasePool.h --- aqua/inc/VCLAutoreleasePool.h 9 Sep 2005 10:30:28 -0000 1.8 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,71 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLAUTORELEASEPOOL_H -#define _SV_VCLAUTORELEASEPOOL_H - -typedef void *VCLAUTORELEASEPOOL; - -#ifndef __cplusplus - -#include -#import -#include - -// ---------------------- -// - VCLAutoreleasePool - -// ---------------------- - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Invokes [[VCLAutoreleasePool new] init] -VCLAUTORELEASEPOOL VCLAutoreleasePool_Init(); - -// Invokes [VCLAutoreleasePool release] -void VCLAutoreleasePool_Release( VCLAUTORELEASEPOOL hReleasepool ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLAUTORELEASEPOOL_H Index: aqua/inc/VCLEvent.h =================================================================== RCS file: aqua/inc/VCLEvent.h diff -N aqua/inc/VCLEvent.h --- aqua/inc/VCLEvent.h 9 Sep 2005 10:30:41 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,73 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLEVENT_H -#define _SV_VCLEVENT_H - -#ifndef _SV_SV_H -#include -#endif - -#ifndef __cplusplus - -#include -#import -#include - -// ----------- -// - VCLEvent - -// ----------- - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Start sending NSPeriodic events -void VCLEvent_StartPeriodicEvents( ULONG nDelay ); - -// Stop sending NSPeriodic events -void VCLEvent_StopPeriodicEvents(); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLEVENT_H Index: aqua/inc/VCLGraphics.h =================================================================== RCS file: aqua/inc/VCLGraphics.h diff -N aqua/inc/VCLGraphics.h --- aqua/inc/VCLGraphics.h 9 Sep 2005 10:30:57 -0000 1.20 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,100 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLGRAPHICS_H -#define _SV_VCLGRAPHICS_H - -typedef void *VCLGRAPHICS; - -#ifndef _SV_SV_H -#include -#endif - -#ifndef _SV_VCLVIEW_H -#include -#endif -#ifndef _SV_VCLWINDOW_H -#include -#endif - -#include -#include -#include - -#ifndef __cplusplus - -#include -#import -#include - -// --------------- -// - VCLGraphics - -// --------------- - -@interface VCLGraphics : NSObject - -// Get, and lock, a QuickDraw View - -+ (CGrafPtr)LockFocusCGrafPort: (VCLView *)hView; - -// Close, and unlock, a QuickDraw View - -+ (void)UnLockFocusCGrafPort: (VCLView *)hView; - -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Get, and lock, a QuickDraw View - -CGrafPtr VCLGraphics_LockFocusCGrafPort ( VCLVIEW hView ); - -// Close, and unlock, a QuickDraw View - -void VCLGraphics_UnLockFocusCGrafPort ( VCLVIEW hView ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLGRAPHICS_H Index: aqua/inc/VCLView.h =================================================================== RCS file: aqua/inc/VCLView.h diff -N aqua/inc/VCLView.h --- aqua/inc/VCLView.h 9 Sep 2005 10:31:11 -0000 1.8 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,75 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLVIEW_H -#define _SV_VCLVIEW_H - -typedef void *VCLVIEW; - -#ifndef __cplusplus - -#include -#import -#include - -// ----------- -// - VCLView - -// ----------- - -@interface VCLView : NSQuickDrawView -{ -int qdRgnResized; -} -- init; -- (void)drawRect: (NSRect)aRect; -- (void)lockFocus; -- (MacOSBOOL)isOpaque; -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLVIEW_H Index: aqua/inc/VCLWindow.h =================================================================== RCS file: aqua/inc/VCLWindow.h diff -N aqua/inc/VCLWindow.h --- aqua/inc/VCLWindow.h 9 Sep 2005 10:31:48 -0000 1.26 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,117 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLWINDOW_H -#define _SV_VCLWINDOW_H - -typedef void *VCLWINDOW; - -#ifndef _SV_SALFRAME_HXX -#include -#endif - -#ifndef _SV_VCLVIEW_H -#include -#endif - -#ifndef __cplusplus - -#include -#import -#include - -// ------------- -// - VCLWindow - -// ------------- - -@interface VCLWindow : NSWindow -{ -@public - // Important: these data members must be explicitly set before using this - // class. Otherwise, none of the rest of the methods in this class will - // work properly. - SalFrame *mpSalFrame; - struct SalFrameData *mpSalFrameData; -} -- (void)setContentSize: (NSSize)aSize; -- (void)windowDidBecomeKey: (NSNotification *)aNotification; -- (void)windowDidResignKey: (NSNotification *)aNotification; -- (MacOSBOOL)windowShouldClose: (id)sender; -- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)proposedFrameSize; -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Instantiate a native VCLWindow. -VCLWINDOW VCLWindow_New( ULONG nSalFrameStyle, VCLWINDOW hParentWindow, - SalFrame *pFrame, struct SalFrameData *pFrameData ); - -// Get VCLWindow contentView -VCLVIEW VCLWindow_ContentView( VCLWINDOW hWindow ); - -// Display VCLWindow -void VCLWindow_Show( VCLWINDOW hWindow ); - -// Hide VCLWindow -void VCLWindow_Close( VCLWINDOW hWindow ); - -// Release a native VCLWindow -void VCLWindow_Release( VCLWINDOW hWindow ); - -// Set the title for VCLWindow -void VCLWindow_SetTitle( VCLWINDOW hWindow, const char *pTitle ); - -// Set the size of a VCLWindow -void VCLWindow_SetSize( VCLWINDOW hWindow, long nWidth, long nHeight ); - -// Post an NSApplicationDefined event to the event queue -BOOL VCLWindow_PostEvent( VCLWINDOW hWindow, void *pData ); - -// Sound a beep -void VCLWindow_Beep(); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLWINDOW_H Index: aqua/inc/aquavcltypes.h =================================================================== RCS file: aqua/inc/aquavcltypes.h diff -N aqua/inc/aquavcltypes.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/inc/aquavcltypes.h 27 Feb 2006 21:33:52 -0000 1.1.2.3 @@ -0,0 +1,11 @@ +#ifndef _AQUAVCLTYPES_H +#define _AQUAVCLTYPES_H + +#include +#include +#include + +typedef WindowRef CarbonWindowRef; +typedef ControlRef CarbonViewRef; + +#endif _AQUAVCLTYPES_H Index: aqua/inc/salbmp.h =================================================================== RCS file: aqua/inc/salbmp.h diff -N aqua/inc/salbmp.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/inc/salbmp.h 27 Nov 2005 09:48:14 -0000 1.1.2.1 @@ -0,0 +1,131 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALBMP_H +#define _SV_SALBMP_H + +#ifndef _GEN_HXX +#include +#endif + +#ifndef _SV_SV_H +#include +#endif + +#ifndef _SV_SALBTYPE_HXX +#include +#endif + +#ifndef _SV_SALDATA_HXX +#include +#endif + +#ifndef _SV_SALINST_HXX +#include +#endif + +#ifndef _SV_SALCONST_H +#include +#endif + +#ifndef _SV_SALVD_HXX +#include +#endif + +#ifndef _SV_SALCOLORUTILS_HXX +#include +#endif + +#ifndef _SV_SALPIXMAPUTILS_HXX +#include +#endif + +#ifndef _SV_SALRECTANGLEUTILS_HXX +#include +#endif + +#ifndef _SV_SALBMP_HXX +#include +#endif + +#ifndef _SV_SALGDI_H +#include +#endif + +// -------------- +// - SalBitmap - +// -------------- + +struct BitmapBuffer; +class BitmapColor; +class BitmapPalette; +class AquaSalVirtualDevice; +class AquaSalGraphics; + +class AquaSalBitmap : public SalBitmap +{ +private: + + AquaSalVirtualDevice *mpVirDev; + PixMapHandle mhPixMap; + Size mnSize; + USHORT mnBitCount; + +public: + + AquaSalBitmap(); + ~AquaSalBitmap(); + +public: + + bool Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); + bool Create( const SalBitmap& rSalBmp ); + bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); + bool Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ); + + void Destroy(); + + Size GetSize() const { return mnSize; } + USHORT GetBitCount() const { return mnBitCount; } + + BitmapBuffer *AcquireBuffer( bool bReadOnly ); + void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); + + AquaSalGraphics *GetGraphics(); + void ReleaseGraphics( SalGraphics* pGraphics ); + bool GetSystemData( BitmapSystemData& rData ); +}; + +#endif // _SV_SALBMP_HXX Index: aqua/inc/saldata.hxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/saldata.hxx,v retrieving revision 1.12 retrieving revision 1.12.112.2 diff -u -r1.12 -r1.12.112.2 --- aqua/inc/saldata.hxx 9 Sep 2005 10:33:28 -0000 1.12 +++ aqua/inc/saldata.hxx 2 Mar 2006 00:31:02 -0000 1.12.112.2 @@ -52,9 +52,9 @@ #include #endif -#ifndef _SV_VCLWINDOW_H - #include -#endif +//#ifndef _SV_VCLWINDOW_H +// #include +//#endif #ifdef __cplusplus @@ -109,5 +109,11 @@ BOOL SalGetAppQuit(); #endif // __cplusplus + +// --- Prototypes --- + +BOOL ImplSalYieldMutexTryToAcquire(); +void ImplSalYieldMutexAcquire(); +void ImplSalYieldMutexRelease(); #endif // _SV_SALDATA_HXX Index: aqua/inc/salframe.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salframe.h,v retrieving revision 1.15 retrieving revision 1.15.112.6 diff -u -r1.15 -r1.15.112.6 --- aqua/inc/salframe.h 9 Sep 2005 10:33:56 -0000 1.15 +++ aqua/inc/salframe.h 27 Feb 2006 21:33:52 -0000 1.15.112.6 @@ -40,28 +40,161 @@ #include #endif -#ifndef _SV_VCLWINDOW_H -#include -#endif #ifndef _SV_SYSDATA_HXX #include #endif +#include + +#include + +class AquaSalGraphics; +class AquaSalFrame; + +typedef struct SalFrame::SalPointerState SalPointerState; + // ---------------- -// - SalFrameData - +// - AquaSalFrame - // ---------------- -struct SalFrameData +class AquaSalFrame : public SalFrame { - VCLWINDOW mhWnd; // Window handle - SalGraphics* mpGraphics; // current frame graphics - SalFrame* mpNextFrame; // pointer to next frame - SalFrame* mpParent; // pointer to parent frame +public: + CarbonWindowRef mhWnd; // Window handle + AquaSalGraphics* mpGraphics; // current frame graphics + AquaSalFrame* mpNextFrame; // pointer to next frame + AquaSalFrame* mpParent; // pointer to parent frame void* mpInst; // instance handle for callback SALFRAMEPROC mpProc; // callback proc long mnWidth; // client width in pixels long mnHeight; // client height in pixels + int mnMinWidth; // min. client width in pixeln + int mnMinHeight; // min. client height in pixeln + int mnMaxWidth; // max. client width in pixeln + int mnMaxHeight; // max. client height in pixeln BOOL mbGraphics; // is Graphics used? + + /*HWND mhWnd; // Window handle + HCURSOR mhCursor; // cursor handle + HIMC mhDefIMEContext; // default IME-Context + WinSalGraphics* mpGraphics; // current frame graphics + WinSalGraphics* mpGraphics2; // current frame graphics for other threads + WinSalFrame* mpNextFrame; // pointer to next frame + HMENU mSelectedhMenu; // the menu where highlighting is currently going on + HMENU mLastActivatedhMenu; // the menu that was most recently opened + SystemEnvData maSysData; // system data + SalFrameState maState; // frame state + int mnShowState; // show state + RECT maFullScreenRect; // fullscreen rect + int mnFullScreenShowState; // fullscreen restore show state + UINT mnInputLang; // current Input Language + UINT mnInputCodePage; // current Input CodePage + ULONG mnStyle; // style + BOOL mbGraphics; // is Graphics used + BOOL mbCaption; // has window a caption + BOOL mbBorder; // has window a border + BOOL mbFixBorder; // has window a fixed border + BOOL mbSizeBorder; // has window a sizeable border + BOOL mbNoIcon; // is an window without an icon + BOOL mbFloatWin; // is a FloatingWindow + BOOL mbFullScreen; // TRUE: in full screen mode + BOOL mbPresentation; // TRUE: Presentation Mode running + BOOL mbInShow; // innerhalb eines Show-Aufrufs + BOOL mbRestoreMaximize; // Restore-Maximize + BOOL mbInMoveMsg; // Move-Message wird verarbeitet + BOOL mbInSizeMsg; // Size-Message wird verarbeitet + BOOL mbFullScreenToolWin; // WS_EX_TOOLWINDOW reset in FullScreenMode + BOOL mbDefPos; // default-position + BOOL mbOverwriteState; // TRUE: WindowState darf umgesetzt werden + BOOL mbIME; // TRUE: We are in IME Mode + BOOL mbHandleIME; // TRUE: Wir handeln die IME-Messages + BOOL mbSpezIME; // TRUE: Spez IME + BOOL mbAtCursorIME; // TRUE: Wir behandeln nur einige IME-Messages + BOOL mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus + static BOOL mbInReparent; // TRUE: ignore focus lost and gain due to reparenting*/ + +public: + AquaSalFrame(); + AquaSalFrame(SalFrame* pParent, ULONG salFrameStyle); + + virtual ~AquaSalFrame(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual BOOL PostEvent( void* pData ); + virtual void SetTitle( const XubString& rTitle ); + virtual void SetIcon( USHORT nIcon ); + virtual void SetMenu( SalMenu* pSalMenu ); + virtual void DrawMenuBar(); + virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); + virtual void Enable( BOOL bEnable ); + virtual void SetMinClientSize( long nWidth, long nHeight ); + virtual void SetMaxClientSize( long nWidth, long nHeight ); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); + virtual void GetClientSize( long& rWidth, long& rHeight ); + virtual void GetWorkArea( Rectangle& rRect ); + virtual SalFrame* GetParent() const; + virtual void SetWindowState( const SalFrameState* pState ); + virtual BOOL GetWindowState( SalFrameState* pState ); + virtual void ShowFullScreen( BOOL bFullScreen ); + virtual void StartPresentation( BOOL bStart ); + virtual void SetAlwaysOnTop( BOOL bOnTop ); + virtual void ToTop( USHORT nFlags ); + virtual void SetPointer( PointerStyle ePointerStyle ); + virtual void CaptureMouse( BOOL bMouse ); + virtual void SetPointerPos( long nX, long nY ); + virtual void Flush(); + virtual void Sync(); + virtual void SetInputContext( SalInputContext* pContext ); + virtual void EndExtTextInput( USHORT nFlags ); + virtual String GetKeyName( USHORT nKeyCode ); + virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ); + virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); + virtual LanguageType GetInputLanguage(); + virtual SalBitmap* SnapShot(); + virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep( SoundType eSoundType ); + virtual const SystemEnvData* GetSystemData() const; + virtual SalPointerState GetPointerState(); + virtual void SetParent( SalFrame* pNewParent ); + virtual bool SetPluginParent( SystemParentData* pNewParent ); + virtual void SetExtendedFrameStyle( SalExtStyle ); + virtual void SetBackgroundBitmap( SalBitmap* ); + + virtual void SetClientSize( long nWidth, long nHeight ); + virtual void SetCallback( void* pInst, SALFRAMEPROC pProc ); + + private: + void InsertThisIntoFrameList(); + void RemoveThisFromFrameList(); }; + +// Instantiate a native VCLWindow. +CarbonWindowRef Carbon_NewWindow( ULONG nSalFrameStyle, AquaSalFrame *pParentFrame ); + +// Get VCLWindow contentView +OSStatus Carbon_GetWindowContentView( CarbonWindowRef hWindow, ControlRef hControl ); + +// Display VCLWindow +void Carbon_ShowWindow( CarbonWindowRef hWindow ); + +// Hide VCLWindow +void Carbon_CloseWindow( CarbonWindowRef hWindow ); + +// Release a native VCLWindow +void Carbon_CloseWindow( CarbonWindowRef hWindow ); + +// Set the title for VCLWindow +void Carbon_SetWindowTitle( CarbonWindowRef hWindow, const char *pTitle ); + +// Set the size of a VCLWindow +void Carbon_SetWindowSize( CarbonWindowRef hWindow, long nWidth, long nHeight ); + +// Post an NSApplicationDefined event to the event queue +BOOL Carbon_PostEventToWindow( CarbonWindowRef hWindow, void *pData ); + +// Sound a beep +void Carbon_BeepWindow(); +void Carbon_Beep(); #endif // _SV_SALFRAME_H Index: aqua/inc/salgdi.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salgdi.h,v retrieving revision 1.28 retrieving revision 1.28.112.5 diff -u -r1.28 -r1.28.112.5 --- aqua/inc/salgdi.h 9 Sep 2005 10:34:10 -0000 1.28 +++ aqua/inc/salgdi.h 27 Feb 2006 21:33:52 -0000 1.28.112.5 @@ -44,22 +44,114 @@ #include #endif -#ifndef _SV_VCLWINDOW_H - #include +#ifndef _SV_OUTFONT_HXX +#include #endif +#ifndef _SV_SALGDI_HXX + #include +#endif + +#ifndef _AQUAVCLTYPES_H + #include +#endif + +#include +//#include +class AquaSalBitmap; + +// mac specific physically available font face +class ImplMacFontData : public ImplFontData +{ +public: + rtl_TextEncoding meScript; + FontFamily meFamily; + FontType meType; + AquaSalSystem mpSysData; + + +public: + ImplMacFontData( const ImplDevFontAttributes&, + int nFontHeight, int macCharSet, + int nPitchAndFamily ); + ~ImplMacFontData(); + + virtual ImplFontData* Clone() const; + virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; + // void UpdateFromHDC( HDC ); + + bool HasChar( sal_uInt32 cChar ) const; + +// int GetCharSet() const { return meWinCharSet; } +// int GetPitchAndFamily() const { return mnPitchAndFamily; } +// bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; } +// bool SupportsKorean() const { return mbHasKoreanRange; } +// bool SupportsCJK() const { return mbHasCJKSupport; } +// bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } +// bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } + + ImplFontCharMap* GetImplFontCharMap(); + +private: +// bool mbDisableGlyphApi; +// bool mbHasKoreanRange; +// bool mbHasCJKSupport; +// +// ImplFontCharMap* mpUnicodeMap; +// +// // TODO: get rid of the members below needed to work with the Win9x non-unicode API +// int* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) +// int mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried +// int meWinCharSet; +// int mnPitchAndFamily; +// bool mbAliasSymbolsHigh; +// bool mbAliasSymbolsLow; + +private: +// void ReadCmapTable( HDC ); +// void ReadOs2Table( HDC ); + +#ifdef GNG_VERT_HACK +// void ReadGsubTable( HDC ) const; + + typedef std::hash_set IntHashSet; + mutable IntHashSet maGsubTable; + mutable bool mbGsubRead; +public: +// bool HasGSUBstitutions( HDC ) const; +// bool IsGSUBstituted( sal_Unicode ) const; +#endif // GNG_VERT_HACK +}; + // ------------------- // - Structures - // ------------------- -struct SalGraphicsData -{ - // NSView and NSWindow +//struct SalGraphicsData +//{ +//}; +// +//typedef struct SalGraphicsData SalGraphicsData; +//typedef SalGraphicsData *SalGraphicsDataPtr; +//typedef SalGraphicsDataPtr *SalGraphicsDataHandle; - VCLVIEW mhDC; // VCLVIEW - // QuickDraw graph port, offscreen graphic world, and graphic device handle +// ------------------- +// - AquaSalGraphics - +// ------------------- +class AquaSalGraphics : public SalGraphics +{ +public: + // NSView and NSWindow + + CarbonViewRef mhDC; // VCLVIEW + + CGContextRef mhContext; // graphics context for Quartz 2D + CarbonWindowRef mhWnd; // Window if this is a Window graphics + + // QuickDraw graph port, offscreen graphic world, and graphic device handle + CGrafPtr mpCGrafPort; // QD color graphics port GWorldPtr mpGWorld; // QD offscreen GWorld GDHandle mhGDevice; // QD GDevice @@ -71,48 +163,326 @@ BOOL mbGWorldPixelsNew; // GWorld pixels is brand new? GWorldFlags mnGWorldFlags; // GWorld pixels status flags PixMapHandle mhGWorldPixMap; // GWorld pixels - + // Clip region - + BOOL mbClipRgnChanged; // Did the clip region change? RgnHandle mhClipRgn; // Clip Region Handle - + // Font attributes - + short mnFontID; // Mac FontFamilyId short mnFontSize; // Mac Font Size RGBColor maFontColor; // Text Color Style mnFontStyle; // Mac Font Style - + // Pen attributes and status - + BOOL mbPenTransparent; // Is pen transparent? SInt32 mnPenMode; // Pen Mode RGBColor maPenColor; // Pen Color - + // Port's pen attributes - + SInt32 mnPortPenMode; // Port's pen mode MacOSPoint maPortPenSize; // Port's pen size; MacOSPoint maPortPenLocation; // Port's pen location PixPatHandle mhPortPenPattern; // Port's pen pattern - + // Brush attributes and status - + BOOL mbBrushTransparent; // Is brush transparent? RGBColor maBrushColor; // Brush Color - + // Miscellaneous status flags - + BOOL mbPrinter; // Is a printer available? BOOL mbVirDev; // Is a virtual device available? BOOL mbWindow; // Is a window availble? BOOL mbScreen; // Is this screen compatiable? OSStatus mnOSStatus; // The current MacOS error + + +public: + AquaSalGraphics(); + virtual ~AquaSalGraphics(); + +protected: + virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ); + virtual void drawPixel( long nX, long nY, SalColor nSalColor ); + virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); + virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); + virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); + virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); + virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, USHORT nFlags ); + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); + virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ); + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nTransparentColor ); + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap ); + virtual void drawMask( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nMaskColor ); + + virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); + virtual SalColor getPixel( long nX, long nY ); + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags); + virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + + virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); + + // native widget rendering methods that require mirroring + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + rtl::OUString aCaption ); + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + SalControlHandle& rControlHandle, rtl::OUString aCaption ); + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + const ImplControlValue& aValue, SalControlHandle& rControlHandle, rtl::OUString aCaption, + Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + +public: + // public SalGraphics methods, the interface to teh independent vcl part + + // get device resolution + virtual void GetResolution( long& rDPIX, long& rDPIY ); + // get resolution for fonts (an implementations specific adjustment, + // ideally would be the same as the Resolution) + virtual void GetScreenFontResolution( long& rDPIX, long& rDPIY ); + // get the depth of the device + virtual USHORT GetBitCount(); + // get the width of the device + virtual long GetGraphicsWidth(); + + // set the clip region to empty + virtual void ResetClipRegion(); + // begin setting the clip region, add rectangles to the + // region with the UnionClipRegion call + virtual void BeginSetClipRegion( ULONG nCount ); + // all rectangles were added and the clip region should be set now + virtual void EndSetClipRegion(); + + // set the line color to transparent (= don't draw lines) + virtual void SetLineColor(); + // set the line color to a specific color + virtual void SetLineColor( SalColor nSalColor ); + // set the fill color to transparent (= don't fill) + virtual void SetFillColor(); + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( SalColor nSalColor ); + // enable/disable XOR drawing + virtual void SetXORMode( BOOL bSet ); + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ); + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ); + // set the text color to a specific color + virtual void SetTextColor( SalColor nSalColor ); + // set the font + virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); + // get the current font's etrics + virtual void GetFontMetric( ImplFontMetricData* ); + // get kernign pairs of the current font + // return only PairCount if (pKernPairs == NULL) + virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); + // get the repertoire of the current font + virtual ImplFontCharMap* GetImplFontCharMap() const; + // graphics must fill supplied font list + virtual void GetDevFontList( ImplDevFontList* ); + // graphics should call ImplAddDevFontSubstitute on supplied + // OutputDevice for all its device specific preferred font substitutions + virtual void GetDevFontSubstList( OutputDevice* ); + virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); + // CreateFontSubset: a method to get a subset of glyhps of a font + // inside a new valid font file + // returns TRUE if creation of subset was successfull + // parameters: rToFile: contains a osl file URL to write the subset to + // pFont: describes from which font to create a subset + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // pWidths: the advance widths of the correspoding glyphs (in PS font units) + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, + ImplFontData* pFont, + long* pGlyphIDs, + sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter + ); + + // GetFontEncodingVector: a method to get the encoding map Unicode + // to font encoded character; this is only used for type1 fonts and + // may return NULL in case of unknown encoding vector + // if ppNonEncoded is set and non encoded characters (that is type1 + // glyphs with only a name) exist it is set to the corresponding + // map for non encoded glyphs; the encoding vector contains -1 + // as encoding for these cases + virtual const std::map< sal_Unicode, sal_Int32 >* GetFontEncodingVector( ImplFontData* pFont, const std::map< sal_Unicode, rtl::OString >** ppNonEncoded ); + + // GetEmbedFontData: gets the font data for a font marked + // embeddable by GetDevFontList or NULL in case of error + // parameters: pFont: describes the font in question + // pWidths: the widths of all glyphs from char code 0 to 255 + // pWidths MUST support at least 256 members; + // rInfo: additional outgoing information + // pDataLen: out parameter, contains the byte length of the returned buffer + virtual const void* GetEmbedFontData( ImplFontData* pFont, + const sal_Unicode* pUnicodes, + sal_Int32* pWidths, + FontSubsetInfo& rInfo, + long* pDataLen ); + // frees the font data again + virtual void FreeEmbedFontData( const void* pData, long nDataLen ); + + virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); + virtual BOOL GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ); + + virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); + virtual void DrawServerFontLayout( const ServerFontLayout& ); + + // Query the platform layer for control support + virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + + + + + + virtual void CopyBits( const SalTwoRect* pPosAry, + AquaSalGraphics* pSrcGraphics ); + + virtual BOOL UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); + + virtual void DrawPixel( long nX, long nY ); + + virtual void DrawPixel( long nX, long nY, SalColor nSalColor ); + + virtual void DrawLine( long nX1, long nY1, long nX2, long nY2 ); + + //virtual void DrawRect( long nX, long nY, long nWidth, long nHeight ); + +// virtual void DrawPolyLine( ULONG nPoints, const SalPoint *pPtAry ); +// +// virtual void DrawPolygon( ULONG nPoints, const SalPoint *pPtAry ); +// + virtual sal_Bool DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + + virtual sal_Bool DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + + virtual sal_Bool DrawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); + + virtual void DrawPolyPolygon( ULONG nPoly, const ULONG *pPoints, PCONSTSALPOINT *ppPtAry ); + + virtual void CopyArea( long nDstX, long nDstY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, USHORT nFlags ); + +// virtual void DrawBitmap( const SalTwoRect* pPosAry, AquaSalBitmap& rSalBitmap ); +// +// virtual void DrawBitmap( const SalTwoRect* pPosAry, AquaSalBitmap& rSalBitmap, SalColor nTransparentColor ); +// +// virtual void DrawBitmap( const SalTwoRect* pPosAry, AquaSalBitmap& rSalBitmap, AquaSalBitmap& rTransparentBitmap ); +// + virtual void DrawMask( const SalTwoRect* pPosAry, AquaSalBitmap& rSalBitmap, SalColor nMaskColor ); + + virtual SalBitmap* GetBitmap( long nX, + long nY, + long nDX, + long nDY ); + + virtual SalColor GetPixel( long nX, + long nY + ); + + virtual void Invert( long nX, + long nY, + long nWidth, + long nHeight, + SalInvert nFlags + ); + + virtual void Invert( ULONG nPoints, + const SalPoint* pPtAry, + SalInvert nSalFlags + ); + + virtual BOOL DrawEPS( long nX, + long nY, + long nWidth, + long nHeight, + void* pPtr, + ULONG nSize + ); + + virtual USHORT SetFont( ImplFontSelectData* pFont ); + + virtual long GetCharWidth( sal_Unicode nChar1, + sal_Unicode nChar2, + long* pWidthAry + ); + + virtual ULONG GetFontCodeRanges( sal_uInt32* pCodePairs ) const; + + virtual void DrawText( long nX, + long nY, + const xub_Unicode *pStr, + xub_StrLen nLen + ); + + virtual void DrawTextArray( long nX, + long nY, + const xub_Unicode* pStr, + xub_StrLen nLen, + const long* pDXAry + ); + + virtual BOOL GetGlyphBoundRect( xub_Unicode cChar, + long* pX, + long* pY, + long* pWidth, + long* pHeight + ); + }; -typedef struct SalGraphicsData SalGraphicsData; -typedef SalGraphicsData *SalGraphicsDataPtr; -typedef SalGraphicsDataPtr *SalGraphicsDataHandle; +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + // Get, and lock, a QuickDraw View + + CGrafPtr VCLGraphics_LockFocusCGrafPort ( CarbonViewRef hView ); + + // Close, and unlock, a QuickDraw View + + void VCLGraphics_UnLockFocusCGrafPort ( CarbonViewRef hView ); + +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // _SV_SALGDI_H Index: aqua/inc/salgdiutils.hxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salgdiutils.hxx,v retrieving revision 1.6 retrieving revision 1.6.112.2 diff -u -r1.6 -r1.6.112.2 --- aqua/inc/salgdiutils.hxx 9 Sep 2005 10:34:27 -0000 1.6 +++ aqua/inc/salgdiutils.hxx 16 Feb 2006 21:36:31 -0000 1.6.112.2 @@ -52,17 +52,13 @@ #include #endif -#ifndef _SV_VCLGRAPHICS_H - #include -#endif - #ifndef _SV_SALCOLORUTILS_HXX #include #endif // ------------------------------------------------------------------ -short SelectCopyMode ( const SalGraphicsDataPtr pSalGraphicsData ); +short SelectCopyMode ( const AquaSalGraphics *pSalGraphicsData ); // ------------------------------------------------------------------ @@ -82,31 +78,31 @@ // ------------------------------------------------------------------ -BOOL LockGraphics ( SalGraphics *rSalGraphics ); +BOOL LockGraphics ( AquaSalGraphics *rSalGraphics ); -BOOL UnlockGraphics ( SalGraphics *rSalGraphics ); +BOOL UnlockGraphics ( AquaSalGraphics *rSalGraphics ); // ------------------------------------------------------------------ -BOOL BeginGraphics ( SalGraphicsDataPtr rSalGraphicsData ); +BOOL BeginGraphics ( AquaSalGraphics *pSalGraphics ); -BOOL EndGraphics ( SalGraphicsDataPtr rSalGraphicsData ); +BOOL EndGraphics ( AquaSalGraphics *pSalGraphics ); // ------------------------------------------------------------------ -void InitBrush ( SalGraphicsDataPtr rSalGraphicsData ); +void InitBrush ( AquaSalGraphics *pSalGraphics ); -void InitFont ( SalGraphicsDataPtr rSalGraphicsData ); +void InitFont ( AquaSalGraphics *pSalGraphics ); -void InitGWorld ( SalGraphicsDataPtr rSalGraphicsData ); +void InitGWorld ( AquaSalGraphics *pSalGraphics ); -void InitPen ( SalGraphicsDataPtr rSalGraphicsData ); +void InitPen ( AquaSalGraphics *pSalGraphics ); -void InitQD ( SalGraphicsDataPtr rSalGraphicsData ); +void InitQD ( AquaSalGraphics *pSalGraphics ); -void InitRegions ( SalGraphicsDataPtr rSalGraphicsData ); +void InitRegions ( AquaSalGraphics *pSalGraphics ); -void InitStatusFlags ( SalGraphicsDataPtr rSalGraphicsData ); +void InitStatusFlags ( AquaSalGraphics *pSalGraphics ); // ------------------------------------------------------------------ Index: aqua/inc/salinst.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salinst.h,v retrieving revision 1.10 retrieving revision 1.10.110.3 diff -u -r1.10 -r1.10.110.3 --- aqua/inc/salinst.h 9 Sep 2005 10:34:41 -0000 1.10 +++ aqua/inc/salinst.h 16 Feb 2006 21:36:32 -0000 1.10.110.3 @@ -46,9 +46,12 @@ #include #endif -#ifndef _SV_VCLWINDOW_H -#include -#endif +#include +#include +#include +#include +#include +#include #ifdef __cplusplus @@ -82,12 +85,78 @@ // - SalInstanceData - // ------------------- -struct SalInstanceData +//struct SalInstanceData +//{ +//public: +//}; + +// ------------------ +// - AquaSalInstance - +// ------------------ + +class AquaSalInstance : public SalInstance { public: void* mpFilterInst; void* mpFilterCallback; SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex +public: + AquaSalInstance(); + virtual ~AquaSalInstance(); + + virtual SalSystem* CreateSystem(); + virtual void DestroySystem(SalSystem*); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); + virtual void DestroyFrame( SalFrame* pFrame ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData ); + virtual void DestroyObject( SalObject* pObject ); + virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, + USHORT nBitCount, const SystemGraphicsData *pData ); + virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); + + virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ); + virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ); + virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ); + virtual void DestroyPrinter( SalPrinter* pPrinter ); + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ); + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ); + virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ); + virtual String GetDefaultPrinter(); + virtual SalSound* CreateSalSound(); + virtual SalTimer* CreateSalTimer(); + virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics ); + virtual SalI18NImeStatus* CreateI18NImeStatus(); + virtual SalSystem* CreateSalSystem(); + virtual SalBitmap* CreateSalBitmap(); + virtual vos::IMutex* GetYieldMutex(); + virtual ULONG ReleaseYieldMutex(); + virtual void AcquireYieldMutex( ULONG nCount ); + virtual void Yield( BOOL bWait ); + virtual bool AnyInput( USHORT nType ); + virtual SalMenu* CreateMenu( BOOL bMenuBar ); + virtual void DestroyMenu( SalMenu* ); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual void DestroyMenuItem( SalMenuItem* ); + virtual SalSession* CreateSalSession(); + virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); }; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + // Invokes [VCLApplication run] + void VCLApplication_Run( BOOL bWait ); + +#ifdef __cplusplus +} +#endif // __cplusplus + + #endif // _SV_SALINST_H Index: aqua/inc/salobj.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salobj.h,v retrieving revision 1.5 retrieving revision 1.5.112.1 diff -u -r1.5 -r1.5.112.1 --- aqua/inc/salobj.h 9 Sep 2005 10:35:10 -0000 1.5 +++ aqua/inc/salobj.h 27 Nov 2005 09:48:16 -0000 1.5.112.1 @@ -44,16 +44,57 @@ #include #endif +#include + +class AquaSalFrame; +class AquaSalObject; + + // ----------------- // - SalObjectData - // ----------------- struct SalObjectData { - SalFrame* mpFrame; // parent frame - SalObject* mpNextObject; // pointer to next object +}; + +class AquaSalObject : public SalObject +{ +public: + AquaSalFrame* mpFrame; // parent frame + AquaSalObject* mpNextObject; // pointer to next object void* mpInst; // instance handle for callback SALOBJECTPROC mpProc; // callback proc + + +// HWND mhWnd; // Window handle +// HWND mhWndChild; // Child Window handle +// HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte +// SystemChildData maSysData; // SystemEnvData +// RGNDATA* mpClipRgnData; // ClipRegion-Data +// RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data +// RECT* mpNextClipRect; // Naechstes ClipRegion-Rect +// BOOL mbFirstClipRect; // Flag for first cliprect to insert +// WinSalObject* mpNextObject; // pointer to next object + + + AquaSalObject(); + virtual ~AquaSalObject(); + + virtual void ResetClipRegion(); + virtual USHORT GetClipRegionType(); + virtual void BeginSetClipRegion( ULONG nRects ); + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); + virtual void EndSetClipRegion(); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); + virtual void Show( BOOL bVisible ); + virtual void Enable( BOOL nEnable ); + virtual void GrabFocus(); + virtual void SetBackground(); + virtual void SetBackground( SalColor nSalColor ); + virtual const SystemEnvData* GetSystemData() const; + + virtual void SetCallback( void* pInst, SALOBJECTPROC pProc ); }; #endif // _SV_SALOBJ_H Index: aqua/inc/salogl.h =================================================================== RCS file: aqua/inc/salogl.h diff -N aqua/inc/salogl.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/inc/salogl.h 27 Feb 2006 21:33:53 -0000 1.1.2.2 @@ -0,0 +1,118 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALOGL_H +#define _SV_SALOGL_H + +//#if defined EXPLICITLY_INCLUDE_GLX_H +//#include +//#define GL_H +//#include +//#include +//#else +//typedef void* GLXContext; +//typedef XID GLXDrawable; +//// needed GLX_ constants +//#define GLX_USE_GL 1 +//#define GLX_DOUBLEBUFFER 5 +//#endif + +#ifndef _SV_SALOGL_HXX +#include +#endif + +#ifndef _OSL_MODULE_H +#include +#endif + +// ------------- +// - SalOpenGL - +// ------------- + +class SalGraphics; + +class AquaSalOpenGL : public SalOpenGL +{ +private: + static CarbonViewRef mhOGLLastDC; + static ULONG mnOGLState; + + // static oslModule mpGLLib; +// static GLXContext maGLXContext; +// static ULONG mnOGLState; +// static Display* mpDisplay; +// static XVisualInfo* mpVisualInfo; +// static BOOL mbHaveGLVisual; +// +// static BOOL ImplInit(); +// +// static GLXContext (*pCreateContext)( Display *, XVisualInfo *, GLXContext, Bool ); +// static void (*pDestroyContext)( Display *, GLXContext ); +// static GLXContext (*pGetCurrentContext)( ); +// static Bool (*pMakeCurrent)( Display *, GLXDrawable, GLXContext ); +// static void (*pSwapBuffers)( Display*, GLXDrawable ); +// static int (*pGetConfig)( Display*, XVisualInfo*, int, int* ); +// static void (*pFlush)(); +// +// Drawable maDrawable; +// +// static void* resolveSymbol( const char* pSym ); +public: + + AquaSalOpenGL( SalGraphics* pGraphics ); + ~AquaSalOpenGL(); + +// static void Release(); +// static void ReleaseLib(); +// static void MakeVisualWeights( +// Display *pDisplay, +// XVisualInfo* pInfos, +// int* pWeights, +// int nVisuals +// ); + + // overload all pure virtual methods + virtual bool IsValid(); + virtual void* GetOGLFnc( const char * ); + virtual void OGLEntry( SalGraphics* pGraphics ); + virtual void OGLExit( SalGraphics* pGraphics ); + virtual void StartScene( SalGraphics* pGraphics ); + virtual void StopScene(); + virtual BOOL Create(); + virtual void Release(); + +}; + +#endif // _SV_SALOGL_H Index: aqua/inc/salogl.hxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salogl.hxx,v retrieving revision 1.4 retrieving revision 1.4.112.1 diff -u -r1.4 -r1.4.112.1 --- aqua/inc/salogl.hxx 9 Sep 2005 10:35:24 -0000 1.4 +++ aqua/inc/salogl.hxx 27 Feb 2006 21:33:53 -0000 1.4.112.1 @@ -69,7 +69,7 @@ class SalOpenGL { private: - static VCLVIEW mhOGLLastDC; + static CarbonViewRef mhOGLLastDC; static ULONG mnOGLState; public: Index: aqua/inc/salprn.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salprn.h,v retrieving revision 1.5 retrieving revision 1.5.112.3 diff -u -r1.5 -r1.5.112.3 --- aqua/inc/salprn.h 9 Sep 2005 10:36:03 -0000 1.5 +++ aqua/inc/salprn.h 27 Feb 2006 21:33:54 -0000 1.5.112.3 @@ -40,6 +40,9 @@ #include #endif +#ifndef _AQUAVCLTYPES_H +#include +#endif class SalGraphics; class SalInfoPrinter; @@ -84,7 +87,7 @@ ByteString maDriverNameA; // printer driver name ByteString maDeviceNameA; // printer device name ByteString maPortNameA; // printer port name - VCLVIEW mhDC; // printer hdc + CarbonViewRef mhDC; // printer hdc BOOL mbGraphics; // is Graphics used BOOL mbAnsi; }; @@ -98,5 +101,79 @@ SalGraphics* mpGraphics; // current Printer graphics SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter }; + +// --------------------- +// - AquaSalInfoPrinter - +// --------------------- + +class AquaSalGraphics; + +class AquaSalInfoPrinter : public SalInfoPrinter +{ +public: + AquaSalGraphics* mpGraphics; // current Printer graphics + XubString maDriverName; // printer driver name + XubString maDeviceName; // printer device name + XubString maPortName; // printer port name + ByteString maDriverNameA; // printer driver name + ByteString maDeviceNameA; // printer device name + ByteString maPortNameA; // printer port name +// HDC mhDC; // printer hdc + BOOL mbGraphics; // is Graphics used + BOOL mbAnsi; + +public: + AquaSalInfoPrinter(); + virtual ~AquaSalInfoPrinter(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); + virtual BOOL SetPrinterData( ImplJobSetup* pSetupData ); + virtual BOOL SetData( ULONG nFlags, ImplJobSetup* pSetupData ); + virtual void GetPageInfo( const ImplJobSetup* pSetupData, + long& rOutWidth, long& rOutHeight, + long& rPageOffX, long& rPageOffY, + long& rPageWidth, long& rPageHeight ); + virtual ULONG GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ); + virtual ULONG GetPaperBinCount( const ImplJobSetup* pSetupData ); + virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); + virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); + virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ); +}; + +// ----------------- +// - AquaSalPrinter - +// ----------------- + +class AquaSalPrinter : public SalPrinter +{ +public: + AquaSalGraphics* mpGraphics; // current Printer graphics + AquaSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + AquaSalPrinter* mpNextPrinter; // next printing printer +// HDC mhDC; // printer hdc + ULONG mnError; // Error Code + ULONG mnCopies; // Kopien + BOOL mbCollate; // Sortierte Kopien + BOOL mbAbort; // Job Aborted + +public: + AquaSalPrinter(); + virtual ~AquaSalPrinter(); + + virtual BOOL StartJob( const XubString* pFileName, + const XubString& rJobName, + const XubString& rAppName, + ULONG nCopies, BOOL bCollate, + ImplJobSetup* pSetupData ); + virtual BOOL EndJob(); + virtual BOOL AbortJob(); + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ); + virtual BOOL EndPage(); + virtual ULONG GetErrorCode(); +}; + #endif // _SV_SALPRN_H Index: aqua/inc/salsound.h =================================================================== RCS file: aqua/inc/salsound.h diff -N aqua/inc/salsound.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/inc/salsound.h 27 Nov 2005 09:48:19 -0000 1.1.2.1 @@ -0,0 +1,109 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALSOUND_H +#define _SV_SALSOUND_H + +//#ifndef _SV_WINCOMP_HXX +//#include +//#endif + +#ifndef _GEN_HXX +#include +#endif +#ifndef _STRING_HXX +#include +#endif + +#ifndef _SV_SV_H +#include +#endif + +#include + +#ifndef _SV_SALFRAME_HXX +#include +#endif +#ifndef _SV_SALSTYPE_HXX +#include +#endif +#ifndef _SV_SALSOUND_HXX +#include +#endif + +// ------------ +// - SalSound - +// ------------ + +class AquaSalSound : public SalSound +{ +private: +// static oslModule mhMCILib; + static ULONG mnSoundState; + SALSOUNDPROC mpProc; +// static void* mpMCIFnc; +// ULONG mnStartTime; +// ULONG mnPlayLen; +// HWND mhSoundWnd; +// UINT mnDeviceId; + bool mbLoop; + bool mbPaused; + +public: + void ImplSetError( int nMciErr ); + void ImplNotify( SoundNotification eNotification, ULONG nError ); + +public: + AquaSalSound(); + virtual ~AquaSalSound(); + + virtual bool IsValid(); + virtual bool Init( const String& rSoundName, + ULONG& rSoundLen ); + virtual void Play( ULONG nStartTime, ULONG nPlayTime, bool bLoop ); + virtual void Stop(); + virtual void Pause(); + virtual void Continue(); + virtual bool IsLoopMode() const; + virtual bool IsPlaying() const; + virtual bool IsPaused() const; + + + bool ImplCreate(); + void ImplDestroy(); + static void Release(); +}; + +#endif // _SV_SALSOUND_H Index: aqua/inc/salsys.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salsys.h,v retrieving revision 1.3 retrieving revision 1.3.112.1 diff -u -r1.3 -r1.3.112.1 --- aqua/inc/salsys.h 9 Sep 2005 10:36:47 -0000 1.3 +++ aqua/inc/salsys.h 27 Nov 2005 09:48:20 -0000 1.3.112.1 @@ -40,13 +40,35 @@ #include #endif +#include + +#include // ----------------- // - SalSystemData - // ----------------- -struct SalSystemData +//struct SalSystemData +//{ +//}; + +class VCL_DLLPUBLIC AquaSalSystem : public SalSystem { +public: + AquaSalSystem() {} + virtual ~AquaSalSystem(); + + // overload pure virtual methods + virtual bool GetSalSystemDisplayInfo( DisplayInfo& rInfo ); + virtual int ShowNativeDialog( const String& rTitle, + const String& rMessage, + const std::list< String >& rButtons, + int nDefButton ); + virtual int ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton); }; + #endif // _SV_SALSYS_H Index: aqua/inc/saltimer.h =================================================================== RCS file: aqua/inc/saltimer.h diff -N aqua/inc/saltimer.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/inc/saltimer.h 2 Mar 2006 00:31:02 -0000 1.2.2.2 @@ -0,0 +1,68 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALTIMER_H +#define _SV_SALTIMER_H + +#include +#include +#include + +#ifndef _SV_SALTIMER_HXX +#include +#endif + +class AquaSalTimer : public SalTimer +{ +private: + TMTask mTask; // the timer task + BOOL mbInstalled; // timer task is in queue + long mMS; // current timer interval in msec + BOOL InstallTask(); // installs timer task and returns status + +public: + AquaSalTimer(); + virtual ~AquaSalTimer(); + + // overload all pure virtual methods + void Start( ULONG nMS ); + void Stop(); + + // restarts active tasks using the current timeout + // optional with different timeout (when nMS is != 0) + void ReStart( ULONG nMS = 0 ); +}; + +#endif Index: aqua/inc/salvd.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/salvd.h,v retrieving revision 1.10 retrieving revision 1.10.112.1 diff -u -r1.10 -r1.10.112.1 --- aqua/inc/salvd.h 9 Sep 2005 10:37:00 -0000 1.10 +++ aqua/inc/salvd.h 27 Nov 2005 09:48:26 -0000 1.10.112.1 @@ -56,6 +56,9 @@ #include #endif +#include +#include + #if PRAGMA_ONCE #pragma once #endif @@ -70,11 +73,6 @@ struct SalVirDevData { - SalGraphics *mpGraphics; // current VirDev graphics - USHORT mnBitCount; // GWorld pixel depth - long mnWidth; // GWorld width - long mnHeight; // GWorld height - BOOL mbGraphics; // is Graphics used? }; typedef struct SalVirDevData SalVirDevData; @@ -82,6 +80,39 @@ typedef SalVirDevDataPtr *SalVirDevDataHandle; // ======================================================================= + +class AquaSalGraphics; + +// ----------------- +// - SalVirDevData - +// ----------------- + +class AquaSalVirtualDevice : public SalVirtualDevice +{ +public: + AquaSalGraphics *mpGraphics; // current VirDev graphics + USHORT mnBitCount; // GWorld pixel depth + long mnWidth; // GWorld width + long mnHeight; // GWorld height + BOOL mbGraphics; // is Graphics used? + + +// HDC mhDC; // HDC or 0 for Cache Device +// HBITMAP mhBmp; // Memory Bitmap +// HBITMAP mhDefBmp; // Default Bitmap +// WinSalGraphics* mpGraphics; // current VirDev graphics +// WinSalVirtualDevice* mpNext; // next VirDev +// USHORT mnBitCount; // BitCount (0 or 1) +// BOOL mbGraphics; // is Graphics used +// BOOL mbForeignDC; // uses a foreign DC instead of a bitmap + + AquaSalVirtualDevice(); + virtual ~AquaSalVirtualDevice(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual BOOL SetSize( long nNewDX, long nNewDY ); +}; // ======================================================================= Index: aqua/source/app/VCLApplication.m =================================================================== RCS file: aqua/source/app/VCLApplication.m diff -N aqua/source/app/VCLApplication.m --- aqua/source/app/VCLApplication.m 9 Sep 2005 10:37:46 -0000 1.32 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,400 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import -#import -#import -#import -#import -#include -#import -#include - -#define _SV_VCLAPPLICATION_M - -// -------------------- -// - Static functions - -// -------------------- - -static BOOL SalHandleMouseEvent( NSEvent *pEvent ) -{ - VCLWindow *pFrame = [pEvent window]; - NSEventType nEventType = [pEvent type]; - struct SalMouseEvent aMouseEvt; - NSPoint aPoint = [pEvent locationInWindow]; - NSRect aFrameRect = [(VCLWindow *)pFrame frame]; - NSRect aContentRect = [[(VCLWindow *)pFrame contentView] frame]; - NSRect aResizeRect; - unsigned int nModifiers = [pEvent modifierFlags]; - USHORT nEvent = 0; - - // Test if the point is in the window's contentView. If not, we don't - // handle it here. - if ( ! NSPointInRect( aPoint, aContentRect ) ) - { - return FALSE; - } - - // Test if the point is in the window's resize box. If so, allow the - // default event handler to handle it. - if ( [pFrame styleMask] & NSResizableWindowMask ) - { - aResizeRect.origin.x = aFrameRect.size.width - kThemeMetricResizeControlHeight; - aResizeRect.origin.y = 0; - aResizeRect.size.width = kThemeMetricResizeControlHeight; - aResizeRect.size.height = kThemeMetricResizeControlHeight; - if ( NSPointInRect( aPoint, aResizeRect ) ) - return FALSE; - } - - // Convert mouse coordinates from window's coordinate space that - // contentView's coordinate space since we will be drawing in the - // contentView. - aPoint.x -= aContentRect.origin.x; - aPoint.y -= aContentRect.origin.y; - - // Initialize SalMouseEvent structure - aMouseEvt.mnTime = (ULONG)([pEvent timestamp] * 1000); - aMouseEvt.mnCode = 0; - aMouseEvt.mnX = (long)(aPoint.x); - // Need to adjust the Y coordinate since 0 is at the bottom of the window - // in aPoint - aMouseEvt.mnY = (long)(aContentRect.size.height - (aPoint.y)); - aMouseEvt.mnButton = 0; - - // Get the modifiers for the event - if ( nModifiers & NSShiftKeyMask ) - aMouseEvt.mnCode |= KEY_SHIFT; - if ( nModifiers & NSCommandKeyMask ) - aMouseEvt.mnCode |= KEY_MOD1; - if ( nModifiers & NSAlternateKeyMask ) - aMouseEvt.mnCode |= KEY_MOD2; - - // Determine with button has been pressed - switch ( nEventType ) - { - case NSLeftMouseDown: - case NSLeftMouseUp: - case NSLeftMouseDragged: - // If the Alt key is pressed, treat event as a right button - // event and ignore the Alt key. We need this since many Apple - // machines have only a one-button mouse. We can't use the Command - // key because that is reserved for drag-copy operations. - if ( aMouseEvt.mnCode & KEY_MOD2 ) - { - aMouseEvt.mnCode |= MOUSE_RIGHT; - aMouseEvt.mnCode &= ~KEY_MOD2 ; - } - else - aMouseEvt.mnCode |= MOUSE_LEFT; - break; - case NSRightMouseDown: - case NSRightMouseUp: - case NSRightMouseDragged: - aMouseEvt.mnCode |= MOUSE_RIGHT; - break; - default: - break; - } - - // Get the button for this event - if ( aMouseEvt.mnCode & MOUSE_LEFT ) - aMouseEvt.mnButton = MOUSE_LEFT; - if ( aMouseEvt.mnCode & MOUSE_RIGHT ) - aMouseEvt.mnButton = MOUSE_RIGHT; - - // Pass the event to this window's callback function - switch ( nEventType ) - { - case NSLeftMouseDown: - case NSRightMouseDown: - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - case NSLeftMouseUp: - case NSRightMouseUp: - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - case NSMouseMoved: - case NSMouseEntered: - case NSLeftMouseDragged: - case NSRightMouseDragged: - nEvent = SALEVENT_MOUSEMOVE; - break; - case NSMouseExited: - nEvent = SALEVENT_MOUSELEAVE; - break; - default: - return FALSE; - break; - } - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, nEvent, &aMouseEvt ); - - return FALSE; -} - -static BOOL SalHandleKeyEvent( NSEvent *pEvent ) -{ - VCLWindow *pFrame = [pEvent window]; - NSEventType nEventType = [pEvent type]; - NSString *pKey = nil; - struct SalKeyEvent aKeyEvt; - unsigned int nModifiers = [pEvent modifierFlags]; - USHORT nEvent = 0; - - // Initialize SalKeyEvent structure - aKeyEvt.mnTime = (ULONG)[pEvent timestamp]; - aKeyEvt.mnCode = 0; - aKeyEvt.mnCharCode = 0; - aKeyEvt.mnRepeat = 0; - - // Get the modifiers for the event - if ( nModifiers & NSShiftKeyMask ) - aKeyEvt.mnCode |= KEY_SHIFT; - if ( nModifiers & NSCommandKeyMask ) - aKeyEvt.mnCode |= KEY_MOD1; - if ( nModifiers & NSAlternateKeyMask ) - aKeyEvt.mnCode |= KEY_MOD2; - - if ( nEventType == NSKeyDown || nEventType == NSKeyUp ) - { - // Get the Unicode character for the event - pKey = [pEvent characters]; - if ( [pKey length] ) - aKeyEvt.mnCharCode = (USHORT)[pKey characterAtIndex: 0]; - else - return TRUE; - - // Add alphanumeric and special characters to modifiers - if ( ( aKeyEvt.mnCharCode >= '0' ) && ( aKeyEvt.mnCharCode <= '9' ) ) - aKeyEvt.mnCode |= KEYGROUP_NUM + aKeyEvt.mnCharCode - '0'; - else if ( ( aKeyEvt.mnCharCode >= 'A' ) && ( aKeyEvt.mnCharCode <= 'Z' ) ) - aKeyEvt.mnCode |= KEYGROUP_ALPHA + aKeyEvt.mnCharCode - 'A'; - else if ( ( aKeyEvt.mnCharCode >= 'a' ) && ( aKeyEvt.mnCharCode <= 'z' ) ) - aKeyEvt.mnCode |= KEYGROUP_ALPHA + aKeyEvt.mnCharCode - 'a'; - else if ( aKeyEvt.mnCharCode == 0x0D ) // RETURN - aKeyEvt.mnCode |= KEY_RETURN; - else if ( aKeyEvt.mnCharCode == 0x1B ) // ESCAPE - aKeyEvt.mnCode |= KEY_ESCAPE; - else if ( aKeyEvt.mnCharCode == 0x09 ) // TAB - aKeyEvt.mnCode |= KEY_TAB; - else if ( aKeyEvt.mnCharCode == 0x20 ) // SPACE - aKeyEvt.mnCode |= KEY_SPACE; - } - // Check if this is a system key equivalent (e.g. Command-Q) - if ( nModifiers == NSCommandKeyMask ) - { - // Only handle event if it is a Key Down event, not a Key Up event - if (nEventType == NSKeyDown ) - { - if (aKeyEvt.mnCharCode == 'q') - { - [NSApp terminate: NSApp]; - return TRUE; - } - if (aKeyEvt.mnCharCode == 'h') - { - [NSApp hide: NSApp]; - return TRUE; - } - } - } - - // Pass the event to this window's callback function - switch ( nEventType ) - { - case NSKeyDown: - nEvent = SALEVENT_KEYINPUT; - break; - case NSKeyUp: - nEvent = SALEVENT_KEYUP; - break; - case NSFlagsChanged: - nEvent = SALEVENT_KEYMODCHANGE; - break; - default: - return FALSE; - break; - } - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, nEvent, &aKeyEvt ); - - return TRUE; -} - -static BOOL SalHandlePeriodicEvent( NSEvent *pEvent ) -{ - NSArray *pWindows = nil; - VCLWindow *pFrame = nil; - unsigned int nFrame = 0; - struct SalData *pSalData = NULL; - - pSalData = SalGetSalData(); - - // Call the timer callback to paint - if ( pSalData->mpTimerProc ) - { - pSalData->mpTimerProc(); - - // Force update of all windows so that the window border is painted - pWindows = [NSApp windows]; - for ( nFrame = 0; nFrame < [pWindows count]; nFrame++ ) - { - pFrame = (VCLWindow *)[pWindows objectAtIndex: nFrame]; - if ( [pFrame isVisible] ) - [pFrame display]; - } - } - - return TRUE; -} - -// ------------------ -// - VCLApplication - -// ------------------ - -@implementation VCLApplication - -- (MacOSBOOL)applicationShouldTerminate: (NSApplication *)sender -{ - VCLWindow *pFrame = [NSApp keyWindow]; - - // Pass the event to this window's callback function. - if ( pFrame && pFrame->mpSalFrameData->mpProc ) - { - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, SALEVENT_SHUTDOWN, NULL ); - } - - // Always return FALSE as the event handler above should have taken - // care of starting the termination process - return FALSE; -} - -- (void)sendEvent: (NSEvent *)anEvent -{ - VCLWindow *pFrame = [anEvent window]; - BOOL bHandled = FALSE; - - // Check if this is an event that we should handle. If so, translate and - // pass the event to the platform independent event handlers. - switch ( [anEvent type] ) - { - case NSLeftMouseDown: - case NSLeftMouseUp: - case NSRightMouseDown: - case NSRightMouseUp: - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSMouseEntered: - case NSMouseExited: - if ( [pFrame isVisible] && SalHandleMouseEvent( anEvent ) ) - bHandled = TRUE; - break; - case NSCursorUpdate: - break; - case NSKeyDown: - case NSKeyUp: - case NSFlagsChanged: - if ( [pFrame isVisible] && SalHandleKeyEvent( anEvent ) ) - bHandled = TRUE; - break; - case NSApplicationDefined: - // Pass the event to this window's callback function. - if ( pFrame && pFrame->mpSalFrameData->mpProc ) - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, SALEVENT_USEREVENT, - (void *)[anEvent data1] ); - bHandled = TRUE; - break; - case NSScrollWheel: - break; - case NSPeriodic: - bHandled = SalHandlePeriodicEvent( anEvent ); - break; - case NSAppKitDefined: - case NSSystemDefined: - break; - default: - break; - } - - // If the event has not been handled, pass it to [NSApplication sendEvent:] - if ( !bHandled ) - [super sendEvent: anEvent]; -} - -@end - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -void VCLApplication_SharedApplication() -{ - [VCLApplication sharedApplication]; - [NSApp setDelegate: NSApp]; - - // We need to invoke the following code since we don't use [NSApp run] - [NSApp finishLaunching]; -} - -void VCLApplication_Run( BOOL bWait ) -{ - NSEvent *pEvent; - NSDate *pDate = [NSDate date]; - - // Manually pull events from the event queue and dispatch them to - // [NSApp sendEvent:]. Although this is the same thing that [NSApp run] - // does, the VCL platform independent expects events to be pulled instead - // of pushed from the system event queue. - for ( ; ; ) - { - pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: pDate - inMode: NSDefaultRunLoopMode dequeue: YES]; - - if ( pEvent ) - { - [NSApp sendEvent: pEvent]; - - // Invoke update on all of the windows. This is done in [NSApp run] - // hence it is included here. - [NSApp updateWindows]; - } - else - break; - } -} Index: aqua/source/app/VCLApplication.mm =================================================================== RCS file: aqua/source/app/VCLApplication.mm diff -N aqua/source/app/VCLApplication.mm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/source/app/VCLApplication.mm 16 Feb 2006 21:36:33 -0000 1.1.2.3 @@ -0,0 +1,413 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#import +#import +#import +#import +#import +#include +#import +#import +#include + +#define _SV_VCLAPPLICATION_M + +// -------------------- +// - Static functions - +// -------------------- + +static BOOL SalHandleMouseEvent( NSEvent *pEvent ) +{ + VCLWindow *pFrame = (VCLWindow*)[pEvent window]; + NSEventType nEventType = [pEvent type]; + struct SalMouseEvent aMouseEvt; + NSPoint aPoint = [pEvent locationInWindow]; + NSRect aFrameRect = [(VCLWindow *)pFrame frame]; + NSRect aContentRect = [[(VCLWindow *)pFrame contentView] frame]; + NSRect aResizeRect; + unsigned int nModifiers = [pEvent modifierFlags]; + USHORT nEvent = 0; + + // Test if the point is in the window's contentView. If not, we don't + // handle it here. + if ( ! NSPointInRect( aPoint, aContentRect ) ) + { + return FALSE; + } + + // Test if the point is in the window's resize box. If so, allow the + // default event handler to handle it. + if ( [pFrame styleMask] & NSResizableWindowMask ) + { + aResizeRect.origin.x = aFrameRect.size.width - kThemeMetricResizeControlHeight; + aResizeRect.origin.y = 0; + aResizeRect.size.width = kThemeMetricResizeControlHeight; + aResizeRect.size.height = kThemeMetricResizeControlHeight; + if ( NSPointInRect( aPoint, aResizeRect ) ) + return FALSE; + } + + // Convert mouse coordinates from window's coordinate space that + // contentView's coordinate space since we will be drawing in the + // contentView. + aPoint.x -= aContentRect.origin.x; + aPoint.y -= aContentRect.origin.y; + + // Initialize SalMouseEvent structure + aMouseEvt.mnTime = (ULONG)([pEvent timestamp] * 1000); + aMouseEvt.mnCode = 0; + aMouseEvt.mnX = (long)(aPoint.x); + // Need to adjust the Y coordinate since 0 is at the bottom of the window + // in aPoint + aMouseEvt.mnY = (long)(aContentRect.size.height - (aPoint.y)); + aMouseEvt.mnButton = 0; + + // Get the modifiers for the event + if ( nModifiers & NSShiftKeyMask ) + aMouseEvt.mnCode |= KEY_SHIFT; + if ( nModifiers & NSCommandKeyMask ) + aMouseEvt.mnCode |= KEY_MOD1; + if ( nModifiers & NSAlternateKeyMask ) + aMouseEvt.mnCode |= KEY_MOD2; + + // Determine with button has been pressed + switch ( nEventType ) + { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSLeftMouseDragged: + // If the Alt key is pressed, treat event as a right button + // event and ignore the Alt key. We need this since many Apple + // machines have only a one-button mouse. We can't use the Command + // key because that is reserved for drag-copy operations. + if ( aMouseEvt.mnCode & KEY_MOD2 ) + { + aMouseEvt.mnCode |= MOUSE_RIGHT; + aMouseEvt.mnCode &= ~KEY_MOD2 ; + } + else + aMouseEvt.mnCode |= MOUSE_LEFT; + break; + case NSRightMouseDown: + case NSRightMouseUp: + case NSRightMouseDragged: + aMouseEvt.mnCode |= MOUSE_RIGHT; + break; + default: + break; + } + + // Get the button for this event + if ( aMouseEvt.mnCode & MOUSE_LEFT ) + aMouseEvt.mnButton = MOUSE_LEFT; + if ( aMouseEvt.mnCode & MOUSE_RIGHT ) + aMouseEvt.mnButton = MOUSE_RIGHT; + + // Pass the event to this window's callback function + switch ( nEventType ) + { + case NSLeftMouseDown: + case NSRightMouseDown: + nEvent = SALEVENT_MOUSEBUTTONDOWN; + break; + case NSLeftMouseUp: + case NSRightMouseUp: + nEvent = SALEVENT_MOUSEBUTTONUP; + break; + case NSMouseMoved: + case NSMouseEntered: + case NSLeftMouseDragged: + case NSRightMouseDragged: + nEvent = SALEVENT_MOUSEMOVE; + break; + case NSMouseExited: + nEvent = SALEVENT_MOUSELEAVE; + break; + default: + return FALSE; + break; + } + if ( nEvent && pFrame && pFrame->mpSalFrame->mpProc ) + { + pFrame->mpSalFrame->mpProc( pFrame->mpSalFrame->mpInst, + pFrame->mpSalFrame, nEvent, &aMouseEvt ); + //return TRUE; + } + + return FALSE; +} + +static BOOL SalHandleKeyEvent( NSEvent *pEvent ) +{ + VCLWindow *pFrame = (VCLWindow*)[pEvent window]; + NSEventType nEventType = [pEvent type]; + NSString *pKey = nil; + struct SalKeyEvent aKeyEvt; + unsigned int nModifiers = [pEvent modifierFlags]; + USHORT nEvent = 0; + + // Initialize SalKeyEvent structure + aKeyEvt.mnTime = (ULONG)[pEvent timestamp]; + aKeyEvt.mnCode = 0; + aKeyEvt.mnCharCode = 0; + aKeyEvt.mnRepeat = 0; + + // Get the modifiers for the event + if ( nModifiers & NSShiftKeyMask ) + aKeyEvt.mnCode |= KEY_SHIFT; + if ( nModifiers & NSCommandKeyMask ) + aKeyEvt.mnCode |= KEY_MOD1; + if ( nModifiers & NSAlternateKeyMask ) + aKeyEvt.mnCode |= KEY_MOD2; + + if ( nEventType == NSKeyDown || nEventType == NSKeyUp ) + { + // Get the Unicode character for the event + pKey = [pEvent characters]; + if ( [pKey length] ) + aKeyEvt.mnCharCode = (USHORT)[pKey characterAtIndex: 0]; + else + return TRUE; + + // Add alphanumeric and special characters to modifiers + if ( ( aKeyEvt.mnCharCode >= '0' ) && ( aKeyEvt.mnCharCode <= '9' ) ) + aKeyEvt.mnCode |= KEYGROUP_NUM + aKeyEvt.mnCharCode - '0'; + else if ( ( aKeyEvt.mnCharCode >= 'A' ) && ( aKeyEvt.mnCharCode <= 'Z' ) ) + aKeyEvt.mnCode |= KEYGROUP_ALPHA + aKeyEvt.mnCharCode - 'A'; + else if ( ( aKeyEvt.mnCharCode >= 'a' ) && ( aKeyEvt.mnCharCode <= 'z' ) ) + aKeyEvt.mnCode |= KEYGROUP_ALPHA + aKeyEvt.mnCharCode - 'a'; + else if ( aKeyEvt.mnCharCode == 0x0D ) // RETURN + aKeyEvt.mnCode |= KEY_RETURN; + else if ( aKeyEvt.mnCharCode == 0x1B ) // ESCAPE + aKeyEvt.mnCode |= KEY_ESCAPE; + else if ( aKeyEvt.mnCharCode == 0x09 ) // TAB + aKeyEvt.mnCode |= KEY_TAB; + else if ( aKeyEvt.mnCharCode == 0x20 ) // SPACE + aKeyEvt.mnCode |= KEY_SPACE; + } + // Check if this is a system key equivalent (e.g. Command-Q) + if ( nModifiers == NSCommandKeyMask ) + { + // Only handle event if it is a Key Down event, not a Key Up event + if (nEventType == NSKeyDown ) + { + if (aKeyEvt.mnCharCode == 'q') + { + [NSApp terminate: NSApp]; + return TRUE; + } + if (aKeyEvt.mnCharCode == 'h') + { + [NSApp hide: NSApp]; + return TRUE; + } + } + } + + // Pass the event to this window's callback function + switch ( nEventType ) + { + case NSKeyDown: + nEvent = SALEVENT_KEYINPUT; + break; + case NSKeyUp: + nEvent = SALEVENT_KEYUP; + break; + case NSFlagsChanged: + nEvent = SALEVENT_KEYMODCHANGE; + break; + default: + return FALSE; + break; + } + if ( pFrame && pFrame->mpSalFrame->mpProc ) + { + pFrame->mpSalFrame->mpProc( pFrame->mpSalFrame->mpInst, + pFrame->mpSalFrame, nEvent, &aKeyEvt ); + return TRUE; + } + + return FALSE; +} + +static BOOL SalHandlePeriodicEvent( NSEvent *pEvent ) +{ + NSArray *pWindows = nil; + VCLWindow *pFrame = nil; + unsigned int nFrame = 0; + struct SalData *pSalData = NULL; + +#ifdef __cplusplus + pSalData = GetSalData(); +#else + pSalData = SalGetSalData(); +#endif + + // Call the timer callback to paint + if ( pSalData->mpTimerProc ) + { + pSalData->mpTimerProc(); + + // Force update of all windows so that the window border is painted + pWindows = [NSApp windows]; + for ( nFrame = 0; nFrame < [pWindows count]; nFrame++ ) + { + pFrame = (VCLWindow *)[pWindows objectAtIndex: nFrame]; + if ( [pFrame isVisible] ) + [pFrame display]; + } + } + + return TRUE; +} + +// ------------------ +// - VCLApplication - +// ------------------ + +@implementation VCLApplication + +- (MacOSBOOL)applicationShouldTerminate: (NSApplication *)sender +{ + VCLWindow *pFrame = (VCLWindow*)[NSApp keyWindow]; + + // Pass the event to this window's callback function. + if ( pFrame && pFrame->mpSalFrame->mpProc ) + { + pFrame->mpSalFrame->mpProc( pFrame->mpSalFrame->mpInst, + pFrame->mpSalFrame, SALEVENT_SHUTDOWN, NULL ); + } + + // Always return FALSE as the event handler above should have taken + // care of starting the termination process + return FALSE; +} + +- (void)sendEvent: (NSEvent *)anEvent +{ + VCLWindow *pFrame = (VCLWindow*)[anEvent window]; + BOOL bHandled = FALSE; + + // Check if this is an event that we should handle. If so, translate and + // pass the event to the platform independent event handlers. + switch ( [anEvent type] ) + { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSRightMouseDown: + case NSRightMouseUp: + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSMouseEntered: + case NSMouseExited: + if ( [pFrame isVisible] && SalHandleMouseEvent( anEvent ) ) + bHandled = TRUE; + break; + case NSCursorUpdate: + break; + case NSKeyDown: + case NSKeyUp: + case NSFlagsChanged: + if ( [pFrame isVisible] && SalHandleKeyEvent( anEvent ) ) + bHandled = TRUE; + break; + case NSApplicationDefined: + // Pass the event to this window's callback function. + if ( pFrame && pFrame->mpSalFrame->mpProc ) + pFrame->mpSalFrame->mpProc( pFrame->mpSalFrame->mpInst, + pFrame->mpSalFrame, SALEVENT_USEREVENT, + (void *)[anEvent data1] ); + bHandled = TRUE; + break; + case NSScrollWheel: + break; + case NSPeriodic: + bHandled = SalHandlePeriodicEvent( anEvent ); + break; + case NSAppKitDefined: + case NSSystemDefined: + break; + default: + break; + } + + // If the event has not been handled, pass it to [NSApplication sendEvent:] + if ( !bHandled ) + [super sendEvent: anEvent]; +} + +@end + +// ----------------------- +// - C wrapper functions - +// ----------------------- + +void VCLApplication_SharedApplication() +{ + [VCLApplication sharedApplication]; + [NSApp setDelegate: NSApp]; + + // We need to invoke the following code since we don't use [NSApp run] + [NSApp finishLaunching]; +} + +void VCLApplication_Run( BOOL bWait ) +{ + NSEvent *pEvent; + NSDate *pDate = [NSDate date]; + + // Manually pull events from the event queue and dispatch them to + // [NSApp sendEvent:]. Although this is the same thing that [NSApp run] + // does, the VCL platform independent expects events to be pulled instead + // of pushed from the system event queue. + for ( ; ; ) + { + pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: pDate + inMode: NSDefaultRunLoopMode dequeue: YES]; + + if ( pEvent ) + { + [NSApp sendEvent: pEvent]; + + // Invoke update on all of the windows. This is done in [NSApp run] + // hence it is included here. + [NSApp updateWindows]; + } + else + break; + } +} Index: aqua/source/app/VCLAutoreleasePool.m =================================================================== RCS file: aqua/source/app/VCLAutoreleasePool.m diff -N aqua/source/app/VCLAutoreleasePool.m --- aqua/source/app/VCLAutoreleasePool.m 9 Sep 2005 10:38:03 -0000 1.9 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,59 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import - -#define _SV_VCLAUTORELEASEPOOL_M - -// ---------------------- -// - VCLAutoreleasePool - -// ---------------------- - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -VCLAUTORELEASEPOOL VCLAutoreleasePool_Init() -{ - return [[NSAutoreleasePool alloc] init]; -} - -void VCLAutoreleasePool_Release( VCLAUTORELEASEPOOL hReleasepool ) -{ - if ( (NSAutoreleasePool *)hReleasepool == nil ) - return; - - [(NSAutoreleasePool *)hReleasepool release]; -} Index: aqua/source/app/VCLAutoreleasePool.mm =================================================================== RCS file: aqua/source/app/VCLAutoreleasePool.mm diff -N aqua/source/app/VCLAutoreleasePool.mm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/source/app/VCLAutoreleasePool.mm 16 Feb 2006 21:36:33 -0000 1.1.2.2 @@ -0,0 +1,59 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#import + +#define _SV_VCLAUTORELEASEPOOL_M + +// ---------------------- +// - VCLAutoreleasePool - +// ---------------------- + +// ----------------------- +// - C wrapper functions - +// ----------------------- + +VCLAUTORELEASEPOOL VCLAutoreleasePool_Init() +{ + return [[NSAutoreleasePool alloc] init]; +} + +void VCLAutoreleasePool_Release( VCLAUTORELEASEPOOL hReleasepool ) +{ + if ( (NSAutoreleasePool *)hReleasepool == nil ) + return; + + [(NSAutoreleasePool *)hReleasepool release]; +} Index: aqua/source/app/VCLEvent.m =================================================================== RCS file: aqua/source/app/VCLEvent.m diff -N aqua/source/app/VCLEvent.m --- aqua/source/app/VCLEvent.m 9 Sep 2005 10:38:17 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,62 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import - -#define _SV_VCLEVENT_M - -// ----------- -// - VCLEvent - -// ----------- - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -void VCLEvent_StartPeriodicEvents( ULONG nDelay ) -{ - NSTimeInterval nSeconds = (NSTimeInterval)nDelay / 1000; - - // Need to stop period event processing before invoking the start. This - // prevents exceptions from being thrown and allows us to change the - // interval. - [NSEvent stopPeriodicEvents]; - [NSEvent startPeriodicEventsAfterDelay: nSeconds withPeriod: nSeconds]; -} - -void VCLEvent_StopPeriodicEvents() -{ - [NSEvent stopPeriodicEvents]; -} Index: aqua/source/app/VCL_Event.mm =================================================================== RCS file: aqua/source/app/VCL_Event.mm diff -N aqua/source/app/VCL_Event.mm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/source/app/VCL_Event.mm 16 Feb 2006 21:36:34 -0000 1.1.2.2 @@ -0,0 +1,62 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#import + +#define _SV_VCLEVENT_M + +// ----------- +// - VCLEvent - +// ----------- + +// ----------------------- +// - C wrapper functions - +// ----------------------- + +void VCLEvent_StartPeriodicEvents( ULONG nDelay ) +{ + NSTimeInterval nSeconds = (NSTimeInterval)nDelay / 1000; + + // Need to stop period event processing before invoking the start. This + // prevents exceptions from being thrown and allows us to change the + // interval. + [NSEvent stopPeriodicEvents]; + [NSEvent startPeriodicEventsAfterDelay: nSeconds withPeriod: nSeconds]; +} + +void VCLEvent_StopPeriodicEvents() +{ + [NSEvent stopPeriodicEvents]; +} Index: aqua/source/app/makefile.mk =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/makefile.mk,v retrieving revision 1.12 retrieving revision 1.12.112.2 diff -u -r1.12 -r1.12.112.2 --- aqua/source/app/makefile.mk 9 Sep 2005 10:38:32 -0000 1.12 +++ aqua/source/app/makefile.mk 16 Feb 2006 21:36:34 -0000 1.12.112.2 @@ -55,19 +55,16 @@ .ELSE # "$(GUIBASE)"!="aqua" -OBJFILES= $(OBJ)$/salmain.obj \ - $(OBJ)$/VCLApplication.obj \ - $(OBJ)$/VCLAutoreleasePool.obj +#CFLAGS+=-x objective-c++ + +OBJFILES= $(OBJ)$/salmain.obj SLOFILES= $(SLO)$/salinst.obj \ $(SLO)$/saldata.obj \ $(SLO)$/saltimer.obj \ $(SLO)$/salsound.obj \ $(SLO)$/salsys.obj \ - $(SLO)$/salmain.obj \ - $(SLO)$/VCLApplication.obj \ - $(SLO)$/VCLAutoreleasePool.obj \ - $(SLO)$/VCLEvent.obj + $(SLO)$/salmain.obj EXCEPTIONSFILES=$(SLO)$/salmain.obj \ $(OBJ)$/salmain.obj Index: aqua/source/app/salinst.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/salinst.cxx,v retrieving revision 1.33 retrieving revision 1.33.110.8 diff -u -r1.33 -r1.33.110.8 --- aqua/source/app/salinst.cxx 9 Sep 2005 10:39:02 -0000 1.33 +++ aqua/source/app/salinst.cxx 2 Mar 2006 00:31:03 -0000 1.33.110.8 @@ -41,32 +41,45 @@ #ifndef _SV_SALINST_HXX #include #endif -#ifndef _SV_SALFRAME_HXX -#include +#ifndef _SV_SALINST_H +#include +#endif +#ifndef _SV_SALFRAME_H +#include #endif #ifndef _SV_SALOBJ_HXX #include #endif +#include +#ifndef _SV_SALOBJ_H +#include +#endif #ifndef _SV_SALSYS_HXX #include #endif +#ifndef _SV_SALSYS_H +#include +#endif #ifndef _SV_SALVD_HXX #include #endif +#ifndef _SV_SALVD_H +#include +#endif #ifndef _SV_DIALOG_HXX #include #endif -#ifndef _SV_VCLAPPLICATION_H -#include -#endif -#ifndef _SV_VCLAUTORELEASEPOOL_H -#include -#endif #ifndef _FSYS_HXX #include #endif +#ifndef _SV_SALIMESTATUS_HXX +#include +#endif -static VCLAUTORELEASEPOOL hMainAutoreleasePool = NULL; +#include +#include + +#include // ======================================================================= @@ -91,6 +104,14 @@ // ----------------------------------------------------------------------- +const ::rtl::OUString& SalGetDesktopEnvironment() +{ + static OUString aDesktopEnvironment(RTL_CONSTASCII_USTRINGPARAM( "MacOSX" )); + return aDesktopEnvironment; +} + +// ----------------------------------------------------------------------- + void DeInitSalData() { SalData *pSalData = GetSalData(); @@ -108,80 +129,59 @@ void InitSalMain() { - // [ed] 5/14/02 We need to use _NSGetEnviron() here and can't use the straight - // environ. This is due to two-level-namespaces not enjoying having funky - // global hack symbols lying around. -#ifdef QUARTZ - char **environ; - char *stackNULL=NULL; - if(_NSGetEnviron()) - environ=*_NSGetEnviron(); - else - environ=&stackNULL; -#else - extern char **environ; -#endif - - char **pEnviron; - - // Get full executable path. We cna't use __progname as that only holds - // the name of the executable and not the path. The full executable path - // is listed after the first NULL in *environ. - pEnviron = environ; - while ( *pEnviron++ ) - ; - - // Need to include the absolute path for this executable in the PATH - // and STAR_RESOURCEPATH environment variables so that the resource manager - // can find resource files and in the DYLD_LIBRARY_PATH environment - // variable so that the dynamic library loader can find shared libraries - ByteString aPath( getenv( "PATH" ) ); - ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); - ByteString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) ); - ByteString aCmdPath( *pEnviron ); - ByteString aTmpPath; - // Get absolute path of command's directory - if ( aCmdPath.Len() ) { - DirEntry aCmdDirEntry( aCmdPath ); - aCmdDirEntry.ToAbs(); - aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); - } - // Assign to PATH environment variable - if ( aCmdPath.Len() ) - { - aTmpPath = ByteString( "PATH=" ); - aTmpPath += aCmdPath; - if ( aPath.Len() ) - aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); - aTmpPath += aPath; - putenv( aTmpPath.GetBuffer() ); - } - // Assign to STAR_RESOURCEPATH environment variable - if ( aCmdPath.Len() ) - { - aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); - aTmpPath += aCmdPath; - if ( aResPath.Len() ) - aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); - aTmpPath += aResPath; - putenv( aTmpPath.GetBuffer() ); - } - // Assign to DYLD_LIBRARY_PATH environment variable - if ( aCmdPath.Len() ) - { - aTmpPath = ByteString( "DYLD_LIBRARY_PATH=" ); - aTmpPath += aCmdPath; - if ( aLibPath.Len() ) - aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); - aTmpPath += aLibPath; - putenv( aTmpPath.GetBuffer() ); - } - - // Setup up autorelease pool for Objective-C objects - hMainAutoreleasePool = VCLAutoreleasePool_Init(); - - // Initialize application's connection to the window server - VCLApplication_SharedApplication(); + rtl_uString *urlWorkDir = NULL; + rtl_uString *sysWorkDir = NULL; + + oslProcessError err1 = osl_getProcessWorkingDir(&urlWorkDir); + + if (err1 == osl_Process_E_None) + { + oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir, &sysWorkDir); + if (err2 == osl_File_E_None) + { + ByteString aPath( getenv( "PATH" ) ); + ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); + ByteString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) ); + ByteString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() ); + ByteString aTmpPath; + // Get absolute path of command's directory + if ( aCmdPath.Len() ) { + DirEntry aCmdDirEntry( aCmdPath ); + aCmdDirEntry.ToAbs(); + aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); + } + // Assign to PATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "PATH=" ); + aTmpPath += aCmdPath; + if ( aPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + // Assign to STAR_RESOURCEPATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); + aTmpPath += aCmdPath; + if ( aResPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aResPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + // Assign to DYLD_LIBRARY_PATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "DYLD_LIBRARY_PATH=" ); + aTmpPath += aCmdPath; + if ( aLibPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aLibPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + } + } } // ----------------------------------------------------------------------- @@ -189,7 +189,7 @@ void DeInitSalMain() { // Release autorelease pool - VCLAutoreleasePool_Release( hMainAutoreleasePool ); + //VCLAutoreleasePool_Release( hMainAutoreleasePool ); } @@ -198,8 +198,8 @@ void SetFilterCallback( void* pCallback, void* pInst ) { SalData *pSalData = GetSalData(); - pSalData->mpFirstInstance->maInstData.mpFilterCallback = pCallback; - pSalData->mpFirstInstance->maInstData.mpFilterInst = pInst; + //[fheckl]pSalData->mpFirstInstance->mpFilterCallback = pCallback; + //[fheckl]pSalData->mpFirstInstance->mpFilterInst = pInst; } // ======================================================================= @@ -234,10 +234,40 @@ { mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier(); mnCount++; - return True; + return sal_True; } else - return False; + return sal_False; +} + +// ----------------------------------------------------------------------- + +// some convenience functions regarding the yield mutex, aka solar mutex + +BOOL ImplSalYieldMutexTryToAcquire() +{ + AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + return pInst->mpSalYieldMutex->tryToAcquire(); + else + return FALSE; +} + +void ImplSalYieldMutexAcquire() +{ + AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + pInst->mpSalYieldMutex->acquire(); +} + +void ImplSalYieldMutexRelease() +{ + AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + { + //GdiFlush(); + pInst->mpSalYieldMutex->release(); + } } // ======================================================================= @@ -245,7 +275,7 @@ SalInstance* CreateSalInstance() { SalData* pSalData = GetSalData(); - SalInstance* pInst = new SalInstance; + AquaSalInstance* pInst = new AquaSalInstance; // init instance (only one instance in this version !!!) pSalData->mpFirstInstance = pInst; @@ -262,34 +292,34 @@ // ----------------------------------------------------------------------- -SalInstance::SalInstance() +AquaSalInstance::AquaSalInstance() { - maInstData.mpFilterCallback = NULL; - maInstData.mpFilterInst = NULL; - maInstData.mpSalYieldMutex = new SalYieldMutex; - maInstData.mpSalYieldMutex->acquire(); + mpFilterCallback = NULL; + mpFilterInst = NULL; + mpSalYieldMutex = new SalYieldMutex; + mpSalYieldMutex->acquire(); } // ----------------------------------------------------------------------- -SalInstance::~SalInstance() +AquaSalInstance::~AquaSalInstance() { - maInstData.mpSalYieldMutex->release(); - delete maInstData.mpSalYieldMutex; + mpSalYieldMutex->release(); + delete mpSalYieldMutex; } // ----------------------------------------------------------------------- -vos::IMutex* SalInstance::GetYieldMutex() +vos::IMutex* AquaSalInstance::GetYieldMutex() { - return maInstData.mpSalYieldMutex; + return mpSalYieldMutex; } // ----------------------------------------------------------------------- -ULONG SalInstance::ReleaseYieldMutex() +ULONG AquaSalInstance::ReleaseYieldMutex() { - SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex; + SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == NAMESPACE_VOS(OThread)::getCurrentIdentifier() ) { @@ -309,9 +339,9 @@ // ----------------------------------------------------------------------- -void SalInstance::AcquireYieldMutex( ULONG nCount ) +void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) { - SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex; + SalYieldMutex* pYieldMutex = mpSalYieldMutex; while ( nCount ) { pYieldMutex->acquire(); @@ -321,7 +351,7 @@ // ----------------------------------------------------------------------- -void SalInstance::Yield( BOOL bWait ) +void AquaSalInstance::Yield( BOOL bWait ) { ULONG nCount = 0; @@ -329,59 +359,65 @@ // events from the event queue nCount = ReleaseYieldMutex(); - // Pull pending events from the event queue and dispatch them. - VCLApplication_Run( bWait ); + EventRef theEvent; + EventTargetRef theTarget = GetEventDispatcherTarget(); + EventTimeout timeout = bWait ? kEventDurationForever : 0; + + if (ReceiveNextEvent(0, NULL, timeout, true, &theEvent) == noErr) + { + SendEventToEventTarget(theEvent, theTarget); + ReleaseEvent(theEvent); + } // Reset all locks - AcquireYieldMutex( nCount ); + AcquireYieldMutex( nCount ); } // ----------------------------------------------------------------------- -BOOL SalInstance::AnyInput( USHORT nType ) +bool AquaSalInstance::AnyInput( USHORT nType ) { return FALSE; } // ----------------------------------------------------------------------- -SalFrame* SalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) +SalFrame* AquaSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) { return NULL; } // ----------------------------------------------------------------------- -SalFrame* SalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) +SalFrame* AquaSalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) { - SalFrame *pFrame = new SalFrame; + //AquaSalFrame *pFrame = new AquaSalFrame(pParent, nSalFrameStyle); - pFrame->maFrameData.mpParent = pParent; + //pFrame->mpParent = (AquaSalFrame*)pParent; // Create the native window - pFrame->maFrameData.mhWnd = VCLWindow_New( nSalFrameStyle, NULL, - pFrame, &(pFrame->maFrameData) ); + //pFrame->mhWnd = Carbon_NewWindow( nSalFrameStyle, pFrame ); - return pFrame; + return new AquaSalFrame(pParent, nSalFrameStyle); //pFrame; } // ----------------------------------------------------------------------- -void SalInstance::DestroyFrame( SalFrame* pFrame ) +void AquaSalInstance::DestroyFrame( SalFrame* pFrame ) { delete pFrame; } // ----------------------------------------------------------------------- -SalObject* SalInstance::CreateObject( SalFrame* pParent ) +SalObject* AquaSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData ) { - SalObject *pObject = NULL; + AquaSalObject *pObject = NULL; if ( pParent ) { - pObject = new SalObject; - pObject->maObjectData.mpFrame = pParent; + pObject = new AquaSalObject(); + pObject->mpFrame = (AquaSalFrame*)pParent; } return pObject; @@ -389,74 +425,74 @@ // ----------------------------------------------------------------------- -void SalInstance::DestroyObject( SalObject* pObject ) +void AquaSalInstance::DestroyObject( SalObject* pObject ) { delete ( pObject ); } // ----------------------------------------------------------------------- -SalVirtualDevice* SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, USHORT nBitCount ) +SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, USHORT nBitCount, const SystemGraphicsData *pData ) { - SalVirtualDevice *pVirDev = new SalVirtualDevice; + AquaSalVirtualDevice *pVirDev = new AquaSalVirtualDevice; // Cache values for when SalVirtualDevice::GetGraphics() is invoked - pVirDev->maVirDevData.mnBitCount = nBitCount; - pVirDev->maVirDevData.mnWidth = nDX; - pVirDev->maVirDevData.mnHeight = nDY; + pVirDev->mnBitCount = nBitCount; + pVirDev->mnWidth = nDX; + pVirDev->mnHeight = nDY; return pVirDev; } // ----------------------------------------------------------------------- -void SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) +void AquaSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) { delete pDevice; } // ----------------------------------------------------------------------- -SalPrinter* SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) +SalPrinter* AquaSalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) { return NULL; } // ----------------------------------------------------------------------- -void SalInstance::DestroyPrinter( SalPrinter* pPrinter ) +void AquaSalInstance::DestroyPrinter( SalPrinter* pPrinter ) { } // ----------------------------------------------------------------------- -void SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) +void AquaSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) { } // ----------------------------------------------------------------------- -void SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) +void AquaSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) { } // ----------------------------------------------------------------------- -void SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) +void AquaSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) { } // ----------------------------------------------------------------------- -XubString SalInstance::GetDefaultPrinter() +XubString AquaSalInstance::GetDefaultPrinter() { return XubString(); } // ----------------------------------------------------------------------- -SalInfoPrinter* SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, +SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) { return NULL; @@ -464,41 +500,136 @@ // ----------------------------------------------------------------------- -void SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) +void AquaSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) { } // ----------------------------------------------------------------------- -SalSystem* SalInstance::CreateSystem() +SalSystem* AquaSalInstance::CreateSystem() { - return new SalSystem(); + return new AquaSalSystem(); } // ----------------------------------------------------------------------- -void SalInstance::DestroySystem( SalSystem* pSystem ) +void AquaSalInstance::DestroySystem( SalSystem* pSystem ) { delete pSystem; } // ----------------------------------------------------------------------- -void SalInstance::SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) +void AquaSalInstance::SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) { } // ----------------------------------------------------------------------- -void SalInstance::SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) +void AquaSalInstance::SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) { } // ----------------------------------------------------------------------- -void* SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) +void* AquaSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) { rReturnedBytes = 1; rReturnedType = AsciiCString; - return ""; + return (void*)""; } + + + + + + + + + + + + + + + + + + + +SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +{ + return NULL; +} + +void AquaSalInstance::DestroyMenu( SalMenu* ) +{ + +} + +SalMenuItem* AquaSalInstance::CreateMenuItem( const SalItemParams* pItemData ) +{ + +} + +void AquaSalInstance::DestroyMenuItem( SalMenuItem* ) +{ + +} + +SalSound* AquaSalInstance::CreateSalSound() +{ + return new AquaSalSound(); +} + +SalTimer* AquaSalInstance::CreateSalTimer() +{ + return new AquaSalTimer(); +} + +SalOpenGL* AquaSalInstance::CreateSalOpenGL( SalGraphics* pGraphics ) +{ + return new AquaSalOpenGL( pGraphics ); +} + +SalSystem* AquaSalInstance::CreateSalSystem() +{ + return new AquaSalSystem(); +} + +SalBitmap* AquaSalInstance::CreateSalBitmap() +{ + return new AquaSalBitmap(); +} + +SalSession* AquaSalInstance::CreateSalSession() +{ + return NULL; +} + +class MacImeStatus : public SalI18NImeStatus +{ +public: + MacImeStatus() {} + virtual ~MacImeStatus() {} + + // asks whether there is a status window available + // to toggle into menubar + virtual bool canToggle() { return false; } + virtual void toggle() {} +}; + +SalI18NImeStatus* AquaSalInstance::CreateI18NImeStatus() +{ + return new MacImeStatus(); +} + + + + +////////////////////////////////////////////////////////////// +void VCLApplication_Run( BOOL bWait ) +{ + RunApplicationEventLoop(); +} + Index: aqua/source/app/salmain.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/salmain.cxx,v retrieving revision 1.18 retrieving revision 1.18.112.1 diff -u -r1.18 -r1.18.112.1 --- aqua/source/app/salmain.cxx 9 Sep 2005 10:39:18 -0000 1.18 +++ aqua/source/app/salmain.cxx 18 Feb 2006 14:13:34 -0000 1.18.112.1 @@ -33,6 +33,7 @@ * ************************************************************************/ +#include #include #ifndef _SAL_MAIN_H_ Index: aqua/source/app/salsound.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/salsound.cxx,v retrieving revision 1.6 retrieving revision 1.6.112.1 diff -u -r1.6 -r1.6.112.1 --- aqua/source/app/salsound.cxx 9 Sep 2005 10:39:32 -0000 1.6 +++ aqua/source/app/salsound.cxx 27 Nov 2005 09:48:34 -0000 1.6.112.1 @@ -33,19 +33,19 @@ * ************************************************************************/ -#ifndef _SV_SALSOUND_HXX -#include +#ifndef _SV_SALSOUND_H +#include #endif // ======================================================================== // Initialize static data members -ULONG SalSound::mnSoundState = SOUND_STATE_UNLOADED; +ULONG AquaSalSound::mnSoundState = SOUND_STATE_UNLOADED; // ======================================================================== -SalSound::SalSound() : +AquaSalSound::AquaSalSound() : mpProc ( NULL ), mbLoop ( FALSE ), mbPaused ( FALSE ) @@ -54,52 +54,85 @@ // ------------------------------------------------------------------------ -SalSound::~SalSound() +AquaSalSound::~AquaSalSound() { Stop(); } // ------------------------------------------------------------------------ -BOOL SalSound::Create() -{ - return FALSE; -} +//BOOL AquaSalSound::Create() +//{ +// return FALSE; +//} // ------------------------------------------------------------------------ -void SalSound::Release() +void AquaSalSound::Release() { } // ------------------------------------------------------------------------ -BOOL SalSound::Init( SalFrame* pFrame, const XubString& rSoundName, ULONG& rSoundLen ) +bool AquaSalSound::Init( /*SalFrame* pFrame,*/ const String& rSoundName, ULONG& rSoundLen ) { return FALSE; } // ------------------------------------------------------------------------ -BOOL SalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ) +//BOOL AquaSalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ) +//{ +// return FALSE; +//} + +// ------------------------------------------------------------------------ + +void AquaSalSound::Play( ULONG nStartTime, ULONG nPlayLen, bool bLoop ) { - return FALSE; } // ------------------------------------------------------------------------ -void SalSound::Play( ULONG nStartTime, ULONG nPlayLen, BOOL bLoop ) +void AquaSalSound::Stop() { } // ------------------------------------------------------------------------ -void SalSound::Stop() +void AquaSalSound::Pause() { } -// ------------------------------------------------------------------------ -void SalSound::Pause() + + + + + + + +bool AquaSalSound::IsValid() { + return false; } + +void AquaSalSound::Continue() +{ + +} + +bool AquaSalSound::IsLoopMode() const +{ + return false; +} + +bool AquaSalSound::IsPlaying() const +{ + return false; +} + +bool AquaSalSound::IsPaused() const +{ + return false; +} \ No newline at end of file Index: aqua/source/app/salsys.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/salsys.cxx,v retrieving revision 1.4 retrieving revision 1.4.112.1 diff -u -r1.4 -r1.4.112.1 --- aqua/source/app/salsys.cxx 9 Sep 2005 10:39:53 -0000 1.4 +++ aqua/source/app/salsys.cxx 27 Nov 2005 09:48:34 -0000 1.4.112.1 @@ -36,33 +36,62 @@ #ifndef _SV_SALSYS_HXX #include #endif +#ifndef _SV_SALSYS_H +#include +#endif // ======================================================================= -SalSystem::SalSystem() -{ -} +//AquaSalSystem::AquaSalSystem() +//{ +//} // ----------------------------------------------------------------------- -SalSystem::~SalSystem() +AquaSalSystem::~AquaSalSystem() { } // ----------------------------------------------------------------------- -BOOL SalSystem::StartProcess( SalFrame* pFrame, - const XubString& rFileName, - const XubString& rParam, - const XubString& rWorkDir ) +//bool AquaSalSystem::StartProcess( SalFrame* pFrame, +// const XubString& rFileName, +// const XubString& rParam, +// const XubString& rWorkDir ) +//{ +// return FALSE; +//} + +// ----------------------------------------------------------------------- + +//BOOL AquaSalSystem::AddRecentDoc( SalFrame*, const XubString& rFileName ) +//{ +// return FALSE; +//} + + + + + + +int AquaSalSystem::ShowNativeDialog( const String& rTitle, + const String& rMessage, + const std::list< String >& rButtons, + int nDefButton ) { - return FALSE; + return 0; } -// ----------------------------------------------------------------------- +bool AquaSalSystem::GetSalSystemDisplayInfo( DisplayInfo& rInfo ) +{ + return false; +} -BOOL SalSystem::AddRecentDoc( SalFrame*, const XubString& rFileName ) +int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton) { - return FALSE; + return 0; } Index: aqua/source/app/saltimer.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/saltimer.cxx,v retrieving revision 1.10 retrieving revision 1.10.112.3 diff -u -r1.10 -r1.10.112.3 --- aqua/source/app/saltimer.cxx 9 Sep 2005 10:40:07 -0000 1.10 +++ aqua/source/app/saltimer.cxx 2 Mar 2006 00:31:03 -0000 1.10.112.3 @@ -33,34 +33,102 @@ * ************************************************************************/ -#ifndef _SV_SALTIMER_HXX -#include +#ifndef _SV_SALTIMER_H +#include #endif #ifndef _SV_SALDATA_HXX #include #endif -#ifndef _SV_VCLEVENT_H -#include -#endif // ======================================================================= -void SalTimer::Start( ULONG nMS ) +void AquaSalTimerProc ( TMTaskPtr tmTaskPtr ) { - VCLEvent_StartPeriodicEvents( nMS ); -} + ImplSVData* pSVData = ImplGetSVData(); + + AquaSalTimer *pSalTimer = (AquaSalTimer*) pSVData->mpSalTimer; + if( pSalTimer ) + { + if( ImplSalYieldMutexTryToAcquire() ) + { + pSalTimer->CallCallback(); + ImplSalYieldMutexRelease(); + + // fire again using current timeout as this is a single shot timer + pSalTimer->ReStart(); + } + else + { + // could not acquire solar mutex, so + // fire again with a short delay (10ms) + pSalTimer->ReStart( 10 ); + } + } +} // ----------------------------------------------------------------------- -void SalTimer::Stop() +AquaSalTimer::AquaSalTimer( ) +{ + mbInstalled = FALSE; + mMS = 0; + mTask.tmAddr = NewTimerUPP( AquaSalTimerProc ); +} + +AquaSalTimer::~AquaSalTimer() { - VCLEvent_StopPeriodicEvents(); + if( mbInstalled ) + RemoveTimeTask( (QElemPtr) &mTask ); + DisposeTimerUPP( mTask.tmAddr ); } // ----------------------------------------------------------------------- -void SalTimer::SetCallback( SALTIMERPROC pProc ) +void AquaSalTimer::Start( ULONG nMS ) +{ + // cancel current timer + if( mbInstalled ) + RemoveTimeTask( (QElemPtr) &mTask ); + + // store new timeout + mMS = nMS; + + // install the timer task + mbInstalled = InstallTask(); + + // fire + if( mbInstalled ) + PrimeTimeTask( (QElemPtr) &mTask, mMS ); +} + +void AquaSalTimer::ReStart( ULONG nMS ) { - SalData* pSalData = GetSalData(); - pSalData->mpTimerProc = pProc; + if( mbInstalled ) + // use current timeout if nMS == 0 + PrimeTimeTask( (QElemPtr) &mTask, nMS ? nMS : mMS ); } + +void AquaSalTimer::Stop() +{ + if( mbInstalled ) + { + RemoveTimeTask( (QElemPtr) &mTask ); + mbInstalled = FALSE; + } +} + +BOOL AquaSalTimer::InstallTask() +{ + // install the timer task + mTask.tmWakeUp = 0; + mTask.tmCount = 0; + if( InstallTimeTask( (QElemPtr) &mTask ) == noErr ) + return TRUE; + else + { + fprintf(stderr, "Could not install timer task!\n"); + return FALSE; + } +} + +// ----------------------------------------------------------------------- Index: aqua/source/gdi/VCLGraphics.m =================================================================== RCS file: aqua/source/gdi/VCLGraphics.m diff -N aqua/source/gdi/VCLGraphics.m --- aqua/source/gdi/VCLGraphics.m 9 Sep 2005 10:40:23 -0000 1.24 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,156 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#define _SV_VCLGRAPHICS_M - -#import - -// ======================================================================= - -// ======================================================================= - -// ----------------------------------------------------------------------- -// -// VCLGraphics -// -// ----------------------------------------------------------------------- - -@implementation VCLGraphics - -// ----------------------------------------------------------------------- -// -// Get, and lock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -+ (CGrafPtr)LockFocusCGrafPort: (VCLView *)hView -{ - if ( hView != nil ) - { - if ( [hView isKindOfClass: [NSQuickDrawView class]] ) - { - CGrafPtr pCGrafPort=NULL; - RGBColor oldFore, newFore; - Rect r; - NSRect viewBounds; - - [hView lockFocus]; - - // [ed] 12/12/01 The Carbon GrafPort only is valid as long as the view has - // the focus, so we need to be sure to execute lockFocus before assigning - // the port. - - pCGrafPort = [(NSQuickDrawView *)hView qdPort]; - - return pCGrafPort; - } - else - { - // [ed] 12/12/01 Error checking - - fprintf(stderr, "Non nil hView in LockFocusCGrafPort(), but not a quickdrawview\n"); - } // if - } - else - { - // [ed] 12/12/01 Error checking - - fprintf(stderr, "Nil hView in LockFocusCGrafPort()\n"); - } // if - - return NULL; -} // LockFocusCGrafPort - -// ----------------------------------------------------------------------- -// -// Close, and unlock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -+ (void)UnLockFocusCGrafPort: (VCLView *)hView -{ - if ( hView != nil ) - { - if ( [hView isKindOfClass: [NSQuickDrawView class]] ) - { - [hView unlockFocus]; - } // if - } // if -} // UnLockFocusCGrafPort - -@end - -// ======================================================================= - -// ======================================================================= - -// ----------------------------------------------------------------------- -// -// C wrapper functions -// -// ----------------------------------------------------------------------- - -// ----------------------------------------------------------------------- -// -// Get, and lock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -CGrafPtr VCLGraphics_LockFocusCGrafPort ( VCLVIEW hView ) -{ - if ( (VCLView *)hView == nil ) - return NULL; - - return [ VCLGraphics LockFocusCGrafPort: (VCLView *)hView ]; -} // VCLGraphics_LockFocusCGrafPort - -// ----------------------------------------------------------------------- -// -// Close, and unlock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -void VCLGraphics_UnLockFocusCGrafPort ( VCLVIEW hView ) -{ - if ( (VCLView *)hView == nil ) - return; - - [ VCLGraphics UnLockFocusCGrafPort: (VCLView *)hView ]; -} // VCLGraphics_UnLockFocusCGrafPort - -// ======================================================================= - -// ======================================================================= - Index: aqua/source/gdi/VCLGraphics.mm =================================================================== RCS file: aqua/source/gdi/VCLGraphics.mm diff -N aqua/source/gdi/VCLGraphics.mm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/source/gdi/VCLGraphics.mm 16 Feb 2006 21:36:35 -0000 1.1.2.2 @@ -0,0 +1,156 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#define _SV_VCLGRAPHICS_M + +#import + +// ======================================================================= + +// ======================================================================= + +// ----------------------------------------------------------------------- +// +// VCLGraphics +// +// ----------------------------------------------------------------------- + +@implementation VCLGraphics + +// ----------------------------------------------------------------------- +// +// Get, and lock, a QuickDraw View +// +// ----------------------------------------------------------------------- + ++ (CGrafPtr)LockFocusCGrafPort: (VCLView *)hView +{ + if ( hView != nil ) + { + if ( [hView isKindOfClass: [NSQuickDrawView class]] ) + { + CGrafPtr pCGrafPort=NULL; + RGBColor oldFore, newFore; + Rect r; + NSRect viewBounds; + + [hView lockFocus]; + + // [ed] 12/12/01 The Carbon GrafPort only is valid as long as the view has + // the focus, so we need to be sure to execute lockFocus before assigning + // the port. + + pCGrafPort = (CGrafPtr)[(NSQuickDrawView *)hView qdPort]; + + return pCGrafPort; + } + else + { + // [ed] 12/12/01 Error checking + + fprintf(stderr, "Non nil hView in LockFocusCGrafPort(), but not a quickdrawview\n"); + } // if + } + else + { + // [ed] 12/12/01 Error checking + + fprintf(stderr, "Nil hView in LockFocusCGrafPort()\n"); + } // if + + return NULL; +} // LockFocusCGrafPort + +// ----------------------------------------------------------------------- +// +// Close, and unlock, a QuickDraw View +// +// ----------------------------------------------------------------------- + ++ (void)UnLockFocusCGrafPort: (VCLView *)hView +{ + if ( hView != nil ) + { + if ( [hView isKindOfClass: [NSQuickDrawView class]] ) + { + [hView unlockFocus]; + } // if + } // if +} // UnLockFocusCGrafPort + +@end + +// ======================================================================= + +// ======================================================================= + +// ----------------------------------------------------------------------- +// +// C wrapper functions +// +// ----------------------------------------------------------------------- + +// ----------------------------------------------------------------------- +// +// Get, and lock, a QuickDraw View +// +// ----------------------------------------------------------------------- + +CGrafPtr VCLGraphics_LockFocusCGrafPort ( VCLVIEW hView ) +{ + if ( (VCLView *)hView == nil ) + return NULL; + + return [ VCLGraphics LockFocusCGrafPort: (VCLView *)hView ]; +} // VCLGraphics_LockFocusCGrafPort + +// ----------------------------------------------------------------------- +// +// Close, and unlock, a QuickDraw View +// +// ----------------------------------------------------------------------- + +void VCLGraphics_UnLockFocusCGrafPort ( VCLVIEW hView ) +{ + if ( (VCLView *)hView == nil ) + return; + + [ VCLGraphics UnLockFocusCGrafPort: (VCLView *)hView ]; +} // VCLGraphics_UnLockFocusCGrafPort + +// ======================================================================= + +// ======================================================================= + Index: aqua/source/gdi/makefile.mk =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/makefile.mk,v retrieving revision 1.10 retrieving revision 1.10.112.1 diff -u -r1.10 -r1.10.112.1 --- aqua/source/gdi/makefile.mk 9 Sep 2005 10:40:51 -0000 1.10 +++ aqua/source/gdi/makefile.mk 16 Feb 2006 21:36:35 -0000 1.10.112.1 @@ -63,7 +63,6 @@ $(SLO)$/salatsuifontutils.obj \ $(SLO)$/salfontutils.obj \ $(SLO)$/salgdi.obj \ - $(SLO)$/VCLGraphics.obj \ $(SLO)$/salvd.obj \ $(SLO)$/salprn.obj \ $(SLO)$/salbmp.obj \ Index: aqua/source/gdi/salatsuifontutils.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salatsuifontutils.cxx,v retrieving revision 1.5 retrieving revision 1.5.112.1 diff -u -r1.5 -r1.5.112.1 --- aqua/source/gdi/salatsuifontutils.cxx 9 Sep 2005 10:41:07 -0000 1.5 +++ aqua/source/gdi/salatsuifontutils.cxx 27 Nov 2005 09:48:35 -0000 1.5.112.1 @@ -149,9 +149,9 @@ ByteCount nFontFamilyNameLength = 0; FontNamesPtr pFontFamilyNames = NULL; FontNameCode nFontFamilyNameCode = kFontFamilyName; - FontLanguageCode nFontFamilyLanguageCode = kFontNoLanguage; - FontPlatformCode nFontFamilyPlatformCode = kFontNoPlatform; - FontScriptCode nFontFamilyScriptCode = kFontNoScript; + FontLanguageCode nFontFamilyLanguageCode = kFontNoLanguageCode; + FontPlatformCode nFontFamilyPlatformCode = kFontNoPlatformCode; + FontScriptCode nFontFamilyScriptCode = kFontNoScriptCode; ItemCount nFontFamilyIndex = 0; OSStatus nStatus = noErr; MacOSPtr pFontFamilyName = NULL; @@ -1053,9 +1053,9 @@ { FontNameEncodingRecord aBestFontNameEncoding; FontNameCode *pFontNameCode = NULL; - FontPlatformCode nFontNamePlatformCode = kFontNoPlatform; - FontScriptCode nFontNameScriptCode = kFontNoScript; - FontLanguageCode nFontNameLanguageCode = kFontNoLanguage; + FontPlatformCode nFontNamePlatformCode = kFontNoPlatformCode; + FontScriptCode nFontNameScriptCode = kFontNoScriptCode; + FontLanguageCode nFontNameLanguageCode = kFontNoLanguageCode; ItemCount nBestFontIndex = ULONG_MAX; ItemCount nNextFontIndex = 0; ItemCount nFontNamesCount = 0; Index: aqua/source/gdi/salbmp.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salbmp.cxx,v retrieving revision 1.23 retrieving revision 1.23.112.1 diff -u -r1.23 -r1.23.112.1 --- aqua/source/gdi/salbmp.cxx 9 Sep 2005 10:41:21 -0000 1.23 +++ aqua/source/gdi/salbmp.cxx 27 Nov 2005 09:48:36 -0000 1.23.112.1 @@ -33,15 +33,17 @@ * ************************************************************************/ -#ifndef _SV_SALBMP_HXX - #include +#ifndef _SV_SALBMP_H + #include #endif +#include + // ======================================================================= // ======================================================================= -SalBitmap::SalBitmap() : +AquaSalBitmap::AquaSalBitmap() : mpVirDev( 0 ), mnBitCount( 0 ) { @@ -49,20 +51,20 @@ // ------------------------------------------------------------------ -SalBitmap::~SalBitmap() +AquaSalBitmap::~AquaSalBitmap() { Destroy(); } // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const Size& rSize, - USHORT nBitCount, - const BitmapPalette& rBitmapPalette - ) +bool AquaSalBitmap::Create( const Size& rSize, + USHORT nBitCount, + const BitmapPalette& rBitmapPalette + ) { ImplSVData *pSVData = ImplGetSVData(); - BOOL bSalBitmapCreated = FALSE; + bool bSalBitmapCreated = FALSE; if ( pSVData != NULL ) { @@ -74,24 +76,25 @@ if ( ( nHeight > 0 ) && ( nWidth > 0 ) ) { // Create a SalVirtualDevice - + AquaSalInstance *pInst = (AquaSalInstance*)pSVData->mpDefInst; mpVirDev - = pSVData->mpDefInst->CreateVirtualDevice( NULL, - nWidth, - nHeight, - nBitCount - ); + = (AquaSalVirtualDevice*)pInst->CreateVirtualDevice( NULL, + nWidth, + nHeight, + nBitCount, + NULL + ); if ( mpVirDev != NULL ) { // Get the SalGraphics which contains the // GWorld we will draw to - SalGraphics *pGraphics = GetGraphics(); + AquaSalGraphics *pGraphics = GetGraphics(); if ( pGraphics != NULL ) { - const CGrafPtr pCGraf = pGraphics->maGraphicsData.mpCGrafPort; + const CGrafPtr pCGraf = pGraphics->mpCGrafPort; if ( pCGraf != NULL ) { @@ -124,23 +127,24 @@ // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const SalBitmap& rSalBmp ) +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp ) { return Create( rSalBmp, rSalBmp.GetBitCount() ); } // SalBitmap::Create // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const SalBitmap& rSalBmp, +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) { USHORT nSalBmpBitCount = 0; - BOOL bSalBitmapCreated = FALSE; + bool bSalBitmapCreated = FALSE; + AquaSalGraphics *pMacGraphics = (AquaSalGraphics*)pGraphics; if ( pGraphics != NULL ) { - const CGrafPtr pCGraf = pGraphics->maGraphicsData.mpCGrafPort; + const CGrafPtr pCGraf = pMacGraphics->mpCGrafPort; if ( pCGraf != NULL ) { @@ -169,35 +173,36 @@ // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ) +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ) { - BOOL bSalBitmapCreated = FALSE; + bool bSalBitmapCreated = FALSE; + AquaSalBitmap rMacSalBmp = (AquaSalBitmap&)rSalBmp; - if ( Create( rSalBmp.mnSize, nNewBitCount, BitmapPalette() ) ) + if ( Create( rMacSalBmp.mnSize, nNewBitCount, BitmapPalette() ) ) { // Copy pixels from rSalBmp.mpVirDev to mpVirDev - SalGraphics *pDstGraphics = GetGraphics(); + AquaSalGraphics *pDstGraphics = GetGraphics(); if ( pDstGraphics != NULL ) { - SalGraphics *pSrcGraphics = rSalBmp.GetGraphics(); + AquaSalGraphics *pSrcGraphics = rMacSalBmp.GetGraphics(); - if ( ( pSrcGraphics != NULL ) - && ( pSrcGraphics->maGraphicsData.mpCGrafPort != NULL ) + if ( ( pSrcGraphics != NULL ) + && ( pSrcGraphics->mpCGrafPort != NULL ) ) { SalTwoRect aTwoRect; // Get size of graphics to copy from - GetTwoRectFromSalBmp( rSalBmp, &aTwoRect ); + GetTwoRectFromSalBmp( rMacSalBmp, &aTwoRect ); // Copy bits from source graphics pDstGraphics->CopyBits( &aTwoRect, pSrcGraphics ); - rSalBmp.ReleaseGraphics( pSrcGraphics ); + rMacSalBmp.ReleaseGraphics( pSrcGraphics ); bSalBitmapCreated = TRUE; } // if @@ -211,7 +216,7 @@ // ------------------------------------------------------------------ -void SalBitmap::Destroy() +void AquaSalBitmap::Destroy() { ImplSVData *pSVData = ImplGetSVData(); @@ -230,7 +235,7 @@ // ------------------------------------------------------------------ -BitmapBuffer* SalBitmap::AcquireBuffer( BOOL bReadOnly ) +BitmapBuffer* AquaSalBitmap::AcquireBuffer( bool bReadOnly ) { BitmapBuffer *pBuffer = NULL; @@ -255,8 +260,8 @@ if ( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) ) { - pBuffer->mnWidth = mpVirDev->maVirDevData.mnWidth; - pBuffer->mnHeight = mpVirDev->maVirDevData.mnHeight; + pBuffer->mnWidth = mpVirDev->mnWidth; + pBuffer->mnHeight = mpVirDev->mnHeight; pBuffer->mnScanlineSize = GetPixRowBytes( mhPixMap ); pBuffer->mpBits = (BYTE *)GetPixBaseAddr( mhPixMap ); pBuffer->mnBitCount = GetPixDepth( mhPixMap); @@ -324,17 +329,17 @@ // ------------------------------------------------------------------ -void SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly ) +void AquaSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) { if ( mpVirDev != NULL ) { // Get the SalGraphics which contains the GWorld // we used as the buffer - SalGraphics *pGraphics = GetGraphics(); + AquaSalGraphics *pGraphics = GetGraphics(); - if ( ( pGraphics != NULL ) - && ( pGraphics->maGraphicsData.mpCGrafPort != NULL ) + if ( ( pGraphics != NULL ) + && ( pGraphics->mpCGrafPort != NULL ) ) { // Release the SalGraphics so that others can get a @@ -461,11 +466,11 @@ // ------------------------------------------------------------------ -SalGraphics* SalBitmap::GetGraphics() +AquaSalGraphics* AquaSalBitmap::GetGraphics() { if ( mpVirDev != NULL ) { - return mpVirDev->GetGraphics(); + return (AquaSalGraphics*)mpVirDev->GetGraphics(); } // if else { @@ -475,7 +480,7 @@ // ------------------------------------------------------------------ -void SalBitmap::ReleaseGraphics( SalGraphics* pGraphics ) +void AquaSalBitmap::ReleaseGraphics( SalGraphics* pGraphics ) { if ( mpVirDev != NULL ) { @@ -485,4 +490,14 @@ // ======================================================================= + + + + + // ======================================================================= + +bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) +{ + return false; +} Index: aqua/source/gdi/salcolorutils.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salcolorutils.cxx,v retrieving revision 1.5 retrieving revision 1.5.112.1 diff -u -r1.5 -r1.5.112.1 --- aqua/source/gdi/salcolorutils.cxx 9 Sep 2005 10:41:36 -0000 1.5 +++ aqua/source/gdi/salcolorutils.cxx 27 Nov 2005 09:48:36 -0000 1.5.112.1 @@ -36,6 +36,7 @@ #ifndef _SV_SALCOLORUTILS_HXX #include #endif +#include // ======================================================================= Index: aqua/source/gdi/salfontutils.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salfontutils.cxx,v retrieving revision 1.7 retrieving revision 1.7.112.1 diff -u -r1.7 -r1.7.112.1 --- aqua/source/gdi/salfontutils.cxx 9 Sep 2005 10:41:50 -0000 1.7 +++ aqua/source/gdi/salfontutils.cxx 27 Nov 2005 09:48:36 -0000 1.7.112.1 @@ -45,164 +45,320 @@ #include #endif +#include + // ======================================================================= // ======================================================================= -static rtl_Script GetRTLScriptFromFontScriptCode( const FontNameEncodingPtr pFontNameEncoding ) +static rtl_TextEncoding GetRTLScriptFromFontScriptCode( const FontNameEncodingPtr pFontNameEncoding ) { FontScriptCode nFontScriptCode = pFontNameEncoding->mnFontScriptCode; FontPlatformCode nFontPlatformCode = pFontNameEncoding->mnFontPlatformCode; - rtl_Script nFontRTLScript = SCRIPT_DONTKNOW; + rtl_TextEncoding nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; if ( nFontPlatformCode == kFontUnicodePlatform ) { - nFontRTLScript = SCRIPT_UNICODE; + nFontRTLScript = RTL_TEXTENCODING_UNICODE; } // if else { switch( nFontScriptCode ) { case kFontRomanScript: - nFontRTLScript = SCRIPT_LATIN; + nFontRTLScript = RTL_TEXTENCODING_APPLE_ROMAN; break; case kFontJapaneseScript: - nFontRTLScript = SCRIPT_JAPANESE; + nFontRTLScript = RTL_TEXTENCODING_APPLE_JAPANESE; break; case kFontTraditionalChineseScript: - nFontRTLScript = SCRIPT_CHINESE_TRADITIONAL; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CHINTRAD; break; case kFontKoreanScript: - nFontRTLScript = SCRIPT_KOREAN; + nFontRTLScript = RTL_TEXTENCODING_APPLE_KOREAN; break; case kFontArabicScript: - nFontRTLScript = SCRIPT_ARABIC; + nFontRTLScript = RTL_TEXTENCODING_APPLE_ARABIC; break; case kFontHebrewScript: - nFontRTLScript = SCRIPT_HEBREW; + nFontRTLScript = RTL_TEXTENCODING_APPLE_HEBREW; break; case kFontGreekScript: - nFontRTLScript = SCRIPT_GREEK; + nFontRTLScript = RTL_TEXTENCODING_APPLE_GREEK; break; case kFontCyrillicScript: - nFontRTLScript = SCRIPT_CYRILLIC; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CYRILLIC; break; case kFontRSymbolScript: - nFontRTLScript = SCRIPT_SYMBOL; + nFontRTLScript = RTL_TEXTENCODING_SYMBOL; break; case kFontDevanagariScript: - nFontRTLScript = SCRIPT_DEVANAGARI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_DEVANAGARI; break; case kFontGurmukhiScript: - nFontRTLScript = SCRIPT_GURMUKHI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_GURMUKHI; break; case kFontGujaratiScript: - nFontRTLScript = SCRIPT_GUJARATI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_GUJARATI; break; case kFontOriyaScript: - nFontRTLScript = SCRIPT_ORIYA; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontBengaliScript: - nFontRTLScript = SCRIPT_BENGALI; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontTamilScript: - nFontRTLScript = SCRIPT_TAMIL; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontTeluguScript: - nFontRTLScript = SCRIPT_TELUGU; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontKannadaScript: - nFontRTLScript = SCRIPT_KANNADA; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontMalayalamScript: - nFontRTLScript = SCRIPT_MALAYALAM; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontSinhaleseScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontBurmeseScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontKhmerScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontThaiScript: - nFontRTLScript = SCRIPT_THAI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_THAI; break; case kFontLaotianScript: - nFontRTLScript = SCRIPT_LAO; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontGeorgianScript: - nFontRTLScript = SCRIPT_GEORGIEN; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontArmenianScript: - nFontRTLScript = SCRIPT_ARMENIAN; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontSimpleChineseScript: - nFontRTLScript = SCRIPT_CHINESE_SIMPLIFIED; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CHINSIMP; break; case kFontTibetanScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontMongolianScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontGeezScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontEastEuropeanRomanScript: - nFontRTLScript = SCRIPT_EASTEUROPE; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CENTEURO; break; case kFontVietnameseScript: - nFontRTLScript = SCRIPT_VIETNAMESE; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontExtendedArabicScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontUninterpretedScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; default: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; } // switch } // else return nFontRTLScript; } // GetRTLScriptFromFontScriptCode +//static rtl_Script GetRTLScriptFromFontScriptCode( const FontNameEncodingPtr pFontNameEncoding ) +//{ +// FontScriptCode nFontScriptCode = pFontNameEncoding->mnFontScriptCode; +// FontPlatformCode nFontPlatformCode = pFontNameEncoding->mnFontPlatformCode; +// rtl_Script nFontRTLScript = SCRIPT_DONTKNOW; +// +// if ( nFontPlatformCode == kFontUnicodePlatform ) +// { +// nFontRTLScript = SCRIPT_UNICODE; +// } // if +// else +// { +// switch( nFontScriptCode ) +// { +// case kFontRomanScript: +// nFontRTLScript = SCRIPT_LATIN; +// break; +// +// case kFontJapaneseScript: +// nFontRTLScript = SCRIPT_JAPANESE; +// break; +// +// case kFontTraditionalChineseScript: +// nFontRTLScript = SCRIPT_CHINESE_TRADITIONAL; +// break; +// +// case kFontKoreanScript: +// nFontRTLScript = SCRIPT_KOREAN; +// break; +// +// case kFontArabicScript: +// nFontRTLScript = SCRIPT_ARABIC; +// break; +// +// case kFontHebrewScript: +// nFontRTLScript = SCRIPT_HEBREW; +// break; +// +// case kFontGreekScript: +// nFontRTLScript = SCRIPT_GREEK; +// break; +// +// case kFontCyrillicScript: +// nFontRTLScript = SCRIPT_CYRILLIC; +// break; +// +// case kFontRSymbolScript: +// nFontRTLScript = SCRIPT_SYMBOL; +// break; +// +// case kFontDevanagariScript: +// nFontRTLScript = SCRIPT_DEVANAGARI; +// break; +// +// case kFontGurmukhiScript: +// nFontRTLScript = SCRIPT_GURMUKHI; +// break; +// +// case kFontGujaratiScript: +// nFontRTLScript = SCRIPT_GUJARATI; +// break; +// +// case kFontOriyaScript: +// nFontRTLScript = SCRIPT_ORIYA; +// break; +// +// case kFontBengaliScript: +// nFontRTLScript = SCRIPT_BENGALI; +// break; +// +// case kFontTamilScript: +// nFontRTLScript = SCRIPT_TAMIL; +// break; +// +// case kFontTeluguScript: +// nFontRTLScript = SCRIPT_TELUGU; +// break; +// +// case kFontKannadaScript: +// nFontRTLScript = SCRIPT_KANNADA; +// break; +// +// case kFontMalayalamScript: +// nFontRTLScript = SCRIPT_MALAYALAM; +// break; +// +// case kFontSinhaleseScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontBurmeseScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontKhmerScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontThaiScript: +// nFontRTLScript = SCRIPT_THAI; +// break; +// +// case kFontLaotianScript: +// nFontRTLScript = SCRIPT_LAO; +// break; +// +// case kFontGeorgianScript: +// nFontRTLScript = SCRIPT_GEORGIEN; +// break; +// +// case kFontArmenianScript: +// nFontRTLScript = SCRIPT_ARMENIAN; +// break; +// +// case kFontSimpleChineseScript: +// nFontRTLScript = SCRIPT_CHINESE_SIMPLIFIED; +// break; +// +// case kFontTibetanScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontMongolianScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontGeezScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontEastEuropeanRomanScript: +// nFontRTLScript = SCRIPT_EASTEUROPE; +// break; +// +// case kFontVietnameseScript: +// nFontRTLScript = SCRIPT_VIETNAMESE; +// break; +// +// case kFontExtendedArabicScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontUninterpretedScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// default: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// } // switch +// } // else +// +// return nFontRTLScript; +//} // GetRTLScriptFromFontScriptCode // ----------------------------------------------------------------------- @@ -306,18 +462,19 @@ if ( hFontList != NULL ) { short nItem = 1; - ImplFontData *pData = NULL; - ImplFontData *pCompare = NULL; + ImplDevFontAttributes pAttributes; + ImplMacFontData *pData = NULL; + ImplMacFontData *pCompare = NULL; ULONG nInsertPos = 0; char pFontFamilyName[kFontFamilyNameLength]; char pFontStyleName[kFontStyleNameLength]; - for ( nItem = 1; - nItem <= nFontListLength; + for ( nItem = 0; + nItem < nFontListLength; nItem++ ) { - pData = new ImplFontData; + pData = new ImplMacFontData(pAttributes,0,0,0); memset( pFontFamilyName, 0, kFontFamilyNameMemSize ); memset( pFontStyleName, 0, kFontStyleNameMemSize ); @@ -353,11 +510,12 @@ pData->meWeight = GetFontWeightFromFontNamesRecord( hFontList[ nItem ] ); - pData->mpSysData = NULL; // System-Data (only GSL) - pData->mnWidth = 0; // Font width in pixels - pData->mnHeight = 0; // Font height in pixels + //pData->mpSysData = (AquaSalSystem*)NULL; // System-Data (only GSL) +// pData->mnWidth = 0; // Font width in pixels +// pData->mnHeight = 0; // Font height in pixels +// pData->SetBitmapSize(0,0); pData->meFamily = FAMILY_DONTKNOW; // Font family - pData->meCharSet = 0; // Font character set +// pData->meCharSet = 0; // Font character set pData->mePitch = PITCH_DONTKNOW; // Font pitch pData->meWidthType = WIDTH_NORMAL; // Font weight type pData->meWeight = WEIGHT_NORMAL; // Font weight @@ -367,11 +525,11 @@ pData->mbDevice = TRUE; // Device font pData->mnQuality = 0; // Font quality - nInsertPos = nItem - 1; + nInsertPos = nItem /*- 1*/; while ( nInsertPos ) { - pCompare = pList->GetObject( nInsertPos - 1 ); + pCompare = (ImplMacFontData*)pList->GetObject( nInsertPos - 1 ); if ( pCompare->maName > pData->maName ) { Index: aqua/source/gdi/salgdi.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salgdi.cxx,v retrieving revision 1.59 retrieving revision 1.59.112.5 diff -u -r1.59 -r1.59.112.5 --- aqua/source/gdi/salgdi.cxx 9 Sep 2005 10:42:09 -0000 1.59 +++ aqua/source/gdi/salgdi.cxx 27 Feb 2006 21:33:54 -0000 1.59.112.5 @@ -45,8 +45,8 @@ #include #endif -#ifndef _SV_VCLGRAPHICS_H - #include +#ifndef _SV_SALBMP_H +#include #endif #ifndef _SV_SALCOLORUTILS_HXX @@ -65,100 +65,128 @@ #include #endif +#include + // ======================================================================= // ======================================================================= -SalGraphics::SalGraphics() +ImplMacFontData::ImplMacFontData(const ImplDevFontAttributes& rDFA, + int nFontHeight=0, int macCharSet=0, + int nPitchAndFamily=0) : +ImplFontData(rDFA,0) +{ + +} + +ImplMacFontData::~ImplMacFontData() +{ + +} + +ImplFontData* ImplMacFontData::Clone() const +{ + return NULL; +} + +ImplFontEntry* ImplMacFontData::CreateFontInstance( ImplFontSelectData& rFSD ) const +{ + ImplFontEntry* pEntry = new ImplFontEntry( rFSD ); + return pEntry; +} + + +// ======================================================================= + +// ======================================================================= + +AquaSalGraphics::AquaSalGraphics() { // QuickDraw graph port, offscreen graphic world, and graphic device handle - InitQD( &maGraphicsData ); + InitQD( this ); // GWorld attributes - InitGWorld( &maGraphicsData ); + InitGWorld( this ); // Regions within a current port - InitRegions( &maGraphicsData ); + InitRegions( this ); // Font attributes - InitFont( &maGraphicsData ); + InitFont( this ); // Pen attributes and status - InitPen( &maGraphicsData ); + InitPen( this ); // Brush attributes and status - InitBrush( &maGraphicsData ); + InitBrush( this ); // Miscellaneous status flags - InitStatusFlags( &maGraphicsData ); + InitStatusFlags( this ); } // SalGraphics Class Constructor // ----------------------------------------------------------------------- -SalGraphics::~SalGraphics() +AquaSalGraphics::~AquaSalGraphics() { // Release memory taken up by clip region, off-screen // graph world, and colour graph port - if ( ( ( maGraphicsData.mbGWorldPixelsCopy == TRUE ) - || ( maGraphicsData.mbGWorldPixelsNew == TRUE ) + if ( ( ( mbGWorldPixelsCopy == TRUE ) + || ( mbGWorldPixelsNew == TRUE ) ) - && ( maGraphicsData.mhGWorldPixMap != NULL ) + && ( mhGWorldPixMap != NULL ) ) { - DisposePixMap( maGraphicsData.mhGWorldPixMap ); + DisposePixMap( mhGWorldPixMap ); - maGraphicsData.mhGWorldPixMap = NULL; + mhGWorldPixMap = NULL; } // if - if ( maGraphicsData.mhClipRgn != NULL ) + if ( mhClipRgn != NULL ) { - DisposeRgn( maGraphicsData.mhClipRgn ); + DisposeRgn( mhClipRgn ); - maGraphicsData.mhClipRgn = NULL; + mhClipRgn = NULL; } // if - if ( maGraphicsData.mpGWorld != NULL ) + if ( mpGWorld != NULL ) { - DisposeGWorld( maGraphicsData.mpGWorld ); + DisposeGWorld( mpGWorld ); - maGraphicsData.mpGWorld = NULL; + mpGWorld = NULL; } // if - if ( maGraphicsData.mpCGrafPort != NULL ) + if ( mpCGrafPort != NULL ) { - DisposeGWorld( maGraphicsData.mpCGrafPort ); + DisposeGWorld( mpCGrafPort ); - maGraphicsData.mpCGrafPort = NULL; + mpCGrafPort = NULL; } // if - // Initialize the rest of the fields to zero - - memset( &maGraphicsData, 0, sizeof(SalGraphicsData) ); } // SalGraphics Class Destructor // ======================================================================= // ======================================================================= -void SalGraphics::GetResolution( long& rDPIX, +void AquaSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) { long nHRes = 0; long nVRes = 0; - maGraphicsData.mnOSStatus = GetGDeviceResolution( &nHRes, &nVRes ); + mnOSStatus = GetGDeviceResolution( &nHRes, &nVRes ); - if ( maGraphicsData.mnOSStatus == noErr ) + if ( mnOSStatus == noErr ) { rDPIX = nHRes; rDPIY = nVRes; @@ -167,16 +195,16 @@ // ----------------------------------------------------------------------- -void SalGraphics::GetScreenFontResolution( long& rDPIX, +void AquaSalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY ) { long nHRes = 0; long nVRes = 0; - maGraphicsData.mnOSStatus = GetGDeviceResolution( &nHRes, &nVRes ); + mnOSStatus = GetGDeviceResolution( &nHRes, &nVRes ); - if ( maGraphicsData.mnOSStatus == noErr ) + if ( mnOSStatus == noErr ) { rDPIX = nHRes; rDPIY = nVRes; @@ -185,26 +213,26 @@ // ----------------------------------------------------------------------- -USHORT SalGraphics::GetBitCount() +USHORT AquaSalGraphics::GetBitCount() { unsigned short nBitDepth = 0; - maGraphicsData.mnOSStatus = GetGDeviceBitDepth( &nBitDepth ); + mnOSStatus = GetGDeviceBitDepth( &nBitDepth ); return nBitDepth; } // SalGraphics::GetBitCount // ----------------------------------------------------------------------- -void SalGraphics::ResetClipRegion() +void AquaSalGraphics::ResetClipRegion() { - if ( !maGraphicsData.mbWindow ) + if ( !mbWindow ) { - if ( maGraphicsData.mhClipRgn != NULL ) + if ( mhClipRgn != NULL ) { - DisposeRgn( maGraphicsData.mhClipRgn ); + DisposeRgn( mhClipRgn ); - maGraphicsData.mhClipRgn = NULL; + mhClipRgn = NULL; } // if } // if else @@ -215,17 +243,17 @@ short nRight = 0; short nBottom = 0; - if ( maGraphicsData.mhClipRgn == NULL ) + if ( mhClipRgn == NULL ) { - maGraphicsData.mhClipRgn = NewRgn(); + mhClipRgn = NewRgn(); } // if - GetPortBounds( maGraphicsData.mpCGrafPort, &aClipRect); + GetPortBounds( mpCGrafPort, &aClipRect); nRight = aClipRect.right - aClipRect.left; nBottom = aClipRect.bottom - aClipRect.top; - MacSetRectRgn ( maGraphicsData.mhClipRgn, + MacSetRectRgn ( mhClipRgn, nLeft, nTop, nRight, @@ -233,24 +261,24 @@ ); } // else - maGraphicsData.mbClipRgnChanged = TRUE; + mbClipRgnChanged = TRUE; } // SalGraphics::ResetClipRegion // ----------------------------------------------------------------------- -void SalGraphics::BeginSetClipRegion( ULONG nRectCount ) +void AquaSalGraphics::BeginSetClipRegion( ULONG nRectCount ) { - if ( maGraphicsData.mhClipRgn != NULL ) + if ( mhClipRgn != NULL ) { - DisposeRgn( maGraphicsData.mhClipRgn ); + DisposeRgn( mhClipRgn ); - maGraphicsData.mhClipRgn = NULL; + mhClipRgn = NULL; } // if } // SalGraphics::BeginSetClipRegion // ----------------------------------------------------------------------- -BOOL SalGraphics::UnionClipRegion( long nX, +BOOL AquaSalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight @@ -275,23 +303,23 @@ nBottom ); - if ( maGraphicsData.mhClipRgn != NULL ) + if ( mhClipRgn != NULL ) { - MacUnionRgn ( maGraphicsData.mhClipRgn, + MacUnionRgn ( mhClipRgn, hClipRegion, - maGraphicsData.mhClipRgn + mhClipRgn ); - maGraphicsData.mnOSStatus = QDErr(); + mnOSStatus = QDErr(); DisposeRgn( hClipRegion ); } // if else { - maGraphicsData.mhClipRgn = hClipRegion; + mhClipRgn = hClipRegion; } // else - if ( maGraphicsData.mnOSStatus == noErr ) + if ( mnOSStatus == noErr ) { bClipRegionsJoined = TRUE; } // if @@ -302,11 +330,11 @@ // ----------------------------------------------------------------------- -void SalGraphics::EndSetClipRegion() +void AquaSalGraphics::EndSetClipRegion() { - maGraphicsData.mbClipRgnChanged = TRUE; + mbClipRgnChanged = TRUE; - if ( maGraphicsData.mhClipRgn == NULL ) + if ( mhClipRgn == NULL ) { ResetClipRegion(); } @@ -314,55 +342,55 @@ // ----------------------------------------------------------------------- -void SalGraphics::SetLineColor() +void AquaSalGraphics::SetLineColor() { - maGraphicsData.mbPenTransparent = TRUE; + mbPenTransparent = TRUE; } // SalGraphics::SetLineColor // ----------------------------------------------------------------------- -void SalGraphics::SetLineColor( SalColor nSalColor ) +void AquaSalGraphics::SetLineColor( SalColor nSalColor ) { - maGraphicsData.mbPenTransparent = FALSE; - maGraphicsData.maPenColor = SALColor2RGBColor( nSalColor ); + mbPenTransparent = FALSE; + maPenColor = SALColor2RGBColor( nSalColor ); } // SalGraphics::SetLineColor // ----------------------------------------------------------------------- -void SalGraphics::SetFillColor() +void AquaSalGraphics::SetFillColor() { - maGraphicsData.mbBrushTransparent = TRUE; + mbBrushTransparent = TRUE; } // SalGraphics::SetFillColor // ----------------------------------------------------------------------- -void SalGraphics::SetFillColor( SalColor nSalColor ) +void AquaSalGraphics::SetFillColor( SalColor nSalColor ) { RGBColor aRGBColor; aRGBColor = SALColor2RGBColor( nSalColor ); - maGraphicsData.maBrushColor = aRGBColor; - maGraphicsData.mbBrushTransparent = FALSE; + maBrushColor = aRGBColor; + mbBrushTransparent = FALSE; } // SalGraphics::SetFillColor // ----------------------------------------------------------------------- -void SalGraphics::SetXORMode( BOOL bSet ) +void AquaSalGraphics::SetXORMode( BOOL bSet ) { if ( bSet == TRUE ) { - maGraphicsData.mnPenMode = patXor; + mnPenMode = patXor; } // if else { - maGraphicsData.mnPenMode = patCopy; + mnPenMode = patCopy; } // else } // SalGraphics::SetXORMode // ----------------------------------------------------------------------- -void SalGraphics::SetROPLineColor( SalROPColor nROPColor ) +void AquaSalGraphics::SetROPLineColor( SalROPColor nROPColor ) { SalColor nSalColor = GetROPSalColor( nROPColor ); @@ -371,7 +399,7 @@ // ----------------------------------------------------------------------- -void SalGraphics::SetROPFillColor( SalROPColor nROPColor ) +void AquaSalGraphics::SetROPFillColor( SalROPColor nROPColor ) { SalColor nSalColor = GetROPSalColor( nROPColor ); @@ -380,28 +408,28 @@ // ----------------------------------------------------------------------- -void SalGraphics::DrawPixel( long nX, +void AquaSalGraphics::DrawPixel( long nX, long nY ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - RGBColor aPixelRGBColor = maGraphicsData.maPenColor; + RGBColor aPixelRGBColor = maPenColor; SetCPixel( nX, nY, &aPixelRGBColor ); - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // SalGraphics::DrawPixel // ----------------------------------------------------------------------- -void SalGraphics::DrawPixel( long nX, +void AquaSalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { RGBColor aPixelRGBColor; @@ -409,59 +437,61 @@ SetCPixel( nX, nY, &aPixelRGBColor ); - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // SalGraphics::DrawPixel // ----------------------------------------------------------------------- -void SalGraphics::DrawLine( long nX1, +void AquaSalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2 ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { MoveTo( nX1, nY1 ); - if ( maGraphicsData.mbPenTransparent == TRUE ) + if ( mbPenTransparent == TRUE ) { SetBlackForeColor(); } // if else { - RGBColor aPenColor = maGraphicsData.maPenColor; + RGBColor aPenColor = maPenColor; RGBForeColor( &aPenColor ); } // else MacLineTo( nX2, nY2 ); - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // SalGraphics::DrawLine // ----------------------------------------------------------------------- -void SalGraphics::DrawRect( long nX, +void AquaSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) { - if ( BeginGraphics( &maGraphicsData ) ) + fprintf(stdout, ">*>_> %s\n",__func__); + + if ( BeginGraphics( this ) ) { long nEndX = 0; long nEndY = 0; - RGBColor aBrushColor = maGraphicsData.maBrushColor; + RGBColor aBrushColor = maBrushColor; Rect aRect; // [ed] 12/1/01 Parameter checks. Limit all of the parameters to fit within // the current port bounds Rect portBounds; - GetPortBounds(maGraphicsData.mpCGrafPort, &portBounds); + GetPortBounds(mpCGrafPort, &portBounds); if(nX < portBounds.left) nX=portBounds.left; @@ -476,7 +506,7 @@ nWidth=portBounds.right-portBounds.left-(nX-portBounds.left)-1; // Compute the second set of (nX,nY) coordinates - + /* nEndX = nX + nWidth; nEndY = nY + nHeight; @@ -485,29 +515,32 @@ MoveTo( nX, nY ); MacSetRect( &aRect, nX, nY, nEndX, nEndY ); - - if ( maGraphicsData.mbBrushTransparent == TRUE ) +*/ + if ( mbBrushTransparent == TRUE ) { MacFrameRect( &aRect ); } // if else - { - PaintRect( &aRect ); + { + fprintf(stdout, "PaintRect\n"); + CGContextSetRGBFillColor (mhContext, 1, 0, 0, 1); + CGContextFillRect (mhContext, CGRectMake (nX, nY, nWidth, nHeight)); + //PaintRect( &aRect ); } // else - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // SalGraphics::DrawRect // ----------------------------------------------------------------------- -void SalGraphics::DrawPolyLine( ULONG nPoints, +void AquaSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) { if ( ( nPoints > 1 ) && ( pPtAry != NULL ) ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { long nPolyEdges = 0; PolyHandle hPolygon = NULL; @@ -541,9 +574,9 @@ // Did a QD error occur whilst constructing a polygon? - maGraphicsData.mnOSStatus = QDErr(); + mnOSStatus = QDErr(); - if ( ( maGraphicsData.mnOSStatus == noErr ) + if ( ( mnOSStatus == noErr ) && ( hPolygon != NULL ) ) { @@ -552,24 +585,24 @@ KillPoly( hPolygon ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawPolyLine // ----------------------------------------------------------------------- -void SalGraphics::DrawPolygon( ULONG nPoints, +void AquaSalGraphics::drawPolygon( ULONG nPoints, const SalPoint *pPtAry ) { if ( ( nPoints > 1 ) && ( pPtAry != NULL ) ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { long nPolyEdges = 0; PolyHandle hPolygon = NULL; - RGBColor aPolyColor = maGraphicsData.maBrushColor; + RGBColor aPolyColor = maBrushColor; RGBForeColor( &aPolyColor ); @@ -600,9 +633,9 @@ // Did a QD error occur whilst constructing a polygon? - maGraphicsData.mnOSStatus = QDErr(); + mnOSStatus = QDErr(); - if ( ( maGraphicsData.mnOSStatus == noErr ) + if ( ( mnOSStatus == noErr ) && ( hPolygon != NULL ) ) { @@ -611,24 +644,24 @@ KillPoly( hPolygon ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawPolygon // ----------------------------------------------------------------------- -void SalGraphics::DrawPolyPolygon( ULONG nPoly, +void AquaSalGraphics::DrawPolyPolygon( ULONG nPoly, const ULONG *pPoints, PCONSTSALPOINT *ppPtAry ) { if ( ( nPoly > 1 ) && ( ppPtAry != NULL ) && ( ppPtAry != NULL ) ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { RgnHandle hPolyRgn = NULL; - RGBColor aPolyColor = maGraphicsData.maBrushColor; + RGBColor aPolyColor = maBrushColor; OSStatus nOSStatus = noErr; RGBForeColor( &aPolyColor ); @@ -652,30 +685,30 @@ hPolyRgn = NULL; } // if - maGraphicsData.mnOSStatus = nOSStatus; + mnOSStatus = nOSStatus; - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawPolyPolygon // ----------------------------------------------------------------------- -sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool AquaSalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { return sal_False; } // ----------------------------------------------------------------------- -sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool AquaSalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { return sal_False; } // ----------------------------------------------------------------------- -sal_Bool SalGraphics::DrawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, +sal_Bool AquaSalGraphics::DrawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) { return sal_False; @@ -683,15 +716,15 @@ // ----------------------------------------------------------------------- -void SalGraphics::CopyBits( const SalTwoRect *pPosAry, - SalGraphics *pSrcGraphics +void AquaSalGraphics::CopyBits( const SalTwoRect *pPosAry, + AquaSalGraphics *pSrcGraphics ) { if ( ( pPosAry != NULL ) && ( pSrcGraphics != NULL ) ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); + const BitMap *pDstBitMap = GetPortBitMapForCopyBits( mpCGrafPort ); if ( pDstBitMap != NULL ) { @@ -705,11 +738,11 @@ SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); + GetPortBounds( ((AquaSalGraphics*)pSrcGraphics)->mpCGrafPort, &aPortBoundsRect ); CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - nCopyMode = SelectCopyMode( &maGraphicsData ); + nCopyMode = SelectCopyMode( this ); // Now we can call QD CopyBits to copy the bits from source rectangle // to the destination rectangle @@ -717,7 +750,7 @@ if ( LockGraphics( pSrcGraphics ) ) { const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( ((AquaSalGraphics*)pSrcGraphics)->mpCGrafPort ); if ( pSrcBitMap != NULL ) { @@ -744,14 +777,14 @@ } // else } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::CopyBits // ----------------------------------------------------------------------- -void SalGraphics::CopyArea( long nDstX, +void AquaSalGraphics::CopyArea( long nDstX, long nDstY, long nSrcX, long nSrcY, @@ -760,9 +793,9 @@ USHORT nFlags ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); + const BitMap *pDstBitMap = GetPortBitMapForCopyBits( mpCGrafPort ); if ( pDstBitMap != NULL ) { @@ -778,11 +811,11 @@ GetQDRect( nDstX, nDstY, nDstWidth, nDstHeight, &aDstRect ); - GetPortBounds( maGraphicsData.mpCGrafPort, &aPortBoundsRect ); + GetPortBounds( mpCGrafPort, &aPortBoundsRect ); CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - nCopyMode = SelectCopyMode( &maGraphicsData ); + nCopyMode = SelectCopyMode( this ); // Now we can call QD CopyBits to copy the bits from source rectangle // to the destination rectangle @@ -796,30 +829,30 @@ ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // SalGraphics::CopyArea // ----------------------------------------------------------------------- -void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, +void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ) { if ( pPosAry != NULL ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); + AquaSalGraphics *pSrcGraphics = ((AquaSalBitmap&)rSalBitmap).GetGraphics(); if ( LockGraphics( pSrcGraphics ) ) { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); + const BitMap *pDstBitMap = GetPortBitMapForCopyBits( mpCGrafPort ); if ( pDstBitMap != NULL ) { const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( pSrcGraphics->mpCGrafPort ); if ( pSrcBitMap != NULL ) { @@ -833,11 +866,11 @@ SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); + GetPortBounds( pSrcGraphics->mpCGrafPort, &aPortBoundsRect ); CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - nCopyMode = SelectCopyMode( &maGraphicsData ); + nCopyMode = SelectCopyMode( this ); // Now we can call QD CopyBits to copy the bits from source rectangle // to the destination rectangle @@ -854,35 +887,35 @@ UnlockGraphics( pSrcGraphics ); - rSalBitmap.ReleaseGraphics( pSrcGraphics ); + ((AquaSalBitmap&)rSalBitmap).ReleaseGraphics( pSrcGraphics ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawBitmap // ----------------------------------------------------------------------- -void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, +void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nTransparentColor ) { if ( pPosAry != NULL ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); + AquaSalGraphics *pSrcGraphics = ((AquaSalBitmap&)rSalBitmap).GetGraphics(); if ( LockGraphics( pSrcGraphics ) ) { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); + const BitMap *pDstBitMap = GetPortBitMapForCopyBits( mpCGrafPort ); if ( pDstBitMap != NULL ) { const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( pSrcGraphics->mpCGrafPort ); if ( pSrcBitMap != NULL ) { @@ -897,7 +930,7 @@ SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); + GetPortBounds( pSrcGraphics->mpCGrafPort, &aPortBoundsRect ); CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); @@ -920,44 +953,44 @@ UnlockGraphics( pSrcGraphics ); - rSalBitmap.ReleaseGraphics( pSrcGraphics ); + ((AquaSalBitmap&)rSalBitmap).ReleaseGraphics( pSrcGraphics ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawBitmap // ----------------------------------------------------------------------- -void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, +void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap ) { if ( pPosAry != NULL ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); + AquaSalGraphics *pSrcGraphics = ((AquaSalBitmap&)rSalBitmap).GetGraphics(); if ( LockGraphics( pSrcGraphics ) ) { - SalGraphics *pMskGraphics = rTransparentBitmap.GetGraphics(); + AquaSalGraphics *pMskGraphics = ((AquaSalBitmap&)rTransparentBitmap).GetGraphics(); if ( LockGraphics( pMskGraphics ) ) { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); + const BitMap *pDstBitMap = GetPortBitMapForCopyBits( mpCGrafPort ); if ( pDstBitMap != NULL ) { const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( pSrcGraphics->mpCGrafPort ); if ( pSrcBitMap != NULL ) { const BitMap *pMskBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( pSrcGraphics->mpCGrafPort ); if ( pMskBitMap != NULL ) { @@ -971,13 +1004,13 @@ SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, + GetPortBounds( pSrcGraphics->mpCGrafPort, &aPortBoundsRect ); CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - nCopyMode = SelectCopyMode( &maGraphicsData ); + nCopyMode = SelectCopyMode( this ); // Now we can call QD CopyDeepMask to copy the bits from // source rectangle to the destination rectangle using the @@ -998,41 +1031,41 @@ UnlockGraphics( pMskGraphics ); - rSalBitmap.ReleaseGraphics( pMskGraphics ); + ((AquaSalBitmap&)rSalBitmap).ReleaseGraphics( pMskGraphics ); } // if UnlockGraphics( pSrcGraphics ); - rSalBitmap.ReleaseGraphics( pSrcGraphics ); + ((AquaSalBitmap&)rSalBitmap).ReleaseGraphics( pSrcGraphics ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } //if } // SalGraphics::DrawBitmap // ----------------------------------------------------------------------- -void SalGraphics::DrawMask( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, +void AquaSalGraphics::DrawMask( const SalTwoRect* pPosAry, + AquaSalBitmap& rSalBitmap, SalColor nMaskColor ) { if ( pPosAry != NULL ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); + AquaSalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); if ( LockGraphics( pSrcGraphics ) ) { const BitMap *pDstBitMap - = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( mpCGrafPort ); if ( pDstBitMap != NULL ) { const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); + = GetPortBitMapForCopyBits( pSrcGraphics->mpCGrafPort ); if ( pSrcBitMap != NULL ) { @@ -1047,7 +1080,7 @@ SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); + GetPortBounds( pSrcGraphics->mpCGrafPort, &aPortBoundsRect ); CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); @@ -1055,7 +1088,7 @@ RGBBackColor( &aMaskBackColor ); - nCopyMode = SelectCopyMode( &maGraphicsData ); + nCopyMode = SelectCopyMode( this ); // Now we can call QD CopyDeepMask to copy the bits from // source rectangle to the destination rectangle using the @@ -1078,14 +1111,14 @@ rSalBitmap.ReleaseGraphics( pSrcGraphics ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawMask // ----------------------------------------------------------------------- -SalBitmap* SalGraphics::GetBitmap( long nX, +SalBitmap* AquaSalGraphics::GetBitmap( long nX, long nY, long nDX, long nDY @@ -1100,7 +1133,7 @@ // ----------------------------------------------------------------------- -SalColor SalGraphics::GetPixel( long nX, +SalColor AquaSalGraphics::GetPixel( long nX, long nY ) { @@ -1118,7 +1151,7 @@ // ----------------------------------------------------------------------- -void SalGraphics::Invert( long nX, +void AquaSalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, @@ -1127,7 +1160,7 @@ { // Implementation not yet complete - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { short left = (short)nX; short top = (short)nY; @@ -1139,13 +1172,13 @@ ::MacInvertRect( &aRect ); - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // SalGraphics::Invert // ----------------------------------------------------------------------- -void SalGraphics::Invert( ULONG nPoints, +void AquaSalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) @@ -1154,7 +1187,7 @@ if ( ( pPtAry != NULL ) && ( nPoints > 1 ) ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { unsigned long nPolyEdges = nPoints; unsigned long nPolyEdgeIndex = 0; @@ -1162,7 +1195,7 @@ short nY = 0; short nPenMode = patXor; RgnHandle hPolyRgn = NULL; - CGrafPtr pCGrafPort = maGraphicsData.mpCGrafPort; + CGrafPtr pCGrafPort = mpCGrafPort; Pattern aPenPatGray; hPolyRgn = NewRgn (); @@ -1201,9 +1234,9 @@ // End region construction - maGraphicsData.mnOSStatus = QDErr(); + mnOSStatus = QDErr(); - if ( maGraphicsData.mnOSStatus == noErr ) + if ( mnOSStatus == noErr ) { MacInvertRgn( hPolyRgn ); @@ -1213,14 +1246,14 @@ } // if } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::Invert // ----------------------------------------------------------------------- -BOOL SalGraphics::DrawEPS( long nX, +BOOL AquaSalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, @@ -1237,14 +1270,14 @@ // ----------------------------------------------------------------------- -void SalGraphics::SetTextColor( SalColor nSalColor ) +void AquaSalGraphics::SetTextColor( SalColor nSalColor ) { - maGraphicsData.maFontColor = SALColor2RGBColor( nSalColor ); + maFontColor = SALColor2RGBColor( nSalColor ); } // SalGraphics::SetTextColor // ----------------------------------------------------------------------- -USHORT SalGraphics::SetFont( ImplFontSelectData* pFont ) +USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pFont ) { fprintf( stderr, "<> SalGraphics::SetFont not yet implemented!\n" @@ -1255,7 +1288,7 @@ // ----------------------------------------------------------------------- -long SalGraphics::GetCharWidth( sal_Unicode nChar1, +long AquaSalGraphics::GetCharWidth( sal_Unicode nChar1, sal_Unicode nChar2, long* pWidthAry ) @@ -1284,7 +1317,7 @@ // ----------------------------------------------------------------------- -void SalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) +void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) { // Stub Code @@ -1298,7 +1331,7 @@ // ----------------------------------------------------------------------- -ULONG SalGraphics::GetKernPairs( ULONG nPairs, +ULONG AquaSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) { @@ -1311,7 +1344,7 @@ // ----------------------------------------------------------------------- -ULONG SalGraphics::GetFontCodeRanges( sal_uInt32* pCodePairs ) const +ULONG AquaSalGraphics::GetFontCodeRanges( sal_uInt32* pCodePairs ) const { // TODO: try to get the necessary info from Aqua return 0; @@ -1319,7 +1352,7 @@ // ----------------------------------------------------------------------- -void SalGraphics::GetDevFontList( ImplDevFontList *pList ) +void AquaSalGraphics::GetDevFontList( ImplDevFontList *pList ) { if ( pList != NULL ) { @@ -1328,41 +1361,42 @@ if ( pSalData != NULL ) { FontList *pMacFontList = NULL; - ImplFontData *pDevFontData = NULL; - ImplFontData *pSysFontData = NULL; + ImplMacFontData *pDevFontData = NULL; + ImplMacFontData *pSysFontData = NULL; - if ( pSalData->mpFontList != NULL ) + if ( pSalData->mpFontList == NULL ) { pSalData->mpFontList = GetMacFontList(); pMacFontList = pSalData->mpFontList; - pSysFontData = pMacFontList->First(); + pSysFontData = (ImplMacFontData*)pMacFontList->First(); while ( pSysFontData != NULL ) { - pDevFontData = new ImplFontData; + ImplDevFontAttributes pAttributes; + pDevFontData = new ImplMacFontData(pAttributes,0,0,0); - pDevFontData->mpSysData = pSysFontData; +// pDevFontData->mpSysData = pSysFontData; pDevFontData->maName = pSysFontData->maName; pDevFontData->maStyleName = pSysFontData->maStyleName; - pDevFontData->mnWidth = pSysFontData->mnWidth; - pDevFontData->mnHeight = pSysFontData->mnHeight; +// pDevFontData->mnWidth = pSysFontData->mnWidth; +// pDevFontData->mnHeight = pSysFontData->mnHeight; pDevFontData->meFamily = pSysFontData->meFamily; - pDevFontData->meCharSet = pSysFontData->meCharSet; +// pDevFontData->meCharSet = pSysFontData->meCharSet; pDevFontData->meScript = pSysFontData->meScript; pDevFontData->mePitch = pSysFontData->mePitch; pDevFontData->meWidthType = pSysFontData->meWidthType; pDevFontData->meWeight = pSysFontData->meWeight; pDevFontData->meItalic = pSysFontData->meItalic; pDevFontData->meType = pSysFontData->meType; - pDevFontData->mnVerticalOrientation = pSysFontData->mnVerticalOrientation; +// pDevFontData->mnVerticalOrientation = pSysFontData->mnVerticalOrientation; pDevFontData->mbOrientation = pSysFontData->mbOrientation; pDevFontData->mbDevice = pSysFontData->mbDevice; pDevFontData->mnQuality = pSysFontData->mnQuality; pList->Add( pDevFontData ); - pSysFontData = pMacFontList->Next(); + pSysFontData = (ImplMacFontData*)pMacFontList->Next(); } // while } // if } // if @@ -1371,7 +1405,7 @@ // ----------------------------------------------------------------------- -void SalGraphics::DrawText( long nX, +void AquaSalGraphics::DrawText( long nX, long nY, const xub_Unicode *pStr, xub_StrLen nLen @@ -1381,7 +1415,7 @@ if ( ( pStr != NULL ) && ( nLen > 0 ) ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics( this ) ) { ByteString aByteString( pStr, nLen, @@ -1394,7 +1428,7 @@ { short nFirstByte = 0; short nByteCount = nLen; - const RGBColor aFontForeColor = maGraphicsData.maFontColor; + const RGBColor aFontForeColor = maFontColor; RGBForeColor( &aFontForeColor ); @@ -1403,14 +1437,14 @@ ::MacDrawText( pTextBuffer, nFirstByte, nByteCount ); } // if - EndGraphics( &maGraphicsData ); + EndGraphics( this ); } // if } // if } // SalGraphics::DrawText // ----------------------------------------------------------------------- -void SalGraphics::DrawTextArray( long nX, +void AquaSalGraphics::DrawTextArray( long nX, long nY, const xub_Unicode* pStr, xub_StrLen nLen, @@ -1424,7 +1458,7 @@ // ----------------------------------------------------------------------- -BOOL SalGraphics::GetGlyphBoundRect( xub_Unicode cChar, +BOOL AquaSalGraphics::GetGlyphBoundRect( xub_Unicode cChar, long* pX, long* pY, long* pWidth, @@ -1438,21 +1472,279 @@ return FALSE; } // SalGraphics::GetGlyphBoundRect -// ----------------------------------------------------------------------- +// ======================================================================= + +// ======================================================================= + +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! +// IMPLEMENT ME!! -ULONG SalGraphics::GetGlyphOutline( xub_Unicode cChar, - USHORT** ppPolySizes, - SalPoint** ppPoints, - BYTE** ppFlags + +SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) +{ + return NULL; +} + +bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ) +{ + return sal_False; +} + +BOOL AquaSalGraphics::GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ) +{ + return sal_False; +} + +void AquaSalGraphics::drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ) +{ + +} + +BOOL AquaSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) +{ + return sal_False; +} + +BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, + ImplFontData* pFont, + long* pGlyphIDs, + sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter ) { - fprintf( stderr, - "<> SalGraphics::GetGlyphOutline not yet implemented!\n" - ); + return sal_False; +} - return 0; -} // SalGraphics::GetGlyphOutline +const void* AquaSalGraphics::GetEmbedFontData( ImplFontData* pFont, + const sal_Unicode* pUnicodes, + sal_Int32* pWidths, + FontSubsetInfo& rInfo, + long* pDataLen ) +{ + return NULL; +} + +long AquaSalGraphics::GetGraphicsWidth() +{ + return 0; +} + +void AquaSalGraphics::FreeEmbedFontData( const void* pData, long nDataLen ) +{ + +} + +BOOL AquaSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& ) +{ + return sal_False; +} + +BOOL AquaSalGraphics::drawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + SalControlHandle& rControlHandle, + rtl::OUString aCaption ) +{ + return sal_False; +} + +sal_Bool AquaSalGraphics::drawPolyLineBezier( ULONG nPoints, + const SalPoint* pPtAry, + const BYTE* pFlgAry ) +{ + return sal_False; +} + +sal_Bool AquaSalGraphics::drawPolygonBezier( ULONG nPoints, + const SalPoint* pPtAry, + const BYTE* pFlgAry ) +{ + return sal_False; +} + +void AquaSalGraphics::GetDevFontSubstList( OutputDevice* ) +{ + +} + +void AquaSalGraphics::DrawServerFontLayout( const ServerFontLayout& ) +{ + +} + +BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + SalControlHandle& rControlHandle, + BOOL& rIsInside ) +{ + +} + +const std::map< sal_Unicode, sal_Int32 >* AquaSalGraphics::GetFontEncodingVector( ImplFontData* pFont, + const std::map< sal_Unicode, + rtl::OString >** ppNonEncoded ) +{ + return NULL; +} + +BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + SalControlHandle& rControlHandle, + rtl::OUString aCaption ) +{ + return sal_False; +} + +sal_Bool AquaSalGraphics::drawPolyPolygonBezier( ULONG nPoly, + const ULONG* pPoints, + const SalPoint* const* pPtAry, + const BYTE* const* pFlgAry ) +{ + return sal_False; +} + +BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + SalControlHandle& rControlHandle, + rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ) +{ + return sal_False; +} + +BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +{ + return sal_False; +} + +void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) +{ + +} + +void AquaSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ) +{ + +} + +BOOL AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) +{ + return sal_False; +} + +USHORT AquaSalGraphics::SetFont( ImplFontSelectData*, int nFallbackLevel ) +{ + return 0; +} + +void AquaSalGraphics::copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, USHORT nFlags ) +{ + +} + +void AquaSalGraphics::copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ) +{ + +} + +void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) +{ + +} + +void AquaSalGraphics::drawMask( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nMaskColor ) +{ + +} + +void AquaSalGraphics::drawPixel( long nX, long nY ) +{ + +} + +void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) +{ + +} + +SalColor AquaSalGraphics::getPixel( long nX, long nY ) +{ + return MAKE_SALCOLOR(0,0,0); +} + +SalBitmap* AquaSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight ) +{ + return NULL; +} + +ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const +{ + return NULL; +} + + +///////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------- +// +// Get, and lock, a QuickDraw View +// +// ----------------------------------------------------------------------- + +CGrafPtr VCLGraphics_LockFocusCGrafPort ( CarbonViewRef hView ) +{ + if ( hView == nil ) + return NULL; + + // CGrafPtr ptr = [ VCLGraphics LockFocusCGrafPort: (VCLView *)hView ]; + + return NULL; +} // VCLGraphics_LockFocusCGrafPort + +// ----------------------------------------------------------------------- +// +// Close, and unlock, a QuickDraw View +// +// ----------------------------------------------------------------------- + +void VCLGraphics_UnLockFocusCGrafPort ( CarbonViewRef hView ) +{ + if ( hView == nil ) + return; + + // [ VCLGraphics UnLockFocusCGrafPort: (VCLView *)hView ]; +} // VCLGraphics_UnLockFocusCGrafPort -// ======================================================================= -// ======================================================================= Index: aqua/source/gdi/salgdiutils.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salgdiutils.cxx,v retrieving revision 1.7 retrieving revision 1.7.112.2 diff -u -r1.7 -r1.7.112.2 --- aqua/source/gdi/salgdiutils.cxx 9 Sep 2005 10:42:31 -0000 1.7 +++ aqua/source/gdi/salgdiutils.cxx 27 Feb 2006 20:28:47 -0000 1.7.112.2 @@ -41,11 +41,11 @@ // ======================================================================= -short SelectCopyMode ( const SalGraphicsDataPtr pSalGraphicsData ) +short SelectCopyMode ( const AquaSalGraphics *pSalGraphics ) { short nCopyMode = 0; - if ( pSalGraphicsData->mnPenMode == patCopy ) + if ( pSalGraphics->mnPenMode == patCopy ) { nCopyMode = srcCopy; } // if @@ -208,26 +208,26 @@ // ======================================================================= -BOOL LockGraphics ( SalGraphics *rSalGraphics ) +BOOL LockGraphics ( AquaSalGraphics *rSalGraphics ) { BOOL bCGrafPortLocked = FALSE; // [ed] 12/16/01 Don't lock QDView grafports. if ( ( rSalGraphics != NULL ) - && ( rSalGraphics->maGraphicsData.mpCGrafPort != NULL ) - && ( rSalGraphics->maGraphicsData.mbWindow != TRUE) + && ( rSalGraphics->mpCGrafPort != NULL ) + && ( rSalGraphics->mbWindow != TRUE) ) { - rSalGraphics->maGraphicsData.mnOSStatus - = LockPortBits( rSalGraphics->maGraphicsData.mpCGrafPort ); + rSalGraphics->mnOSStatus + = LockPortBits( rSalGraphics->mpCGrafPort ); - if ( rSalGraphics->maGraphicsData.mnOSStatus == noErr ) + if ( rSalGraphics->mnOSStatus == noErr ) { - rSalGraphics->maGraphicsData.mhGWorldPixMap - = GetPortPixMap( rSalGraphics->maGraphicsData.mpCGrafPort ); + rSalGraphics->mhGWorldPixMap + = GetPortPixMap( rSalGraphics->mpCGrafPort ); - rSalGraphics->maGraphicsData.mnOSStatus = QDErr(); + rSalGraphics->mnOSStatus = QDErr(); bCGrafPortLocked = TRUE; } // if @@ -238,16 +238,16 @@ // ----------------------------------------------------------------------- -BOOL UnlockGraphics ( SalGraphics *rSalGraphics ) +BOOL UnlockGraphics ( AquaSalGraphics *rSalGraphics ) { BOOL bCGrafPortUnlocked = FALSE; - if ( ( rSalGraphics->maGraphicsData.mpCGrafPort != NULL ) - && ( rSalGraphics->maGraphicsData.mnOSStatus == noErr ) + if ( ( rSalGraphics->mpCGrafPort != NULL ) + && ( rSalGraphics->mnOSStatus == noErr ) ) { - rSalGraphics->maGraphicsData.mnOSStatus - = UnlockPortBits( rSalGraphics->maGraphicsData.mpCGrafPort ); + rSalGraphics->mnOSStatus + = UnlockPortBits( rSalGraphics->mpCGrafPort ); bCGrafPortUnlocked = TRUE; } // if @@ -259,98 +259,130 @@ // ======================================================================= -BOOL BeginGraphics ( SalGraphicsDataPtr rSalGraphicsData ) +BOOL BeginGraphics ( AquaSalGraphics *pSalGraphics ) { BOOL bStartGraphics = FALSE; + + // --- + if( pSalGraphics->mhWnd != NULL ) + { + SetPortWindowPort (pSalGraphics->mhWnd); + if( noErr == QDBeginCGContext (GetWindowPort (pSalGraphics->mhWnd), &pSalGraphics->mhContext)) + { + fprintf(stderr, "QDBeginCGContext() successful\n"); + + // switch to HIView coordinate system, i.e. (0,0) is top-left + Rect windowBounds; + GetWindowPortBounds ( pSalGraphics->mhWnd, &windowBounds); + //fprintf(stderr, "windowBounds: top: %d left: %d bottom: %d right: %d\n", + // windowBounds.top, windowBounds.left, windowBounds.bottom, windowBounds.right); + + CGContextTranslateCTM (pSalGraphics->mhContext, 0, windowBounds.bottom - windowBounds.top); + CGContextScaleCTM (pSalGraphics->mhContext, 1.0, -1.0); + return true; + } + else + { + fprintf(stderr, "QDBeginCGContext() error\n"); + return false; + } + } + else + { + fprintf(stderr, "BeginGraphics: mhWindow == NULL !\n"); + return false; + } + // --- + // Previous to entering this function, was there a QD error? - if ( rSalGraphicsData->mnOSStatus == noErr ) + if ( pSalGraphics->mnOSStatus == noErr ) { // Get the graph port and lock focus on it - if ( rSalGraphicsData->mbWindow == TRUE ) + if ( pSalGraphics->mbWindow == TRUE ) { - rSalGraphicsData->mpCGrafPort - = VCLGraphics_LockFocusCGrafPort( rSalGraphicsData->mhDC ); + pSalGraphics->mpCGrafPort + = VCLGraphics_LockFocusCGrafPort( pSalGraphics->mhDC ); } // if // [ed] 12/3/01 Check to make sure we've got a valid graph port - if(rSalGraphicsData->mpCGrafPort && !IsValidPort(rSalGraphicsData->mpCGrafPort)) + if(pSalGraphics->mpCGrafPort && !IsValidPort(pSalGraphics->mpCGrafPort)) { fprintf(stderr, "Invalid port in BeginGraphics()\n"); } - if ( ( rSalGraphicsData->mpCGrafPort != NULL ) && IsValidPort(rSalGraphicsData->mpCGrafPort)) + if ( ( pSalGraphics->mpCGrafPort != NULL ) && IsValidPort(pSalGraphics->mpCGrafPort)) { // Get the port's pen attributes - GetPortPenPixPat( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mhPortPenPattern + GetPortPenPixPat( pSalGraphics->mpCGrafPort, + pSalGraphics->mhPortPenPattern ); - GetPortPenSize( rSalGraphicsData->mpCGrafPort, - &(rSalGraphicsData->maPortPenSize) + GetPortPenSize( pSalGraphics->mpCGrafPort, + &(pSalGraphics->maPortPenSize) ); - GetPortPenLocation( rSalGraphicsData->mpCGrafPort, - &(rSalGraphicsData->maPortPenLocation) + GetPortPenLocation( pSalGraphics->mpCGrafPort, + &(pSalGraphics->maPortPenLocation) ); - rSalGraphicsData->mnPortPenMode - = GetPortPenMode( rSalGraphicsData->mpCGrafPort ); + pSalGraphics->mnPortPenMode + = GetPortPenMode( pSalGraphics->mpCGrafPort ); // Set the port pen mode to its new value - SetPortPenMode( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mnPenMode + SetPortPenMode( pSalGraphics->mpCGrafPort, + pSalGraphics->mnPenMode ); // Set to the current offscreen world for Mac OS X // only as everything is written to GWorld here - SetGWorld( rSalGraphicsData->mpCGrafPort, NULL ); + SetGWorld( pSalGraphics->mpCGrafPort, NULL ); // Was there a QD error when we set the GWorld? - rSalGraphicsData->mnOSStatus = QDErr(); + pSalGraphics->mnOSStatus = QDErr(); - if ( rSalGraphicsData->mnOSStatus == noErr ) + if ( pSalGraphics->mnOSStatus == noErr ) { // Get the PixMap associated with this particular CGrafPort - rSalGraphicsData->mhGWorldPixMap - = GetPortPixMap( rSalGraphicsData->mpCGrafPort ); + pSalGraphics->mhGWorldPixMap + = GetPortPixMap( pSalGraphics->mpCGrafPort ); - rSalGraphicsData->mnOSStatus = QDErr(); + pSalGraphics->mnOSStatus = QDErr(); - if ( ( rSalGraphicsData->mnOSStatus == noErr ) - && ( rSalGraphicsData->mhGWorldPixMap != NULL ) + if ( ( pSalGraphics->mnOSStatus == noErr ) + && ( pSalGraphics->mhGWorldPixMap != NULL ) ) { // Get the current PixMap state, i.e., // is it the memory associated with this // PixMap is marked to be moved? - rSalGraphicsData->mnGWorldFlags - = GetPixelsState( rSalGraphicsData->mhGWorldPixMap ); + pSalGraphics->mnGWorldFlags + = GetPixelsState( pSalGraphics->mhGWorldPixMap ); - if ( rSalGraphicsData->mnGWorldFlags == noErr ) + if ( pSalGraphics->mnGWorldFlags == noErr ) { // if the PixMap is a relocatable block, // then mark it as locked. // [ed] 12/16/01 Don't lock pixels of QDViews - if ( !rSalGraphicsData->mbWindow && - LockPixels( rSalGraphicsData->mhGWorldPixMap ) ) + if ( !pSalGraphics->mbWindow && + LockPixels( pSalGraphics->mhGWorldPixMap ) ) { - rSalGraphicsData->mbGWorldPixelsLocked = TRUE; + pSalGraphics->mbGWorldPixelsLocked = TRUE; } // if else { - rSalGraphicsData->mbGWorldPixelsLocked = FALSE; + pSalGraphics->mbGWorldPixelsLocked = FALSE; } // else // Set background color to white on this GWorld @@ -368,21 +400,21 @@ // Now begin to set the clip region - if ( ( rSalGraphicsData->mbClipRgnChanged == TRUE ) - && ( rSalGraphicsData->mhClipRgn != NULL ) + if ( ( pSalGraphics->mbClipRgnChanged == TRUE ) + && ( pSalGraphics->mhClipRgn != NULL ) ) { // Set to the clip region - SetClip( rSalGraphicsData->mhClipRgn ); + SetClip( pSalGraphics->mhClipRgn ); // Was there an error after setting the clip region? - rSalGraphicsData->mnOSStatus = QDErr(); + pSalGraphics->mnOSStatus = QDErr(); // Set the new status flag for our port - rSalGraphicsData->mbClipRgnChanged = FALSE; + pSalGraphics->mbClipRgnChanged = FALSE; } // if } // if else @@ -413,30 +445,41 @@ // ----------------------------------------------------------------------- -BOOL EndGraphics ( SalGraphicsDataPtr rSalGraphicsData ) +BOOL EndGraphics ( AquaSalGraphics *pSalGraphics ) { + + // --- + if( pSalGraphics->mhContext != NULL && pSalGraphics->mhWnd != NULL ) + { + CGContextFlush(pSalGraphics->mhContext); + QDEndCGContext (GetWindowPort(pSalGraphics->mhWnd), &pSalGraphics->mhContext); + fprintf(stderr, "flushed context\n"); + } + return true; + // --- + BOOL bEndGraphics = FALSE; // Previous to entering this function, was there a QD error? - if ( rSalGraphicsData->mnOSStatus == noErr ) + if ( pSalGraphics->mnOSStatus == noErr ) { // Unlock our CGrafPort - if ( ( rSalGraphicsData->mhGWorldPixMap != NULL ) - && ( rSalGraphicsData->mnGWorldFlags == noErr ) - && ( rSalGraphicsData->mbGWorldPixelsLocked ) + if ( ( pSalGraphics->mhGWorldPixMap != NULL ) + && ( pSalGraphics->mnGWorldFlags == noErr ) + && ( pSalGraphics->mbGWorldPixelsLocked ) ) { // Set pixel state to its original state // thus unlocking the PixMap - SetPixelsState( rSalGraphicsData->mhGWorldPixMap, - rSalGraphicsData->mnGWorldFlags + SetPixelsState( pSalGraphics->mhGWorldPixMap, + pSalGraphics->mnGWorldFlags ); - rSalGraphicsData->mnOSStatus = QDErr(); - rSalGraphicsData->mbGWorldPixelsLocked = FALSE; + pSalGraphics->mnOSStatus = QDErr(); + pSalGraphics->mbGWorldPixelsLocked = FALSE; } // if // Reset the port's pen to its original attributes @@ -450,24 +493,24 @@ +++ Is it necessary to reset the pen pattern? - SetPortPenPixPat( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mhPortPenPattern + SetPortPenPixPat( pSalGraphics->mpCGrafPort, + pSalGraphics->mhPortPenPattern ); */ - SetPortPenSize( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->maPortPenSize + SetPortPenSize( pSalGraphics->mpCGrafPort, + pSalGraphics->maPortPenSize ); - SetPortPenMode( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mnPortPenMode + SetPortPenMode( pSalGraphics->mpCGrafPort, + pSalGraphics->mnPortPenMode ); // When we get here then the QD port must have changed(?) // [ed] 12/19/01 This will commit the changes to reset the pen size // and pen mode. - PortChanged( rSalGraphicsData->mpCGrafPort ); + PortChanged( pSalGraphics->mpCGrafPort ); // [ed] 6/1/02 Always flush the buffer, regardless of whether we're in // a debug or non-debug build. @@ -475,23 +518,23 @@ // [ed] 12/19/01 Flush the QuickDraw buffer immediately. This helps // with VCL debugging. - if(QDIsPortBuffered(rSalGraphicsData->mpCGrafPort)) - QDFlushPortBuffer( rSalGraphicsData->mpCGrafPort, NULL ); + if(QDIsPortBuffered(pSalGraphics->mpCGrafPort)) + QDFlushPortBuffer( pSalGraphics->mpCGrafPort, NULL ); // Unlock focus on the current NSView - if ( rSalGraphicsData->mbWindow == TRUE ) + if ( pSalGraphics->mbWindow == TRUE ) { - VCLGraphics_UnLockFocusCGrafPort( rSalGraphicsData->mhDC ); + VCLGraphics_UnLockFocusCGrafPort( pSalGraphics->mhDC ); } // if // Was there an error after flushing the QuickDraw buffer - rSalGraphicsData->mnOSStatus = QDErr(); + pSalGraphics->mnOSStatus = QDErr(); // Set the new status flag for clip region - rSalGraphicsData->mbClipRgnChanged = FALSE; + pSalGraphics->mbClipRgnChanged = FALSE; // If we get here then we have safely written to our GWorld @@ -505,76 +548,78 @@ // ======================================================================= -void InitBrush ( SalGraphicsDataPtr rSalGraphicsData ) +void InitBrush ( AquaSalGraphics *pSalGraphics ) { - rSalGraphicsData->mbBrushTransparent = FALSE; - rSalGraphicsData->maBrushColor = GetBlackColor(); + pSalGraphics->mbBrushTransparent = FALSE; + pSalGraphics->maBrushColor = GetBlackColor(); } // InitBrush // ----------------------------------------------------------------------- -void InitFont ( SalGraphicsDataPtr rSalGraphicsData ) +void InitFont ( AquaSalGraphics *pSalGraphics ) { - rSalGraphicsData->maFontColor = GetBlackColor(); - rSalGraphicsData->mnFontID = kFontIDGeneva; - rSalGraphicsData->mnFontSize = 10; - rSalGraphicsData->mnFontStyle = normal; + pSalGraphics->maFontColor = GetBlackColor(); + pSalGraphics->mnFontID = kFontIDGeneva; + pSalGraphics->mnFontSize = 10; + pSalGraphics->mnFontStyle = normal; } // InitFont // ----------------------------------------------------------------------- -void InitGWorld ( SalGraphicsDataPtr rSalGraphicsData ) +void InitGWorld ( AquaSalGraphics *pSalGraphics ) { - rSalGraphicsData->mbGWorldPixelsLocked = FALSE; - rSalGraphicsData->mbGWorldPixelsCopy = FALSE; - rSalGraphicsData->mbGWorldPixelsNew = FALSE; - rSalGraphicsData->mnGWorldFlags = noErr; - rSalGraphicsData->mhGWorldPixMap = NULL; + pSalGraphics->mbGWorldPixelsLocked = FALSE; + pSalGraphics->mbGWorldPixelsCopy = FALSE; + pSalGraphics->mbGWorldPixelsNew = FALSE; + pSalGraphics->mnGWorldFlags = noErr; + pSalGraphics->mhGWorldPixMap = NULL; } // InitGWorld // ----------------------------------------------------------------------- -void InitPen ( SalGraphicsDataPtr rSalGraphicsData ) +void InitPen ( AquaSalGraphics *pSalGraphics ) { long nMacOSPointSize = sizeof(MacOSPoint); - rSalGraphicsData->maPenColor = GetBlackColor(); - rSalGraphicsData->mnPenMode = patCopy; - rSalGraphicsData->mbPenTransparent = FALSE; + pSalGraphics->maPenColor = GetBlackColor(); + pSalGraphics->mnPenMode = patCopy; + pSalGraphics->mbPenTransparent = FALSE; - rSalGraphicsData->mnPortPenMode = patCopy; - rSalGraphicsData->mhPortPenPattern = NULL; + pSalGraphics->mnPortPenMode = patCopy; + pSalGraphics->mhPortPenPattern = NULL; - memset( &(rSalGraphicsData->maPortPenSize), 0, nMacOSPointSize ); - memset( &(rSalGraphicsData->maPortPenLocation), 0, nMacOSPointSize ); + memset( &(pSalGraphics->maPortPenSize), 0, nMacOSPointSize ); + memset( &(pSalGraphics->maPortPenLocation), 0, nMacOSPointSize ); } // InitPen // ----------------------------------------------------------------------- -void InitQD ( SalGraphicsDataPtr rSalGraphicsData ) +void InitQD ( AquaSalGraphics *pSalGraphics ) { - rSalGraphicsData->mhDC = NULL; - rSalGraphicsData->mpCGrafPort = NULL; - rSalGraphicsData->mpGWorld = NULL; + pSalGraphics->mhDC = NULL; + pSalGraphics->mhWnd = NULL; + pSalGraphics->mhContext = NULL; + pSalGraphics->mpCGrafPort = NULL; + pSalGraphics->mpGWorld = NULL; } // InitQD // ----------------------------------------------------------------------- -void InitRegions ( SalGraphicsDataPtr rSalGraphicsData ) +void InitRegions ( AquaSalGraphics *pSalGraphics ) { - rSalGraphicsData->mhClipRgn = NULL; - rSalGraphicsData->mbClipRgnChanged = FALSE; + pSalGraphics->mhClipRgn = NULL; + pSalGraphics->mbClipRgnChanged = FALSE; } // InitRegions // ----------------------------------------------------------------------- -void InitStatusFlags ( SalGraphicsDataPtr rSalGraphicsData ) +void InitStatusFlags ( AquaSalGraphics *pSalGraphics ) { - rSalGraphicsData->mbPrinter = FALSE; - rSalGraphicsData->mbVirDev = FALSE; - rSalGraphicsData->mbWindow = FALSE; - rSalGraphicsData->mbScreen = FALSE; - rSalGraphicsData->mnOSStatus = noErr; + pSalGraphics->mbPrinter = FALSE; + pSalGraphics->mbVirDev = FALSE; + pSalGraphics->mbWindow = FALSE; + pSalGraphics->mbScreen = FALSE; + pSalGraphics->mnOSStatus = noErr; } // InitStatusFlags // ======================================================================= Index: aqua/source/gdi/salmathutils.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salmathutils.cxx,v retrieving revision 1.4 retrieving revision 1.4.112.1 diff -u -r1.4 -r1.4.112.1 --- aqua/source/gdi/salmathutils.cxx 9 Sep 2005 10:42:46 -0000 1.4 +++ aqua/source/gdi/salmathutils.cxx 27 Nov 2005 09:48:38 -0000 1.4.112.1 @@ -37,6 +37,8 @@ #include #endif +#include + // ======================================================================= // ======================================================================= Index: aqua/source/gdi/salogl.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salogl.cxx,v retrieving revision 1.5 retrieving revision 1.5.112.2 diff -u -r1.5 -r1.5.112.2 --- aqua/source/gdi/salogl.cxx 9 Sep 2005 10:43:03 -0000 1.5 +++ aqua/source/gdi/salogl.cxx 27 Feb 2006 21:33:54 -0000 1.5.112.2 @@ -36,57 +36,85 @@ #ifndef _SV_SALGDI_HXX #include #endif +#ifndef _SV_SALGDI_H +#include +#endif #ifndef _SV_SALOGL_HXX #include #endif +#ifndef _SV_SALOGL_H +#include +#endif // ======================================================================== // Initialize static data members -VCLVIEW SalOpenGL::mhOGLLastDC = 0; -ULONG SalOpenGL::mnOGLState = OGL_STATE_UNLOADED; +CarbonViewRef AquaSalOpenGL::mhOGLLastDC = 0; +ULONG AquaSalOpenGL::mnOGLState = OGL_STATE_UNLOADED; // ======================================================================== -SalOpenGL::SalOpenGL( SalGraphics* pGraphics ) +AquaSalOpenGL::AquaSalOpenGL( SalGraphics* pGraphics ) { } // ------------------------------------------------------------------------ -SalOpenGL::~SalOpenGL() +AquaSalOpenGL::~AquaSalOpenGL() { } // ------------------------------------------------------------------------ -BOOL SalOpenGL::Create() +BOOL AquaSalOpenGL::Create() { return FALSE; } // ------------------------------------------------------------------------ -void SalOpenGL::Release() +void AquaSalOpenGL::Release() { } // ------------------------------------------------------------------------ -void *SalOpenGL::GetOGLFnc( const char* pFncName ) +void *AquaSalOpenGL::GetOGLFnc( const char* pFncName ) { return NULL; } // ------------------------------------------------------------------------ -void SalOpenGL::OGLEntry( SalGraphics* pGraphics ) +void AquaSalOpenGL::OGLEntry( SalGraphics* pGraphics ) { } // ------------------------------------------------------------------------ -void SalOpenGL::OGLExit( SalGraphics* pGraphics ) +void AquaSalOpenGL::OGLExit( SalGraphics* pGraphics ) +{ +} + + + + + + + + +void AquaSalOpenGL::StartScene( SalGraphics* pGraphics ) +{ + +} + +bool AquaSalOpenGL::IsValid() +{ + +} + +void AquaSalOpenGL::StopScene() { + } Index: aqua/source/gdi/salprn.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salprn.cxx,v retrieving revision 1.6 retrieving revision 1.6.112.1 diff -u -r1.6 -r1.6.112.1 --- aqua/source/gdi/salprn.cxx 9 Sep 2005 10:43:38 -0000 1.6 +++ aqua/source/gdi/salprn.cxx 27 Nov 2005 09:48:38 -0000 1.6.112.1 @@ -42,78 +42,81 @@ #ifndef _SV_SALPRN_HXX #include #endif +#ifndef _SV_SALPRN_H +#include +#endif // ======================================================================= -SalInfoPrinter::SalInfoPrinter() +AquaSalInfoPrinter::AquaSalInfoPrinter() { } // ----------------------------------------------------------------------- -SalInfoPrinter::~SalInfoPrinter() +AquaSalInfoPrinter::~AquaSalInfoPrinter() { } // ----------------------------------------------------------------------- -SalGraphics* SalInfoPrinter::GetGraphics() +SalGraphics* AquaSalInfoPrinter::GetGraphics() { return NULL; } // ----------------------------------------------------------------------- -void SalInfoPrinter::ReleaseGraphics( SalGraphics* ) +void AquaSalInfoPrinter::ReleaseGraphics( SalGraphics* ) { } // ----------------------------------------------------------------------- -BOOL SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) +BOOL AquaSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) { return FALSE; } // ----------------------------------------------------------------------- -BOOL SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) +BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) { return FALSE; } // ----------------------------------------------------------------------- -BOOL SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) +BOOL AquaSalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) { return FALSE; } // ----------------------------------------------------------------------- -ULONG SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) +ULONG AquaSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) { return 0; } // ----------------------------------------------------------------------- -XubString SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ) +XubString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ) { return XubString(); } // ----------------------------------------------------------------------- -ULONG SalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ) +ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ) { return 0; } // ----------------------------------------------------------------------- -void SalInfoPrinter::GetPageInfo( const ImplJobSetup*, +void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*, long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) @@ -122,19 +125,19 @@ // ======================================================================= -SalPrinter::SalPrinter() +AquaSalPrinter::AquaSalPrinter() { } // ----------------------------------------------------------------------- -SalPrinter::~SalPrinter() +AquaSalPrinter::~AquaSalPrinter() { } // ----------------------------------------------------------------------- -BOOL SalPrinter::StartJob( const XubString* pFileName, +BOOL AquaSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, ULONG nCopies, BOOL bCollate, @@ -145,35 +148,54 @@ // ----------------------------------------------------------------------- -BOOL SalPrinter::EndJob() +BOOL AquaSalPrinter::EndJob() { return TRUE; } // ----------------------------------------------------------------------- -BOOL SalPrinter::AbortJob() +BOOL AquaSalPrinter::AbortJob() { return TRUE; } // ----------------------------------------------------------------------- -SalGraphics* SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) +SalGraphics* AquaSalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) { return NULL; } // ----------------------------------------------------------------------- -BOOL SalPrinter::EndPage() +BOOL AquaSalPrinter::EndPage() { return TRUE; } // ----------------------------------------------------------------------- -ULONG SalPrinter::GetErrorCode() +ULONG AquaSalPrinter::GetErrorCode() { return 0; } + +//////////////////////////// +////// IMPLEMENT US ///// +//////////////////////////// + +DuplexMode AquaSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pSetupData ) +{ + return DUPLEX_UNKNOWN; +} + +void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) +{ + +} + +int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) +{ + return 0; +} \ No newline at end of file Index: aqua/source/gdi/salvd.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/salvd.cxx,v retrieving revision 1.16 retrieving revision 1.16.112.1 diff -u -r1.16 -r1.16.112.1 --- aqua/source/gdi/salvd.cxx 9 Sep 2005 10:44:08 -0000 1.16 +++ aqua/source/gdi/salvd.cxx 27 Nov 2005 09:48:39 -0000 1.16.112.1 @@ -36,25 +36,28 @@ #ifndef _SV_SALVD_HXX #include #endif +#ifndef _SV_SALVD_H +#include +#endif // ======================================================================= // ======================================================================= -static BOOL InitVirtualDeviceGWorld ( SalVirDevDataPtr rSalVirDevData ) +static BOOL InitVirtualDeviceGWorld ( AquaSalVirtualDevice *pSalVirDev ) { BOOL bVirtualDeviceGWorldInited = FALSE; - if ( ( rSalVirDevData != NULL ) - && ( rSalVirDevData->mpGraphics != NULL ) + if ( ( pSalVirDev != NULL ) + && ( pSalVirDev->mpGraphics != NULL ) ) { Rect aBoundsRect; short nRectLeft = 0; short nRectTop = 0; - short nRectRight = rSalVirDevData->mnWidth; - short nRectBottom = rSalVirDevData->mnHeight; - short nPixelDepth = rSalVirDevData->mnBitCount; + short nRectRight = pSalVirDev->mnWidth; + short nRectBottom = pSalVirDev->mnHeight; + short nPixelDepth = pSalVirDev->mnBitCount; GWorldPtr pGWorld = NULL; CTabHandle hCTable = NULL; GDHandle hGDevice = NULL; @@ -96,22 +99,24 @@ { // Lock the virtual GWorld's port bits - rSalVirDevData->mpGraphics->maGraphicsData.mnOSStatus + AquaSalGraphics *pGraphics = (AquaSalGraphics*)pSalVirDev->mpGraphics; + + pGraphics->mnOSStatus = LockPortBits( pGWorld ); - if ( rSalVirDevData->mpGraphics->maGraphicsData.mnOSStatus == noErr ) + if ( pGraphics->mnOSStatus == noErr ) { // Initialize the virtual graph port - rSalVirDevData->mpGraphics->maGraphicsData.mpCGrafPort + pGraphics->mpCGrafPort = pGWorld; - rSalVirDevData->mpGraphics->maGraphicsData.mpGWorld + pGraphics->mpGWorld = pGWorld; // Initialize virtual port's GWorld attributes - rSalVirDevData->mpGraphics->maGraphicsData.mhGWorldPixMap + pGraphics->mhGWorldPixMap = GetGWorldPixMap( pGWorld ); // Unlock virtual GWorld's port bits @@ -121,34 +126,34 @@ // Initialize virtual port's GWorld attributes - rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsLocked = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsCopy = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsNew = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mnGWorldFlags = noErr; + pGraphics->mbGWorldPixelsLocked = FALSE; + pGraphics->mbGWorldPixelsCopy = FALSE; + pGraphics->mbGWorldPixelsNew = FALSE; + pGraphics->mnGWorldFlags = noErr; // Initialize the virtual port's brush attributes - rSalVirDevData->mpGraphics->maGraphicsData.mbBrushTransparent = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.maBrushColor = GetBlackColor( ); + pGraphics->mbBrushTransparent = FALSE; + pGraphics->maBrushColor = GetBlackColor( ); // Initialize the virtual port's font attributes - rSalVirDevData->mpGraphics->maGraphicsData.maFontColor = GetBlackColor( ); - rSalVirDevData->mpGraphics->maGraphicsData.mnFontID = kFontIDGeneva; - rSalVirDevData->mpGraphics->maGraphicsData.mnFontSize = 10; - rSalVirDevData->mpGraphics->maGraphicsData.mnFontStyle = normal; + pGraphics->maFontColor = GetBlackColor( ); + pGraphics->mnFontID = kFontIDGeneva; + pGraphics->mnFontSize = 10; + pGraphics->mnFontStyle = normal; // Initialize virtual port's clip regions - rSalVirDevData->mpGraphics->maGraphicsData.mhClipRgn = NULL; - rSalVirDevData->mpGraphics->maGraphicsData.mbClipRgnChanged = FALSE; + pGraphics->mhClipRgn = NULL; + pGraphics->mbClipRgnChanged = FALSE; // Initilaize virtual port's status flags - rSalVirDevData->mpGraphics->maGraphicsData.mbPrinter = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbVirDev = TRUE; - rSalVirDevData->mpGraphics->maGraphicsData.mbWindow = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbScreen = TRUE; + pGraphics->mbPrinter = FALSE; + pGraphics->mbVirDev = TRUE; + pGraphics->mbWindow = FALSE; + pGraphics->mbScreen = TRUE; bVirtualDeviceGWorldInited = TRUE; } // if @@ -161,63 +166,63 @@ // ======================================================================= -SalVirtualDevice::SalVirtualDevice() +AquaSalVirtualDevice::AquaSalVirtualDevice() { - maVirDevData.mpGraphics = NULL; - maVirDevData.mnBitCount = 0; - maVirDevData.mnWidth = 0; - maVirDevData.mnHeight = 0; - maVirDevData.mbGraphics = FALSE; + mpGraphics = NULL; + mnBitCount = 0; + mnWidth = 0; + mnHeight = 0; + mbGraphics = FALSE; } // Constructor // ----------------------------------------------------------------------- -SalVirtualDevice::~SalVirtualDevice() +AquaSalVirtualDevice::~AquaSalVirtualDevice() { - if ( maVirDevData.mpGraphics != NULL ) + if ( mpGraphics != NULL ) { // Delete exisiting clip regions, offscreen graphic world, // and its associated colour graph port - delete maVirDevData.mpGraphics; + delete mpGraphics; } // if } // Destructor // ----------------------------------------------------------------------- -SalGraphics* SalVirtualDevice::GetGraphics() +SalGraphics* AquaSalVirtualDevice::GetGraphics() { - if ( maVirDevData.mbGraphics ) + if ( mbGraphics ) { return NULL; } // if - if ( !maVirDevData.mpGraphics ) + if ( !mpGraphics ) { - maVirDevData.mpGraphics = new SalGraphics; + mpGraphics = new AquaSalGraphics; - maVirDevData.mbGraphics = InitVirtualDeviceGWorld( &maVirDevData ); + mbGraphics = InitVirtualDeviceGWorld( this ); - if ( !maVirDevData.mbGraphics ) + if ( !mbGraphics ) { - delete maVirDevData.mpGraphics; - maVirDevData.mpGraphics = NULL; + delete mpGraphics; + mpGraphics = NULL; } // if } // if - return maVirDevData.mpGraphics; + return mpGraphics; } // SalVirtualDevice::GetGraphics // ----------------------------------------------------------------------- -void SalVirtualDevice::ReleaseGraphics( SalGraphics *pGraphics ) +void AquaSalVirtualDevice::ReleaseGraphics( SalGraphics *pGraphics ) { - maVirDevData.mbGraphics = FALSE; + mbGraphics = FALSE; } // SalVirtualDevice::ReleaseGraphics // ----------------------------------------------------------------------- -BOOL SalVirtualDevice::SetSize( long nDX, long nDY ) +BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY ) { BOOL bSizeSet = FALSE; @@ -225,34 +230,34 @@ // by deleting exisiting clip regions, offscreen graphic worlds, // and its associated colour graph port - if ( ( ( maVirDevData.mpGraphics->maGraphicsData.mbGWorldPixelsCopy == TRUE ) - || ( maVirDevData.mpGraphics->maGraphicsData.mbGWorldPixelsNew == TRUE ) + if ( ( ( mpGraphics->mbGWorldPixelsCopy == TRUE ) + || ( mpGraphics->mbGWorldPixelsNew == TRUE ) ) - && ( maVirDevData.mpGraphics->maGraphicsData.mhGWorldPixMap != NULL ) + && ( mpGraphics->mhGWorldPixMap != NULL ) ) { - DisposePixMap( maVirDevData.mpGraphics->maGraphicsData.mhGWorldPixMap ); + DisposePixMap( mpGraphics->mhGWorldPixMap ); } // if - if ( maVirDevData.mpGraphics->maGraphicsData.mhClipRgn != NULL ) + if ( mpGraphics->mhClipRgn != NULL ) { - DisposeRgn( maVirDevData.mpGraphics->maGraphicsData.mhClipRgn ); + DisposeRgn( mpGraphics->mhClipRgn ); } // if - if ( maVirDevData.mpGraphics->maGraphicsData.mpCGrafPort != NULL ) + if ( mpGraphics->mpCGrafPort != NULL ) { - DisposeGWorld( maVirDevData.mpGraphics->maGraphicsData.mpCGrafPort ); + DisposeGWorld( mpGraphics->mpCGrafPort ); - maVirDevData.mpGraphics->maGraphicsData.mpGWorld = NULL; - maVirDevData.mpGraphics->maGraphicsData.mpCGrafPort = NULL; + mpGraphics->mpGWorld = NULL; + mpGraphics->mpCGrafPort = NULL; } // if // Create the offscreen graphics context - maVirDevData.mnWidth = nDX; - maVirDevData.mnHeight = nDY; + mnWidth = nDX; + mnHeight = nDY; - bSizeSet = InitVirtualDeviceGWorld( &maVirDevData ); + bSizeSet = InitVirtualDeviceGWorld( this ); return bSizeSet; } // SalVirtualDevice::SetSize Index: aqua/source/window/VCLView.m =================================================================== RCS file: aqua/source/window/VCLView.m diff -N aqua/source/window/VCLView.m --- aqua/source/window/VCLView.m 9 Sep 2005 10:44:38 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,100 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import -#import - -#define _SV_VCLVIEW_M - -// ------------- -// - VCLView - -// ------------- - -@implementation VCLView - -- (void)drawRect: (NSRect)aRect -{ -} - -- init -{ - qdRgnResized=0; - return self; -} - -- (void)lockFocus -{ - [super lockFocus]; - - // [ed] 12/15/01 If we haven't done so yet, adjust the visRgn and clipRgn of the port - // to match the view. OS 10.1 changed the default behaviour of the clipping of - // NSQDViews and they now require initialization. - - if(!qdRgnResized) - { - RgnHandle tempRgn; - Rect r; - - r.left=0; - r.top=0; - r.right=[self bounds].size.width; - r.bottom=[self bounds].size.height; - - SetPort([self qdPort]); - - tempRgn=NewRgn(); - RectRgn(tempRgn, &r); - - ClipRect(&r); - SetPortVisibleRegion([self qdPort], tempRgn); - PortChanged([self qdPort]); - - DisposeRgn(tempRgn); - qdRgnResized=1; - } -} - -- (MacOSBOOL)isOpaque -{ - // Set background to white to avoid flickering when timer paints - return YES; -} - -@end - -// ----------------------- -// - C wrapper functions - -// ----------------------- - Index: aqua/source/window/VCLView.mm =================================================================== RCS file: aqua/source/window/VCLView.mm diff -N aqua/source/window/VCLView.mm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/source/window/VCLView.mm 16 Feb 2006 21:36:37 -0000 1.1.2.2 @@ -0,0 +1,102 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#import +#import + +#define _SV_VCLVIEW_M + +// ------------- +// - VCLView - +// ------------- + +@implementation VCLView + +- (void)drawRect: (NSRect)aRect +{ +} + +- init +{ + qdRgnResized=0; + return self; +} + +- (void)lockFocus +{ + [super lockFocus]; + + // [ed] 12/15/01 If we haven't done so yet, adjust the visRgn and clipRgn of the port + // to match the view. OS 10.1 changed the default behaviour of the clipping of + // NSQDViews and they now require initialization. + + if(!qdRgnResized) + { + RgnHandle tempRgn; + Rect r; + + r.left=0; + r.top=0; + r.right=[self bounds].size.width; + r.bottom=[self bounds].size.height; + + OpaqueGrafPtr *pGrafPtr = (OpaqueGrafPtr*)[self qdPort]; + + SetPort(pGrafPtr); + + tempRgn=NewRgn(); + RectRgn(tempRgn, &r); + + ClipRect(&r); + SetPortVisibleRegion(pGrafPtr, tempRgn); + PortChanged(pGrafPtr); + + DisposeRgn(tempRgn); + qdRgnResized=1; + } +} + +- (MacOSBOOL)isOpaque +{ + // Set background to white to avoid flickering when timer paints + return YES; +} + +@end + +// ----------------------- +// - C wrapper functions - +// ----------------------- + Index: aqua/source/window/VCLWindow.m =================================================================== RCS file: aqua/source/window/VCLWindow.m diff -N aqua/source/window/VCLWindow.m --- aqua/source/window/VCLWindow.m 9 Sep 2005 10:44:52 -0000 1.47 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,329 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import - -#define _SV_VCLWINDOW_M - -// ------------- -// - VCLWindow - -// ------------- - -@implementation VCLWindow - -- (void)setContentSize: (NSSize)aSize -{ - NSRect aFrameRect = [self frame]; - NSRect aContentRect; - struct SalPaintEvent aPaintEvt; - - // Get the current size of the content view - aContentRect = [VCLWindow contentRectForFrameRect: aFrameRect - styleMask: [self styleMask]]; - - if ( aSize.width != aContentRect.size.width || - aSize.height != aContentRect.size.height ) - { - // Cache the new size - mpSalFrameData->mnWidth = aSize.width; - mpSalFrameData->mnHeight = aSize.height; - - // Pass the event to this window's callback function. We need to force - // a resize before we post a paint event, otherwise only the old content - // view area will only be painted. - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_RESIZE, NULL); - - // Initialize SalKeyEvent structure - aPaintEvt.mnBoundX = 0; - aPaintEvt.mnBoundY = 0; - aPaintEvt.mnBoundWidth = aSize.width; - aPaintEvt.mnBoundHeight = aSize.height; - - // Pass the event to this window's callback function - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_PAINT, &aPaintEvt ); - } - - // Invoke the superclass to set the size of the window - [super setContentSize: aSize]; -} - -- (void)windowDidBecomeKey: (NSNotification *)aNotification -{ - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_GETFOCUS, NULL ); -} - -- (void)windowDidResignKey: (NSNotification *)aNotification -{ - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_LOSEFOCUS, NULL ); -} - -- (MacOSBOOL)windowShouldClose: (id)sender -{ - // Pass the event to this window's callback function. - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_CLOSE, NULL ); - - // Always return FALSE as the event handler above should have taken - // care of closing the window - return FALSE; -} - -- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)proposedFrameSize -{ - NSRect aFrameRect; - NSRect aContentRect; - NSEvent *pEvent; - struct SalPaintEvent aPaintEvt; - - // Get the size of the window's content area - aFrameRect = NSMakeRect( 0, 0, proposedFrameSize.width, - proposedFrameSize.height ); - aContentRect = [VCLWindow contentRectForFrameRect: aFrameRect - styleMask: [self styleMask]]; - - if ( aContentRect.size.width != mpSalFrameData->mnWidth || - aContentRect.size.height != mpSalFrameData->mnHeight ) - { - // Cache the new size - mpSalFrameData->mnWidth = aContentRect.size.width; - mpSalFrameData->mnHeight = aContentRect.size.height; - - // Pass the event to this window's callback function. - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_RESIZE, NULL); - - // Initialize SalKeyEvent structure - aPaintEvt.mnBoundX = 0; - aPaintEvt.mnBoundY = 0; - aPaintEvt.mnBoundWidth = aContentRect.size.width; - aPaintEvt.mnBoundHeight = aContentRect.size.height; - - // Pass the event to this window's callback function - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_PAINT, &aPaintEvt ); - - // We need to poll for the next NSPeriodic event that is posted - // by the paint event that we posted, otherwise no repainting will - // happen until after the last windowWillResize notification has - // been issued. If the NSPeriodic event has not been posted yet, - // don't worry about it as we will catch it the next time through. - if ( [self isVisible] ) - { - pEvent = [NSApp nextEventMatchingMask: NSPeriodicMask - untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES]; - if ( pEvent ) - [NSApp sendEvent: pEvent]; - } - } - - return proposedFrameSize; -} - -@end - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -VCLWINDOW VCLWindow_New( ULONG nSalFrameStyle, VCLWINDOW hParentWindow, - SalFrame *pFrame, struct SalFrameData *pFrameData ) -{ - VCLWindow *hWindow = nil; - unsigned int nMask = 0; - NSRect aContentRect; - NSNotificationCenter *pNotifyCenter = [NSNotificationCenter defaultCenter]; - - if (nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE) { - nMask |= NSResizableWindowMask; - } - if (nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) { - nMask |= NSClosableWindowMask; - } - if (nSalFrameStyle & SAL_FRAME_STYLE_MINABLE) { - nMask |= NSMiniaturizableWindowMask; - } - if (nSalFrameStyle & SAL_FRAME_STYLE_BORDER) { - nMask |= NSTitledWindowMask; - } - - // Special settings for a generic window (i.e. one with a title bar) - if( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT ) { - // Make sure there is a title bar - nMask |= NSTitledWindowMask; - aContentRect = [[NSScreen mainScreen] visibleFrame]; - } - // Generate a window without a title bar - else if( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) - { - // Make sure that we turn off all title bar related items - nMask &= ~NSClosableWindowMask; - nMask &= ~NSMiniaturizableWindowMask; - nMask &= ~NSTitledWindowMask; - - // Need to determine the correct default size for this case - aContentRect = NSMakeRect(0, 0, 200, 300); - } - // All other windows - else - { - // Make sure there is a title bar - nMask |= NSTitledWindowMask; - aContentRect = NSMakeRect(0, 0, 500, 400); - } - - // Create a native window - hWindow = [[VCLWindow new] initWithContentRect: aContentRect - styleMask: nMask backing: NSBackingStoreBuffered defer: YES]; - - // We need to attach the required SalFrameData struct pointer - hWindow->mpSalFrame = pFrame; - hWindow->mpSalFrameData = pFrameData; - - // Cache the size of the content area of the window - hWindow->mpSalFrameData->mnHeight = aContentRect.size.height; - hWindow->mpSalFrameData->mnWidth = aContentRect.size.width; - - // We need to set the window as its own Delegate to capture - // resizing events - [hWindow setDelegate: hWindow]; - - // We need to replace the window's contentView with an VCLView so - // that we can paint using QuickDraw - [hWindow setContentView: [[[VCLView new] init] initWithFrame: [hWindow frame]]]; - - // Turn on optimized drawing since we have no overlapping views - [hWindow useOptimizedDrawing: YES]; - - // Turn on mouse entered and exited events - [[hWindow contentView] addTrackingRect: aContentRect owner: hWindow - userData: nil assumeInside: NO]; - - return hWindow; -} - -VCLVIEW VCLWindow_ContentView( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return NULL; - - return [(VCLWindow *)hWindow contentView]; -} - -void VCLWindow_Show( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // If being shown for the first time, center it - if ( ! [(VCLWindow *)hWindow isVisible] ) - [(VCLWindow *)hWindow center]; - - // Bring the window to the front - [(VCLWindow *)hWindow makeKeyAndOrderFront: NSApp]; - - // Turn on tracking of mouse move events. Note that we can't do this until - // after [VCLWindow makeKeyAndOrderFront:] is invoked. Otherwise, this call - // does nothing. - [(VCLWindow *)hWindow setAcceptsMouseMovedEvents: YES]; -} - -void VCLWindow_Close( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // Hide the window - [(VCLWindow *)hWindow orderOut: (VCLWindow *)hWindow]; -} - -void VCLWindow_Release( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // Closing releases the window - [(VCLWindow *)hWindow close]; -} - -void VCLWindow_SetTitle( VCLWINDOW hWindow, const char *pTitle ) -{ - NSString *pString = nil; - - if ( (VCLWindow *)hWindow == nil ) - return; - - pString = [NSString stringWithCString: pTitle]; - [(VCLWindow *)hWindow setTitle: pString]; -} - -void VCLWindow_SetSize( VCLWINDOW hWindow, long nWidth, long nHeight ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // Set the native window size - [(VCLWindow *)hWindow setContentSize: NSMakeSize(nWidth, nHeight)]; -} - -BOOL VCLWindow_PostEvent( VCLWINDOW hWindow, void *pData ) -{ - NSEvent *pEvent = nil; - NSDate *pDate = nil; - - if ( (VCLWindow *)hWindow == nil ) - return FALSE; - - // Construct an event - pDate = [NSDate date]; - pEvent = [NSEvent otherEventWithType: NSApplicationDefined - location: NSMakePoint(0, 0) modifierFlags: 0 - timestamp: [pDate timeIntervalSince1970] - windowNumber: [(VCLWindow *)hWindow windowNumber] - context: nil subtype: 0 data1: (int)pData data2: 0]; - - // Post the event - [(VCLWindow *)hWindow postEvent: pEvent atStart: NO]; - - return TRUE; -} - -void VCLWindow_Beep( VCLWINDOW hWindow ) -{ - NSBeep(); -} Index: aqua/source/window/VCLWindow.mm =================================================================== RCS file: aqua/source/window/VCLWindow.mm diff -N aqua/source/window/VCLWindow.mm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ aqua/source/window/VCLWindow.mm 16 Feb 2006 21:36:37 -0000 1.1.2.2 @@ -0,0 +1,333 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#define _SV_VCLWINDOW_M + +#import + +//#include + +// ------------- +// - VCLWindow - +// ------------- + +@implementation VCLWindow + +- (void)setContentSize: (NSSize)aSize +{ + NSRect aFrameRect = [self frame]; + NSRect aContentRect; + struct SalPaintEvent aPaintEvt; + + // Get the current size of the content view + aContentRect = [VCLWindow contentRectForFrameRect: aFrameRect + styleMask: [self styleMask]]; + + if ( aSize.width != aContentRect.size.width || + aSize.height != aContentRect.size.height ) + { + // Cache the new size + mpSalFrame->mnWidth = aSize.width; + mpSalFrame->mnHeight = aSize.height; + + // Pass the event to this window's callback function. We need to force + // a resize before we post a paint event, otherwise only the old content + // view area will only be painted. + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_RESIZE, NULL); + + // Initialize SalKeyEvent structure + aPaintEvt.mnBoundX = 0; + aPaintEvt.mnBoundY = 0; + aPaintEvt.mnBoundWidth = aSize.width; + aPaintEvt.mnBoundHeight = aSize.height; + + // Pass the event to this window's callback function + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_PAINT, &aPaintEvt ); + } + + // Invoke the superclass to set the size of the window + [super setContentSize: aSize]; +} + +- (void)windowDidBecomeKey: (NSNotification *)aNotification +{ + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_GETFOCUS, NULL ); +} + +- (void)windowDidResignKey: (NSNotification *)aNotification +{ + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_LOSEFOCUS, NULL ); +} + +- (MacOSBOOL)windowShouldClose: (id)sender +{ + // Pass the event to this window's callback function. + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_CLOSE, NULL ); + + // Always return FALSE as the event handler above should have taken + // care of closing the window + return FALSE; +} + +- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)proposedFrameSize +{ + NSRect aFrameRect; + NSRect aContentRect; + NSEvent *pEvent; + struct SalPaintEvent aPaintEvt; + + // Get the size of the window's content area + aFrameRect = NSMakeRect( 0, 0, proposedFrameSize.width, + proposedFrameSize.height ); + aContentRect = [VCLWindow contentRectForFrameRect: aFrameRect + styleMask: [self styleMask]]; + + if ( aContentRect.size.width != mpSalFrame->mnWidth || + aContentRect.size.height != mpSalFrame->mnHeight ) + { + // Cache the new size + mpSalFrame->mnWidth = aContentRect.size.width; + mpSalFrame->mnHeight = aContentRect.size.height; + + // Pass the event to this window's callback function. + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_RESIZE, NULL); + + // Initialize SalKeyEvent structure + aPaintEvt.mnBoundX = 0; + aPaintEvt.mnBoundY = 0; + aPaintEvt.mnBoundWidth = aContentRect.size.width; + aPaintEvt.mnBoundHeight = aContentRect.size.height; + + // Pass the event to this window's callback function + mpSalFrame->mpProc( mpSalFrame->mpInst, mpSalFrame, + SALEVENT_PAINT, &aPaintEvt ); + + // We need to poll for the next NSPeriodic event that is posted + // by the paint event that we posted, otherwise no repainting will + // happen until after the last windowWillResize notification has + // been issued. If the NSPeriodic event has not been posted yet, + // don't worry about it as we will catch it the next time through. + if ( [self isVisible] ) + { + pEvent = [NSApp nextEventMatchingMask: NSPeriodicMask + untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES]; + if ( pEvent ) + [NSApp sendEvent: pEvent]; + } + } + + return proposedFrameSize; +} + +@end + +// ----------------------- +// - C wrapper functions - +// ----------------------- + +VCLWINDOW VCLWindow_New( ULONG nSalFrameStyle, VCLWINDOW hParentWindow, AquaSalFrame *pFrame) +{ + VCLWindow *hWindow = nil; + unsigned int nMask = 0; + NSRect aContentRect; + NSNotificationCenter *pNotifyCenter = [NSNotificationCenter defaultCenter]; + + if (nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE) { + nMask |= NSResizableWindowMask; + } + if (nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) { + nMask |= NSClosableWindowMask; + } +// if (nSalFrameStyle & SAL_FRAME_STYLE_MINABLE) { +// nMask |= NSMiniaturizableWindowMask; +// } +// if (nSalFrameStyle & SAL_FRAME_STYLE_BORDER) { +// nMask |= NSTitledWindowMask; +// } + + // Special settings for a generic window (i.e. one with a title bar) + if( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT ) { + // Make sure there is a title bar + nMask |= NSTitledWindowMask; + aContentRect = [[NSScreen mainScreen] visibleFrame]; + } + // Generate a window without a title bar + else if( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) + { + // Make sure that we turn off all title bar related items + nMask &= ~NSClosableWindowMask; + nMask &= ~NSMiniaturizableWindowMask; + nMask &= ~NSTitledWindowMask; + + // Need to determine the correct default size for this case + aContentRect = NSMakeRect(0, 0, 200, 300); + } + // All other windows + else + { + // Make sure there is a title bar + nMask |= NSTitledWindowMask; + aContentRect = NSMakeRect(0, 0, 500, 400); + } + + // Create a native window + hWindow = [[VCLWindow new] initWithContentRect: aContentRect + styleMask: nMask backing: NSBackingStoreBuffered defer: YES]; + + hWindow->mpSalFrame = pFrame; + + // Cache the size of the content area of the window + hWindow->mpSalFrame->mnHeight = aContentRect.size.height; + hWindow->mpSalFrame->mnWidth = aContentRect.size.width; + + // We need to set the window as its own Delegate to capture + // resizing events + [hWindow setDelegate: hWindow]; + + // We need to replace the window's contentView with an VCLView so + // that we can paint using QuickDraw + [hWindow setContentView: [[[VCLView new] init] initWithFrame: [hWindow frame]]]; + + // Turn on optimized drawing since we have no overlapping views + [hWindow useOptimizedDrawing: YES]; + + // Turn on mouse entered and exited events + [[hWindow contentView] addTrackingRect: aContentRect owner: hWindow + userData: nil assumeInside: NO]; + + return hWindow; +} + +VCLVIEW VCLWindow_ContentView( VCLWINDOW hWindow ) +{ + if ( (VCLWindow *)hWindow == nil ) + return NULL; + + return [(VCLWindow *)hWindow contentView]; +} + +void VCLWindow_Show( VCLWINDOW hWindow ) +{ + if ( (VCLWindow *)hWindow == nil ) + return; + + // If being shown for the first time, center it + if ( ! [(VCLWindow *)hWindow isVisible] ) + [(VCLWindow *)hWindow center]; + + // Bring the window to the front + [(VCLWindow *)hWindow makeKeyAndOrderFront: NSApp]; + + // Turn on tracking of mouse move events. Note that we can't do this until + // after [VCLWindow makeKeyAndOrderFront:] is invoked. Otherwise, this call + // does nothing. + [(VCLWindow *)hWindow setAcceptsMouseMovedEvents: YES]; +} + +void VCLWindow_Close( VCLWINDOW hWindow ) +{ + if ( (VCLWindow *)hWindow == nil ) + return; + + // Hide the window + [(VCLWindow *)hWindow orderOut: (VCLWindow *)hWindow]; +} + +void VCLWindow_Release( VCLWINDOW hWindow ) +{ + if ( (VCLWindow *)hWindow == nil ) + return; + + // Closing releases the window + [(VCLWindow *)hWindow close]; +} + +void VCLWindow_SetTitle( VCLWINDOW hWindow, const char *pTitle ) +{ + NSString *pString = nil; + + if ( (VCLWindow *)hWindow == nil ) + return; + + pString = [NSString stringWithCString: pTitle]; + [(VCLWindow *)hWindow setTitle: pString]; +} + +void VCLWindow_SetSize( VCLWINDOW hWindow, long nWidth, long nHeight ) +{ + if ( (VCLWindow *)hWindow == nil ) + return; + + // Set the native window size + [(VCLWindow *)hWindow setContentSize: NSMakeSize(nWidth, nHeight)]; +} + +BOOL VCLWindow_PostEvent( VCLWINDOW hWindow, void *pData ) +{ + NSEvent *pEvent = nil; + NSDate *pDate = nil; + + if ( (VCLWindow *)hWindow == nil ) + return FALSE; + + // Construct an event + pDate = [NSDate date]; + pEvent = [NSEvent otherEventWithType: NSApplicationDefined + location: NSMakePoint(0, 0) modifierFlags: 0 + timestamp: [pDate timeIntervalSince1970] + windowNumber: [(VCLWindow *)hWindow windowNumber] + context: nil subtype: 0 data1: (int)pData data2: 0]; + + // Post the event + [(VCLWindow *)hWindow postEvent: pEvent atStart: NO]; + + return TRUE; +} + +VCL_DLLPUBLIC void VCLWindow_Beep( VCLWINDOW hWindow ) +{ + NSBeep(); +} + +VCL_DLLPUBLIC void VCLWindow_Beep() +{ + NSBeep(); +} Index: aqua/source/window/makefile.mk =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/window/makefile.mk,v retrieving revision 1.9 retrieving revision 1.9.112.1 diff -u -r1.9 -r1.9.112.1 --- aqua/source/window/makefile.mk 9 Sep 2005 10:45:06 -0000 1.9 +++ aqua/source/window/makefile.mk 16 Feb 2006 21:36:37 -0000 1.9.112.1 @@ -59,9 +59,7 @@ SLOFILES= \ $(SLO)/salframe.obj \ - $(SLO)/salobj.obj \ - $(SLO)/VCLView.obj \ - $(SLO)/VCLWindow.obj + $(SLO)/salobj.obj .ENDIF # "$(GUIBASE)"!="aqua" Index: aqua/source/window/salframe.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/window/salframe.cxx,v retrieving revision 1.46 retrieving revision 1.46.112.8 diff -u -r1.46 -r1.46.112.8 --- aqua/source/window/salframe.cxx 9 Sep 2005 10:45:20 -0000 1.46 +++ aqua/source/window/salframe.cxx 2 Mar 2006 00:32:25 -0000 1.46.112.8 @@ -41,319 +41,835 @@ #ifndef _SV_SALGDI_HXX #include #endif -#ifndef _SV_SALFRAME_HXX -#include -#endif -#ifndef _SV_VCLWINDOW_H -#include +#ifndef _SV_SALGDI_H +#include #endif -#ifndef _SV_VCLGRAPHICS_H -#include +#ifndef _SV_SALFRAME_HXX +#include #endif +#include + +#define kOOoSalUserEventClass 2870 +#define kOOoSalEventUser 20975 +#define kOOoSalEventData 19999 +#define kOOoSalEventParamTypePtr 27802 + // ======================================================================= static long ImplSalFrameCallbackDummy( void*, SalFrame*, USHORT, const void* ) { + fprintf(stdout, ">*>_> %s\n",__func__); return 0; } // ======================================================================= -SalFrame::SalFrame() -{ - SalData* pSalData = GetSalData(); - - maFrameData.mhWnd = NULL; - maFrameData.mpGraphics = NULL; - maFrameData.mpInst = NULL; - maFrameData.mpProc = ImplSalFrameCallbackDummy; - maFrameData.mnWidth = 0; - maFrameData.mnHeight = 0; - maFrameData.mbGraphics = FALSE; +AquaSalFrame::AquaSalFrame() : + mhWnd(NULL), + mpGraphics(NULL), + mpParent(NULL), + mpInst(NULL), + mpProc(ImplSalFrameCallbackDummy), + mnWidth(0), + mnHeight(0), + mnMinWidth(0), + mnMinHeight(0), + mnMaxWidth(0), + mnMaxHeight(0), + mbGraphics(FALSE) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + InsertThisIntoFrameList(); +} + +AquaSalFrame::AquaSalFrame(SalFrame* pParent, ULONG salFrameStyle) : + mpGraphics(NULL), + mpParent(NULL), + mpInst(NULL), + mpProc(ImplSalFrameCallbackDummy), + mnWidth(0), + mnHeight(0), + mnMinWidth(0), + mnMinHeight(0), + mnMaxWidth(0), + mnMaxHeight(0), + mbGraphics(FALSE) +{ + InsertThisIntoFrameList(); + mpParent = dynamic_cast(pParent); + BOOST_ASSERT((pParent && pFrame->mpParent) || (pParent == NULL) && "Parent frame is no AquaSalFrame!"); + mhWnd = Carbon_NewWindow(salFrameStyle, this); +} - // insert frame in framelist - maFrameData.mpNextFrame = pSalData->mpFirstFrame; +void AquaSalFrame::InsertThisIntoFrameList() +{ + SalData* pSalData = GetSalData(); + mpNextFrame = dynamic_cast(pSalData->mpFirstFrame); pSalData->mpFirstFrame = this; } -// ----------------------------------------------------------------------- - -SalFrame::~SalFrame() +void AquaSalFrame::RemoveThisFromFrameList() { SalData* pSalData = GetSalData(); - if ( maFrameData.mpGraphics ) - delete maFrameData.mpGraphics; - - if ( maFrameData.mhWnd ) - VCLWindow_Release( maFrameData.mhWnd ); - - // remove frame from framelist - if ( this == pSalData->mpFirstFrame ) - pSalData->mpFirstFrame = maFrameData.mpNextFrame; + if (this == pSalData->mpFirstFrame) + pSalData->mpFirstFrame = mpNextFrame; else { - SalFrame* pTempFrame = pSalData->mpFirstFrame; - while ( pTempFrame->maFrameData.mpNextFrame != this ) - pTempFrame = pTempFrame->maFrameData.mpNextFrame; + AquaSalFrame* pTempFrame = (AquaSalFrame*)pSalData->mpFirstFrame; + while (pTempFrame->mpNextFrame != this) + pTempFrame = (AquaSalFrame*)pTempFrame->mpNextFrame; - pTempFrame->maFrameData.mpNextFrame = maFrameData.mpNextFrame; + pTempFrame->mpNextFrame = mpNextFrame; } } // ----------------------------------------------------------------------- -SalGraphics* SalFrame::GetGraphics() +AquaSalFrame::~AquaSalFrame() +{ + fprintf(stdout, ">*>_> %s\n",__func__); + + if ( mpGraphics ) + delete mpGraphics; + + if (mhWnd) + { + Carbon_CloseWindow( mhWnd ); + ReleaseWindow(mhWnd); + } + + RemoveThisFromFrameList(); +} + +// ----------------------------------------------------------------------- + +SalGraphics* AquaSalFrame::GetGraphics() { - if ( maFrameData.mbGraphics ) + fprintf(stdout, ">*>_> %s\n",__func__); + if ( mbGraphics ) return NULL; - if ( !maFrameData.mpGraphics ) + if ( !mpGraphics ) { - VCLVIEW hView = NULL; - SalFrame *pFrame = this; + CarbonViewRef hView; + AquaSalFrame *pFrame = this; // Search for the parent SalFrame that has a native window and // use that window to get an NSView - while ( !pFrame->maFrameData.mhWnd ) { - pFrame = pFrame->maFrameData.mpParent; + + while ( !pFrame->mhWnd ) { + pFrame = (AquaSalFrame*)pFrame->mpParent; if ( !pFrame ) break; } - hView = VCLWindow_ContentView( pFrame->maFrameData.mhWnd ); + + Carbon_GetWindowContentView( pFrame->mhWnd, hView ); if ( hView ) { - maFrameData.mpGraphics = new SalGraphics; - maFrameData.mpGraphics->maGraphicsData.mhDC = hView; - maFrameData.mpGraphics->maGraphicsData.mbPrinter = FALSE; - maFrameData.mpGraphics->maGraphicsData.mbVirDev = FALSE; - maFrameData.mpGraphics->maGraphicsData.mbWindow = TRUE; - maFrameData.mpGraphics->maGraphicsData.mbScreen = TRUE; + mpGraphics = new AquaSalGraphics; + mpGraphics->mhDC = hView; + mpGraphics->mhWnd = mhWnd; + mpGraphics->mbPrinter = FALSE; + mpGraphics->mbVirDev = FALSE; + mpGraphics->mbWindow = TRUE; + mpGraphics->mbScreen = TRUE; } } - maFrameData.mbGraphics = TRUE; + mbGraphics = TRUE; - return maFrameData.mpGraphics; + return mpGraphics; } // ----------------------------------------------------------------------- -void SalFrame::ReleaseGraphics( SalGraphics *pGraphics ) +void AquaSalFrame::ReleaseGraphics( SalGraphics *pGraphics ) { - maFrameData.mbGraphics = FALSE; + fprintf(stdout, ">*>_> %s\n",__func__); + mbGraphics = FALSE; } // ----------------------------------------------------------------------- -BOOL SalFrame::PostEvent( void *pData ) +BOOL AquaSalFrame::PostEvent( void *pData ) { - VCLWINDOW hWindow = NULL; - SalFrame *pFrame = this; + fprintf(stdout, ">*>_> %s\n",__func__); // Search for the parent SalFrame that has a native window and // use that window to post the event to - while ( !pFrame->maFrameData.mhWnd ) { - pFrame = pFrame->maFrameData.mpParent; - if ( !pFrame ) + AquaSalFrame *pFrame = this; + while (!pFrame->mhWnd) + { + pFrame = pFrame->mpParent; + if (!pFrame) break; } - return VCLWindow_PostEvent( pFrame->maFrameData.mhWnd, pData ); + + bool bret = false; + + if (pFrame) + { + EventRef eventRef; + if (CreateEvent(NULL, kOOoSalUserEventClass, kOOoSalEventUser, 0, kEventAttributeNone, &eventRef) == noErr) + { + EventTargetRef eventTargetRef = GetWindowEventTarget(pFrame->mhWnd); + if (SetEventParameter(eventRef, kEventParamPostTarget, typeEventTargetRef, sizeof(EventTargetRef), &eventTargetRef) == noErr && + SetEventParameter(eventRef, kOOoSalEventData, kOOoSalEventParamTypePtr, sizeof(pData), &pData) == noErr && + PostEventToQueue(GetMainEventQueue(), eventRef, kEventPriorityStandard) == noErr) + { + bret = true; + } + ReleaseEvent(eventRef); + } + } + return bret; } // ----------------------------------------------------------------------- -void SalFrame::SetTitle( const XubString& rTitle ) +void AquaSalFrame::SetTitle( const XubString& rTitle ) { + fprintf(stdout, ">*>_> %s\n",__func__); ByteString aByteTitle( rTitle, gsl_getSystemTextEncoding() ); char *pTitle = (char *)aByteTitle.GetBuffer(); - if ( maFrameData.mhWnd ) - VCLWindow_SetTitle( maFrameData.mhWnd, pTitle ); + if ( mhWnd ) + Carbon_SetWindowTitle( mhWnd, pTitle ); } // ----------------------------------------------------------------------- -void SalFrame::SetIcon( USHORT nIcon ) +void AquaSalFrame::SetIcon( USHORT nIcon ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::Show( BOOL bVisible ) +void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) { - if ( bVisible ) + fprintf(stdout, ">*>_> %s\n",__func__); + + BOOST_ASSERT(mhWnd && "Precondition violation - no window associated with frame yet"); + + if (bVisible) { - if ( maFrameData.mhWnd ) - VCLWindow_Show( maFrameData.mhWnd ); - } // if + if (mhWnd) + { + Carbon_ShowWindow( mhWnd ); + } + } else { - if ( maFrameData.mhWnd ) + if (mhWnd) { - VCLWindow_Close( maFrameData.mhWnd ); - if ( maFrameData.mpParent ) - maFrameData.mpParent->Show( TRUE ); + Carbon_CloseWindow(mhWnd); + if (mpParent) + mpParent->Show(TRUE, FALSE); } - } // else -} // SalFrame::Show + } +} // ----------------------------------------------------------------------- -void SalFrame::Enable( BOOL bEnable ) +void AquaSalFrame::Enable( BOOL bEnable ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetMinClientSize( long nWidth, long nHeight ) +void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight ) { + fprintf(stdout, ">*>_> %s\n",__func__); + mnMinWidth = nWidth; + mnMinHeight = nHeight; } // ----------------------------------------------------------------------- -void SalFrame::SetClientSize( long nWidth, long nHeight ) +void AquaSalFrame::SetClientSize( long nWidth, long nHeight ) { - maFrameData.mnWidth = nWidth; - maFrameData.mnHeight = nHeight; + fprintf(stdout, ">*>_> %s\n",__func__); + mnWidth = nWidth; + mnHeight = nHeight; // If this is a native window, resize it - if ( maFrameData.mhWnd ) - VCLWindow_SetSize( maFrameData.mhWnd, nWidth, nHeight ); + if ( mhWnd ) + Carbon_SetWindowSize( mhWnd, nWidth, nHeight ); } // ----------------------------------------------------------------------- -void SalFrame::GetClientSize( long& rWidth, long& rHeight ) +void AquaSalFrame::GetClientSize( long& rWidth, long& rHeight ) { - rWidth = maFrameData.mnWidth; - rHeight = maFrameData.mnHeight; + fprintf(stdout, ">*>_> %s\n",__func__); + rWidth = mnWidth; + rHeight = mnHeight; } // ----------------------------------------------------------------------- -void SalFrame::SetWindowState( const SalFrameState* pState ) +void AquaSalFrame::SetWindowState( const SalFrameState* pState ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -BOOL SalFrame::GetWindowState( SalFrameState* pState ) +BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) { + fprintf(stdout, ">*>_> %s\n",__func__); return FALSE; } // ----------------------------------------------------------------------- -void SalFrame::ShowFullScreen( BOOL bFullScreen ) +void AquaSalFrame::ShowFullScreen( BOOL bFullScreen ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::StartPresentation( BOOL bStart ) +void AquaSalFrame::StartPresentation( BOOL bStart ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetAlwaysOnTop( BOOL bOnTop ) +void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::ToTop( USHORT nFlags ) +void AquaSalFrame::ToTop(USHORT nFlags) { - if ( maFrameData.mhWnd ) - VCLWindow_Show( maFrameData.mhWnd ); + fprintf(stdout, ">*>_> %s\n",__func__); + + BOOST_ASSERT(mhWnd && "Precondition violation - no window associated with frame yet"); + + if (mhWnd) + { + Carbon_ShowWindow(mhWnd); + ActivateWindow(mhWnd, TRUE); + } } // ----------------------------------------------------------------------- -void SalFrame::SetPointer( PointerStyle ePointerStyle ) +void AquaSalFrame::SetPointer( PointerStyle ePointerStyle ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::CaptureMouse( BOOL bCapture ) +void AquaSalFrame::CaptureMouse( BOOL bCapture ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetPointerPos( long nX, long nY ) +void AquaSalFrame::SetPointerPos( long nX, long nY ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::Flush() +void AquaSalFrame::Flush() { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::Sync() +void AquaSalFrame::Sync() { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetInputContext( SalInputContext* pContext ) +void AquaSalFrame::SetInputContext( SalInputContext* pContext ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::EndExtTextInput( USHORT nFlags ) +void AquaSalFrame::EndExtTextInput( USHORT nFlags ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -XubString SalFrame::GetKeyName( USHORT nKeyCode ) +XubString AquaSalFrame::GetKeyName( USHORT nKeyCode ) { + fprintf(stdout, ">*>_> %s\n",__func__); return XubString(); } // ----------------------------------------------------------------------- -XubString SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) +XubString AquaSalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) { + fprintf(stdout, ">*>_> %s\n",__func__); return GetKeyName( nKeyCode ); } // ----------------------------------------------------------------------- -void SalFrame::UpdateSettings( AllSettings& rSettings ) +void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) { + fprintf(stdout, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -const SystemEnvData* SalFrame::GetSystemData() const +const SystemEnvData* AquaSalFrame::GetSystemData() const { + fprintf(stdout, ">*>_> %s\n",__func__); return NULL; } // ----------------------------------------------------------------------- -void SalFrame::Beep( SoundType eSoundType ) +void AquaSalFrame::Beep( SoundType eSoundType ) { - VCLWindow_Beep(); + fprintf(stdout, ">*>_> %s\n",__func__); + Carbon_Beep(); } // ----------------------------------------------------------------------- -void SalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc ) +void AquaSalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc ) { - maFrameData.mpInst = pInst; + fprintf(stdout, ">*>_> %s\n",__func__); + mpInst = pInst; if ( pProc ) - maFrameData.mpProc = pProc; + mpProc = pProc; else - maFrameData.mpProc = ImplSalFrameCallbackDummy; + mpProc = ImplSalFrameCallbackDummy; +} + + +////////////////////////////////////////////////////////////////////////// +// NEW THINGS STILL TO BE IMPLEMENTED +////////////////////////////////////////////////////////////////////////// + +void AquaSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::DrawMenuBar() +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::GetWorkArea( Rectangle& rRect ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + Rect aRect; + + if (mhWnd == NULL) + return; +// GetWindowBounds(mhWnd, kWindowContentRgn, &aRect); +// rRect.nTop = aRect.top; +// rRect.nLeft = aRect.left; +// rRect.nBottom = aRect.bottom; +// rRect.nRight = aRect.right; + rRect.nTop = rRect.nLeft = 10; + rRect.nRight = rRect.nBottom = 500; +} + +SalPointerState AquaSalFrame::GetPointerState() +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement + SalPointerState state; + return state; +} + +bool AquaSalFrame::SetPluginParent( SystemParentData* pNewParent ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement + return sal_False; +} + +BOOL AquaSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + // not supported yet + return FALSE; +} + +LanguageType AquaSalFrame::GetInputLanguage() +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement + return LANGUAGE_DONTKNOW; +} + +void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + mnMaxWidth = nWidth; + mnMaxHeight = nHeight; +} + +void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::SetBackgroundBitmap( SalBitmap* ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement +} + +SalBitmap* AquaSalFrame::SnapShot() +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement + return NULL; +} + +SalFrame* AquaSalFrame::GetParent() const +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement + return mpParent; +} + +void AquaSalFrame::SetParent( SalFrame* pNewParent ) +{ + fprintf(stdout, ">*>_> %s\n",__func__); + //TODO: implement + mpParent = (AquaSalFrame*)pNewParent; +} + +const EventTypeSpec windowBoundsChangedEvent = { kEventClassWindow, kEventWindowBoundsChanged }; +const EventTypeSpec windowCloseEvent = { kEventClassWindow, kEventWindowClose }; +const EventTypeSpec oOOSalUserEvent = { kOOoSalUserEventClass, kOOoSalEventUser }; +const EventTypeSpec windowActivatedEvent = { kEventClassWindow, kEventWindowActivated }; +const EventTypeSpec windowPaintEvent = { kEventClassWindow, kEventWindowPaint }; +const EventTypeSpec windowUpdateEvent = { kEventClassWindow, kEventWindowUpdate }; +const EventTypeSpec mouseUpDownEvent[] = { { kEventClassMouse, kEventMouseDown }, { kEventClassMouse, kEventMouseUp } }; + +OSStatus HandleWindowCloseEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == kEventClassWindow && GetEventKind(inEvent) == kEventWindowClose && "Only WindowClose event expected"); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + pSalFrame->CallCallback(SALEVENT_CLOSE, 0); + return noErr; +} + +OSStatus HandleWindowBoundsChangedEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == kEventClassWindow && GetEventKind(inEvent) == kEventWindowBoundsChanged && "Only WindowBoundsChanged event expected"); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + memset(&pSalFrame->maGeometry, 0, sizeof(SalFrameGeometry)); + + // Update frame geometry + CarbonWindowRef windowRef; + GetEventParameter(inEvent, kEventParamDirectObject, typeWindowRef, NULL, sizeof(windowRef), NULL, &windowRef); + + Rect windowBounds; + GetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &windowBounds); + + Rect windowStructRgn; + GetWindowBounds(windowRef, kWindowStructureRgn, &windowStructRgn); + + Rect windowTitleBarRgn; + GetWindowBounds(windowRef, kWindowTitleBarRgn, &windowTitleBarRgn); + + Rect windowGrowRgn; + GetWindowBounds(windowRef, kWindowZoomBoxRgn, &windowGrowRgn); + + Rect windowCntRgn; + GetWindowBounds(windowRef, kWindowContentRgn, &windowCntRgn); + + // pSalFrame->maGeometry.nX = windowBounds. + //pSalFrame->maGeometry.nY = + + //pSalFrame->maGeometry.nTopDecoration = + + // save frame state + + // todo... + + // compose sal resize event + long windowWidth = windowBounds.right - windowBounds.left; + long windowHeight = windowBounds.bottom - windowBounds.top; + + // Get the size of the window's content area + if ( windowWidth != pSalFrame->mnWidth || + windowHeight != pSalFrame->mnHeight ) + { + // Cache the new size + pSalFrame->mnWidth = windowWidth; + pSalFrame->mnHeight = windowHeight; + pSalFrame->CallCallback( SALEVENT_RESIZE, NULL); + } + + return noErr; +} + +OSStatus HandleOOoSalUserEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == kOOoSalUserEventClass && "Only SalUserEvents expected"); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + void* pData = NULL; + + GetEventParameter(inEvent, kOOoSalEventData, kOOoSalEventParamTypePtr, NULL, sizeof(pData), NULL, &pData); + pSalFrame->CallCallback(SALEVENT_USEREVENT, pData); + return noErr; +} + +OSStatus HandleWindowActivatedEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + return eventNotHandledErr; +} + +OSStatus HandleWindowPaintEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + return eventNotHandledErr; +} + +OSStatus HandleWindowUpdateEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + Rect updateBounds, contentBounds; + GetWindowBounds( pSalFrame->mhWnd, kWindowContentRgn, &contentBounds ); + GetWindowBounds( pSalFrame->mhWnd, kWindowUpdateRgn, &updateBounds ); + + SalPaintEvent aPaintEvt; + aPaintEvt.mnBoundX = updateBounds.left - contentBounds.left; + aPaintEvt.mnBoundY = updateBounds.top - contentBounds.top; + aPaintEvt.mnBoundWidth = updateBounds.right - updateBounds.left; + aPaintEvt.mnBoundHeight = updateBounds.bottom - updateBounds.top; + + pSalFrame->CallCallback(SALEVENT_PAINT, &aPaintEvt); + + return noErr; +} + +OSStatus HandleMouseUpDownEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == kEventClassMouse && (GetEventKind(inEvent) == kEventMouseDown || GetEventKind(inEvent) == kEventMouseUp) && "Mouse up or mouse down events expected"); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + // use window bounds to convert from screen to window coordinates + Rect bounds; + GetWindowBounds( pSalFrame->mhWnd, kWindowContentRgn, &bounds ); + + // get mouse coordinates in screen space + MacOSPoint aPt; + GetEventParameter(inEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(aPt), NULL, &aPt); + + SalMouseEvent aMouseEvt; + aMouseEvt.mnX = aPt.h - bounds.left; + aMouseEvt.mnY = aPt.v - bounds.top; + + // TODO: read code, time and button from event and use the same code for MouseUp !!! + + aMouseEvt.mnCode = 0; + aMouseEvt.mnTime = 0; //GetMessageTime(); + + // which button ? + EventMouseButton aButtonEvt; + GetEventParameter(inEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(aButtonEvt), NULL, &aButtonEvt); + + switch( aButtonEvt ) + { + case kEventMouseButtonPrimary: + aMouseEvt.mnButton = MOUSE_LEFT; + break; + + case kEventMouseButtonSecondary: + aMouseEvt.mnButton = MOUSE_MIDDLE; + break; + + case kEventMouseButtonTertiary: + aMouseEvt.mnButton = MOUSE_RIGHT; + break; + } + + pSalFrame->CallCallback(GetEventKind( inEvent ) == kEventMouseDown ? + SALEVENT_MOUSEBUTTONDOWN : SALEVENT_MOUSEBUTTONUP, + &aMouseEvt); + + // Note: we have to return eventNotHandledErr otherwise + // the window will not be activated and stay in the background + return eventNotHandledErr; +} + +OSStatus GetOptimalWindowSize(Rect* rect); + +CarbonWindowRef Carbon_NewWindow( ULONG nSalFrameStyle, AquaSalFrame *pFrame) +{ + CarbonWindowRef hWindow = nil; + // in order to receive windowupdate events we must not use compositing (kWindowCompositingAttribute)! + unsigned int nWindowAttributes = kWindowStandardHandlerAttribute; + WindowClass windowClass = kPlainWindowClass; + Rect aContentRect; + + if (nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE) { + // force live resize + nWindowAttributes |= (kWindowResizableAttribute | kWindowLiveResizeAttribute); + } + if (nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) { + nWindowAttributes |= kWindowCloseBoxAttribute; + } + + // Special settings for a generic window (i.e. one with a title bar) + if( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT ) { + windowClass = kDocumentWindowClass; + GetOptimalWindowSize(&aContentRect); + } + // Generate a window without a title bar + else if( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) + { + // Make sure that we turn off all title bar related items + // Need to determine the correct default size for this case + // aContentRect = NSMakeRect(0, 0, 200, 300); + aContentRect.top = aContentRect.left = 50; + aContentRect.right = 300; + aContentRect.bottom = 200; + + } + else // All other windows + { + // Make sure there is a title bar + // nMask |= NSTitledWindowMask; + // aContentRect = NSMakeRect(0, 0, 500, 400); + aContentRect.top = aContentRect.left = 50; + aContentRect.right = 500; + aContentRect.bottom = 400; + } + + OSStatus rc = CreateNewWindow(windowClass, nWindowAttributes, &aContentRect, &hWindow); + + // Cache the size of the content area of the window + pFrame->mnHeight = aContentRect.bottom - aContentRect.top; + pFrame->mnWidth = aContentRect.right - aContentRect.left; + + // ToDo: We need to free the UPP pointers (the system will not do so)!!! + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleWindowCloseEvent), 1, &windowCloseEvent, pFrame, NULL); + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleWindowBoundsChangedEvent), 1, &windowBoundsChangedEvent, pFrame, NULL); + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleOOoSalUserEvent), 1, &oOOSalUserEvent, pFrame, NULL); + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleWindowPaintEvent), 1, &windowPaintEvent, pFrame, NULL); + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleWindowUpdateEvent), 1, &windowUpdateEvent, pFrame, NULL); + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleWindowActivatedEvent), 1, &windowActivatedEvent, pFrame, NULL); + InstallWindowEventHandler(hWindow, NewEventHandlerUPP(HandleMouseUpDownEvent), GetEventTypeCount(mouseUpDownEvent), mouseUpDownEvent, pFrame, NULL); + + return hWindow; +} + +OSStatus GetOptimalWindowSize(Rect* rect) +{ + OSStatus err = noErr; + GDHandle hDisplay; + + BOOST_ASSERT(rect != NULL && "Precondition violated"); + + /* + for (hDisplay = DMGetFirstScreenDevice(TRUE); hDisplay != 0; hDisplay = DMGetNextScreenDevice(hDisplay, TRUE)){} + err = GetAvailableWindowPositioningBounds(hDisplay,rect); + */ + rect->top = 100; + rect->left = 100; + rect->bottom = 500; + rect->right = 500; + return err; +} + +OSStatus Carbon_GetWindowContentView( CarbonWindowRef hWindow, ControlRef hControl) +{ + OSStatus err; + BOOST_ASSERT(hWindow && "Precondition violated"); + BOOST_ASSERT(hControl && "Precondition 2 violated"); + err = GetRootControl(hWindow, &hControl); + return err; +} + +void Carbon_ShowWindow( CarbonWindowRef hWindow ) +{ + BOOST_ASSERT(hWindow && "Precondition violated"); + + ShowWindow( hWindow ); + //SelectWindow( hWindow ); + + //this should only be done for document windows!!! + //RepositionWindow(hWindow, NULL, kWindowCenterOnMainScreen); +} + +void Carbon_CloseWindow( CarbonWindowRef hWindow ) +{ + BOOST_ASSERT(hWindow); + HideWindow(hWindow); +} + +void Carbon_SetWindowTitle( CarbonWindowRef hWindow, const char *pTitle ) +{ + BOOST_ASSERT(hWindow && pTitle && "Precondition violation"); + CFStringRef pString = CFStringCreateWithCString(kCFAllocatorDefault,pTitle,kCFStringEncodingUTF8); + SetWindowTitleWithCFString( hWindow, pString ); + CFRelease(pString); +} + +void Carbon_SetWindowSize( CarbonWindowRef hWindow, long nWidth, long nHeight ) +{ + BOOST_ASSERT(hWindow && "Precondition violation"); + + Rect bounds; + GetWindowBounds( hWindow, kWindowContentRgn, &bounds ); + bounds.right = bounds.left + nWidth; + bounds.bottom = bounds.top + nHeight; + SetWindowBounds( hWindow, kWindowContentRgn, &bounds ); } + +BOOL Carbon_PostEventToWindow( CarbonWindowRef hWindow, void *pData ) +{ + return FALSE; +} + +void Carbon_BeepWindow( CarbonWindowRef hWindow ) +{ + SysBeep(1); +} + +void Carbon_Beep() +{ + SysBeep(1); +} + Index: aqua/source/window/salobj.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/window/salobj.cxx,v retrieving revision 1.8 retrieving revision 1.8.112.1 diff -u -r1.8 -r1.8.112.1 --- aqua/source/window/salobj.cxx 9 Sep 2005 10:45:37 -0000 1.8 +++ aqua/source/window/salobj.cxx 27 Nov 2005 09:48:41 -0000 1.8.112.1 @@ -38,8 +38,8 @@ #ifndef _SV_SALDATA_HXX #include #endif -#ifndef _SV_SALOBJ_HXX -#include +#ifndef _SV_SALOBJ_H +#include #endif // ======================================================================= @@ -51,118 +51,118 @@ // ======================================================================= -SalObject::SalObject() +AquaSalObject::AquaSalObject() { SalData* pSalData = GetSalData(); - maObjectData.mpFrame = NULL; - maObjectData.mpInst = NULL; - maObjectData.mpProc = ImplSalObjectCallbackDummy; + mpFrame = NULL; + mpInst = NULL; + mpProc = ImplSalObjectCallbackDummy; // Insert object in objectlist - maObjectData.mpNextObject = pSalData->mpFirstObject; + mpNextObject = (AquaSalObject*)pSalData->mpFirstObject; pSalData->mpFirstObject = this; } // ----------------------------------------------------------------------- -SalObject::~SalObject() +AquaSalObject::~AquaSalObject() { SalData* pSalData = GetSalData(); // remove frame from framelist if ( this == pSalData->mpFirstObject ) - pSalData->mpFirstObject = maObjectData.mpNextObject; + pSalData->mpFirstObject = mpNextObject; else { - SalObject* pTempObject = pSalData->mpFirstObject; - while ( pTempObject->maObjectData.mpNextObject != this ) - pTempObject = pTempObject->maObjectData.mpNextObject; - pTempObject->maObjectData.mpNextObject = maObjectData.mpNextObject; + AquaSalObject* pTempObject = (AquaSalObject*)pSalData->mpFirstObject; + while ( pTempObject->mpNextObject != this ) + pTempObject = pTempObject->mpNextObject; + pTempObject->mpNextObject = mpNextObject; } } // ----------------------------------------------------------------------- -void SalObject::ResetClipRegion() +void AquaSalObject::ResetClipRegion() { } // ----------------------------------------------------------------------- -USHORT SalObject::GetClipRegionType() +USHORT AquaSalObject::GetClipRegionType() { return SAL_OBJECT_CLIP_INCLUDERECTS; } // ----------------------------------------------------------------------- -void SalObject::BeginSetClipRegion( ULONG nRectCount ) +void AquaSalObject::BeginSetClipRegion( ULONG nRectCount ) { } // ----------------------------------------------------------------------- -void SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) +void AquaSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) { } // ----------------------------------------------------------------------- -void SalObject::EndSetClipRegion() +void AquaSalObject::EndSetClipRegion() { } // ----------------------------------------------------------------------- -void SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) +void AquaSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) { } // ----------------------------------------------------------------------- -void SalObject::Show( BOOL bVisible ) +void AquaSalObject::Show( BOOL bVisible ) { } // ----------------------------------------------------------------------- -void SalObject::Enable( BOOL bEnable ) +void AquaSalObject::Enable( BOOL bEnable ) { } // ----------------------------------------------------------------------- -void SalObject::GrabFocus() +void AquaSalObject::GrabFocus() { } // ----------------------------------------------------------------------- -void SalObject::SetBackground() +void AquaSalObject::SetBackground() { } // ----------------------------------------------------------------------- -void SalObject::SetBackground( SalColor nSalColor ) +void AquaSalObject::SetBackground( SalColor nSalColor ) { } // ----------------------------------------------------------------------- -const SystemEnvData* SalObject::GetSystemData() const +const SystemEnvData* AquaSalObject::GetSystemData() const { return NULL; } // ----------------------------------------------------------------------- -void SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) +void AquaSalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) { - maObjectData.mpInst = pInst; + mpInst = pInst; if ( pProc ) - maObjectData.mpProc = pProc; + mpProc = pProc; else - maObjectData.mpProc = ImplSalObjectCallbackDummy; + mpProc = ImplSalObjectCallbackDummy; } Index: inc/salbtype.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/salbtype.hxx,v retrieving revision 1.11 retrieving revision 1.10.112.2 diff -u -r1.11 -r1.10.112.2 --- inc/salbtype.hxx 27 Jan 2006 13:49:55 -0000 1.11 +++ inc/salbtype.hxx 20 Feb 2006 13:17:12 -0000 1.10.112.2 @@ -89,7 +89,7 @@ #define BMP_FORMAT_8BIT_PAL 0x00000010UL #define BMP_FORMAT_8BIT_TC_MASK 0x00000020UL -// #define BMP_FORMAT_16BIT_TC_MASK 0x00000040UL +#define BMP_FORMAT_16BIT_TC_MASK 0x00000040UL #define BMP_FORMAT_24BIT_TC_BGR 0x00000080UL #define BMP_FORMAT_24BIT_TC_RGB 0x00000100UL Index: util/makefile.mk =================================================================== RCS file: /cvs/gsl/vcl/util/makefile.mk,v retrieving revision 1.77 retrieving revision 1.75.14.4 diff -u -r1.77 -r1.75.14.4 --- util/makefile.mk 19 Dec 2005 17:21:56 -0000 1.77 +++ util/makefile.mk 21 Feb 2006 18:23:29 -0000 1.75.14.4 @@ -150,7 +150,7 @@ $(SLB)$/helper.lib -.IF "$(GUI)" == "UNX" +.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" LIB1FILES+=$(SLB)$/salplug.lib .ELSE LIB1FILES+= \ @@ -235,10 +235,12 @@ .ENDIF .IF "$(GUIBASE)"=="aqua" -SHL1STDLIBS += -framework Cocoa +SHL1STDLIBS += -framework Cocoa -framework Carbon .ENDIF +.IF "$(GUIBASE)"!="aqua" SHL1STDLIBS += -lX11 +.ENDIF .IF "$(OS)"=="MACOSX" SHL1STDLIBS += -framework Foundation -framework CoreFoundation @@ -263,7 +265,6 @@ # libs for generic plugin SHL2STDLIBS=\ $(VCLLIB)\ - -lpsp$(VERSION)$(DLLPOSTFIX)\ $(SOTLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ @@ -274,11 +275,17 @@ $(VOSLIB) \ $(SALLIB) +.IF "$(GUIBASE)"!="aqua" +SHL2STDLIBS+=-lpsp$(VERSION)$(DLLPOSTFIX) +.ENDIF + # prepare linking of Xinerama .IF "$(USE_XINERAMA)" != "NO" .IF "$(OS)"=="MACOSX" +.IF "$(GUIBASE)"!="aqua" XINERAMALIBS=-lXinerama +.ENDIF #aqua .ELSE .IF "$(OS)" != "SOLARIS" .IF "$(XINERAMA_LINK)" == "dynamic" @@ -300,6 +307,9 @@ .IF "$(ENABLE_PASF)" != "" .IF "$(OS)"=="MACOSX" SHL2STDLIBS += -framework CoreAudio -framework AudioToolbox +.IF "$(GUIBASE)"=="aqua" +SHL2STDLIBS += -framework Cocoa -framework Carbon +.ENDIF # aqua .ENDIF SHL2STDLIBS += -lsndfile -lportaudio .ENDIF # ENABLE_PASF @@ -328,8 +338,10 @@ # dummy plugin LIB3TARGET=$(SLB)$/idummy_plug_ +.IF "$(GUIBASE)"!="aqua" LIB3FILES= \ $(SLB)$/dapp.lib +.ENDIF SHL3TARGET=vclplug_dummy$(UPD)$(DLLPOSTFIX) SHL3IMPLIB=idummy_plug_ SHL3LIBS=$(LIB3TARGET) @@ -338,7 +350,6 @@ # libs for dummy plugin SHL3STDLIBS=\ $(VCLLIB)\ - -lpsp$(VERSION)$(DLLPOSTFIX)\ $(SOTLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ @@ -349,6 +360,10 @@ $(VOSLIB) \ $(SALLIB) +.IF "$(GUIBASE)"!="aqua" +SHL3STDLIBS += -lpsp$(VERSION)$(DLLPOSTFIX) +.ENDIF + # gtk plugin .IF "$(ENABLE_GTK)" != "" PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0 @@ -373,7 +388,7 @@ SHL4STDLIBS+=-l$(SHL2TARGET) -.IF "$(OS)"=="FREEBSD" || "$(OS)"=="MACOSX" +.IF "$(OS)"=="FREEBSD" || "$(OS)"=="MACOSX" SHL4STDLIBS+=$(SHL3STDLIBS) -lX11 .ELSE SHL4STDLIBS+=$(SHL3STDLIBS) -lX11 -ldl Index: workben/makefile.mk =================================================================== RCS file: /cvs/gsl/vcl/workben/makefile.mk,v retrieving revision 1.12 retrieving revision 1.12.112.1 diff -u -r1.12 -r1.12.112.1 --- workben/makefile.mk 9 Sep 2005 14:09:34 -0000 1.12 +++ workben/makefile.mk 27 Feb 2006 20:33:36 -0000 1.12.112.1 @@ -38,7 +38,8 @@ PRJNAME=SV TARGET=svdem LIBTARGET=NO -TARGETTYPE=GUI +#TARGETTYPE=GUI +NO_DEFAULT_STL=TRUE # --- Settings ----------------------------------------------------- @@ -63,7 +64,8 @@ $(SALLIB) \ $(VOSLIB) \ $(SOTLIB) \ - $(SVLIB) + $(SVLIB)\ + -framework Carbon APP1DEPN= $(L)$/itools.lib \ $(L)$/sot.lib Index: workben/svdem.cxx =================================================================== RCS file: /cvs/gsl/vcl/workben/svdem.cxx,v retrieving revision 1.14 retrieving revision 1.14.112.1 diff -u -r1.14 -r1.14.112.1 --- workben/svdem.cxx 9 Sep 2005 14:10:00 -0000 1.14 +++ workben/svdem.cxx 27 Feb 2006 20:31:19 -0000 1.14.112.1 @@ -45,6 +45,10 @@ #include #include +#include +#include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; // ----------------------------------------------------------------------- @@ -89,7 +93,7 @@ MyWin aMainWin( NULL, WB_APP | WB_STDWORK ); aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - Workbench" ) ) ); aMainWin.Show(); - + Application::Execute(); } @@ -111,7 +115,10 @@ void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) { - WorkWindow::MouseButtonDown( rMEvt ); + Rectangle aRect(0,0,4,4); + aRect.SetPos( rMEvt.GetPosPixel() ); + SetFillColor(Color(COL_RED)); + DrawRect( aRect ); } // ----------------------------------------------------------------------- @@ -139,7 +146,11 @@ void MyWin::Paint( const Rectangle& rRect ) { - WorkWindow::Paint( rRect ); + // note: this is not working yet + fprintf(stderr, "MyWin::Paint()\n"); + + SetFillColor(Color(COL_RED)); + DrawRect( rRect ); } // -----------------------------------------------------------------------