added "xchem load_symbol" command to load a symbol without binding to any instance, text edit attribute "Load" button will start in "$current_dirname"
This commit is contained in:
parent
4362c44a8d
commit
c87f44a441
|
|
@ -546,16 +546,11 @@ void remove_symbol(int j)
|
|||
int i,c;
|
||||
xSymbol save;
|
||||
dbg(1, "remove_symbol(): removing symbol %d\n", j);
|
||||
if(xctx.sym[j].prop_ptr != NULL) {
|
||||
my_free(666, &xctx.sym[j].prop_ptr);
|
||||
}
|
||||
|
||||
if(xctx.sym[j].templ != NULL) {
|
||||
my_free(667, &xctx.sym[j].templ);
|
||||
}
|
||||
if(xctx.sym[j].type != NULL) {
|
||||
my_free(668, &xctx.sym[j].type);
|
||||
}
|
||||
my_free(666, &xctx.sym[j].prop_ptr);
|
||||
my_free(667, &xctx.sym[j].templ);
|
||||
my_free(668, &xctx.sym[j].type);
|
||||
my_free(684, &xctx.sym[j].name);
|
||||
/* /20150409 */
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
|
|
@ -613,7 +608,6 @@ void remove_symbol(int j)
|
|||
}
|
||||
}
|
||||
my_free(683, &xctx.sym[j].text);
|
||||
my_free(684, &xctx.sym[j].name);
|
||||
|
||||
save = xctx.sym[j];
|
||||
for(i = j + 1; i < xctx.symbols; i++) {
|
||||
|
|
|
|||
|
|
@ -523,7 +523,6 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
for(k=0; k<lastselected; k++) {
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
j = selectedgroup[k].n ;
|
||||
/* my_strdup(22, &type,get_tok_value((xctx.inst[j].ptr+ xctx.sym)->prop_ptr,"type",0)); */
|
||||
my_strdup(23, &type,(xctx.inst[j].ptr+ xctx.sym)->type);
|
||||
if( type && IS_LABEL_SH_OR_PIN(type)) break;
|
||||
symbol = xctx.sym + xctx.inst[j].ptr;
|
||||
|
|
|
|||
|
|
@ -484,8 +484,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
|
|||
if(!has_x) return;
|
||||
if(
|
||||
(hide_symbols==1 && (xctx.inst[n].ptr+ xctx.sym)->prop_ptr &&
|
||||
!strcmp(get_tok_value( (xctx.inst[n].ptr+ xctx.sym)->prop_ptr, "type",0 ), "subcircuit") ) ||
|
||||
(hide_symbols == 2) ) {
|
||||
!strcmp( (xctx.inst[n].ptr+ xctx.sym)->type, "subcircuit") ) || (hide_symbols == 2) ) {
|
||||
hide = 1;
|
||||
} else {
|
||||
hide = 0;
|
||||
|
|
|
|||
|
|
@ -1560,7 +1560,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
if((lcc[level].fd=fopen(sympath,fopen_read_mode))==NULL)
|
||||
{
|
||||
if(recursion_counter == 1) dbg(0, "l_s_d(): Symbol not found: %s\n",sympath);
|
||||
my_snprintf(sympath, S(sympath), "%s/%s.sym", tclgetvar("XSCHEM_SHAREDIR"), "systemlib/missing");
|
||||
my_snprintf(sympath, S(sympath), "%s/%s", tclgetvar("XSCHEM_SHAREDIR"), "systemlib/missing.sym");
|
||||
if((lcc[level].fd=fopen(sympath, fopen_read_mode))==NULL)
|
||||
{
|
||||
fprintf(errfp, "l_s_d(): systemlib/missing.sym missing, I give up\n");
|
||||
|
|
|
|||
|
|
@ -290,7 +290,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1], "load_symbol"))
|
||||
{
|
||||
int save, missing = 0;
|
||||
if(argc > 2) {
|
||||
save = xctx.symbols;
|
||||
match_symbol(argv[2]);
|
||||
if( xctx.symbols != save && !strcmp( xctx.sym[xctx.symbols - 1].type, "missing") ) {
|
||||
missing = 1;
|
||||
remove_symbol( xctx.symbols - 1);
|
||||
}
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, missing ? "0" : "1", NULL);
|
||||
}
|
||||
else if(!strcmp(argv[1],"place_symbol"))
|
||||
{
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -1608,10 +1608,11 @@ proc enter_text {textlabel {preserve_disabled disabled}} {
|
|||
}
|
||||
button .t.buttons.b3 -text "Load" -command \
|
||||
{
|
||||
global INITIALPROPDIR
|
||||
set a [tk_getOpenFile -parent .t -initialdir $INITIALPROPDIR ]
|
||||
global INITIALTEXTDIR
|
||||
if { ![info exists INITIALTEXTDIR] } { set INITIALTEXTDIR $current_dirname }
|
||||
set a [tk_getOpenFile -parent .t -initialdir $INITIALTEXTDIR ]
|
||||
if [string compare $a ""] {
|
||||
set INITIALPROPDIR [file dirname $a]
|
||||
set INITIALTEXTDIR [file dirname $a]
|
||||
read_data_window .t.txt $a
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue