Merge branch 'master' into SuperChayan
This commit is contained in:
commit
d32c684c3c
|
|
@ -2592,6 +2592,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
#endif
|
||||
char *estr = NULL;
|
||||
|
||||
xctx->show_hidden_texts = tclgetboolvar("show_hidden_texts");
|
||||
boundbox->x1=-100;
|
||||
boundbox->x2=100;
|
||||
boundbox->y1=-100;
|
||||
|
|
|
|||
|
|
@ -4777,7 +4777,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2,
|
|||
cairo_surface_t *png_sfc;
|
||||
int save, save_draw_window, save_draw_grid, rwi, rhi;
|
||||
size_t olength;
|
||||
const double max_size = 3000.0;
|
||||
const double max_size = 2500.0;
|
||||
|
||||
if(!has_x) return;
|
||||
|
||||
|
|
@ -4792,9 +4792,9 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2,
|
|||
rw = fabs(rx2 -rx1);
|
||||
rh = fabs(ry2 - ry1);
|
||||
scale = 3.0;
|
||||
if(rw > rh && rw > max_size) {
|
||||
if(rw > rh && rw * scale > max_size) {
|
||||
scale = max_size / rw;
|
||||
} else if(rh > max_size) {
|
||||
} else if(rh * scale > max_size) {
|
||||
scale = max_size / rh;
|
||||
}
|
||||
rwi = (int) (rw * scale + 1.0);
|
||||
|
|
@ -4882,7 +4882,6 @@ void draw(void)
|
|||
#endif
|
||||
|
||||
dbg(1, "draw()\n");
|
||||
|
||||
|
||||
if(!xctx || xctx->no_draw) return;
|
||||
cs = tclgetdoublevar("cadsnap");
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ static int ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, doubl
|
|||
double rw, rh, scale;
|
||||
cairo_surface_t* png_sfc;
|
||||
int save, save_draw_window, save_draw_grid, rwi, rhi;
|
||||
const double max_size = 3000.0;
|
||||
const double max_size = 2500.0;
|
||||
int d_c;
|
||||
unsigned char* jpgData = NULL;
|
||||
size_t fileSize = 0;
|
||||
|
|
@ -292,10 +292,10 @@ static int ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, doubl
|
|||
rw = fabs(rx2 - rx1);
|
||||
rh = fabs(ry2 - ry1);
|
||||
scale = 3.0;
|
||||
if (rw > rh && rw > max_size) {
|
||||
if (rw > rh && rw * scale > max_size) {
|
||||
scale = max_size / rw;
|
||||
}
|
||||
else if (rh > max_size) {
|
||||
else if (rh * scale > max_size) {
|
||||
scale = max_size / rh;
|
||||
}
|
||||
rwi = (int)(rw * scale + 1.0);
|
||||
|
|
|
|||
56
src/save.c
56
src/save.c
|
|
@ -3446,6 +3446,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
{
|
||||
FILE *fd;
|
||||
char name[PATH_MAX];
|
||||
char *ffname = NULL; /*copy of fname so I can change it */
|
||||
char msg[PATH_MAX+100];
|
||||
struct stat buf;
|
||||
int i, ret = 1; /* success */
|
||||
|
|
@ -3454,24 +3455,31 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
my_strdup2(_ALLOC_ID_, &ffname, trim_chars(fname, " \t\n"));
|
||||
if(reset_undo) {
|
||||
xctx->clear_undo();
|
||||
xctx->prev_set_modify = -1; /* will force set_modify(0) to set window title */
|
||||
}
|
||||
else xctx->prev_set_modify = 0; /* will prevent set_modify(0) from setting window title */
|
||||
if(fname && fname[0]) {
|
||||
if(ffname && ffname[0]) {
|
||||
int generator = 0;
|
||||
if(is_generator(fname)) generator = 1;
|
||||
my_strncpy(name, fname, S(name));
|
||||
dbg(1, "load_schematic(): fname=%s\n", fname);
|
||||
/* if ffname is a generator add () at end of filename if not already present */
|
||||
tclvareval("is_xschem_file {", ffname, "}", NULL);
|
||||
if(!strcmp(tclresult(), "GENERATOR")) {
|
||||
size_t len = strlen(ffname);
|
||||
if( ffname[len - 1] != ')') my_strcat(_ALLOC_ID_, &ffname, "()");
|
||||
}
|
||||
if(is_generator(ffname)) generator = 1;
|
||||
my_strncpy(name, ffname, S(name));
|
||||
dbg(1, "load_schematic(): name=%s generator=%d\n", name, generator);
|
||||
/* remote web object specified */
|
||||
if(is_from_web(fname) && xschem_web_dirname[0]) {
|
||||
if(is_from_web(ffname) && xschem_web_dirname[0]) {
|
||||
/* download into ${XSCHEM_TMP_DIR}/xschem_web */
|
||||
tclvareval("download_url {", fname, "}", NULL);
|
||||
tclvareval("download_url {", ffname, "}", NULL);
|
||||
/* build local file name of downloaded object */
|
||||
my_snprintf(name, S(name), "%s/%s", xschem_web_dirname, get_cell_w_ext(fname, 0));
|
||||
my_snprintf(name, S(name), "%s/%s", xschem_web_dirname, get_cell_w_ext(ffname, 0));
|
||||
/* build current_dirname by stripping off last filename from url */
|
||||
my_snprintf(msg, S(msg), "get_directory {%s}", fname);
|
||||
my_snprintf(msg, S(msg), "get_directory {%s}", ffname);
|
||||
my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname));
|
||||
/* local file name */
|
||||
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], name);
|
||||
|
|
@ -3482,29 +3490,32 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
/* ... but not local file from web download --> reset current_dirname */
|
||||
char sympath[PATH_MAX];
|
||||
my_snprintf(sympath, S(sympath), "%s", xschem_web_dirname);
|
||||
/* fname does not begin with $XSCHEM_TMP_DIR/xschem_web and fname does not exist */
|
||||
/* ffname does not begin with $XSCHEM_TMP_DIR/xschem_web and ffname does not exist */
|
||||
|
||||
if(strstr(fname, sympath) != fname /* && stat(fname, &buf)*/) {
|
||||
my_snprintf(msg, S(msg), "get_directory {%s}", fname);
|
||||
if(strstr(ffname, sympath) != ffname /* && stat(ffname, &buf)*/) {
|
||||
my_snprintf(msg, S(msg), "get_directory {%s}", ffname);
|
||||
my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname));
|
||||
}
|
||||
/* local file name */
|
||||
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], fname);
|
||||
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], ffname);
|
||||
/* local relative reference */
|
||||
my_strncpy(xctx->current_name, rel_sym_path(fname), S(xctx->current_name));
|
||||
my_strncpy(xctx->current_name, rel_sym_path(ffname), S(xctx->current_name));
|
||||
} else { /* local file specified and not coming from web url */
|
||||
/* build current_dirname by stripping off last filename from url */
|
||||
my_snprintf(msg, S(msg), "get_directory {%s}", fname);
|
||||
my_snprintf(msg, S(msg), "get_directory {%s}", ffname);
|
||||
my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname));
|
||||
/* local file name */
|
||||
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], fname);
|
||||
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], ffname);
|
||||
/* local relative reference */
|
||||
my_strncpy(xctx->current_name, rel_sym_path(fname), S(xctx->current_name));
|
||||
my_strncpy(xctx->current_name, rel_sym_path(ffname), S(xctx->current_name));
|
||||
}
|
||||
|
||||
dbg(1, "load_schematic(): opening file for loading:%s, fname=%s\n", name, fname);
|
||||
dbg(1, "load_schematic(): opening file for loading:%s, ffname=%s\n", name, ffname);
|
||||
dbg(1, "load_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch]);
|
||||
if(!name[0]) return 0; /* empty filename */
|
||||
if(!name[0]) {
|
||||
my_free(_ALLOC_ID_, &ffname);
|
||||
return 0; /* empty filename */
|
||||
}
|
||||
if(reset_undo) {
|
||||
if(!stat(name, &buf)) { /* file exists */
|
||||
xctx->time_last_modify = buf.st_mtime;
|
||||
|
|
@ -3515,7 +3526,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
} else {xctx->time_last_modify = 0;} /* undefined */
|
||||
if(generator) {
|
||||
char *cmd;
|
||||
cmd = get_generator_command(fname);
|
||||
cmd = get_generator_command(ffname);
|
||||
if(cmd) {
|
||||
fd = popen(cmd, "r");
|
||||
my_free(_ALLOC_ID_, &cmd);
|
||||
|
|
@ -3526,9 +3537,9 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
size_t len;
|
||||
ret = 0;
|
||||
if(alert) {
|
||||
fprintf(errfp, "load_schematic(): unable to open file: %s, fname=%s\n", name, fname );
|
||||
fprintf(errfp, "load_schematic(): unable to open file: %s, ffname=%s\n", name, ffname );
|
||||
if(has_x) {
|
||||
my_snprintf(msg, S(msg), "update; alert_ {Unable to open file: %s}", fname);
|
||||
my_snprintf(msg, S(msg), "update; alert_ {Unable to open file: %s}", ffname);
|
||||
tcleval(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -3567,7 +3578,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
}
|
||||
}
|
||||
dbg(1, "load_schematic(): %s, returning\n", xctx->sch[xctx->currsch]);
|
||||
} else { /* fname == NULL or empty */
|
||||
} else { /* ffname == NULL or empty */
|
||||
/* if(reset_undo) xctx->time_last_modify = time(NULL); */ /* no file given, set mtime to current time */
|
||||
if(reset_undo) xctx->time_last_modify = 0; /* no file given, set mtime to 0 (undefined) */
|
||||
clear_drawing();
|
||||
|
|
@ -3602,6 +3613,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
|
|||
set_netlist_dir(2, NULL);
|
||||
drc_check(-1);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &ffname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ void hier_psprint(char **res, int what) /* netlister driver */
|
|||
xctx->prev_set_modify = save_prev_mod;
|
||||
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
|
||||
xctx->do_copy_area = save;
|
||||
if(what & 1) ps_draw(4, 1, 0); /* trailer */
|
||||
zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
|
||||
draw();
|
||||
if(what & 1) ps_draw(4, 1, 0); /* trailer */
|
||||
}
|
||||
|
||||
static char *model_name_result = NULL; /* safe even with multiple schematics */
|
||||
|
|
|
|||
|
|
@ -2188,6 +2188,8 @@ void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h)
|
|||
#else
|
||||
XWindowAttributes wattr;
|
||||
#endif
|
||||
dbg(1, "resetwin(): create=%d, clear=%d, force=%d, w=%d, h=%d\n",
|
||||
create_pixmap, clear_pixmap, force, w, h);
|
||||
if(w && h) {
|
||||
width = w;
|
||||
height = h;
|
||||
|
|
|
|||
|
|
@ -1799,6 +1799,8 @@ proc cellview_setlabels {w symbol derived_symbol} {
|
|||
if { $sym_spice_sym_def eq {}} {
|
||||
if { ![file exists [abs_sym_path [$w get]]] } {
|
||||
$w configure -bg $missingbg
|
||||
} elseif {$new_sch ne $default_sch } {
|
||||
$w configure -bg $symbg
|
||||
}
|
||||
}
|
||||
puts ===============
|
||||
|
|
@ -1814,7 +1816,7 @@ proc cellview_setlabels {w symbol derived_symbol} {
|
|||
xschem set schsymbolprop $newprop
|
||||
xschem set_modify 3 ;# set only modified flag to force a save, do not update window/tab titles
|
||||
xschem save fast
|
||||
xschem remove_symbols ;# purge all symbols to force a reload from disk
|
||||
# xschem remove_symbols ;# purge all symbols to force a reload from disk
|
||||
xschem load -keep_symbols -nodraw -noundoreset $current
|
||||
xschem netlist -keep_symbols -noalert;# traverse the hierarchy and retain all encountered symbols
|
||||
puts "get netlist"
|
||||
|
|
@ -1834,7 +1836,6 @@ proc cellview_edit_item {symbol w} {
|
|||
} elseif { $sym_spice_sym_def eq {}} {
|
||||
xschem load_new_window [$w get]
|
||||
} else {
|
||||
puts $symbol
|
||||
set current [xschem get current_name]
|
||||
set old_sym_def [xschem getprop symbol $symbol spice_sym_def 2]
|
||||
set new_sym_def [editdata $sym_spice_sym_def {Symbol spice_sym_def attribute}]
|
||||
|
|
@ -1906,15 +1907,17 @@ proc cellview { {derived_symbols {}} {upd 0} } {
|
|||
}
|
||||
|
||||
set syms [join [lsort -index 1 [xschem symbols $derived_symbols]]]
|
||||
# puts "syms=$syms"
|
||||
foreach {i symbol} $syms {
|
||||
if { [catch {set base_name [xschem symbol_base_name $symbol]}] } {
|
||||
set base_name $symbol
|
||||
}
|
||||
# puts "i=$i, symbol=$symbol"
|
||||
set derived_symbol 0
|
||||
if {$base_name ne {}} {
|
||||
set derived_symbol 1
|
||||
}
|
||||
if { [catch {set abs_sch [xschem get_sch_from_sym -1 $symbol]} ]} {
|
||||
if { [catch {xschem get_sch_from_sym -1 $symbol} abs_sch ]} {
|
||||
set abs_sch [abs_sym_path [add_ext $symbol .sch]]
|
||||
}
|
||||
if {$derived_symbol} {
|
||||
|
|
@ -1931,6 +1934,9 @@ proc cellview { {derived_symbols {}} {upd 0} } {
|
|||
}
|
||||
if {$skip} { continue }
|
||||
set sym_sch [rel_sym_path $abs_sch]
|
||||
if {[catch {xschem getprop symbol $symbol type} type]} {
|
||||
puts "error: $symbol not found: $type"
|
||||
}
|
||||
set type [xschem getprop symbol $symbol type]
|
||||
set sym_spice_sym_def [xschem getprop symbol $symbol spice_sym_def 2]
|
||||
if {$type eq {subcircuit}} {
|
||||
|
|
@ -1986,7 +1992,7 @@ proc cellview { {derived_symbols {}} {upd 0} } {
|
|||
if {$upd} {return}
|
||||
|
||||
frame .cv.bottom
|
||||
button .cv.bottom.update -text Update -command "cellview $derived_symbols 1"
|
||||
button .cv.bottom.update -text Update -command "cellview [list $derived_symbols] 1"
|
||||
pack .cv.bottom.update -side left
|
||||
label .cv.bottom.status -text {STATUS LINE}
|
||||
pack .cv.bottom.status -fill x -expand yes
|
||||
|
|
@ -2955,6 +2961,14 @@ proc touches {sel tag} {
|
|||
return $res
|
||||
}
|
||||
|
||||
proc set_graph_default_colors {} {
|
||||
global graph_selected graph_schname
|
||||
if { [xschem get schname] ne $graph_schname } return
|
||||
xschem setprop -fast rect 2 $graph_selected color "4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21"
|
||||
graph_update_nodelist
|
||||
xschem draw_graph $graph_selected
|
||||
}
|
||||
|
||||
# change color of selected wave in text widget and redraw graph
|
||||
# OR
|
||||
# change color attribute of wave given as parameter, redraw graph
|
||||
|
|
@ -3346,13 +3360,13 @@ proc graph_edit_properties {n} {
|
|||
grid columnconfig .graphdialog.center.right 5 -weight 0
|
||||
|
||||
# bottom frame
|
||||
button .graphdialog.bottom.cancel -text Cancel -command {
|
||||
button .graphdialog.bottom.cancel -padx 1 -borderwidth 1 -pady 0 -text Cancel -command {
|
||||
set graph_dialog_default_geometry [winfo geometry .graphdialog]
|
||||
destroy .graphdialog
|
||||
set graph_selected {}
|
||||
set graph_schname {}
|
||||
}
|
||||
button .graphdialog.bottom.ok -text OK -command {
|
||||
button .graphdialog.bottom.ok -padx 1 -borderwidth 1 -pady 0 -text OK -command {
|
||||
if { [xschem get schname] eq $graph_schname } {
|
||||
graph_push_undo
|
||||
graph_update_node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
|
||||
|
|
@ -3367,7 +3381,7 @@ proc graph_edit_properties {n} {
|
|||
set graph_selected {}
|
||||
set graph_schname {}
|
||||
}
|
||||
button .graphdialog.bottom.apply -text Apply -command {
|
||||
button .graphdialog.bottom.apply -padx 1 -borderwidth 1 -pady 0 -text Apply -command {
|
||||
if { [xschem get schname] eq $graph_schname } {
|
||||
graph_push_undo
|
||||
graph_update_node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
|
||||
|
|
@ -3384,9 +3398,16 @@ proc graph_edit_properties {n} {
|
|||
pack .graphdialog.bottom.apply -side left
|
||||
pack .graphdialog.bottom.cancel -side left
|
||||
|
||||
for {set i 4} {$i < $cadlayers} {incr i} {
|
||||
radiobutton .graphdialog.bottom.r$i -value $i -background [lindex $tctx::colors $i] \
|
||||
-variable graph_sel_color -command graph_change_wave_color -selectcolor white -foreground black
|
||||
for {set i 4} {$i <= $cadlayers} {incr i} {
|
||||
if {$i == $cadlayers } {
|
||||
button .graphdialog.bottom.r$i -padx 1 -borderwidth 1 -pady 0 \
|
||||
-command "set_graph_default_colors" \
|
||||
-text {AUTO SET}
|
||||
} else {
|
||||
radiobutton .graphdialog.bottom.r$i -value $i -background [lindex $tctx::colors $i] \
|
||||
-variable graph_sel_color -command graph_change_wave_color \
|
||||
-selectcolor white -foreground black
|
||||
}
|
||||
pack .graphdialog.bottom.r$i -side left
|
||||
}
|
||||
|
||||
|
|
@ -4247,7 +4268,7 @@ proc file_dialog_place_symbol {} {
|
|||
|
||||
proc file_dialog_display_preview {f} {
|
||||
set type [is_xschem_file $f]
|
||||
if { $type ne {0} && $type ne {GENERATOR} } {
|
||||
if { $type ne {0} } {
|
||||
if { [winfo exists .load] } {
|
||||
.load.l.paneright.draw configure -background {}
|
||||
xschem preview_window draw .load.l.paneright.draw "$f"
|
||||
|
|
|
|||
Loading…
Reference in New Issue