Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 103 lines (84 sloc) 2.617 kb
ee99867 @ccgus oh geeze
authored
1 //
2 // NoodleLineNumberMarker.m
3 // Line View Test
4 //
5 // Created by Paul Kim on 9/30/08.
6 // Copyright (c) 2008 Noodlesoft, LLC. All rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person
9 // obtaining a copy of this software and associated documentation
10 // files (the "Software"), to deal in the Software without
11 // restriction, including without limitation the rights to use,
12 // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the
14 // Software is furnished to do so, subject to the following
15 // conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 // OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 #import "NoodleLineNumberMarker.h"
31
32
33 @implementation NoodleLineNumberMarker
34
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
35 - (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(CGFloat)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin
ee99867 @ccgus oh geeze
authored
36 {
37 if ((self = [super initWithRulerView:aRulerView markerLocation:0.0 image:anImage imageOrigin:imageOrigin]) != nil)
38 {
39 lineNumber = line;
40 }
41 return self;
42 }
43
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
44 - (void)setLineNumber:(NSUInteger)line
ee99867 @ccgus oh geeze
authored
45 {
46 lineNumber = line;
47 }
48
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
49 - (NSUInteger)lineNumber
ee99867 @ccgus oh geeze
authored
50 {
51 return lineNumber;
52 }
53
54 #pragma mark NSCoding methods
55
56 #define NOODLE_LINE_CODING_KEY @"line"
57
58 - (id)initWithCoder:(NSCoder *)decoder
59 {
60 if ((self = [super initWithCoder:decoder]) != nil)
61 {
62 if ([decoder allowsKeyedCoding])
63 {
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
64 lineNumber = [[decoder decodeObjectForKey:NOODLE_LINE_CODING_KEY] unsignedIntegerValue];
ee99867 @ccgus oh geeze
authored
65 }
66 else
67 {
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
68 lineNumber = [[decoder decodeObject] unsignedIntegerValue];
ee99867 @ccgus oh geeze
authored
69 }
70 }
71 return self;
72 }
73
74 - (void)encodeWithCoder:(NSCoder *)encoder
75 {
76 [super encodeWithCoder:encoder];
77
78 if ([encoder allowsKeyedCoding])
79 {
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
80 [encoder encodeObject:[NSNumber numberWithUnsignedInteger:lineNumber] forKey:NOODLE_LINE_CODING_KEY];
ee99867 @ccgus oh geeze
authored
81 }
82 else
83 {
44a9c46 @ccgus Fixed some problems where the ruler view wouldn't show up correctly i…
authored
84 [encoder encodeObject:[NSNumber numberWithUnsignedInteger:lineNumber]];
ee99867 @ccgus oh geeze
authored
85 }
86 }
87
88
89 #pragma mark NSCopying methods
90
91 - (id)copyWithZone:(NSZone *)zone
92 {
93 id copy;
94
95 copy = [super copyWithZone:zone];
96 [copy setLineNumber:lineNumber];
97
98 return copy;
99 }
100
101
102 @end
Something went wrong with that request. Please try again.