Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Classes/GraphicClientView.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 199 - (show annotations) (download) (as text)
Mon Apr 4 14:50:52 2022 UTC (2 years, 1 month ago) by toshinagata1964
File MIME type: text/x-chdr
File size: 4443 byte(s)
Vertical grids are shown in strip chart view
1 //
2 // GraphicClientView.h
3 //
4 /*
5 Copyright (c) 2000-2017 Toshi Nagata. All rights reserved.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation version 2 of the License.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 */
16
17 #import <Cocoa/Cocoa.h>
18
19 enum {
20 kGraphicGenericViewType = 0,
21 kGraphicPianoRollViewType = 1,
22 kGraphicTimeChartViewType = 2,
23 kGraphicStripChartViewType = 3
24 };
25
26 extern CGFloat gLineDash1[];
27 extern CGFloat gLineDash2[];
28 extern CGFloat gDashWidth;
29
30 @interface GraphicClientView : NSView {
31 id dataSource; // The data source
32 float minValue, maxValue;
33 float visibleRangeMin, visibleRangeMax; // To be used in save/restoreVisibleRange
34
35 // The current graphic tool is taken from -[GraphicWindowController graphicTool]
36 // within mouseDown/mouseMoved/flagsChanged handler.
37 // Some client (like TimeChartView) may want to override the selection mode;
38 // this is implemented in -[GraphicClientView modifyLocalGraphicTool:];
39 int localGraphicTool;
40
41 BOOL isDragging;
42 BOOL isLoupeDragging;
43 BOOL autoScaleOnResizing;
44 NSUInteger initialModifierFlags;
45 NSUInteger currentModifierFlags;
46 NSMutableArray *selectPoints;
47 NSBezierPath *selectionPath;
48 NSRect initialSelectionRect;
49 NSTimer *autoscrollTimer;
50 }
51
52 // Should be overridden in subclasses
53 + (float)minHeight;
54 - (int)clientViewType;
55
56 - (BOOL)hasVerticalScroller;
57 - (void)setDataSource: (id)object;
58 - (id)dataSource;
59 - (void)paintEditingRange: (NSRect)aRect startX: (float *)startp endX: (float *)endp;
60 - (void)reloadData;
61 - (void)setYScale: (float)y;
62 - (float)yScale;
63 - (void)setMinValue: (float)value;
64 - (float)minValue;
65 - (void)setMaxValue: (float)value;
66 - (float)maxValue;
67
68 // The visible/focus track can either be chosen in the track list, or be determined
69 // for each client view. The following methods calls the GraphicWindowController
70 // versions by default, but the subclass can override them to implement client-specific
71 // focus track handling (e.g. 'tempo' view always edits the conductor track)
72 - (BOOL)isFocusTrack: (int)trackNum;
73 - (int32_t)visibleTrackCount;
74 - (int)sortedTrackNumberAtIndex: (int)index;
75
76 // Set client-specific focus track. By default, focus track is -1 (i.e. as in the track list)
77 - (void)setFocusTrack:(int)aTrack;
78 - (int)focusTrack;
79
80 // Update internal information for the track if necessary
81 - (void)doTrackModified:(int)aTrack;
82
83 // Drawing
84 - (void)drawContentsInRect:(NSRect)aRect;
85 - (void)drawVerticalLinesInRect: (NSRect)aRect;
86 - (NSColor *)verticalLineColor: (BOOL)beforeEndOfSequence;
87
88 //- (int)selectMode;
89 - (BOOL)isDragging;
90 //- (BOOL)shiftDown;
91 - (NSArray *)selectPoints;
92 - (NSBezierPath *)selectionPath;
93 - (NSRect)willInvalidateSelectRect: (NSRect)rect;
94 - (void)invalidateSelectRegion;
95 - (void)calcSelectRegion;
96 - (void)setSelectRegion: (NSBezierPath *)path;
97 - (void)drawSelectRegion;
98 - (BOOL)isPointInSelectRegion: (NSPoint)point;
99
100 // The subclass should override this to respond to mouse actions
101 - (void)doMouseDown: (NSEvent *)theEvent;
102 - (void)doMouseDragged: (NSEvent *)theEvent;
103 - (void)doMouseUp: (NSEvent *)theEvent;
104 //- (void)draggingDidEnd: (NSRect)bounds;
105
106 // Overrides for implementing selection rectangle/region
107 - (void)mouseDown: (NSEvent *)theEvent;
108 - (void)mouseDragged: (NSEvent *)theEvent;
109 - (void)mouseUp: (NSEvent *)theEvent;
110
111 // Info text during mouse move and dragging
112 - (NSString *)infoTextForMousePoint:(NSPoint)pt dragging:(BOOL)flag option:(int *)option;
113
114 // Will be called from GraphicWindowController's mouseMoved: handler
115 - (void)doMouseMoved: (NSEvent *)theEvent;
116
117 // Will be called from GraphicBackgroundView's flagsChanged: handler
118 - (void)doFlagsChanged: (NSEvent *)theEvent;
119
120 - (int)modifyLocalGraphicTool:(int)originalGraphicTool;
121
122 - (void)convertFromPoint:(NSPoint)pt toY:(float *)y andTick:(int32_t *)tick;
123 - (NSPoint)convertToPointFromY:(float)y andTick:(int32_t)tick;
124
125 - (void)setVisibleRangeMin:(float)min max:(float)max;
126 - (void)getVisibleRangeMin:(float *)min max:(float *)max;
127 - (void)saveVisibleRange;
128 - (void)restoreVisibleRange;
129
130 - (float)scrollVerticalPosition;
131 - (void)scrollToVerticalPosition:(float)pos;
132
133 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26