racket/gui cocoa: fix internal ObjC class names

"My" -> "Racket". The "My" prefix was from initial experiments,
of course, and I just never got around to changing it before.
I think these names go into a global namespace, though, at the
ObjC level, so they need to have a distinct and Racket-specific
prefix.
This commit is contained in:
Matthew Flatt 2012-05-16 08:07:29 -06:00
parent 3d8c1e200a
commit 3a9f8eea4f
16 changed files with 55 additions and 55 deletions

View File

@ -14,7 +14,7 @@
(provide
(protect-out button%
core-button%
MyButton))
RacketButton))
;; ----------------------------------------
@ -26,7 +26,7 @@
(define NSSmallControlSize 1)
(define NSMiniControlSize 2)
(define-objc-class MyButton NSButton
(define-objc-class RacketButton NSButton
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
(-a _void (clicked: [_id sender])
@ -47,7 +47,7 @@
(define button-cocoa
(let ([cocoa
(as-objc-allocation
(tell (tell MyButton alloc)
(tell (tell RacketButton alloc)
initWithFrame: #:type _NSRect (make-NSRect (make-init-point x y)
(make-NSSize w h))))])
(when button-type

View File

@ -62,7 +62,7 @@
(make-NSSize 32000 32000))))
(tellv ctx restoreGraphicsState)))))))
(define-objc-mixin (MyViewMixin Superclass)
(define-objc-mixin (RacketViewMixin Superclass)
#:mixins (KeyMouseTextResponder CursorDisplayer FocusResponder)
[wxb]
(-a _void (drawRect: [_NSRect r])
@ -87,12 +87,12 @@
(let ([wx (->wx wxb)])
(when wx (send wx do-scroll 'vertical scroller))))))
(define-objc-class MyView NSView
#:mixins (MyViewMixin)
(define-objc-class RacketView NSView
#:mixins (RacketViewMixin)
[wxb])
(define-objc-class MyGLView NSOpenGLView
#:mixins (MyViewMixin)
(define-objc-class RacketGLView NSOpenGLView
#:mixins (RacketViewMixin)
[wxb])
(define-objc-class CornerlessFrameView NSView
@ -149,7 +149,7 @@
(- (NSSize-height (NSRect-size r)) 4)))))
(tellv ctx restoreGraphicsState)))))
(define-objc-class MyComboBox NSComboBox
(define-objc-class RacketComboBox NSComboBox
#:mixins (FocusResponder KeyMouseTextResponder CursorDisplayer)
#:protocols (NSComboBoxDelegate)
[wxb]
@ -347,12 +347,12 @@
(max 0 (- h (if hscroll? scroll-width 0) (* 2 y-margin)))))])
(as-objc-allocation
(if (or is-combo? (not (memq 'gl style)))
(tell (tell (if is-combo? MyComboBox MyView)
(tell (tell (if is-combo? RacketComboBox RacketView)
alloc)
initWithFrame: #:type _NSRect r)
(let ([pf (gl-config->pixel-format gl-config)])
(begin0
(tell (tell MyGLView alloc)
(tell (tell RacketGLView alloc)
initWithFrame: #:type _NSRect r
pixelFormat: pf)
(tellv pf release)))))))

View File

@ -17,7 +17,7 @@
(import-class NSPopUpButton)
(define-objc-class MyPopUpButton NSPopUpButton
(define-objc-class RacketPopUpButton NSPopUpButton
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
(-a _void (clicked: [_id sender])
@ -33,7 +33,7 @@
[cocoa
(let ([cocoa
(as-objc-allocation
(tell (tell MyPopUpButton alloc)
(tell (tell RacketPopUpButton alloc)
initWithFrame: #:type _NSRect (make-NSRect (make-init-point x y)
(make-NSSize w h))
pullsDown: #:type _BOOL #f))])

View File

@ -41,7 +41,7 @@
;; problems.
(define all-windows (make-hash))
(define-objc-mixin (MyWindowMethods Superclass)
(define-objc-mixin (RacketWindowMethods Superclass)
[wxb]
[-a _scheme (getEventspace)
(let ([wx (->wx wxb)])
@ -147,12 +147,12 @@
(lambda () (send wx on-toolbar-click))))))
(void)])
(define-objc-class MyWindow NSWindow
#:mixins (FocusResponder KeyMouseResponder MyWindowMethods)
(define-objc-class RacketWindow NSWindow
#:mixins (FocusResponder KeyMouseResponder RacketWindowMethods)
[wxb])
(define-objc-class MyPanel NSPanel
#:mixins (FocusResponder KeyMouseResponder MyWindowMethods)
(define-objc-class RacketPanel NSPanel
#:mixins (FocusResponder KeyMouseResponder RacketWindowMethods)
[wxb])
(set-front-hook! (lambda ()
@ -173,8 +173,8 @@
;; eventspace:
(not (ptr-equal? w (send root-fake-frame get-cocoa)))
(is-mouse-or-key?))
(or (objc-is-a? w MyWindow)
(objc-is-a? w MyPanel))
(or (objc-is-a? w RacketWindow)
(objc-is-a? w RacketPanel))
(tell #:type _scheme w getEventspace))]
[front (send front get-eventspace)]
[root-fake-frame
@ -211,8 +211,8 @@
h)))])
(let ([c (as-objc-allocation
(tell (tell (if (or is-sheet? (memq 'float style))
MyPanel
MyWindow)
RacketPanel
RacketWindow)
alloc)
initWithContentRect: #:type _NSRect init-rect
styleMask: #:type _int (if (memq 'no-caption style)

View File

@ -17,7 +17,7 @@
(import-class NSProgressIndicator)
(define-objc-class MyProgressIndicator NSProgressIndicator
(define-objc-class RacketProgressIndicator NSProgressIndicator
#:mixins (KeyMouseResponder CursorDisplayer)
[wxb])
@ -34,7 +34,7 @@
[cocoa (let ([cocoa (as-objc-allocation
;; Beware that a gauge may be finally deallocated in
;; a separate OS-level thread
(tell (tell MyProgressIndicator alloc) init))])
(tell (tell RacketProgressIndicator alloc) init))])
(tellv cocoa setIndeterminate: #:type _BOOL #f)
(tellv cocoa setMaxValue: #:type _double* rng)
(tellv cocoa setDoubleValue: #:type _double* 0.0)

View File

@ -13,7 +13,7 @@
(import-class NSBox)
(define-objc-class MyBox NSBox
(define-objc-class RacketBox NSBox
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb])
@ -27,7 +27,7 @@
(super-new [parent parent]
[cocoa
(let ([cocoa (as-objc-allocation
(tell (tell MyBox alloc) init))])
(tell (tell RacketBox alloc) init))])
(when label
(tellv cocoa setTitle: #:type _NSString label)
(tellv cocoa sizeToFit))

View File

@ -21,7 +21,7 @@
(import-class NSScrollView NSTableView NSTableColumn NSCell NSIndexSet)
(import-protocol NSTableViewDataSource)
(define-objc-class MyTableView NSTableView
(define-objc-class RacketTableView NSTableView
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
[-a _id (preparedCellAtColumn: [_NSInteger column] row: [_NSInteger row])
@ -44,7 +44,7 @@
(let ([wx (->wx wxb)])
(when wx (send wx reset-column-order)))])
(define-objc-class MyDataSource NSObject
(define-objc-class RacketDataSource NSObject
#:protocols (NSTableViewDataSource)
[wxb]
[-a _NSInteger (numberOfRowsInTableView: [_id view])
@ -73,7 +73,7 @@
register-as-child)
(define source (as-objc-allocation
(tell (tell MyDataSource alloc) init)))
(tell (tell RacketDataSource alloc) init)))
(set-ivar! source wxb (->wxb this))
(define itemss (cons choices
@ -89,7 +89,7 @@
(define-values (content-cocoa column-cocoas)
(let ([content-cocoa
(as-objc-allocation
(tell (tell MyTableView alloc) init))])
(tell (tell RacketTableView alloc) init))])
(tellv content-cocoa setDelegate: content-cocoa)
(tellv content-cocoa setDataSource: source)
(define cols

View File

@ -37,7 +37,7 @@
(define the-apple-menu #f)
(define recurring-for-command (make-parameter #f))
(define-objc-class MyBarMenu NSMenu
(define-objc-class RacketBarMenu NSMenu
[]
;; Disable automatic handling of keyboard shortcuts, except for
;; the Apple menu
@ -66,7 +66,7 @@
(tell r keyUp: evt)])))
#t)))))))))
(define cocoa-mb (tell (tell MyBarMenu alloc) init))
(define cocoa-mb (tell (tell RacketBarMenu alloc) init))
(define current-mb #f)
;; Used to detect mouse click on the menu bar:

View File

@ -13,7 +13,7 @@
(import-class NSMenuItem)
(define-objc-class MyMenuItem NSMenuItem
(define-objc-class RacketMenuItem NSMenuItem
[wxb]
(-a _void (selected: [_id sender])
(let ([wx (->wx wxb)])
@ -60,7 +60,7 @@
(if submenu
(send submenu install menu label enabled?)
(let ([item (as-objc-allocation
(tell (tell MyMenuItem alloc)
(tell (tell RacketMenuItem alloc)
initWithTitle: #:type _NSString (clean-menu-label (regexp-replace #rx"\t.*" label ""))
action: #:type _SEL #f
keyEquivalent: #:type _NSString ""))])

View File

@ -62,11 +62,11 @@
;; ----------------------------------------
(define-objc-class MyTextField NSTextField
(define-objc-class RacketTextField NSTextField
#:mixins (KeyMouseResponder CursorDisplayer)
[wxb])
(define-objc-class MyImageView NSImageView
(define-objc-class RacketImageView NSImageView
#:mixins (KeyMouseResponder CursorDisplayer)
[wxb])
@ -84,9 +84,9 @@
[cocoa
(if (string? label)
(as-objc-allocation
(tell (tell MyTextField alloc) init))
(tell (tell RacketTextField alloc) init))
(as-objc-allocation
(tell (tell MyImageView alloc) init)))])
(tell (tell RacketImageView alloc) init)))])
(cond
[(string? label)
(init-font cocoa font)

View File

@ -16,7 +16,7 @@
(import-class NSView NSGraphicsContext)
(define-objc-class MyPanelView NSView
(define-objc-class RacketPanelView NSView
#:mixins (KeyMouseTextResponder CursorDisplayer)
[wxb])
@ -118,7 +118,7 @@
(super-new [parent parent]
[cocoa
(as-objc-allocation
(tell (tell (if has-border? FrameView MyPanelView) alloc)
(tell (tell (if has-border? FrameView RacketPanelView) alloc)
initWithFrame: #:type _NSRect (make-NSRect (make-init-point x y)
(make-NSSize (max (if has-border? 3 1) w)
(max (if has-border? 3 1) h)))))]
@ -129,7 +129,7 @@
(let* ([c (get-cocoa)]
[f (tell #:type _NSRect c frame)])
(as-objc-allocation
(tell (tell MyPanelView alloc)
(tell (tell RacketPanelView alloc)
initWithFrame: #:type _NSRect (make-NSRect (make-init-point 1 1)
(let ([s (NSRect-size f)])
(make-NSSize (max 1 (- (NSSize-width s) 2))

View File

@ -49,7 +49,7 @@
(define got-file? #f)
(define-objc-class MyApplicationDelegate NSObject #:protocols (NSApplicationDelegate)
(define-objc-class RacketApplicationDelegate NSObject #:protocols (NSApplicationDelegate)
[]
[-a _NSUInteger (applicationShouldTerminate: [_id app])
(queue-quit-event)
@ -113,7 +113,7 @@
(unless (zero? v)
(log-error (format "error from TransformProcessType: ~a" v)))))
(define app-delegate (tell (tell MyApplicationDelegate alloc) init))
(define app-delegate (tell (tell RacketApplicationDelegate alloc) init))
(tellv app setDelegate: app-delegate)
(unless (scheme_register_process_global "Racket-GUI-no-front" #f)
(tellv app activateIgnoringOtherApps: #:type _BOOL #t))

View File

@ -22,7 +22,7 @@
(define NSRadioModeMatrix 0)
(define NSListModeMatrix 2)
(define-objc-class MyMatrix NSMatrix
(define-objc-class RacketMatrix NSMatrix
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
(-a _void (clicked: [_id sender])
@ -31,7 +31,7 @@
(tellv self setAllowsEmptySelection: #:type _BOOL #f)
(queue-window*-event wxb (lambda (wx) (send wx clicked)))))
(define-objc-class MyImageButtonCell NSButtonCell
(define-objc-class RacketImageButtonCell NSButtonCell
[img]
[-a _NSSize (cellSize)
(let ([s (super-tell #:type _NSSize cellSize)])
@ -74,13 +74,13 @@
[cocoa
(let ([cocoa
(as-objc-allocation
(tell (tell MyMatrix alloc)
(tell (tell RacketMatrix alloc)
initWithFrame: #:type _NSRect (make-NSRect (make-init-point x y)
(make-NSSize w h))
mode: #:type _int NSRadioModeMatrix
cellClass: (if (andmap string? labels)
NSButtonCell
MyImageButtonCell)
RacketImageButtonCell)
numberOfRows: #:type _NSInteger (if horiz? 1 (length labels))
numberOfColumns: #:type _NSInteger (if horiz? (length labels) 1)))])
(for ([label (in-list labels)]

View File

@ -21,7 +21,7 @@
(import-class NSSlider NSTextField NSView)
(define-objc-class MySlider NSSlider
(define-objc-class RacketSlider NSSlider
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
(-a _void (changed: [_id sender])
@ -51,7 +51,7 @@
(define slider-cocoa
(let ([cocoa (as-objc-allocation
(tell (tell MySlider alloc) init))])
(tell (tell RacketSlider alloc) init))])
(tellv cocoa setMinValue: #:type _double* lo)
(tellv cocoa setMaxValue: #:type _double* hi)
(tellv cocoa setDoubleValue: #:type _double* (flip val))

View File

@ -9,7 +9,7 @@
(import-class NSSound)
(define-objc-class MySound NSSound
(define-objc-class RacketSound NSSound
[result
sema]
[-a _void (sound: [_id sound] didFinishPlaying: [_BOOL ok?])
@ -19,7 +19,7 @@
(define (play-sound path async?)
(let ([s (as-objc-allocation
(tell (tell MySound alloc)
(tell (tell RacketSound alloc)
initWithContentsOfFile: #:type _NSString (path->string
(path->complete-path path))
byReference: #:type _BOOL #t))]

View File

@ -41,7 +41,7 @@
(define order_content_first (function-ptr order-content-first
(_fun #:atomic? #t _id _id _id -> _int)))
(define-objc-class MyTabView NSTabView
(define-objc-class RacketTabView NSTabView
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
(-a _void (tabView: [_id cocoa] didSelectTabViewItem: [_id item-cocoa])
@ -49,7 +49,7 @@
(when (and wx (send wx callbacks-enabled?))
(queue-window*-event wxb (lambda (wx) (send wx do-callback)))))))
(define-objc-class MyPSMTabBarControl PSMTabBarControl
(define-objc-class RacketPSMTabBarControl PSMTabBarControl
#:mixins (FocusResponder KeyMouseResponder CursorDisplayer)
[wxb]
(-a _void (tabView: [_id cocoa] didSelectTabViewItem: [_id item-cocoa])
@ -66,7 +66,7 @@
block-mouse-events)
(define tabv-cocoa (as-objc-allocation
(tell (tell MyTabView alloc) init)))
(tell (tell RacketTabView alloc) init)))
(define cocoa (if (not (memq 'border style))
(as-objc-allocation
(tell (tell NSView alloc) init))
@ -75,7 +75,7 @@
(define control-cocoa
(and (not (memq 'border style))
(let ([i (as-objc-allocation
(tell (tell MyPSMTabBarControl alloc)
(tell (tell RacketPSMTabBarControl alloc)
initWithFrame: #:type _NSRect (make-NSRect (make-NSPoint 0 0)
(make-NSSize 200 22))))])
(tellv cocoa addSubview: i)