Show the channel labels in the Wave Inspector.

merge-requests/1/head
Teuniz 2017-01-02 11:13:36 +01:00
rodzic 8c970f133e
commit 24d1e5be99
3 zmienionych plików z 183 dodań i 1 usunięć

Wyświetl plik

@ -35,7 +35,7 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.34_1701021058"
#define PROGRAM_VERSION "0.34_1701021109"
#define MAX_PATHLEN 4096

Wyświetl plik

@ -123,6 +123,11 @@ void WaveCurve::paintEvent(QPaintEvent *)
painter->fillRect(0, curve_h - 30, curve_w, curve_h, QColor(32, 32, 32));
for(i=0; i<devparms->channel_cnt; i++)
{
drawChanLabel(painter, 8 + (i * 130), curve_h - 25, i);
}
/////////////////////////////////// translate coordinates, draw and fill a rectangle ///////////////////////////////////////////
painter->translate(bordersize, bordersize);
@ -1518,6 +1523,182 @@ int WaveCurve::ascii_decode_control_char(char ch, char *str)
}
void WaveCurve::drawChanLabel(QPainter *painter, int xpos, int ypos, int chn)
{
QPainterPath path;
char str1[4],
str2[128];
if(devparms == NULL)
{
return;
}
str1[0] = '1' + chn;
str1[1] = 0;
convert_to_metric_suffix(str2, devparms->chanscale[chn], 2);
strcat(str2, devparms->chanunitstr[devparms->chanunit[chn]]);
if(devparms->chanbwlimit[chn])
{
strcat(str2, " B");
}
if(devparms->chandisplay[chn])
{
if(chn == devparms->activechannel)
{
path.addRoundedRect(xpos, ypos, 20, 20, 3, 3);
painter->fillPath(path, SignalColor[chn]);
painter->setPen(Qt::black);
painter->drawText(xpos + 6, ypos + 15, str1);
if(devparms->chaninvert[chn])
{
painter->drawLine(xpos + 6, ypos + 3, xpos + 14, ypos + 3);
}
path = QPainterPath();
path.addRoundedRect(xpos + 25, ypos, 90, 20, 3, 3);
painter->fillPath(path, Qt::black);
painter->setPen(SignalColor[chn]);
painter->drawRoundedRect(xpos + 25, ypos, 90, 20, 3, 3);
painter->drawText(xpos + 35, ypos + 1, 90, 20, Qt::AlignCenter, str2);
if(devparms->chancoupling[chn] == 0)
{
painter->drawLine(xpos + 33, ypos + 6, xpos + 33, ypos + 10);
painter->drawLine(xpos + 28, ypos + 10, xpos + 38, ypos + 10);
painter->drawLine(xpos + 30, ypos + 12, xpos + 36, ypos + 12);
painter->drawLine(xpos + 32, ypos + 14, xpos + 34, ypos + 14);
}
else if(devparms->chancoupling[chn] == 1)
{
painter->drawLine(xpos + 28, ypos + 8, xpos + 38, ypos + 8);
painter->drawLine(xpos + 28, ypos + 12, xpos + 30, ypos + 12);
painter->drawLine(xpos + 32, ypos + 12, xpos + 34, ypos + 12);
painter->drawLine(xpos + 36, ypos + 12, xpos + 38, ypos + 12);
}
else if(devparms->chancoupling[chn] == 2)
{
painter->drawArc(xpos + 30, ypos + 8, 5, 5, 10 * 16, 160 * 16);
painter->drawArc(xpos + 35, ypos + 8, 5, 5, -10 * 16, -160 * 16);
}
}
else
{
path.addRoundedRect(xpos, ypos, 20, 20, 3, 3);
path.addRoundedRect(xpos + 25, ypos, 85, 20, 3, 3);
painter->fillPath(path, Qt::black);
painter->setPen(SignalColor[chn]);
painter->drawText(xpos + 6, ypos + 15, str1);
if(devparms->chaninvert[chn])
{
painter->drawLine(xpos + 6, ypos + 3, xpos + 14, ypos + 3);
}
painter->drawText(xpos + 35, ypos + 1, 90, 20, Qt::AlignCenter, str2);
if(devparms->chancoupling[chn] == 0)
{
painter->drawLine(xpos + 33, ypos + 6, xpos + 33, ypos + 10);
painter->drawLine(xpos + 28, ypos + 10, xpos + 38, ypos + 10);
painter->drawLine(xpos + 30, ypos + 12, xpos + 36, ypos + 12);
painter->drawLine(xpos + 32, ypos + 14, xpos + 34, ypos + 14);
}
else if(devparms->chancoupling[chn] == 1)
{
painter->drawLine(xpos + 28, ypos + 8, xpos + 38, ypos + 8);
painter->drawLine(xpos + 28, ypos + 12, xpos + 30, ypos + 12);
painter->drawLine(xpos + 32, ypos + 12, xpos + 34, ypos + 12);
painter->drawLine(xpos + 36, ypos + 12, xpos + 38, ypos + 12);
}
else if(devparms->chancoupling[chn] == 2)
{
painter->drawArc(xpos + 30, ypos + 8, 5, 5, 10 * 16, 160 * 16);
painter->drawArc(xpos + 35, ypos + 8, 5, 5, -10 * 16, -160 * 16);
}
}
}
else
{
path.addRoundedRect(xpos, ypos, 20, 20, 3, 3);
path.addRoundedRect(xpos + 25, ypos, 85, 20, 3, 3);
painter->fillPath(path, Qt::black);
painter->setPen(QColor(48, 48, 48));
painter->drawText(xpos + 6, ypos + 15, str1);
painter->drawText(xpos + 30, ypos + 1, 85, 20, Qt::AlignCenter, str2);
if(devparms->chanbwlimit[chn])
{
painter->drawText(xpos + 90, ypos + 1, 20, 20, Qt::AlignCenter, "B");
}
if(devparms->chancoupling[chn] == 0)
{
painter->drawLine(xpos + 33, ypos + 6, xpos + 33, ypos + 10);
painter->drawLine(xpos + 28, ypos + 10, xpos + 38, ypos + 10);
painter->drawLine(xpos + 30, ypos + 12, xpos + 36, ypos + 12);
painter->drawLine(xpos + 32, ypos + 14, xpos + 34, ypos + 14);
}
else if(devparms->chancoupling[chn] == 1)
{
painter->drawLine(xpos + 28, ypos + 8, xpos + 38, ypos + 8);
painter->drawLine(xpos + 28, ypos + 12, xpos + 30, ypos + 12);
painter->drawLine(xpos + 32, ypos + 12, xpos + 34, ypos + 12);
painter->drawLine(xpos + 36, ypos + 12, xpos + 38, ypos + 12);
}
else if(devparms->chancoupling[chn] == 2)
{
painter->drawArc(xpos + 30, ypos + 8, 5, 5, 10 * 16, 160 * 16);
painter->drawArc(xpos + 35, ypos + 8, 5, 5, -10 * 16, -160 * 16);
}
}
}

Wyświetl plik

@ -108,6 +108,7 @@ private:
void drawSmallTriggerArrow(QPainter *, int, int, int, QColor);
void drawTrigCenterArrow(QPainter *, int, int);
void drawTopLabels(QPainter *);
void drawChanLabel(QPainter *, int, int, int);
void paintLabel(QPainter *, int, int, int, int, const char *, QColor);
void draw_decoder(QPainter *, int, int);
int ascii_decode_control_char(char, char *);