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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-21 20:18:36 +0300
committerTon Roosendaal <ton@blender.org>2008-12-21 20:18:36 +0300
commit4bb20689c5e0fa81d06fefdef4bd90057246979f (patch)
treec2f44992f201f714d6c539a6207244db302abfbf /source
parenteb8e220f26183fe92945247a45aabe9447871285 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/screen/Makefile1
-rw-r--r--source/blender/editors/screen/SConscript2
-rw-r--r--source/blender/editors/screen/area.c68
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/makesdna/DNA_screen_types.h1
7 files changed, 56 insertions, 22 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c0d23c8c495..94d215b877b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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;
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 06293090f6f..22b74ea3715 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -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);
diff --git a/source/blender/editors/screen/Makefile b/source/blender/editors/screen/Makefile
index 16ff8867eb0..1960ff28b16 100644
--- a/source/blender/editors/screen/Makefile
+++ b/source/blender/editors/screen/Makefile
@@ -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
diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript
index 57a8e1ac931..ce92a5454cb 100644
--- a/source/blender/editors/screen/SConscript
+++ b/source/blender/editors/screen/SConscript
@@ -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 = ''
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index fcee8726d9d..f90c247d69d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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);
- }
- else {
- float fac= 0.1*ar->swinid;
-
- fac= fac - (int)fac;
+ 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);
+ }
- glClearColor(0.5, fac, 1.0f-fac, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ if(sa)
+ region_draw_emboss(ar);
- /* swapbuffers indicator */
- fac= BLI_frand();
- glColor3f(fac, fac, fac);
- glRecti(20, 2, 30, 12);
+ /* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
+ ED_region_pixelspace(ar);
}
-
- 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);
+ }
+ }
+}
/* *************************************************************** */
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index cef98a7e901..1022fea605c 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -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);
}
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 486d160aad7..c932c0bd1b7 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -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;