public
Description: A popular sample Cocoa application rewritten in Nu. Original code by Aaron Hillegass, ported to Nu by Tim Burks.
Homepage: http://programming.nu/posts/2007/12/12/nupagepacker
Clone URL: git://github.com/timburks/nupagepacker.git
Polish. Added comments and build step that "internalizes" Nu.
timburks (author)
Sun Dec 09 14:45:53 -0800 2007
commit  fdc7dd6d52ae8fc528f63cf92818276f6d2ff444
tree    13e3c22cb637c6d1f7481e01718bfeba0a417c1f
parent  92769bf116eb6978c6273005057264d2e7873cca
...
1
 
2
3
4
...
10
11
12
 
 
 
 
 
 
 
13
14
15
...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
47
48
49
50
51
 
 
 
 
 
...
 
1
2
3
4
...
10
11
12
13
14
15
16
17
18
19
20
21
22
...
40
41
42
 
 
 
 
 
 
 
 
 
 
 
43
44
45
 
46
47
48
49
50
51
52
0
@@ -1,4 +1,4 @@
0
-;; Nukefile for PagePacker
0
+;; Nukefile for NuPagePacker
0
 
0
 ;; source files
0
 (set @c_files (filelist "^objc/.*.c$"))
0
@@ -10,6 +10,13 @@
0
 (@resources << "resources/diyp3h_core_1up.pdf")
0
 (@resources << "resources/PagePacker.sdef")
0
 
0
+;; application description
0
+(set @application "NuPagePacker")
0
+(set @application_identifier "nu.programming.NuPagePacker")
0
+(set @application_icon_file "NuPPApp.icns")
0
+(set @application_help_folder "PagePackerHelp")
0
+
0
+;; specify the entire Info.plist here:
0
 (set @info
0
      (dict "CFBundleDevelopmentRegion" "English"
0
            "CFBundleDocumentTypes"
0
@@ -33,19 +40,13 @@
0
            "NSPrincipalClass" "NSApplication"
0
            "OSAScriptingDefinition" "PagePacker.sdef"))
0
 
0
-;; application description
0
-(set @application "NuPagePacker")
0
-(set @application_identifier "nu.programming.nupagepacker")
0
-(set @application_icon_file "NuPPApp.icns")
0
-(set @application_help_folder "PagePackerHelp")
0
-
0
-;; build configuration
0
-(set @cc "gcc")
0
-(set @cflags "-g -O3 -DMACOSX ")
0
-(set @mflags "-fobjc-exceptions")
0
-
0
+;; build tasks
0
 (compilation-tasks)
0
 (application-tasks)
0
-
0
 (task "default" => "application")
0
 
0
+;; this copies the Nu.framework into the application so that it can be run on systems without Nu.
0
+(task "finalize" => "application" is
0
+ (SH "mkdir -p '#{@application_dir}/Contents/Frameworks'")
0
+ (SH "ditto /Library/Frameworks/Nu.framework '#{@application_dir}/Contents/Frameworks/Nu.framework'")
0
+ (SH "install_name_tool -change 'Nu.framework/Versions/A/Nu' '@executable_path/../Frameworks/Nu.framework/Versions/A/Nu' '#{@application_dir}/Contents/MacOS/#{@application}'"))
...
3
4
5
6
7
8
9
10
11
 
 
 
 
 
 
 
 
12
13
14
15
 
16
17
 
18
19
20
21
22
23
24
 
25
26
27
28
 
29
30
31
...
3
4
5
 
 
 
 
 
 
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
28
29
30
31
 
32
33
34
35
0
@@ -3,29 +3,33 @@
0
 ;;
0
 ;; @copyright Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc.
0
 
0
-(load "nu") ;; essentials
0
-(load "cocoa") ;; wrapped frameworks
0
-(load "console") ;; interactive console
0
-(load "packer") ;; application code
0
-
0
-;; unfortunately, these initialize methods aren't called automatically, so we call them here.
0
+(load "Nu:nu") ;; essentials
0
+(load "Nu:cocoa") ;; wrapped frameworks
0
+(load "Nu:console") ;; interactive console
0
+(load "bridged") ;; more bridged declarations
0
+(load "helpers") ;; some helper functions
0
+(load "packer") ;; the main application code
0
+
0
+;; Initialize methods for Nu classes aren't (yet) called automatically, so we call them here.
0
 (PackerView initialize)
0
 (PreferenceController initialize)
0
 (DraggingSourcePDFView initialize)
0
 
