[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41992] trunk/blender: UI:
Brecht Van Lommel
brechtvanlommel at pandora.be
Sat Nov 19 21:57:53 CET 2011
Revision: 41992
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41992
Author: blendix
Date: 2011-11-19 20:57:53 +0000 (Sat, 19 Nov 2011)
Log Message:
-----------
UI:
* Add theme option to show panel header background.
* Draw panel collapse widget a bit smaller.
* Add theme option to draw icons muted.
* Code tweak: replace U.themes.first by UI_GetTheme() calls.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
trunk/blender/source/blender/blenkernel/BKE_blender.h
trunk/blender/source/blender/editors/include/UI_resources.h
trunk/blender/source/blender/editors/interface/interface_icons.c
trunk/blender/source/blender/editors/interface/interface_intern.h
trunk/blender/source/blender/editors/interface/interface_panel.c
trunk/blender/source/blender/editors/interface/interface_style.c
trunk/blender/source/blender/editors/interface/interface_widgets.c
trunk/blender/source/blender/editors/interface/resources.c
trunk/blender/source/blender/editors/interface/view2d.c
trunk/blender/source/blender/editors/screen/area.c
trunk/blender/source/blender/editors/space_text/text_draw.c
trunk/blender/source/blender/editors/space_view3d/drawarmature.c
trunk/blender/source/blender/makesdna/DNA_userdef_types.h
trunk/blender/source/blender/makesrna/intern/rna_userdef.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py 2011-11-19 20:57:53 UTC (rev 41992)
@@ -634,13 +634,52 @@
colsub.row().prop(ui, "inner_key_sel")
colsub.row().prop(ui, "blend")
+ col.separator()
+ col.separator()
+
ui = theme.user_interface
+ col.label("Icons:")
+
+ row = col.row()
+
+ subsplit = row.split(percentage=0.95)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "icon_file")
+
+ subsplit = row.split(percentage=0.85)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "icon_alpha")
+
col.separator()
col.separator()
- split = col.split(percentage=0.93)
- split.prop(ui, "icon_file")
+ ui = theme.user_interface.panel
+ col.label("Panels:")
+ row = col.row()
+
+ subsplit = row.split(percentage=0.95)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ rowsub = colsub.row()
+ rowsub.prop(ui, "show_header")
+ rowsub.label()
+
+ subsplit = row.split(percentage=0.85)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "header")
+
layout.separator()
layout.separator()
elif theme.theme_area == 'BONE_COLOR_SETS':
Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h 2011-11-19 20:57:53 UTC (rev 41992)
@@ -42,7 +42,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 260
-#define BLENDER_SUBVERSION 4
+#define BLENDER_SUBVERSION 5
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
Modified: trunk/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_resources.h 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/source/blender/editors/include/UI_resources.h 2011-11-19 20:57:53 UTC (rev 41992)
@@ -318,6 +318,9 @@
// internal (blender) usage only, for init and set active
void UI_SetTheme(int spacetype, int regionid);
+// get current theme
+struct bTheme *UI_GetTheme(void);
+
/* only for buttons in theme editor! */
const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
Modified: trunk/blender/source/blender/editors/interface/interface_icons.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_icons.c 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/source/blender/editors/interface/interface_icons.c 2011-11-19 20:57:53 UTC (rev 41992)
@@ -506,7 +506,7 @@
static void init_internal_icons(void)
{
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
ImBuf *bbuf= NULL;
int x, y, icontype;
char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
@@ -950,6 +950,7 @@
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
{
+ bTheme *btheme= UI_GetTheme();
Icon *icon = NULL;
DrawInfo *di = NULL;
IconImage *iimg;
@@ -957,6 +958,7 @@
int w, h;
icon = BKE_icon_get(icon_id);
+ alpha *= btheme->tui.icon_alpha;
if (icon==NULL) {
if (G.f & G_DEBUG)
Modified: trunk/blender/source/blender/editors/interface/interface_intern.h
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_intern.h 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/source/blender/editors/interface/interface_intern.h 2011-11-19 20:57:53 UTC (rev 41992)
@@ -112,7 +112,7 @@
/* internal panel drawing defines */
#define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */
-#define PNL_HEADER UI_UNIT_Y /* 20 default */
+#define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */
/* panel->flag */
#define PNL_SELECT 1
Modified: trunk/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_panel.c 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/source/blender/editors/interface/interface_panel.c 2011-11-19 20:57:53 UTC (rev 41992)
@@ -59,6 +59,7 @@
#include "ED_screen.h"
#include "UI_interface.h"
+#include "UI_resources.h"
#include "interface_intern.h"
@@ -173,7 +174,6 @@
Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open)
{
- uiStyle *style= UI_GetStyle();
Panel *pa, *patab, *palast, *panext;
char *drawname= pt->label;
char *idname= pt->idname;
@@ -208,7 +208,7 @@
}
pa->ofsx= 0;
- pa->ofsy= style->panelouter;
+ pa->ofsy= 0;
pa->sizex= 0;
pa->sizey= 0;
pa->runtime_flag |= PNL_NEW_ADDED;
@@ -482,6 +482,7 @@
/* panel integrated in buttonswindow, tool/property lists etc */
void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
{
+ bTheme *btheme= UI_GetTheme();
Panel *panel= block->panel;
rcti headrect;
rctf itemrect;
@@ -493,19 +494,37 @@
/* calculate header rect */
/* + 0.001f to prevent flicker due to float inaccuracy */
headrect= *rect;
- headrect.ymin= headrect.ymax;
+ headrect.ymin= headrect.ymax - 2.0f/block->aspect;
headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
- if(!(panel->runtime_flag & PNL_FIRST)) {
- float minx= rect->xmin+5.0f/block->aspect;
- float maxx= rect->xmax-5.0f/block->aspect;
+ {
+ float minx= rect->xmin;
+ float maxx= rect->xmax;
float y= headrect.ymax;
-
+
glEnable(GL_BLEND);
- glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- fdrawline(minx, y+1, maxx, y+1);
- glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
- fdrawline(minx, y, maxx, y);
+
+ if(btheme->tui.panel.show_header) {
+ /* draw with background color */
+ glEnable(GL_BLEND);
+ glColor4ubv((unsigned char*)btheme->tui.panel.header);
+ glRectf(minx, headrect.ymin, maxx, y);
+
+ fdrawline(minx, y, maxx, y);
+ fdrawline(minx, y, maxx, y);
+ }
+ else if(!(panel->runtime_flag & PNL_FIRST)) {
+ /* draw embossed separator */
+ minx += 5.0f/block->aspect;
+ maxx -= 5.0f/block->aspect;
+
+ glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
+ fdrawline(minx, y+1, maxx, y+1);
+ glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
+ fdrawline(minx, y, maxx, y);
+ glDisable(GL_BLEND);
+ }
+
glDisable(GL_BLEND);
}
@@ -518,7 +537,8 @@
itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin);
itemrect.ymin= headrect.ymin;
itemrect.ymax= headrect.ymax;
- rectf_scale(&itemrect, 0.8f);
+
+ rectf_scale(&itemrect, 0.7f);
ui_draw_panel_dragwidget(&itemrect);
}
@@ -538,7 +558,7 @@
/* in some occasions, draw a border */
if(panel->flag & PNL_SELECT) {
if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
- else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
+ else uiSetRoundBox(UI_CNR_NONE);
UI_ThemeColorShade(TH_BACK, -120);
uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
@@ -567,7 +587,7 @@
itemrect.ymin= headrect.ymin;
itemrect.ymax= headrect.ymax;
- rectf_scale(&itemrect, 0.5f);
+ rectf_scale(&itemrect, 0.35f);
if(panel->flag & PNL_CLOSEDY)
ui_draw_tria_rect(&itemrect, 'h');
@@ -589,12 +609,12 @@
return PNL_HEADER;
}
-static int get_panel_size_y(uiStyle *style, Panel *pa)
+static int get_panel_size_y(Panel *pa)
{
if(pa->type && (pa->type->flag & PNL_NO_HEADER))
return pa->sizey;
- return PNL_HEADER + pa->sizey + style->panelouter;
+ return PNL_HEADER + pa->sizey;
}
/* this function is needed because uiBlock and Panel itself dont
@@ -667,7 +687,6 @@
/* returns 1 when it did something */
static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
{
- uiStyle *style= UI_GetStyle();
Panel *pa;
PanelSort *ps, *panelsort, *psnext;
int a, tot=0, done;
@@ -719,18 +738,18 @@
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
ps= panelsort;
ps->pa->ofsx= 0;
- ps->pa->ofsy= -get_panel_size_y(style, ps->pa);
+ ps->pa->ofsy= -get_panel_size_y(ps->pa);
for(a=0; a<tot-1; a++, ps++) {
psnext= ps+1;
if(align==BUT_VERTICAL) {
psnext->pa->ofsx= ps->pa->ofsx;
- psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(style, psnext->pa);
+ psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
}
else {
psnext->pa->ofsx= get_panel_real_ofsx(ps->pa);
- psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(style, ps->pa) - get_panel_size_y(style, psnext->pa);
+ psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
}
}
Modified: trunk/blender/source/blender/editors/interface/interface_style.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_style.c 2011-11-19 20:40:46 UTC (rev 41991)
+++ trunk/blender/source/blender/editors/interface/interface_style.c 2011-11-19 20:57:53 UTC (rev 41992)
@@ -124,7 +124,6 @@
style->buttonspacex= 8;
style->buttonspacey= 2;
style->panelspace= 8;
- style->panelouter= 4;
return style;
}
Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c 2011-11-19 20:40:46 UTC (rev 41991)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list