various checks to prevent multiple file loading if no X or -x option used, put xpm header in icon.c so it can be opened by image viewers
This commit is contained in:
parent
727f842778
commit
c7b9e8206f
|
|
@ -1,3 +1,4 @@
|
|||
/* XPM */
|
||||
/* File: icon.c
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
|
|
@ -20,7 +21,6 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* XPM */
|
||||
char *cad_icon[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"56 42 6 1 ",
|
||||
|
|
|
|||
|
|
@ -1591,17 +1591,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1],"load_new_window") )
|
||||
{
|
||||
char fullname[PATH_MAX];
|
||||
|
||||
cmd_found = 1;
|
||||
if(argc>=3) {
|
||||
my_snprintf(fullname, S(fullname),"%s", argv[2]);
|
||||
if(has_x) {
|
||||
if(argc>=3) {
|
||||
my_snprintf(fullname, S(fullname),"%s", argv[2]);
|
||||
} else {
|
||||
tcleval("load_file_dialog {Load file} .sch.sym INITIALLOADDIR");
|
||||
my_snprintf(fullname, S(fullname),"%s", tclresult());
|
||||
}
|
||||
if( fullname[0] ) {
|
||||
new_schematic("create", NULL, fullname);
|
||||
tclvareval("update_recent_file {", fullname, "}", NULL);
|
||||
}
|
||||
} else {
|
||||
tcleval("load_file_dialog {Load file} .sch.sym INITIALLOADDIR");
|
||||
my_snprintf(fullname, S(fullname),"%s", tclresult());
|
||||
}
|
||||
if( fullname[0] ) {
|
||||
new_schematic("create", NULL, fullname);
|
||||
tclvareval("update_recent_file {", fullname, "}", NULL);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
}
|
||||
else if(!strcmp(argv[1],"log"))
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ END{
|
|||
leak+= address[i]
|
||||
print " address[ " i ", " idx[i] " ]= " address[i]
|
||||
if(show_source) {
|
||||
pipe = "egrep -n 'my_(malloc|calloc|realloc|free|strdup|strdup2)\(" idx[i] ",' *.c xschem.h"
|
||||
pipe = "egrep -n 'my_(malloc|calloc|realloc|free|strdup|strdup2)\\(" idx[i] ",' *.c xschem.h"
|
||||
while( pipe | getline a) print " " a
|
||||
close(pipe)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -693,13 +693,13 @@ void xwin_exit(void)
|
|||
my_free(1143, &xschem_executable);
|
||||
record_global_node(2, NULL, NULL); /* delete global node array */
|
||||
dbg(1, "xwin_exit(): deleted undo buffer\n");
|
||||
if(errfp!=stderr) fclose(errfp);
|
||||
errfp=stderr;
|
||||
/* delete cmdline stuff */
|
||||
for(i = 0 ; i < cli_opt_argc; i++) {
|
||||
my_free(1141, &cli_opt_argv[i]);
|
||||
}
|
||||
my_free(1464, &cli_opt_argv);
|
||||
if(errfp!=stderr) fclose(errfp);
|
||||
errfp=stderr;
|
||||
if(!detach) printf("\n");
|
||||
init_done=0; /* 20150409 to avoid multiple calls */
|
||||
}
|
||||
|
|
@ -1421,6 +1421,7 @@ int new_schematic(const char *what, const char *win_path, const char *fname)
|
|||
int tabbed_interface;
|
||||
const char *tmp;
|
||||
|
||||
if(!has_x) return 0;
|
||||
tabbed_interface = 0;
|
||||
if((tmp = tclgetvar("tabbed_interface"))) {
|
||||
if(tmp[0] == '1') tabbed_interface = 1;
|
||||
|
|
@ -1999,7 +2000,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
{
|
||||
pixdata[i]=my_calloc(642, 32, sizeof(char));
|
||||
}
|
||||
pixmap=my_calloc(636, cadlayers, sizeof(Pixmap));
|
||||
if(has_x) pixmap=my_calloc(636, cadlayers, sizeof(Pixmap));
|
||||
|
||||
my_strncpy(xctx->plotfile, cli_opt_plotfile, S(xctx->plotfile));
|
||||
xctx->draw_window = tclgetintvar("draw_window");
|
||||
|
|
@ -2343,7 +2344,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
|
||||
|
||||
/* load additional files */
|
||||
for(i = 2; i < cli_opt_argc; i++) {
|
||||
if(has_x) for(i = 2; i < cli_opt_argc; i++) {
|
||||
tclvareval("xschem load_new_window ", cli_opt_argv[i], NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3961,6 +3961,8 @@ set tctx::global_array_list {
|
|||
}
|
||||
|
||||
proc delete_ctx {context} {
|
||||
global has_x
|
||||
if {![info exists $has_x]} {return}
|
||||
set tctx::tctx $context
|
||||
uplevel #0 {
|
||||
# puts "delete_ctx $tctx::tctx"
|
||||
|
|
@ -3975,6 +3977,8 @@ proc delete_ctx {context} {
|
|||
|
||||
proc restore_ctx {context} {
|
||||
# puts "restoring tcl context $context : semaphore=[xschem get semaphore]"
|
||||
global has_x
|
||||
if {![info exists $has_x]} {return}
|
||||
set tctx::tctx $context
|
||||
array unset ::sim
|
||||
uplevel #0 {
|
||||
|
|
@ -3998,6 +4002,8 @@ proc restore_ctx {context} {
|
|||
|
||||
proc save_ctx {context} {
|
||||
# puts "saving tcl context $context : semaphore=[xschem get semaphore]"
|
||||
global has_x
|
||||
if {![info exists $has_x]} {return}
|
||||
set tctx::tctx $context
|
||||
uplevel #0 {
|
||||
# puts "save_ctx $tctx::tctx"
|
||||
|
|
@ -4015,6 +4021,8 @@ proc save_ctx {context} {
|
|||
}
|
||||
|
||||
proc housekeeping_ctx {} {
|
||||
global has_x
|
||||
if {![info exists $has_x]} {return}
|
||||
uplevel #0 {
|
||||
# puts housekeeping_ctx
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue