Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 86 lines (65 sloc) 2.472 kb
a516cc8 Initial check-in.
uli authored
1 //
2 // UKPaintTempRectTool.m
3 // UKPaintView
4 //
5 // Created by Uli Kusterer on Sat Nov 01 2003.
6 // Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
7 //
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
26 //
a516cc8 Initial check-in.
uli authored
27
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
28 #import "ULIPaintTempRectangleTool.h"
29 #import "ULIPaintView.h"
a516cc8 Initial check-in.
uli authored
30
31
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
32 @implementation ULIPaintTempRectangleTool
a516cc8 Initial check-in.
uli authored
33
34 /* Override this to draw a shape during tracking:
35 The drawings you do in here will be undone before you're called again.
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
36 This is also called when tracking has finished by drawDisposableToolShapeFrom:to:. */
a516cc8 Initial check-in.
uli authored
37 -(void) drawTemporaryTrackingToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos
38 {
39 NSRect box = [self rectFrom: [owner initialPos] to: currPos];
40 NSRect oldBox = [self rectWithLineSizeFrom: [owner initialPos] to: *prevPos];
41
42 [[owner lineColor] set];
43 [NSBezierPath setDefaultLineWidth: [owner lineSize].width];
44 [NSBezierPath strokeRect: box];
45
46 box = [self rectWithLineSizeFrom: [owner initialPos] to: currPos];
47
48 [owner setNeedsDisplayInRect: oldBox];
49 [owner setNeedsDisplayInRect: box];
50
51 *prevPos = currPos;
52 }
53
54
55 -(NSString*) toolIconName
56 {
57 return @"UKPaintTempRectTool";
58 }
59
60
61 -(void) drawDisposableToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos
62 {
63 [self drawTemporaryTrackingToolShapeFrom: prevPos to: currPos];
64 }
65
66 -(void) drawFinalToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos
67 {
68 // The default calls drawTemporaryTrackingToolShapeFrom:to:, which we don't want here.
69 }
70
71
72 -(void) trackingWillStart
73 {
74 [owner setNeedsDisplay: YES]; // Make sure previous marker's area is redrawn.
75 }
76
77
78 -(void) paintToolWillUnload: (id)sender
79 {
80 [owner clearMarkersBuffer: nil];
81 }
82
83
84
85 @end
Something went wrong with that request. Please try again.