do not accept 0 in graph `X div` and `Y div` textboxes, as this will cause an endless loop
This commit is contained in:
parent
9e888b8b44
commit
bd8c1fd6eb
|
|
@ -1574,6 +1574,7 @@ static double axis_increment(double a, double b, int div, int freq)
|
|||
if(div == 1) {
|
||||
return delta;
|
||||
}
|
||||
if(div < 1) div = 1;
|
||||
if(delta == 0.0) return delta;
|
||||
/* if user wants only one division, just do what user asks */
|
||||
if(div == 1) return delta;
|
||||
|
|
@ -1597,6 +1598,7 @@ static double axis_increment(double a, double b, int div, int freq)
|
|||
|
||||
static double axis_start(double n, double delta, int div)
|
||||
{
|
||||
if(div < 1) div = 1;
|
||||
if(delta == 0.0) return n;
|
||||
/* if user wants only one division, just do what user asks */
|
||||
if(div == 1) return n;
|
||||
|
|
@ -1995,8 +1997,10 @@ void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr)
|
|||
if(val[0]) gr->subdivy = atoi(val);
|
||||
val = get_tok_value(r->prop_ptr,"divx",0);
|
||||
if(val[0]) gr->divx = atoi(val);
|
||||
if(gr->divx < 1) gr->divx = 1;
|
||||
val = get_tok_value(r->prop_ptr,"divy",0);
|
||||
if(val[0]) gr->divy = atoi(val);
|
||||
if(gr->divy < 1) gr->divy = 1;
|
||||
val = get_tok_value(r->prop_ptr,"y1",0);
|
||||
if(val[0]) gr->gy1 = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"y2",0);
|
||||
|
|
|
|||
|
|
@ -1582,6 +1582,18 @@ proc update_graph_node {node} {
|
|||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
proc update_div {graph_selected div} {
|
||||
set divis [.graphdialog.top2.$div get]
|
||||
if {[regexp {^[0-9]+$} $divis] && $divis < 1} {
|
||||
set divis 1
|
||||
.graphdialog.top2.$div delete 0 end
|
||||
.graphdialog.top2.$div insert 0 $divis
|
||||
}
|
||||
xschem setprop rect 2 $graph_selected $div $divis
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
|
||||
proc graph_edit_properties {n} {
|
||||
global graph_bus graph_sort graph_digital graph_selected colors graph_sel_color
|
||||
global graph_unlocked graph_schname
|
||||
|
|
@ -1727,15 +1739,13 @@ proc graph_edit_properties {n} {
|
|||
label .graphdialog.top2.labdivx -text { X div.}
|
||||
entry .graphdialog.top2.divx -width 2
|
||||
bind .graphdialog.top2.divx <KeyRelease> {
|
||||
xschem setprop rect 2 $graph_selected divx [.graphdialog.top2.divx get]
|
||||
xschem draw_graph $graph_selected
|
||||
update_div $graph_selected divx
|
||||
}
|
||||
|
||||
label .graphdialog.top2.labdivy -text { Y div.}
|
||||
entry .graphdialog.top2.divy -width 2
|
||||
bind .graphdialog.top2.divy <KeyRelease> {
|
||||
xschem setprop rect 2 $graph_selected divy [.graphdialog.top2.divy get]
|
||||
xschem draw_graph $graph_selected
|
||||
update_div $graph_selected divy
|
||||
}
|
||||
|
||||
label .graphdialog.top2.labsubdivx -text { X subdiv.}
|
||||
|
|
|
|||
Loading…
Reference in New Issue