Skip to content

Commit fd0bfeb

Browse files
committed
Fix label pluralization in GraphViewer
1 parent fc47911 commit fd0bfeb

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Source/UI/GraphViewer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,20 @@ void DataStreamInfo::paint(Graphics& g)
328328
g.fillRect(1, 0, getWidth() - 2, getHeight() - 1);
329329
g.fillRect(1, 0, 24, getHeight() - 1);
330330

331+
int numEventChannels = stream->getEventChannels().size();
332+
int numSpikeChannels = stream->getSpikeChannels().size();
333+
334+
String ttlText = numEventChannels == 1 ? "TTL Channel" : "TTL Channels";
335+
String spikeText = numSpikeChannels == 1 ? "Spike Channel" : "Spike Channels";
336+
331337
g.setColour(Colours::black);
332338
g.drawText("@ " + String(stream->getSampleRate()) + " Hz", 30, 0, getWidth() - 30, 20, Justification::left);
333-
g.drawText("TTL Channels", 30, 20, getWidth() - 30, 20, Justification::left);
334-
g.drawText("Spike Channels", 30, 40, getWidth() - 30, 20, Justification::left);
339+
g.drawText(ttlText, 30, 20, getWidth() - 30, 20, Justification::left);
340+
g.drawText(spikeText, 30, 40, getWidth() - 30, 20, Justification::left);
335341

336342
g.drawText(String(stream->getChannelCount()), 0, 0, 25, 20, Justification::centred);
337-
g.drawText(String(stream->getEventChannels().size()), 0, 20, 25, 20, Justification::centred);
338-
g.drawText(String(stream->getSpikeChannels().size()), 0, 40, 25, 20, Justification::centred);
343+
g.drawText(String(numEventChannels), 0, 20, 25, 20, Justification::centred);
344+
g.drawText(String(numSpikeChannels), 0, 40, 25, 20, Justification::centred);
339345

340346
}
341347

0 commit comments

Comments
 (0)