[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patch: overlapping bus values in sim window
From: |
Tuukka Toivonen |
Subject: |
patch: overlapping bus values in sim window |
Date: |
Thu, 12 Jul 2001 20:33:38 +0300 (EEST) |
When a bus changes consecutively its value too fast, the printed bus
values in simulation window will overlap obscuring each other.
This patch fixes that: if a change occurs too near before the next
change, its bus value will not be printed.
The patch is tested with electric 6.03 and yet-unpublished version 6.04.
--- electric-6.04z/src/sim/simwindow.c.orig Thu Jul 12 20:15:40 2001
+++ electric-6.04z/src/sim/simwindow.c Thu Jul 12 20:08:08 2001
@@ -2474,6 +2474,7 @@
REGISTER DISCHANNEL *bustr;
REGISTER VARIABLE *var;
float time, position, nexttime;
+ INTSML wid, hei;
/* get coordinates */
temp_trace_spacing = 540 / sim_window_vislines;
@@ -2579,7 +2580,21 @@
}
}
- /* draw the value */
+ /* advance to the next time */
+ nexttime = time;
+ for(bustr = sim_window_plot; bustr != NODISCHANNEL;
bustr = bustr->nextdischannel)
+ {
+ if (bustr->buschannel != tr) continue;
+ for(j=0; j<bustr->numsteps; j++)
+ if (bustr->timearray[j] > time) break;
+ if (j < bustr->numsteps)
+ {
+ if (nexttime == time ||
bustr->timearray[j] < nexttime)
+ nexttime = bustr->timearray[j];
+ }
+ }
+
+ /* draw the value (before the time was advanced) */
x_max = sim_window_timetoxpos(time);
if (x_max < 114) x_max = 114;
if (x_max > 767) break;
@@ -2597,25 +2612,22 @@
sim_window_drawto(wavewin, x_min,
(y_min+y_max)/2);
if (style == 0)
{
- sim_window_moveto(x_max+BUSANGLE/2,
(y_min+y_max)/2);
- sim_window_drawhcstring(wavewin, s2);
+ if (nexttime != time)
+ {
+ tx =
sim_window_timetoxpos(nexttime);
+ } else
+ tx = 767;
+ screengettextsize(wavewin, s2, &wid,
&hei);
+ /* Make sure the bus value has space
before next change */
+ if (x_max+BUSANGLE/2+wid <= tx)
+ {
+
sim_window_moveto(x_max+BUSANGLE/2, (y_min+y_max)/2);
+
sim_window_drawhcstring(wavewin, s2);
+ }
}
x_min = x_max;
}
- /* advance to the next time */
- nexttime = time;
- for(bustr = sim_window_plot; bustr != NODISCHANNEL;
bustr = bustr->nextdischannel)
- {
- if (bustr->buschannel != tr) continue;
- for(j=0; j<bustr->numsteps; j++)
- if (bustr->timearray[j] > time) break;
- if (j < bustr->numsteps)
- {
- if (nexttime == time ||
bustr->timearray[j] < nexttime)
- nexttime = bustr->timearray[j];
- }
- }
if (nexttime == time) break;
time = nexttime;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- patch: overlapping bus values in sim window,
Tuukka Toivonen <=