0
+;; The console is too much fun to omit.
0
 (set SHOW_CONSOLE_AT_STARTUP nil)
0
 
0
+;; The main application controller.
0
 (class AppController is NSObject
0
      (imethod (void) applicationDidFinishLaunching: (id) sender is
0
           (set $console ((NuConsoleWindowController alloc) init))
0
           (if SHOW_CONSOLE_AT_STARTUP ($console toggleConsole:self))
0
           ((CatalogController sharedCatalogController) showWindow:nil)))
0
 
0
-(load "scripting") ;; scripting support, must be loaded after AppControler is defined
0
+(load "scripting") ;; scripting support must be loaded after AppControler is defined
0
 
0
 (set NSApp (NSApplication sharedApplication))
0
 
0
-;; this makes the application window take focus when we've started it from the terminal
0
+;; this makes the application window take focus when we've started it from the terminal (like when we type "nuke run")
0
 (NSApp activateIgnoringOtherApps:YES)
0
 
0
 ;; run the main Cocoa event loop
...
2
3
4
 
 
5
6
7
8
9
10
11
12
13
14
15
16
17
 
18
 
 
 
19
20
21
22
23
24
25
 
 
 
26
27
28
...
31
32
33
34
35
36
37
38
...
85
86
87
 
 
88
89
90
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 
 
126
127
128
...
132
133
134
135
 
136
137
138
...
173
174
175
176
177
178
179
180
181
 
 
182
183
184
...
303
304
305
 
 
306
307
308
...
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
 
 
369
370
371
...
375
376
377
378
 
 
 
 
 
 
379
380
381
...
665
666
667
668
669
670
671
 
 
 
672
673
674
...
731
732
733
734
735
 
736
737
738
739
740
741
 
742
743
744
 
 
745
746
747
...
758
759
760
 
 
 
 
 
 
761
762
763
764
765
766
767
 
 
768
769
770
...
780
781
782
783
784
785
786
787
788
789
790
791
 
 
 
792
793
794
795
796
 
 
797
798
799
...
801
802
803
804
805
806
807
 
 
808
809
 
810
811
812
813
814
815
816
817
 
 
 
818
819
820
821
 
822
823
824
825
826
 
827
828
829
830
831
832
833
834
 
 
 
835
836
837
838
839
 
840
841
842
843
 
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
 
 
872
...
2
3
4
5
6
7
 
 
 
 
 
 
 
 
 
 
 
 
8
9
10
11
12
13
14
15
16
17
18
 
19
20
21
22
23
24
...
27
28
29
 
 
30
31
32
...
79
80
81
82
83
84
85
86
...
108
109
110
 
 
 
 
 
 
 
 
 
 
 
111
112
113
114
115
...
119
120
121
 
122
123
124
125
...
160
161
162
 
 
 
 
 
 
163
164
165
166
167
...
286
287
288
289
290
291
292
293
...
319
320
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
...
353
354
355
 
356
357
358
359
360
361
362
363
364
...
648
649
650
 
 
 
 
651
652
653
654
655
656
...
713
714
715
 
 
716
717
 
 
 
 
 
718
719
720
 
721
722
723
724
725
...
736
737
738
739
740
741
742
743
744
745
746
747
748
 
 
749
750
751
752
753
754
...
764
765
766
 
 
 
 
 
 
 
 
 
767
768
769
770
 
 
 
 
771
772
773
774
775
...
777
778
779
 
 
 
 
780
781
782
 
783
784
785
 
 
 
 
 
 
786
787
788
789
790
 
 
791
792
793
794
 
 
795
796
797
798
799
800
 
 
 
801
802
803
804
805
806
 
 
807
808
809
 
 
810
811
812
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
814
815
0
@@ -2,27 +2,23 @@
0
 ;; @discussion PagePacker in Nu.
0
 ;;
0
 ;; @copyright Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc.
0
+;; Substantially derived from original Objective-C source code by Aaron Hillegass.
0
+;; See objc/PagePacker.m for the copyright notice for the original code.
0
 
