use cairo png export if Xrender extensions present (alpha), editprop code for graph node list
This commit is contained in:
parent
904439d751
commit
f5fd1ef352
20
src/draw.c
20
src/draw.c
|
|
@ -47,8 +47,10 @@ int textclip(int x1,int y1,int x2,int y2,
|
|||
|
||||
void print_image()
|
||||
{
|
||||
int save_draw_grid;
|
||||
#if HAS_CAIRO == 0
|
||||
char cmd[PATH_MAX+100];
|
||||
#endif
|
||||
int save_draw_grid;
|
||||
static char lastdir[PATH_MAX] = "";
|
||||
const char *r;
|
||||
|
||||
|
|
@ -77,12 +79,26 @@ void print_image()
|
|||
xctx->draw_pixmap=1;
|
||||
draw();
|
||||
#ifdef __unix__
|
||||
|
||||
#if HAS_CAIRO == 1 /* use cairo native support for png writing, no need to convert
|
||||
* XPM and handles Xrender extensions for transparent embedded images */
|
||||
{
|
||||
cairo_surface_t *png_sfc;
|
||||
png_sfc = cairo_xlib_surface_create(display, xctx->save_pixmap, visual,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
if(xctx->plotfile[0])
|
||||
cairo_surface_write_to_png(png_sfc, xctx->plotfile);
|
||||
else
|
||||
cairo_surface_write_to_png(png_sfc, "plot.png");
|
||||
}
|
||||
#else /* no cairo */
|
||||
XpmWriteFileFromPixmap(display, "plot.xpm", xctx->save_pixmap,0, NULL ); /* .gz ???? */
|
||||
dbg(1, "print_image(): Window image saved\n");
|
||||
if(xctx->plotfile[0]) {
|
||||
my_snprintf(cmd, S(cmd), "convert_to_png plot.xpm {%s}", xctx->plotfile);
|
||||
tcleval(cmd);
|
||||
} else tcleval( "convert_to_png plot.xpm plot.png");
|
||||
#endif
|
||||
#else
|
||||
char *psfile=NULL;
|
||||
create_ps(&psfile, 7);
|
||||
|
|
@ -2291,7 +2307,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
|
|||
} /* for(p = ofs ; p < ofs + xctx->graph_npoints[dset]; p++) */
|
||||
if(first != -1) {
|
||||
if(dataset == -1 || dataset == sweepvar_wrap) {
|
||||
/* plot graph */
|
||||
/* plot graph. Bus bundles are not plotted if graph is not digital.*/
|
||||
if(bus_msb) {
|
||||
if(digital) {
|
||||
draw_graph_bus_points(ntok, n_bits, idx_arr, first, last, wave_color,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,30 @@
|
|||
#include <stdarg.h>
|
||||
#include "xschem.h"
|
||||
|
||||
|
||||
|
||||
int my_strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
while(tolower(*s1) == tolower(*s2)) {
|
||||
if (*s1 == '\0') return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return tolower(*s1) - tolower(*s2);
|
||||
}
|
||||
|
||||
int my_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
if (n == 0) return 0;
|
||||
while(tolower(*s1) == tolower(*s2)) {
|
||||
if (--n == 0) return 0;
|
||||
if (*s1 == '\0') return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return tolower(*s1) - tolower(*s2);
|
||||
}
|
||||
|
||||
char *my_strtok_r(char *str, const char *delim, char **saveptr)
|
||||
{
|
||||
char *tok;
|
||||
|
|
|
|||
|
|
@ -30,14 +30,16 @@ static unsigned int hi_hash(const char *tok)
|
|||
|
||||
if(xctx->sch_path_hash[xctx->currsch] == 0) {
|
||||
str=xctx->sch_path[xctx->currsch];
|
||||
while ( (c = (unsigned char)*str++) )
|
||||
while ( (c = (unsigned char)*str++) ) {
|
||||
hash += (hash << 5) + c;
|
||||
}
|
||||
xctx->sch_path_hash[xctx->currsch] = hash;
|
||||
} else {
|
||||
hash = xctx->sch_path_hash[xctx->currsch];
|
||||
}
|
||||
while ( (c = (unsigned char)*tok++) )
|
||||
while ( (c = (unsigned char)*tok++) ) {
|
||||
hash += (hash << 5) + c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,19 +108,19 @@ proc annotate {} {
|
|||
set type [xschem getprop instance $i cell::type]
|
||||
if { $type == "probe"} {
|
||||
set net [xschem instance_net $i p]
|
||||
if {[catch {xschem setprop $i voltage [get_voltage $net] fast} err]} {
|
||||
if {[catch {xschem setprop instance $i voltage [get_voltage $net] fast} err]} {
|
||||
puts "1 error : $err net: $net"
|
||||
}
|
||||
}
|
||||
if { $type == "current_probe"} {
|
||||
if {[catch {xschem setprop $i current [get_current $name] fast} err]} {
|
||||
if {[catch {xschem setprop instance $i current [get_current $name] fast} err]} {
|
||||
puts "2 error : $err"
|
||||
}
|
||||
}
|
||||
if { $type == "differential_probe"} {
|
||||
set netp [xschem instance_net $i p]
|
||||
set netm [xschem instance_net $i m]
|
||||
if {[catch {xschem setprop $i voltage [get_diff_voltage $netp $netm] fast} err]} {
|
||||
if {[catch {xschem setprop instance $i voltage [get_diff_voltage $netp $netm] fast} err]} {
|
||||
puts "3 error : $err"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,19 +198,19 @@ proc ngspice::annotate {} {
|
|||
set type [xschem getprop instance $i cell::type]
|
||||
if { $type eq {probe} } {
|
||||
set net $path[xschem instance_net $i p]
|
||||
if {[catch {xschem setprop $i voltage [ngspice::get_voltage_probe arr $net] fast} err]} {
|
||||
if {[catch {xschem setprop instance $i voltage [ngspice::get_voltage_probe arr $net] fast} err]} {
|
||||
puts "Warning 1: ${err}, net: $net"
|
||||
}
|
||||
}
|
||||
if { $type eq {current_probe} } {
|
||||
if {[catch {xschem setprop $i current [ngspice::get_curr_probe arr $path$name] fast} err]} {
|
||||
if {[catch {xschem setprop $i instance current [ngspice::get_curr_probe arr $path$name] fast} err]} {
|
||||
puts "Warning 2: $err"
|
||||
}
|
||||
}
|
||||
if { $type eq {differential_probe} } {
|
||||
set netp $path[xschem instance_net $i p]
|
||||
set netm $path[xschem instance_net $i m]
|
||||
if {[catch {xschem setprop $i voltage [ngspice::get_diff_probe arr $netp $netm] fast} err]} {
|
||||
if {[catch {xschem setprop instance $i voltage [ngspice::get_diff_probe arr $netp $netm] fast} err]} {
|
||||
puts "Warning 3: $err"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
170
src/scheduler.c
170
src/scheduler.c
|
|
@ -414,6 +414,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1],"case_insensitive"))
|
||||
{
|
||||
cmd_found = 1;
|
||||
if(argc > 2) {
|
||||
int n = atoi(argv[2]);
|
||||
if(n) {
|
||||
xctx->case_insensitive = 1;
|
||||
xctx->strcmp = my_strcasecmp;
|
||||
} else {
|
||||
xctx->case_insensitive = 0;
|
||||
xctx->strcmp = strcmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!strcmp(argv[1],"check_symbols"))
|
||||
{
|
||||
char sympath[PATH_MAX];
|
||||
|
|
@ -784,10 +798,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[2],"cadlayers")) {
|
||||
char s[30]; /* overflow safe 20161212 */
|
||||
my_snprintf(s, S(s), "%d",cadlayers);
|
||||
Tcl_SetResult(interp, s,TCL_VOLATILE);
|
||||
my_snprintf(s, S(s), "%d", cadlayers);
|
||||
Tcl_SetResult(interp, s, TCL_VOLATILE);
|
||||
}
|
||||
else if(!strcmp(argv[2],"color_ps")) {
|
||||
else if(!strcmp(argv[2], "case_insensitive")) {
|
||||
char s[30];
|
||||
my_snprintf(s, S(s), "%d", xctx->case_insensitive);
|
||||
Tcl_SetResult(interp, s, TCL_VOLATILE);
|
||||
}
|
||||
else if(!strcmp(argv[2], "color_ps")) {
|
||||
if( color_ps != 0 )
|
||||
Tcl_SetResult(interp, "1",TCL_STATIC);
|
||||
else
|
||||
|
|
@ -2067,7 +2086,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_AppendResult(interp, s, NULL);
|
||||
} else if(!strcmp(argv[2], "list")) {
|
||||
for(i = 0 ; i < xctx->graph_nvars; i++) {
|
||||
Tcl_AppendResult(interp, xctx->graph_names[i], "\n", NULL);
|
||||
if(i > 0) Tcl_AppendResult(interp, "\n", NULL);
|
||||
Tcl_AppendResult(interp, xctx->graph_names[i], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2547,73 +2567,117 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
/* 'fast' argument if given does not redraw and is not undoable */
|
||||
else if(!strcmp(argv[1], "setprop"))
|
||||
{
|
||||
/* 0 1 2 3 4 5
|
||||
* xschem setprop R4 value [30k] [fast] */
|
||||
/* 0 1 2 3 4 5 6
|
||||
* xschem setprop instance R4 value [30k] [fast] */
|
||||
int inst, fast=0;
|
||||
|
||||
cmd_found = 1;
|
||||
if(argc >= 6) {
|
||||
if(!strcmp(argv[5], "fast")) {
|
||||
fast = 1;
|
||||
argc = 5;
|
||||
|
||||
if(argc > 2 && !strcmp(argv[2], "instance")) {
|
||||
if(argc >= 7) {
|
||||
if(!strcmp(argv[6], "fast")) {
|
||||
fast = 1;
|
||||
argc = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(argc >= 5) {
|
||||
if(!strcmp(argv[4], "fast")) {
|
||||
fast = 1;
|
||||
argc = 4;
|
||||
else if(argc >= 6) {
|
||||
if(!strcmp(argv[5], "fast")) {
|
||||
fast = 1;
|
||||
argc = 5;
|
||||
}
|
||||
}
|
||||
if(argc < 5) {
|
||||
Tcl_SetResult(interp, "xschem setprop instance needs 2 or 3 additional arguments", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( (inst = get_instance(argv[3])) < 0 ) {
|
||||
Tcl_SetResult(interp, "xschem setprop: instance not found", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
char *type;
|
||||
int cond;
|
||||
if(!fast) {
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
xctx->push_undo();
|
||||
}
|
||||
set_modify(1);
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
if(!strcmp(argv[4], "name")) hash_all_names(inst);
|
||||
if(argc >= 6) {
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5]),fast,
|
||||
tclgetboolvar("disable_unique_names"));
|
||||
} else {/* assume argc == 5 , delete attribute */
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),fast,
|
||||
tclgetboolvar("disable_unique_names"));
|
||||
}
|
||||
type=xctx->sym[xctx->inst[inst].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) xctx->inst[inst].flags|=2;
|
||||
else {
|
||||
xctx->inst[inst].flags &=~2;
|
||||
my_strdup(1215, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0));
|
||||
}
|
||||
|
||||
if(!fast) {
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
/* redraw symbol with new props */
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
}
|
||||
Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE);
|
||||
}
|
||||
} else if(argc > 5 && !strcmp(argv[2], "rect")) {
|
||||
/* 0 1 2 3 4 5 6 7
|
||||
* xschem setprop rect c n token value [fast] */
|
||||
xRect *r;
|
||||
int c = atoi(argv[3]);
|
||||
int n = atoi(argv[4]);
|
||||
|
||||
if (!(c>=0 && c < cadlayers && n >=0 && n < xctx->rects[c]) ) {
|
||||
Tcl_SetResult(interp, "xschem setprop rect: wrong layer or rect number", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
r = &xctx->rect[c][n];
|
||||
if(argc >= 8) {
|
||||
if(!strcmp(argv[7], "fast")) {
|
||||
fast = 1;
|
||||
argc = 7;
|
||||
}
|
||||
}
|
||||
else if(argc >= 7) {
|
||||
if(!strcmp(argv[6], "fast")) {
|
||||
fast = 1;
|
||||
argc = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(argc < 4) {
|
||||
Tcl_SetResult(interp, "xschem setprop needs 2 or 3 additional arguments", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( (inst = get_instance(argv[2])) < 0 ) {
|
||||
Tcl_SetResult(interp, "xschem setprop: instance not found", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
char *type;
|
||||
int cond;
|
||||
if(!fast) {
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
xctx->push_undo();
|
||||
}
|
||||
set_modify(1);
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
if(!strcmp(argv[3], "name")) hash_all_names(inst);
|
||||
if(argc >= 5) {
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),fast,
|
||||
tclgetboolvar("disable_unique_names"));
|
||||
} else {/* assume argc == 4 , delete attribute */
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),fast,
|
||||
tclgetboolvar("disable_unique_names"));
|
||||
}
|
||||
type=xctx->sym[xctx->inst[inst].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) xctx->inst[inst].flags|=2;
|
||||
else {
|
||||
xctx->inst[inst].flags &=~2;
|
||||
my_strdup(1215, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0));
|
||||
}
|
||||
|
||||
if(argc > 6)
|
||||
my_strdup(1478, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6]));
|
||||
else
|
||||
my_strdup(1478, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */
|
||||
if(!fast) {
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
/* redraw symbol with new props */
|
||||
bbox(ADD, r->x1, r->y1, r->x2, r->y2);
|
||||
/* redraw rect with new props */
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE);
|
||||
}
|
||||
else if(!strcmp(argv[1],"show_pin_net_names")) {
|
||||
int i;
|
||||
|
|
|
|||
28
src/token.c
28
src/token.c
|
|
@ -30,29 +30,23 @@ unsigned int str_hash(const char *tok)
|
|||
register unsigned int hash = 5381;
|
||||
register unsigned int c;
|
||||
|
||||
while ( (c = (unsigned char)*tok++) )
|
||||
hash += (hash << 5) + c;
|
||||
while ( (c = (unsigned char)*tok++) ) {
|
||||
hash += (hash << 5) + c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
/* seems unused */
|
||||
int name_strcmp(char *s, char *d) /* compare strings up to '\0' or'[' */
|
||||
{
|
||||
int i=0;
|
||||
while(1)
|
||||
{
|
||||
if(d[i]=='\0' || d[i]=='[')
|
||||
int i=0;
|
||||
while(*s == *d) {
|
||||
{
|
||||
if(s[i]!='\0' && s[i]!='[') return 1;
|
||||
return 0;
|
||||
if(*s == '\0' || *s == '[') return 0;
|
||||
*s++;
|
||||
*d++;
|
||||
}
|
||||
if(s[i]=='\0' || s[i]=='[')
|
||||
{
|
||||
if(d[i]!='\0' && d[i]!='[') return 1;
|
||||
return 0;
|
||||
}
|
||||
if(s[i]!=d[i]) return 1;
|
||||
i++;
|
||||
}
|
||||
return *s1 - *s2
|
||||
}
|
||||
|
||||
/* 20180926 added token_size */
|
||||
|
|
@ -90,7 +84,7 @@ static Inst_hashentry *inst_hash_lookup(char *token, int value, int what, size_t
|
|||
}
|
||||
return NULL; /* token was not in hash */
|
||||
}
|
||||
if( entry->hash==hashcode && !strcmp(token,entry->token) ) { /* found a matching token */
|
||||
if( entry->hash==hashcode && !xctx->strcmp(token,entry->token) ) { /* found a matching token */
|
||||
if(what == XDELETE) { /* remove token from the hash table ... */
|
||||
saveptr=entry->next;
|
||||
my_free(969, &entry);
|
||||
|
|
|
|||
|
|
@ -614,6 +614,8 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
my_strdup2(1296, &xctx->top_path, top_path);
|
||||
my_strdup2(1462, &xctx->current_win_path, win_path);
|
||||
xctx->fill_type=my_calloc(640, cadlayers, sizeof(int));
|
||||
xctx->case_insensitive = 0;
|
||||
xctx->strcmp = strcmp;
|
||||
xctx->fill_pattern = 1;
|
||||
xctx->draw_window = 0;
|
||||
xctx->time_last_modify = 0;
|
||||
|
|
|
|||
|
|
@ -931,6 +931,8 @@ typedef struct {
|
|||
void (*pop_undo)(int, int);
|
||||
void (*delete_undo)(void);
|
||||
void (*clear_undo)(void);
|
||||
int case_insensitive; /* for case insensitive compare where needed */
|
||||
int (*strcmp)(const char *, const char *);
|
||||
} Xschem_ctx;
|
||||
|
||||
/* GLOBAL VARIABLES */
|
||||
|
|
@ -1297,6 +1299,8 @@ extern void my_strndup(int id, char **dest, const char *src, int n);
|
|||
extern size_t my_strdup2(int id, char **dest, const char *src);
|
||||
extern char *my_strtok_r(char *str, const char *delim, char **saveptr);
|
||||
extern int my_strncpy(char *d, const char *s, int n);
|
||||
extern int my_strcasecmp(const char *s1, const char *s2);
|
||||
extern int my_strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
extern char* strtolower(char* s);
|
||||
extern char* strtoupper(char* s);
|
||||
extern void *my_malloc(int id, size_t size);
|
||||
|
|
|
|||
181
src/xschem.tcl
181
src/xschem.tcl
|
|
@ -1283,10 +1283,181 @@ proc waves {} {
|
|||
}
|
||||
}
|
||||
# ============================================================
|
||||
proc graph_edit_properties {n} {
|
||||
|
||||
set data [xschem getprop rect 2 $n node]
|
||||
viewdata $data
|
||||
proc graph_add_nodes {} {
|
||||
global graph_bus
|
||||
set sel_idx [.dialog.center.left.list1 curselection]
|
||||
set sel {}
|
||||
if {$graph_bus} {
|
||||
set sep ,
|
||||
} else {
|
||||
set sep \n
|
||||
}
|
||||
foreach i $sel_idx {
|
||||
if {$sel ne {}} {append sel $sep}
|
||||
append sel [.dialog.center.left.list1 get $i]
|
||||
}
|
||||
if {$graph_bus} {
|
||||
set sel "BUS_NAME,${sel}\n"
|
||||
} else {
|
||||
set sel "${sel}\n"
|
||||
}
|
||||
.dialog.center.right.text1 insert {insert lineend + 1 char} $sel
|
||||
}
|
||||
|
||||
proc graph_get_signal_list {siglist pattern } {
|
||||
global graph_sort
|
||||
set direction {-decreasing}
|
||||
if {$graph_sort} {set direction {-increasing}}
|
||||
set result {}
|
||||
set siglist [join [lsort $direction -dictionary $siglist] \n]
|
||||
set err [catch {regexp $pattern {12345}} res]
|
||||
if {$err} {set pattern {}}
|
||||
foreach i $siglist {
|
||||
regsub {^v\((.*)\)$} $i {\1} i
|
||||
if {[regexp $pattern $i] } {
|
||||
lappend result $i
|
||||
}
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
proc graph_update_nodelist {} {
|
||||
global graph_selected colors graph_sel_color
|
||||
set nodelist [.dialog.center.right.text1 get 1.0 end]
|
||||
# xschem setprop rect 2 $graph_selected node $nodelist
|
||||
|
||||
# tagging nodes in text widget:
|
||||
set col [xschem getprop rect 2 $graph_selected color]
|
||||
set col [string trim $col { }]
|
||||
set tt [.dialog.center.right.text1 search -all -nolinestop -regexp -count cc {[^ \n]+} 1.0]
|
||||
set n 0
|
||||
foreach t $tt c $cc {
|
||||
set curr_color [expr {$n % 18 + 4}]
|
||||
set b [lindex $col $n]
|
||||
if {$b eq {}} {
|
||||
if {$col ne {}} {append col { }}
|
||||
append col $curr_color
|
||||
set b [lindex $colors $curr_color]
|
||||
} else {
|
||||
set b [lindex $colors $b]
|
||||
}
|
||||
.dialog.center.right.text1 tag add t$n $t "$t + $c chars"
|
||||
.dialog.center.right.text1 tag configure t$n -background $b
|
||||
if { $n == 4 || $n == 5 || $n == 12 } {
|
||||
.dialog.center.right.text1 tag configure t$n -foreground black}
|
||||
incr n
|
||||
}
|
||||
|
||||
# get tag the cursor is on:
|
||||
# .dialog.center.right.text1 tag names insert
|
||||
puts $col
|
||||
}
|
||||
|
||||
proc fill_graph_listbox {} {
|
||||
set retval [.dialog.top.e1 get]
|
||||
set retval [graph_get_signal_list [xschem raw_query list] $retval]
|
||||
.dialog.center.left.list1 delete 0 end
|
||||
eval .dialog.center.left.list1 insert 0 $retval
|
||||
}
|
||||
|
||||
proc graph_edit_properties {n} {
|
||||
global graph_bus graph_sort graph_digital graph_selected colors graph_sel_color
|
||||
|
||||
set graph_selected $n
|
||||
set_ne graph_sel_color 4
|
||||
set_ne graph_bus 0
|
||||
set_ne graph_sort 0
|
||||
set graph_digital 0
|
||||
if {[xschem getprop rect 2 $n digital] == 1} {set graph_digital 1}
|
||||
toplevel .dialog
|
||||
frame .dialog.top
|
||||
panedwindow .dialog.center -orient horiz
|
||||
frame .dialog.bottom
|
||||
frame .dialog.center.left
|
||||
frame .dialog.center.right
|
||||
.dialog.center add .dialog.center.left .dialog.center.right
|
||||
pack .dialog.top -side top -fill x
|
||||
pack .dialog.center -side top -fill both -expand yes
|
||||
pack .dialog.bottom -side top -fill x
|
||||
|
||||
# center-left frame
|
||||
label .dialog.center.left.lab1 -text {Signal list}
|
||||
listbox .dialog.center.left.list1 -width 20 -height 10 -selectmode extended \
|
||||
-yscrollcommand {.dialog.center.left.yscroll set} \
|
||||
-xscrollcommand {.dialog.center.left.xscroll set}
|
||||
scrollbar .dialog.center.left.yscroll -command {.dialog.center.left.list1 yview}
|
||||
scrollbar .dialog.center.left.xscroll -orient horiz -command {.dialog.center.left.list1 xview}
|
||||
grid .dialog.center.left.lab1
|
||||
grid .dialog.center.left.list1 .dialog.center.left.yscroll -sticky nsew
|
||||
grid .dialog.center.left.xscroll -sticky nsew
|
||||
grid rowconfig .dialog.center.left 0 -weight 0
|
||||
grid rowconfig .dialog.center.left 1 -weight 1 -minsize 100
|
||||
grid columnconfig .dialog.center.left 0 -weight 1
|
||||
|
||||
# center right frame
|
||||
label .dialog.center.right.lab1 -text {Signals in graph}
|
||||
text .dialog.center.right.text1 -wrap none -height 10 -bg grey50 -fg white -insertbackground grey40 \
|
||||
-yscrollcommand {.dialog.center.right.yscroll set} \
|
||||
-xscrollcommand {.dialog.center.right.xscroll set}
|
||||
scrollbar .dialog.center.right.yscroll -command {.dialog.center.right.text1 yview}
|
||||
scrollbar .dialog.center.right.xscroll -orient horiz -command {.dialog.center.right.text1 xview}
|
||||
|
||||
grid .dialog.center.right.lab1
|
||||
grid .dialog.center.right.text1 .dialog.center.right.yscroll -sticky nsew
|
||||
grid .dialog.center.right.xscroll -sticky nsew
|
||||
grid rowconfig .dialog.center.right 0 -weight 0
|
||||
grid rowconfig .dialog.center.right 1 -weight 1 -minsize 100
|
||||
grid columnconfig .dialog.center.right 0 -weight 1
|
||||
|
||||
|
||||
# bottom frame
|
||||
button .dialog.bottom.ok -text OK -command {
|
||||
graph_update_nodelist
|
||||
# destroy .dialog
|
||||
}
|
||||
pack .dialog.bottom.ok -side left
|
||||
|
||||
for {set i 4} {$i < 22} {incr i} {
|
||||
radiobutton .dialog.bottom.r$i -value $i -bg [lindex $colors $i] -variable graph_sel_color
|
||||
pack .dialog.bottom.r$i -side left
|
||||
}
|
||||
|
||||
# top frame
|
||||
label .dialog.top.l1 -text Search:
|
||||
entry .dialog.top.e1 -width 20
|
||||
checkbutton .dialog.top.c1 -text bus -variable graph_bus
|
||||
checkbutton .dialog.top.c2 -text {Increasing sort} -variable graph_sort -indicatoron 1 \
|
||||
-command fill_graph_listbox
|
||||
checkbutton .dialog.top.c3 -text {Digital} -variable graph_digital -indicatoron 1 \
|
||||
-command {xschem setprop rect 2 $graph_selected digital $graph_digital}
|
||||
|
||||
button .dialog.top.b1 -text Clear -command {
|
||||
.dialog.top.e1 delete 0 end
|
||||
fill_graph_listbox
|
||||
}
|
||||
button .dialog.top.b2 -text Add -command {graph_add_nodes}
|
||||
pack .dialog.top.l1 .dialog.top.e1 .dialog.top.b1 .dialog.top.b2 .dialog.top.c1 -side left
|
||||
pack .dialog.top.c2 .dialog.top.c3 -side left
|
||||
|
||||
# binding
|
||||
bind .dialog.top.e1 <KeyRelease> {
|
||||
fill_graph_listbox
|
||||
}
|
||||
|
||||
# fill data in left listbox
|
||||
eval .dialog.center.left.list1 insert 0 [graph_get_signal_list [xschem raw_query list] {}]
|
||||
|
||||
# fill data in right textbox
|
||||
set plotted_nodes [xschem getprop rect 2 $n node]
|
||||
if {[string index $plotted_nodes end] ne {\n}} {append plotted_nodes \n}
|
||||
.dialog.center.right.text1 insert 1.0 $plotted_nodes
|
||||
|
||||
# add stuff in textbox at end of line + 1 char (after newline)
|
||||
# .dialog.center.right.text1 insert {insert lineend + 1 char} foo\n
|
||||
|
||||
|
||||
# tkwait window .dialog
|
||||
}
|
||||
|
||||
proc graph_show_measure {{action show}} {
|
||||
|
|
@ -3940,7 +4111,9 @@ set tctx::global_list {
|
|||
dark_colorscheme dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window
|
||||
edit_prop_pos edit_prop_size editprop_sympath edit_symbol_prop_new_sel enable_dim_bg enable_stretch
|
||||
en_hilight_conn_inst filetmp
|
||||
flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter hide_empty_graphs hide_symbols hsize hspice_netlist
|
||||
flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter graph_bus graph_digital
|
||||
graph_sel_color graph_selected graph_sort
|
||||
hide_empty_graphs hide_symbols hsize hspice_netlist
|
||||
incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR
|
||||
input_line_cmd input_line_data launcher_default_program light_colors line_width local_netlist_dir
|
||||
measure_text
|
||||
|
|
|
|||
Loading…
Reference in New Issue