23 #include <Q3PointArray>
67 p->
Painter->setPen(QPen(Qt::black,0));
75 p->
Painter->setBrush(QColor(192, 192, 192));
76 p->
Painter->setPen(QColor(152, 152, 152));
82 Points.setPoints(3, x, (y+dy)>>1, dx, y, dx, dy);
83 p->
Painter->drawConvexPolygon(Points);
84 p->
Painter->setPen(QColor(224, 224, 224));
85 p->
Painter->drawLine(x, (y+dy)>>1, dx, y);
89 p->
Painter->setPen(QColor(152, 152, 152));
92 Points.setPoints(3, x, (y+dy)>>1, x-dx, y, x-dx, dy);
93 p->
Painter->drawConvexPolygon(Points);
94 p->
Painter->setPen(QColor(208, 208, 208));
95 p->
Painter->drawLine(x-dx, y, x, (y+dy)>>1);
96 p->
Painter->setPen(QColor(224, 224, 224));
97 p->
Painter->drawLine(x-dx, y, x-dx, dy);
99 p->
Painter->setBrush(QBrush(Qt::NoBrush));
104 p->
Painter->setPen(QPen(Qt::darkGray,3));
106 p->
Painter->setPen(QPen(Qt::darkRed,2));
123 int tHeight = metrics.lineSpacing();
125 int colWidth=0, x=4, y, xStart = 0, z;
129 int invisibleCount = 0;
131 if(
y2 < (tHeight + 8))
133 y =
y2 - tHeight - 6;
137 Lines.append(
new Line(0,
y2, 0, 0, QPen(Qt::black,0)));
139 Lines.append(
new Line(0, 0,
x2, 0, QPen(Qt::black,0)));
140 Lines.append(
new Line(0, y+2,
x2, y+2, QPen(Qt::black,0)));
148 Str = QObject::tr(
"no variables");
162 Str = QObject::tr(
"no data");
164 if(colWidth < 0)
return 0;
175 if(g->
Var.right(2) ==
".X") {
186 int TimeStepWidth = colWidth * metrics.width(
"X") + 8;
187 if(TimeStepWidth < 40)
192 if(!firstGraph->
cPointsX.isEmpty()) {
194 if(firstGraph->
cPointsX.count() > 1) {
195 Str = QObject::tr(
"wrong dependency");
208 if(colWidth < 0)
return 1;
215 if(y < tHeight)
break;
218 if(colWidth < 0)
return 1;
224 Lines.append(
new Line(x-6,
y2, x-6, 0, QPen(Qt::black,0)));
245 colWidth = metrics.width(Str);
246 if(x+colWidth+2 >=
x2)
break;
249 Lines.append(
new Line(x+5, y, x+5, y-3, QPen(Qt::black,0)));
265 Lines.append(
new Line(4, 6, 4, -7, QPen(Qt::red,2)));
266 Lines.append(
new Line(1, 0, 4, -7, QPen(Qt::red,2)));
267 Lines.append(
new Line(7, 0, 4, -7, QPen(Qt::red,2)));
275 Str = QObject::tr(
"no data");
277 if(colWidth < 0)
goto funcEnd;
284 Str = QObject::tr(
"wrong dependency");
286 if(colWidth < 0)
goto funcEnd;
294 case 1: Pen.setStyle(Qt::DashLine);
break;
295 case 2: Pen.setStyle(Qt::DotLine);
break;
299 if(g->
Var.right(2) !=
".X") {
302 z = g->
cPointsX.getFirst()->count - z;
303 yNow = 1 + ((tHeight - 6) >> 1);
304 Lines.append(
new Line(x, y-yNow, x+2, y-1, Pen));
305 Lines.append(
new Line(x+2, y-tHeight+5, x, y-yNow, Pen));
307 if(x+TimeStepWidth >=
x2)
break;
308 Lines.append(
new Line(x+2, y-1, x+TimeStepWidth-2, y-1, Pen));
309 Lines.append(
new Line(x+2, y-tHeight+5, x+TimeStepWidth-2, y-tHeight+5, Pen));
313 Texts.append(
new Text(x+3, y,QString::number(*px)));
317 QString::number(sqrt((*px)*(*px) + (*(px+1))*(*(px+1))))));
321 Lines.append(
new Line(x-2, y-tHeight+5, x+2, y-1, Pen));
322 Lines.append(
new Line(x+2, y-tHeight+5, x-2, y-1, Pen));
331 pcx += z * (strlen(pcx)+1);
333 if(strlen(pcx) < 2) {
337 if(z > 0) yLast += 2;
338 switch(*(pcx-yLast)) {
346 yLast = 1 + ((tHeight - 6) >> 1);
349 z = g->
cPointsX.getFirst()->count - z;
360 yNow = 1 + ((tHeight - 6) >> 1);
364 Lines.append(
new Line(x, y-yLast, x, y-yNow, Pen));
365 if(x+TimeStepWidth >=
x2)
break;
366 if((*pcx & 254) ==
'0')
367 Lines.append(
new Line(x, y-yNow, x+TimeStepWidth, y-yNow, Pen));
369 Texts.append(
new Text(x+(TimeStepWidth>>1)-3, y, QString(pcx)));
370 Lines.append(
new Line(x+3, y-1, x+TimeStepWidth-3, y-1, Pen));
371 Lines.append(
new Line(x+3, y-tHeight+5, x+TimeStepWidth-3, y-tHeight+5, Pen));
372 Lines.append(
new Line(x, y-yNow, x+3, y-1, Pen));
373 Lines.append(
new Line(x, y-yNow, x+3, y-tHeight+5, Pen));
374 Lines.append(
new Line(x+TimeStepWidth-3, y-1, x+TimeStepWidth, y-yNow, Pen));
375 Lines.append(
new Line(x+TimeStepWidth-3, y-tHeight+5, x+TimeStepWidth, y-yNow, Pen));
386 z = g->
cPointsX.getFirst()->count - z;
387 yNow = 1 + ((tHeight - 6) >> 1);
388 Lines.append(
new Line(x, y-yNow, x+2, y-1, Pen));
389 Lines.append(
new Line(x+2, y-tHeight+5, x, y-yNow, Pen));
391 if(x+TimeStepWidth >=
x2)
break;
392 Lines.append(
new Line(x+2, y-1, x+TimeStepWidth-2, y-1, Pen));
393 Lines.append(
new Line(x+2, y-tHeight+5, x+TimeStepWidth-2, y-tHeight+5, Pen));
395 Texts.append(
new Text(x+3, y, QString(pcx)));
398 pcx += strlen(pcx) + 1;
399 Lines.append(
new Line(x-2, y-tHeight+5, x+2, y-1, Pen));
400 Lines.append(
new Line(x+2, y-tHeight+5, x-2, y-1, Pen));
409 if(invisibleCount > 0) {
420 if(NumLeft < 0) NumLeft = 0;
421 y = NumAll - NumLeft - z;
449 if(
y1 <= 0)
return 0;
453 if(clickPos > (
cx+
x2-20)) {
507 Name = QObject::tr(
"Timing Diagram");
508 BitmapFile = (
char *)
"timing";
void drawResizeRect(int, int)
void paint(ViewPainter *)
void map(int, int, int &, int &)
#define MIN_SCROLLBAR_SIZE
bool sameDependencies(Graph *, Graph *)
void drawLine(int, int, int, int)
Definitions and declarations for the main application.
void fillRect(int, int, int, int, const QColor &)
int drawText(const QString &, int, int, int *Height=0)
QString num2str(double Num)
static Element * info(QString &, char *&, bool getNewOne=false)
Q3PtrList< Graph > Graphs
int checkColumnWidth(const QString &, const QFontMetrics &, int, int, int)
void drawRect(int, int, int, int)
Superclass of all schematic drawing elements.
TimingDiagram(int _cx=0, int _cy=0)
bool scrollTo(int, int, int)
Q3PtrList< DataX > cPointsX