0
-;; these declarations would be unnecessary if Nu is enhanced to read the Apple BridgeSupport files.
0
-(global kPDFDisplaySinglePage 0)
0
-(global NSDragOperationCopy 1)
0
-(global NSPDFPboardType "Apple PDF pasteboard type")
0
-(global NSDragPboard "Apple CFPasteboard drag")
0
-(global NSRectClip (NuBridgedFunction functionWithName:"NSRectClip" signature:"v{_NSRect}"))
0
-(global NSIntersectionRect (NuBridgedFunction functionWithName:"NSIntersectionRect" signature:"{_NSRect}{_NSRect}{_NSRect}"))
0
-(global NSPointInRect (NuBridgedFunction functionWithName:"NSPointInRect" signature:"i{_NSPoint}{_NSRect}"))
0
-(global NSFilenamesPboardType "NSFilenamesPboardType")
0
-(global NSIntersectsRect (NuBridgedFunction functionWithName:"NSIntersectsRect" signature:"i{_NSRect}{_NSRect}"))
0
-(global NSInsetRect (NuBridgedFunction functionWithName:"NSInsetRect" signature:"{_NSRect}{_NSRect}ff"))
0
-(global NSSquareLineCapStyle 2)
0
+(global BLOCK_COUNT 8) ;; We display 8 pages in a PagePacker document. There is no easy way to change this.
0
 
0
+;; @class CatalogController
0
+;; @discussion This class controls the display of the PDF source document.
0
+;; Pages can be dragged from this document into the PagePacker document view.
0
 (class CatalogController is NSWindowController
0
      (ivar (id) pdfView
0
            (id) pageSlider
0
            (id) pageField
0
            (int) currentPageIndex)
0
      
0
- (set sharedCatalogController nil) ;; Nu closures make this a class variable
0
+ (set sharedCatalogController nil) ;; Since the assignment is made inside the class declaration, Nu closures make this a class variable.
0
+
0
+ (+ sharedCatalogController is sharedCatalogController)
0
      
0
      (- init is
0
         (super initWithWindowNibName:"CatalogController")
0
@@ -31,8 +27,6 @@
0
         (set @currentPageIndex 0)
0
         self)
0
      
0
- (+ sharedCatalogController is sharedCatalogController)
0
-
0
      (- windowDidLoad is
0
         (set path ((NSBundle mainBundle) pathForResource:"diyp3h_core_1up" ofType:@"pdf"))
0
         (set url (NSURL fileURLWithPath:path))
0
@@ -85,6 +79,8 @@
0
         (self changeToPage:(- @currentPageIndex 1))
0
         (@pageSlider setIntValue:@currentPageIndex)))
0
 
0
+;; @class MyDocument
0
+;; @discussion This is the main PagePacker document.
0
 (class MyDocument
0
      
0
      (- (id)init is
0
@@ -112,17 +108,8 @@
0
         (if @packerView (self updateUI))
0
         YES))
0
 
0
-(function PointInRect (point rect)
0
- (and (>= (point first) (rect first))
0
- (>= (point second) (rect second))
0
- (<= (point first) (+ (rect first) (rect third)))
0
- (<= (point second) (+ (rect second) (rect fourth)))))
0
-
0
-(function distanceSquaredBetweenPoints (p1 p2)
0
- (set deltax (- (p1 first) (p2 first)))
0
- (set deltay (- (p1 second) (p2 second)))
0
- (+ (* deltax deltax) (* deltay deltay)))
0
-
0
+;; @class DragingSourcePDFView
0
+;; @discussion This class controls the view of the source document.
0
 (class DraggingSourcePDFView is PDFView
0
      (ivar (id) mouseDownEvent)
0
      
0
@@ -132,7 +119,7 @@
0
      (- (id) hitTest:(NSPoint) aPoint is
0
         (if (PointInRect aPoint (self frame))
0
             (then self)
0
- (else nil))) ;; in the most hard-won conclusion of this project, this should be NULL and not nil.
0
+ (else nil)))
0
      
0
      (- (BOOL) shouldDelayWindowOrderingForEvent:(id) theEvent is YES)
0
      
0
@@ -173,12 +160,8 @@
0
      (- (void) mouseUp:(id) e is
0
         (set @mouseDownEvent nil)))
0
 
0
-(function pdfFromAttributedStringOfSize (attStr sz)
0
- (set v ((TextDisplayView alloc) initWithPageSize:sz attributedString:attStr))
0
- (v dataWithPDFInsideRect:(v bounds)))
0
-
0
-(set BLOCK_COUNT 8)
0
-
0
+;; @class PackModel
0
+;; @discussion This class describes the PagePacker document.
0
 (class PackModel is NSObject
0
      (ivar (id) pageInfos (id) undoManager)
0
      
0
@@ -303,6 +286,8 @@
0
                    forPage:(+ i j)))
0
         (+ i j)))
0
 
