Index: source/blender/editors/interface/interface_panel.c =================================================================== --- source/blender/editors/interface/interface_panel.c (Revision 21774) +++ source/blender/editors/interface/interface_panel.c (Arbeitskopie) @@ -465,7 +465,7 @@ } -static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect) +static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect, char dir) { Panel *panel= block->panel; Panel *pa; @@ -492,12 +492,20 @@ UI_ThemeColor(TH_TITLE); hrect= *rect; + if(dir == 'h') { hrect.xmin= rect->xmin+pnl_icons; uiStyleFontDraw(&style->paneltitle, &hrect, activename); + } + else { + /* ignore 'pnl_icons' */ + hrect.xmin= rect->xmin + (PNL_ICON+5)/block->aspect + 0.001f; + uiStyleFontDrawRotated(&style->paneltitle, &hrect, activename); + } return; } + if(dir == 'h') { a= 0; width= (rect->xmax-rect->xmin - 3 - pnl_icons - PNL_ICON)/nr; for(pa= ar->panels.first; pa; pa=pa->next) { @@ -522,6 +530,13 @@ a++; } } + } + else { + hrect= *rect; + hrect.xmin= rect->xmin + (PNL_ICON+5)/block->aspect + 0.001f; + UI_ThemeColor(TH_TITLE); + uiStyleFontDrawRotated(&style->paneltitle, &hrect, activename); + } } static void rectf_scale(rctf *rect, float scale) @@ -554,6 +569,13 @@ headrect.ymin= headrect.ymax; headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f); + /* title */ + if((panel->flag & PNL_CLOSEDX)) { + /* draw vertical title */ + ui_draw_aligned_panel_header(ar, style, block, &headrect, 'v'); + + } + else { if(!(panel->runtime_flag & PNL_FIRST)) { float minx= rect->xmin+5.0f/block->aspect; float maxx= rect->xmax-5.0f/block->aspect; @@ -567,9 +589,8 @@ glDisable(GL_BLEND); } - /* title */ - if(!(panel->flag & PNL_CLOSEDX)) { - ui_draw_aligned_panel_header(ar, style, block, &headrect); + /* draw horizontal title */ + ui_draw_aligned_panel_header(ar, style, block, &headrect, 'h'); /* itemrect smaller */ itemrect.xmax= headrect.xmax - 5.0f/block->aspect; Index: source/blender/editors/interface/interface_style.c =================================================================== --- source/blender/editors/interface/interface_style.c (Revision 21774) +++ source/blender/editors/interface/interface_style.c (Arbeitskopie) @@ -184,6 +184,66 @@ BLF_disable(BLF_KERNING_DEFAULT); } +/* draw at 90 degree angle */ +void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, char *str) +{ + float height; + int xofs, yofs; + float angle; + rcti txtrect; + + uiStyleFontSet(fs); + + height= BLF_height("2"); /* correct offset is on baseline, the j is below that */ + /* becomes x-offset when rotated */ + xofs= floor( 0.5f*(rect->ymax - rect->ymin - height)) + 1; + + /* ignore UI_STYLE, always aligned to top */ + + /* XXX rotate which way? */ + if(0) { /* clockwise */ + yofs=0; + angle= -90.0f; + } + else { /* counterclock */ + xofs+= height; + yofs= BLF_width(str) + 5; + angle= 90.0f; + } + + /* translate rect to vertical */ + txtrect.xmin= rect->xmin - (rect->ymax - rect->ymin); + txtrect.ymin= rect->ymin - (rect->xmax - rect->xmin); + txtrect.xmax= rect->xmin; + txtrect.ymax= rect->ymin; + + /* clip is very strict, so we give it some space */ + /* clipping is done without rotation, so make rect big enough to contain both positions */ + BLF_clipping(txtrect.xmin-1, txtrect.ymin-yofs-xofs-4, rect->xmax+1, rect->ymax+4); + BLF_enable(BLF_CLIPPING); + BLF_position(txtrect.xmin+xofs, txtrect.ymax-yofs, 0.0f); + + BLF_enable(BLF_ROTATION); + BLF_rotation(angle); + + if (fs->shadow) { + BLF_enable(BLF_SHADOW); + BLF_shadow(fs->shadow, fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha); + BLF_shadow_offset(fs->shadx, fs->shady); + } + + if (fs->kerning == 1) + BLF_enable(BLF_KERNING_DEFAULT); + + BLF_draw(str); + BLF_disable(BLF_ROTATION); + BLF_disable(BLF_CLIPPING); + if (fs->shadow) + BLF_disable(BLF_SHADOW); + if (fs->kerning == 1) + BLF_disable(BLF_KERNING_DEFAULT); +} + /* ************** helpers ************************ */ /* temporarily, does widget font */