proc graph_edit_properties: add another row of buttons, added legend text size textbox, separated from y label text size
This commit is contained in:
parent
69c02e1f54
commit
933805fded
13
src/draw.c
13
src/draw.c
|
|
@ -3197,7 +3197,7 @@ void setup_graph_data(int i, int skip, Graph_ctx *gr)
|
|||
|
||||
dbg(1, "setup_graph_data: i=%d\n", i);
|
||||
/* default values */
|
||||
gr->magx = gr->magy = 1.0;
|
||||
gr->magx = gr->magy = gr->maglegend = 1.0;
|
||||
gr->divx = gr->divy = 5;
|
||||
gr->subdivx = gr->subdivy = 0;
|
||||
gr->logx = gr->logy = 0;
|
||||
|
|
@ -3235,6 +3235,7 @@ void setup_graph_data(int i, int skip, Graph_ctx *gr)
|
|||
gr->txtsizelab = 0.3;
|
||||
gr->txtsizex = 0.3;
|
||||
gr->txtsizey = 0.3;
|
||||
gr->txtsizelegend = 0.3;
|
||||
|
||||
/* container (embedding rectangle) coordinates */
|
||||
gr->rx1 = r->x1;
|
||||
|
|
@ -3289,6 +3290,8 @@ void setup_graph_data(int i, int skip, Graph_ctx *gr)
|
|||
if(val[0]) gr->magx = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"ylabmag", 0);
|
||||
if(val[0]) gr->magy = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"legendmag", 0);
|
||||
if(val[0]) gr->maglegend = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"subdivx", 0);
|
||||
if(val[0]) gr->subdivx = atoi(val);
|
||||
val = get_tok_value(r->prop_ptr,"subdivy", 0);
|
||||
|
|
@ -3371,6 +3374,11 @@ void setup_graph_data(int i, int skip, Graph_ctx *gr)
|
|||
if(tmp < gr->txtsizex) gr->txtsizex = tmp;
|
||||
gr->txtsizex *= gr->magx;
|
||||
|
||||
/* signal names (legend) size. */
|
||||
gr->txtsizelegend = gr->h * 0.00095;
|
||||
gr->txtsizelegend *= gr->maglegend;
|
||||
dbg(1, "setup_graph_data(): txtsizelegend=%g, maglegend=%g\n", gr->txtsizelegend, gr->maglegend);
|
||||
|
||||
/* cache coefficients for faster graph --> xschem coord transformations */
|
||||
gr->cx = gr->w / gr->gw;
|
||||
gr->dx = gr->x1 - gr->gx1 * gr->cx;
|
||||
|
|
@ -3578,8 +3586,9 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee
|
|||
#endif
|
||||
dbg(1, "%g %g %s\n", xt, yt, tmpstr);
|
||||
my_snprintf(tmpstr, S(tmpstr), "%s", str_replace(tmpstr, "\\ ", " ", 0, -1));
|
||||
dbg(1, "txtsizelegend=%g\n", gr->txtsizelegend);
|
||||
draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0,
|
||||
xt, yt, gr->txtsizey * gr->magy * 0.4, gr->txtsizey * gr->magy * 0.4);
|
||||
xt, yt, gr->txtsizelegend, gr->txtsizelegend);
|
||||
#if HAS_CAIRO == 1
|
||||
if(gr->hilight_wave == wcnt) {
|
||||
xctx->cairo_font =
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
"subdivx=1\n"
|
||||
"xlabmag=1.0\n"
|
||||
"ylabmag=1.0\n"
|
||||
"legendmag=1.0\n"
|
||||
"node=\"\"\n"
|
||||
"color=\"\"\n"
|
||||
"dataset=-1\n"
|
||||
|
|
|
|||
|
|
@ -892,12 +892,12 @@ typedef struct {
|
|||
double dscy, dsdy;
|
||||
int divx, divy;
|
||||
int subdivx, subdivy;
|
||||
double magx, magy;
|
||||
double magx, magy, maglegend;
|
||||
double unitx, unity;
|
||||
int unitx_suffix; /* 'n' or 'u' or 'M' or 'k' ... */
|
||||
int unity_suffix;
|
||||
int mode; /* default:0 0:Line, 1:HistoV, 2:HistoH */
|
||||
double txtsizelab, digtxtsizelab, txtsizey, txtsizex;
|
||||
double txtsizelab, digtxtsizelab, txtsizey, txtsizex, txtsizelegend;
|
||||
int dataset;
|
||||
int hilight_wave; /* wave index */
|
||||
int logx, logy;
|
||||
|
|
|
|||
|
|
@ -3479,6 +3479,7 @@ proc graph_edit_properties {n} {
|
|||
frame .graphdialog.top2
|
||||
frame .graphdialog.top3
|
||||
frame .graphdialog.top4
|
||||
frame .graphdialog.top5
|
||||
panedwindow .graphdialog.center -orient horiz
|
||||
frame .graphdialog.bottom
|
||||
frame .graphdialog.center.left
|
||||
|
|
@ -3488,6 +3489,7 @@ proc graph_edit_properties {n} {
|
|||
pack .graphdialog.top2 -side top -fill x
|
||||
pack .graphdialog.top3 -side top -fill x
|
||||
pack .graphdialog.top4 -side top -fill x
|
||||
pack .graphdialog.top5 -side top -fill x
|
||||
pack .graphdialog.center -side top -fill both -expand yes
|
||||
pack .graphdialog.bottom -side top -fill x
|
||||
# center-left frame
|
||||
|
|
@ -3655,7 +3657,7 @@ proc graph_edit_properties {n} {
|
|||
pack .graphdialog.top4.r$i -side left
|
||||
}
|
||||
|
||||
checkbutton .graphdialog.top.legend -text {Legend} -variable graph_legend -indicatoron 1 \
|
||||
checkbutton .graphdialog.top5.legend -text {Legend} -variable graph_legend -indicatoron 1 \
|
||||
-command {
|
||||
if { [xschem get schname] eq $graph_schname } {
|
||||
graph_push_undo
|
||||
|
|
@ -3665,7 +3667,7 @@ proc graph_edit_properties {n} {
|
|||
}
|
||||
|
||||
# top2 frame
|
||||
checkbutton .graphdialog.top2.vlegend -text {V. legend} -variable graph_vlegend -indicatoron 1 \
|
||||
checkbutton .graphdialog.top5.vlegend -text {V. legend} -variable graph_vlegend -indicatoron 1 \
|
||||
-command {
|
||||
if { [xschem get schname] eq $graph_schname } {
|
||||
graph_push_undo
|
||||
|
|
@ -3785,9 +3787,41 @@ proc graph_edit_properties {n} {
|
|||
if {$graph_mode eq {}} { set graph_mode Line}
|
||||
.graphdialog.top2.mode set $graph_mode
|
||||
|
||||
pack .graphdialog.top2.vlegend .graphdialog.top2.labunitx .graphdialog.top2.unitx \
|
||||
label .graphdialog.top5.legendlabmag -text { Legend mag:}
|
||||
entry .graphdialog.top5.legendmag -width 4
|
||||
entry_replace_selection .graphdialog.top5.legendmag
|
||||
bind .graphdialog.top5.legendmag <KeyRelease> {
|
||||
graph_push_undo
|
||||
xschem setprop rect 2 $graph_selected legendmag [.graphdialog.top5.legendmag get]
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
label .graphdialog.top5.xlabmag -text { X/Y lab mag:}
|
||||
entry .graphdialog.top5.xmag -width 4
|
||||
entry_replace_selection .graphdialog.top5.xmag
|
||||
bind .graphdialog.top5.xmag <KeyRelease> {
|
||||
graph_push_undo
|
||||
xschem setprop rect 2 $graph_selected xlabmag [.graphdialog.top5.xmag get]
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
label .graphdialog.top5.ylabmag -text { }
|
||||
entry .graphdialog.top5.ymag -width 4
|
||||
entry_replace_selection .graphdialog.top5.ymag
|
||||
bind .graphdialog.top5.ymag <KeyRelease> {
|
||||
graph_push_undo
|
||||
xschem setprop rect 2 $graph_selected ylabmag [.graphdialog.top5.ymag get]
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
pack .graphdialog.top2.labunitx .graphdialog.top2.unitx \
|
||||
.graphdialog.top2.labunity .graphdialog.top2.unity -side left
|
||||
|
||||
pack .graphdialog.top5.legend \
|
||||
.graphdialog.top5.vlegend .graphdialog.top5.legendlabmag .graphdialog.top5.legendmag \
|
||||
.graphdialog.top5.xlabmag .graphdialog.top5.xmag .graphdialog.top5.ylabmag .graphdialog.top5.ymag \
|
||||
-side left
|
||||
|
||||
pack .graphdialog.top2.labdivx .graphdialog.top2.divx \
|
||||
.graphdialog.top2.labdivy .graphdialog.top2.divy \
|
||||
.graphdialog.top2.labsubdivx .graphdialog.top2.subdivx \
|
||||
|
|
@ -3881,26 +3915,7 @@ proc graph_edit_properties {n} {
|
|||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
label .graphdialog.top3.xlabmag -text { X/Y lab mag:}
|
||||
entry .graphdialog.top3.xmag -width 4
|
||||
entry_replace_selection .graphdialog.top3.xmag
|
||||
bind .graphdialog.top3.xmag <KeyRelease> {
|
||||
graph_push_undo
|
||||
xschem setprop rect 2 $graph_selected xlabmag [.graphdialog.top3.xmag get]
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
label .graphdialog.top3.ylabmag -text { }
|
||||
entry .graphdialog.top3.ymag -width 4
|
||||
entry_replace_selection .graphdialog.top3.ymag
|
||||
bind .graphdialog.top3.ymag <KeyRelease> {
|
||||
graph_push_undo
|
||||
xschem setprop rect 2 $graph_selected ylabmag [.graphdialog.top3.ymag get]
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
|
||||
pack .graphdialog.top.legend -side left
|
||||
pack .graphdialog.top.incr -side left
|
||||
pack .graphdialog.top.bus -side left
|
||||
pack .graphdialog.top.priv_curs -side left
|
||||
|
|
@ -3915,8 +3930,9 @@ proc graph_edit_properties {n} {
|
|||
.graphdialog.top3.ymax insert 0 [xschem getprop rect 2 $graph_selected y2]
|
||||
.graphdialog.top3.xmin insert 0 [xschem getprop rect 2 $graph_selected x1]
|
||||
.graphdialog.top3.xmax insert 0 [xschem getprop rect 2 $graph_selected x2]
|
||||
.graphdialog.top3.xmag insert 0 [xschem getprop rect 2 $graph_selected xlabmag]
|
||||
.graphdialog.top3.ymag insert 0 [xschem getprop rect 2 $graph_selected ylabmag]
|
||||
.graphdialog.top5.xmag insert 0 [xschem getprop rect 2 $graph_selected xlabmag]
|
||||
.graphdialog.top5.ymag insert 0 [xschem getprop rect 2 $graph_selected ylabmag]
|
||||
.graphdialog.top5.legendmag insert 0 [xschem getprop rect 2 $graph_selected legendmag]
|
||||
|
||||
# top3 frame
|
||||
set graph_rainbow [xschem getprop rect 2 $graph_selected rainbow]
|
||||
|
|
@ -3973,8 +3989,10 @@ proc graph_edit_properties {n} {
|
|||
pack .graphdialog.top3.logx .graphdialog.top3.logy \
|
||||
.graphdialog.top3.xlabmin .graphdialog.top3.xmin .graphdialog.top3.xlabmax .graphdialog.top3.xmax \
|
||||
.graphdialog.top3.ylabmin .graphdialog.top3.ymin .graphdialog.top3.ylabmax .graphdialog.top3.ymax \
|
||||
.graphdialog.top3.xlabmag .graphdialog.top3.xmag .graphdialog.top3.ylabmag .graphdialog.top3.ymag \
|
||||
-fill x -expand yes -side left
|
||||
|
||||
pack .graphdialog.top5.xlabmag .graphdialog.top5.xmag .graphdialog.top5.ylabmag .graphdialog.top5.ymag \
|
||||
-side left
|
||||
# binding
|
||||
bind .graphdialog.center.left.search <KeyRelease> {
|
||||
graph_fill_listbox
|
||||
|
|
|
|||
Loading…
Reference in New Issue