0
+;; @class PageInfo
0
+;; @discussion This class describes an individual page in a PagePacker document.
0
 (class PageInfo is NSObject
0
      (ivar (id) imageRep (int) pageOfRep)
0
      
0
@@ -334,38 +319,31 @@
0
      (- (id)description is
0
         "<PageInfo: #{(@imageRep description)}, #{@pageOfRep}>"))
0
 
0
-(function insetRect (rect x y)
0
- (list (+ (rect first) x) (+ (rect second) y) (- (rect third) x x) (- (rect fourth) y y)))
0
-
0
-(function isLeftSide (pageNum) (or (eq pageNum 0) (> pageNum 4)))
0
-
0
-(function NSMinX (rect)
0
- (set x1 (rect first))
0
- (set x2 (+ (rect first) (rect third)))
0
- (if (< x1 x2) (then x1) (else x2)))
0
-
0
-(function NSMaxX (rect)
0
- (set x1 (rect first))
0
- (set x2 (+ (rect first) (rect third)))
0
- (if (> x1 x2) (then x1) (else x2)))
0
-
0
-(function NSMinY (rect)
0
- (set y1 (rect second))
0
- (set y2 (+ (rect second) (rect fourth)))
0
- (if (< y1 y2) (then y1) (else y2)))
0
-
0
-(function NSMaxY (rect)
0
- (set y1 (rect second))
0
- (set y2 (+ (rect second) (rect fourth)))
0
- (if (> y1 y2) (then y1) (else y2)))
0
-
0
-(function HalfX (r) (+ (r first) (* 0.5 (r third))))
0
-(function QuarterY (r) (+ (r second) (* 0.25 (r fourth))))
0
-(function HalfY (r) (+ (r second) (* 0.5 (r fourth))))
0
-(function ThreeQuarterY (r) (+ (r second) (* 0.75 (r fourth))))
0
-
0
-(global BUTTON_MARGIN 4.0)
0
+;; @class RoundCloseButtonCell
0
+;; @discussion This class provides a custom button cell for use in the PackerView display.
0
+(class RoundCloseButtonCell is NSButtonCell
0
+ (- (void)drawWithFrame:(NSRect)cellFrame inView:(id)controlView is
0
+ (if (NSGraphicsContext currentContextDrawingToScreen)
0
+ (if (self isHighlighted)
0
+ (then ((NSColor orangeColor) set))
0
+ (else ((NSColor blueColor) set)))
0
+ (NSBezierPath fillRect:cellFrame)
0
+ (NSBezierPath setDefaultLineWidth:3)
0
+ ((NSColor whiteColor) set)
0
+ (NSBezierPath strokeRect:cellFrame)
0
+ (set p ((NSBezierPath alloc) init))
0
+ (p setLineWidth:3.0)
0
+ (p setLineCapStyle:NSSquareLineCapStyle)
0
+ (set xRect (NSInsetRect cellFrame 9 7))
0
+ (p moveToPoint:(list (xRect first) (xRect second)))
0
+ (p lineToPoint:(list (+ (xRect first) (xRect third)) (+ (xRect second) (xRect fourth))))
0
+ (p moveToPoint:(list (xRect first) (+ (xRect second) (xRect fourth))))
0
+ (p lineToPoint:(list (+ (xRect first) (xRect third)) (xRect second)))
0
+ ((NSColor whiteColor) set)
0
+ (p stroke))))
0
 
