Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 6637) +++ trunk/src/board.c (revision 6638) @@ -111,10 +111,11 @@ #include "defpcb_internal.c" -pcb_board_t *pcb_board_new(void) +pcb_board_t *pcb_board_new(int inhibit_events) { pcb_board_t *old, *nw = NULL; int dpcb; + unsigned int inh = inhibit_events ? PCB_INHIBIT_BOARD_CHANGED : 0; old = PCB; PCB = NULL; @@ -121,7 +122,7 @@ dpcb = -1; pcb_io_err_inhibit_inc(); - conf_list_foreach_path_first(dpcb, &conf_core.rc.default_pcb_file, pcb_load_pcb(__path__, NULL, pcb_false, 1 | 0x10)); + conf_list_foreach_path_first(dpcb, &conf_core.rc.default_pcb_file, pcb_load_pcb(__path__, NULL, pcb_false, 1 | 0x10 | inh)); pcb_io_err_inhibit_dec(); if (dpcb != 0) { /* no default PCB in file, use embedded version */ Index: trunk/src/board.h =================================================================== --- trunk/src/board.h (revision 6637) +++ trunk/src/board.h (revision 6638) @@ -120,8 +120,9 @@ /* creates a new PCB - low level */ pcb_board_t *pcb_board_new_(pcb_bool SetDefaultNames); -/* creates a new PCB - high level (uses a template board) */ -pcb_board_t *pcb_board_new(void); +/* creates a new PCB - high level (uses a template board); does not generate + new board event if inhibit_events is set */ +pcb_board_t *pcb_board_new(int inhibit_events); /* Called after PCB->Data->LayerN is set. Returns non-zero on error */ int pcb_board_new_postproc(pcb_board_t *pcb, int use_defaults); Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 6637) +++ trunk/src/buffer.c (revision 6638) @@ -202,7 +202,7 @@ */ pcb_bool pcb_buffer_load_layout(pcb_buffer_t *Buffer, const char *Filename, const char *fmt) { - pcb_board_t *newPCB = pcb_board_new(); + pcb_board_t *newPCB = pcb_board_new(1); /* new data isn't added to the undo list */ if (!pcb_parse_pcb(newPCB, Filename, fmt, CFR_invalid, 0)) { Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 6637) +++ trunk/src/file_act.c (revision 6638) @@ -190,7 +190,7 @@ if (PCB->Changed && conf_core.editor.save_in_tmp) pcb_save_in_tmp(); pcb_board_remove(PCB); - PCB = pcb_board_new(); + PCB = pcb_board_new(0); pcb_board_new_postproc(PCB, 1); /* setup the new name and reset some values to default */ Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 6637) +++ trunk/src/main.c (revision 6638) @@ -466,7 +466,7 @@ pcb_gui->parse_arguments(&hid_argc, &hid_argv); /* Create a new PCB object in memory */ - PCB = pcb_board_new(); + PCB = pcb_board_new(0); if (PCB == NULL) { pcb_message(PCB_MSG_ERROR, "Can't create an empty layout, exiting\n"); Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 6637) +++ trunk/src/plug_io.c (revision 6638) @@ -443,7 +443,8 @@ } } - pcb_board_changed(0); + if (!(how & PCB_INHIBIT_BOARD_CHANGED)) + pcb_board_changed(0); /* release unused memory */ pcb_board_remove(newPCB); Index: trunk/src/plug_io.h =================================================================== --- trunk/src/plug_io.h (revision 6637) +++ trunk/src/plug_io.h (revision 6638) @@ -112,7 +112,8 @@ FILE *pcb_check_and_open_file(const char *, pcb_bool, pcb_bool, pcb_bool *, pcb_bool *); FILE *pcb_open_connection_file(void); int pcb_save_pcb(const char *, const char *fmt); -int pcb_load_pcb(const char *name, const char *fmt, pcb_bool, int how); /* how: 0=normal pcb; 1=default.pcb, 2=misc (do not load settings) | 0x10: ignore missing file */ +#define PCB_INHIBIT_BOARD_CHANGED 0x20 +int pcb_load_pcb(const char *name, const char *fmt, pcb_bool, int how); /* how: 0=normal pcb; 1=default.pcb, 2=misc (do not load settings) | 0x10: ignore missing file, | PCB_INHIBIT_BOARD_CHANGED: do not send a board changed event */ void pcb_enable_autosave(void); void pcb_backup(void); void pcb_save_in_tmp(void);