Source code: com/virtuosotechnologies/asaph/standardgui/LineChordPlaceholderView.java
1 /*
2 ================================================================================
3
4 FILE: LineChordPlaceholderView.java
5
6 PROJECT:
7
8 Virtuoso Utilities
9
10 CONTENTS:
11
12 LineMemberView representing a chord annotation placeholder
13
14 PROGRAMMERS:
15
16 Daniel Azuma (DA) <dazuma@kagi.com>
17
18 COPYRIGHT:
19
20 Copyright (C) 2003 Daniel Azuma (dazuma@kagi.com)
21
22 This program is free software; you can redistribute it and/or
23 modify it under the terms of the GNU General Public License as
24 published by the Free Software Foundation; either version 2
25 of the License, or (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public
33 License along with this program; if not, write to
34 Free Software Foundation, Inc.
35 59 Temple Place, Suite 330
36 Boston, MA 02111-1307 USA
37
38 ================================================================================
39 */
40
41
42 package com.virtuosotechnologies.asaph.standardgui;
43
44
45 import java.awt.Graphics2D;
46 import java.awt.geom.Rectangle2D;
47
48 import com.virtuosotechnologies.asaph.model.ChordAnnotation;
49
50
51 /**
52 * LineMemberView representing a chord annotation placeholder
53 */
54 /*package*/ class LineChordPlaceholderView
55 extends LineMemberView
56 {
57 private float top_;
58 private float bottom_;
59 private ChordGroupView groupView_;
60
61
62 /**
63 * Constructor
64 */
65 /*package*/ LineChordPlaceholderView(
66 ChordAnnotation model,
67 float xpos,
68 float width,
69 float top,
70 float bottom,
71 ChordGroupView groupView)
72 {
73 super(model, xpos, width);
74 top_ = top;
75 bottom_ = bottom;
76 groupView_ = groupView;
77 }
78
79
80 /**
81 * Draw
82 */
83 /*package*/ void paint(
84 Graphics2D g2d,
85 float x,
86 float y)
87 {
88 g2d.setColor(EditorConstants.CHORD_PLACEHOLDER_COLOR);
89 g2d.fill(new Rectangle2D.Float(
90 x+getXPos(), y+top_, getWidth(), bottom_-top_));
91 }
92
93
94 /**
95 * In selection area?
96 */
97 /*package*/ boolean isInSelectionArea(
98 float x)
99 {
100 float xpos = getXPos();
101 return (x >= xpos-EditorConstants.CHORDGROUP_SELECT_SLOP+1 &&
102 x <= xpos+EditorConstants.CHORDGROUP_SELECT_SLOP);
103 }
104 }