0
+;; @class PackerView
0
+;; @discussion This class provides a view of a PagePacker document.
0
 (class PackerView
0
      (ivar (id) packModel
0
            (id) foldLines
0
@@ -375,7 +353,12 @@
0
            (int) dropPage
0
            (int) dragStart)
0
      
0
- (set numberAttributes nil) ;; pseudo-class variable
0
+ (set numberAttributes nil) ;; a class variable to hold the attribute dictionary for displayed numbers.
0
+ (set buttonMargin 4.0) ;; a class variable that specifies the position of our custom close buttons.
0
+
0
+ ;; determine whether a page is on the left or right side of the PageView display.
0
+ ;; Because this function is defined in the class declaration, it is effectively local (private) to this class.
0
+ (function isLeftSide (pageNum) (or (eq pageNum 0) (> pageNum 4)))
0
      
0
      (+ (void) initialize is
0
         (set numberAttributes ((NSMutableDictionary alloc) init))
0
@@ -665,10 +648,9 @@
0
              (do (i)
0
                  (if (@packModel pageIsFilled:i)
0
                      (set fullRect (self fullRectForPage:i))
0
- (set buttonRect (list
0
- (- (NSMaxX fullRect) (+ 30 BUTTON_MARGIN))
0
- (+ (NSMinY fullRect) BUTTON_MARGIN)
0
- 30 25))
0
+ (set buttonRect (list (- (NSMaxX fullRect) (+ 30 buttonMargin))
0
+ (+ (NSMinY fullRect) buttonMargin)
0
+ 30 25))
0
                      (set button ((NSButton alloc) initWithFrame:buttonRect))
0
                      (button setCell:((RoundCloseButtonCell alloc) init))
0
                      (button setTag:i)
0
@@ -731,17 +713,13 @@
0
             (if @showsImageableRect
0
                 ((NSColor blueColor) set)
0
                 (NSBezierPath setDefaultLineWidth:1.0)
0
- (NSBezierPath strokeRect:@imageablePageRect))
0
-
0
+ (NSBezierPath strokeRect:@imageablePageRect))
0
             (if (>= @dropPage 0)
0
- (set dropColor (NSColor colorWithDeviceRed:0.8
0
- green:0.5
0
- blue:0.5
0
- alpha:0.3))
0
- (dropColor set)
0
+ ((NSColor colorWithDeviceRed:0.8 green:0.5 blue:0.5 alpha:0.3) set)
0
                 (NSBezierPath fillRect:(self fullRectForPage:@dropPage))))))
0
 
0
-
0
+;; @class TextDisplayView
0
+;; @discussion This helper class is used to generate PDF representations of strings.
0
 (class TextDisplayView is NSView
0
      (ivar (id) attString (NSSize) pageSize)
0
      
0
@@ -758,13 +736,19 @@
0
         (set bounds (NSInsetRect (self bounds) 3 3))
0
         (@attString drawInRect:bounds)))
0
 
0
+;; use the above class to generate a PDF for an attribute string.
0
+(function pdfFromAttributedStringOfSize (attStr sz)
0
+ (set v ((TextDisplayView alloc) initWithPageSize:sz attributedString:attStr))
0
+ (v dataWithPDFInsideRect:(v bounds)))
0
+
0
+;; some internal constants
0
 (global PaperSizeChangedNotification "PaperSizeChangedNotification")
0
 (global PaperSizeKey "PaperSize")
0
 (global FontFamilyKey "FontFamily")
0
 (global FontSizeKey "FontSize")
0
-(global LETTER_PAPER_ID 0)
0
-(global A4_PAPER_ID 1)
0
 
0
+;; @class PreferenceController
0
+;; @discussion This class controls the application's preference window.
0
 (class PreferenceController is NSWindowController
0
      (ivar (id) paperPopUp (id) textFontField (id) textFont)
0
      
0
@@ -780,20 +764,12 @@
0
         self)
0
      
0
      (+ (void)initialize is
0
- (set factoryDefaults ((NSMutableDictionary alloc) init))
0
- (factoryDefaults setObject:(NSNumber numberWithInt:0)
0
- forKey:PaperSizeKey)
0
- (factoryDefaults setObject:@"Helvetica"
0
- forKey:FontFamilyKey)
0
- (factoryDefaults setObject:(NSNumber numberWithFloat:8.0)
0
- forKey:FontSizeKey)
0
-
0
- ((NSUserDefaults standardUserDefaults) registerDefaults:factoryDefaults))
0
+ ((NSUserDefaults standardUserDefaults) registerDefaults:(dict PaperSizeKey 0
0
+ FontFamilyKey "Helvetica"
0
+ FontSizeKey 8.0)))
0
      
