removed some direct exit() calls in editprop.c

This commit is contained in:
stefan schippers 2023-06-03 12:19:34 +02:00
parent d4116a3bb0
commit 57ea120a33
3 changed files with 14 additions and 9 deletions

View File

@ -766,6 +766,11 @@ static int edit_rect_property(int x)
const char *dash, *fill; const char *dash, *fill;
int preserve, modified = 0; int preserve, modified = 0;
char *oldprop=NULL; char *oldprop=NULL;
if(x < 0 || x > 2) {
fprintf(errfp, "edit_rect_property() : unknown parameter x=%d\n",x);
return 0;
}
my_strdup(_ALLOC_ID_, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); my_strdup(_ALLOC_ID_, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
if(oldprop && oldprop[0]) { if(oldprop && oldprop[0]) {
tclsetvar("retval",oldprop); tclsetvar("retval",oldprop);
@ -778,10 +783,7 @@ static int edit_rect_property(int x)
xctx->semaphore--; xctx->semaphore--;
} }
else if(x==2) tcleval("viewdata $::retval"); else if(x==2) tcleval("viewdata $::retval");
else if(x==1) tcleval("edit_vi_prop {Text:}"); else tcleval("edit_vi_prop {Text:}"); /* x == 1 */
else {
fprintf(errfp, "edit_rect_property() : unknown parameter x=%d\n",x); exit(EXIT_FAILURE);
}
preserve = atoi(tclgetvar("preserve_unchanged_attrs")); preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
if(strcmp(tclgetvar("rcode"),"") ) if(strcmp(tclgetvar("rcode"),"") )
{ {
@ -1108,6 +1110,10 @@ static int edit_text_property(int x)
/* const char *str; */ /* const char *str; */
char *oldprop = NULL; char *oldprop = NULL;
if(x < 0 || x > 2) {
fprintf(errfp, "edit_text_property() : unknown parameter x=%d\n",x);
return 0;
}
dbg(1, "edit_text_property(): entering\n"); dbg(1, "edit_text_property(): entering\n");
sel = xctx->sel_array[0].n; sel = xctx->sel_array[0].n;
my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr); my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr);
@ -1134,10 +1140,7 @@ static int edit_text_property(int x)
if( (oldprop && strcmp(oldprop, tclgetvar("props"))) || (!oldprop && props[0]) ) props_changed = 1; if( (oldprop && strcmp(oldprop, tclgetvar("props"))) || (!oldprop && props[0]) ) props_changed = 1;
} }
else if(x==2) tcleval("viewdata $::retval"); else if(x==2) tcleval("viewdata $::retval");
else if(x==1) tcleval("edit_vi_prop {Text:}"); else tcleval("edit_vi_prop {Text:}"); /* x == 1 */
else {
fprintf(errfp, "edit_text_property() : unknown parameter x=%d\n",x); exit(EXIT_FAILURE);
}
preserve = atoi(tclgetvar("preserve_unchanged_attrs")); preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
if(x == 0 || x == 1) { if(x == 0 || x == 1) {
if(strcmp(xctx->text[sel].txt_ptr, tclgetvar("retval") ) ) { if(strcmp(xctx->text[sel].txt_ptr, tclgetvar("retval") ) ) {

View File

@ -3751,7 +3751,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* testmode */ * testmode */
else if(!strcmp(argv[1], "test")) else if(!strcmp(argv[1], "test"))
{ {
swap_tabs(0, 1); dbg(0, "--> %d\n", get_window_count());
/* swap_tabs(0, 1); */
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }

View File

@ -40,6 +40,7 @@ typedef int myproc(
/* variables for handling multiple windows/tabs */ /* variables for handling multiple windows/tabs */
static Xschem_ctx *save_xctx[MAX_NEW_WINDOWS]; /* save pointer to current schematic context structure */ static Xschem_ctx *save_xctx[MAX_NEW_WINDOWS]; /* save pointer to current schematic context structure */
static char window_path[MAX_NEW_WINDOWS][WINDOW_PATH_SIZE]; static char window_path[MAX_NEW_WINDOWS][WINDOW_PATH_SIZE];
/* ==0 if no additional windows/tabs, ==1 if one additional window/tab, ... */
static int window_count = 0; static int window_count = 0;
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */