From 27d0dedbd15488b28d3ba8ea4f4610255eef40c9 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 17 Feb 2016 10:31:15 +0000 Subject: [PATCH] Add new group after active group, not after all groups. --- src/group.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 411d8074..12afe211 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -56,9 +56,6 @@ void Group::MenuGroup(int id) { g.color = RGBi(100, 100, 100); g.scale = 1; - Group *gl = SK.GetGroup(SK.groupOrder.elem[SK.groupOrder.n - 1]); - g.order = gl->order + 1; - if(id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT)) { g.impFile = RecentFile[id-RECENT_IMPORT]; id = GraphicsWindow::MNU_GROUP_IMPORT; @@ -228,6 +225,17 @@ void Group::MenuGroup(int id) { SS.GW.ClearSelection(); SS.UndoRemember(); + bool afterActive = false; + for(int i = 0; i < SK.groupOrder.n; i++) { + Group *gi = SK.GetGroup(SK.groupOrder.elem[i]); + if(afterActive) + gi->order += 1; + if(gi->h.v == SS.GW.activeGroup.v) { + g.order = gi->order + 1; + afterActive = true; + } + } + SK.group.AddAndAssignId(&g); Group *gg = SK.GetGroup(g.h);