Skip to content

Commit 0e490d2

Browse files
committed
Merge branch 'lfpchanname' of https://github.com/mspacek/plugin-GUI into mspacek-lfpchanname
2 parents d721c26 + 5024f36 commit 0e490d2

2 files changed

Lines changed: 18 additions & 24 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,9 @@ void LfpDisplayCanvas::update()
255255
//std::cout << "Updating channel names" << std::endl;
256256
for (int i = 0; i < nChans; i++)
257257
{
258-
259258
String chName = processor->getDataChannel(i)->getName();
260-
261259
lfpDisplay->channelInfo[i]->setName(chName);
262260
lfpDisplay->setEnabledState(isChannelEnabled[i], i);
263-
264261
}
265262

266263
if (nChans == 0) lfpDisplay->setBounds(0, 0, getWidth(), getHeight());
@@ -275,7 +272,8 @@ void LfpDisplayCanvas::update()
275272
{
276273
for (int i = 0; i < nChans; i++)
277274
{
278-
//std::cout << i << std::endl;
275+
String chName = processor->getDataChannel(i)->getName();
276+
lfpDisplay->channelInfo[i]->setName(chName);
279277
lfpDisplay->channels[i]->updateType();
280278
lfpDisplay->channelInfo[i]->updateType();
281279
}
@@ -3078,6 +3076,7 @@ LfpChannelDisplay::LfpChannelDisplay(LfpDisplayCanvas* c, LfpDisplay* d, LfpDisp
30783076
, options(o)
30793077
, isSelected(false)
30803078
, chan(channelNumber)
3079+
, name("")
30813080
, drawableChan(channelNumber)
30823081
, channelOverlap(300)
30833082
, channelHeight(30)
@@ -3513,6 +3512,11 @@ int LfpChannelDisplay::getChannelNumber()
35133512
return chan;
35143513
}
35153514

3515+
String LfpChannelDisplay::getName()
3516+
{
3517+
return name;
3518+
}
3519+
35163520
int LfpChannelDisplay::getDrawableChannelNumber()
35173521
{
35183522
return drawableChan;
@@ -3569,7 +3573,7 @@ LfpChannelDisplayInfo::LfpChannelDisplayInfo(LfpDisplayCanvas* canvas_, LfpDispl
35693573
y = -1.0f;
35703574

35713575
// enableButton = new UtilityButton(String(ch+1), Font("Small Text", 13, Font::plain));
3572-
enableButton = new UtilityButton("*", Font("Small Text", 13, Font::plain));
3576+
enableButton = new UtilityButton("", Font("Small Text", 13, Font::plain));
35733577
enableButton->setRadius(5.0f);
35743578

35753579
enableButton->setEnabledState(true);
@@ -3729,24 +3733,17 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
37293733

37303734
int center = getHeight()/2 - (isSingleChannel?(75):(0));
37313735

3732-
// g.setColour(lineColour);
3733-
//if (chan > 98)
3734-
// g.fillRoundedRectangle(5,center-8,51,22,8.0f);
3735-
//else
3736-
3737-
// g.fillRoundedRectangle(5,center-8,41,22,8.0f);
3738-
37393736
// Draw the channel numbers
37403737
g.setColour(Colours::grey);
3741-
const String channelString = (isChannelNumberHidden() ? ("--") : String(getChannelNumber() + 1));
3738+
const String channelString = (isChannelNumberHidden() ? ("--") : getName());
37423739
bool isCentered = !getEnabledButtonVisibility();
37433740

37443741
g.drawText(channelString,
37453742
2,
37463743
center-4,
3747-
isCentered ? (getWidth()/2-4) : (getWidth()/4),
3744+
getWidth()/2,
37483745
10,
3749-
isCentered ? Justification::centred : Justification::centredRight,
3746+
isCentered ? Justification::centred : Justification::centredLeft,
37503747
false);
37513748

37523749
g.setColour(lineColour);
@@ -3797,17 +3794,11 @@ void LfpChannelDisplayInfo::resized()
37973794
{
37983795

37993796
int center = getHeight()/2 - (isSingleChannel?(75):(0));
3800-
3801-
//if (chan > 98)
3802-
// enableButton->setBounds(8,center-5,45,16);
3803-
//else
3804-
// enableButton->setBounds(8,center-5,35,16);
3805-
38063797
setEnabledButtonVisibility(getHeight() >= 16);
38073798

38083799
if (getEnabledButtonVisibility())
38093800
{
3810-
enableButton->setBounds(getWidth()/4 + 5, (center) - 7, 15, 15);
3801+
enableButton->setBounds(getWidth()/2 - 10, center - 5, 10, 10);
38113802
}
38123803

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

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

@@ -694,9 +694,12 @@ class LfpChannelDisplay : public Component
694694
void setChannelOverlap(int);
695695
int getChannelOverlap();
696696

697-
/** Return the assigned channel number for this display */
697+
/** Return the assigned channel number */
698698
int getChannelNumber();
699699

700+
/** Return the assigned channel name */
701+
String getName();
702+
700703
/** Returns the assigned channel number for this display, relative
701704
to the subset of channels being drawn to the canvas */
702705
int getDrawableChannelNumber();

0 commit comments

Comments
 (0)