AquaPortCocoa/Changelog
Comments in the changes ( aquavcl03 cws )
What follows are dev notes relative to Cocoa migration in Open Office.org code ( Aqua version for Mac OS X )
Contents
aquavcltypes.h-1.2 vs. 1.2.4.1.html
#include <premac.h> #include <Carbon/Carbon.h> +#import <Cocoa/Cocoa.h> +#import <AppKit/NSEvent.h> #include <postmac.h>
-> #import replaces #include, and add only once every needed header file.
NSEvent.h does contain all event types.
e.g. :
NSLeftMouseDown = 1, NSLeftMouseUp = 2, NSRightMouseDown = 3, NSRightMouseUp = 4, NSMouseMoved = 5, NSLeftMouseDragged = 6, NSRightMouseDragged = 7, NSMouseEntered = 8, NSMouseExited = 9, NSKeyDown = 10, NSKeyUp = 11,
... etc
saldata.hxx-1.14 vs 1.14.4.1.html
- #include <Carbon/Carbon.h> + #include <Cocoa/Cocoa.h>
Remove every Carbon thing, and use Cocoa definitions instead
- class SalInstance;
+ class AquaSalInstance;
Define AquaSalInstance
- /* - * SalTimer related members - */ - BOOL mbInTimerProc; // timer event is currently being dispatched - BOOL mbTimerInstalled; // timer is in the event loop - ULONG mnTimerMS; // Current Time (in MS) of the Timer - ULONG mnTimerOrgMS; // Current Original Time (in MS) - EventLoopTimerRef mrTimerRef; - EventLoopTimerUPP mrTimerUPP;
-> remove Carbon Timers
means : remove all Carbon timers members in SalData structure
TODO :
- use Cocoa Timers instead - check in the code if old code is remaining
salframe.h- 1.18 vs. 1.18.4.1
New classes for SalFrameWindow and SalFrameView using objective-C syntax + new variables (and associated types):
@interface SalFrameWindow : NSWindow { AquaSalFrame* mpFrame; } -(id)initWithSalFrame: (AquaSalFrame*)pFrame; -(void)windowDidBecomeKey: (NSNotification*)pNotification; -(void)windowDidResignKey: (NSNotification*)pNotification; -(void)windowDidChangeScreen: (NSNotification*)pNotification; -(void)windowDidMove: (NSNotification*)pNotification; -(void)windowDidResize: (NSNotification*)pNotification; -(void)windowDidMiniaturize: (NSNotification*)pNotification; -(void)windowDidDeminiaturize: (NSNotification*)pNotification; -(MacOSBOOL)windowShouldClose: (NSNotification*)pNotification; @end @interface SalFrameView : NSView { AquaSalFrame* mpFrame; } -(id)initWithSalFrame: (AquaSalFrame*)pFrame; -(MacOSBOOL)acceptsFirstResponder; -(MacOSBOOL)acceptsFirstMouse: (NSEvent *)pEvent; -(MacOSBOOL)isOpaque; -(void)drawRect: (NSRect)aRect; -(void)mouseDown: (NSEvent*)pEvent; -(void)mouseDragged: (NSEvent*)pEvent; -(void)mouseUp: (NSEvent*)pEvent; -(void)mouseMoved: (NSEvent*)pEvent; -(void)mouseEntered: (NSEvent*)pEvent; -(void)mouseExited: (NSEvent*)pEvent; -(void)rightMouseDown: (NSEvent*)pEvent; -(void)rightMouseDragged: (NSEvent*)pEvent; -(void)rightMouseUp: (NSEvent*)pEvent; -(void)otherMouseDown: (NSEvent*)pEvent; -(void)otherMouseDragged: (NSEvent*)pEvent; -(void)otherMouseUp: (NSEvent*)pEvent; -(void)scrollWheel: (NSEvent*)pEvent; -(void)keyDown: (NSEvent*)pEvent; -(void)keyUp: (NSEvent*)pEvent; -(void)flagsChanged: (NSEvent*)pEvent; -(void)sendMouseEventToFrame:(NSEvent*)pEvent button:(USHORT)nButton eventtype:(USHORT)nEvent; @end
salframe.cxx-1.50vs.1.50.4.1.html
Remove overlay Event Handler ( TODO : reimplement a new one, if needed )
Remove static void ImplSalCalcFullScreenSize() // Note: useless ?
Implemented AquaSalFrame::AquaSalFrame()
members removed : mpInst / mnWidthn mnWeight, mpSalInstance, maTsmDocumentId, mpMenu
Removed : CreateNewSystemWindow(), InstallAndRegisterAllEventHandler(), DeinstallAndUnregisterAllEventHandler(), GetOptimalWindowSize()
Added :
void AquaSalFrame::initWindowAndView(): helps to initialize mirroring parameters, calculates style mask, and initiamize the frame + delegates to mpWindow // FIXME: desccribe better delegates
void AquaSalFrame::CocoaToVCL( NSRect& io_rRect, bool bRelativeToScreen )
void AquaSalFrame::CocoaToVCL( NSPoint& io_rPoint, bool bRelativeToScreen )
-> translates Cocoa rectangle [resp.] point coordinates into VCL one the Cocoa rectangle [resp.] point depending the fact the rectangle [resp.] the point is relative to screen or not
void AquaSalFrame::VCLToCocoa( NSRect& io_rRect, bool bRelativeToScreen )
void AquaSalFrame::VCLToCocoa( NSPoint& io_rPoint, bool bRelativeToScreen )
-> translate VCL rectangle [resp.] point into Cocoa area [resp.] point depending the fact the rectangle [resp.] the point is relative to screen or not
Modified :
void AquaSalFrame::SetTitle(const XubString& rTitle)
-> replace Carbon things using Cocoa things ( CFStringRef -> NSStrings, and CreateCFString -> CreateNSString)
Removed : CarbonViewRef, and Carbon AquaSalGraphics object type, replaced by Cocoa equivalent.
Removed : Carbon Event Queue management, e.g. PostEventToQueue() .. and Co stuff // FIXME : how does it work now ?
Removed assertion about wrWindow
Removed CreateMenu(), SetRootMenu() ..etc // FIXME : manage menus a day
Added : manage top window in a group
-> orderFront (This action method moves the receiver to the front of its level in the screen list, without changing either the key window or the main window.) -> makeKeyAndOrderFront() (This action method moves the receiver to the front of the screen list, within its level, and makes it the key window.)
Removed : HideWindow
Replaced Carbon methods with Cocoa one :
CGSize -> NSSize
Removed : SetWindowResizeLimits() , replaced by setMaxSize (ew code:[mpWindow setMaxSize: aSize]; )
Replaced Get/SetWindowBounds with setContentSize
Removed ZoomWindow, CollapseWindow ( use isZoomed / isMiniaturized instead )
Replaced Rect aRectState with NSRect aStateRect
To be fixed:
replace by Cocoa calls all SetSystemUIMode() calls ; use Cocoa pointers instead of use SetThemeCursor(aPointer[ePointerStyle]); use Cocoa functions in AquaSalFrame::SetPointerPos() new implementation of Carbon (??) NewTSMDocument() // FIXME : not sure
Modified:
AquaSalFrame::Flush() -> Sync() replaces Flush() Rect parentContentRect; -> NSRect aParentContentRect;
In AquaSalFrame::ShowFullScreen() , replaced Carbon stuff with frameRectForContentRect
Removed : AquaSalFrame::DrawMenuBar() // FIXME: implement Cocoa way
Modified AquaSalFrame::GetWorkArea() -> Rect are now NSRect
Implemented SalFrameWindow and SalFrameView using objective-C syntax + corresponding members (and associated types) -> see interface in salframe.hxx
salframe.cxx-1.50.4.1vs.1.50.4.2
in AquaSalFrame::ShowFullScreen() , if mbShown true, pass SALEVENT_MOVERESIZE at event kind, and NULL for the event to CallCallback(), whatever value bFullScreen has.
salframe.cxx-1.50vs.1.50.4.1
in AquaSalFrame::initWindowAndView(), add NSTitledWindowMask as mnStyleMask ( or'ed with existing flags)
salgdi.h-1.31vs.1.31.4.1
Removed Carbon refs: CarbonViewRef , CarbonWindowRef, IsScreenCompatible()
Modified: add Cocoa implementations of SetWindowGraphics() and UpdateWindow()
salgdiutils.cxx-1.10vs.1.10.4.1
New AquaSalGraphics::SetWindowGraphics() implementation. pFrame alone replaces mrView, mrWindow, mbScreen ( FIXME : needed in the future ? )
Modified AquaSalGraphics::CheckContext() and AquaSalGraphics::RefreshRect() implementation (): use mpFrame only )
In RefreshRect(), added a workaround for antialiased rendering. The area outside the rect is not refreshed and causes "lines" and alien around an area containing gradients e.g. Add + 2 to the REct size helps.
Partial Cocoa implementation of AquaSalGraphics::UpdateWindow() // FIXME : work completed ?
salinst.h-1.12vs.1.12.4.1
Modifications in class SalYieldMutex
New class AquaSalInstance: added structure SalUserEvent
Removed TimerEvenHandler(), replaced by handleAppDefinedEvent()
New methods: PostUserEvent, isNSAppThread(), CreateNSString()
TO BE CONTINUED