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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-16 05:08:39 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-16 05:08:39 +0400
commitf10541f7cfa13b3f2c92abea2c99c2901efbf91a (patch)
tree29359fc0122925407301ef8d2ecd94cb5477a47f /source/blender/editors/interface/interface_panel.c
parent51fbc95e8c8699cd9ba2f7b1958df7270851af39 (diff)
UI
* Added option for panel to be closed by default. * Added support for RNA property and enum icons in buttons. * Remove some deprecated RNA menu code. * Fix issue with newly created panels not being inserted in the right place. * Fix issue with 3-split layout not being divided correctly. * FIx issue with menu items not drawing correct using python UI.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 278f7c026b1..06582762fdb 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -69,6 +69,7 @@
#define PNL_ACTIVE 2
#define PNL_WAS_ACTIVE 4
#define PNL_ANIM_ALIGN 8
+#define PNL_NEW_ADDED 16
typedef enum uiHandlePanelState {
PANEL_STATE_DRAG,
@@ -157,18 +158,20 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar)
pa->ofsy= papar->ofsy + papar->sizey-pa->sizey;
}
-Panel *uiBeginPanel(ARegion *ar, uiBlock *block, PanelType *pt, int *open)
+Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open)
{
uiStyle *style= U.uistyles.first;
Panel *pa, *patab, *palast, *panext;
- char *panelname= pt->label;
- char *tabname= pt->label;
+ char *drawname= pt->label;
+ char *idname= pt->idname;
+ char *tabname= pt->idname;
char *hookname= NULL;
int newpanel;
+ int align= panel_aligned(sa, ar);
/* check if Panel exists, then use that one */
for(pa=ar->panels.first; pa; pa=pa->next)
- if(strncmp(pa->panelname, panelname, UI_MAX_NAME_STR)==0)
+ if(strncmp(pa->panelname, idname, UI_MAX_NAME_STR)==0)
if(strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0)
break;
@@ -181,13 +184,21 @@ Panel *uiBeginPanel(ARegion *ar, uiBlock *block, PanelType *pt, int *open)
/* new panel */
pa= MEM_callocN(sizeof(Panel), "new panel");
pa->type= pt;
- BLI_strncpy(pa->panelname, panelname, UI_MAX_NAME_STR);
+ BLI_strncpy(pa->panelname, idname, UI_MAX_NAME_STR);
BLI_strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
+
+ if(pt->flag & PNL_DEFAULT_CLOSED) {
+ if(align == BUT_VERTICAL)
+ pa->flag |= PNL_CLOSEDY;
+ else
+ pa->flag |= PNL_CLOSEDX;
+ }
pa->ofsx= 0;
pa->ofsy= style->panelouter;
pa->sizex= 0;
pa->sizey= 0;
+ pa->runtime_flag |= PNL_NEW_ADDED;
BLI_addtail(&ar->panels, pa);
@@ -207,6 +218,8 @@ Panel *uiBeginPanel(ARegion *ar, uiBlock *block, PanelType *pt, int *open)
}
}
+ BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR);
+
/* if a new panel is added, we insert it right after the panel
* that was last added. this way new panels are inserted in the
* right place between versions */
@@ -235,7 +248,6 @@ Panel *uiBeginPanel(ARegion *ar, uiBlock *block, PanelType *pt, int *open)
if(pa->flag & PNL_CLOSED) return pa;
*open= 1;
- pa->drawname[0]= 0; /* otherwise closes panels show wrong title */
return pa;
}
@@ -244,13 +256,20 @@ void uiEndPanel(uiBlock *block, int width, int height)
{
Panel *pa= block->panel;
- if(pa->sizex != width || pa->sizey != height) {
- pa->runtime_flag |= PNL_ANIM_ALIGN;
- pa->ofsy += pa->sizey-height;
+ if(pa->runtime_flag & PNL_NEW_ADDED) {
+ pa->runtime_flag &= ~PNL_NEW_ADDED;
+ pa->sizex= width;
+ pa->sizey= height;
}
+ else if(!(width == 0 || height == 0)) {
+ if(pa->sizex != width || pa->sizey != height) {
+ pa->runtime_flag |= PNL_ANIM_ALIGN;
+ pa->ofsy += pa->sizey-height;
+ }
- pa->sizex= width;
- pa->sizey= height;
+ pa->sizex= width;
+ pa->sizey= height;
+ }
}
#if 0