0
- (+ (id)sharedPreferenceController is
0
-
0
- (unless sharedPreferenceController
0
- ((PreferenceController alloc) init))
0
+ (+ (id)sharedPreferenceController is
0
+ (unless sharedPreferenceController ((PreferenceController alloc) init))
0
         sharedPreferenceController)
0
      
0
      (- (int)paperSizeID is
0
@@ -801,71 +777,38 @@
0
      
0
      (- (void)setPaperSizeID:(int)i is
0
         ((NSUserDefaults standardUserDefaults) setInteger:i forKey:PaperSizeKey)
0
- (set userInfo (NSMutableDictionary dictionary))
0
- (userInfo setObject:(NSValue valueWithSize:(self paperSize))
0
- forKey:"PaperSize")
0
- ((NSNotificationCenter defaultCenter) postNotificationName:PaperSizeChangedNotification
0
+ ((NSNotificationCenter defaultCenter)
0
+ postNotificationName:PaperSizeChangedNotification
0
          object:self
0
- userInfo:userInfo))
0
+ userInfo:(dict PaperSizeKey (NSValue valueWithSize:(self paperSize)))))
0
      
0
      (- (NSSize)paperSize is
0
- (set i (self paperSizeID))
0
- (if (eq i 0)
0
- (then ;; letter
0
- '(612 792))
0
- (else ;; assume it's A4
0
- '(595 842))))
0
+ (case (self paperSizeID)
0
+ (0 '(612 792)) ;; LETTER
0
+ (else '(595 842)))) ;; assume it's A4
0
      
0
      (- (void)windowDidLoad is
0
- (set i (self paperSizeID))
0
- (@paperPopUp selectItemWithTag:i)
0
+ (@paperPopUp selectItemWithTag:(self paperSizeID))
0
         (@textFontField setStringValue:(self fontDescription)))
0
      
0
      (- (void)paperChosen:(id)sender is
0
- (set i (@paperPopUp selectedTag))
0
- (self setPaperSizeID:i))
0
+ (self setPaperSizeID:(@paperPopUp selectedTag)))
0
      
0
      (- (id) textFont is @textFont)
0
      
0
      (- (void) setTextFont:(id) f is
0
         (set @textFont f)
0
- (set ud (NSUserDefaults standardUserDefaults))
0
- (ud setObject:(f familyName) forKey:FontFamilyKey)
0
- (ud setFloat:(f pointSize) forKey:FontSizeKey)
0
+ (set userDefaults (NSUserDefaults standardUserDefaults))
0
+ (userDefaults setObject:(f familyName) forKey:FontFamilyKey)
0
+ (userDefaults setFloat:(f pointSize) forKey:FontSizeKey)
0
         (@textFontField setStringValue:(self fontDescription)))  
0
      
0
      (- (id) fontDescription is
0
- (set f (self textFont))
0
- "#{(f displayName)} - #{(f pointSize)}")
0
+ "#{((self textFont) displayName)} - #{((self textFont) pointSize)}")
0
      
0
      (- (void)changeFont:(id)sender is
0
- (set newFont (sender convertFont:@textFont))
0
- (self setTextFont:newFont))
0
+ (self setTextFont:(sender convertFont:@textFont)))
0
      
0
      (- (void)chooseFont:(id)sender is
0
- (set fm (NSFontManager sharedFontManager))
0
- (fm setSelectedFont:@textFont isMultiple:NO)
0
- (set fp (NSFontPanel sharedFontPanel))
0
- (fp makeKeyAndOrderFront:nil)))
0
-
0
-(class RoundCloseButtonCell is NSButtonCell
0
- (- (void)drawWithFrame:(NSRect)cellFrame inView:(id)controlView is
0
- (if (NSGraphicsContext currentContextDrawingToScreen)
0
- (if (self isHighlighted)
0
- (then ((NSColor orangeColor) set))
0
- (else ((NSColor blueColor) set)))
0
- (NSBezierPath fillRect:cellFrame)
0
- (NSBezierPath setDefaultLineWidth:3)
0
- ((NSColor whiteColor) set)
0
- (NSBezierPath strokeRect:cellFrame)
0
- (set p ((NSBezierPath alloc) init))
0
- (p setLineWidth:3.0)
0
- (p setLineCapStyle:NSSquareLineCapStyle)
0
- (set xRect (NSInsetRect cellFrame 9 7))
0
- (p moveToPoint:(list (xRect first) (xRect second)))
0
- (p lineToPoint:(list (+ (xRect first) (xRect third)) (+ (xRect second) (xRect fourth))))
0
- (p moveToPoint:(list (xRect first) (+ (xRect second) (xRect fourth))))
0
- (p lineToPoint:(list (+ (xRect first) (xRect third)) (xRect second)))
0
- ((NSColor whiteColor) set)
0
- (p stroke))))
0
-
0
+ ((NSFontManager sharedFontManager) setSelectedFont:@textFont isMultiple:NO)
0
+ ((NSFontPanel sharedFontPanel) makeKeyAndOrderFront:nil)))
0
\ No newline at end of file
...
2
3
4
 
 
5
6
7
...
2
3
4
5
6
7
8
9
0
@@ -2,6 +2,8 @@
0
 ;; @discussion PagePacker scripting support in Nu.
0
 ;;
0
 ;; @copyright Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc.
0
+;; Substantially derived from original Objective-C source code by Aaron Hillegass.
0
+;; See objc/PagePacker.m for the copyright notice for the original code.
0
 
0
 (class NSObject
0
      

Comments

    No one has commented yet.