MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / paint

Method paint

Source/Panels/SpectrogramPanel/Multiband.cpp:105–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void Multiband::paint(juce::Graphics& g)
106{
107 // send band buffer to graphs
108 if (isVisible())
109 processor.setHistoryArray(focusIndex);
110
111 // draw line that will be added next
112 float startY = 0;
113 float endY = getHeight();
114 auto mousePos = getMouseXYRelative();
115 float xPos = mousePos.getX();
116 float yPos = mousePos.getY();
117
118 if (yPos >= startY && yPos <= startY + getHeight() / 5 && lineNum < 3)
119 {
120 bool canCreate = true;
121 float xPercent = getMouseXYRelative().getX() / static_cast<float>(getWidth());
122 for (int i = 0; i < 3; i++)
123 {
124 if ((freqDividerGroup[i]->getToggleState() && fabs(freqDividerGroup[i]->getVerticalLine().getXPercent() - xPercent) < limitLeft) || xPercent < limitLeft || xPercent > limitRight)
125 {
126 canCreate = false;
127 break;
128 }
129 }
130 if (canCreate)
131 {
132 g.setColour(COLOUR1.withAlpha(0.2f));
133 g.drawLine(xPos, startY, xPos, endY, 2);
134 }
135 }
136
137 // set black and focus masks
138 int margin2 = getWidth() / 250; // leftside of line: 1/100(line width) * 4 / 10
139 int margin1 = getWidth() * 6 / 1000; // rightside of line: 1/100(line width) * 6 / 10
140 int mouseX = getMouseXYRelative().getX();
141 int mouseY = getMouseXYRelative().getY();
142
143 // set closebuttons visibility to false
144 for (int i = 0; i < lineNum + 1; i++)
145 {
146 bandUIs[i].closeButton->setVisible(false); // <--- MODIFIED
147 }
148
149 // set dragging state
150 isDragging = false;
151 for (int i = 0; i < lineNum; i++)
152 {
153 if (freqDividerGroup[i]->getVerticalLine().isMouseOverOrDragging())
154 {
155 isDragging = true;
156 break;
157 }
158 }
159
160 // set leftmost mask
161 setMasks(g, 0, 0, 0, 0, freqDividerGroup[0]->getX() + margin2, getHeight(), mouseX, mouseY);
162

Callers

nothing calls this directly

Calls 2

setHistoryArrayMethod · 0.80
getXPercentMethod · 0.80

Tested by

no test coverage detected