Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-12-01 15:39:14 +0300
committerTon Roosendaal <ton@blender.org>2004-12-01 15:39:14 +0300
commitd7c8ff725afa8748b2443e18ff2aba359afe022f (patch)
tree7f604506c391d3989ab21ec8306c7848c8776e8e /source/blender/src/interface_panel.c
parent10e64fe4b4ad42209d6a01155b0d3ad2d6e5dda3 (diff)
Bug #1909
When choosing "render engine" in Scene Buttons, the newly added or removed Panels didn't invoke a re-alignment event yet. Also added code that inserts new panels as good as possible on their previous locations. This works reliable for 1 new panel, not for more, this because a Panel only stores its old location, not the locations of all Panels in a given configuration. Consider that minor issue...
Diffstat (limited to 'source/blender/src/interface_panel.c')
-rw-r--r--source/blender/src/interface_panel.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c
index 2d486aac7fa..d16b3bcef18 100644
--- a/source/blender/src/interface_panel.c
+++ b/source/blender/src/interface_panel.c
@@ -1169,12 +1169,20 @@ typedef struct PanelSort {
Panel *pa, *orig;
} PanelSort;
+/* note about sorting;
+ the sortcounter has a lower value for new panels being added.
+ however, that only works to insert a single panel, when more new panels get
+ added the coordinates of existing panels and the previously stored to-be-insterted
+ panels do not match for sorting */
+
static int find_leftmost_panel(const void *a1, const void *a2)
{
const PanelSort *ps1=a1, *ps2=a2;
if( ps1->pa->ofsx > ps2->pa->ofsx) return 1;
else if( ps1->pa->ofsx < ps2->pa->ofsx) return -1;
+ else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
+ else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
return 0;
}
@@ -1186,6 +1194,8 @@ static int find_highest_panel(const void *a1, const void *a2)
if( ps1->pa->ofsy < ps2->pa->ofsy) return 1;
else if( ps1->pa->ofsy > ps2->pa->ofsy) return -1;
+ else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
+ else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
return 0;
}
@@ -1197,6 +1207,7 @@ int uiAlignPanelStep(ScrArea *sa, float fac)
SpaceButs *sbuts= sa->spacedata.first;
Panel *pa;
PanelSort *ps, *panelsort, *psnext;
+ static int sortcounter= 0;
int a, tot=0, done;
if(sa->spacetype!=SPACE_BUTS) {
@@ -1278,6 +1289,12 @@ int uiAlignPanelStep(ScrArea *sa, float fac)
}
}
+ /* set counter, used for sorting with newly added panels */
+ sortcounter++;
+ for(pa= sa->panels.first; pa; pa= pa->next) {
+ if(pa->active) pa->sortcounter= sortcounter;
+ }
+
/* free panelsort array */
ps= panelsort;
for(a=0; a<tot; a++, ps++) {