Browse code
minor changes ... saving
Ed Langley authored on 14/08/2018 01:41:45
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -187,66 +187,39 @@ |
187 | 187 |
|
188 | 188 |
(defparameter *application-shim* (make-instance 'application-shim)) |
189 | 189 |
|
190 |
-#+nil |
|
190 |
+;#+nil |
|
191 | 191 |
(defun old-code () |
192 |
- (trivial-main-thread:with-body-in-main-thread (:blocking t) |
|
193 |
- (sb-int:with-float-traps-masked |
|
194 |
- (:underflow :overflow :inexact |
|
195 |
- :invalid :divide-by-zero) |
|
196 |
- (with-selectors ((shared-application "sharedApplication") |
|
197 |
- (process-info "processInfo") |
|
198 |
- (process-name "processName") |
|
199 |
- (set-activation-policy "setActivationPolicy:") |
|
200 |
- ;; (init-with-content-rect "initWithContentRect:styleMask:backing:defer:") |
|
201 |
- (set-title "setTitle:") |
|
202 |
- (run "run") |
|
203 |
- (activate-ignoring-other-apps "activateIgnoringOtherApps:") |
|
204 |
- (make-key-and-order-front "makeKeyAndOrderFront:") |
|
205 |
- (cascade-top-left-from-point "cascadeTopLeftFromPoint:") |
|
206 |
- (add-item "addItem:") |
|
207 |
- (set-main-menu "setMainMenu:") |
|
208 |
- (init-with-title "initWithTitle:action:keyEquivalent:") |
|
209 |
- (set-submenu "setSubmenu:") |
|
210 |
- (init-with-encoding "initWithCString:length:") |
|
211 |
- (content-view "contentView") |
|
212 |
- (add-subview "addSubview:") |
|
213 |
- (set-target "setTarget:") |
|
214 |
- (set-action "setAction:") |
|
215 |
- terminate? |
|
216 |
- ;; (application-should-terminate "applicationShouldTerminate:") |
|
217 |
- ;; (set-delegate "setDelegate:") |
|
218 |
- ;; (finish-launching "finishLaunching") |
|
219 |
- alloc new autorelease |
|
220 |
- ) |
|
221 |
- [#@NSAutoReleasePool new] |
|
222 |
- [#@NSApplication shared-application] |
|
223 |
- [objc-runtime::ns-app set-activation-policy :int 0] |
|
224 |
- |
|
225 |
- |
|
226 |
- |
|
227 |
- ;; (break) |
|
228 |
- (let* ((application-name [[#@NSProcessInfo process-info] process-name])) |
|
229 |
- (let* ((menubar [[#@NSMenu new] autorelease]) |
|
230 |
- (app-menu-item [[#@NSMenuItem new] autorelease]) |
|
231 |
- (app-menu [[#@NSMenu new] autorelease]) |
|
232 |
- (quit-name [[#@NSString alloc] init-with-encoding :string "Quit" :uint 4]) |
|
233 |
- (key [[#@NSString alloc] init-with-encoding :string "q" :uint 1]) |
|
234 |
- (quit-menu-item |
|
235 |
- [[[#@NSMenuItem alloc] init-with-title :pointer quit-name :pointer terminate? :string key] autorelease])) |
|
236 |
- [menubar add-item :pointer app-menu-item] |
|
237 |
- [app-menu add-item :pointer quit-menu-item] |
|
238 |
- [app-menu-item set-submenu :pointer app-menu] |
|
239 |
- [objc-runtime::ns-app set-main-menu :pointer menubar] ) |
|
240 |
- |
|
241 |
- (setf (main-view *application-shim*) |
|
242 |
- [#@NSStackView @(stackViewWithViews:) :pointer [[#@NSArray @(alloc)] @(init)]]) |
|
243 |
- (with-point (p (20 20)) |
|
244 |
- (let* ((foreign-rect (make-rect 10 10 120 120)) |
|
245 |
- (the-window (init-window [#@NSWindow alloc] foreign-rect 1 2 nil))) |
|
246 |
- |
|
247 |
- [(value-for-key the-window "contentView") add-subview :pointer (main-view *application-shim*)] |
|
248 |
- [the-window cascade-top-left-from-point :pointer p] |
|
249 |
- [the-window set-title :pointer application-name] |
|
250 |
- [the-window make-key-and-order-front :pointer (cffi:null-pointer)] |
|
251 |
- [ objc-runtime::ns-app activate-ignoring-other-apps :boolean t] |
|
252 |
- [ objc-runtime::ns-app run]))))))) |
|
192 |
+ #+null |
|
193 |
+ (trivial-main-thread:with-body-in-main-thread (:blocking t) |
|
194 |
+ (sb-int:with-float-traps-masked |
|
195 |
+ (:underflow :overflow :inexact |
|
196 |
+ :invalid :divide-by-zero))) |
|
197 |
+ [#@NSAutoReleasePool @(new)] |
|
198 |
+ [#@NSApplication @(sharedApplication)] |
|
199 |
+ [objc-runtime::ns-app @(setActivationPolicy) :int 0] |
|
200 |
+ |
|
201 |
+ (let* ((application-name [[#@NSProcessInfo @(processInfo)] @(processName)])) |
|
202 |
+ (let* ((menubar [[#@NSMenu @(new)] @(autorelease)]) |
|
203 |
+ (app-menu-item [[#@NSMenuItem @(new)] @(autorelease)]) |
|
204 |
+ (app-menu [[#@NSMenu @(new)] @(autorelease)]) |
|
205 |
+ (quit-name [[#@NSString @(alloc)] @(initWithEncoding) :string "Quit" :uint 4]) |
|
206 |
+ (key [[#@NSString @(alloc)] @(initWithCString:length:) :string "q" :uint 1]) |
|
207 |
+ (quit-menu-item |
|
208 |
+ [[[#@NSMenuItem @(alloc)] @(initWithTitle:action:keyEquivalent:) :pointer quit-name :pointer @(terminate?) :string key] @(autorelease)])) |
|
209 |
+ [menubar @(addItem:) :pointer app-menu-item] |
|
210 |
+ [app-menu @(addItem:) :pointer quit-menu-item] |
|
211 |
+ [app-menu-item @(setSubmenu:) :pointer app-menu] |
|
212 |
+ [objc-runtime::ns-app @(setMainMenu:) :pointer menubar] ) |
|
213 |
+ |
|
214 |
+ (setf (main-view *application-shim*) |
|
215 |
+ [#@NSStackView @(stackViewWithViews:) :pointer [[#@NSArray @(alloc)] @(init)]]) |
|
216 |
+ (with-point (p (20 20)) |
|
217 |
+ (let* ((foreign-rect (make-rect 10 10 120 120)) |
|
218 |
+ (the-window (init-window [#@NSWindow @(alloc)] foreign-rect 1 2 nil))) |
|
219 |
+ |
|
220 |
+ [(value-for-key the-window "contentView") @(addSubview:) :pointer (main-view *application-shim*)] |
|
221 |
+ [the-window @(cascadeTopLeftFromPoint:) :pointer p] |
|
222 |
+ [the-window @(setTitle:) :pointer application-name] |
|
223 |
+ [the-window @(makeKeyAndOrderFront:) :pointer (cffi:null-pointer)] |
|
224 |
+ [ objc-runtime::ns-app @(activateIgnoringOtherApps:) :boolean t] |
|
225 |
+ [ objc-runtime::ns-app @(run)])))) |