forked from bartvdbraak/blender
2.5
Added 'header print' feature back. ED_area_headerprint(ScrArea *sa, const char *str); Give it a NULL string to disable the feature. On each call it tags the header for redraw.
This commit is contained in:
parent
eb8e220f26
commit
4bb20689c5
@ -4151,6 +4151,7 @@ static void direct_link_region(FileData *fd, ARegion *ar)
|
||||
{
|
||||
ar->handlers.first= ar->handlers.last= NULL;
|
||||
ar->uiblocks.first= ar->uiblocks.last= NULL;
|
||||
ar->headerstr= NULL;
|
||||
ar->regiondata= NULL;
|
||||
ar->swinid= 0;
|
||||
ar->type= NULL;
|
||||
|
@ -64,6 +64,7 @@ void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct
|
||||
void ED_area_exit(struct bContext *C, struct ScrArea *sa);
|
||||
int ED_screen_area_active(const struct bContext *C);
|
||||
void ED_area_tag_redraw(ScrArea *sa);
|
||||
void ED_area_headerprint(ScrArea *sa, const char *str);
|
||||
|
||||
/* screens */
|
||||
void ED_screens_initialize(struct wmWindowManager *wm);
|
||||
|
@ -37,6 +37,7 @@ CFLAGS += $(LEVEL_1_C_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(NAN_GLEW)/include
|
||||
CPPFLAGS += -I$(OPENGL_HEADERS)
|
||||
CPPFLAGS += -I$(NAN_BMFONT)/include
|
||||
|
||||
# not very neat....
|
||||
CPPFLAGS += -I../../windowmanager
|
||||
|
@ -5,7 +5,7 @@ sources = env.Glob('*.c')
|
||||
|
||||
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
|
||||
incs += ' ../../blenloader ../../windowmanager ../../python ../../makesrna'
|
||||
incs += ' #/intern/guardedalloc #/extern/glew/include'
|
||||
incs += ' #/intern/guardedalloc #/extern/glew/include #intern/bmfont'
|
||||
|
||||
defs = ''
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "BLI_rand.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
@ -54,6 +55,8 @@
|
||||
#include "UI_resources.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "BMF_Api.h"
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
#include "BPY_extern.h"
|
||||
#endif
|
||||
@ -181,30 +184,31 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
|
||||
/* note; this sets state, so we can use wmOrtho and friends */
|
||||
wmSubWindowSet(win, ar->swinid);
|
||||
|
||||
if(ar->swinid && at->draw) {
|
||||
UI_SetTheme(sa);
|
||||
at->draw(C, ar);
|
||||
UI_SetTheme(NULL);
|
||||
if(ar->swinid) {
|
||||
/* optional header info instead? */
|
||||
if(ar->headerstr) {
|
||||
float col[3];
|
||||
UI_SetTheme(sa);
|
||||
UI_GetThemeColor3fv(TH_HEADER, col);
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
UI_ThemeColor(TH_MENU_TEXT);
|
||||
glRasterPos2i(20, 6);
|
||||
BMF_DrawString(G.font, ar->headerstr);
|
||||
}
|
||||
else if(at->draw) {
|
||||
UI_SetTheme(sa);
|
||||
at->draw(C, ar);
|
||||
UI_SetTheme(NULL);
|
||||
}
|
||||
|
||||
if(sa)
|
||||
region_draw_emboss(ar);
|
||||
|
||||
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
|
||||
ED_region_pixelspace(ar);
|
||||
}
|
||||
else {
|
||||
float fac= 0.1*ar->swinid;
|
||||
|
||||
fac= fac - (int)fac;
|
||||
|
||||
glClearColor(0.5, fac, 1.0f-fac, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* swapbuffers indicator */
|
||||
fac= BLI_frand();
|
||||
glColor3f(fac, fac, fac);
|
||||
glRecti(20, 2, 30, 12);
|
||||
}
|
||||
|
||||
if(sa)
|
||||
region_draw_emboss(ar);
|
||||
|
||||
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
|
||||
ED_region_pixelspace(ar);
|
||||
|
||||
ar->do_draw= 0;
|
||||
}
|
||||
@ -230,6 +234,28 @@ void ED_area_tag_redraw(ScrArea *sa)
|
||||
}
|
||||
|
||||
|
||||
/* *************************************************************** */
|
||||
|
||||
/* use NULL to disable it */
|
||||
void ED_area_headerprint(ScrArea *sa, const char *str)
|
||||
{
|
||||
ARegion *ar;
|
||||
|
||||
for(ar= sa->regionbase.first; ar; ar= ar->next) {
|
||||
if(ar->regiontype==RGN_TYPE_HEADER) {
|
||||
if(str) {
|
||||
if(ar->headerstr==NULL)
|
||||
ar->headerstr= MEM_mallocN(256, "headerprint");
|
||||
BLI_strncpy(ar->headerstr, str, 256);
|
||||
}
|
||||
else if(ar->headerstr) {
|
||||
MEM_freeN(ar->headerstr);
|
||||
ar->headerstr= NULL;
|
||||
}
|
||||
ED_region_tag_redraw(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* *************************************************************** */
|
||||
|
||||
|
@ -1024,6 +1024,10 @@ void ED_region_exit(bContext *C, ARegion *ar)
|
||||
wm_subwindow_close(CTX_wm_window(C), ar->swinid);
|
||||
ar->swinid= 0;
|
||||
|
||||
if(ar->headerstr)
|
||||
MEM_freeN(ar->headerstr);
|
||||
ar->headerstr= NULL;
|
||||
|
||||
CTX_wm_region_set(C, prevar);
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,7 @@ typedef struct ARegion {
|
||||
ListBase uiblocks;
|
||||
ListBase handlers; /* wmEventHandler */
|
||||
|
||||
char *headerstr; /* use this string to draw info */
|
||||
void *regiondata; /* XXX 2.50, need spacedata equivalent? */
|
||||
} ARegion;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user