Skip to content

Commit 5024f36

Browse files
committed
Label LFP Viewer chans by name instead of number
* LFP enable/disable buttons are also a bit smaller now
1 parent ebb0455 commit 5024f36

2 files changed

Lines changed: 19 additions & 25 deletions

File tree

Source/Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,9 @@ void LfpDisplayCanvas::update()
288288
//std::cout << "Updating channel names" << std::endl;
289289
for (int i = 0; i < nChans; i++)
290290
{
291-
292-
String chName = processor->getDataChannel(i)->getName();
293-
291+
String chName = processor->getDataChannel(i)->getName();
294292
lfpDisplay->channelInfo[i]->setName(chName);
295293
lfpDisplay->setEnabledState(isChannelEnabled[i], i);
296-
297294
}
298295

299296
if (nChans == 0) lfpDisplay->setBounds(0, 0, getWidth(), getHeight());
@@ -308,7 +305,8 @@ void LfpDisplayCanvas::update()
308305
{
309306
for (int i = 0; i < nChans; i++)
310307
{
311-
//std::cout << i << std::endl;
308+
String chName = processor->getDataChannel(i)->getName();
309+
lfpDisplay->channelInfo[i]->setName(chName);
312310
lfpDisplay->channels[i]->updateType();
313311
lfpDisplay->channelInfo[i]->updateType();
314312
}
@@ -3137,6 +3135,7 @@ LfpChannelDisplay::LfpChannelDisplay(LfpDisplayCanvas* c, LfpDisplay* d, LfpDisp
31373135
, options(o)
31383136
, isSelected(false)
31393137
, chan(channelNumber)
3138+
, name("")
31403139
, drawableChan(channelNumber)
31413140
, channelOverlap(300)
31423141
, channelHeight(30)
@@ -3572,6 +3571,11 @@ int LfpChannelDisplay::getChannelNumber()
35723571
return chan;
35733572
}
35743573

3574+
String LfpChannelDisplay::getName()
3575+
{
3576+
return name;
3577+
}
3578+
35753579
int LfpChannelDisplay::getDrawableChannelNumber()
35763580
{
35773581
return drawableChan;
@@ -3628,7 +3632,7 @@ LfpChannelDisplayInfo::LfpChannelDisplayInfo(LfpDisplayCanvas* canvas_, LfpDispl
36283632
y = -1.0f;
36293633

36303634
// enableButton = new UtilityButton(String(ch+1), Font("Small Text", 13, Font::plain));
3631-
enableButton = new UtilityButton("*", Font("Small Text", 13, Font::plain));
3635+
enableButton = new UtilityButton("", Font("Small Text", 13, Font::plain));
36323636
enableButton->setRadius(5.0f);
36333637

36343638
enableButton->setEnabledState(true);
@@ -3788,24 +3792,17 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
37883792

37893793
int center = getHeight()/2 - (isSingleChannel?(75):(0));
37903794

3791-
// g.setColour(lineColour);
3792-
//if (chan > 98)
3793-
// g.fillRoundedRectangle(5,center-8,51,22,8.0f);
3794-
//else
3795-
3796-
// g.fillRoundedRectangle(5,center-8,41,22,8.0f);
3797-
37983795
// Draw the channel numbers
37993796
g.setColour(Colours::grey);
3800-
const String channelString = (isChannelNumberHidden() ? ("--") : String(getChannelNumber() + 1));
3797+
const String channelString = (isChannelNumberHidden() ? ("--") : getName());
38013798
bool isCentered = !getEnabledButtonVisibility();
38023799

38033800
g.drawText(channelString,
38043801
2,
38053802
center-4,
3806-
isCentered ? (getWidth()/2-4) : (getWidth()/4),
3803+
getWidth()/2,
38073804
10,
3808-
isCentered ? Justification::centred : Justification::centredRight,
3805+
isCentered ? Justification::centred : Justification::centredLeft,
38093806
false);
38103807

38113808
g.setColour(lineColour);
@@ -3856,17 +3853,11 @@ void LfpChannelDisplayInfo::resized()
38563853
{
38573854

38583855
int center = getHeight()/2 - (isSingleChannel?(75):(0));
3859-
3860-
//if (chan > 98)
3861-
// enableButton->setBounds(8,center-5,45,16);
3862-
//else
3863-
// enableButton->setBounds(8,center-5,35,16);
3864-
38653856
setEnabledButtonVisibility(getHeight() >= 16);
38663857

38673858
if (getEnabledButtonVisibility())
38683859
{
3869-
enableButton->setBounds(getWidth()/4 + 5, (center) - 7, 15, 15);
3860+
enableButton->setBounds(getWidth()/2 - 10, center - 5, 10, 10);
38703861
}
38713862

38723863
setChannelNumberIsHidden(getHeight() < 16 && (getDrawableChannelNumber() + 1) % 10 != 0);

Source/Plugins/LfpDisplayNode/LfpDisplayCanvas.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class LfpDisplayCanvas : public Visualizer,
148148
//void scrollBarMoved(ScrollBar *scrollBarThatHasMoved, double newRangeStart);
149149

150150
bool fullredraw; // used to indicate that a full redraw is required. is set false after each full redraw, there is a similar switch for each display;
151-
static const int leftmargin=50; // left margin for lfp plots (so the ch number text doesnt overlap)
151+
static const int leftmargin = 50; // left margin for lfp plots (so the ch number text doesnt overlap)
152152

153153
Array<bool> isChannelEnabled;
154154

@@ -711,9 +711,12 @@ class LfpChannelDisplay : public Component
711711
void setChannelOverlap(int);
712712
int getChannelOverlap();
713713

714-
/** Return the assigned channel number for this display */
714+
/** Return the assigned channel number */
715715
int getChannelNumber();
716716

717+
/** Return the assigned channel name */
718+
String getName();
719+
717720
/** Returns the assigned channel number for this display, relative
718721
to the subset of channels being drawn to the canvas */
719722
int getDrawableChannelNumber();

0 commit comments

Comments
 (0)