From 53c643e1df6ab1f5f7e78a594a031632e1e9cda0 Mon Sep 17 00:00:00 2001 From: Roland Lutz Date: Sun, 6 Oct 2019 16:59:31 +0200 Subject: [PATCH] Fix changed flag update for embed/unembed actions --- gschem/src/actions.c | 8 ++++++-- libgeda/src/o_embed.c | 11 ----------- utils/gschlas/s_util.c | 9 +++++---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gschem/src/actions.c b/gschem/src/actions.c index 442f28c4c..af3632329 100644 --- a/gschem/src/actions.c +++ b/gschem/src/actions.c @@ -1342,8 +1342,10 @@ DEFINE_ACTION (edit_embed, } s_current = g_list_next(s_current); } - if (changed) + if (changed) { + gschem_toplevel_page_content_changed (w_current, toplevel->page_current); o_undo_savestate_old (w_current, UNDO_ALL, _("Embed")); + } } else { /* nothing selected, go back to select state */ o_redraw_cleanstates(w_current); @@ -1384,8 +1386,10 @@ DEFINE_ACTION (edit_unembed, } s_current = g_list_next(s_current); } - if (changed) + if (changed) { + gschem_toplevel_page_content_changed (w_current, toplevel->page_current); o_undo_savestate_old (w_current, UNDO_ALL, _("Unembed")); + } } else { /* nothing selected, go back to select state */ o_redraw_cleanstates(w_current); diff --git a/libgeda/src/o_embed.c b/libgeda/src/o_embed.c index 944ce0bdd..603bbddd2 100644 --- a/libgeda/src/o_embed.c +++ b/libgeda/src/o_embed.c @@ -42,7 +42,6 @@ */ gboolean o_embed(TOPLEVEL *toplevel, OBJECT *o_current) { - PAGE *page = o_get_page (toplevel, o_current); gboolean page_modified = FALSE; /* check o_current is a complex and is not already embedded */ @@ -66,11 +65,6 @@ gboolean o_embed(TOPLEVEL *toplevel, OBJECT *o_current) page_modified = TRUE; } - if (page_modified && page != NULL) { - /* page content has been modified */ - page->CHANGED = 1; - } - return page_modified; } @@ -88,7 +82,6 @@ gboolean o_embed(TOPLEVEL *toplevel, OBJECT *o_current) gboolean o_unembed(TOPLEVEL *toplevel, OBJECT *o_current) { const CLibSymbol *sym; - PAGE *page = o_get_page (toplevel, o_current); gboolean page_modified = FALSE; /* check o_current is an embedded complex */ @@ -124,9 +117,5 @@ gboolean o_unembed(TOPLEVEL *toplevel, OBJECT *o_current) page_modified = TRUE; } - if (page_modified && page != NULL) { - page->CHANGED = 1; - } - return page_modified; } diff --git a/utils/gschlas/s_util.c b/utils/gschlas/s_util.c index b7e1dbd36..7f5704338 100644 --- a/utils/gschlas/s_util.c +++ b/utils/gschlas/s_util.c @@ -59,10 +59,11 @@ s_util_embed(TOPLEVEL *pr_current, int embed_mode) if (o_current->type == OBJ_COMPLEX || o_current->type == OBJ_PICTURE) { - if (embed_mode == TRUE) { - o_embed(pr_current, o_current); - } else { - o_unembed(pr_current, o_current); + if (embed_mode ? o_embed(pr_current, o_current) + : o_unembed(pr_current, o_current)) { + PAGE *page = o_get_page (pr_current, o_current); + if (page != NULL) + page->CHANGED = 1; } } -- 2.11.4.GIT