bold clicked wave for better visibility if multiple waves
This commit is contained in:
parent
038ef39bb5
commit
ee263197d8
|
|
@ -235,22 +235,23 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
zoom_m = (xctx->mousex - gr->x1) / gr->w;
|
zoom_m = (xctx->mousex - gr->x1) / gr->w;
|
||||||
/* dragging cursors when mouse is very close */
|
/* dragging cursors when mouse is very close */
|
||||||
if(event == ButtonPress && button == Button1) {
|
if(event == ButtonPress && button == Button1) {
|
||||||
if( (xctx->graph_flags & 2) && fabs(xctx->mousex - W_X(xctx->graph_cursor1_x)) < 10) {
|
if(edit_wave_attributes(2, i, gr)) {
|
||||||
xctx->graph_flags |= 16; /* Start move cursor1 */
|
draw_graph(i, 1 + 8 + (xctx->graph_flags & 6), gr); /* draw data in each graph box */
|
||||||
}
|
} else {
|
||||||
if( (xctx->graph_flags & 4) && fabs(xctx->mousex - W_X(xctx->graph_cursor2_x)) < 10) {
|
if( (xctx->graph_flags & 2) && fabs(xctx->mousex - W_X(xctx->graph_cursor1_x)) < 10) {
|
||||||
xctx->graph_flags |= 32; /* Start move cursor2 */
|
xctx->graph_flags |= 16; /* Start move cursor1 */
|
||||||
|
}
|
||||||
|
if( (xctx->graph_flags & 4) && fabs(xctx->mousex - W_X(xctx->graph_cursor2_x)) < 10) {
|
||||||
|
xctx->graph_flags |= 32; /* Start move cursor2 */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(event == -3 && button == Button1) {
|
if(event == -3 && button == Button1) {
|
||||||
if(!edit_wave_attributes(i, gr)) {
|
if(!edit_wave_attributes(1, i, gr)) {
|
||||||
char s[30];
|
char s[30];
|
||||||
my_snprintf(s, S(s), "%d", i);
|
my_snprintf(s, S(s), "%d", i);
|
||||||
tclvareval("graph_edit_properties ", s, NULL);
|
tclvareval("graph_edit_properties ", s, NULL);
|
||||||
}
|
}
|
||||||
setup_graph_data(i, xctx->graph_flags, 0, gr);
|
|
||||||
draw_graph(i, 1 + 8 + (xctx->graph_flags & 6), gr); /* draw data in each graph box */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* x cursor1 toggle */
|
/* x cursor1 toggle */
|
||||||
else if((key == 'a') ) {
|
else if((key == 'a') ) {
|
||||||
|
|
|
||||||
35
src/draw.c
35
src/draw.c
|
|
@ -1677,6 +1677,8 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
|
||||||
double vthl = gr->gy1 * 0.8 + gr->gy2 * 0.2;
|
double vthl = gr->gy1 * 0.8 + gr->gy2 * 0.2;
|
||||||
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
||||||
if(c1 >= gr->ypos1 && c1 <=gr->ypos2) {
|
if(c1 >= gr->ypos1 && c1 <=gr->ypos2) {
|
||||||
|
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
||||||
|
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
||||||
drawline(wave_col, NOW, lx1, ylow, lx2, ylow, 0);
|
drawline(wave_col, NOW, lx1, ylow, lx2, ylow, 0);
|
||||||
drawline(wave_col, NOW, lx1, yhigh, lx2, yhigh, 0);
|
drawline(wave_col, NOW, lx1, yhigh, lx2, yhigh, 0);
|
||||||
for(p = first ; p <= last; p++) {
|
for(p = first ; p <= last; p++) {
|
||||||
|
|
@ -1709,6 +1711,8 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
|
||||||
draw_string(wave_col, NOW, old_busval, 2, 0, 1, 0, (xval + xval_old) * 0.5,
|
draw_string(wave_col, NOW, old_busval, 2, 0, 1, 0, (xval + xval_old) * 0.5,
|
||||||
yhigh, labsize, labsize);
|
yhigh, labsize, labsize);
|
||||||
}
|
}
|
||||||
|
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
||||||
|
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1723,7 +1727,6 @@ static void draw_graph_points(int v, int first, int last,
|
||||||
double s2;
|
double s2;
|
||||||
double c, c1;
|
double c, c1;
|
||||||
register SPICE_DATA *gv = xctx->graph_values[v];
|
register SPICE_DATA *gv = xctx->graph_values[v];
|
||||||
int hilight_wave = -1;
|
|
||||||
|
|
||||||
digital = gr->digital;
|
digital = gr->digital;
|
||||||
if(digital) {
|
if(digital) {
|
||||||
|
|
@ -1747,17 +1750,17 @@ static void draw_graph_points(int v, int first, int last,
|
||||||
}
|
}
|
||||||
/* plot data */
|
/* plot data */
|
||||||
if(xctx->draw_window) {
|
if(xctx->draw_window) {
|
||||||
if(hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
||||||
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
||||||
XDrawLines(display, xctx->window, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
|
XDrawLines(display, xctx->window, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
|
||||||
if(hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
||||||
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
||||||
}
|
}
|
||||||
if(xctx->draw_pixmap) {
|
if(xctx->draw_pixmap) {
|
||||||
if(hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
||||||
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
||||||
XDrawLines(display, xctx->save_pixmap, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
|
XDrawLines(display, xctx->save_pixmap, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
|
||||||
if(hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
|
||||||
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
|
||||||
}
|
}
|
||||||
} else dbg(1, "skipping wave: %s\n", xctx->graph_names[v]);
|
} else dbg(1, "skipping wave: %s\n", xctx->graph_names[v]);
|
||||||
|
|
@ -1854,6 +1857,7 @@ void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr)
|
||||||
xRect *r = &xctx->rect[GRIDLAYER][i];
|
xRect *r = &xctx->rect[GRIDLAYER][i];
|
||||||
|
|
||||||
/* default values */
|
/* default values */
|
||||||
|
gr->hilight_wave = -1;
|
||||||
gr->divx = gr->divy = 5;
|
gr->divx = gr->divy = 5;
|
||||||
gr->subdivx = gr->subdivy = 0;
|
gr->subdivx = gr->subdivy = 0;
|
||||||
gr->digital = 0;
|
gr->digital = 0;
|
||||||
|
|
@ -2181,11 +2185,14 @@ int read_embedded_rawfile(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when double clicking in a graph if this happens on a wave label
|
/* when double clicking in a graph if this happens on a wave label
|
||||||
* look up the wave and call tcl "graph_edit_wave <graph> <wave>"
|
* what == 1:
|
||||||
* with graph index and wave index
|
* look up the wave and call tcl "graph_edit_wave <graph> <wave>"
|
||||||
|
* with graph index and wave index
|
||||||
|
* what == 2:
|
||||||
|
* look up the wave and draw in bold
|
||||||
* return 1 if a wave was found
|
* return 1 if a wave was found
|
||||||
*/
|
*/
|
||||||
int edit_wave_attributes(int i, Graph_ctx *gr)
|
int edit_wave_attributes(int what, int i, Graph_ctx *gr)
|
||||||
{
|
{
|
||||||
char *node = NULL, *color = NULL, *sweep = NULL;
|
char *node = NULL, *color = NULL, *sweep = NULL;
|
||||||
int sweep_idx = 0;
|
int sweep_idx = 0;
|
||||||
|
|
@ -2227,8 +2234,10 @@ int edit_wave_attributes(int i, Graph_ctx *gr)
|
||||||
if(POINTINSIDE(xctx->mousex_snap, xctx->mousey_snap, xt1, yt1, xt2, yt2)) {
|
if(POINTINSIDE(xctx->mousex_snap, xctx->mousey_snap, xt1, yt1, xt2, yt2)) {
|
||||||
char s[30];
|
char s[30];
|
||||||
ret = 1;
|
ret = 1;
|
||||||
my_snprintf(s, S(s), "%d %d", i, wcnt);
|
if(what == 1) {
|
||||||
tclvareval("graph_edit_wave ", s, NULL);
|
my_snprintf(s, S(s), "%d %d", i, wcnt);
|
||||||
|
tclvareval("graph_edit_wave ", s, NULL);
|
||||||
|
} else gr->hilight_wave = wcnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2239,8 +2248,10 @@ int edit_wave_attributes(int i, Graph_ctx *gr)
|
||||||
if(POINTINSIDE(xctx->mousex_snap, xctx->mousey_snap, xt1, yt1, xt2, yt2)) {
|
if(POINTINSIDE(xctx->mousex_snap, xctx->mousey_snap, xt1, yt1, xt2, yt2)) {
|
||||||
char s[50];
|
char s[50];
|
||||||
ret = 1;
|
ret = 1;
|
||||||
my_snprintf(s, S(s), "%d %d", i, wcnt);
|
if(what == 1) {
|
||||||
tclvareval("graph_edit_wave ", s, NULL);
|
my_snprintf(s, S(s), "%d %d", i, wcnt);
|
||||||
|
tclvareval("graph_edit_wave ", s, NULL);
|
||||||
|
} else gr->hilight_wave = wcnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wcnt++;
|
wcnt++;
|
||||||
|
|
|
||||||
|
|
@ -704,6 +704,7 @@ typedef struct {
|
||||||
int unity_suffix;
|
int unity_suffix;
|
||||||
double txtsizelab, digtxtsizelab, txtsizey, txtsizex;
|
double txtsizelab, digtxtsizelab, txtsizey, txtsizex;
|
||||||
int dataset;
|
int dataset;
|
||||||
|
int hilight_wave;
|
||||||
} Graph_ctx;
|
} Graph_ctx;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -1018,7 +1019,7 @@ extern void free_rawfile(int dr);
|
||||||
extern int read_rawfile(const char *f);
|
extern int read_rawfile(const char *f);
|
||||||
extern double get_raw_value(int dataset, int idx, int point);
|
extern double get_raw_value(int dataset, int idx, int point);
|
||||||
extern int schematic_waves_loaded(void);
|
extern int schematic_waves_loaded(void);
|
||||||
extern int edit_wave_attributes(int i, Graph_ctx *gr);
|
extern int edit_wave_attributes(int what, int i, Graph_ctx *gr);
|
||||||
extern void draw_graph(int i, int flags, Graph_ctx *gr);
|
extern void draw_graph(int i, int flags, Graph_ctx *gr);
|
||||||
extern void draw_graph_all(int flags);
|
extern void draw_graph_all(int flags);
|
||||||
extern void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr);
|
extern void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue