separated undo_initialized and mem_undo_initialized, so they can be used more interchangeably
This commit is contained in:
parent
b4423126ea
commit
5bc194f3a5
|
|
@ -203,8 +203,8 @@ static void mem_init_undo(void)
|
|||
{
|
||||
int slot;
|
||||
|
||||
dbg(1, "mem_init_undo(): undo_initialized = %d\n", xctx->undo_initialized);
|
||||
if(!xctx->undo_initialized) {
|
||||
dbg(1, "mem_init_undo(): undo_initialized = %d\n", xctx->mem_undo_initialized);
|
||||
if(!xctx->mem_undo_initialized) {
|
||||
for(slot = 0;slot<MAX_UNDO; slot++) {
|
||||
xctx->uslot[slot].lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
xctx->uslot[slot].rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
|
|
@ -215,7 +215,7 @@ static void mem_init_undo(void)
|
|||
xctx->uslot[slot].aptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *));
|
||||
xctx->uslot[slot].pptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *));
|
||||
}
|
||||
xctx->undo_initialized = 1;
|
||||
xctx->mem_undo_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -223,11 +223,11 @@ static void mem_init_undo(void)
|
|||
void mem_clear_undo(void)
|
||||
{
|
||||
int slot;
|
||||
dbg(1, "mem_clear_undo(): undo_initialized = %d\n", xctx->undo_initialized);
|
||||
dbg(1, "mem_clear_undo(): undo_initialized = %d\n", xctx->mem_undo_initialized);
|
||||
xctx->cur_undo_ptr = 0;
|
||||
xctx->tail_undo_ptr = 0;
|
||||
xctx->head_undo_ptr = 0;
|
||||
if(!xctx->undo_initialized) return;
|
||||
if(!xctx->mem_undo_initialized) return;
|
||||
for(slot = 0; slot<MAX_UNDO; slot++) {
|
||||
free_undo_lines(slot);
|
||||
free_undo_rects(slot);
|
||||
|
|
@ -244,8 +244,8 @@ void mem_clear_undo(void)
|
|||
void mem_delete_undo(void)
|
||||
{
|
||||
int slot;
|
||||
dbg(1, "mem_delete_undo(): undo_initialized = %d\n", xctx->undo_initialized);
|
||||
if(!xctx->undo_initialized) return;
|
||||
dbg(1, "mem_delete_undo(): undo_initialized = %d\n", xctx->mem_undo_initialized);
|
||||
if(!xctx->mem_undo_initialized) return;
|
||||
mem_clear_undo();
|
||||
for(slot = 0;slot<MAX_UNDO; slot++) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].lines);
|
||||
|
|
@ -257,7 +257,7 @@ void mem_delete_undo(void)
|
|||
my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr);
|
||||
}
|
||||
xctx->undo_initialized = 0;
|
||||
xctx->mem_undo_initialized = 0;
|
||||
}
|
||||
|
||||
void mem_push_undo(void)
|
||||
|
|
|
|||
|
|
@ -3570,7 +3570,7 @@ static void init_undo(void)
|
|||
if(xctx->no_undo == 0 && !xctx->undo_initialized) {
|
||||
/* create undo directory */
|
||||
if( !my_strdup(_ALLOC_ID_, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) {
|
||||
dbg(0, "xinit(): problems creating tmp undo dir, Undo will be disabled\n");
|
||||
dbg(0, "init_undo(): problems creating tmp undo dir, Undo will be disabled\n");
|
||||
dbg(0, "init_undo(): Check permissions in %s\n", tclgetvar("XSCHEM_TMP_DIR"));
|
||||
xctx->no_undo = 1; /* disable undo */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -475,6 +475,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->clear_undo = mem_clear_undo;
|
||||
}
|
||||
xctx->undo_initialized = 0;
|
||||
xctx->mem_undo_initialized = 0;
|
||||
xctx->zoom=CADINITIALZOOM;
|
||||
xctx->mooz=1/CADINITIALZOOM;
|
||||
xctx->xorigin=CADINITIALX;
|
||||
|
|
|
|||
|
|
@ -1082,6 +1082,7 @@ typedef struct {
|
|||
/* in_memory_undo */
|
||||
Undo_slot uslot[MAX_UNDO];
|
||||
int undo_initialized;
|
||||
int mem_undo_initialized;
|
||||
/* graph context struct */
|
||||
Graph_ctx graph_struct;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue