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>2009-04-09 22:11:18 +0400
committerTon Roosendaal <ton@blender.org>2009-04-09 22:11:18 +0400
commit79c30a0752105130f90102915ed8b6471b50146d (patch)
treed1d973a05dc5fa6de48c69fcdfc910592b64f153 /source/blender/editors/interface/interface.c
parent46d8c1ebc7bd3069f3295de6b4299802a0dee9c9 (diff)
2.5
WIP commit for UI drawing. - Hooked up Diego's new Font API - Added Style definitions for fonts, currently it uses a different font for panel titles to show it. - Styles are in Userdef now too, still not finished - Userdef "DPI" will offer global control over font size, to match monitor size/resolution. It's meant to scale widgets and headers too btw, later. - Lots of code removed for old fonts, but that's unfinished. On todo: too much to mention, will continue happily tomorrow!
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e548bbd76ca..5a1b8fb6118 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -88,7 +88,7 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but);
/* ************ GLOBALS ************* */
-static uiFont UIfont[UI_ARRAY]; // no init needed
+static uiFontOld UIfont[UI_ARRAY]; // no init needed
/* ************* translation ************** */
@@ -643,11 +643,34 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* ************** BLOCK DRAWING FUNCTION ************* */
+/* project button or block (but==NULL) to pixels in regionspace */
+static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, uiBut *but)
+{
+ float gx, gy;
+ float getsizex, getsizey;
+
+ getsizex= ar->winx;
+ getsizey= ar->winy;
+
+ gx= (but?but->x1:block->minx) + (block->panel?block->panel->ofsx:0.0f);
+ gy= (but?but->y1:block->miny) + (block->panel?block->panel->ofsy:0.0f);
+
+ rect->xmin= floor(getsizex*(0.5+ 0.5*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
+ rect->ymin= floor(getsizey*(0.5+ 0.5*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+
+ gx= (but?but->x2:block->maxx) + (block->panel?block->panel->ofsx:0.0f);
+ gy= (but?but->y2:block->maxy) + (block->panel?block->panel->ofsy:0.0f);
+
+ rect->xmax= floor(getsizex*(0.5+ 0.5*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
+ rect->ymax= floor(getsizey*(0.5+ 0.5*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+}
+
void uiDrawBlock(const bContext *C, uiBlock *block)
{
ARegion *ar;
uiBut *but;
-
+ rcti rect;
+
/* get menu region or area region */
ar= CTX_wm_menu(C);
if(!ar)
@@ -659,13 +682,6 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
/* we set this only once */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if(block->flag & UI_BLOCK_LOOP)
- ui_draw_menu_back(block);
- else if(block->panel)
- ui_draw_panel(ar, block);
-
- if(block->drawextra) block->drawextra(C, block);
-
/* pixel space for AA widgets */
glMatrixMode(GL_PROJECTION);
glPushMatrix();
@@ -675,9 +691,21 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
wmOrtho2(0.0f, ar->winx, 0.0f, ar->winy);
- for(but= block->buttons.first; but; but= but->next)
- ui_draw_but(ar, but);
+ /* back */
+ ui_but_to_pixelrect(&rect, ar, block, NULL);
+ if(block->flag & UI_BLOCK_LOOP)
+ ui_draw_menu_back(block, &rect);
+ else if(block->panel)
+ ui_draw_panel(ar, block, &rect);
+ if(block->drawextra) block->drawextra(C, block);
+
+ /* widgets */
+ for(but= block->buttons.first; but; but= but->next) {
+ ui_but_to_pixelrect(&rect, ar, block, but);
+ ui_draw_but(ar, but, &rect);
+ }
+
/* restore matrix */
glMatrixMode(GL_PROJECTION);
glPopMatrix();
@@ -3287,12 +3315,14 @@ void UI_init(void)
void UI_init_userdef()
{
+ uiStyleInit();
ui_text_init_userdef();
ui_theme_init_userdef();
}
void UI_exit(void)
{
+ uiStyleExit();
ui_resources_free();
}